5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-03-08 04:58:26 +03:00

fix #2493: show QEMU errors in migration log

QEMU usually only prints warnings and errors and stays silent otherwise,
so it makes sense to just log all of it's output.

Prefix it with '[<target_hostname>]' to indicate that the output is
coming from the remote node, so users know where to search for the
error.

Side effect is that the 'VM start' task created by the migration will
now show the "QEMU:" prefix, but it's still very readable IMHO.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
Stefan Reiter 2019-12-09 16:14:09 +01:00 committed by Thomas Lamprecht
parent 6e0216d862
commit 8bf30c2a72
2 changed files with 15 additions and 1 deletions

View File

@ -625,10 +625,12 @@ sub phase2 {
$self->{target_drive}->{$targetdrive}->{volid} = $volid;
$self->{target_drive}->{$targetdrive}->{nbd_uri} = $nbd_uri;
} elsif ($line =~ m/^QEMU: (.*)$/) {
$self->log('info', "[$self->{node}] $1\n");
}
}, errfunc => sub {
my $line = shift;
$self->log('info', $line);
$self->log('info', "[$self->{node}] $line");
}, noerr => 1);
die "remote command failed with exit code $exitcode\n" if $exitcode;

View File

@ -5411,6 +5411,18 @@ sub vm_start {
noerr => 1,
);
# when migrating, prefix QEMU output so other side can pick up any
# errors that might occur and show the user
if ($migratedfrom) {
$run_params{quiet} = 1;
$run_params{logfunc} = sub {
my $msg = shift;
return if !$msg;
chomp $msg;
print "QEMU: $msg\n";
};
}
my %properties = (
Slice => 'qemu.slice',
KillMode => 'none',