The QMP command was added in 671326201d ("migration: Introduce interface
query-migrationthreads", v8.0). Add the HMP version of it.
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Dr. David Alan Gilbert <dave@treblig.org>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
include/monitor/hmp.h | 1 +
migration/migration-hmp-cmds.c | 25 +++++++++++++++++++++++++
hmp-commands-info.hx | 13 +++++++++++++
3 files changed, 39 insertions(+)
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index ae116d9804..e44a399e4a 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -31,6 +31,7 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict);
void hmp_info_migrate(Monitor *mon, const QDict *qdict);
void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict);
+void hmp_info_migrationthreads(Monitor *mon, const QDict *qdict);
void hmp_info_cpus(Monitor *mon, const QDict *qdict);
void hmp_info_vnc(Monitor *mon, const QDict *qdict);
void hmp_info_spice(Monitor *mon, const QDict *qdict);
diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
index 20d1a6e219..63a6ea61f2 100644
--- a/migration/migration-hmp-cmds.c
+++ b/migration/migration-hmp-cmds.c
@@ -814,3 +814,28 @@ void loadvm_completion(ReadLineState *rs, int nb_args, const char *str)
vm_completion(rs, str);
}
}
+
+void hmp_info_migrationthreads(Monitor *mon, const QDict *qdict)
+{
+ MigrationThreadInfoList *list;
+ MigrationThreadInfo *entry;
+ Error *err = NULL;
+
+ list = qmp_query_migrationthreads(&err);
+
+ if (!list) {
+ monitor_printf(mon, "No migration threads found\n");
+ return;
+ }
+
+ monitor_printf(mon, "%-16s%s\n", "TID", "Thread Name");
+ while (list) {
+ entry = list->value;
+ monitor_printf(mon, "%-16" PRId64 "%s\n",
+ entry->thread_id, entry->name);
+ list = list->next;
+ }
+
+ qapi_free_MigrationThreadInfoList(list);
+ hmp_handle_error(mon, err);
+}
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index c59cd6637b..a8dc55dbd2 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -512,6 +512,19 @@ SRST
Show current migration parameters.
ERST
+ {
+ .name = "migrationthreads",
+ .args_type = "",
+ .params = "",
+ .help = "show migration threads information",
+ .cmd = hmp_info_migrationthreads,
+ },
+
+SRST
+ ``info migrationthreads``
+ Show migration threads information.
+ERST
+
{
.name = "balloon",
.args_type = "",
--
2.45.0
* Peter Xu (peterx@redhat.com) wrote: > The QMP command was added in 671326201d ("migration: Introduce interface > query-migrationthreads", v8.0). Add the HMP version of it. > > Cc: Markus Armbruster <armbru@redhat.com> > Cc: Dr. David Alan Gilbert <dave@treblig.org> > Signed-off-by: Peter Xu <peterx@redhat.com> > --- > include/monitor/hmp.h | 1 + > migration/migration-hmp-cmds.c | 25 +++++++++++++++++++++++++ > hmp-commands-info.hx | 13 +++++++++++++ > 3 files changed, 39 insertions(+) > > diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h > index ae116d9804..e44a399e4a 100644 > --- a/include/monitor/hmp.h > +++ b/include/monitor/hmp.h > @@ -31,6 +31,7 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict); > void hmp_info_migrate(Monitor *mon, const QDict *qdict); > void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict); > void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict); > +void hmp_info_migrationthreads(Monitor *mon, const QDict *qdict); > void hmp_info_cpus(Monitor *mon, const QDict *qdict); > void hmp_info_vnc(Monitor *mon, const QDict *qdict); > void hmp_info_spice(Monitor *mon, const QDict *qdict); > diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c > index 20d1a6e219..63a6ea61f2 100644 > --- a/migration/migration-hmp-cmds.c > +++ b/migration/migration-hmp-cmds.c > @@ -814,3 +814,28 @@ void loadvm_completion(ReadLineState *rs, int nb_args, const char *str) > vm_completion(rs, str); > } > } > + > +void hmp_info_migrationthreads(Monitor *mon, const QDict *qdict) > +{ > + MigrationThreadInfoList *list; > + MigrationThreadInfo *entry; > + Error *err = NULL; > + > + list = qmp_query_migrationthreads(&err); > + I think you need to do the hmp_handle_error here rather than at the end, and return if there was one. Other than that it looks OK. Dave > + if (!list) { > + monitor_printf(mon, "No migration threads found\n"); > + return; > + } > + > + monitor_printf(mon, "%-16s%s\n", "TID", "Thread Name"); > + while (list) { > + entry = list->value; > + monitor_printf(mon, "%-16" PRId64 "%s\n", > + entry->thread_id, entry->name); > + list = list->next; > + } > + > + qapi_free_MigrationThreadInfoList(list); > + hmp_handle_error(mon, err); > +} > diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx > index c59cd6637b..a8dc55dbd2 100644 > --- a/hmp-commands-info.hx > +++ b/hmp-commands-info.hx > @@ -512,6 +512,19 @@ SRST > Show current migration parameters. > ERST > > + { > + .name = "migrationthreads", > + .args_type = "", > + .params = "", > + .help = "show migration threads information", > + .cmd = hmp_info_migrationthreads, > + }, > + > +SRST > + ``info migrationthreads`` > + Show migration threads information. > +ERST > + > { > .name = "balloon", > .args_type = "", > -- > 2.45.0 > -- -----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ dave @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/
© 2016 - 2024 Red Hat, Inc.