@@ -2350,7 +2350,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);
@@ -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)
@@ -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;
}
@@ -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");
.. because it makes QMP calls which are going to be async. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- tools/libxl/libxl.h | 12 +++++++++++- tools/libxl/libxl_domain.c | 12 ++++++++---- tools/xl/xl_misc.c | 4 ++-- tools/xl/xl_vmcontrol.c | 4 ++-- 4 files changed, 23 insertions(+), 9 deletions(-)