From 389634e6670a8cc2eea1c2886bcc65b248d92fad Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 17 Feb 2015 16:53:25 +0100 Subject: [PATCH] qemu: Forbid setting maximum memory size with the API with NUMA enabled NUMA enabled guest configuration explicitly specifies memory sizes for individual nodes. Allowing the virDomainSetMemoryFlags API (and friends) to change the total doesn't make sense as the individual node configs are not updated in that case. Forbid use of the API in case NUMA is specified. --- src/qemu/qemu_driver.c | 10 ++++++++++ tools/virsh.pod | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 83a4e18ae6..e59f501c6d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2308,6 +2308,16 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, if (flags & VIR_DOMAIN_AFFECT_CONFIG) { /* Help clang 2.8 decipher the logic flow. */ sa_assert(persistentDef); + + /* resizing memory with NUMA nodes specified doesn't work as there + * is no way to change the individual node sizes with this API */ + if (virDomainNumaGetNodeCount(persistentDef->numa) > 0) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("maximum memory size of a domain with NUMA " + "nodes cannot be modified with this API")); + goto endjob; + } + persistentDef->mem.max_balloon = newmem; if (persistentDef->mem.cur_balloon > newmem) persistentDef->mem.cur_balloon = newmem; diff --git a/tools/virsh.pod b/tools/virsh.pod index 85ce257f71..7c927a5e43 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1938,7 +1938,10 @@ exclusive. If no flag is specified, behavior is different depending on hypervisor. Some hypervisors such as QEMU/KVM don't support live changes (especially -increasing) of the maximum memory limit. +increasing) of the maximum memory limit. Even persistent configuration changes +might not be performed with some hypervisors/configuration (e.g. on NUMA enabled +domains on QEMU). For complex configuration changes use command B +instead). I is a scaled integer (see B above); it defaults to kibibytes (blocks of 1024 bytes) unless you provide a suffix (and the older option -- GitLab