From patchwork Tue Jun 6 10:15:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13268894 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 BEE15C7EE2F for ; Tue, 6 Jun 2023 10:16:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Tjf-0001ai-Nl; Tue, 06 Jun 2023 06:16:19 -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 1q6Tje-0001aT-LS for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:18 -0400 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Tjc-0006Mm-M6 for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:18 -0400 Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3567WVsi006549; Tue, 6 Jun 2023 03:16:08 -0700 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-type : content-transfer-encoding : mime-version; s=proofpoint20171006; bh=doLlW5QKg+3iGve7PXCO+9X7V+IaFgcwPQvlkEes5Ac=; b=M6lIMb0VCsO2BSNYrI/xVkCix56M7jY4DgEM90RUVTnx0cMyZQ95faCtwZt+S4IEu1Rq 8OZKb038R+q1oQ6Q0uN0NoO7JqDf3GzC1OGCnOOOI286JT2Lrxh/2htauE/neOzIKRfg GjN4Fx9ctxa7g2pjYDbGSFf4afFXQXuZD64UfX6bKL2iGh9X2Wb5ZuL/FDmmA2Ka4+kM wxMCcnawzDeU4nUxhRqI4Rl/3a0QPN04NClhABMOKRcNxua6y26WAtwIBG2rhLqbNuxf Dgr+jK7/KnuEsy9EGWbZMQkoMZBmzGss012S4oGJdNy7tcs2m44UUo4ixeRSoqs/Sd0h eQ== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2048.outbound.protection.outlook.com [104.47.66.48]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3r04ucwdmd-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Jun 2023 03:16:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FnCS/NSNDCldmkk4zWpCuSLuJqgyA0R+rvOupEnA8YzuWPFcy2IngXrOyZZ6G5Vimt0Pu27eu4arswk7KOOmkmB18IaRTsduJmZt4mf29ioRFjaUGkNUHH7sabUoUxGH9NKKEDktl6R+WcIpzis8sdarY3UjYnSYGRcGz/09GiWkI8TnQ2/jm41wq+mD5ch18prLcPB9Wxeo1F8YbXVAEzT/SqyYtWYD7oJlNEeQrL9jHtEmbhoqQRxo42dwWc1by8KlOMASkDGYnXKOOOPjekZUNx4U91C3wsigCyfG/nB3bFO0UxjJsPoce3hNYLki9TQu8ads4STcvueVInPxTA== 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=doLlW5QKg+3iGve7PXCO+9X7V+IaFgcwPQvlkEes5Ac=; b=PCKG34VKBvkDOGUTnuwVZX2HX9p9ZTUCCUbYU3LN+D6typ4x6uXTV6eLUDPXuMK6lv4GbeybnfTfudQzSc0CXDoBQ7c1iJwO/2wtSBZr9OT0Cs03WBic8JJHtJDHENgUfpoO1F3N5taZXV59nMr3Kasj2mRU500iEn1e4WcZI+7PfWEn6ESdGqlLjzKgy9dKXqGM6d2Ztm5/h0ETGdU9As3B4xcr9TC1CIxj6SfTqgtGHoxn65+lLtd37Qv5eT3dVfw0Q3mKIJZ7CZUXeOnkNZjiux4Fm6nMWT1jt1g8FdhiTLB7my4QjvkWyre1LgzeU7PT+2F35iSYjim0ou01Kg== 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=doLlW5QKg+3iGve7PXCO+9X7V+IaFgcwPQvlkEes5Ac=; b=eAWESP2Z81oqljFCnMA9aX6XYH5ZamxDeJRQDtHZ1w0+hW5zyyIEUWPpmIF9f/xn3Wzy5J7kefBupsGcDkpJ1n4peThwJvfUnNqA9nBt5PeaXcvqqBce2Hfe+N1iGvCJGb6q11ye5ZcrvuJoNNtpQPfW02YLEXvNRjp7YoTCzjhChf7jc/S80KsyIUfMgeogLbJJ8gywfvQAts//SQHOpzPA0CDBe6nFZf1M0i6YURSHnYx3Ovvlj2fV+CP/gFpwGtl3PmEZVn0w4OProc99/dXmH60vWOMxZqreRjnGhCNgKyUaVkeGseRECbHCIJ8brdzBBoAl95VhLEAAFyme3Q== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by PH0PR02MB7797.namprd02.prod.outlook.com (2603:10b6:510:4c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 10:16:05 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%6]) with mapi id 15.20.6455.030; Tue, 6 Jun 2023 10:16:05 +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, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v6 1/9] migration: introduced 'MigrateAddress' in QAPI for migration wire protocol. Date: Tue, 6 Jun 2023 10:15:49 +0000 Message-Id: <20230606101557.202060-2-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230606101557.202060-1-het.gala@nutanix.com> References: <20230606101557.202060-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR03CA0251.namprd03.prod.outlook.com (2603:10b6:a03:3a0::16) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|PH0PR02MB7797:EE_ X-MS-Office365-Filtering-Correlation-Id: cf2ed190-072f-4a7e-0b75-08db667709c1 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: aJgCZBmNd6bRCMOR+J4Lug+2NN0Rw8CInFRmw+Y/7Cv4QeyPkE8t6B4JnM066T9dgOPbge1bJZRof+PMEKvzLPiSf8nVybEsRolAQfdc1bgDaKJiiu7vCmhiIfvk7x3anKi2u+qU7j56RPuVwDH3HdpsckBfjNhMPqlGbe0RkVEmKX82zzWs90PyniXcJQod1CN/JB1FLlRJCPmUIuF7ULkK4jSPsGqSMkHhKhnGLcVIO9Zj5aGG04X9rXmMFx/vghg6uzm/1FwfUfjN6frIubwPDIiCWU0ibc8UWnBYHQJn0NJ96RwwFrRvY+xQTzwilps2Ttj8/ALj8cZd5IKL9eCYQtU1/GI9cB4r+yll6e29a5Feqg0z0y947taB6IIx54VV54elYw973pGEAMgdFEZzRWF/9tpzdMd3/jlCIxhIejh72rU/Zhz8ErP8rMLHG7u96TtvpNAqnK+Bx3DKNl9StJO2ZtG3GJH3748AmSY+0z8WsnppLSDrcKApYU4W2QBtOy5SFbp2TWPVZenFNAA9DV9tW5GKjcmqhYygqi1aCtKBT/9YR+spSsoUVaRP93DugXWiThQqHUkcBsBdRWF7cie8sd/wA/W7xkj8+HJbnMhUtdNtBQMaPBk2d257 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:(13230028)(346002)(366004)(136003)(39860400002)(396003)(376002)(451199021)(186003)(478600001)(6916009)(8676002)(8936002)(4326008)(38350700002)(41300700001)(66946007)(38100700002)(316002)(66556008)(66476007)(2616005)(6486002)(6666004)(52116002)(1076003)(26005)(6512007)(6506007)(107886003)(86362001)(44832011)(5660300002)(2906002)(36756003)(66899021); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?yWSeF1p2FB2VuAQmGUuq1GKQV0DB?= =?utf-8?q?DVYt8qpQglgkw4AfrRDYe3HKzzcgeEXQoE3QVwbudn2FJEiXmGRjcyCufRga9s62U?= =?utf-8?q?Vu8tvr/etVLnXwttU+izr+Rv8bHtVu9crlzviillBg2tljP6dc7GJxDrRt+nVKe4M?= =?utf-8?q?9URmPvGOP/6SXD89qS4k4wIShBqOCnIP0Dm8klPTVsIIQWxzCczNrZswS2EX4P4V6?= =?utf-8?q?O1f86WKlUO6QSSUnrFj0FNfZNiyRzx0f69FzBOaK5EU3P+q/R3BjerHBb0321TpGX?= =?utf-8?q?UGHx5Xrf3XtAHI5NbHUbF7leiHLem8m4e1bfVC0+Unuo/nOG7hIWec4fAM7Bq0WSy?= =?utf-8?q?4wqRhzBxSpF2z05pG+iluZHiGtoFdEeJOj+7h/RHBcB1f2CHkbtO2ip28ChViIuuY?= =?utf-8?q?xgr9D8JcITEjFFXy+TFrHNxJG1ObhFDuYaVm1FMDWcGA0CmTMwOiq9TczWMSW99qb?= =?utf-8?q?dh4gkb76/AoKLZZQqm8ynjqWaKwtcnc0TRu+KsEoFCHuajn+YA1ueZUgCr5Mt5klA?= =?utf-8?q?3DNmt4Ul3TjnLf+9XVHBggRPLFgMN1e7GPL3rYiNVHEZlu0Jt3GHQXEoeQ5slwTTk?= =?utf-8?q?81xuV/GsvPmiFxOoTJ/CrqAF2D+LDQqThi6nndR4XHfz5GwIExfYHiAyrF0nISJ7L?= =?utf-8?q?xajNRCBK2wqSFJP8Np/nuvRJp8jyA6pSRII6v+rh6EuvgMZ1og5qYTgjl4gj+ccq1?= =?utf-8?q?taPJIDGkCoILLFbLB0Rq5a4ZAkY4vhH1Hu+8Yvsu4YqoaRn12qbnHdg1nYn7qvpzW?= =?utf-8?q?TCMg3MickiRB1mNV2aM5Nx+wbWV76YzSJCZw+HAR/IZmJ38EflEJLBiYMHhH1VNgQ?= =?utf-8?q?55wPzgu5VoKyrynyD13JvTc6RM8AJnprjAS9Kq6Szw7rVRZIS18GbGTClfBOY+6l1?= =?utf-8?q?Yd6xR1fh4/rItD5N6qoIqvwdy94zI53uHODau/ieto44NCWBap/EQMHsXva19QJiq?= =?utf-8?q?+PhHTfhArfT/+0g7dnvr+P+MY8xsV/FnONhnSFFToxqo4L9AF3POYwbZ6MExNa+67?= =?utf-8?q?zZ5LUeaKqdLcLeG6DcjszLBn6XucxNh6oH9vETPtnsMb5eh9oQROAAc7qvUpIXz29?= =?utf-8?q?QdgYYmMEyAGxlwUASPuniKLdswdRzLhpclt8u2FE1mbZWxsrrN8Lcecd+Mxf9rcDu?= =?utf-8?q?XDpxKoj54Mt+kPfFL0uMVw2pdrDBwdtBEjVrOgIz/+WFS07C4PRxSjl6rlNhYRoZj?= =?utf-8?q?Uh0GB0TYTuD/aHSsM4Z2FSwTvQOv7M6NroQdCipmZvC+GKm7KpddvVbK2uiodrgA6?= =?utf-8?q?oZlag0qLDaaeRhxSl2Cq/a8S20EH6gzVXjyG4cQZCplTlxaLzGwUD+AwCBS3IVqpF?= =?utf-8?q?cuyBehlwPHK0qT1HwOvYzt0th5+leemuNMMkiSqfo+jnvBuD7ysKs7sJh65bjR+tu?= =?utf-8?q?gudkUcal+3eysKoxpvkYDzyE3Q8YIO+CG16UVtSXhrA7vwnaumOVThVhhigaZMsFA?= =?utf-8?q?Mv+Cdt0yzYs1TmSpRQbEgM+z5WA+nrZC4+pw7+3Qv7B3OmY52dTJqcZSahhhAbSaI?= =?utf-8?q?tzr326fmIxOY6yvUGBZS2bTv650MVfOGmw=3D=3D?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf2ed190-072f-4a7e-0b75-08db667709c1 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 10:16:05.5392 (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: 0lTY6ZweOgDDSr6YJfAxnyEuFeZwA4jHx4ylSU0/NropOVVMlffbSYbUKK/OCBeFOw6364oRGAeeB3Mbb7oPVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7797 X-Proofpoint-ORIG-GUID: U38SbbwATXjfz3ykzVVaRQgrgKPyK0mr X-Proofpoint-GUID: U38SbbwATXjfz3ykzVVaRQgrgKPyK0mr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-06_06,2023-06-06_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-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, T_SCC_BODY_TEXT_LINE=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This patch introduces well defined MigrateAddress struct and its related child objects. The existing argument of 'migrate' and 'migrate-incoming' QAPI - 'uri' is of string type. The current migration flow follows double encoding scheme for fetching migration parameters such as 'uri' and this is not an ideal design. Motive for intoducing struct level design is to prevent double encoding of QAPI arguments, as Qemu should be able to directly use the QAPI arguments without any level of encoding. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala Reviewed-by: Juan Quintela Reviewed-by: Daniel P. Berrangé --- qapi/migration.json | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/qapi/migration.json b/qapi/migration.json index 179af0c4d8..e61d25eba2 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1407,6 +1407,51 @@ ## { 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} } +## +# @MigrationAddressType: +# +# The migration stream transport mechanisms. +# +# @socket: Migrate via socket. +# +# @exec: Direct the migration stream to another process. +# +# @rdma: Migrate via RDMA. +# +# Since 8.1 +## +{ 'enum': 'MigrationAddressType', + 'data': ['socket', 'exec', 'rdma'] } + +## +# @MigrationExecCommand: +# +# @args: list of commands for migraton stream execution to a file. +# +# Notes: +# +# 1. @args[0] needs to be the path to the new program. +# +# Since 8.1 +## +{ 'struct': 'MigrationExecCommand', + 'data': {'args': [ 'str' ] } } + +## +# @MigrationAddress: +# +# Migration endpoint configuration. +# +# Since 8.1 +## +{ 'union': 'MigrationAddress', + 'base': { 'transport' : 'MigrationAddressType'}, + 'discriminator': 'transport', + 'data': { + 'socket': 'SocketAddress', + 'exec': 'MigrationExecCommand', + 'rdma': 'InetSocketAddress' } } + ## # @migrate: # From patchwork Tue Jun 6 10:15:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13268896 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 65A17C77B73 for ; Tue, 6 Jun 2023 10:17:29 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Tjo-0001cP-Sw; Tue, 06 Jun 2023 06:16:28 -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 1q6Tjg-0001bA-EV for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:20 -0400 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Tjc-0006NT-RR for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:20 -0400 Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3567WVsj006549; Tue, 6 Jun 2023 03:16:09 -0700 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=fxVQjiFW4e1cX+l1WtR6hv9kcaeorLkzZfPmlBtp91w=; b=hMubfbrF/Qxb+xmnpEec4R7C/Vb4ge9ajNfjHdjpUZ3HKLij48VO9ZIoX8DIdfez4hsQ ag3lTf+Gi04vTACIzO0nQPLW2wnMqHLIqhHAA47Sme9EnNYt4pZmf4C3sGIKujB96FUa Ly9iPiUf7ohpwogPEqSsZwGVXBLs0+2S40rQjrDsWpJh2LKaGDxQn+L3KJsSVqX06/sV Li8QCU0sYkOaV1iSrwJgFFjJ8DMJkL2RG0WTDVmTQv8lOcQD6W3qSAEUHJul9QhVn0a3 r09gGiZJWBo9oOINUfOhcZwsPYMpXVu7jDjgYpKGU046SaDqD89gee30eFNCCk6qw6Vi /w== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2048.outbound.protection.outlook.com [104.47.66.48]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3r04ucwdmd-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Jun 2023 03:16:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cD3QSMt74LRrAn6tVsCscZ3HBt/u8wt+fKz65ELCSeN8jI7A/Cnld3v4/MAqPiE4aL8ylwV+4XLJBID+r3/krtD6QbL7IjE6QpqUR+k4dbHE1d5vsBekFPYo2aUp/IfUQCBgMkyRqui3doF/MMHfSvwxluy1NH0iCnBJmgH4267gpZImfHuDxWS+smf1RJZ/TnMgku3A+h2ERVsOHwFCiTjvzDWDsORerpFArt+x0/ptpSzs9Wf/g8Jy6UK0psQiURnSciSvfbArWOdbtN6GTqCb4WlsTwycJaYGyM0OBvOs4AgS10F2jze9QozROEHOiTX6ZxOChQIBUVqP+PBCHg== 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=fxVQjiFW4e1cX+l1WtR6hv9kcaeorLkzZfPmlBtp91w=; b=aFe/w5xBa7kswHYfBV6QEdFIPLq3siCCdR9NVBLhypJ7SQMHT+manZs2wtx9yPv/u+pUEuMJVRV+QQUeIhP1b0nFNWJnsjajml8IdDPBBSJTQ63bwUOQe5JbGDXAx1rZUqMkAhCx6UBzDPd15UtKqs1opcMutV25RmKbhC1S5COhjCs1Ru1+YCaS8PelQ3U31mZqrQQ59S1S2cXtswVtP06ZOdNnr66o+tGtRUVUKWmpRbySHGr27UCBza+AH68IhFAp3jsQG/asrjbyC8vq8e+c4o4T5EjXkm8gHVmVeLmawo8c9/ASOuTdYao+gJbtxXkj4KfSHhau0NHyxa0ECg== 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=fxVQjiFW4e1cX+l1WtR6hv9kcaeorLkzZfPmlBtp91w=; b=a+4KffUATfngiLLmgK2Lei6vIknP1TIcMCrVeMq12O3iT+5Y+QOSJ9b+oq7dBDcmPO8VXZbpckE8JWvMS3rwZE35IeENXjaDqZHWYmGrpRowzTomo5bTc0kBJQl6r8pffkZ/uuSDTUjybypc24axPkhhE+YCDlCS5K0Xiwo825h8pG3+F3cYvbKNEJv39FIh4/ADSOofj2uvzrn8L4CjLHazoE/vLWeu7pfcwONSUL+eNG92KIQomA9qx3EsJNRKGQYh+nXglihhHG3+Pv/HwkRO4+va23UTC2Nspz7BuBqOQPRHfoEkkABd+ea0ty0BRkY70Eiwb/HrTeSuTTVAow== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by PH0PR02MB7797.namprd02.prod.outlook.com (2603:10b6:510:4c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 10:16:07 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%6]) with mapi id 15.20.6455.030; Tue, 6 Jun 2023 10:16:07 +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, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v6 2/9] migration: convert uri parameter into 'MigrateAddress' struct Date: Tue, 6 Jun 2023 10:15:50 +0000 Message-Id: <20230606101557.202060-3-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230606101557.202060-1-het.gala@nutanix.com> References: <20230606101557.202060-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR03CA0251.namprd03.prod.outlook.com (2603:10b6:a03:3a0::16) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|PH0PR02MB7797:EE_ X-MS-Office365-Filtering-Correlation-Id: d7768ba2-4ada-4211-c20b-08db66770a9e 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: BjyRScWKM/PKyew/XK2JvRHaYEPaFByzL4wG+wQzMKsb6qOV2BAUU5U0ELyAQdXgK+lNCrsZTZ5566MS0UpgXrGHOH86pQoxBYmym6OsjyfiPtvK5/KRbcOCsuUW/JALxQ6YwyJ5fe07AKGpA9oF0ARaTIm3uG+Q7dlOQG75sXikxB8LlTINzv5F1cPwiaOLXqcxFn0i5aFEUu7aZ3erApvCnx3QZPYA7AwOIvvwVmkNy19QhLePLm+l87MNZAuMVRl67hdImMVQO2QEoniIE9QLxXiZYWcfq/YTVxeUafFZgGNL2t+BXkejqinIOKd32hKpJFYJu0voc1AChW+LkkeN0QEZTaGLk7UwchWJUCKSy7qLgbXuQx8yw3HuHmSalQ8mEYanXX6I1UkxoxQlVzk271y00FgOgPe3H9gS+tsQIuA4LNZYctMTutq6VFP3bJT9HsoboVHLMgb2pf7cTbb93U1DS27vAoSsMNiEbnUX32YH5le/b8xLEW5hhfMTHDbhPhcV2jwGa5dWfXBcvwgil4x6UuIG1Sqhtz81r+G2QS4cdLwsk+WQ3INmHaHjGuG0rVYDi47gHTkQyhnQD5nY+SG5Qb99yP+41lbtzqzSJFPLv0jjGviH+zyBAJo3 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:(13230028)(346002)(366004)(136003)(39860400002)(396003)(376002)(451199021)(186003)(478600001)(6916009)(8676002)(8936002)(4326008)(38350700002)(41300700001)(66946007)(38100700002)(316002)(66556008)(66476007)(2616005)(83380400001)(6486002)(6666004)(52116002)(1076003)(26005)(6512007)(6506007)(107886003)(86362001)(44832011)(5660300002)(2906002)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sgcbegdkVjd9Gf9W0CZViEpPTBBpJms/XhBjGNMULTlGxu7w5rT96LUHtoPsPgblNiuWCf7VmKxhtNSmuFWeuUBBSf8C8pLl6x/F2f3jUd1COsA0z8eZkrIt9l4X8CXE54XUjUcT1eztlBGoTZI1N6uIt8OI4Eg+czTAIBlUcMbYVdd4aYgwsDtgPzEF+oj0c26JLwwDtSuYnbCzK3Np1TqC1GjqmQqR6+TaULvM18ZXDG5POTCpSS90YF6bzWW/KPXvNJNCzKMiMsxKKfpNBRTOHw5aVz8rEaGZPZpxK7jbveEPT5ncQZCtskjBA9X9gP3GvaO3Aw4YQUDPNCyDuqQX3fw7cbhbFd9Zzf7XvvsC98lASPEyFZPl7PCvepV+TpomfvCnJTSFQbb4yXgJRaZ7tj5oF8iAxnqqGZvsboDpkDvHlng9pJSkh35gexbETByiyrW4P1r3hQRTuJLVX4MQMKAHInplRJ1yptC3h45DrLm/mQeQ0Y0C5OBeQDP2DxjShQ475iDoDMCBTQdflH+mJ+zPW3VY2j67UwESSQ/zJQUsGqIseBF5Chka0UceFi8AR8TPYZZ1JD5CXJV1SeSG1UN3mTFGzvA2jbLWF452MrrSxmklRv2U7HODU85rkb8qj4LLtA9xamsf4qpOaTo7AXvO2lpLDLAnoY2cSzxeaAveGtH5YD9ATLu4MxoMzASeFtWn90xQ0v3w1w3idaQ7JhOF7yv8QPJ4lqmoZntb5oNbZ6KQ+6imGk4QXeP8NWZqz55JWDIYNfVHOMdk+fUTaTrQtBxTSOMzlgmBNxM6JIYrASovZxaB9FBaOnV0xsYqeHbD1oeT9QD5WKpU8LHhn3yA+JZT3ldkTYzravINy7lvGTgQ7UKiFIpgAqz2Y2qTxjyvJvgQCesvIuilRw2AZouHR38vl79RFyQio2rAjvpDuxv5y7FNb624gpZAaxypDcdLzypp42+SEn4tEG5qhbfA9Jx+92G9QIRcAuMLRhNHQY9NUiZsDGQZywZyXVn5CUG/DoaglXzse8rYmKL29wJY7h6cparccusDtMq/j/c7FG0HtLKp+PNOEvhHkpqm7TnOP/ye0+NX2IEbux4JKRhINtIPVSfgaSuVGe4tRKZtVA4Lrnb1cWBG9EF15nfxcnMH9aqaqYFMuQKrZdQ4aw+xLd7HxTclxMsJtNViJPXiYbW3SE+1gsx8qz0oct6rZm/6FIorE+zxy0pUd1eVQ5jZLWr3AGWwIDFVDfjFTqry7lKQJg4tx893DXbhUeJNCQgDVtJ7fkE9Og2zH+m9YeWgCiCtBz5dAsGHpbKFN/tNeL0SkuY4v2TxhvkCextXeLaBRL0UE+xs/XBLumCHk4qWHCaQKyE+uhNUg6pAfj4MNAxASTobV+jfqVssGJLGsTHl02GdWaR5rZCValOtxA/SRw8t0agMQkfhifSdtK+34uPzxoFhwJEF0A/3JpC7W4uEG+q0Dt5mBegiqNwiVF2gUxnXTxNaDzaaDkqnVPXXB3XeF57LQA0kKKOqXpJ2Nch1s6KgAh7bQ+rilntQXKww8yi6jg9iqnM/dL95GKobPIftZpjsq23EoKBB X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7768ba2-4ada-4211-c20b-08db66770a9e X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 10:16:06.9659 (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: /CIcxuQPQV4rhwPfreS1Dke7KhUz9DLxqymLALimOmh6BVYwinC6zIsxGwBVKDESmXFZMdpIeZ9XbBPxb0qRdw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7797 X-Proofpoint-ORIG-GUID: lJO5pyFQp3gHD1C7g-6gw5BE3qVIqGWi X-Proofpoint-GUID: lJO5pyFQp3gHD1C7g-6gw5BE3qVIqGWi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-06_06,2023-06-06_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-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, T_SCC_BODY_TEXT_LINE=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This patch parses 'migrate' and 'migrate-incoming' QAPI's 'uri' parameter with all the migration connection related information and stores them inside well defined 'MigrateAddress' struct. Misc: limit line width in exec.c to 80 characters recommended by Qemu. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/exec.c | 4 ++-- migration/exec.h | 4 ++++ migration/migration.c | 54 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/migration/exec.c b/migration/exec.c index 2bf882bbe1..c4a3293246 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -27,7 +27,6 @@ #include "qemu/cutils.h" #ifdef WIN32 -const char *exec_get_cmd_path(void); const char *exec_get_cmd_path(void) { g_autofree char *detected_path = g_new(char, MAX_PATH); @@ -40,7 +39,8 @@ const char *exec_get_cmd_path(void) } #endif -void exec_start_outgoing_migration(MigrationState *s, const char *command, Error **errp) +void exec_start_outgoing_migration(MigrationState *s, const char *command, + Error **errp) { QIOChannel *ioc; diff --git a/migration/exec.h b/migration/exec.h index b210ffde7a..736cd71028 100644 --- a/migration/exec.h +++ b/migration/exec.h @@ -19,6 +19,10 @@ #ifndef QEMU_MIGRATION_EXEC_H #define QEMU_MIGRATION_EXEC_H + +#ifdef WIN32 +const char *exec_get_cmd_path(void); +#endif void exec_start_incoming_migration(const char *host_port, Error **errp); void exec_start_outgoing_migration(MigrationState *s, const char *host_port, diff --git a/migration/migration.c b/migration/migration.c index dc05c6f6ea..0eb25bb5a4 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -64,6 +64,7 @@ #include "yank_functions.h" #include "sysemu/qtest.h" #include "options.h" +#include "qemu/sockets.h" static NotifierList migration_state_notifiers = NOTIFIER_LIST_INITIALIZER(migration_state_notifiers); @@ -420,15 +421,63 @@ void migrate_add_address(SocketAddress *address) QAPI_CLONE(SocketAddress, address)); } +static bool migrate_uri_parse(const char *uri, + MigrationAddress **channel, + Error **errp) +{ + g_autoptr(MigrationAddress) addrs = g_new0(MigrationAddress, 1); + SocketAddress *saddr = &addrs->u.socket; + InetSocketAddress *isock = &addrs->u.rdma; + strList **tail = &addrs->u.exec.args; + + if (strstart(uri, "exec:", NULL)) { + addrs->transport = MIGRATION_ADDRESS_TYPE_EXEC; +#ifdef WIN32 + QAPI_LIST_APPEND(tail, g_strdup(exec_get_cmd_path())); +#else + QAPI_LIST_APPEND(tail, g_strdup("/bin/sh")); +#endif + QAPI_LIST_APPEND(tail, g_strdup("-c")); + QAPI_LIST_APPEND(tail, g_strdup(uri + strlen("exec:"))); + } else if (strstart(uri, "rdma:", NULL)) { + if (inet_parse(isock, uri + strlen("rdma:"), errp)) { + qapi_free_InetSocketAddress(isock); + return false; + } + addrs->transport = MIGRATION_ADDRESS_TYPE_RDMA; + } else if (strstart(uri, "tcp:", NULL) || + strstart(uri, "unix:", NULL) || + strstart(uri, "vsock:", NULL) || + strstart(uri, "fd:", NULL)) { + addrs->transport = MIGRATION_ADDRESS_TYPE_SOCKET; + saddr = socket_parse(uri, errp); + if (!saddr) { + qapi_free_SocketAddress(saddr); + return false; + } + } else { + error_setg(errp, "unknown migration protocol: %s", uri); + return false; + } + + *channel = addrs; + return true; +} + static void qemu_start_incoming_migration(const char *uri, Error **errp) { const char *p = NULL; + g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1); /* URI is not suitable for migration? */ if (!migration_channels_and_uri_compatible(uri, errp)) { return; } + if (uri && !migrate_uri_parse(uri, &channel, errp)) { + return; + } + qapi_event_send_migration(MIGRATION_STATUS_SETUP); if (strstart(uri, "tcp:", &p) || strstart(uri, "unix:", NULL) || @@ -1632,12 +1681,17 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, Error *local_err = NULL; MigrationState *s = migrate_get_current(); const char *p = NULL; + g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1); /* URI is not suitable for migration? */ if (!migration_channels_and_uri_compatible(uri, errp)) { return; } + if (!migrate_uri_parse(uri, &channel, &local_err)) { + return; + } + if (!migrate_prepare(s, has_blk && blk, has_inc && inc, has_resume && resume, errp)) { /* Error detected, put into errp */ From patchwork Tue Jun 6 10:15:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13268899 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 546E2C7EE2C for ; Tue, 6 Jun 2023 10:18:20 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Tjp-0001eR-Cf; Tue, 06 Jun 2023 06:16: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 1q6Tjg-0001b8-EJ for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:20 -0400 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Tjc-0006Nf-RX for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:20 -0400 Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3567WVsl006549; Tue, 6 Jun 2023 03:16:10 -0700 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=EZ6U/hzp0czYTtKNuGxn7rm5UWUAtByvFgaypzH72yw=; b=zV7bSHJF+DvN/aIE8wPAGFrNSVUEK8y/cQO4aWNn67Udg/2p6DFnAiWlqATNn0ElelI0 latuTDFfDac/s2ibNQNQ3rYh5JWsdmSPGQS9sWajuMrWc5Kyy10M6yj/Bax4X6q/ZiNY h0Li6+yuDwMozUVUngLIDUlnQy3CGuzBqbFVTpsOR1+UdgQNGE2IgOyKGl69mpH2d60p YAyiM1O1oPlqDMKIYRNMM6hTlRlPYFgzh+9OrdWubIFW95fkHcL4RH0J2MEpI1lTqKBP FxpCdCpZGkV9SgoH2ddBB90SHcFeZCpC2Wc+g5SJCzfkt5IuFB5VMtrQqJ9R4MfDd0QW OQ== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2048.outbound.protection.outlook.com [104.47.66.48]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3r04ucwdmd-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Jun 2023 03:16:09 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l3u8K+iC/5R8ApkxS8kQpa9A4l3bclnD2p8vwvY805l8Z+2nNPeEvA5fXhp36FYgGlmSQbozXS9ARIRB0VXGKZgotU7yXlX9O38alds2zbZFJDbGhgVXRUEkqGJL0aRlJ95lgtjEEVp7muGwGueeB2ex1VAV+XqRBRE9n9TMe0HjzfHJmzkwgHwU3qTiaXVEphLVTxWb0sHmnoSIXUg09GXE+GbSpuSS76QZmYdw39H7OpQk5mNstNDF6aKp2D4O8N0aZmvZepm0FWO50M7+hucU+5QhaK70zgf37UWf+hY1QpUhQSICtsisTWY9IHy+6sUgHKednS34kcwwU3sQsA== 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=EZ6U/hzp0czYTtKNuGxn7rm5UWUAtByvFgaypzH72yw=; b=FOwT06JuPYAJNLrR5DPEzh9hOL5MZaFlVNGGx1HSfOeYJCP4Q2A3AqRj2ntdftuJpqk2NX9MgYoJGfn2gAc3v8NFSzDPr5sHvWiMfgZ7xVh/Aa1lEL9tqvwV1bO4XZlOwoi7tdLwEgdVkaZFRJ30YtoqOJHUBPFRAP1rC/38Ci6vhSBzZUj2DIZO8jkgqckmL3V8z86CFFeHyM2Els7AB7BTrZyUN5NLo5gxsIfr4tLi/ny06T5UaDJV+oDmXxsph6BEPZvu2u0+hKtL/lmWnT2juTU4OujHIkKKOZsknF5UxISGdQxrfm9eNMN8rEtS3Z3amx2+g6zLMlnlCUALng== 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=EZ6U/hzp0czYTtKNuGxn7rm5UWUAtByvFgaypzH72yw=; b=Gv1WdSTrpN2DcFPjMeg6nLMpaLXwrfFkHyChj46Mx4FmWlUIMixaBMyef25pxwkrt7KCI7JulA22uN2Z6EisY73w1fjZcY3wqoPk/Dn5zQtjxBv2SQqpfokcR1LPFcy6lzkkSgjsBolMvDBknpN7ttPW/f53rpihwybSxk04NwI4R7Fb5Z4VKKcUnlkI+dVnBCb6s6ZuYByKWYta9VEB+P1mEHctofynr/Y5PQoNMTd7kS0U8+bvxFcH4Fvee+3ACfLHwHBlFl/llJikXGHw52c7OdrQY2F88YTPl2tCzH/Kehu0fIZcuoug1MOKVrhO5U4ZmoDQD98jDn5Q7yvi9g== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by PH0PR02MB7797.namprd02.prod.outlook.com (2603:10b6:510:4c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 10:16:08 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%6]) with mapi id 15.20.6455.030; Tue, 6 Jun 2023 10:16:08 +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, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v6 3/9] migration: convert socket backend to accept MigrateAddress struct Date: Tue, 6 Jun 2023 10:15:51 +0000 Message-Id: <20230606101557.202060-4-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230606101557.202060-1-het.gala@nutanix.com> References: <20230606101557.202060-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR03CA0251.namprd03.prod.outlook.com (2603:10b6:a03:3a0::16) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|PH0PR02MB7797:EE_ X-MS-Office365-Filtering-Correlation-Id: 21c55358-9f5c-4192-4fb9-08db66770b94 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: EM3bRP7HYEJGb7fWxkIN1TeQRp5oXe6HwvHl7HZdxSK/j0/Lto1kt1xfmiGnLweLGJqoa6oVTYrL+CXbouiA2B+BPPxeHOtEWGx6FXg+dM3g/GERTlJh+4pl+ZjSQOYyBV6Yws9ws6bMOuPHC1WXYtjyjOn5qYIXJ7DkNuLym2xgVnIaP+1SD0MKp91IG3y/MLuysfPzI0t7hT3k09wCMI1b9tGhYZIy8GIYEalWZTO7ZRy7aHNdmDRbKvlsqk3KMX8HuYLmZio0sBcfZnOodOxizctTJfxkJ7sUG/YCzJa1083vNmTfZJMy8e1LmJhkM760etQV94tmMC6JwccAEsAgpZIyj0Vnlq2Wc/VCNzypsRdqbc4aUJSoaZ70O6JUjfS5ym2aHtk3j6NsEtOvzjvecgWKeo0pVpPEr1AVnO0igDVfGaD/yxu/Ky8zwd9aIxdhCCR003jyzfgOr6ksjb3oBC+Fw5Bf2PJnDegtiIcCQ2t/ulWLIS/HV1XaDQ1T1ZkfZSo5BOE5/jLzoXF8+caG3CnTUB168uOWipgXKalyWiL7cEICeQyCX7ksZpSs903dIXe9B8qHQGyGbBT8kciZ+Rw5TcXA3npb35+0mptPm0JbWSe3ZJKISA9E59sl 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:(13230028)(346002)(366004)(136003)(39860400002)(396003)(376002)(451199021)(186003)(478600001)(6916009)(8676002)(8936002)(4326008)(38350700002)(41300700001)(66946007)(38100700002)(316002)(66556008)(66476007)(2616005)(83380400001)(6486002)(6666004)(52116002)(1076003)(26005)(6512007)(6506007)(107886003)(86362001)(44832011)(5660300002)(2906002)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6krHFlJ4wPX5SIbGdSga1Sjya0nsg5eLdfhh/A7/PjRRpGfY+IY/xpE2EcHV5kkeWDyRGqivR+jdbQf9NMHDVanP9c0RWwl7kXETNi9a+g9tW/6agtm0R/7e1HhEwHUxy/x+hNVu6YADYLrJdB0O1SOGVsLNTKOoezPITL1Sl79EiBgQYTNQQokx6Syq9ikU/C52aY4K5FvKPhETMhgba8JptoIG7MoLpczze9PT7Wm5X+JVcmTQrpVwFOEIduaezGyegBHHhT7+k/wue05Jt06FCZkJGIQSHqEGWvHE/j4Eh75qJqf1YoI8hW6DB5+YzsOvd3NrG+Zs0bzcJFiCKRCGp96Wl7AkPVUy3DX4IQOVe6E23GRIEJyDMV14hOcw2H3j6U0o1DyizJOCZK44p8kAaMi/RH5WNsPQo+4gHRIq67Baa298zJCkqHTuSrb99Le2HegI3zWw1xaZtkIXLZ1wON/3cWYUR9ndt6SCa4Runs/Co5SGfzsX/LsuXo2NOBsjTP6MNPBEZsFqx4+zc7Nit2nqE9ufr2MXA9w+9jxy0xRg+Zpe7YZSJG6Mf0SseaFmzAQIuWJAfcQb09fzKl8txzBWLk4H8EggyMXi2a+iaxuR2OkVHK7SNjiyNXbEEhPGyPCkaS1Rv9nhU7AOPcN3SyFFcEattbLiBvZ6fhW2tRB8QlaOD7qL/BUPzRZRJpY3u9VAzhuKslyAFByQB8OegErxHHVxA5Y3Sd9D0+j358LtHcqnSJH3cV5Z4YPnIwY2UuPwaqQCCWycsmctrVwaIjWLrjQuAlqFUobunUEnCiIF1aqurQEyf5NXGsPaCJ52YJPSHc/14nhHrA3KyygcwBYM05asXK6obMyOm3/EeAXaCmNHqiasup4uhEw8kBbJniwH/ayc0YPX3p/C2smsQUfgQ0IaCqT4Eip7bHgavOHYPn2YIjrvvKWcvLm4QFLz2rxX6Jtvk+msa0dLaFXDN9VOVNcQaAf2kac4UCxGv/GRSqhq41jHWV4EMnXxodMt8W6zAolPj59oDl/z4Gxdrv6Ylwlk86i9sUaIbVoVJb6jPXPcbvZQQOV+iJwu5b9VWNN/jO/wCXl/Gv1drWHUTVPyBBoCudFRQQ9WfgJ/gbHmj1q5eht8itdDqV2NrSG738y51MAryx9QFXnPqF8IEYUSqJ1qyiIW2ncC48/RJVVJmZ6xibdzjtFI3Ahm6lDxTJtwiV0TG/e2uQwXaFzbWSV+M2/yhqdmRsgEBFp5g2sl+ELONTezwYU5cQwv9xnrJCDTvtujYDYYKKmqFCT08dUKEciyFb0B4+nwsscde4YH/3E/4yFqtdvcy9Gxu8SlPsmRBEk85anWuXkwIO29Lz/SJxjrSJ8nIpfGkxMnzBtIIKg9TMzkRC64aKC9Zz2KQXPSekqwRb9//WUHD4FZoPc7ivHRG7fkXErRJma7eEQaRxOOYOzcwwDYj/FXm88qVMAyrQUAK8S8Z7BittSJwMAUD8zJvpIg1U0kNgHnEjkldfZTdjGA6Pifph7wylwDf453vAchaJUQ95d9k4/PhBNF1VPbyWI7CcAUQlMdcwGJPb/+rD6R4gprTVviapgvGZtLQJjmELJx46cOyA== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 21c55358-9f5c-4192-4fb9-08db66770b94 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 10:16:08.5853 (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: z6kmseGpw1aLsN0+Gu0o3NvuZvjEiTO2jkD+kVdaxnSatKut3oIVwQqJML8irAiunHWWru6T2yj8OjvNoiwbuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7797 X-Proofpoint-ORIG-GUID: C9QD92m0PkM74vfXfzXoW7K9KC6YyiRh X-Proofpoint-GUID: C9QD92m0PkM74vfXfzXoW7K9KC6YyiRh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-06_06,2023-06-06_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-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, T_SCC_BODY_TEXT_LINE=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Socket transport backend for 'migrate'/'migrate-incoming' QAPIs accept new wire protocol of MigrateAddress struct. It is achived by parsing 'uri' string and storing migration parameters required for socket connection into well defined SocketAddress struct. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/migration.c | 32 +++++++++++++++++++------------- migration/socket.c | 34 +++++----------------------------- migration/socket.h | 7 ++++--- 3 files changed, 28 insertions(+), 45 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 0eb25bb5a4..0554536b7f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -479,18 +479,21 @@ static void qemu_start_incoming_migration(const char *uri, Error **errp) } qapi_event_send_migration(MIGRATION_STATUS_SETUP); - if (strstart(uri, "tcp:", &p) || - strstart(uri, "unix:", NULL) || - strstart(uri, "vsock:", NULL)) { - socket_start_incoming_migration(p ? p : uri, errp); + if (channel->transport == MIGRATION_ADDRESS_TYPE_SOCKET) { + SocketAddress *saddr = &channel->u.socket; + if (saddr->type == SOCKET_ADDRESS_TYPE_INET || + saddr->type == SOCKET_ADDRESS_TYPE_UNIX || + saddr->type == SOCKET_ADDRESS_TYPE_VSOCK) { + 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); #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 { error_setg(errp, "unknown migration protocol: %s", uri); } @@ -1688,7 +1691,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, return; } - if (!migrate_uri_parse(uri, &channel, &local_err)) { + if (!migrate_uri_parse(uri, &channel, errp)) { return; } @@ -1704,18 +1707,21 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, } } - if (strstart(uri, "tcp:", &p) || - strstart(uri, "unix:", NULL) || - strstart(uri, "vsock:", NULL)) { - socket_start_outgoing_migration(s, p ? p : uri, &local_err); + if (channel->transport == MIGRATION_ADDRESS_TYPE_SOCKET) { + SocketAddress *saddr = &channel->u.socket; + if (saddr->type == SOCKET_ADDRESS_TYPE_INET || + saddr->type == SOCKET_ADDRESS_TYPE_UNIX || + saddr->type == SOCKET_ADDRESS_TYPE_VSOCK) { + 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 (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); } else { if (!(has_resume && resume)) { yank_unregister_instance(MIGRATION_YANK_INSTANCE); diff --git a/migration/socket.c b/migration/socket.c index 1b6f5baefb..8e7430b266 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -108,10 +108,9 @@ out: object_unref(OBJECT(sioc)); } -static void -socket_start_outgoing_migration_internal(MigrationState *s, - SocketAddress *saddr, - Error **errp) +void socket_start_outgoing_migration(MigrationState *s, + SocketAddress *saddr, + Error **errp) { QIOChannelSocket *sioc = qio_channel_socket_new(); struct SocketConnectData *data = g_new0(struct SocketConnectData, 1); @@ -135,18 +134,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) @@ -172,9 +159,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(); @@ -213,13 +199,3 @@ socket_start_incoming_migration_internal(SocketAddress *saddr, } } -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 dc54df4e6c..5e4c33b8ea 100644 --- a/migration/socket.h +++ b/migration/socket.h @@ -19,13 +19,14 @@ #include "io/channel.h" #include "io/task.h" +#include "qemu/sockets.h" 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, const char *str, - Error **errp); +void socket_start_outgoing_migration(MigrationState *s, + SocketAddress *saddr, Error **errp); #endif From patchwork Tue Jun 6 10:15:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13268903 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 6376BC77B7A for ; Tue, 6 Jun 2023 10:18:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Tjq-0001fB-RD; Tue, 06 Jun 2023 06:16:30 -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 1q6Tjg-0001b4-Ct for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:20 -0400 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Tjc-0006Pu-Qy for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:20 -0400 Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3567Q9jl006542; Tue, 6 Jun 2023 03:16:13 -0700 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=Z+YSCSLNvriNipDs+Q9mgqdY6J7YLicGclF8K0VLml0=; b=QEfVg6t+ba67a3K18LG+b1uBpKGqg7B1f3xQwo+pH81J/UI3zFgD0pT5cipWP2FANy+w iL/1FUZ9A2E8iQiYzxkyaIYLPnQZynejcd8zVZbDDUk6+3F/L51MR+ERCmxNMD46Pk8L MJ1spEmU/1s85AXdqEqVsmIMc557FTo3ZEmrBSlph1xKGadPqb3R9+DbUgq+mBpQ9xdX 8Ad6qrsBLwelx0noQS1fNhFJuxieNHPPyjqU/Dp3Zf+OXuNcR7r/8px1fTL/HioAZkkb 648Vc18FDB7k/A74hED10pI1oDI4dYrVU3SoeNweUE+oMygpFEqeDjdxkpLYZZJ+QNLC Qw== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2046.outbound.protection.outlook.com [104.47.66.46]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3r04ucwdmh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Jun 2023 03:16:12 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e5Ipt/oX23wlDQfpVQxK/2FX72D0Bg7/io0Q7blEzBRTXk/ZqewIOSxk+IX09AyS+NueT5uYUIbCZVm9MHOqAnQuVV10Ug3KKX5T49QLR6h2Fdj3vQZ0fG6Cf6MVF/yzBYqr6FVlgbYkG/jFv20Ni7uyqqood7cf0OvzRGkVXyr+4oz8rMuQwU0flRnP/RMCo5eXGuzwi4enEewbBjF15Osy8bFNzzuSGhKOPWJ9p85F4QOsT3Fpb/Eohbe6FMWQhWGcqmxCO7Ilb4CwCHjYi/SGusdyy26RY7K5r1C3GLOWGm8zmjUjYNmG4385kIrm7FArceeqQKoYVncIPyFfvw== 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=Z+YSCSLNvriNipDs+Q9mgqdY6J7YLicGclF8K0VLml0=; b=iFroxMpRs264i/lNxE0VyMQkAcUme7gZ7lCNx8un9hbQE2VgVLBKAhxX4AYlbkMtYJB3A6UPKh90Q1jDzsd3izJsnxVZghvsJThShf2hQBjOVc3JkGFzOxGfFuSYgPkoN/1pKWaPN9h2IhC2LiWAjOsIcQvlh8cjPBHcc/ig6Lcm2hJWBCQWZEjkJKouqO5Jh0RNpGVgClcJnKIsucQk5grv1L/PAV7YsdG0zvhDAy2ux+0YJnZJ/gQ+HiQF4EVP7HuuOM353wdw10zevsPFmqrlxrCMwexG1UWATPFmyY1cbCFH5h+zbOUfvhBKAMV+zJTqaln/XEYG0bVKgK1XdQ== 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=Z+YSCSLNvriNipDs+Q9mgqdY6J7YLicGclF8K0VLml0=; b=TJd6eZTcfUHZhgxggBT9FRXuG0L0hiDDwHVJWvHOJiYmVg6UEY0AgRUu6khHIeavD2YEeeQCwrhxF5eOgs2Nhj3i1FFFDQ+kEYxR6euir2pU6sII+evDetjKl0DAYJzTdS0SmxPkkPHknTx0YhLV4imilPL0UuHhsoYjx3fauop/znNkgCDyt5hxTKKejq2B/2BY/Jkb493hYVxyKDwRoOMssGu0Lv5GAsZ7BYYdZPeKQ7j/Soo0tQuaG89bb9cnp0T4kVYXFP3N8d/7nC4ywEO/bdAfXMK2SB/+E0f3Df00/WjP0g2+rajbLdb9iFCiGk7rjr19S/05lO0EtCA8fQ== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by PH0PR02MB7797.namprd02.prod.outlook.com (2603:10b6:510:4c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 10:16:10 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%6]) with mapi id 15.20.6455.030; Tue, 6 Jun 2023 10:16:10 +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, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v6 4/9] migration: convert rdma backend to accept MigrateAddress struct Date: Tue, 6 Jun 2023 10:15:52 +0000 Message-Id: <20230606101557.202060-5-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230606101557.202060-1-het.gala@nutanix.com> References: <20230606101557.202060-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR03CA0251.namprd03.prod.outlook.com (2603:10b6:a03:3a0::16) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|PH0PR02MB7797:EE_ X-MS-Office365-Filtering-Correlation-Id: ed9aed9f-f221-4c89-5210-08db66770c9f 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: lT3g4xynPwKQxxl10TcIttkLKqb8bl2qfyBDy1ZrfOcgUVESZU8eyR0A17zr7HcOBgdtDzAjWqSWj+wDjpsaXOw6+3jGHlQHQQR7yob0tlsxn1EYnpPZrosz1l14IEi+HSrm+XSsLhQgwuWSKRIMB16/lnf6L/DXewTeJbHaI6LUv2vdEQvk0k2G6uw569r/PD2KZcd6EOQ3ECDrzupRi/iCH8PnGKdngBz7Sv7XcnZjMWHBUendJrNbufAxrLrtrfjMoeOWaVTovZ4hw6quexGGgGgCu7erZwb6awMQmw4zfKOSNmuhFG33YXDfGQyCqFJQ0HyEgFUwuGYHIEQmcow0F2c7v/aLaXh3F/2E89pOgGO9WDRWn2hC7rMdAQKTE0NEGILucLJXFJEzFzV2Q8GEr0HywdeMYhpHH1+XMose3PE/nwfTmRSr9DGSYctNCx0gCSlTJ8oIpRzb8uhEqKHjJKYXWshuT/qI/M82iMVPX/SvK3L8REpy9pTGZjp/ng/uRmYxXLTbdT+nylQBIs3eEegJ+jjzEmkbP4bs4c28jyFxgqY71dWVZBt2v0/YCVfAx70cSS22xYyhW+yXbkp+Znrt+A2ny3noxhtrR92qOm//A9VbLW2w0Kw33j/d 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:(13230028)(346002)(366004)(136003)(39860400002)(396003)(376002)(451199021)(186003)(478600001)(6916009)(8676002)(8936002)(4326008)(38350700002)(41300700001)(66946007)(38100700002)(316002)(66556008)(66476007)(2616005)(83380400001)(6486002)(6666004)(52116002)(1076003)(26005)(6512007)(6506007)(107886003)(86362001)(44832011)(5660300002)(2906002)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VI2Ntp1eN39bXIJJFqoWN4cgVkaNHq7DkATbfs1zDTd9hPcBBnr7mE1clrqJGW5k6nv3qMSN7+HGOG57ResADUsG2iiiBt8TJAdvb0Emfy3lec87fDgwBebK1gymv7r5vafvxKTK06yx6PzJ3aMMh8aF1JIP8gKx7zvanJju4P9IkYWHPw/+s3s+ADo+1oOw/1RnGE1FWd1Xbuj13m6ndH4fOj20hdZFBsnbjc9O119bcoGdVboim5EL9bU2aobFJ3d6L9PWQ37cpHtB03GRpQKRbrPXj78sedYgqHtSFz1JdPChA3bprQsqI30WwUfLDeerjSJ3UvibExv1y2p/aDfFF/1IDZk95feEOYGrBxBRVUFUBR/1dMRLUM+bd8SiwgRLAuKQiyKCd2DUT9QVMIQOQ6X/IiY/XWyAQrhIgdybC/cfdbVbJk1KLxrLBCvSJop1cjLQPnNJDXAIX7nEfH6lW5uTKMfBX0poUlZWB9OlloQ/hV2IDVSeB2TVhuSHSODzJpUfI17PDT2Bu+r30M6MjzfiGDNxJRuiUFYlpDNeChcM4yZerQVb5Y9MsCrdRUKMzTm3N9HiTaNzw6RVlzfBU/x77eyE7vb+Uq3TrIjCVo5zegz5c21RYGQN4iK2u3UraaKE51dzXVN0oOPqLOnaNlRSd8tCmvievnJSZO5/4fKp6RdzeqUscYg024idNU6blFy5jxauCreI+IY/7nnuE0T5xRq+ECRPdgtExogqozLoStHJTuiVxeoA/BKTldp+6ZSKf2O5gqq5uLgAoDBAQWHvvPB94EOvijcQ8eo/zwobZd5Z9vWM2AOLKQ499J0QX5mdZ3uYSBVNXvYVC91YWW74sgECrzCepSdfF1EujbJVw7EV4xV9H++7uivxZz9kpnvGPgQIH1fOgeMElyETjI7IMS6HV4mjeWnU8IGHYJZhzNOkCRlgBPZo2G2r3dTefwehtxMsJeFnOEkU0GCwmgZlNw2HpnJM9XebG8uGRD4Wn+/QXZdKZ3Hn9dlde3e+bzDAC/JPKOH8hsfm6OiS91RWofSKg4QuXpln1aQaO9BZKlSfsvG6hhok7yJ4Urs/Aschb0OPtxLx3vYKlDVtIbdE2jn6qiZkaL9Bt6JSgL2lHVuwGOwXmjKVTMHbcFhOPF4Hw0yKeb7yOJ9ypVFE6yzrQXfRUQVhqNWlIZcsL6StdvoleqERNStz+hT34B3WvDCsnpncu91zt64NXlc6YPd0i83I8uJsRpZnp7j/2YyQSJSYbUwWsckIom7wTLZyGfQU2K+6SsweJHRZlww/ZmDO6cO3uH9bRby2C2mUEhahTDi2mRmgdGtcc98NKYq8p5wxanXI4qKsJgCkSKXByR1LUY2mg/2pIeAs4k5RXWc0o+IAbPsyoYf3SRFh1mQ0aF+xIqVFtyldp6MbIr3I93H+M8GyLEnu5lvxHqAML7wfcpwMqcYTJb6RFZK2agP+GtvwJzgXlLKOU27g2eAhVAYGNocQ0RMHe0uhnbLIXVaVSsnUweuFklo0vvtgGXKz5sLi6uDZc2XOiiCM4hgyTP+Fm64+UpcPeA2y8dAYceWKFRQORkXqm5HhLg1TIrb2w/yScFyrTTXKNAlkzw== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: ed9aed9f-f221-4c89-5210-08db66770c9f X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 10:16:10.3463 (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: q3OdquQH5CT9CXWo/VFzXINwWNlZ1QD7CbwDtkN2zWOCVxub2iFnIIuixzxotyjgcn+F5LyVCjTwllzdYUs2CQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7797 X-Proofpoint-ORIG-GUID: qva_lWwDkrz31l4wb1SlmgX2pHueiJcG X-Proofpoint-GUID: qva_lWwDkrz31l4wb1SlmgX2pHueiJcG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-06_06,2023-06-06_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-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, T_SCC_BODY_TEXT_LINE=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org RDMA based transport backend for 'migrate'/'migrate-incoming' QAPIs accept new wire protocol of MigrateAddress struct. It is achived by parsing 'uri' string and storing migration parameters required for RDMA connection into well defined InetSocketAddress struct. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/migration.c | 8 ++++---- migration/rdma.c | 34 ++++++++++++---------------------- migration/rdma.h | 6 ++++-- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 0554536b7f..ff020656fb 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -489,8 +489,8 @@ static void qemu_start_incoming_migration(const char *uri, Error **errp) 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 (channel->transport == MIGRATION_ADDRESS_TYPE_RDMA) { + rdma_start_incoming_migration(&channel->u.rdma, errp); #endif } else if (strstart(uri, "exec:", &p)) { exec_start_incoming_migration(p, errp); @@ -1717,8 +1717,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, fd_start_outgoing_migration(s, saddr->u.fd.str, &local_err); } #ifdef CONFIG_RDMA - } else if (strstart(uri, "rdma:", &p)) { - rdma_start_outgoing_migration(s, p, &local_err); + } else if (channel->transport == MIGRATION_ADDRESS_TYPE_RDMA) { + rdma_start_outgoing_migration(s, &channel->u.rdma, &local_err); #endif } else if (strstart(uri, "exec:", &p)) { exec_start_outgoing_migration(s, p, &local_err); diff --git a/migration/rdma.c b/migration/rdma.c index dd1c039e6c..4d64fae492 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -319,7 +319,6 @@ typedef struct RDMALocalBlocks { typedef struct RDMAContext { char *host; int port; - char *host_port; RDMAWorkRequestData wr_data[RDMA_WRID_MAX]; @@ -2455,9 +2454,7 @@ static void qemu_rdma_cleanup(RDMAContext *rdma) rdma->channel = NULL; } g_free(rdma->host); - g_free(rdma->host_port); rdma->host = NULL; - rdma->host_port = NULL; } @@ -2739,28 +2736,17 @@ static void qemu_rdma_return_path_dest_init(RDMAContext *rdma_return_path, rdma_return_path->is_return_path = true; } -static void *qemu_rdma_data_init(const char *host_port, Error **errp) +static void *qemu_rdma_data_init(InetSocketAddress *saddr, Error **errp) { RDMAContext *rdma = NULL; - InetSocketAddress *addr; - if (host_port) { + if (saddr) { rdma = g_new0(RDMAContext, 1); rdma->current_index = -1; rdma->current_chunk = -1; - addr = g_new(InetSocketAddress, 1); - if (!inet_parse(addr, host_port, NULL)) { - rdma->port = atoi(addr->port); - rdma->host = g_strdup(addr->host); - rdma->host_port = g_strdup(host_port); - } else { - ERROR(errp, "bad RDMA migration address '%s'", host_port); - g_free(rdma); - rdma = NULL; - } - - qapi_free_InetSocketAddress(addr); + rdma->host = g_strdup(saddr->host); + rdma->port = atoi(saddr->port); } return rdma; @@ -3359,6 +3345,7 @@ static int qemu_rdma_accept(RDMAContext *rdma) .private_data_len = sizeof(cap), }; RDMAContext *rdma_return_path = NULL; + g_autoptr(InetSocketAddress) isock = g_new0(InetSocketAddress, 1); struct rdma_cm_event *cm_event; struct ibv_context *verbs; int ret = -EINVAL; @@ -3374,13 +3361,16 @@ static int qemu_rdma_accept(RDMAContext *rdma) goto err_rdma_dest_wait; } + isock->host = rdma->host; + isock->port = g_strdup_printf("%d", rdma->port); + /* * initialize the RDMAContext for return path for postcopy after first * connection request reached. */ if ((migrate_postcopy() || migrate_return_path()) && !rdma->is_return_path) { - rdma_return_path = qemu_rdma_data_init(rdma->host_port, NULL); + rdma_return_path = qemu_rdma_data_init(isock, NULL); if (rdma_return_path == NULL) { rdma_ack_cm_event(cm_event); goto err_rdma_dest_wait; @@ -4113,7 +4103,8 @@ static void rdma_accept_incoming_migration(void *opaque) } } -void rdma_start_incoming_migration(const char *host_port, Error **errp) +void rdma_start_incoming_migration(InetSocketAddress *host_port, + Error **errp) { int ret; RDMAContext *rdma; @@ -4159,13 +4150,12 @@ err: error_propagate(errp, local_err); if (rdma) { g_free(rdma->host); - g_free(rdma->host_port); } g_free(rdma); } void rdma_start_outgoing_migration(void *opaque, - const char *host_port, Error **errp) + InetSocketAddress *host_port, Error **errp) { MigrationState *s = opaque; RDMAContext *rdma_return_path = NULL; diff --git a/migration/rdma.h b/migration/rdma.h index de2ba09dc5..ee89296555 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -14,12 +14,14 @@ * */ +#include "qemu/sockets.h" + #ifndef QEMU_MIGRATION_RDMA_H #define QEMU_MIGRATION_RDMA_H -void rdma_start_outgoing_migration(void *opaque, const char *host_port, +void rdma_start_outgoing_migration(void *opaque, InetSocketAddress *host_port, Error **errp); -void rdma_start_incoming_migration(const char *host_port, Error **errp); +void rdma_start_incoming_migration(InetSocketAddress *host_port, Error **errp); #endif From patchwork Tue Jun 6 10:15:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13268902 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 04241C77B73 for ; Tue, 6 Jun 2023 10:18:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Tjq-0001eU-3p; Tue, 06 Jun 2023 06:16:30 -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 1q6Tjg-0001b9-Ei for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:20 -0400 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Tjc-0006QA-PE for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:20 -0400 Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3567Q9jn006542; Tue, 6 Jun 2023 03:16:14 -0700 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=7g/T7Ky2AAQc5L5NkckbTA9vFxuLlSMOAYHdEVQdTgQ=; b=XWIzg0z6h4wttDp/dcx0T+RnHn/hP7ZO0l5GUS4V8vEAvqXSB9kTyU24i24fSiuLP2ZN JRh47SZV6DToKVJsqiyNQommPg71ISVVBM6O41HPeiLCHuZVqZ6H5jCNLFjBsRuiiQGE zZvLKrd7E/zx/grALuxSaBrt4hptyCbxSe0PvNNZcbPIbeIxm2yTaIi3IdTIPFH1ZDgX yhn27MpvKD8OtQj4XQrwno4gloQApXSgZ88FT5z1onueDhSpUh+p+kbrFlhzRFLZujIb z6ni/1/nq5oXEeogR2apIq66mGP1nlE+N+q9eW6zkOTtUdbOvBoy2pjycmKzsk+clXp7 Ww== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2046.outbound.protection.outlook.com [104.47.66.46]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3r04ucwdmh-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Jun 2023 03:16:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L7ObqLpN4eTy7iG3Ccs5ouhShajce22JCv9rNDeUWJHYHLTL/icf/5Lx7unL1w9XB+4BtJAb0SvbzKnw9BBGMLwiJtsIftJDbdDajCBUps51Vny84yiBP79IWe/jZ76dAunKVNZsg9gto3+77pgsCAAuJmiXoOEzeuthC518zb4TAuIygohau2BFjb47Penk9TLvZipNQk9habAEW86r2W0bE3uxA+JLg2L4E6Qsky0XdZlBNsM4b1/MMPovKLgAOPLT3515TZZ4KXskGDejnz2CjZOwYGXpUuNbMNM3RX+GUodFlSi0jcSP32xEHrCUI0Z55QmjXbXOplrgLuGOHQ== 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=7g/T7Ky2AAQc5L5NkckbTA9vFxuLlSMOAYHdEVQdTgQ=; b=UOVGM6ZG0udmJa3Z4yeQicCCxQkMQ2gdZH03+tNs9lQUqAbT6s/Bm2ZuPN+B+jssNiWpfOnK6dcfqCETXFqNLmln2zafHBAbvd+qbA9/qecWWP+oMOmOU3QmqgYAQuyWSBQJDqjEYL3KV2DCR33FBRGR9Lj3b97oITOwf3Hfe26liP8jWlsXhJ0KDApYjIOlH8WeP4+Gb0LRBnjhgAg9O20Qdzz9CENrlAMqDBfVIAhu87sCfRriEMLDu1xWfWnda1keXTo4/0w7E8wXmdloLDMzbJcbyJG1GQ13BF64KKXzmbUAjL6N2GWpmpkhyLvfwy2xvpwzYnLFaLwPpz7S/Q== 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=7g/T7Ky2AAQc5L5NkckbTA9vFxuLlSMOAYHdEVQdTgQ=; b=HY+6291T1tp/Uk11RBIfGoTZYQmLTbsS9CEpFZZGIUL+IRKucW88vPM68/Bd+dABNO6Hl3dW0MACdhbAvStX2kNmo13RVctTzSZiMLhUhaMKeHta7i8wqOYwTRcyaspAWQ5J0woNJyGP6eXHEYYV9eDxdPHItxvNe1E9AsaKLU6nS9Rxjc+NdHisIkYu62J0HVdwsmaGyRNQL4Vmq5WwhMtgTBcSOPWgDFUliMQQgZvvQiO6L69TZwPeF84hgmaJUI9ATeHjYIACvs6rtWRIu7ZvU1KCuNnelxQAqW2CqJOy5IJtvk/TtjTVh7n2A3WSeXiYeHPopCpmryhHogxY+Q== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by PH0PR02MB7797.namprd02.prod.outlook.com (2603:10b6:510:4c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 10:16:12 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%6]) with mapi id 15.20.6455.030; Tue, 6 Jun 2023 10:16:12 +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, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v6 5/9] migration: convert exec backend to accept MigrateAddress struct. Date: Tue, 6 Jun 2023 10:15:53 +0000 Message-Id: <20230606101557.202060-6-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230606101557.202060-1-het.gala@nutanix.com> References: <20230606101557.202060-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR03CA0251.namprd03.prod.outlook.com (2603:10b6:a03:3a0::16) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|PH0PR02MB7797:EE_ X-MS-Office365-Filtering-Correlation-Id: c6b93295-c0f1-4765-f229-08db66770da7 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: xhZJEraxZYdpJpFWB5YDlTQIUqdm3k5pEjzXBBbymwyuFVAgMoVu1hpkVTFBs7s4Ll5cjttFCQ1+YIhVKNmeQ7StsdwvcDT2Bzt+HXeGWmKYAzOFO3HXM4Jrhaxw7JSvW6VDw7TKQXTCQG67o/j485tLFTpeNvNrkcMEK11K32n3NH1kh2WppvJRqTdjjIKBwZPdngBg/cgeoXbjh1tQZt56SQhZa5L2PVDH6WmKWiO9e747CFt7YPhuCsiRitl41HeQplnv3ECr2bCLBhO7zBK+x1oKOlpyRywxMMyPlWRxl/dglJtLLRYjkbqTkh0u+vaZaeCR4XFKws+mGTNSxKhPEr8O+2yz6d79EMtfuLu3pNJNfxmCgZka2oxzDSD7kU2UB93/0Eg2cHiwB8+jkbIys/DuafvmONP1pbHQyAcywDDAglZ8/5VPZGtusVEG7s1KQ/46W8uhADJmByki+jNPeEtbtFl4PlUYUEa4PPS6I9j8S+y2fbbomqqb0ennSnDT6F2C7g2TcZIegosBGXb2OLc0K936KR0sjws1qByvmWSzaElE7sN0cRkzq0FnzgcDyYTxxDWS2oNG0cSWLJwyUC+LXLLw6yl8L6DG7k8bWdyyWN/G8orPZ1D8RPzm 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:(13230028)(346002)(366004)(136003)(39860400002)(396003)(376002)(451199021)(186003)(478600001)(6916009)(8676002)(8936002)(4326008)(38350700002)(41300700001)(66946007)(38100700002)(316002)(66556008)(66476007)(2616005)(83380400001)(6486002)(6666004)(52116002)(1076003)(26005)(6512007)(6506007)(107886003)(86362001)(44832011)(5660300002)(2906002)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +CmFEziEvJvgJVgqfRmSyVzeS+6Za/3ZkLIAkExtr+O6d19YdM1Iep0gWpd9v/9s9z9XdIxLfaZH5SXpUKFycLq8qmTv8hxAo9X+CcN0L5Ea2S4JefNOaotYJ6fOGrbUyKQqnDNmqc2CUsSDMVujMUDlA9U6D2KWCa2/ds7PoQgfngJkHzzhEyyjPrpoKy1ohVM1E5fMgLWGrIJyDl4wxj6J6XZ6VbU7m1fu7bskM1N4DDy74Q9yES1LDzpNMSIHh3pY2Qg2tQwwkCtJ3G/4puTD7cxq79LEQqNqMGnVa8HlRSzg3CJ0dEQPuUO3GT6wonl4JQ/0Ma5/uY4agbw4SyjCkpwIwxWfz6JdxqoNKuY3JBMYEeqEirBnuJ/U1bIchCKMbeqi78z4njI1QlwfMnC8fVKemDV5wzqO47nL5LoLCodjdbjacHHGGVBuRnM2N4g6KeOtPCdv9sjKiGLwy0CRfbfNhjORwi5skWg7UCoZPmFv1nqkQ2flyGXYzYK1sx4HQmy8AlODyx7PIUHNwkGnBUTPdITYtvXpw51lFpH7kBZIioBqVn0j4BaB+1oeYODee1of1N9KrnGLbnjGMTfwBQ+cFAeiV7Fk1oyCDomR8amMHQEIMDh1WPFstDgpWuniuSFDgQZE2I77ji4HFfN3ZUtC42cLYp66tr9dfiInG2E2rS2rF2y5OtfPFQBeGl0P/a3a8+JMU+3au0YITiHak6GdVW7NLKcARLu8uuwTaLUrj4K9m3/3ba38bxhTpfmmtBPIyGs/KyFTkGI57+EA0ncX0EbQvcub5JNwJjFo2KczUIQOA2oWDOSUnniYIzwK1ghbLOufB25qDkWFOy0RynBOYQFCnGtqKjJL4f6hE7rN1BEzMPiAQ6sreot9C2if3ywiYEE1gwUYp5pr/bkdvXHvsJy7jRpW2Sio1IuOw8W3oVmDetzOvK6cpB7rvio7yGFOZt7k3O+CaEccKmy0YEA0p75vpkw6AwawN8XRNhzymxTngq7/lcCW0ttpD9daoXR9p5SVHfSY/ZHLBKxSd5R3Zs+PltxBjkw1O8/zeA8LdHitUfMAdPFR5OGPM9GCAy7MVZsc2tXUAHej+aHkqhYIq/Raf1/PHpxhAr2+MNFdOMhJNL2UQUWMaZKWF5gaS4p3qYuh17fqNXgZTtDPsuJZblgDukXo/CtkdJ2xhnw7sBPeioGMkBuC2BtovABg+SngAhajygiMa5OBHveZijLd05JMT1Icvg245O9DO6OFVIRW+neXbfhSLGW/p0jBvMZb3DIxTC1d8JKtn/Uv0HCQcsG+vh2ToqUXH6CT9NHDQP0B/jAHymqMa2CvKtVysULdCsp6J8kUoCrnQgIF8aACnKJzPN35uI5Ctv5Dwv9HgMy6RlOgezz5kGRUpM4kGPin4scgKjGBoo8eNghbLJW5A5oAcriszYtdK30O/LeocJR1wQkB/xnXZKU81EVCefBHhmdcsu3N/CES7mUjhBQuEPNyUWpMb6D/zCBVo+/XdsQUHjeVQ2hxebopmsniCyrICBUOT5zycjH7pVgNbgWIsTu1KLI3JjozIFiRghtl0mJ+ltA2+upw7hSnX3Vo92UbgKMnPfL3qUUQFQ== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: c6b93295-c0f1-4765-f229-08db66770da7 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 10:16:12.0945 (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: W0N3p0iF6L2seWyiDbVNGEQDp0M1EHMyZjmHXlHYF9kTA5KaDFeoqJyc5CAK4o6SiPlzEYxEv1S5zD7Fx9AXxQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7797 X-Proofpoint-ORIG-GUID: dZ-fvQ-NxKjr7Gr8ajN383tdVmlEH9uZ X-Proofpoint-GUID: dZ-fvQ-NxKjr7Gr8ajN383tdVmlEH9uZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-06_06,2023-06-06_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-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, T_SCC_BODY_TEXT_LINE=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Exec transport backend for 'migrate'/'migrate-incoming' QAPIs accept new wire protocol of MigrateAddress struct. It is achived by parsing 'uri' string and storing migration parameters required for exec connection into strList struct. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/exec.c | 70 ++++++++++++++++++++++++++++++------------- migration/exec.h | 4 +-- migration/migration.c | 10 +++---- 3 files changed, 56 insertions(+), 28 deletions(-) diff --git a/migration/exec.c b/migration/exec.c index c4a3293246..8bc321c66b 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -39,21 +39,50 @@ const char *exec_get_cmd_path(void) } #endif -void exec_start_outgoing_migration(MigrationState *s, const char *command, +/* provides the length of strList */ +static int +str_list_length(strList *list) +{ + int len = 0; + strList *elem; + + for (elem = list; elem != NULL; elem = elem->next) { + len++; + } + + return len; +} + +static void +init_exec_array(strList *command, char **argv, Error **errp) +{ + int i = 0; + strList *lst; + + for (lst = command; lst; lst = lst->next) { + argv[i++] = lst->value; + } + + argv[i] = NULL; + return; +} + +void exec_start_outgoing_migration(MigrationState *s, strList *command, Error **errp) { QIOChannel *ioc; -#ifdef WIN32 - const char *argv[] = { exec_get_cmd_path(), "/c", command, NULL }; -#else - const char *argv[] = { "/bin/sh", "-c", command, NULL }; -#endif + int length = str_list_length(command); + g_auto(GStrv) argv = (char **) g_new0(const char *, length); - trace_migration_exec_outgoing(command); - ioc = QIO_CHANNEL(qio_channel_command_new_spawn(argv, - O_RDWR, - errp)); + init_exec_array(command, argv, errp); + g_autofree char *new_command = g_strjoinv(" ", (char **)argv); + + trace_migration_exec_outgoing(new_command); + ioc = QIO_CHANNEL( + qio_channel_command_new_spawn((const char * const *) argv, + O_RDWR, + errp)); if (!ioc) { return; } @@ -72,20 +101,21 @@ static gboolean exec_accept_incoming_migration(QIOChannel *ioc, return G_SOURCE_REMOVE; } -void exec_start_incoming_migration(const char *command, Error **errp) +void exec_start_incoming_migration(strList *command, Error **errp) { QIOChannel *ioc; -#ifdef WIN32 - const char *argv[] = { exec_get_cmd_path(), "/c", command, NULL }; -#else - const char *argv[] = { "/bin/sh", "-c", command, NULL }; -#endif + int length = str_list_length(command); + g_auto(GStrv) argv = (char **) g_new0(const char *, length); + + init_exec_array(command, argv, errp); + g_autofree char *new_command = g_strjoinv(" ", (char **)argv); - trace_migration_exec_incoming(command); - ioc = QIO_CHANNEL(qio_channel_command_new_spawn(argv, - O_RDWR, - errp)); + trace_migration_exec_incoming(new_command); + ioc = QIO_CHANNEL( + qio_channel_command_new_spawn((const char * const *) argv, + O_RDWR, + errp)); if (!ioc) { return; } diff --git a/migration/exec.h b/migration/exec.h index 736cd71028..3107f205e3 100644 --- a/migration/exec.h +++ b/migration/exec.h @@ -23,8 +23,8 @@ #ifdef WIN32 const char *exec_get_cmd_path(void); #endif -void exec_start_incoming_migration(const char *host_port, Error **errp); +void exec_start_incoming_migration(strList *host_port, Error **errp); -void exec_start_outgoing_migration(MigrationState *s, const char *host_port, +void exec_start_outgoing_migration(MigrationState *s, strList *host_port, Error **errp); #endif diff --git a/migration/migration.c b/migration/migration.c index ff020656fb..f482de5df3 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -466,7 +466,6 @@ static bool migrate_uri_parse(const char *uri, static void qemu_start_incoming_migration(const char *uri, Error **errp) { - const char *p = NULL; g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1); /* URI is not suitable for migration? */ @@ -492,8 +491,8 @@ static void qemu_start_incoming_migration(const char *uri, Error **errp) } else if (channel->transport == MIGRATION_ADDRESS_TYPE_RDMA) { rdma_start_incoming_migration(&channel->u.rdma, errp); #endif - } else if (strstart(uri, "exec:", &p)) { - exec_start_incoming_migration(p, errp); + } else if (channel->transport == MIGRATION_ADDRESS_TYPE_EXEC) { + exec_start_incoming_migration(channel->u.exec.args, errp); } else { error_setg(errp, "unknown migration protocol: %s", uri); } @@ -1683,7 +1682,6 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, { Error *local_err = NULL; MigrationState *s = migrate_get_current(); - const char *p = NULL; g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1); /* URI is not suitable for migration? */ @@ -1720,8 +1718,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, } else if (channel->transport == MIGRATION_ADDRESS_TYPE_RDMA) { rdma_start_outgoing_migration(s, &channel->u.rdma, &local_err); #endif - } else if (strstart(uri, "exec:", &p)) { - exec_start_outgoing_migration(s, p, &local_err); + } else if (channel->transport == MIGRATION_ADDRESS_TYPE_EXEC) { + exec_start_outgoing_migration(s, channel->u.exec.args, &local_err); } else { if (!(has_resume && resume)) { yank_unregister_instance(MIGRATION_YANK_INSTANCE); From patchwork Tue Jun 6 10:15:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13268900 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 08583C7EE2F for ; Tue, 6 Jun 2023 10:18:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Tjq-0001ea-EB; Tue, 06 Jun 2023 06:16:30 -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 1q6Tjg-0001be-Uj for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:21 -0400 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Tjd-0006Qs-MC for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:20 -0400 Received: from pps.filterd (m0127844.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3567SD7T004530; Tue, 6 Jun 2023 03:16:16 -0700 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=sK3PZ4fsTbGSznr8MvSOIiiIpJ/1NvIquHLFEOZHPUU=; b=jABE9AtD600nlGsR5OFXWkkavzWpkeC2lZsBpHDcfsvHX9un0KDo/29q6NRlPJ4AdI5e OKsbT45cFoZ1tQ8S+bC8P/Kfl8gnlHO59uIWKwSZ5rWpSgI8qYKK0Q8r3UouslwfsKN8 iR39930M+gI1I7fPGXHiKXt6A6D6c+vhMGritaZ2eaTT8BQRX0rTwRDUoDHo7LJKW13f /W56mhdm1qBBgkbfr6p/Bh4iW1ch3/0/NJFaGPjYMbTh5QVxeJ4Sv9nNs6OXtcWogvwx A8f/1bktqTqhz0iojx80m3KVQacuooD6fbb+FF/m1URurfVCli4BDf7fcKuAv3TklGhe Lw== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3r051y5d90-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Jun 2023 03:16:15 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YToV1pkPA7h9RXQFJabIGXNAfI9LNjd2KxWeUg5FFBgWjHXmOASUXlcgZE0/99Gv9y9j29k1/eLxOC4NghqPPBJP94UWz3ZF0jF1I1FxkYkBp+e7PVbw12XelvfjQYOatb/xZnuCUeqmegOotsPRK8PTtOmy9v3SssZZwU0rDaMSBnnGxyt292uOu35gts+Y0AjSJiCIm24nFmSZIAzNDb198enpvIxvCvPXy+6rx9Q3cYWxlxRY5YQPWVrtfQT/uQ2mmUhlx8wVjNNez5R3v/1YtrdMngh3Zkkp3+bp746WqAUc1YwLFijQogx7J5n5CKzDZz3RSdO1dcjJAq2lhQ== 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=sK3PZ4fsTbGSznr8MvSOIiiIpJ/1NvIquHLFEOZHPUU=; b=O0iCqnPsz4CmsbffeQilaNTfW0GfBn6gO86ck9mlCM0jycUNSoR2ry7DQ2qmfZTJ4c9XGAaH+p2DSny8taP917JAFU/sQPsiGkiuSRjcr6iY2yi0iptxtDuQKJcS3zyxdJN1h/W3x098iL7oP5kh//hrvjg1D+iM1QG/vrJLa5mn7dXGi2GSRMpUfJ3GF1hr2Jn4k91a8dAVDzIyCsnQfCDaIwNJodOMrlBBFG7ZWgXY80JiGIPALJpd9WuzYouAFbMwOXx/bxbYO8ttQta+ZZUYViQLRCAvrCrOIg+4aAQXCDKFlbJ2A9ZWXmovA9ZSvNsYM3T4juwe7lzzl+hZYw== 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=sK3PZ4fsTbGSznr8MvSOIiiIpJ/1NvIquHLFEOZHPUU=; b=pCEuNwDWHU6uk72gFef2rDC8Zveg/NFhLfOPrYDYZ+DwHAxKbdKrAklQJ0Yv6b0Kj6jP4Mc1Bl6Y64yslL6YrIwuFAywzZXD1g1IGN1SEkzARVS6m6/Dy/iT4OcXeIFWWufR3D0+Xj5ttAhn5Ei7DqtRozk/f5vtZd7nDs0lL6ZeglEVdUa+b3V64n95qB0w6iiLZlVqYAvqQ8WKaS14hM46tAy4/v7M2URsbPr1J54iMzAVBHe0w3DAxabwSH1zBcWXUEsgYE0RI85eKv33PA3OrTob3OhtCUZ8n0i5Z3meiB2ZE9wD2O3TjZAsIwW8Ran129ntAQMW/12XwE+ZJQ== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by PH0PR02MB7797.namprd02.prod.outlook.com (2603:10b6:510:4c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 10:16:13 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%6]) with mapi id 15.20.6455.030; Tue, 6 Jun 2023 10:16:13 +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, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v6 6/9] migration: modified migration QAPIs to accept 'channels' argument for migration Date: Tue, 6 Jun 2023 10:15:54 +0000 Message-Id: <20230606101557.202060-7-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230606101557.202060-1-het.gala@nutanix.com> References: <20230606101557.202060-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR03CA0251.namprd03.prod.outlook.com (2603:10b6:a03:3a0::16) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|PH0PR02MB7797:EE_ X-MS-Office365-Filtering-Correlation-Id: fed96da5-397c-4b4c-bb3b-08db66770e98 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: RVemoj3jZgJKNqnupGl+lrF507r4fyBra0idaylovf1R8hxsLlCCFbGoIhsLjwOV/wALJaG6WYHzJSBOh4+6O/fUZXBr7cLq9Pi6FypWDG8QXjbPyJQHdEjY97DE2+PFHPK+HXhnHyAWXCD8aq3Bk2XFkTor297RFDADzSswrIDWWsacqTueGS+3vtLUnS/DHW1XqBLzAmglmhWgi1HHM6YRYkqYGgj5fTSPcIlB7x5YGqp5mnnXtzkAQY/fGFfzF9pcxoG3cXSMJHPb6l1mmWUCqRRnKm4/YpnF3gvVrXJk1Tbl1APIHviwrJDj2nupSUI+15JZEvvWBIHArOs+bckqqH7o1Gl2p+q4bFVB93yOfobNY+Jv3ugwyeEclvdaw5crOU0DRrQGuVvzzOk8nDj0tI42ag2rlYbOnWr46NL5bagL/6c0fdV1rXzfDr199DEyL88wmq1vFn0dyUCKSbahJNJ6sdPZzjQI1prSoyAlS5GxDOJJ7cctNcmMsMB2eLjUMT8H6XePoQyL2nQsoksiGMzUGN1lKBB2liUd38VaLrg7qgPAlUBJumzJN1sDv7MK9k80wNZQAnZgdIEHjOVICltDfwSoGfH85lAJN96WGqm1QfgC1Zv9jkbQFGtM8nt09lENB4sqSF9K1NliGw== 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:(13230028)(346002)(366004)(136003)(39860400002)(396003)(376002)(451199021)(186003)(478600001)(6916009)(8676002)(8936002)(4326008)(38350700002)(41300700001)(66946007)(38100700002)(316002)(66556008)(66476007)(2616005)(83380400001)(6486002)(6666004)(52116002)(1076003)(26005)(6512007)(6506007)(107886003)(86362001)(44832011)(5660300002)(2906002)(36756003)(309714004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OaHvKz4favTit/7vQO+I5Lq2JQd+aouDzOZk/FVn9eYHo/pTyWf60fPtpAfuq1CcXBPjpKeQnvpvOkylo6JErJykXGq6CKY+twTLQHsjMERBMCAGUWEYW/cMoR6QvWl3NOSESWsWbaEfv8kMv2L2pw8lEOY+cacX2Pj2K4I73mxUQE07ER5aVhunLQ28I6QMTGMOtgTvR9zhYPQyfsmZi8d6N7uZaD97x648/yqgS8FIywIzugLzFe/7iXg7S/XiA1sxqP/UWAqnr/OG2QumE8FacW8h9Ci3QYCZiVeFiY4bnHQnXb0jL6k+Y60i4H22Qns9CF6cuQnW4LnQf4xK7J/xychp0z5TLfBOB+7f5p8GN4LrvLJui5HXGJ5ZMNfykCFSKVw3g8xVe8FPHLy33+PtwSQBZRSRKQEZzO6uQkooPp2yFdTks/nxIvuG6aJi/7GfUhqFZVv5T76QGunU7NunqkeNRyJ+f8x3fyyHBQ2VzRmBflFILEmVHzRxJPrRrRxHXj+WcfqqWbhaaCJT3tvw4hXyLHXmu01SMtUwC74WRvSZroc4CYpFesHHn55lZAIAFRw0artr8LOrmhCZcNsm/FxJchGgLguY44Veu2ltHmANRBYPtW8ql8mRFiawln1SiWHKgxgMmh9nS7lrp3+CBnb+LXK8x71JkvtlINWlhrNoNd9vx+hnAxVzMXGzNoSoaJ5vz70u+bHKDfHq2wca4RARbIdtfH1zBO0pKxm52kgmf4xLHy2tQzt6Ytq2gB/nAVdC2bBGesjIUtH7SgIDkpOl9S2lZM2Fsx5V2IlaS315d3muqOyTJz3tELUw++5cOE9Xd1ikzSM35UjxiiQ5O29DbpL4E1fHJBceJGuHYMvGv9poqlCUw2uczfVM4YynPHHf3SC57l8ycn847ZO7dkeyyDebjPxvruiOTGLVEF9omdEf4hyAhq08SCB+cYY9a6DoxOXsRWPymzMl9oXKVEOpKeLdYDvr3rEbiaUQF+AB0cpK3MlfBvlIugR/jbhbCfEKSIYPC/IHrMbDAzZcbuKamNXeaorMgB9Qs/1HR1PqvXgF+x9WcmXvxRNxEroInn291ctT/08jKW3bQt8pTKGrUePeQvHAUQLFQkf6HvEmFi14o4LW4G8H4fjyG5OwsNhJ22TDVXex39KEfL6AzXPCoe7XaYHPzSB+pD3RVrWnMkG2hE1zEco5n9OFeX3m2wiug3PQxd9RvkbGxXFWLrIWWs2+0TvAXNfaz1EfgWmTIdVjHDibB39cHtYs6wehLOg65vwTyF2atgBXx2p91UM4RhjOVdNYQxhJ+QcaF+VZjA2IsGHC60ENPmmVztzUGcgj5VfM//D+ZpxQJHnC85GSVRNu2WUK+A0oL82CmozxAS4b3qZDNCzrlZzNoENtyhrQ7q0IPszCjuUba2IoWR8PVhnDnn6n5VqCH0yiQXDXciXUxF7O9vF0JR+4NIlgDGbXoSBb6/c+J4ccYPU37tKcbfHu0cZmDJtYjfEftG6BYUQoBFp+Vy4dEDN4QbJ1zdxFD8sFNsOCiZoVvmKi06RqRVaHYeDT4nNhj1V1ezwl44m8ge/zrmuZUWfa X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: fed96da5-397c-4b4c-bb3b-08db66770e98 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 10:16:13.6302 (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: VxYBXkpH/7LR9l3oj4MJyN2qPP4gp3RP6kZTvNpxnyDQGJYq6aRxR3rEiMyQw/ZgqKJWdGX04GQNp/7j3zupZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7797 X-Proofpoint-ORIG-GUID: QrbqPFszd2thx0kGL3l-T_I6Q8ihGFIP X-Proofpoint-GUID: QrbqPFszd2thx0kGL3l-T_I6Q8ihGFIP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-06_06,2023-06-06_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-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, T_SCC_BODY_TEXT_LINE=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org MigrateChannelList allows to connect accross multiple interfaces. Added MigrateChannelList struct as argument to migration QAPIs. Future patchset series plans to include multiple MigrateChannels for multiple interfaces to be connected. That is the reason, 'MigrateChannelList' is the preferred choice of argument over 'MigrateChannel' and making migration QAPIs future proof. For current patchset series, have limited the size of the list to single element (single interface) as runtime check. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/migration-hmp-cmds.c | 16 +++-- migration/migration.c | 34 ++++++++-- qapi/migration.json | 109 ++++++++++++++++++++++++++++++++- softmmu/vl.c | 2 +- 4 files changed, 147 insertions(+), 14 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 9885d7c9f7..5f04598202 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -423,10 +423,12 @@ void hmp_migrate_incoming(Monitor *mon, const QDict *qdict) { Error *err = NULL; const char *uri = qdict_get_str(qdict, "uri"); + MigrationChannelList *caps = NULL; + g_autoptr(MigrationChannel) channel = g_new0(MigrationChannel, 1); - qmp_migrate_incoming(uri, &err); - - hmp_handle_error(mon, err); + QAPI_LIST_PREPEND(caps, channel); + qmp_migrate_incoming(uri, false, caps, &err); + qapi_free_MigrationChannelList(caps); } void hmp_migrate_recover(Monitor *mon, const QDict *qdict) @@ -704,9 +706,13 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) bool resume = qdict_get_try_bool(qdict, "resume", false); const char *uri = qdict_get_str(qdict, "uri"); Error *err = NULL; + MigrationChannelList *caps = NULL; + g_autoptr(MigrationChannel) channel = g_new0(MigrationChannel, 1); - qmp_migrate(uri, !!blk, blk, !!inc, inc, - false, false, true, resume, &err); + QAPI_LIST_PREPEND(caps, channel); + qmp_migrate(uri, false, caps, !!blk, blk, !!inc, inc, + false, false, true, resume, &err); + qapi_free_MigrationChannelList(caps); if (hmp_handle_error(mon, err)) { return; } diff --git a/migration/migration.c b/migration/migration.c index f482de5df3..a5ca9e0e27 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -464,10 +464,22 @@ static bool migrate_uri_parse(const char *uri, return true; } -static void qemu_start_incoming_migration(const char *uri, Error **errp) +static void qemu_start_incoming_migration(const char *uri, bool has_channels, + MigrationChannelList *channels, + Error **errp) { g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1); + /* + * Having preliminary checks for uri and channel + */ + if (uri && has_channels) { + error_setg(errp, "'uri' and 'channels' arguments are mutually " + "exclusive; exactly one of the two should be present in " + "'migrate-incoming' qmp command "); + return; + } + /* URI is not suitable for migration? */ if (!migration_channels_and_uri_compatible(uri, errp)) { return; @@ -1489,7 +1501,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, bool has_channels, + MigrationChannelList *channels, Error **errp) { Error *local_err = NULL; static bool once = true; @@ -1507,7 +1520,7 @@ void qmp_migrate_incoming(const char *uri, Error **errp) return; } - qemu_start_incoming_migration(uri, &local_err); + qemu_start_incoming_migration(uri, has_channels, channels, &local_err); if (local_err) { yank_unregister_instance(MIGRATION_YANK_INSTANCE); @@ -1543,7 +1556,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, false, NULL, errp); } void qmp_migrate_pause(Error **errp) @@ -1676,7 +1689,8 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc, return true; } -void qmp_migrate(const char *uri, bool has_blk, bool blk, +void qmp_migrate(const char *uri, bool has_channels, + MigrationChannelList *channels, bool has_blk, bool blk, bool has_inc, bool inc, bool has_detach, bool detach, bool has_resume, bool resume, Error **errp) { @@ -1684,6 +1698,16 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, MigrationState *s = migrate_get_current(); g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1); + /* + * Having preliminary checks for uri and channel + */ + if (uri && has_channels) { + error_setg(errp, "'uri' and 'channels' arguments are mutually " + "exclusive; exactly one of the two should be present in " + "'migrate' qmp command "); + return; + } + /* URI is not suitable for migration? */ if (!migration_channels_and_uri_compatible(uri, errp)) { return; diff --git a/qapi/migration.json b/qapi/migration.json index e61d25eba2..7d4160e130 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1452,6 +1452,34 @@ 'exec': 'MigrationExecCommand', 'rdma': 'InetSocketAddress' } } +## +# @MigrationChannelType: +# +# The migration channel-type request options. +# +# @main: Main outbound migration channel. +# +# Since 8.1 +## +{ 'enum': 'MigrationChannelType', + 'data': [ 'main' ] } + +## +# @MigrationChannel: +# +# Migration stream channel parameters. +# +# @channel-type: Channel type for transfering packet information. +# +# @addr: Migration endpoint configuration on destination interface. +# +# Since 8.1 +## +{ 'struct': 'MigrationChannel', + 'data': { + 'channel-type': 'MigrationChannelType', + 'addr': 'MigrationAddress' } } + ## # @migrate: # @@ -1459,6 +1487,9 @@ # # @uri: the Uniform Resource Identifier of the destination VM # +# @channels: list of migration stream channels with each stream +# in the list connected to a destination interface endpoint. +# # @blk: do block migration (full disk copy) # # @inc: incremental disk copy migration @@ -1483,14 +1514,50 @@ # 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. For now, number of migration streams is restricted to one, i.e +# number of items in 'channels' list is just 1. +# +# 6. The 'uri' and 'channels' arguments are mutually exclusive; +# exactly one of the two should be present. +# # Example: # # -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } } # <- { "return": {} } +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "socket", +# "type": "inet", +# "host": "10.12.34.9", +# "port": "1050" } } ] } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "exec", +# "args": [ "/bin/nc", "-p", "6000", +# "/some/sock" ] } } ] } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "rdma", +# "host": "10.12.34.9", +# "port": "1050" } } ] } } +# <- { "return": {} } +# ## { 'command': 'migrate', - 'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', - '*detach': 'bool', '*resume': 'bool' } } + 'data': {'*uri': 'str', '*channels': [ 'MigrationChannel' ], + '*blk': 'bool', '*inc': 'bool', '*detach': 'bool', + '*resume': 'bool' } } ## # @migrate-incoming: @@ -1501,6 +1568,9 @@ # @uri: The Uniform Resource Identifier identifying the source or # address to listen on # +# @channels: list of migration stream channels with each stream +# in the list connected to a destination interface endpoint. +# # Returns: nothing on success # # Since: 2.3 @@ -1516,13 +1586,46 @@ # # 3. The uri format is the same as for -incoming # +# 5. For now, number of migration streams is restricted to one, i.e +# number of items in 'channels' list is just 1. +# +# 4. The 'uri' and 'channels' arguments are mutually exclusive; +# exactly one of the two should be present. +# # Example: # # -> { "execute": "migrate-incoming", # "arguments": { "uri": "tcp::4446" } } # <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "socket", +# "type": "inet", +# "host": "10.12.34.9", +# "port": "1050" } } ] } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "exec", +# "args": [ "/bin/nc", "-p", "6000", +# "/some/sock" ] } } ] } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "rdma", +# "host": "10.12.34.9", +# "port": "1050" } } ] } } +# <- { "return": {} } ## -{ 'command': 'migrate-incoming', 'data': {'uri': 'str' } } +{ 'command': 'migrate-incoming', + 'data': {'*uri': 'str', + '*channels': [ 'MigrationChannel' ] } } ## # @xen-save-devices-state: diff --git a/softmmu/vl.c b/softmmu/vl.c index b0b96f67fa..d811f3f878 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2651,7 +2651,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, false, NULL, &local_err); if (local_err) { error_reportf_err(local_err, "-incoming %s: ", incoming); exit(1); From patchwork Tue Jun 6 10:15:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13268897 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 0E03EC7EE2C for ; Tue, 6 Jun 2023 10:18:14 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Tk4-0001hy-Bs; Tue, 06 Jun 2023 06:16:44 -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 1q6Tju-0001ge-DE for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:41 -0400 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 1q6Tjr-0006VY-OY for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:34 -0400 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 3567sj3H027360; Tue, 6 Jun 2023 03:16:30 -0700 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=UkJknEcHo18Gfj0NnrrSNtzOM/CHYD5C0N7eRLRIUs4=; b=0ARGoYQ9/U1010jBKCJVqVg2eBuvIubVIM7fwgy/VOErST3ydZ2HzACstUok3ALndjBm mcuXFqraAZgoyYNzp3EROXmSNuEcpScKsOuMdFloRVR+Dhtn86A8qu9bSK1jIrUQNE6A AgMELODNTM465DtDnBrc6BwBpNjGOSN+YnkIw8YVT0MDjzr5R4A6wFAuZAU/49xFrvtF +sEiZ1o3Pp+szbhnTfEdtV+vdTUM2srAdzEhC164//k/XmB0iQ8MFISicFsbl39WDWxQ bNs6QYWyhew7C4LUh9lo5V/Fgj8ItUmUiCRe9Ih4wVp2IDb3uJAl66hcqDGJ509ykNq8 bg== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2174.outbound.protection.outlook.com [104.47.55.174]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3r01e6d007-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Jun 2023 03:16:29 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F8YUXwXYrYAPpyOdnttegYvJJVtgpvToIn4GpS9aBISYKm4KrEermOaMwCGQlDYZjbHJd2s54j57/36WxIKhEQNTSh1LRgxNvZVBsgoG6DiAdapOcj9BaHp4zmd3sO4A27axBXTJzQTj5DtQWeWxSE5yFKYu8N40RDjegnVUVdu86BX+ggVfdFRqpSwcBKyrAwTQRmYdJ30kurZ+vsSCGtzLkyEGjuvoP79KRA/8u44x7DXm/+0PHlPiOxzHdC7aHhiJYkgcJJHvaz2UVCtLPlgnTMNP+52YKEUVkvdxw4OFrZOXeVpbWp0Pk6qtysa/ok+fgOFwsBKACimdf4z4mw== 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=UkJknEcHo18Gfj0NnrrSNtzOM/CHYD5C0N7eRLRIUs4=; b=SASF0EOOL0lneiXYGjZ3pOoy4EvlR0mnAzZZbE84ypojNNzn6hxHQ6Y2hTgSZFX5r9Pyl5n7fB+iV2rFVh0hxmT19KyowBsuuhOuOy35dmWJZfQLPNsZqIio7j+IAJMCKG6qPCoL/Ltdd8YxAOEjfS4WpWFTIsowj2AUaQdqN2CwGe12X02CZ4NuY7itsQyRWXO6n5FJSwKlO8qnEVNCtvyPDfxYrdbR1CcHvQZbf2a2a9x+lgMZKeeb3YxXprHRrhiwe8pDbCSfjmGceWrgRAQy0CZa6nS/KHL5WRoISKLeDPdorM8UPhzA+59udVRxP78skfJFvCIjMRVmUvIsCw== 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=UkJknEcHo18Gfj0NnrrSNtzOM/CHYD5C0N7eRLRIUs4=; b=FC+LTds57m5TiwHmSJ+vGLnMMMNlnCgOYPZGlqjK8Mb5M4BK4hzkMkUD0/eSPmzuJFtbJ4ujRXHKyeqMbdV7TGaxaddQLXrg9PNUKkurXmVZWU/sE+cVJRUds0fb+UA1muT075zjkTxbssq6eg7iNc9XQAv170B95izlb8jIuppPH/JD/4xoLLekhB+v/ZJBB2kuGKNIRm4pEJRD57Ndvbkkd0Zzm1FBzOeyJ6ArKbz3KeQhY1jRGlcyR3UK+dt4Sde0EI7QpTEtkK9vZgykyG+1uGynN/nNnyoAxr4h4IIRNXv0tXwrUleDUVTtarMtk9k8CjArpj7K3X4yOVIUJw== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by SA0PR02MB7257.namprd02.prod.outlook.com (2603:10b6:806:db::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 10:16:15 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%6]) with mapi id 15.20.6455.030; Tue, 6 Jun 2023 10:16:15 +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, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v6 7/9] migration: modify migration_channels_and_uri_compatible() to incorporate newer migration QAPI syntax Date: Tue, 6 Jun 2023 10:15:55 +0000 Message-Id: <20230606101557.202060-8-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230606101557.202060-1-het.gala@nutanix.com> References: <20230606101557.202060-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR03CA0251.namprd03.prod.outlook.com (2603:10b6:a03:3a0::16) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|SA0PR02MB7257:EE_ X-MS-Office365-Filtering-Correlation-Id: f5784f99-04e3-475a-5b45-08db66770fa1 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: wkPv76qKdrF6IGIZdWVuVQ1m4k8aYwEWrj8pI3uKtVKTAlw6An35OqYnlX3PWWwV+dPCJtKUDT9ZgL64GOf/ITem4TQ2gwDiCVrfGM0PFFJAljp947d5yV1VdMUqc/5BCIlBgWaG8bnA19p2z/S4VxMwEO1ZkHhgSlcERIWf+OxSi6syDUxYnr1ofmJOPqhVRFuqsw3YjlcT2nQ+wKW4THG+Mzvdqf2r0RpBit7ybDoGCIZ6bwEZokEVUnMbDqk6TgrV0Fh5eskNBTyX973m5j20hCtXbAHfCnimfRtSHYFptTR1vrGYVv/lucqvnBYLgW4BuAQL/fgA+9oxYJ/fe9eDHjedzmhLc8L6H96yMOZSXNpEyuqZl+j1OfIG9PFJwKT9X3bnTouBJ4vzwv52TnnfFIUvi9csQfqA5YmRN4WoL+fvvGogIERsmcGxR01Yeomgv8RQnMciWhlnj/Dnp4HuOVFagLvlVl0DfBl4maoNcNkwLsMnDJgj+/4vl/TMi5yJ+5au8EOZcxtOhBZUt4XQ3nC1DL8JLDQnTZuYGGjr4GucVk+1GFNiUNTSqe6oUVEmWrWIz5fnoxOtwEyZ754btxbcgIWCYD8NuCWhUxSy0BZMIyGwP3fLmxY4oaNd 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:(13230028)(366004)(39860400002)(136003)(396003)(376002)(346002)(451199021)(2906002)(44832011)(8936002)(41300700001)(8676002)(5660300002)(316002)(4326008)(66556008)(66476007)(6916009)(66946007)(478600001)(52116002)(36756003)(6486002)(6666004)(107886003)(186003)(86362001)(2616005)(83380400001)(26005)(1076003)(6506007)(6512007)(38350700002)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QybFACEMhXpa/sb/XEFmMWWBmMrBTHoIIt+sDYY7tnRjHPw4ZMpk1+ToC9YGNvLzRp4JR+Gok49+XWF7DlrkKKaAJBm1CT55luII4Wqb8vd9Fx3eEBpDOyU5qVSO4D3jCJEJvZ3gL6sxo5/wa9iOQ3wOKF2EmgPtMAz40l2lamtr8LX+2HWF+bcvkGEpdeUGhhImvwJmFZDfpA8l4j0blGx//IgX2t2/poRD/3kR4Kgofw+vBzaOLqzFEusx1U38fiPvWevMN09BbpIVPQPvFCbZ9kAB64D1sbvDarfX1MbYSajpdDYoqM4XJ4Bk+1q6Nu0xM+wpxottO4fm7KlfC8lICQ8HVsow+uCg6rIvUV5wlykIPVzHEmNRCMLHnyQHmlh4htvkihsmnpgtC9Ab2od2TG5TuwqrK3QWzd9iV2pOJ2eF0CWOcO+za4HQ8lem2vvXFzKp0j0Wu61yYjEpuoYHBm96TaUmRPdxGmudC3XmBBUfVXhl8/re32SmuYOLar4w2iKaXd1vL5WHoyEmkm8+o2SOSfdCmDqWo9CixyARXYRz35lRq8iYDHUJhjlNwi0+e0ZCPBRCMn8eLF8djhJEttL/gsYX27ik5U3Oagt7Xmu4Zz4DCB7XKrWelZoZfwqv+WwM1a4e45/X57rVn9uyb+NWYZk3F3pt+3yJDjuUnHJpKzaK069U9sF1/wlzLcyR9wClEA4wnONBao16W/kEMY9cPiHvS8OXGscSRSP3HNEQx6k72/Fgqyys21e1dmnxZO8OVc5VIb6ogpBaRCa4Dkxr6pbZkmjA/nZKh3V1dqsPR2qVAMg+K7PUTqlPotR8U+LswDMXkcViASc3smZYPePwE/WXP99tmKBsiwdNvqvlE6ch5RzM4Ew8WtYKf+58x6yZHuh8Yt/uVNt8a2LGq3sULLB418ATX2qztqux+E/pl3N5n1khRPUkoqe2WuKcMw10BHwl2A3ivPc9TRv/ULdt9mTSHlAh0U+BlVULfrfxjbb3kOv7oenwAE5Ry4PBHiiwfmghn6HXm3uR2tV28RWGv2IPR2jC0GwQhLgut8GdUsGP07KlCrlw1r1xR9BMYm64zV01VboJhJPxg7yhhG27vsOsdDNtHzufjufhcZPydRSjMExqSH2VPN/xfkc6zgCKDou1nzEINPD1VdFbFWNL++VopDFwh0WpIkwdwdk8uU4eLWtGWe/OqmAE1pKslYyupqUrfEtZMIosFEEQHAY3zPGf916SmcmFO7IxguWWx+S5mBDtJI1bNSI/DWlflsv6JGu5+NFR1s9DG5ETBVc9V9ixLpaB1igs43buQhc9144oxuI7xRUGbzqJcWpK8/32ZvYkWX8UJ3Zf3bmHKWjSinOOND7XbdCks80oMQv/intBCd9/bH2fQmqbjhv1SmXViWVcrXJv01UQMwqtemAL0s+kzCOx8FskTteJo+BFYxldAIIy0JzO3FK65cTMyjol3gsZhnLBEPHz+niN5tnkrpslJyKh6thZa6Y54oqVSHWv947jHNnyoMBfg9PubNn8kCbICF9sD0RIrg8Rhni94hVs9jGq4P5zxMihmcdo1BENi9WDp7NzuRhM3fW7O3c12Yw+ulN1W9eiCQ== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: f5784f99-04e3-475a-5b45-08db66770fa1 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 10:16:15.3811 (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: BDzBAi8O3y6iZ2xi8C5DybEocl1zF3ADz2omWTnxsjGl1hbFjDFiX53uVz+hOD3oPzskyLQLTrVtFWXTWbNY8w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR02MB7257 X-Proofpoint-ORIG-GUID: RER9xy5uYW2RYpgzVnnp3i0UetZ5AO0_ X-Proofpoint-GUID: RER9xy5uYW2RYpgzVnnp3i0UetZ5AO0_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-06_06,2023-06-06_01,2023-05-22_02 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, T_SCC_BODY_TEXT_LINE=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org migration_channels_and_uri_compatible() check for transport mechanism suitable for multifd migration gets executed when the caller calls old uri syntax. It needs it to be run when using the mordern MigrateCHannel QAPI syntax too. After URI -> 'MigrateChannel' object conversion, migration_channels_and_uri_compatible() -> migration_channels_and_transport_compatible() passes object as argument and checks for valid transport mechanism. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/migration.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index a5ca9e0e27..98b797679b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -103,17 +103,20 @@ static bool migration_needs_multiple_sockets(void) return migrate_multifd() || migrate_postcopy_preempt(); } -static bool uri_supports_multi_channels(const char *uri) +static bool transport_supports_multi_channels(SocketAddress *saddr) { - return strstart(uri, "tcp:", NULL) || strstart(uri, "unix:", NULL) || - strstart(uri, "vsock:", NULL); + return saddr->type == SOCKET_ADDRESS_TYPE_INET || + saddr->type == SOCKET_ADDRESS_TYPE_UNIX || + saddr->type == SOCKET_ADDRESS_TYPE_VSOCK; } static bool -migration_channels_and_uri_compatible(const char *uri, Error **errp) +migration_channels_and_transport_compatible(MigrationAddress *addrs, + Error **errp) { if (migration_needs_multiple_sockets() && - !uri_supports_multi_channels(uri)) { + (addrs->transport == MIGRATION_ADDRESS_TYPE_SOCKET) && + !transport_supports_multi_channels(&addrs->u.socket)) { error_setg(errp, "Migration requires multi-channel URIs (e.g. tcp)"); return false; } @@ -480,12 +483,12 @@ static void qemu_start_incoming_migration(const char *uri, bool has_channels, return; } - /* URI is not suitable for migration? */ - if (!migration_channels_and_uri_compatible(uri, errp)) { + if (uri && !migrate_uri_parse(uri, &channel, errp)) { return; } - if (uri && !migrate_uri_parse(uri, &channel, errp)) { + /* transport mechanism not suitable for migration? */ + if (!migration_channels_and_transport_compatible(channel, errp)) { return; } @@ -1708,12 +1711,12 @@ void qmp_migrate(const char *uri, bool has_channels, return; } - /* URI is not suitable for migration? */ - if (!migration_channels_and_uri_compatible(uri, errp)) { + if (!migrate_uri_parse(uri, &channel, errp)) { return; } - if (!migrate_uri_parse(uri, &channel, errp)) { + /* transport mechanism not suitable for migration? */ + if (!migration_channels_and_transport_compatible(channel, errp)) { return; } From patchwork Tue Jun 6 10:15:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13268901 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 924CFC77B73 for ; Tue, 6 Jun 2023 10:18:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Tk4-0001hz-GB; Tue, 06 Jun 2023 06:16:44 -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 1q6Tju-0001gd-7m for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:41 -0400 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 1q6Tjs-0006Vx-2r for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:33 -0400 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 3567sj3I027360; Tue, 6 Jun 2023 03:16:30 -0700 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=fOLNY0S9vC4KJRdPt8Wt9uTdytokpM0oJbx9zbU5SBM=; b=PZhSjWvu5Gk8NI7KdImF/NZSvfoUlKN5yttbYKawl4uaeh46UxjqI0RFfxiHf3h7JqPG oCy/ntSJyLq3LFd3WwKQMxMjqExNvfz7hmlSvyKLP8bRTDNtDMv5juaJ3yTm1KKbgVq7 q0ILabTApcuDuEWD/UKS44fFeqFCwXZP344vYn6IFav8NMR5Ps/lGcVSeAA+qvy8QQKN L9uDnZHtAzFrYjdiB5Y9kmkClq+70lUxy+dCK97k+FZGIZTu5jWrV27TrZBr95C6z9ki BVSmNeF69gwcmRcCtA938eThcIVNMUa1wvEP9IyTxj3cyi4fpx/rW6rMKYYlbbxUK7+L cw== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2174.outbound.protection.outlook.com [104.47.55.174]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3r01e6d007-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Jun 2023 03:16:30 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UdD23Ntxku4NovMzQRV6/nRrTh4GMaEqJRHKRJUQ7JxKo6m1bwcvV7h8IBP/507qbnKNTxTfpjCq48y2QXJY6auTXlsvPjTUSVRqpt4oRKUlEhRvx/g106vSVNdAplDdzWt5oDHIQWjdZqBxD6eHDPfK137ReTFS0d8RJJX3kEHvKoMIsq0crOg7h37PqSdBWhhoLT43JAgJwxem5629lun2aAW1Shep5TZCVBUT03wzWjRU3r1irH82vQy3ZHcNwhB8/O5rQtQjn9Z56gqP9oyboUbLlNcMoWr+QNqtg83LrGHKO1hOu/xJtR8N1Qpy6HMi6ZVxHjdqaYvwhGxIgA== 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=fOLNY0S9vC4KJRdPt8Wt9uTdytokpM0oJbx9zbU5SBM=; b=UYSaymJZbMnyNqPryHY0ULSwhXeJpjfHIgjOGy3oKiKatfWom+LRkw7Km+wQ05XRVLoeugsE897NhS7Q8dclpv81KZctE+N408acYZwgSBDb3+ver8m9YLtFrQQoAcqfOHi3Ntub483wdyLGLId5arLNtrvlr2TeGb8FA3ttHhdXC/QRfOMHRQLYeKh4QMoKNUo8Ptrzzi4Tw6OOT3SZgXjHdHQ4RRI/Zmkv1J1ORV71qxRo48f7pcIl4aAHnOhDZhyYEsuE6bkUbWKqec4KmVfJRF4oOUhgpt1l9EM3o77MtwxdCzFR7imJptE4eGxUUI277eJAJGgEpho2LcFWVQ== 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=fOLNY0S9vC4KJRdPt8Wt9uTdytokpM0oJbx9zbU5SBM=; b=fmPlXlJn0R2rjWJub1qQ+RJleWRuPT3EVdyRRz5RO7g6WLOf4vWQZ4SUtknSrqVSkU9khu/cReRtAdG2ZKiGMDirrawkfkNL4j0Uij1k2FKY8EEdy7T+j3o58QW2SlHoEEwATOSwnsfYlDxt6gfzymdsNMLBF7hzkifsVxPzvnezUseEuqCDS0rv+/xAxKSK6U78rbYBCNvqfPGdVCdf7GHIpLQL/Wg2/fPK6k80v7qUKAPUlhNEzOtMboCW1k1Dxh8IWa18dcv4lziWjwvES6ZdA2bg8YaEfd8NvcL2P7yNZpa7+H5IiIZvZ+iEFw0xjljAke3GWqzuMyYOcSmymw== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by SA0PR02MB7257.namprd02.prod.outlook.com (2603:10b6:806:db::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 10:16:17 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%6]) with mapi id 15.20.6455.030; Tue, 6 Jun 2023 10:16:17 +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, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v6 8/9] migration: Introduced MigrateChannelList struct to migration code flow. Date: Tue, 6 Jun 2023 10:15:56 +0000 Message-Id: <20230606101557.202060-9-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230606101557.202060-1-het.gala@nutanix.com> References: <20230606101557.202060-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR03CA0251.namprd03.prod.outlook.com (2603:10b6:a03:3a0::16) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|SA0PR02MB7257:EE_ X-MS-Office365-Filtering-Correlation-Id: 796df2e0-4fec-4e54-869b-08db66771094 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: ihB8VNNFbnD8s5kNBj81WrQoKg/WYwSC6yJxNG0EtM8/LcRwqnMHhSBiMfN6QOZvZVMW3tkCckDOXVer5eP5TfX0v5lTzK41eu02Q5j3QTdgZ0MQZLjNEhzZZGbKYDUzmX4iqnyPjKQMOJ6cNlgyy9kfqigBeWq0BOm+lH4vGI3nNo+DaP7QwBqA2F3bsYNPgxOGUH5tFSAMFc0gx4JRLAk+mDwQueT9yahc+VO5MwwCfqds8ayVoqrYwH/c+3QPbzuL+eRhhFJX7GjiTIL6njsEZc37PmDtAYZjKgKatZVc/LVXWw+65aVWjEkqq02HPzlyd8gILi95q/AJgBElsDVtWK5J88EkpOAJUDnCkJD4N4REgs9qPe3EHYW0Etisc78A2e4tKCHuCNQhIkuCelwqxOKennlMnyOM0reEduGTVn7tSvRz0WECAc/si/sQv6G3CR6ws8Uo9p1C7STctBJgMTgiGAlyZH7AIJ1htktbM+sGBlklX7y6u8jBlke0Ql+CBtF5QLHISVTRUOaur/D5UjVMKqW48vJUr04McMcBxuT9wvXD0PHrRcYIn3KVKaKG5sQSugKpBoah4DzTtmYj/Fk4qyUJDqkcrwfsG2kHiKLB51VeBzJXZIfTpJxz 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:(13230028)(366004)(39860400002)(136003)(396003)(376002)(346002)(451199021)(2906002)(44832011)(8936002)(41300700001)(8676002)(5660300002)(316002)(4326008)(66556008)(66476007)(6916009)(66946007)(478600001)(52116002)(36756003)(6486002)(6666004)(107886003)(186003)(86362001)(2616005)(83380400001)(26005)(1076003)(6506007)(6512007)(38350700002)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jsraeam1+0iafcHhOGfC9iA/9yf4sNQHRWVftfz3LPJ0JTk+mVljeeruajUezfSx1rq8egZ4oe5sFGUQizIEPM85HIPkn/35n26pLZa4JFC9Ow4lfQIrTWNCEhkGiyKJuIDiGT5HR0E9c0z+oqBDAqhqWKmo8tzIOO6ZHzLgkxQY+Dk36e1uBltuSWnG9saYTiYP/qlMEPSnU34hNJlU9oowzhDFi7HwF9QmaLoitKvRQMlHGxuxrchEx1L0firTq6ZiGhOtRrWZYpoS8ITWqXN4sXeiBtT0o55b1NaZtCGGAlUSor3pHph5fNSIn4teikLbspuiagSc0T9Dn3vDCwP+vwE+gZTU1Yi7ntcU5PTE4Zr9eruL0UOxdGJULhz7a6ZpUT6gMdgYEUK1ZE8nBqkJvasOM4NqF3vSoqAPoFQpdnUUwGh44D7Puwo+WyLDUu4wU8cNhVjkbnaMFi8c7lOlJre/NBl4Bqab8M0h/O6h47L8NrINyYIZzNOralid5T0/ooZTr2eE/7B1Cy2fEhC4oO0iqjgWuYl3eWvb2SDAb1uA7zwS9K4052jBa/KYjOac+EHzgx/Y1iY19p6/XpXex63It2Y3/7hocIfkc7dl6McQGMvYXIsgogICQHdyOfG0bRCkentjDn0UUhKuse9XuXYbdzbk0stK2i7zp981RXKWIkynV07HoZMzORsJHYqiyU4UVB52DbGD05fmvuj/cwl1WY2eGs41naBBYdid6JCdKAj+uL2da0zpEbFkW2c0MlTaDmfDbCZ2eWe9PAX5dRJbc51msvnMrN8a+WDZip4K4fSyofy5kphannwVPNJsUS2Ba5B4SNC32NqzqyyRvxxQmJTxYmAVY7iqxQlZRCg+2L36I1pJ//RfAj0uwVj0kzg39+icZAGnogpYdPN3zwJNhn3AvVKVUoS0mvIkkDaKIJZAOmKQptjyQ0rXWxjFY1QNQS39pffvviqifSTrABWieXyxhvW1NOa4ikpmV1DFeTpvaFgNvHYlXp7i6Uq4AdXtboCkRnQDsxJNUr2U+ckC23LcLltL5W26m4Hvn7ErM7N5NOgqO/N058UQIUD27v2hu7eEbRvQVd0a+uQXYq8ywppLhIcCdWLQ3eF3artO2Vi+Raeavl4uB5Qtciz04DSbiYrVegYeCAhGqMcZCSOePZlcU3mPhnseud/5E2JwCHCeZocxzgnTRJm551Mfc2BmiSoah3xcOs0oMaFA4NMU+5WmcxtcEYTfETJ+Scv147D6Lel3b8939AqwW5A7f5N0I4FeebfqHkbUqYpcYXgHoKVBzV97BA3j6R06rUsFiwB74folh7bC+5LT79d6VXdbzJ/RAZ/po/qxbLRZURjNuEFc5z3h8gS/feeMiN6ThwxBjrL9ohixMSWngoZiKRSMeVMrtDkisDOu5XqXezmEs3cJwg5BwZcVYYINEBZBPRqJL997TmHk5+aCZ/siuHsF+W9XqoX6VsTDEjaungikKzLmLgKdCoRIrbJwj1lz7XfCjIFJxQFdSk9hBEIL7S5RVSfdkR/DVSXQ6K+2qrG0nCs91KquFouHeCV3Mz9au0RR5XqDFjyFAiZW X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 796df2e0-4fec-4e54-869b-08db66771094 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 10:16:16.9655 (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: b+wyq49y13van5ayQIruuUxTEXjVUdx1ZyZomk5AJjbb+LEHd3pKdt4LMV6qYU3H08ArUojdiHPfOudNlB7MNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR02MB7257 X-Proofpoint-ORIG-GUID: dAGSU62W9dgMDPI2JKJ6ui4EtsWyFRwh X-Proofpoint-GUID: dAGSU62W9dgMDPI2JKJ6ui4EtsWyFRwh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-06_06,2023-06-06_01,2023-05-22_02 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, T_SCC_BODY_TEXT_LINE=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Integrated MigrateChannelList with all transport backends (socket, exec and rdma) for both source and destination migration code flow. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/migration.c | 77 ++++++++++++++++++++++++++++--------------- migration/socket.c | 5 ++- 2 files changed, 54 insertions(+), 28 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 98b797679b..9a0aec3ecb 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -425,9 +425,10 @@ void migrate_add_address(SocketAddress *address) } static bool migrate_uri_parse(const char *uri, - MigrationAddress **channel, + MigrationChannel **channel, Error **errp) { + g_autoptr(MigrationChannel) val = g_new0(MigrationChannel, 1); g_autoptr(MigrationAddress) addrs = g_new0(MigrationAddress, 1); SocketAddress *saddr = &addrs->u.socket; InetSocketAddress *isock = &addrs->u.rdma; @@ -463,7 +464,9 @@ static bool migrate_uri_parse(const char *uri, return false; } - *channel = addrs; + val->channel_type = MIGRATION_CHANNEL_TYPE_MAIN; + val->addr = addrs; + *channel = val; return true; } @@ -471,7 +474,8 @@ static void qemu_start_incoming_migration(const char *uri, bool has_channels, MigrationChannelList *channels, Error **errp) { - g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1); + g_autoptr(MigrationChannel) channel = g_new0(MigrationChannel, 1); + g_autoptr(MigrationAddress) addrs = g_new0(MigrationAddress, 1); /* * Having preliminary checks for uri and channel @@ -481,20 +485,29 @@ static void qemu_start_incoming_migration(const char *uri, bool has_channels, "exclusive; exactly one of the two should be present in " "'migrate-incoming' qmp command "); return; - } - - if (uri && !migrate_uri_parse(uri, &channel, errp)) { - return; + } else if (channels) { + /* To verify that Migrate channel list has only item */ + if (channels->next) { + error_setg(errp, "Channel list has more than one entries"); + return; + } + channel = channels->value; + addrs = channel->addr; + } else { + /* caller uses the old URI syntax */ + if (uri && !migrate_uri_parse(uri, &channel, errp)) { + return; + } } /* transport mechanism not suitable for migration? */ - if (!migration_channels_and_transport_compatible(channel, errp)) { + if (!migration_channels_and_transport_compatible(addrs, errp)) { return; } qapi_event_send_migration(MIGRATION_STATUS_SETUP); - if (channel->transport == MIGRATION_ADDRESS_TYPE_SOCKET) { - SocketAddress *saddr = &channel->u.socket; + if (addrs->transport == MIGRATION_ADDRESS_TYPE_SOCKET) { + SocketAddress *saddr = &addrs->u.socket; if (saddr->type == SOCKET_ADDRESS_TYPE_INET || saddr->type == SOCKET_ADDRESS_TYPE_UNIX || saddr->type == SOCKET_ADDRESS_TYPE_VSOCK) { @@ -503,11 +516,11 @@ static void qemu_start_incoming_migration(const char *uri, bool has_channels, fd_start_incoming_migration(saddr->u.fd.str, errp); } #ifdef CONFIG_RDMA - } else if (channel->transport == MIGRATION_ADDRESS_TYPE_RDMA) { - rdma_start_incoming_migration(&channel->u.rdma, errp); -#endif - } else if (channel->transport == MIGRATION_ADDRESS_TYPE_EXEC) { - exec_start_incoming_migration(channel->u.exec.args, errp); + } else if (addrs->transport == MIGRATION_ADDRESS_TYPE_RDMA) { + rdma_start_incoming_migration(&addrs->u.rdma, errp); + #endif + } else if (addrs->transport == MIGRATION_ADDRESS_TYPE_EXEC) { + exec_start_incoming_migration(addrs->u.exec.args, errp); } else { error_setg(errp, "unknown migration protocol: %s", uri); } @@ -1699,7 +1712,8 @@ void qmp_migrate(const char *uri, bool has_channels, { Error *local_err = NULL; MigrationState *s = migrate_get_current(); - g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1); + g_autoptr(MigrationChannel) channel = g_new0(MigrationChannel, 1); + g_autoptr(MigrationAddress) addrs = g_new0(MigrationAddress, 1); /* * Having preliminary checks for uri and channel @@ -1709,14 +1723,23 @@ void qmp_migrate(const char *uri, bool has_channels, "exclusive; exactly one of the two should be present in " "'migrate' qmp command "); return; - } - - if (!migrate_uri_parse(uri, &channel, errp)) { - return; + } else if (channels) { + /* To verify that Migrate channel list has only item */ + if (channels->next) { + error_setg(errp, "Channel list has more than one entries"); + return; + } + channel = channels->value; + addrs = channel->addr; + } else { + /* caller uses the old URI syntax */ + if (uri && !migrate_uri_parse(uri, &channel, errp)) { + return; + } } /* transport mechanism not suitable for migration? */ - if (!migration_channels_and_transport_compatible(channel, errp)) { + if (!migration_channels_and_transport_compatible(addrs, errp)) { return; } @@ -1732,8 +1755,8 @@ void qmp_migrate(const char *uri, bool has_channels, } } - if (channel->transport == MIGRATION_ADDRESS_TYPE_SOCKET) { - SocketAddress *saddr = &channel->u.socket; + if (addrs->transport == MIGRATION_ADDRESS_TYPE_SOCKET) { + SocketAddress *saddr = &addrs->u.socket; if (saddr->type == SOCKET_ADDRESS_TYPE_INET || saddr->type == SOCKET_ADDRESS_TYPE_UNIX || saddr->type == SOCKET_ADDRESS_TYPE_VSOCK) { @@ -1742,11 +1765,11 @@ void qmp_migrate(const char *uri, bool has_channels, fd_start_outgoing_migration(s, saddr->u.fd.str, &local_err); } #ifdef CONFIG_RDMA - } else if (channel->transport == MIGRATION_ADDRESS_TYPE_RDMA) { - rdma_start_outgoing_migration(s, &channel->u.rdma, &local_err); + } else if (addrs->transport == MIGRATION_ADDRESS_TYPE_RDMA) { + rdma_start_outgoing_migration(s, &addrs->u.rdma, &local_err); #endif - } else if (channel->transport == MIGRATION_ADDRESS_TYPE_EXEC) { - exec_start_outgoing_migration(s, channel->u.exec.args, &local_err); + } else if (addrs->transport == MIGRATION_ADDRESS_TYPE_EXEC) { + exec_start_outgoing_migration(s, addrs->u.exec.args, &local_err); } else { if (!(has_resume && resume)) { yank_unregister_instance(MIGRATION_YANK_INSTANCE); diff --git a/migration/socket.c b/migration/socket.c index 8e7430b266..98e3ea1514 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -28,6 +28,8 @@ #include "trace.h" #include "postcopy-ram.h" #include "options.h" +#include "qapi/clone-visitor.h" +#include "qapi/qapi-visit-sockets.h" struct SocketOutgoingArgs { SocketAddress *saddr; @@ -114,12 +116,13 @@ void socket_start_outgoing_migration(MigrationState *s, { QIOChannelSocket *sioc = qio_channel_socket_new(); struct SocketConnectData *data = g_new0(struct SocketConnectData, 1); + SocketAddress *addr = QAPI_CLONE(SocketAddress, saddr); data->s = s; /* in case previous migration leaked it */ qapi_free_SocketAddress(outgoing_args.saddr); - outgoing_args.saddr = saddr; + outgoing_args.saddr = addr; if (saddr->type == SOCKET_ADDRESS_TYPE_INET) { data->hostname = g_strdup(saddr->u.inet.host); From patchwork Tue Jun 6 10:15:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13268898 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 0C0EDC77B73 for ; Tue, 6 Jun 2023 10:18:14 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Tk1-0001gG-Ue; Tue, 06 Jun 2023 06:16:42 -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 1q6Tjo-0001e9-Rn for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:28 -0400 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Tjh-0006So-Ac for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:16:22 -0400 Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3567WVsp006549; Tue, 6 Jun 2023 03:16:20 -0700 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=eydsa4hC0jOC2V+eZqnR8wCdR56OPO80b+vFC6rbpg8=; b=Cho+EdCMKNGVKK+X9dkI2SwOeiIuIfnexO8N7imYERHNHARMAsHoEsl1hL8r7li+eHq0 F+ShspvkLZsuLmNV4nELCFpFTBYVprBKh7Au4r56r4CivKnz7NsiIlNIgzR2WrHWZ4RW E96LJqDfloXJGQr6FsOyLe72beL7YiQ/MGeJ/JhY330HMPLvM8QnJdgKBv9RqZCUrPN5 Br1OjDkqjqW+mhDlBPlCO9Z/VRWMBsh4O0FJu8rFBjjH0kU2/50X7yIdojCdeSaw3d3P PNoNB7+mehiMnE4HZ6vzubrDu0ZH9MZo5aBpYJhxeiL4LeA40LoOeIJp7V6ntz7wvnPc rQ== Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3r04ucwdmr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Jun 2023 03:16:20 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FAxpE7Fjp7GAuBavVzOwSR55ctULSusbdYx2aPNPmuIEamiYGTFg7ggVL1jY6NZhOoLqH4bZ36xCo3Mjz7kU7chZBRNN8z1Ux3koOJBZX6VeuSIlHS1PZCYpRWHdMAcZhVCkcalniyGcS6PUypt44q6nL+mK4Dh++gDmDAsTGS8F5NPtO1XX6/4EF7Pj/5ux/Bzh68KnYlhaZXrwzB/aXJGIP5JUQ+5cQxD/P7jZ0IoOBG3DVH+BLVw4TYgzClmJKw5LQopoxI6+XpzQk5A7bDbhzxF/dbbwpZZjSSBb5VxKhiJB8vwnFJbLzRVYHE0Sgv5b8mUuMj30oGNqqhbAXw== 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=eydsa4hC0jOC2V+eZqnR8wCdR56OPO80b+vFC6rbpg8=; b=fI+H8Lzq4eI+7cedeVeC8ziAD3svrw+yDVNirQe8Gx1O9FsTq4zaAN9S7NxrtF2ZIXkaATNWyYl5VIqOUi2NUQ4pcoo9UCOMh2XdmD8ZKrmdO2NPs5UzgtQwCftY2CYwOdNDfMsztaiGbOQoM57syC2cRG2mzPjjLU69pOeMozmPxVibn3ZTtsuXNYnbtCoOb/BeaDkh6wieUmGRS1c6q7NrWhKh80lxbythRIE1SP3RKQhB6n8jks7sCFhx88jYt8xCfgCKbm/8PV2MDGni0tE0Gg5wMmKWLNMp8Tz16FCSoYbVqfmOdRvKXeI8B212L8XuPzjzU0gv+idGvM+oxg== 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=eydsa4hC0jOC2V+eZqnR8wCdR56OPO80b+vFC6rbpg8=; b=WFxj8Yo8mjGNZTrMNSVvL5xYY51JQknBUmM2McombTyQSQFZiNXM/LoWzT7DVYV0efrQzN2S9147z9r7kpMXLC+jXY7Y+VYT4untxSRKNWt8iRzezKegN3h9gTq6Pq2bVpyNg6YqSg1Wp9q1CUpsTHlluUh41h9RNAGjRqnWylTqufRbo70Btk4kQ5o6HLGfXFHf79ZYnuAH4sOPM1l6wMUNNRGfBpg9x1ivBjiYuEj2/TEY6JKKVQdH5aZFLWsg+a0IdSj8dCnt4PWOXIosza94UK290PTYY/F6rwQUxsSD26OYYQ946RPc2AM12oxInK/9VKFPVlcR8ZCgq1vR5A== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by PH0PR02MB7797.namprd02.prod.outlook.com (2603:10b6:510:4c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 10:16:18 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%6]) with mapi id 15.20.6455.030; Tue, 6 Jun 2023 10:16:18 +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, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v6 9/9] migration: adding test case for modified QAPI syntax Date: Tue, 6 Jun 2023 10:15:57 +0000 Message-Id: <20230606101557.202060-10-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230606101557.202060-1-het.gala@nutanix.com> References: <20230606101557.202060-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR03CA0251.namprd03.prod.outlook.com (2603:10b6:a03:3a0::16) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|PH0PR02MB7797:EE_ X-MS-Office365-Filtering-Correlation-Id: 1618edfc-b6f8-4443-641a-08db66771179 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: y+QDcOJc0i2isC8ZmNW/zVrmfcroyh56lBy10j46wkqz5NxZyfwuG5oMCw1BchsSU2wnp2y4MV283uk81eJja+ymFMiFUhsyy78zIcrxefVfysq215+SwNboqVSdizXy74hnZwxCOyZyFhajJ9t3rZ1dYzPKgx0UAFIQyPW46QDWum6twcRDeh4FQKI2dl90xeBD9qNug2YKvUlJvGfSXHb1bxkgLMIWSlCUz+hfbwmxYR2UPjjx5pLd1i4SU6k0gNyLepnZ/q5F1Wgx5KVi3VgNZ0SmzoavtM+2Dbr5z8Uq9YMHnoIG2EbzOhlhoDTQk7XOS7QpPtkm+pLoOco5W4DFSYXzDNANcB8s+fIHWDFKlTqiXOn7RxPI4AzCCAM9ZKs0CsAzFHoTuWPJ8OB+3SX674uVXU05cEv0s7oNLV7K5iYDVZ90Nf+VRUl9jFm0/DBuCMusJlrJM4+QQZsU0zFnz3fFr5Rv20S1HvcpkKLQ/NZ1DZJc9Gx+89yhA9fmzEa8yTuWnM93z2WRG94cGPpJeHri73/QVA8dA8k/trzQlFydKE2PS+A9fhkgMyGYAg2lJKipp6vQGSOmkFZAQQJTIGvmZ6QcKI+fiPzgVYbLDeX3RVtGTlC2uuxH3G90 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:(13230028)(346002)(366004)(136003)(39860400002)(396003)(376002)(451199021)(186003)(478600001)(6916009)(8676002)(8936002)(4326008)(38350700002)(41300700001)(66946007)(38100700002)(316002)(66556008)(66476007)(2616005)(6486002)(6666004)(52116002)(1076003)(26005)(6512007)(6506007)(107886003)(86362001)(44832011)(5660300002)(2906002)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mxGW2+Jj5lLRprsNWESut972m7v4Uz4QtTLXHp3k8mFVdqAV4uWHTRggzf+iNM5DIl2tV8jAcHI2Ddpj5NHAk3CIw+xBL7stkK2/KHvUq9Y6uO4Ut8hivnObHEK+RovSwlJRr9N6u1M6VFlL/wqx8lmuWiRk/cy4rvL1CE755IQHykWn29QskgninQHlHkqWFeBKfOMPDfSMMU9vnmR5ibqVozC3a5/ToAbuhgTVd/7VkstRSdcffAg4rQVe7hxUeEmvJDC6PWGKcJWZZWknWeZpk80Pp9cDWfIHSojwQTK7w1lG8NMe+LGRktcmct4wZQPLk5OWo0F0Mopxc8YL+Hp2VoWQjJdu8MaenLPik1bcg3ru1fXxGgpQnIn+lwEk841rFhj87S0schfQeaxz/coIyTEO1257wjSU1gV5T9v9LpAFT0y2hpBX3fC4EnVllv63SCm4UrqPlG0XKOG7sGnjWHYsFZlawok0i6B3DnMwOJbKO/lh99xL3zzlw+aiMJmKLYXuOxKdLfniUBpjCv6SnIN0o9TsWZveeqxjDjYwKbsLpKluKwt+A+7JzHeo2znwZIpce8K/2EVabu4NNDRASksHvkW6f25t9UkyhwmqrsEsmaAMI6FbnTUftFwcW/pOUyPDWSZT6i3GUxnwN0EI39imEIa1srkOh8DteqV7ymE7TgYt+fgPlLrWm2D5P/bASK4fkLBmMHBy2wR5aqb436dEiW17Rce33qRw35Qu+GrBJ9RRRiWUVk7FeZ6gRtzGO+CD1HVgeRSV2kwsdS1PX8WyxVIAVT38zhJk7XCouATTk0pohA1YDkw1PiViLzaixVk11SuMA6KLYdkkpI1nF4GKK03uIRaMbYlzIxTTAVrpBHKUclDdJTQ9X9zSZOI+C1Rsx0h4hiz087M+f73AoCyTmZfypsv8jkJprLTt8zEMTIM1kzWyrnL4ZXUHjUMnXpkfoDOHN1M3oebSRFOHx6L58QNDLW7C8wKcyL4+zMOYsRM8TEXJGHhoM1lCMcq28Axiivcqp2ZAiTNfqBBIaD0hY2OVy0br6bzgDUp3HZvJ6mefiijt1qlUMbBI6qnOf7aodyKSZxB8qfodGO/B/xamFz7xhaopGfg9FG75JSYrlhCuWwXxtm3UNaDsBc0jNZoZrrwIuA/BRHVOF9SG9AMQefIrytlna8V5eqmxWQGaOEs7LLkhwBC34tZ7YEcQKduhLnXeenQ7wivTVTatFiDGwUiUUBn+D3MokWYbanZSVunDI69N6mVIKeThroqNv+BF/KadU+P3yzB7s8Ss4R7OxLibM2hs3B9BckX7vuHSSdV+/VBgWzlq5hWHZnrU//aKrj846V4avEJQC8yvbNO0fkQnfH2vAt4JJWKpZRQuAXmZLpXQiDvPTqvuNk5BY7y7A79JzNJb36v0wimBPFXtFTVSxm4GieWgXZb4veDj0QhjVKF9+1bn3CiH2ldYno69sRLsvecH3aR14aJWSPRYros5pvrFwJKxGTcCeu2/N1YN0SfJLhfEGABwQZd2/8X5xMKn7iC0ONozO2A9FeUjAi5LZ2O9ujDsDhHPdlM/SwqtTgxrMIDcVYCY X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1618edfc-b6f8-4443-641a-08db66771179 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 10:16:18.4783 (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: VGVnpMDyCQQPPLDQRpYPwJR0feydXLgqDK0N5UGbhjQuAG6adyGqevb792g+DcGGTgYCpRIdMthfnIEloJh2Bg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7797 X-Proofpoint-ORIG-GUID: ig1uTxnJ2HB3_q_f7JxLIDJ3WN_fn3pd X-Proofpoint-GUID: ig1uTxnJ2HB3_q_f7JxLIDJ3WN_fn3pd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-06_06,2023-06-06_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-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, T_SCC_BODY_TEXT_LINE=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Adding multifd tcp common test case for modified QAPI syntax defined. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- tests/qtest/migration-test.c | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index b0c355bbd9..310484f6d5 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2059,6 +2059,32 @@ test_migrate_precopy_tcp_multifd_start_common(QTestState *from, return NULL; } +static void * +test_migrate_precopy_tcp_multifd_start_new_syntax_common(QTestState *from, + QTestState *to, + const char *method) +{ + migrate_set_parameter_int(from, "multifd-channels", 16); + migrate_set_parameter_int(to, "multifd-channels", 16); + + migrate_set_parameter_str(from, "multifd-compression", method); + migrate_set_parameter_str(to, "multifd-compression", method); + + migrate_set_capability(from, "multifd", true); + migrate_set_capability(to, "multifd", true); + + /* Start incoming migration from the 1st socket */ + qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," + " 'arguments': { " + " 'channels': [ { 'channeltype': 'main'," + " 'addr': { 'transport': 'socket'," + " 'type': 'inet'," + " 'host': '127.0.0.1'," + " 'port': '0' } } ] } }"); + + return NULL; +} + static void * test_migrate_precopy_tcp_multifd_start(QTestState *from, QTestState *to) @@ -2066,6 +2092,14 @@ test_migrate_precopy_tcp_multifd_start(QTestState *from, return test_migrate_precopy_tcp_multifd_start_common(from, to, "none"); } +static void * +test_migrate_precopy_tcp_multifd_new_syntax_start(QTestState *from, + QTestState *to) +{ + return test_migrate_precopy_tcp_multifd_start_new_syntax_common(from, + to, "none"); +} + static void * test_migrate_precopy_tcp_multifd_zlib_start(QTestState *from, QTestState *to) @@ -2097,6 +2131,15 @@ static void test_multifd_tcp_none(void) test_precopy_common(&args); } +static void test_multifd_tcp_new_syntax_none(void) +{ + MigrateCommon args = { + .listen_uri = "defer", + .start_hook = test_migrate_precopy_tcp_multifd_new_syntax_start, + }; + test_precopy_common(&args); +} + static void test_multifd_tcp_zlib(void) { MigrateCommon args = { @@ -2778,6 +2821,8 @@ int main(int argc, char **argv) } qtest_add_func("/migration/multifd/tcp/plain/none", test_multifd_tcp_none); + qtest_add_func("/migration/multifd/tcp/plain/none", + test_multifd_tcp_new_syntax_none); /* * This test is flaky and sometimes fails in CI and otherwise: * don't run unless user opts in via environment variable.