[libvirt] [PATCH] qemu: Fix shutdown regression
Daniel P. Berrange
berrange at redhat.com
Wed Sep 21 09:29:35 UTC 2011
On Wed, Sep 21, 2011 at 10:43:32AM +0200, Jiri Denemark wrote:
> The commit that prevents disk corruption on domain shutdown
> (96fc4784177ecb70357518fa863442455e45ad0e) causes regression with QEMU
> 0.14.* and 0.15.* because of a regression bug in QEMU that was fixed
> only recently in QEMU git. The affected versions of QEMU do not quit on
> SIGTERM if started with -no-shutdown, which we use to implement fake
> reboot. Since -no-shutdown tells QEMU not to quit automatically on guest
> shutdown, domains started using the affected QEMU cannot be shutdown
> properly and stay in a paused state.
>
> This patch disables fake reboot feature on such QEMU by not using
> -no-shutdown, which makes shutdown work as expected. However,
> virDomainReboot will not work in this case and it will report "Requested
> operation is not valid: Reboot is not supported with this QEMU binary".
>
> NB, the qemu capability is called QEMU_CAPS_NO_FAKE_REBOOT for backward
> compatibility with running domains started by libvirtd that didn't have
> this patch in.
> ---
> src/qemu/qemu_capabilities.c | 9 +++++++++
> src/qemu/qemu_capabilities.h | 1 +
> src/qemu/qemu_command.c | 2 +-
> src/qemu/qemu_driver.c | 6 ++++++
> 4 files changed, 17 insertions(+), 1 deletions(-)
>
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 36f47a9..5b9e4a9 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -136,6 +136,7 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
> "pci-ohci",
> "usb-redir",
> "usb-hub",
> + "no-fake-reboot",
> );
This should really be 'no-shutdown'.
The reboot code is just one current potential user of that capability.
> struct qemu_feature_flags {
> @@ -1008,6 +1009,14 @@ qemuCapsComputeCmdFlags(const char *help,
> qemuCapsSet(flags, QEMU_CAPS_VHOST_NET);
> }
>
> + /* Do not use -no-shutdown to implement fake reboot if qemu doesn't support
> + * it or SIGTERM handling is most likely buggy when used with -no-shutdown
> + * (which applies for qemu 0.14.* and 0.15.*)
> + */
> + if (!strstr(help, "-no-shutdown") ||
> + version / 1000 == 14 || version / 1000 == 15)
> + qemuCapsSet(flags, QEMU_CAPS_NO_FAKE_REBOOT);
> +
> /*
> * Handling of -incoming arg with varying features
> * -incoming tcp (kvm >= 79, qemu >= 0.10.0)
> diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
> index 96b7a3b..b4f3ba4 100644
> --- a/src/qemu/qemu_capabilities.h
> +++ b/src/qemu/qemu_capabilities.h
> @@ -110,6 +110,7 @@ enum qemuCapsFlags {
> QEMU_CAPS_PCI_OHCI = 71, /* -device pci-ohci */
> QEMU_CAPS_USB_REDIR = 72, /* -device usb-redir */
> QEMU_CAPS_USB_HUB = 73, /* -device usb-hub */
> + QEMU_CAPS_NO_FAKE_REBOOT = 74, /* don't fake reboot using -no-shutdown */
s/FAKE_REBOOT/SHUTDOWN/
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list