all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server] block job: mirror: always detach the target node upon error
Date: Mon, 28 Jul 2025 12:06:36 +0200	[thread overview]
Message-ID: <20250728100702.38685-1-f.ebner@proxmox.com> (raw)

For example, attempting to live-migrate a disk again after failure
would not work, because a node with the same name would still be
attached.

Mirroring the disk to a shared storage after VM live-migration failure
and then attempting VM live-migration again, would result in

> migration status error: failed - Error in migration completion: Input/output error

This is because for migration completion, all attached block devices
are flushed, but the NBD export does not exist on the target side
anymore.

Fixes: 1da91175 ("block job: add blockdev mirror")
Reported-by: Hannes Dürr <h.duerr@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/QemuServer/BlockJob.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/PVE/QemuServer/BlockJob.pm b/src/PVE/QemuServer/BlockJob.pm
index 9c04600b..f742b184 100644
--- a/src/PVE/QemuServer/BlockJob.pm
+++ b/src/PVE/QemuServer/BlockJob.pm
@@ -28,6 +28,9 @@ sub qemu_handle_concluded_blockjob {
     eval { mon_cmd($vmid, 'job-dismiss', id => $job_id); };
     log_warn("$job_id: failed to dismiss job - $@") if $@;
 
+    # If there was an error, always detach the target.
+    $job->{'detach-node-name'} = $job->{'target-node-name'} if $qmp_info->{error};
+
     if (my $node_name = $job->{'detach-node-name'}) {
         eval { PVE::QemuServer::Blockdev::detach($vmid, $node_name); };
         log_warn($@) if $@;
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

             reply	other threads:[~2025-07-28 10:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-28 10:06 Fiona Ebner [this message]
2025-07-28 12:08 ` Hannes Duerr
2025-07-29  6:08 ` 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=20250728100702.38685-1-f.ebner@proxmox.com \
    --to=f.ebner@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal