From patchwork Thu Oct 12 15:10:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13419369 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 68213CDB46E for ; Thu, 12 Oct 2023 15:13:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqxLi-0006SA-Tn; Thu, 12 Oct 2023 11:11:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqxLg-0006P1-Vh for qemu-devel@nongnu.org; Thu, 12 Oct 2023 11:11:41 -0400 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqxLd-0003gv-Vx for qemu-devel@nongnu.org; Thu, 12 Oct 2023 11:11:40 -0400 Received: from pps.filterd (m0127844.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 39CAbVNW017937; Thu, 12 Oct 2023 08:11:37 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-type:content-transfer-encoding:mime-version; s= proofpoint20171006; bh=hLHnoLs2k8XyCKqL59yZ5EFsIqg3skKlW79vxSzXN 3Y=; b=cjIrYapUUVio28Z0gVQFtd+gjhwpZPhiQO4ZnHP1qbHYHUdLejqW9bON/ Tqm9eP+q9cxO2kuEtY5GQKz69dXUB+hCxZow6TkJzI9RYZTFwr24UaXEN46DRXV1 wP2SO2s6WHS25oDIoKabrZrYLAlOkL1Han5D/DjbTaXzquDAafPHrbyxEhvMfray 82Q6JUZj1gvz+m0ykOKZlWrBlHrIMWo2y3HdfNYYd7bLDOAbqwHmGa362h3Q46HT OIm5I1c/Mz7MP4FEoSOfvmMZVDzZhxD+8Ij4/rx4qttw0/3LahLfapWTd6xk5wjz It2npb08mFUSpqcvbEKYg7KBCRvlw== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3tkhv0bhs2-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Oct 2023 08:11:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ab+gNRqB1TV9OfeBoXRYftaqleUTEsVRKEBgTyJT4rZizGzEB1Fni0FnD8aUHwViy4gVzoA2FDF8tpvFipXZhsRwFgnBIDS/QD9w8zL26Dk14HT42q9nEv7TqsSpUBHa2TCY2Hj+RRyJ6uGCKBp2vA7hVUlNwCbgP0p9V942S6g7BjGz5FPW5fYpxP8lmqnsoJ1VXbnBDJ7dETSijgxhSdG5XqrvTTfSPrZ26Y/zghj+1Ylny6vsicIP1e8fDmbrqWHwz1+EXNiVoWm53m206aUPakJ8Vuv3eqBIJxixCo85GBqifdDRSEwjVcCXVYYp2nJms/ow9rE9RqRwQw5MlA== 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=hLHnoLs2k8XyCKqL59yZ5EFsIqg3skKlW79vxSzXN3Y=; b=UwTZHpyhxKcmAWxmWQux0blGdDcbv9fy3jejW2fjVEspk3QSS9wPx3FbahJkhCoCFIhf7yuzJc7KkShevWAsnhcLEu6e/8vDFMR8WgbKfqTrwrenP1Rf/I+oboQRTl5M6FTTuoNjT/ugLwI5wYOmyR/wfw9itzIh2ywkxxO2zTep92IrExkmgMu+6j4mcmFGZzjDIHxUT1kKHrrMTaF0qIITwljOEh7OfNhi19wmsvMtwm4ScCnKC+XY/nOyHnllmcUEL/KbUMK1pLEmPZvEU+Tsssl8KYh58FwCIYrXBWZkf5n9CSWn+lZoGJ5VrWm0h1m4Y6Ek8lMi/zTxmC+g0A== 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=hLHnoLs2k8XyCKqL59yZ5EFsIqg3skKlW79vxSzXN3Y=; b=GmRluPs2RSyTCigw1foWwJyoU5OZtJE0e+Uc21/by+18EIGGxuLjmCr58V3CtXTysFibuRyl8J8Ot9oeVJVU+tdLLuHENRyAWkSx0kpNnbxnaYcaL1XzuvXPfufaWCPNdsJKVOA3dDSn3+vQ/Cp2o3mGt9hXwPGhi+PJHm71kVQVIhFk/URFZbYrVc43UW0h0nSfxu3BtpG8HRKGthtS0tRq5alI6GiHrNAxJpfutSI4UmkpUsKAXIpe4EP3bmopJMx/LjMzfMGKeDgBfiDcbBt9tGCYmYsGMXo8AaUMz040knnH/NmesrC3nEtIUnFDRKZAHUxYp9DD4ZLTqpqU7w== Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by IA0PR02MB9510.namprd02.prod.outlook.com (2603:10b6:208:403::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Thu, 12 Oct 2023 15:11:23 +0000 Received: from SJ2PR02MB9955.namprd02.prod.outlook.com ([fe80::f13d:ea:118b:b4ae]) by SJ2PR02MB9955.namprd02.prod.outlook.com ([fe80::f13d:ea:118b:b4ae%4]) with mapi id 15.20.6863.043; Thu, 12 Oct 2023 15:11: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, farosas@suse.de, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v13 07/10] migration: modify migration_channels_and_uri_compatible() for new QAPI syntax Date: Thu, 12 Oct 2023 15:10:49 +0000 Message-Id: <20231012151052.154106-8-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20231012151052.154106-1-het.gala@nutanix.com> References: <20231012151052.154106-1-het.gala@nutanix.com> X-ClientProxiedBy: MN2PR12CA0004.namprd12.prod.outlook.com (2603:10b6:208:a8::17) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|IA0PR02MB9510:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d6d7cc5-52e1-47f8-b7b0-08dbcb357f46 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: UgsZrFY0K+T1aAi5Pg4tN5AVSkgHAM8RA3BEmb/VyXDkkxjDM1bVCup/Y7nYRXOMKG7IUSScR32O7tq9W2hQ/XFEQHU22UHnrj4bhmXdg8Rr68zK0NYR5wirelcwDNlXI7auesJPgGQP1MPcASF/QXdGTNKDaklSMxp5Zod0yjBN4Hu85DSeILRxrwj6o5qiHZsi3AWgiuH8V3VCqzH336fliPFfUiftCr9ExIrDXGt8n7xzM97JASZklXTlqP7UnzoqTnOdEOPIB/nW2EfGQK0FIuvKkaFd9FwNyER5+uQ8j93Ymw0ONfgbwJwS9pGdwRUli3YZGEhn3p0dTx/2Fx5N+OMU+bRIAcZpvboay6k8x7ffYe2T+JvEA+E3dwzuRBmBuQnFXNZ0nsSGrdgS3UecZQZdGCC+jAJoptSuKjHQdxx5h6Q2ZcMZ0RguYaVAWpc+fmqasHhYJ9bOFLEfLmGli4zHOWw6Lb/fEgy+B1GXM/D37yvdQqbQX6hYRl5kkQA53Ry3LANGfiFq7dhP/D8I4suOuEPHostNl2LVGyJtfWKYbRLXhp8h2Pynvm6HH3jH1X+vf6gU2/umow2sG/NYgX67n5xijx8radifp+MikXwojk4lmA0TnyELDcFf X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ2PR02MB9955.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(136003)(376002)(346002)(366004)(39860400002)(230922051799003)(1800799009)(64100799003)(451199024)(186009)(6512007)(38350700002)(38100700002)(26005)(2616005)(1076003)(107886003)(478600001)(6486002)(44832011)(5660300002)(8936002)(4326008)(8676002)(86362001)(2906002)(6916009)(316002)(66476007)(36756003)(41300700001)(66556008)(66946007)(6666004)(52116002)(6506007)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Ht7NHO0PIjqgUFS8nU5zmhxTSPD1?= =?utf-8?q?8ha8ZZv7/2O8VqiqMLcMZ49oqkHj7zK+Dty+iCuPhXi9VV10i0RKyd9YYAqqw6HYn?= =?utf-8?q?XQM3TFUW1MIEPDzpLDLQBctsRCU/LhmG0A8blMy/t5u/3g8uB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nyp7k5Y?= =?utf-8?q?1twMDtRK9PfGjsN3mpsZiBWuO9kOYF3ZMxv37/CgWlQLvdifHdlh11obTmZj7HxnO?= =?utf-8?q?aw4ACrv/AmXSgequ+BVpbHej6vpwe6uD7+abf3vRZaikFkxBO0mK0xAER+P5VoBjD?= =?utf-8?q?PmCFfLKiS+oQbJw3Dn8aj7ZL+h6vOGLrX5vbTQQQF525ELnzFQMRKh8fxQAG2yL1g?= =?utf-8?q?uB7piN0cVubIKRjOjZORgrl6yy8b1RKBmIwSFQzx5LrZTRtoXYcE8tyAQUrkH/ExN?= =?utf-8?q?GAAGr1niEGZlRHo40MoPqExjBZ5CF4695l2twBRawHsaiQ5iAzicXBioK4SeHCc0H?= =?utf-8?q?qcTbFyKa5r4R/edn+Ky8hhKS8tcdOlhMcCqoHrR29EAucpZIdIj7rSsFMV8KybjmR?= =?utf-8?q?psNF9yacZlhooJ5i0pw37+5RWQKDUJKqvzXRk1IybOBX/a6nm7tYFKN63Bz1fHNnd?= =?utf-8?q?DUJC5X5jnJ7PLsYHqZCTs0VVS6x0DocuJdTFj3Pzb/yXVnrhbSCmc27nVcAiK8Mnj?= =?utf-8?q?UWbawkOiGD1/?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d6d7cc5-52e1-47f8-b7b0-08dbcb357f46 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2023 15:11:23.3775 (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: LQbi70FF9XGX7/4uLXe46JOIvv/UrWwFDXvG9thayGtnz2d3FdHtg8favtz4dnTH1fojJMe+o2skxLqHe3YJDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR02MB9510 X-Proofpoint-ORIG-GUID: _JwaYV6vNvJ7qcyLJBJMfp92NRZ-W5xS X-Proofpoint-GUID: _JwaYV6vNvJ7qcyLJBJMfp92NRZ-W5xS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-12_05,2023-10-12_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 da50b83e5c..cf5a620c8e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -107,17 +107,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; } @@ -503,12 +506,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; } @@ -1788,12 +1791,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; }