From nobody Sun May 12 17:18:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681994307; cv=none; d=zohomail.com; s=zohoarc; b=ILJ7SOZaeiJO7OBjo+khI0O5S0DfgyLB9PtxSk/E1WjsL6VxvjV/9RuaXufUZcoYUI2H+hoSufN8QlO/xgW7ZcSwpXOr1SLGGZvmpNaGCqeTYEtPAGysI138pjAeiA/YFuK5+0JuswMno+0knMf7OZ11kfsr/58aw/5fozTxETo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681994307; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=nm7S0Kx5+8PKbcCtBeSbXaSnuCz2FTMp3wzRJFAmcQs=; b=fdFpaDuQajCBJGRtnQN/kwV0kzMYvgJnYgntLMsEL627H/lLwWtGzz8GBhASTqmWxcNDFz2lO5EpNEWLwucLtGtbzUyk5s1co9ww4RbMbYAEKWIVUHlrmum9nCqMmnPpDttwekvh1u89Wx0r5Y7Nwqvq/xsXq9rU6vY5YmnGT4A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168199430709925.334703462512948; Thu, 20 Apr 2023 05:38:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppTXV-0003M1-Fh; Thu, 20 Apr 2023 08:37:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppTXN-00039k-M6 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:37:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppTXI-0005Tk-4V for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:37:21 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-665-h2p2pyinPZGoIYNF5wUvrQ-1; Thu, 20 Apr 2023 08:37:13 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8EA7681B915 for ; Thu, 20 Apr 2023 12:37:13 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53A4D1410F1C; Thu, 20 Apr 2023 12:37:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681994235; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=nm7S0Kx5+8PKbcCtBeSbXaSnuCz2FTMp3wzRJFAmcQs=; b=S4bwB2uydDIT5yXGAQsls4iPYpGTNB7PygcQAFgqT9U5B3ujTeSZXfFcEbcxPeOxs8EzBj 4n6SdEDKlkd40VyITX20VsRiD0timOGlnh1prbhKmZVuAjxv4DNovKX2Nwf0YIiCQhg+C3 xseRr9E7Lw3JTBIojKlYRG4oTfNrOsY= X-MC-Unique: h2p2pyinPZGoIYNF5wUvrQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Markus Armbruster , Eric Blake , Juan Quintela , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2] spice: move client_migrate_info command to ui/ Date: Thu, 20 Apr 2023 14:37:11 +0200 Message-Id: <20230420123711.26640-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681994308102100001 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- I would claim that it should be only compiled with CONFIG_SPICE, but I left that to spice maintainers. Gerd, what do you think? Should I take this patch over my tree? Based-on: Message-Id: <20230420121038.25167-1-quintela@redhat.com> [PATCH v3] migration: move migration_global_dump() to migration-hmp-cmds.c --- qapi/migration.json | 28 ---------------------------- qapi/ui.json | 28 ++++++++++++++++++++++++++++ migration/migration-hmp-cmds.c | 18 ------------------ migration/migration.c | 30 ------------------------------ ui/ui-hmp-cmds.c | 17 +++++++++++++++++ ui/ui-qmp-cmds.c | 29 +++++++++++++++++++++++++++++ 6 files changed, 74 insertions(+), 76 deletions(-) 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' } =20 -## -# @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/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" =20 @@ -636,23 +635,6 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDi= ct *qdict) hmp_handle_error(mon, err); } =20 -void hmp_client_migrate_info(Monitor *mon, const QDict *qdict) -{ - Error *err =3D NULL; - const char *protocol =3D qdict_get_str(qdict, "protocol"); - const char *hostname =3D qdict_get_str(qdict, "hostname"); - bool has_port =3D qdict_haskey(qdict, "port"); - int port =3D qdict_get_try_int(qdict, "port", -1); - bool has_tls_port =3D qdict_haskey(qdict, "tls-port"); - int tls_port =3D qdict_get_try_int(qdict, "tls-port", -1); - const char *cert_subject =3D 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 =3D NULL; diff --git a/migration/migration.c b/migration/migration.c index fd9f41fe37..ca2e57b106 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" =20 #define MAX_THROTTLE (128 << 20) /* Migration transfer speed throttl= ing */ =20 @@ -1019,35 +1018,6 @@ MigrationParameters *qmp_query_migrate_parameters(Er= ror **errp) return params; } =20 -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") =3D=3D 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/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 =3D NULL; + const char *protocol =3D qdict_get_str(qdict, "protocol"); + const char *hostname =3D qdict_get_str(qdict, "hostname"); + bool has_port =3D qdict_haskey(qdict, "port"); + int port =3D qdict_get_try_int(qdict, "port", -1); + bool has_tls_port =3D qdict_haskey(qdict, "tls-port"); + int tls_port =3D qdict_get_try_int(qdict, "tls-port", -1); + const char *cert_subject =3D 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, Err= or **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") =3D=3D 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'"); +} --=20 2.39.2