]> xenbits.xensource.com Git - libvirt.git/commitdiff
allow memballoon type of none to desactivate it
authorDaniel Veillard <veillard@redhat.com>
Wed, 11 Aug 2010 09:28:17 +0000 (11:28 +0200)
committerDaniel Veillard <veillard@redhat.com>
Wed, 11 Aug 2010 09:28:17 +0000 (11:28 +0200)
  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
  <memballoon type="none"/>
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
src/conf/domain_conf.c
src/conf/domain_conf.h
src/qemu/qemu_conf.c

index b2783b0a6ccb11f183ec73a4e6760280f61a432c..1e42827b1769f6adf59226e2ef0aec27fa460a97 100644 (file)
         <choice>
           <value>virtio</value>
           <value>xen</value>
+          <value>none</value>
         </choice>
       </attribute>
       <optional>
index bfe01f00034076f4f08bbce9804dc2085c011fa8..c6534b8d060b448db2c75dbb35c7f64e1f19701b 100644 (file)
@@ -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",
index e32188fa758326110b5c3fd6642c497ccb09bf54..4361d5b79fdf3324b95a208ff6f8c0e5c09d449f 100644 (file)
@@ -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
 };
index 376cd10fbcbf90da948ce6395b8a6cf0dbdb1147..fb852208608aae18f8806904385432e24b9e889f 100644 (file)
@@ -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)