Re: [libvirt] [PATCH v4 04/13] XML parsing for memory tunables
On Wed, Oct 13, 2010 at 10:39:00AM +0530, Nikunj A. Dadhania wrote: On Tue, 12 Oct 2010 16:54:39 +0200, Daniel Veillard veill...@redhat.com wrote: anyway once cleaned up the patch makes sensei, ACK, but please use make syntax-check and do not configure out drivers when you are developping patches, Thanks Daniel, Did not know about the make syntax-check. And as you guessed, I did not compile it for other drivers, just went out of my mind, I will take care next time. Okay, HACKING in the git checkout and http://libvirt.org/hacking.html gives a set of advices for people developping patches it lists make syntax-check and also suggestsi ./configure --enable-compile-warnings=error which would likely have caught the CP error in the remote code. Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v4 04/13] XML parsing for memory tunables
On Fri, Oct 08, 2010 at 05:45:23PM +0530, Nikunj A. Dadhania wrote: From: Nikunj A. Dadhania nik...@linux.vnet.ibm.com Adding parsing code for memory tunables in the domain xml file v4: * Add memtune in tests/qemuxml2xmltest.c * Fix: insert memtune element only when any of them is set v2: + Fix typo min_guarantee The patch is fine except the usual space and tabs mixups and the fact that a number of drivers still needed to be converted to the change of the definition structure. grep -- -memory src/*/* isn't that hard and would have shown that even the driver for your own IBM Phyp hardware failed to compile after your patch !! anyway once cleaned up the patch makes sensei, ACK, but please use make syntax-check and do not configure out drivers when you are developping patches, thanks, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v4 04/13] XML parsing for memory tunables
On Tue, Oct 12, 2010 at 09:33:03PM +0200, Matthias Bolte wrote: 2010/10/12 Daniel Veillard veill...@redhat.com: On Fri, Oct 08, 2010 at 05:45:23PM +0530, Nikunj A. Dadhania wrote: From: Nikunj A. Dadhania nik...@linux.vnet.ibm.com Adding parsing code for memory tunables in the domain xml file v4: * Add memtune in tests/qemuxml2xmltest.c * Fix: insert memtune element only when any of them is set v2: + Fix typo min_guarantee The patch is fine except the usual space and tabs mixups and the fact that a number of drivers still needed to be converted to the change of the definition structure. grep -- -memory src/*/* isn't that hard and would have shown that even the driver for your own IBM Phyp hardware failed to compile after your patch !! anyway once cleaned up the patch makes sensei, ACK, but please use make syntax-check and do not configure out drivers when you are developping patches, thanks, Daniel This patch should have added documentation about the new XML elements to docs/formatdomain.html.in. right! virsh man page need to be completed too, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v4 04/13] XML parsing for memory tunables
On Tue, 12 Oct 2010 16:54:39 +0200, Daniel Veillard veill...@redhat.com wrote: On Fri, Oct 08, 2010 at 05:45:23PM +0530, Nikunj A. Dadhania wrote: From: Nikunj A. Dadhania nik...@linux.vnet.ibm.com Adding parsing code for memory tunables in the domain xml file v4: * Add memtune in tests/qemuxml2xmltest.c * Fix: insert memtune element only when any of them is set v2: + Fix typo min_guarantee The patch is fine except the usual space and tabs mixups and the fact that a number of drivers still needed to be converted to the change of the definition structure. grep -- -memory src/*/* isn't that hard and would have shown that even the driver for your own IBM Phyp hardware failed to compile after your patch !! anyway once cleaned up the patch makes sensei, ACK, but please use make syntax-check and do not configure out drivers when you are developping patches, Thanks Daniel, Did not know about the make syntax-check. And as you guessed, I did not compile it for other drivers, just went out of my mind, I will take care next time. Regards, Nikunj -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v4 04/13] XML parsing for memory tunables
From: Nikunj A. Dadhania nik...@linux.vnet.ibm.com Adding parsing code for memory tunables in the domain xml file v4: * Add memtune in tests/qemuxml2xmltest.c * Fix: insert memtune element only when any of them is set v2: + Fix typo min_guarantee Acked-by: Daniel P. Berrange berra...@redhat.com Signed-off-by: Nikunj A. Dadhania nik...@linux.vnet.ibm.com --- src/conf/domain_conf.c | 54 +++--- src/conf/domain_conf.h | 12 - src/esx/esx_vmx.c| 30 ++-- src/lxc/lxc_controller.c |2 - src/lxc/lxc_driver.c | 12 ++--- src/openvz/openvz_driver.c |8 ++- src/qemu/qemu_conf.c |8 ++- src/qemu/qemu_driver.c | 18 --- src/test/test_driver.c | 12 ++--- src/uml/uml_conf.c |2 - src/uml/uml_driver.c | 14 +++--- tests/qemuxml2argvdata/qemuxml2argv-memtune.args |1 tests/qemuxml2argvdata/qemuxml2argv-memtune.xml | 30 tests/qemuxml2xmltest.c |1 14 files changed, 140 insertions(+), 64 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memtune.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memtune.xml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 539d443..146e7a7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4235,19 +4235,38 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, def-description = virXPathString(string(./description[1]), ctxt); /* Extract domain memory */ -if (virXPathULong(string(./memory[1]), ctxt, def-maxmem) 0) { +if (virXPathULong(string(./memory[1]), ctxt, + def-mem.max_balloon) 0) { virDomainReportError(VIR_ERR_INTERNAL_ERROR, %s, _(missing memory element)); goto error; } -if (virXPathULong(string(./currentMemory[1]), ctxt, def-memory) 0) -def-memory = def-maxmem; +if (virXPathULong(string(./currentMemory[1]), ctxt, + def-mem.cur_balloon) 0) +def-mem.cur_balloon = def-mem.max_balloon; node = virXPathNode(./memoryBacking/hugepages, ctxt); if (node) -def-hugepage_backed = 1; - +def-mem.hugepage_backed = 1; + +/* Extract other memory tunables */ +if (virXPathULong(string(./memtune/hard_limit), ctxt, + def-mem.hard_limit) 0) +def-mem.hard_limit = 0; + +if (virXPathULong(string(./memtune/soft_limit[1]), ctxt, + def-mem.soft_limit) 0) +def-mem.soft_limit = 0; + +if (virXPathULong(string(./memtune/min_guarantee[1]), ctxt, + def-mem.min_guarantee) 0) +def-mem.min_guarantee = 0; + +if (virXPathULong(string(./memtune/swap_hard_limit[1]), ctxt, + def-mem.swap_hard_limit) 0) +def-mem.swap_hard_limit = 0; + if (virXPathULong(string(./vcpu[1]), ctxt, def-vcpus) 0) def-vcpus = 1; @@ -6384,10 +6403,29 @@ char *virDomainDefFormat(virDomainDefPtr def, virBufferEscapeString(buf, description%s/description\n, def-description); -virBufferVSprintf(buf, memory%lu/memory\n, def-maxmem); +virBufferVSprintf(buf, memory%lu/memory\n, def-mem.max_balloon); virBufferVSprintf(buf, currentMemory%lu/currentMemory\n, - def-memory); -if (def-hugepage_backed) { + def-mem.cur_balloon); + +/* add memtune only if there are any */ +if(def-mem.hard_limit || def-mem.hard_limit || def-mem.hard_limit) +virBufferVSprintf(buf, memtune\n); +if (def-mem.hard_limit) { +virBufferVSprintf(buf, hard_limit%lu/hard_limit\n, + def-mem.hard_limit); +} +if (def-mem.soft_limit) { +virBufferVSprintf(buf, soft_limit%lu/soft_limit\n, + def-mem.soft_limit); +} +if (def-mem.swap_hard_limit) { +virBufferVSprintf(buf, swap_hard_limit%lu/swap_hard_limit\n, + def-mem.swap_hard_limit); +} +if(def-mem.hard_limit || def-mem.hard_limit || def-mem.hard_limit) +virBufferVSprintf(buf, /memtune\n); + +if (def-mem.hugepage_backed) { virBufferAddLit(buf, memoryBacking\n); virBufferAddLit(buf, hugepages/\n); virBufferAddLit(buf, /memoryBacking\n); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 9bf13d8..7c5215f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -866,9 +866,15 @@ struct _virDomainDef { char *name; char *description; -unsigned long memory; -unsigned long maxmem;