From patchwork Fri May 19 09:46:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13248127 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 E750BC77B75 for ; Fri, 19 May 2023 09:48:34 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzwh1-0000AN-NF; Fri, 19 May 2023 05:46:35 -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 1pzwgx-00009H-KB for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:32 -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 1pzwgu-0008RH-Sg for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:30 -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 34J5ECPH005134; Fri, 19 May 2023 02:46:26 -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=PWv0dLSW9skaAjax9Lvcd+8+cGRLygn4rK/llLhQdJQ=; b=e3XoJU049PEQigJlbYfBBHzHaAxc5pizBaMUCHwHPMJdgx30xZbHWZYOmxg8ZY3Koznb xXv2e0+c0KqRlTj0rwzoKnXDotcE4YDDnOY/gRQn9eR/DDuCD2Xrc2RtOUThQvwN815F AcpYvS6AcM7VQA316c83uwsMFAbUwlZ6eHrfxr/7ZSBGiLsDoCrlfUF06gOpmRo4zXwD QcK2QG0H5gcpBRRLfMsJTsQUp3vGjhObvPUE9mhesTqWh7LffpbkXozL64d42L89TUl5 8nNhVzCeDZBFEEVcJNQsYGtY/CNeZYk/5JHPUSOOje9CYRzoo1ctmfML9EeVAiBvvwE3 WA== Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2049.outbound.protection.outlook.com [104.47.56.49]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3qmw0vda29-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 May 2023 02:46:26 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZuJ4tiHAjAPSdy7MIOTm7fyexd9Y4dwf071ghQSlDp9Z+bavQ+U5Ufy/JibWqG0S+KaAboDcNrmBbFLCGDHXA1jE68MifHLqHz4UHTLdokB6IwVNPaaGQmQjCBZqmpAnUC02WUkyVtUDTvyK0raf/lv1pG5TES22TYGous6MWLe5dTIFRk0oNNlIzq0obhHfMz5JpXHz1JNWMy6SBJO8FcdgDGk3NUbSk/dAtOvQFy1z9gYbnoE+v9K7o182fagToPYCc5Mt5e8t97G+GhNxYHFWE5SzzllwHWsxrqBa2P69tfiFKa4qc01okP8XOJysLJJS0uGBjVMtEh79m/6r4w== 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=PWv0dLSW9skaAjax9Lvcd+8+cGRLygn4rK/llLhQdJQ=; b=Y7xg3ew4hBrOb6I0b0EET6pavhHrsjSpLbFP5x/Jxlpbv+JYeMit5RnkxxqQ9S9+xmqlEKCeXwHTFLp/Y+b7CUjfOBuFYGgpJFG1xJ+5xSwhI+enu6lk+8Op2ZXbDyQEICIHW5psmQoiA9DlbIZoY7V0amwfeBdV7Cy6vee52TrQcvDQBGpZMPDggexUwtfeJuPwow0aa08Mh5PKl+rZkttwRwchEDfS7pec5hpx2QO3sBBQdWkaZuKcrSn1+wl8alHQM2Shw7W+c5STVkKupuuqes4TMWQ3VO+Se3UKZJzZ529gJP0bzHqGHXYJdrGBt+n5k8+Tv84FGnX0AiqAjw== 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=PWv0dLSW9skaAjax9Lvcd+8+cGRLygn4rK/llLhQdJQ=; b=RQhOxibmIPJnXjlaWYNuw0mPXTrjlgRn9Yhf/qCGFlO+FYpAx/wxiOu/FeGthJsMaCo+j+EsGkz4f62lwPxcAT2U3LiwZZ6YtNGS4mwwufVO7CA3mZzkAFz/lbXYaK4zoz4lW9Tec0LAxmcXUH7+YUrTyFLnrKM480izKrqsnBzc4WiX2K33GF2HyRGIsX5NOdgMX9hRsolm4+dgPafJSNzMVdqOEbUj/m2lcFoa8T7EO0GCDdwU3+c6YZ3SYNU6LVh7rnBFTi/WeCCNCN39/PpKuE2gqmuVuosyB8fDPqEobWCQgdkhk4XEEFAri4ZbQiCO/59lBuL1iDao9zdOYw== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by DM8PR02MB7912.namprd02.prod.outlook.com (2603:10b6:8:11::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 09:46:24 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9%7]) with mapi id 15.20.6411.019; Fri, 19 May 2023 09:46:24 +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 v5 1/9] migration: introduced 'MigrateAddress' in QAPI for migration wire protocol. Date: Fri, 19 May 2023 09:46:09 +0000 Message-Id: <20230519094617.7078-2-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230519094617.7078-1-het.gala@nutanix.com> References: <20230519094617.7078-1-het.gala@nutanix.com> X-ClientProxiedBy: BY5PR13CA0031.namprd13.prod.outlook.com (2603:10b6:a03:180::44) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|DM8PR02MB7912:EE_ X-MS-Office365-Filtering-Correlation-Id: 8350c28a-3208-4189-7a15-08db584de895 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: x363LYGamy/23Pib6JotCCGvEKECBgOB4Ah8HPLx7Fuw1F5CIpDgVXjDWE6xAqIwfAmTCJ5COODhb/d5An+kZ7WyUpYvC/7Jx8f9dpmaPpoV2fgU5iJITv7+ebLbNfHDcNvK6wPag3k8DETCQCiMfe58rWysJeTdLN5lDi1KSUx5kGKai8VQDEWdwZMKxJ+ha1szy6CgMEJmXsPP+veAIVbSCl1+MPbGbKqSj5tcLtWyyB6z32M68u2LK6QPAwcsVL2XFBfSct4ps0h703xp+7jmaKR+WGMWvDgXNEbkBPvH9NpbAdERW//x452hzlVSYO6+CYaREeCZNmrIi0LO6JwvlqjY+auyH8RMdvEezJZgCj41dDhK2Q7M/DKMjIJFxrRhbFzSOkyUkDkxZfXD9QC1RBCZ5Zefw0dn3mwTSI1BVCyzZRIVksMZ4PN1n/YAqIpFkP/3lLVuMvvzkmi0KHp0tTyGG7tGnbeWZpQRgaFz66sG7LEEb1m8+TIMI0oYzXHDOxHPFOGexGwJQ4X3M4eW4MUdq/Iqgh8IART3JQISWNQYeajS40BGXo++rbc7P1D/qk3+RjPcOYlAiy9fk6m+QfR0w9P3gLQ+69u6waqyrQjHZbS/Agcn7KRkaGEQ 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)(39860400002)(136003)(376002)(396003)(366004)(346002)(451199021)(66899021)(36756003)(44832011)(8676002)(8936002)(5660300002)(316002)(41300700001)(66476007)(38350700002)(4326008)(38100700002)(6916009)(86362001)(66556008)(66946007)(107886003)(6512007)(6506007)(1076003)(26005)(2906002)(186003)(52116002)(6486002)(478600001)(6666004)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?kiBgvey+dPp/cN7yQL9YePDptEv8?= =?utf-8?q?PvwJHklq+MHnn1/wTLU4MNn6CQO6JwfZlRfF6vvCcrdCSmeZi1081HbK+jekHCPe0?= =?utf-8?q?0JJcH4gqeiDDRiH0jAHuomWThNaNYws6MPzjFVU766tHGSbeI061WzZfYnZzJXpls?= =?utf-8?q?zQ1sqrl/57HzAthze3+6yBqTJF39gQE7cNDiPyhAW6fvRCrFWtAXrr5j1URUuCYEd?= =?utf-8?q?0HPvwGUdK17qhQxE8lbB5KPcAHJZW7XGJhTSQhqE22t9FsO/Y6Hg9+i+IstZ4TAZD?= =?utf-8?q?HvlCA5a8BjoMSgrKNeD9t36cYkH03MngdODdsZZuENO7bu21xPJRm3CL7Y+BkPTc+?= =?utf-8?q?DUrR2j9L/R6bjBhJGrTB6iz3zg4pGwtZfdhe19nwVOw/yOExxz08GnIUOiU6Hll7I?= =?utf-8?q?iI8ZWqIw3vyD6yhpQ1yPU3SOGSynyXL8YL8UYLLeU45DRZjo21Fw2NohJmZEQ1txg?= =?utf-8?q?7x1Jmsu6onSPtdYKW8p16jdKHzFbHBm2rD1wHrg7uw+m/TIbSHh6i6M8FRRypPtqB?= =?utf-8?q?aXhjoZXp0FewN2NAODjsihLCMVbdBQwWkP+Y7EYxz5UCJF3FSws/UpFwbbhwZ+dN1?= =?utf-8?q?vWK16Ya3gWNxDRQgiNidkMMeFfOhDobcZ9syHgmxXWSAlWoubc2TS+jq010tG4NLA?= =?utf-8?q?U5cCNtPBA7Tc8pj/X1pewwNxxAgxoDwbHKfDk/1TB6eH4MWOJNJfgTjibKhLu8CAn?= =?utf-8?q?CIlnswsuoKSSX+LxJwsXpQc9/ZuHyvy7te9Yfgby87GtBgTzfyOJ5KXzksrrojs1d?= =?utf-8?q?UuYjQhOpVtNDHuDh/JFA9Jby7uvP1XxYbAlmZXHyadqK8Z9bmRDlLPLQxgw4PrtKV?= =?utf-8?q?jAVhN8G2S4vDKcrT9IcLX8nRmos2lQpV9s+GYNXU3CSYZbPvdsg8zjBNvV5sZVpK0?= =?utf-8?q?ohndN/ripSu4o3/VpOw1EXoeGCkLg+n851XquKyTjlQxuDPIF1AtY5oCXQjPNMcBY?= =?utf-8?q?TgazK4Sgo9CIZ3az+84x+pGEA83EuL9f9zoN17CA/8CzM2GylFkNo50VHoB81kRmX?= =?utf-8?q?+Iult9wgjHofb7JLaHNmwtW+89JuukzsLKOX7SPyv+cg+T3Kv0D2McG99jJTMfLBf?= =?utf-8?q?oUXQNLsByBZGBXm0mSxG9kL7XpxzCog5Cwl/diMM/i5gPjOv9h8vy+Yl6gpXf7q0W?= =?utf-8?q?GAlWbt1+u3G82jVH9zjvowCg909N5ArhjMQoEgrEnV1elv8L3o0JWvUAu4hFzs3uL?= =?utf-8?q?vhm9x3dKYu1hGMQvazkszCseQ84VdGa5AasEbHMMnebhNlSgEV5jvj6rSInQktPkB?= =?utf-8?q?Mw6jviLzkg6ZyOF+EgZBVcQ+v4k+VCg9MrP9YtVHiX544FcKMLSvAijo4iHctXxxj?= =?utf-8?q?SYFNuXCE4uG15vb8Ys8x2TW0mjslYHeIux4mKMsFZChTRCPg6fraTVK1/0qr+n6zZ?= =?utf-8?q?YJ6FZlmnOKH8Pd8Xv7F9ARNpuNzjdkdpz+ZlqJADo9boFyftskl6y4NJcCb6S9rgf?= =?utf-8?q?uXVEeHjt+4Lk37Q0LlzK4wrToV41LMNaCIBD2hQKIxY3nIAcSlM0zzHs42+23k+qu?= =?utf-8?q?23BNFPhIwyB1?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8350c28a-3208-4189-7a15-08db584de895 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 09:46:24.3380 (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: xUVKbLjIHYTmTK8kZ7CraSdecbRVhUkBZYHErSHL2pnDinpk6VDlWvYrNTfwUW37AN/DxdmnhTofrQcHc97EgQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR02MB7912 X-Proofpoint-ORIG-GUID: t1xgrJC0m_lF783KDlYVBdNEitTnT_9o X-Proofpoint-GUID: t1xgrJC0m_lF783KDlYVBdNEitTnT_9o X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-19_05,2023-05-17_02,2023-02-09_01 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 | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/qapi/migration.json b/qapi/migration.json index 179af0c4d8..c500744bb7 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1407,6 +1407,47 @@ ## { 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} } +## +# @MigrateTransport: +# +# The supported communication transport mechanisms for migration +# +# @socket: Supported communication type between two devices for migration. +# Socket is able to cover all of 'tcp', 'unix', 'vsock' and +# 'fd' already +# +# @exec: Supported communication type to redirect migration stream into file. +# +# @rdma: Supported communication type to redirect rdma type migration stream. +# +# Since 8.1 +## +{ 'enum': 'MigrateTransport', + 'data': ['socket', 'exec', 'rdma'] } + +## +# @MigrateExecCommand: + # + # Since 8.1 + ## +{ 'struct': 'MigrateExecCommand', + 'data': {'args': [ 'str' ] } } + +## +# @MigrateAddress: +# +# The options available for communication transport mechanisms for migration +# +# Since 8.1 +## +{ 'union': 'MigrateAddress', + 'base': { 'transport' : 'MigrateTransport'}, + 'discriminator': 'transport', + 'data': { + 'socket': 'SocketAddress', + 'exec': 'MigrateExecCommand', + 'rdma': 'InetSocketAddress' } } + ## # @migrate: # From patchwork Fri May 19 09:46:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13248126 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 48C06C77B7A for ; Fri, 19 May 2023 09:48:34 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzwh4-0000Bi-03; Fri, 19 May 2023 05:46:38 -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 1pzwgy-00009W-IW for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:34 -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 1pzwgv-0008RX-8r for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:32 -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 34J5Jq33003348; Fri, 19 May 2023 02:46:28 -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=8kLFhBy8xrHkyhdB/+w2R7EJX1c38C6ixHyMREzOmLY=; b=D5bT/3/Y9vUwsqYfokkrXziozt1l7ZzCc4dZPBwwOGo1be9Tv+5b4kqQAROfz6CK5Oi/ NdFr/WiEkd8CjgLKIq1soyrCzQFXhBCpouuGZpXcyntc2+1RPDpc1IZ8TxeqoFHcD210 kVvCLWbhCCxbTHFbh2twZoDAhpvrBF64y9vW5vs5GxyfPaFg3lYjOmw2R4NO/B1ynu4z h8FaFLA0dKc/BPCCAii3BgP3Van+DMV9+HLf9iwtRnFQ+Oi06DXoZ8I8zRtfNCIt3+vD rfx9PSHf4GXQR8TpOulL5M8WvJP33j/F1MWBlCOqu5q9l+NPaIVP1k81VvsRR3FdTDGh ng== Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2042.outbound.protection.outlook.com [104.47.56.42]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3qmw0vda2f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 May 2023 02:46:28 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dyMxkReaA/8Qzec4iv972HZPx9A6vEra9p024J2FTYrCkR/Ki0Z/aqDMn4ZqmSM/z9VPJNqOUuOM2cq7D4Yg4p69JJfvbrhU4jxZa+CTS8dasDETcPYmdSXgNm6Yi3OEKzLiTnBfwfFASzDC3t3yUf046/1JqKbrro7eKcOgP6+IBIGTF7NdDumbiypieMwnmg9FKZV+96XDp5tpcFK2EbySXR+w8vg1ND4+9cx8EbnfKuDz5qSB5bRcXrwlsKsiMvKxjo8pGhiRJk3RSApqvUaHC6kbDMfMQ1o9Gm5nvaN4Cql5P2o8w0ixlVDIUHRndkbtb+jpQ2mhXBlLaJ9g4Q== 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=8kLFhBy8xrHkyhdB/+w2R7EJX1c38C6ixHyMREzOmLY=; b=KpVbmYmTJq2lFS7s1eZkXUHqlC3dyTcKsrR8ghb49fcybWE0N6FNrUs40KoUecl5Oi01m61LT3YVC3yjUwP2oTp9SXdEStGjQ6Ct+pGbmTd/ZDo7m3xb/7s7XvR92X57IzWFq5YmRzFcdS0uo4lSvtlWvN7Dr9WjSttDiGeZ8/1x7bvm9lvOeLazWKmELYvTgjuM6rmThHVajhqlrabrc/9GdwMlSGbtqLzqEbDS0MwHrEi0+yHd6Ze9FMvIyWbkj5i+rRirb1n8GfTdIwdbiucScj+1tuB+GiMOAxe+EbMj98nYMKmbj86L3/2KFBv9JKnNHJxL3idKW/wrR1fW1g== 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=8kLFhBy8xrHkyhdB/+w2R7EJX1c38C6ixHyMREzOmLY=; b=onrkTXW1JBZS2YTT2mfOZCRhEwG1XRteiN4/Sl7ZbmOpkoKsS7qFydiArytcULWNau2tIU7RXmbd+7XJnAmWdrYyoqAiYRT2h7kbZOtFm2Yb/7SyaMqp0TVlqlvdUUhyTYBB5+zMTXWfEx0XTWjP/xOwzBaHzNaSMWuYEUTnL4Sc8AjiN1DzD9eJPXFELq97GJh78+2k4YI3sNFN657EIe6LQ5IBQZ8aaj2hF/CoqQNMEQuRz5Yb2O9De5nDgtB3SVtbN4ftZp4nPW8h7qZ4wJJI/Q1k/e3k+CKvs5QUmv8Jd1f8gab6QyifttXXVE6DpA17lYlvJepKLcI3vNI2jQ== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by DM8PR02MB7912.namprd02.prod.outlook.com (2603:10b6:8:11::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 09:46:26 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9%7]) with mapi id 15.20.6411.019; Fri, 19 May 2023 09:46:26 +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 v5 2/9] migration: convert uri parameter into 'MigrateAddress' struct Date: Fri, 19 May 2023 09:46:10 +0000 Message-Id: <20230519094617.7078-3-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230519094617.7078-1-het.gala@nutanix.com> References: <20230519094617.7078-1-het.gala@nutanix.com> X-ClientProxiedBy: BY5PR13CA0031.namprd13.prod.outlook.com (2603:10b6:a03:180::44) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|DM8PR02MB7912:EE_ X-MS-Office365-Filtering-Correlation-Id: b7b33fde-9f61-451b-69bb-08db584de98d 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: eMUp2sCNHmtJ7OZzvUcsn7YoTJrOXK/7lZ02hG+qXRGVF6HLFAEqGU9fHS2RT/zcUOKxG/WAU7hy+8jYgkbsnnOOUTz+iBRuYm2V8KFY1/czLvc+GJcGP/OEW/StuBL2qV21Zwu4UVO9Y58JfIWP6kPagXlU62kGZb6jUr6UrVjAwrO+B5aE1iubD+hUA+TI5SWZ2K347WhlRCswX4A2e/hmOEhFNSBG2WGhQKiU4mY59Z4nPsHVO3+fT3IymEyGyIQlu+ygooxzXGmwKXv0ZVHTBnEpXon13mtbr0y+czcFP0GEF6T59aPHFr1VVFDMU4msQFmNbZaFHDmdnsdh2+ne89H+WdyrCHNoiFG8ura5zlOzLI3FBBVqOMBB31ELZ4wapDVz6vgtsU6hhv7yedbdWatjgjARRP4UsPTN+EO3RtLHd5q3Ev4ScwH1J6ezlGqmbQH/a/Q5XNEc/06m/doIaMpltHvEZw2O+cJVl5rg41kl/nRuwzEm3kmFOKyF5F/uE7mXKtOpF7hTB3SDcliBj4Z3uQyIt3HKaBIsiZjCZcormbqYWvilLb+hbkOXFK4WsWmFdjDYDHchAsIR7XM41i8RXoZfMYEdfp/s3xjsaG5sEg25QCm6W5lrDuQI 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)(39860400002)(136003)(376002)(396003)(366004)(346002)(451199021)(36756003)(44832011)(8676002)(8936002)(5660300002)(316002)(41300700001)(66476007)(38350700002)(4326008)(38100700002)(6916009)(86362001)(66556008)(66946007)(83380400001)(107886003)(6512007)(6506007)(1076003)(26005)(2906002)(186003)(52116002)(6486002)(478600001)(6666004)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zZXntn0Zc0bg7BWhcfozDGIYFswiJXF6lPY+d/948bwiej/WwhTIADRtDaiiyAP+f2arv26ED4BsnLJ9EINUq+NaUuUfI2MQyJYuLh916AUENMi2EDaU22cjI2x+zix1Ru3kjE0IcQFzZBx5FiOtJnuYZ8avUVJIYSAmLF4EbL+fUZjGF8a265eNBvlpN1U8Q42xusVLOzTn2uNMts1zRHhhtWwNYk4RofTjNFPKMCvX3hEIrG174C37cAwDshgzbXZQohei+Q0c3i5qgKuQE3Tu07AF/pbOkDKgYT+DGJrZq8CTu8Te8p+fAmjkAoHXi9gq/EW09elr6jWsqJ3GSc2AtKXnqGNXUWSrht3V+Syck8qnYE6vmmm8+UK3vMOT1asiXZh4rNZg4h5FDglKfBQJ9Y8FDD3Ild87puIiwzVwmcC5ys7NM7g+Y797KnJGY75Pjf3uaHmYk6tvK/vrbj5WL2srAWuBB1KWjlIXeMu9mDf6G/aCie13APafqZglCbE61mfAfT52sZ1hUja1+0cgO7ViS/Hpc20DH2JEB99N9HmE39iZBYQ1KDRqe/h0EyhbrfjV6UrIV/gJ16MhbvNEaKd9q0/Yr3OAyxx+OqAU2TXtrMYZT9H+J+yBnUw31qMafRJ+ckfQWkG0ccGahwi0VlD/74ExD0vBSJClSEo7zDJ55q8EwcR1oUTspFYJR6ew5JqLlqNgE4JJ/l+r2FM8DuilbqiLNkcBzoezVUNdnEc+5YLDvPS2btMc+OqYjrJDxRsTz4vo/WQdri4InQXyBdGzXOmYZBIOZPxZDEOqQpKWbESBd+biMiHp2b91I93kvldO5TzF5BrPlO+pO0JwJpsCcztuQ8qvmYQwpJhvwaLGXeIajMqxfeejO4V4epSC0eQkb4gX/Q4e80rk5OAL9C9gHeZ1Fj2GcPQYJ3T6aNt5TFb89zkAxaEqqcffhKmtfYZP95DybqPDEH3A+9ciX1f7q0PCyoekDhMfJQWTmmXK3Zii4BO8cKrP2GRn8vp0OWch6dA/wIV4FhLfcwkRqjtzOqLNs2A6GZJW9sDW89kL+gSyGGrVvfT1enQVSssy6d4N/78sTD6LT+YWE8DUZj32q50o9u3wS/NYCFKedN1pqQU50JhWDC3lkeZ8RYG4wKTJ8sSj5V4QWv2VlN+hbm+E5IV0GjlhHycNNDozzgIzF+tPE7kvlWk9NvbzZhxXkj1PY8IVqjUqziy22mq0T0NT6lE9AnI+IY9Se/Kq/1l/hUIdLMq8sBD4Zx6VPhbDliigL5Bes+dzgNLxvcdGb/vBO7LeLAZEiOi8UKA1GT1+PumkfSmOo3z5QWGiflMQUl8HUxswdG5vlJXSdh906FuTqM1+5TOgdQyUbTBQu71deugwFWhYZJxfUQ76DHsJG6TBTzUdTcoQkUsbtDWhYiIyTYtCQn0PxHYlHcTT79Q7ag15DJBRKVqvYGV89iPHt2hmkws7yOj2+UjFybjeBykeur972Av+OYjy69QOSbh9jlWqc8daOV6F7qWh2ZfLsPBhizH75dzSreiBTD6s7r0DMqt0Hk9X6zuCAWeLbGBOCQWlrFfIWS2flAeE X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7b33fde-9f61-451b-69bb-08db584de98d X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 09:46:25.9043 (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: itCdgdON5r+IeWE5G6YawYX64qYza6Bwo8waydA8xeelkiMzkpdEWnAjHSTtSl3ncvG2iOQ8TJ04JBg/bYVK7A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR02MB7912 X-Proofpoint-ORIG-GUID: G16XQVepJp8cSAWQ628JGutAI_s555an X-Proofpoint-GUID: G16XQVepJp8cSAWQ628JGutAI_s555an X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-19_05,2023-05-17_02,2023-02-09_01 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 | 53 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 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 5de7f734b9..4c9ecd521b 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,62 @@ void migrate_add_address(SocketAddress *address) QAPI_CLONE(SocketAddress, address)); } +static bool migrate_uri_parse(const char *uri, MigrateAddress **channel, + Error **errp) +{ + g_autoptr(MigrateAddress) addrs = g_new0(MigrateAddress, 1); + SocketAddress *saddr = &addrs->u.socket; + InetSocketAddress *isock = &addrs->u.rdma; + strList **tail = &addrs->u.exec.args; + + if (strstart(uri, "exec:", NULL)) { + addrs->transport = MIGRATE_TRANSPORT_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 = MIGRATE_TRANSPORT_RDMA; + } else if (strstart(uri, "tcp:", NULL) || + strstart(uri, "unix:", NULL) || + strstart(uri, "vsock:", NULL) || + strstart(uri, "fd:", NULL)) { + addrs->transport = MIGRATE_TRANSPORT_SOCKET; + saddr = socket_parse(uri, 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(MigrateAddress) channel = g_new0(MigrateAddress, 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 +1680,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(MigrateAddress) channel = g_new0(MigrateAddress, 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 Fri May 19 09:46:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13248119 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 CF0A0C77B7A for ; Fri, 19 May 2023 09:47:09 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzwh3-0000BP-LF; Fri, 19 May 2023 05:46:37 -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 1pzwgy-00009X-Mb for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:34 -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 1pzwgv-0008Rb-No for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:32 -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 34J5Jq35003348; Fri, 19 May 2023 02:46:28 -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=RZJ/ECXJccVQZPzOfM3CWxAHJVk11v6IfR/PzTdt964=; b=SlR4QIGsRlfvxI0RTBBXN2iWPV/0OWRHCNDQN2pCnANOrCRYh7BzZGtlr5E0BbG+CAIc cnuVuQLaJDpoejkKHLB/fGit7uhjkWPIba+GUE0uZVN+rrukP/UhNF9GZLmLwhedctUR aP32ajtyTYd6kt17xsbkYInsKETmQzfocBjSYcuf0mYrHijPgCzP3Vklqt4fyaGD/wNA sUR66qcsDfjI9AOyygqwkTHg7RIp1lnyCW4KAhl/D9awga6qswPD7HMoF3fvuVhiVz+V mZOJryDTZQ/FoOn8CmoLviiPP8B/Gdn12mBJOg93LSs16RRYqhPxRdt3gfZIv2shHWmF Rw== Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2042.outbound.protection.outlook.com [104.47.56.42]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3qmw0vda2f-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 May 2023 02:46:28 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BQJCiNzfsgUKhOtTLA3aeGF84UHRViuRKSCi3rOGq228s3wzvrRtUnjeT14FzEZ7ml3/Fl9qNZv3+1eVK8ccUpS//U229D2nlIkLlYcy9inxEiXlaYeqCFYjkrBzK8tTmInzrlS7V731YtVLBKpDB212fNJkIwAM9vXnlpksPa2PfVSNrBWNprMd+FgJ6bB4LTa0PXnsOoWQBV833/EbYQuhKBbAkRLRKVVKzJlS88JkgYVcMMwEtnTBkwcaVRH+oowtMY5Z1AKwPj8W71Pj6XGL9gC/JxMWJWjdulRlo7j5w2BLvosB9RRxyUJmuJuKKKsnKPXNU186jz4fz9Tbuw== 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=RZJ/ECXJccVQZPzOfM3CWxAHJVk11v6IfR/PzTdt964=; b=ZiOvwaBXXGIEl6ypsiCENZWg3bZgQ1u8720SiXF+rjEcqDpeQMXwIxWOR1j7XcY81zsQvlut0vhWgqpDmiDb/lY+jGotNGCnpAiGlQwMvjx8D1xgJZMNMAwhvRRcz3oo5f4uyxLALlYKcm4HzRaZNAucY6lL/I44gZyv/DBju5ZpimyRaHxXLzyO+K9m7v/2mWSR7/MP/EAKUqB7pQUUcB3wxxUZRgGlR+56OO5llBI53PgINHsTFiknM69vzaBWdxwiAEFYE5vhq/4IeCKBd6yMlo8DHgfrsXqammkjPgoBDLh9q2TSAuuoruD1eQbAffA3T1/gCN1mK9Hsz2IcIg== 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=RZJ/ECXJccVQZPzOfM3CWxAHJVk11v6IfR/PzTdt964=; b=a7Fhak834gMRq6PcVhZBivrYEmKNCjFhY970ORI3fO0xm16iRZrjOmFCMJwYt8Q2mqpD/deERwKzmqBeUbF9sy6GLuADE4UM0BQnLuumZ8QtoVKSzPzHa+2Ceh9lRZvlTYLxRsrs/hRu5gGTevoJM4yRv22kPsikE6wcuho6qlPW6mXsg0Bfj4sLBgWYUi2AT2Viq0ekVMjz2l57wgOSeUWxRWeTQ4CmMXEKEeSKTuZOy/EvldOpsA4oHUPdVKYo0Ajs9qjTb3MVxDB/V62GcmXlIl1069pBjVSTz52jw7LBeHgQXN5S1lbQvzw3nUXZSmnyBw0BZtkdIBnz+sl28Q== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by DM8PR02MB7912.namprd02.prod.outlook.com (2603:10b6:8:11::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 09:46:27 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9%7]) with mapi id 15.20.6411.019; Fri, 19 May 2023 09:46:27 +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 v5 3/9] migration: convert socket backend to accept MigrateAddress struct Date: Fri, 19 May 2023 09:46:11 +0000 Message-Id: <20230519094617.7078-4-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230519094617.7078-1-het.gala@nutanix.com> References: <20230519094617.7078-1-het.gala@nutanix.com> X-ClientProxiedBy: BY5PR13CA0031.namprd13.prod.outlook.com (2603:10b6:a03:180::44) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|DM8PR02MB7912:EE_ X-MS-Office365-Filtering-Correlation-Id: b8a6af4f-cf29-42f3-46f9-08db584dea72 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: ylz+qWCaY08kc4azpcUldv2oBAWDV4rhSYkYEXV0d6Xg9J6F7jzPAiJU9cGk8QETX8E/AWbUylI3+Igvz4tB/tzefUiXHFD9zEpLbn/ReNwe12TjOj9i/B84pHc1XCvvmZvVSFaKQbYjJa/ggw5eXM2lp+e8Y8YyCdX2HhArmrTyWkLw4WwZBtPQIXc0e931x85IfJca6PBKc8jSksDmKql/hP2ANRY3hlbtB3N8etkMwOVeQFLKtU3/JNspa3ToIB5x/KEcbcbOFyqr5ETyRG4hRKoV4TXUrU8L3w/E7yKVQqSObPtNIzpQmTkHNRumsolphkvtQlreB+jL9jawAVclsev0w+iOppddOsYBivOwViwJI4/E4RPTfPpcgdAc4yNIWDRqHJvQkmPOin/hl4fOlNvYn/cgtEm1zFA6cdzWl9hM6UfTefZAmwE4SOYoB0HKLIrP/o968xG8o6qjjcHkrOQWbIpv7gEHQlvNU9LAW3v4dT+RIuQrBXMWAONS5weyf0Abn203X6PZYpHLluUXFqlyshG4vvslkWGFe1OkWoaHiGrCsjz7GArRagPVTcsKySX2k/s5dFUBcf3Sj0HhSiZQW+Y16Tdv+faVo16SdVjz+ZkfJFVDkXwHv/6/ 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)(39860400002)(136003)(376002)(396003)(366004)(346002)(451199021)(36756003)(44832011)(8676002)(8936002)(5660300002)(316002)(41300700001)(66476007)(38350700002)(4326008)(38100700002)(6916009)(86362001)(66556008)(66946007)(83380400001)(107886003)(6512007)(6506007)(1076003)(26005)(2906002)(186003)(52116002)(6486002)(478600001)(6666004)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oZiz77zbSFQagXuUT87B9ilYu+4+GDwV3rW22J7HNF0x84h/syumhrPAPJ/Z+v+Lr6j1RE0HB59YsQmxqVTWR4Yz4rqeuAlcsUUk1kidGDC1OS7MxoYnXLozyQFvvoW1eCglDaPN7x7Uwz2sDOknsFVQNpjXIsbGgF6D/oebkOIiqZ8FP36VosQfljpZgdVBAgh7+gLh2IBLZYse6K62pfaReBMo7qQLeyq5RUWTZTFZbnAzS3j98iDIZX6eeD24/QyObRk2TcImxVDvLLO0f6TmY7mEQI6VGADcTggdrkfATwuq3E65PvFua2k1Wz/zRflSf+fHp/1SC4kaRVWBX7977uUW5BMOhT1SLQtqt6zBcE1FYU+ywE223DR8/eVJE3fALN2VGFAN5rPgCjuOtQEf609H8HSqyxrraWXjD+u3+3xkpU5arr/DI3xCFFKvjY6q/aQCWpOfgLZQ2nXHpLL7vecyOByErXHV9jnlKcbxRYDfFXao6Yw8qDksUEcWTsPp745hXwSMoH4vrVPXeMnvfczr0+ifAS52zafD/vJeE8TRY+lGlU/+dn7fNyDXd83DLXsGNIhkN1b88KME8cl/kLjl6o5wNkzz2kHRuIWpFG2ziWSrarNxp3ChId+NyEc0W45NBq+2amLSjB4S9HHdx/P1eW/4T7NJE6qNyWxRG18nECBmVrb1e7kIZVc2gl3YdfcbRzzuANf+boN29xu+iX5bXyggIhXRgYi+2RCTSPOkAU9KcZ1xqbisDNDrssSvfYgYiuzdGKZeC1Ykizkw4drvqX7A37qWH7oFn+oR6JMkVbkQxE06dOLAP79E7Y3QD//AKK7Raja0td078MnKRjlex7S2c4rtLvPueabEwmvypC2HZF+KJaI63+XcdyUmGPuT16aCOfG71JUPPgf9Vq5MQlTw7m8zHZG1e7wEHVbvzMaqxtEpGl7C1Ir7KF/CVGYh63kN5x0YMILRuJEQ4UPc+ZyDlAoDN1PSogyd1OgMHi8sRExUd4SOrrEEhF1AdYfYi++BFNm1xLfshUNi0e2V0tbBEsdOUt8FzSF0vqThhh13rzzghze4y3XjQ/y5udpfDth/WVRc5n9n+9yLcSdv9x40GYOkg4PKcXK1aIdUVsmKRwf5h32+NsstRxF5qdPg2gLMfllE2LyL+8WRrwG1jcSBVx+tZcL4jn+S4XC5qhcvHBPjOhtarjxIQEtfYMfCzFc64X5eP4/PEVV8dWINz0AGf8rKl3kDzb3fBWghKloafQR6CP3yLxBG6/L+j9R49pJnGFtGQoCLFjosdmtcqwc4yP3r4iWTNu88rtCWkartnPcpeoPnfGJUdBDlt6gkj5JuXpC7DZq573HUoJFvLgrQyCM6OtDgRDWJS10YnhtgW0GPLIscY9N/elv8KVgfMTVb4S4O4NnqNK3MC3wMj0VR3zoASh4714hwsyCCVDDxuaYtCSgvjMNfLexIvsGt/YsSwtkPP9EKvdHQ33870x6hcSewOInKUV3pAa3EPz6Rne0BgXa1hlq1kOKGthi37/qUgNbr89SGazy0Z7d2/2eD0H73mXPn8Y5KiLko6UxHSQPD+nzKEa8kEw00g7oo+7WUyyGTPVkLxg== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8a6af4f-cf29-42f3-46f9-08db584dea72 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 09:46:27.4405 (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: OF4o5RCPdvqGprQlic3kLRHHlkeNDtUqaDiMoUvSkXfVnzkir5n7asj+0vYB1cPavhkVUDqcDlprZ4EX7m2I8g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR02MB7912 X-Proofpoint-ORIG-GUID: tq_s1HjDHI-1Pe-Nlj2gLpY8lngXZ_yf X-Proofpoint-GUID: tq_s1HjDHI-1Pe-Nlj2gLpY8lngXZ_yf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-19_05,2023-05-17_02,2023-02-09_01 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 4c9ecd521b..3724de7edd 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -478,18 +478,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 == MIGRATE_TRANSPORT_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); } @@ -1687,7 +1690,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; } @@ -1703,18 +1706,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 == MIGRATE_TRANSPORT_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 Fri May 19 09:46:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13248118 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 08614C77B7A for ; Fri, 19 May 2023 09:47:01 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzwh1-0000AS-UO; Fri, 19 May 2023 05:46:35 -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 1pzwgz-00009a-P1 for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:34 -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 1pzwgx-0008Rk-VX for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:33 -0400 Received: from pps.filterd (m0127841.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34J4mKNT015301; Fri, 19 May 2023 02:46:31 -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=gKRydWLyO6rRjilcS0ihsVSMD6klFbAP/dH/wGgCwfQ=; b=Y9YQ8Ar/9EgAS8iyxcwyWATLKu4V6y/2PYPr1wINHH6IDrpqje9ogpJVZRmBA6h2D/Qf 31MW1Xsrd+53HJRNwyR+QwgMzx4AtZJFVFiXHsAUek/LDez6aWhfXVbgt++WPEo8SdzV +jQTMvxbcUjXc7toYYKklOe6ZoleyZgkeQhcNBQlPCdFlo5nu5xvY/4QIULQUjsyTBel QatVSnALPArrq323GpqgGLP0gswFUnpEor1If5rmhTCP6GAAMJi4zi3Y1SiuQSco70tP xh1H+RBXraf92YxtBXgaHFk2eA/3ctHfEK+YuFUc1ilyMr1WoH9nDTWrGW+Ux0XkzTHR mw== Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2049.outbound.protection.outlook.com [104.47.56.49]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3qmvtrdagp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 May 2023 02:46:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hT8l5cLwh6/93RDdgAhIjNn2kFGelbGKK8noy/0XcNZYo3tV2cjePpOhDqTdt22Yj7ZhQjmwJi6hswmP1/bDFKu0Vwu2Xa98W/md/ABGu7Uxo4LEo6eumemBXzKYdRXrjN+fIOV21ltwzg3wKIOzpRPnpV5IcmM9UAiRNZYyPNJH3fu/HcNseCYVsDT0u7Hq996hFNttggtR9bdSksqFG/Hi6pXKVedDb3MmfeQY73O9DALg9HzoFB+UqlflcY0iY1LC5KFbvH7rbKLizfHmb5Kz4UPhTgMjcyBq3Sag0OhcycqA/sqOM4nChQUOWRH3iJx5iRMU4VrTMHqO0QJrRA== 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=gKRydWLyO6rRjilcS0ihsVSMD6klFbAP/dH/wGgCwfQ=; b=IddTfFwUUVuQBN4wrz5K2J/cfnWWlIGQNcV2Boqb6l6T8U2NYKGt+1DRoj/9rKO14RA69Bt7lwCKq+8zvrHou2FZlLbtlGJA3wxkEkJhhi1t5qQo/8AQFqauw2dfNi/4jHLwc3arWPxNssKpbSbNlpAHfJusEePjRwQ0SzElXU4cLLbLg7nKSvx01Yr2nmOu29LNvgZtVHZyKs1cYTIgK92X5d0cFxoTD6lVNGTVN+gfbrn+UxIPVXhjzVekJ1ZU4ZQkeWtoRVaYRa0ANabb7sJEH6rmRzdeR9AlWQbGLbHIiuIbFPkxOwZ98U/9uEI5OLO/cpQ74dPPOwMbK0tPjA== 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=gKRydWLyO6rRjilcS0ihsVSMD6klFbAP/dH/wGgCwfQ=; b=j2NfgpJ1NPVJHCrbdAl8Ovtnyyv/aAc1h+rcsJQmj7yj9hOzKLKkwlFs/ETdakXwJK+ww+3EMUDR1Q/nU8zwCgAklBpqqT+qbZeUeVegXBSg3mRPsMvbd6Az0O5Cjg3ZlO72v/eDpF6v2la1QTtri8F/JnRE2HUk9+CfKP0xzCRxoN7e3UQFiVrDhW/1Lwbh2ugy+WI0IMKtaXqZSKPg+8ASu5qJakHjE++1nYpXm+2vipsBkkSPAtWA9OruBHjIYMRezzJd/RO7oHP4nLWFq4FAVOwD8fzNWjoVl5iADCFwRZ7kfGbG0OUo8L3tDGquXDoEw5iyf472XOaP6IfNRg== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by DM8PR02MB7912.namprd02.prod.outlook.com (2603:10b6:8:11::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 09:46:29 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9%7]) with mapi id 15.20.6411.019; Fri, 19 May 2023 09:46:29 +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 v5 4/9] migration: convert rdma backend to accept MigrateAddress struct Date: Fri, 19 May 2023 09:46:12 +0000 Message-Id: <20230519094617.7078-5-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230519094617.7078-1-het.gala@nutanix.com> References: <20230519094617.7078-1-het.gala@nutanix.com> X-ClientProxiedBy: BY5PR13CA0031.namprd13.prod.outlook.com (2603:10b6:a03:180::44) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|DM8PR02MB7912:EE_ X-MS-Office365-Filtering-Correlation-Id: b8290fc6-d742-4c14-2431-08db584deb57 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: Kx5Mm9xgV90EZZWbYAF5qUogL11DtPuOFcZK+JECa9UDI5bY7IoxRzKDymLL/Qx7mtccbV0duzapjtis6goys949nsD/F6ON9SqRVWIPqMYmJsfm/CusEmPxIn9U4kDEW4jisS5WhF06X9cNGjxF4mI9ZiWaptrQkRcd7cpEZ5rd74EZ40Sxb4PfHOdz72sclMvJs6gnXGkv2Mh390DFSydtLbkIQBqziVwznV0rryLOTVZDdYvzsp2Kee8PBBuOx6/kR9T7vmRSfy5ipSF5jQuYqmPclJxTar9Ve2juGQc/hqTUPN/Pe8vIEiMrsriJrWfYUX4uFXznvfXqE9TL4idG+fAug13Qa0mhHKHmjK0USqjH4bse3ZSIAyQdOhgy/iDEgXwbCkRdifwordvV/umlgmhd6KU9ZpqrURLGHfeX5Z1fCvGpPn11z4I7LCGVmAHCpoun4xPr4t/jsHc0KVG2KzqXSGULCKroxIDoMy8eqmf4JGyQQXvLRSDiQbkvTkYzcuprTMHN6wtjpkqeJ21uNZiixh+1WY6ZYfrgposLe/VEoR5yNJtPF4ZN0vtqUrMf09sha12F/UTp/p13XkfcOeWOYS+gvtghUuWaVvAooNKJU4tfcrXxi4OgVB+G 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)(39860400002)(136003)(376002)(396003)(366004)(346002)(451199021)(36756003)(44832011)(8676002)(8936002)(5660300002)(316002)(41300700001)(66476007)(38350700002)(4326008)(38100700002)(6916009)(86362001)(66556008)(66946007)(83380400001)(107886003)(6512007)(6506007)(1076003)(26005)(2906002)(186003)(52116002)(6486002)(478600001)(6666004)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yfQMRsAAmjDGwSa3fudAkouO4LXuhcs4a/cquSckCVkS/VGUMAuX9Erq2F3W6aCfTmrx+gd0QbF74R4VT775vfHofnRL6y6T6ZDLJSZRnMbNUuwtKM7ACYFhIH7Ce9LUjFTYK8jI4YTO7qvL2Bs8GuTtBBhk/nR86TaONk5su0c4qYeFumi2xA313xSc3FMz2HcHrOPbMbwiZ69R2ucHDJdJau6dMfGxPplw7T3i9tkC/F35RYrcbaPlKhucBi3LE1kDsapzGaV7RGZou2USLBVS6r6vebejCjODNikD0jlZSorPGxF0SOeqBlJObZ/VyEj/y8oK9PxlzS2wcDRA0BfiV1Lyx1Q4m/Adlp7wE7wRATJXOqOgh7X7t06bW5gskDBAl/5r9Ip6mQQeOrVSMy+mpywQvyg/CEBy9HpmhjqdekzjDlqkmaWy2y1H9yCV8NXvs65+8SE9i8zVwGFwAjXtb0eHEGcSN1osDaiJ7zGol/k2Z4YjzrjG5P+Ma/MdW17iYim5FdC5fRGPYaeUTtptmKCwcvdaWiiyqwa1mR2/iQdDdCJAwSvJzayS8tV32eSJH82Y2RzGd15i+gVmatsKIK4FHr2GnEPIK0rHqN6Vr6RzUPc+QrxPz9DeP81CoaWq8TK6GCxQYRksMWChI61epVml/GaW6cbXCCb0yVfol7CnRfH7DoYAS4Td5n384VLj7AjcFU62Mc+0j81NIfJoVi1AGIcjK95nbOh4bhlpDPzGZtlEWrW/LkGnvoX0HhomEwT79cJSCf+puwJskxSJsQbf09pjyT/gkgfht/NMC1ZF2XU+CgIA9EfOQhZgNIJLkMNPsOYHN3Yns77pEYSNpnxfWBc+bVjhz4KG9G+eliZdE5D5m+9z+2dCLgT/GDBQf63jtwH9UbCLQQsHA916Jp0ZWw96ecHC/Pr4p1YHhwAfWPqhtO+Le9QC4mmuo1E/R1ZB2C/2t1G0kKt4zYV5+UI8IX9sIozZNomzQAIjxwB3g6pLZ3Pt8w7friOTgbdbjGkZkw5FmKsGynrTTbd8ps5FmV6+5Nclh/r5mQNkbB4UvgPMnLBGZninAOTcjv6QQpb2jfwJ5beiBnU+SMrkcBzRA7+a7kmvT7oeFEuRyAwxLEyqty58BogJr8QBkIQum+87E07tKGxs5SDQqNNQbFaz9Cy0K8pTJBtP+V5WBBWmu8Um6ZaADovk20lcv81oRlnSK5vobfJPD1w0FwAgRKy/6BMKaQAlKd2yItg4Ie/7ZkqaZqG3hvnotf7DqeS1587O0isono41reXEhL0Cs25bs58owxWRvPp5YSiKcSyAuG5wvHuZE3pXF1JxbH93bz4VHLFlR1sMFALeKgcVcFu4a5zERZvZXBlpl0NWXeqYSvrDemW987nEY3VUet7dkdtZ4cw1WoEhP00vc/+knjWlYWe7py1lZVs+HzVqiyqre2OuLb+Q5Mla8p8jmG8At11enpYpShP4vK9ah0dDkujDYAq13VmUGZVLO37eB2DkjYkMEZJWX1xr5nkCi5YZJ+x34VsM8ZYC/6emmiaX+SWdJ9QYsSP2+Ats81TSRj0RAYciUJkDMl0cNmuW+TDWLRp458RowAQ65AWbaA== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8290fc6-d742-4c14-2431-08db584deb57 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 09:46:28.9330 (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: SSfD87pkDAtwaShVuYgQxjLhHDdk749PwPeYNHrpK6rSZfV5+0H4bpcmg3BskAmqCN3Q7OpkAzK8vSxYr0jkNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR02MB7912 X-Proofpoint-GUID: EQYXz6ejXF0nT3_0qtdVaX877f1qpehJ X-Proofpoint-ORIG-GUID: EQYXz6ejXF0nT3_0qtdVaX877f1qpehJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-19_05,2023-05-17_02,2023-02-09_01 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 3724de7edd..b7c72fafc9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -488,8 +488,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 == MIGRATE_TRANSPORT_RDMA) { + rdma_start_incoming_migration(&channel->u.rdma, errp); #endif } else if (strstart(uri, "exec:", &p)) { exec_start_incoming_migration(p, errp); @@ -1716,8 +1716,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 == MIGRATE_TRANSPORT_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 2e4dcff1c9..966a21151c 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 Fri May 19 09:46:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13248121 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 60F21C77B75 for ; Fri, 19 May 2023 09:47:43 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzwh3-0000Bg-SS; Fri, 19 May 2023 05:46:37 -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 1pzwh1-0000A0-1m for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:35 -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 1pzwgz-0008S7-7g for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:34 -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 34J50Jod031984; Fri, 19 May 2023 02:46:32 -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=XtTp3GLHb6VPeCAKCjNOD5FusDvZRctVCIVx+o5tH8A=; b=jYZs8VhbFUvzZ9OhIgK9POwD7gb9oahuasFwvKSE9iqRjkCk4aPeZKMLSJpQAhIIQ87G wPdRVz9XEZzm/j08JkZFt1B+izsxphGSWL7AgPeSZcltnMNLcw3EHf6Mlcydt0odv5vQ Vjt6xDiKu5ce0EXXaFzMmuSBJWdx+XoURa7lKBEB8ztW8nF2oiH2k46bVs9lua0BdOKr 5sbPt9F1LR5gW4umL96HQIYiArJgjmTnrvf8phLeFf8uVTcIPw4ss7zackCtrvufdRb8 y5DLU/CYYgNnK9uRJBSypfAb6zlLXe0Ss4lpEmQimEz8qeNqOSOpjjtBvxP/bYQw0v1d OQ== Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2041.outbound.protection.outlook.com [104.47.56.41]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3qmw4fna3g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 May 2023 02:46:32 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hg+QU86Ae30bh38Bql3pd8l1UFdD0TAm8ZIGDemgJYOB+exwfhb1tdujhAsmwFVzkU5i1y1ddnnT/HgQVfxe5pgcsjRPTEMW3B4qjERjjMpCqYSJ49dR0UFdqcEMZgWqM/7Rgx+3Oy/ShF/+WnDfglZ4oliP89M4hYbtqhpTodMVn9FbRLy1eGEUhRL8urhzbLDb3iVAJDIj6KIBhyNvwBkBK0d323El0y4zjpGrgZQCcIwHYINbX+h8rhoxUf8ILkPAfBA9GmtUiJmM/b+OkFCdyt4BQkar+PzeuO5ulEZrcOk/OjsyTWWmBwuSURWijHaYUZPO8jFoHd108Hjfhg== 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=XtTp3GLHb6VPeCAKCjNOD5FusDvZRctVCIVx+o5tH8A=; b=EuyjyNX1jsqC1dmrQWW2o3XqF0dIuDbIForJuXYClh2AAD97KvBpawTCSuZGLwg4cW4bI9W46/XjVvSEamagVrdCCCOBDe150jt4yEJFM3134p0fKZ8XdNgJg0TyoXQItofMbJBSuU+/IaBoeDnOd2jfpoTLO519SCoMXE7hMio4WYlBNuk55uE6hI87arxKP3WyDr1WbspA6jG3PNJhb4lX2SGwcVaB2nHoOyCS69E/WaJQPqvAqSBwyGPHXFsWyXkcVtazFOhK5NiaOyFbQscnHexqAv1/Dppdke6o7Ewr9lHHH3Lkp/5JQ54tJ8TZMTp8x1CoCMAxg4yxxWvZgQ== 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=XtTp3GLHb6VPeCAKCjNOD5FusDvZRctVCIVx+o5tH8A=; b=s7cX26giNV5qZ8AbkbCmkRQlTMsWXNisPZQGKqNxANJuzRJpP5NlEIl1O2RqdbkhDPqz6fRDXQsMZ/wEOAHVBV4MvV0EakneWXFoo5sqAolkrH4sgYPLB2luX9xenBnzhPShTAfRPux54CgfmPjxZDKb0XnZZtJn2wmvQRns2n9xNZUbRUtMUCyfVcg+2vij6X7TlG1jpouRaSkm8pret8yWX4y6ajQdT5jNl4jCwxb9mF13pUAT48LGiAXk2myeyEODXv/D7Chy4d8eDgEVu8TpDS/N3zurcTRvMHhSrtj/P0jhYL9vStkpnGRWQG+n1WPiLeMeIIQEvpf8zLgbZQ== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by DM8PR02MB7912.namprd02.prod.outlook.com (2603:10b6:8:11::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 09:46:30 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9%7]) with mapi id 15.20.6411.019; Fri, 19 May 2023 09:46:30 +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 v5 5/9] migration: convert exec backend to accept MigrateAddress struct. Date: Fri, 19 May 2023 09:46:13 +0000 Message-Id: <20230519094617.7078-6-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230519094617.7078-1-het.gala@nutanix.com> References: <20230519094617.7078-1-het.gala@nutanix.com> X-ClientProxiedBy: BY5PR13CA0031.namprd13.prod.outlook.com (2603:10b6:a03:180::44) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|DM8PR02MB7912:EE_ X-MS-Office365-Filtering-Correlation-Id: 920530f9-9c79-4399-b188-08db584dec4c 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: 4fhEu1X0Y4iwJr3twLrKuLpfw3cT8lC7DWAJ0IcdPNHUGqksJF2beU4Ir1Jod3PE4SfCX8GQ9PrwhXDazNrgpBFXdddZbj6ZbkaIrL00xAxkDWxKGnSWJ4c0oxsNO7vJPKlErMXC51LC2CPySkQ0yDFTfWkjqjXouH+mQ5lM98nSbqnL8rxeM8b+c3Ai0mptaKl64WlAmiQ0N5+gTCc34HwZO7b/Puz2JIqGVQhzrl+AYolxioPFe8FxZRhx8axzWcKwBh76iRMoYrEgyds+su3kwCjrTUKUrojU6sY/V0i56a251McO/nnngjvR/+jEUVcLPkRsQH63oEdJycRIShxisc1lkGcAutQqgPUrhyOkX2MChNJDhQ7dj2Q+kIm9SgsLREQfpHAUkIXTgjlbRGJjLSINGFqdZehLPO9GTv0VpoReJ6FPw2ccPJ04uGxvJoFAqWaoUmtXXCAexOgvpmgom+MCcBiMFMSz6BScK47esLHOcbstArV4aIX1HGWcAfal0ncoStCN3NRGMIylgnaxzogE2DePykV4Al1AcbGiudIZOtQSKQ7dL/170ze0G+xMEB5HTh8PYny1+JNrUd3kb6l92ZPPYZUOJrd2UZhPs1jPN7K/tVoZLNMtnzC+ 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)(39860400002)(136003)(376002)(396003)(366004)(346002)(451199021)(36756003)(44832011)(8676002)(8936002)(5660300002)(316002)(41300700001)(66476007)(38350700002)(4326008)(38100700002)(6916009)(86362001)(66556008)(66946007)(83380400001)(107886003)(6512007)(6506007)(1076003)(26005)(2906002)(186003)(52116002)(6486002)(478600001)(6666004)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ne4FZSN/qJvU0SzdDtQNl2P5FctXQO0vC+4wJGF2AnCPXqT0cB/xSC/tQ9SzELhvre5WhDDYnc7v8XJ3xfuJ00bZD6nTwK+BpWyfE+gue2wPqEYnPLcLZLmaktSg3TnxWsLlOfgCTrM8yZygaWOB968H6dD+dU59MUxTvH41hLqky0l3Jh3NkicpM5V0bE2HaUennYd2YgKg89iM2wYi//2e0QZteUJnhe+rMiRDSOSce7Ji//1UZSp7JmLnZXMklCu4UYsbV14s4krbMO/uZc6tlPTFsEty0uAuFRCn3j+ydDw15pqDp5BD0xMA1Q8xAvMQ3aa+LcTapnFHYB/6gMtes6amilGpurTPnANZozVn/prKe2UmREXtvIjZG+JcMHpxWHTtIUWp0Zt6AChYUey5hum3B3p60+S+y9JmpCrH944kz2ZCvEahqhIvzgwFuYgR9VxCpgFFECrxlCJpqTzdqtuPcbrjivZe/kABcSf9iviUqgihnOZF2IQ9saU0qtK1vbKzCiJj1+u+HuxyWJs3lQyMiVcbmYSagfkQchUgAAq6avv4N896BdsphWZ31QeZU60J9JTi6ue1Ro8NQdvlLAsZhv8htf9D0zsvWrYdyGFTRn3dF3bfCT4S9THyXWlxzYNhViPWBkoPp9nnyrVJIoBbIjofmgPwYUiQrPl2m6wWx3QdOOQ8ChQ1ERnpkbQx+wvr/WWdiVoMHTNWuvO2jUaNVhpJMx/tRbFEzTK8zcyp8HuII/+u2SLm/iT4CLzzxqkwTMRGhtkOx7Ppnvrm0ZyI+GfQPRBdOvCPo55s0mvDkXxqo60KY/dCM1EeeTp7slaeeSxPQ0lS+voMyN9nUt7ajg1SFpCMZYrQHGW/RmKTiiCfJ22aReXn9B33Lj/hnrJ2fwB+uUR9KeNO1TLEdOXCNvSem0/axIMTp+XHQk0RvYog+0ih1jSpbUeEnPlSYLtJJRuDu2sPg1f1lXJ0o4rdJE1taIvX3Ga17VaH5T7+Reau1kA1V8r6uWJY/9t2dmvrZOK99ZRRWL3Rsuf+ZZlsm02UDmb+JFC9SwxOr5/S7maQj/X4QPrvfAY47HTkBBzv2PDJM61n6FvL1Mfl8Qiu1ex6tKPjFxtgH+SqHbFzyuNn1b7X1RBaWHu4WG5iPuRt1gADWLbRHNZ2L9ApOb2/YhDurLvYci6IxR+XaJYAXylF9WfbiXh4xuaL/eAbKqac58S6va8AaM4DYfurVW9V4WmzDVp+heHKeZ7e5hIpHxyl3ZgFkRTuKM8uRRifoSnu6ly8Ae4pwkV0Z92Y0uz5ABPyWYAe4SVy60Lh5My5YCW02G4iH+KRInc5Ylkcqrr3ufYQfc9xncP0zf18xYdt0Dq5D2UTvRvwvhfS5bsvK5cTg34pBZa+bDESn2H/OAgWh2GuMvlNiOVb9ZAuc8WJ0FmJvjWf+bCLW4kmuiThf8duaVLJE5CP8NAh39OmZvju9yN0/rxD+mdvJSyT2k2Vo5Hg1aknp76m5hvNsnzDv9meEbPLhUcywqt4zPDF3ktGSrQN7mXOWn7BvaYBMnS9lJ2Bb9uo4AnvTAa1BYZYsBT2fBgqqOOhhFg3rPF8+ksNHiTgtJ/ZJO0q1Q== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 920530f9-9c79-4399-b188-08db584dec4c X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 09:46:30.5261 (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: R6cfvjtavLrVHuD7EAiPNpu3ZvSh/rCdaGi1qbS7LyPJZyP9MEfcQtsrz+tpdVX5FG7eKNSPxRgMeV4W8gtN0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR02MB7912 X-Proofpoint-ORIG-GUID: ejfaiZONexIkTLxpDxbR53liJklXW57V X-Proofpoint-GUID: ejfaiZONexIkTLxpDxbR53liJklXW57V X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-19_06,2023-05-17_02,2023-02-09_01 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 | 60 +++++++++++++++++++++++++++++++------------ migration/exec.h | 4 +-- migration/migration.c | 10 +++----- 3 files changed, 50 insertions(+), 24 deletions(-) diff --git a/migration/exec.c b/migration/exec.c index c4a3293246..a4f02b207f 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -39,19 +39,47 @@ 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, + 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) { @@ -72,18 +100,18 @@ 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, + trace_migration_exec_incoming(new_command); + ioc = QIO_CHANNEL(qio_channel_command_new_spawn((const char * const*) argv, O_RDWR, errp)); if (!ioc) { 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 b7c72fafc9..0a6ab9229b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -465,7 +465,6 @@ static bool migrate_uri_parse(const char *uri, MigrateAddress **channel, static void qemu_start_incoming_migration(const char *uri, Error **errp) { - const char *p = NULL; g_autoptr(MigrateAddress) channel = g_new0(MigrateAddress, 1); /* URI is not suitable for migration? */ @@ -491,8 +490,8 @@ static void qemu_start_incoming_migration(const char *uri, Error **errp) } else if (channel->transport == MIGRATE_TRANSPORT_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 == MIGRATE_TRANSPORT_EXEC) { + exec_start_incoming_migration(channel->u.exec.args, errp); } else { error_setg(errp, "unknown migration protocol: %s", uri); } @@ -1682,7 +1681,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(MigrateAddress) channel = g_new0(MigrateAddress, 1); /* URI is not suitable for migration? */ @@ -1719,8 +1717,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, } else if (channel->transport == MIGRATE_TRANSPORT_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 == MIGRATE_TRANSPORT_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 Fri May 19 09:46:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13248122 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 86475C77B75 for ; Fri, 19 May 2023 09:48:03 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzwhD-0000DV-SZ; Fri, 19 May 2023 05:46:47 -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 1pzwh3-0000BI-Dm for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:37 -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 1pzwh1-0008SN-8h for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:37 -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 34J2pJKn002052; Fri, 19 May 2023 02:46:34 -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=nDdoYy/t0hOZ081DVTBqbp7lBYMx5Z4qe0SmmVB4zIY=; b=SBL4b0HoP4vWNqI+lm/IfjEpgEzZkuvi9W64lTTYo6pm8oBcponZetzKy0aMNri3DXKe jH8vhzPXgdvVqD38F52cVMB7J3O6vNbgXotIrgK9ZIWOhTw30lPb7lUm2O6JWZ4vuMss OhoOOxRgmkCVm4PrGC9bugE1rxFX3SXf+Fa6bHImx+2Btl6qj3ZctOdGRuyyUCJ43KPQ EhtV5aiGLJUEVrKSXDsfQHvpHd0dZBIBejVIr75zBlxXSRsgV+/KULgc8NAaum6TUwAY 1A8+62CuBGcf1HyV8bko0EJGzhqSkIB+n3LkrWgRZRFAFwwVtVnCSB+GmF5peujPPBQB Kw== Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2045.outbound.protection.outlook.com [104.47.56.45]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3qmw4fna3h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 May 2023 02:46:33 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fKtbrpcYat+6aNyKm7FHhjfxXMzUe9Pt3+mwO1XmFK/bIaHqA+42ebD5IGymnNkiqIMhcClr0DC5A4vbnAsgYPvpxARsSqTG4QjL8RtmJK47UI6/m4m03hlkQq2S1oBS8EokPnCTkixNeHk7u58iLjwpHrKlzkRUvtv+pHcH2vY7s6fchZhxz888vo30QQeqhEkRY7vmjnlmFaCUYCIOXSyWxnGhFI/DrSsWMdesmAFJVg0DCHTUmZ/yzgrvWjbicHwc5oc0uUo5KkoKVXwk6yE7BAM9rVklzN+IiC0zTd89krh/VroKSjGuP1QrSgPF9GXU5ieKp6vxDM/TOS28WQ== 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=nDdoYy/t0hOZ081DVTBqbp7lBYMx5Z4qe0SmmVB4zIY=; b=VFaKhx4qF8+oDSc8VAIxQhoC8gVBYZuBzay3uS1Y2EUTaZnzrOpfQlvufsNPpA1RIgHur6D9bn5hChsa2pEKv5iO/B2aPyPs8UYX1sZg7vryheits5MupEOewjPFK2siDaQbvIQ6diivFRfcjQQIITA7sK0B7tY7AxLY28KBNEwvUSlOz2181ntJOcNQl62y8QtAMLOh+Y6GJy8ZukpDrCBipviB+Gt3H8LfLDVHpMZ7Xt1RJmwO2xm0GVe82Y9rmCWUtjuC5sLzwbJxd/xWT3ZdQRXAYEtzODebuAKzKnmDJ1tiAw6xStqEwqTbpzrqnFOXLIh0WBmGmd/PQkeHug== 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=nDdoYy/t0hOZ081DVTBqbp7lBYMx5Z4qe0SmmVB4zIY=; b=cpdMWxjzgLeE9kbiyXK88Lib+3GD3DlQbT71KvqDlI75Y66QZow50a8b0H4YyjwecUEqqMZ+h9ecLgDu+Ma1S9+b0f3c37f3nlrWcUhRDT9lpguofetJnCtljUsSL2l26uYTw1HEmfWMOfYupMG6Yaj9Kmq8T1lpejTmcwJEaoJpXkzzBrQhDPYIei64zld7m2vh0qfSgHNGooT+l/JpZxLlMvSNgPZ08hXWE19kv3mntGojX27ygpiJVCW8ftJNzeBLBr19xHewLLqL+RzR2BdyUQT34vg1mSl+hMEphDCvTsn89s6f91Eu5rFZXIlha95d1bZUjqy75D0h5ViPbA== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by DM8PR02MB7912.namprd02.prod.outlook.com (2603:10b6:8:11::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 09:46:32 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9%7]) with mapi id 15.20.6411.019; Fri, 19 May 2023 09:46:32 +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 v5 6/9] migration: modified migration QAPIs to accept 'channels' argument for migration Date: Fri, 19 May 2023 09:46:14 +0000 Message-Id: <20230519094617.7078-7-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230519094617.7078-1-het.gala@nutanix.com> References: <20230519094617.7078-1-het.gala@nutanix.com> X-ClientProxiedBy: BY5PR13CA0031.namprd13.prod.outlook.com (2603:10b6:a03:180::44) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|DM8PR02MB7912:EE_ X-MS-Office365-Filtering-Correlation-Id: 97470706-bc40-41de-058c-08db584ded28 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: PjBrWHG5YkxbmBkKJtgS1vxEyF8cq9lznbpT2ibqDsUkPhUew1BOF2P1pZtrn3e4egGIKeIxUIuLHS9UqE3pPXlIqQFA7X1OfMTASc3YYtrAmnColQbd1DIg0Y7I2meNOP1Oe2vv7q6n2/34gPONO2v7xTJ9qBxZoXT8x3qqSq3U5jmmZKEpIglNCxv+YFFiTdRX4eHEaUjIQXcbw3R+6z+QbYqwMJ/LdUTy7WGh8Cd55MOvzViMIgWFXGA+jiJpmlosUsTjyTugzcRFywMJFi2Z6yxEgsTr0WRb+lZBn/REwwVr5qsAJk6knQqsToxdySoeWDTd02j/V/9ZttOKbuKVC3EP0g8UqSKCIvAadS9T8UKBoA4L5l30HozSuLC/IIjwY+c+/Sc0KVrKVc/hxeaVrgyCf4WsFJwb2rPM85Le7KA7WLudz1Yisqz+vkmuZeBxmdtLju9X+/1TZmH/9YjLob5fXsJbliTbfXywtPn7rWjLPqgu5soNIyqIycaePVhp9owhHdCP6jTfD7Xe4UKHrIf/VYJi6V3zOGTbSAMcQlKcQYvrGGIKBgr4oiUvTcvgqn9V6xGIlkyrllKLubsOVVvzIzy8iwBh61pwbxrm/SpgGIw/DYWgalNAhakNNVxXEFqFZNIU86K6MMcGMw== 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)(39860400002)(136003)(376002)(396003)(366004)(346002)(451199021)(36756003)(44832011)(8676002)(8936002)(5660300002)(316002)(41300700001)(66476007)(38350700002)(4326008)(38100700002)(6916009)(86362001)(66556008)(66946007)(83380400001)(107886003)(6512007)(6506007)(1076003)(26005)(2906002)(186003)(52116002)(6486002)(478600001)(6666004)(2616005)(309714004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1OFSKPGZHEwBlXhbyl1kwNCzTkHSAHsjyjyYjpP0zIkdt6kAzHJTMpZTy0ElaM0H2MoNMUiTgd2cvsf9bxt/7T34mrjp3g1+1QRuMBDUPGtZXlU73GpQSCoLwYANtf9gld8fceYebYzIyPEn19Vlo58oN7PHGB5Vjx31nEZNVD31I37QcHRmI0MrZ5Jib2vvPjvc96Exuuf5n3Io9gzwX17Y6LDFgOjKoemzu629q0QQtz9RyUbWyWsX9Jt/8gh2oQv4mQVTp8o3thlhWT9d0lQzZXxmlwX8CZPGVM5/7rd85Hp4Y06FaK2JNqpNDm+bRWoARpxD7+faJIewnKa9fIPdFodd86zfdKiCY2V0av7nwExLHh9xuVq8l4pof2oAEWsLKbYe0Bd7bNgeCmsh4OeCLY2WmA73PV5h6II5mIJGpqw9KGuP6aHve54LC3wr4uOZqX4KGRgbrGlj+aT5SQlSfbVvaANCe/JA/AL3Z2nd5itkxxFueAhGOi9deIEJ1+XzrfFzROemk8Scqd0a3auam2eTZp4oKBN4pS0CaDXEqOMc9icHpCLbRH96CLncQwaztA2Il8pXvAxNp6YY8vIhtncKeMHOOpQdCAxLrIEeKjbro++c+6T0dc7ZZ7c6PvSKjb8nrOSt2fHDO3OqaciK2x6q8HovvzszPF9yLYtI4TByB3qq+Gw3wfthR9UccrtoAx0i54jTwoB9hODaoI0ILZIs8UPFldXBbaTNEyYZjHdAZVeWMvYcLVe5Y++Xys6yHi3Ytc+ZuaX5K5yVTraa67/nKblO3TyOcnslnE4yi/MSVanrf+jtBQ75Q+DXkxJOXqMF3Mg238qAbtE/Le9QJV/zAVxw5UhRPtn4K7vKHiPEHLLqjAJKaAP8zRmDj7pW2x6uE8a1PxKJzNObJW4UM11OP8QNBSeK0diEv3WDiufwY3Eb48x2G5LKpzvQya4eJ4PsE5s5RhZ8CRqMiTDNIwm/fL0PuEatvjep4uhqwa88GtQBr1ry0+k/AMJkf5kyC6YiZSUsGVOADFxuexbh/jWssUl051pZxIMR/1TPdItj9hYDdreepirG4YWvDlCQS7Ac3DlUelM91g5+yXC689VxslVJj3T/WxmsWwoJeJC1tMWp35zaqd9yPm8rd6H547M3KbqBxqk0OapDO7rOx7hHCr3/NLKz0V3zvKj/ldGCip+ndOYdBN4tF1AEUbJcQbyViN0U2XgrFN+mcrFi1hRTO92MowVixjqDV3SfUovvULBuiUAF0yIxu6W72P0JM2XoQ+OsX1vxQRQetzf56JEDkf++R7dYQxHUq3xPGwccUZHM/5yc+KLyhImrEggzMnwCZKsa4o4OMRp7SE6TkrX5kSAtQ0kGUY/bGHtmbNiNhu/KpPTaCxJmCm0GB9De/jzMcnqWQRqBRoinplXEoefog3/6JeZ7Rb65meiKaRkJhQW8iQYY/uSrVihZQEMWn3BGSyGEn49Z7Q750jNpMv9bJIFgIeKT8aRwm3f0Qb7iRqh3499Lwn9w1tNzlVaq1gkWml2Ix4/+NU3MR4g+dog4tKNjEkkGm+G+qev8TTW8GLJ/rv3u+yN1X41ylSvzqeQNPvZD66K7tzBUYA== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97470706-bc40-41de-058c-08db584ded28 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 09:46:31.9988 (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: vEyE56kGxGn0l7rU/dzp8WK9HVR6haRRglmblt2/a45IVIU+7D4porimO5H1nb7YZztmt8NmIpkwt8tmDFcPVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR02MB7912 X-Proofpoint-ORIG-GUID: lk28twIj2DWmd25lI_ujmQBkmT6f_-PN X-Proofpoint-GUID: lk28twIj2DWmd25lI_ujmQBkmT6f_-PN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-19_06,2023-05-17_02,2023-02-09_01 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 | 38 +++++++++--- qapi/migration.json | 104 ++++++++++++++++++++++++++++++++- softmmu/vl.c | 2 +- 4 files changed, 144 insertions(+), 16 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 9885d7c9f7..8ddfa258ad 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"); + MigrateChannelList *caps = NULL; + g_autoptr(MigrateChannel) channel = g_new0(MigrateChannel, 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_MigrateChannelList(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; + MigrateChannelList *caps = NULL; + g_autoptr(MigrateChannel) channel = g_new0(MigrateChannel, 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_MigrateChannelList(caps); if (hmp_handle_error(mon, err)) { return; } diff --git a/migration/migration.c b/migration/migration.c index 0a6ab9229b..abccc6bf26 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -463,10 +463,22 @@ static bool migrate_uri_parse(const char *uri, MigrateAddress **channel, 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, + MigrateChannelList *channels, + Error **errp) { g_autoptr(MigrateAddress) channel = g_new0(MigrateAddress, 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; @@ -1488,7 +1500,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, + MigrateChannelList *channels, Error **errp) { Error *local_err = NULL; static bool once = true; @@ -1506,7 +1519,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); @@ -1542,7 +1555,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) @@ -1675,14 +1688,25 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc, return true; } -void qmp_migrate(const char *uri, bool has_blk, bool blk, - bool has_inc, bool inc, bool has_detach, bool detach, - bool has_resume, bool resume, Error **errp) +void qmp_migrate(const char *uri, bool has_channels, + MigrateChannelList *channels, bool has_blk, bool blk, + bool has_inc, bool inc, bool has_detach, + bool detach, bool has_resume, bool resume, Error **errp) { Error *local_err = NULL; MigrationState *s = migrate_get_current(); g_autoptr(MigrateAddress) channel = g_new0(MigrateAddress, 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 c500744bb7..86bbc916d1 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1448,12 +1448,47 @@ 'exec': 'MigrateExecCommand', 'rdma': 'InetSocketAddress' } } +## +# @MigrateChannelType: +# +# The supported options for migration channel type requests +# +# @main: Support request for main outbound migration control channel +# +# Since 8.1 +## +{ 'enum': 'MigrateChannelType', + 'data': [ 'main' ] } + +## +# @MigrateChannel: +# +# Information regarding migration Channel-type for transferring packets, +# source and corresponding destination interface for socket connection +# and number of multifd channels over the interface. +# +# @channeltype: Name of Channel type for transfering packet information +# +# @addr: Information regarding migration parameters of destination interface +# +# Since 8.1 +## +{ 'struct': 'MigrateChannel', + 'data': { + 'channeltype': 'MigrateChannelType', + 'addr': 'MigrateAddress' } } + ## # @migrate: # # Migrates the current running guest to another Virtual Machine. # # @uri: the Uniform Resource Identifier of the destination VM +# for migration thread +# +# @channels: Struct containing list of migration channel types, with all +# the information regarding destination interfaces required for +# initiating a migration stream. # # @blk: do block migration (full disk copy) # @@ -1479,14 +1514,44 @@ # 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. The 'uri' and 'channel' 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": [ { "channeltype": "main", +# "addr": { "transport": "socket", "type": "inet", +# "host": "10.12.34.9", +# "port": "1050" } } ] } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channeltype": "main", +# "addr": { "transport": "exec", +# "args": [ "/bin/nc", "-p", "6000", +# "/some/sock" ] } } ] } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channeltype": "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': [ 'MigrateChannel' ], '*blk': 'bool', + '*inc': 'bool', '*detach': 'bool', '*resume': 'bool' } } ## # @migrate-incoming: @@ -1497,6 +1562,10 @@ # @uri: The Uniform Resource Identifier identifying the source or # address to listen on # +# @channels: Struct containing list of migration channel types, with all +# the information regarding destination interfaces required for +# initiating a migration stream. +# # Returns: nothing on success # # Since: 2.3 @@ -1512,13 +1581,42 @@ # # 3. The uri format is the same as for -incoming # +# 4. The 'uri' and 'channel' 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": [ { "channeltype": "main", +# "addr": { "transport": "socket", "type": "inet", +# "host": "10.12.34.9", +# "port": "1050" } } ] } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channeltype": "main", +# "addr": { "transport": "exec", +# "args": [ "/bin/nc", "-p", "6000", +# "/some/sock" ] } } ] } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channeltype": "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': [ 'MigrateChannel' ] } } ## # @xen-save-devices-state: diff --git a/softmmu/vl.c b/softmmu/vl.c index 6c2427262b..ade411eb4f 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2633,7 +2633,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 Fri May 19 09:46:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13248123 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 261AFC77B7A for ; Fri, 19 May 2023 09:48:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzwhP-0000E7-AJ; Fri, 19 May 2023 05:46:59 -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 1pzwh4-0000By-CI for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:44 -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 1pzwh2-0008SW-Li for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:38 -0400 Received: from pps.filterd (m0127843.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34J2p4Rw000994; Fri, 19 May 2023 02:46:35 -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=CL1UKJsalFSKxW2mgL7YEqL+z4e/qcEiAXPCnFWtC58=; b=HAXpbx3aLfAazqUvQs7+vIToq5LQkUQwPpvLUzZI/8ABmglWxaui8WXiSluKLDZmu4tv CTSWW4/9u46Nm2T54Lbgliu7HiF9KtjAkNe9PHYJ/8ugrQmGMxbQKjtZn53WDjHBbRLc fYvyDq/WUxjSu+xZMLXfqwVgIGWi3LOz3sJrWij7L+N3gqIIzm5wUeWYN/1YFI92JoSY qCi8ousWe/3rpzB3WfiPghU3ttWGReMCuzE8/5QwHh/53p+Cq66CdR+HpnLcVOgMeygP vOPH/gLKdj/1sQK++GfxbQTP7hbhHOX9jz9F1Zur2l/i25Fh8qB6IXZguUZ9IfQPu8iG SA== Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2048.outbound.protection.outlook.com [104.47.56.48]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3qmvu7dbmk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 May 2023 02:46:35 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hkGokfEQ+MUU3fI7RXQCfa7usQ12QiC26G7uwO9hhlWvVoGUBaAC2mkUAA7HESQMuMGkkGoTKITP0UnvinOFiuokWG95THVnsrbt6rgA94iWLHRA6vaHvoys4cz751Q0/1WzdawarFlbAqBIiL6DBp1WNYmOGt8XTUfAXflp1NEb9QWJ7u/2ZC9NnLH8M11cR2lO/k+uZFxK5lSYCDwGPc/lezEtio6KyqPYQR7sxEDgmqA+lBWOZqBQq5xIKwknLSBM/8YDq2qFzodROHsjPzIGzEQPVwnYUs/a7VnkbUvBTQR8ujp+qNnc/jcl3ivpk9DLEMWwhMRlwsx37EwB9w== 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=CL1UKJsalFSKxW2mgL7YEqL+z4e/qcEiAXPCnFWtC58=; b=lo7cHCZ1Ks4wH5lhmPNipEshJ7ac6fF0fjrrE1e/w4J9OMQEHxwjh1KNXVBWMqGhpTFMD6UfSVdL1/n7QO5H+DNbeBXI1m82dVsBWNYs+KdooL0te2hu5oexCbK2ptTeXYXa4ooFN4frNe5y0HruT1UBjLEH7+BjIjWxI/LsSWvScR/CmC2W9i7eDyk8lgrX6lIdVo2RkVdTwwGzP18PRHAiR5ykjL8CV9smCEPVfcbx29QAb839KMXqWvntIk+i6zKs/Rl4XvKT1YEvcqB8nUQY6p0LQybe1oQ24pqm2wqscfFMleHEpwOOg+61dIBixwGqb1Vwd/Z7ltImVR5LMQ== 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=CL1UKJsalFSKxW2mgL7YEqL+z4e/qcEiAXPCnFWtC58=; b=cipLW7r4vRFgZfdkJMFFm9ZGHns+jGPkELTaXCRnc0P3htDBlacv0943OAMrS6kt9ukle2y5pOhuj5duPFyCC8jX7bWwJL8BwkHhHDFzm9zAI1WQx8utTDIfpaJS1ZhKlesZlUxa5uyLdTFQIxP6rqL2Fe2J7aFKVLuTtQOu7pUtgukSLqDKLkvDsmLPbg4hkB2HJLsZ9joLyXTMZ51wRcyfmfQighOTcGX+pH5R9e8y97t+heAQYwciDqSOsih4JZ3nvdPcPmKDs2N23fvbcqiWMLpfchV0SvzHllSJ6JkB2ZCR/OvOlTub7vV8aJeJ+NkY0TiooGtH/jeF8BkIgw== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by DM8PR02MB7912.namprd02.prod.outlook.com (2603:10b6:8:11::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 09:46:33 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9%7]) with mapi id 15.20.6411.019; Fri, 19 May 2023 09:46:33 +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 v5 7/9] migration: modify migration_channels_and_uri_compatible() to incorporate newer migration QAPI syntax Date: Fri, 19 May 2023 09:46:15 +0000 Message-Id: <20230519094617.7078-8-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230519094617.7078-1-het.gala@nutanix.com> References: <20230519094617.7078-1-het.gala@nutanix.com> X-ClientProxiedBy: BY5PR13CA0031.namprd13.prod.outlook.com (2603:10b6:a03:180::44) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|DM8PR02MB7912:EE_ X-MS-Office365-Filtering-Correlation-Id: 3c089761-6159-4bee-a55c-08db584dee30 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: mDFSMCRdux8bcTQB4JH5F21SHBBXFMB4cgkMy/pagl2ERDfZf9b4AAPbqcs4SFolhrM7petWu834gmrdKGRuUsHJLJHC88y6MN2uV76rrwkE9M+QIvpB05Bp51ckeSczxehSZNyaoALp+WIA44YVwz7z7z/Ap1c3gm9sfUAc+eW5mUFeaIW6YLKqXBWC5HTx3QDYnIO26mjtFchMczsA2l00hWy4LtGizTNtHf2NZK3XSj9+WkJPp1b5wpgg3TCEYZHn36SSg0g2iMwgqt/4Bcs80/uBpTC3vgLlhOr2Mpgh60yeVB38DhWU9lHaoOdluPWJJ6Zhdl5jV8x4xqvBUJTN93VAjN61XeKjjS0p3e5eVEgw7dHNH+DmxmPUjk/6AqrVUDhnQU+20Bxla4eVHJUZK6/jgU0eLYiCplWiVdDuBi3TEEiFtm39Azys41JRWqTetCS4a8GJn4JxvT9HpSgw8KZj7pBbgNDMgT2GqOo34bUvsFOSmUP7jjMkgdLWoe7OK67a5o7Nc8xvEYz+bd0yjWlkFPMA4M6x1n0zn0gLBRVE8c89RUA9xMMnDLEidNyd3SAqZPUpqTemhNABTqHoFYKLYnsait7cgJjRJEtxoYgDmoTCh7GVRNi1Cs2C 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)(39860400002)(136003)(376002)(396003)(366004)(346002)(451199021)(36756003)(44832011)(8676002)(8936002)(5660300002)(316002)(41300700001)(66476007)(38350700002)(4326008)(38100700002)(6916009)(86362001)(66556008)(66946007)(83380400001)(107886003)(6512007)(6506007)(1076003)(26005)(2906002)(186003)(52116002)(6486002)(478600001)(6666004)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SsaZrEtZgkTVaflv/RVuO592iRJygVz+e7o+4M6n278NTdqpzr7XwDy5UL05tj4A6faL94o/dQ5i1fkelNWgJNlLihjDlVcbC/DjXWTW6lhIUzCQrEAyfhQCH0Ep77KE/DVCJR+hPBZnHSyMdQJZmhfjlaM7e8vSluy/hpDRQDuBKcxlWtJTtKpSH0EExcR+hjP58TNQSU+0r7H2SaAP5EN6vrhPXjjqhFyH8Xr1vfLCjNIobc61vOZ6M0uNToddTWQKwp5V8fEIuML0NJbiF+qwO7yH3NEFU5vbVI6wX0ylAPAIZVlK3CCQNMbp+AQsm5ZtzTwn5FmllRxgGPlkj4P28Usbm490p+ibTDb5ueHQxmVcITtn44j/9ES+H2dKRn+LSmIL3MSsv11DlYFNJTBmhiJkL2iJqanyjrpgWG90dHcmS3J+4qm87ZHZthSd1tFUSA4y+82lbA718fmXsogrkR7zH80xF8RcrA+pzjrEzvAXZCUP6NtVz1EScBpzNEci6jQb2rYuJG+x1Q1NGCwvJ1oJNeEDVR4Ou8k0/bzBZpTUaAe64SHxD0D+0B59eympRGhP5niftfjcPyywx0fgR1wodbb15cFa/SkmEMzU/jObS8ZnX4iM/GgjZAYfnlZ3WDVgKbG8bqrNlanEX2WXlzm+V3rUxyuXj7ayLJ5Rmsq0OjFtQtdCOJpx4QUsT+du6C5D87ZvsODT9Xp51DEQpq7JoKf8vchiKjipg0/EXANQRBfJv1+28lCWgUc1+TYx9rwBpEeV4k4rGoBEVBmO26BcRzcLo+O3jkVTpLO/Hm0lnTK1frY7j7ILNG1pohujWsFolKX7BviIJLachFOGltKGv0tmL5po0Zj9CfitmMRYYT6Cv+1pjcHrTfzSKvnt6GZIkfiIIi+6o8+E7u6ubPeRa+VVRwElzt9P5eSjFdW+lv7uzTIgpe5DAh1LuHk8FHTbT1+Z5umdmazjccwTz2StloXc001Z05fQ9dYPCx7noONHsaG+BPsfCIzy1YQcymUIEdIOFGFW+fPg4w37mqionK4ONyHpjd+4tyNW5VRY366i+gQfbAvuVM0Oj3KyaQgVcPPd9UDqDU9wgmFvmUYbUM3k83QUbGTj9uQ/3dFohGC/etCTE86Fp65APtlgf4pt87BvHKNr21IRME76TaTI52aCBVLjpEBYJQ2VMZre5cfEyg5peKCaz6YEtQsZxbfvtTMx9qiETtpsVwlZPvYnpSoBQdgc47ZmoIY2LS1KJHTFyPiwP2IMwfr5+Y+3b2Fp5ftMnZ9JHXQScYzQOjjQKL5YrDV9WIMekRlqaePbVIoSJo+eWw1uY0e0QEtaVaZ2TayKBayAp66Sw2PsBWOwYwtcsm3TIgcLG3lmSuzUSIrup+kS+Z7Iwd/1YDjuI8O3qwjRZadJa4MvGoXYNCKM76ic/WZPVmyqxwhn5WQ9GE3HKzRrDifY0+FwW4tZK5aZOBv2QRCshlDDzp9Z6GQKfspV2A/xi95mCpJe+fyiHKXZH3hTG8moIroUMzirEaMhEEL6O/PzOeXXc+S5+xcg4224uPRqqtVJX9I29YfOUN9M01ilzSQX4D5n X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c089761-6159-4bee-a55c-08db584dee30 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 09:46:33.7277 (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: WNZ74nu+ah8ve/dGIlyNJGPSAmNa2HDaU9Hh3ImRfWkgEYQrEtEvk8aT0wRE/Ow0cuPInlkbhiZDkkkc0HGirg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR02MB7912 X-Proofpoint-ORIG-GUID: 9TDzAZKN9cbwS5gKyZDTUL6GJaXbRSz7 X-Proofpoint-GUID: 9TDzAZKN9cbwS5gKyZDTUL6GJaXbRSz7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-19_05,2023-05-17_02,2023-02-09_01 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 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 abccc6bf26..8afdea4f91 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(MigrateAddress *addrs, + Error **errp) { if (migration_needs_multiple_sockets() && - !uri_supports_multi_channels(uri)) { + (addrs->transport == MIGRATE_TRANSPORT_SOCKET) && + !transport_supports_multi_channels(&addrs->u.socket)) { error_setg(errp, "Migration requires multi-channel URIs (e.g. tcp)"); return false; } @@ -479,12 +482,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; } @@ -1707,12 +1710,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 Fri May 19 09:46:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13248120 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 489F0C77B75 for ; Fri, 19 May 2023 09:47:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzwhg-0000S8-Ub; Fri, 19 May 2023 05:47:17 -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 1pzwh7-0000C8-Po for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:45 -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 1pzwh5-0008Sq-Gk for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:41 -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 34J8qln1011300; Fri, 19 May 2023 02:46:37 -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=ISIUxtMRlIOIJp0TeuSX/VCex3O11KEXuVzJp63I/jM=; b=LoTOsL+ooTgaEQjvk1Hph/gICQQ/tEhn8oiZk4q+Z5+xv29pDlbk9AlEpMGqfrfbE8fw 1kRJ9c5PoIAIQJrIc8zjXEqSZby5BD4gCQcSPRMOGxmyn7N1VXt9rl2IRBErS91GHb6U sdpa36nNb7OUYXy2tZNAmah3wWWbyuEuWUb6n06I6HcXxbEzbHXu0UxIUox8+/zSsnwC +pgfbRatMA32KuJih1r+9QA6WOGpVxAkrwYrgOc9pn5peHDVPvKSp7BGVymh9b+x/DRr jOoMUVq2ZE2vB0Svm+riwkXwH0rEroxke6hDC/d0un3MdNJbX7nU40snMuxXf38NKzni Sw== Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3qmw97vjca-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 May 2023 02:46:37 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GDZxl6JoDepuG9C3Qq4oGww9zbFnokk9p2qnMHNiJq0HSZb9brV9yFAcciKGcC9ZV7Olo4w6A6GmIyGJmZ4JjndEkIoSncXz/bq6s67UtPQ502FB26uZkLR1i4nOAhrDPjk88Wrla+Ht91G3mBKk6fxtOpajPcWLjqQgxzcg6ppRXIfo1KhdI6rmtNTvFnqC6BlmCwvqV2JgbfSWEnJrcsZ5Ess3UlbuMCQsIPoX4Ti+5fEpIKK17c9wbIdGTnY6HdtOlIaE6BuZTGkxyWVq+juc28n9nMjtc0zA8fb2yPgRlavV4BFZJ5VRIQvzZU4kC0S1PP+LeLdT/ZNgHS6hzA== 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=ISIUxtMRlIOIJp0TeuSX/VCex3O11KEXuVzJp63I/jM=; b=CGS90I9e2ps5om89uf+N/WlcvZW8yp5o4V92zjPWh6vkmSTjrunHRSoGgwVl4ObD+nPws2Q4GhKiObsFAV76g6wCP08nKmleYwKn+WdC9a9nuRJ25WTav+ORgoznOh1tr9ztrIVm6MRXJdQD0RuRM6lKkcaRicCnF7vd1jIUWQHScuw+eQcTBNSv8aE40/HJk5AE7JXBN4gOb8WyxX3Dnvl0rqwHbJxcGXjaFXU8jngiFboJSClqIy8zWfEVFRTwP+cuxoUXcofunss6xHBkbWlRm7OvTGDWk2Q/bZzpDlk0IFezXxnck+eOTiDruHbpzU/qLgqQgJfqhNoJ5XiRLg== 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=ISIUxtMRlIOIJp0TeuSX/VCex3O11KEXuVzJp63I/jM=; b=puPS4O6BVYFGRVyPLCpK7oFz6w/SNliMI/EGljjM2nYl1Iar/KK7Uwhn2vgM52o+84D7U6zpDy+7rFkkAMc2K91YncFSb8K6DInrYQPFIqLhvJzZKPagCPVgcbm9w0dzzys75op7k+6FrKDRXOdiP+YSOBpTM1ZP7NgklH9wi90GDX8v7hvNyu1LscEzncZNTQDxzjupHgbQRthk6/TmM6v5F4Wn2jxCHT91LnY1CGMeMemlPczTWuDr99LjXS3IKcRf9NSNvSoPs1Kox145jIVur4E2+85540eQdRKImaINk08oOTewGrEdGCgkCWID78YfkaKYFhbmdvmRlP8+DQ== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by DM8PR02MB7912.namprd02.prod.outlook.com (2603:10b6:8:11::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 09:46:35 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9%7]) with mapi id 15.20.6411.019; Fri, 19 May 2023 09:46:35 +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 v5 8/9] migration: Introduced MigrateChannelList struct to migration code flow. Date: Fri, 19 May 2023 09:46:16 +0000 Message-Id: <20230519094617.7078-9-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230519094617.7078-1-het.gala@nutanix.com> References: <20230519094617.7078-1-het.gala@nutanix.com> X-ClientProxiedBy: BY5PR13CA0031.namprd13.prod.outlook.com (2603:10b6:a03:180::44) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|DM8PR02MB7912:EE_ X-MS-Office365-Filtering-Correlation-Id: a6777e47-c924-4671-f95a-08db584def0b 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: VimLdLSfFyjb6wEQPKAoVHNL3bmGIx1t0dfe2zLK9CUFhpo+XY9fu2Um94MwseEMrPo2j/cAovhpCZRYBzWk2k1MhHA3grEm7woOjgiOLuODWBVxagtSckeTGvmGV5JFFTRsw/PiU1D1rrGpte3TCsFtmatkimGfF4DY1kI2hlUavmXCvGf7GmBpxzN+lELZ6OC+pPYnwYdrYSXOzdErPAE6/hJYWA17lKOPL3xSh8XBykfCb3m7gzNM7QCyj2RJM9K+LLJXFav3h0u5/jSS9+zAFKCz0eiacAFqH/9gytAsUsnD36AOL/w3NDbIFHpspUVzuZgogoidVDlh3di085kVKgV3UzM5KW1YSRH5Gv8eZR5yu78LhSwKQWHH4iTqImMmDemp+0HsqyizyTPHTAMHgnkBS25psn7x/oDCelshbqwslZjBt0IMtkajrDl92hl1OTReeOgmHwjJUoLmeG5ejb0zbsPvpQeXGd/woh+bDxyOzHizclkTv1JO/2oxpuhdBUQFMFdRtOo0EW9DIe2QyVCmJFkBLVruCOYstDPIhsnosYUWQal4IPVsgUF67e1/KpbDXXG158fFqrDhQu8BNlUbjxfVlI9Ty5EUKiBboxzT2U8FzffXDAHzHA0Y 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)(39860400002)(136003)(376002)(396003)(366004)(346002)(451199021)(36756003)(44832011)(8676002)(8936002)(5660300002)(316002)(41300700001)(66476007)(38350700002)(4326008)(38100700002)(6916009)(86362001)(66556008)(66946007)(83380400001)(107886003)(6512007)(6506007)(1076003)(26005)(2906002)(186003)(52116002)(6486002)(478600001)(6666004)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ihqXE5maWL7PSZjIs/DA7uWYQfO5mrwwuMZiCVCXNE/CN4tvKnMxJfS8XW23FiFi+Io0OM+EO1tQGkeCwvNhmJEsc+4Lbw+ydxqLAzydcJ+U8WRgMU0mBHtS/z7tsffegXkcm/uuXRvxs96ErmHgpuarXeFpu1B/5XB5w1NRBH7QlCMx1W83nnuDtOARWYzgdyZvjTucOwfNgBdrV6EK08MmUAQSRiOFzdA1dq8CCCMgYOOxmRjP6GJDcC7URK/cOPytGqi1weiQ3j9sJOFset9IaOp9hefVPOKE6HjEGi4CV47MmuEmoxO4GUALpk+KOwamgJz5CYjP5lj3RVQtQg3tjjtMJJxUBNv3dofYxioo6TErcSSvtcXWvXM1ZR/MPTspAG3flA6SHZzF9k49LlddW9xRWdAFtoGFXefGedplhUwCTL/fm+Dp5Lm/Xjqu1FW2/MrFy6HWZQDKQU2cJJFb/vbvxs2nBk86ym9codjqLk6w2Hgn8NYDnVYMI77qcEUajGcca7nEsUl3YEmEXdo0p56qleaG7vhJJI5ewrNo4SDSYGWKbswT0DMBoV8t7yNUv0c2hZpLtGEGVK9YDuDRmETQ9g37WvsPlWcAG/md9YhNmP85m9upxN9nZYUklqsuSKd8waj2JKYunH844803jpQkpOcNGPgwjMKevIjs6hv5UZbzIGDVKzOn4Jr0D+3Mr6aAomaRLkl21CvbPIJZCtwz6XTa0bmXxOBk2HB7sCl/ML7vYP3rJ0LMp3WghzWqyTIocp7XI+r6a1O8DJdOgI2BiO6JzkfE7FNaCNLlNPE4RV7WwYaSVjaINalnT9Bqije3KRCcJJJZ/gFrg0B4phBmzrvWULq5Qowe8j+5Pv2mjHOETLXazvk8T56m1aLZjE25FsFtxQQ//UuaLg6K8WWWq7WkDgBnJ5g+3IMJps90koRNWfHNg3iqdTkA8LY3rV890j/j4k+NcWwKtmDix6hAnZUDBYp7YrmvLmMbMWvSw7EQMuSYZx3lhC09OgPVdMi3FHaTY9GRcr0k2mbZ+SRDyt+vCXL29mVsi0bSVl5WYULuY5EWIhXwRp39M2uY5cFUc1sniBeJZ6AJ3X7zGncTMk0rgfjDRwwkFqXnwwWdd0ysvdyvWwO+iZuEfzaJ+TZU3B8YFM1aHbozTVffcyxe9sxIcDF26qJf8yndxisQ02hwjiXhX+0V6qBD+RVzahYlOyJqRVreKjSBRZn8YJdtBFJdhWx8goNCHBDtNzpGn8ixcPTiFE2ukfC8Fa/xH3eMzQXAdMPXN9Ea1UZRv/ww1Fgci/hHRi05cue9VOSXe2Wb7+KaQ2gBvisHA7Mfbqn7MyTZDjmAYZaobbxjSlyTMTQVWsOi1zFSGSRf91FsKIDX8kVSziuUggl3CPtffh8MnSgMY0kazd8OT5rmWWA7jHdqJmmyoz8vPSsHJ5yLU4ovIM2PPXrlKyOpf5DoRMcXH2gWYE4zRYrvhZL43q4bzcreD6184Iz5XH0EW+OIamPM0NysL1Sk8Vz1+gNwkjL9r3MZH7Hpqtg32C/XAdxaKGFZY+H3AAB3MecJXZdG5RxkbxTgGxUMY45O X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6777e47-c924-4671-f95a-08db584def0b X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 09:46:35.5109 (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: Nwysd1q03YXIq0Znx0ckWv3IeyXm4W5Z57sSrXhnemRFLlNMxajgPJ/m/NOXUV/Os41jYXl632KP/bD7BIYWNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR02MB7912 X-Proofpoint-GUID: xgmAJLvsx14-6ltS9YDJkbkL3ww_g6Nf X-Proofpoint-ORIG-GUID: xgmAJLvsx14-6ltS9YDJkbkL3ww_g6Nf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-19_06,2023-05-17_02,2023-02-09_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, 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 | 75 ++++++++++++++++++++++++++++--------------- migration/socket.c | 5 ++- 2 files changed, 53 insertions(+), 27 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 8afdea4f91..57085753f4 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -424,9 +424,10 @@ void migrate_add_address(SocketAddress *address) QAPI_CLONE(SocketAddress, address)); } -static bool migrate_uri_parse(const char *uri, MigrateAddress **channel, +static bool migrate_uri_parse(const char *uri, MigrateChannel **channel, Error **errp) { + g_autoptr(MigrateChannel) val = g_new0(MigrateChannel, 1); g_autoptr(MigrateAddress) addrs = g_new0(MigrateAddress, 1); SocketAddress *saddr = &addrs->u.socket; InetSocketAddress *isock = &addrs->u.rdma; @@ -462,7 +463,9 @@ static bool migrate_uri_parse(const char *uri, MigrateAddress **channel, return false; } - *channel = addrs; + val->channeltype = MIGRATE_CHANNEL_TYPE_MAIN; + val->addr = addrs; + *channel = val; return true; } @@ -470,7 +473,8 @@ static void qemu_start_incoming_migration(const char *uri, bool has_channels, MigrateChannelList *channels, Error **errp) { - g_autoptr(MigrateAddress) channel = g_new0(MigrateAddress, 1); + g_autoptr(MigrateChannel) channel = g_new0(MigrateChannel, 1); + g_autoptr(MigrateAddress) addrs; /* * Having preliminary checks for uri and channel @@ -480,20 +484,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 == MIGRATE_TRANSPORT_SOCKET) { - SocketAddress *saddr = &channel->u.socket; + if (addrs->transport == MIGRATE_TRANSPORT_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) { @@ -502,11 +515,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 == MIGRATE_TRANSPORT_RDMA) { - rdma_start_incoming_migration(&channel->u.rdma, errp); + } else if (addrs->transport == MIGRATE_TRANSPORT_RDMA) { + rdma_start_incoming_migration(&addrs->u.rdma, errp); #endif - } else if (channel->transport == MIGRATE_TRANSPORT_EXEC) { - exec_start_incoming_migration(channel->u.exec.args, errp); + } else if (addrs->transport == MIGRATE_TRANSPORT_EXEC) { + exec_start_incoming_migration(addrs->u.exec.args, errp); } else { error_setg(errp, "unknown migration protocol: %s", uri); } @@ -1698,7 +1711,8 @@ void qmp_migrate(const char *uri, bool has_channels, { Error *local_err = NULL; MigrationState *s = migrate_get_current(); - g_autoptr(MigrateAddress) channel = g_new0(MigrateAddress, 1); + g_autoptr(MigrateChannel) channel = g_new0(MigrateChannel, 1); + g_autoptr(MigrateAddress) addrs; /* * Having preliminary checks for uri and channel @@ -1708,14 +1722,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; } @@ -1731,8 +1754,8 @@ void qmp_migrate(const char *uri, bool has_channels, } } - if (channel->transport == MIGRATE_TRANSPORT_SOCKET) { - SocketAddress *saddr = &channel->u.socket; + if (addrs->transport == MIGRATE_TRANSPORT_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) { @@ -1741,11 +1764,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 == MIGRATE_TRANSPORT_RDMA) { - rdma_start_outgoing_migration(s, &channel->u.rdma, &local_err); + } else if (addrs->transport == MIGRATE_TRANSPORT_RDMA) { + rdma_start_outgoing_migration(s, &addrs->u.rdma, &local_err); #endif - } else if (channel->transport == MIGRATE_TRANSPORT_EXEC) { - exec_start_outgoing_migration(s, channel->u.exec.args, &local_err); + } else if (addrs->transport == MIGRATE_TRANSPORT_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 Fri May 19 09:46:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13248125 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 1952CC7EE23 for ; Fri, 19 May 2023 09:48:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzwhE-0000E1-DE; Fri, 19 May 2023 05:46:48 -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 1pzwh8-0000CC-W0 for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:45 -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 1pzwh7-0008Sw-2W for qemu-devel@nongnu.org; Fri, 19 May 2023 05:46:42 -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 34J923xu028216; Fri, 19 May 2023 02:46:39 -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=WZHyegdihqSgcUIZLMoRoLOBn351tr/V+Ov5iI36Abk=; b=fmxolm1be8F8VItX90FH9ZaF3EX+p9A7CkqIvdRzVJGDzMEryo6IQQmvbfaXEWJtGyaq RbPzhJYi9rwuwpINZWboJQsbsD709wp/LpJkllNAtXLEv9hnFs6uQ+jjEEKnSaZEn79D yQQi738DIXW1oYDupX+6UbqtY65LH/bGR94GR+KqgEcnDU3I9BwxQ7s+aI2LEKOM3sx3 duamwOEjqvj5oBH71tDrVLVQaDWtsK2wTyD18q/vcF7J5t+7UQNXTlwU2cewgMRXO7KH q+0GKNFBSvGSzMmZ1ROIcMfh5Ft7yFjoDRpcoGSOuZ/D0zdJrbZyxxC5HzaXmZbwJaDm lQ== Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3qmw97vjcb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 May 2023 02:46:39 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KhzrO30CA077J2tQasV1zoBnYjLrjjaWkPWJZCxlMOI3VOBhbzyME9UAyDm9VkSvo3l49wH9pOzdp1G1DBxFSFACLxlzZi4eMZMc+3Zydfe48zXf9cnLvUDWEdR0YG2vffQsOSrDR597Km98WqJq0HxFQ61QBdegMlAgNnlHIGr9bOzSjQHLIvESB3NtAeXGmeWAQWPVUhf9N6GKjayEcd6RfK2MZDZOyntmxd8krp757b1XDlzkjHsC4OdiHBo5ZLU5ybV8rHLnybWOGKl7lJ7jHJnRR0la2SyM4XfuSQcTSEaLYK16OTbl4NmiPeBCoCUac3wB4UQR6r8OpFpC9w== 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=WZHyegdihqSgcUIZLMoRoLOBn351tr/V+Ov5iI36Abk=; b=LzHumy4oJ7UikdiuOVCCitWw6CSHE3cEHMSLzDTzMs5XzPU+g0/DHdprMEC/+TxwTD/cTqhvhTxS+2MXJPdoWny17w2XuGZ4PeoR24V1jeqov163fuS4VXNtAlsaWhxz5IiH6b98RU2Dc9ITU6+l+93mS3PfGAuGxKTxwV1P+7FWdjzmZ/DISRS3tU9xuYsvxLCdnQTfOwRE1c9RNMNXvsYDIrPbnwDzjzBObZ7w2MKYbW0DamH2ei6RhDSKVRWy25YFoWO9byfdUVUX+1A4nL/+syAw9EGpfNrytM5Ok1tTOYsMYDs52fAflLdYgjcMocIE93r4sHA3R6KhxJ5kqQ== 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=WZHyegdihqSgcUIZLMoRoLOBn351tr/V+Ov5iI36Abk=; b=PfLu0zI9v+Gaa4yUus/AG2qkxcNOboDP+37/0tQ4Qkd8ZAxkeSuVE1xpfAaIzibdC2njEmVUM5Zpa2p7V7euKMramj3LxAlgA6t3kXGaQwU6UfugPQvfzjedv/WHXNFwWkJVooEHHe3qU8GX5LSoDLscWU6ySkzt9FoHAamRH4xg7SIjC5YsZlXqkSTiE6ZJVWMz3haT50sBFd7AlHsoWDay6zKsPXpaXnhV0Z8j3vTsZlLhgjARDEnJJOjOC/KdSacbWf2ldvLjGZEnCx2bCYjerVXtIVpuS4KgvznDtJRjvPCVw4ws6ig6kvLSh9XG0JBte1BwjBDIZHRsh5mmsw== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by DM8PR02MB7912.namprd02.prod.outlook.com (2603:10b6:8:11::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 09:46:37 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::4500:569:a3d6:71c9%7]) with mapi id 15.20.6411.019; Fri, 19 May 2023 09:46:37 +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 v5 9/9] migration: adding test case for modified QAPI syntax Date: Fri, 19 May 2023 09:46:17 +0000 Message-Id: <20230519094617.7078-10-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230519094617.7078-1-het.gala@nutanix.com> References: <20230519094617.7078-1-het.gala@nutanix.com> X-ClientProxiedBy: BY5PR13CA0031.namprd13.prod.outlook.com (2603:10b6:a03:180::44) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|DM8PR02MB7912:EE_ X-MS-Office365-Filtering-Correlation-Id: 8bd5267f-ee89-4328-a571-08db584df084 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: KocDfK2IEK997sMX/SXRYDIhzKrDNOjfo3AdObNyYSs1HNpwB8kzQzZqdIrzxOdrQ1L7bhcpPBGLlwj7YBzxihwnde/3jPyB+qIXCT9VzTaU0GZ3CBYGjJ9WRACCyN2qpEpDENasslGm439vIZyXDrHu9y6cQZKc3TN21r33mNjJ0x4+11ig/2zYigIfKcfYprPXCsoG7tYuVkc5V/GpBYVupiNdXtwMdyc1tW5YfcQH0n7yaWJLKd3/xxGYFRDa3yiYugyf9EL/Fh5xVQfLWo2RsPgws8+zmUcIBnYqsoADvwvAJYazOWbGoWMTpgHOCga5IE/vpqkVNIOh1RZuYLOGQ4jtflgTUf5YxmxjnnC+kE5YFzlW3hVF+nsUXmFO//e3q/iqvr2wrQXZRZAQPIUcgVfycd4P5Yi6XsbPjvOwG9HSMJI3+rdXZ4sCcf76f+90cvapdOdykijn26qvfLQ+WvYS3F1Hmq8SQ6CorobuyaYrEv0VPAtK+7Te0mqqm2XASD4MvFay8nbaPLpnD4CtwiP1/07WtF9RqEldbnVmTiAtBPtfLNBhBzb1FH+oTpHcF9dYUto1JvLN3nZblrEAfPSjHBFBsBEoQ7p4Bkfm20AXM4tmtCQsT99t9F0o 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)(39860400002)(136003)(376002)(396003)(366004)(346002)(451199021)(36756003)(44832011)(8676002)(8936002)(5660300002)(316002)(41300700001)(66476007)(38350700002)(4326008)(38100700002)(6916009)(86362001)(66556008)(66946007)(107886003)(6512007)(6506007)(1076003)(26005)(2906002)(186003)(52116002)(6486002)(478600001)(6666004)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YxQhU8bgGE13T/Jlf99tLcGIE1XzX1heq4rt/KhJRUMHPPQ4eCEdsGnUJ6teIglcJXpRRUsbK0cA7KW2/e/+EurNPJgOWgsr2IRn8Xz0TtI6JmQt611uXXARKo0tUQsi3wAvFiyYDf0Q50n1cFRt2HKkc51YOsJzBsE0qAPwsBFpRO9Ezla8fUaRY5fKvYayZiy0Ro03CybtvTClvXJtlXtPlR2lhYuz7fjRe1UP5ZW/D2H+QmZA0TRor5Y/Bw25AVpsiELGYWNT0dqhkrZcA57xBs9M6VU1J7UuKIEkt0C1XhQ+/wZLrFLyoFAo+m9SN78sSotWeDM3bYHkPeymM9kb5+UIpAmzuhQ2ENL6lGQt9dAhscy1GetjqLncNraVQHHbfd4hcRC6qizX52DdlQVNO4pQVG6cRmI9ieTeBRBjR/Ifx+q9jtRn1sAW21bPOxIMypFNfn4zHNQXDfJcIRTx956y/IqDbSMI7sR10a+OvjPv8Dyqi1lpoDAJz55l+RMpJXw0s1jwtTBwGcJDGr5kq/KlR5CT0qnLohgtU3BMcEXGefjVZ4CTOJDhafP/fx+ZAouXYSyqYtJKBWBbDXdT1HOS4VRa6nQDR4LEVMny/fN1xdWuXtnjUypt1vASXrMCrJaR/IrE14ig6umxLw+WJt5r2RCv5zd53thvrIcoPF3HrJ1atkPvZwV19T+p2oRG9G2Mv8SAjLxNIODqmEQlmYb6hv9NiCrCy748WO9hwRssDaLneKRRv5CgmP6RA7NemA3YAhd+QXMMN/NsiwBl/RZ+t3GMW+nc0EduLGr6a0RhQEtHr3sTTSORvHr7tVHI9uiw7jCgtOBDlqlR3wGKbv8sgnhFVuP3QMEcbHvWhdbnQQwyDdCee5j+2ke17r+u0U0KIJ7u3Scbhih7issKJzS9qbflprQvv2eLFUZp+LQBhlBZC4A6fINeO7437nkyTNPoSytmYU5WohcbRo6vemU787H3D6uokYWAq7V9OEe3rW3cnwr4ukE+DHXAIxHcJy6sFogb4Le9siLG6/qH4+L4unTfSlZbhXmbZHWeyrXmrN+eefa5Wdtl+vT4xuJ392sOeWcpWkzYqANzN8fWZ72hu6hQLtKkqJ3orYqZ1n/A8vWUSMbT5ngUKwPQcQeOhfpQB99neMexLqjblSA/7yV7FrdTgi1BODP7MovFxYAJu8QrITLtkL1OElOLtROBDHoltASW6oODyoThhZPJCc6Mz5EOcoN5yPKOC+vC4gdwc/LafijwmL9fxDaUBhg02uV7KZIA8AX2EEdYyyKNj4NsPVuQraMq8HKtVu3Q4dbDHGm30AW52DmeLsM1X+SkmoOJ5Tl788Ni9EVIxjmmVpUkiOf9Phfod/UqLowWVas+0UzykBKgumWxsDVhn1EkJyCzPEZ6W0iVDLORJrtksU9LMQu9v1k1vURNkw6b6hRZEPukavTMwCsEC4OMuK0GOZyOIyQnGRw16OG8KRnHKeCM3tLB0TIUvdBXv+JW7Q7q4LxErvgR686T6Y9o3mJy2ILWKHfe9Oe/CRc+1IfGgIIlIS8+4z+tnfAnM5hgyms2m8O3WsKN4OgBlGPo X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8bd5267f-ee89-4328-a571-08db584df084 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 09:46:37.6592 (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: pxm07RBvXNA4R4nSfgkT57JUBOdThOS6TUgSfryGeJ+iXO9r0zArEAPQEqHd0+SwCqVjh93XctfD4tqXTPaGvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR02MB7912 X-Proofpoint-GUID: 8z35C9Ypm94aPirWXa3Y4bLYPhtHBScq X-Proofpoint-ORIG-GUID: 8z35C9Ypm94aPirWXa3Y4bLYPhtHBScq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-19_06,2023-05-17_02,2023-02-09_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, 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 | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index b99b49a314..ef6f9181da 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2021,6 +2021,34 @@ 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) +{ + QDict *rsp; + + 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 */ + rsp = wait_command(to, "{ 'execute': 'migrate-incoming'," + " 'arguments': { " + " 'channels': [ { 'channeltype': 'main'," + " 'addr': { 'transport': 'socket'," + " 'type': 'inet','host': '127.0.0.1'," + " 'port': '0' } } ] } }"); + qobject_unref(rsp); + + return NULL; +} + static void * test_migrate_precopy_tcp_multifd_start(QTestState *from, QTestState *to) @@ -2028,6 +2056,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) @@ -2053,6 +2089,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 = { @@ -2736,6 +2781,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.