[PATCH v2 05/12] libxl: add API wrapper for libxl_domain_pause

Olaf Hering olaf at aepfle.de
Thu Mar 25 16:26:05 UTC 2021


Upcoming changes will use different LIBXL_API_VERSION variants.

Prepare libxl_domain_pause, which got a new parameter
"ao_how" in Xen 4.12. libvirt does not use this parameter.

No functional change intended.

Signed-off-by: Olaf Hering <olaf at aepfle.de>
---
 src/libxl/libxl_api_wrapper.h | 14 ++++++++++++++
 src/libxl/libxl_driver.c      |  4 ++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/libxl/libxl_api_wrapper.h b/src/libxl/libxl_api_wrapper.h
index 6744ba7db3..c912aabadb 100644
--- a/src/libxl/libxl_api_wrapper.h
+++ b/src/libxl/libxl_api_wrapper.h
@@ -86,3 +86,17 @@ libxlDomainRebootWrapper(libxl_ctx *ctx, uint32_t domid)
 
     return ret;
 }
+
+static inline int
+libxlDomainPauseWrapper(libxl_ctx *ctx, uint32_t domid)
+{
+    int ret;
+
+#if LIBXL_API_VERSION < 0x041300
+    ret = libxl_domain_pause(ctx, domid);
+#else
+    ret = libxl_domain_pause(ctx, domid, NULL);
+#endif
+
+    return ret;
+}
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index cad008c1f5..afde679269 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1185,7 +1185,7 @@ libxlDomainSuspend(virDomainPtr dom)
         goto endjob;
 
     if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PAUSED) {
-        if (libxl_domain_pause(cfg->ctx, vm->def->id) != 0) {
+        if (libxlDomainPauseWrapper(cfg->ctx, vm->def->id) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Failed to suspend domain '%d' with libxenlight"),
                            vm->def->id);
@@ -2048,7 +2048,7 @@ libxlDomainCoreDump(virDomainPtr dom, const char *to, unsigned int flags)
 
     if (!(flags & VIR_DUMP_LIVE) &&
         virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
-        if (libxl_domain_pause(cfg->ctx, vm->def->id) != 0) {
+        if (libxlDomainPauseWrapper(cfg->ctx, vm->def->id) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Before dumping core, failed to suspend domain '%d'"
                              " with libxenlight"),




More information about the libvir-list mailing list