]> git.proxmox.com Git - qemu.git/commitdiff
Allow the monitor to be suspended during non-blocking op
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
Mon, 6 Oct 2008 13:52:44 +0000 (13:52 +0000)
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
Mon, 6 Oct 2008 13:52:44 +0000 (13:52 +0000)
Live migration happens in the background, but it is useful to make the monitor
command appear as if it's blocking.  This allows a management tool to
immediately know when the live migration has completed without having to poll
the migration status.

This patch allows the monitor to be suspended from a monitor callback which
will prevent new monitor commands from being executed.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5431 c046a42c-6fe2-441c-8c8c-71466251a162

console.h
monitor.c

index dd8b0397e6184c19b0ba294c569963eae6f955c9..fba9e299b3351f820fefda8d24ca3a451cbee11d 100644 (file)
--- a/console.h
+++ b/console.h
@@ -175,6 +175,8 @@ void term_flush(void);
 void term_print_help(void);
 void monitor_readline(const char *prompt, int is_password,
                       char *buf, int buf_size);
+void monitor_suspend(void);
+void monitor_resume(void);
 
 /* readline.c */
 typedef void ReadLineFunc(void *opaque, const char *str);
index 4f51eccdcade54c824a0b2e9c2ec24b398f66b75..dd2e770e685728d677e32569527c5ba1ac872378 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -2694,10 +2694,27 @@ static void term_read(void *opaque, const uint8_t *buf, int size)
         readline_handle_byte(buf[i]);
 }
 
+static int monitor_suspended;
+
 static void monitor_handle_command1(void *opaque, const char *cmdline)
 {
     monitor_handle_command(cmdline);
-    monitor_start_input();
+    if (!monitor_suspended)
+        monitor_start_input();
+    else
+        monitor_suspended = 2;
+}
+
+void monitor_suspend(void)
+{
+    monitor_suspended = 1;
+}
+
+void monitor_resume(void)
+{
+    if (monitor_suspended == 2)
+        monitor_start_input();
+    monitor_suspended = 0;
 }
 
 static void monitor_start_input(void)