SHA256
1
0
forked from pool/libvirt
libvirt/libxl-dom-reset.patch
James Fehlig 14c21278a9 Accepting request 476767 from home:jfehlig:branches:Virtualization
- Update to libvirt 3.1.0
  - Modularize storage driver by splitting it into backend-specific
    subpackages
  - CVE-2017-2635, bsc#1027075
  - Many incremental improvements and bug fixes, see
    http://libvirt.org/news.html
  - Dropped patches:
    b018ada3-shunloadtest-build-fix.patch,
    f86a7a83-libxl-dom0-balloon-fix.patch,
    6e4759d0-libxl-timer-fix.patch,
    87df87e0-libxl-timer-tsc-emulate.patch,
    b4386fda-xenconfig-timer-fix.patch,
    d3970925-timer-tests.patch,
    321a28c6-libxl-default-disk-format.patch,
    bd116810-libxl-fix-disk-detach.patch,
    ff225538-libxl-autoballoon-setting.patch,
    c89a6e78-libxl-physinfo-cleanup.patch,
    d2b77608-libxl-maxmem-fix.patch,
    79692c38-libxl-dom0-maxmem.patch,
    4ab0c959-libxl-mem-leak.patch,
    2dc1cf19-libxl-double-free.patch,
    apparmor-errormsg-fix.patch,
    apparmor-alt-seclabel.patch,
    qemu-disable-namespaces.patch

OBS-URL: https://build.opensuse.org/request/show/476767
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=588
2017-03-03 15:02:55 +00:00

85 lines
2.6 KiB
Diff

commit 3ac6e50943a775c545aa7d4e4bde5fcb8a163b64
Author: Jim Fehlig <jfehlig@suse.com>
Date: Mon Jun 23 15:51:20 2014 -0600
libxl: support domainReset
Currently, libxl_send_trigger() does not implement the LIBXL_TRIGGER_RESET
option, but domainReset can be implemented in the libxl driver by
forcibly destroying the domain and starting it again.
Index: libvirt-3.1.0/src/libxl/libxl_driver.c
===================================================================
--- libvirt-3.1.0.orig/src/libxl/libxl_driver.c
+++ libvirt-3.1.0/src/libxl/libxl_driver.c
@@ -1389,6 +1389,61 @@ libxlDomainReboot(virDomainPtr dom, unsi
}
static int
+libxlDomainReset(virDomainPtr dom, unsigned int flags)
+{
+ libxlDriverPrivatePtr driver = dom->conn->privateData;
+ libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
+ virDomainObjPtr vm;
+ int ret = -1;
+
+ virCheckFlags(0, -1);
+
+ if (!(vm = libxlDomObjFromDomain(dom)))
+ goto cleanup;
+
+ if (virDomainResetEnsureACL(dom->conn, vm->def) < 0)
+ goto cleanup;
+
+ if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
+ goto cleanup;
+
+ if (!virDomainObjIsActive(vm)) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("Domain is not running"));
+ goto endjob;
+ }
+
+ /*
+ * The semantics of reset can be achieved by forcibly destroying
+ * the domain and starting it again.
+ */
+ if (libxl_domain_destroy(cfg->ctx, vm->def->id, NULL) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to reset domain '%d'"), vm->def->id);
+ goto endjob;
+ }
+
+ libxlDomainCleanup(driver, vm);
+
+ if (libxlDomainStartNew(driver, vm, false) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to start domain '%d' after reset"),
+ vm->def->id);
+ goto endjob;
+ }
+
+ ret = 0;
+
+ endjob:
+ libxlDomainObjEndJob(driver, vm);
+
+ cleanup:
+ virDomainObjEndAPI(&vm);
+ virObjectUnref(cfg);
+ return ret;
+}
+
+static int
libxlDomainDestroyFlags(virDomainPtr dom,
unsigned int flags)
{
@@ -6497,6 +6552,7 @@ static virHypervisorDriver libxlHypervis
.domainShutdown = libxlDomainShutdown, /* 0.9.0 */
.domainShutdownFlags = libxlDomainShutdownFlags, /* 0.9.10 */
.domainReboot = libxlDomainReboot, /* 0.9.0 */
+ .domainReset = libxlDomainReset, /* 1.2.16 */
.domainDestroy = libxlDomainDestroy, /* 0.9.0 */
.domainDestroyFlags = libxlDomainDestroyFlags, /* 0.9.4 */
.domainGetOSType = libxlDomainGetOSType, /* 0.9.0 */