]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
qmp: Add announce-self command
authorDr. David Alan Gilbert <dgilbert@redhat.com>
Wed, 27 Feb 2019 13:24:11 +0000 (13:24 +0000)
committerJason Wang <jasowang@redhat.com>
Tue, 5 Mar 2019 03:27:41 +0000 (11:27 +0800)
Add a qmp command that can trigger guest announcements.

It uses its own announce-timer instance, and parameters
passed to it explicitly in the command.

Like most qmp commands, it's in the main thread/bql, so
there's no racing with any outstanding timer.

Based on work of Germano Veit Michel <germano@redhat.com> and
                 Vladislav Yasevich <vyasevic@redhat.com>

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
net/announce.c
qapi/net.json

index 070f37a7fa569aa9b49bd8faf76194255c6d1b1f..91e9a6e267c750816fa7c12d224fa5f16e35900d 100644 (file)
@@ -12,6 +12,7 @@
 #include "net/net.h"
 #include "qapi/clone-visitor.h"
 #include "qapi/qapi-visit-net.h"
+#include "qapi/qapi-commands-net.h"
 #include "trace.h"
 
 int64_t qemu_announce_timer_step(AnnounceTimer *timer)
@@ -131,3 +132,9 @@ void qemu_announce_self(AnnounceTimer *timer, AnnounceParameters *params)
         qemu_announce_timer_del(timer);
     }
 }
+
+void qmp_announce_self(AnnounceParameters *params, Error **errp)
+{
+    static AnnounceTimer announce_timer;
+    qemu_announce_self(&announce_timer, params);
+}
index 5face0c14b7752b1eaa53700a9235e1c56f33f61..5f7bff1637fbe61f2f926fb223bbbe1c3d05a251 100644 (file)
             'max': 'int',
             'rounds': 'int',
             'step': 'int' } }
+
+##
+# @announce-self:
+#
+# Trigger generation of broadcast RARP frames to update network switches.
+# This can be useful when network bonds fail-over the active slave.
+#
+# @params: AnnounceParameters giving timing and repetition count of announce
+#
+# Example:
+#
+# -> { "execute": "announce-self"
+#      "arguments": {
+#          "initial": 50, "max": 550, "rounds": 10, "step": 50 } }
+# <- { "return": {} }
+#
+# Since: 4.0
+##
+{ 'command': 'announce-self', 'boxed': true,
+  'data' : 'AnnounceParameters'}