From nobody Tue Nov 26 06:54:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); dmarc=pass(p=none dis=none) header.from=nutanix.com ARC-Seal: i=2; a=rsa-sha256; t=1709722297; cv=pass; d=zohomail.com; s=zohoarc; b=Qa6iXzvVlIMhestbnX5HZMKkrOaJggPCq+5td9rrfiPu9VDZZNvKVv1g7Jggeii0hmnLGNkF1Jv3duWiwkDAnxLLAJ8T5/fiCbd2GOgUhJ3WuHGmX/iuIEPMJe83+JvRkYx9zJX+NPIUbGIXD0YRWnvZiuLK6ezRX5nC98ZG6aY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709722297; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dje5I28MVmiUtcOmBA4JKLc1xSAQmSaRXgku8IbipS4=; b=LNZstkpXueU7yY7wbcAkdSeAWAPrXYqQFh9r90ggsEW3Q+/KCbrGWgzGh5/9cJ83kvViRNiYhzK64B1EnmgFhIgPkPV6OJ9NTz8yTBdPPzZdRFc/2Nw946O+XwqXXXSq62U/BHPJSutPeQ6Tgo4kJmR9tcBpq4wGI1nT6Vxkdmk= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709722297089725.9677642399288; Wed, 6 Mar 2024 02:51:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhor7-0006Pj-4S; Wed, 06 Mar 2024 05:50:37 -0500 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 1rhor5-0006OY-0W for qemu-devel@nongnu.org; Wed, 06 Mar 2024 05:50:35 -0500 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 1rhor3-0000F5-Bp for qemu-devel@nongnu.org; Wed, 06 Mar 2024 05:50:34 -0500 Received: from pps.filterd (m0127839.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42601p7S003955; Wed, 6 Mar 2024 02:50:32 -0800 Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3wm42hgg65-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 Mar 2024 02:50:31 -0800 (PST) Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by DS0PR02MB9617.namprd02.prod.outlook.com (2603:10b6:8:f3::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.41; Wed, 6 Mar 2024 10:50:29 +0000 Received: from SJ2PR02MB9955.namprd02.prod.outlook.com ([fe80::225c:2edd:87e:7cf0]) by SJ2PR02MB9955.namprd02.prod.outlook.com ([fe80::225c:2edd:87e:7cf0%7]) with mapi id 15.20.7362.019; Wed, 6 Mar 2024 10:50:29 +0000 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=dje5I28MVmiUtcOmBA4JKLc1xSAQmSaRXgku8Ibip S4=; b=xQrAODXWnDIw5oH0SmrfC7Vy90E04ghU6SekYXAkqEWhAoHXTTDKevt+t YKzQgDxU21FWPK/oKjR3zlwDp89Agqt32W3ao1WpuTAVi28cBkukRnbWKPFffozg WhGsf4fiDi/1WtKm4gX8tXOlJTM0/p5su/1fcdNqk/u1TxhP+uniD/b4GgXKotz+ Vi1Tm5lAyUlL9sRM9GPH2+4hnbE0lPLMDy1F1PUA+NbmGySq5ESYqphQvF08koL/ Q27XtzmVwnAEjjkJvpv0dhDTRo7scbxIZZTP/GKb/396Npa5eDKj0IgvmLVOEVL0 4/nQPi8yClD8keQlm3EeJPXGKTG6w== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vn2/LuW/Dk4K1v7qQf2t9SIVkAR3UAMVQNCnv20PaY3lJweV6ZmKiUQLh4E48bgOrWInYc0AupT/bD8uAjddUOfGMK7upK0byfxY7B7Fzc45S/RnMJ+Co1hwXfGPZe0wVSjfaSt+XbQjlVux4mGMO8n8G9wWLi3LiCiwWul9sGowm4uVH277wdsNwxzh+8lN2uWhaC9JgWq7ttBwmLqxGP2r/Lhi0wii/XqmYbfKpDxIX9Gc0DV01LRxGo4FJSJl9a8LjdBtVx965OKvijeOZW3rnnj77GRmhvH1NN9HFCJn6SXFoGHqYeDTJGjlp5AS2ZzVacE8dnxdCQCyZ9jEzg== 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=dje5I28MVmiUtcOmBA4JKLc1xSAQmSaRXgku8IbipS4=; b=EFokf9Jahmm6zHVqBLRxhyVrcGR7nULY2aJIgw4g5+E37YAbhIi37OLbuFLQJo7UgdmDNbGRR1KZzwA4eqyVK+UVVvHAv46di1DkLqPb9Pcv/IoRUMORMwhDzwgjivM+V2fRk5cuYnMxEUt00sjPGZy1xMqERQj4JGsYh3gQYKcZq2r81JPA0LoyxTBWlvue8F6WsyZI7SSB1H9hTlFQR5QeSu2RY0O2S3Bc1i0xGu5+1g6edIFvTUAEZ47okSs+rQMVEq8QIojqomPnkudoSZholXUuLZxu3Y73bKYMpb+elzr1VMarJAJIsQj+p2RT3VdSQSU823K+WfCShmSFxA== 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=dje5I28MVmiUtcOmBA4JKLc1xSAQmSaRXgku8IbipS4=; b=YdyHqvruJfu8D+8A/iZrrtWYhGGcjWN+Mur+UegRWcCVJbbwutAVwgODWLcciE+h3mrC8SzL4HH6iPuNGa2xdM3uRIOEeaDCRTfzEGY4+C+FR0oF0+5z9qEltoWBUvV3ivKlQVeg9e2bkLNIPafsFEQ/4tURoOdMK/X23qjHoxtQkJHgofbYdJKeT9AEnodf8chH2+BaxDYw/67C3kRixOmQALdCAWL9xA7SCvXhBP1TlKb0uJtOGZe9OF9P4XNfOXaqhA/XRlwkFfkhew0uAPdPDnKtm/elwmt1LGVzYvXpXAOAAnP5lZa0vRmcuj+U5J7z+ZORd+K0ndx0ZYv1uQ== From: Het Gala To: qemu-devel@nongnu.org Cc: marcandre.lureau@redhat.com, thuth@redhat.com, lvivier@redhat.com, pbonzini@redhat.com, peterx@redhat.com, farosas@suse.de, Het Gala Subject: [PATCH v3 4/7] Add migrate_set_ports into migrate_qmp to change migration port number Date: Wed, 6 Mar 2024 10:49:55 +0000 Message-Id: <20240306104958.39857-5-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240306104958.39857-1-het.gala@nutanix.com> References: <20240306104958.39857-1-het.gala@nutanix.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BYAPR21CA0011.namprd21.prod.outlook.com (2603:10b6:a03:114::21) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|DS0PR02MB9617:EE_ X-MS-Office365-Filtering-Correlation-Id: d9327cee-ba79-4c95-26b8-08dc3dcb3d4c 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: QF0i9OqgjLC8ij6M5bu3Uhrs97sNHg9w768oXd/QbQ5xWsr9QDH8vndU4zc442xNzpjR1M62O1Hw25C9J94JFxcKwwYOCx8DVZ/vTE6b4Twij9F5vBitSy4E3ar0p7RHv1j8WEL3X0Tbcb6pHjb8bpWFLEziJpEtqgJUqIr3OuwFbTjQtPNJ2xjQ58WK/tt5ysb+zGjj0ZGyRqFFtdvliKbeQIuxxE88VL+MB43O4REnKxxNh510uzXrGS91p9ri/cyd3QrLzgevoB45Q7uRSQ0vd8YC/vqHXuwpXcZ+LIpdH1jm+dWZdnPDWIHgq5cpuVCvvN8y/auENT1BSGzeRX72fQR4avE/wfpqytygvwwtKj51aO2tCbPKuYKJBqXGIfK5PnFoQPxz1ll1RQiWb0lp3PZ4wYIo82C663FQ0GhODwDbKY02W6oonj3K+iL1OTEATSKrqgCKLGW6S/cH3vsn7sQTVXc7DZithG+7IlCkaL+aPMCN7sVQqcMMgFrwcMYpeJyZGJAkzKxZcFVUMabtN3OUtG9183N05KROQNZzAAduAVYJqsmE3M2LAPsR0Y+p8TQeONQmHtyW0yKUl8nuEW/MH19H36dsVO1+WvGXb/SQPeYrb8uCbvtth6ljWxWpV6I1QDj6t8nkR7xz5rQ1Jm2Vk75woAeWb6+oDDINjoSuLhwoqD4aKFDvLRoSFbhNk+rtC/OlQf26tOqV5zLBHhbrVsBFzfHib63PPeY= 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)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?WCQ6xAmrEPsSbSQ5C1n+ElicZ44ZBSS2REFMP9kM32oBIkD/p14GXRfGcs7c?= =?us-ascii?Q?YioaVmjKy0Kr4TBELaQdQ2Hx/kLEi/ygFjOW9XkHkZv8ZsIMtuonnoSBGwBa?= =?us-ascii?Q?bIWQEuVz4huuZgvy3/nwfiYEQikS64lJDg7euzwDws/ZbETbR8zjVcHBf61H?= =?us-ascii?Q?LA83XvNpy70oEkzvUVcj/XcofgzUAg6zd/T93752dBoDx1RX2VRlAWjs27oz?= =?us-ascii?Q?h87PT8ZMincy5VOut++zvJnUthdjSIaf1y0T4F1K9vSA7spIG2SAD5M5tVmu?= =?us-ascii?Q?rpK1+dQDCsgHCLayP2TIY5XgcMnLRKnMypBL6ZuupqfNDWviIDHR74Jix6ZR?= =?us-ascii?Q?MOzo+vak15Er/5ZcoDuptyimi8eTbJ+b/ktra+0h3zM7i3KhzRPumCPEy2Ye?= =?us-ascii?Q?djb3EeY61AY/ZG27QOZzyM6fyqvNpKicHqWSAL1Az8rlBVv9vF2iqYVLK4dK?= =?us-ascii?Q?/PVw3SoernjFP2ECOtm+/Cvw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sfqjI1WHUO?= =?us-ascii?Q?O5O7rj7Z9GjqWHJYqc1z9Q3C0wQSCxP+1NxXSWJpXtfO1DHvwqTUYioi63jL?= =?us-ascii?Q?+IqBg1VeJTfrNXFL9ae0zYOrAOPMkGNtDkNW4hgiSJz+XV/JUQPn9APjXFLQ?= =?us-ascii?Q?oZTToOBMwsBtwE1ygq9xd1g8IkJ9plvLlKqDbEF/u0J1VKCz8wo4Uk+glTDM?= =?us-ascii?Q?K665rwtyfMRlXqFBwFKNNytW5lkZk9RIs3R/4d8EjH3ZzUxmFCSgHs1cVhCT?= =?us-ascii?Q?qA=3D=3D?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9327cee-ba79-4c95-26b8-08dc3dcb3d4c X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2024 10:50:29.6865 (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: mC/TuukKc3X48mhFaB4K+9Q91k6/JsekSmlrDLeiIBQrcGCNMBmnbsNXXRzJOz+yRxrPAP2R9yEsWYRphlisnw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR02MB9617 X-Proofpoint-ORIG-GUID: eAx_JguV4pgWF2ZiZp6nWW2Cnrho-elk X-Proofpoint-GUID: eAx_JguV4pgWF2ZiZp6nWW2Cnrho-elk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-06_06,2024-03-05_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.568, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @nutanix.com) X-ZM-MESSAGEID: 1709722298970100001 Content-Type: text/plain; charset="utf-8" Add a migrate_set_ports() function that from each QDict, fills in the port in case it was 0 in the test. Handle a list of channels so we can add a negative test that passes more than one channel. Signed-off-by: Het Gala Suggested-by: Fabiano Rosas --- tests/qtest/migration-helpers.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helper= s.c index 478c1f259b..df4978bf17 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -17,6 +17,8 @@ #include "qapi/qapi-visit-sockets.h" #include "qapi/qobject-input-visitor.h" #include "qapi/error.h" +#include "qapi/qmp/qlist.h" + =20 #include "migration-helpers.h" =20 @@ -73,6 +75,29 @@ migrate_get_socket_address(QTestState *who, const char *= parameter) return result; } =20 +static void migrate_set_ports(QTestState *to, QList *channelList) +{ + g_autofree char *addr =3D NULL; + g_autofree char *addr_port =3D NULL; + QListEntry *entry; + + addr =3D migrate_get_socket_address(to, "socket-address"); + addr_port =3D g_strsplit(addr, ":", 3)[2]; + + QLIST_FOREACH_ENTRY(channelList, entry) { + QDict *channel =3D qobject_to(QDict, qlist_entry_obj(entry)); + QObject *addr_obj =3D qdict_get(channel, "addr"); + + if (qobject_type(addr_obj) =3D=3D QTYPE_QDICT) { + QDict *addrdict =3D qobject_to(QDict, addr_obj); + if (qdict_haskey(addrdict, "port") && + (strcmp(qdict_get_str(addrdict, "port"), "0") =3D=3D 0)) { + qdict_put_str(addrdict, "port", addr_port); + } + } + } +} + bool migrate_watch_for_events(QTestState *who, const char *name, QDict *event, void *opaque) { @@ -143,6 +168,7 @@ void migrate_qmp(QTestState *who, QTestState *to, const= char *uri, if (!uri) { connect_uri =3D migrate_get_socket_address(to, "socket-address"); } + migrate_set_ports(to, NULL); qdict_put_str(args, "uri", uri ? uri : connect_uri); =20 qtest_qmp_assert_success(who, --=20 2.22.3