libxl: add API wrapper for libxl_domain_unpause

Upcoming changes will use different LIBXL_API_VERSION variants.

Prepare libxl_domain_unpause, 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@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
Olaf Hering 2021-03-25 17:26:06 +01:00 committed by Jim Fehlig
parent c44c970aa8
commit 9960337cd6
4 changed files with 20 additions and 5 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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;