[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen staging] libxl: Re-introduce libxl__domain_unpause



commit beca37ba97d9d64b7cd9a606d93cb498bf681ad1
Author:     Anthony PERARD <anthony.perard@xxxxxxxxxx>
AuthorDate: Sun May 26 15:01:35 2019 +0100
Commit:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
CommitDate: Fri Sep 20 10:42:42 2019 +0100

    libxl: Re-introduce libxl__domain_unpause
    
    libxl__domain_unpause is a reimplementation of
    libxl__domain_unpause_deprecated with asynchronous operation.
    
    Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl_domain.c   | 52 ++++++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl_internal.h |  5 ++++-
 2 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_domain.c b/tools/libxl/libxl_domain.c
index d78ffa6b60..52a8bd7895 100644
--- a/tools/libxl/libxl_domain.c
+++ b/tools/libxl/libxl_domain.c
@@ -639,6 +639,58 @@ out:
     return rc;
 }
 
+static void domain_unpause_done(libxl__egc *egc,
+                                libxl__dm_resume_state *,
+                                int rc);
+
+void libxl__domain_unpause(libxl__egc *egc,
+                           libxl__dm_resume_state *dmrs)
+{
+    STATE_AO_GC(dmrs->ao);
+    int rc = 0;
+
+    /* Convenience aliases */
+    libxl_domid domid = dmrs->domid;
+
+    libxl_domain_type type = libxl__domain_type(gc, domid);
+    if (type == LIBXL_DOMAIN_TYPE_INVALID) {
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+    if (type == LIBXL_DOMAIN_TYPE_HVM) {
+        dmrs->dm_resumed_callback = domain_unpause_done;
+        libxl__dm_resume(egc, dmrs); /* must be last */
+        return;
+    }
+    rc = 0;
+out:
+    domain_unpause_done(egc, dmrs, rc);
+}
+
+static void domain_unpause_done(libxl__egc *egc,
+                                libxl__dm_resume_state *dmrs,
+                                int rc)
+{
+    EGC_GC;
+    int r;
+
+    /* Convenience aliases */
+    libxl_domid domid = dmrs->domid;
+
+    if (rc) goto out;
+
+    r = xc_domain_unpause(CTX->xch, domid);
+    if (r < 0) {
+        LOGED(ERROR, domid, "Unpausing domain");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+    rc = 0;
+out:
+    dmrs->callback(egc, dmrs, rc);
+}
+
 int libxl_domain_unpause(libxl_ctx *ctx, uint32_t domid,
                          const libxl_asyncop_how *ao_how)
 {
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 6bb6d6d2e1..a0cb6d2885 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1351,9 +1351,10 @@ struct libxl__dm_resume_state {
     libxl_domid domid;
     void (*callback)(libxl__egc *, libxl__dm_resume_state *, int rc);
 
-    /* private to libxl__domain_resume */
+    /* private to libxl__domain_resume and libxl__domain_unpause */
     void (*dm_resumed_callback)(libxl__egc *,
                                 libxl__dm_resume_state *, int rc);
+    /* private to libxl__domain_resume */
     bool suspend_cancel;
 
     /* private to libxl__dm_resume */
@@ -1366,6 +1367,8 @@ _hidden void libxl__dm_resume(libxl__egc *egc,
 _hidden void libxl__domain_resume(libxl__egc *egc,
                                   libxl__dm_resume_state *dmrs,
                                   bool suspend_cancel);
+_hidden void libxl__domain_unpause(libxl__egc *,
+                                   libxl__dm_resume_state *dmrs);
 
 /* returns 0 or 1, or a libxl error code */
 _hidden int libxl__domain_pvcontrol_available(libxl__gc *gc, uint32_t domid);
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.