[libvirt] [PATCH] qemu: do not ask for balloon information if not used

Basically a followup of the previous patch about balloon desactivation if desactivated, to not ask for balloon information to qemu as we will just get an error back. This can make a huge difference in the time needed for domain information or list when a machine is loaded, and balloon has been desactivated in the guests. Note that the patch does a check in the GetDomainInfo function, to avoid checking for job, getting a job, getting the monitor lock and cleaning back which would be added operations if I had done this one level down in qemuMonitorGetBalloonInfo() The qemudDomainDumpXML() function also call qemuMonitorGetBalloonInfo() so maybe the check should be duplicated there, I left that out of the patch for now as this is an operation which sounds less time critical. Or maybe the test should be added to qemuMonitorGetBalloonInfo() too since it's exported from src/qemu/qemu_monitor.h and may end up being used from other places in the future, opinions ? Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Thu, Aug 12, 2010 at 02:07:41PM +0200, Daniel Veillard wrote:
Basically a followup of the previous patch about balloon desactivation if desactivated, to not ask for balloon information to qemu as we will just get an error back. This can make a huge difference in the time needed for domain information or list when a machine is loaded, and balloon has been desactivated in the guests.
Note that the patch does a check in the GetDomainInfo function, to avoid checking for job, getting a job, getting the monitor lock and cleaning back which would be added operations if I had done this one level down in qemuMonitorGetBalloonInfo() The qemudDomainDumpXML() function also call qemuMonitorGetBalloonInfo() so maybe the check should be duplicated there, I left that out of the patch for now as this is an operation which sounds less time critical. Or maybe the test should be added to qemuMonitorGetBalloonInfo() too since it's exported from src/qemu/qemu_monitor.h and may end up being used from other places in the future,
Nah, putting it in qemu_driver is the correct place. The qemu_monitor.h files are designed to not have any awareness of the virDomainDef structures - just simple commaands to talk to the monitor. We should add the same to DumpXML as you say.
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e4f47d4..deb8b02 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4938,7 +4938,11 @@ static int qemudDomainGetInfo(virDomainPtr dom,
if (virDomainObjIsActive(vm)) { qemuDomainObjPrivatePtr priv = vm->privateData; - if (!priv->jobActive) { + + if ((vm->def->memballoon != NULL) && + (vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE)) { + info->memory = vm->def->maxmem; + } else if (!priv->jobActive) { if (qemuDomainObjBeginJob(vm) < 0) goto cleanup;
Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Thu, Aug 12, 2010 at 01:36:06PM +0100, Daniel P. Berrange wrote:
On Thu, Aug 12, 2010 at 02:07:41PM +0200, Daniel Veillard wrote:
Basically a followup of the previous patch about balloon desactivation if desactivated, to not ask for balloon information to qemu as we will just get an error back. This can make a huge difference in the time needed for domain information or list when a machine is loaded, and balloon has been desactivated in the guests.
Note that the patch does a check in the GetDomainInfo function, to avoid checking for job, getting a job, getting the monitor lock and cleaning back which would be added operations if I had done this one level down in qemuMonitorGetBalloonInfo() The qemudDomainDumpXML() function also call qemuMonitorGetBalloonInfo() so maybe the check should be duplicated there, I left that out of the patch for now as this is an operation which sounds less time critical. Or maybe the test should be added to qemuMonitorGetBalloonInfo() too since it's exported from src/qemu/qemu_monitor.h and may end up being used from other places in the future,
Nah, putting it in qemu_driver is the correct place. The qemu_monitor.h files are designed to not have any awareness of the virDomainDef structures - just simple commaands to talk to the monitor. We should add the same to DumpXML as you say.
Okay, done and pushed, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (2)
-
Daniel P. Berrange
-
Daniel Veillard