On Tue, Sep 08, 2020 at 03:17:47PM +0200, Peter Krempa wrote:
On Fri, Aug 28, 2020 at 10:08:35 -0400, Masayoshi Mizuma wrote:
> From: Masayoshi Mizuma <m.mizuma(a)jp.fujitsu.com>
>
> Block migration when transient disk option is enabled because migration
> requires some blockjobs.
>
> Signed-off-by: Masayoshi Mizuma <m.mizuma(a)jp.fujitsu.com>
> ---
> src/qemu/qemu_migration.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 0f2f92b211..6fcf5a3a07 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -2949,6 +2949,22 @@ qemuMigrationDstPrepareDirect(virQEMUDriverPtr driver,
> }
>
>
> +static bool
> +qemuMigrationTransientDiskExists(virDomainDefPtr def)
> +{
> + size_t i;
> +
> + for (i = 0; i < def->ndisks; i++) {
> + virDomainDiskDefPtr disk = def->disks[i];
> +
> + if (disk->transient)
> + return true;
> + }
> +
> + return false;
> +}
> +
> +
> virDomainDefPtr
> qemuMigrationAnyPrepareDef(virQEMUDriverPtr driver,
> virQEMUCapsPtr qemuCaps,
> @@ -2971,6 +2987,12 @@ qemuMigrationAnyPrepareDef(virQEMUDriverPtr driver,
> VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
> goto cleanup;
>
> + /*
> + * transient disk option is a blocker for migration
> + */
> + if (qemuMigrationTransientDiskExists(def))
> + goto cleanup;
This should really be placed into qemuMigrationSrcIsAllowed() rather
than open-coded. Migration is used in other places too and doesn't use
this API to trigger it.
OK, I'll add the following to block the migration.
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index a530c17582..7316d74677 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1397,6 +1397,16 @@ qemuMigrationSrcIsAllowed(virQEMUDriverPtr driver,
_("cannot migrate this domain without dbus-vmstate
support"));
return false;
}
+
+ for (i = 0; i < vm->def->ndisks; i++) {
+ virDomainDiskDefPtr disk = vm->def->disks[i];
+
+ if (disk->transient) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("migration with transient disk is not
supported"));
+ return false;
+ }
+ }
}
return true;