5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-07 17:17:57 +03:00

migrate : add nocheck for resume

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>
This commit is contained in:
Alexandre Derumier 2015-10-14 11:06:06 +02:00 committed by Dietmar Maurer
parent 9accf2d797
commit 289e0b8564
3 changed files with 17 additions and 7 deletions

View 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;
};

View 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;

View 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");
}
});
}