]> git.proxmox.com Git - qemu-server.git/commitdiff
vm_resume: fix nocheck/migrate handling
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 21 Nov 2022 12:16:04 +0000 (13:16 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 21 Nov 2022 12:42:52 +0000 (13:42 +0100)
it's not deterministic whether the rename/move of the VM config
triggered on the source side of a migration is already visible on the
target side when vm_resume is executed. check the vmlist for the node
where the config is currently located if $nocheck is set - it is now
needed to add the forwarding DB entries to the bridge.

this fixes an issue on busier or slower clusters, where pmxcfs hasn't
yet processed the rename, and resuming would fail with an error about
the config not existing.

Reported-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
PVE/QemuServer.pm

index 721633d8d956c6920dbc06720ffb0d6a2019a146..caaf1a5a8bdad57ee0001667de6eb93e30cd8251 100644 (file)
@@ -6366,7 +6366,17 @@ sub vm_resume {
        my $res = mon_cmd($vmid, 'query-status');
        my $resume_cmd = 'cont';
        my $reset = 0;
-       my $conf = PVE::QemuConfig->load_config($vmid);
+       my $conf;
+       if ($nocheck) {
+           my $vmlist = PVE::Cluster::get_vmlist();
+           my $node;
+           if (exists($vmlist->{ids}->{$vmid})) {
+               $node = $vmlist->{ids}->{$vmid}->{node};
+           }
+           $conf = PVE::QemuConfig->load_config($vmid, $node);
+       } else {
+           $conf = PVE::QemuConfig->load_config($vmid);
+       }
 
        if ($res->{status}) {
            return if $res->{status} eq 'running'; # job done, go home
@@ -6375,7 +6385,6 @@ sub vm_resume {
        }
 
        if (!$nocheck) {
-
            PVE::QemuConfig->check_lock($conf)
                if !($skiplock || PVE::QemuConfig->has_lock($conf, 'backup'));
        }