2022-09-02 00:07:34 +02:00
|
|
|
From 02cd96b46167b2b9c27a388ec25d4ffdae6508ba Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jim Fehlig <jfehlig@suse.com>
|
|
|
|
Date: Tue, 5 Jul 2022 11:07:05 -0600
|
|
|
|
Subject: libxl: support domainReset
|
2016-06-24 19:07:56 +02:00
|
|
|
|
2022-09-02 00:07:34 +02:00
|
|
|
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.
|
2016-06-24 19:07:56 +02:00
|
|
|
|
2022-09-02 00:07:34 +02:00
|
|
|
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
|
|
|
|
---
|
|
|
|
src/libxl/libxl_driver.c | 58 ++++++++++++++++++++++++++++++++++++++++
|
|
|
|
1 file changed, 58 insertions(+)
|
|
|
|
|
Accepting request 1068569 from home:jfehlig:branches:Virtualization
- Update to libvirt 9.1.0
- Many incremental improvements and bug fixes, see
https://libvirt.org/news.html#v9-1-0-2023-03-01
- spec: Remove obsolete Groups tag
- spec: Integrate upstream spec file changes that split the
libvirt-daemon package, allowing more modular, customized
installations
- spec: New subpackages libvirt-daemon-common, libvirt-daemon-lock,
libvirt-daemon-log, libvirt-daemon-proxy, and
libvirt-daemon-plugin-lockd
- spec: Renamed subpackage libvirt-lock-sanlock to
libvirt-daemon-plugin-sanlock
- Dropped patches:
ef482951-apparmor-Allow-umount-dev.patch,
d6a8b9ee-qemu-Fix-managed-no-when-creating-ethdev.patch,
c3f16cea-qemu-cleanup-label-on-umount-failure.patch,
697c16e3-qemu_process-better-debug-message.patch,
5155ab4b-qemu_namespace-nested-mounts-when-umount.patch
OBS-URL: https://build.opensuse.org/request/show/1068569
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=968
2023-03-02 01:49:27 +01:00
|
|
|
Index: libvirt-9.1.0/src/libxl/libxl_driver.c
|
2016-06-24 19:07:56 +02:00
|
|
|
===================================================================
|
Accepting request 1068569 from home:jfehlig:branches:Virtualization
- Update to libvirt 9.1.0
- Many incremental improvements and bug fixes, see
https://libvirt.org/news.html#v9-1-0-2023-03-01
- spec: Remove obsolete Groups tag
- spec: Integrate upstream spec file changes that split the
libvirt-daemon package, allowing more modular, customized
installations
- spec: New subpackages libvirt-daemon-common, libvirt-daemon-lock,
libvirt-daemon-log, libvirt-daemon-proxy, and
libvirt-daemon-plugin-lockd
- spec: Renamed subpackage libvirt-lock-sanlock to
libvirt-daemon-plugin-sanlock
- Dropped patches:
ef482951-apparmor-Allow-umount-dev.patch,
d6a8b9ee-qemu-Fix-managed-no-when-creating-ethdev.patch,
c3f16cea-qemu-cleanup-label-on-umount-failure.patch,
697c16e3-qemu_process-better-debug-message.patch,
5155ab4b-qemu_namespace-nested-mounts-when-umount.patch
OBS-URL: https://build.opensuse.org/request/show/1068569
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=968
2023-03-02 01:49:27 +01:00
|
|
|
--- libvirt-9.1.0.orig/src/libxl/libxl_driver.c
|
|
|
|
+++ libvirt-9.1.0/src/libxl/libxl_driver.c
|
2022-10-05 16:41:22 +02:00
|
|
|
@@ -1355,6 +1355,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;
|
|
|
|
+
|
2022-10-05 16:41:22 +02:00
|
|
|
+ if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0)
|
2016-06-24 19:07:56 +02:00
|
|
|
+ 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:
|
2022-10-05 16:41:22 +02:00
|
|
|
+ virDomainObjEndJob(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)
|
|
|
|
{
|
Accepting request 1068569 from home:jfehlig:branches:Virtualization
- Update to libvirt 9.1.0
- Many incremental improvements and bug fixes, see
https://libvirt.org/news.html#v9-1-0-2023-03-01
- spec: Remove obsolete Groups tag
- spec: Integrate upstream spec file changes that split the
libvirt-daemon package, allowing more modular, customized
installations
- spec: New subpackages libvirt-daemon-common, libvirt-daemon-lock,
libvirt-daemon-log, libvirt-daemon-proxy, and
libvirt-daemon-plugin-lockd
- spec: Renamed subpackage libvirt-lock-sanlock to
libvirt-daemon-plugin-sanlock
- Dropped patches:
ef482951-apparmor-Allow-umount-dev.patch,
d6a8b9ee-qemu-Fix-managed-no-when-creating-ethdev.patch,
c3f16cea-qemu-cleanup-label-on-umount-failure.patch,
697c16e3-qemu_process-better-debug-message.patch,
5155ab4b-qemu_namespace-nested-mounts-when-umount.patch
OBS-URL: https://build.opensuse.org/request/show/1068569
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=968
2023-03-02 01:49:27 +01:00
|
|
|
@@ -6601,6 +6658,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
|