diff --git a/src/libxl/libxl_api_wrapper.h b/src/libxl/libxl_api_wrapper.h index c912aabadb..13200cfec6 100644 --- a/src/libxl/libxl_api_wrapper.h +++ b/src/libxl/libxl_api_wrapper.h @@ -100,3 +100,17 @@ libxlDomainPauseWrapper(libxl_ctx *ctx, uint32_t domid) return ret; } + +static inline int +libxlDomainUnpauseWrapper(libxl_ctx *ctx, uint32_t domid) +{ + int ret; + +#if LIBXL_API_VERSION < 0x041300 + ret = libxl_domain_unpause(ctx, domid); +#else + ret = libxl_domain_unpause(ctx, domid, NULL); +#endif + + return ret; +} diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 809108fd7d..a034fe2219 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -594,7 +594,7 @@ libxlDomainShutdownThread(void *opaque) goto endjob; } libxl_evenable_domain_death(cfg->ctx, vm->def->id, 0, &priv->deathW); - libxl_domain_unpause(cfg->ctx, vm->def->id); + libxlDomainUnpauseWrapper(cfg->ctx, vm->def->id); #endif } else { VIR_INFO("Unhandled shutdown_reason %d", xl_reason); @@ -1459,7 +1459,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver, goto destroy_dom; if (!start_paused) { - libxl_domain_unpause(cfg->ctx, domid); + libxlDomainUnpauseWrapper(cfg->ctx, domid); virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BOOTED); } else { virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER); diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 05d32513ad..ca5d48cf63 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -1238,7 +1238,7 @@ libxlDomainResume(virDomainPtr dom) goto endjob; if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) { - if (libxl_domain_unpause(cfg->ctx, vm->def->id) != 0) { + if (libxlDomainUnpauseWrapper(cfg->ctx, vm->def->id) != 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to resume domain '%d' with libxenlight"), vm->def->id); @@ -2091,7 +2091,7 @@ libxlDomainCoreDump(virDomainPtr dom, const char *to, unsigned int flags) unpause: if (virDomainObjIsActive(vm) && paused) { - if (libxl_domain_unpause(cfg->ctx, vm->def->id) != 0) { + if (libxlDomainUnpauseWrapper(cfg->ctx, vm->def->id) != 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("After dumping core, failed to resume domain '%d' with" " libxenlight"), vm->def->id); diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c index cb474123ea..39d83cd26c 100644 --- a/src/libxl/libxl_migration.c +++ b/src/libxl/libxl_migration.c @@ -34,6 +34,7 @@ #include "virthread.h" #include "virhook.h" #include "rpc/virnetsocket.h" +#include "libxl_api_wrapper.h" #include "libxl_domain.h" #include "libxl_driver.h" #include "libxl_conf.h" @@ -1296,7 +1297,7 @@ libxlDomainMigrationDstFinish(virConnectPtr dconn, /* Unpause if requested */ if (!(flags & VIR_MIGRATE_PAUSED)) { - if (libxl_domain_unpause(cfg->ctx, vm->def->id) != 0) { + if (libxlDomainUnpauseWrapper(cfg->ctx, vm->def->id) != 0) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("Failed to unpause domain")); goto cleanup;