qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: Prasad Pandit <ppandit@redhat.com>,
	Julia Suvorova <jusual@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	peterx@redhat.com, Fabiano Rosas <farosas@suse.de>,
	Juraj Marcin <jmarcin@redhat.com>,
	"Dr . David Alan Gilbert" <dave@treblig.org>
Subject: [PATCH 7/7] hmp: Add "info migrationthreads"
Date: Mon, 30 Sep 2024 15:58:37 -0400	[thread overview]
Message-ID: <20240930195837.825728-8-peterx@redhat.com> (raw)
In-Reply-To: <20240930195837.825728-1-peterx@redhat.com>

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



  parent reply	other threads:[~2024-09-30 20:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-30 19:58 [PATCH 0/7] migration: query-migrationthreads enhancements and cleanups Peter Xu
2024-09-30 19:58 ` [PATCH 1/7] migration: Unify names of migration src main thread Peter Xu
2024-09-30 19:58 ` [PATCH 2/7] migration: Put thread names together with macros Peter Xu
2024-09-30 19:58 ` [PATCH 3/7] migration: Remove thread_id in migration_threads_add() Peter Xu
2024-09-30 19:58 ` [PATCH 4/7] migration: Simplify migration-threads API Peter Xu
2024-09-30 19:58 ` [PATCH 5/7] migration: Add all threads with QMP query-migrationthreads Peter Xu
2024-09-30 19:58 ` [PATCH 6/7] migration: Remove MigrationThread and threadinfo.h Peter Xu
2024-09-30 19:58 ` Peter Xu [this message]
2024-09-30 23:43   ` [PATCH 7/7] hmp: Add "info migrationthreads" Dr. David Alan Gilbert
2024-10-01  5:46 ` [PATCH 0/7] migration: query-migrationthreads enhancements and cleanups Markus Armbruster
2024-10-01 14:25   ` Daniel P. Berrangé
2024-10-01 15:06     ` Peter Xu
2024-10-02  5:58       ` Markus Armbruster
2024-10-10 19:46         ` Peter Xu

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=20240930195837.825728-8-peterx@redhat.com \
    --to=peterx@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dave@treblig.org \
    --cc=farosas@suse.de \
    --cc=jmarcin@redhat.com \
    --cc=jusual@redhat.com \
    --cc=ppandit@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).