[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] libxl: Make libxl_send_trigger async
commit 95627b87c3159928458ee586e8c5c593bdd248d8 Author: Anthony PERARD <anthony.perard@xxxxxxxxxx> AuthorDate: Wed May 29 17:45:54 2019 +0100 Commit: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> CommitDate: Fri Sep 20 10:41:01 2019 +0100 libxl: Make libxl_send_trigger 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 | 13 ++++++++++++- tools/libxl/libxl_domain.c | 12 ++++++++---- tools/xl/xl_misc.c | 4 ++-- tools/xl/xl_vmcontrol.c | 4 ++-- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 10dfde3fd8..4301232749 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -1219,6 +1219,7 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, const libxl_mac *src); * asynchronously. Those functions are: * libxl_domain_pause() * libxl_domain_unpause() + * libxl_send_trigger() */ #define LIBXL_HAVE_FN_USING_QMP_ASYNC 1 @@ -2380,7 +2381,17 @@ int libxl_vcpu_sched_params_set_all(libxl_ctx *ctx, uint32_t domid, const libxl_vcpu_sched_params *params); int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid, - libxl_trigger trigger, uint32_t vcpuid); + libxl_trigger trigger, uint32_t vcpuid, + const libxl_asyncop_how *ao_how) + LIBXL_EXTERNAL_CALLERS_ONLY; +#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION < 0x041300 +static inline int libxl_send_trigger_0x041200( + libxl_ctx *ctx, uint32_t domid, libxl_trigger trigger, uint32_t vcpuid) +{ + return libxl_send_trigger_0x041200(ctx, domid, trigger, vcpuid, NULL); +} +#define libxl_send_trigger libxl_send_trigger_0x041200 +#endif int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq); int libxl_send_debug_keys(libxl_ctx *ctx, char *keys); int libxl_set_parameters(libxl_ctx *ctx, char *params); diff --git a/tools/libxl/libxl_domain.c b/tools/libxl/libxl_domain.c index 1c313005db..86cddc05a9 100644 --- a/tools/libxl/libxl_domain.c +++ b/tools/libxl/libxl_domain.c @@ -1470,10 +1470,11 @@ static int libxl__domain_s3_resume(libxl__gc *gc, int domid) } int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid, - libxl_trigger trigger, uint32_t vcpuid) + libxl_trigger trigger, uint32_t vcpuid, + const libxl_asyncop_how *ao_how) { + AO_CREATE(ctx, domid, ao_how); int rc; - GC_INIT(ctx); switch (trigger) { case LIBXL_TRIGGER_POWER: @@ -1509,10 +1510,13 @@ int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid, LOGED(ERROR, domid, "Send trigger '%s' failed", libxl_trigger_to_string(trigger)); rc = ERROR_FAIL; + goto out; } - GC_FREE; - return rc; + libxl__ao_complete(egc, ao, rc); + return AO_INPROGRESS; +out: + return AO_CREATE_FAIL(rc); } uint32_t libxl_vm_get_start_time(libxl_ctx *ctx, uint32_t domid) diff --git a/tools/xl/xl_misc.c b/tools/xl/xl_misc.c index dcf940a6d4..50c8436337 100644 --- a/tools/xl/xl_misc.c +++ b/tools/xl/xl_misc.c @@ -36,7 +36,7 @@ static void button_press(uint32_t domid, const char *b) exit(EXIT_FAILURE); } - libxl_send_trigger(ctx, domid, trigger, 0); + libxl_send_trigger(ctx, domid, trigger, 0, NULL); } int main_button_press(int argc, char **argv) @@ -106,7 +106,7 @@ int main_trigger(int argc, char **argv) } } - libxl_send_trigger(ctx, domid, trigger, vcpuid); + libxl_send_trigger(ctx, domid, trigger, vcpuid, NULL); return EXIT_SUCCESS; } diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c index 419bf780a4..3fc6f56574 100644 --- a/tools/xl/xl_vmcontrol.c +++ b/tools/xl/xl_vmcontrol.c @@ -108,7 +108,7 @@ static void reboot_domain(uint32_t domid, libxl_evgen_domain_death **deathw, if (fallback_trigger) { fprintf(stderr, "PV control interface not available:" " sending ACPI reset button event.\n"); - rc = libxl_send_trigger(ctx, domid, LIBXL_TRIGGER_RESET, 0); + rc = libxl_send_trigger(ctx, domid, LIBXL_TRIGGER_RESET, 0, NULL); } else { fprintf(stderr, "PV control interface not available:" " external graceful reboot not possible.\n"); @@ -141,7 +141,7 @@ static void shutdown_domain(uint32_t domid, if (fallback_trigger) { fprintf(stderr, "PV control interface not available:" " sending ACPI power button event.\n"); - rc = libxl_send_trigger(ctx, domid, LIBXL_TRIGGER_POWER, 0); + rc = libxl_send_trigger(ctx, domid, LIBXL_TRIGGER_POWER, 0, NULL); } else { fprintf(stderr, "PV control interface not available:" " external graceful shutdown not possible.\n"); -- generated by git-patchbot for /home/xen/git/xen.git#staging _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |