aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl.c
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2012-08-23 19:00:09 +0100
committerIan Campbell <ian.campbell@citrix.com>2012-08-23 19:00:09 +0100
commit7eaccb3cc3fabdde1fe7ef55300941f5520ca785 (patch)
treebd8515be66ce604994f8bc2aed13e8251fe49678 /tools/libxl/libxl.c
parentfd5729846b86580e1878b3af4565fb4d8c444457 (diff)
downloadxen-7eaccb3cc3fabdde1fe7ef55300941f5520ca785.tar.gz
xen-7eaccb3cc3fabdde1fe7ef55300941f5520ca785.tar.bz2
xen-7eaccb3cc3fabdde1fe7ef55300941f5520ca785.zip
libxl: make domain resume API asynchronous
Although the current implementation has no asynchromous parts I can envisage it needing to do bits of create/destroy like functionality which may need async support in the future. To do this make the meat into an internal libxl__domain_resume function in order to satisfy the no-internal-callers rule for the async function. Since I needed to touch the logging to s/ctx/CTX/ anyway switch to the LOG* helper macros. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Roger Pau Monne <roger.pau@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl.c')
-rw-r--r--tools/libxl/libxl.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 8ea34788bf..0857c48aee 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -396,15 +396,12 @@ int libxl_domain_rename(libxl_ctx *ctx, uint32_t domid,
return rc;
}
-int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid, int suspend_cancel)
+int libxl__domain_resume(libxl__gc *gc, uint32_t domid, int suspend_cancel)
{
- GC_INIT(ctx);
int rc = 0;
- if (xc_domain_resume(ctx->xch, domid, suspend_cancel)) {
- LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
- "xc_domain_resume failed for domain %u",
- domid);
+ if (xc_domain_resume(CTX->xch, domid, suspend_cancel)) {
+ LOGE(ERROR, "xc_domain_resume failed for domain %u", domid);
rc = ERROR_FAIL;
goto out;
}
@@ -418,24 +415,29 @@ int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid, int suspend_cancel)
if (type == LIBXL_DOMAIN_TYPE_HVM) {
rc = libxl__domain_resume_device_model(gc, domid);
if (rc) {
- LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
- "failed to resume device model for domain %u:%d",
- domid, rc);
+ LOG(ERROR, "failed to resume device model for domain %u:%d",
+ domid, rc);
goto out;
}
}
- if (!xs_resume_domain(ctx->xsh, domid)) {
- LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
- "xs_resume_domain failed for domain %u",
- domid);
+ if (!xs_resume_domain(CTX->xsh, domid)) {
+ LOGE(ERROR, "xs_resume_domain failed for domain %u", domid);
rc = ERROR_FAIL;
}
out:
- GC_FREE;
return rc;
}
+int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid, int suspend_cancel,
+ const libxl_asyncop_how *ao_how)
+{
+ AO_CREATE(ctx, domid, ao_how);
+ int rc = libxl__domain_resume(gc, domid, suspend_cancel);
+ libxl__ao_complete(egc, ao, rc);
+ return AO_INPROGRESS;
+}
+
/*
* Preserves a domain but rewrites xenstore etc to make it unique so
* that the domain can be restarted.