]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Explicitly represent balloon device in XML and handle PCI address
authorDaniel P. Berrange <dan@berrange.com>
Thu, 15 Jul 2010 13:02:42 +0000 (14:02 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 21 Jul 2010 10:33:11 +0000 (11:33 +0100)
To allow compatibility with older QEMU PCI device slot assignment
it is necessary to explicitly track the balloon device in the
XML. This introduces a new device

   <memballoon model='virtio|xen'/>

It can also have a PCI address, auto-assigned if necessary.

The memballoon will be automatically added to all Xen and QEMU
guests by default.

* docs/schemas/domain.rng: Add <memballoon> element
* src/conf/domain_conf.c, src/conf/domain_conf.h: parsing
  and formatting for memballoon device. Always add a memory
  balloon device to Xen/QEMU if none exists in XML
* src/libvirt_private.syms: Export memballoon model APIs
* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Honour the
  PCI device address in memory balloon device
* tests/*: Update to test new functionality

102 files changed:
docs/schemas/domain.rng
src/conf/domain_conf.c
src/conf/domain_conf.h
src/libvirt_private.syms
src/qemu/qemu_conf.c
src/qemu/qemu_conf.h
src/qemu/qemu_driver.c
tests/define-dev-segfault
tests/qemuxml2argvdata/qemuxml2argv-balloon-device.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-balloon-device.xml [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml
tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.xml
tests/qemuxml2argvdata/qemuxml2argv-boot-network.xml
tests/qemuxml2argvdata/qemuxml2argv-bootloader.xml
tests/qemuxml2argvdata/qemuxml2argv-channel-guestfwd.xml
tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-auto.xml
tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.xml
tests/qemuxml2argvdata/qemuxml2argv-clock-france.xml
tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.xml
tests/qemuxml2argvdata/qemuxml2argv-clock-utc.xml
tests/qemuxml2argvdata/qemuxml2argv-clock-variable.xml
tests/qemuxml2argvdata/qemuxml2argv-console-compat-chardev.xml
tests/qemuxml2argvdata/qemuxml2argv-console-compat.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-empty.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-none.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wb.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wt.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-none.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wb.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wt.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-enospace.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-stop.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-disk.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-many.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-usb-device.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-usb.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.xml
tests/qemuxml2argvdata/qemuxml2argv-encrypted-disk.xml
tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml
tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml
tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml
tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml
tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml
tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml
tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-address-device.xml
tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-address.xml
tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address-device.xml
tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.xml
tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml
tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.xml
tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.xml
tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml
tests/qemuxml2argvdata/qemuxml2argv-machine-aliases1.xml
tests/qemuxml2argvdata/qemuxml2argv-machine-aliases2.xml
tests/qemuxml2argvdata/qemuxml2argv-migrate.xml
tests/qemuxml2argvdata/qemuxml2argv-minimal.xml
tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.xml
tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.xml
tests/qemuxml2argvdata/qemuxml2argv-misc-uuid.xml
tests/qemuxml2argvdata/qemuxml2argv-net-eth-ifname.xml
tests/qemuxml2argvdata/qemuxml2argv-net-eth-names.xml
tests/qemuxml2argvdata/qemuxml2argv-net-eth.xml
tests/qemuxml2argvdata/qemuxml2argv-net-user.xml
tests/qemuxml2argvdata/qemuxml2argv-net-virtio-device.xml
tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev.xml
tests/qemuxml2argvdata/qemuxml2argv-net-virtio.xml
tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.xml
tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp-chardev.xml
tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml
tests/qemuxml2argvdata/qemuxml2argv-restore-v1.xml
tests/qemuxml2argvdata/qemuxml2argv-restore-v2.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-dev-chardev.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-file-chardev.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-file.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-many-chardev.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-many.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-pty-chardev.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-chardev.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet-chardev.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-udp-chardev.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-unix-chardev.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-unix.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-vc-chardev.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml
tests/qemuxml2argvdata/qemuxml2argv-sound-device.xml
tests/qemuxml2argvdata/qemuxml2argv-sound.xml
tests/qemuxml2argvdata/qemuxml2argv-watchdog-device.xml
tests/qemuxml2argvdata/qemuxml2argv-watchdog.xml
tests/qemuxml2argvtest.c

index 1d56f5b008ca1cdfb45112d9a28a337dd525a625..2ca0ad2b020c59a2e832d1435f228c8f46fd74c1 100644 (file)
       </optional>
     </element>
   </define>
+  <define name="memballoon">
+    <element name="memballoon">
+      <attribute name="model">
+        <choice>
+          <value>virtio</value>
+          <value>xen</value>
+        </choice>
+      </attribute>
+      <optional>
+        <ref name="address"/>
+      </optional>
+    </element>
+  </define>
   <define name="parallel">
     <element name="parallel">
       <ref name="qemucdev"/>
         <optional>
           <ref name="watchdog"/>
         </optional>
+        <optional>
+          <ref name="memballoon"/>
+        </optional>
       </interleave>
     </element>
   </define>
index f3b8cfa3a56b0b8ac539e2669002495bcd1b76d5..0feb0cd6bc6aca342b7bf675c145d91046b8689c 100644 (file)
@@ -189,6 +189,10 @@ VIR_ENUM_IMPL(virDomainSoundModel, VIR_DOMAIN_SOUND_MODEL_LAST,
               "pcspk",
               "ac97")
 
+VIR_ENUM_IMPL(virDomainMemballoonModel, VIR_DOMAIN_MEMBALLOON_MODEL_LAST,
+              "virtio",
+              "xen");
+
 VIR_ENUM_IMPL(virDomainWatchdogModel, VIR_DOMAIN_WATCHDOG_MODEL_LAST,
               "i6300esb",
               "ib700")
@@ -567,6 +571,16 @@ void virDomainSoundDefFree(virDomainSoundDefPtr def)
     VIR_FREE(def);
 }
 
+void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def)
+{
+    if (!def)
+        return;
+
+    virDomainDeviceInfoClear(&def->info);
+
+    VIR_FREE(def);
+}
+
 void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def)
 {
     if (!def)
@@ -1001,6 +1015,9 @@ int virDomainDeviceInfoIterate(virDomainDefPtr def,
     if (def->watchdog)
         if (cb(def, &def->watchdog->info, opaque) < 0)
             return -1;
+    if (def->memballoon)
+        if (cb(def, &def->memballoon->info, opaque) < 0)
+            return -1;
     if (def->console)
         if (cb(def, &def->console->info, opaque) < 0)
             return -1;
@@ -3170,6 +3187,40 @@ error:
 }
 
 
+static virDomainMemballoonDefPtr
+virDomainMemballoonDefParseXML(const xmlNodePtr node,
+                               int flags)
+{
+    char *model;
+    virDomainMemballoonDefPtr def;
+
+    if (VIR_ALLOC(def) < 0) {
+        virReportOOMError();
+        return NULL;
+    }
+
+    model = virXMLPropString(node, "model");
+    if ((def->model = virDomainMemballoonModelTypeFromString(model)) < 0) {
+        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+                             _("unknown memory balloon model '%s'"), model);
+        goto error;
+    }
+
+    if (virDomainDeviceInfoParseXML(node, &def->info, flags) < 0)
+        goto error;
+
+cleanup:
+    VIR_FREE(model);
+
+    return def;
+
+error:
+    virDomainMemballoonDefFree(def);
+    def = NULL;
+    goto cleanup;
+}
+
+
 int
 virDomainVideoDefaultRAM(virDomainDefPtr def,
                          int type)
@@ -4634,6 +4685,41 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
         VIR_FREE(nodes);
     }
 
+    /* analysis of the memballoon devices */
+    def->memballoon = NULL;
+    if ((n = virXPathNodeSet("./devices/memballoon", ctxt, &nodes)) < 0) {
+        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+                             "%s", _("cannot extract memory balloon devices"));
+        goto error;
+    }
+    if (n > 1) {
+        virDomainReportError (VIR_ERR_INTERNAL_ERROR,
+                              "%s", _("only a single memory balloon device is supported"));
+        goto error;
+    }
+    if (n > 0) {
+        virDomainMemballoonDefPtr memballoon =
+            virDomainMemballoonDefParseXML(nodes[0], flags);
+        if (!memballoon)
+            goto error;
+
+        def->memballoon = memballoon;
+        VIR_FREE(nodes);
+    } else {
+        if (def->virtType == VIR_DOMAIN_VIRT_XEN ||
+            def->virtType == VIR_DOMAIN_VIRT_QEMU ||
+            def->virtType == VIR_DOMAIN_VIRT_KQEMU ||
+            def->virtType == VIR_DOMAIN_VIRT_KVM) {
+            virDomainMemballoonDefPtr memballoon;
+            if (VIR_ALLOC(memballoon) < 0)
+                goto no_memory;
+            memballoon->model = def->virtType == VIR_DOMAIN_VIRT_XEN ?
+                VIR_DOMAIN_MEMBALLOON_MODEL_XEN :
+                VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO;
+            def->memballoon = memballoon;
+        }
+    }
+
     /* analysis of security label */
     if (virSecurityLabelDefParseXML(def, ctxt, flags) == -1)
         goto error;
