Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 3160499aacb81f6735941eb4c372d87a > files > 228

kvm-83-164.el5_5.30.src.rpm

From ead65ad4117b15a5f79c13063fd2fa0b01e35c5d Mon Sep 17 00:00:00 2001
From: Uri Lublin <uril@redhat.com>
Date: Mon, 8 Jun 2009 15:41:30 +0300
Subject: [PATCH 4/5] asynchronous notifications: add "all" event (v3)

Instead of setting one by one just "notify all on/off" in qemu monitor
or start with '-notify all'.

Changes from v2:
    Replaced memset() with a for loop.

bz 501693

Signed-off-by: Uri Lublin <uril@redhat.com>
Message-Id: <1244464890-14761-1-git-send-email-uril@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Upstream-status: not-applicable
Obsoletes: <1243956781-29993-4-git-send-email-uril@redhat.com>
Acked-by: Dor Laor <dlaor@redhat.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Bugzilla: 504237
---
 qemu/monitor.c |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/qemu/monitor.c b/qemu/monitor.c
index 66246fd..072d4b3 100644
--- a/qemu/monitor.c
+++ b/qemu/monitor.c
@@ -248,7 +248,16 @@ static void do_help(const char *name)
  */
 static int set_notify_async_events(const char *event_str, const char *enable)
 {
-    int event;
+    int event, val;
+
+    if (!strcmp(enable, "on"))
+        val = 1;
+    else if (!strcmp(enable, "off"))
+        val = 0;
+    else {
+        term_printf("notify: invalid argument\n");
+        return 1;
+    }
 
     if (!strcmp(event_str, "vnc"))
         event = VNC_ASYNC_EVENT;
@@ -266,19 +275,18 @@ static int set_notify_async_events(const char *event_str, const char *enable)
         event = WATERMARK_ASYNC_EVENT;
     else if (!strcmp(event_str, "vdi"))
         event = VDI_ASYNC_EVENT;
+    else if (!strcmp(event_str, "all")) {
+        for (event=0; event<ARRAY_SIZE(async_printable_events); event++)
+            async_printable_events[event] = val;
+        return 0;
+    }
     else {
         term_printf("notify: invalid event %s\n", event_str);
         return 1;
     }
 
-    if (!strcmp(enable, "on"))
-        async_printable_events[event] = 1;
-    else if (!strcmp(enable, "off"))
-        async_printable_events[event] = 0;
-    else {
-        term_printf("notify: invalid argument\n");
-        return 2;
-    }
+    async_printable_events[event] = val;
+
     return 0;
 }
 
@@ -1670,7 +1678,7 @@ static term_cmd_t term_cmds[] = {
     { "set_qxl_log_level", "i", qxl_do_set_log_level, "", "set qxl log level" },
 #endif
     { "notify", "ss", do_notify_async_events,
-      "vnc|rtc|migration|reboot|shutdown|vmstop|watermark|vdi on|off",
+      "vnc|rtc|migration|reboot|shutdown|vmstop|watermark|vdi|all on|off",
       "enable / disable printing of notifications for the specified event" },
     { "block_set_watermark", "Bi", do_block_set_watermark,
       "block-device offset(in MB)",
-- 
1.6.3.rc4.29.g8146