qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Xu" <peterx@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"David Hildenbrand" <david@redhat.com>,
	"John Snow" <jsnow@redhat.com>, "Fam Zheng" <fam@euphon.net>,
	"Hailiang Zhang" <zhanghailiang@xfusion.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-block@nongnu.org, "Gerd Hoffmann" <kraxel@redhat.com>,
	"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
	"Leonardo Bras" <leobras@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Juan Quintela" <quintela@redhat.com>,
	"Eric Blake" <eblake@redhat.com>
Subject: [PATCH v2 02/43] spice: move client_migrate_info command to ui/
Date: Thu, 20 Apr 2023 15:39:21 +0200	[thread overview]
Message-ID: <20230420134002.29531-3-quintela@redhat.com> (raw)
In-Reply-To: <20230420134002.29531-1-quintela@redhat.com>

It has nothing to do with migration, except for the "migrate" in the
name of the command.  Move it with the rest of the ui commands.

Signed-off-by: Juan Quintela <quintela@redhat.com>

---

I would claim that it should be only compiled with CONFIG_SPICE, but
I left that to spice maintainers.
---
 migration/migration-hmp-cmds.c | 18 ------------------
 migration/migration.c          | 30 ------------------------------
 qapi/migration.json            | 28 ----------------------------
 qapi/ui.json                   | 28 ++++++++++++++++++++++++++++
 ui/ui-hmp-cmds.c               | 17 +++++++++++++++++
 ui/ui-qmp-cmds.c               | 29 +++++++++++++++++++++++++++++
 6 files changed, 74 insertions(+), 76 deletions(-)

diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
index 71da91967a..83f214d145 100644
--- a/migration/migration-hmp-cmds.c
+++ b/migration/migration-hmp-cmds.c
@@ -28,7 +28,6 @@
 #include "qemu/error-report.h"
 #include "qemu/sockets.h"
 #include "sysemu/runstate.h"
-#include "ui/qemu-spice.h"
 #include "sysemu/sysemu.h"
 #include "migration.h"
 
@@ -636,23 +635,6 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
     hmp_handle_error(mon, err);
 }
 
-void hmp_client_migrate_info(Monitor *mon, const QDict *qdict)
-{
-    Error *err = NULL;
-    const char *protocol = qdict_get_str(qdict, "protocol");
-    const char *hostname = qdict_get_str(qdict, "hostname");
-    bool has_port        = qdict_haskey(qdict, "port");
-    int port             = qdict_get_try_int(qdict, "port", -1);
-    bool has_tls_port    = qdict_haskey(qdict, "tls-port");
-    int tls_port         = qdict_get_try_int(qdict, "tls-port", -1);
-    const char *cert_subject = qdict_get_try_str(qdict, "cert-subject");
-
-    qmp_client_migrate_info(protocol, hostname,
-                            has_port, port, has_tls_port, tls_port,
-                            cert_subject, &err);
-    hmp_handle_error(mon, err);
-}
-
 void hmp_migrate_start_postcopy(Monitor *mon, const QDict *qdict)
 {
     Error *err = NULL;
diff --git a/migration/migration.c b/migration/migration.c
index 4be66b1956..74f28cdca6 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -63,7 +63,6 @@
 #include "sysemu/cpus.h"
 #include "yank_functions.h"
 #include "sysemu/qtest.h"
-#include "ui/qemu-spice.h"
 
 #define MAX_THROTTLE  (128 << 20)      /* Migration transfer speed throttling */
 
@@ -1018,35 +1017,6 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
     return params;
 }
 
