Bläddra i källkod

hmp: Add hmp_announce_self

Add an HMP command to trigger self annocements.
Unlike the QMP command (which takes a set of parameters), the HMP
command reuses the set of parameters used for migration.

Signend-off-by: 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>
Dr. David Alan Gilbert 6 år sedan
förälder
incheckning
544f6ea324
4 ändrade filer med 23 tillägg och 0 borttagningar
  1. 16 0
      hmp-commands.hx
  2. 5 0
      hmp.c
  3. 1 0
      hmp.h
  4. 1 0
      tests/test-hmp.c

+ 16 - 0
hmp-commands.hx

@@ -936,6 +936,22 @@ Bug: can screw up when the buffer contains invalid UTF-8 sequences,
 NUL characters, after the ring buffer lost data, and when reading
 NUL characters, after the ring buffer lost data, and when reading
 stops because the size limit is reached.
 stops because the size limit is reached.
 
 
+ETEXI
+
+    {
+        .name       = "announce_self",
+        .args_type  = "",
+        .params     = "",
+        .help       = "Trigger GARP/RARP announcements",
+        .cmd        = hmp_announce_self,
+    },
+
+STEXI
+@item announce_self
+@findex announce_self
+Trigger a round of GARP/RARP broadcasts; this is useful for explicitly updating the
+network infrastructure after a reconfiguration or some forms of migration.
+The timings of the round are set by the migration announce parameters.
 ETEXI
 ETEXI
 
 
     {
     {

+ 5 - 0
hmp.c

@@ -1570,6 +1570,11 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
 
 
 }
 }
 
 
+void hmp_announce_self(Monitor *mon, const QDict *qdict)
+{
+    qmp_announce_self(migrate_announce_params(), NULL);
+}
+
 void hmp_migrate_cancel(Monitor *mon, const QDict *qdict)
 void hmp_migrate_cancel(Monitor *mon, const QDict *qdict)
 {
 {
     qmp_migrate_cancel(NULL);
     qmp_migrate_cancel(NULL);

+ 1 - 0
hmp.h

@@ -46,6 +46,7 @@ void hmp_sync_profile(Monitor *mon, const QDict *qdict);
 void hmp_system_reset(Monitor *mon, const QDict *qdict);
 void hmp_system_reset(Monitor *mon, const QDict *qdict);
 void hmp_system_powerdown(Monitor *mon, const QDict *qdict);
 void hmp_system_powerdown(Monitor *mon, const QDict *qdict);
 void hmp_exit_preconfig(Monitor *mon, const QDict *qdict);
 void hmp_exit_preconfig(Monitor *mon, const QDict *qdict);
+void hmp_announce_self(Monitor *mon, const QDict *qdict);
 void hmp_cpu(Monitor *mon, const QDict *qdict);
 void hmp_cpu(Monitor *mon, const QDict *qdict);
 void hmp_memsave(Monitor *mon, const QDict *qdict);
 void hmp_memsave(Monitor *mon, const QDict *qdict);
 void hmp_pmemsave(Monitor *mon, const QDict *qdict);
 void hmp_pmemsave(Monitor *mon, const QDict *qdict);

+ 1 - 0
tests/test-hmp.c

@@ -20,6 +20,7 @@
 static int verbose;
 static int verbose;
 
 
 static const char *hmp_cmds[] = {
 static const char *hmp_cmds[] = {
+    "announce_self",
     "boot_set ndc",
     "boot_set ndc",
     "chardev-add null,id=testchardev1",
     "chardev-add null,id=testchardev1",
     "chardev-send-break testchardev1",
     "chardev-send-break testchardev1",