From patchwork Mon Dec 26 05:33:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13081629 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AA44EC46467 for ; Mon, 26 Dec 2022 05:34:36 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9g7f-0003uH-UO; Mon, 26 Dec 2022 00:34:03 -0500 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 1p9g7d-0003tl-V8 for qemu-devel@nongnu.org; Mon, 26 Dec 2022 00:34:01 -0500 Received: from mx0a-002c1b01.pphosted.com ([148.163.151.68]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9g7b-00019T-Rt for qemu-devel@nongnu.org; Mon, 26 Dec 2022 00:34:01 -0500 Received: from pps.filterd (m0127837.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BQ0A5oU013196; Sun, 25 Dec 2022 21:33:57 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=proofpoint20171006; bh=m8atIBhdANZHvsFOCTgDAgWneoB97LfOThtRftkjl78=; b=2ONVOqPHQLKa9owHwGtAssmCYlVsyQUpNDQXfBjlGknVdV6VQrTf+ttBQvaYVIK9ybHV XS4s+CskI8mKNBWRaLwFHz7HphLMHM9F0t4j4l2wUnAa9ymKko4Qrbiq3XNsfyuihYYh nWgBf8PFN8idUJ1Iw4zGmX3R7XNq7xy/WVE0o4wOsDFXpv6971LgUn57rGmyP5M6XIpB +UUuU2vXyeX3l9Zvbni0n4+RFaHMBjB+/cJT897ns+fPpLPHfYLUoFm+2IXrHHZliDKS FaLvrA8RdtqsWwDoqEAFFnu8XceitU2HZQGLYuxDAmFPG2OrZarEC2EqVoEjqqVZx1O9 oA== Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2042.outbound.protection.outlook.com [104.47.73.42]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3mnx7dukw3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 25 Dec 2022 21:33:57 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CUhuRBDuU4OzmtixeEPKodF5v3EYfBAAbgFR8Pcya2CSORAR0ujGlCG391I9diVcev/jyH++Pn3UVc/2QLSNfq7YUcTsKcWvxXsp8p8TN2FIhto27jFmbVaqjibyWjj0NbR7Dej2YmKMTJRtg75OdlZipp5TLq96RMYrwiVCFy4b6OlG3KqQSBruaCi0uxURZPKOXAnlhUo67gBByRkJy1oUqNDxloEt02lfcDzWDnUBPcW9mPnZZvtc2OpkY8jfkrkvMfB0qNdAB/Ojwx0XEIQW0wU+Y3ukWh/dcAoTbSEgx/XH3UePTaq699pPytaADDqxLoZQuyZdd7csGB3Oiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=m8atIBhdANZHvsFOCTgDAgWneoB97LfOThtRftkjl78=; b=Tf3KjQPFB7KIm9P1XqwFUtfigQxFnbaNiHUE0b8iRwEjPwzdUbTGz/wgZFC5xQ0LmkHVm6cKg6VQs2Lcws4msmAuGOXLNFDR/KWOKByvzXP2OUmG4CPHeEu+DfdXHIwDUersffmluO3ww//hAiWgQ/7OwCtRM7g50d2uXsuqW3JrZslkiJU/wJ8V0D0YbdcNT3GA/7E0CbG5UeNmFsIgllw68FmISLgeShWCl50tlspDXPM0wj6LBXEybnksxkna8H+7SjSK/SNqFlyF6QEmN1EepR0r5lgyc/rFFq9kIpOu5gJnMAD3fqpxpZHoFXPi/W07Wq0U9FlCkhFyzD60bw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m8atIBhdANZHvsFOCTgDAgWneoB97LfOThtRftkjl78=; b=Y05bWu8z+mxnhd/zze24IKfv/0htViVazJvbNUL0AEmmnZ7TjRq28/fOnisNQXlblgsw85iOSAuzrJgac30GN2TSPuB3j0cHYOfQWVE247kz5rEBWsBRMhBjTU1RBu6s21vbyzH3CihtvMvyN8Q4pn6iAyNhxlTKhARx5irBzxfA2nc1CYArXJlij8SGGrFxJ6+N4B/AREat2I6M9ZLUdfAesjkWd9SR49997q2enswkXo3sMM6ZLG140/40HgBJJDPpRvDRGSTJMbnxlLjfYKvaBs4Dt5ef/tyqWXYVZz4BwAxqlz7OMNN8Snk6e8RnCF5yAqWIwRCGLAavfT1qNw== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by PH0PR02MB7655.namprd02.prod.outlook.com (2603:10b6:510:57::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Mon, 26 Dec 2022 05:33:55 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::6713:972f:95c7:a1f3]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::6713:972f:95c7:a1f3%6]) with mapi id 15.20.5944.016; Mon, 26 Dec 2022 05:33:55 +0000 From: Het Gala To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com, eblake@redhat.com, Author Het Gala , Manish Mishra , Aravind Retnakaran Subject: [PATCH 1/5] migration: Updated QAPI format for 'migrate' qemu monitor command Date: Mon, 26 Dec 2022 05:33:25 +0000 Message-Id: <20221226053329.157905-2-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20221226053329.157905-1-het.gala@nutanix.com> References: <20221226053329.157905-1-het.gala@nutanix.com> X-ClientProxiedBy: BYAPR01CA0009.prod.exchangelabs.com (2603:10b6:a02:80::22) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|PH0PR02MB7655:EE_ X-MS-Office365-Filtering-Correlation-Id: c0e6787a-a706-4440-bec0-08dae702c723 x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 17X1vkeeeUU3UlHDBo+04vjd7lCdNvy24fOudwVf5EFlvS2LEHlfH0s8mHf9dxauuCtjyxRKtKwkSloJeWs4o73A6o98z9wmbtiKzkohbUc4BH3Q4rPMEj2x8+AMyCJVoabE3Kr9kEdEn5yK0gz/A5G2rCgRQvbUNeHAxDA4dsGRAIDIG8Gtf31XGpDzxoDq5iK38eiIVA4pyC/mLN9QIxIMFBYWgPZdZVcQlc4Xl4dqrvRqlr0BfHLk3w29LFbG3dK3xKFHuyUfXDnBhwkoWLc+SUGfOIv7q4dPHxis3bO+7+Je/LWgcgghADfYL2Zsj0GqrgBkuLkyIX9RW940Wgf61huRdT+zmsPP4t3F6dv+QQE2L0L1XXd1QDEtVhMgJ7GuF7yQCKkYEGK39u6kdq8pPMeLWcI7U1ccF+M0wJEhVo3i2k2M0+LkqkReiJQpoKPBgnZ5FQ+Sb3A3hG3GkE80UHavprkYO7bOlD2xxZ0gGRPov99fuwbTbgoRYOWdUi/rfEM4BeYWjXWLrItw4UfCIesj5SqhMuEmxu/TtMebZR/p7VoIqTCRy2kLGLKljXMUAl2WrxEsgjUEwq6QI8JAHJ1xeLbiUcQOaZkYveH8U5vd5nPcQ9OXx4UiJZusF1hl2/DR9TNoz1qOe0+TyC6r2x8eXDyrYwdDFLhiGDffk1qxzOendqaj/if1dgX/804HDasrDjNJ7Z1lXrC9DQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(39850400004)(396003)(346002)(376002)(366004)(136003)(451199015)(36756003)(86362001)(26005)(6486002)(478600001)(52116002)(6512007)(186003)(107886003)(6666004)(6506007)(8676002)(66556008)(66476007)(5660300002)(66946007)(41300700001)(8936002)(2906002)(6916009)(316002)(44832011)(54906003)(4326008)(38100700002)(38350700002)(1076003)(2616005)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Rgm/21Rn2UFuGOKo+Da8kvDyUl0gF0iUroEOGoY8zYbIGXQIJHKKXsxRf2wtRyFAv+siCoSe6I9KSjmq9pQ/HatPt0VVXnZMw2xLVRnrmEwohtmZ3hZ9hujWCCrgTUwqjNMkJzUyfuO5df9bTEVpJxd1nGpZFEspqtqofwijkju8Trbc1ZoE0HitVnt5vsNI6aJdZnU84yoBTN++FvGWM1zxFm1x8iBsRxzN57ZAfq7zoazFL8xhDZC8xAmJSW45UgusNJAqOE7hljrd7lSh7oGhEasjJI/YpVAvxjQb2ahAzvrIbcyud9FRwIY/yTN4K3VnnDshvbbkXVg/jdB/8JC0+hAzoewTThqvL1IktX3gSTmillW/4TxDI+sTIqOsX0KKVMcey8MM10pQwRiT2zGqzKPH0tApkgVjdKDkhL/Y8GbOD6e0inrDIUa/jcxyqb6d/tWphgCqRswqFshqgRrCMDllTv5azhGfbzhzPXkUzJSro1n1mb+XwzBKRBUAKSuR2nU1CKisS/3UO3kkXAMDKVWKQosFvz/ZzyuKZuecSogCVby7SI4ch2KGlfTPFEXBkGmfh2M9YTMttGB2rRjidzrxKe4K58RgzN3BKTcZQYg07IjuNEm6Cww9FH6LxFnDqJn60B0p72Y9Dnj5WR2IVtxDcKy8TAZUZOhhYyxIPspn4ggiW1kX+c4eP41jVGpXr6KvrzGFeIZQP1nRVwNE3VmZa2ZMKTrF8mPZDWzuIwRsyz5/y9M0cRqO4QeGMX3ksWUMu0kwAN9uV91DjEHnYgwp52TNa6z4jx+8WX8vYVZPq9WrCss/MkojxXWNHz5HZ3qj0eWsGhGLLjk2SeqOwVDS7d3KIYLDmHXVjV2sxZN+yLk1+8H0rd2nNFm0kSDZJvMNXUwrO8jK28Ffwlr1SRFhFVtKU9f00gXBkFhU9BK7Zq3/Vv9KGGlIUlz6CBoKWYf18Fn8V37w0B4pPezDeYuYeY6ZF4v728nuiPRflDi3jKsso/sEaFFXB0RCGGxKULT6e45anZQzc/cTEBM8QlYU5121s3yXmtdbd+Qzc1k+Z9tWFi8V0DvHyNbDDYSDG2ZfqZGxqfx9nVXdhc2wVUmYjwbv2zAAkJqoiOPwOoB7LQpIcv3cw9tLsqkRH3hTM+lpH4N/jADdhlESmzRE+nz/cvOIAmaLp2MJ05WH/L3KbnGek9zGfK/ojkWZDwc1Jl01Ji3WB7xF1XdbL6hCUQsR/TYF4XniVaL/5+ZfWG6uF0Nr3oJzOZuWV0SdT115BnCldTJR82053FZ3gsg9xAGYeDS2haOOXDEU9P0/xWES85Wu2XMSrKEOtshl29GEP9YL0fe/ZH8NVDB7N/GNNfLqfLnqkit4IWnyZb0hKEO6naLuV566uymKR5aYkAYMBVGTSVt7XyZUtwFTry22VLAh9m/8Eyekas5fwon7Wn//aZMzkaK9kV3uBmB82ZifDGlNt7jE1Ma0uKKO1d0GcKZlMboy9tqVLSVuB6MlxgErxYfbJO7lcZTvqHo2qtxBLDuBua50GlCjaMwdCQYmdTlefhfeNPhelzSw/bwa3FGkhSisS6pFAyffS1s4nxB3r+5/WOBouJtWHW0eHw== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0e6787a-a706-4440-bec0-08dae702c723 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2022 05:33:55.2836 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Nr59i877oxA0PMSkFlnSp6lc2cIoJx/2BgF0A3LVOdWZnCKj950pFMfRETCFv7jeOEYgiOsRxC29Nb8JSAeYPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7655 X-Proofpoint-GUID: vB9-mVzz_PrebQVaoc0X-cka69UZOsLK X-Proofpoint-ORIG-GUID: vB9-mVzz_PrebQVaoc0X-cka69UZOsLK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-26_02,2022-12-23_01,2022-06-22_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Author Het Gala Existing 'migrate' QAPI design enforces transport mechanism, ip address of destination interface and corresponding port number in the form of a unified string 'uri' parameter. This scheme does seem to have an issue in it, i.e. double-level encoding of URIs. The current patch maps existing QAPI design into a well-defined data structure - 'MigrateChannel' only from the design perspective. Please note that the existing 'uri' parameter is kept untouched for backward compatibility. Suggested-by: Daniel P. Berrange Suggested-by: Manish Mishra Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- qapi/migration.json | 121 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 119 insertions(+), 2 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index 88ecf86ac8..753e187ce2 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1449,12 +1449,108 @@ ## { 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} } +## +# @MigrateTransport: +# +# The supported communication transport mechanisms for migration +# +# @socket: Supported communication type between two devices for migration. +# Socket is able to cover all of 'tcp', 'unix', 'vsock' and +# 'fd' already +# +# @exec: Supported communication type to redirect migration stream into file. +# +# @rdma: Supported communication type to redirect rdma type migration stream. +# +# Since 8.0 +## +{ 'enum': 'MigrateTransport', + 'data': ['socket', 'exec', 'rdma'] } + +## +# @MigrateSocketAddr: +# +# To support different type of socket. +# +# @socket-type: Different type of socket connections. +# +# Since 8.0 +## +{ 'struct': 'MigrateSocketAddr', + 'data': {'socket-type': 'SocketAddress' } } + +## +# @MigrateExecAddr: + # + # Since 8.0 + ## +{ 'struct': 'MigrateExecAddr', + 'data' : {'exec-str': 'str' } } + +## +# @MigrateRdmaAddr: +# +# Since 8.0 +## +{ 'struct': 'MigrateRdmaAddr', + 'data' : {'rdma-str': 'str' } } + +## +# @MigrateAddress: +# +# The options available for communication transport mechanisms for migration +# +# Since 8.0 +## +{ 'union' : 'MigrateAddress', + 'base' : { 'transport' : 'MigrateTransport'}, + 'discriminator' : 'transport', + 'data' : { + 'socket' : 'MigrateSocketAddr', + 'exec' : 'MigrateExecAddr', + 'rdma': 'MigrateRdmaAddr' } } + +## +# @MigrateChannelType: +# +# The supported options for migration channel type requests +# +# @main: Support request for main outbound migration control channel +# +# Since 8.0 +## +{ 'enum': 'MigrateChannelType', + 'data': [ 'main'] } + +## +# @MigrateChannel: +# +# Information regarding migration Channel-type for transferring packets, +# source and corresponding destination interface for socket connection +# and number of multifd channels over the interface. +# +# @channeltype: Name of Channel type for transfering packet information +# +# @addr: SocketAddress of destination interface +# +# Since 8.0 +## +{ 'struct': 'MigrateChannel', + 'data' : { + 'channeltype' : 'MigrateChannelType', + 'addr' : 'MigrateAddress' } } + ## # @migrate: # # Migrates the current running guest to another Virtual Machine. # # @uri: the Uniform Resource Identifier of the destination VM +# for migration thread +# +# @channel: Struct containing migration channel type, along with all +# the details of destination interface required for initiating +# a migration stream. # # @blk: do block migration (full disk copy) # @@ -1479,15 +1575,36 @@ # 3. The user Monitor's "detach" argument is invalid in QMP and should not # be used # +# 4. The uri argument should have the Uniform Resource Identifier of default +# destination VM. This connection will be bound to default network +# +# 5. Both 'uri' and 'channel' arguments, are mututally exclusive but, atleast +# one of the two arguments should be present. +# # Example: # # -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } } # <- { "return": {} } # +# -> { "execute": "migrate", +# "arguments": { +# "channel": { "channeltype": "main", +# "addr": { "transport": "socket", +# "socket-type": { "type': "inet', +# "host": "10.12.34.9", +# "port": "1050" } } } } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { "channel": { "channeltype": "main", +# "addr": { "transport": "exec", +# "exec-str": "/tmp/exec" } } } } +# <- { "return": {} } +# ## { 'command': 'migrate', - 'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', - '*detach': 'bool', '*resume': 'bool' } } + 'data': {'*uri': 'str', '*channel': 'MigrateChannel', '*blk': 'bool', + '*inc': 'bool', '*detach': 'bool', '*resume': 'bool' } } ## # @migrate-incoming: From patchwork Mon Dec 26 05:33:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13081634 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1A206C4332F for ; Mon, 26 Dec 2022 05:35:15 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9g7j-0003vM-KU; Mon, 26 Dec 2022 00:34:07 -0500 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 1p9g7h-0003ue-NN for qemu-devel@nongnu.org; Mon, 26 Dec 2022 00:34:05 -0500 Received: from mx0a-002c1b01.pphosted.com ([148.163.151.68]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9g7d-00019m-J2 for qemu-devel@nongnu.org; Mon, 26 Dec 2022 00:34:05 -0500 Received: from pps.filterd (m0127840.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BQ3YPXn017384; Sun, 25 Dec 2022 21:33:59 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=proofpoint20171006; bh=C3B85I4D5OuYEyvO291MlLaOn/jG/RgAB1040jHCuYE=; b=n8vI4jfXJF5XKATqfJ91G3AJqNhaWC41oRoht+BVgc6Oei2MzlDCg8mhz7PV4VyboFS4 okiBeyBFCLF8jiabUjkv4CsaZOv232ZDqj88IlM4syUfZGgtQLkO//SxZERE1v8Aegwc lhTEiavKacjA0fIn6yGSLG7u/conuNESMWhHplLUQ/V+F5TtIFcGwRZ7+TqCGNHkNttK cyuzClKG6KtPoQDaV6qvqrR79GCh01akh0RyEQcPmjeRYVHTSRrtJoIPr0b2dkR0wVdw jyCMNUcFVzdpb008xQumKlFh2l7bTWYkB9ExySxj1mwMJevD6hjSf3UkAf+8nVpHEzoY Yg== Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2047.outbound.protection.outlook.com [104.47.73.47]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3mnxn0bjpx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 25 Dec 2022 21:33:59 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F/drBnGoQHfIYdNnuPCY4xHChCqAnbK9OfoP/sHc/CWfeAxVVu4GqmxCX3298xRQDu+8nVTc0rtjs9pxzkkDTdXU2h4M1JLiB0yPVW31GvphhdX6exi5j12QQ3zzN1gq5zRz93IF3RTMiV3dBFrAZGiXGYnEk11NYDbgiqZymjdYxEjs7OPJI6RoOkD93+V+ejEkBMTEYSa9UOV2wSkTCo65e11SVmo0M3xmDAH8jfJY9VBmYCBQ+B+8Wr68rs8TIdAJHOzK6LgYFRg8ZNqqkK0xc3alGLie7IDOr1wHAvUkWpGe3io6aQm5jfqa9iqiqLiwiv1Mhs4Tprn7rojMiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=C3B85I4D5OuYEyvO291MlLaOn/jG/RgAB1040jHCuYE=; b=i9GrLsMAsFoj+OcWcpuzadLSch/EcX6/TycqVoi2+Tdtt+ZhitxDltZYuJEuzWoTKKfKoo0oCyQXVp+/SLjSRRCnY33fPBDAF624VyAOMNDyUsiF+VJjFuhCxKAqkslyQlI1xJhG7dAwuFo0a5shtdX9w9HONBjCohJxg7xFJOdmQnK0jgIuKQcVbV36pCrh2oTj6vOBmjMwqxscRA+pJFyQqHnQvsz5T6ugk3pAx/lY7ACY3wM3Ok6xfJmk+UHgZxAvh220sqGNAmev+C+5X0GxdLS5KLDDAa0mWXBkTZbwus/832LFd0MZ/fMiGWzi/ETYx62dyrB02XhnZe1Xcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=C3B85I4D5OuYEyvO291MlLaOn/jG/RgAB1040jHCuYE=; b=LQNSXVrL/CIgVGRbXhK3kybNlz42NeZSuPgFuMl15fHIYbZHbAAOzs0eISqm8PdPTSbeFGfX93fnLi/qiX2k6Hls9zcGopWIuh32qdqQQzzanr7tQyTc0dVKb1TcdtMwkm1c5Pb5j8oY8sXlOHf9iQoQHEmRJOqg79cDuLegyuVMbFoiXPtRyhBaDswgwdL40LySwI+UYBNFuvNBYXx7HyL95yPr/knWzD1O52Ll1paeagIj63of+Bp+u0h+teB/0yHS8XhgL0iX5e4pXG3c829RN3ZdIY8CYbyG2uyXka9PTD/mJdf49SWGqLMt2YdlMhTyBfkP680HrYIz/xDVEg== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by PH0PR02MB7655.namprd02.prod.outlook.com (2603:10b6:510:57::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Mon, 26 Dec 2022 05:33:57 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::6713:972f:95c7:a1f3]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::6713:972f:95c7:a1f3%6]) with mapi id 15.20.5944.016; Mon, 26 Dec 2022 05:33:57 +0000 From: Het Gala To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com, eblake@redhat.com, Author Het Gala , Manish Mishra , Aravind Retnakaran Subject: [PATCH 2/5] migration: HMP side changes for modified 'migrate' QAPI design Date: Mon, 26 Dec 2022 05:33:26 +0000 Message-Id: <20221226053329.157905-3-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20221226053329.157905-1-het.gala@nutanix.com> References: <20221226053329.157905-1-het.gala@nutanix.com> X-ClientProxiedBy: BYAPR01CA0009.prod.exchangelabs.com (2603:10b6:a02:80::22) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|PH0PR02MB7655:EE_ X-MS-Office365-Filtering-Correlation-Id: 1694d9ac-77fb-453a-655c-08dae702c8f9 x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +d/AE0u3XMTuQtXBn3pPxl2x+vIfpCFjg2HyRN75PUliU22MWyn7b+AGyqgTF8v8PsyaiHJu+hueao/KJlP0vzWNCzGEF8qHoUBRyB+B2cp8p1nu2ANMLnLEb4G7rlvx7TRYcW26/flMuKOTu1Xwo46O/r6OVABMpa3+EWCI3XgBm6tHLvXRWbSlaufA8jMwCwM9ZnfNU7VA96aWpY7BR960IIQtw6F+nUV0/yFVx9skpt2KBjZwni4UThsCXpygzi4rMa26v6mqRtywCqOb5xp8y6aCxATQCvnArUFjtoGLNKtt8GG5AijUDQoEfmINe71iIpFdDEfzu6BlHb2h8sIcmrBaJUpn2p3PmC+evqqP54CuRwUUBIMUWZXPh2t2igjFT1hmqOrLrFffHVnE8GZeu7/Fl2NNIK6u8gQFD5qC2BXhW115uAdjTmFTgtK1S/YE8VaJqbhOXaDxTWbgiDykp0rNPIsiCVzkX+R8eT8erelIb1K5UdWMdWs37zmnN6d7QHCK3WAUrpYr7MZswTPhunHtVT5cD8zVH8jHqhg4V0q7XQPF5qwNVdXpciTLLlIsBaIBCd2eWn5ADp4QrQ2rwmSfOlb4RTkn9kj3QEXGycCvBxYsNkeaAvpFQQdcD7vgQfAEZcszXlT+BC/uioabM3BTT8b06mWaJ6d83JvEUNAsmBOMTzkkxue6M0hPHk6TMbisTK9QQKYpA7qr6pLxCtk/Md5TmTtGqEAnfD4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(39850400004)(396003)(346002)(376002)(366004)(136003)(451199015)(36756003)(86362001)(26005)(6486002)(478600001)(52116002)(6512007)(186003)(107886003)(6666004)(6506007)(8676002)(66556008)(66476007)(5660300002)(66946007)(41300700001)(8936002)(2906002)(6916009)(316002)(44832011)(54906003)(4326008)(38100700002)(38350700002)(1076003)(2616005)(83380400001)(309714004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: w8FEzj3eMuQCmEY8xjyaoujsqi6DocPZUE4S+8wpjfwTWN7YGLhGvGKPOegZVEYHRjxcMzrKyKoEtbyys5juiBR7BMnAHDTWfzEmDvY8uiybW6KSHUlAbDgvxH5/tlbl1KGWJup/w1q5uIdnMGp+IasX3X8jqUiEhvXh9Tdaux8u/Bnl/StCRePCA0cuUFLQpPd4sYNM8JYgZhLQwLmnXiIKQRoS8pLztcwUQMG9SvUfmaPnwo+41EbqoVRoBgt6y/XGFLPpffz4iBGMawbN8ddVpogIUL8Xiyzx9SzRo5h9W2R7emJxySh/0wk0gMmiO0MK9Ha655NTb4vl6+Po5aG9/wuvERXqRNmil0j/IhDGImD3S0kJstG59UlZ71B4xsJI1MLb91MLlLgwit5bzAk92Y/5CFqPWWiDiJfDET1/z2NMrhLAuZgKaK/66cYG0EGldoTX1bMW9t8ml83TMlXUiQPQPu2qjEM/ul2MmSHuQd9SnYkmrHJUeFPoilIwKochBSzJEKfThwrX+iR21VPKFRnKgmX6zu0yfjLQ6jT9b+LnsGPX/5QRbK+lHJO/LQV3790m7SNUoITQt2ZQVCn6t2WUVpCpx257ckOt++7MK3KzRRY7BOZb0+CF83IDRdHg8+OfgSEg2qT63Dh8+ACNRXVixwjjSoTn90ap0p8ofcUi9tY6sfHWPNPhQbLrI5XrLhKBSMLUDvVAzowQgWYY+zykcTs5BJEUrQPBayQUpmyNY+UVddVdixo9F3hpD500DrP0mizs+2HAAsbEaQFT5JLp97wN9JQJTxXpgIJx/JhLxn2tazTnAwp7darQVDjDsOe3JUpiS/sqWBa1kRHPTN2BC8olpHXuvzwk0tKmyFkJvzzlBCwdS9NpMxXyYUXWJoBni5CpvdDapng4u1V61G+84bxedDyhJ72d7iLVaZfC4UB1QtPavQRZibTB2GdpJJcf3J7XBa+TTrbbVmbo12ZKyb8ojD6BWNUVOQEM71hVWp8BdDg8BORMuDlMzQx2B6HJvKj1EZVAVVhPGTxayAE5fciOsX7KZMkkCLtp+Iz3C4CFUywXjqt7yCbDq63usXn4dCoZvqqcc0ycm9iNLAjeEwYvMUoEllg2ilpN8dmuFSmxF9OHhP70AWgCQKvMZ+WGkxltd4a8JTRjxWmI1LQI4pJCNHDEwl2grNzIk31OjS7hOFYzOSyByZuxw6ZIZVTnUUQMfCeTF64KeD8n6i+rQgnKjnMarQvYuEClmyD5hS5kuAmbP9y2QFBSz99wtSmmZy6DDY0xQ9kQFGs9qm/kUCXPbFQP4MaR6GNP445nK54T4rSaIw+5THYAftGyV1Yzsq6VDcoI1xBcXnyi9v4dCzOPMXYZz+HArlOVkEvU6Jg+cGS6kiLGHwlHr/c6vs2QdgQZArJsBDke8Gw+cCYw19GjsmPNKZTGOpkdPs/8r/Qq7aqj2N2l2mLODLL98QhgCP8T0R0oIxeOKMeLHI4ulag5oISkjZ0cnIbMgsvv84/jywf9A6COI/mGqaERBI0m7H4Nu3uFLyADmU362XRoI4Wb9gZAWlvBLE843zoHx04Ygi7E1Nu9DuYBsDG9I6u4CvHMUXdjN5c8YA== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1694d9ac-77fb-453a-655c-08dae702c8f9 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2022 05:33:57.6897 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0hDjVbsh+wAW+eYgXoplk4JlFymuE2V+Ps0WOqEVDWnCuxEn3tCbQYJaZrKps0e7xJ5Qb0n4glSEGQSdfadduA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7655 X-Proofpoint-GUID: aloiq3mGpFrjfnS71iFwdoBTcD7IMimd X-Proofpoint-ORIG-GUID: aloiq3mGpFrjfnS71iFwdoBTcD7IMimd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-26_02,2022-12-23_01,2022-06-22_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Author Het Gala hmp_migrate() accepts uri (backward compatibility) and a well-defined struct for migration parameters, and with help of migrate_channel_from_qdict() maps QDict's 'key':'value' pair required for migration stream into MigrateChannel struct. Suggested-by: Daniel P. Berrange Suggested-by: Manish Mishra Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/migration.c | 6 +-- monitor/hmp-cmds.c | 91 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 52b5d39244..1b6e62612a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2391,9 +2391,9 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc, return true; } -void qmp_migrate(const char *uri, bool has_blk, bool blk, - bool has_inc, bool inc, bool has_detach, bool detach, - bool has_resume, bool resume, Error **errp) +void qmp_migrate(const char *uri, MigrateChannel *channel, bool has_blk, + bool blk, bool has_inc, bool inc, bool has_detach, + bool detach, bool has_resume, bool resume, Error **errp) { Error *local_err = NULL; MigrationState *s = migrate_get_current(); diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index ed78a87ddd..e44d96f5dc 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -999,6 +999,91 @@ void hmp_announce_self(Monitor *mon, const QDict *qdict) qapi_free_AnnounceParameters(params); } +static void +migrate_channel_from_qdict(MigrateChannel **channel, + const QDict *qdict, Error **errp) +{ + Error *err = NULL; + const char *channeltype = qdict_get_try_str(qdict, "channeltype"); + const char *transport_str = qdict_get_try_str(qdict, "transport"); + const char *socketaddr_type = qdict_get_try_str(qdict, "type"); + const char *inet_host = qdict_get_try_str(qdict, "host"); + const char *inet_port = qdict_get_try_str(qdict, "port"); + const char *unix_path = qdict_get_try_str(qdict, "path"); + const char *vsock_cid = qdict_get_try_str(qdict, "cid"); + const char *vsock_port = qdict_get_try_str(qdict, "port"); + const char *fd_str = qdict_get_try_str(qdict, "str"); + const char *exec_str = qdict_get_try_str(qdict, "exec-str"); + const char *rdma_str = qdict_get_try_str(qdict, "rdma-str"); + MigrateChannel *val = g_new0(MigrateChannel, 1); + MigrateChannelType channel_type; + MigrateTransport transport; + MigrateAddress *addr = g_new0(MigrateAddress, 1); + SocketAddress *saddr = g_new(SocketAddress, 1); + SocketAddressType type; + + channel_type = qapi_enum_parse(&MigrateChannelType_lookup, + channeltype, -1, &err); + if (channel_type < 0) { + goto end; + } + + transport = qapi_enum_parse(&MigrateTransport_lookup, + transport_str, -1, &err); + if (transport < 0) { + goto end; + } + + type = qapi_enum_parse(&SocketAddressType_lookup, + socketaddr_type, -1, &err); + if (type < 0) { + goto end; + } + + addr->transport = transport; + switch (transport) { + case MIGRATE_TRANSPORT_SOCKET: + switch (type) { + case SOCKET_ADDRESS_TYPE_INET: + saddr->type = SOCKET_ADDRESS_TYPE_INET; + saddr->u.inet.host = (char *)inet_host; + saddr->u.inet.port = (char *)inet_port; + break; + case SOCKET_ADDRESS_TYPE_UNIX: + saddr->type = SOCKET_ADDRESS_TYPE_UNIX; + saddr->u.q_unix.path = (char *)unix_path; + break; + case SOCKET_ADDRESS_TYPE_VSOCK: + saddr->type = SOCKET_ADDRESS_TYPE_VSOCK; + saddr->u.vsock.cid = (char *)vsock_cid; + saddr->u.vsock.port = (char *)vsock_port; + break; + case SOCKET_ADDRESS_TYPE_FD: + saddr->type = SOCKET_ADDRESS_TYPE_FD; + saddr->u.fd.str = (char *)fd_str; + break; + default: + break; + } + addr->u.socket.socket_type = saddr; + break; + case MIGRATE_TRANSPORT_EXEC: + addr->u.exec.exec_str = (char *)exec_str; + break; + case MIGRATE_TRANSPORT_RDMA: + addr->u.rdma.rdma_str = (char *)rdma_str; + break; + default: + break; + } + + val->channeltype = channel_type; + val->addr = addr; + *channel = val; +end: + error_propagate(errp, err); +} + void hmp_migrate_cancel(Monitor *mon, const QDict *qdict) { qmp_migrate_cancel(NULL); @@ -1441,8 +1526,12 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) const char *uri = qdict_get_str(qdict, "uri"); Error *err = NULL; - qmp_migrate(uri, !!blk, blk, !!inc, inc, + MigrateChannel *channel = g_new0(MigrateChannel, 1); + migrate_channel_from_qdict(&channel, qdict, &err); + + qmp_migrate(uri, channel, !!blk, blk, !!inc, inc, false, false, true, resume, &err); + qapi_free_MigrateChannel(channel); if (hmp_handle_error(mon, err)) { return; } From patchwork Mon Dec 26 05:33:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13081631 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E4E3FC4332F for ; Mon, 26 Dec 2022 05:34:39 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9g7i-0003uz-S0; Mon, 26 Dec 2022 00:34:06 -0500 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 1p9g7h-0003ua-Ha for qemu-devel@nongnu.org; Mon, 26 Dec 2022 00:34:05 -0500 Received: from mx0a-002c1b01.pphosted.com ([148.163.151.68]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9g7f-0001A8-CJ for qemu-devel@nongnu.org; Mon, 26 Dec 2022 00:34:05 -0500 Received: from pps.filterd (m0127840.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BQ3Y3TV016008; Sun, 25 Dec 2022 21:34:01 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=proofpoint20171006; bh=Lvz2KwJfcS034ygl/SCVf8cOZQp7laAp1DBeMg85Rdw=; b=pyeqllEDQCMiSTP4qbNFmKQvI/FkNnN1PNKnE1SscuOG2S8eYXAjEba5LaR9VcfLgadG ACrw+hwFCekKmZhHtEPdd/BGKExBhFNQUWmxhxv8ajvafUvWTP6N/oZ8at25fIVNbGSg RPqglDlw6QlbLoYI+rrzuwnyk0Cmm4hvRqnjOO4Jq88HDG7UsOideSl9K/jvxE0MlJUf ekvo+N+bjd7iDyi3V6Y7APrZqQWq4Ck4Fv6oXVf7OCUXK2DIxPPSVpV4+bU6no465/jw CtCUbDj9RC2sTIyMwkUovwy6tb5++GofvECIs6Lr8W3G4y/xamw6kC67blAUwFC1dzKt mQ== Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2042.outbound.protection.outlook.com [104.47.73.42]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3mnxn0bjq0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 25 Dec 2022 21:34:01 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mE9uJgC4NNc8OwObyPIRTemT5HnfBVdmIhJlZgS9d/Lm9oSpQ4o0k6IlMm32uW/30BhYwfVhbX9RgsNv3qgnRiAn4CcGLwbkJgClkif712edkwco/R6vWLbYAstINi7jz3sbA7CwzzfqLtCDGWX2NEjXeFmqyp0tH5GaOseXYYgl8ksetPGRQbR9CQnNZXio3jn+WX3YO2GpzFv2VosYcEi6pFHat1rb50yw9u74hD+bgk+OhHfZPmoWoUgAlDgXgosUUZ+4zWxZtTfbVqEfmtJjiSzq5jfjNYQVW9IK7mO6QfIDcSVYR1sLwfBpd9GZDm4S8wzhROgKf1+8vkzXpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Lvz2KwJfcS034ygl/SCVf8cOZQp7laAp1DBeMg85Rdw=; b=jhSAWpsAkokl0VsKZkxkDLliMs/+fk8e3virsTMUZq5pC3OlSpPbzq+vsaakHbvJ6yxhTW3mGiwqFJiZfVrjNP/cjn3BNBpaaYmUjCYKumgP/jgsDklulRG06957dwZ3/YuD6nEtV3UBMrwxhKiF349pxJwPO0jUDeKehX+uKIy4zfk+nBkp/4XQjfsCd8XdsKp7GdK4UGBwhdSd8iDc9wBGDqKyz4Jh+MT5ekljqWAdBt+c8rVvQutJNVL45qw2gjh4hiV0VDD4PEPAY7EUKiDgg7FKmGOdK9V9u+dZ9MSrA+Wvy8p2CkH3O5yXoNUybBXiQnRqYW3XaTof6clV8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Lvz2KwJfcS034ygl/SCVf8cOZQp7laAp1DBeMg85Rdw=; b=S1ZmR4E35Ap4SUEwTcGTKpUmI8frKNnn/Qa8gSpQgfUhTTI/fPs9TubAQQG+eOSSipzoUUMF0o5zJU5TNX1JQtIIJmvrk6H5Jii6TdYNAWZMhFb94h+BU44HayQZhgcd8EeU9Eg+RC/IraoHKqbMLDH6k7JBPnTEIYnZQ1jK4yymeuzS2cc0LOt8vdeuCroSl4s8aMGhoTx+cMxI4RzmqLTiMjM+6oOja1e7HeT6R4N6iQsIyi09FvhQZg22Q80404qCpepvamfkFhVZX85qTZ9UwH3H+JbRB7MSIFS8aYtMMKgUTc2d8VD5GcRvf3oy7rjM7a/AcnNi+WHqO2MTCg== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by PH0PR02MB7655.namprd02.prod.outlook.com (2603:10b6:510:57::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Mon, 26 Dec 2022 05:34:00 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::6713:972f:95c7:a1f3]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::6713:972f:95c7:a1f3%6]) with mapi id 15.20.5944.016; Mon, 26 Dec 2022 05:34:00 +0000 From: Het Gala To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com, eblake@redhat.com, Author Het Gala , Manish Mishra , Aravind Retnakaran Subject: [PATCH 3/5] migration: Avoid multiple parsing of uri in migration code flow Date: Mon, 26 Dec 2022 05:33:27 +0000 Message-Id: <20221226053329.157905-4-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20221226053329.157905-1-het.gala@nutanix.com> References: <20221226053329.157905-1-het.gala@nutanix.com> X-ClientProxiedBy: BYAPR01CA0009.prod.exchangelabs.com (2603:10b6:a02:80::22) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|PH0PR02MB7655:EE_ X-MS-Office365-Filtering-Correlation-Id: b4acdadd-60e4-48ed-eb08-08dae702ca6a x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: czPUboKc23RJHH+jJn9eTXrBVGc6wrQui0C14yl6WfJW2tMCKE0qsb+JBax6C3slvxpPyCm+4nHWzqpIYURPxBIfO5057VmmWkCDr0oYJFV7XHUbJiqXJ3zHLNrSkJPWu9yWQJLUjj9WDcQprn/fzLr1WAfFZw4n+drjQiChGzzYi6yz1XCu9Vw6hlXerpwCVKH0vE1zjD/Y6GjGmOl/Mxck4RLTuCiWqyio/eJ62AEhrb3pp3Ypn9Hbo+SX7IajsYv+KBf1iWJhvMF2AWhHWpYhB+jjb3k+cjHP75TNvAbnrya3HHePA11bGZXKrIuOHSEoXvJErh6I+Q3ysxe5SdXIFwZua962hrricMLDfF2rT7vDDOTYm19Dpix1E6qO81oW6F4x4dUqvjVS1cVCiUPSdC7hltTvnn0+OSpQhUQYUJm9MajF7l8Ap789YMvf12zxl7DBHgnjhk56rTpSSNTR4Fe/BmnXZ4TvdZhX8TMONalitTWXs4Az+JXbwlaFvgP9Xa0R5bCJ6E1m95/fJ8kXdpTISPW9X0rlQEp2f2JAzXav62W/UZGYL+fEM3T/eiTNvIntFt65SuL93gt92sR9/RL9vTLUUW61vmh/bTwcWnHV1DiGFBN+3wJamgPMV/qJdyxiBAp+o5lCWcVzew3gAA3QE/XY4fN8OiEF7AkshKYkSegJBWyTW8O1p9Tb9XhBTk+E5g0v3r6HzeIdBQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(39850400004)(396003)(346002)(376002)(366004)(136003)(451199015)(36756003)(86362001)(26005)(6486002)(478600001)(52116002)(6512007)(186003)(107886003)(6666004)(6506007)(8676002)(66556008)(66476007)(5660300002)(66946007)(41300700001)(8936002)(2906002)(6916009)(316002)(44832011)(54906003)(4326008)(38100700002)(38350700002)(1076003)(2616005)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eMdjpXAvdh5o9TCIPB+UGlsacxgNNxd30TenzfeQ/UvW4aPgB+Rhjrlsehf1u/kP7ajDqXXXJiwl4C1hU5cd+ga1j09HR4DOdeVd752i41WzaWsnOjDmHQkEuStc/UHJZ4+dqevvk8WbrtiF/eScLus6rvH6pN8FT9jdxog3n6uH7oHE2nhUNhBT5+XAhCpF78JQCOf8x36QMTwPE47odpcYzArzQ3lfvdCTdXWmmntphAKXre3p+MNEGf0NiQvGuWcZs/X90R0pB/gbqUqNjHj+BTtJufYD9PpC1fGpK1qr7oSChqRdGv8Zx5Fn2IT4WFrfnV+y+XIwb+bXVYUQHgvB7rTRe8UFb0+QGsvX6He9A10t6Tt9h83bIaTIG7AmfGbODz2M92I2YLQHR1kiCV58ZwBWhOc2qJhhFHeIhONfnFN9E1pbGu60V8ypxttk0XFBELthCT8Xmy4nGhR6psWK4AZ799sZlnkVRcN5k0+yh/uHs54vcIS9Wn8KT9euoRSx/nnFnOXu/1RSz6WuHIvWgj29h8yguY1ldcWjy/Trp9yNpvFl8QvfpsTSqyF81hKSER97Um1/lkRCvGBwWaPStznaH1tXEEyW4Quy/xZtbeJY1Nm3yOmEVMVPzB/TFJqEswAMpX/o6uF3pFysjs45LjyrAJOuYJgrlv72KGUG/UGTgfAm4i2NmtBoHhRS8wPweaCmBOl+WeLyLy6w2vpcV+P8pYGAkDqL2Fo8KZAJCGVq1bvK/0XwzHfZ28SFOVPkGDS+K8tdXyxK4HFEpKMocgxR2LJ1i2WYSyOr6ZOXnCrdrUKkWOQ7MoYM9YZQd3qpdhkeiG0RSJAWt/+cQHqSavz7gQnMweXVVyt2F4Umm7M9QJ5ZKa8r/5SGneghI6YlsLYG7B1XFobvOXrj91wk2MJyrm3BmOC2m76ow9XViRcIDcVL1wE/nQFujaIcmj3bmP6aGtHE+q01SudpWYLaFdwvI2NTpKTFukPc7omYoK0USpkqJyGe7EG2A/AUxihSRXZ0p/EKyUyF76fXbCzXXqekQEUdhAhkxOT3eQC9VscyYtQIyrYemyBY5lEY0WA3l/qk6B9MWi+/ztstdtDjFbnPen8rYIrIpLg0XJqpLzKoF6sTSyUua17jDNXFmESO478Tg+APLpEBocLyH1DmzHDBKgYth8NUEAlF6a2rGRlzK6eprckzt14dpn+rVlajRjW7fqmrMqAizaM+FE4ApO3jyu9etLVABfoV2I9tSMU08PEHehOuhECpYmVUL7SuYc5DSeM82VsBukKoUAVqXmnWSB33eJfCoAKv1dSmSCO0LrxSdnoTxGNyQaic7gjkQwRA6TBJq6SpI7TDN5+vznBQ8vr5qMNnEhXzG7EZRK8sEYV/vyXWl2xT5lQDyISh/rTk0Hm3aRmLA1aQJD5eWXsFqvDvzpPhxzNrIVRKAbrHVppNFJ1hFX1TI9DWjOFElky1d8u/6DXTNn6gXrh0zQp5JYcp2SKdNoNH3/M/JzNgrC8bKfTTxuzS7+zVGd5a1V5ZZJOtmyoge8Qmnw/jc5qzjlln6oQrBAlyupdC9T4xwTNU52mmOiXr3K5wAvcN7VbNn7Orjrm/Kw5iLw== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4acdadd-60e4-48ed-eb08-08dae702ca6a X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2022 05:33:59.9864 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: P4JWIARV8DoQh2d4/Tf6cbr3eu7rxtVIxE9J+qR9zhLR3VKbyqQpBZ/PpfTD1mEQPx1z3gGAe1+FvenhWee/TA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7655 X-Proofpoint-GUID: oF2OazjQ90rSjezWzrzc1egJJWBFa7ke X-Proofpoint-ORIG-GUID: oF2OazjQ90rSjezWzrzc1egJJWBFa7ke X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-26_02,2022-12-23_01,2022-06-22_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Author Het Gala Existing uri is encoded at multiple levels to extract the relevant migration information. The modified QAPI design maps migration parameters into MigrateChannel struct before, thus avoiding double-level uri encoding. socket_outgoing_migration() has been depricated as It's only purpose was uri parsing. Renamed socket_outgoing_migration_internal() as socket_outgoing_migration(). qemu_uri_parsing() has been introduced to parse uri string (backward compatibility) and populate the MigrateChannel struct parameters. Note that the function will no longer be needed once the 'uri' parameter is depricated. Suggested-by: Daniel P. Berrange Suggested-by: Manish Mishra Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/migration.c | 78 +++++++++++++++++++++++++++++++++++-------- migration/socket.c | 15 +-------- migration/socket.h | 3 +- 3 files changed, 67 insertions(+), 29 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 1b6e62612a..36de9f6a6b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -61,6 +61,7 @@ #include "sysemu/cpus.h" #include "yank_functions.h" #include "sysemu/qtest.h" +#include "qemu/sockets.h" #define MAX_THROTTLE (128 << 20) /* Migration transfer speed throttling */ @@ -486,6 +487,39 @@ void migrate_add_address(SocketAddress *address) QAPI_CLONE(SocketAddress, address)); } +static void qemu_uri_parsing(const char *uri, + MigrateChannel **channel, + Error **errp) +{ + Error *local_err = NULL; + const char *p = NULL; + MigrateChannel *val = g_new0(MigrateChannel, 1); + MigrateAddress *addrs = g_new0(MigrateAddress, 1); + SocketAddress *saddr = g_new0(SocketAddress, 1); + + if (strstart(uri, "exec:", &p)) { + addrs->transport = MIGRATE_TRANSPORT_EXEC; + addrs->u.exec.exec_str = g_strdup(p + strlen("exec:")); + } else if (strstart(uri, "rdma:", NULL)) { + addrs->transport = MIGRATE_TRANSPORT_RDMA; + addrs->u.rdma.rdma_str = g_strdup(p + strlen("rdma:")); + } else if (strstart(uri, "tcp:", NULL) || + strstart(uri, "unix:", NULL) || + strstart(uri, "vsock:", NULL) || + strstart(uri, "fd:", NULL)) { + addrs->transport = MIGRATE_TRANSPORT_SOCKET; + saddr = socket_parse(uri, &local_err); + addrs->u.socket.socket_type = saddr; + } + val->channeltype = MIGRATE_CHANNEL_TYPE_MAIN; + val->addr = addrs; + *channel = val; + + if (local_err) { + error_propagate(errp, local_err); + } +} + static void qemu_start_incoming_migration(const char *uri, Error **errp) { const char *p = NULL; @@ -2397,7 +2431,8 @@ void qmp_migrate(const char *uri, MigrateChannel *channel, bool has_blk, { Error *local_err = NULL; MigrationState *s = migrate_get_current(); - const char *p = NULL; + MigrateAddress *addrs = g_new0(MigrateAddress, 1); + SocketAddress *saddr = g_new0(SocketAddress, 1); if (!migrate_prepare(s, has_blk && blk, has_inc && inc, has_resume && resume, errp)) { @@ -2411,20 +2446,35 @@ void qmp_migrate(const char *uri, MigrateChannel *channel, bool has_blk, } } + /* + * motive here is just to have checks and convert uri into + * socketaddress struct + */ + if (uri && channel) { + error_setg(errp, "uri and channels options should be" + "mutually exclusive"); + } else if (uri) { + qemu_uri_parsing(uri, &channel, &local_err); + } + migrate_protocol_allow_multi_channels(false); - if (strstart(uri, "tcp:", &p) || - strstart(uri, "unix:", NULL) || - strstart(uri, "vsock:", NULL)) { - migrate_protocol_allow_multi_channels(true); - socket_start_outgoing_migration(s, p ? p : uri, &local_err); -#ifdef CONFIG_RDMA - } else if (strstart(uri, "rdma:", &p)) { - rdma_start_outgoing_migration(s, p, &local_err); -#endif - } else if (strstart(uri, "exec:", &p)) { - exec_start_outgoing_migration(s, p, &local_err); - } else if (strstart(uri, "fd:", &p)) { - fd_start_outgoing_migration(s, p, &local_err); + addrs = channel->addr; + saddr = channel->addr->u.socket.socket_type; + if (addrs->transport == MIGRATE_TRANSPORT_SOCKET) { + if (saddr->type == SOCKET_ADDRESS_TYPE_INET || + saddr->type == SOCKET_ADDRESS_TYPE_UNIX || + saddr->type == SOCKET_ADDRESS_TYPE_VSOCK) { + migrate_protocol_allow_multi_channels(true); + socket_start_outgoing_migration(s, saddr, &local_err); + } else if (saddr->type == SOCKET_ADDRESS_TYPE_FD) { + fd_start_outgoing_migration(s, saddr->u.fd.str, &local_err); + } + #ifdef CONFIG_RDMA + } else if (addrs->transport == MIGRATE_TRANSPORT_RDMA) { + rdma_start_outgoing_migration(s, addrs->u.rdma.rdma_str, &local_err); + #endif + } else if (addrs->transport == MIGRATE_TRANSPORT_EXEC) { + exec_start_outgoing_migration(s, addrs->u.exec.exec_str, &local_err); } else { if (!(has_resume && resume)) { yank_unregister_instance(MIGRATION_YANK_INSTANCE); diff --git a/migration/socket.c b/migration/socket.c index e6fdf3c5e1..ecf98b7e6b 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -107,8 +107,7 @@ out: object_unref(OBJECT(sioc)); } -static void -socket_start_outgoing_migration_internal(MigrationState *s, +void socket_start_outgoing_migration(MigrationState *s, SocketAddress *saddr, Error **errp) { @@ -134,18 +133,6 @@ socket_start_outgoing_migration_internal(MigrationState *s, NULL); } -void socket_start_outgoing_migration(MigrationState *s, - const char *str, - Error **errp) -{ - Error *err = NULL; - SocketAddress *saddr = socket_parse(str, &err); - if (!err) { - socket_start_outgoing_migration_internal(s, saddr, &err); - } - error_propagate(errp, err); -} - static void socket_accept_incoming_migration(QIONetListener *listener, QIOChannelSocket *cioc, gpointer opaque) diff --git a/migration/socket.h b/migration/socket.h index dc54df4e6c..95c9c166ec 100644 --- a/migration/socket.h +++ b/migration/socket.h @@ -19,6 +19,7 @@ #include "io/channel.h" #include "io/task.h" +#include "io/channel-socket.h" void socket_send_channel_create(QIOTaskFunc f, void *data); QIOChannel *socket_send_channel_create_sync(Error **errp); @@ -26,6 +27,6 @@ int socket_send_channel_destroy(QIOChannel *send); void socket_start_incoming_migration(const char *str, Error **errp); -void socket_start_outgoing_migration(MigrationState *s, const char *str, +void socket_start_outgoing_migration(MigrationState *s, SocketAddress *saddr, Error **errp); #endif From patchwork Mon Dec 26 05:33:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13081630 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A7CE9C4332F for ; Mon, 26 Dec 2022 05:34:36 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9g7k-0003vr-HA; Mon, 26 Dec 2022 00:34:08 -0500 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 1p9g7j-0003vD-78 for qemu-devel@nongnu.org; Mon, 26 Dec 2022 00:34:07 -0500 Received: from mx0a-002c1b01.pphosted.com ([148.163.151.68]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9g7h-0001AD-8y for qemu-devel@nongnu.org; Mon, 26 Dec 2022 00:34:06 -0500 Received: from pps.filterd (m0127837.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BPNR4tA013796; Sun, 25 Dec 2022 21:34:03 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=proofpoint20171006; bh=0jRv6wzpfsybjN4oJ2uto6f4enBJ2KFpjeXYBHdIUN8=; b=TVRYwg3eYf3wSfEzsZctLrOCoo9tzoWGYNJvkfgrJpDOWvVfiX2QDerIy4vEL6UFjUmS dJDXokrdaCIPhTOWl/8Pg9WsRGfN3Ag3V9/KuKFHLQlsexIG+diD1d6Ni5m5EdtSCCtU FmiMEsGlmUAbrlenNAgxHw+XJFmC6hQg/6Py5ryTPgmAn7vtRRniI7vhjKphSYxuC7iA 0rTDB5USMsz4xuaGd6DzbQBMTlogbdkw8stcJjiexKnAw7YjhFRHKNDvbTK7DRyjFVzA BwKOcG/wq7sPUC7ZkDo69rPaJWpN4aJjcnl5MTCJY51EuLlPevMQ/RNoAv9jFPy+UBcz gg== Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2047.outbound.protection.outlook.com [104.47.73.47]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3mnx7dukw7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 25 Dec 2022 21:34:03 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kvevb+7hek79/sPBhQxdC/fTpUQjglkgRAfhMPKIR1viggAs/YDe+XGyUfWvGaCyOuFLwh3h0VzNl2Rlm/5CPO9GZRgiYmE7J6Q+2w/lmtRS4pC01WEQzNHy8myrUZvbNag5ZRmwbARrboVgQ2VW1PzvuTjrvjfZNIryr98P4iBvKeCLjEpm76yc+zzIjNZsyxxPTxeJCBpgwkdoT9FAAKHIGvoY3fUURHN3LpmCaLmlyyJ+Q+oyjGphIdm30xT0xGwPjS0joDvrUz5QhytC2tn7QO7OwSRXzlY9cWWOvM87ZLhRLJrUj2kTOHzfrej5dDkAi193SlZfbibZ7lCU8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0jRv6wzpfsybjN4oJ2uto6f4enBJ2KFpjeXYBHdIUN8=; b=DbmGSGPTokIafwBnekMnUevjw3/rxtAwm05zY9UN4jERtRB8jWWU/2eo8UtMUaRiKiVa1QED7ZJLiQUUd3DeWAvfXTp6Kngx/BDSjovKFjPJEb9ArDLtAiK5P6qtGL6QhFrD8/8YHpATwm/AY5fBhKtGjwNYEB5HvajG0+Uh924zxSxUK2R8/+u3XL3PldY3TBXYPknypeW5IwIatt9VbfW7Niqs1EHASxohcQjaeuWdvOVRY/apK73l95zRvY/Ko1UqpVs7pZdnOc8WU6dgtJRg2v5Jo2hlSq2QdogjGMk5La7imyef+DnNobz9PF5qBY1DCRbjpnzLTo3ZNa8iDA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0jRv6wzpfsybjN4oJ2uto6f4enBJ2KFpjeXYBHdIUN8=; b=qV2c1loLAVNmjC0eN2xEgHXn+IBAYatpqHZfhWn8rQkQFvLyqwFULI/Z84yHd130qgr0q5mHzxKe39gd4AXg8xvYw7Q+IYd/cdKccIOdaD8q4Noy6ykiHmwHerX+0sBlvNzq8q9i551o97YUcjCJvELJouus8OSmE3evSG/UcnQSaw/1XvK26x46r7EYHKKVOkTLuX7UaIc8GYECI2u0BTdQpNshTarVyK3qd18XKwhf2jy6WkwJL7DbmlU+KYXH9b7dcX3iJHTS5yM4iQtjXA12ITneSGj3npDgjbqgpfI/2opp9lPlSRe+1LAWvHtw9EEVml43vSGcuIlAJlIPeA== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by PH0PR02MB7655.namprd02.prod.outlook.com (2603:10b6:510:57::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Mon, 26 Dec 2022 05:34:02 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::6713:972f:95c7:a1f3]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::6713:972f:95c7:a1f3%6]) with mapi id 15.20.5944.016; Mon, 26 Dec 2022 05:34:02 +0000 From: Het Gala To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com, eblake@redhat.com, Author Het Gala , Manish Mishra , Aravind Retnakaran Subject: [PATCH 4/5] migration: Modified 'migrate-incoming' QAPI and HMP side changes on the destination interface. Date: Mon, 26 Dec 2022 05:33:28 +0000 Message-Id: <20221226053329.157905-5-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20221226053329.157905-1-het.gala@nutanix.com> References: <20221226053329.157905-1-het.gala@nutanix.com> X-ClientProxiedBy: BYAPR01CA0009.prod.exchangelabs.com (2603:10b6:a02:80::22) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|PH0PR02MB7655:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b4696e4-f43e-481e-74b6-08dae702cb9e x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Mn8QRAAVF5GZ/0yD7RhMyF5NQLRUX+ImjnknKDELPwKWg4sM+QC8sdbNCcbjyBGkE6uFSx31d1mqvX63YFOhFCx8HwIoL+jLyy/3EbdRBoVqzN0OnjNDTzPgKvxi0OWdcOPXImVXYxlFmgwEcrlb3DuIg3J5AOyDjVuG+YOAdad29n6X7WjZBeceuCaXeI2czFG7HtTkxeQLBLCy4zshqNXHw5kQm7EExDPNe5pJqGud3A4ta6/fsXX9+w1z/rx6y+2thVxmrDgW+wuPqs+Qytw2tPr30zCts6OifM4NWi3mcMdx3ugCJ/gPN8WRYtNbgYV0RS/LIli2a8kmmtq7vJxqBLmkilqPgd8DK1KAUdF9pITOqaEB8podJo5rPCEkJQFhwVOdBerRqzqc3AofsL7Rww4loC90UpjVXrzYED0yialtVagjvfbfRn0VUgLZDZVYGDAc+Nxv7zY4ZShwdXocb5rd4akiOZqNeh1d8rL+28ztxCE69MZp3WkQm/OhAcuT/vq3EdX90IFu0W3p6XSsheNrMlMLPrE1EBu+FnaYpInwil5o+AqcCl+bPSSP6t0/GkjtVEywxcWM9g7RRBqfhRCq+NaBzU07B+DUqLHq/aeIeR3TIyINBCNEmja1qy2tV0ctoLfJB8H0yLuvumFG8m3es8iuc/KlIvDro27QzZKdssJsSQ9IPrCC0lmhKB/s3SqpMLIs6XdsxZ1xxQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(39850400004)(396003)(346002)(376002)(366004)(136003)(451199015)(36756003)(86362001)(26005)(6486002)(478600001)(52116002)(6512007)(186003)(107886003)(6666004)(6506007)(8676002)(66556008)(66476007)(5660300002)(66946007)(41300700001)(8936002)(2906002)(6916009)(316002)(44832011)(54906003)(4326008)(38100700002)(38350700002)(1076003)(2616005)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dPYZAbK/sep7j7zP+UZkXgzrUPAdqL7dgnq7PTYmN3poN/6KJQ8PtMsj5CatRxlQ+xnZbO68lV9xPnJF2rJ/bCm5CJOc9oqtkrCtWaXxeTbZy7wDV/wf383QGsMH/AHkc+jteOkzijmd+Gvehk/85FEm138wXZDiL2fKrKARJIXHqNoqPsOHkQdXsm1DcmySKi+vmunu3byc3OUuyN3k5nE5rpklKs6j3dKgSJvblSnB7cjJutlYXeLtncPwJyVkAjFMD/LZ8p9s0OKpHuHMTffFFzTdYiCwxgKrxU/+D6Btj+qQu4Ne7XI6PU87Jn5mTCPRgYUFwj6vsc4X5v1n3oPbb4zc2B5GaOIxP3uilfgu3GRX3KKqDzujvqKW+kDvd1s/g/uZaL0bQVjc3TdiWx+K2gan7+Zi3l4n354oJ18MsFvnMXT/Xumop5pYcLgXuZKctmKeFq91quJ8p0S7oH90OecMvgcjpWtLnqkcfiOLhFqNCnAnZHiIdS0k0lSYbXZLS+OEb0I7sAEVd7ZWfWKxGjbUEIDi3geNjaCQvHzcX83GdRQmM+k0O6eiHd9K9R7Rd+Dykrqf/IiIwj0AnP0gOXHJuBe28vMYfdfrVR4vy4W3CSRLTVI3bNonpR7ZcDKIfuYedDN/yEc3hO8DWRch5gNqn3Nr3d/KD0+224A8JKrmXaBfgB6wcrAehVOXrfNe6BVljUOudZbbYr+L5tSzRDp9M3XzUeoUqPyvidpFaSZ+XVagUFyf4CaEkzhRAlGjFOjD8FgWdSdPvqgNGcOAh28jUI87qILmdSfJ/TXzAuTJl+5PRhCinf7IIgvDLf8Ad8qKdC1wzSvWZmzKamTnaKzXGZJt1F1Zz8SPOXI/FEACE1X4p/xR+FmZvSQibAzb+Au9zGGN9MJ/+4iTK/tpCHDtq2i4WQcrD8TGY0p+dsue7mdxPlY7c3KoNJj/btPHXeluQ08J0UuB8g3FI67ddgCEDh+kCUb+thqmjdCIQnWTJsab6N7uJJsoF8BBm6J8TgFGA552pu1m7kVcuRqVDG8URJJTdQBlZND9h3RTayd+yQJPRmR6NSitJdlerr6ImWaOqXNA/kA3F4FcNDOA6VQsbj9sB1ZLJZwrFbG7G6Mpgwuvv/VgHeIbOv4XSNDLIeItlmWSVDomu7UcOb9mcHpt6mckNQVrzAXlVGMynC6zfndbYZHsCgmaoRgrAcDj0sJDOZLzc4XrYcDmnmfpdyrad6PutFjtsPkFO04q4aHlANY1XF23Z7CDK3JQDXN5zgVwiPgcllRMduZgmpQz1xnKGZDUxDEsXXfYE/4qYuCXDcOqEHlU+1iygxMh5W6/ISS2btDRfUUN8OVv90M700STgs1BOjj2vp6zNo9gywJF9VB5fhsfvSoyZfIJBo35kMcPwIoM/T0hENR9eU47adnpWKALy34YivjwDIj53Li9BKJ4txqnfwNZ5QinCkX3W4VMUAa1OH8VRurwDUDHQ98BzityyINQ50jmOkOj7/+JcGbwcYIqUeyFD1bBd5SK6stbYifayS/GAEdP6uW8sjj9YaQSgdjYdmrQkqKd5XjSTjUT6pwaZvPlasA0EzuWm0EMc9wNDLUBJyCi3w== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b4696e4-f43e-481e-74b6-08dae702cb9e X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2022 05:34:02.1112 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WQ+RmrbwqsGyqDvBw75mGE3+AqpTS59NiRDomuptrFs7MGeBo69ycc+/1l4zT0RypynEpgd10UW/06kCXustPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7655 X-Proofpoint-GUID: PeKqakHxsggHhUrTaZ8OhmOBNPoRNpXI X-Proofpoint-ORIG-GUID: PeKqakHxsggHhUrTaZ8OhmOBNPoRNpXI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-26_02,2022-12-23_01,2022-06-22_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Author Het Gala 'migrate-incoming' QAPI design have been modified into a well-defined struct 'MigrateChannel'. Similarly like the source side, modified design was introduced on destination side mainly to prevent multiple-level encoding of uri string. The struct contains various fields for type of migration channel, type of transport backends and various associated migration parameters with each backends. Please note that the 'uri' parameter is kept for backward compatibility. HMP side changes similar to source interface , on dest interface uses migrate_channel_from_qdict() to redirect migration parameters from QDict into 'MigrateChannel' struct. Suggested-by: Daniel P. Berrange Suggested-by: Manish Mishra Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/migration.c | 3 ++- monitor/hmp-cmds.c | 10 ++++++++-- qapi/migration.json | 22 ++++++++++++++++++++-- softmmu/vl.c | 2 +- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 36de9f6a6b..838940fd55 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2237,7 +2237,8 @@ void migrate_del_blocker(Error *reason) migration_blockers = g_slist_remove(migration_blockers, reason); } -void qmp_migrate_incoming(const char *uri, Error **errp) +void qmp_migrate_incoming(const char *uri, MigrateChannel *channel, + Error **errp) { Error *local_err = NULL; static bool once = true; diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index e44d96f5dc..7f45624c41 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -1106,9 +1106,15 @@ void hmp_migrate_incoming(Monitor *mon, const QDict *qdict) { Error *err = NULL; const char *uri = qdict_get_str(qdict, "uri"); + MigrateChannel *channel = g_new0(MigrateChannel, 1); + migrate_channel_from_qdict(&channel, qdict, &err); + if (err) { + error_setg(&err, "error in retrieving channel from qdict"); + return; + } - qmp_migrate_incoming(uri, &err); - + qmp_migrate_incoming(uri, channel, &err); + qapi_free_MigrateChannel(channel); hmp_handle_error(mon, err); } diff --git a/qapi/migration.json b/qapi/migration.json index 753e187ce2..201b085715 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1613,7 +1613,11 @@ # with -incoming defer # # @uri: The Uniform Resource Identifier identifying the source or -# address to listen on +# the address to listen on +# +# @channel: Struct containing migration channel type, along with +# all the details of the destination interface required +# for the address to listen on for migration stream. # # Returns: nothing on success # @@ -1630,14 +1634,28 @@ # # 3. The uri format is the same as for -incoming # +# 4. The 'uri' and 'channel' arguments are mutually exclusive but, atleast +# one of the two arguments should be present. +# # Example: # # -> { "execute": "migrate-incoming", # "arguments": { "uri": "tcp::4446" } } # <- { "return": {} } # +# -> { "execute": "migrate", +# "arguments": { +# "channels": { 'channeltype': 'main', +# 'addr': { 'transport': 'socket', +# 'socket-type': {'type': 'inet', +# 'host': '10.12.34.9', +# 'port': '1050' } } } } } +# <- { "return": {} } +# ## -{ 'command': 'migrate-incoming', 'data': {'uri': 'str' } } +{ 'command': 'migrate-incoming', + 'data': {'*uri': 'str', + '*channel': 'MigrateChannel'} } ## # @xen-save-devices-state: diff --git a/softmmu/vl.c b/softmmu/vl.c index 798e1dc933..7005be978a 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2614,7 +2614,7 @@ void qmp_x_exit_preconfig(Error **errp) if (incoming) { Error *local_err = NULL; if (strcmp(incoming, "defer") != 0) { - qmp_migrate_incoming(incoming, &local_err); + qmp_migrate_incoming(incoming, NULL, &local_err); if (local_err) { error_reportf_err(local_err, "-incoming %s: ", incoming); exit(1); From patchwork Mon Dec 26 05:33:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13081633 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8E2A3C4332F for ; Mon, 26 Dec 2022 05:35:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9g7n-0003wH-Bc; Mon, 26 Dec 2022 00:34:11 -0500 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 1p9g7l-0003vv-FO for qemu-devel@nongnu.org; Mon, 26 Dec 2022 00:34:09 -0500 Received: from mx0a-002c1b01.pphosted.com ([148.163.151.68]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9g7j-0001AS-AT for qemu-devel@nongnu.org; Mon, 26 Dec 2022 00:34:09 -0500 Received: from pps.filterd (m0127839.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BPImvYt013223; Sun, 25 Dec 2022 21:34:05 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=proofpoint20171006; bh=sptYFKhHmB5as2mzr5juLcCnIJK9/aLv7spbz6tV11Q=; b=yh1tC1PRhtn/nzFeeZfj0N2hIkLkpFsoV9pGAzAK/GyjqJz9YwjtqHF389nvqteep+5r B0P3XgY00YAnsIbKC8QUAt0q7MzpYLYo6M5Q8LqkyAZ/9HHTUNewkVSk+U96EVMRY1nN X8FywLcYdBEMgYNodk0LqB1xHyFzsR2LScfoF31p4thqc8BmXH4h5kMX6ivx1kvTbypS /Y1xkIrPh2qyUVL0uoIVa/VThR2YHUJ7DTZHPZZRhGy1kymsAbPxXovvzjQzzmu8tzlD gdhYw/6Gr1iy+fVAWsFz7i6GgttjarB1KW2ydlVHH6/mLTgt3F712ONWikiXbtpcXptI sQ== Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2046.outbound.protection.outlook.com [104.47.73.46]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3mp1cnuc0n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 25 Dec 2022 21:34:05 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ce9K4cindqvdXQDjN4ZDR0Wl5JkSZdlfA4JcT62Z/BgNftMOlwG2a1TkJS5yYpvkiEqhwPYWQhu1Xg699VFaH5Um3t5dFM/Hc+8bkXrI6wSnBYb9JA6vqyTWJrGxC5Ogsi+MMKTh47BqtB3NTemds08fpSeH24MqBzZUAmRXFnROqNrRtzI9Q5GfQV9s5+cbqK3BuZTVmY/6iVHVzb54Ilspb0WQKE+szL4uGjq2SvIJFlFC3DPrymoRJzQMfzxj80NXYDOGq4oii7xF6L0trZwdSnLYcQpukflAhhEgCS8gJ0rtK7nXD/RSHyf/pYU29iM9GPhGdMdXqcReNQ4bTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sptYFKhHmB5as2mzr5juLcCnIJK9/aLv7spbz6tV11Q=; b=g6SGP4gcKnjs1PnS2TrJRzRbJcEWISBpx4BLEGxn54QxoxkBfTu5f1G0wA7SmoPkjyX61v6ZGcwbGtmdviYkZOmzP1kIERkdU33Vm86JCgB91BcRMu3qgVZnXurXcPCmnfME2RQjMtpPAuNBHF5nr6LjfMftO7AD1A/OU62Epu6ifvRp58mU8KR07CroOyywMI7lBXv92opgVNC3WYTXmkd+FYN2y6cno649ObFqNY8FZp8OIY0Og0NiK29308TLZ51vKQtJs6p+cKdXTPeA7rxuMcPqnXHg57iGhLVWi013m33P3hBU7s6w4AwGd06iXMWLlOt/Jikd4rnqeuYX1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sptYFKhHmB5as2mzr5juLcCnIJK9/aLv7spbz6tV11Q=; b=BgEjD8XmIW+49wB3+eEbwCdAVbNJje/bkqpKD6JGmqJwwQdw2g56z+yh7vUPjCjxPbyeZOXQSB/efr3MyFyuAb5oOeqlcJyQ8SUQywnVr0HOxVIBzaNI01M7BAgq5lgg9QauLOjWJsjcR5ca7z00F9PCYYa0y7bhX9yxnxD6a1LvqwVw7G4TzZBEgJaHxcS0tsSXvkQXhc5N8HSxCTCEqu838UdnPA6PQ40ZNPCkPVEl8NnuKQfSyvzccm58DtD/g3ytHMmEH7u50Y6ZJBV5/HEGE6xrN+WLTAee0ppn5AglpLqsUim9AFHBE5D/zSyCJ0F3uEzR99+YnADefyqIHw== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by PH0PR02MB7655.namprd02.prod.outlook.com (2603:10b6:510:57::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Mon, 26 Dec 2022 05:34:04 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::6713:972f:95c7:a1f3]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::6713:972f:95c7:a1f3%6]) with mapi id 15.20.5944.016; Mon, 26 Dec 2022 05:34:04 +0000 From: Het Gala To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com, eblake@redhat.com, Author Het Gala , Manish Mishra , Aravind Retnakaran Subject: [PATCH 5/5] migration: Established connection for listener sockets on the dest interface Date: Mon, 26 Dec 2022 05:33:29 +0000 Message-Id: <20221226053329.157905-6-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20221226053329.157905-1-het.gala@nutanix.com> References: <20221226053329.157905-1-het.gala@nutanix.com> X-ClientProxiedBy: BYAPR01CA0009.prod.exchangelabs.com (2603:10b6:a02:80::22) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|PH0PR02MB7655:EE_ X-MS-Office365-Filtering-Correlation-Id: c19089a2-b6af-4781-b088-08dae702ccc3 x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C4gbYe69xj5heLCbKFR9o1IYuH0pPMy8h5wd4ChUQVdcZDzRaqlAlTArXlaJDTG84XSNiuavw1ARR54n/GOhrotI8qAViL8gtsqQiDX3amEWYfK8zeWrH9tolAonz4FWo/RxIlzh+3fQYFxDwes2+G+upPbBom3siUozql+WFqZ9hnxsnZAg2D01FibVnVlx2oJ9Y2AVYRQL0bPC3DjlSgnPR5o+BveVJJSiHdcHjSr4wOi6UKizb3AA1ah4hGQgf5i2Uwy6bc+Q7f+wyVhClRkgn6/4O4KiVuX7kRLwhBHsHLA6i6Dl9SoR45Xiszf3ahKPd3I1k3ofPBlH/9lMNT7cDIJLIa7V7zt2eJ3wHae61gOLaX3/oUeyjHY8Q2ndluQFrtU8G6FEsO6OBd4AxL/s7Es/0ho1Ej2VqVMJ+UN2qlqbgXsvr4xQdnF6Qt453a97SVDyjO5kYl9uXxt0jIGBPJ6wM2Hz12QPeJP7msm30xkwb5sOW4P8ydOZpzmZ71QITtxaDTob7NGmQSh3dwQJPOv88vhC0SCuXdaNNn0s6bIxqN/EZSjJ3oPjYqmeq53yZ5srzN2j1qqKIFrzbvo+aVF5zf/UBBjMxSZOvKeooi8qy0UG1CpO8GBbzTullP/8Ee1c8MRBTYg2rdsniTuk3vSmadVtAdvx0gv5Tq1zoLmV5QgsfYr17KsHHx3F X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(39850400004)(396003)(346002)(376002)(366004)(136003)(451199015)(36756003)(86362001)(26005)(6486002)(478600001)(52116002)(6512007)(186003)(107886003)(6666004)(6506007)(8676002)(66556008)(66476007)(5660300002)(66946007)(41300700001)(8936002)(2906002)(6916009)(316002)(44832011)(54906003)(4326008)(38100700002)(38350700002)(1076003)(2616005)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: K7tPWzLJFN44ylumIb2wXXa93418xer1Qr6lvFqC0XQIGcvy0MYoO94Krpd5sRcICNnNMNYYNCiS18dWwvBj990/qZqcLzaR8PCZDiFYIeVJaNfUpMAcxV5S3rt5uLU/L1J6GliMZcke3kgn07fXbKKSxPLQ+if4BftFlDfONO4Aoi9BnMYfPOzdk2o9hloCPUJnAgZcS5+9uH+W/7SFd2LqdOS8WIlQ2LuFSO1B7RUXx/DRSQZOkaaCw670G8mnP7XDSLcqqoHsaln708t4BQ5uTS+x4U+A9XYHvIDfeSz834GKUA9DAvGtv4zGSxSus2SbEONlZsOIePzen/Z7zRBAtY8ZbyuwjEPfrpsJdLKNUcMb4RUxoksGgm+3t2w2cDUVBAMIMt8hgMqDeG/Azexf8Fb3pk5VyAQVD6g+wzbJYYTAFjYQC4lYtgghqyR/XdoGHiqPYp8xtE60rulfMlyXu6fScJ+6ciqtMlIN5RRPPKq/E8T9b8nku0SuekeJfuUcKuNfyJIB5HXQDyzZ8IvQ45xBHoP0NkGvKR0/JuN0FE4+0jaWlLK7vi+r2eHI5TwAIHpI/RVhTqGxeYg7YetYg0Yh8IPsvPhlubbL/PcvS3tNT8DxzYKQGjBNHJ2V08aPYmp99DOg+diqnaagP/V7KGBK9gJpB+/po51izuVihCwRPh7qjawsmpAWv2rryXWbyySdPk91SLHXKTg8v2/8Fm9TNQi0wIoXpNJd1c5nJRbi7ZJKBVk5w5oA8ozd5A9hOGZ3NQKpyOpimJCDBDGQMWq1rAT5xmC0KNJ6+vCkGVvJOZMD1k6kox+fwLeRLpAR+jAETCbSjtNcKLp/XyP/d7x3KIYLsxQuvkEN6XxTocSefCRCjKq+93FRIW2W6FOChSL5v8M9gpHrsYCGjUT6OWfP4aBiXsPL4I9gFnfHEamI/IQHvzX2bDbk3VeYI7QHOyyQYZR/yvOUEaZFhPBPCRrmt5DZjXLEXDzYRROuElEvJzKeQcNSBJlVL0Q4FN9z+FgbGbgCqZaUbSNtwO++q6RDvUioH6Q1eSczBRM+4/6Vi3fWra4jjROD142AWguAWBRjqTwMUXoYvKWzfOSrh9ird6FtoC/zqhVvLm+oRGmXxD0UXMcB2YHArWEBebDYGR0pZbaboK1qSImm4CrD00ZHTpxoBcpnyi/DNK+qtIfeblAb5nQT4+N/O2i5xXXUE9giQ9l+nAP7pYJmxIGC1FqXf1BwJybwxc/OQl5PJc9BetEcxyZEuPLI2s2AAUtt0ApOyfubUmmOvm61zSL7BNWpKYmlNxFSGw1DR1zwOJ44FNiF5304b6TpCgJb7dnHsTYkRcwPBX5WwimP/qyvrHTb7cZKT/DmJsf5w5KMTd//TC3E/iiThbncBPRRlB+wJ5Lwu5EeLaooaqcual+QtvW4GD8wJcKbrn5xjyrWpnX9JVVTtLmXe/fY1LkXvxbA4p7iBpx1x6fdeoiY6aw/O8ocOvU0aM5hoxKAKUCPRMoFE3oKjPVU+fOGxUpRiGQyiXTbhhMbnMS7joY1m8fizUMyQK1iJ0nbq9FR5tYyfTnIVCOvtmxQg18XXBpDDm37gehk/vfXl1X22PF3hw== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: c19089a2-b6af-4781-b088-08dae702ccc3 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2022 05:34:03.9548 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6GhoFV0TWm5Te8Sm/G1J3UX2IMIfXmutvi4vTkgg+OMgSmW5UH2TmYowPPoXCdeCwT0NqQXDqXAnUSUaaTrNng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7655 X-Proofpoint-GUID: kMHo1HxO0L1GX5jZ5Q_72rZ0xDAa3hK9 X-Proofpoint-ORIG-GUID: kMHo1HxO0L1GX5jZ5Q_72rZ0xDAa3hK9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-26_02,2022-12-23_01,2022-06-22_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Author Het Gala Modified 'migrate-incoming' QAPI supports MigrateChannel parameters to prevent multi-level encodings of uri on the destination side. socket_start_incoming_migration() has been depricated as it's only purpose was uri parsing. Renamed socket_outgoing_migration_internal() as socket_start_incoming_migration(). qemu_uri_parsing() is used to populate the new struct from 'uri' string needed for migration connection. The function will no longer be used once the 'uri' parameter is depricated, as the parameters will already be mapped into new struct. Suggested-by: Daniel P. Berrange Suggested-by: Manish Mishra Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/migration.c | 48 ++++++++++++++++++++++++++++--------------- migration/socket.c | 16 ++------------- migration/socket.h | 2 +- 3 files changed, 35 insertions(+), 31 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 838940fd55..c70fd0ab4f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -520,27 +520,43 @@ static void qemu_uri_parsing(const char *uri, } } -static void qemu_start_incoming_migration(const char *uri, Error **errp) +static void qemu_start_incoming_migration(const char *uri, + MigrateChannel *channel, + Error **errp) { - const char *p = NULL; + MigrateAddress *addrs = g_new0(MigrateAddress, 1); + SocketAddress *saddr = g_new0(SocketAddress, 1); + + /* + * motive here is just to have checks and convert uri into + * socketaddress struct + */ + if (uri && channel) { + error_setg(errp, "uri and channels options should be used " + "mutually exclusive"); + } else if (uri) { + qemu_uri_parsing(uri, &channel, errp); + } migrate_protocol_allow_multi_channels(false); /* reset it anyway */ qapi_event_send_migration(MIGRATION_STATUS_SETUP); - if (strstart(uri, "tcp:", &p) || - strstart(uri, "unix:", NULL) || - strstart(uri, "vsock:", NULL)) { - migrate_protocol_allow_multi_channels(true); - socket_start_incoming_migration(p ? p : uri, errp); + if (addrs->transport == MIGRATE_TRANSPORT_SOCKET) { + if (saddr->type == SOCKET_ADDRESS_TYPE_INET || + saddr->type == SOCKET_ADDRESS_TYPE_UNIX || + saddr->type == SOCKET_ADDRESS_TYPE_VSOCK) { + migrate_protocol_allow_multi_channels(true); + socket_start_incoming_migration(saddr, errp); + } else if (saddr->type == SOCKET_ADDRESS_TYPE_FD) { + fd_start_incoming_migration(saddr->u.fd.str, errp); + } #ifdef CONFIG_RDMA - } else if (strstart(uri, "rdma:", &p)) { - rdma_start_incoming_migration(p, errp); + } else if (addrs->transport == MIGRATE_TRANSPORT_RDMA) { + rdma_start_incomng_migration(addrs->u.rdma.rdma_str, errp); #endif - } else if (strstart(uri, "exec:", &p)) { - exec_start_incoming_migration(p, errp); - } else if (strstart(uri, "fd:", &p)) { - fd_start_incoming_migration(p, errp); + } else if (addrs->transport == MIGRATE_TRANSPORT_EXEC) { + exec_start_incoming_migration(addrs->u.exec.exec_str, errp); } else { - error_setg(errp, "unknown migration protocol: %s", uri); + error_setg(errp, "unknown migration protocol: %i", addrs->transport); } } @@ -2256,7 +2272,7 @@ void qmp_migrate_incoming(const char *uri, MigrateChannel *channel, return; } - qemu_start_incoming_migration(uri, &local_err); + qemu_start_incoming_migration(uri, channel, &local_err); if (local_err) { yank_unregister_instance(MIGRATION_YANK_INSTANCE); @@ -2292,7 +2308,7 @@ void qmp_migrate_recover(const char *uri, Error **errp) * only re-setup the migration stream and poke existing migration * to continue using that newly established channel. */ - qemu_start_incoming_migration(uri, errp); + qemu_start_incoming_migration(uri, NULL, errp); } void qmp_migrate_pause(Error **errp) diff --git a/migration/socket.c b/migration/socket.c index ecf98b7e6b..3558821298 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -158,9 +158,8 @@ socket_incoming_migration_end(void *opaque) object_unref(OBJECT(listener)); } -static void -socket_start_incoming_migration_internal(SocketAddress *saddr, - Error **errp) +void socket_start_incoming_migration(SocketAddress *saddr, + Error **errp) { QIONetListener *listener = qio_net_listener_new(); MigrationIncomingState *mis = migration_incoming_get_current(); @@ -198,14 +197,3 @@ socket_start_incoming_migration_internal(SocketAddress *saddr, qapi_free_SocketAddress(address); } } - -void socket_start_incoming_migration(const char *str, Error **errp) -{ - Error *err = NULL; - SocketAddress *saddr = socket_parse(str, &err); - if (!err) { - socket_start_incoming_migration_internal(saddr, &err); - } - qapi_free_SocketAddress(saddr); - error_propagate(errp, err); -} diff --git a/migration/socket.h b/migration/socket.h index 95c9c166ec..4769a2bdf9 100644 --- a/migration/socket.h +++ b/migration/socket.h @@ -25,7 +25,7 @@ void socket_send_channel_create(QIOTaskFunc f, void *data); QIOChannel *socket_send_channel_create_sync(Error **errp); int socket_send_channel_destroy(QIOChannel *send); -void socket_start_incoming_migration(const char *str, Error **errp); +void socket_start_incoming_migration(SocketAddress *saddr, Error **errp); void socket_start_outgoing_migration(MigrationState *s, SocketAddress *saddr, Error **errp);