While it's intended that qemuMigrationDstPrecreateDisk is called with any kind of the disk, the logic in qemuMigrationDstPrecreateStorage which checks the existence of the image wouldn't properly handle e.g. network backed disks, where it would attempt to use virFileExists() on the disk's 'src->path'. Fix the logic by first skipping disks not meant for migration, then do the existence check only when 'disk->src' is local storage. Since qemuMigrationDstPrecreateDisk has a debug statement there's no need to have an extra one right before calling into it. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_migration.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 15032512e2..a6cfede49f 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -448,7 +448,7 @@ qemuMigrationDstPrecreateStorage(virDomainObj *vm, for (i = 0; i < nbd->ndisks; i++) { virDomainDiskDef *disk; - const char *diskSrcPath; + const char *diskSrcPath = NULL; g_autofree char *nvmePath = NULL; VIR_DEBUG("Looking up disk target '%s' (capacity=%llu)", @@ -461,19 +461,28 @@ qemuMigrationDstPrecreateStorage(virDomainObj *vm, return -1; } + /* Skip disks we don't want to migrate. */ + if (!qemuMigrationAnyCopyDisk(disk, nmigrate_disks, migrate_disks)) + continue; + if (disk->src->type == VIR_STORAGE_TYPE_NVME) { virPCIDeviceAddressGetSysfsFile(&disk->src->nvme->pciAddr, &nvmePath); diskSrcPath = nvmePath; - } else { + } else if (virStorageSourceIsLocalStorage(disk->src)) { diskSrcPath = virDomainDiskGetSource(disk); } - /* Skip disks we don't want to migrate and already existing disks. */ - if (!qemuMigrationAnyCopyDisk(disk, nmigrate_disks, migrate_disks) || - (diskSrcPath && virFileExists(diskSrcPath))) { - continue; + if (diskSrcPath) { + + /* don't pre-create existing disks */ + if (virFileExists(diskSrcPath)) { + VIR_DEBUG("Skipping pre-create of existing source for disk '%s'", disk->dst); + continue; + } } + /* create the storage - if supported */ + if (incremental) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("pre-creation of storage target '%1$s' for incremental storage migration of disk '%2$s' is not supported"), @@ -481,8 +490,6 @@ qemuMigrationDstPrecreateStorage(virDomainObj *vm, return -1; } - VIR_DEBUG("Proceeding with disk source %s", NULLSTR(diskSrcPath)); - if (qemuMigrationDstPrecreateDisk(&conn, disk, nbd->disks[i].capacity) < 0) return -1; } -- 2.43.0 _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx