.. 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>
* asynchronously. Those functions are:
* libxl_domain_pause()
* libxl_domain_unpause()
+ * libxl_send_trigger()
*/
#define LIBXL_HAVE_FN_USING_QMP_ASYNC 1
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);
}
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:
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)
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)
}
}
- libxl_send_trigger(ctx, domid, trigger, vcpuid);
+ libxl_send_trigger(ctx, domid, trigger, vcpuid, NULL);
return EXIT_SUCCESS;
}
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");
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");