@@ -2287,7 +2287,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
@@ -1386,9 +1386,11 @@ static int libxl__set_vcpuonline_qmp(libxl__gc *gc, uint32_t domid,
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)
@@ -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;
}
@@ -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)
.. because it makes QMP calls which are going to be async. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- tools/libxl/libxl.h | 14 +++++++++++++- tools/libxl/libxl_domain.c | 12 ++++++++---- tools/xl/xl_cpupool.c | 2 +- tools/xl/xl_vcpu.c | 2 +- 4 files changed, 23 insertions(+), 7 deletions(-)