#define LIBXL_HAVE_NO_SUSPEND_RESUME 1
#endif
+/*
+ * LIBXL_HAVE_DOMAIN_SUSPEND_ONLY
+ *
+ * If this is defined, function libxl_domains_suspend_only() is available.
+ */
+
+#define LIBXL_HAVE_DOMAIN_SUSPEND_ONLY 1
+
/*
* LIBXL_HAVE_DEVICE_PCI_SEIZE
*
#define LIBXL_SUSPEND_DEBUG 1
#define LIBXL_SUSPEND_LIVE 2
+/*
+ * Only suspend domain, do not save its state to file, do not destroy it.
+ * Suspended domain can be resumed with libxl_domain_resume()
+ */
+int libxl_domain_suspend_only(libxl_ctx *ctx, uint32_t domid,
+ const libxl_asyncop_how *ao_how)
+ LIBXL_EXTERNAL_CALLERS_ONLY;
+
/* @param suspend_cancel [from xenctrl.h:xc_domain_resume( @param fast )]
* If this parameter is true, use co-operative resume. The guest
* must support this.
return AO_CREATE_FAIL(rc);
}
+static void domain_suspend_empty_cb(libxl__egc *egc,
+ libxl__domain_suspend_state *dss, int rc)
+{
+ STATE_AO_GC(dss->ao);
+ libxl__ao_complete(egc,ao,rc);
+}
+
+int libxl_domain_suspend_only(libxl_ctx *ctx, uint32_t domid,
+ const libxl_asyncop_how *ao_how)
+{
+ AO_CREATE(ctx, domid, ao_how);
+ libxl__domain_suspend_state *dsps;
+ int rc;
+
+ libxl_domain_type type = libxl__domain_type(gc, domid);
+ if (type == LIBXL_DOMAIN_TYPE_INVALID) {
+ rc = ERROR_FAIL;
+ goto out_err;
+ }
+
+ GCNEW(dsps);
+ dsps->ao = ao;
+ dsps->domid = domid;
+ dsps->type = type;
+ rc = libxl__domain_suspend_init(egc, dsps, type);
+ if (rc < 0) goto out_err;
+ dsps->callback_common_done = domain_suspend_empty_cb;
+ libxl__domain_suspend(egc, dsps);
+ return AO_INPROGRESS;
+
+ out_err:
+ return AO_CREATE_FAIL(rc);
+}
+
int libxl_domain_pause(libxl_ctx *ctx, uint32_t domid)
{
int ret;