[PATCH v2] qemu: Skip pre-creation of NVMe disks

Michal Privoznik posted 1 patch 3 years, 10 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/d3ebf89e4adbb12fbf1a5622748ab80fa92f0498.1590503307.git.mprivozn@redhat.com
src/qemu/qemu_migration.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
[PATCH v2] qemu: Skip pre-creation of NVMe disks
Posted by Michal Privoznik 3 years, 10 months ago
Upon migration with disks, libvirt determines if each disk exists
on the destination and tries to pre-create missing ones. Well,
NVMe disks can't be pre-created, but they can be checked for
presence.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1823639

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---

Technically, this is a v2 of:

https://www.redhat.com/archives/libvir-list/2020-May/msg00253.html

but I've taken what I'm suggesting in a BZ comment and posting it as a
patch.

 src/qemu/qemu_migration.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 02e8271e42..7ee5b5eda8 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -315,6 +315,7 @@ qemuMigrationDstPrecreateStorage(virDomainObjPtr vm,
     for (i = 0; i < nbd->ndisks; i++) {
         virDomainDiskDefPtr disk;
         const char *diskSrcPath;
+        g_autofree char *nvmePath = NULL;
 
         VIR_DEBUG("Looking up disk target '%s' (capacity=%llu)",
                   nbd->disks[i].target, nbd->disks[i].capacity);
@@ -326,7 +327,12 @@ qemuMigrationDstPrecreateStorage(virDomainObjPtr vm,
             goto cleanup;
         }
 
-        diskSrcPath = virDomainDiskGetSource(disk);
+        if (disk->src->type == VIR_STORAGE_TYPE_NVME) {
+            virPCIDeviceAddressGetSysfsFile(&disk->src->nvme->pciAddr, &nvmePath);
+            diskSrcPath = nvmePath;
+        } else {
+            diskSrcPath = virDomainDiskGetSource(disk);
+        }
 
         /* Skip disks we don't want to migrate and already existing disks. */
         if (!qemuMigrationAnyCopyDisk(disk, nmigrate_disks, migrate_disks) ||
-- 
2.26.2

Re: [PATCH v2] qemu: Skip pre-creation of NVMe disks
Posted by Ján Tomko 3 years, 10 months ago
technically, the pre-creation was never there, you just fix the
detection of existing disks here,

but I don't have a better phrasing for the commit summary

On a Tuesday in 2020, Michal Privoznik wrote:
>Upon migration with disks, libvirt determines if each disk exists
>on the destination and tries to pre-create missing ones. Well,
>NVMe disks can't be pre-created, but they can be checked for
>presence.
>
>Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1823639
>
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
>
>Technically, this is a v2 of:
>
>https://www.redhat.com/archives/libvir-list/2020-May/msg00253.html
>
>but I've taken what I'm suggesting in a BZ comment and posting it as a
>patch.
>
> src/qemu/qemu_migration.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano