From: Daniel Veillard Date: Thu, 12 Aug 2010 16:32:16 +0000 (+0200) Subject: qemu: avoid calling the balloon info command if disabled X-Git-Tag: v0.8.4~103 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=986c2086958e351da35079501fb51e40af2d5b48;p=thirdparty%2Flibvirt.git qemu: avoid calling the balloon info command if disabled 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. * src/qemu/qemu_driver.c: do not get the balloon info if the balloon suppor is disabled --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e4f47d4ff7..2dbb624206 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; @@ -6745,8 +6749,10 @@ static char *qemudDomainDumpXML(virDomainPtr dom, goto cleanup; } - /* Refresh current memory based on balloon info */ - if (virDomainObjIsActive(vm)) { + /* Refresh current memory based on balloon info if supported */ + if ((vm->def->memballoon != NULL) && + (vm->def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE) && + (virDomainObjIsActive(vm))) { qemuDomainObjPrivatePtr priv = vm->privateData; /* Don't delay if someone's using the monitor, just use * existing most recent data instead */