2016-06-24 19:07:56 +02:00
|
|
|
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.
|
|
|
|
|
2021-10-01 23:10:15 +02:00
|
|
|
Index: libvirt-7.8.0/src/libxl/libxl_driver.c
|
2016-06-24 19:07:56 +02:00
|
|
|
===================================================================
|
2021-10-01 23:10:15 +02:00
|
|
|
--- libvirt-7.8.0.orig/src/libxl/libxl_driver.c
|
|
|
|
+++ libvirt-7.8.0/src/libxl/libxl_driver.c
|
2021-09-14 23:02:46 +02:00
|
|
|
@@ -1343,6 +1343,63 @@ libxlDomainReboot(virDomainPtr dom, unsi
|
2016-06-24 19:07:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
+libxlDomainReset(virDomainPtr dom, unsigned int flags)
|
|
|
|
+{
|
2021-05-18 00:14:02 +02:00
|
|
|
+ libxlDriverPrivate *driver = dom->conn->privateData;
|
|
|
|
+ libxlDriverConfig *cfg = libxlDriverConfigGet(driver);
|
|
|
|
+ virDomainObj *vm;
|
2016-06-24 19:07:56 +02:00
|
|
|
+ int ret = -1;
|
|
|
|
+
|
|
|
|
+ virCheckFlags(0, -1);
|
|
|
|
+
|
|
|
|
+ if (!(vm = libxlDomObjFromDomain(dom)))
|
|
|
|
+ goto cleanup;
|
|
|
|
+
|
2021-05-18 00:14:02 +02:00
|
|
|
+ LIBXL_CHECK_DOM0_GOTO(vm->def->name, cleanup);
|
|
|
|
+
|
2016-06-24 19:07:56 +02:00
|
|
|
+ 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:
|
2016-07-01 18:39:05 +02:00
|
|
|
+ libxlDomainObjEndJob(driver, vm);
|
2016-06-24 19:07:56 +02:00
|
|
|
+
|
|
|
|
+ cleanup:
|
2016-07-01 18:39:05 +02:00
|
|
|
+ virDomainObjEndAPI(&vm);
|
2016-06-24 19:07:56 +02:00
|
|
|
+ virObjectUnref(cfg);
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
libxlDomainDestroyFlags(virDomainPtr dom,
|
|
|
|
unsigned int flags)
|
|
|
|
{
|
2021-09-14 23:02:46 +02:00
|
|
|
@@ -6441,6 +6498,7 @@ static virHypervisorDriver libxlHypervis
|
2016-06-24 19:07:56 +02:00
|
|
|
.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 */
|
2018-10-03 22:24:42 +02:00
|
|
|
#ifdef LIBXL_HAVE_DOMAIN_SUSPEND_ONLY
|