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

Daniel Veillard veillard at redhat.com
Thu Aug 12 12:07:41 UTC 2010


 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 at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/
-------------- next part --------------
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;
 


More information about the libvir-list mailing list