From patchwork Fri Jul 21 14:49:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13322105 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 60AD4EB64DC for ; Fri, 21 Jul 2023 14:51:04 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMrRu-0003CR-76; Fri, 21 Jul 2023 10:49: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 1qMrRs-00033v-Cv for qemu-devel@nongnu.org; Fri, 21 Jul 2023 10:49:40 -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 1qMrRo-0004nh-ET for qemu-devel@nongnu.org; Fri, 21 Jul 2023 10:49:38 -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 36LBsHB5004497; Fri, 21 Jul 2023 07:49:35 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= from:to:cc:subject:date:message-id:references:in-reply-to :content-type:content-id:content-transfer-encoding:mime-version; s=proofpoint20171006; bh=+6llMYzHdp3fRPNmOAVlmXSqEzZSuuZRAKvWho 1eZlY=; b=UQEIgVPLh4MZD2g/2FsKwHbB6fvcmtf9zyuvz3W0AbyJf3M0lD58lH fMmb9Edm0wasP6WELesSfYVFUnFGnywfMQAFF7+5CEmAFDnu6kqB3ZCbAxDLrfrb +j34KYb+bctKIjBn4hLB9hfOBhpLeVjr2dF0enID8zpnHisFwzHI8/UqWGxqepN6 Ug2b3ZzfRiVHFyn34MXar4eftnw+7USYITNEc5tmn2ECeIRGLiZnsyiTi7JZr73w etIJsFcTGAB0sw4XsPO5njUojnfZgawBuB0t+XfHcTMqgkRMLyTPoIyyHlRzDEkM iLaC732GPIDSz7iZeY/iRv3p+Ndm6B9Q== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2107.outbound.protection.outlook.com [104.47.55.107]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3rx2jdejxp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jul 2023 07:49:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B9euuYND5wJXb/54Km7hif6LC/TYdLQ0JtJbpMEx/v2g/fRcTbYCTkk0U+2F+2vPHgkiciBOa1UwCluVlRWKh73Jg8BARehDZQePci6ZLbJhCZdOCin8ntO+USBPlxtYNIiMVl4viRsatg7BukTtVOTu71hPNgb8+fSU2xvk0myROcJrqPWhmnLfnehqmG38nhDA5uK9KC6XNL8/rlZP86F1+M5S1vtvBdMRGBGEp7uA9JDmA7XLTOwdSZPdArmK1mV/3lj8rbXAQxT/kdckPpMV7FQvKQVhbDisykMwMd8ntIJ95IXZUK4dR+/aXz4sXYNEKJ6so3dCEwhsuuD23A== 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=+6llMYzHdp3fRPNmOAVlmXSqEzZSuuZRAKvWho1eZlY=; b=m77bM4PT7CZHeCR1ChlzJeAL4U1NhSNrlPHVQS+1fceMZbWkYVmEQ/Lzg2YBc4l6NT/QGl+Y/wa3jWMPxbmY2aaMn2knOdIE/KrmG+5q8XlevtgtwKRJmr7RVvaYee50tvVf4K9akb44sdBNrPWmoNiz6oYoAVIqIr/T4m47r7ZRp//jCNpF7Np7ByXk6Wjrz2IyD7uSypMjXoh6gJ4bAbCJGTZ37ye3DlK4NKdJHGMByq0JW2Haakx/4D8FUOdDmrSOmo51zf1Rgenq9XVIA3he5fqWqXkR7J3Uo0/3SLva4lhQKPFZQ5rosd7Yk3pP1LObCv4MBR0/Rw4Lyz2QRQ== 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=+6llMYzHdp3fRPNmOAVlmXSqEzZSuuZRAKvWho1eZlY=; b=YtsBwLijOoreVGjyyhmcCyQYt0BDMuB00n7kZexUQ/WYh4At5Jq/U/mAB2P6PXLYQAzSKTIfBHr2aApolIbUPnLJnd1Mm58INz9naKNQ+t265MVA44Y3eSGJb/8oYkTULkuPuTQOo/WHUwiaXkVgziFWpx2jkaeKyq7+yhTu/8TuT44gSl9R1k2KhdxIxnoj+IJW6/+58sX5iELk1My2/4/CiEg7mulnuCOEGvao27JpzsJiihq5KMgrOtkVz9Swizwr7q5ubrnkpJcGWXwaCFtQRz4Ey7bYW3mJTNPMqgHNJZKSozNS2kihBjQzcBMwEdCpx9Nw4OZkohesu/CKQQ== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by SA2PR02MB7561.namprd02.prod.outlook.com (2603:10b6:806:140::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 14:49:32 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::89a1:d75c:813:618e]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::89a1:d75c:813:618e%7]) with mapi id 15.20.6609.022; Fri, 21 Jul 2023 14:49:32 +0000 From: Het Gala To: "qemu-devel@nongnu.org" CC: Prerna Saxena , "quintela@redhat.com" , "dgilbert@redhat.com" , "pbonzini@redhat.com" , "berrange@redhat.com" , "armbru@redhat.com" , "eblake@redhat.com" , Manish Mishra , Aravind Retnakaran , Het Gala Subject: [PATCH v9 07/10] migration: modify migration_channels_and_uri_compatible() for new QAPI syntax Thread-Topic: [PATCH v9 07/10] migration: modify migration_channels_and_uri_compatible() for new QAPI syntax Thread-Index: Adm74o9RITolK2NQX0i65VwVxFZA3A== Date: Fri, 21 Jul 2023 14:49:32 +0000 Message-ID: <20230721144914.170991-8-het.gala@nutanix.com> References: <20230721144914.170991-1-het.gala@nutanix.com> In-Reply-To: <20230721144914.170991-1-het.gala@nutanix.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PH0P220CA0028.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:d3::17) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BYAPR02MB4343:EE_|SA2PR02MB7561:EE_ x-ms-office365-filtering-correlation-id: d016f1aa-8665-479d-bbf8-08db89f9b1d1 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: GsPet6oerRMtPDK4rhhJxVJu+OdI9dBsPVr8cW7Fcl0Etar1ygupeJtjSzMqk0gCca6RIMzQR2et+6V87YHOI7XFK8/YURl8pdRqnHI/rYnvPJro7sqjuIb5j+VrAhcariwYK0yec/hEIItGheDOqlnGar1SkZ6fruvXwYmyAL9Nne5p2OIKtYE6RJj6VGrkn2qsetPFXFc/JfbPYZUn9DfV0IgANU1EDRIFa4LePQ+WywcdLorIEkb8sQs0j4x3PoVLAFzpUDbQ0QvuJeMebXsJypBkluaQpXdrtMcdkZK2esSqPmU1qHZAgIw0wvAIPzxKaCZC/FjJsxBiiFho5HQEdwp+1rMD+sBhZdyemYWAMdJrO4wRRof0NfGC+GsFiiotw+N2xCGhqprWwYrZfElzmXOlaQM/q/4xZ4Y7w7sTW9SpKHDMRMpzAdeDFVJrvhvM6hYc4kQ3V4hz9bFMWu8zn8dHcEem3fOcJ6PjQDxBweHyefCqxRhtMpcQVsRnkZdsJsyyjnXJw91TDz9jIw2J5CRh4akjWjRoxqoA5B2eE6UCHFsdiYsDk1cZLgmLMS1+xSp6yrg5rSY0oflF5L/9rpVmwdKgijla6LDBta+iwZbKhA9LGkRIWe6/bQZ4 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)(39860400002)(366004)(376002)(136003)(346002)(451199021)(2616005)(6486002)(52116002)(6512007)(71200400001)(478600001)(86362001)(26005)(1076003)(107886003)(6506007)(36756003)(5660300002)(4326008)(44832011)(6916009)(41300700001)(8936002)(8676002)(316002)(2906002)(122000001)(38100700002)(54906003)(64756008)(66476007)(66556008)(66446008)(66946007)(38350700002)(186003)(83380400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?MTK8nE2E/3atZJV0Ww1/uL2CeWUl?= =?utf-8?q?jluOfvPolr1CLvVHWEuhzdrJEtwKPZhV+HlMq4UV9ouTbTttO8Be3e5/ThROZ2T5a?= =?utf-8?q?nwW5W2HVh3ItHkT4iPHG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dTpQVMg9LRykPtE+zXclSUHFDonc3KxiaoDkMA73s?= =?utf-8?q?GSS5Dyo3QbQHYerfHczrRMe+uvuR1fLydTXQ/be6gymShuE3hgBlNXBDCUpOENK5C?= =?utf-8?q?77mO4+/j8PkIkO+5wMhk6qm7b4v1+MHDuIB6x0/d9leKvaSe8u34UVJdG941VAvcA?= =?utf-8?q?M8D6G9I7oHV0KaIUzVkK/aisEj1cl7+cQVGtXEjQ2OmilT8MVfM2jtlGqkMlR9R+a?= =?utf-8?q?OMw6wXxUNLZCxb5sIf/Ghjj9drx2U2PZT/uy62fw5d5OFOg1E6Pl2vnbwdb0w6gsb?= =?utf-8?q?FDSBlz8w2oG1fsfHlLknPB7vUI01WtEg24dj9HOvSZpkbJXJHQli7OOUdQMD9O9f0?= =?utf-8?q?Gqrn9m5RrpnemFbN5ehocWdDxFxkv9DCw34y1TFGuQO1mok1nZuDtQq4wdp+ynb7b?= =?utf-8?q?FT/XL9uVzjGXDtwYYnT+FYkhTDQnMAbVdjJ25+1LkaXZVlGQiawQ6hwQ9ehjOjw3I?= =?utf-8?q?5VNLuDAJnnXJ2bqGp/lIeuOTP1QZzm38LwIGLoK1iyaKE3GwHaPUz4gqjvXPJfSAf?= =?utf-8?q?fCv9lzAVpg2k7Ccb9DX/McjsnRb/0FIDgQ=3D=3D?= Content-ID: <56BEF17733B02443B5D22A66FA38514A@namprd02.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d016f1aa-8665-479d-bbf8-08db89f9b1d1 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jul 2023 14:49:32.5729 (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: 1FXAcWOIN+XhDTjgwEqr6+5jTpY40y5Rd2O07oLMyt5GGXQs8th7kuZXWSZnZO07bcshdf5SnkgsOl6nmei7kA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR02MB7561 X-Proofpoint-GUID: iOEEb2QRFyG6VipJn9nsqwkI6usSDbyX X-Proofpoint-ORIG-GUID: iOEEb2QRFyG6VipJn9nsqwkI6usSDbyX 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-21_09,2023-07-20_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 bd3a93fc8c..6e0a8beaf2 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; } @@ -482,12 +485,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; } @@ -1718,12 +1721,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; }