[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] hmp-commands: Add new HMP command for COLO passthrough
From: |
Zhang Chen |
Subject: |
[PATCH 2/3] hmp-commands: Add new HMP command for COLO passthrough |
Date: |
Thu, 24 Dec 2020 09:09:17 +0800 |
From: Zhang Chen <chen.zhang@intel.com>
Add hmp_colo_passthrough_add and hmp_colo_passthrough_del make user
can maintain COLO network passthrough list in human monitor.
Signed-off-by: Zhang Chen <chen.zhang@intel.com>
---
hmp-commands.hx | 26 ++++++++++++++++++++++++++
include/monitor/hmp.h | 2 ++
monitor/hmp-cmds.c | 20 ++++++++++++++++++++
3 files changed, 48 insertions(+)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 470a420c2d..f5790782d6 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1341,6 +1341,32 @@ SRST
Remove host network device.
ERST
+ {
+ .name = "colo_passthrough_add",
+ .args_type = "protocol:s,port:i",
+ .params = "protocol port",
+ .help = "Add network stream to colo passthrough list",
+ .cmd = hmp_colo_passthrough_add,
+ },
+
+SRST
+``colo_passthrough_add``
+ Add network stream to colo passthrough list.
+ERST
+
+ {
+ .name = "colo_passthrough_del",
+ .args_type = "protocol:s,port:i",
+ .params = "protocol port",
+ .help = "Delete network stream from colo passthrough list",
+ .cmd = hmp_colo_passthrough_del,
+ },
+
+SRST
+``colo_passthrough_del``
+ Delete network stream from colo passthrough list.
+ERST
+
{
.name = "object_add",
.args_type = "object:O",
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index ed2913fd18..3c4943b09f 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -81,6 +81,8 @@ void hmp_device_del(Monitor *mon, const QDict *qdict);
void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict);
void hmp_netdev_add(Monitor *mon, const QDict *qdict);
void hmp_netdev_del(Monitor *mon, const QDict *qdict);
+void hmp_colo_passthrough_add(Monitor *mon, const QDict *qdict);
+void hmp_colo_passthrough_del(Monitor *mon, const QDict *qdict);
void hmp_getfd(Monitor *mon, const QDict *qdict);
void hmp_closefd(Monitor *mon, const QDict *qdict);
void hmp_sendkey(Monitor *mon, const QDict *qdict);
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 65d8ff4849..ab98a6b77d 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1661,6 +1661,26 @@ void hmp_netdev_del(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, err);
}
+void hmp_colo_passthrough_add(Monitor *mon, const QDict *qdict)
+{
+ const char *prot = qdict_get_str(qdict, "protocol");
+ uint32_t port = qdict_get_int(qdict, "port");
+ Error *err = NULL;
+
+ qmp_colo_passthrough_add(prot, port, &err);
+ hmp_handle_error(mon, err);
+}
+
+void hmp_colo_passthrough_del(Monitor *mon, const QDict *qdict)
+{
+ const char *prot = qdict_get_str(qdict, "protocol");
+ uint32_t port = qdict_get_int(qdict, "port");
+ Error *err = NULL;
+
+ qmp_colo_passthrough_del(prot, port, &err);
+ hmp_handle_error(mon, err);
+}
+
void hmp_object_add(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
--
2.17.1