-void qmp_client_migrate_info(const char *protocol, const char *hostname,
-                             bool has_port, int64_t port,
-                             bool has_tls_port, int64_t tls_port,
-                             const char *cert_subject,
-                             Error **errp)
-{
-    if (strcmp(protocol, "spice") == 0) {
-        if (!qemu_using_spice(errp)) {
-            return;
-        }
-
-        if (!has_port && !has_tls_port) {
-            error_setg(errp, QERR_MISSING_PARAMETER, "port/tls-port");
-            return;
-        }
-
-        if (qemu_spice.migrate_info(hostname,
-                                    has_port ? port : -1,
-                                    has_tls_port ? tls_port : -1,
-                                    cert_subject)) {
-            error_setg(errp, "Could not set up display for migration");
-            return;
-        }
-        return;
-    }
-
-    error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol", "'spice'");
-}
-
 AnnounceParameters *migrate_announce_params(void)
 {
     static AnnounceParameters ap;
diff --git a/qapi/migration.json b/qapi/migration.json
index c84fa10e86..2c35b7b9cf 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
@@ -1203,34 +1203,6 @@
 { 'command': 'query-migrate-parameters',
   'returns': 'MigrationParameters' }
 
-##
-# @client_migrate_info:
-#
-# Set migration information for remote display.  This makes the server
-# ask the client to automatically reconnect using the new parameters
-# once migration finished successfully.  Only implemented for SPICE.
-#
-# @protocol: must be "spice"
-# @hostname: migration target hostname
-# @port: spice tcp port for plaintext channels
-# @tls-port: spice tcp port for tls-secured channels
-# @cert-subject: server certificate subject
-#
-# Since: 0.14
-#
-# Example:
-#
-# -> { "execute": "client_migrate_info",
-#      "arguments": { "protocol": "spice",
-#                     "hostname": "virt42.lab.kraxel.org",
-#                     "port": 1234 } }
-# <- { "return": {} }
-#
-##
-{ 'command': 'client_migrate_info',
-  'data': { 'protocol': 'str', 'hostname': 'str', '*port': 'int',
-            '*tls-port': 'int', '*cert-subject': 'str' } }
-
 ##
 # @migrate-start-postcopy:
 #
diff --git a/qapi/ui.json b/qapi/ui.json
index 98322342f7..7ddd27a932 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -1554,3 +1554,31 @@
 { 'command': 'display-update',
   'data': 'DisplayUpdateOptions',
   'boxed' : true }
+
+##
+# @client_migrate_info:
+#
+# Set migration information for remote display.  This makes the server
+# ask the client to automatically reconnect using the new parameters
+# once migration finished successfully.  Only implemented for SPICE.
+#
+# @protocol: must be "spice"
+# @hostname: migration target hostname
+# @port: spice tcp port for plaintext channels
+# @tls-port: spice tcp port for tls-secured channels
+# @cert-subject: server certificate subject
+#
+# Since: 0.14
+#
+# Example:
+#
+# -> { "execute": "client_migrate_info",
+#      "arguments": { "protocol": "spice",
+#                     "hostname": "virt42.lab.kraxel.org",
+#                     "port": 1234 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'client_migrate_info',
+  'data': { 'protocol': 'str', 'hostname': 'str', '*port': 'int',
+            '*tls-port': 'int', '*cert-subject': 'str' } }
diff --git a/ui/ui-hmp-cmds.c b/ui/ui-hmp-cmds.c
index 5c456ecc02..c671389473 100644
--- a/ui/ui-hmp-cmds.c
+++ b/ui/ui-hmp-cmds.c
@@ -458,3 +458,20 @@ hmp_screendump(Monitor *mon, const QDict *qdict)
 end:
     hmp_handle_error(mon, err);
 }
+
+void hmp_client_migrate_info(Monitor *mon, const QDict *qdict)
+{
+    Error *err = NULL;
+    const char *protocol = qdict_get_str(qdict, "protocol");
+    const char *hostname = qdict_get_str(qdict, "hostname");
+    bool has_port        = qdict_haskey(qdict, "port");
+    int port             = qdict_get_try_int(qdict, "port", -1);
+    bool has_tls_port    = qdict_haskey(qdict, "tls-port");
+    int tls_port         = qdict_get_try_int(qdict, "tls-port", -1);
+    const char *cert_subject = qdict_get_try_str(qdict, "cert-subject");
+
+    qmp_client_migrate_info(protocol, hostname,
+                            has_port, port, has_tls_port, tls_port,
+                            cert_subject, &err);
+    hmp_handle_error(mon, err);
+}
diff --git a/ui/ui-qmp-cmds.c b/ui/ui-qmp-cmds.c
index dbc4afcd73..a37a7024f3 100644
--- a/ui/ui-qmp-cmds.c
+++ b/ui/ui-qmp-cmds.c
@@ -175,3 +175,32 @@ void qmp_display_update(DisplayUpdateOptions *arg, Error **errp)
         abort();
     }
 }
