]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuMigrationSrcBeginPhase: Require storage migration when 'migrate_disks' parameter...
authorPeter Krempa <pkrempa@redhat.com>
Wed, 9 Aug 2023 12:18:58 +0000 (14:18 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 10 Aug 2023 12:53:27 +0000 (14:53 +0200)
If a user passes a list of disks to migrate but don't actually use
'VIR_MIGRATE_NON_SHARED_DISK' or 'VIR_MIGRATE_NON_SHARED_INC' flags the
parameter would be simply ignored without informing the user of the
error.

Add a proper error in such case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_migration.c

index a3fe6be4e97fcbdc1c15d1071e53c8fce1513b9b..d21551ab07d96dcb6fe35c290b37178a6a18f126 100644 (file)
@@ -2644,6 +2644,12 @@ qemuMigrationSrcBeginPhase(virQEMUDriver *driver,
                                                      migrate_disks,
                                                      nmigrate_disks))
             cookieFlags |= QEMU_MIGRATION_COOKIE_NBD;
+    } else {
+        if (nmigrate_disks > 0) {
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                           _("use of 'VIR_MIGRATE_PARAM_MIGRATE_DISKS' requires use of 'VIR_MIGRATE_NON_SHARED_DISK' or 'VIR_MIGRATE_NON_SHARED_INC' flag"));
+            return NULL;
+        }
     }
 
     if (virDomainDefHasMemoryHotplug(vm->def) ||