On Thu, Feb 19, 2015 at 04:38:28PM +0100, Peter Krempa wrote:
To enable memory hotplug the maximum memory size and slot count need
to
be specified. As qemu supports now other units than mebibytes when
specifying memory, use the new interface in this case.
---
docs/formatdomain.html.in | 2 +-
src/qemu/qemu_command.c | 34 ++++++++++++++++++----
src/qemu/qemu_domain.c | 8 ++---
.../qemuxml2argv-memory-hotplug-nonuma.xml | 22 ++++++++++++++
.../qemuxml2argv-memory-hotplug.args | 6 ++++
.../qemuxml2argv-memory-hotplug.xml | 34 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 4 +++
tests/qemuxml2xmltest.c | 3 ++
8 files changed, 102 insertions(+), 11 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nonuma.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug.xml
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7b83f9f..d9666c3 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8313,13 +8313,35 @@ qemuBuildCommandLine(virConnectPtr conn,
if (qemuDomainAlignMemorySizes(def) < 0)
goto error;
- /* Set '-m MB' based on maxmem, because the lower 'memory' limit
- * is set post-startup using the balloon driver. If balloon driver
- * is not supported, then they're out of luck anyway. Update the
- * XML to reflect our rounding.
- */
virCommandAddArg(cmd, "-m");
- virCommandAddArgFormat(cmd, "%llu", virDomainDefGetMemoryInitial(def) /
1024);
+
+ if (def->mem.max_memory || def->mem.memory_slots) {
Bit more cofusing, having this one one place:
(def->mem.memory_slots && def->mem.max_memory)
and this one second one:
(def->mem.max_memory || def->mem.memory_slots)
but that's just a detail (unless we drift off and with the values and
end up with only one being set).
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 39ed66b..92b5fc5 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1533,6 +1533,10 @@ mymain(void)
DO_TEST_PARSE_ERROR("shmem-msi-only", NONE);
DO_TEST("cpu-host-passthrough-features", QEMU_CAPS_KVM,
QEMU_CAPS_CPU_HOST);
+ DO_TEST_FAILURE("memory-hotplug-nonuma", QEMU_CAPS_DEVICE_PC_DIMM);
+ DO_TEST_FAILURE("memory-hotplug", 0);
Use NONE instead '0', please.
ACK with this ^^ one thing change changed.