]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuProcessStop: Reattach NVMe disks a domain is mirroring into
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 18 May 2020 13:11:49 +0000 (15:11 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 18 May 2020 13:14:27 +0000 (15:14 +0200)
If the mirror destination is not a file but a NVMe disk, then
call qemuHostdevReAttachOneNVMeDisk() to reattach the NVMe back
to the host.

This would be done by blockjob code when the job finishes, but in
this case the job won't finish - QEMU is killed meanwhile.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1825785
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_process.c

index 7e41695e03b0a75e0f87e2de1b25b0132e039bd3..7cdd19b393d874cac5f7927b3ce32189817a5808 100644 (file)
@@ -7600,6 +7600,9 @@ void qemuProcessStop(virQEMUDriverPtr driver,
             if (disk->mirror) {
                 if (qemuSecurityRestoreImageLabel(driver, vm, disk->mirror, false) < 0)
                     VIR_WARN("Unable to restore security label on %s", disk->dst);
+
+                if (virStorageSourceChainHasNVMe(disk->mirror))
+                    qemuHostdevReAttachOneNVMeDisk(driver, vm->def->name, disk->mirror);
             }
 
             qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->src);