[libvirt] Fwd: Re: [Qemu-devel] Re: qemu-kvm-0.12 bug?

Hi, there is a new parameter in qemu-0.12 required for virtio_balloon support. Is there an appropriate XML-entry in libvirt's domain config yet or any plans to introduce one? A quick googling for "libvirt balloon" didn't reveal any hints. Adam, how did you test the memstat reporting feature? kr, tom ---------- Forwarded Message ---------- Subject: Re: [Qemu-devel] Re: qemu-kvm-0.12 bug? Date: Tuesday 29 December 2009 From: Luiz Capitulino <lcapitulino@redhat.com> To: Thomas Treutner <thomas@scripty.at> On Tue, 29 Dec 2009 13:08:26 +0100 Thomas Treutner <thomas@scripty.at> wrote:
On Tuesday 29 December 2009 12:48:39 Luiz Capitulino wrote:
On Tue, 29 Dec 2009 13:10:36 +0200 Avi Kivity <avi@redhat.com> wrote:
Hm, I get "The balloon device has not been activated by the guest" in the qemu monitor.
Is the "-balloon virtio" parameter passed on the command-line?
# grep balloon /usr/local/var/log/libvirt/qemu/* | wc -l 0
These logs include some history - so the parameter isn't used by libvirt even when ballooning works?
This parameter is new in qemu-0.12.

On Tue, 2009-12-29 at 13:57 +0100, Thomas Treutner wrote:
Hi,
there is a new parameter in qemu-0.12 required for virtio_balloon support. Is there an appropriate XML-entry in libvirt's domain config yet or any plans to introduce one? A quick googling for "libvirt balloon" didn't reveal any hints.
When developing this feature, I did the same search and came up empty-handed. This does need to be done. Is anyone working on it?
Adam, how did you test the memstat reporting feature?
I was able to test this by using a qemu wrapper script: #!/bin/bash exec /usr/bin/qemu-system-x86_64 -balloon virtio "$@" and by using the following emulator tag domain xml file: <emulator>/home/aglitke/images/qemu-wrapper.sh</emulator> -- Thanks, Adam

On Mon, Jan 04, 2010 at 09:22:05AM -0500, Adam Litke wrote:
On Tue, 2009-12-29 at 13:57 +0100, Thomas Treutner wrote:
Hi,
there is a new parameter in qemu-0.12 required for virtio_balloon support. Is there an appropriate XML-entry in libvirt's domain config yet or any plans to introduce one? A quick googling for "libvirt balloon" didn't reveal any hints.
When developing this feature, I did the same search and came up empty-handed. This does need to be done. Is anyone working on it?
Prior to 0.12, the balloon device was always enabled by default. No one mentioned that it had been disabled now until now :-( We will need to add the new balloon arg to enable it again. 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 :|

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@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 */ -- Thanks, Adam

On 01/04/2010 07:13 PM, 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.
Why add it automatically? I rather have the user state explicitly that a balloon is required. If the balloon is not used, we're just wasting a pci slot and enlarge the hypervisor signature. I'm in favor of using the balloon driver, but there are occasions it won't be required or we won't have a guest driver for it.
Signed-off-by: Adam Litke<agl@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 */

On Tue, Jan 05, 2010 at 09:43:32AM +0200, Dor Laor wrote:
On 01/04/2010 07:13 PM, 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.
Why add it automatically? I rather have the user state explicitly that a balloon is required. If the balloon is not used, we're just wasting a pci slot and enlarge the hypervisor signature.
I'm in favor of using the balloon driver, but there are occasions it won't be required or we won't have a guest driver for it.
Not having the balloon driver present is a regression from earlier libvirt behaviour, and likewise requiring it to be explicitly added to a guest will cause an immediate regression for all apps using libvirt 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 :|

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@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 :|

The test suite needs a small fixup with the qemu balloon patch applied. This patch applies on top of: qemu: Always enable the virtio balloon driver A small update to the qemuhelpdata test is required. It must be told about the new QEMUD_CMD_FLAG_BALLOON flag that will be turned on for qemu-kvm-0.11.0-rc2. Signed-off-by: Adam Litke <agl@us.ibm.com> diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c index a747da7..0a78b05 100644 --- a/tests/qemuhelptest.c +++ b/tests/qemuhelptest.c @@ -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; -- Thanks, Adam

On Tue, Jan 05, 2010 at 08:27:42AM -0600, Adam Litke wrote:
The test suite needs a small fixup with the qemu balloon patch applied.
This patch applies on top of: qemu: Always enable the virtio balloon driver
A small update to the qemuhelpdata test is required. It must be told about the new QEMUD_CMD_FLAG_BALLOON flag that will be turned on for qemu-kvm-0.11.0-rc2.
Signed-off-by: Adam Litke <agl@us.ibm.com>
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c index a747da7..0a78b05 100644 --- a/tests/qemuhelptest.c +++ b/tests/qemuhelptest.c @@ -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;
Okay, I have pushed both patches together, thanks, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (5)
-
Adam Litke
-
Daniel P. Berrange
-
Daniel Veillard
-
Dor Laor
-
Thomas Treutner