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

[Xen-devel] [PATCH 09/35] libxl: Deprecate libxl__domain_{unpause, resume}



These two functions are used from many places in libxl and need to
change to be able to accomodate libxl__ev_qmp calls and thus needs to
be asynchronous.

(There is also libxl__domain_resume_device_model in the mix.)

A later patch will introduce a new libxl__domain_resume and
libxl__domain_unpause which will make use of libxl__ev_qmp.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 tools/libxl/libxl_colo_restore.c |  4 ++--
 tools/libxl/libxl_colo_save.c    |  4 ++--
 tools/libxl/libxl_dm.c           |  2 +-
 tools/libxl/libxl_dom_suspend.c  |  6 +++---
 tools/libxl/libxl_domain.c       |  8 ++++----
 tools/libxl/libxl_internal.h     | 12 ++++++++----
 tools/libxl/libxl_remus.c        |  2 +-
 7 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/tools/libxl/libxl_colo_restore.c b/tools/libxl/libxl_colo_restore.c
index aaa70552b8..aa365670fb 100644
--- a/tools/libxl/libxl_colo_restore.c
+++ b/tools/libxl/libxl_colo_restore.c
@@ -124,7 +124,7 @@ static void colo_resume_vm(libxl__egc *egc,
                 return;
             }
         }
-        rc = libxl__domain_resume(gc, crs->domid, 0);
+        rc = libxl__domain_resume_deprecated(gc, crs->domid, 0);
         if (rc)
             LOGD(ERROR, crs->domid, "cannot resume secondary vm");
 
