[PATCH v2 2/6] qemu: move memory size align to qemuProcessPrepareDomain()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
 src/qemu/qemu_command.c | 3 ---
 src/qemu/qemu_process.c | 6 ++++++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 34b5746c1a..2bcdb28244 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9792,9 +9792,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 3677da635c..39c3edf4b9 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)
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux