From patchwork Wed Jul 26 14:18:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13328192 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 BE49DC001B0 for ; Wed, 26 Jul 2023 14:46:10 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOfMO-0003kX-Oy; Wed, 26 Jul 2023 10:19:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOfLt-0003Nf-PD for qemu-devel@nongnu.org; Wed, 26 Jul 2023 10:18:58 -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 1qOfLs-0001Bz-25 for qemu-devel@nongnu.org; Wed, 26 Jul 2023 10:18:57 -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 36QDA2t7003674; Wed, 26 Jul 2023 07:18:54 -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=DroMgIIs1Plyl/97uQxKwblK2nl2ndcV7NeEK7PMd tI=; b=zrmgRHik6cpTOSbmxCGz5/rUFZQ3Fukt/3S3r9DCeqsPqv+fxEgLJvCmP 8627VR0Se9EQ+n/0NgmXlfaZ1Xv1lJEK71YQpnrg+sKZWQC5Cl+NzYL5TAHNNUEb dOYu6w5bBiCIR+J9VECUbNiQu1042Vbf8YWE6htIBv+FpnyZ43p8UehPrr4C33eY QoD6Czy/zaEyXMssGRsxnmjIV16b18m281hxL2bwlhjG03PrSJsGsp8pEyhcz9HN gUqu9qeh44SIXT51JFG8qEdJ8B1PUhpC0rIMz3Mb05ZKIBJmI+XyKQOYCb7ekGtT RkAujYWc0YS1RphMRz1+iX0qhKWVg== Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3s0e6dfyrb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jul 2023 07:18:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AjrwmUZAE7A/jH6zaZpqlbpczzgZuJA4U5u2yHxvtuYFure+ANGnWDGPh9H87IWH/p+j5R+vcfPCAVVWD/al5lpf4f+L6rMB33ZD3YmnhYiqBcHeUjpPfGPHMMmm45ilRXCoys0MG3WLFs+9c4MVK82pF/EN6xXPTyUcPDknAYuaq39sqORzNSmdevzyZ/lHJ2L2bYbH0Rfs3DvCKBuf6rEENPKY+KXjJ5NnNCgaGCtQEUGpSt4jA0b8T1sca1Nr8O5i8j6pOCvEuD2Icg30yGcQeq8Hnv4lCF5oJPs5ABvpkH/i58PTT1E23mZclTNSbI5mQAgCJUWY7j9Tehhm3A== 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=DroMgIIs1Plyl/97uQxKwblK2nl2ndcV7NeEK7PMdtI=; b=K8AHufyvdS2tCzYf7JGznTO/B9Oqk1pX3RreGfOBi7y2jSUMNrYSdSURIoDNsEN5oVG4M6A2XTetJX0qmYVn1De4T2yWkdjF+YipC47/AEHE23Rz9bC/GsJLP4yK/c9Q0IFUPKrx3gJ/2aALNflW+5CrQ68/EPPWIJI/mxTI9xbxmo9gP2kbC81QUWkiOb4Sz5u8T1zyoQHOrxNyr0ajCAGc8Y3yT+8i228V/vWeBMb3u6JlLXTC4GAI9garj9Fy7ai/WDCXqGvJJaU+v7EI+0F7aX5KNu9EmmOlijMgmO0yE607qx0ZUhnlo3ctw70fPWxDtF9i/7iHOcooStAiuQ== 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=DroMgIIs1Plyl/97uQxKwblK2nl2ndcV7NeEK7PMdtI=; b=F21I+RZYGaW0G0vYgkwZvrYBXl52ybKChKGXSzb+51GP+FmuDjifS70v6CmMD0JpVeolOMwUSrBROxl8bajY5Gn2pW/u0MGlmmh05pTTeUzgOcCam9FP+i7khrr0+h8dYcCV4XFQocThF2rFqrBTASibOTYdv2v4D8ge4h0KgDlMgQvTMWtBchTpNr94f8Ne4zt0u9HziVItpYgGhf5VWOnKTcQh4dOT8vGxrlYrjs3zgNG6IrcHx3pAIVgU7mCK6BwpXLwjkh0KXqNNW1EKW1qYXB6AQbSbXF06e4mNbYWi0SjuAjkbknZ5QeoyESBX2TaEz1kix2FVlyXNxglF8Q== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by MN2PR02MB6861.namprd02.prod.outlook.com (2603:10b6:208:15f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.24; Wed, 26 Jul 2023 14:18:52 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::2c:438b:2b97:26ad]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::2c:438b:2b97:26ad%3]) with mapi id 15.20.6631.026; Wed, 26 Jul 2023 14:18:52 +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 v10 07/10] migration: modify migration_channels_and_uri_compatible() for new QAPI syntax Date: Wed, 26 Jul 2023 14:18:30 +0000 Message-Id: <20230726141833.50252-8-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230726141833.50252-1-het.gala@nutanix.com> References: <20230726141833.50252-1-het.gala@nutanix.com> X-ClientProxiedBy: BYAPR07CA0096.namprd07.prod.outlook.com (2603:10b6:a03:12b::37) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|MN2PR02MB6861:EE_ X-MS-Office365-Filtering-Correlation-Id: 40ab9df7-f821-4456-3fdd-08db8de33c73 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: IGRo2w8aw6PuMwuhD/30ir638w/x5HxMrSSr+iUW5S1lWTlii/MRdo16HqEdcMbiQqNXwp1YwrPE08WtnUEIDy6W8Qsvw4QHLHRcIqXIN3K4xqwdwlb/xFQhkFgG+3/+AKEvlpKON5g6Ux6lPaAAmCeCcpWr+QM+gsOGeSqEsr/Q5bMY3PXoY/7fb0SooOikj1p3AeNDjvZDkL2exB03GyMQ/yTvguZRpBTDz1g4cLtLWl5uS0ZgsOADDSLIjo3qdrjEKR1zwmZh4g+YQxvsEdxVCOwh4hWCA7nA9uuB+9eSLjEHbHjUsUBW8Y1TT9kpY9629RDgH/lr/Rlo9ncniefXFouI8/mVQHi20Umah8nqwcRXUxYnHOiTYidUZNfxintia4gr3/8PcxPtC1QXPbSetrhLBR7xA5svUkUg7sVI+lGC9TaVWJd8Bd8eBLf8LmruXTXke+u8u6WGdi5SIfxddKaEEnwJo+/q2w+9iL+ofpApUg7LYMvvEjkQAXiCCNRbqbPc+BXA93RG6gaLG5M2e8oPtVQYwKz0RZR2Rfw1HZgc4MEAzwIhgpfLNKi60t5tJ2F697IiDzrXqeNxbZ1sEeSroYdl42EmljpjiVSYfwOKgzXJvdXFnA3K17ud X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(396003)(376002)(346002)(39860400002)(366004)(136003)(451199021)(1076003)(26005)(38100700002)(86362001)(38350700002)(6506007)(36756003)(186003)(2906002)(44832011)(8676002)(8936002)(5660300002)(2616005)(83380400001)(41300700001)(107886003)(6916009)(4326008)(316002)(66476007)(66946007)(66556008)(6486002)(6512007)(6666004)(478600001)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?T8o7OIsPqDOpIlAR7YVy784Q0QrT?= =?utf-8?q?8YMuJpVZnIVN8RfNn3PSBLtX3lqE45NbQ71+II8a3qQNDPHJjPx8Rlb9VXgD5ZIiM?= =?utf-8?q?V+bOX/V347yB8gcq+LR3B6p2xPGPPL0QNNiVLwXroFK1Gq0VK4k57askFSAlMRQ4c?= =?utf-8?q?Vknb2rKC+OLNtg6ah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iGYX90XD5RX1WAcSairQxDnxM5VYplMkKLEtt?= =?utf-8?q?oscPUzuMn+0fdoEwIfw67Qzc0JF1mrvKb70mZd2I7/nvUISLdCRAsFXewy1tTjxL9?= =?utf-8?q?dCWyvbxM/aAJ7bnINlDW3rbHalO47J5/UwP+oEf2jVXnjbAnpjNRBefmhjmz3SdID?= =?utf-8?q?bhEql2LE2Th6xibrnGbhr3bN4ptf5jao4aVCh/6mSpEd5/jOqspfQtNSsC4BKwXHI?= =?utf-8?q?FCC1iEFPWjUhpE0bWAqnPyWF+4vB/MydHawvGk+Rdwa/FZP1wkjeVRISNrySRo/eS?= =?utf-8?q?S87Hka6+P9Psy1xzXDdI0oc5o8VJ2CT94X+6gRyHwTN+iFkEgA0JI8MzTLQznNADE?= =?utf-8?q?ivlxlmBJ5N9kV4P5ZoSLa3T81MJZnnpNe7QyL4+KFKrR+POqwzaI6Smpiw/hTKJsp?= =?utf-8?q?SYOaC4PRa3OYvOwLsGgeJncPFD2nZfYUcjazE9P1d7GNrf41XeAoYw5Rq6PbdRf8d?= =?utf-8?q?dn6VdeJ2jXwuyNp0Hhf6Y+xrdoyZapX8bQ=3D=3D?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 40ab9df7-f821-4456-3fdd-08db8de33c73 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2023 14:18:52.4319 (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: PQ7hh8p9asmQs5yrGlPPRpjBAh3Z0+1jPeJ3Lb4hRy8sE46RHX/ImCDmwBm7prMNmukYh8JOuByr0WuTXayWlA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR02MB6861 X-Proofpoint-GUID: DGLFepSkHKPhG7YcIbpuj3VPGRpkKQML X-Proofpoint-ORIG-GUID: DGLFepSkHKPhG7YcIbpuj3VPGRpkKQML 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-26_06,2023-07-26_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 be8cdf0fa5..5720c8ed4c 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; } @@ -493,12 +496,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; } @@ -1740,12 +1743,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; }