]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Always enable the virtio balloon driver
authorAdam Litke <agl@us.ibm.com>
Wed, 6 Jan 2010 17:01:51 +0000 (18:01 +0100)
committerDaniel Veillard <veillard@redhat.com>
Wed, 6 Jan 2010 17:01:51 +0000 (18:01 +0100)
The behavior for the qemu balloon device has changed.  Formerly, a virtio
balloon device was provided by default.  Now, '-balloon virtio' must be
specified on the command line to enable it.  This patch causes libvirt to
add '-balloon virtio' to the command line whenever the -balloon option is
available.
* src/qemu/qemu_conf.c src/qemu/qemu_conf.h: check for the new flag and
  add "-baloon vitio" to qemu command when needed
* tests/qemuhelptest.c: add the new flag for detection

src/qemu/qemu_conf.c
src/qemu/qemu_conf.h
tests/qemuhelptest.c

index f53c1f722fae74e8a234e2682edce8724b2fdb09..824055f3caebe8a8325e6ec01522900d44bc7c1b 100644 (file)
@@ -1113,6 +1113,8 @@ static unsigned int qemudComputeCmdFlags(const char *help,
         flags |= QEMUD_CMD_FLAG_MEM_PATH;
     if (strstr(help, "-chardev"))
         flags |= QEMUD_CMD_FLAG_CHARDEV;
+    if (strstr(help, "-balloon"))
+        flags |= QEMUD_CMD_FLAG_BALLOON;
 
     if (version >= 9000)
         flags |= QEMUD_CMD_FLAG_VNC_COLON;
@@ -2888,6 +2890,14 @@ int qemudBuildCommandLine(virConnectPtr conn,
         ADD_ARG_LIT(migrateFrom);
     }
 
+    /* QEMU changed its default behavior to not include the virtio balloon
+     * device.  Explicitly request it to ensure it will be present.
+     */
+    if (qemuCmdFlags & QEMUD_CMD_FLAG_BALLOON) {
+        ADD_ARG_LIT("-balloon");
+        ADD_ARG_LIT("virtio");
+    }
+
     ADD_ARG(NULL);
     ADD_ENV(NULL);
 
index 209cd31050fe6b5bd813a5bb3e9c79ed44a5f363..82254ca58491df9a6fce5f0fe80d2126e2cab586 100644 (file)
@@ -77,6 +77,7 @@ enum qemud_cmd_flags {
     QEMUD_CMD_FLAG_CHARDEV       = (1 << 22), /* Is the new -chardev arg available */
     QEMUD_CMD_FLAG_ENABLE_KVM    = (1 << 23), /* Is the -enable-kvm flag available to "enable KVM full virtualization support" */
     QEMUD_CMD_FLAG_MONITOR_JSON  = (1 << 24), /* JSON mode for monitor */
+    QEMUD_CMD_FLAG_BALLOON       = (1 << 25), /* -balloon available */
 };
 
 /* Main driver state */
index a747da740536650f2fe83dccd0ae292301a34acb..0a78b05082c79c87f104cb0119012a8ffd1bd021 100644 (file)
@@ -179,7 +179,8 @@ mymain(int argc, char **argv)
             QEMUD_CMD_FLAG_0_10 |
             QEMUD_CMD_FLAG_PCIDEVICE |
             QEMUD_CMD_FLAG_MEM_PATH |
-            QEMUD_CMD_FLAG_ENABLE_KVM,
+            QEMUD_CMD_FLAG_ENABLE_KVM |
+            QEMUD_CMD_FLAG_BALLOON,
             10092, 1,  0);
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;