]> git.proxmox.com Git - qemu-server.git/commitdiff
migrate: log which local resource causes error
authorTim Marx <t.marx@proxmox.com>
Fri, 3 May 2019 12:22:39 +0000 (14:22 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 7 May 2019 10:22:12 +0000 (10:22 +0000)
Signed-off-by: Tim Marx <t.marx@proxmox.com>
PVE/QemuMigrate.pm
PVE/QemuServer.pm

index e915a9a95c5e7d6109739fbd9b0681d001c637de..bc83816ac95a7053e699e6ff588bcf2e14de9202 100644 (file)
@@ -218,10 +218,10 @@ sub prepare {
        $self->{forcemachine} = PVE::QemuServer::qemu_machine_pxe($vmid, $conf);
 
     }
        $self->{forcemachine} = PVE::QemuServer::qemu_machine_pxe($vmid, $conf);
 
     }
-
-    if (my $loc_res = PVE::QemuServer::check_local_resources($conf, 1)) {
+    my $loc_res = PVE::QemuServer::check_local_resources($conf, 1);
+    if (scalar @$loc_res) {
        if ($self->{running} || !$self->{opts}->{force}) {
        if ($self->{running} || !$self->{opts}->{force}) {
-           die "can't migrate VM which uses local devices\n";
+           die "can't migrate VM which uses local devices: " . join(", ", @$loc_res) . "\n";
        } else {
            $self->log('info', "migrating VM which uses local devices");
        }
        } else {
            $self->log('info', "migrating VM which uses local devices");
        }
index ee4fbd3f4d21689bb6050798f07ce249f36de2a9..9d560ec3a91031d95fe6fd056e3f2c8298514a7c 100644 (file)
@@ -2846,23 +2846,23 @@ sub config_list {
 sub check_local_resources {
     my ($conf, $noerr) = @_;
 
 sub check_local_resources {
     my ($conf, $noerr) = @_;
 
-    my $loc_res = 0;
+    my @loc_res = ();
 
 
-    $loc_res = 1 if $conf->{hostusb}; # old syntax
-    $loc_res = 1 if $conf->{hostpci}; # old syntax
+    push @loc_res, "hostusb" if $conf->{hostusb}; # old syntax
+    push @loc_res, "hostpci" if $conf->{hostpci}; # old syntax
 
 
-    $loc_res = 1 if $conf->{ivshmem};
+    push @loc_res, "ivshmem" if $conf->{ivshmem};
 
     foreach my $k (keys %$conf) {
        next if $k =~ m/^usb/ && ($conf->{$k} eq 'spice');
        # sockets are safe: they will recreated be on the target side post-migrate
        next if $k =~ m/^serial/ && ($conf->{$k} eq 'socket');
 
     foreach my $k (keys %$conf) {
        next if $k =~ m/^usb/ && ($conf->{$k} eq 'spice');
        # sockets are safe: they will recreated be on the target side post-migrate
        next if $k =~ m/^serial/ && ($conf->{$k} eq 'socket');
-       $loc_res = 1 if $k =~ m/^(usb|hostpci|serial|parallel)\d+$/;
+       push @loc_res, $k if $k =~ m/^(usb|hostpci|serial|parallel)\d+$/;
     }
 
     }
 
-    die "VM uses local resources\n" if $loc_res && !$noerr;
+    die "VM uses local resources\n" if scalar @loc_res && !$noerr;
 
 
-    return $loc_res;
+    return \@loc_res;
 }
 
 # check if used storages are available on all nodes (use by migrate)
 }
 
 # check if used storages are available on all nodes (use by migrate)