]> xenbits.xensource.com Git - people/hx242/xen.git/commitdiff
libxl: Make libxl_qemu_monitor_command async
authorAnthony PERARD <anthony.perard@citrix.com>
Wed, 29 May 2019 17:06:34 +0000 (18:06 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Fri, 20 Sep 2019 09:41:01 +0000 (10:41 +0100)
.. 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>
tools/libxl/libxl.h
tools/libxl/libxl_qmp.c
tools/xl/xl_misc.c

index fd1e1349bf6aee80ae1fac56f8e78c779af22b96..ba48e7e900d36bf82e5dc737bb8cd741dc1565e3 100644 (file)
@@ -1222,6 +1222,7 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, const libxl_mac *src);
  *   libxl_send_trigger()
  *   libxl_set_vcpuonline()
  *   libxl_retrieve_domain_configuration()
+ *   libxl_qemu_monitor_command()
  */
 #define LIBXL_HAVE_FN_USING_QMP_ASYNC 1
 
@@ -2571,7 +2572,18 @@ int libxl_fd_set_nonblock(libxl_ctx *ctx, int fd, int nonblock);
  * via output.
  */
 int libxl_qemu_monitor_command(libxl_ctx *ctx, uint32_t domid,
-                               const char *command_line, char **output);
+                               const char *command_line, char **output,
+                               const libxl_asyncop_how *ao_how)
+                               LIBXL_EXTERNAL_CALLERS_ONLY;
+#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION < 0x041300
+static inline int libxl_qemu_monitor_command_0x041200(libxl_ctx *ctx,
+    uint32_t domid, const char *command_line, char **output)
+{
+    return libxl_qemu_monitor_command(ctx, domid, command_line, output,
+                                      NULL);
+}
+#define libxl_qemu_monitor_command libxl_qemu_monitor_command_0x041200
+#endif
 
 #include <libxl_event.h>
 
index 20d9eed8ddc89b0960a87c8f7afed1f0685f6149..505e0e5469a94286bae515b4b006aba4c54f5de7 100644 (file)
@@ -1291,15 +1291,16 @@ int libxl__qmp_hmp(libxl__gc *gc, int domid, const char *command_line,
 }
 
 int libxl_qemu_monitor_command(libxl_ctx *ctx, uint32_t domid,
-                               const char *command_line, char **output)
+                               const char *command_line, char **output,
+                               const libxl_asyncop_how *ao_how)
 {
-    GC_INIT(ctx);
+    AO_CREATE(ctx, domid, ao_how);
     int rc;
 
     rc = libxl__qmp_hmp(gc, domid, command_line, output);
 
-    GC_FREE;
-    return rc;
+    libxl__ao_complete(egc, ao, rc);
+    return AO_INPROGRESS;
 }
 
 int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid,
index 50c8436337c9a988293216b8b01100b256393105..20ed605f4f44288120a29c14eac597b964ea2123 100644 (file)
@@ -228,7 +228,7 @@ int main_qemu_monitor_command(int argc, char **argv)
         return EXIT_FAILURE;
     }
 
-    ret = libxl_qemu_monitor_command(ctx, domid, cmd, &output);
+    ret = libxl_qemu_monitor_command(ctx, domid, cmd, &output, NULL);
     if (!ret && output) {
         printf("%s\n", output);
         free(output);