[PATCH 0/2] qemu: migration fixes

Peter Krempa (2): qemu: migration: Validate migration XML virsh: migrate: Interlock '--copy-storage-all' and '--copy-storage-inc' src/qemu/qemu_migration.c | 9 +++------ tools/virsh-domain.c | 1 + 2 files changed, 4 insertions(+), 6 deletions(-) -- 2.43.0

There's no point in skiping the validation step: - on the source, the VM is parsed for ABI stability checking, thus the equivalent config was validated when the VM was started - on the destination, the XML will be validated inside qemuProcessInit very soon after it is parsed This fixes problems such as if the user uses a relative path in the disk source or omits the source, as the disk migration code reasonably expects that all checks were performed. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_migration.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index f9c34b72e8..a5488fd477 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2523,8 +2523,7 @@ qemuMigrationSrcBeginXML(virDomainObj *vm, g_autoptr(virDomainDef) def = NULL; if (!(def = virDomainDefParseString(xmlin, driver->xmlopt, priv->qemuCaps, - VIR_DOMAIN_DEF_PARSE_INACTIVE | - VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE))) + VIR_DOMAIN_DEF_PARSE_INACTIVE))) return NULL; if (!qemuDomainCheckABIStability(driver, vm, def)) @@ -3316,8 +3315,7 @@ qemuMigrationDstPrepareFresh(virQEMUDriver *driver, VIR_DEBUG("Using hook-filtered domain XML: %s", xmlout); newdef = virDomainDefParseString(xmlout, driver->xmlopt, NULL, - VIR_DOMAIN_DEF_PARSE_INACTIVE | - VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE); + VIR_DOMAIN_DEF_PARSE_INACTIVE); if (!newdef) goto cleanup; @@ -3843,8 +3841,7 @@ qemuMigrationAnyPrepareDef(virQEMUDriver *driver, if (!(def = virDomainDefParseString(dom_xml, driver->xmlopt, qemuCaps, - VIR_DOMAIN_DEF_PARSE_INACTIVE | - VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE))) + VIR_DOMAIN_DEF_PARSE_INACTIVE))) goto cleanup; if (dname) { -- 2.43.0

The API treats them as mutually exclusive and interlocks them at the library handler. Provide better error in virsh. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tools/virsh-domain.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 66f933dead..afb8c401da 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -11518,6 +11518,7 @@ cmdMigrate(vshControl *ctl, const vshCmd *cmd) VSH_EXCLUSIVE_OPTIONS("live", "offline"); VSH_EXCLUSIVE_OPTIONS("timeout-suspend", "timeout-postcopy"); + VSH_EXCLUSIVE_OPTIONS("copy-storage-all", "copy-storage-inc"); VSH_REQUIRE_OPTION("postcopy-after-precopy", "postcopy"); VSH_REQUIRE_OPTION("postcopy-resume", "postcopy"); VSH_REQUIRE_OPTION("timeout-postcopy", "postcopy"); -- 2.43.0

On 12/5/23 17:51, Peter Krempa wrote:
Peter Krempa (2): qemu: migration: Validate migration XML virsh: migrate: Interlock '--copy-storage-all' and '--copy-storage-inc'
src/qemu/qemu_migration.c | 9 +++------ tools/virsh-domain.c | 1 + 2 files changed, 4 insertions(+), 6 deletions(-)
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Michal
participants (2)
-
Michal Prívozník
-
Peter Krempa