From: Vladislav Yasevich <vyasevic@redhat.com>
To: qemu-devel@nongnu.org, dgilbert@redhat.com, quintela@redhat.com
Cc: germano@redhat.com, lvivier@redhat.com, jasowang@redhat.com,
jdenemar@redhat.com, kashyap@redhat.com, armbru@redhat.com,
mst@redhat.com, Vladislav Yasevich <vyasevic@redhat.com>
Subject: [Qemu-devel] [PATCH 09/12] hmp: add announce paraters info/set
Date: Wed, 24 May 2017 14:05:25 -0400 [thread overview]
Message-ID: <1495649128-10529-10-git-send-email-vyasevic@redhat.com> (raw)
In-Reply-To: <1495649128-10529-1-git-send-email-vyasevic@redhat.com>
Add HMP command to control and read annoucment parameters.
Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
---
hmp-commands-info.hx | 13 ++++++++
hmp-commands.hx | 14 +++++++++
hmp.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++
hmp.h | 4 +++
monitor.c | 18 +++++++++++
5 files changed, 135 insertions(+)
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index ae16901..7f1f0f1 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -830,6 +830,19 @@ ETEXI
},
STEXI
+@item info announce_parameters
+@findex announce_parameters
+Show current RARP/GARP announce parameters.
+ETEXI
+ {
+ .name = "announce_parameters",
+ .args_type = "",
+ .params = "",
+ .help = "show current RARP/GARP announce parameters",
+ .cmd = hmp_info_announce_parameters,
+ },
+
+STEXI
@end table
ETEXI
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 0aca984..c8dd816 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -921,7 +921,21 @@ character code in hexadecimal. Character \ is printed \\.
Bug: can screw up when the buffer contains invalid UTF-8 sequences,
NUL characters, after the ring buffer lost data, and when reading
stops because the size limit is reached.
+ETEXI
+ {
+ .name = "announce_set_parameter",
+ .args_type = "parameter:s,value:s",
+ .params = "parameter value",
+ .help = "Set the parameter for GARP/RARP announcements",
+ .cmd = hmp_announce_set_parameter,
+ .command_completion = announce_set_parameter_completion,
+ },
+
+STEXI
+@item announce_set_parameter @var{parameter} @var{value}
+@findex announce_set_parameter
+Set the parameter @var{parameter} for GARP/RARP announcements.
ETEXI
{
diff --git a/hmp.c b/hmp.c
index 3dceaf8..7d41783 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1449,6 +1449,66 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
}
+void hmp_announce_set_parameter(Monitor *mon, const QDict *qdict)
+{
+ const char *param = qdict_get_str(qdict, "parameter");
+ const char *valuestr = qdict_get_str(qdict, "value");
+ Error *err = NULL;
+ bool use_int_value = false;
+ int64_t *set;
+ int i;
+
+ for (i = 0; i < ANNOUNCE_PARAMETER__MAX; i++) {
+ if (strcmp(param, AnnounceParameter_lookup[i]) == 0) {
+ AnnounceParameters p = { 0 };
+ switch (i) {
+ case ANNOUNCE_PARAMETER_INITIAL:
+ p.has_initial = true;
+ use_int_value = true;
+ set = &p.initial;
+ break;
+ case ANNOUNCE_PARAMETER_MAX:
+ p.has_max = true;
+ use_int_value = true;
+ set = &p.max;
+ break;
+ case ANNOUNCE_PARAMETER_ROUNDS:
+ p.has_rounds = true;
+ use_int_value = true;
+ set = &p.rounds;
+ break;
+ case ANNOUNCE_PARAMETER_STEP:
+ p.has_step = true;
+ use_int_value = true;
+ set = &p.step;
+ break;
+ }
+
+ if (use_int_value) {
+ long valueint = 0;
+ if (qemu_strtol(valuestr, NULL, 10, &valueint) < 0) {
+ error_setg(&err, "Unable to parse '%s' as an int",
+ valuestr);
+ goto cleanup;
+ }
+ *set = valueint;
+ }
+
+ qmp_announce_set_parameters(&p, &err);
+ break;
+ }
+ }
+
+ if (i == ANNOUNCE_PARAMETER__MAX) {
+ error_setg(&err, QERR_INVALID_PARAMETER, param);
+ }
+
+ cleanup:
+ if (err) {
+ error_report_err(err);
+ }
+}
+
void hmp_migrate_cancel(Monitor *mon, const QDict *qdict)
{
qmp_migrate_cancel(NULL);
@@ -2801,3 +2861,29 @@ void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, &err);
qapi_free_GuidInfo(info);
}
+
+void hmp_info_announce_parameters(Monitor *mon, const QDict *qdict)
+{
+ AnnounceParameters *params;
+
+ params = qmp_query_announce_parameters(NULL);
+
+ if (params) {
+ assert(params->has_initial);
+ monitor_printf(mon, "%s: %" PRId64 "\n",
+ AnnounceParameter_lookup[ANNOUNCE_PARAMETER_INITIAL],
+ params->initial);
+ assert(params->has_max);
+ monitor_printf(mon, "%s: %" PRId64 "\n",
+ AnnounceParameter_lookup[ANNOUNCE_PARAMETER_MAX],
+ params->max);
+ assert(params->has_rounds);
+ monitor_printf(mon, "%s: %" PRId64 "\n",
+ AnnounceParameter_lookup[ANNOUNCE_PARAMETER_ROUNDS],
+ params->rounds);
+ assert(params->has_step);
+ monitor_printf(mon, "%s: %" PRId64 "\n",
+ AnnounceParameter_lookup[ANNOUNCE_PARAMETER_STEP],
+ params->step);
+ }
+}
diff --git a/hmp.h b/hmp.h
index d8b94ce..adf017c 100644
--- a/hmp.h
+++ b/hmp.h
@@ -67,6 +67,7 @@ void hmp_loadvm(Monitor *mon, const QDict *qdict);
void hmp_savevm(Monitor *mon, const QDict *qdict);
void hmp_delvm(Monitor *mon, const QDict *qdict);
void hmp_info_snapshots(Monitor *mon, const QDict *qdict);
+void hmp_announce_set_parameter(Monitor *mon, const QDict *qdict);
void hmp_migrate_cancel(Monitor *mon, const QDict *qdict);
void hmp_migrate_incoming(Monitor *mon, const QDict *qdict);
void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict);
@@ -130,6 +131,8 @@ void migrate_set_capability_completion(ReadLineState *rs, int nb_args,
const char *str);
void migrate_set_parameter_completion(ReadLineState *rs, int nb_args,
const char *str);
+void announce_set_parameter_completion(ReadLineState *rs, int nb_args,
+ const char *str);
void host_net_add_completion(ReadLineState *rs, int nb_args, const char *str);
void host_net_remove_completion(ReadLineState *rs, int nb_args,
const char *str);
@@ -143,5 +146,6 @@ void hmp_info_dump(Monitor *mon, const QDict *qdict);
void hmp_info_ramblock(Monitor *mon, const QDict *qdict);
void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict);
void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict);
+void hmp_info_announce_parameters(Monitor *mon, const QDict *qdict);
#endif
diff --git a/monitor.c b/monitor.c
index afbacfe..cb2c407 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3563,6 +3563,24 @@ void migrate_set_parameter_completion(ReadLineState *rs, int nb_args,
}
}
+void announce_set_parameter_completion(ReadLineState *rs, int nb_args,
+ const char *str)
+{
+ size_t len;
+
+ len = strlen(str);
+ readline_set_completion_index(rs, len);
+ if (nb_args == 2) {
+ int i;
+ for (i = 0; i < ANNOUNCE_PARAMETER__MAX; i++) {
+ const char *name = AnnounceParameter_lookup[i];
+ if (!strncmp(str, name, len)) {
+ readline_add_completion(rs, name);
+ }
+ }
+ }
+}
+
void host_net_add_completion(ReadLineState *rs, int nb_args, const char *str)
{
int i;
--
2.7.4
next prev parent reply other threads:[~2017-05-24 18:06 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-24 18:05 [Qemu-devel] [PATCH 00/12] self-announce updates Vladislav Yasevich
2017-05-24 18:05 ` [Qemu-devel] [PATCH 01/12] migration: Introduce announce parameters Vladislav Yasevich
2017-05-26 4:03 ` Jason Wang
2017-05-26 13:06 ` Vlad Yasevich
2017-05-30 18:57 ` Dr. David Alan Gilbert
2017-06-01 7:02 ` Jason Wang
2017-06-01 13:45 ` Vlad Yasevich
2017-06-01 14:02 ` Dr. David Alan Gilbert
2017-05-26 13:08 ` Eric Blake
2017-05-26 13:17 ` Vlad Yasevich
2017-05-30 9:58 ` Juan Quintela
2017-05-30 13:45 ` Vlad Yasevich
2017-05-30 19:08 ` Dr. David Alan Gilbert
2017-05-24 18:05 ` [Qemu-devel] [PATCH 02/12] migration: Introduce announcement timer Vladislav Yasevich
2017-05-26 4:13 ` Jason Wang
2017-05-30 10:00 ` Juan Quintela
2017-05-24 18:05 ` [Qemu-devel] [PATCH 03/12] migration: Switch to using " Vladislav Yasevich
2017-05-26 4:16 ` Jason Wang
2017-05-26 13:01 ` Vlad Yasevich
2017-05-30 10:10 ` Juan Quintela
2017-05-30 13:46 ` Vlad Yasevich
2017-05-30 19:19 ` Dr. David Alan Gilbert
2017-05-30 19:34 ` Vlad Yasevich
2017-05-24 18:05 ` [Qemu-devel] [PATCH 04/12] net: Add a network device specific self-announcement ability Vladislav Yasevich
2017-05-26 4:17 ` Jason Wang
2017-05-24 18:05 ` [Qemu-devel] [PATCH 05/12] virtio-net: Allow qemu_announce_self to trigger virtio announcements Vladislav Yasevich
2017-05-26 4:21 ` Jason Wang
2017-05-24 18:05 ` [Qemu-devel] [PATCH 06/12] qmp: Expose qemu_announce_self as a qmp command Vladislav Yasevich
2017-05-26 13:16 ` Eric Blake
2017-05-26 13:19 ` Vlad Yasevich
2017-05-30 10:11 ` Juan Quintela
2017-05-30 13:49 ` Vlad Yasevich
2017-05-30 14:24 ` Juan Quintela
2017-05-30 14:43 ` Vlad Yasevich
2017-05-30 14:14 ` Daniel P. Berrange
2017-05-30 15:01 ` Vlad Yasevich
2017-05-24 18:05 ` [Qemu-devel] [PATCH 07/12] migration: Allow for a limited number of announce timers Vladislav Yasevich
2017-05-30 10:13 ` Juan Quintela
2017-05-30 19:31 ` Dr. David Alan Gilbert
2017-05-24 18:05 ` [Qemu-devel] [PATCH 08/12] announce_timer: Add ability to reset an existing Vladislav Yasevich
2017-05-30 10:15 ` Juan Quintela
2017-05-30 19:35 ` Dr. David Alan Gilbert
2017-05-30 20:01 ` Vlad Yasevich
2017-05-24 18:05 ` Vladislav Yasevich [this message]
2017-05-30 10:18 ` [Qemu-devel] [PATCH 09/12] hmp: add announce paraters info/set Juan Quintela
2017-05-30 13:57 ` Vlad Yasevich
2017-05-24 18:05 ` [Qemu-devel] [PATCH 10/12] hmp: Add hmp_announce_self Vladislav Yasevich
2017-05-31 9:47 ` Dr. David Alan Gilbert
2017-05-24 18:05 ` [Qemu-devel] [PATCH 11/12] tests/test-hmp: Add announce parameter tests Vladislav Yasevich
2017-05-31 9:53 ` Dr. David Alan Gilbert
2017-05-24 18:05 ` [Qemu-devel] [PATCH 12/12] tests: Add a test for qemu self announcments Vladislav Yasevich
2017-05-24 18:19 ` [Qemu-devel] [PATCH 00/12] self-announce updates no-reply
2017-05-24 18:38 ` no-reply
2017-05-24 18:40 ` no-reply
2017-05-31 10:29 ` Dr. David Alan Gilbert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1495649128-10529-10-git-send-email-vyasevic@redhat.com \
--to=vyasevic@redhat.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=germano@redhat.com \
--cc=jasowang@redhat.com \
--cc=jdenemar@redhat.com \
--cc=kashyap@redhat.com \
--cc=lvivier@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).