@@ -853,7 +853,7 @@ static void colo_unpause_svm(libxl__egc *egc,
     EGC_GC;
 
     /* We have enabled secondary vm's logdirty, so we can unpause it now */
-    rc = libxl__domain_unpause(gc, domid);
+    rc = libxl__domain_unpause_deprecated(gc, domid);
     if (rc) {
         LOGD(ERROR, domid, "cannot unpause secondary vm");
         goto out;
diff --git a/tools/libxl/libxl_colo_save.c b/tools/libxl/libxl_colo_save.c
index 1d261a1639..b47f038f6e 100644
--- a/tools/libxl/libxl_colo_save.c
+++ b/tools/libxl/libxl_colo_save.c
@@ -470,7 +470,7 @@ static void colo_preresume_cb(libxl__egc *egc,
     }
 
     /* Resumes the domain and the device model */
-    if (libxl__domain_resume(gc, dss->domid, /* Fast Suspend */1)) {
+    if (libxl__domain_resume_deprecated(gc, dss->domid, /* Fast Suspend */1)) {
         LOGD(ERROR, dss->domid, "cannot resume primary vm");
         goto out;
     }
@@ -480,7 +480,7 @@ static void colo_preresume_cb(libxl__egc *egc,
      * no disk migration.
      */
     if (css->paused) {
-        rc = libxl__domain_unpause(gc, dss->domid);
+        rc = libxl__domain_unpause_deprecated(gc, dss->domid);
         if (rc) {
             LOGD(ERROR, dss->domid, "cannot unpause primary vm");
             goto out;
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index bb5339784e..246c570121 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -2404,7 +2404,7 @@ static void stubdom_pvqemu_cb(libxl__egc *egc,
         goto out;
     }
 
-    rc = libxl__domain_unpause(gc, dm_domid);
+    rc = libxl__domain_unpause_deprecated(gc, dm_domid);
     if (rc) goto out;
 
     sdss->xswait.ao = ao;
diff --git a/tools/libxl/libxl_dom_suspend.c b/tools/libxl/libxl_dom_suspend.c
index d1af3a6573..2460021e5a 100644
--- a/tools/libxl/libxl_dom_suspend.c
+++ b/tools/libxl/libxl_dom_suspend.c
@@ -421,7 +421,7 @@ static void domain_suspend_callback_common_done(libxl__egc 
*egc,
 
 /*======================= Domain resume ========================*/
 
-int libxl__domain_resume_device_model(libxl__gc *gc, uint32_t domid)
+int libxl__domain_resume_device_model_deprecated(libxl__gc *gc, uint32_t domid)
 {
     const char *path, *state;
 
@@ -449,7 +449,7 @@ int libxl__domain_resume_device_model(libxl__gc *gc, 
uint32_t domid)
     return 0;
 }
 
-int libxl__domain_resume(libxl__gc *gc, uint32_t domid, int suspend_cancel)
+int libxl__domain_resume_deprecated(libxl__gc *gc, uint32_t domid, int 
suspend_cancel)
 {
     int rc = 0;
 
@@ -460,7 +460,7 @@ int libxl__domain_resume(libxl__gc *gc, uint32_t domid, int 
suspend_cancel)
     }
 
     if (type == LIBXL_DOMAIN_TYPE_HVM) {
-        rc = libxl__domain_resume_device_model(gc, domid);
+        rc = libxl__domain_resume_device_model_deprecated(gc, domid);
         if (rc) {
             LOGD(ERROR, domid, "failed to resume device model:%d", rc);
             goto out;
diff --git a/tools/libxl/libxl_domain.c b/tools/libxl/libxl_domain.c
index f2d5c86427..80797c5ed2 100644
--- a/tools/libxl/libxl_domain.c
+++ b/tools/libxl/libxl_domain.c
@@ -178,7 +178,7 @@ 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);
+    int rc = libxl__domain_resume_deprecated(gc, domid, suspend_cancel);
     libxl__ao_complete(egc, ao, rc);
     return AO_INPROGRESS;
 }
@@ -593,7 +593,7 @@ int libxl_domain_core_dump(libxl_ctx *ctx, uint32_t domid,
     return AO_INPROGRESS;
 }
 
-int libxl__domain_unpause(libxl__gc *gc, libxl_domid domid)
+int libxl__domain_unpause_deprecated(libxl__gc *gc, libxl_domid domid)
 {
     int r, rc;
 
@@ -604,7 +604,7 @@ int libxl__domain_unpause(libxl__gc *gc, libxl_domid domid)
     }
 
     if (type == LIBXL_DOMAIN_TYPE_HVM) {
-        rc = libxl__domain_resume_device_model(gc, domid);
+        rc = libxl__domain_resume_device_model_deprecated(gc, domid);
         if (rc < 0) {
             LOGD(ERROR, domid,
                  "Failed to unpause device model for domain: %d", rc);
@@ -628,7 +628,7 @@ int libxl_domain_unpause(libxl_ctx *ctx, uint32_t domid,
     AO_CREATE(ctx, domid, ao_how);
     int rc = 0;
 
-    rc = libxl__domain_unpause(gc, domid);
+    rc = libxl__domain_unpause_deprecated(gc, domid);
     if (rc) goto out;
 
     libxl__ao_complete(egc, ao, rc);
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 5e09e602ed..da3631d853 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1314,7 +1314,8 @@ _hidden int libxl__domain_rename(libxl__gc *gc, uint32_t 
domid,
                                  const char *old_name, const char *new_name,
                                  xs_transaction_t trans);
 
-_hidden int libxl__domain_resume_device_model(libxl__gc *gc, uint32_t domid);
+/* Deprecated, use libxl__dm_resume instead. */
+_hidden int libxl__domain_resume_device_model_deprecated(libxl__gc *gc, 
uint32_t domid);
 
 _hidden const char *libxl__userdata_path(libxl__gc *gc, uint32_t domid,
                                          const char *userdata_userid,
@@ -1331,8 +1332,12 @@ _hidden int libxl__userdata_store(libxl__gc *gc, 
uint32_t domid,
                                   const char *userdata_userid,
                                   const uint8_t *data, int datalen);
 
-_hidden int libxl__domain_resume(libxl__gc *gc, uint32_t domid,
-                                 int suspend_cancel);
+/* Deprecated, use libxl__domain_resume instead */
+_hidden int libxl__domain_resume_deprecated(libxl__gc *gc, uint32_t domid,
+                                            int suspend_cancel);
+/* Deprecated, use libxl__domain_unpause instead */
+_hidden int libxl__domain_unpause_deprecated(libxl__gc *,
+                                             libxl_domid domid);
 
 /* returns 0 or 1, or a libxl error code */
 _hidden int libxl__domain_pvcontrol_available(libxl__gc *gc, uint32_t domid);
@@ -4103,7 +4108,6 @@ _hidden void libxl__remus_teardown(libxl__egc *egc,
                                    int rc);
 _hidden void libxl__remus_restore_setup(libxl__egc *egc,
                                         libxl__domain_create_state *dcs);
-_hidden int libxl__domain_unpause(libxl__gc *, libxl_domid domid);
 
 
 /*
diff --git a/tools/libxl/libxl_remus.c b/tools/libxl/libxl_remus.c
index 29a47838c8..6338a1bae5 100644
--- a/tools/libxl/libxl_remus.c
+++ b/tools/libxl/libxl_remus.c
@@ -267,7 +267,7 @@ static void remus_devices_preresume_cb(libxl__egc *egc,
         goto out;
 
     /* Resumes the domain and the device model */
-    rc = libxl__domain_resume(gc, dss->domid, /* Fast Suspend */1);
+    rc = libxl__domain_resume_deprecated(gc, dss->domid, /* Fast Suspend */1);
     if (rc)
         goto out;
 
-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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