]> git.proxmox.com Git - qemu-server.git/commitdiff
fix #2493: show QEMU errors in migration log
authorStefan Reiter <s.reiter@proxmox.com>
Mon, 9 Dec 2019 15:14:09 +0000 (16:14 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 12 Dec 2019 12:36:19 +0000 (13:36 +0100)
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>
PVE/QemuMigrate.pm
PVE/QemuServer.pm

index b5ec45c54ee243eb842d61d2ee7b6121930c3c31..035345889306c0a72c068f8c4d467f5e5d7906cb 100644 (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;
index 45fee3cae9ab14e4c6e20df84474d746a9e679da..c5330702cc9a1ae818c8642ad50a22de94174302 100644 (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',