diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm index 6d717c8f..3a8942b4 100644 --- a/PVE/QemuMigrate.pm +++ b/PVE/QemuMigrate.pm @@ -117,7 +117,7 @@ sub finish_tunnel { sub lock_vm { my ($self, $vmid, $code, @param) = @_; - + return PVE::QemuServer::lock_config($vmid, $code, @param); } @@ -280,7 +280,7 @@ sub phase1_cleanup { if (my $err = $@) { $self->log('err', $err); } - + if ($self->{volumes}) { foreach my $volid (@{$self->{volumes}}) { $self->log('err', "found stale volume copy '$volid' on node '$self->{node}'"); @@ -343,7 +343,7 @@ sub phase2 { $self->log('info', "migration speed: $mbps MB/s"); } } - + if ($stat->{status} eq 'failed' || $stat->{status} eq 'cancelled') { die "aborting\n" } @@ -390,7 +390,7 @@ sub phase2_cleanup { sub phase3 { my ($self, $vmid) = @_; - + my $volids = $self->{volumes}; # destroy local copies @@ -416,18 +416,16 @@ sub phase3_cleanup { die "Failed to move config to node '$self->{node}' - rename failed: $!\n" if !rename($conffile, $newconffile); - ## now that config file is move, we can resume vm on target if livemigrate + # now that config file is move, we can resume vm on target if livemigrate if ($self->{tunnel}) { - my $cmd = [@{$self->{rem_ssh}}, 'qm', 'resume', $vmid, '--skiplock']; eval{ PVE::Tools::run_command($cmd, outfunc => sub {}, errfunc => sub {}) }; - if (my $err = $@) { + if (my $err = $@) { $self->log('err', $err); $self->{errors} = 1; } } - # always stop local VM eval { PVE::QemuServer::vm_stop($self->{storecfg}, $vmid, 1, 1); }; if (my $err = $@) { diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index db8da387..f19d52b0 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -1940,7 +1940,7 @@ sub vmstatus { } } - return $res if !$full; + return $res if !$full; my $qmpclient = PVE::QMPClient->new(); @@ -2588,7 +2588,7 @@ sub qemu_block_set_io_throttle { } -# old code, only used to shutdown old VM after update +# old code, only used to shutdown old VM after update sub __read_avail { my ($fh, $timeout) = @_; @@ -2617,14 +2617,14 @@ sub __read_avail { } die "monitor read timeout\n" if !scalar(@ready); - + return $res; } -# old code, only used to shutdown old VM after update +# old code, only used to shutdown old VM after update sub vm_monitor_command { my ($vmid, $cmdstr, $nocheck) = @_; - + my $res; eval { @@ -2678,9 +2678,9 @@ sub vm_monitor_command { if ($res = __read_avail($sock, $timeout)) { my @lines = split("\r?\n", $res); - + shift @lines if $lines[0] !~ m/^unknown command/; # skip echo - + $res = join("\n", @lines); $res .= "\n"; } @@ -2692,7 +2692,7 @@ sub vm_monitor_command { syslog("err", "VM $vmid monitor command failed - $err"); die $err; } - + return $res; } @@ -2811,7 +2811,7 @@ sub vm_qmp_command { eval { die "VM $vmid not running\n" if !check_running($vmid, $nocheck); my $sname = PVE::QemuServer::qmp_socket($vmid); - if (-e $sname) { + if (-e $sname) { my $qmpclient = PVE::QMPClient->new(); $res = $qmpclient->cmd($vmid, $cmd); @@ -2836,7 +2836,7 @@ sub vm_human_monitor_command { my $res; - my $cmd = { + my $cmd = { execute => 'human-monitor-command', arguments => { 'command-line' => $cmdline}, }; @@ -3019,7 +3019,7 @@ sub vm_sendkey { lock_config($vmid, sub { my $conf = load_config($vmid); - + # there is no qmp command, so we use the human monitor command vm_human_monitor_command($vmid, "sendkey $key"); });