[pve-devel] [PATCH v2 manager 10/11] refactor: check_running was moved to QemuConfig

Stefan Reiter s.reiter at proxmox.com
Mon Oct 28 12:59:22 CET 2019


Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
 PVE/API2/Nodes.pm          | 6 +++---
 test/ReplicationTestEnv.pm | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 9e731e05..0f30a518 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -1729,7 +1729,7 @@ __PACKAGE__->register_method ({
 			} elsif ($d->{type} eq 'qemu') {
 			    $typeText = 'VM';
 			    $default_delay = 3; # to reduce load
-			    return if PVE::QemuServer::check_running($vmid, 1);
+			    return if PVE::QemuConfig::check_running($vmid, 1);
 			    print STDERR "Starting VM $vmid\n";
 			    $upid = PVE::API2::Qemu->vm_start({node => $nodename, vmid => $vmid });
 			} else {
@@ -1775,7 +1775,7 @@ my $create_stop_worker = sub {
 	$upid = PVE::API2::LXC::Status->vm_shutdown({node => $nodename, vmid => $vmid,
 					     timeout => $timeout, forceStop => 1 });
     } elsif ($type eq 'qemu') {
-	return if !PVE::QemuServer::check_running($vmid, 1);
+	return if !PVE::QemuConfig::check_running($vmid, 1);
 	my $timeout =  defined($down_timeout) ? int($down_timeout) : 60*3;
 	print STDERR "Stopping VM $vmid (timeout = $timeout seconds)\n";
 	$upid = PVE::API2::Qemu->vm_shutdown({node => $nodename, vmid => $vmid,
@@ -1894,7 +1894,7 @@ my $create_migrate_worker = sub {
 	$upid = PVE::API2::LXC->migrate_vm({node => $nodename, vmid => $vmid, target => $target,
 					    restart => $online });
     } elsif ($type eq 'qemu') {
-	my $online = PVE::QemuServer::check_running($vmid, 1) ? 1 : 0;
+	my $online = PVE::QemuConfig::check_running($vmid, 1) ? 1 : 0;
 	print STDERR "Migrating VM $vmid\n";
 	$upid = PVE::API2::Qemu->migrate_vm({node => $nodename, vmid => $vmid, target => $target,
 					     online => $online });
diff --git a/test/ReplicationTestEnv.pm b/test/ReplicationTestEnv.pm
index fa106037..242e3842 100755
--- a/test/ReplicationTestEnv.pm
+++ b/test/ReplicationTestEnv.pm
@@ -249,7 +249,7 @@ sub setup {
 	lock => sub { $mocked_cfs_lock_file->('replication.cfg', undef, $_[0]); },
 	write => sub { $mocked_cfs_write_file->('replication.cfg', $_[0]); },
     );
-    $pve_qemuserver_module->mock(check_running => sub { return 0; });
+    $pve_qemuconfig_module->mock(check_running => sub { return 0; });
     $pve_qemuconfig_module->mock(load_config => $mocked_qemu_load_conf);
 
     $pve_lxc_config_module->mock(load_config => $mocked_lxc_load_conf);
-- 
2.20.1





More information about the pve-devel mailing list