From 79c27a620a129dc77bb91a61c208d0a325fd7c3f Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Wed, 11 Aug 2010 11:28:17 +0200 Subject: [PATCH] allow memballoon type of none to desactivate it The balloon device is automatically added to qemu guests if supported, but it may be useful to desactivate it. The simplest to not change the existing behaviour is to allow as an extra option to desactivate it (it is automatically added if the memballoon construct is missing for the domain). The following simple patch just adds the extra option and does not change the default behaviour but avoid creating a balloon device if type="none" is used. * docs/schemas/domain.rng: add the extra type attribute value * src/conf/domain_conf.c src/conf/domain_conf.h: add the extra enum value * src/qemu/qemu_conf.c: if enum is NONE, don't activate the device, i.e. don't pass the args to qemu/kvm --- docs/schemas/domain.rng | 1 + src/conf/domain_conf.c | 3 ++- src/conf/domain_conf.h | 1 + src/qemu/qemu_conf.c | 6 +++++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index b2783b0a6c..1e42827b17 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -1354,6 +1354,7 @@ virtio xen + none diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index bfe01f0003..c6534b8d06 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -203,7 +203,8 @@ VIR_ENUM_IMPL(virDomainSoundModel, VIR_DOMAIN_SOUND_MODEL_LAST, VIR_ENUM_IMPL(virDomainMemballoonModel, VIR_DOMAIN_MEMBALLOON_MODEL_LAST, "virtio", - "xen"); + "xen", + "none"); VIR_ENUM_IMPL(virDomainWatchdogModel, VIR_DOMAIN_WATCHDOG_MODEL_LAST, "i6300esb", diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e32188fa75..4361d5b79f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -581,6 +581,7 @@ struct _virDomainHostdevDef { enum { VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO, VIR_DOMAIN_MEMBALLOON_MODEL_XEN, + VIR_DOMAIN_MEMBALLOON_MODEL_NONE, VIR_DOMAIN_MEMBALLOON_MODEL_LAST }; diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 376cd10fbc..fb85220860 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -4958,7 +4958,8 @@ int qemudBuildCommandLine(virConnectPtr conn, * NB: Earlier we declared that VirtIO balloon will always be in * slot 0x3 on bus 0x0 */ - if (def->memballoon) { + if ((def->memballoon) && + (def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE)) { if (def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Memory balloon device type '%s' is not supported by this version of qemu"), @@ -6575,6 +6576,9 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, def->videos[def->nvideos++] = vid; } + /* + * having a balloon is the default, define one with type="none" to avoid it + */ if (!def->memballoon) { virDomainMemballoonDefPtr memballoon; if (VIR_ALLOC(memballoon) < 0) -- GitLab