@@ -5671,6 +5757,35 @@ virDomainSoundDefFormat(virBufferPtr buf,
 }
 
 
+static int
+virDomainMemballoonDefFormat(virBufferPtr buf,
+                             virDomainMemballoonDefPtr def,
+                             int flags)
+{
+    const char *model = virDomainMemballoonModelTypeToString(def->model);
+
+    if (!model) {
+        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+                             _("unexpected memballoon model %d"), def->model);
+        return -1;
+    }
+
+    virBufferVSprintf(buf, "    <memballoon model='%s'",
+                      model);
+
+    if (virDomainDeviceInfoIsSet(&def->info)) {
+        virBufferAddLit(buf, ">\n");
+        if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
+            return -1;
+        virBufferAddLit(buf, "    </memballoon>\n");
+    } else {
+        virBufferAddLit(buf, "/>\n");
+    }
+
+    return 0;
+}
+
+
 static int
 virDomainWatchdogDefFormat(virBufferPtr buf,
                            virDomainWatchdogDefPtr def,
@@ -6280,6 +6395,9 @@ char *virDomainDefFormat(virDomainDefPtr def,
     if (def->watchdog)
         virDomainWatchdogDefFormat (&buf, def->watchdog, flags);
 
+    if (def->memballoon)
+        virDomainMemballoonDefFormat (&buf, def->memballoon, flags);
+
     virBufferAddLit(&buf, "  </devices>\n");
 
     if (def->seclabel.model) {
index d46869e44ff0479b96a557f7eeec3af976dd3a55..5e08aa196b767337b54da2af07633236a8217a23 100644 (file)
@@ -560,6 +560,22 @@ struct _virDomainHostdevDef {
     virDomainDeviceInfo info; /* Guest address */
 };
 
+
+enum {
+    VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO,
+    VIR_DOMAIN_MEMBALLOON_MODEL_XEN,
+
+    VIR_DOMAIN_MEMBALLOON_MODEL_LAST
+};
+
+typedef struct _virDomainMemballoonDef virDomainMemballoonDef;
+typedef virDomainMemballoonDef *virDomainMemballoonDefPtr;
+struct _virDomainMemballoonDef {
+    int model;
+    virDomainDeviceInfo info;
+};
+
+
 /* Flags for the 'type' field in next struct */
 enum virDomainDeviceType {
     VIR_DOMAIN_DEVICE_DISK,
@@ -871,6 +887,7 @@ struct _virDomainDef {
     virDomainChrDefPtr console;
     virSecurityLabelDef seclabel;
     virDomainWatchdogDefPtr watchdog;
+    virDomainMemballoonDefPtr memballoon;
     virCPUDefPtr cpu;
 };
 
@@ -931,6 +948,7 @@ void virDomainFSDefFree(virDomainFSDefPtr def);
 void virDomainNetDefFree(virDomainNetDefPtr def);
 void virDomainChrDefFree(virDomainChrDefPtr def);
 void virDomainSoundDefFree(virDomainSoundDefPtr def);
+void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def);
 void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def);
 void virDomainVideoDefFree(virDomainVideoDefPtr def);
 void virDomainHostdevDefFree(virDomainHostdevDefPtr def);
@@ -1109,6 +1127,7 @@ VIR_ENUM_DECL(virDomainNet)
 VIR_ENUM_DECL(virDomainChrTarget)
 VIR_ENUM_DECL(virDomainChr)
 VIR_ENUM_DECL(virDomainSoundModel)
+VIR_ENUM_DECL(virDomainMemballoonModel)
 VIR_ENUM_DECL(virDomainWatchdogModel)
 VIR_ENUM_DECL(virDomainWatchdogAction)
 VIR_ENUM_DECL(virDomainVideo)
index b5f36953bbb4a407ac61094b9f3c03966928291a..3573da17a9c8a4fd67911d9185cf0cce0705b9eb 100644 (file)
@@ -170,6 +170,8 @@ virDomainSaveStatus;
 virDomainSoundDefFree;
 virDomainSoundModelTypeFromString;
 virDomainSoundModelTypeToString;
+virDomainMemballoonModelTypeFromString;
+virDomainMemballoonModelTypeToString;
 virDomainWatchdogModelTypeFromString;
 virDomainWatchdogModelTypeToString;
 virDomainWatchdogActionTypeFromString;
index d89e065e229aeeeb0802300d05ac833441ee7925..ae345fb5fc7e3be6006a479966e1d5a16bec41f4 100644 (file)
@@ -2023,6 +2023,10 @@ qemuAssignDeviceAliases(virDomainDefPtr def, unsigned long long qemuCmdFlags)
         if (virAsprintf(&def->watchdog->info.alias, "watchdog%d", 0) < 0)
             goto no_memory;
     }
+    if (def->memballoon) {
+        if (virAsprintf(&def->memballoon->info.alias, "balloon%d", 0) < 0)
+            goto no_memory;
+    }
 
     return 0;
 
@@ -2296,8 +2300,17 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
     }
 
     /* VirtIO balloon always at slot 3 by default */
