From patchwork Mon Jul 10 12:27:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13306863 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 DFFD7EB64DC for ; Mon, 10 Jul 2023 12:29:51 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIq0A-0008LF-KQ; Mon, 10 Jul 2023 08:28:26 -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 1qIq08-0008JP-T9 for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:25 -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 1qIpzy-0000jw-Ip for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:24 -0400 Received: from pps.filterd (m0127841.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36A6g0PY002141; Mon, 10 Jul 2023 05:28:11 -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=yE8QNBoBo1yNhXkzaJo4kdSTJRNOhJiLF7qssFTcp p4=; b=zNGwQ68YkupVX+xYpBPaXmFv7y3obfX4ntjEpWd/tqSCH2nj7bfvLFImY JK8tdKYZpDUj2vTmUnmRg1YaKRHsm4bobeeAGXMsgFlvg5EQxmRQKZSvLHKUJvu4 Y/RvYvqx6a/XTwxziZm11XSs0reJ5pt1DXG8QZk/fsiyi2h9pYh32hexJIZwqKSM FQUu6GhUZQUFjdFdpwlrUpNvaDqa5VIWXhNpKaPrVv60ECKKIgYPLIlsTWpSUoln sLt2x/a4auz/4GLm+rRZgDcuCjz/BYQkxZ6PBOELomDANQWOK7j1tGHDmh2zYnoZ 3V9lHmZexYXMJHLYlDbKnV6dIJddA== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3rq5b5b2te-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 05:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YRwCY24YMAyv/SvunnFQEmpJkKRecknftpFwA4GjwOmMUUYQlRK7OfIpXpk3x0cl6qI64T9AKf0m/nvfSOiyK50xjcFVdWBsUjrqWJF1h/R5oYG3WSlJLJ4K+JehC9yvoSvcA5GvBVTS/ltgc7IeyzjP7FSMCSG152Bnu95ZYXXHaglVSUhL5t1LjDdu1ya7FCF9tsJQmgypw34yjTExTBFeKZ2+HSzX7D9aAkWAMaMVZRyoF+J6NWCQ8YKnjFxbxffj/rMBV4umod7DRgIBJ93yq/9PB4hwYlm4WBbazIIflGeR63p+U6rnPHDLUfejStV4rXPdVQASQjEh99YgBg== 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=yE8QNBoBo1yNhXkzaJo4kdSTJRNOhJiLF7qssFTcpp4=; b=Q48lwgwiuYGhiPUG6neWfUppGRnDhmU6fV7ZCOnigdi0+XxgrSGVTe/7/c72KqKp8rWDk8Ps9p8kCpKa6yt4tZAOYxCrBuz+AomsZiIErPJoQGHprEuxgbUHJ8dZmCmHqWscAnEnMmunZJ71cJfgBMRmKipXUTvmff6kUWab7AAlI6E09XATGoi2TDjr5/zPj+WFHsN0tkwXdqqpav+fKx/sk/jUqf4z8swUs0oIQgdt66VZDusFcktkKGGD6Rfga4xRw41QFmJ6ICLtuheKJ6iszmT7HoDkOhqFKFtJXgtPzKM4SAlrsr2VCbO5Xznq/JPda83c+MF/xMgliCf8bw== 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=yE8QNBoBo1yNhXkzaJo4kdSTJRNOhJiLF7qssFTcpp4=; b=iOVsX8PST/Dsr4VM8SqXE2U6HUdj+nlXQAtLrqmheGyXiwgYIqoNYvqX9DJK3QCqjPVs2yB0D1bvSJgF6wXWoxNOUXM5IupCYPXx8DCAnhQ7lXcEO+HNIldHiw8lx9Yq87IHBXrG9lAAUSe2STTzBX1KLj2rrgFkBBZd/koImLDthW6lbwP2xSuSmCi38Et/xo7z4OpRV1VQ+ZeJ2kD9KyPG9QjhROBUo5vy0mnRwr9fi/5mqlCD5R8nR//TxWKbkRZ/J1eQGNS6+7daIRNBNw0O/6Hh2UaIfBQCcKaCoeOGCDryTTsEppJ39sQKciZK7yxe5VnLQ65Pa/Md9NABkQ== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by MW6PR02MB9934.namprd02.prod.outlook.com (2603:10b6:303:23d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.13; Mon, 10 Jul 2023 12:28:09 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%7]) with mapi id 15.20.6588.017; Mon, 10 Jul 2023 12:28:09 +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 v7 1/9] migration: introduced 'MigrateAddress' in QAPI for migration wire protocol. Date: Mon, 10 Jul 2023 12:27:42 +0000 Message-Id: <20230710122750.69194-2-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230710122750.69194-1-het.gala@nutanix.com> References: <20230710122750.69194-1-het.gala@nutanix.com> X-ClientProxiedBy: PH8PR15CA0003.namprd15.prod.outlook.com (2603:10b6:510:2d2::25) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|MW6PR02MB9934:EE_ X-MS-Office365-Filtering-Correlation-Id: eb343ff1-30a8-4b89-6f40-08db81411ebf 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: bzJFUpILrq6GBPKOQzT8gNAblI1YYkLwOPA0awmRqr3wLYLSTigEyWxxWcUSDjajQmNq8BB2d0fcrN5U95grWVBhLHcin1f3DW7aNTGqO/BSnYH5Ntr/qtcr7kwmwVb8NhCK7/7yh1Gsw7t/KaPZuKDDJs5P7AaKrlQ14Svf8twytUllJ70XSQ2NZvxkeq00m6YrvIc+gQt0Z+21hZqUEsXquKqo4+Gw9Tzj469JZLFsrF+uersgH07jtz9vTRz/81fvxCfOU545ImknkOa8iTxF4xmelCB9599gGE+MminQVfFZo7B3ObtAXn8809fARUMOWmTBKt9Wg5tLmJp57OLyrdCWy+jG1qsb+Po/2yFgTXkTlQLIouq2QZiA1FBTs5KFfEEp9D6bylgPKs4KEW0MZ3UA2v7ed51M7BpFlQb3PYwFaby8x0uNd3Z9IgEFVSS80XtKrskpqMvDBDjAM9IK1bfSLG9bUn1JwmJydeVvKipNcaVHqQyrjmBEaio8tKO3tJg1LzwZMGW+uI/2V12UapIWIoHkIh3c9s2mEdBk5aLv1T/sFvIFbiyqeWCjTd8FW2AOu+RHraQO2/sqUREaA09lPTmzGJecKwHhqb6hoCxPg8/2YFAj8ql0hGBp 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)(396003)(136003)(39860400002)(366004)(376002)(346002)(451199021)(38350700002)(5660300002)(66476007)(8936002)(8676002)(44832011)(38100700002)(66946007)(66556008)(36756003)(2906002)(478600001)(6916009)(86362001)(4326008)(41300700001)(316002)(6666004)(6512007)(6486002)(66899021)(1076003)(52116002)(186003)(6506007)(107886003)(26005)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?FDWNJqCCZ1qo8lenZqswYEW+MjYk?= =?utf-8?q?8YBO1W8dfgejNmVwmJYbnb6jkBSH44dBeWwmTcbIk/ZgvrrFolYH7b9jLjlaVAK1W?= =?utf-8?q?olQGzdSpJkRXp+6VjM0P0ASR1Tj6RBPO0/sSlOvBwovASGE0678orcG5SyNg+KBVa?= =?utf-8?q?I2ybxdob1lvEKHoccdjPaZ8Zf40seMlq53/AICuoSinMzvIZngMq7cvBLpJF2Tyip?= =?utf-8?q?DepIrnGzBjwOBwDRsmKgTHjgUWdbMbHP/gVQGAQwQ+x9FE6F8RIZe+Nrg+sGjmY+F?= =?utf-8?q?jW3DsUOAFNpsLx1TKogJyFMLqeeuLdciQqi8IGzcDmNwLTSPBZL/ZCNLufr2UIPIH?= =?utf-8?q?T3ESguCFEYiBTnGZaYuBvfOdrT+HYmy/HoHiJ5to00x+Am8Lply/SRF8w/C5mtcL6?= =?utf-8?q?ROMCv7P33+mJASRIWINoNfcwsTlguQ5hIJ4Ekn/86JUUZH0gheBTTQnYd+45LYJDt?= =?utf-8?q?FxqZ1BFPabCL3EiR+5TWJhnM0HfKuEcVGlMKp9Wm35JFypnz0+V7o+y/6AND9MSGM?= =?utf-8?q?OvQkIY/cc7x7FYItsgQM6JULsbqR83sdL7XgKj4vPTzxAVuJnIH96Q0eBEhBKVu5q?= =?utf-8?q?jBk0XqpIDBgK7tMribghA3Vul42dp1ZBJi44hDvLbgIv1zjUisLeAUu4bU8MS++wi?= =?utf-8?q?e3gFdDKgPZwAIsL5Xls+tSEWdRWBWJ6wH+/dXH5qsHnPziHyuUeGA90DKY4pWABzI?= =?utf-8?q?jh5M3JVd3r3/dlgDFiplrhk46X0i5Eyx7Yh8BJs0nuFuVHuUU4Ze9c7l/qOlmTOE8?= =?utf-8?q?p9FkVwneEk5hYCZkXMV+wL8HPpudI+DRWS0KGtwDGY7qywuxbpHLVmTcq/W+hmqve?= =?utf-8?q?OqYp156MYy1QMTuusmpm8sHm+r1f9TlOxoa7aanqZ5nFHPXv/aQPaQv8cZYjkx+z5?= =?utf-8?q?BVBt3xiprkVxnpp/kNUe8iQWKyUu17g1VPttCXT8BavblkGDuc1DRw0dCsMdWiQ03?= =?utf-8?q?ohBH5cAcyWZE62sB5YIHYZTGQE/KJYdZx1hQ0tVXmKtvwZoooHqBRMLnW3XF5fw5n?= =?utf-8?q?J+jpFknjJ9GgUxuN1oLQ1QWKA2yA7RULshNxgU86nJG6vAMRJtiKJUXd3yXt18e5s?= =?utf-8?q?LsnN2LIo2OTIr9nJbJYY8Z2MYhWmO7rgIzZgFihJrdsGOhPE8ITo7M718o9ayDC1p?= =?utf-8?q?dMDZUnMoD0PTmi8HJVnVH2M3Y4JwryrddkL6Y4VqDcgXQ35eDZfyJQE0sJ5gjW2MW?= =?utf-8?q?Aykn/JwwT5l2w2/EFVqF5LCP16K4dxT9JQ4q27YooKF7OAvSAMlgxlhl+ZGyH0sjQ?= =?utf-8?q?7541lAr2q8oeJxQrSu/WHR9gJGKx/LXXrLAsez2tNphlCmqnAEXYRHCG7CmoNFBXX?= =?utf-8?q?6FNClHazwsg54UdsfLKOhAqR/sZ29P34jo50Kc9E5kyfX9OC+IHXI3KV/loWLHN1v?= =?utf-8?q?YBkdmmoTatOc399ksDXT4FxGg7hlda88lvRFU7blwc8/yZdIq6uogKjn5u40m4c0K?= =?utf-8?q?Flz5AnnJ+ZndkOmSXthnhVq2yWtjyGZSKwYJN8hmiMSx5IrhrLHFpPzxv5MREuFP/?= =?utf-8?q?FbuoTJoJLd/z?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb343ff1-30a8-4b89-6f40-08db81411ebf X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 12:28:09.2985 (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: ukV9CRLd9AgBxIB4he5DozFSYmsrIZvIw92B0usezJgwAzLonrBXTGxniWbjLqJ3iaNWeO8av49lKUO69qSFfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR02MB9934 X-Proofpoint-ORIG-GUID: MIaDcasKt4Uv6X_htx_25kUwFJ0AGUhD X-Proofpoint-GUID: MIaDcasKt4Uv6X_htx_25kUwFJ0AGUhD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-10_09,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This patch introduces well defined MigrateAddress struct and its related child objects. The existing argument of 'migrate' and 'migrate-incoming' QAPI - 'uri' is of string type. The current migration flow follows double encoding scheme for fetching migration parameters such as 'uri' and this is not an ideal design. Motive for intoducing struct level design is to prevent double encoding of QAPI arguments, as Qemu should be able to directly use the QAPI arguments without any level of encoding. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala Reviewed-by: Juan Quintela Reviewed-by: Daniel P. Berrangé Acked-by: Markus Armbruster --- qapi/migration.json | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/qapi/migration.json b/qapi/migration.json index 47dfef0278..b583642c2d 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1417,6 +1417,47 @@ ## { 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} } +## +# @MigrationAddressType: +# +# The migration stream transport mechanisms. +# +# @socket: Migrate via socket. +# +# @exec: Direct the migration stream to another process. +# +# @rdma: Migrate via RDMA. +# +# Since 8.1 +## +{ 'enum': 'MigrationAddressType', + 'data': ['socket', 'exec', 'rdma'] } + +## +# @MigrationExecCommand: +# +# @args: command (list head) and arguments to execute. +# +# Since 8.1 +## +{ 'struct': 'MigrationExecCommand', + 'data': {'args': [ 'str' ] } } + +## +# @MigrationAddress: +# +# Migration endpoint configuration. +# +# Since 8.1 +## +{ 'union': 'MigrationAddress', + 'base': { 'transport' : 'MigrationAddressType'}, + 'discriminator': 'transport', + 'data': { + 'socket': 'SocketAddress', + 'exec': 'MigrationExecCommand', + 'rdma': 'InetSocketAddress' } } + ## # @migrate: # From patchwork Mon Jul 10 12:27:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13306870 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 190EDEB64DC for ; Mon, 10 Jul 2023 12:30:19 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIq0B-0008Lw-Cd; Mon, 10 Jul 2023 08:28:27 -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 1qIq08-0008JQ-Tu for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:25 -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 1qIq06-0000ls-Q2 for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:24 -0400 Received: from pps.filterd (m0127844.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36A6feiF020935; Mon, 10 Jul 2023 05:28:21 -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=LZuRxmOF8pMmOEJONkSHfrpI/6ZokjlPiGL9NtF/x qQ=; b=pLMe/nBeP8pP+KjMl2ymjhB95JemyNE+up7a/5Vu0/5RsrlB5TLNlDn5i JDLRoMvhOQfURSOm2tnvs7KZBE75/34Xn5MMINDdhlr2hEem+24eJ16LGHAfreDV qzMQ8mqQMGxaEP9Ykbw1UAFYYGgVaiuFIr2Wpi7ngwCF/I7iEft+yT5O9Tr3rnAM 01pAq3BadwsRPbm6+jBq+iqNahuwiYizc8nSVH44NXSAp55Q194WU4zBG49DfpEe +E+knkjxjaREz334enZB4rH6o0DCMbg5kVySCE4N06em5hXadP6RWAR9JNcLch79 0JX3ltCd5mldqA843umXJafMOf51A== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3rq7awaxxh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 05:28:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hFXMKFrGKw1gVjZoXvHbJtLi2W3HOuwHsBDZDxXCSiiJQ3su3is8iUjWLPkcTXu8trlSwfibW8Gy0eojU/C/fiFSK6BAuPSBdGRjMdommN9Km7MpZiHqX7c7hOkRXasDUV2JQ5fSdiHOAg6bpkWAv998J8ONF7UycmTcJ0ZGZTkah6gq+f7OFqGOiCJqwmzfXIoZQZu+iEx7xrMstyInb3/iHQbX/Uk15Srxi3v2MC5gln2uAMOKyJ33Hq7NXIXK2ArHv0EhYbHD/gVrm1ScujL7rveIpgq4SPsvheCDrw6zteSP577zFwmNwxRg4cvgHncvi35voQbYTvM0N90txA== 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=LZuRxmOF8pMmOEJONkSHfrpI/6ZokjlPiGL9NtF/xqQ=; b=ivfeN4NWJEKFr85ObE3PbbyyaNHTGlvCZZZG2wZThd5b0Z5PF89C4GnSaR8vymifKY53TZw11/1yLnugva+eu+E1Cok1YiN7jMrf4DpJsy1g7iIi/fX4M1lZ0Vv3/GvDMuj3Q7GOWKSw005tBCzclcAbpkx21o/QbbpNvAcl/oapO5P/O6EntnVb7em28gKNO89HltrjqZX4xm2OK5PqJOQdlvZ7Ghmm9HWEajB1mmJBJh1j+niq2sdXvfw1UHoQoR7y3eysAgxKgYbIpbOYYGmYU1jhSQf5SaWoBhUZ2d41kTX327ODp2B5NtqTYgMgjqzUFBThxxDHLq8FoAp1eQ== 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=LZuRxmOF8pMmOEJONkSHfrpI/6ZokjlPiGL9NtF/xqQ=; b=taiP1lEb5Fmxoh3SkV9A2yHcVdUPuHQp4hD0AFStbb+XA/fzfffLt94pITZa/dFDJYh6c6iVWLGGZqSbmWp6t90LGbEKD/ZkLgOLHSCwR65QLDXlZHjTKiNHVl9z17tbvRXgUwMiAI5ePAVh4FS/3KY7yNpobczB6n1+Jfd/VJVLwH2ETnhE8WY54f7ANGM8xwpjWIsgbjgcWlrVGIHTGCc4KY0Btrj2T4MpYnnEtNgPWGsHSEzkgwigqvaRPYISRC3cJiYlYHpKqNvrLd8+0PuJlTNkYbQ0fGzGLmS/j1tiVQTvaZnP+zMRcmKCadUmLIIVQfOqPU+JflbdDb2jvw== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by MW6PR02MB9934.namprd02.prod.outlook.com (2603:10b6:303:23d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.13; Mon, 10 Jul 2023 12:28:11 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%7]) with mapi id 15.20.6588.017; Mon, 10 Jul 2023 12:28:11 +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 v7 2/9] migration: convert uri parameter into 'MigrateAddress' struct Date: Mon, 10 Jul 2023 12:27:43 +0000 Message-Id: <20230710122750.69194-3-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230710122750.69194-1-het.gala@nutanix.com> References: <20230710122750.69194-1-het.gala@nutanix.com> X-ClientProxiedBy: PH8PR15CA0003.namprd15.prod.outlook.com (2603:10b6:510:2d2::25) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|MW6PR02MB9934:EE_ X-MS-Office365-Filtering-Correlation-Id: 86494f75-8a42-4162-6f90-08db81411fe9 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: cMnhBUH4pRQRwCXs0dV+nqYrGd99IZoZe7xvh8isbKZy2EtTWnc3P5npNAhXeoV6ABgCgvzEmm33SVOjj7ycBxgmtdlPf2h+mhYdaXk7IkZxjrj3g18nxcQJAcVLstlSdqY8r44+eec5gRENDhN9U1qkTONf7xh+6FP39IRyePawslWQi2zJ/BUV9pN5gNdXfl7Ltc7oby7cqcICnAySZ4DqQBaUw6+BAdkOajZ1yWPDpS5qc8tpSMiA7NqYsTLxByDiHNHgI1H427M7oKg2366BLxOXSLtnpas4GHflyBldj+1CAiyyfLc0EwKQoh2+1Cihi4zjP7QkgpQgwgKUtDtwme6tFQopBGTi37XxDofjSouNSvux0uDE1t/q5bYiaoxlytX7Y78qabKspo9cxLmBXK3SCJrMZa/FO2V9CbJiz5VAlW4pAXMv2AatbFAET5BwPgpvEyqsJERETiIQZp/UKm0I451oC019R9b3vT6AUZ3ne/iMFSpznGUW2hC4v4n0Zg+rWflJHaTaW03hDC0X56kw6MlWTtbbfCE2uNrhjG6Q9TlJ53iEaOv4tK+T+2/Fp3i8bk3bvV4LE3DpwnUyhelO/e6ooN6KPzaipcUEnCW9QZTaOOMAQ0zATuf/ 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)(396003)(136003)(39860400002)(366004)(376002)(346002)(451199021)(38350700002)(5660300002)(66476007)(8936002)(8676002)(44832011)(83380400001)(38100700002)(66946007)(66556008)(36756003)(2906002)(478600001)(6916009)(86362001)(4326008)(41300700001)(316002)(6666004)(6512007)(6486002)(1076003)(52116002)(186003)(6506007)(107886003)(26005)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2EMMR1s+9ZdYColf3qJP8kv6ZmwMY7EPId6COQaAMx1qLXsZ2Xe/P7QRpRO9b5iUAMW6P+1/zo7hkyImM9BgWtUqwwhzWDX/CZNr3GZJdNEX7RCa+xVKq2B5EmrlcJeDaHnS2I8YPm6pJoyY7EPuLsN6fqB025DGlaOIT3ZWdU/3AOIiJzKocFbTu1ycvY1LcM+agISGzq9+NdEEjl+zYJiBZxNjoQE7x0LRL+YwLQrfwqtqEKpMXcducL0tR8+bt7CkmZPEpwIyJF9oaVWRV3HHKGbXqUH7/ztmPP7I3te3qPYBXR05zaVyoc2bMNLXadINuT+B+xG0uIIfld/k81bh5Tbvy/+aEGUtu2tPtjOLuYYxMWo/reu1Z/LcE65ueb5Ke4yBFdgGP27XZNV5/Q6+p3uGMcjsjL0C2mopzAmcJl0kEfWmg6pbTJkzuocSMbfsWK2nFYqSVu18CWnC/oyVXwd1X3/2+phJa/ZAsbz83afuQcAPxDgUr72IqQeEPQwHZvIvmxaxfLTJ18N1X5p3TqkBvEHA0t4oMlag9EfLsgHNTnzjlBr18k2wZN2wuqfGIt19VXKpxuf8cBPM61nzkLHbGv4E+13Kk7uf3OeDKaUqHonxe9TASSZaufXULi+cspn2Y3R3Qwft67KkEm2Xz3UntjOMHISDImZAoPnfoeC5ZXCP73Z05C/NKUuKsrqJHuuzsSxQCHleQKQRgo57egEVvx07vmHI/lAWmJT9Z3VmX/3NlNdGdICLzccQ+ETlDt8jYsmcWnCpQ2OmVl0gv3G3QdSz/8hbxeIKzB4niuwcMwWEGFrvLJ70y+ZMdfbnjkc0jzdXegODd/Agvy3zE1ysOaqMPb5XDaa3KI/gsfB/hxBUsaEFAOLgzeBfIlRj8qwlaLTJ6csB5Ruy5oRVwfn30EYackHaAuAQePANmryybKHQkAowmVk4xS/pxEXXsqmpH+4fUT3q4pQWMaTq7LvE2/F7maxMvS3JQTQZPfQR+fIGEKQcgSmm3Y018NW3cXpr6wVhWoylLGCwpR3tRBtB2Dp+BR4HE1S4VrsWVSIbcErkg05LoYTDfNYdxnOq0bzqro/a6hW6DLW8nOwxOCrU/Cy+0UvxmU9O1bpzFWBicGbymj4HGP+x5P9rfWm7wVPbHN8Eqv4gaLtG3Kq8z8BtfYdK+/tvw75cZLtyx+TZYUH8J9nO9LuraFUKJBqxgLZzb9gs8Q0NJFPcD0U82epHptdbx9fAWjUXBMlRi9rvBcLWHYRmOJhpNPbW0KI/lUxW3srbhKI0/dv8+VO3WOMLM4cdeyBxJtbjw5SQnHp/XIc4EP4HQ8VKx6uO+yca32gkUkHdFCAoGX+Gkdrg7C+yJzXeczCtX/820TARD+h+ayAj09kgmKCNK9JUGaEzuBdmNYPu85SI4a3iRDsSTynQ3kerpoLkybTKEfvP/N1H9OXPgTYYkHO5ehOPuNkUJ/j4rWu72DSZZBltvUwNXDidVF4t9mjToqwxk9+NzWMMi3d4WZXW0VFNbPmAe6NllXY5H9ZAiXyZRO5GTSLitA92YJqaJTFIMMMNvr5r6U1Yy0VA0sAiYPKHOqxQ X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 86494f75-8a42-4162-6f90-08db81411fe9 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 12:28:11.2434 (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: 15AGYipcTGQMXfsUya4MIv86ksn+/biLBVLzquxYIWXw/9Cq6WXoh8x1InQmmCgLDk1zS8+sLANoRD9/FEeraQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR02MB9934 X-Proofpoint-GUID: gqw589yyo6oDP7TbCHZ6-yfnf7KmIWV8 X-Proofpoint-ORIG-GUID: gqw589yyo6oDP7TbCHZ6-yfnf7KmIWV8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-10_09,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This patch parses 'migrate' and 'migrate-incoming' QAPI's 'uri' parameter with all the migration connection related information and stores them inside well defined 'MigrateAddress' struct. Misc: limit line width in exec.c to 80 characters recommended by Qemu. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/exec.c | 4 ++-- migration/exec.h | 4 ++++ migration/migration.c | 54 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/migration/exec.c b/migration/exec.c index 2bf882bbe1..c4a3293246 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -27,7 +27,6 @@ #include "qemu/cutils.h" #ifdef WIN32 -const char *exec_get_cmd_path(void); const char *exec_get_cmd_path(void) { g_autofree char *detected_path = g_new(char, MAX_PATH); @@ -40,7 +39,8 @@ const char *exec_get_cmd_path(void) } #endif -void exec_start_outgoing_migration(MigrationState *s, const char *command, Error **errp) +void exec_start_outgoing_migration(MigrationState *s, const char *command, + Error **errp) { QIOChannel *ioc; diff --git a/migration/exec.h b/migration/exec.h index b210ffde7a..736cd71028 100644 --- a/migration/exec.h +++ b/migration/exec.h @@ -19,6 +19,10 @@ #ifndef QEMU_MIGRATION_EXEC_H #define QEMU_MIGRATION_EXEC_H + +#ifdef WIN32 +const char *exec_get_cmd_path(void); +#endif void exec_start_incoming_migration(const char *host_port, Error **errp); void exec_start_outgoing_migration(MigrationState *s, const char *host_port, diff --git a/migration/migration.c b/migration/migration.c index 91bba630a8..af2ec50061 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); @@ -421,15 +422,63 @@ void migrate_add_address(SocketAddress *address) QAPI_CLONE(SocketAddress, address)); } +static bool migrate_uri_parse(const char *uri, + MigrationAddress **channel, + Error **errp) +{ + g_autoptr(MigrationAddress) addr = g_new0(MigrationAddress, 1); + SocketAddress *saddr = &addr->u.socket; + InetSocketAddress *isock = &addr->u.rdma; + strList **tail = &addr->u.exec.args; + + if (strstart(uri, "exec:", NULL)) { + addr->transport = MIGRATION_ADDRESS_TYPE_EXEC; +#ifdef WIN32 + QAPI_LIST_APPEND(tail, g_strdup(exec_get_cmd_path())); +#else + QAPI_LIST_APPEND(tail, g_strdup("/bin/sh")); +#endif + QAPI_LIST_APPEND(tail, g_strdup("-c")); + QAPI_LIST_APPEND(tail, g_strdup(uri + strlen("exec:"))); + } else if (strstart(uri, "rdma:", NULL)) { + if (inet_parse(isock, uri + strlen("rdma:"), errp)) { + qapi_free_InetSocketAddress(isock); + return false; + } + addr->transport = MIGRATION_ADDRESS_TYPE_RDMA; + } else if (strstart(uri, "tcp:", NULL) || + strstart(uri, "unix:", NULL) || + strstart(uri, "vsock:", NULL) || + strstart(uri, "fd:", NULL)) { + addr->transport = MIGRATION_ADDRESS_TYPE_SOCKET; + saddr = socket_parse(uri, errp); + if (!saddr) { + qapi_free_SocketAddress(saddr); + return false; + } + } else { + error_setg(errp, "unknown migration protocol: %s", uri); + return false; + } + + *channel = addr; + return true; +} + static void qemu_start_incoming_migration(const char *uri, Error **errp) { const char *p = NULL; + g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1); /* URI is not suitable for migration? */ if (!migration_channels_and_uri_compatible(uri, errp)) { return; } + if (uri && !migrate_uri_parse(uri, &channel, errp)) { + return; + } + qapi_event_send_migration(MIGRATION_STATUS_SETUP); if (strstart(uri, "tcp:", &p) || strstart(uri, "unix:", NULL) || @@ -1641,12 +1690,17 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, Error *local_err = NULL; MigrationState *s = migrate_get_current(); const char *p = NULL; + g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1); /* URI is not suitable for migration? */ if (!migration_channels_and_uri_compatible(uri, errp)) { return; } + if (!migrate_uri_parse(uri, &channel, &local_err)) { + return; + } + resume_requested = has_resume && resume; if (!migrate_prepare(s, has_blk && blk, has_inc && inc, resume_requested, errp)) { From patchwork Mon Jul 10 12:27:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13306867 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 84BF4EB64DA for ; Mon, 10 Jul 2023 12:30:05 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIq0G-0008PA-Cf; Mon, 10 Jul 2023 08:28:32 -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 1qIq09-0008KQ-RG for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:25 -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 1qIq07-0000mD-4I for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:25 -0400 Received: from pps.filterd (m0127844.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36A6feiG020935; Mon, 10 Jul 2023 05:28:22 -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=EeDi+b0ZZWKX5mKEfvo36KjkLu9vTDbr6zhVX4Ev9 yI=; b=uoiwHHPWaSLXnpn+UXJYEGRTzZ9gLr2krHwhYeQCJW3RT7xIAPUr+RS3u vbNuA5YxjAHU0eVPpYjknCJGT4WInpRLsC0vu5md/K6oZzV388m8yALv2OHeoeBW Rr2FVgNI+7ob4JWzN9ydKLCaiYfEb8nCosD+E/zet9vAvuE0ChNJ7aOi86C8z23w E6sY3jWjnya26SZyPSQejR+f3azKDAphig7k8UNskXiCQhBsTLNaMxUjtermMuN/ tbMFec8u1nC7bQ47KrZ8ndhMt0mogcys7MKf4QLoVgNrG2e4BC1Fg9lgWUB5ilqo cdpKXOPA+wDNyLo95kb/WsM2ZqCEQ== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3rq7awaxxh-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 05:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HwmUWoY4EmtNFzwufm6FdY87CJyjgojJBcIF9uD3by6eb1YlEYocASogXNHTerUUO0P8mVK0tl5z62qyBI5WgKzf46jKk7iaBmRSSZLyEDgJIjc+1tLtHqtsRiht1UvCxm33zPVIOGtEVxB1j77TAb4onq8b+ZUMzvyq+Zv3Kfjo00VLnDLQyn6WHtRolAE2374Vacd0aWAlLv4dXZ1453OBLeykx997fSvAmKSsPttnjpJanpLclnK6+Cb0clzjl/Ce9yzGa5U5MZZute5yVXrtGMI9sjSkNGkkxdwDW+tdNn20dexEv75RYXWnDaF+tXqw0m1qagf95LNeMIz4LA== 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=EeDi+b0ZZWKX5mKEfvo36KjkLu9vTDbr6zhVX4Ev9yI=; b=dQEvaSm+zFOpxOj6W7HdcH7o5be7nodrSwQ/X8o0TAiUN15pTD2uwI6LDjFTGkCaLwK5kDKfhRS6GG0FVeyKEaXuyTsm9u6Q9tXHHt0a/4BEn2ZkqRszc27G3+riYiGENylNtJX5hKVR3H1qAqH1k65KeubxNy7MQdt7FfxoS9aK/NI0Qf4ZoxupVU+d19hz0Fxar+pdJATYnY3qj0OaiJ/JzHPK56DEXvFdpCMEK77xEHVwgKAmM8m5EoJTVCYC86LGb9enMSEn+xLtC5OQO1ILD56XgdBk2S5uIprNWei/HIC593O+zVh5qTupoEOIiWOjSX+nGC/Ve/yB4+lbeA== 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=EeDi+b0ZZWKX5mKEfvo36KjkLu9vTDbr6zhVX4Ev9yI=; b=g/7KmUxwmi5vGPX6Rbxzy5akEnmJl6c8v06+Fj3j9van/bgYEkIsP4mzKOqlur1DSlSqlWSRD6C33eb5faSt6rozkVChcoCREJ4A4US43PdxyU2c/vaBkxFt8srsUcy9ohOO7y/blMJ8WhtYhhCOe8b/7O2bbDZQwJq2o1OehBMdIbl+TwbjJd0KevPOKMWGOiXMps8c0DiIvUfcd9g5oC2Wtz8Ww3/nlXGpgFv4lKivzDc+wi64M2Cclr9oq0Eior+rrQNcey/OoxgUalIeb52wbwSvXU992kLgWclsolIuuAsqxWWkZsYCwp2HUgVk6YuSwfNveuzIERSPcF3Aiw== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by MW6PR02MB9934.namprd02.prod.outlook.com (2603:10b6:303:23d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.13; Mon, 10 Jul 2023 12:28:13 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%7]) with mapi id 15.20.6588.017; Mon, 10 Jul 2023 12:28:13 +0000 From: Het Gala To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com, eblake@redhat.com, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v7 3/9] migration: convert socket backend to accept MigrateAddress struct Date: Mon, 10 Jul 2023 12:27:44 +0000 Message-Id: <20230710122750.69194-4-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230710122750.69194-1-het.gala@nutanix.com> References: <20230710122750.69194-1-het.gala@nutanix.com> X-ClientProxiedBy: PH8PR15CA0003.namprd15.prod.outlook.com (2603:10b6:510:2d2::25) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|MW6PR02MB9934:EE_ X-MS-Office365-Filtering-Correlation-Id: 1a5162cd-fd94-494c-bdb9-08db81412121 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: OWACG4ph5VisOyf9BPrwNGq9v/GWe6p29Pskf5hbZVlk09bviMA+2Pe7klkjUUv2vf4opNgo1G9YHg3H30mKGB2Xk7luhHKjdJlhqkJHgY0m4XMgd4QJY3TGzgruT+CZNwQIUofkxkeyMYYbgtEkzXVUDRDrZut0e3iG3h+EcLGiljV1y7L2hS2UOeULkH505NLQhCp1UKmhxdaI5FRvIHFlwK1GKZNI9WDY5nABMbXMTnumGiGX3WkNuvEtnVWoN1m+cttPDmNqlapm6eOx2LvOJMXUQFsVSgeaPWyRxW40AD7bwLthYe8v8BHAIf+P4PZGYyjPQXYP+MdyI4POyz0I9sZlu/PcwWwtFpZhH1fJ1hIYlMr75CGltwFvLADZxfMlt0Sevjk2osLurPq3r2hlQoSeByPf2/Q/cUX3rcM84h72xX8ixCD5IrVy6VYfAquIhKIbHEEesicNaAYqu39JKCyM3YiXi3x4YWg0zJ7J0MX61UZWu7x2fcO+WJDpjI++H4ckn5HLTi3WyxKk2Nttb8TCe5TQhEs9AzV9tGd7b2Qpb/qk5fIx7powloPgsGcuT5fB7HwaamyvSq/aXJcUZBOBx0Qbs7Wdls1wTdbbtXMhRAjJ8fF0Gzfiosap 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)(396003)(136003)(39860400002)(366004)(376002)(346002)(451199021)(38350700002)(5660300002)(66476007)(8936002)(8676002)(44832011)(83380400001)(38100700002)(66946007)(66556008)(36756003)(2906002)(478600001)(6916009)(86362001)(4326008)(41300700001)(316002)(6666004)(6512007)(6486002)(1076003)(52116002)(186003)(6506007)(107886003)(26005)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: E2knWZq9JA5WO0h6NjQBgd4wT3ydc1sw5YWidYQDZRsxkEDoLgLHlWtLduznqzUvEDtxlcwUpgZxUAniACdDrrvESSHpX7c8nre9ZGiLgImrWSRJo3W7THUfj4kuZS4tlcK5W9rs7wzmTdDD/cpk1WB9ldX8H/KPp9G/mmX9l3DVgnWfVwh85mTpDYQ798o5Esu1sA8TRBGv5Af9uTi4EwOedn3sPhXwkPRk791+zbkpxTZGfS+vi94SrMPqaET8GAaTacnFCpVPY1gttAmmRI8l7yk/VLN2vkhsrdjOrwehEnaCZkkIw7j+hlBci+CJS6Z8pO461ZWg/cdHGS6BaBMA73ECXaAsiheIm3AMfmwNUo/QOEqfkLLOY9LBc7ErgZwew8zZa+QgHTiFnxsknh9WkGzIzPOj4itEtySILJFyfQPrzQWLK3pAjqZrQQO4w6HJQ+E15FxFaw31Sg6A9MvWbPAIrC8IiQzbAUbyY5nYFGJI3o38qDpqHDCjW1TiAEQeSs58PNwNAXKd/ngxqyA0Flt74pYnvFKwrncVcKmfLqBl+OZysZf1c2bjE4slyXlSClFUikLIIfRrtVzgE3fGuscILuuWVBF5vCgSZBGytZWyVmPNAjHxwpPWNkCjxmNfG4cod2Xrnf3rSscCC728l69mGnLw0ZrNpweEclOlTuIvqhuVRlT15jSammg0qaJ7LAq+JGyeGMPS1zcUef180wREWGbET3cc2okJRmkfviJylX4eadg47fCt0hYaJS1YGeIZWYCkEGueEdI0L/dpUIfwWgzrVJtiFacjyraXVl2MSD23CjoQwjLjOyo4FNyJVkMJLN64OC/2Yph1UdbofTg61iU8fMdagY4T7cE8tI28/tD1WptjpHXUyAVZZ4mNXMzJeeYmyVOjGZINJMRnGbBxdzW8ChLwInaMNM8rf9ozM787Y5Qjj2K42duidTY/67Bim2xF+zHh+XC60jBlFbgT7J2gHz+kKr8+BFuzIl6HAVoY5dbOffn3HTn0bBHbSM4h8fwD3+NBT7ktsiybXrR+Ws/sImy/zWe8t4CtDFJs9hPas0nugbJehzQhlR/VBWihEgEgoy7iBvJCVSMs537HUIDGXEc2sdZgNsmnoON6DcSY2Ne6QZzwOfy5Yo2x5x99z4yZ/j0jZKjojfxnDxOIvH3pxFH17E2QjCr+Mg3ZXGYXWKwDJoWwJ/r4KNDsYaBKBFCENpSQV6efKQ/wEKfuSf4uC1cdlg2zNpkCPH5MW6adhJHR7SblgS91elOFazPh9G2WX5RrvkukHTbB02qS5njVaXIQnkOtBdKw7qxBMO/RkT0phU+BWN8JpwgH2s1AvxDKzVrePJCgDfu06jUkyl0hNYOyp0Dy5wwipymk0ZJUA7Z2HelbIVH0VRw8mO4CsYKj1ak6jXbo75Z2WA/VCZm5zXNnII4EFwIDY1dafasDj759MY/AZ+yzcx9LCbFu8V3ZqSSQ9DIWdQh1aUkcFo85be1OWpEArH6siY1rDkrB/K+Orloj6TJ7JSp6Itvj+4658pDrJxeDS/cXZyz77FlFL0ij7DnuBjSdjJLm9XagJ2RWp7tv61PxBF79MuhoRnMPS0GEK5MZKQ== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a5162cd-fd94-494c-bdb9-08db81412121 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 12:28:13.2936 (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: /ZEKrDlzHHeLqUrO1lN3lb2EXqTOL2ajPuyHxpCtALhMMiCNrzHjJ0zCmChUafbps4pRzQkZmYufrnyxcMGSAg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR02MB9934 X-Proofpoint-GUID: rAOIvy9Uy0-tTybHR1SAkbJpps3wuiGc X-Proofpoint-ORIG-GUID: rAOIvy9Uy0-tTybHR1SAkbJpps3wuiGc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-10_09,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Socket transport backend for 'migrate'/'migrate-incoming' QAPIs accept new wire protocol of MigrateAddress struct. It is achived by parsing 'uri' string and storing migration parameters required for socket connection into well defined SocketAddress struct. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/migration.c | 32 +++++++++++++++++++------------- migration/socket.c | 34 +++++----------------------------- migration/socket.h | 7 ++++--- 3 files changed, 28 insertions(+), 45 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index af2ec50061..8108d4248f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -480,18 +480,21 @@ static void qemu_start_incoming_migration(const char *uri, Error **errp) } qapi_event_send_migration(MIGRATION_STATUS_SETUP); - if (strstart(uri, "tcp:", &p) || - strstart(uri, "unix:", NULL) || - strstart(uri, "vsock:", NULL)) { - socket_start_incoming_migration(p ? p : uri, errp); + if (channel->transport == MIGRATION_ADDRESS_TYPE_SOCKET) { + SocketAddress *saddr = &channel->u.socket; + if (saddr->type == SOCKET_ADDRESS_TYPE_INET || + saddr->type == SOCKET_ADDRESS_TYPE_UNIX || + saddr->type == SOCKET_ADDRESS_TYPE_VSOCK) { + socket_start_incoming_migration(saddr, errp); + } else if (saddr->type == SOCKET_ADDRESS_TYPE_FD) { + fd_start_incoming_migration(saddr->u.fd.str, errp); + } #ifdef CONFIG_RDMA } else if (strstart(uri, "rdma:", &p)) { rdma_start_incoming_migration(p, errp); #endif } else if (strstart(uri, "exec:", &p)) { exec_start_incoming_migration(p, errp); - } else if (strstart(uri, "fd:", &p)) { - fd_start_incoming_migration(p, errp); } else { error_setg(errp, "unknown migration protocol: %s", uri); } @@ -1697,7 +1700,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; } @@ -1714,18 +1717,21 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, } } - if (strstart(uri, "tcp:", &p) || - strstart(uri, "unix:", NULL) || - strstart(uri, "vsock:", NULL)) { - socket_start_outgoing_migration(s, p ? p : uri, &local_err); + if (channel->transport == MIGRATION_ADDRESS_TYPE_SOCKET) { + SocketAddress *saddr = &channel->u.socket; + if (saddr->type == SOCKET_ADDRESS_TYPE_INET || + saddr->type == SOCKET_ADDRESS_TYPE_UNIX || + saddr->type == SOCKET_ADDRESS_TYPE_VSOCK) { + socket_start_outgoing_migration(s, saddr, &local_err); + } else if (saddr->type == SOCKET_ADDRESS_TYPE_FD) { + fd_start_outgoing_migration(s, saddr->u.fd.str, &local_err); + } #ifdef CONFIG_RDMA } else if (strstart(uri, "rdma:", &p)) { rdma_start_outgoing_migration(s, p, &local_err); #endif } else if (strstart(uri, "exec:", &p)) { exec_start_outgoing_migration(s, p, &local_err); - } else if (strstart(uri, "fd:", &p)) { - fd_start_outgoing_migration(s, p, &local_err); } else { if (!resume_requested) { 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 Mon Jul 10 12:27:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13306864 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 C7273EB64DA for ; Mon, 10 Jul 2023 12:29:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIq0D-0008Np-V4; Mon, 10 Jul 2023 08:28:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIq0A-0008Kl-9M for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:26 -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 1qIq07-0000mY-Kw for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:26 -0400 Received: from pps.filterd (m0127844.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36A6feiH020935; Mon, 10 Jul 2023 05:28:22 -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=eBYDmSFyjVdAWMWu1a/acT5Xh74HYc/DSUxT3GLns p0=; b=TUF7P+u6YLoMPvV1m4jecJQxZZtshBJlmqgxoBfPDspJ99SAMeCVWL1dj EqW2DQMxTeUK8u0RX/wqXwmFlYEOAqm05NFJxiWzCs1xH3owS2WhzQEj6RBUucJv piIJKVyDKxfg7OJhOKqzI8QN5aQ/OA1MGCSWBgUmLMZUKuhZJOU+cgEDEL5/+DSL DrV+B7+a7G+C8V5QoZq7jQiI1+//vMQ0N1F84xfcDOycYyaZGG+8tgvgiGbCLDGA gzL2UstABm3WVvX6qYu2Mc/tgkTWnhvjT9PIsvRUyiKfXe/zMo3wzCFsn76CHsBm uqL6M6i53pTW7uv0+5FC1ks0UTOsA== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3rq7awaxxh-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 05:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VESmJMXifc7OT8359LduVNZpEmJX/sp93r7pKDIlH2alw8v91vZuIv+/3pEhNFYwWvu9Jg1pDJmVet09IjkEt52A1BFGNvwceZFZ9bkhCK6uJ+QYcPtb9UEib5SDxT8yJvsY/aWyWAvoNBR3kOAqTDDxpG3BOQt0gGnN9JB0SsQSulqodEPlrd8pFExX4W++d6A5/BToh3huPHD2aR4nC5nxBVFFKmBP8CXw0xSeBCxbLTM3nmwa0nQm+lADabIn/0BA3Wnv6VhT70uuZGbqW3Lt3Jk4kd97YBBqSKMPDQHVB1mmXqZZdaxPleJC7iHJfUtAh0GYvy112KJmIkOHpA== 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=eBYDmSFyjVdAWMWu1a/acT5Xh74HYc/DSUxT3GLnsp0=; b=QAEOgkPDCEAlUQOFriAHRGt6nBvgVeQnCk2uOBR494lII+2w77nNJrb1XI9qNZwOfbOOFHtLgpZ9e8sG23gey1gH33rLESfbS6VmUOIR2OM4/oM1QgkRx/1oTS9XIZlx/oY37loBrBpIJ5mCWbfC/PEggj7iSnKx0LPVDfDYfuleWwjMkZXrOhWlVLvVbxxxfmT4m3gbzLBg4aL84yJQH4nJBcPO4DypSa4mUgv/XZJxJDILt2MJP7nMxqwtrsf6wNufPRlKYAAo0uR5LkM4Oifiiq+1L9WIeXatoYWRAVqy9cbM1ujiJ03hw/K+Ao9uETJ/ZY6QMWrbzmBfcNT/Zw== 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=eBYDmSFyjVdAWMWu1a/acT5Xh74HYc/DSUxT3GLnsp0=; b=WMuUzcyGvZdX8REELTz+fJrJYVv9Uu8M9SYu074eiqJobjPMmW+KsgPBvoRq9TQEGh3uIKg/1dgKHhpDU6UPCXWX8wYh2c1aGjR22vULYhERmL061m2A9Ks+JgmD3hsBqbXWft8W7by1vTZecztkbn0/R/KZcHB19wcCqInlswAaj1jObuzMiue+4tz4ATCbsUXZ9YyTd65XwfifJ0rAHFzjU7TyqU799L6n99yhwp1cBEvWMMgqvvb3Gocs14fEtOBGr1tSFD5DnPnccToGp0ef+gGz+WpzTZoFdR1aPzUd0x+6DQK9XLez89dybp5bzFIH27oxykr+T2yRq8zfnA== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by MW6PR02MB9934.namprd02.prod.outlook.com (2603:10b6:303:23d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.13; Mon, 10 Jul 2023 12:28:15 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%7]) with mapi id 15.20.6588.017; Mon, 10 Jul 2023 12:28:15 +0000 From: Het Gala To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com, eblake@redhat.com, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v7 4/9] migration: convert rdma backend to accept MigrateAddress struct Date: Mon, 10 Jul 2023 12:27:45 +0000 Message-Id: <20230710122750.69194-5-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230710122750.69194-1-het.gala@nutanix.com> References: <20230710122750.69194-1-het.gala@nutanix.com> X-ClientProxiedBy: PH8PR15CA0003.namprd15.prod.outlook.com (2603:10b6:510:2d2::25) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|MW6PR02MB9934:EE_ X-MS-Office365-Filtering-Correlation-Id: 9328efef-298f-4688-d484-08db81412220 x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: D/2cGJOD6BfWqyDq3RQmzXe6TXx2dEXG1jJSCok+qS4wzK7auDA4/5j0xRHPmj/+mq4LVJGrwVl7bhXunXEEXmwCpGWrcrJucCHBX9sWhReTtQq5c4+7k462fdXi+oaHyTJiHjSz4OgSMm94K1FRt6CwRmduh+yz40lgvIU09fQy2zYsUb3n8IKiHyIETpz3fTkcpNe9mGjJ9tmyNzEOZgk/do++ft2Pz0glgBg5KCkVDdnMq+uUDeR5Vaf6FyirZn2pUC2gK8jK7FSyDfqbYsdL/I/FszKd9tDphFY9afP9XS0Gtmw1RH1WJy4kczOUwL8x2wv2jigNG/c7ufx2g7JsC8QsxTaYOvtjOdTnH83n4DRKC7HtwlkjKX49UGpzgw9uEhtNWKQY8fLt2zc7aHwWTJFbzqNWmhrIZLbSiDOurvdgoOZRr3yYhpyZo6SIwET3TEQM7zdKa3xrXBfdWToP6I8ZKUTeC1UOxYahwmQqLrSaOUYjkGbN8VJpPqkybbJ2ZSIIoNMIKZrYODceDoNw5qwCXNG56ho295K91S8zNjKPyiBprbwr6GuOKkMrCdb6oUEkoiyT9ARM4+VNuxBx4zlQWwvfzTfKO0BG5sX0UHRAUkSp7UbijBklvZUe 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)(396003)(136003)(39860400002)(366004)(376002)(346002)(451199021)(38350700002)(5660300002)(66476007)(8936002)(8676002)(44832011)(83380400001)(38100700002)(66946007)(66556008)(36756003)(2906002)(478600001)(6916009)(86362001)(4326008)(41300700001)(316002)(6666004)(6512007)(6486002)(1076003)(52116002)(186003)(6506007)(107886003)(26005)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kbk1SkJQWyxkYFZxDkuQ2ojS/SDHvZkmMFphZdHqVyL3yd9KoDdDgUef9Fq75hkS96NeBFrQbk5NmErSMutwoB3C7xmuspvZzKQJeluTwps+UB/4PipxKd4MceL8RZKL6VBN/4/cKEG254l6RCC9yrqrk/1ejpPx6rfiVa5SEuKlEOS+mpKpgka6OvDqCJJiY2Id1WP2krzFmEIdRJZPqrMjKNyCfvod7zUWDO7Tkf7MOYlwbF+jSXQuRQ0E2NzE7xP6wLpp0A5AbStLOdQ1LGP5oYJ+eGHc0zPEga/ktZS+FTruznsaPnf2V4mIy4IoH5Rc/C1ApSDw8m2tPkXWKMBzlZXSobP7Kj3kpXID6Jiaq3ifPzcPaOFQ1lieZNXQYiCxbFwj9hfa+JBFdj6M6tiwNhcfqOLXa2I2BXnzbkTUBl2zZiUz51d4ZIEEL56AimBxCrYc85n+oKExUZVBuKus0dk9sNok8v0Frq8lr8IwnL3i6Iz2axBZ01RtMaklvFfdXD5slUHwyA74vKhPd0I7f1ldTXYrOHMIP1QeMi3WyAptvgZ3tRsg/k89NWDBKBHFe9zthsb28WA6r8lrQBbJc52M+jkWIoAz3VlI8MBwzmFyu/0xpruCWtFKbCrPThsQxwXgoVDwTN6wySRnql6kW57SDhei/O+KiVNzs6YCc9SGVsbbGFBifvIcIkSwYiLt5RKtkShLDCWYvi91xJcpEhGsa2bb8GgOKD7NydfaVCw75fkcLrLejz0rsHmAofozAgXxKE7hUMN1EOqH8Wmc5E/XC8+90q721R3710lI3onIz6UIKvnljK5ZJBw/Rd4OjPIMvYTN5/ZdgzTZ84AJSGOo+Fcu3MyfHIWKUFzEVqWvS7QdMeW49+9j5i3dRKHFTgAhxcq4xEfFQnE1wN9ucDk099ycQh5anPjRsn04czLmQxvHA5s3fZ4SXw5HvWzvqUQ8vcTGYEA87PpvwAU6+S2Xcnn7u5bnDZuswAH3iGVPn7wAxJrSERXdGbi7s8rq3PKckPQOdXJkreBn3QE4LaUjnlbekxzw85OhUahVaIvMgz3zLnTXgjjW6bafJL/WmHSK9EBNYlYMLu/Mc4ryFs0jn4MT8UES0jlV4L6jDkhF0bSKOZovMU/AkvibHc0DLohPpVmGNerU/79xw5ICUM+v4C0oubBqiQsQYijU0nHlNtN3LOp7FNevgY405si8Z4Mc4iMMt8/nMSDWnXCBAkAdToIoRGrIRmbA9/CXc+C5F+fwRH2E1PJCBHRBmAAbCBqMbgmmjePe1PG4UZCd80eFCuWk+vsMR91KwFkouU2p5XT9nrHO1iMdw+x/EGm0DN8BWsX1584Mpkvl3XSym0/3SOShvFV/frLWxm1Bdi5ULvmhGuJ4x658SOpEuhvH1NdHJGZ2skN9nggzlL4oNauMN7gE8uj31lw7GpG0t26g1A9/NIRXWxFtPNU72iLg0VEKfDGzkXxllwnHLHtL9lrm3g+LKDeGmKhiZeWvN+HDZJiJNLruFE1ufwh3dLvcQis0K1vm/fEZSVxjMx/Izduw4iTdbB4gk1FOYrxKdE0HpTYmpZ9YkPqMYtJB1Xf5jojjdNbmZxjgEgG2iA== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9328efef-298f-4688-d484-08db81412220 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 12:28:14.9627 (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: OWya4MRT+514w6bT4RmlR5HQ30Mzg1HttUzacTjAOCkIg4BUUPsOVIJGxzBZeWO0MYZlVfesxri+pPMo2CFoBA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR02MB9934 X-Proofpoint-GUID: 51Z782DymDH851dW8hBidvTLBmnCkWK8 X-Proofpoint-ORIG-GUID: 51Z782DymDH851dW8hBidvTLBmnCkWK8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-10_09,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org RDMA based transport backend for 'migrate'/'migrate-incoming' QAPIs accept new wire protocol of MigrateAddress struct. It is achived by parsing 'uri' string and storing migration parameters required for RDMA connection into well defined InetSocketAddress struct. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/migration.c | 8 ++++---- migration/rdma.c | 34 ++++++++++++---------------------- migration/rdma.h | 6 ++++-- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 8108d4248f..2f5bd5df6b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -490,8 +490,8 @@ static void qemu_start_incoming_migration(const char *uri, Error **errp) fd_start_incoming_migration(saddr->u.fd.str, errp); } #ifdef CONFIG_RDMA - } else if (strstart(uri, "rdma:", &p)) { - rdma_start_incoming_migration(p, errp); + } else if (channel->transport == MIGRATION_ADDRESS_TYPE_RDMA) { + rdma_start_incoming_migration(&channel->u.rdma, errp); #endif } else if (strstart(uri, "exec:", &p)) { exec_start_incoming_migration(p, errp); @@ -1727,8 +1727,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, fd_start_outgoing_migration(s, saddr->u.fd.str, &local_err); } #ifdef CONFIG_RDMA - } else if (strstart(uri, "rdma:", &p)) { - rdma_start_outgoing_migration(s, p, &local_err); + } else if (channel->transport == MIGRATION_ADDRESS_TYPE_RDMA) { + rdma_start_outgoing_migration(s, &channel->u.rdma, &local_err); #endif } else if (strstart(uri, "exec:", &p)) { exec_start_outgoing_migration(s, p, &local_err); diff --git a/migration/rdma.c b/migration/rdma.c index dd1c039e6c..4d64fae492 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -319,7 +319,6 @@ typedef struct RDMALocalBlocks { typedef struct RDMAContext { char *host; int port; - char *host_port; RDMAWorkRequestData wr_data[RDMA_WRID_MAX]; @@ -2455,9 +2454,7 @@ static void qemu_rdma_cleanup(RDMAContext *rdma) rdma->channel = NULL; } g_free(rdma->host); - g_free(rdma->host_port); rdma->host = NULL; - rdma->host_port = NULL; } @@ -2739,28 +2736,17 @@ static void qemu_rdma_return_path_dest_init(RDMAContext *rdma_return_path, rdma_return_path->is_return_path = true; } -static void *qemu_rdma_data_init(const char *host_port, Error **errp) +static void *qemu_rdma_data_init(InetSocketAddress *saddr, Error **errp) { RDMAContext *rdma = NULL; - InetSocketAddress *addr; - if (host_port) { + if (saddr) { rdma = g_new0(RDMAContext, 1); rdma->current_index = -1; rdma->current_chunk = -1; - addr = g_new(InetSocketAddress, 1); - if (!inet_parse(addr, host_port, NULL)) { - rdma->port = atoi(addr->port); - rdma->host = g_strdup(addr->host); - rdma->host_port = g_strdup(host_port); - } else { - ERROR(errp, "bad RDMA migration address '%s'", host_port); - g_free(rdma); - rdma = NULL; - } - - qapi_free_InetSocketAddress(addr); + rdma->host = g_strdup(saddr->host); + rdma->port = atoi(saddr->port); } return rdma; @@ -3359,6 +3345,7 @@ static int qemu_rdma_accept(RDMAContext *rdma) .private_data_len = sizeof(cap), }; RDMAContext *rdma_return_path = NULL; + g_autoptr(InetSocketAddress) isock = g_new0(InetSocketAddress, 1); struct rdma_cm_event *cm_event; struct ibv_context *verbs; int ret = -EINVAL; @@ -3374,13 +3361,16 @@ static int qemu_rdma_accept(RDMAContext *rdma) goto err_rdma_dest_wait; } + isock->host = rdma->host; + isock->port = g_strdup_printf("%d", rdma->port); + /* * initialize the RDMAContext for return path for postcopy after first * connection request reached. */ if ((migrate_postcopy() || migrate_return_path()) && !rdma->is_return_path) { - rdma_return_path = qemu_rdma_data_init(rdma->host_port, NULL); + rdma_return_path = qemu_rdma_data_init(isock, NULL); if (rdma_return_path == NULL) { rdma_ack_cm_event(cm_event); goto err_rdma_dest_wait; @@ -4113,7 +4103,8 @@ static void rdma_accept_incoming_migration(void *opaque) } } -void rdma_start_incoming_migration(const char *host_port, Error **errp) +void rdma_start_incoming_migration(InetSocketAddress *host_port, + Error **errp) { int ret; RDMAContext *rdma; @@ -4159,13 +4150,12 @@ err: error_propagate(errp, local_err); if (rdma) { g_free(rdma->host); - g_free(rdma->host_port); } g_free(rdma); } void rdma_start_outgoing_migration(void *opaque, - const char *host_port, Error **errp) + InetSocketAddress *host_port, Error **errp) { MigrationState *s = opaque; RDMAContext *rdma_return_path = NULL; diff --git a/migration/rdma.h b/migration/rdma.h index de2ba09dc5..ee89296555 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -14,12 +14,14 @@ * */ +#include "qemu/sockets.h" + #ifndef QEMU_MIGRATION_RDMA_H #define QEMU_MIGRATION_RDMA_H -void rdma_start_outgoing_migration(void *opaque, const char *host_port, +void rdma_start_outgoing_migration(void *opaque, InetSocketAddress *host_port, Error **errp); -void rdma_start_incoming_migration(const char *host_port, Error **errp); +void rdma_start_incoming_migration(InetSocketAddress *host_port, Error **errp); #endif From patchwork Mon Jul 10 12:27:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13306862 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 E269CEB64D9 for ; Mon, 10 Jul 2023 12:29:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIq0C-0008Ma-2i; Mon, 10 Jul 2023 08:28:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIq08-0008JR-U4 for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:25 -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 1qIq06-0000lm-OY for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:24 -0400 Received: from pps.filterd (m0127838.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36ABqv47006326; Mon, 10 Jul 2023 05:28:21 -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=ljhltNUk9KvhipxrtKFUECjVpOkw/8Mvt6PEjAiJB JQ=; b=Hu86adFJt8+2CYGBGRmT/+5h3OtAXa2b/XYQIhXMBGzx82zpYzid0snL9 V2Ka2hdSwu5CQRBNf+fAdsF1nzJhHwGQbXDGBXVsaPV/U3RqI5DFFKiuN0v+eY91 ahGEhEMFYpZtKLAUJ6qbHDjRfuaNNG7DD5UzUL2gvPoxeGsGBw+pJVKPYOwheTsz 5KVrHErX03XdnR4vLN2M9sUXMl07kjfv37x4nVLxLUHWdb2L39qoIb4hs32OLvwS sTqnVL0nuVwDQImzJc2Jiw9l5nFAS6Bq6LXdCT8w9aI0bG3ItbptJyOuAzDz8lIh lMo2RlzQ6/B2wTVICe6WtsJJbLtaQ== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3rq7butu5x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 05:28:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZCcevPo5CiIN7sJDYOImNynhIHxXx38nlfmbikOrOHXcB06rWwofaGrVadJkOtKqIFQwEzNFlnvbdvUsSA3yV2fX+Ayeigb3kJF9OLtyGkbhYr6dAY6uL/2MAsOdW7gdIXoxXnrDXbZ55T735a2kv+zQ0H3ha8GBcddIiMPa9q8ao2jQ75mlwpNgSPxY1JSlRWI+TLW29KrEeHdb61rOQy5mrZodFTIh4XPqI4E0PHjy/fRfSAAToaGxvpU+4itfpv8jnWPhAqN0M7628j1Pnh4UzwC7S1mZpVekcvL/SWCHzwkcNPXejhqMlL2c5ZzW1RwY3eWrTNGQ4D4JpQ6EHQ== 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=ljhltNUk9KvhipxrtKFUECjVpOkw/8Mvt6PEjAiJBJQ=; b=nNmMJaxM9MHwRI2doktnFMaO5IibAM5wg52qJ7XgCv1eT1wC6oeyXA476ETY6GOeil4MtiTnhxQ1DxQ/m02ZiT4Iw4HlR2QuY4tzsAKRa1uC1fY4ba5NgCVRw4zDd89ontmClVsKc1UQdM9fC89pV6MryC0hYc1ALBeMnrmMMH1TKN6uWWOXv920kGw0VfR4VLq3DyP0DS8L07yYzAvWrGjrC3x1uxwBSiiy6G30v+DI7UYFvb5lJ0GqbHZ8IvYy+4byim2A+9nFsn8JGU5ZMU+jmAYZHXV9BkA1a2CCVp/AcPLeU9ykkSfw1k+dCDVaUm+kkl+kFlssj+ZyqQ1rtw== 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=ljhltNUk9KvhipxrtKFUECjVpOkw/8Mvt6PEjAiJBJQ=; b=cYXnmItYbYPbPO1l1/AchFzFpSzFX4QJlXM4RHfC0zPgg9Q8zH5MQ199drgropoZBhiiR8TcdO1LhZq9+i92RrDFXhUrYJr4KxOne4i1IKpHqqkYDn/8ftUByXW5X3gvmp9rvLQi32iZXa1ZzSFdATYtWbiVxsdILfuMldxbPnx3R9Zj2l2y/ajPJHLD24s27YlEFCl2J7mOaT7/YskjZKwf7w1PvswdtLD+dNx3n2TEUzy1fXwe2yqFwXDOi/j9H/DaKuu35WP229MEEDdEOaoSPShNcTsGBQxjEmvV69QIiK1fJaZcEvi/iolPbwKIn0Kj2BclpTcRoaGqMJt3/g== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by CYYPR02MB9688.namprd02.prod.outlook.com (2603:10b6:930:c3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Mon, 10 Jul 2023 12:28:17 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%7]) with mapi id 15.20.6588.017; Mon, 10 Jul 2023 12:28:16 +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 v7 5/9] migration: convert exec backend to accept MigrateAddress struct. Date: Mon, 10 Jul 2023 12:27:46 +0000 Message-Id: <20230710122750.69194-6-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230710122750.69194-1-het.gala@nutanix.com> References: <20230710122750.69194-1-het.gala@nutanix.com> X-ClientProxiedBy: PH8PR15CA0003.namprd15.prod.outlook.com (2603:10b6:510:2d2::25) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|CYYPR02MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: 2262bc67-c8fe-48c0-aded-08db81412343 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: t40zlU/cd7/M4qg6wCJFnyDdCTBNeJnfaXbCi9C6mbihjbMquKVxVdpLYCJBfpbBsberpWCs1c+LUX5EVz9EOO18kUZSy/c42/Wbj6cQ+MxsfWxW86KBz3Zw4ERsUh7LaoQt6+GM+ky0wWXeVDhNKZnD61MrMnT5ZMkaiVNYkd4BDx6QFHG9jqwGUgoU8/Xuw6/TlQ5oyxJIrndpDPcBts/8hkDUbOyTGj9rDoxBsxFIpGLLxwlU2/HVoiEssCDR/3DBYn5hRvG3k1xm4XHbC3jz4yGiZlFzPCQXQF0pxR5eaxCAHrLK2fljix4cNQWCgC9MsAyPw8Hv4ZvfMuL75eVxcU8qxll2Mf6OdYJ/DexHAk4LtqmiJ34lbKR+INr9SZCxg4LTjehtPz6qSlTzV+oUuUGc1o+YUqJJ4c9MySs8NO85UqnGDUl6rmaCeVfUf3v10+zZB/pQ5KSkoChFB2FpQnhfIkFgHzVO4WnlxvL4Q6Sg5fIWNb59IbhkJ+7D55F+xb6Kk+DirBg2rTYmeYAEDQbP7oEjSNEtGBeuzWxn7rKxlftDszwb1ghffbrcVR/Xm8d3lYLqfMOfJOBaQo3iG0PTAhvc1mIAz0L6DYsMrunfuJWr2P2YhEcYJOhH X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(39860400002)(136003)(396003)(376002)(346002)(451199021)(66946007)(66476007)(4326008)(66556008)(6916009)(186003)(2616005)(86362001)(26005)(1076003)(6506007)(107886003)(38350700002)(83380400001)(38100700002)(478600001)(52116002)(6512007)(6666004)(6486002)(2906002)(41300700001)(36756003)(8936002)(44832011)(8676002)(5660300002)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6bVAi1+l/CyE3kB5oK3ab5N2nD0n4VtbT2+fhtusWmnML68PLMk8VfptY/9XZpnRaUn+2VpQ03HFXTqIP/o9TwbtlSCctandXVmMlAcaSYThl38jG2F8Od/i7zyjkpcK4ZL/MB5bQCZANKfH1RqacJZ0NTbe46etmjCweO5PHJUU8YbCdfP47KA4AUeW0LR3uclbI+37HZF98+cwDW1BfjTNnBtD4nz/WEyv+mhLgtz3VhCfBod7ii6R1xHXhbOcf3xcTCyQhETMETjELMHyFF5ZY9mgZewz24wG731alBVtDlKDHj/e+WXRk3fimerChlMVhy0SsdKS2IJhEMFvcTi+OGpdi+j2CJZHHG1NgPKK1Fzx0EFfaSHajXapF9gpiQJ5dKIaKYfjEVBED2JDejBn8N7x1fFeLSpfHfwvd84YijtLMIIq/fevz49Yakm+x7FzkPDc+mu36rJS6jF2QD+vMb8LL1PRjmLm9iJHoS7W0+Zu18zO1oTdo/tZL2ku6bu6TOLDBU7OpvsAMFjc9yvCCbPRQ2cK5SHWJLVP3ueYkzdwx1u2HlawQ1yKwyp/2ESdqnev7I1DIa7iArrJFGJRY4DDxnKSyYOplolCM8ZGPxxiBhTKloBoVYGUmMRKGXftkVCBftclKCxj13P7O5BfhjbCaQRDUXbWgy/LzCdpr9yBbvyVIIACVeQLgVCu7Rhr36lGEAQ++tXEHReHwgYbdX7f10Ib28OGIrjOTwVKBrhhjTrfF3RHNd+M2mF5shMDsZvQeapVqzRX970g+8NZxu3AeH1RpBG9jpAmVK1gl3RMMv+SC4q9Qc6a/g0jF84KLw+3Rlxzu9eI+2Kif2JESbwetndounEsok6q8xaPnjyt8YfxWRaCnz30L+XWA3y0roAqMQvB6yWbKmVhHcKZiBv8rMaRqSQU/lvQO0OtUDs/7Kly9xYiBcbzk+RElNgMcM5dEJ6Qhx098q+erv+6ZpdYeWh8aj8/6uvGDkxuef6ABFenywkGium6hXiLYRAalG/4G6qafyFfbx83T01ZxXS6GZ4u3VRyBLcVyjvYYjP4GQanXftbZxEefnL27bwwLeHIRX3DaNVihGBAtdlRzoUTxfd+m9rl7h3LeujQYrvg7aD2pKowjs6cZiGGNNzSsTmPbQGf4m13dY6MPpmr/ZdHr303g0/hytDp5GnJfiztDUUlNRy1DaRA7PdMNrP17dHV5nTf46zxPFkDtdURacbqRWv/9LDkNto+pHaQugCn4JWbF2P/RavpkwkyoEhjNuMppOkVTnU7anG3o0GQNGXRbmt6Pb/suCHUfqZNd5OoOwG17u09a72BVkCUEQIU4wQlpa3cbZyO3annbRbbYlGzS62vSh/ukCKkd/tgqHiotGoUELC1Q890Mwy4taUmFsNzSmFZ2pslyO/hy7JaPJ+uhZe8kD3Bh0MsobeXIZNBAswyvIia5V8q3Tch6K/0nA3GZpe5CC5OVqNmEEw/owJS7PXQNiT3LVrLjdC5hKi5eJhJwl1xXxPF7pDhkD3NtnXf1D83h4uoM/aWuY3wNejesPwH4f2ex1sl9s2NNQkHvICEZDKeCV5V1KQHfzs9Z8rAABHbdMOv9UpRog== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2262bc67-c8fe-48c0-aded-08db81412343 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 12:28:16.8630 (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: ZIhklkjNcI/d1fujhaWktl97USJjGknp4UpY+B6fvcg8TAGDMPsaWSiV34LxTgj+oTanZQkmMkjmE8RRcSzgvg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR02MB9688 X-Proofpoint-GUID: 8FJo0zuOVkO8PEyLdVqauX6T7wAYpN7u X-Proofpoint-ORIG-GUID: 8FJo0zuOVkO8PEyLdVqauX6T7wAYpN7u X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-10_09,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Exec transport backend for 'migrate'/'migrate-incoming' QAPIs accept new wire protocol of MigrateAddress struct. It is achived by parsing 'uri' string and storing migration parameters required for exec connection into strList struct. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/exec.c | 70 ++++++++++++++++++++++++++++++------------- migration/exec.h | 4 +-- migration/migration.c | 10 +++---- 3 files changed, 56 insertions(+), 28 deletions(-) diff --git a/migration/exec.c b/migration/exec.c index c4a3293246..8bc321c66b 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -39,21 +39,50 @@ const char *exec_get_cmd_path(void) } #endif -void exec_start_outgoing_migration(MigrationState *s, const char *command, +/* provides the length of strList */ +static int +str_list_length(strList *list) +{ + int len = 0; + strList *elem; + + for (elem = list; elem != NULL; elem = elem->next) { + len++; + } + + return len; +} + +static void +init_exec_array(strList *command, char **argv, Error **errp) +{ + int i = 0; + strList *lst; + + for (lst = command; lst; lst = lst->next) { + argv[i++] = lst->value; + } + + argv[i] = NULL; + return; +} + +void exec_start_outgoing_migration(MigrationState *s, strList *command, Error **errp) { QIOChannel *ioc; -#ifdef WIN32 - const char *argv[] = { exec_get_cmd_path(), "/c", command, NULL }; -#else - const char *argv[] = { "/bin/sh", "-c", command, NULL }; -#endif + int length = str_list_length(command); + g_auto(GStrv) argv = (char **) g_new0(const char *, length); - trace_migration_exec_outgoing(command); - ioc = QIO_CHANNEL(qio_channel_command_new_spawn(argv, - O_RDWR, - errp)); + init_exec_array(command, argv, errp); + g_autofree char *new_command = g_strjoinv(" ", (char **)argv); + + trace_migration_exec_outgoing(new_command); + ioc = QIO_CHANNEL( + qio_channel_command_new_spawn((const char * const *) argv, + O_RDWR, + errp)); if (!ioc) { return; } @@ -72,20 +101,21 @@ static gboolean exec_accept_incoming_migration(QIOChannel *ioc, return G_SOURCE_REMOVE; } -void exec_start_incoming_migration(const char *command, Error **errp) +void exec_start_incoming_migration(strList *command, Error **errp) { QIOChannel *ioc; -#ifdef WIN32 - const char *argv[] = { exec_get_cmd_path(), "/c", command, NULL }; -#else - const char *argv[] = { "/bin/sh", "-c", command, NULL }; -#endif + int length = str_list_length(command); + g_auto(GStrv) argv = (char **) g_new0(const char *, length); + + init_exec_array(command, argv, errp); + g_autofree char *new_command = g_strjoinv(" ", (char **)argv); - trace_migration_exec_incoming(command); - ioc = QIO_CHANNEL(qio_channel_command_new_spawn(argv, - O_RDWR, - errp)); + trace_migration_exec_incoming(new_command); + ioc = QIO_CHANNEL( + qio_channel_command_new_spawn((const char * const *) argv, + O_RDWR, + errp)); if (!ioc) { return; } diff --git a/migration/exec.h b/migration/exec.h index 736cd71028..3107f205e3 100644 --- a/migration/exec.h +++ b/migration/exec.h @@ -23,8 +23,8 @@ #ifdef WIN32 const char *exec_get_cmd_path(void); #endif -void exec_start_incoming_migration(const char *host_port, Error **errp); +void exec_start_incoming_migration(strList *host_port, Error **errp); -void exec_start_outgoing_migration(MigrationState *s, const char *host_port, +void exec_start_outgoing_migration(MigrationState *s, strList *host_port, Error **errp); #endif diff --git a/migration/migration.c b/migration/migration.c index 2f5bd5df6b..52e2ec3502 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -467,7 +467,6 @@ static bool migrate_uri_parse(const char *uri, static void qemu_start_incoming_migration(const char *uri, Error **errp) { - const char *p = NULL; g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1); /* URI is not suitable for migration? */ @@ -493,8 +492,8 @@ static void qemu_start_incoming_migration(const char *uri, Error **errp) } else if (channel->transport == MIGRATION_ADDRESS_TYPE_RDMA) { rdma_start_incoming_migration(&channel->u.rdma, errp); #endif - } else if (strstart(uri, "exec:", &p)) { - exec_start_incoming_migration(p, errp); + } else if (channel->transport == MIGRATION_ADDRESS_TYPE_EXEC) { + exec_start_incoming_migration(channel->u.exec.args, errp); } else { error_setg(errp, "unknown migration protocol: %s", uri); } @@ -1692,7 +1691,6 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, bool resume_requested; Error *local_err = NULL; MigrationState *s = migrate_get_current(); - const char *p = NULL; g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1); /* URI is not suitable for migration? */ @@ -1730,8 +1728,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, } else if (channel->transport == MIGRATION_ADDRESS_TYPE_RDMA) { rdma_start_outgoing_migration(s, &channel->u.rdma, &local_err); #endif - } else if (strstart(uri, "exec:", &p)) { - exec_start_outgoing_migration(s, p, &local_err); + } else if (channel->transport == MIGRATION_ADDRESS_TYPE_EXEC) { + exec_start_outgoing_migration(s, channel->u.exec.args, &local_err); } else { if (!resume_requested) { yank_unregister_instance(MIGRATION_YANK_INSTANCE); From patchwork Mon Jul 10 12:27:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13306865 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 B7E8AEB64D9 for ; Mon, 10 Jul 2023 12:30:01 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIq0C-0008Nb-Pb; Mon, 10 Jul 2023 08:28:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIq0A-0008L2-Gt for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:26 -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 1qIq07-0000lv-Fr for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:26 -0400 Received: from pps.filterd (m0127838.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36ABqv48006326; Mon, 10 Jul 2023 05:28:21 -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=c8R3QiEWHMRTZBiyRNVpI+goxXTbEG8dMUo7C7j7v xM=; b=1G70x9QsF0MWE0zF8NDlME4xV975goS5iUoz0lXxotFo4rJlH4OgxDpqZ YSqTD/SnxMRCD9tQfQgixDrkSYdNgepKqaLS1uzn09hlrulhWAIB4aerk5nf/XWz QfyJ2VpWRLrNX+DDccn+EodUlGGaeso3d80o6uxAx/ADdw+2crwwn21UTqtYu/kR OScdkOqcsrTq7Uq4nhBLNnwlXsnPeYFRsTKbPu0wK0jK5bPC4JjCzPYHv1lGGBQD zYGof1dBHlYvl1kOzrlb7yaifolQHQFNULzm9vuhtn9++H3znvKR0K1IIyaW0PbF oQ2NE8UjLO7jJBMbTQER9xgvtNNOQ== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3rq7butu5x-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 05:28:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YZBDZni+/+mWkSbUsdhzHOkyfv+XSabBtt1SCUvv9wE9+edjuYlnsOlEtNzzwFaPo797zgJonJUXxcL1sNZJ/NEVrT76AOcDxCDExdpTr/SZ1QtU8tHO+5QClAJ7+7fmArhVaieOji1bIuu7hMOBdeylCrbNRqO++IL07yRdYIfoijEZDpyV3kue8KjozzCu/OKtGGz1FUm8eqcdyT2F0A9tS+VkJugxr5Uc/ADYZQa3SZt1oNeyxqPdmbgZLZQGTfBBCK5hvyjdsvRGN5nM72I0aiebViAiGV+JQWkeoyYNlpjRswbzFMqQgqQIMNnOCafQthwgYdS2jfmaZkHxVg== 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=c8R3QiEWHMRTZBiyRNVpI+goxXTbEG8dMUo7C7j7vxM=; b=EP+72Lxy4mahuC4OuJBjcHTt6bA0UEE88aS9lSPlprKdmYUlpkjgtV41Z5HAPhpSVY+8cT89xakEKb3sAydRTL434sqgQyXFug1PjasstJT/BOqkCJCh5YbR99Cq1UOg1oltbo04M98BacqtDQuqJdsTTiRkHrMY6LbfNSZjBmoYLrQxdOUZM8TgO6WcSIJkZHNRp9KYwbNK4odWK+JN7td59naL28KMkUmFFqfz89YNAoNnKCTDl68SBPMcQUUBfu4RBDefDcMX6nHQWKAma022Fmk6GA4mQjXIep+dA6uMrWgjae9EBQ2m9+dFo2FKG9GtYwlQJYOBb7P25VOpUA== 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=c8R3QiEWHMRTZBiyRNVpI+goxXTbEG8dMUo7C7j7vxM=; b=DEddv7bW2Uy9H14jfgg0KF2Id+738xdEInMI5dM3p8yyL0M6XCFtDCf/tSqeB+vRqQ+2UVJPcWaVAJRdK2r8kGwK8JSs1euVgts7UOFuYFZ3EEVZoNM77jz5wzCT7Nc8PdOo3hjPMRK2HGl7EX6OaosrLFMFOt7JZT+BxCU5FZ98ietbnLS/AZW36M151LcV3/XXWb5Nwp0p27QbP8xmmj0G4dsN7ZJ3/yelM7KuYLhQtENF54aQ1pWQHo1yDkDynDdQ1sdZTdj5yYt2WB8ufhAHTEfckIH4nAqWUCKhVl7wTx7kAUALnzbTvDqK22u2vg9IwCNBLFSm0zVi9uavEA== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by CYYPR02MB9688.namprd02.prod.outlook.com (2603:10b6:930:c3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Mon, 10 Jul 2023 12:28:18 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%7]) with mapi id 15.20.6588.017; Mon, 10 Jul 2023 12:28:18 +0000 From: Het Gala To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com, eblake@redhat.com, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v7 6/9] migration: modified migration QAPIs to accept 'channels' argument for migration Date: Mon, 10 Jul 2023 12:27:47 +0000 Message-Id: <20230710122750.69194-7-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230710122750.69194-1-het.gala@nutanix.com> References: <20230710122750.69194-1-het.gala@nutanix.com> X-ClientProxiedBy: PH8PR15CA0003.namprd15.prod.outlook.com (2603:10b6:510:2d2::25) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|CYYPR02MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: 37cf8901-d086-4e47-d72e-08db81412455 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: l/uULkH15+sQ0mzZuimYIVXFPC6ZhOuEGF3cqKdmu/3wqADDRsFkQ0FmunYnDXgO9ydXFgokjbAJeQBYq6Sls3fyiFeGD3Fs2UAEE3NDDQpIAizPfboX2JrSsSIGixo/NiRHf0OHML+o5Gmaln7TOxCjOFC150RrKyAEGMWGEkB7UdfFOc1PQzkZT2MH/yXxXP/CFxxsWUuOXCwv8HPx9w5cMwP7evOyPxzr8T7wCGf1gqKfHfZjUyX7jEJkA7z1h/ZRqDB7mgy64dKEiunC37n72j/b5uoBNyXW+0W7mGzL0Wz3ng4Qzzuv/FhdIiStFfFh0Bs4FOZZInkWdhddCQ4Jp6WcZO6rMPF/qr4WiqVwSwvP46ygby3ISCPYRGMtoAKDlPBD6D0nSntZ1GjiTncClbWypmIsE9N1t1VGe3wjOzIN2mhS4Z+pmIHTZvac785XtywYXtSw1mqfxbdhtIYGmraxYGEuIvln9DyHJuSQxViptvykneKm3c2/Qk89Yijkfw1f/8zMBsVipMsdtAXz6nsyXPnr+hhO1NGVz+tIANxVV8tUS8blKF7Bhdi8bCft94MvRPjiY8mvfU+rWVMp5cqA53DhvmgBY6741F1wot9V8gg2rRfY2W6idHB1j4yd+kLxv4SIT/GURhyFiQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(39860400002)(136003)(396003)(376002)(346002)(451199021)(66946007)(66476007)(4326008)(66556008)(6916009)(186003)(2616005)(86362001)(26005)(1076003)(6506007)(107886003)(38350700002)(83380400001)(38100700002)(478600001)(52116002)(6512007)(6666004)(6486002)(2906002)(41300700001)(36756003)(8936002)(44832011)(8676002)(5660300002)(316002)(309714004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: icAXQCBOYFB8Wrptpg2vDkMs00F3jFK/NBjRy3b/ol2DT6KpjdzD7408hBQ/whyTRVWaQ9HuwAbttGNUfxmaMvBP++QtFehO88UjEVlxijpAHVhvDvQLZD86rQBdt/1GLne0emc6voCfw3qggp+JdPeUjN5NBjX/BWnDvvESli35DEq3CBOvJkNGrHSc4Jo92HO5ExoRd41GJbO5MDQZ6FIdxK1bfVPf7/vUBKOMKs0ogwe+o8Mf+yoD5ecxjgGvtZ9h2pCbsNDyjdFGZy592o/Bf0hpHNtxRFYa9u/sAW5LcL2C0u5aY2oBOU7mEaiQTrp16wADvn2bZpRamLlr3KTL4EMBSB1TGb7Eq55LGIbHcQ2l7GRAzDfJ0AqJAm3+J1L47sEWZdOz3sqeglAke48zzHrl1ESro/J2tWeY70A7g+1ZcaLb+s7q63ecOYq0sSv9aP1ohM+8Q3lyuX7sEHNaVJJRNM+1B83mSjUQ4vS0u36TjT3OzL1sfeuIKyhI8sxGjKcjf85zTvJ/bMApglxbgjvpsTt5lLgN1IsQfZo2Ka60vD9R6YtQ2dIw/4H5ReUdHj2KMQ8oBS+4avPW5JfZSfs4nO1xBlOaWa9cHrM9yvErCNdRrxLHM2i5GNuihPoi4cys2L1x8k83pusXPPjG9nahCqBvqRNbOnG8x9bBEMf8d7PH0QYFy/8DFIkoyvLiEYidO9Gq/zFMBdeZmGxocxA13guONq+Hdjjxm/FpEZX0y1p/ed+vc46u4VYf4Dxe/Bo7AUSap4Hax9g+IlNbsLd31yZmCeP+IkQnaIfXgMdsgPzoY0D4f1R94CN4JABtF7DOW9ou/GQkrU4AReDyk27bL5NOy6pC1L3792CAH6k4uTwKfzXqm7eDh39g12iTkTdSYrcRJF6q53SoJ9EoM0eapfCu2xrk26TzN3QDZuO2WudjXRKHcaWmLgmcoM9wcUyczrKAlmrfPk4pZKjxlM3s2kTH0bqeAeqjc/0itSfgC9yP13Q/36r2N2PET8K6FV5pPgS9tkPM1aaxy+OlCA80s3TNran2dtvvWPzYkoEkjYPliEvnbe4ITE+DdAmKlshbH7g5CMzjCEnKKSCAa3IOx20+4k64gLm1rzmIm7GnTbQeilaBfh4fP8Hnf4Zcy3FQCMfN34yyOopiQ/EQRlwOHF8xtm6OzCBh/kxZwwUfv1ZHXiQwoYG3qB4xuTcVshirF4TWQYd+7icWZj37ZfVdX+6tRNYiEDwQmEUy1zscYlROQOo4YieoW80oB9k7g+/pwhn4SgX+yRAcVbvZqM0u+NVmtp2hQFSxc2eNNeAPu7YXuEMtDvvRIRwz4sDVOHDLN48u4B0XDeTQmr24m6cD4OglKE9epaMy71hCqOj/WzJ9PCfAK7NDX/N3LwUu8mP/BAlNpjzyw1h67Q9hzFRLJNOtZWd8CTLo0TjloqncYXeD9vmZu+sR79V5ziuQmvSsL83dZxJjWAp/VI8kCulwItuQn0XHpa1sEqaqDU/bq64Kz7s43oB+eEKy0qsQ1WV+CkA7q15Vno4+zzr606uI8jePXrTYbRK6S/ogN7IZtioTwrwy3OpSdlDVJTlM/ay3Qvb00ncHtgONlQ== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 37cf8901-d086-4e47-d72e-08db81412455 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 12:28:18.7103 (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: hq3zAuuXGxM2CutvTKyAgIPaDQqdGE4ZteuGPO7rBaUq1KFLZcRZnevM/+p6SFhxMZWz5rLUTfdJWu8qNFRaaw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR02MB9688 X-Proofpoint-GUID: R_d4tdUWS6l976tTS5QMLlmEC8vBQj_w X-Proofpoint-ORIG-GUID: R_d4tdUWS6l976tTS5QMLlmEC8vBQj_w X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-10_09,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 Acked-by: Markus Armbruster --- migration/migration-hmp-cmds.c | 16 +++-- migration/migration.c | 34 ++++++++-- qapi/migration.json | 109 ++++++++++++++++++++++++++++++++- softmmu/vl.c | 2 +- 4 files changed, 147 insertions(+), 14 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 9885d7c9f7..5f04598202 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -423,10 +423,12 @@ void hmp_migrate_incoming(Monitor *mon, const QDict *qdict) { Error *err = NULL; const char *uri = qdict_get_str(qdict, "uri"); + MigrationChannelList *caps = NULL; + g_autoptr(MigrationChannel) channel = g_new0(MigrationChannel, 1); - qmp_migrate_incoming(uri, &err); - - hmp_handle_error(mon, err); + QAPI_LIST_PREPEND(caps, channel); + qmp_migrate_incoming(uri, false, caps, &err); + qapi_free_MigrationChannelList(caps); } void hmp_migrate_recover(Monitor *mon, const QDict *qdict) @@ -704,9 +706,13 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) bool resume = qdict_get_try_bool(qdict, "resume", false); const char *uri = qdict_get_str(qdict, "uri"); Error *err = NULL; + MigrationChannelList *caps = NULL; + g_autoptr(MigrationChannel) channel = g_new0(MigrationChannel, 1); - qmp_migrate(uri, !!blk, blk, !!inc, inc, - false, false, true, resume, &err); + QAPI_LIST_PREPEND(caps, channel); + qmp_migrate(uri, false, caps, !!blk, blk, !!inc, inc, + false, false, true, resume, &err); + qapi_free_MigrationChannelList(caps); if (hmp_handle_error(mon, err)) { return; } diff --git a/migration/migration.c b/migration/migration.c index 52e2ec3502..65272ef739 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -465,10 +465,22 @@ static bool migrate_uri_parse(const char *uri, return true; } -static void qemu_start_incoming_migration(const char *uri, Error **errp) +static void qemu_start_incoming_migration(const char *uri, bool has_channels, + MigrationChannelList *channels, + Error **errp) { g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1); + /* + * Having preliminary checks for uri and channel + */ + if (uri && has_channels) { + error_setg(errp, "'uri' and 'channels' arguments are mutually " + "exclusive; exactly one of the two should be present in " + "'migrate-incoming' qmp command "); + return; + } + /* URI is not suitable for migration? */ if (!migration_channels_and_uri_compatible(uri, errp)) { return; @@ -1496,7 +1508,8 @@ void migrate_del_blocker(Error *reason) migration_blockers = g_slist_remove(migration_blockers, reason); } -void qmp_migrate_incoming(const char *uri, Error **errp) +void qmp_migrate_incoming(const char *uri, bool has_channels, + MigrationChannelList *channels, Error **errp) { Error *local_err = NULL; static bool once = true; @@ -1514,7 +1527,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); @@ -1550,7 +1563,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) @@ -1684,7 +1697,8 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc, return true; } -void qmp_migrate(const char *uri, bool has_blk, bool blk, +void qmp_migrate(const char *uri, bool has_channels, + MigrationChannelList *channels, bool has_blk, bool blk, bool has_inc, bool inc, bool has_detach, bool detach, bool has_resume, bool resume, Error **errp) { @@ -1693,6 +1707,16 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, MigrationState *s = migrate_get_current(); g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1); + /* + * Having preliminary checks for uri and channel + */ + if (uri && has_channels) { + error_setg(errp, "'uri' and 'channels' arguments are mutually " + "exclusive; exactly one of the two should be present in " + "'migrate' qmp command "); + return; + } + /* URI is not suitable for migration? */ if (!migration_channels_and_uri_compatible(uri, errp)) { return; diff --git a/qapi/migration.json b/qapi/migration.json index b583642c2d..239affdc34 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1458,6 +1458,34 @@ 'exec': 'MigrationExecCommand', 'rdma': 'InetSocketAddress' } } +## +# @MigrationChannelType: +# +# The migration channel-type request options. +# +# @main: Main outbound migration channel. +# +# Since 8.1 +## +{ 'enum': 'MigrationChannelType', + 'data': [ 'main' ] } + +## +# @MigrationChannel: +# +# Migration stream channel parameters. +# +# @channel-type: Channel type for transfering packet information. +# +# @addr: Migration endpoint configuration on destination interface. +# +# Since 8.1 +## +{ 'struct': 'MigrationChannel', + 'data': { + 'channel-type': 'MigrationChannelType', + 'addr': 'MigrationAddress' } } + ## # @migrate: # @@ -1465,6 +1493,9 @@ # # @uri: the Uniform Resource Identifier of the destination VM # +# @channels: list of migration stream channels with each stream +# in the list connected to a destination interface endpoint. +# # @blk: do block migration (full disk copy) # # @inc: incremental disk copy migration @@ -1489,14 +1520,50 @@ # 3. The user Monitor's "detach" argument is invalid in QMP and should # not be used # +# 4. The uri argument should have the Uniform Resource Identifier of +# default destination VM. This connection will be bound to default +# network. +# +# 5. For now, number of migration streams is restricted to one, i.e +# number of items in 'channels' list is just 1. +# +# 6. The 'uri' and 'channels' arguments are mutually exclusive; +# exactly one of the two should be present. +# # Example: # # -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } } # <- { "return": {} } +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "socket", +# "type": "inet", +# "host": "10.12.34.9", +# "port": "1050" } } ] } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "exec", +# "args": [ "/bin/nc", "-p", "6000", +# "/some/sock" ] } } ] } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "rdma", +# "host": "10.12.34.9", +# "port": "1050" } } ] } } +# <- { "return": {} } +# ## { 'command': 'migrate', - 'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', - '*detach': 'bool', '*resume': 'bool' } } + 'data': {'*uri': 'str', '*channels': [ 'MigrationChannel' ], + '*blk': 'bool', '*inc': 'bool', '*detach': 'bool', + '*resume': 'bool' } } ## # @migrate-incoming: @@ -1507,6 +1574,9 @@ # @uri: The Uniform Resource Identifier identifying the source or # address to listen on # +# @channels: list of migration stream channels with each stream +# in the list connected to a destination interface endpoint. +# # Returns: nothing on success # # Since: 2.3 @@ -1522,13 +1592,46 @@ # # 3. The uri format is the same as for -incoming # +# 5. For now, number of migration streams is restricted to one, i.e +# number of items in 'channels' list is just 1. +# +# 4. The 'uri' and 'channels' arguments are mutually exclusive; +# exactly one of the two should be present. +# # Example: # # -> { "execute": "migrate-incoming", # "arguments": { "uri": "tcp::4446" } } # <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "socket", +# "type": "inet", +# "host": "10.12.34.9", +# "port": "1050" } } ] } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "exec", +# "args": [ "/bin/nc", "-p", "6000", +# "/some/sock" ] } } ] } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "rdma", +# "host": "10.12.34.9", +# "port": "1050" } } ] } } +# <- { "return": {} } ## -{ 'command': 'migrate-incoming', 'data': {'uri': 'str' } } +{ 'command': 'migrate-incoming', + 'data': {'*uri': 'str', + '*channels': [ 'MigrationChannel' ] } } ## # @xen-save-devices-state: diff --git a/softmmu/vl.c b/softmmu/vl.c index b0b96f67fa..d811f3f878 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2651,7 +2651,7 @@ void qmp_x_exit_preconfig(Error **errp) if (incoming) { Error *local_err = NULL; if (strcmp(incoming, "defer") != 0) { - qmp_migrate_incoming(incoming, &local_err); + qmp_migrate_incoming(incoming, false, NULL, &local_err); if (local_err) { error_reportf_err(local_err, "-incoming %s: ", incoming); exit(1); From patchwork Mon Jul 10 12:27:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13306869 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 A44CFEB64D9 for ; Mon, 10 Jul 2023 12:30:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIq0F-0008On-Oh; Mon, 10 Jul 2023 08:28:31 -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 1qIq0A-0008Ko-Ai for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:26 -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 1qIq07-0000mR-Oi for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:26 -0400 Received: from pps.filterd (m0127838.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36ABqv49006326; Mon, 10 Jul 2023 05:28:22 -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=zXyVC4Y3WmZTc1xA1KhZ2ngdIUGTw3rghvjXnLFgC x4=; b=myQH4cQ1eFmEEBkGqeEcU5dczYeS6Sf4E/Ifa+vP54hOePKVNWCC7dqiF 75WTMU0Dw1VdRiCUgj9Nf2m1utRrbM655DjkQIHktl0UnfK8aDX5ttIHkqjlqYCw 3uT8fy4KQQdwOIRBVUokA7TZtxIKzowRnZkvEuCedhAuDxtZ2MzkciGN/2iMihW5 8AxovLYC9UXk2sU0H8fnFJk6UWDVKukbQRaF+kP4RaX/17AoawYOvs1x+ZRGWKdo HFGkGXHZMyzVQoeWwgP30yB6vM7GhZe/QrZ42Rt1Qkcjr8PVYMqIBCIvDH+IXF2L +zpdjEEkH5B6p0KWetn+KSFnh83Gg== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3rq7butu5x-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 05:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FXLAU5Ihv2YxN2wOuty1HxLbrcUaw5Z0j1eCxCPMQYw2CwJzaTOSQLNF5oznm9KHNShowL1/Jlk92q8J7mT7jJdR6moLsnBF7vutQQXpJBc4rk6+i7wXM31S6uwCyuZexHSWXIjwNKGbabzamUEhdCO7WC1Fl4s8w/L+NgwGl51r3j9ciJ7IabSBZmnge5hfIX6zVMaqxniOaQcxUKd6njXvLaK2lx2LM05YYbc35dNrQWb+vIatkMd0ZhX1gqy7GlbNiQRjaIiJe6yibTj/E2GC7s3jY29Kxr2FXl/nmN5Ac63nVHTrN6bMGFoUkHr+U3o95g9UtO7szxfpv3Ph3Q== 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=zXyVC4Y3WmZTc1xA1KhZ2ngdIUGTw3rghvjXnLFgCx4=; b=L6BrPxU3Wmr56J5lH0QxIrapV8k1zQRje4VT+yzxiZ8xdwidwAQ6RDXq2uNcjQ3qAGfcNolsgE5taxY/sCdnw050cO/iY2dNoSu0SPypQDiTgY4Df4eNew3hFAaYJY+vrDCqw/nwOl0XbUIELIIVEl7qZ6En1/BjYZxlNtymBOOXcX0B35cxKFk6Pxfm9YK/GAruvmNb3T5vDrG64hc7sErVDiwlQ7zTEpSWwY5ZCLlGShxxfhVQ4PzggDlfzv5OJpNWVGwiqDt09UMNskKEqg2x7LBvwCOpHG2vLxMsN/+O+/8y5z66yjhnAZrNCwSzeN0tdgEYsrWAwvW/CTEBpA== 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=zXyVC4Y3WmZTc1xA1KhZ2ngdIUGTw3rghvjXnLFgCx4=; b=wu6mRxoivOC31qCWaVRPevaHTGhaOTiu54ruNzSJ485WRVyZf23OaDSaIW443yVUg3V7RDHZrGLylMgi58clydzihJyeZve4g0IbZZJ5j7UCtk9r5mHcwhKiOj271ESRHuskl7cUsekjyFpVYixzkTKMKpxJViBGA+VZwwN70jQpO2hTlXvv/SeqlbGe2M5CRgiuV/NNHIIZKMsNuZ46xMf14/ct04SqR1b1PvcDDiTCzeoQIqd2hWw13G2lBkGF8MkLrK7YWmg7sNrWR+QcjIyD6IgKRQV4RS34oatd9phr4La7b3s2RKMBM0IjqKFeqG84cnemf7A5N6+GM8n6BA== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by CYYPR02MB9688.namprd02.prod.outlook.com (2603:10b6:930:c3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Mon, 10 Jul 2023 12:28:20 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%7]) with mapi id 15.20.6588.017; Mon, 10 Jul 2023 12:28:20 +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 v7 7/9] migration: modify migration_channels_and_uri_compatible() to incorporate new migration QAPI syntax Date: Mon, 10 Jul 2023 12:27:48 +0000 Message-Id: <20230710122750.69194-8-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230710122750.69194-1-het.gala@nutanix.com> References: <20230710122750.69194-1-het.gala@nutanix.com> X-ClientProxiedBy: PH8PR15CA0003.namprd15.prod.outlook.com (2603:10b6:510:2d2::25) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|CYYPR02MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: c8a90143-38ef-4357-62c5-08db8141256a 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: PBZ+SK6Mx8o9Y3O+yKzWlatTu5S18QDrV6AcKBrRQakss3SVTA7fDz4W1CS6xVBO4U5SQ5sqiv7Ge/WEN5VdB2X87we6FNdkuft/uV8WGz6SX6SS1bNP800434wq5yA8HQcoQaCjd3n7cR9BnyhflPbaEokb6+hYPDUac0bNV73QLyS0ctF+zmIbg5Bsg0CG9GLZEOzpbvnpPa19c10b4qH1xypCLYC9uDQvQeqnBPsXzKwb/7D1k+f5Be3nFCB1KMjacQSACVKiOK2xnLR6ZAT3E8GFzUuKzX9JLeBO+D8VzQVNqlzftvUKWm21C+cTOTN9BQd7qH9JexkrZAm10CNiCYuUfexYd5wnJ0Z+ht0+55LJhAcGCwSfME1eDkKYrw/LY8LfUvy+vlI6CltQdywzPitiTEsJpbnAT8sQ7vZDfVv2B2nAn4ARNQ8iq2LGPOhdt9Kg1x3mtBS2HVYgP90EOMgck7rYBiOD4GBOVWDOpp25g4XQr3fYSi75uG+UVeEmpPD1HvwdAbtTCN7BjItdnaabcYdG1eX0ZtPCxejAaMMjeVoEFDZFKccfXLSIxJjLpOdZ+V1S+zM+Zzr2aR7qgHenYCvkveRct7uoOR7cHVxDMnh83yslUSEb4L3c X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(39860400002)(136003)(396003)(376002)(346002)(451199021)(66946007)(66476007)(4326008)(66556008)(6916009)(186003)(2616005)(86362001)(26005)(1076003)(6506007)(107886003)(38350700002)(83380400001)(38100700002)(478600001)(52116002)(6512007)(6666004)(6486002)(2906002)(41300700001)(36756003)(8936002)(44832011)(8676002)(5660300002)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mGwhIRVY5q/Nk39OV17CloDkF2POQtcjH+av2zZrrN9ZbKpEJEzcww1DztZOa2VBWnDd63UZznXP9s8KbDUBFPPeG4v9mIwKBTdVmBo5jWpGIAPt1kHQwAZpRMGK22NZGE00RVSD9yac2YEQEmlJ/UU+SCbSn/E9Ned9Dij128OzsW34k3I8oBiLRofa6jyJmJPGrv2VRwQdgg5Ql+xeTXFR1M/Dcv8er90zOalao+dkGhHvMmJGN3pVI7KEmgeg5HX/VTtLXXPJ1oVIHDPvtA11gpXYWS6ZCSUUMeRJ54Z4vBamxK/87IbKCq7djd910bqBMhPTAEq8uH2LMSXcmt8DZRBZvu+NjlzpWTzeFdCBYoCxF34wTErodjPegDyLGqHij/C/nrcykpihHjWmf0oXD7DDRJbvkYO+oraob5uf2cAQhaj81/iGCrgfm7nxKpzqmnsvgbFPgrNIqEERZSt4Rnvp60HGGdhHy4SnOjA6rG9NYFS37z39irD1hDDgBAdNXOOccaudm7xb3HUmP3MQAH/Z+pI6sAJSt0rTH9brkDlwUtintUUVLqsFNr3C2hF8yV7n+FZLv//dU6PGtlsPYRrYZPMY+KBK5P94qF0Tj8MA9Y1wzmdR+49koRZGUN+9ZFG8qmenwGNQaKHhZH6k2Vde83PzAXn1605hFtHR54e4FCy0pUs0peX5CjGTvETSpk/8Fnu4vLFXjPQCNuKG6EvyX6wZ18GIO8Yn9u0enohmzsAb38X3T/yIVxd0g3KcPgktGkZ+a4Dl06CsWz4IiswCEAlhJD4boFX3ChZfyMp49kHW8JS9PLGhmhWVShUvp7kzQgvMq2M03velZmfIn4PjYQB54rnhXxTPX7zURT+ojezfQEWz+OxprGkpYHxbWNWyRqo63Xm6z01GUlKaoRX38hpGSney0dORjbfWvvPAGQxBqhrkjb9y8rFzYt10EoMBZn1Z4d1anUSkKBSk8W0TbwcbZtjc/HGlRC4Swq60VAEsFiRFl2bdFLvbgyEUm2S+oH9UWgsi+jMQoVqeAQE9RMvLCG/EL+pn/cq1EuAlBbhntnARbdnpxN4wC2G8xLNUyFkaQxyk2cw9M3QNhZPL4s0FOZXA8I4tbjHVswqhkcpG/ZqlKOCogvuJm5zdHGqyTZ8zLkBmf0HShybR42ghsdHROB80PfHI1BRohUHX8wcpAxiQeAPRSb/woxHRmGHYoagvQTy74s9WybWv9Gh/wrwFUDJROZJpQ54brxJivIgFKhPnJKXo4dv3jPH33hKrdbCd7iBjyb10COeX5iN+rDAV/TBoy3tEc6j89n9BueIG0ZM0XylBFsNbqf3P6r7VTErEe6/S9/dcLZvfAkVn5Fw1sgy2b22XDE/SjdcPDro+IEZ8twwvujgNhgwmNFM2wE1+4D2uvEUzMJWCBHalfPiS/y44JH+tyBytdt+kWu1PotWEeu5NIOnBj0CRkPVPPntkfhoW0H/z2VGI3kDf6u6uUJkMVJZYDT9kimINLuUyedxS+/eCqpP/7b1+leJpsxHIE/2LMMo66gIkOgFg13gGONplojpfVNMSdrGnd1nLOlXVy2Y7TNJmcRPoZmmogj+kPI5vUv55iw== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: c8a90143-38ef-4357-62c5-08db8141256a X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 12:28:20.4992 (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: uQ6zOFid1Ow0zeQKxlYfie2RXvgBWc1Br+uLbk5lpaoKfzoRGD2U5KlJ+jlhzO0bP2VJ0ZJ0ItLEFDHEIfQqPg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR02MB9688 X-Proofpoint-GUID: RHSY9IwYpHf1jTcVk9FsyMXr0PBdcUZU X-Proofpoint-ORIG-GUID: RHSY9IwYpHf1jTcVk9FsyMXr0PBdcUZU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-10_09,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org migration_channels_and_uri_compatible() check for transport mechanism suitable for multifd migration gets executed when the caller calls old uri syntax. It needs it to be run when using the modern 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 65272ef739..62894952ca 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -104,17 +104,20 @@ static bool migration_needs_multiple_sockets(void) return migrate_multifd() || migrate_postcopy_preempt(); } -static bool uri_supports_multi_channels(const char *uri) +static bool transport_supports_multi_channels(SocketAddress *saddr) { - return strstart(uri, "tcp:", NULL) || strstart(uri, "unix:", NULL) || - strstart(uri, "vsock:", NULL); + return saddr->type == SOCKET_ADDRESS_TYPE_INET || + saddr->type == SOCKET_ADDRESS_TYPE_UNIX || + saddr->type == SOCKET_ADDRESS_TYPE_VSOCK; } static bool -migration_channels_and_uri_compatible(const char *uri, Error **errp) +migration_channels_and_transport_compatible(MigrationAddress *addr, + Error **errp) { if (migration_needs_multiple_sockets() && - !uri_supports_multi_channels(uri)) { + (addr->transport == MIGRATION_ADDRESS_TYPE_SOCKET) && + !transport_supports_multi_channels(&addr->u.socket)) { error_setg(errp, "Migration requires multi-channel URIs (e.g. tcp)"); return false; } @@ -481,12 +484,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; } @@ -1717,12 +1720,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 Mon Jul 10 12:27:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13306866 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 3C2C3EB64DC for ; Mon, 10 Jul 2023 12:30:02 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIq0F-0008Og-MP; Mon, 10 Jul 2023 08:28:31 -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 1qIq0B-0008MB-Gd for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:27 -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 1qIq09-0000mz-1P for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:27 -0400 Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36A6eI9h010705; Mon, 10 Jul 2023 05:28:24 -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=13KBLY4cvT9N5ctwx7N6zjPTg1P8+XMUjbKBLHc82 qQ=; b=HYMcwoGZrmieH+463hqomXwvUy4GqgvEoPQcgZ1eKYgTB8ssvaSzm++Q1 hiw1yRRhf4m9mifmCXNjHwxqHgHKv1bgMPQgsA6C69qw6gTrxnCJLFAy3qG2DZyo 2fpa4zMkK5VK0wmhm1sDrbJJpDbY0AR81ggAD1j0LxB4GPQemyfeI96FewCOUe8s pDHoPgkuBW3OjrSNKYMas/6fEm275PvkwNOPfCQX3SNxn7XuviZ8fUeKBiIeQWeH XWtJDS4tu9OgVG/H6kePCLp6GfhC+4rK1hbvYCaxzpn3hp0jvGteZX1AQFXv6yUc SMwRhRccDIfV2CfZOkfuHuKASE7HA== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3rq74ctydn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 05:28:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T995MzSPhhXlzpkkhQOYvSJcumCmDkkLAu+4WCCjuS++Veiwk/01a4ppaE9aAMgz2VdkaijGzAsCg7m7pmRhZvjg9n9HBlUU6wLEgqssmCUE+EEkXrc87ErISt6X1V2+JpGYenriAOsLNL3KLk8V+0ILwAkbNa17PfgPFowBChCFLYMbSJpw9Ux8gwvlg328jPfNC5leBlYFWrbYL3eNsUue/HscXTkCWvMCw/m0nN9hq0H6kOXZkdLw0jyrFBL42o1N61GLodyZ1YRGMAliS5lgj3627LhngxTQ6mgFoZYNs+VF+J1aF3MZw2dOJWF8Zhp2M5ccgbaq9DeUGRvZug== 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=13KBLY4cvT9N5ctwx7N6zjPTg1P8+XMUjbKBLHc82qQ=; b=lOF2WMhA/ceyXms8AeoS+3RpKqP8EgI9DZbr35EVfgVHNIdQ4e3dW8/WJN2FFqD0rlzG43bdHvPdV7r1UCW8dvSkO/8fCOih0Aln/8y+44RpZkbnGbzsxd+atvZ6adObzJT1j+38x/4p35K+BuGEoUqdP+p1yPjXMqpTPVl+5Tx54e6OcAqKY2jXzlzf2a0wUS9ZcTy1EIJaz8hz6HuTdnDflfsx1l/Imvl/AfEX8Gfb8+Q8GDsDJNDDfyRKQ5og1N88x71eEmXi17GCMmZ2gFg7SJ1g8t03XHQrKfDJHirXX3VlgteW6p025vDT35v7Sfo1LXpPRdc6sDKYUy9TNw== 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=13KBLY4cvT9N5ctwx7N6zjPTg1P8+XMUjbKBLHc82qQ=; b=xYiYaOkWwnsQUtwsVO7cVNtkTc5EIzXQtZKeWgpCHnwOvmaL4q0sEmV/FF6nb4C5nbve/6diQpYejNLEYEx3XXKkQu7pQlNHF3HYE9MOyaGc9APgwwwA4HO/xKxOa6aKq4mS6LBZXnNXNTtvExdmqWiWdV684PokjB+v4jjJSCdEjeMPvRWEdisMsd1pvurq5RG1Au3n3PzUn7OTc48qfbAZZ9EL6WRupH9kcq/xNc3zxNUCDLtzwKlv3cwbANt+PJKuJ8sv9rqml2XFnvsuOuB/BvuT6pA6c0GPC3GHR0ISNTsb+LZr74nxKwduKtvSaeBI5b8d3rIdrvuJPdnoAw== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by CYYPR02MB9688.namprd02.prod.outlook.com (2603:10b6:930:c3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Mon, 10 Jul 2023 12:28:22 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%7]) with mapi id 15.20.6588.017; Mon, 10 Jul 2023 12:28:22 +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 v7 8/9] migration: Introduced MigrateChannelList struct to migration code flow. Date: Mon, 10 Jul 2023 12:27:49 +0000 Message-Id: <20230710122750.69194-9-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230710122750.69194-1-het.gala@nutanix.com> References: <20230710122750.69194-1-het.gala@nutanix.com> X-ClientProxiedBy: PH8PR15CA0003.namprd15.prod.outlook.com (2603:10b6:510:2d2::25) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|CYYPR02MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: ac0d4431-fd45-4103-b4ed-08db81412664 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: Hoea9DsKE2GvSsVt74xpb4ZN+oYOESLjuBa//u/4VirMc8DyOvz7n6MzKUL2O3sE3pgdGofTqfx6jmxU5ryEafMggUMvXxcH3EauJ763PzVKfvrr6f0LGBdnowFoC/Wjzx1GRTgeZMoWTRHJXsZR8p5MPkatY7dVwFbhG7axM6I8XEdYo43FDyiI/zkFUJYztZ/3F+93nxaVZpoFH6+TH0z8qxjWrfYks/uNTzrQAoISXtstLxfe6nLvv9C0sZ0zyENCTcHZLaDvlwXbnsICTm0P3vP1E+n0oqMv6tmHm3mlFOG8ayVqrGifoeulOE+en80zGOdcDYPp8xZJiXp65cE6IWIDZ99bJbdnN34YS21BUuLYHgDTKDUX/1oabVaF2cfPC+TrI3GYGLk2bK5t+ymCC7XfSlYl9lLeacCUiKt5+4qy5plea6WigNiZQzwnXTbsAryoQ2XAUnNCrdq8bDj+bVG/yph67Io2AkJGlmiz0vWq/d3Hdllf9U8gGS7GAE5ryhWwLZVuEXZHgoBJ4R4eKJrfzdPipztHfnDWbEu2pvrR/RXiQWuVnXilHT2RvaFMBupsWZBltVXcyV1fmIWIYNbDc2W4Ju2IDNJ8aUtqGZwGT/RRLq6KMvK6fvgp X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(39860400002)(136003)(396003)(376002)(346002)(451199021)(66946007)(66476007)(4326008)(66556008)(6916009)(186003)(2616005)(86362001)(26005)(1076003)(6506007)(107886003)(38350700002)(83380400001)(38100700002)(478600001)(52116002)(6512007)(6666004)(6486002)(2906002)(41300700001)(36756003)(8936002)(44832011)(8676002)(5660300002)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B908BAPO6RUuG2pHIETuto9k3pTOGOQs6d+4L+kFWsY2rB2hAc7hWnZRm1OWn/y8XcT0ZkSN7WjK9lJZKAIdG1oLpGsA8OXG1auASRfuJkHMdbUXPg8R7OIFRy7tpUi45NEHiGmoqjB1KQ55ew3U+5RzRNBIqe1ZNlkIc1AcsJ7YMuCwNkHm8D4EkKMgRgzaAj3ti0RS7es7m0es34/YNZQ3PlDE0KhlxulhrmlF2WQviT9X3Ehpzu4IfKdYBjCtVlA5C/XmN1pb/S3ibBrkgu2jBbiiLCJU1CA1Gz97+7tmqmdStKY+CT9tIsFuPZmOY82ldFjgCOZDEGmb8YbbhMmLw+Jl+K1BGE0omHJFYrgAzYhZUFO/OILqpSjeCxc6e36OOfpF+b38JVoiFbyqHl1bBEJJPRTgVOmmiT9DvkvU3ldeiKkw3YD5xawDEARNMXCvlNBZeVFaAc43ZlHAYP+tBZbkPFPz4tps42kpQ8SWcFfTBA5s2Rf/bvKLetjGY0VGKMTQR+KWiAOjNu9AMLxJg1a3gI28kg5GgcC68YlBdxRLJW45Zv2b7WFL6DQzHebJsy3N3iS/ubjadEt5Nk+szkrQ4lpzCrUrSPOipTjf6Ofa5/hOBwTftH13FuDyWrR7/nrO8XX2FdR5eDs7GNyrySmItGojm13MKD5eir1yGzHmOEW/QfGVBJ9fPJiCw5qfcVQRExJuZOxrDzmBzdklq+NI0hUXqYPc9iVpdMCs/4kFtgXj3ntLudN/SoGVyuFQS7x7NWB2SqinCrDSfVSyH9oH/i2un1OPj5qWsU/bWpMOGujTvw2AHIgp89j+5avP2b9cK0CgE2bdGbx8hZoMDEUbJllXnlnHuFI1AzF58xkHAYHEL2MXOfS7IP+/bvgD+tMS8eB3N2I9kha1wr56Kmvx5gOebN1JNM/a2kxiTQGSrDBp7gY3ROoWXXXxzmiaCNdmg9aqprBKQb5Hha8DpgSUMWyMeFPhCBXrzX+Zduqy+P5HohceCo5U1eOHzXI5oGOpTRRN01E7knyw+/28SzUlerdKf/FeGnUTtEVS/OwfjVfl9wcT9NRtlKR6BvjEObX5MsED+G7MNKeyNaPrKGcdJZb/18TNRHBrfBqI2uIoL3DHPyiXDeFcFUxYcdOwk2270HN+h5sU6wAZeJQpzZPyaCW6yCH1KP/YqLSdRb4VtkvEfia0UU47NzkEMaMze7Qh6mAoyazYYAG03dBN2vs+eKOd+L1K1XWKJ9YV0jtTJpxD56d78NW0vGmCXFCHyGbPTdnWciFUAet3BKNKhHGHLWjqkMRlNJdBZkDhzg7Dirz8xoHYYdGll1m52jIBVPySLjsCYeGEEZAllM8s0eR0tZV6TIMoyb7JzoxluXFfXEE8kwHU42jaTx9DoGGvwf+RQry795K3zjsy8MT9Swm2z7qLsQLYLsybwf9VMxIEnbbesDNYKbh9tKkSEv1WqzTBhZjonU0sh9ktBchIDrVDhVSHn/4vSt6jL+mken0ofpfJ9GbprX56Zl9fvD1qtbMwLAONv0Q/R4gns0kGwQlF9Ld1w2fgKEd3q/0ceNO7GtV8Crg2t7ErvJJfMSIH8wTJUtulJxw7AIIXZg== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac0d4431-fd45-4103-b4ed-08db81412664 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 12:28:22.1245 (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: 4mSs0Qw7kJVWHZ6iAGEINCjjQ2LxE2qTtQjsXtEu9f05sy/D6375iDYHVDD8BmrYe0X+HpgeCHRFJVV6y5zdVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR02MB9688 X-Proofpoint-GUID: NX_CwaTRL2H2UNC_MNDU6OU5B5rwJpqY X-Proofpoint-ORIG-GUID: NX_CwaTRL2H2UNC_MNDU6OU5B5rwJpqY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-10_09,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Integrated MigrateChannelList with all transport backends (socket, exec and rdma) for both source and destination migration code flow. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/migration.c | 77 ++++++++++++++++++++++++++++--------------- migration/socket.c | 5 ++- 2 files changed, 54 insertions(+), 28 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 62894952ca..43c7e4b525 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -426,9 +426,10 @@ void migrate_add_address(SocketAddress *address) } static bool migrate_uri_parse(const char *uri, - MigrationAddress **channel, + MigrationChannel **channel, Error **errp) { + g_autoptr(MigrationChannel) val = g_new0(MigrationChannel, 1); g_autoptr(MigrationAddress) addr = g_new0(MigrationAddress, 1); SocketAddress *saddr = &addr->u.socket; InetSocketAddress *isock = &addr->u.rdma; @@ -464,7 +465,9 @@ static bool migrate_uri_parse(const char *uri, return false; } - *channel = addr; + val->channel_type = MIGRATION_CHANNEL_TYPE_MAIN; + val->addr = addr; + *channel = val; return true; } @@ -472,7 +475,8 @@ static void qemu_start_incoming_migration(const char *uri, bool has_channels, MigrationChannelList *channels, Error **errp) { - g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1); + g_autoptr(MigrationChannel) channel = g_new0(MigrationChannel, 1); + g_autoptr(MigrationAddress) addr = g_new0(MigrationAddress, 1); /* * Having preliminary checks for uri and channel @@ -482,20 +486,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; + addr = 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(addr, errp)) { return; } qapi_event_send_migration(MIGRATION_STATUS_SETUP); - if (channel->transport == MIGRATION_ADDRESS_TYPE_SOCKET) { - SocketAddress *saddr = &channel->u.socket; + if (addr->transport == MIGRATION_ADDRESS_TYPE_SOCKET) { + SocketAddress *saddr = &addr->u.socket; if (saddr->type == SOCKET_ADDRESS_TYPE_INET || saddr->type == SOCKET_ADDRESS_TYPE_UNIX || saddr->type == SOCKET_ADDRESS_TYPE_VSOCK) { @@ -504,11 +517,11 @@ static void qemu_start_incoming_migration(const char *uri, bool has_channels, fd_start_incoming_migration(saddr->u.fd.str, errp); } #ifdef CONFIG_RDMA - } else if (channel->transport == MIGRATION_ADDRESS_TYPE_RDMA) { - rdma_start_incoming_migration(&channel->u.rdma, errp); -#endif - } else if (channel->transport == MIGRATION_ADDRESS_TYPE_EXEC) { - exec_start_incoming_migration(channel->u.exec.args, errp); + } else if (addr->transport == MIGRATION_ADDRESS_TYPE_RDMA) { + rdma_start_incoming_migration(&addr->u.rdma, errp); + #endif + } else if (addr->transport == MIGRATION_ADDRESS_TYPE_EXEC) { + exec_start_incoming_migration(addr->u.exec.args, errp); } else { error_setg(errp, "unknown migration protocol: %s", uri); } @@ -1708,7 +1721,8 @@ void qmp_migrate(const char *uri, bool has_channels, bool resume_requested; Error *local_err = NULL; MigrationState *s = migrate_get_current(); - g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1); + g_autoptr(MigrationChannel) channel = g_new0(MigrationChannel, 1); + g_autoptr(MigrationAddress) addr = g_new0(MigrationAddress, 1); /* * Having preliminary checks for uri and channel @@ -1718,14 +1732,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; + addr = 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(addr, errp)) { return; } @@ -1742,8 +1765,8 @@ void qmp_migrate(const char *uri, bool has_channels, } } - if (channel->transport == MIGRATION_ADDRESS_TYPE_SOCKET) { - SocketAddress *saddr = &channel->u.socket; + if (addr->transport == MIGRATION_ADDRESS_TYPE_SOCKET) { + SocketAddress *saddr = &addr->u.socket; if (saddr->type == SOCKET_ADDRESS_TYPE_INET || saddr->type == SOCKET_ADDRESS_TYPE_UNIX || saddr->type == SOCKET_ADDRESS_TYPE_VSOCK) { @@ -1752,11 +1775,11 @@ void qmp_migrate(const char *uri, bool has_channels, fd_start_outgoing_migration(s, saddr->u.fd.str, &local_err); } #ifdef CONFIG_RDMA - } else if (channel->transport == MIGRATION_ADDRESS_TYPE_RDMA) { - rdma_start_outgoing_migration(s, &channel->u.rdma, &local_err); + } else if (addr->transport == MIGRATION_ADDRESS_TYPE_RDMA) { + rdma_start_outgoing_migration(s, &addr->u.rdma, &local_err); #endif - } else if (channel->transport == MIGRATION_ADDRESS_TYPE_EXEC) { - exec_start_outgoing_migration(s, channel->u.exec.args, &local_err); + } else if (addr->transport == MIGRATION_ADDRESS_TYPE_EXEC) { + exec_start_outgoing_migration(s, addr->u.exec.args, &local_err); } else { if (!resume_requested) { 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 Mon Jul 10 12:27:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13306868 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 D62DEEB64D9 for ; Mon, 10 Jul 2023 12:30:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIq0G-0008P9-CC; Mon, 10 Jul 2023 08:28:32 -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 1qIq0C-0008Mh-92 for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:28 -0400 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIq0A-0000nw-LH for qemu-devel@nongnu.org; Mon, 10 Jul 2023 08:28:28 -0400 Received: from pps.filterd (m0127841.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36A6fhdO002035; Mon, 10 Jul 2023 05:28:25 -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=PZMOLbucO1Z63YRw1BrTgRFraVE6zRGEtvM8yL47G 6E=; b=xbsqlTMSEN7OWQ0kbobz0H7g3Q7UV71C50jAX80GaTbrMv0jTHyGKA150 SjOkDG2IH3A43uGuV2iDE5SMFXev2GVWFPdMLvLmKVdhwdolpqG0s3OUKVOxnOgJ VJevR3//zUQDPdRIz0sA2fTlCGFfJJO574vdFHUmayVaMYcJXsoZdIeoKTXtJZfm a6IhKBaqj4ijvLXCd3ZXmmBHTWAcNZw9TEb5aS7W4pyl41Gc9rXQqeY7YQuTH3QH rXFluG2E3WusRegwRnDDfMFvyCXpmPCOv88NOpI3X3q79WCpY1Bzvj14N1ojhQ/Q 52TMgY6VjyPKW7OoRxhyI3iQ7iO5w== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2106.outbound.protection.outlook.com [104.47.70.106]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3rq5b5b2tv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 05:28:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GPix4d/sDTy9u3uUVA22iq1uR6S+/wsjjwXWtDUFNFpAXV8ssDGFTJEYbPMVP9I05FHiw9ozrfAytzvq7qhd7Ydy13y4Cl8dOcysyYdb6uZESSjhbCvh6RvBb/L9T6iawd4aHdninCI1z8mfTx3zCxrEYvUwb9HftZKZkGa8X5GFd9N84SWxIgY6CQnW49k5OpwR1vFnvDtYvQ2IlkdWBNHljf9Lc+HokPqtxh3vhxF6tIreOnq5kBp2KFEMUtnEm6/2AWz1D4BYy3S6oaat+GYEXJdi1OgyaNPFRWiW2GGFPYtfhh1l+NpJpk+q3ilJnen/XAqzln8NDmXvGmSzMQ== 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=PZMOLbucO1Z63YRw1BrTgRFraVE6zRGEtvM8yL47G6E=; b=J3xYodHpa0vwOmRPAeT3CMWOpWnqk3cXNPwBxi8YTdcmQjN/KSVzofctEPwfyxejfvbxWMc9nmUjXSbbGIZjVwU9zjWvXRrPZ7TAcFy1vaYzGS8FAcCpqXhu1HdNTrJfI7kkFJtMNaxUmwaWd8dMhBvEehLR5ixa6JN3QvvzNggxUMSu/QM+j/OSRM5Elvx5tYXur7Hyr2vq6XhFjjXZlhCgWoIM6L6n6W9nZDUmfiScKwh9z+UWYM2lKpXAlJPbY/K+Inymhy8Jqpi4OBcC03JMYe4LPX2e9YkPiF0zHwfrJ9AgTgE9jdxzfIDVxlIpF8CS+oiNyNP0PU2aaIdEvA== 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=PZMOLbucO1Z63YRw1BrTgRFraVE6zRGEtvM8yL47G6E=; b=FSxGrrqQqNqFUMvyepIHn70IpVFPReXi02J96fygRJ8ouxuBFghV9T79+q47ynp0UKvrpMHU0IvoKtjmSboQW1kwPKN2WenFhTa25Wi1JFQ0sCTRPS7vE3r8E3IpSequ+Dh0sdIkcFgwusGYVg+LjlBsmevgnqbEEaCl/Yk5q47Q85SUajFRWeB70IyzgcoPiCpsXlKcukOtt8SZXsEv6QIwcR0sLmiVGCHirp3NFW27E/EZ/zPyVwf+rBBsM+mkWlumwYFqqjd6BrGR2RRvkrW60W9qLJN0+DWGCjoC3JVOszJAqIM/snmUrPxsPIAOpdIw188avWJMQ4U6lD84jw== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by CYYPR02MB9688.namprd02.prod.outlook.com (2603:10b6:930:c3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Mon, 10 Jul 2023 12:28:24 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::26a6:11ae:fb38:5920%7]) with mapi id 15.20.6588.017; Mon, 10 Jul 2023 12:28: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 v7 9/9] migration: adding test case for modified QAPI syntax Date: Mon, 10 Jul 2023 12:27:50 +0000 Message-Id: <20230710122750.69194-10-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230710122750.69194-1-het.gala@nutanix.com> References: <20230710122750.69194-1-het.gala@nutanix.com> X-ClientProxiedBy: PH8PR15CA0003.namprd15.prod.outlook.com (2603:10b6:510:2d2::25) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|CYYPR02MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: 3316cf9b-8e96-408e-676b-08db81412780 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: aJKbOk8lO/j+7Z2MFJHyRdrAKRWesE95pl+WHhDkqvcDIjJKeDr27t/elDb53smrtKwP/egXVlD+uAQHRJzdGk2BCwUgtGqA7VGsDHCHIRXgdmPPCk27oFhdYI1cxsBYULS2eJq12DNtTy6IrkrCofHoapgw0eed8bOgyb9UYntBRVy4ckgr9Je20LKtbZ4rJPN+7VItzTYObrJKrXw8fyCDGKoxtXLzSCJktKi/SqN1uAiMQXlmZzp1N0knw85Yio4OQFecMNgWtAVm5aYcjgqfCkKrSWUROOSsVbuhi+0Yge2z/xRmhkVgPQ1WMWEaWR0MWJT67CTE+b1h30wSe+wEIy6Rac7RvU94T4k5Zs1bTS6SxjIWJ0ubeZnAPgJvpFd7/sh0w18y68wJfjjM0x0RjiYdmhuEy16VJZha4AHZF3gl6COFUtCdzGAcsCKMYwm5hhqCpZ5unmmTc4wqX3OhOo5zuZVfSrh/nkXZEYmdzlE3xT5il+Fg+cQWmx3lvS9ATV5LKiGisw4srw4U9+x8mSjl9du+vBNgcVgyOJ7+H7E7dhDkmtmFp7jsVm0gZbvxvK4ESeVrY2cAn+V2w6YlPdne8904vsBJrz96SUROU5wKfZF11FfvTjt5LaU/ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(39860400002)(136003)(396003)(376002)(346002)(451199021)(66946007)(66476007)(4326008)(66556008)(6916009)(186003)(2616005)(86362001)(26005)(1076003)(6506007)(107886003)(38350700002)(38100700002)(478600001)(52116002)(6512007)(6666004)(6486002)(2906002)(41300700001)(36756003)(8936002)(44832011)(8676002)(5660300002)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7hSM7YRCT6zvEdFo6eJ2fsGWXECUmJFNWMvDtRvVvXpKlrCnY/pqVX4Rdg+HZPvjAUtjSjQR1MZQdvLXlyRFrwGD+X9PhxqUTzOBUkfRB8lxISrsjKC66gr+QGISVdEe0+LQcU/hCyEKUz6QhEtEv0GYfNd3rbHegDX9grwcPaQXkA4jEPe0r8QQ7ckPELqFmY1OvSyUW+lANl3D1FJqhhlF9hJ8NPFJRKUIGfMpEc90oJrBwDiaxff4sTlnIctNw7arA7ow6jWTbaxNR7haKbG4+JMDsUFc0uC8yosVv8Qu8MMH+twefGzszcOJ9NOoSgNEy+9JvmSaRUQBypX3Wq+LvJyfE1RO146nHSd6By1v5crtdQKBBqD+/zwfq8vLNyFGjnVGNzhj5Z9QvAjrbgDgIADvu7uL4O1NJE0tanmd+N+O/160CJGeG1991J1CporyD4T6ZBPCA/8VyD5WbenG+Wka3xlm6VB6B2E3DKJUC93iWDk7Y9y/lHqVgvOODqpN501LMhhRYNLUhmoBVQDtq0zS6dQlsGNhmugeq4amTRrrO2+swuWBhUv3QWfK/SHrV/Tqf25414/eSSJv3U34PC9Dmp38re8W6K5QhYWMiaFK02uq0yw8REWNg0aJtrTZlOSRNj2C/mbOIF1wOXEpTIC1xFV110cne2npda7p3xlp/2pfIWHGTLNyurfd6DfvBmMZBDi80i4bkJp2zfwqNddgo7d0kD5VB82Y2vRVcghjJLcLASAsiERu1zq+INlltNnqU9kp7j/1WgaKhjMirlwe0QfcYuaIwcjPStB+ly3vLCdzAEC3x7zv0VpbNWapfk+QkliAy9pruycU8e72mfjPz1q4hqq5mEn+Qd0iYyhrJhh+9QFGTLJCXAgsQICncvWfu/mPF4++f+S2Qaa/si+rETKUM+fEPhpqZKIvmliA30GMvsH0rWfXSYe3dWV7yV5Bi2A7mCDOmGNVNaOAzmrm19u/EgqJnxjVrCmaG9F2xqJESKgT/qmHaCPRenfHTeUKI3J4R7hHvnGG+q9lRdJZPgWa2XEkYHDiTJEGDfy1Jf0SdHYLYsj11LG5IIJp/xdml6+zvMPyi3MgIt/bPf+gWqBfVN5ZpJdC8M7AiEWnU+BAvEHXxhAhLxIjdJLlT0zjFtsUVh5X4gIyCtGdOj/3soHpeLdPOqFa5YDgiZeB5RsBWAC6NsutXqEnOGz6TdZLTRZ048IeJjRHeTrH7qIO763DR0h4JZNPinKpoEOOhb74Aswqto9NUmPh0I43+CjD1tDKG+5QUua0czKBKkRgUYb0/uRPNz/Pt90MuozyITFdOUW3hQ/HwqGvfhJcQk3XJ0n7ZpGuJQx7f3PC/7PprLdiOtbjIBB9H3eCztWYOKtUJC8KCj4nL9lV77fCr38qsO8PnRr+gQ8fhv7PUlRB1iJ7jGtLHpvaakNpdVr9BVUHLnfXCOOArs1tahpbqJD5gzwpMxrw1UUYJCywuTbFuc/aEnDjGdJH6KyuaHZremRpdsZscy5X0DKnF/8wXKBo6yC5jCcqaBglQCr2fZY0NFKnAsEKXHtHwxfzEs+HfzKeaHF5HkW+TIbRiSNa4C0AXgBpToYTCoEPRA== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3316cf9b-8e96-408e-676b-08db81412780 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 12:28:23.9858 (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: Aq86Ck47bXO4TODJ+LqdICbfzPzUNvJIBr4nR/AAUxleF4EWaqqVzIifyEgK9cswH8chLjEsT9ZT6IQEWIjNfw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR02MB9688 X-Proofpoint-ORIG-GUID: 4yhIp3RDY0ywZ2fGU-TePI8fQP0rjj4X X-Proofpoint-GUID: 4yhIp3RDY0ywZ2fGU-TePI8fQP0rjj4X X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-10_09,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Adding multifd tcp common test case for modified QAPI syntax defined. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- tests/qtest/migration-test.c | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index b9cc194100..5a876d67e0 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2086,6 +2086,32 @@ test_migrate_precopy_tcp_multifd_start_common(QTestState *from, return NULL; } +static void * +test_migrate_precopy_tcp_multifd_start_new_syntax_common(QTestState *from, + QTestState *to, + const char *method) +{ + migrate_set_parameter_int(from, "multifd-channels", 16); + migrate_set_parameter_int(to, "multifd-channels", 16); + + migrate_set_parameter_str(from, "multifd-compression", method); + migrate_set_parameter_str(to, "multifd-compression", method); + + migrate_set_capability(from, "multifd", true); + migrate_set_capability(to, "multifd", true); + + /* Start incoming migration from the 1st socket */ + qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," + " 'arguments': { " + " 'channels': [ { 'channeltype': 'main'," + " 'addr': { 'transport': 'socket'," + " 'type': 'inet'," + " 'host': '127.0.0.1'," + " 'port': '0' } } ] } }"); + + return NULL; +} + static void * test_migrate_precopy_tcp_multifd_start(QTestState *from, QTestState *to) @@ -2093,6 +2119,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) @@ -2124,6 +2158,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 = { @@ -2809,6 +2852,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.