[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/10] Allow the monitor to be suspended during non-b

From: Anthony Liguori
Subject: [Qemu-devel] [PATCH 2/10] Allow the monitor to be suspended during non-blocking op
Date: Tue, 9 Sep 2008 14:49:54 -0500

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 <address@hidden>

diff --git a/console.h b/console.h
index 561ef51..c94386c 100644
--- a/console.h
+++ b/console.h
@@ -168,6 +168,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);
diff --git a/monitor.c b/monitor.c
index 47c5514..14bdbeb 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2687,10 +2687,27 @@ static void term_read(void *opaque, const uint8_t *buf, 
int size)
 static void monitor_start_input(void);
+static int monitor_suspended;
 static void monitor_handle_command1(void *opaque, const char *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)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]