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

[Xen-changelog] [xen staging] libxl: Make libxl_set_vcpuonline async



commit fded24ea83150ea7690e6d5c77da69f22d101dda
Author:     Anthony PERARD <anthony.perard@xxxxxxxxxx>
AuthorDate: Wed May 29 17:54:26 2019 +0100
Commit:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
CommitDate: Fri Sep 20 10:41:01 2019 +0100

    libxl: Make libxl_set_vcpuonline async
    
    .. because it makes QMP calls which are going to be async.
    
    Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.h        | 15 ++++++++++++++-
 tools/libxl/libxl_domain.c | 12 ++++++++----
 tools/xl/xl_cpupool.c      |  2 +-
 tools/xl/xl_vcpu.c         |  2 +-
 4 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 4301232749..fd69e92166 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -1220,6 +1220,7 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, const 
libxl_mac *src);
  *   libxl_domain_pause()
  *   libxl_domain_unpause()
  *   libxl_send_trigger()
+ *   libxl_set_vcpuonline()
  */
 #define LIBXL_HAVE_FN_USING_QMP_ASYNC 1
 
@@ -2318,7 +2319,19 @@ int libxl_domain_set_nodeaffinity(libxl_ctx *ctx, 
uint32_t domid,
                                   libxl_bitmap *nodemap);
 int libxl_domain_get_nodeaffinity(libxl_ctx *ctx, uint32_t domid,
                                   libxl_bitmap *nodemap);
-int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_bitmap *cpumap);
+int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid,
+                         libxl_bitmap *cpumap,
+                         const libxl_asyncop_how *ao_how)
+                         LIBXL_EXTERNAL_CALLERS_ONLY;
+#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION < 0x041300
+static inline int libxl_set_vcpuonline_0x041200(libxl_ctx *ctx,
+                                                uint32_t domid,
+                                                libxl_bitmap *cpumap)
+{
+    return libxl_set_vcpuonline(ctx, domid, cpumap, NULL);
+}
+#define libxl_set_vcpuonline libxl_set_vcpuonline_0x041200
+#endif
 
 /* A return value less than 0 should be interpreted as a libxl_error, while a
  * return value greater than or equal to 0 should be interpreted as a
diff --git a/tools/libxl/libxl_domain.c b/tools/libxl/libxl_domain.c
index 86cddc05a9..60c3f7a34b 100644
--- a/tools/libxl/libxl_domain.c
+++ b/tools/libxl/libxl_domain.c
@@ -1386,9 +1386,11 @@ out:
     return rc;
 }
 
-int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_bitmap *cpumap)
+int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid,
+                         libxl_bitmap *cpumap,
+                         const libxl_asyncop_how *ao_how)
 {
-    GC_INIT(ctx);
+    AO_CREATE(ctx, domid, ao_how);
     int rc, maxcpus;
     libxl_dominfo info;
 
@@ -1439,8 +1441,10 @@ int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, 
libxl_bitmap *cpumap)
 
 out:
     libxl_dominfo_dispose(&info);
-    GC_FREE;
-    return rc;
+    if (rc)
+        return AO_CREATE_FAIL(rc);
+    libxl__ao_complete(egc, ao, rc);
+    return AO_INPROGRESS;
 }
 
 static int libxl__domain_s3_resume(libxl__gc *gc, int domid)
diff --git a/tools/xl/xl_cpupool.c b/tools/xl/xl_cpupool.c
index 273811b663..cffe87e0c7 100644
--- a/tools/xl/xl_cpupool.c
+++ b/tools/xl/xl_cpupool.c
@@ -546,7 +546,7 @@ int main_cpupoolnumasplit(int argc, char **argv)
         fprintf(stderr, "error on getting info for Domain-0\n");
         goto out;
     }
-    if (info.vcpu_online > n && libxl_set_vcpuonline(ctx, 0, &cpumap)) {
+    if (info.vcpu_online > n && libxl_set_vcpuonline(ctx, 0, &cpumap, NULL)) {
         fprintf(stderr, "error on removing vcpus for Domain-0\n");
         goto out;
     }
diff --git a/tools/xl/xl_vcpu.c b/tools/xl/xl_vcpu.c
index 329512eaaf..9ff5354f74 100644
--- a/tools/xl/xl_vcpu.c
+++ b/tools/xl/xl_vcpu.c
@@ -369,7 +369,7 @@ static int vcpuset(uint32_t domid, const char* nr_vcpus, 
int check_host)
     for (i = 0; i < max_vcpus; i++)
         libxl_bitmap_set(&cpumap, i);
 
-    rc = libxl_set_vcpuonline(ctx, domid, &cpumap);
+    rc = libxl_set_vcpuonline(ctx, domid, &cpumap, NULL);
     if (rc == ERROR_DOMAIN_NOTFOUND)
         fprintf(stderr, "Domain %u does not exist.\n", domid);
     else if (rc)
--
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®.