public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 1/2] vm_resume: fix nocheck/migrate handling
Date: Mon, 21 Nov 2022 13:16:04 +0100	[thread overview]
Message-ID: <20221121121605.1217-1-f.gruenbichler@proxmox.com> (raw)

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 | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 721633d8..29110c0f 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -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'));
 	}
-- 
2.30.2





             reply	other threads:[~2022-11-21 12:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21 12:16 Fabian Grünbichler [this message]
2022-11-21 12:16 ` [pve-devel] [PATCH qemu-server 2/2] explain 'nocheck' in more places Fabian Grünbichler
2022-11-21 13:08 ` [pve-devel] applied: [PATCH qemu-server 1/2] vm_resume: fix nocheck/migrate handling Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221121121605.1217-1-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal