[pve-devel] [PATCH qemu-server] block job: mirror: always detach the target node upon error
Fiona Ebner
f.ebner at proxmox.com
Mon Jul 28 12:06:36 CEST 2025
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 at proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner at 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
More information about the pve-devel
mailing list