mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
libxl: Make libxl_set_vcpuonline async
.. because it makes QMP calls which are going to be async. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
1 parent
95627b87c3
commit
fded24ea83
4 files changed
+24
-7
No files matched your search
+14
-1
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||