[libvirt] [PATCH] qemu: Always enable the virtio balloon driver

Daniel P. Berrange berrange at redhat.com
Tue Jan 5 10:02:31 UTC 2010


On Mon, Jan 04, 2010 at 11:13:04AM -0600, Adam Litke wrote:
> 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.
> 
> Signed-off-by: Adam Litke <agl at us.ibm.com>
> 
> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> index 36bf9a2..07b0bd1 100644
> --- a/src/qemu/qemu_conf.c
> +++ b/src/qemu/qemu_conf.c
> @@ -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;
> @@ -2883,6 +2885,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);
>  
> diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
> index e958850..28f59bf 100644
> --- a/src/qemu/qemu_conf.h
> +++ b/src/qemu/qemu_conf.h
> @@ -78,6 +78,7 @@ enum qemud_cmd_flags {
>      QEMUD_CMD_FLAG_ENABLE_KVM    = (1 << 23), /* Is the -enable-kvm flag available to "enable KVM full virtualization support" */
>      QEMUD_CMD_FLAG_0_12          = (1 << 24),
>      QEMUD_CMD_FLAG_MONITOR_JSON  = QEMUD_CMD_FLAG_0_12, /* JSON mode for monitor */
> +    QEMUD_CMD_FLAG_BALLOON       = (1 << 25), /* -balloon available */
>  };
>  
>  /* Main driver state */
> 
> 

ACK, this looks good to me.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list