[PATCH 2/4] qemuMigrationSrcBeginPhase: Require storage migration when 'migrate_disks' parameter is specified

Peter Krempa posted 4 patches 2 years, 6 months ago
[PATCH 2/4] qemuMigrationSrcBeginPhase: Require storage migration when 'migrate_disks' parameter is specified
Posted by Peter Krempa 2 years, 6 months ago
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>
---
 src/qemu/qemu_migration.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index a3fe6be4e9..9057590c94 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -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 the '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) ||
-- 
2.41.0
Re: [PATCH 2/4] qemuMigrationSrcBeginPhase: Require storage migration when 'migrate_disks' parameter is specified
Posted by Ján Tomko 2 years, 6 months ago
On a Wednesday in 2023, Peter Krempa wrote:
>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>
>---
> src/qemu/qemu_migration.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
>diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
>index a3fe6be4e9..9057590c94 100644
>--- a/src/qemu/qemu_migration.c
>+++ b/src/qemu/qemu_migration.c
>@@ -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 the 'VIR_MIGRATE_PARAM_MIGRATE_DISKS' requires use of 'VIR_MIGRATE_NON_SHARED_DISK' or 'VIR_MIGRATE_NON_SHARED_INC' flag"));

d/the/


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

Jano