Re: [libvirt] [PATCHv2] qemu: Fix issues with maxMemory in qemuDomainSetMemoryFlags()
On Wed, Apr 01, 2015 at 11:02:26 +0200, Martin Kletzander wrote: On Mon, Mar 30, 2015 at 09:01:37PM +0200, Peter Krempa wrote: From: Luyao Huang lhu...@redhat.com qemuDomainSetMemoryFlags() would allow to set the initial memory greater than the maxMemory field. While the configuration would not work as memory hotplug requires NUMA to be enabled and the qemuDomainSetMemoryFlags() API does not work on NUMA guests this just fixes a corner case. ACK, since it's a corner-case, after release. Thanks, I've pushed this patch with one tweak ... The fix is still worth though as it allows to induce an invalid configuration and make the VM vanish on libvirt restart. Additionally this tweaks error message to be more accurate. Signed-off-by: Luyao Huang lhu...@redhat.com Signed-off-by: Peter Krempa pkre...@redhat.com --- Version 2 tweaks the error messages to be (possibly) more descriptive. src/qemu/qemu_driver.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6700fc9..d15931c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2319,11 +2319,19 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, * 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 + _(initial memory size of a domain with NUMA nodes cannot be modified with this API)); goto endjob; } +if (persistentDef-mem.max_memory +persistentDef-mem.max_memory newmem) { +virReportError(VIR_ERR_OPERATION_INVALID, %s, + _(cannot set initial memory size biger than s/biger/greater/ + the maximum memory size)); +goto endjob; +} + virDomainDefSetMemoryInitial(persistentDef, newmem); if (persistentDef-mem.cur_balloon newmem) Peter signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv2] qemu: Fix issues with maxMemory in qemuDomainSetMemoryFlags()
On Mon, Mar 30, 2015 at 09:01:37PM +0200, Peter Krempa wrote: From: Luyao Huang lhu...@redhat.com qemuDomainSetMemoryFlags() would allow to set the initial memory greater than the maxMemory field. While the configuration would not work as memory hotplug requires NUMA to be enabled and the qemuDomainSetMemoryFlags() API does not work on NUMA guests this just fixes a corner case. ACK, since it's a corner-case, after release. The fix is still worth though as it allows to induce an invalid configuration and make the VM vanish on libvirt restart. Additionally this tweaks error message to be more accurate. Signed-off-by: Luyao Huang lhu...@redhat.com Signed-off-by: Peter Krempa pkre...@redhat.com --- Version 2 tweaks the error messages to be (possibly) more descriptive. src/qemu/qemu_driver.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6700fc9..d15931c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2319,11 +2319,19 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, * 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 + _(initial memory size of a domain with NUMA nodes cannot be modified with this API)); goto endjob; } +if (persistentDef-mem.max_memory +persistentDef-mem.max_memory newmem) { +virReportError(VIR_ERR_OPERATION_INVALID, %s, + _(cannot set initial memory size biger than + the maximum memory size)); +goto endjob; +} + virDomainDefSetMemoryInitial(persistentDef, newmem); if (persistentDef-mem.cur_balloon newmem) -- 2.2.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list pgp9iZz2XiY8i.pgp Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv2] qemu: Fix issues with maxMemory in qemuDomainSetMemoryFlags()
From: Luyao Huang lhu...@redhat.com qemuDomainSetMemoryFlags() would allow to set the initial memory greater than the maxMemory field. While the configuration would not work as memory hotplug requires NUMA to be enabled and the qemuDomainSetMemoryFlags() API does not work on NUMA guests this just fixes a corner case. The fix is still worth though as it allows to induce an invalid configuration and make the VM vanish on libvirt restart. Additionally this tweaks error message to be more accurate. Signed-off-by: Luyao Huang lhu...@redhat.com Signed-off-by: Peter Krempa pkre...@redhat.com --- Version 2 tweaks the error messages to be (possibly) more descriptive. src/qemu/qemu_driver.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6700fc9..d15931c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2319,11 +2319,19 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, * 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 + _(initial memory size of a domain with NUMA nodes cannot be modified with this API)); goto endjob; } +if (persistentDef-mem.max_memory +persistentDef-mem.max_memory newmem) { +virReportError(VIR_ERR_OPERATION_INVALID, %s, + _(cannot set initial memory size biger than + the maximum memory size)); +goto endjob; +} + virDomainDefSetMemoryInitial(persistentDef, newmem); if (persistentDef-mem.cur_balloon newmem) -- 2.2.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list