-    if (qemuDomainPCIAddressReserveSlot(addrs, 3) < 0)
-        goto error;
+    if (def->memballoon &&
+        def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO &&
+        def->memballoon->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
+        def->memballoon->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
+        def->memballoon->info.addr.pci.domain = 0;
+        def->memballoon->info.addr.pci.bus = 0;
+        def->memballoon->info.addr.pci.slot = 3;
+        def->memballoon->info.addr.pci.function = 0;
+        if (qemuDomainPCIAddressReserveSlot(addrs, 3) < 0)
+            goto error;
+    }
 
     for (i = 0; i < def->ndisks ; i++) {
         if (def->disks[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
@@ -2912,6 +2925,29 @@ error:
 }
 
 
+char *
+qemuBuildMemballoonDevStr(virDomainMemballoonDefPtr dev)
+{
+    virBuffer buf = VIR_BUFFER_INITIALIZER;
+
+    virBufferAddLit(&buf, "virtio-balloon-pci");
+    virBufferVSprintf(&buf, ",id=%s", dev->info.alias);
+    if (qemuBuildDeviceAddressStr(&buf, &dev->info) < 0)
+        goto error;
+
+    if (virBufferError(&buf)) {
+        virReportOOMError();
+        goto error;
+    }
+
+    return virBufferContentAndReset(&buf);
+
+error:
+    virBufferFreeAndReset(&buf);
+    return NULL;
+}
+
+
 char *
 qemuBuildUSBInputDevStr(virDomainInputDefPtr dev)
 {
@@ -4771,12 +4807,25 @@ int qemudBuildCommandLine(virConnectPtr conn,
      * NB: Earlier we declared that VirtIO balloon will always be in
      * slot 0x3 on bus 0x0
      */
-    if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
-        ADD_ARG_LIT("-device");
-        ADD_ARG_LIT("virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3");
-    } else if (qemuCmdFlags & QEMUD_CMD_FLAG_BALLOON) {
-        ADD_ARG_LIT("-balloon");
-        ADD_ARG_LIT("virtio");
+    if (def->memballoon) {
+        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"),
+                            virDomainMemballoonModelTypeToString(def->memballoon->model));
+            goto error;
+        }
+        if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
+            char *optstr;
+            ADD_ARG_LIT("-device");
+
+            optstr = qemuBuildMemballoonDevStr(def->memballoon);
+            if (!optstr)
+                goto error;
+            ADD_ARG(optstr);
+        } else if (qemuCmdFlags & QEMUD_CMD_FLAG_BALLOON) {
+            ADD_ARG_LIT("-balloon");
+            ADD_ARG_LIT("virtio");
+        }
     }
 
     if (current_snapshot && current_snapshot->def->active) {
@@ -6346,6 +6395,15 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
         def->videos[def->nvideos++] = vid;
     }
 
+    if (!def->memballoon) {
+        virDomainMemballoonDefPtr memballoon;
+        if (VIR_ALLOC(memballoon) < 0)
+            goto no_memory;
+        memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO;
+
+        def->memballoon = memballoon;
+    }
+
     VIR_FREE(nics);
 
     if (!def->name) {
index ea10f8592cea4b1a02bb99839a07fcb597dea2c2..ca4559f5f047ec0b29045ea071fb576d38e0e6ec 100644 (file)
@@ -243,6 +243,8 @@ char * qemuBuildControllerDevStr(virDomainControllerDefPtr def);
 
 char * qemuBuildWatchdogDevStr(virDomainWatchdogDefPtr dev);
 
+char * qemuBuildMemballoonDevStr(virDomainMemballoonDefPtr dev);
+
 char * qemuBuildUSBInputDevStr(virDomainInputDefPtr dev);
 
 char * qemuBuildSoundDevStr(virDomainSoundDefPtr sound);
index 92b98479ab7faa37bf402e5fba9b64414cd01801..6c7852882fc22aa85554b7c2ab497a19000d3a20 100644 (file)
@@ -2360,6 +2360,8 @@ cleanup:
 
 #define QEMU_PCI_PRODUCT_DISK_VIRTIO 0x1001
 
+#define QEMU_PCI_PRODUCT_BALLOON_VIRTIO 0x1002
+
 #define QEMU_PCI_PRODUCT_NIC_NE2K     0x8029
 #define QEMU_PCI_PRODUCT_NIC_PCNET    0x2000
 #define QEMU_PCI_PRODUCT_NIC_RTL8139  0x8139
@@ -2568,6 +2570,25 @@ qemuGetPCIWatchdogVendorProduct(virDomainWatchdogDefPtr def,
 }
 
 
+static int
+qemuGetPCIMemballoonVendorProduct(virDomainMemballoonDefPtr def,
+                                  unsigned *vendor,
+                                  unsigned *product)
+{
+    switch (def->model) {
+    case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO:
+        *vendor = QEMU_PCI_VENDOR_REDHAT;
+        *product = QEMU_PCI_PRODUCT_BALLOON_VIRTIO;
+        break;
+
+    default:
+        return -1;
+    }
+
+    return 0;
+}
+
+
 /*
  * This entire method assumes that PCI devices in 'info pci'
  * match ordering of devices specified on the command line
@@ -2649,7 +2670,7 @@ qemuDetectPCIAddresses(virDomainObjPtr vm,
             continue;
 
         if (qemuAssignNextPCIAddress(&(vm->def->sounds[i]->info),
-                                     vendor, product,
+                                    vendor, product,
                                      addrs,  naddrs) < 0) {
             qemuReportError(VIR_ERR_INTERNAL_ERROR,
                             _("cannot find PCI address for sound adapter %s"),
@@ -2671,6 +2692,18 @@ qemuDetectPCIAddresses(virDomainObjPtr vm,
         }
     }
 
+    if (vm->def->memballoon &&
+        qemuGetPCIMemballoonVendorProduct(vm->def->memballoon, &vendor, &product) == 0) {
+        if (qemuAssignNextPCIAddress(&(vm->def->memballoon->info),
+                                     vendor, product,
+                                     addrs, naddrs) < 0) {
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("cannot find PCI address for balloon %s"),
+                            virDomainMemballoonModelTypeToString(vm->def->memballoon->model));
+            return -1;
+        }
+    }
+
     /* XXX console (virtio) */
 
 
@@ -2678,8 +2711,6 @@ qemuDetectPCIAddresses(virDomainObjPtr vm,
 
     /* XXX USB controller ? */
 
-    /* XXXX virtio balloon ? */
-
     /* XXX what about other PCI devices (ie bridges) */
 
     return 0;
index e0b953ad8409006e20d6f5891359199b3fa5ad20..7a9a7b6fc6bde86295e3c6834b995a30a8fe4d9d 100755 (executable)
@@ -59,6 +59,7 @@ cat <<\EOF > D.xml || fail=1
     </console>
     <sound model='pcspk'/>
     <sound model='es1370'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
 EOF
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-balloon-device.args b/tests/qemuxml2argvdata/qemuxml2argv-balloon-device.args
new file mode 100644 (file)
index 0000000..0a481d6
--- /dev/null
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x12
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-balloon-device.xml b/tests/qemuxml2argvdata/qemuxml2argv-balloon-device.xml
new file mode 100644 (file)
index 0000000..274eb8b
--- /dev/null
@@ -0,0 +1,25 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+    </disk>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0' bus='0' slot='18' function='0'/>
+    </memballoon>
+  </devices>
+</domain>
index cf0d3df58c56e7ad63fa994d53517aa11e4dcdc1..410e6f9551e3dcf7bc289060874c5e24e52b600c 100644 (file)
@@ -21,5 +21,6 @@
       <address type='drive' controller='0' bus='1' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index cf3c5a8fd5f3ee04f2bd8bfb56459329a2169af5..ad8bae226de5abec5b42cee0c153732b9a6c605e 100644 (file)
@@ -26,5 +26,6 @@
     </disk>
     <controller type='fdc' index='0'/>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index a28372dc3eab41b75460578e5bd4d82eed22cac7..b1b77218d1baaccbc5d0f793616b8b5f2c1afdda 100644 (file)
@@ -20,5 +20,6 @@
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 4af280c5f1f1052a600b9e5f659aa54ffbd3a8cb..af19b3b7a00f4737a57af9bce0b9bd5b90dea4c5 100644 (file)
@@ -21,5 +21,6 @@
       <address type='drive' controller='0' bus='1' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 8963350fadf7628f5df82d5bed44e901283da988..b3c56b1dcd569984e21843a4d09f5bc7b81423ed 100644 (file)
@@ -24,5 +24,6 @@
       <source path='/tmp/guestfwd'/>
       <target type='guestfwd' address='10.0.2.1' port='4600'/>
     </channel>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 6e3458f1de8337bf5d8b85e619d084d2fb7dbbf5..afd73f42e773c04fc828ae3cff278482e4633600 100644 (file)
@@ -47,5 +47,6 @@
       <target type='virtio' name='org.linux-kvm.port.lla'/>
       <address type='virtio-serial' controller='2' bus='0'/>
     </channel>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index e597c407e4f982eff0688fc10a474c180a1dfb17..2dbb59697f34af6644ca0dc6514b48fdd29abcca 100644 (file)
@@ -27,5 +27,6 @@
       <target type='virtio' name='org.linux-kvm.port.foo'/>
       <address type='virtio-serial' controller='1' bus='0' port='3'/>
     </channel>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 157fdfb3de6d017f10b6c8270658e059794e43f3..8794492300d724189b7923935f7574f2470c7671 100644 (file)
@@ -20,5 +20,6 @@
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 345ae22e9bb0af264b066319b3d811e51ea477e1..786d0c70e8f41e78e9354d6a264a953cd294aff9 100644 (file)
@@ -20,5 +20,6 @@
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 533ea59b307ef25a18985ebc5d624249ca0794d9..ed91e37a128f1094155e7c114cf81abc25110807 100644 (file)
@@ -20,5 +20,6 @@
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index fa20b2737411ea6cefd4450aefe86ddec4355790..41818d25eba74998caa83367d0991afb0fa51c85 100644 (file)
@@ -20,5 +20,6 @@
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index df694c78cdbfaa7dfad478dbc02c329e82e5eb0c..611ddb8d7b53ca67a3911a7372036d5f76b78c68 100644 (file)
@@ -26,5 +26,6 @@
     <console type='pty'>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index df694c78cdbfaa7dfad478dbc02c329e82e5eb0c..611ddb8d7b53ca67a3911a7372036d5f76b78c68 100644 (file)
@@ -26,5 +26,6 @@
     <console type='pty'>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index addbbf116671af6b0ac8c67fdd49bebacddacb38..1b18d613d15ecd05a308aa2867e77a67ba60e4d8 100644 (file)
@@ -25,5 +25,6 @@
       <address type='drive' controller='0' bus='1' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 9c10551c4116c5efcdc7c34c4af66d53990827e1..061b196ba9206ef82cb30a617ac10861ccf1bf7a 100644 (file)
@@ -26,5 +26,6 @@
       <address type='drive' controller='0' bus='1' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 736e189e7cd62f26e7743f3a7e4a38d8e44024f9..0994a4986e2e3e9db9fd20c6cdcfba18d2603e70 100644 (file)
@@ -25,5 +25,6 @@
       <address type='drive' controller='0' bus='1' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index c379f3185533ce2db9b4244b67db13a9493b3b28..9762f5aef4c09649ffc9e1090b00969ea61defee 100644 (file)
@@ -25,5 +25,6 @@
       <address type='drive' controller='0' bus='1' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index e689d9cad2dfe5f4968e90c9566ecec96e0487f0..0b2f512ecd2fdc2c3e07e5611b66214050503103 100644 (file)
@@ -28,5 +28,6 @@
       <address type='drive' controller='0' bus='1' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index be00c4c81c5559d08b63917180773514e1ae8db4..a43808618db60d5cbe296956607d803eb9aec416 100644 (file)
@@ -28,5 +28,6 @@
       <address type='drive' controller='0' bus='1' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index edf776a3999be542712284421cad868fa2b5fb4f..29012a854d8509fd7bf330805d2b086c4d9fef98 100644 (file)
@@ -28,5 +28,6 @@
       <address type='drive' controller='0' bus='1' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index e689d9cad2dfe5f4968e90c9566ecec96e0487f0..0b2f512ecd2fdc2c3e07e5611b66214050503103 100644 (file)
@@ -28,5 +28,6 @@
       <address type='drive' controller='0' bus='1' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index be00c4c81c5559d08b63917180773514e1ae8db4..a43808618db60d5cbe296956607d803eb9aec416 100644 (file)
@@ -28,5 +28,6 @@
       <address type='drive' controller='0' bus='1' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index edf776a3999be542712284421cad868fa2b5fb4f..29012a854d8509fd7bf330805d2b086c4d9fef98 100644 (file)
@@ -28,5 +28,6 @@
       <address type='drive' controller='0' bus='1' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 8fe64d4bdf1f74721e77425f5bb9fdb5ed8cfce6..b3e6de994762d5f803a00282abfdc8fe32093466 100644 (file)
@@ -28,5 +28,6 @@
       <address type='drive' controller='0' bus='1' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 67e23ccfe4450e78dbbbc9009869177ccb66bee3..a4865026eb07b21a630c55402265f6d2d303c521 100644 (file)
@@ -28,5 +28,6 @@
       <address type='drive' controller='0' bus='1' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index b2b1b4ec1e48575f8ce5a9e12d35140f44bbffdb..a3491e770b92fe11beebfaf4c990994e2bb0b0d7 100644 (file)
@@ -22,5 +22,6 @@
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 0b04e69d9097dd708e72904cfa0fca024d211b81..f2643bb09ebb5a378591611fb03ceab1ef3fdec7 100644 (file)
@@ -28,5 +28,6 @@
       <address type='drive' controller='0' bus='1' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 39c3a1ccfebf5af552c488b1ab9c32db11dc1fa0..1f193c93cb93ab3fae87e124e49789df38f7145e 100644 (file)
@@ -26,5 +26,6 @@
        <address type='drive' controller='0' bus='1' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 47afcd710cad19b80c66b6ff0ea1fb2b9610272a..27e741ae840bede52e09b4a2ab86332fb14fbf84 100644 (file)
@@ -30,5 +30,6 @@
       <address type='drive' controller='0' bus='1' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 35474beb1eccc51e6b7881a385e0b5a4376e98f7..c0a4a083849ab72b22f75f9e0d8f8456f35a6b9d 100644 (file)
@@ -31,5 +31,6 @@
     </disk>
     <controller type='fdc' index='0'/>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 467fa5d65b74e5a5960d5b4505f29e0165692399..14f85cc72da297eb7168b865a04e0dfc1c97ffec 100644 (file)
@@ -35,5 +35,6 @@
       <address type='drive' controller='0' bus='1' unit='1'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index d59e1c0a27d0d786997d5219c47a5ea3c9ae033f..6d35eea5fc52a622b7973baf6c0ada41d4e6deb0 100644 (file)
@@ -22,5 +22,6 @@
       <source file='/tmp/usbdisk.img'/>
       <target dev='sda' bus='usb'/>
     </disk>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 8148626ad579a09c5f3cb9871070b484abc67879..79ab65422b5262b4d73536a9a024d4bc6b9fdba9 100644 (file)
@@ -24,5 +24,6 @@
       <target dev='sda' bus='usb'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 23930731f22f33b1dfc182c871ca546b9d833b02..a8aae71b3922ee223b16836df174b7a41dc9e323 100644 (file)
@@ -34,5 +34,6 @@
       <target dev='vdb' bus='virtio'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 0c364576016bb96bab8f6f79870e5ab2cf1e13af..a3dd4c637baa4789e5b6c2e3af42c3e8ccbbbeec 100644 (file)
@@ -34,5 +34,6 @@
       <target dev='xvdg' bus='xen'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index cb7b06d3d37706a8229fd4a68b04f20fe2682714..f5e5d74a890dd8a14f7d08c2372e7a085b589982 100644 (file)
@@ -23,5 +23,6 @@
       </encryption>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </disk>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 6da210d09709ba7f0891bac2c9fe923a32de64b7..ec74bdddd6e8ac96b3479c3b0980d25b61de4fff 100644 (file)
@@ -23,5 +23,6 @@
     </disk>
     <controller type='ide' index='0'/>
     <controller type='fdc' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index dcecd47d3d60aa964f7887a605070d49f9244602..06b0539894c4489f94c8bfaf18038a179e012d6c 100644 (file)
@@ -25,5 +25,6 @@
     <video>
       <model type='cirrus' vram='9216' heads='1'/>
     </video>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index f691bfeca55525e4b1ae2cda67849af192924fb1..16fd3badd4b5788a92299b56c4fc7a01ceb57ecd 100644 (file)
@@ -25,5 +25,6 @@
     <video>
       <model type='vga' vram='9216' heads='1'/>
     </video>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index da0f3c68af3c59aeeb39e8ec089835c1078f5315..a07f87b139bd3d0efe77ac3805f466765c848a88 100644 (file)
@@ -25,5 +25,6 @@
     <video>
       <model type='cirrus' vram='9216' heads='1'/>
     </video>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index da0f3c68af3c59aeeb39e8ec089835c1078f5315..a07f87b139bd3d0efe77ac3805f466765c848a88 100644 (file)
@@ -25,5 +25,6 @@
     <video>
       <model type='cirrus' vram='9216' heads='1'/>
     </video>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index da0f3c68af3c59aeeb39e8ec089835c1078f5315..a07f87b139bd3d0efe77ac3805f466765c848a88 100644 (file)
@@ -25,5 +25,6 @@
     <video>
       <model type='cirrus' vram='9216' heads='1'/>
     </video>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index ac5ad47ecaa10cd59158840d7b2f353367913aa0..711e3f8ca95370da43c82ae7e95c9929b6f7057b 100644 (file)
@@ -23,5 +23,6 @@
         <address domain='0x0000' bus='0x06' slot='0x12' function='0x5'/>
       </source>
     </hostdev>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index cb039af7839c108fe78f96d995e40faefcc74c7d..0347eeea19d7cca974810a02f6f4cf7b8138d8fb 100644 (file)
@@ -25,5 +25,6 @@
         <address domain='0x0000' bus='0x06' slot='0x12' function='0x5'/>
       </source>
     </hostdev>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 61bb2a2b2a137403bcb4fe9c18d51b4ea2a0d1a1..da2562e825e7167deb6438d798d2017fb24bb08e 100644 (file)
@@ -23,5 +23,6 @@
         <address bus='14' device='6'/>
       </source>
     </hostdev>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index c7d0d919f337037396304608fb61f02f22d34f10..4391bf108e8986b09898e3be8a3de34cae12fb5e 100644 (file)
@@ -25,5 +25,6 @@
         <address bus='14' device='6'/>
       </source>
     </hostdev>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 2e4b75fa68d34da7c160939cccf7a1c911b6599d..8ed7490eca1cab5671f5bfe2538a6cef441cd3cd 100644 (file)
@@ -23,5 +23,6 @@
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 8603d1bcbaeace481be32bc64e110471bae2cb21..b76a895ee424c08b9dff57fb1a82e8bb1dab79d1 100644 (file)
@@ -21,5 +21,6 @@
     </disk>
     <controller type='ide' index='0'/>
     <input type='mouse' bus='usb'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 6c2a41b70a1353ccfb8b73c3f94517fc4e99cf83..a878f8c9a6e6e838b6bc661802b00ef75d41de8c 100644 (file)
@@ -21,5 +21,6 @@
     </disk>
     <controller type='ide' index='0'/>
     <input type='tablet' bus='usb'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 91dd79524c9a7e3a8f151dbdf857e28f76f6aafd..0ea00c1bef35fd42d49e1def836d604ff36d024d 100644 (file)
@@ -25,5 +25,6 @@
     <video>
       <model type='xen' vram='4096' heads='1'/>
     </video>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 268954d0d91768304d483379164b2c778cafacc2..9f3fc85ea8b6028d161818e15837277569686622 100644 (file)
@@ -20,5 +20,6 @@
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 354b1d5d7cd1a31dbff75b58354478d1b652f379..c57e64ce02254cb120461be958e81bcdbc49233a 100644 (file)
@@ -20,5 +20,6 @@
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 533ea59b307ef25a18985ebc5d624249ca0794d9..ed91e37a128f1094155e7c114cf81abc25110807 100644 (file)
@@ -20,5 +20,6 @@
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 334a9f99c390d41f4bcb963146469d67fdf70ef2..8a13e474287fe62fc42b115b9d06e2e225747f40 100644 (file)
@@ -20,5 +20,6 @@
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 474832d05331326081672d6c052865cc68afbf3c..c8e87b058d8005e03864bb03fa07f6c1f374dd92 100644 (file)
@@ -23,5 +23,6 @@
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index f75722ffccfdcbf2a48753b18a7ba60d8745e1c0..bb4f5f05a3817424528e0ad4bf8db4b6be71a7fd 100644 (file)
@@ -20,5 +20,6 @@
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 474832d05331326081672d6c052865cc68afbf3c..c8e87b058d8005e03864bb03fa07f6c1f374dd92 100644 (file)
@@ -23,5 +23,6 @@
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index e24cd997ba2990e7c03863793fc5844c41292a22..516957fc0233ad07c0b48117dbb490eb1be33651 100644 (file)
@@ -25,5 +25,6 @@
       <script path='/etc/qemu-ifup'/>
       <target dev='nic02'/>
     </interface>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 105d3f629253db66e2cef870a361e3823fcf1b4f..7875d0ccf8a993c1fa8fb42637ecdaa819037f4a 100644 (file)
@@ -29,5 +29,6 @@
       <script path='/etc/qemu-ifup'/>
       <model type='e1000'/>
     </interface>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 27238fc75a61f14e304d15546af7cc0c586f0418..5d410b37537209f9bdcee958d650fca1c07b07e7 100644 (file)
@@ -24,5 +24,6 @@
       <mac address='00:11:22:33:44:55'/>
       <script path='/etc/qemu-ifup'/>
     </interface>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 525593dc8cf6ddfdd1cd0a9e3b7e9a9a278a80e7..ffc4a2ceb9d90e2198ff5c651d44f5ff33ad056e 100644 (file)
@@ -23,5 +23,6 @@
     <interface type='user'>
       <mac address='00:11:22:33:44:55'/>
     </interface>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 5d34bd492c73df8625a6f15fb728c5702fbd6dfe..e521796f9d36db964e48824a85de6cd778d7b048 100644 (file)
@@ -22,5 +22,6 @@
       <mac address='00:11:22:33:44:55'/>
       <model type='virtio'/>
     </interface>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 5d34bd492c73df8625a6f15fb728c5702fbd6dfe..e521796f9d36db964e48824a85de6cd778d7b048 100644 (file)
@@ -22,5 +22,6 @@
       <mac address='00:11:22:33:44:55'/>
       <model type='virtio'/>
     </interface>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index f8d9acfb6f60ce91d89be1201cb353a03d22fb14..9b9c059ad0680952d4f67cf29334d402ec4dc205 100644 (file)
@@ -24,5 +24,6 @@
       <mac address='00:11:22:33:44:55'/>
       <model type='virtio'/>
     </interface>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 533ea59b307ef25a18985ebc5d624249ca0794d9..ed91e37a128f1094155e7c114cf81abc25110807 100644 (file)
@@ -20,5 +20,6 @@
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 96a1ca5a17e8ab873945109fb7ec2594bcb19fad..1093901da14a52eb29c6b94e448ef046f2fc4bae 100644 (file)
@@ -25,5 +25,6 @@
       <protocol type='raw'/>
       <target port='0'/>
     </parallel>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 96a1ca5a17e8ab873945109fb7ec2594bcb19fad..1093901da14a52eb29c6b94e448ef046f2fc4bae 100644 (file)
@@ -25,5 +25,6 @@
       <protocol type='raw'/>
       <target port='0'/>
     </parallel>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 533ea59b307ef25a18985ebc5d624249ca0794d9..ed91e37a128f1094155e7c114cf81abc25110807 100644 (file)
@@ -20,5 +20,6 @@
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 533ea59b307ef25a18985ebc5d624249ca0794d9..ed91e37a128f1094155e7c114cf81abc25110807 100644 (file)
@@ -20,5 +20,6 @@
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index ae906c25bc735a68802018de87f303fa1968d976..5d249863414992e65989f9e19fba0224789caae4 100644 (file)
@@ -28,5 +28,6 @@
       <source path='/dev/ttyS2'/>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index ae906c25bc735a68802018de87f303fa1968d976..5d249863414992e65989f9e19fba0224789caae4 100644 (file)
@@ -28,5 +28,6 @@
       <source path='/dev/ttyS2'/>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index bdc483ffc7523b1a40134ee6a906ab0243692099..98bc4ef70f144f8be599b3f786281cb7ae4eaa56 100644 (file)
@@ -28,5 +28,6 @@
       <source path='/tmp/serial.log'/>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index bdc483ffc7523b1a40134ee6a906ab0243692099..98bc4ef70f144f8be599b3f786281cb7ae4eaa56 100644 (file)
@@ -28,5 +28,6 @@
       <source path='/tmp/serial.log'/>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 38a9498faa31fb037974ec2fe2b3af39b2475156..b121c5c72fe76b17f5d69fd48741bbc9534dfdd0 100644 (file)
@@ -30,5 +30,6 @@
     <console type='pty'>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 38a9498faa31fb037974ec2fe2b3af39b2475156..b121c5c72fe76b17f5d69fd48741bbc9534dfdd0 100644 (file)
@@ -30,5 +30,6 @@
     <console type='pty'>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index df694c78cdbfaa7dfad478dbc02c329e82e5eb0c..611ddb8d7b53ca67a3911a7372036d5f76b78c68 100644 (file)
@@ -26,5 +26,6 @@
     <console type='pty'>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index df694c78cdbfaa7dfad478dbc02c329e82e5eb0c..611ddb8d7b53ca67a3911a7372036d5f76b78c68 100644 (file)
@@ -26,5 +26,6 @@
     <console type='pty'>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index a8a35267133fe34601e06a217394b72b1327500e..286417e18176082398a77bff88382d08a1359cca 100644 (file)
@@ -30,5 +30,6 @@
       <protocol type='raw'/>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index fb8004214eda26036dab1208271681f17e379e0b..5aeceb0e8c42220e5ee62fa1e47e885c28409579 100644 (file)
@@ -30,5 +30,6 @@
       <protocol type='telnet'/>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index fb8004214eda26036dab1208271681f17e379e0b..5aeceb0e8c42220e5ee62fa1e47e885c28409579 100644 (file)
@@ -30,5 +30,6 @@
       <protocol type='telnet'/>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index a8a35267133fe34601e06a217394b72b1327500e..286417e18176082398a77bff88382d08a1359cca 100644 (file)
@@ -30,5 +30,6 @@
       <protocol type='raw'/>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 01dba47c88f53e34168011a6a205d2862a5f3e85..2c447389d59569fbe8c7bb173f0c5cd26e86b1e3 100644 (file)
@@ -30,5 +30,6 @@
       <source mode='connect' host='127.0.0.1' service='9998'/>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 01dba47c88f53e34168011a6a205d2862a5f3e85..2c447389d59569fbe8c7bb173f0c5cd26e86b1e3 100644 (file)
@@ -30,5 +30,6 @@
       <source mode='connect' host='127.0.0.1' service='9998'/>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 7b90d7b3c51d1cfa12b5f51515ad40d0d041abe0..2c07e94a0a639869bf5210d0a4d600373f07dbf3 100644 (file)
@@ -28,5 +28,6 @@
       <source mode='connect' path='/tmp/serial.sock'/>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 7b90d7b3c51d1cfa12b5f51515ad40d0d041abe0..2c07e94a0a639869bf5210d0a4d600373f07dbf3 100644 (file)
@@ -28,5 +28,6 @@
       <source mode='connect' path='/tmp/serial.sock'/>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 76b3e2abc89a96362e5588319854914cc247a0c7..5b39736d5bfabe27fa402454be947e57be704e90 100644 (file)
@@ -26,5 +26,6 @@
     <console type='vc'>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 76b3e2abc89a96362e5588319854914cc247a0c7..5b39736d5bfabe27fa402454be947e57be704e90 100644 (file)
@@ -26,5 +26,6 @@
     <console type='vc'>
       <target port='0'/>
     </console>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 8c33e6c90af1298fa7687d2af592684c669a1071..c7253462b2c6337a09677556b374c33b6fce07f1 100644 (file)
@@ -22,5 +22,6 @@
     <sound model='es1370'/>
     <sound model='sb16'/>
     <sound model='ac97'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 85f81cefaf7b076c0a3eaebcc9050446f4ca0c2f..d34e0b341141efb8540d75c4ac17fa351dce6c3d 100644 (file)
@@ -24,5 +24,6 @@
     <sound model='es1370'/>
     <sound model='sb16'/>
     <sound model='ac97'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 9b2ffdf8b246d03ced025011f2cfb4037c582bde..2dfc37e22e640e816841b57d27b40012059951f7 100644 (file)
@@ -19,5 +19,6 @@
       <target dev='hda' bus='ide'/>
     </disk>
     <watchdog model='ib700' action='poweroff'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index 07d2c14269daa423bc8a46c2f2c5b069f371bbb8..804dfd89355c758af5f88baaf142c1368b93702a 100644 (file)
@@ -21,5 +21,6 @@
     </disk>
     <controller type='ide' index='0'/>
     <watchdog model='ib700' action='poweroff'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
index ad1379b5c625d564e533eb2a3b69350bdb3190b8..24002b8f17805fb333621a70997b4a94d4a6f291 100644 (file)
@@ -352,6 +352,8 @@ mymain(int argc, char **argv)
     DO_TEST("watchdog", 0);
     DO_TEST("watchdog-device", QEMUD_CMD_FLAG_DEVICE |
             QEMUD_CMD_FLAG_NODEFCONFIG);
+    DO_TEST("balloon-device", QEMUD_CMD_FLAG_DEVICE |
+            QEMUD_CMD_FLAG_NODEFCONFIG);
     DO_TEST("sound", 0);
     DO_TEST("sound-device", QEMUD_CMD_FLAG_DEVICE |
             QEMUD_CMD_FLAG_NODEFCONFIG);