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>
node => get_standard_option('pve-node'),
vmid => get_standard_option('pve-vmid'),
skiplock => get_standard_option('skiplock'),
+ nocheck => { type => 'boolean', optional => 1 },
+
},
},
returns => {
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;
};
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;
}
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");
+ }
});
}