From patchwork Thu Jul 13 10:57:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13311834 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 B22DAC001DC for ; Thu, 13 Jul 2023 10:58:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJu0y-0002TL-2W; Thu, 13 Jul 2023 06:57:40 -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 1qJu0o-0002T4-It for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:30 -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 1qJu0l-0003aB-6X for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:30 -0400 Received: from pps.filterd (m0127837.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36D4rtjn028091; Thu, 13 Jul 2023 03:57: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-type:content-transfer-encoding:mime-version; s= proofpoint20171006; bh=Kc7k29J7SSu5rkMtqGhCPJpuxRwa2osBLPOGNDHVE NM=; b=ZcZXylErv4okc7wnwHGclqgqFq5fDX2Re88C8lIvHD2m665XvcIdNEz+K AC8d6e+21hI5lMmUeYwZho7erFgoMZhAnIh7GxA2SSuXGt5C9bfjRoibGYhkBDE/ cImQuKDCZTDGgbnKEP+C3az3OtF9m/A/IyeEDBDzqJz2/ijODrL4+H8mCWblyP4S chFJtdz0LoFxoRcdAGb+46gIdS7S5PzNNlwK242dm44AGcgRTswO6Jj1tuXdPx2r J1zsOEORXZ/HPnrLYasqRsK/R9lORH4XCnCB1cCSd6kfjHTlh6RjLIclW/e1y/ed C5WI23EsHQlFA6t8ldpUlfFVton0Q== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2174.outbound.protection.outlook.com [104.47.55.174]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3rsyb41s42-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jul 2023 03:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aL0jXc8/U5puFAcu4qgQl3AxpJLNmbnEZT7chOIi1LyvOLDDyENh0nAq5c3C+EXX5xX3rZoKhclzFVttJtqe9/HF5DnnFg+EFhGJk31BD8dYm9VQjUcHFz3MvVn+w769LstvCDMwXAQsL1OvSlz9LcKSQlxZFkNAibw3nHR4dvoZhSMreQZNkwh+332AKFoNr8t5Fy5dew8EGmztnp6YJn81yLer8NFyUhr9gxC/vLd4oLKn8XRdEbfwH0RSBhr2bAoqpkLSdzG1ZLViKIX1LgQO8wMeJyX/wNjP6i3UwkV+mAMlbuls8OiKneU8nOGJbVt51wXswpyiT2k05MbN6g== 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=Kc7k29J7SSu5rkMtqGhCPJpuxRwa2osBLPOGNDHVENM=; b=F1vGKKVXz90WudszIQs3Ta74mfg5GuUWD+uQvUfhm6BIZYk6bbkpvWfyOrJEW1NplzwsnJyxhJ0gUWOmTaqm6XMTCwIa7Ub6VdCuJByZJPqe1CtuwVQdrBjFk0GqeHDio3noJiu/UO//ws/wWDyVqm447Tu2gvo4qZ310t8vVqEvXKL2D5gkdAxvxgd4aI26BZ/rve6ONE9zA1V8k9XxnwT1QP+eyF+/udL+AQQPLCwY05Fm/BQb88sCU1lvN+AF2zz0RCp62zroAST+5ijGMhw00AJVH9USorgR+KUJcC+9cL8ao3YiVFTqkJxrk/E/I/ZK3KYhwMH2XLiFJf+LcA== 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=Kc7k29J7SSu5rkMtqGhCPJpuxRwa2osBLPOGNDHVENM=; b=yMTEcrhryTQgSZ9oESLc5hEfHxintL29oIO6abV01BwE+e1rnX86EcWneJhXQKhuNotar0vMxLe0a/8uERioqVCediWPFMeEDUSPmpg+bWKzni3aMsgfpUY4MRDSvuClQ76+BVqBcU4dCs5GZVd6UJANGd4nXJRmkdeS4E/Kgcj3GQfIUc4U7QI5jqGHk9gmpm8mGtO74zgDweK4LmE3fi/b4bdQBVpzAcmTy9yvkpuRXBC6KGFTzlRV5SSzVkoBDQP8snRWI63thYgEBe5UYx+NDEOeMIRi0DBCDHARC9bVOTP4LUXZkIwDWO6hF+rRIFCPT+60Cz7tPDMMizawrA== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by CH0PR02MB7946.namprd02.prod.outlook.com (2603:10b6:610:103::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.24; Thu, 13 Jul 2023 10:57: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.024; Thu, 13 Jul 2023 10:57: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 v8 1/9] migration: New QAPI type 'MigrateAddress' Date: Thu, 13 Jul 2023 10:57:05 +0000 Message-Id: <20230713105713.236883-2-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230713105713.236883-1-het.gala@nutanix.com> References: <20230713105713.236883-1-het.gala@nutanix.com> X-ClientProxiedBy: PH0P220CA0014.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:d3::28) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|CH0PR02MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: a22388c8-6367-4a3b-0997-08db838fee16 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: WoOItqmdLvXHdUX5j1oIbutw5kgMJu3yesJBoiKo9ChvV3IC9u2XcuaCp6EHGs11+Rw791JQ33dHYyh1JVfwidJrCNffV6JOICBi7uCKH9yMxwnbx2fsPfTHZ96j6xcC4KVKaEmZtNITBarNsyfzsNwv8CCdKmLazI7GD74OjLX9xgKEUqPo+/0GeRkH9gHkYNZT7KKzcCVcrW3LaNEYd3Jp+EndKZJvmDM5BCA8cmLLWGm9nOoiUG37lrb3wVZ8hRwgHIUgIwrlkOPJdVgm13GPYqTgCDKu9jobt0RrkXUJxyKj2lBDlj4a0f46wfeWqJXoov+NL+XAbIoit8Rd+l+2opW6qY2UvUzELdeosIrZFmC2flhaH6JTvLKdLYbdPmWHDxZGyUaa9e+MEO5V5paZEboV8uu+f33zru+AitZNU2hr6DRgPjODFL2NB3MdMoJrCcw3nLiXfvqCXQj6busa/NBCW9eQEg2iMifWzVBGEj8IUOD+zq6H1lfE1T3q6FDQfnGC9EAi5mYH2PA+Iv816kwT7fDIuiFu/JwT+81Ww/vRPJXHFh8H9TOuvIvhimPNo+NQLgF1szxaEUwwObmG7uXA3/LsCzf9ZPBh2xbPxdiYGrTrDS9dSUvpe/kU X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(376002)(39860400002)(396003)(136003)(366004)(451199021)(44832011)(5660300002)(8936002)(66556008)(8676002)(4326008)(41300700001)(316002)(66476007)(2906002)(6916009)(66946007)(6666004)(6486002)(6512007)(52116002)(1076003)(6506007)(26005)(186003)(66899021)(107886003)(2616005)(36756003)(86362001)(38350700002)(38100700002)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?SKUt8iEtL7PTCjUVN5w0AIhHsNzk?= =?utf-8?q?arj6zzc2kv3T9YmfKXWXs5E5O6PgB9xO1K7KKOco+HmAiEO03Y8+OYohUTelj7uqD?= =?utf-8?q?CM7krSLhHFXLfN+jEw7xP5IF0C6fgZZj5m5bx7BwI6zPN7MXCnh5NhiREBY2cz2MO?= =?utf-8?q?rLChnonfgGRAYW7elFSlEJaxf6lVSutACosy7a8CrsYV7RcTyOTwKMaxntGO2k5e3?= =?utf-8?q?nJkzLYFlsvf6tceoOlWOMpH++BleuWWPM79IyQuCnJHg6MMCgpubfpvgFgosOLeet?= =?utf-8?q?/D3b4p4+UtgwFAGU82ZQWEpj0H+117WAAWGweTP6oS22R9+SipMcS9el8pOtDul0o?= =?utf-8?q?0lmo9okwCmLxJS2btK7qPFnN6nlc3JWCFVjsUq8KZ6xfHU8CvSJrVRmFjsXN4qbgy?= =?utf-8?q?a9ts2HcXuFRrKiSrEVk47Yp1lmAhbJonC7IXHtx6VfkvaGe1WWflNVqBpwjwXVhd+?= =?utf-8?q?xHZyv54YW7+YDFnOTjRztTyCBeGeXe8oSeLi7kDZitRg3BumwJdIfVE8SWcOsTc9j?= =?utf-8?q?OUy0P0PSY/ikhAoxVGwUOR9VfWsqloJk+vaqhXsqj5MWa2KxNBbQRZ7fYhX1KBQ29?= =?utf-8?q?Tb7sscqevjT3oZarp5s82lWhremORe3y7/pBlfHDxNTqSDcF3hVWRGRNtj41yEBHF?= =?utf-8?q?t/HqVpUNziWIXSEXpRBAmkZRiOeZYnP+semExzNbiw1+67hrHQjp7bHPMTuK6LeNE?= =?utf-8?q?kzXPLqlG65SrJyU46phZ9RaqwEY29WZXLNhbLcpN9UrT+qgSWkMK2I95PKFVdaeCl?= =?utf-8?q?/ORiI7HeXfVPKT+6kAZtQldw0t5y8lISeBcH72ODRB/sSTQB4KRq6LyIs9wSeDLG5?= =?utf-8?q?eO4rUHsRRwSdpG3HeggrUrJJAPWEg3atSPGezNcjijwmmiDggmdcHyrkVAsWKi3kd?= =?utf-8?q?XPf2nT59IOwOLV4YuD0JuCr6eJBuYYFXOBwD6k8TxQ3UIxjcsctBX6KwDeQfQpmT4?= =?utf-8?q?PtOgVdkja1mAVUZRLkZ4UfTXcEKXySuvKGby0ASiTgH1GbwzrRZNbBdxD2bQpvQ2/?= =?utf-8?q?BNEnOsXx4BVhr+2WTDcUwxmU05ncv0VYAxlzFjOtjZ2pMapBnJRNHl/z381J4Nzu1?= =?utf-8?q?ExxXiq0NYQdYoaO6t+/7w5tdDtTd0di2paoVFVLQbC68Ls1AN8S6g88fSSp1dIEvw?= =?utf-8?q?WpAZQ+71ZR0uic/cSHy7uOWUreUpK8LDf6JBXjrIGRWffope9mJM2D05ekdvccFPW?= =?utf-8?q?hKAQMqtIlkINXWgnJ6EJtwifCUV3tYAVsbymH3fJOen7T/dRllCk4pmVtQebuob77?= =?utf-8?q?l6pEwTZe5Loz6eXN1gvc4IbhUhJ1/IBPbMfkBMqbM3vP+V+eFYfwfKtt9GgWxitLV?= =?utf-8?q?uG3jV/qhCKS/euvlkcYuLvZELBlyLCF8V22Y+EaYAW5pFxMUKOyWZmgCw+tbT5TF5?= =?utf-8?q?DPdy8lZMbNUFjInwI0doNAgBv4ZnQcDeKIrBpgC67isvgJN67xz8R/necRCPkfhiq?= =?utf-8?q?oHggesbGn8i4V9SXc1APpd1u6JyZqNcQf2N+XhZ87IWaIZ82Bgbp1PjuqU+/lotXU?= =?utf-8?q?CKmkI1kQIvV6?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: a22388c8-6367-4a3b-0997-08db838fee16 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2023 10:57:20.2773 (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: CrNB6UEXtG4UqshfxVzUoNnEpEFDozrdonUagpebwbx2+a6Ct3tAp3L4kyesPGyEI4eAr3A/PJxX6c8+lAuVhA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR02MB7946 X-Proofpoint-ORIG-GUID: M6wYZ8CnXIfkAe6MqYptAZojSKaWgOrT X-Proofpoint-GUID: M6wYZ8CnXIfkAe6MqYptAZojSKaWgOrT 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-13_04,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This patch introduces well defined MigrateAddress struct and its related child objects. The existing argument of 'migrate' and 'migrate-incoming' QAPI - 'uri' is of type string. The current implementation follows double encoding scheme for fetching migration parameters like '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. Note: this commit only adds the type, and actual uses comes in later commits. 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 Thu Jul 13 10:57:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13311833 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 AEA89C0015E for ; Thu, 13 Jul 2023 10:58:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJu1B-0002WO-1B; Thu, 13 Jul 2023 06:57:53 -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 1qJu0s-0002TI-2j for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:39 -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 1qJu0l-0003aS-TW for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:30 -0400 Received: from pps.filterd (m0127839.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36D4rFZ9023249; Thu, 13 Jul 2023 03:57: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=vQMgQPExDq68RDt/jOd1usP0Vvzl8hMoEBNkVFMbI O0=; b=tqExd2sCnIzG5xRTDEeh04nQ9K6/9SmZq7nJgp0BxNjr04VRfQl9FpG1g VEKYGy5j0CsCUalGrovhFnDZ9d5ERVPT4BGM+3rrs1QqHASvSYYyfF8SNfSTGR3G PhVx/Zc8XbpIQaH6j0KWCgreIVilkMkx0lU3E9nCDuPeZno048XlIRTs8yWIJnpl dpVuYqnrW6h9oROdxwKnPqz821H/7JRt2heuOz1yqZvtdYr0TswTTBJrX6tXUKTz vipoT75IxXKym3VldNGf3k+rIEyBLOZXqzxVIiJaEO+nDEfesdhDraW1yi6OZMKP 8SAi1DU/GX2DZQUEHexAbC/eZhdZw== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3rsyb3srsf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jul 2023 03:57:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i4L0F9k2iDa1hrcwA45x/kJeVV6AHPgCwLJ5pDvaEQBjS9cEHjYMcwEulfRm23yik7eVLppyq4FL8yc3T9tgJLwrR5Rf0vaQjSjxAAWSrBdyVz95h/05nRQAI5v8OCywzxgZkrE8n5T4HVtWplIKe1ANH9J5K3nbKQv11Ww7k6ZrjRxX7QsceWdAduWCwdyferlx+jS4yTJ5TDjIBAtH9avrHYtaPJrK9rgTfWjjJGPEvTmwnHZ0h68TUEGapKhKZe6VjPhCuJBv48pnKtzfxXTaFT79MWHkQ8R8tl4kUvBOVMZuVP/gnSrfjmEhL2vE2O6aIxHbntKK3P1ZMIH4pw== 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=vQMgQPExDq68RDt/jOd1usP0Vvzl8hMoEBNkVFMbIO0=; b=KgT5JkHq6uwMIcb2+/IINOwLJbO8757azki6xfCc5rliqPC/B7HuRdi68JSeRhPqMumtZakEv30Mdohgp2H/vKd7Sg0NIxV0RYzt2ZvmtRwBTrrxcxEJpEzOJk3SDHfGX2c4GAFPfcLhihtYbw4qHe+vn2IdK/GsmRTeWY/ZuYJRKmfM3+ZULocmWBKT9WINT4NeIgwtRA2gBkqmAh6OAlmRRTQtgU9BN3oi9v7BPYDTqnSv8vbRw50gRDE+uEkS0A5JtrMukZ6VxHP1J9bLzrhR2VTI6hhdBmOS4FticoP47/48ikQOrYjFU9ponK+zCMXcS3kNQ2ryQzhTLL2t0g== 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=vQMgQPExDq68RDt/jOd1usP0Vvzl8hMoEBNkVFMbIO0=; b=doct2xPnavbXIFxoO5pH2ztiKSd//qSQWkll8iVNW1B9HJrbs9Did+h22mICUEdtT/sY979H2Hpge9mcsTLDOQvOZYfHpUw5SywTHVu/TV1z0hXkGDWtjzA3hKMw6sp/djIT+geYQqHiL3geU6Ptj9LoTF6WO5rJmv1CE27IgpkWXcsjrUA1VkvuWtV3f6r20ClqquKzfrtHwx3rqcC0htTdCGTn/lQNuoj/rJzsOz8GpJ+LN3/kQZZO1zzBe7UaxsJbJ/CV7jz549x3ntjmgI3/v7HGJ+8H6DzybcEhmcLdry8bmgSZtadJa1AGH1S4uQulCIcKW092fwQXoTG21g== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by CH0PR02MB7946.namprd02.prod.outlook.com (2603:10b6:610:103::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.24; Thu, 13 Jul 2023 10:57: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.024; Thu, 13 Jul 2023 10:57: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 v8 2/9] migration: convert migration 'uri' into 'MigrateAddress' Date: Thu, 13 Jul 2023 10:57:06 +0000 Message-Id: <20230713105713.236883-3-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230713105713.236883-1-het.gala@nutanix.com> References: <20230713105713.236883-1-het.gala@nutanix.com> X-ClientProxiedBy: PH0P220CA0014.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:d3::28) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|CH0PR02MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d2336cc-ff80-452d-e50f-08db838fef19 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: eZjeD5GJ63athOT182GNdvPNaC1+Jb4aEQDGlIGgQFWzBHJ9C7A89qbYPFa629K5N7p54jjokIo5DpbIBnue2+/8N1WdgqZb1HyfaJSyED44adFWAXb0e9114QVYbMLY9+/QjFVZvl/HM/IBacafJQrRQ+VPKr+l7qmBr6V0ZHiQTXDPJIxvuS/1bLOZB+Uej56IReBrZ+luBNtZs1EFlZHw+WtluBRcuEv0D87p1u2HmocANErgMn6Typb29U62Ol3I8/y9udxOY3bKKHG3qCsCkJlTP1ih1pFlgvVtHDfbTwyCGR8r0HTHW5bwF2SUQvKbQc4KzNubQCpDbZbsBVxWm3WHe5jEX3YEpvYpIodA6gbiDdscgigc4Ok5ZyG9X5Ae7S9KChZoKUG9iWYbZE1B/wOnNBniUNSH+EsRGvDEI2s4xeHB9Hnp6KBJBezrJIlgrYi54BRjXZRpe5YXVMykqf3Smv2pCjOxYS6/xMp31ZJ4twZOr6pT50eDpqXZl8XSdPnMjgEfXpINZT3fjxGfdLMK0w3/3dZpWygjFUAV1vsx9mXi0TiJ8v4UI9MNSABQT7lKwv1yQI+i9htlqWL9cEO+HzHJ5GPiSmF7OaXLvGikvJEMmaAYNffmddyu X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(376002)(39860400002)(396003)(136003)(366004)(451199021)(44832011)(5660300002)(8936002)(66556008)(8676002)(4326008)(41300700001)(316002)(66476007)(2906002)(6916009)(66946007)(6666004)(6486002)(6512007)(52116002)(1076003)(6506007)(26005)(186003)(107886003)(83380400001)(2616005)(36756003)(86362001)(38350700002)(38100700002)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sTUR1iT+7qAy3Er34S//t1o0s+hgwRh/0gEjlvqyoWUG3IkMHcwL8nzu5YRDi+SKqSAp9ExwwVzw1hAhmOKeROabmSb/B8hpDqa5M+SgQmmaDBeuwIvDwv4XNmTxutZZShwsuD7KG/ck5pNf/cFbwWZQNGkNJGZtEY2zDs2RBVfwcPCa8Z4t5b6EEMan9wnO0cvX6VgyYY05410ycr4F4Hx6xgaY4orzSNxT3U3MJgbk6CSewkIErGyqq+Y9770MxfWh1OX50FHrPswG8IZMBhxuWfGS2V7u0egF6yz19eext9bFhx0/HjD06Zm11IxtLlDa1lusd/1NFRjvmsOJr1GCKqykoiIrFc9jynuC4Xi5gqE7BKFEkjSXCq0jXml28kw36jQJRmsrQ6vB3H9qO8nnk9kh9EVGpHEFumiBRQ459/3cKE4gR63EeE+Yzo4QyshblqJh4x4W+0KUwY3VripkZyv5YhYqt9sPea0LTxrO2cYiLkYH7szqGBiFMYE1sOmCbFxibdWeCyS4XzmfqDLKurJlALvdiMxX/4BC2pQgKfptBSt2gZMuDn6OHRk4Rv09+tez4zltkaUgwYZbyyupxFaiAa063Tt7HZq8LKizwsYL5VwzLy9YUUeS4Nh7NeL7Urskb6b0/N7TXLpGvaeHITEKTJuG/eJjIV3bELZ1+8A76U1jB2gM+S98G8yp4vtahp5k0+uRG/x7P1pg5SIwSIKUI6X0gEY1Swl7vmJRG72ctE/w61+NFFDX2oEQu4Nz7pkest/8LorRM75VE88XVgrtoOt6vyxP/cYBWT9hESp4DXvrZPL81MQUFc5Q/DHMhRs95iUEHzuOh1EgGOdQDhzfyo+JcpSu61nvOhv0h2B2UaYG/QhyFLnCOaOjMEP+cqelLNR16+0esO9bRICOkgW8a58mu8zC917iyH3p4vrYNgaooCZYh9puN2u7NqdFzUAivTKJige6juKNwYzW/lzFFlQG6CgkmnvnOmfOZ7M2vpShXlbVF5fIkQZcPTWUvakKXX91i/yBpCzG7269rlzbB670R1YCVt/fyv7DUs4c4beoEilcwxsOaCpEiuTSXJDpdUcDvjc1CgvZppvw77TELysoUkO/vfgpXoKNMl2aCLHGLyPCVZWo75u8FjZoY+yxerbbSZA1Nzpd0c8hNRS/ZL3nLD8lb1lWrzCLxfNaSlaosM4uVTEVfHu/VK1W6G19IcSv1mPMq/mLQRBaL+mAHtD3wccydA3YqupwSXzR/2M2h5GFjnp3G+/xzES24OESIGFkXbm3S8SlTb3A3eeFgJ1IePNVNUHSyfoZBjZkrlUFN6LCC7jjm3wcQ4ntv0LwAJuEZXihngRXawsZtUi9cM37ZbMSU3rwyNk9WpqTxw1aL4uyT1bMRgjAPXntOW0hC+7Evhfk6TNhRDXsFb/oWBKRzzkzrSYMJsyu5pNKibQWtXP9B1Q1LL23bVt/89jhhkJLnOQDz+7flil1xqRmFKJkbyuNlzidVUERDmUDeeffj/YYS0OMu15De9HOqGigUaCZg8jEZpm/8J3T5pXceh8xP66vPtb0v8HxTWOfNY6TiZ3tnj2QcXzVWZQuxPjg1qh1fhhYs+3p1Q== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d2336cc-ff80-452d-e50f-08db838fef19 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2023 10:57:21.9788 (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: VMRhfWrUva+mYL353AkIVy+iKzbySDN72OYGRrbuxRj5njpOQ89DSlyZHf7eO49HQ+UweBUVH/QL2VoB5StloQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR02MB7946 X-Proofpoint-ORIG-GUID: u0UJAatogagt_VWyeoGxzKNvot6elMeQ X-Proofpoint-GUID: u0UJAatogagt_VWyeoGxzKNvot6elMeQ 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-13_04,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This patch parses 'migrate' and 'migrate-incoming' QAPI's 'uri' string containing migration connection related information and stores them inside well defined 'MigrateAddress' struct. Misc: limit line width in exec.c to 80 char 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 Thu Jul 13 10:57:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13311839 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 B7D8CEB64DD for ; Thu, 13 Jul 2023 10:59:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJu1A-0002Vv-Fw; Thu, 13 Jul 2023 06:57:52 -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 1qJu0t-0002TO-8B for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:39 -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 1qJu0m-0003ac-0a for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:31 -0400 Received: from pps.filterd (m0127840.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36D4xf1v007647; Thu, 13 Jul 2023 03:57: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=EeDi+b0ZZWKX5mKEfvo36KjkLu9vTDbr6zhVX4Ev9 yI=; b=jutiz/d6VKTDqDhS1gHSW0nYUFIiRl+jUP6urjUaIRrj3C4//as4utNXO sTEzaDlCGtx6DVyrCvfBnsLX0yX1hK71Px4ETKn40HmDQ+iDwd9Xdvsa4y/b6i0V T1CCrkbO49KRo7bqq8uHNY1wvNA8zbJblOOBkkTiAHM/yQtwDQoeJXZOJ5lCgGeQ SryRhWjp2S0TpYnY8xTUSaqpRqrjsFCHcmzYFRW3cwLFQIwRmp7Nml/4AIOK4Pmg it4uFuTzayZbGXkcLLhKvzsQuWwWt52lYqUxftHmoOB9StETiE2F46XbLFW7OAr3 fmqzKKLqyEvpiIibCa7q2dl1z9W4A== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3rsyb3hrmb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jul 2023 03:57:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=auCll1b4he8TbukuQQTfPpHqeUvskJ47AuHgt7wVuDzr6VsewobwZJGHre55AiAvkgaz9W0iL6RKYU0jGfFdmLEITW7+tDRiBy3veVCLbbvL1RmqJs0JmSWIXyf2nFJEpdDEuvjKe5vo4COeDYaqZIQCTmlqyLeBwkQUyZ044qALgPNr2QyXvvTPagJOoKQr4KjLFaoUymLErMMcq9Kr3XpTK9HMexf7woWJjHks8TZFlGHsR4B9eJZWfyRfztneM00ao118Oq1McAs+/ENrzUfsYHofcfF3KnXCnG4c+0gVrjTKaii21Itmk7ofZDndXonkTCik11fHvuqq79JCvw== 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=OcJhCpngH64LU8k/80/I6poe0+7CFJ0biZOO31qBVscgcUeUYrVJTzx71lQuruJR6m9t8IE2ZEjzkSqfXsDI7qjdQjuSCgd/R0eQvRoJS+s+9mme1hcKDu+xRz+DdadEOrBLQnEDdsFWmMMu6CiS99FFDhIR6nFIpVph3B1a0mSJzgmVCAD8M8iXc4Eb2CXXaj+8EwMAsTdi15u1lZYFI74kghtijKo3fj1GfZVufR+K+fYOo0KDg4tNejyswUohO6Jg8IGqt0C+fJYRpbRkMe6jwIj5E8xJ2R9g+OR/m/8/OzPmTYObOHo8lcakNqJzh+4nNCaF1QxNhBFrEV+39w== 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=Fad0np6sabRn94Vm+07OCrBdKTQ+ZE2EzHUyJfMRaAY3HreUvDlfH/QUN6wlb6mmu9qS4SovQ8Mx0a5H9GCdV8I/HrE10Uj+223wFc1uSldil1ExqO69xIKu7LA6EbvNhFL8qZE15SR3z2JoAZo16/vJYa0j1inPyWBZ/BoqxPWbvyoYbwaDCvxbaOtZfQAN6y7SGEmPAdkYMcJuoTSfoNUFOlsOheCq0DIpfzu+jjTR5WSIPCoI8YDU1ZguJeZCGSaqRnMix7nGjccW7WlB9/TUI6vQpDMHGGUYh1wf9mwX+2ybORDUvrY4IdpoifYmKJDXfm7d6mDZEe231RJNSg== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by CH0PR02MB7946.namprd02.prod.outlook.com (2603:10b6:610:103::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.24; Thu, 13 Jul 2023 10:57:23 +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.024; Thu, 13 Jul 2023 10:57:23 +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 v8 3/9] migration: convert socket backend to accept MigrateAddress Date: Thu, 13 Jul 2023 10:57:07 +0000 Message-Id: <20230713105713.236883-4-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230713105713.236883-1-het.gala@nutanix.com> References: <20230713105713.236883-1-het.gala@nutanix.com> X-ClientProxiedBy: PH0P220CA0014.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:d3::28) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|CH0PR02MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: 271de12f-9b21-4b87-4bd4-08db838ff008 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: W5ZRxE1oLMMW/zojVNRuET/Um4zKu5GKkDm3K1teAmwjvELuJpx96XYhRtBxbwhLkpN2ffGK6uzBRdXJpYFK5ogG+MNY2zb/43cQzvq2jlM/166hdGgsgOSxtcbS7zB0kZ0Oa4klFechGXrzzDU6PTIbrjSaPTmOlbQXGV9ar56mqQWzTztADsQ8hZBN/YIZeieUEZP1KPO4y7CrLDQC/QNxJLA0LaucFtaJ7XgySJx1gKU+iMGMUJ9cYIFxiw16l8/H/Ijb23NgVxjGO+wJU5QOYYp6Jg7IF3P5ZdSfQTrwcCmriadEEqIWV3KV9MouJ5J99H9yNJpscsOEcULVT8xBKE+dZdIXizT1c08J9z7MVMJ1do0wuYamS942mnSw2toyDGT5Us96lEBvWdNiP/kIAd5y1HeLPTPnejyvtISxQnlGRkLXKwMXRBVf9P+j53AL+CI2gjne4RKra2i3xeTjQzxGWhl1A8nb+G5WvjVFDV3c+ppWciGMkbQZGUfc/FDJlbSEZXj1JAy8C01nPsZbiqZpR1cTJYCIJTwm20wy+ll4/3rzErAHuD30fUtXfIcjthv91ycoXNX4N4SnFRw5FEgB2UuR2VjQW5xGmZUlF8DQmZOkD0oJkFrpgaEm X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(376002)(39860400002)(396003)(136003)(366004)(451199021)(44832011)(5660300002)(8936002)(66556008)(8676002)(4326008)(41300700001)(316002)(66476007)(2906002)(6916009)(66946007)(6666004)(6486002)(6512007)(52116002)(1076003)(6506007)(26005)(186003)(107886003)(83380400001)(2616005)(36756003)(86362001)(38350700002)(38100700002)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZiQSGfYaz8gNMkcx1YpUtSNR+v+CdY8xhj2wgxg6WFd+EluLlSe2UndFctndpg+itj/zs9+CkxWoaEpmcTJk0h0LBIh6UbDJWyrd3WTAc8PzGpapR6T5pAskiXg/uBuoX8SSTfySE9Hsj6Uv3WrUtL5FOQm9v2cZjvo5cP9yAQX1NbCwgNmWwevGVhIj8NTakGx2l5/hgD3Cizl5Ij5ebkNCEyeudU+W6FirP4i3Q9up6CRvDbIQ/8JQfs2xZl7/7cwzNDrYeLykMq4CiqZVb3wRvM1sX6qVydCezKYas0Jm3ztyv9DVLAwYCbaH2DuKb7v2eKVW4sBqd9vmYKHf0jV1dKFcc+JGRHbwAFu1bHdVd1BzHOlgjSkdo4QIFdLTA2jbCnPQw26H9syOga4V1G+oprjeIidt6Kf59/qtD4lavsokDoduhhPn19ayvA+M3t7qrcO9RFOkt08mUDMfWSgfdMJ81aL65uqe8k3kx8/37FNj6RSBf+pFf5pAIBR1GKaT1i1mZZSc8dZ3eLMfSRZoeznA6P4D71O1MHStrMWi3vGkaYUdStyypcGGuKtfBjKKeurIi0Eaaxs5m3R5gK8y2mvdYI40PCjL7koin/phSIg42Lgvwa46aoIwwl8Ne/Y9gZNnnAVxxzpdzdQkK2dqfUvRGAr877FoNSGLL+NoTHvT6uy822YC4TdKHUDTN6fDYog+mf/eZXokLh3jJUv4sL5TWLIdXnCoXRYhK86a21zSczrgYSN7rFxGkcXrIhmCzEty8yn7IQiOtTArvF3NLE38n57TqK4yNUzQ2+MTYB0mdzQum50DR2S3f7KYrs44yCGxRMyh01X5rV32MiCeL4nHHOb2fNkf9FpiVzWLr+EYeT/7Rw1VQUeHB0rIeI5EJOrd7DedeWONyWZcKpwf+nkERYGoOUkTEIcdbhr/6ly19P9hIyS4p0uvI2kbAoOp4ddfr217lw2UxDmIj+6/2KZms4/IQa8G+2/owPbddHyDWW+HouYOWEnGlDyvsAFI2Ki8JJL2jXQJq1kocY1pvv+trnah3mXaDpl2OIpEtrJyFMkq1BQrsJqFoE9k6ub3rTBq4ygjXkvjQ5zHjhkqZruz4fOsjiyy4g29cxYFSSs05D3Nl+Jc390VfK/hDkUZxpWq7s3kQeUVI5BIYFbibUiolAIo3k+Xvmleorr8X1nKZ64i7hfHRJ9Mn4jaSfnkD4TBqGe59G3PkmgZyITRpc+RInASmKvcRd8ZAhQ2mUZSWw7pMONaKX5zkNMk6AyDJenLxl93PXkW9L3v8tjr5GcRUVkpJAPP59Gy0wB1KU95iNgAjGur5TYaKb8+pbgQhY+u+uJRnXLF+cCT7JjAdp9GfDsgDq+CLARcd2Lt1LWsmX7oqX6sm0wR7HjulNF4/PjFU8CQs+Il42Kq4TCB7MibEINHG7Ug+A21DzJGVp10vx1MybWWpY58EYrukCPq9d13+bpL7Nzo3NRRnhl4wIEnTxL0jDF1KIkPoFK6O0we0dVKmn9Lp6pi7RXjq9zF/RtcZLf97KqWKRLRayoB8VpuCoq9JZdOFKAgP1Ae6fku+8iMxkRFzEIGetXSKcY891eK+dIR4ZqYGGzuVQ== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 271de12f-9b21-4b87-4bd4-08db838ff008 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2023 10:57:23.5646 (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: mxLqMcPcj8bUy3WUN7U9kuYOiBGl0GB+BeYlaW5gnF18ymi5Y6Gpp5IHXgZ85BLI8RzehFlV4cxGikSvyP1ERA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR02MB7946 X-Proofpoint-GUID: gSxbnfd3Tkqvv-MziHYx-rsfOgf3ewSg X-Proofpoint-ORIG-GUID: gSxbnfd3Tkqvv-MziHYx-rsfOgf3ewSg 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-13_04,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 Thu Jul 13 10:57:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13311836 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 7E57FC001DC for ; Thu, 13 Jul 2023 10:59:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJu12-0002Uj-Ox; Thu, 13 Jul 2023 06:57:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qJu0t-0002TW-9i for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:39 -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 1qJu0n-0003b2-R6 for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:31 -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 36DAkHNw017603; Thu, 13 Jul 2023 03:57:27 -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=hk24Yz1BK/Q9dKdjcqsPnFsbAmD69vRbkisIKSpLGZf2mFtV8bJ5qWypz 0SYGw0+zPIepAOJw9UZYuUYelJrbC6CHO8Wh+0Aeg2QXu2nwLsELsuABKd4SPBuG 6W4fHvn0NhU/BPA8gUtW20owLY18NpkNyfres2CI9b20eB6C6muj05C0eOiCECLI rtDGv7cnq+fQzAvUyI1sko97wrOp+EyiE7LtlgZ6gVYp3UtyQoInTTgOrEHGv+YB qt2xRvllTfUOj7Jv0Aa1bcL1jolG55o22lme/Ux8ntzrtEfW2ifj32xAtlZ8SHFd TpvXZa2WRcxd4cWwx8Hy/QHaUKcfA== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2172.outbound.protection.outlook.com [104.47.55.172]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3rsyb3hrjg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jul 2023 03:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BZqJbT83VNncb5fejAaIsTFqG0D57vOhiFOgz2zxZHA7zDcfX0Eute74tzopnPv2IpJwUUCe0guBkMB7TSUqtOG3MJdPU/9i2cVwj1FRwThv2VoLoOaYpr+AmBiG9Gju9AIiAPPKv9bYRVQH2bqNBxNTrp/PuGcrxXlVUSRr2kyj0In9eNHtUVs7tyDsiwFVyIFJSnkvIPXW7islsaQBiEvFBzDcuV36n911Xy7T/W2A6WXesSY/SEbmfPI2eEJ0RELwE0rb5WiASWaOAAmPKiP3kPKlFxiCk4Sg5ude51NgR9lyeLbM78JcrXa/5S9f7wKok7PJCSKV8dWuXrCTAA== 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=P4pxbRsLOPVdYgjj6NfFIQSyE2jOyh/BlyDMO1FNNrrP/xrAjQHadngBXhi/LkG16vUoYiZVicuUTfFpamfoY7PjregKMnchGC6jiZUA9JCirnRBgEghiZcaV6m+HssVKuh0FMvx2BAKqjGHQ+x2XP393gdvBi3P450DjS2mKe9E+5/gu5pDWY6QuNsXCx83p8R7S3JbTuVzSOFgnToJEnR5/rfDz60EgsK6zDE9fKR2+z3BidYYHaZT2iAv7mnS/ZF5lMu7aJGZ+581WZfQP5ynnZ+JqCFmLxsxUhxN8lGgYLy4kLuw17oY7Pc5GNJVsO6bunHJ6/zR92fs3jlUwg== 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=X79WyeYOHRXG4xVcRWFUemOWNkzE8G/NZNh3xtwYbMQeCaZhTTFTAPHh2YyEcHxtZvKNHQqXM5ajDe3PFLJQjAlwICQ12CbTJ56qBixpn8SwtdSe17NYVg6dyEaFYlvlFPDDtClo9OFDIov8umXhfMa8M0lGt1kid+7E1MRw8N+ch6WQvKpY7ntKpQ3PH9JjW1Jal0jE4nWQotf3XF2DaDLBbNklZh0XgD6xJvLtfi4gzUwdsJKJoVP8xUsbvLoP3U49pCBLOgx+7S/Cdi0SuAn1KKhlKt4F+X3GJUHbeZByETgMKqaoUIKnn5CC9IFXVGRVEBb5mnVadyILASsiSA== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by CH0PR02MB7946.namprd02.prod.outlook.com (2603:10b6:610:103::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.24; Thu, 13 Jul 2023 10:57:25 +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.024; Thu, 13 Jul 2023 10:57:25 +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 v8 4/9] migration: convert rdma backend to accept MigrateAddress Date: Thu, 13 Jul 2023 10:57:08 +0000 Message-Id: <20230713105713.236883-5-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230713105713.236883-1-het.gala@nutanix.com> References: <20230713105713.236883-1-het.gala@nutanix.com> X-ClientProxiedBy: PH0P220CA0014.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:d3::28) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|CH0PR02MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: b93b780a-7273-49db-d771-08db838ff11c 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: 31ii7IkpDHMZMuBGVlZAkvMIgQAwdfWv9lse2NUyG8IML94Zq90kcpZqfeikV6tn8s3ZlP7a7jjsFrSMgAxlYaTwwiGaMHPs2X9pFUphf8xRKVigFoGA3we6XC9vIQ/8JozuR95/l3JqfWHf9xpMpUuDz3Bak/EESS6JCMAqAe3a2IrtPqDQMdVC7hxBeg3082ET65aKbnZwqtq7Je2j1KHSPR4lPfyC4o5gZeQgVfE5FveV/AtqeslN9xyrsKEigdbeMG++Nd1LS3VYlWhYKysfeYJ435JpXF8QX2BzOpzvmror2YHJClzjQxbuJYjAM6c3nWcY3j2lYmy/rjnqqQdLF2nz3Vuq7qbttXvGrFIx56xDkh8k+EYwGe8QRiDaWWW1q6UWAfvC25vvEuPDZaAIDmJGBNLsLfZq6WomZWcNIoxUnAA1j4MtMsBL6NNHHIrAmYZ6gGIOC0pujBv4RIL0MzqdOZca9WfVJXEdQ6ZxOcAREtf273PXsRWauxxbNU50T0kmDUyOBfeWZixFn1M9VNOVNIMgl/bFOrxmeRN2Buogcu3gRLwNlLEMOsAZRo9rSeLNIGrAcOrY2rZ12KitRwFrjgpGt1xdPnllmOHo7Zp0VsRyuZyZYjpI8LuF X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(376002)(39860400002)(396003)(136003)(366004)(451199021)(44832011)(5660300002)(8936002)(66556008)(8676002)(4326008)(41300700001)(316002)(66476007)(2906002)(6916009)(66946007)(6666004)(6486002)(6512007)(52116002)(1076003)(6506007)(26005)(186003)(107886003)(83380400001)(2616005)(36756003)(86362001)(38350700002)(38100700002)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Eo2l+poRDDU110c5oplN8gZlgaE9rNIaqHCsEdYE0Zlk1UMP1mTTZMzKhPnSJQ6oEhP9eF2PxNsKKN6+XiCwNgzBhY8nynqkwzBULISoN1B9FIjk2xWuM4TQhCD+1WeFTX2qCaABzmysttJlkNQ9vjAb7n8RekRlPrAYCR/yYy81SSrsI+ljzRrgOyKv3wBwI+TJeQoE4HBMLDnT6F65FWdeTV3A1Tlanb/sJ06G9t+3aVVfKm4H6fOjzchsGM5B0a7ycZrRAz7ixH0IfrG5Nq7STQkK8V2z9xz3jIvtC6mdDKViIjiG95Ws765ltieTVvVQuFA67mWOqk1LX7zUr1Yd93UMZdhXa0NmWiSMRKuWihX8FeQTMl2Uh/uVt293K/yRUq7hmS9K71k9TbceuTJNLryOensIEBVrqQULUz7h1gpUhuIDNQ95GirbJgpRp0jwUBaFm4NmmwLVI+OM6wbTFX66L4YzA3i5Gc3JVY3/9DD1Fid8diti1XxfuM26EejqgmtXFx47qtuZWAOztl0Ki3YErH+JiGjoONPYnJl9/Oiehc46QOu2sve2ekbLh8nhkGczr+PjhONLH7lJ4KWnT5Qwgz3LCTnRQaWorzcP35ewCRyhoeXAGLW1ucUSTuKEPsQ5Fub9In9SqL01Ddp+ITzdsWD5vaWLJ6EEqv/hy5b5vdPcG2z4IgD1gsT3y2M/5F2PJfNIuVeMs1JeHfIu6QrTCWTRSdiYaSr4BVNowmhb+c+WpHv4Uk98z5ZIUg/hQAjcc9GDWT+EC1xFlfqjd3B103XYrg5Nd0TucG0wYRZem2Sno/tDTWKzqIX4H30Ci/Xy105WbgcuUEsxCDR8C4jIgi9agOQdCEyBVE68TwJ83Z6yW0eu0F9mItoyu0vmccGSgaRD2uxR+WwwSWJeITozngui7EbcJxlIha27Fb28SYGHcq9CZPdOTNvyzGXclg1CpGNqjYhbojhG5tyGM6XZkXVKUbo5XKuGHhvHowjnCluhc5+26kWPOcw8NUEDYkiq61hTFTyxpJXaZpOL7es/xpGO0qH8bvJRiQ8hE6j2k/e4StYhAy99I+nnNkmtV1MPR1yN+0BOs6gzLM08wx8xjWlRo0owhvlQB77oRCacHftDhpaiSHgiUpKQgVRLqRcEZYN9RnYmEujZzb612wROgw5lyP8tq8+ZrSucYKPSsdmUuqKKBssoN0STLLyNGQ+TvvT9Hp5hQ3prhhsJBDA4QnVLVOzTO63Ky8NkUmssF5xzUKIQE6kZ9pu5ssbOExHcuNFZVh+RB5It1oDnMK/EcEuaIOTebhA4hno6DXENSMf/6BoWW+1FRplMI/5foA5KneQBodYdNo2Rl0TzXiBvj9J5SQ5+Y5QxEyN0yAqRDTZ3ARGKMh4myqs5yHjnwpOxBb2mlzVOYaBzBxodWzDaCKrFMwOZFzGxdyvIjMXmHYg/fQBgEZET2fzH52yzcIkXCBzCLWQ3s/8+d8bhbUgMPCtLsG/mscJmzTSBlCf4/qhZp5uJf5euEtJqN9UNLLSAZb79hOPwpxER+wG7wkJ1BDDnJiSKcZ0h65QYpl4mPA2HJa9l5FcpwEXHq3CIujEUcPFqBNt4uf8T7A== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: b93b780a-7273-49db-d771-08db838ff11c X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2023 10:57:25.3570 (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: z8RU3WCgTyjDyL7F/VpcFF43RVrn3i0i1LcKn4hfwnBcuLGxcMr8vly2XgLh4QUsB7rvklSYB+ETzPTj2xh+Fw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR02MB7946 X-Proofpoint-ORIG-GUID: PwYlsVZ-5wF9uXtdMuYf9kniOt2WZj3s X-Proofpoint-GUID: PwYlsVZ-5wF9uXtdMuYf9kniOt2WZj3s 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-13_04,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 Reviewed-by: Daniel P. Berrangé --- 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 Thu Jul 13 10:57:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13311837 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 8CE1EEB64DD for ; Thu, 13 Jul 2023 10:59:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJu16-0002VE-2X; Thu, 13 Jul 2023 06:57:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qJu0u-0002TY-Qz for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:39 -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 1qJu0q-0003bn-KW for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:35 -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 36D4o1SJ012615; Thu, 13 Jul 2023 03:57:29 -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=GFbRtiBBKMZAD0ixu0iZk6/lwoDBw6LCgefQrgyXU2+SUMbwbN+oxGl2R 4OPBHDD6m98Q0dU4YsaJZ8ZjfbglTyO3sa66Qjnte8kXeZLDePgTyFHvcLOfWdGy Yc72F5qzCIDfC7EkGulCUMW6xeXcuIu832K436FKXB2d+bF3yGfpZl0udGGABlQh EQFnQP3fFdsKFDCzaD3clDbcWp1ghaTnW3paJhoWtRGUqeleEkoTBMQcuvuLs6rT jtZC9TKAoCJN8QrBAEgLQ+g93Fp2EvbBLq8ePLwxgNw82q/WMaTsneXooRyZyn1J xtdiPJNA5iH/1tbQGjCF4rqe5HcWQ== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2174.outbound.protection.outlook.com [104.47.55.174]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3rsyb3hrjm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jul 2023 03:57:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=geRJWC9Z9smCgxVyFIje3klR/kiypAg+/p8K4LifavnF15xjfPXkethPrdMAUH3eATnnQCMp/bAKq2CY222+vwqQGRQcZva+ur4TrGORZIGDYRpOL7y3mVo0qUqNYB7ma3qVIRpjDbbvSY/isRtQG0fmOg3h4D+Wzn9S7TW7J5CavTC53cHDFtEUPL652CTUDuVS3vDsCxFrQZ6/mPl2rpfyreizNHPIXiGVKr08fgPWaBhdBS5gcyG6wIj3qy9gYICnzC69RG+UQM/Qs5IOBDreHl2HdL36BUgtiJTOiIIBJlGLq6BrGjCuPbIAAXtBxX1ZQcp8EVmI2w6Xzso9fA== 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=eZrIOrKcdZr6c+/Kz3XtfCDhOeSUR1xF5PVxLpAoiDAmFgs9iB2/DamVzJsq8bvAVGXJSmN1BugO2SNlCQK/fnIXgr9qVQ3QuSSzxEFSl2DagyRe/LRVS51LjAPy8w7UQPzHluLcWtq4J1486+vNJ3PXZuUhzb/cAbqEgRtT9nzu3whAIF2Dlt4TkVCRppEvjmnuK32Z/8RF6ejlv4Bpl9zKrPdAXZZFJzDuYe4Q2FwT2BM4pICd3epnwQYJ98vlX3xABvxXRTYid1I9qVNPL74yjO2OcpT27ALyMBYV4HCYf/FVeobdJgOcThjfdxp7PfSm7853mV8CGsES+nsIVA== 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=KHrh0Pk61rGpRhUs08X5W4Maay8HVkbML8PifoKuQ8UBYxMPy16VCLqKBkO4Hy2wdQtKyVHgQqzK/dujG/umDMXk9gn+FU/jGD7KRmKxrNyTas9htptU9nvyPcYA5O/zLKUkYuCHRrskVH5z3bcqfrJ3yAwrjT8omfz8qV+4Up4KJkz36LfE/etmQ8WO5wvfnx8XP9QOWQpJHdjm7fuqVt5OHG8TqimCtEL454SoR5TGxpVWG4ZYnYwF15Q2ZN8bermHy2phCRJaJiBuDJYL51Vk/ts3irqMsfsOV/UCo9gPU1wMDeP4CADxbWdvSc6ZcEwAnq2FJvNrygbpPCDpew== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by CH0PR02MB7946.namprd02.prod.outlook.com (2603:10b6:610:103::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.24; Thu, 13 Jul 2023 10:57:27 +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.024; Thu, 13 Jul 2023 10:57:27 +0000 From: Het Gala To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com, eblake@redhat.com, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v8 5/9] migration: convert exec backend to accept MigrateAddress. Date: Thu, 13 Jul 2023 10:57:09 +0000 Message-Id: <20230713105713.236883-6-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230713105713.236883-1-het.gala@nutanix.com> References: <20230713105713.236883-1-het.gala@nutanix.com> X-ClientProxiedBy: PH0P220CA0014.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:d3::28) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|CH0PR02MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: bf5d6381-fd65-4085-ee5f-08db838ff21b 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: AQsd1GrDiBjd8hhdt5qLDU9BXxUtsuzjv1mEVHMxlLoA3AnYqCiA7GH6yvVOA61hnsDZfQuDp+mV8EIxUbEIm17jMAiDgfyFHfhKjejEJg/IWAcxAPw91yi8F7woJs6nY2mPWteQd/bVF1n6q/aInjx/SVElBhT6YePFZ7UWKbjBs17N56NMk6Qcq9jtH4f7tBOXOJRWIIsGNdDTbARwAyia4VVlvIPie0nxfGhEiZLFZAuJfymDzNCivszkrcDB6jOKNAQLRlszTkSGVCL3TuNc60Y4IahDYbJ1xLfkfBxpXEiTGBQI0sRL0tqJ3wKCCoaicjapr3VGAPVgJ4iYHQwR5krfQfNg05/WyYpq5ltOhI3QtQFVkNMquM1R67ZudBkab0o7ZmmhuGRMTzbtbuFoyh047tj7BVpf/PrII8/HMRMAjBwV3mPuhDlDt7mH/83WRYDFSVCC+BR/b9F2iUfGlrCRxCk3bXNK3Kqm3y4089VE9t5vi4QdAnXPZoHw4E7DkuSZQ+Hk2yAqd0U8CqBfEIDzMQEGk4FFWebKerL0bFNI0rpZa/iCTxk7S2Q0u1SPNCqlyqy7J9ewU2Alub3XeFBGCUuBypgL9WTFkz50ZGcq1bmy4k43SPrOCkx+8DlyARVUzOtNDnhyPNTleQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(376002)(39860400002)(396003)(136003)(366004)(451199021)(44832011)(5660300002)(8936002)(66556008)(8676002)(4326008)(41300700001)(316002)(66476007)(2906002)(6916009)(66946007)(6666004)(6486002)(6512007)(52116002)(1076003)(6506007)(26005)(186003)(107886003)(83380400001)(2616005)(36756003)(86362001)(38350700002)(38100700002)(478600001)(218753002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /1OrV9YsO9BrtoppEvFssV7/xjCs5n7JB+vj4JdFafK4z0dqMySont/WNHXx6XcgXW0gH4VaMZujAyLfGf76BJi0HLFqPWKt+iYeqFRGC3Dw3IWiQ41TNush87FwN4E8oc7nc0CvqJGMa8YiSxNH4KR/tfe1mLYjC7zeEWQJsp1Tvt6KCX6/gvp2y8Cpm40BtTf17oECXzvKEF+G9+9Y8zPsDlmUNDMiC0tEJbVcKzSJ5aN4z/QsJ7laW3uvOP1SkwI3JvqvguDDoe9VMvIgOgD2iuB9Tn+Qb9eQ7jzyyWV+xd1PX1yIwVCz8mVTvBNPITuiRompwHyxav6i2uSOnrAqTc2fH+DHyXBepZZUpm/l68PMLjfvvF4VLnqDY4VrGAl5cbZNTLl/RLdUUSCMDAjWjtdNM0ocSa4yZ6iJEB9s43aj6j00/Y/Ldxt7go0BrejqbKoiAYNx27/3a8ihmXRucoBCtNhVPtOacR5dLfE7BXd10OR5vxrFI+WFKoNyh68cC2fQvWMcILWs1hJ8E1TTTJT7vi4//C/cwtEha/+FCA2mK9o7llUMhc96s4lMji48UMm/Cu4y5KMzssHM4x1MU4daVglk7HxYI2ygncDEtC2/OS7DCeMyPiysb9nGuM8C4Cdp0RhqT03AY4EMrffSZL34HXl0L0VImz4AT67jE5AJSW8Se0qXSUutD5zzjMDFmBRd2Yx8ylJO09kNLJs1hifV2f4KR8wtHEQnsPcRnVNMR/zpeASzVdYol2Sreu7b2/EbNQPuhywZ7QYhLmD32EaACszbGaI0d4fRZRxpucU8jjRtZolyUaopeRUP79wmB5jSCwtNvdKRpgLryi0MQAumJvIc9V6BGoePaaj7QfgY+nn8mrbwcPf8pCepii19/12ZsRt3TGaU37min4jN2Y6Sdv3gNhizfb2FBKduqt1bTQ/5yAY5LHoLOY/VHLr3I1icn3HzgLli2WA/H8W6m2ag0UXJYHtrFEmLuC+AjuFR4Ji83HoNCGtg3axlTRVy40LUNm2zJFNHPUIS2x616GpdFFOSQQDsVuPa5fNCrA4+F12j+eiLHqe4x5rDpg5LnEelUtR4vsQHpQOSkAqAjuyySWbbrAOHDyLgszFxrnnpCd3DuYwxRB/rvydYJRxJmmHcqeX7ZlgLBCn3Dsd9bCgqKP/bmIELHyqOthGAkzXEwKFmLBpwYGBnaGqiUs76j4PSFyAaw2YhvafjQ9ksVm4Js7YcxT9y45O9ABxaAfJ0VeKeVDibytpTqN1swPQmylJWKURgRNjHYNdzhiFM5A7JT4d2c39JJSrg+Gs5kRwLDm7dsclsOyBncAlC3nqharxDFq6vC5d8OQtIu4DeEXnJisTGZrTrXye34dRn9+OWUcdWrTcQNvfjxl2jHa1R5W3jNmM05MxvV8TuwWlQxCkm4mOXHi6zHcYU+X+BTy8ATTp2ney+zIxwrGpl2fDzzT40Hwz1RpMQM9JYZalF6SJ/kNAGcxCZESc29G6o0ieM2tZE/GuK0LF/PoYHTotvfiilhNyLJ9c7PT4U3vh/xj/clrJvpeRk3E+AanM+WglB1fSaeSX/o0Hh1ryKgE70BJBI4r5fWqAvOFgYow== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf5d6381-fd65-4085-ee5f-08db838ff21b X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2023 10:57:27.0246 (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: DuqSRBx9MnG1wcdXz/vPc5N9qEXwyep7G7JENV8OBOYKE/Gi2L8rQYHaympM6gqr4HuRwa8W9xtLNxXzCAv+6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR02MB7946 X-Proofpoint-ORIG-GUID: zdYXxB9Od0Ahmpru0E3QvWfDEjTPCRqo X-Proofpoint-GUID: zdYXxB9Od0Ahmpru0E3QvWfDEjTPCRqo 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-13_04,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 Reviewed-by: Daniel P. Berrangé --- 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 Thu Jul 13 10:57:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13311841 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 2037BC0015E for ; Thu, 13 Jul 2023 10:59:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJu1C-0002Wz-B3; Thu, 13 Jul 2023 06:57:54 -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 1qJu0u-0002TX-Qo for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:39 -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 1qJu0r-0003dl-Ro for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:35 -0400 Received: from pps.filterd (m0127840.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36D4j2hc018083; Thu, 13 Jul 2023 03:57:31 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= proofpoint20171006; bh=+iDNvA2e1K6HSuDdQy/NDDeA2YbsLMxKSh8SFl9Xm 60=; b=jx30hGOIUUD5KuTZu3gZZM/r82TULeeNy9LPv0KAihRFXqs/SbqsosK+Z SoMk+2CajmU299deG91gYVaRIq+499QDpZ3k+4eQNsn5/C/Suof+Lw+vgvRjCNtu FuQdaMybV7DHy4RVPvRfEL1MBKPDg8ktAapB8SRwnmkQIesFQjjXR8J8dLG+pG7n WJPGm671M0RIkm12lZjjTQiJK8wLxzTA6MUAnwU9H25JTCo+De1mT01u6cN8dPgc YuO8UUwu9sIAo2MpPGpH5RChWCjcNkPVCxeXg799GFcnZI+CUOrvcN+kL8VpSbpF /cIVWp9/PzyAWE61sf4BTo8Asq0hQ== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3rsyb3hrmj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jul 2023 03:57:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lcqZPyCWNIftdZFyac773J+bE3Y88BWo2ZcBU/D7rDKGwjRgh8n77QP8rWKCzSwGPf4s5tfYu6lG1GSRXgwlQJc1V6w1f+nUtBWb2dfFYIrcgmCBEcWEWIsk7zJ3Ntj6UzRiTpSum8dVmLy7GkbAQ4EJjuiIbdkxgCAmhgYjItdd9uG2Ioxrm28vcMqLqC3bubqje8fdvTQQP0FoltzQ1168oA4rmeB+c1mX7oT8o89Lq/hibldBBNQ/yzOYJVFqcPdtRbmR48bn1qUe7Zh8Vsm/hI5j/pX6oh5r2R18LC1IkASQJ6o21eBNon38zZfvhodkFPFfJ6p9CeYVFNKUeA== 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=+iDNvA2e1K6HSuDdQy/NDDeA2YbsLMxKSh8SFl9Xm60=; b=VWgrlsG1vujbPfU+D6dJrcwrc9XSo4VokryaUGgBAfx/EASMDyqzRjDmLFut9bYAmRy0FOVXYfPf5jXQRX7JJJtk84g0NRdQpL0e2MfH3EF0hD58T1WOv2Z8yLERxx2aroHXPjv3nssSO0kOaMqL3dL91nRdSR8Yv2bHS640wmn84oGg8Q1NqiVzgBZd0HWBEwXmGGuO+9pCteBlG5TVBAtIbzn1igmnMR7qOfJVSXpOIC/lKp11gshOmy0N3sG3Esnp66271MFIer9Mi6LJTE7vDPtB5KzHO6Z0nXc+XO0Zr12oYOU9y/AckkoAtk5eYq9NUB+j1CLnIKLzmPLZSA== 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=+iDNvA2e1K6HSuDdQy/NDDeA2YbsLMxKSh8SFl9Xm60=; b=Qtn8qtl9xbw3ZBeOR5cNUH3vB2qNWEzLNzRTKU5rBNOEW0lS1p1QPUgfSPuV+TPOpcq0imOO/Logcp+vsP3OAYDoRs29eUhzRaCV+U/paaHzSZF688MhmUStG6F2evmiyfVc3d/k+D9e6lMpcZxhNlU5hKazVMlQ7RNcQaQtBFpI37rK4JmpymYnEbfLCtjnwpCZQ7B0TlZjz2mwmFVOErEhvjhZAjMctnGPrp/SAPTPlp8YLQRuqWtfrR3KYruhd8OSKzIPFqtNnH/ZF+ABH5T4B+dwGfmrZyaM+2ehMThTvW3MXmvuoBYi98bgEapIsMqG2hbIT67BioV6lQu+XA== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by CH0PR02MB7946.namprd02.prod.outlook.com (2603:10b6:610:103::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.24; Thu, 13 Jul 2023 10:57:28 +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.024; Thu, 13 Jul 2023 10:57:28 +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 v8 6/9] migration: New migrate and migrate-incoming argument 'channels' Date: Thu, 13 Jul 2023 10:57:10 +0000 Message-Id: <20230713105713.236883-7-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230713105713.236883-1-het.gala@nutanix.com> References: <20230713105713.236883-1-het.gala@nutanix.com> X-ClientProxiedBy: PH0P220CA0014.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:d3::28) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|CH0PR02MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: a83178d5-02fd-43b0-de51-08db838ff313 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: Pdz9L0NEl+UVciYnSvNLPVrFfeZYDWwELm2xIDtqtLjwyk/BPzpI73Ms8aalUOhAME7Og7jyjd1YePjSXFzbvbHTeNrS3rZKmWCogc/OqbhGEbqfynEQlVm8XiXgWzj9HJS7+u2I5i0GrNfU3aowtcKu4ZuHNRqLH0H/cHFFQOukhIJOCvA4exWoGrYd8DV7Jv9ypoGK4fXXfxpLEECTuLawVmoLP2HojFEn6Ff9Q2R/M1lAiscrxECgr1bRJ8REaBv/iTNOUI7ehv3GWrSiV1i0TuzjYRwP94rwEzaurTbWvSXaaJV2iEuYh47YiK0DiHtGfIWppHR1mWCjS3shD8vuvXprEAj3mStQUoXMx+7pMgtlkfHWgdm13stK/FTUxlj9PdORjyFVAbK3QMQfi7j2t1+IhvZG1De2mzEoyYmfqcxFPRf+1aW+SPk01I9+6FaVSaTateejJWs7x2jWqoahFTI2M1/BOH8QAD3yp17GfD7aMO7O/utx7IwVXttuI00wZbuCvLBkktHa3Tfe/AFspyc1YF6N8C2LfzCogWLmv+gEqL0wjFAMRfJxca+5qPMfSDky6kfxMoblTfFM6S66e8ku/pmunadqdaavwYmL+0/Srun3hyUh0+wwOV4KuvfycwtjzhOQl6275eLlgw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(376002)(39860400002)(396003)(136003)(366004)(451199021)(44832011)(5660300002)(8936002)(66556008)(8676002)(4326008)(41300700001)(316002)(66476007)(2906002)(6916009)(66946007)(6666004)(6486002)(6512007)(52116002)(1076003)(6506007)(26005)(186003)(107886003)(83380400001)(2616005)(36756003)(86362001)(38350700002)(38100700002)(478600001)(309714004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MD+GTtZ6hM16WFbvXoEfMKxBxiIbQtM0I1lluqB7PavtfcW632aWuMltsgwlGRzyggfY/8jI8hfalWVAGmSUdj/2+RemasOphPU0Xq6OByKCaQxj0BKY0RRRvY7Lcp0QtU0oykUdc+MZO0ettccLaXn0rBMpo/Jef/RFmlCfvAElRuddRXfk5128q0g40aNzQEvNNxjNeB1Cn7MCl9bhI1Syn5DKLrNVp6QAv5Zh9tTXRgor8xJuEnbDyLIJJV/fWsneIX+LRfAzA0NbOkglDYQcTJUf3L8YMouxOiMIMWfa8W7Y0w7mN3NGBRZgO94gijAq205H+85GYBFTIES6aDVzRiuIQI509fATQREsbHer+L9IfYg1vnKNamiG6ZKBuwa1MGtHZw0pWo7sRHRfr34Gdgmdnh0eKiRZwphOSMHPQ6hb/5NQKdCODUQfHBeBk6MYgcHIQK/qSKukDrde0bpmrEoKywpNCVr0Hq6ExU4/3X6ZMEGIdDJA82ACkubcpB6CCly8O0YCOufWfCjDn53xtXGqwtExigkEvKbG9j7Kj8TtQ+PtOm+7Um+KnFqjC1LhwEJ7LqzmncIwYnypQJeR3mWxVc/5H/L68B6Qb5P3qIJAWuTgniq/l1rNHMNSiZN1T4zdHiJd+nS8/TQ7zt3+dTMkhkpmGTNc7hblvyOiXazq3KOvGKp8E+KX8/gbZMocrthg4fLIg5GD2POV0yL3+oL6C0bQrdiMX8iho++5A99cqeAcvX24oBzUf6LHMdydQOo7xb95t9KOmec+4ht9vg19Bg1ai5DMu+513wj3zdf7SPcZohEamRHHxhLrajk1u5In5mEvjtGXu8kZLFNUL6G8UUDK1VqXtMAmmGerSz3kZrImhMj09hmk1ET6JEFUYOanLOK1QuVgZdSpdVgskru9oDCc7wkkFJyEG1+msv3fGr+yHMK8ERgtA4eQPoPZ1zmk9DPtm8KEbkIJ9LsNzgqH+Lb2k3HPvQR6b6jmeXYi9LSiXHOurY9ApPtGEh5lHF5DikU7dRLwAZaa5y16Hc6ZfDbb5mfEW/CS0BMycvwlXLte8js+6CiOuUW0gTyL1rE+p1qZjMNJgYCCEs93R9LyZXadwcr99sHASRlo89RxJutlzaisHloIu0JZo+sP2jzFmm1n6L17BNXMr6gn26a7B4+Hif1HmIV1sqKuy6z1D9GCcQkUsipU3FH3E4A2X2KCz2jU1WBWhW/48tEixMJbqSf13wfCiyJ6wZibGKQo4yo3uV/EVJnjnUi9sQ+usyovNVwweBi0nuFcxYOt2ZSQiG2HkXehuqNAbmr8LbBxQF87b20jq9jdn7qEyOgKF8wFGRkZ10bpd4m2l5etekwC3tWJKFubnvuWVpp9kgrDbtIzjQEL/datkGqFm37d6wn3IbteJI4TNOGksvYIQwId2Wq0qNEjCFjCDrblW+fKa7N8IbkUHl15CVrOW9jslJ1cF54YQwZ4JqJYfXtAjcZRA0DOOmJIQLkSFJpYFbYvRdTYv+cPnXyZXsMUaYJ76XUw3XGUCXfbgMKyol3Cl6Al3l+k73SY+9NOjRvnMhDXr4EbMbpLZSTX0YLz0+WZVEIYr5XmHzXniN4ZNQ== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: a83178d5-02fd-43b0-de51-08db838ff313 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2023 10:57:28.6888 (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: mbiaoleFPYBHNggtZQ8QerhRHnjoKHOOGi6nsbPhxdCccZf9ag26SJDFwRejU8lNsteflDcx8PaBVS4wW/ymEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR02MB7946 X-Proofpoint-GUID: n3sfBbMCELE1lAf0-qiULO1y6W7ANK_c X-Proofpoint-ORIG-GUID: n3sfBbMCELE1lAf0-qiULO1y6W7ANK_c 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-13_04,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org MigrateChannelList allows to connect accross multiple interfaces. Add MigrateChannelList struct as argument to migration QAPIs. We plan to include multiple channels in future, to connnect multiple interfaces. Hence, we choose 'MigrateChannelList' as the new argument over 'MigrateChannel' to make migration QAPIs future proof. For current series, limit the size of MigrateChannelList 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..34ac4e0a82 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 Thu Jul 13 10:57:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13311842 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 1173AEB64DD for ; Thu, 13 Jul 2023 10:59:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJu17-0002VT-GH; Thu, 13 Jul 2023 06:57:49 -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 1qJu0z-0002UT-UH for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:42 -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 1qJu0s-0003ds-0u for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:36 -0400 Received: from pps.filterd (m0127840.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36D4j2hd018083; Thu, 13 Jul 2023 03:57:31 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= proofpoint20171006; bh=YzIaJ/bd0koyKDKmNq2mCliBn/iKviX8EN6EEhxhb 9c=; b=PVbxGdQP5MKhUA3VwpNGshZTyc4b0Jmjyn7m2HlMEqAE8d7A80p7bi/Dz lYig159JixtbdxGM98SgFK5AONUX2v3Z0AVdB98U6vJJUzAj6lf1/+mDpaTFB+gG +co5wyHDU258UzomIbWtThPKSngch2QqNYVS0YL20PvDEgyFASvigTTl6l25DbcX cdN53F2w+/mRxJgjlUmt4/vANFer8W0FZvbHDiMV/bgg2kc2sjpRlX06jmEM9ETA XBZ/FxRYuJX4wratDA+d+G7Lm9WsFOhtHk5MScxb7NwoiQzBGTyDe9aAWE7LLW+K N9z6QuesITXHJ9yU00RnqCeDvZtaA== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3rsyb3hrmj-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jul 2023 03:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XjbB34SG8bTuGEr8W+1oftGkUpM5X99hqUBmAQuPlppM1eiZuB+u4H7ApMZjSl/EHe4J6RDd5eGR+I1BBqoGzX7aRuU1Vy9z1xnhJi5BtLLnDIjBvCMpUKwH3yZjgpvN0A+YE/W6QDiCtUAeqRaPNuGANGP3EoOCaGo0WD/G9wCcW2S1mzqPac/tSBkWUq6QuOSxkXNZsMLvKV/V5DkL1ZSpFo0TeqCOLTKbs5jbs/b/Azyr9kdKg6YS/CdN4WmD+h13UKU4RbMkGs2tX5aienebJ44eSWQyQEc9EDl0ukXrBbrC+fqfpNWDeVB7QSt3Cqiy48A8fmQo5yT4yvQeJw== 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=YzIaJ/bd0koyKDKmNq2mCliBn/iKviX8EN6EEhxhb9c=; b=dJPi8Ie5m7xP6yML0MgAf1K961PHl0Oqkxb1n5Vaz9Uh19F4CsqbDBy3x98Fo+2CTM8bUZ4g7Yxtxtf7hU0dJoOz4wKXXU5rOQ9detAaEA59+On596PFE4vExjC05iDfoOF0d2nTKFpqiIjQYuCssCK1HDmK4yx3NGu+h4GxRXk2BcbB/0bUG6SEvrkxND44W3TXcbaQZObPjrSZW3RHHECjrjiuDDWzblJFkxZpwKG5lh9U7N2EcKSpMuOGKt25dxA8g/Ulu+jhAfmXCXE1ijWybazYafxtQmQukL//X5LE7cJhaDpB0H7+vtY9OJu98z+Nsu1fZy35AJAl0XRlFA== 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=YzIaJ/bd0koyKDKmNq2mCliBn/iKviX8EN6EEhxhb9c=; b=L+gxYBPg9CHey+cKs8pckO/NBTUHhFuN3yMqMQcJdhKdoN2ZXaKvc+Slnqvmc/bWK6OW+z2KbLTKHn25FgrSlnmErZcrXrEPOYroacWZ0R+NSgMtYnFo+2jQzDmd7pOIvCJawWT7G25ep3D/VdnHpincqn/oengiCwv1AD0u3ukHCYNQ147+NE9pIDLNDrP8aukDpJTvjM1UEo9PqAh322NhIf7JleeTHwkjTDE+gQFwneZDeLLrGislQq+GopGk6+/xstqIQqYWBXz1Wlyrfvw+SDgKCeTK8E+QOczdj3OCy9LJAEQC8Jba13oTgYZ8r4i2KlB8/jgTc8bEWCrQcw== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by CH0PR02MB7946.namprd02.prod.outlook.com (2603:10b6:610:103::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.24; Thu, 13 Jul 2023 10:57:30 +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.024; Thu, 13 Jul 2023 10:57:30 +0000 From: Het Gala To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com, eblake@redhat.com, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v8 7/9] migration: modify migration_channels_and_uri_compatible() for new QAPI syntax Date: Thu, 13 Jul 2023 10:57:11 +0000 Message-Id: <20230713105713.236883-8-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230713105713.236883-1-het.gala@nutanix.com> References: <20230713105713.236883-1-het.gala@nutanix.com> X-ClientProxiedBy: PH0P220CA0014.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:d3::28) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|CH0PR02MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: 71da7d31-32f0-479f-09a4-08db838ff407 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: npew5EOX87FD6mM4OAVpQgg7h09k3497x/5Rct3Cn5kZszmEbNj8ozbBT5Q27j0Q8fsHiBodQ/5I4gnKL8Ab8bOLOhR3XWZuKSaFIjugIb6gSvdPX3NUtS+ZjPHT/Q2dfwWRmIvnMrsJT8JHsaoyMapS9keVY8N1+nNcDBELHp0Tx3zYg+9pI7Vu+4tQ/c3gU791wpnBR6TlUu7fIqtKjBp7zU3Km6mtbMwGda0A4jzZY/JSIVxKuTZZqJ1whKsSwDDUmT5PxdSSrwojtNwDZI9/CpZ4JtqcAaTwrx474vkyjXpi3w8I/V1yXB5asn71tgY4jSQFFHhmzCPyCQ29w9owZW8u1RLlRlsszzuWkeotDEwyWnSgkh0yMpPFJdMx+B2JI9ttKTpTOJuHdC/ij6hRXExreADvO98WYE8w6321ygo9MZYGjw0pphW63t3v/HeGBWAZvlIJkQdEjMETUWDcZKnNqn+yf51SizNJa39peHQ95qEGYCoFJKeASgazjSheri99UqNLkdZJFt3DPwVQ9vYS5J2EyHOMVNUUByycynjznyo9n1yXeLKQCHoPzej/6HXTGmAsz7l5u1hNHc4DoS04NaBXlglz3cgBz6pKuUqW6izJ029Tt8IN2Hx+ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(376002)(39860400002)(396003)(136003)(366004)(451199021)(44832011)(5660300002)(8936002)(66556008)(8676002)(4326008)(41300700001)(316002)(66476007)(2906002)(6916009)(66946007)(6666004)(6486002)(6512007)(52116002)(1076003)(6506007)(26005)(186003)(107886003)(83380400001)(2616005)(36756003)(86362001)(38350700002)(38100700002)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H4YDr9sDeKDPpmfhR301ho6RQkAyUKo2NXSj6D6k3TCZ21auKXX9lzrmOlvLCKZ0IgkhqjBeGECK2aij0UQF1N7kgiSgKYnA47MxDihQgPXkvin0wPOAPPMSgKSNH+jdEirW2QZ+urMs+u9xapdT1+3xeQPsKs9rjvxa/85v2ZMUoTrLYfJwg2A+RSc+PMY2bL/zPc/mZvohUHZlzXVjqZty8AQlx4yzaR1iX+tWifC3mJXKC5zKDROifAPRtZ+QZ40izaVxYZBx7j+2I/omvKOCB+6ugxgj6VnzdbWoiPlv/DM4R4M/AxIGRJ87cRW7nFvNeWKiCDLuW2WigOf6t2NTv+15bCcWQgX4qmq7xLMwOxacFN2yr9yA0IJhcygHyomchmJLYy7GoV7vMJmitAy/Fzi6PL+vkCqxPugH/yAYFKi2pxa3cmG7mbJEK4xLxg9prsOWvB2lMGRKoL+Kjo//f4NjrT38KFsZLjnGDeBm2KHlR3+OIjQIta73u2JD0+KULikVvf4xcC22+7ojTs6ZJ/oDcutJtIkdqRGqKebSA+VHA6ojp6nEmeb1/UNBVaVEpETsr7XRZ89px0NrXcZqya5zC9Jx7gthnUwbbr11WVwFNUQKd+AhhuwLTCnCWDuYgPIoBsPgH9qmlE4JyC7tmA02Zj87UBttdvQF2wzhUd4HFhSCCbX3W426vc96L11xzP4/5/RpnSKZhdR0cO0vpxjELooCTn80tuX5N90eGq5US4rR5lUmN/UzP5Q6E+FeprEl+nh1XF95Xp458n1lAWZRkY0ug8/9L9F3FZfVklb0Scw3rVnMHCn9Y6MtWzqNNpfCzFJKbtdOkIcPlDmo3/VJ0Yro3pwaGtc+Yb0NLUM6wVUT+gcIAE5nnKDcR6KJkhNzTXAgtxxGuyuoLqyZn5sCPUOCXxOqrv6/zsrXLIJHqbc8UXc2fiSm2UuH6n52mPaNqrbt3lrxRrQmmXRg6dHubMoAmfeReSJxYL7b/VJtGaXhZPDGz1Uac4VF8dRGdYqnFCoe/ekK68lIqlbY1em6Yw6/VG1hMEJsAyuIU3/vT0Yv7HPUk91E154UZdCeUkCw3ZpJR/0ipWr5R9/ljxLUetgXSRYq+vFl5SOCHnzCnY6SV/grU/pxcBqKDarCkcQTjXy4teMNNU1iYszfIGxcIYEzt/ahjFJ7SXxIXfM6Tsk0Udk2Nglw/mVraYt7+rpf0N8vb+PH3/JvXMrfSnAGXyTZ3AO51Sl2731s3YgEcSB9udCMgiplhb9l2TZ9XgRCvJy6JhU3bPGSws1o08M4GbLu8lM5EkkWzJKIgHZfDk9IV6u2RSvIcIH9ythjXl6pMO6e5Ya0qvKW23UGBNUIAOqZRqa9+/JAV/7pqXaUByuNqXYHL8nSbQgHucwQGPq089+qf6Cp+mpC9op2YLEzV7b0DJHv/RET1Ca+mIxH9hqqNvTGp34hgfCELhFNksMZdWwYKvt0YF5vJYDhEQ1oMvdOKAS3ek6B5ePL53jJqh7WhWzteQsyFd6oIyW+egst1ZYW82dYg0gLjEiG4ULu+bPr20tLyjLJlfL3dnrbLM4BMmhVfwKbN3ajUT8NS91sy7AsMg1+B2XhAQ== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71da7d31-32f0-479f-09a4-08db838ff407 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2023 10:57:30.2379 (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: wepgirUx8Uq463AY2jtBoT75O/rwua9xlpIDs0XqXyAhXFAOMyuW8Cqr7zB+hsV/soqIYJxCxMNs0340XRyU3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR02MB7946 X-Proofpoint-GUID: 5WjpDbZmp5ekBM1EoysFldaVcoAORgim X-Proofpoint-ORIG-GUID: 5WjpDbZmp5ekBM1EoysFldaVcoAORgim 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-13_04,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org migration_channels_and_uri_compatible() check for transport mechanism suitable for multifd migration gets executed when the caller calls old uri syntax. It needs it to be run when using the modern MigrateChannel QAPI syntax too. After URI -> 'MigrateChannel' : migration_channels_and_uri_compatible() -> migration_channels_and_transport_compatible() passes object as argument and check for valid transport mechanism. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala Reviewed-by: Daniel P. Berrangé --- 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 Thu Jul 13 10:57:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13311838 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 F0E5EEB64DD for ; Thu, 13 Jul 2023 10:59:29 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJu1F-0002Xp-B5; Thu, 13 Jul 2023 06:57:57 -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 1qJu11-0002Ui-4B for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:44 -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 1qJu0u-0003ed-Ik for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:42 -0400 Received: from pps.filterd (m0127839.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36D7nigq006214; Thu, 13 Jul 2023 03:57:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= proofpoint20171006; bh=PNpno2H7w77Gi1b/qcAPoywJ8n+HTwoAYGyORr67w oI=; b=ZBZ8dx9uwayKwqTv/y4p3omfvlf6KVIGZq6jS5z49IdXDXzDOFSwrOgBO JBkNTK76GBp+KlyA2Z/7GdaB5DRFdWmjhSP1DKUyCZg7wnkXJVNjAGJT6wyhnkKI UK/vrzQM3weoJagv/1n+6nta5v13RNPq1rifvnVVKL+OEASOH8ObWev8qAFEJ41I zDiLTUozu27nsYE/wKLB4UypkGO8rZKRcu6NNc6jTSZUrZf794UPetm/SL6WVcEI DjAZBZblvHMe6EN8IEBeLFtGHgGc5cg8Iwg9PRe2YvuCEeRtKqi6+CK5sPMOoYxt yh92oWGQN9OQ2uCQXoS2ZIjQhGpFQ== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2177.outbound.protection.outlook.com [104.47.55.177]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3rsyb3srss-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jul 2023 03:57:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P4WFqnUl631qoWElkUe1JOTQ3LDekl0RNVprto+pamHPdjVDJPj9EZ71I4KI9+HvoCewRNkgEM0eZ/XiriSJlhrQUf/4ncW5eeXVjpxr2sezLWBVVlpvwI8U5wsTxA3/1W+2pCFP7+sNHfdHPXt+TwQe+w0bSQvNfv5QwBgBqOd8w/fCVkfStDXXy6HzqZxdCnDt7zY4qHSwl32sZcX2v01M/xE2wzHwngjy7IbM7tLqR8V2q98Dc6p1aYWJlgCbChoJ7mLJ5ay7Tm/xDPbqnKjCKH+/mFd2tnWV7Uxijs9KAKbjh9Qm+roaTRnkvdRhRuITdklZjA7k23aEaMU40g== 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=PNpno2H7w77Gi1b/qcAPoywJ8n+HTwoAYGyORr67woI=; b=Uny9lanH7Ox5mO2yvejk/jdOA/T+aiYCc+ngGtff/StOLrl4W955gPSJ17Ht1on0jj7o6o6f30q2lbxzH9OgByTfMJcxDx5cao/5pujz9efY/30Y7SIv2Q+R+1IdXcAN9aHKwhOMoHwkolSrNcsPE9pCvCm4Kn0J0DufOU4751AxcLwo6nCEpw3+EP6HFh5t3z0w+fVoH+vexe6ofcx1byd10mBsU2+RdDAnD0W0u4/bcPZaaOONknneTDJaRdqzhf13KVGlTtUIHwLnR7BgzLT9+gw6FUTm5FhymMJGcHwKaxDoVGxX7v8JiX76mJYWK4GI4QIvWFPQfyzd6hPm2A== 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=PNpno2H7w77Gi1b/qcAPoywJ8n+HTwoAYGyORr67woI=; b=nigXnil89tVFGHXI+ZpH/a5+J29lu74JrEBuWpBk6zUYTb5IXpw/guGF7GSR+VUu7qnDNs2oR+XQbw7ulJlYDCFdKn4Q+xLVxArmgPoq9AmKJTjcFqezB6DSMP1s4gkmLJxC+F1GHOm9pyjYCzyMNQG7u629kIrIj7bN4+4ar/XNtgNsiPQ1vWmiKKI4bYoJClLgmAUn27Iw8XCLu+hnkCIqx7HotAZLasqT7unIFlK2VfZhUq8uS0o+h7YFce+ogjN5agE8NhsuWxIbPrfaPkMf5kLSikFQ6kd0RXgI4BBr4N28Pif3ypQAyQhO9lNq0hE6LmaZPSYK5Igc1iO6vA== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by CH0PR02MB7946.namprd02.prod.outlook.com (2603:10b6:610:103::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.24; Thu, 13 Jul 2023 10:57:32 +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.024; Thu, 13 Jul 2023 10:57:32 +0000 From: Het Gala To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com, eblake@redhat.com, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v8 8/9] migration: Implement MigrateChannelList to migration flow. Date: Thu, 13 Jul 2023 10:57:12 +0000 Message-Id: <20230713105713.236883-9-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230713105713.236883-1-het.gala@nutanix.com> References: <20230713105713.236883-1-het.gala@nutanix.com> X-ClientProxiedBy: PH0P220CA0014.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:d3::28) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|CH0PR02MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: 610a6566-8e25-4128-a7e3-08db838ff52e 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: P8f7DQ9NBRK8jOC1sArRCRLsGfl/XinDL6Ev+1Szmn3clMlM/RTSY+Erp/h7IOQwIcjwcVLvcG6plstmVvXpZvi9blu0jfYhxsujmISy2r4NWoD+5tinvHSCPb1b5jr7Qszi2ptZNUPilCqjN6EZbDKfaNw676WkbQUfCkvXTdi6Ril+mA8oTuOUM9lR5c5h0gpaQXNlOwo4YQmCh2qxEPCttYnMFEZAx42oH7j6woMS0WISAKaEvPvhPxU3g9QQS6fSYLGEmR78bkC5weMNjVjxCubUX+p1X5Be8OSxkwCXpcVfsUaLecuUqNTX09ONz/8svK3KfcYsk9ePGNqIgBVt/+2jb84xQNMAnSaLYcdmsLk8zbYm789mRTT1bQalROjl67D5IIor7e7gCrSfP5H+5ct6N7/lUbQk75v7y2lSOYLeeH+gMcSyTCUKPJKLIWnOhh4iwosq1b7zY0VSWjEdpJG4GwX8YTq/q6HmKw85Dj+u1GRD0hRbtdjaD1eqGIvhaEdR5yQk/4vdl8RWNY64u7yWgwn16f4vOVAP/4cx3MRgLBdblA5b/h9zeZxQjCn3O3Fd+/gDBt6GWhr4rSeCnKlAPm8JmP/LSCS4h8Pn0Zh5YWbqusTTZqMiJPBC X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(376002)(39860400002)(396003)(136003)(366004)(451199021)(44832011)(5660300002)(8936002)(66556008)(8676002)(4326008)(41300700001)(316002)(66476007)(2906002)(6916009)(66946007)(6666004)(6486002)(6512007)(52116002)(1076003)(6506007)(26005)(186003)(107886003)(83380400001)(2616005)(36756003)(86362001)(38350700002)(38100700002)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HT785WlV8o0Kq/EUXiVUg60ek4WYXQwRA64hz+SFMG/MOlqz0xegq9a0iMpZSk4J1xkcg4niGw17deRwF7V64jsBoQeXx/ZRyqWGYAoZjcWUlMQHIMhtdw3cub7ePaqMby12DRS0+kGEcPfJaVbYQ0jFGBO2NCHmEAD5N4xvl7ji1VTC4gYqlUz+KuyD/tzZwBfn5uBvwPwq02F3XtBlHRs9CMoR493WLFAyznPDN8zO/fLhs3bqriXUBQ2U7XxqeGaHDTSvzujPkjur8IVg67yPPMohpAYVfLa7TBCDjLDAMq1wgvY6EhNF61t3O0dzei7l8pUny4MUFalPz5pV21quu+qpZ7VAw/GijKNGn/yp/vLcA7MVI56NmSzLS6tevsjxKtv2Spk14g0gMq2LmOqWvWxUd1ockxuDYDrXQ/VRYA1B9M31ak9VF8uqh1kOEuj3xI8KxYVrqgzfDkxpThQD5Rn24FWbIXhvGvwElEaA9cIfSyV7/Ya5+Er7EJEh6WEKGFX7bCSWeg6W5DAdnkNYkUGGezFXuMvqo66f/zwHt7ShpZpWpdXqwJzAgta4WTS6S06pfo1dNcm42MvgT2QUJ9rZly9p4F2K/krCYIxRq2CXlk/M9fC+z9Wfx7Q1ZevSMk3TwDNSbfV2Ja99ywiKw/RWXVKb8r2fCZUB/8k0ptZ2bc9zHfZ0CjyviX+PV9WEHjaFvKasLVjFrDkrUUH0EO2ClLWVLa3VzvGZ7ZBgAK9ESkNAcvUmPdv8zI45q71MKXfhqhoo0sD8hqamEbSr+9amV3eNe1Su4Fj6aVbECidXDCbGRnG0J2CNz0n/AKYcSFOQn14ILpPU7aQIxOePkOkdkhW32VUyJ5sYhZTZFLPQpBCIe53sG7NxzA/UP+wrvleTYb0X4X/5XzagEZ2kIEw1E2vjEaeW3Tr49R/+Gck0cIm9zcRf4RD+WI1Mui3sEUqMwEwZKMXqDqO305/9kJOFMmRXtowr1WdsqTWc5R19dSSgagA8Td33+WcskR1tjoY/A8+Do/ogyNH0kCgyTfef8UbsfzL6CHlj7FQySMpSJEz/HhgoX4/SUGyuLk17YRhk8Zl1EIdhySp+erusAMZbwJ4v5wPZCN8FJq3kFf0bJdzNTbzLQa0Sj2nqmyOt69UwXFUdkCjr2adz93OhzNWZcYgCuvej4kMiyyHIga4OUfUjEXajFHkUh9TPxvYNLkDq5n6swF+j7NrRcQjwn9OSAaZ3g8EA3wsOsoXPV0eDd5+HdYp6M4Z49Xm/LxPp8acLwMmN2FB0K+b6qGst11SO4RqNEt9wH4vwU32FfsrfRiCVQEwN6r21IQQU+0xSw1h8fmm2rGEY6MQmrRjC5Z90hyuDOug6nKIBwHFx5kj/zJmz2hkDEvKOTvOq6ptC+UWeF8cQtFFMJm7qVsl9gWwgPbtRbN9KUHDNjFfeQzCh2iunURQ0NMDpm5MIuBlbXdHJKH8fRNlFAWKFl4AQbBc7p284fYAzXuVkqsM/5P2cFLD+1w9z759o090oyzJ4A5vDNPYPral8abGdZa3RkTg/e20/4pDedA0ubIDs3makaGIpOz0JP4L6+190PBI9JMLVv94h0XIV657Wew== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 610a6566-8e25-4128-a7e3-08db838ff52e X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2023 10:57:32.1646 (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: VYsRexAxTd+7xum/+IgXxzupDXBIdNoRdwqQNC5qjbNDRxWGnqjTK1I5oq/zRX1+chohWsmAeKx1vI+4gFlvoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR02MB7946 X-Proofpoint-ORIG-GUID: Yw7tcZcVZDEW626bwLCf6Mi4MbSyckjx X-Proofpoint-GUID: Yw7tcZcVZDEW626bwLCf6Mi4MbSyckjx 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-13_04,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Integrate MigrateChannelList with all transport backends (socket, exec and rdma) for both src and dest migration endpoints. 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 Thu Jul 13 10:57:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13311835 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 2F433EB64DD for ; Thu, 13 Jul 2023 10:59:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJu1E-0002XN-TH; Thu, 13 Jul 2023 06:57:56 -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 1qJu11-0002Uh-3f for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:44 -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 1qJu0x-0003er-QE for qemu-devel@nongnu.org; Thu, 13 Jul 2023 06:57:42 -0400 Received: from pps.filterd (m0127840.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36D4xx67008873; Thu, 13 Jul 2023 03:57:36 -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=VG5O+g3KxLuipuONUDPb41m5EhcsnGI3640aLEavF Pg=; b=xXI8xkRhJ/KNKse2nDk8q8Ik/vWuJX8EL5lRc6DIBoVVLva+S4gSNj7o3 XPKsqlmot1O5+9i+ikR7aUSZEI5aGtOyB+TYEruXCtPYdoqhy2iFNTjw+ELzvAix S1O69paTUMhBtbBtJph+HWtxXfQKAwfS9NYtodWeyIlgfCBDrMweM4aW2AP8Q3j2 vsoT7n9akPO+qPHWHrdjJLR48ucF5SCy7Owg6rfH9DGS1G2/XtWW4SS4bWwMQVKL hE2gSHKWHpwANwnM9/HYuWcQ/achEWRNZVD0yPUdBajTYkO1WRz20koQ/lmJ0zlb 5hZ5M4h90t9LTDjSuQoB2Md7PAZHQ== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2172.outbound.protection.outlook.com [104.47.55.172]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3rsyb3hrmr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jul 2023 03:57:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C7uOlKJJW1NJ8QjtgaXsTayl7CodXhzFR6zJOIlk9qeCNUC2v7sSvq6/8EygLz/5ejRFPBxgBQf6emOBJra/g8E/M5iHtcVbAajvsv652S5+62/BHW1odMclXLRyHIBaVexEiibt03GC+fMDF/qxhFLyDCdWp1WzYZQu7EFOcZp9mPY9sJDYD12vp5353yPqdI4cvBvMCC1bdQ9kij2BjB3v9nY5iG/XfNL0iiCRqkxXo/26qdbe6+PQtODNap+QABMiBCHGn8FxrFl7C0AorlElM0aukB/hPIIMoXMnRf3etieCnrYQADBfi3vxGACcrvihjoc+rk+7uMzLFUBpRg== 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=VG5O+g3KxLuipuONUDPb41m5EhcsnGI3640aLEavFPg=; b=UuKaCQrMPkHhZ6QhigKBdp9MtVKaNJvtugyfqnCKR2OLpmkQqvhs6wyr8hkh4FQF6yAkNjk8ocAQyyZqD7RMGeEGlRyr2cvxHF+P+6tKIXulYQ2Esz6tSwBaz8QCTi+v8gfLQ7heC4rJ4e3qdltRwThhYVCjxtgcCdI0Z00TYahMZGcDRd0zkufbB6sygeo51m00cYEAiXixJnMp68w6dROPQC0Uy1Jg7/asBAFsY2GFmdQHBUWvSR/jhltvc7Jca0aNvGB153MLiObCx1FoC9AoeNQdO+vv9msWdQ34LeDgPhPXSGYxGmml+I4HwANZpobklKTtKU6dj3Y0BvYHJw== 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=VG5O+g3KxLuipuONUDPb41m5EhcsnGI3640aLEavFPg=; b=CRa25eu08BmC2QcMSn6CX2eOxn5h84URSMWxKNTcMrap9dm05cWsqxicRJ00X3m12dpxoF4svNXOAaJldJlkxbuFqUttl5f6JtHFvOGeeXRMfwGXZOwVA24f+eIAd/Z+Izjf5Jstd2mBTQX5jsNt/mAxvJGW6zPeC0fuFYbrPRH/AVz8SE+tZ8NLyf+nX3BCSZIh7piGiDGJqkQMYonVdBvbVbhivlPms28vMQMhOlw134CIJfd/uRAJE/0WrFJRdKESQZdRTLVUVqSuS+JUQLiByfDDnWsIq6os6qg7JU45h7PSb3tD/hJNeS80tIPmw0FKh/5fbz+MzMUYkFfmnQ== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by CH0PR02MB7946.namprd02.prod.outlook.com (2603:10b6:610:103::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.24; Thu, 13 Jul 2023 10:57:34 +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.024; Thu, 13 Jul 2023 10:57:34 +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 v8 9/9] migration: Add test case for modified QAPI syntax Date: Thu, 13 Jul 2023 10:57:13 +0000 Message-Id: <20230713105713.236883-10-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230713105713.236883-1-het.gala@nutanix.com> References: <20230713105713.236883-1-het.gala@nutanix.com> X-ClientProxiedBy: PH0P220CA0014.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:d3::28) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|CH0PR02MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: 90337ac4-3681-4180-70c7-08db838ff61f 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: ZHcfx2JKqk8W5v3qAYLlKx6pqFzrW7Af/Mr8/FnshBSsnBZLiwRWDDM3xrtaVXK1PaSnkRVPnJCMEMiaWn1As6z1bMFvSieWhSUL020Q1rAQO7jKi1/KE/VXxyHq4HirqZzSOp32wXlubTRIBd9m/sgjtbQatkh2V+QyvO4ojSqS1ir5Mgc+M8q0A1+zdG79/MUyteVtwcplSYq6pfw15Xo4sRm9lhb00BfEM9Yknj0qG1X6qAoV7AxBokPvmQE7NoWgST+aU7tMrU+iSH1BfUXT+wdgbDrW75HoFR5Bn6tkOJI9hA9hpE8Z/9UZGXswacR//ainj29Q9B2SmhFRZKCrSPzC7xyP5fPra6Xu8DQTnz2FXePxn1SleRnjET+hCGLVLSVD7vor4zmncGVZkI1zHDAFLgSeS32lWCztm3MlgGLpHKlqBGKdFuMzwvksDd7Vb/hJLXS++Z7kaX8UaiWd9ZE3s1QmKGKbw6bQio6Fb7vv97CbKB+3y4CsHiTHOlELs6c7gXhErlyZOM0zBlQa6wJ7Oyxrxhpw7TW/Ds0qXBmnIhRwMtqorL2MA8PiKDQiT/4o6QZZZsRzJ4GZnzlRjSHWscfRD1M9U/0J7JOmoVh3iSutsX8Dz1ES7PZm X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(376002)(39860400002)(396003)(136003)(366004)(451199021)(44832011)(5660300002)(8936002)(66556008)(8676002)(4326008)(41300700001)(316002)(66476007)(2906002)(6916009)(66946007)(6666004)(6486002)(6512007)(52116002)(1076003)(6506007)(26005)(186003)(107886003)(2616005)(36756003)(86362001)(38350700002)(38100700002)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: satuC1nbP57CGOPSGJ0/0+RhcbKZ4w6v+Pp4PY/W82yNVB4P0gLEVSi9p03bRTla2rkLixSfp4j+HcVl9TWRybYwS2G3gGiR8MxMaqk6o/XePRuk+NowcaY78amLjw5jY7wdjoo3pa+M59VN/LxKiHXnZcMkZa3R7ycuusWg1HGF6QOCRkidsvIoIw/Mtq6Gpk9LV5UxAPwbZxvne7zjMWq4gM1SBOi2GLebop3IZ1lrC9D5aKGgG2uHgpJzrGL3juHSKXCPd3TN2YCxElPrpbnUYg9501Vqzz2MGAHUJIfnfeux7OYZvjuN9seproJq6ugXkq7ZyKdQtGRMEX12PPazGtB7Abu9LuQZB3UTFv9Ltt92SQuHr2VGuGgeUrISStAT1rQwu2jKTI4UjbBAvJ0Q+34pC2O/Q8sTEwmgdOLwalSeLIZzZ5Z6ci8iVjGo2C+WL+7DQYu8xRkLYof+n21RoOeayHtR7Y78GTEANcwPRGVoeVyW4cKxjOhnRbiOVpY4D+w0Vc6HB+7cfTUq84FQl3Xl0s4I8miEOOxuggSDf46YrEtS2SjUrr2ZVhJhJCnl3BezwknaMqcxHSW3jjwrBO4louvIsfiHhcOlsEBxS0KTniKXS49kt5MJBm51K60PJXFqdsbXeCONHw0M82NM79zfbvUqID1MueeW0h5KDSsnIxENo45tbdTBSDHaNlYdRcqLwwJePnhrIMiN3x2+lT0VNudYiMqfDtEqISgvEe2kqyB0zTuCZKoMX+hXwxvi+/+u+4L0JWRbmwKmkWEG0Tb85q3qXKJzPQBf2hD3XzZQrV/5KkFrSLFOFV5D8wi4+gPKyP+8qblp01libj4GyfKkuJZzKTQTnU/b6kFhVMeILf0u2MYd1Kxnq9/HsbycBVwyA4gOkI21Al8AfF9IKqzb09tv7m0ReWCPFsDzBmELwKNnhrsidS75ScoBPhfDBhNvxIY1UNxyrJqfPTPx84j764kyxZPVv3+C5aB0DEdijqTYOaaX9yqSjxQT2vI65o4zouRXFCWYdC5uNjbwIkON2391LsfVjMqRGUOLoEB3qIybfny69k0E8Gje7ibfvhpk8LS+z4ig4iteZrGH8QAGDxJb/nnAjj47k1kIg/QY++i5neSW5PJqDk7Ku2aNQtpvENNiy1QlD3+lNAB/0Sge8VXfNjZpLGfdDu0u/NG+JG6FQaxf/xDZOJ1faF5I4IJAOAWc3H56MzmyMFHCOAIm7nlm3AMv9H6QXongMqSCwLlHSbeXaBsa2nBpY8hAXLuDxfS1jQfYYjqauTBDkd3pHvY15rimWGQMDIuaPnUKnNi+l2VVAnSAqMISnTO8D0RAY10fOkFSSXIupgZFwDctCcCLiDUQ4KDH2NuataN5A6eHJPvkzrycX5Z9EKcCTYxS+QORUMkxwxg2cXb/q+xI3QnQ8sIgsuSVhrEu/pHOgCCfR0Vbej+/zAKT5xXI1+96tc72f2Ps4EXsDpyoZQcett4m2+TyAsLDsGuN2dmgLmE0D0Qvzwz3zyB3xs8ZcVERsYqkaW0dLswla5t7mIFpgtDAru03ktPqmhBTzxRjJuIqcOINEE/F8vA7ZK+Dif97rtriUpJWaHcGIQ== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90337ac4-3681-4180-70c7-08db838ff61f X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2023 10:57:33.9691 (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: jNB8QZUieOwsRu3P9sq2KXvoi8KMSNZH0vyy5X89JXI/SW1IuF7XIjw+mTHTQnAZVAThGiagVlkBE0eWZFdkBA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR02MB7946 X-Proofpoint-GUID: VLPYvWvP2vlfSeIzICskvDiFD7UER_VT X-Proofpoint-ORIG-GUID: VLPYvWvP2vlfSeIzICskvDiFD7UER_VT 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-13_04,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add multifd tcp common test case for new 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 efa8c729db..786e6bbe8b 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2190,6 +2190,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) @@ -2197,6 +2223,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) @@ -2228,6 +2262,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 = { @@ -2916,6 +2959,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.