From: Daniel Henrique Barboza Date: Wed, 18 Nov 2020 18:12:51 +0000 (-0300) Subject: qemu: move memory size align to qemuProcessPrepareDomain() X-Git-Tag: v7.0.0-rc1~330 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5a34d0667decd233f4f2319f742920dc52073d4e;p=thirdparty%2Flibvirt.git qemu: move memory size align to qemuProcessPrepareDomain() qemuBuildCommandLine() is calling qemuDomainAlignMemorySizes(), which is an operation that changes live XML and domain and has little to do with the command line build process. Move it to qemuProcessPrepareDomain() where we're supposed to make live XML and domain changes before launch. qemuProcessStart() is setting VIR_QEMU_PROCESS_START_NEW if !migrate && !snapshot, same conditions used in qemuBuildCommandLine() to call qemuDomainAlignMemorySizes(), making this change seamless. Reviewed-by: Michal Privoznik Signed-off-by: Daniel Henrique Barboza --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 33f9b96bf8..5aff89188a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9841,9 +9841,6 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, qemuBuildDomainLoaderCommandLine(cmd, def, qemuCaps); - if (!migrateURI && !snapshot && qemuDomainAlignMemorySizes(def) < 0) - return NULL; - if (qemuBuildMemCommandLine(cmd, def, qemuCaps, priv) < 0) return NULL; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 27a22c950d..9d83825190 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6493,6 +6493,12 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver, if (qemuExtDevicesPrepareDomain(driver, vm) < 0) return -1; + if (flags & VIR_QEMU_PROCESS_START_NEW) { + VIR_DEBUG("Aligning guest memory"); + if (qemuDomainAlignMemorySizes(vm->def) < 0) + return -1; + } + for (i = 0; i < vm->def->nchannels; i++) { if (qemuDomainPrepareChannel(vm->def->channels[i], priv->channelTargetDir) < 0)