mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
libxl: Make libxl_retrieve_domain_configuration 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
fded24ea83
commit
1e3304005e
5 files changed
+25
-11
No files matched your search
+12
-1
@@ -1221,6 +1221,7 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, const libxl_mac *src);
|
||||
* libxl_domain_unpause()
|
||||
* libxl_send_trigger()
|
||||
* libxl_set_vcpuonline()
|
||||
* libxl_retrieve_domain_configuration()
|
||||
*/
|
||||
#define LIBXL_HAVE_FN_USING_QMP_ASYNC 1
|
||||
|
||||
@@ -1564,8 +1565,18 @@ void libxl_domain_config_dispose(libxl_domain_config *d_config);
|
||||
* works with DomU.
|
||||
*/
|
||||
int libxl_retrieve_domain_configuration(libxl_ctx *ctx, uint32_t domid,
|
||||
libxl_domain_config *d_config)
|
||||
libxl_domain_config *d_config,
|
||||
const libxl_asyncop_how *ao_how)
|
||||
LIBXL_EXTERNAL_CALLERS_ONLY;
|
||||
#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION < 0x041300
|
||||
static inline int libxl_retrieve_domain_configuration_0x041200(
|
||||
libxl_ctx *ctx, uint32_t domid, libxl_domain_config *d_config)
|
||||
{
|
||||
return libxl_retrieve_domain_configuration(ctx, domid, d_config, NULL);
|
||||
}
|
||||
#define libxl_retrieve_domain_configuration \
|
||||
libxl_retrieve_domain_configuration_0x041200
|
||||
#endif
|
||||
|
||||
int libxl_domain_suspend(libxl_ctx *ctx, uint32_t domid, int fd,
|
||||
int flags, /* LIBXL_SUSPEND_* */
|
||||
|
||||
@@ -1594,14 +1594,13 @@ out:
|
||||
}
|
||||
|
||||
int libxl_retrieve_domain_configuration(libxl_ctx *ctx, uint32_t domid,
|
||||
libxl_domain_config *d_config)
|
||||
libxl_domain_config *d_config,
|
||||
const libxl_asyncop_how *ao_how)
|
||||
{
|
||||
GC_INIT(ctx);
|
||||
AO_CREATE(ctx, domid, ao_how);
|
||||
int rc;
|
||||
libxl__domain_userdata_lock *lock = NULL;
|
||||
|
||||
CTX_LOCK;
|
||||
|
||||
lock = libxl__lock_domain_userdata(gc, domid);
|
||||
if (!lock) {
|
||||
rc = ERROR_LOCK_FAIL;
|
||||
@@ -1808,9 +1807,10 @@ int libxl_retrieve_domain_configuration(libxl_ctx *ctx, uint32_t domid,
|
||||
|
||||
out:
|
||||
if (lock) libxl__unlock_domain_userdata(lock);
|
||||
CTX_UNLOCK;
|
||||
GC_FREE;
|
||||
return rc;
|
||||
if (rc)
|
||||
return AO_CREATE_FAIL(rc);
|
||||
libxl__ao_complete(egc, ao, rc);
|
||||
return AO_INPROGRESS;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+2
-1
@@ -464,7 +464,8 @@ static void list_domains_details(const libxl_dominfo *info, int nb_domain)
|
||||
|
||||
for (i = 0; i < nb_domain; i++) {
|
||||
libxl_domain_config_init(&d_config);
|
||||
rc = libxl_retrieve_domain_configuration(ctx, info[i].domid, &d_config);
|
||||
rc = libxl_retrieve_domain_configuration(ctx, info[i].domid,
|
||||
&d_config, NULL);
|
||||
if (rc)
|
||||
continue;
|
||||
if (default_output_format == OUTPUT_FORMAT_JSON)
|
||||
|
||||
@@ -56,7 +56,8 @@ void save_domain_core_begin(uint32_t domid,
|
||||
&d_config);
|
||||
free(config_v);
|
||||
} else {
|
||||
rc = libxl_retrieve_domain_configuration(ctx, domid, &d_config);
|
||||
rc = libxl_retrieve_domain_configuration(ctx, domid, &d_config,
|
||||
NULL);
|
||||
if (rc) {
|
||||
fprintf(stderr, "unable to retrieve domain configuration\n");
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
@@ -377,7 +377,8 @@ static void reload_domain_config(uint32_t domid,
|
||||
}
|
||||
|
||||
libxl_domain_config_init(&d_config_new);
|
||||
rc = libxl_retrieve_domain_configuration(ctx, domid, &d_config_new);
|
||||
rc = libxl_retrieve_domain_configuration(ctx, domid, &d_config_new,
|
||||
NULL);
|
||||
if (rc) {
|
||||
LOG("failed to retrieve guest configuration (rc=%d). "
|
||||
"reusing old configuration", rc);
|
||||
|
||||