+
+void qmp_client_migrate_info(const char *protocol, const char *hostname,
+                             bool has_port, int64_t port,
+                             bool has_tls_port, int64_t tls_port,
+                             const char *cert_subject,
+                             Error **errp)
+{
+    if (strcmp(protocol, "spice") == 0) {
+        if (!qemu_using_spice(errp)) {
+            return;
+        }
+
+        if (!has_port && !has_tls_port) {
+            error_setg(errp, QERR_MISSING_PARAMETER, "port/tls-port");
+            return;
+        }
+
+        if (qemu_spice.migrate_info(hostname,
+                                    has_port ? port : -1,
+                                    has_tls_port ? tls_port : -1,
+                                    cert_subject)) {
+            error_setg(errp, "Could not set up display for migration");
+            return;
+        }
+        return;
+    }
+
+    error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol", "'spice'");
+}
-- 
2.39.2



  parent reply	other threads:[~2023-04-20 13:41 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 13:39 [PATCH v2 00/43] Migration: Create options.c for capabilities/params/properties Juan Quintela
2023-04-20 13:39 ` [PATCH v2 01/43] migration: move migration_global_dump() to migration-hmp-cmds.c Juan Quintela
2023-04-20 13:39 ` Juan Quintela [this message]
2023-04-20 13:39 ` [PATCH v2 03/43] migration: Create migration_cap_set() Juan Quintela
2023-04-20 18:44   ` Fabiano Rosas
2023-04-20 19:22     ` Juan Quintela
2023-04-20 13:39 ` [PATCH v2 04/43] migration: Create options.c Juan Quintela
2023-04-20 13:39 ` [PATCH v2 05/43] migration: Move migrate_colo_enabled() to options.c Juan Quintela
2023-04-20 13:39 ` [PATCH v2 06/43] migration: Move migrate_use_compression() " Juan Quintela
2023-04-20 13:39 ` [PATCH v2 07/43] migration: Move migrate_use_events() " Juan Quintela
2023-04-20 13:39 ` [PATCH v2 08/43] migration: Move migrate_use_multifd() " Juan Quintela
2023-04-20 13:39 ` [PATCH v2 09/43] migration: Move migrate_use_zero_copy_send() " Juan Quintela
2023-04-20 13:39 ` [PATCH v2 10/43] migration: Move migrate_use_xbzrle() " Juan Quintela
2023-04-20 13:39 ` [PATCH v2 11/43] migration: Move migrate_use_block() " Juan Quintela
2023-04-20 13:39 ` [PATCH v2 12/43] migration: Move migrate_use_return() " Juan Quintela
2023-04-20 13:39 ` [PATCH v2 13/43] migration: Create migrate_rdma_pin_all() function Juan Quintela
2023-04-20 18:46   ` Fabiano Rosas
2023-04-20 13:39 ` [PATCH v2 14/43] migration: Move migrate_caps_check() to options.c Juan Quintela
2023-04-20 18:09   ` Vladimir Sementsov-Ogievskiy
2023-04-20 13:39 ` [PATCH v2 15/43] migration: Move qmp_query_migrate_capabilities() " Juan Quintela
2023-04-20 18:10   ` Vladimir Sementsov-Ogievskiy
2023-04-20 13:39 ` [PATCH v2 16/43] migration: Move qmp_migrate_set_capabilities() " Juan Quintela
2023-04-20 18:11   ` Vladimir Sementsov-Ogievskiy
2023-04-20 13:39 ` [PATCH v2 17/43] migration: Move migrate_cap_set() " Juan Quintela
2023-04-20 18:12   ` Vladimir Sementsov-Ogievskiy
2023-04-20 13:39 ` [PATCH v2 18/43] migration: Move parameters functions to option.c Juan Quintela
2023-04-20 18:28   ` Vladimir Sementsov-Ogievskiy
2023-04-20 13:39 ` [PATCH v2 19/43] migration: Use migrate_max_postcopy_bandwidth() Juan Quintela
2023-04-20 18:30   ` Vladimir Sementsov-Ogievskiy
2023-04-20 13:39 ` [PATCH v2 20/43] migration: Move migrate_use_block_incremental() to option.c Juan Quintela
2023-04-20 18:31   ` Vladimir Sementsov-Ogievskiy
2023-04-20 13:39 ` [PATCH v2 21/43] migration: Create migrate_throttle_trigger_threshold() Juan Quintela
2023-04-20 18:47   ` Fabiano Rosas
2023-04-20 13:39 ` [PATCH v2 22/43] migration: Create migrate_checkpoint_delay() Juan Quintela
2023-04-20 19:00   ` Fabiano Rosas
2023-04-20 13:39 ` [PATCH v2 23/43] migration: Create migrate_max_cpu_throttle() Juan Quintela
2023-04-20 19:01   ` Fabiano Rosas
2023-04-20 13:39 ` [PATCH v2 24/43] migration: Move migrate_announce_params() to option.c Juan Quintela
2023-04-20 19:04   ` Fabiano Rosas
2023-04-20 13:39 ` [PATCH v2 25/43] migration: Create migrate_cpu_throttle_initial() " Juan Quintela
2023-04-20 19:08   ` Fabiano Rosas
2023-04-20 13:39 ` [PATCH v2 26/43] migration: Create migrate_cpu_throttle_increment() function Juan Quintela
2023-04-20 19:10   ` Fabiano Rosas
2023-04-20 13:39 ` [PATCH v2 27/43] migration: Create migrate_cpu_throttle_tailslow() function Juan Quintela
2023-04-20 19:11   ` Fabiano Rosas
2023-04-20 13:39 ` [PATCH v2 28/43] migration: Move migrate_use_tls() to options.c Juan Quintela
2023-04-20 19:19   ` Fabiano Rosas
2023-04-20 21:07     ` Juan Quintela
2023-04-20 13:39 ` [PATCH v2 29/43] migration: Move migrate_postcopy() " Juan Quintela
2023-04-20 19:25   ` Fabiano Rosas
2023-04-20 13:39 ` [PATCH v2 30/43] migration: Create migrate_max_bandwidth() function Juan Quintela
2023-04-20 19:30   ` Fabiano Rosas
2023-04-20 13:39 ` [PATCH v2 31/43] migration: Move qmp_query_migrate_parameters() to options.c Juan Quintela
2023-04-20 13:39 ` [PATCH v2 32/43] migration: Move qmp_migrate_set_parameters() " Juan Quintela
2023-04-20 13:39 ` [PATCH v2 33/43] migration: Create migrate_params_init() function Juan Quintela
2023-04-20 13:39 ` [PATCH v2 34/43] migration: Make all functions check have the same format Juan Quintela
2023-04-20 13:39 ` [PATCH v2 35/43] migration: Create migrate_downtime_limit() function Juan Quintela
2023-04-20 13:39 ` [PATCH v2 36/43] migration: Move migrate_set_block_incremental() to options.c Juan Quintela
2023-04-20 13:39 ` [PATCH v2 37/43] migration: Move block_cleanup_parameters() " Juan Quintela
2023-04-20 13:39 ` [PATCH v2 38/43] migration: Remove MigrationState from block_cleanup_parameters() Juan Quintela
2023-04-20 13:39 ` [PATCH v2 39/43] migration: Create migrate_tls_creds() function Juan Quintela
2023-04-20 13:39 ` [PATCH v2 40/43] migration: Create migrate_tls_authz() function Juan Quintela
2023-04-20 13:40 ` [PATCH v2 41/43] migration: Create migrate_tls_hostname() function Juan Quintela
2023-04-20 13:40 ` [PATCH v2 42/43] migration: Create migrate_block_bitmap_mapping() function Juan Quintela
2023-04-20 13:40 ` [PATCH v2 43/43] migration: Move migration_properties to options.c Juan Quintela

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=20230420134002.29531-3-quintela@redhat.com \
    --to=quintela@redhat.com \
    --cc=armbru@redhat.com \
    --cc=david@redhat.com \
    --cc=eblake@redhat.com \
    --cc=fam@euphon.net \
    --cc=jsnow@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=leobras@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mst@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@yandex-team.ru \
    --cc=zhanghailiang@xfusion.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).