migrate: add some more log output

Output all errors - if any - and add some log outputs on what we qmp
commands we do with which parameters, may be helpful when debugging
or analyzing a users problem.

Also check if the queried status is defined, as on a error this may
not be.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2016-06-03 11:32:02 +02:00 committed by Dietmar Maurer
parent 92437b8de0
commit f34d146679

View File

@ -477,6 +477,7 @@ sub phase2 {
$self->log('info', "migrate_set_downtime error: $@") if $@; $self->log('info', "migrate_set_downtime error: $@") if $@;
} }
$self->log('info', "set migration_caps");
eval { eval {
PVE::QemuServer::set_migration_caps($vmid); PVE::QemuServer::set_migration_caps($vmid);
}; };
@ -484,10 +485,12 @@ sub phase2 {
#set cachesize 10% of the total memory #set cachesize 10% of the total memory
my $cachesize = int($conf->{memory}*1048576/10); my $cachesize = int($conf->{memory}*1048576/10);
$self->log('info', "set cachesize: $cachesize");
eval { eval {
PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate-set-cache-size", value => $cachesize); PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate-set-cache-size", value => int($cachesize));
}; };
$self->log('info', "migrate-set-cache-size error: $@") if $@;
if (PVE::QemuServer::vga_conf_has_spice($conf->{vga})) { if (PVE::QemuServer::vga_conf_has_spice($conf->{vga})) {
my $rpcenv = PVE::RPCEnvironment::get(); my $rpcenv = PVE::RPCEnvironment::get();
my $authuser = $rpcenv->get_user(); my $authuser = $rpcenv->get_user();
@ -508,6 +511,7 @@ sub phase2 {
} }
$self->log('info', "start migrate command to $ruri");
eval { eval {
PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate", uri => $ruri); PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate", uri => $ruri);
}; };
@ -532,6 +536,7 @@ sub phase2 {
if (my $err = $@) { if (my $err = $@) {
$err_count++; $err_count++;
warn "query migrate failed: $err\n"; warn "query migrate failed: $err\n";
$self->log('info', "query migrate failed: $err");
if ($err_count <= 5) { if ($err_count <= 5) {
usleep(1000000); usleep(1000000);
next; next;
@ -539,12 +544,12 @@ sub phase2 {
die "too many query migrate failures - aborting\n"; die "too many query migrate failures - aborting\n";
} }
if ($stat->{status} =~ m/^(setup)$/im) { if (defined($stat->{status}) && $stat->{status} =~ m/^(setup)$/im) {
sleep(1); sleep(1);
next; next;
} }
if ($stat->{status} =~ m/^(active|completed|failed|cancelled)$/im) { if (defined($stat->{status}) && $stat->{status} =~ m/^(active|completed|failed|cancelled)$/im) {
$merr = undef; $merr = undef;
$err_count = 0; $err_count = 0;
if ($stat->{status} eq 'completed') { if ($stat->{status} eq 'completed') {
@ -557,6 +562,7 @@ sub phase2 {
} }
if ($stat->{status} eq 'failed' || $stat->{status} eq 'cancelled') { if ($stat->{status} eq 'failed' || $stat->{status} eq 'cancelled') {
$self->log('info', "migration status error: $stat->{status}");
die "aborting\n" die "aborting\n"
} }