]> git.proxmox.com Git - qemu-server.git/commitdiff
migrate : add nocheck for resume
authorAlexandre Derumier <aderumier@odiso.com>
Wed, 14 Oct 2015 09:06:06 +0000 (11:06 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 15 Oct 2015 10:41:13 +0000 (12:41 +0200)
Users have reported resume bug when HA is used.

They seem to have a little race (bench show >0s < 1s) between the vm conf file move on source node and replication to,
and resume on target node.

I don't known why this is only with HA, maybe this occur will standard migration too.

Anyway, we don't need to read the vm config file to resume the vm on target host,
as we are sure that the vm is migrated, and config file move action is correct in the cluster.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/API2/Qemu.pm
PVE/QemuMigrate.pm
PVE/QemuServer.pm

index 8bcc2bf0b35254f45c76c45db1417ac7cde2d3f1..3f16bcd3cc7bbe1bbbe0e2c12985879cb6a20d96 100644 (file)
@@ -1888,6 +1888,8 @@ __PACKAGE__->register_method({
            node => get_standard_option('pve-node'),
            vmid => get_standard_option('pve-vmid'),
            skiplock => get_standard_option('skiplock'),
+           nocheck => { type => 'boolean', optional => 1 },
+
        },
     },
     returns => {
@@ -1908,14 +1910,16 @@ __PACKAGE__->register_method({
        raise_param_exc({ skiplock => "Only root may use this option." })
            if $skiplock && $authuser ne 'root@pam';
 
-       die "VM $vmid not running\n" if !PVE::QemuServer::check_running($vmid);
+       my $nocheck = extract_param($param, 'nocheck');
+
+       die "VM $vmid not running\n" if !PVE::QemuServer::check_running($vmid, $nocheck);
 
        my $realcmd = sub {
            my $upid = shift;
 
            syslog('info', "resume VM $vmid: $upid\n");
 
-           PVE::QemuServer::vm_resume($vmid, $skiplock);
+           PVE::QemuServer::vm_resume($vmid, $skiplock, $nocheck);
 
            return;
        };
index 264a2a7608c15add1559c0263a05eba131e1d9b8..a1ee10aba7e162f750a8e82a6aec9474934e6f71 100644 (file)
@@ -584,7 +584,7 @@ sub phase3_cleanup {
 
     if ($self->{livemigration}) {
        # now that config file is move, we can resume vm on target if livemigrate
-       my $cmd = [@{$self->{rem_ssh}}, 'qm', 'resume', $vmid, '--skiplock'];
+       my $cmd = [@{$self->{rem_ssh}}, 'qm', 'resume', $vmid, '--skiplock', '--nocheck'];
        eval{ PVE::Tools::run_command($cmd, outfunc => sub {}, 
                errfunc => sub {
                    my $line = shift;
index 33b3a127f07b51153f34da6ee3c5263406017287..047cf97771730dfbeecec2602bfa3b21c526e37c 100644 (file)
@@ -4615,15 +4615,21 @@ sub vm_suspend {
 }
 
 sub vm_resume {
-    my ($vmid, $skiplock) = @_;
+    my ($vmid, $skiplock, $nocheck) = @_;
 
     lock_config($vmid, sub {
 
-       my $conf = load_config($vmid);
+       if (!$nocheck) {
 
-       check_lock($conf) if !($skiplock || ($conf->{lock} && $conf->{lock} eq 'backup'));
+           my $conf = load_config($vmid);
 
-       vm_mon_cmd($vmid, "cont");
+           check_lock($conf) if !($skiplock || ($conf->{lock} && $conf->{lock} eq 'backup'));
+
+           vm_mon_cmd($vmid, "cont");
+
+       } else {
+           vm_mon_cmd_nocheck($vmid, "cont");
+       }
     });
 }