SHA256
1
0
forked from pool/libvirt
libvirt/c4fe29f8-use-shutdown-flag.patch
James Fehlig 553e9bd059 - Update to libvirt 1.2.4
- Primarily a bug-fix release.  See http://libvirt.org/news.html
    for a detailed list of bug fixes and improvements
  - Drop upstream patches:
    0e0c1a74-domid-fix.patch, 7a1452f5-libxl-empty-cdrom.patch
- libxl: Support ACPI shutdown event
  b98bf811-add-paravirt-shutdown-flag.patch,
  c4fe29f8-use-shutdown-flag.patch, da744120-use-reboot-flag.patch
  bnc#872777
- libx: Support migration
  libxl-migration-support.patch
  bnc#875193

OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=369
2014-05-06 18:02:27 +00:00

69 lines
2.2 KiB
Diff

commit c4fe29f88c4c1d5f571941e95c26246c8c84ce45
Author: Jim Fehlig <jfehlig@suse.com>
Date: Thu May 1 12:11:51 2014 -0600
libxl: support PARAVIRT and ACPI shutdown flags
Add support for VIR_DOMAIN_SHUTDOWN_PARAVIRT and
VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN flags in
libxlDomainShutdownFlags().
Index: libvirt-1.2.4/src/libxl/libxl_driver.c
===================================================================
--- libvirt-1.2.4.orig/src/libxl/libxl_driver.c
+++ libvirt-1.2.4/src/libxl/libxl_driver.c
@@ -873,7 +873,11 @@ libxlDomainShutdownFlags(virDomainPtr do
int ret = -1;
libxlDomainObjPrivatePtr priv;
- virCheckFlags(0, -1);
+ virCheckFlags(VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN |
+ VIR_DOMAIN_SHUTDOWN_PARAVIRT, -1);
+ if (flags == 0)
+ flags = VIR_DOMAIN_SHUTDOWN_PARAVIRT |
+ VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN;
if (!(vm = libxlDomObjFromDomain(dom)))
goto cleanup;
@@ -888,18 +892,33 @@ libxlDomainShutdownFlags(virDomainPtr do
}
priv = vm->privateData;
- if (libxl_domain_shutdown(priv->ctx, vm->def->id) != 0) {
+ if (flags & VIR_DOMAIN_SHUTDOWN_PARAVIRT) {
+ ret = libxl_domain_shutdown(priv->ctx, vm->def->id);
+ if (ret == 0)
+ goto cleanup;
+
+ if (ret != ERROR_NOPARAVIRT) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to shutdown domain '%d' with libxenlight"),
+ vm->def->id);
+ ret = -1;
+ goto cleanup;
+ }
+ ret = -1;
+ }
+
+ if (flags & VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN) {
+ ret = libxl_send_trigger(priv->ctx, vm->def->id,
+ LIBXL_TRIGGER_POWER, 0);
+ if (ret == 0)
+ goto cleanup;
+
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to shutdown domain '%d' with libxenlight"),
vm->def->id);
- goto cleanup;
+ ret = -1;
}
- /* vm is marked shutoff (or removed from domains list if not persistent)
- * in shutdown event handler.
- */
- ret = 0;
-
cleanup:
if (vm)
virObjectUnlock(vm);