From patchwork Mon Mar 11 21:53:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13589347 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 06CACC54E58 for ; Mon, 11 Mar 2024 21:55:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjnbU-0002uY-SB; Mon, 11 Mar 2024 17:54: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 1rjnbO-0002tX-VE for qemu-devel@nongnu.org; Mon, 11 Mar 2024 17:54:34 -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 1rjnbL-0003BU-S5 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 17:54:34 -0400 Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42BD9aGj009722; Mon, 11 Mar 2024 14:54: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=Qdu0lOdUIKGAiRzLxxb8GL70Wt2g6cWH8JYSv6Mkc AY=; b=2uj7T7M6xkl7QSW1bnXIw5qjjcF0bRAqTguz9TYvYhir1LBY7QWUMTUwF gQEEe9CoBt/bfqQiQ47D2ya3NHKh04tuIF4oW2MzABvmIGFFn5q9Dm4Fw3xcb4oq 1Q5CB54Xb5HnMzR/JqMX1BC2gtJi546PqJ9ShWRIfmVJaxwkjGaw4LP2Y2261Y1y pwdAfrez1/wU6LXon5zOmuVe4wxGqmwVvgmjocDBHz8mpAAoMOEogYG64BeEDLUz T4M5HWvxlRTtePlGsiXR/5e8hRaTEyMx3cvmQTYjnnZ0oJ6FNuihJLpeXUry8gwu AeYRFihp0h/CdAQKivoiS2yOplllQ== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3wrqygmc7y-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 14:54:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nYa+ybYndGrTBvM22HMdCqMz8F5IPj249q3q9GAkIEcrDShUtf1fQwgidHXgU46dTqIkGCVR82JWEjbLEyEI+diBbIAvp/J4ulQ1a9f5UpiC7/R4YmF+kh1t6o3aaf/NoW3ZscXuU1KB+xTo5+Qsaoe/QNudYQ9+qZ6+yplstrdgaEbJGsnE3GOouQrYyf1Z2wCQZhimzxffwICpg4Nclo2JyaFt/W53BnLfbKQov46/Jht5gXtKgQvHueXyFjJUYB1dZ+bjvMcVM0u1X9v3jq3RwPDYMnhGZexqaE2uxj4rBLxHByxfQziA5gt/uLUOZNz7Tvs36O3k8t80xg1NKQ== 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=Qdu0lOdUIKGAiRzLxxb8GL70Wt2g6cWH8JYSv6MkcAY=; b=a7MOklWlZr+1TAqu89ishOfMv25q2CNsgBSXloOQK+63B91JYKskkDZ1oqibJ8KfM8Rudj78bHSts64B6Jr/vM094L8VjGLL5bUUAEvgxkQEo7wcaMjsON0ueb8hl+v8/z2zcpSk+IhmLmQ1e5zjY4dvcIBESnHxngZrwxMg0SFU37PUdshEh3sd7FU1Y1y6rnk5hAmF1bPIiU686hb6wGrG9Qg25WyIuuYH8LCJmndSZ19fwiUNj4dQfZJEVDI/DRbgW59X6pUhDAEOiPEFkl9/s7+3CAKQCFiX4edMkVS0S7X1zI6okonHa3Ai1Q2SN0i41t0EFaNmK0OUN2xRFQ== 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=Qdu0lOdUIKGAiRzLxxb8GL70Wt2g6cWH8JYSv6MkcAY=; b=gave33ZJzEs2wnbSN7xSWYdEhnW9uws2CWxuRbj2m51ixYmPvkuyCkMRYKy1t+qDdXh0nz3VZW8oXcunuj21EY5wz3XcfO/XAH21mgBLZulV3joJlRjMxL3xasWh5VzEV/dnXslFZTJoDUeG2Zk7tSIRh0IYCq7BVtvXMdcbMIKx9iGaEzyKYEBOKMGfB7U5olXoE7KVTPwxLZA9EZIDe9fbpxP8pEqjkcKJ4pijjNe7XIxud9lihkxYbRPf2x7hY4yssww+qpvmolEAMRGhRalP6nbJuOfFnG3p/+/joqyOVBTHF9hpa9Zj7fKSiUMFmuC6ApqSuwlUu5hEu8Q2Uw== Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by BY5PR02MB6849.namprd02.prod.outlook.com (2603:10b6:a03:20c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.35; Mon, 11 Mar 2024 21:54:24 +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.035; Mon, 11 Mar 2024 21:54:24 +0000 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 v5 1/8] Add 'to' object into migrate_qmp() Date: Mon, 11 Mar 2024 21:53:51 +0000 Message-Id: <20240311215358.27476-2-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240311215358.27476-1-het.gala@nutanix.com> References: <20240311215358.27476-1-het.gala@nutanix.com> X-ClientProxiedBy: PH2PEPF0000385C.namprd17.prod.outlook.com (2603:10b6:518:1::6a) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|BY5PR02MB6849:EE_ X-MS-Office365-Filtering-Correlation-Id: 3b7f6085-6896-4bf2-915a-08dc4215c83e 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: V7GvQ3pnWbGis/R31fm+/rM66bz+TcMimGeSNaEFrmbIt5C/sgZglqzsLQRK2O/wGfNhau1WQ2/6XU7wmSO5hCz6xLKC0Z5W+Qvq4/FCB5nv0a3C8WpMjnA1oF9rx9Tcpc0WAJmLt1NlPGZU5FadvO4juskpSOkR8SkgwKQPAFFvLVWxDeGHFsO/bIEr7fGG8v5IcjHJJnO+8tjstyF7BJTv9Fae2m2h7adxmEq5jBurPEySkyveSs+ChTwY5BdKPS2NQzo1Ac+ZJCvl8ta0VIqJUo75OjyU3mIUX7R76xLspVUTBTlo2RBElEBIsMFavFfknlffHWdBBMK92n1sHMdclHxhvsLknYOVh3SYE+a0/4u+L3DGDQYdPKvbHHIp7p3GFHehvg5tmXspDtZMijUicgZCV7ABBWeWOdoN9ptEZ/8O1iJxubF5MRqs57p4XOka2v/zIB4kD9Aqh0DQ9sHng2vhAfRO8f0t3HwG5eI7Ep4uAMPp4f0gkuwtUIHv7ZT9gKJDE05bgCij/L8D4CmSGf0hTJoRMLg/ySTYer6nboJI8xJIBjZJyNjfJto3YSq1oQRIVXyHJ+cPh7IYYlqKbesyfZvNH/cRvHJqCdzO0HyvIln5KBC2Ulg/Z1VuFNrVxcR2f44zGiKaTCRBsCW1gWIS/UXcz0BV7ECoVDrsEqSQhJM9sc825u6JbiMNbaJh4A5Kb2V6Aui+6UPllNxJBip7Q35byTjQrGmK+Kc= 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)(52116005)(1800799015)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZjjQHU+S2lurTWdhcpgT4TORlxi3dFFBPf0Ul4p4Am/1q0WlHETzyb0abwPPplVxHWeHY28PUuiGE/Xyh8lTToKUTpC88Updo9uWHkBrBohLOJN33IOoiJM40No3H+3azYPGrHI3fOIHOhw9rZZu/j6/gAfdMpsPxrFXYmkmuSrIPeettp2lbMO/WelEUsSf9B2i1c+HXzAc4MmASOL4swjRlE2zMMA+jfSKR3YBcz+6cEQFi8O1dJXib1rMnjAzL/nZ06MnCTndOmflf7cJr5LotKD2OR6vl6oGzTgwzchX5v/z+BMMzMnGUMrGP1KLqcRbGZUhSfg9cg08M6fRI9jzAKeNcW1UutdEu1NUDaN24iWjekWrL7xFba8DYgEx/zmIyC9wX6LUqzGrRPCBHmDwepXYcd/vZeEzQmFp68gExG3qr9eKYFd/NZ+s+fKz7mHABJc+9zvPsvUyyIwqGZOSe+00b8BOfMPv1seWNUFZBeqpCAU12di0nzjZBsLUU9hWN2mEogXpCKW5yzlTgk/E9xOu+IB4UDuLglA9YKMEphD1iBynEQbXLMcVj5j8xJYCIgaiPrONZdWBBwSlXgZttI66SFDeCdidFeC+gosxH4a8sIP1ISQxNKdh0nISmQ49jazwygmxWRUddw9OTCH1Vp0Xd/hxufPXv0bwoGGANMH245N09bxfvYnX3TuqOob3l2Y6uy6vmTZXOu5TPQndpuwumgX8XOEUKI2hXSJcvALl7QRQBfGLtpN0yJa5L9UuNCuyK0MOKU/rZa87vqRED1kLck4JjeaGL4T9eVhAWD7kVE+onhYXoXrjlnqI0RjvtgM+XV825KIETw7EQNdGhKgX9xBybi9c31lVSoVZikUVOzxdWbwF1M7ixaK6wGvdtFP23RxQjPU+YAL6tfgtKYK1JgGdqP7nJ2KkrhXCOl4Cq+MXXl5x20RMr9E8xpRzdK+sTIqth6fXBTZYGqF0fyBU16gm8lSZVIoyk9Idch9AE1kjCCqC0Y/gyL9DsH8DYhPcTCOancVd/cZSQxmfGXtjAu5wMbdfAQOlFnNc73aelFGM9SSoXWQDgkNTwM/aYC+Awys+mdmMTO2Adc1Eee3qHnx+uGQ4/GxZVe/v1GQSgAvP2cDyZQgjrjhQJ/UufrJuWr4NpliBAV/6Zfv26I7rDVPmHRmjaGPm7zVQR1aWx5eUi2joPnzKHQTwsvz9pMaG0FhbwdqMCPTRZ3+tQMLsScrFbbd4DW+B7RTpJghzSfiqFnjVKdwOaXtBbVUTa1LEQM3VQwbKXRPUI9bPpLpGLL/d23EIrBwr0WA68l5Jo9NMccrKRI9iTleW/ryocZ5zXIxOq98lFWAVv/w5J922RYK1k837Zdi+ItYpm0k3nMW6SEZyujs6okCnQcWZTMYoImIWMdC7tLBC+V97aZvpphL7ZQ87UNLoVnFfjhiYblZL406ZRDwVVy3caloWFsH5olUMD8XAtgt9dU7bHIZSvNBoitw0ROVmdQ/0vSHGwPZJwoI+lXKG6bhG/7OxwS6hz2Se6mHG/q9RyTO/ovlduLhRt1bV+y/Q/Drm39Xjvv3+ANDbEfNcLzMq X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3b7f6085-6896-4bf2-915a-08dc4215c83e X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 21:54:10.2096 (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: eeYlYu/gBDvdssCsN57zmXCGj5VnJrIuST4x+dedMofzPS6YZgxzDq+/ZumVGkQfOdGYTaEi2M3IDK8eu758+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB6849 X-Proofpoint-ORIG-GUID: Ob-b0qu9O3IqQjzFsAFd3kyZk452T_QO X-Proofpoint-GUID: Ob-b0qu9O3IqQjzFsAFd3kyZk452T_QO 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-11_11,2024-03-11_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: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.029, 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 the 'to' object into migrate_qmp(), so we can use migrate_get_socket_address() inside migrate_qmp() to get the port value. This is not applied to other migrate_qmp* because they don't need the port. Signed-off-by: Het Gala Suggested-by: Fabiano Rosas Reviewed-by: Fabiano Rosas --- tests/qtest/migration-helpers.c | 3 ++- tests/qtest/migration-helpers.h | 5 +++-- tests/qtest/migration-test.c | 28 ++++++++++++++-------------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c index e451dbdbed..b6206a04fb 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -68,7 +68,8 @@ void migrate_qmp_fail(QTestState *who, const char *uri, const char *fmt, ...) * Arguments are built from @fmt... (formatted like * qobject_from_jsonf_nofail()) with "uri": @uri spliced in. */ -void migrate_qmp(QTestState *who, const char *uri, const char *fmt, ...) +void migrate_qmp(QTestState *who, QTestState *to, const char *uri, + const char *fmt, ...) { va_list ap; QDict *args; diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helpers.h index 3bf7ded1b9..e16a34c796 100644 --- a/tests/qtest/migration-helpers.h +++ b/tests/qtest/migration-helpers.h @@ -25,8 +25,9 @@ typedef struct QTestMigrationState { bool migrate_watch_for_events(QTestState *who, const char *name, QDict *event, void *opaque); -G_GNUC_PRINTF(3, 4) -void migrate_qmp(QTestState *who, const char *uri, const char *fmt, ...); +G_GNUC_PRINTF(4, 5) +void migrate_qmp(QTestState *who, QTestState *to, const char *uri, + const char *fmt, ...); G_GNUC_PRINTF(3, 4) void migrate_incoming_qmp(QTestState *who, const char *uri, diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 4023d808f9..d9b4e28c12 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1350,7 +1350,7 @@ static int migrate_postcopy_prepare(QTestState **from_ptr, wait_for_suspend(from, &src_state); g_autofree char *uri = migrate_get_socket_address(to, "socket-address"); - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, to, uri, "{}"); migrate_wait_for_dirty_mem(from, to); @@ -1500,7 +1500,7 @@ static void postcopy_recover_fail(QTestState *from, QTestState *to) g_assert_cmpint(ret, ==, 1); migrate_recover(to, "fd:fd-mig"); - migrate_qmp(from, "fd:fd-mig", "{'resume': true}"); + migrate_qmp(from, to, "fd:fd-mig", "{'resume': true}"); /* * Make sure both QEMU instances will go into RECOVER stage, then test @@ -1588,7 +1588,7 @@ static void test_postcopy_recovery_common(MigrateCommon *args) * Try to rebuild the migration channel using the resume flag and * the newly created channel */ - migrate_qmp(from, uri, "{'resume': true}"); + migrate_qmp(from, to, uri, "{'resume': true}"); /* Restore the postcopy bandwidth to unlimited */ migrate_set_parameter_int(from, "max-postcopy-bandwidth", 0); @@ -1669,7 +1669,7 @@ static void test_baddest(void) if (test_migrate_start(&from, &to, "tcp:127.0.0.1:0", &args)) { return; } - migrate_qmp(from, "tcp:127.0.0.1:0", "{}"); + migrate_qmp(from, to, "tcp:127.0.0.1:0", "{}"); wait_for_migration_fail(from, false); test_migrate_end(from, to, false); } @@ -1708,7 +1708,7 @@ static void test_analyze_script(void) uri = g_strdup_printf("exec:cat > %s", file); migrate_ensure_converge(from); - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, to, uri, "{}"); wait_for_migration_complete(from); pid = fork(); @@ -1777,7 +1777,7 @@ static void test_precopy_common(MigrateCommon *args) goto finish; } - migrate_qmp(from, connect_uri, "{}"); + migrate_qmp(from, to, connect_uri, "{}"); if (args->result != MIG_TEST_SUCCEED) { bool allow_active = args->result == MIG_TEST_FAIL; @@ -1873,7 +1873,7 @@ static void test_file_common(MigrateCommon *args, bool stop_src) goto finish; } - migrate_qmp(from, connect_uri, "{}"); + migrate_qmp(from, to, connect_uri, "{}"); wait_for_migration_complete(from); /* @@ -2029,7 +2029,7 @@ static void test_ignore_shared(void) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, to, uri, "{}"); migrate_wait_for_dirty_mem(from, to); @@ -2605,7 +2605,7 @@ static void do_test_validate_uuid(MigrateStart *args, bool should_fail) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, to, uri, "{}"); if (should_fail) { qtest_set_expected_status(to, EXIT_FAILURE); @@ -2708,7 +2708,7 @@ static void test_migrate_auto_converge(void) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, to, uri, "{}"); /* Wait for throttling begins */ percentage = 0; @@ -3029,7 +3029,7 @@ static void test_multifd_tcp_cancel(void) uri = migrate_get_socket_address(to, "socket-address"); - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, to, uri, "{}"); migrate_wait_for_dirty_mem(from, to); @@ -3061,7 +3061,7 @@ static void test_multifd_tcp_cancel(void) migrate_ensure_non_converge(from); - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, to2, uri, "{}"); migrate_wait_for_dirty_mem(from, to2); @@ -3394,7 +3394,7 @@ static void test_migrate_dirty_limit(void) migrate_dirty_limit_wait_showup(from, dirtylimit_period, dirtylimit_value); /* Start migrate */ - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, to, uri, "{}"); /* Wait for dirty limit throttle begin */ throttle_us_per_full = 0; @@ -3435,7 +3435,7 @@ static void test_migrate_dirty_limit(void) } /* Start migrate */ - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, to, uri, "{}"); /* Wait for dirty limit throttle begin */ throttle_us_per_full = 0; From patchwork Mon Mar 11 21:53:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13589345 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 7B112C5475B for ; Mon, 11 Mar 2024 21:55:20 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjnbY-0002vE-5N; Mon, 11 Mar 2024 17:54: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 1rjnbQ-0002tn-MS for qemu-devel@nongnu.org; Mon, 11 Mar 2024 17:54:36 -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 1rjnbM-0003Bm-NL for qemu-devel@nongnu.org; Mon, 11 Mar 2024 17:54:36 -0400 Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42BD9aGn009722; Mon, 11 Mar 2024 14:54: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=CxCJbh1J+F1g/3hkhkhwxypNhNvcLs4MqSzGo8O+S /I=; b=JClZZnoip7FSUr5r8qijnbOkoJVgplFhBBJzKZauJ4yan89FTb+yL344m x0pjlqyCotYSKBfon/Rg9I2ZICGmgo/+KLB7U4NVoHLrFu2J2I5exTx64QjztrRm VmxgLAXi8Aj2CCSSyXY8UnuRl4b3l2okWRUrcVEZ7EeG0XLZVMZB66jb2tEd5zJK O6HPSxNKD2EQUxcF1j1NatjNohM0WVoAzCpHKBGDTL85yaeS4kA7zqkjsfrMuA43 R6ARskjisJf0yqr8fC9/ZMuDO1gW3mTlLU8KS3vHqidROrw33eJHRI0+tOQGe6Yn 7clu/lFdQyOf4bWnxHDoQ4FEetF3Q== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3wrqygmc7y-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 14:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OUHd7URGtW6Dp7o3jO7dZxP6J9bkIfa8e+8SUCUJQ8fsSzXT0omfcsgI6wF2NFxNoSiN8E4ps0xNcBA1BZov+1GYQtr5XFLxY6euWLy2oSpBSBepYQLX505bdem6aLo8U2wjHQaJKqLD0bNoTokScNfVqQcQzR8xPJDj4zpoG4riMTz7yNDDWYt/+PJGbxwit0vWVo7UlqOkF22O9QIQKDnQzdnIke+y4Y7D09Ima9LUCWIviJ4YcGAGip7z8adIMI2v1LcGtRb5zi1F3RmnV2CIcRgJ1KaSX9aWgYsJp8/RJNcFLl5Oo06xLU80LVEtMZf/5z8I96kfW0bN4VuqyA== 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=CxCJbh1J+F1g/3hkhkhwxypNhNvcLs4MqSzGo8O+S/I=; b=A0bfvo0iB4BtBmlymKK3K45b5j7le7Z+ZiCU2G5z5fSVy/heVSmnlt8LfiV1yEZ2HaGZ4R4lGjnpKyw8NHYp02JlEvi81MDMVD056zeXVQ+ebfHHU3hX2mfwKcB/VG0b0Xck0qFOA3tiZxMBV+KD/20JhsUfqUCXrm8c5MZTN4gKnYpwEZeSYnm0yLE26xpwqPLfBiLoh/MKMuRRePGJPoVAvt1FJtWYTyeKWmGT423ZMN3xZ2r8UdNZqGsiRpZc8aQRxdTBWTgEgaWimggVIaaHSjGKB2h1F0rH0EHQ7AhPg0kVvLBus2Jjp4cWs6uocN2zYwlKX0oSkT/sznIpsQ== 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=CxCJbh1J+F1g/3hkhkhwxypNhNvcLs4MqSzGo8O+S/I=; b=fAvMIPYyXg0+CByE+P3H854A4in1Gyu2OvPRGhAB3NCWGo/bh+p+ThGWWB5fGtLUx+WXFLZQVYl9aUCTbFYHMEpAWytZZAh5mgoi6ZgGfUITiU+/P/DW1OlH0K+5I3rzF/mss2nxpJN+cmpnuWOupLqAEwM5Z75zrAsx0I3bjYsUe7wtJAdd6NyZ5i0cHM7ElTYSF8DkXzXo7Lvu12PCEgUujoFsuX3VupohZLwJDO/2n/9jXss7vhbUNJvrM0gpS9QgINbzzPzpo5w3o4kroL+XSF1DlPP81Z4JTZDVpjTy38cgGkXzR02ja/bR4MmNUv22Rr4ahbKjw2YGljVMiQ== Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by BY5PR02MB6849.namprd02.prod.outlook.com (2603:10b6:a03:20c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.35; Mon, 11 Mar 2024 21:54:25 +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.035; Mon, 11 Mar 2024 21:54:25 +0000 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 v5 2/8] Replace connect_uri and move migrate_get_socket_address inside migrate_qmp Date: Mon, 11 Mar 2024 21:53:52 +0000 Message-Id: <20240311215358.27476-3-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240311215358.27476-1-het.gala@nutanix.com> References: <20240311215358.27476-1-het.gala@nutanix.com> X-ClientProxiedBy: PH2PEPF0000385C.namprd17.prod.outlook.com (2603:10b6:518:1::6a) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|BY5PR02MB6849:EE_ X-MS-Office365-Filtering-Correlation-Id: 5bf7aa2e-52dd-4116-3c8b-08dc4215c95e 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: 2/etBFOJJGH3C5ymPrnpEvXeBrZ8sSOubw7NNA86pYWzdZ+Eu83GH6HcnKzOnQaWFdi8UNou3rXUg/OCjwb853trks7AkB5Q7ijL2EQg4tfrmA7fHWcsD7dJu495U+r3mJVn1y1kV/C00mYi31Jt0lPlky9fJEWPVnZekMQzlfe09U5rCxTGrRwTT39zzs6O/joCNixA33WMVSY3mB7IppTKDsa+AAgcFXrOhVtfwyE8NXPK88HKjrxkVW5f8gCz7f2eYpr6zj0PsLUIaFNxS6gb6cnYMia0HiInTublDBIrJQ1S+KATfrRjlX9TbNbg8NWlSTKrLTXZxrcLS9c4eFi42BkzmA6OevtNaJUt/DxrxZSq8IAo7ySxpO/jMoQ3Z7Iut9K7bPYmrPbDWcdvG8n7fqOABwgSXcOBjzwttxM6xGcAZsb501I+/2Qgz8OCTVYjsgPNLYt9vQjJ7VgZ5cGUhO57sgaPd2g3tEDBoZI9wLnK1fl2yNjgv/oelas0gXi6L2Yt/Cd51V5X41zDXFkwsEuuDexfotFqwSFBvWfxMG3aRzNSPF2VtpNuiqPpNw4KOITJ/OueB9D9E/+kvbBRWW+GBlRYKMXXoW9/HY+3QCqbk6W6XG/lvd5qkOnGsiQi9QU9j+nlLyCl/PQUTHylqUUBdpnaOSdz9DR6VFGbxRFhlhrJjl+WH+mDGYNieFQgZvxZjuv13/lcDIR3Z3w+E+pxwuNPoU0aKnQ23cg= 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)(52116005)(1800799015)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: A8R8dKWK6BYgbGaiKRKtT7w+3VRCZsiZXVlLH0sZgEx+BvzC6CSHd7hA9wnPB3a4+9XopEPhdIf2MsvRhTOXGS4118OvNM24dsUYRd/VLC1tuKxR9Tc4bCGA4K4ufI/47b5/5WE9LiCbzju9C/4Hac9tupOzLQZ4OCsnZhBoxbArZzf+eqWSFZ10YptVh3OZaRzvQOhO5yplRZNSWhi3mFxFIPyfVbbqcg0jBzdrxDIKiDM8+Cdzur5yU9H824HZZF0Bz83swEyrnEUow3Gv0ZXCXBU7Iq1K7qH/xKeIEP/1qhKuhMZxBzK3/SNLID5IDgi9e0kQcVYWLHikaQvP+5oEO3drg+DQbctTaFjUWy8opwtVHfVqcs6a7TaugbAgmfL3wwY/Dp27F7GOCbFnmMz9poFE0PL7gP/yzUALJPS3DGwl7SHH1zJ68j9Bi7qZTnE9IJKbwccRMvkE9ngd+M0AKZIZfkmO+TulRk5SgpjudiFmMvS+JRvgyK6ZV0ysI028JUioXUjbUqUvLYvlI4iOL9uBLs1dmf3hIFmO+eb7ow+NPHyYf4TE4VjY7Aax5sy9Fj59ltjJjvN9IZrsp+NIuccVjuOY3kDHivVimyKlcm0PGTLogcOm2AM2JSJalVH8LvLKKxkpf9LkZOszTbVHbdAWwZt5Arfjbmk7YRdzMgYOwEVOU3i096U2GOWX3jjg9MhVEt/yjtP6WbplgRkWlZ/A06e7ndbtL8sV2PW1B+nGrQD2acb7V5YZUVXmFlHryVfcEtTr6jyrMkBa/1HtedRPkP5NwEpnb3xSHz/bXoVqrNCLsyGY8Y+72Jo+WF2cHr9+PAZo95hk3241KWVW/sjymTkiO4iyl9sjEsDR8u0niXSwaUOucMhXE8MlxuztRAH2RqA8uDxsn61XzrB2lD3mruWRproRuibYmnXMWpFoORUNp2mAreqLe1QGpXS/oxvU/7ZXXQ7YhC9mRBBNRJbSq0yUXEv2zQG4wFOxjtP9yMsDvOsI9Q1jBySLfNvcxLNa2Lu+s4mIjBOvUSTrnNLHRbW9P4pUe1l10B5iLeue4gTOJmgN0hrWUHXWfCAnAr0aAeTvFCXKHyRtDSsSxhhG87gUp9q0iO+PYLxXfiw3UHOX07IKg+BF09wCKj4/YQfNB7CanWPQEz922OpSdL/Wdq/Uau2aDuvkDtkavbH4MhCpoQQ7YgIn8tCven9oy+Ai4KoJFsOsvgdGZMAQhD+gmy6D+UO4t9sI6Qy8lnamHooUYxxkuwnzJYl0XQbJX5/4sUYDV+tXA+tVNzAWBxkDkUkglvtmW247Bo8vy0O/UucgGC6/r5FXKTtb6/Qmj/b+tLx8OezmF8z6UPG/l3633Fhvg/EFg8PoozY92wQrm4EGsbVRm6+cp4hr+hL/pDQ+ctijWfqfCNk5bNtTLLAR2RwKLq7VWKroh2m4/ZhMC3rpjZc3tNYS6AzWmnUKNGzAzu67w279U135qJClgBENJhzTK9s+1ZyRHqESsPNa2KaQsVWCNK31QA/QagoMG5r7getIRjXWUFJ+KPs1P1DdoDczZkjAmqwc0UOyk4sZs3L8cs5s+QC3bqP0 X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5bf7aa2e-52dd-4116-3c8b-08dc4215c95e X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 21:54:12.1059 (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: JGOk3H5FvFcKoIcnzKVCvXgmYA/Zcrr02Mgxi4VaVLye4hxBn20fMgLtQ7oblRqeTYCpuqfHR7o8c+OzmFnStg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB6849 X-Proofpoint-ORIG-GUID: I-XBIL4jrODivGsLvLMIVyTP4CjRwXD2 X-Proofpoint-GUID: I-XBIL4jrODivGsLvLMIVyTP4CjRwXD2 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-11_11,2024-03-11_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: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.029, 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 Move the calls to migrate_get_socket_address() into migrate_qmp(). Get rid of connect_uri and replace it with args->connect_uri only because 'to' object will help to generate connect_uri with the correct port number. Signed-off-by: Het Gala Suggested-by: Fabiano Rosas --- tests/qtest/migration-helpers.c | 54 ++++++++++++++++++++- tests/qtest/migration-test.c | 83 ++++----------------------------- 2 files changed, 63 insertions(+), 74 deletions(-) diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c index b6206a04fb..3e8c19c4de 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -13,6 +13,9 @@ #include "qemu/osdep.h" #include "qemu/ctype.h" #include "qapi/qmp/qjson.h" +#include "qapi/qapi-visit-sockets.h" +#include "qapi/qobject-input-visitor.h" +#include "qapi/error.h" #include "migration-helpers.h" @@ -24,6 +27,51 @@ */ #define MIGRATION_STATUS_WAIT_TIMEOUT 120 +static char *SocketAddress_to_str(SocketAddress *addr) +{ + switch (addr->type) { + case SOCKET_ADDRESS_TYPE_INET: + return g_strdup_printf("tcp:%s:%s", + addr->u.inet.host, + addr->u.inet.port); + case SOCKET_ADDRESS_TYPE_UNIX: + return g_strdup_printf("unix:%s", + addr->u.q_unix.path); + case SOCKET_ADDRESS_TYPE_FD: + return g_strdup_printf("fd:%s", addr->u.fd.str); + case SOCKET_ADDRESS_TYPE_VSOCK: + return g_strdup_printf("tcp:%s:%s", + addr->u.vsock.cid, + addr->u.vsock.port); + default: + return g_strdup("unknown address type"); + } +} + +static char * +migrate_get_socket_address(QTestState *who, const char *parameter) +{ + QDict *rsp; + char *result; + SocketAddressList *addrs; + Visitor *iv = NULL; + QObject *object; + + rsp = migrate_query(who); + object = qdict_get(rsp, parameter); + + iv = qobject_input_visitor_new(object); + visit_type_SocketAddressList(iv, NULL, &addrs, &error_abort); + visit_free(iv); + + /* we are only using a single address */ + result = SocketAddress_to_str(addrs->value); + + qapi_free_SocketAddressList(addrs); + qobject_unref(rsp); + return result; +} + bool migrate_watch_for_events(QTestState *who, const char *name, QDict *event, void *opaque) { @@ -73,13 +121,17 @@ void migrate_qmp(QTestState *who, QTestState *to, const char *uri, { va_list ap; QDict *args; + g_autofree char *connect_uri = NULL; va_start(ap, fmt); args = qdict_from_vjsonf_nofail(fmt, ap); va_end(ap); g_assert(!qdict_haskey(args, "uri")); - qdict_put_str(args, "uri", uri); + if (!uri) { + connect_uri = migrate_get_socket_address(to, "socket-address"); + } + qdict_put_str(args, "uri", uri ? uri : connect_uri); qtest_qmp_assert_success(who, "{ 'execute': 'migrate', 'arguments': %p}", args); diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index d9b4e28c12..9bb24fd7c5 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -13,16 +13,12 @@ #include "qemu/osdep.h" #include "libqtest.h" -#include "qapi/error.h" #include "qapi/qmp/qdict.h" #include "qemu/module.h" #include "qemu/option.h" #include "qemu/range.h" #include "qemu/sockets.h" #include "chardev/char.h" -#include "qapi/qapi-visit-sockets.h" -#include "qapi/qobject-input-visitor.h" -#include "qapi/qobject-output-visitor.h" #include "crypto/tlscredspsk.h" #include "qapi/qmp/qlist.h" @@ -369,50 +365,6 @@ static void cleanup(const char *filename) unlink(path); } -static char *SocketAddress_to_str(SocketAddress *addr) -{ - switch (addr->type) { - case SOCKET_ADDRESS_TYPE_INET: - return g_strdup_printf("tcp:%s:%s", - addr->u.inet.host, - addr->u.inet.port); - case SOCKET_ADDRESS_TYPE_UNIX: - return g_strdup_printf("unix:%s", - addr->u.q_unix.path); - case SOCKET_ADDRESS_TYPE_FD: - return g_strdup_printf("fd:%s", addr->u.fd.str); - case SOCKET_ADDRESS_TYPE_VSOCK: - return g_strdup_printf("tcp:%s:%s", - addr->u.vsock.cid, - addr->u.vsock.port); - default: - return g_strdup("unknown address type"); - } -} - -static char *migrate_get_socket_address(QTestState *who, const char *parameter) -{ - QDict *rsp; - char *result; - SocketAddressList *addrs; - Visitor *iv = NULL; - QObject *object; - - rsp = migrate_query(who); - object = qdict_get(rsp, parameter); - - iv = qobject_input_visitor_new(object); - visit_type_SocketAddressList(iv, NULL, &addrs, &error_abort); - visit_free(iv); - - /* we are only using a single address */ - result = SocketAddress_to_str(addrs->value); - - qapi_free_SocketAddressList(addrs); - qobject_unref(rsp); - return result; -} - static long long migrate_get_parameter_int(QTestState *who, const char *parameter) { @@ -1349,8 +1301,7 @@ static int migrate_postcopy_prepare(QTestState **from_ptr, wait_for_serial("src_serial"); wait_for_suspend(from, &src_state); - g_autofree char *uri = migrate_get_socket_address(to, "socket-address"); - migrate_qmp(from, to, uri, "{}"); + migrate_qmp(from, to, NULL, "{}"); migrate_wait_for_dirty_mem(from, to); @@ -1733,7 +1684,6 @@ static void test_precopy_common(MigrateCommon *args) { QTestState *from, *to; void *data_hook = NULL; - g_autofree char *connect_uri = NULL; if (test_migrate_start(&from, &to, args->listen_uri, &args->start)) { return; @@ -1766,18 +1716,12 @@ static void test_precopy_common(MigrateCommon *args) } } - if (!args->connect_uri) { - connect_uri = migrate_get_socket_address(to, "socket-address"); - } else { - connect_uri = g_strdup(args->connect_uri); - } - if (args->result == MIG_TEST_QMP_ERROR) { - migrate_qmp_fail(from, connect_uri, "{}"); + migrate_qmp_fail(from, args->connect_uri, "{}"); goto finish; } - migrate_qmp(from, to, connect_uri, "{}"); + migrate_qmp(from, to, args->connect_uri, "{}"); if (args->result != MIG_TEST_SUCCEED) { bool allow_active = args->result == MIG_TEST_FAIL; @@ -1843,7 +1787,6 @@ static void test_file_common(MigrateCommon *args, bool stop_src) { QTestState *from, *to; void *data_hook = NULL; - g_autofree char *connect_uri = g_strdup(args->connect_uri); if (test_migrate_start(&from, &to, args->listen_uri, &args->start)) { return; @@ -1869,18 +1812,18 @@ static void test_file_common(MigrateCommon *args, bool stop_src) } if (args->result == MIG_TEST_QMP_ERROR) { - migrate_qmp_fail(from, connect_uri, "{}"); + migrate_qmp_fail(from, args->connect_uri, "{}"); goto finish; } - migrate_qmp(from, to, connect_uri, "{}"); + migrate_qmp(from, to, args->connect_uri, "{}"); wait_for_migration_complete(from); /* * We need to wait for the source to finish before starting the * destination. */ - migrate_incoming_qmp(to, connect_uri, "{}"); + migrate_incoming_qmp(to, args->connect_uri, "{}"); wait_for_migration_complete(to); if (stop_src) { @@ -3006,7 +2949,6 @@ static void test_multifd_tcp_cancel(void) .hide_stderr = true, }; QTestState *from, *to, *to2; - g_autofree char *uri = NULL; if (test_migrate_start(&from, &to, "defer", &args)) { return; @@ -3027,9 +2969,7 @@ static void test_multifd_tcp_cancel(void) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); - uri = migrate_get_socket_address(to, "socket-address"); - - migrate_qmp(from, to, uri, "{}"); + migrate_qmp(from, to, NULL, "{}"); migrate_wait_for_dirty_mem(from, to); @@ -3054,14 +2994,11 @@ static void test_multifd_tcp_cancel(void) /* Start incoming migration from the 1st socket */ migrate_incoming_qmp(to2, "tcp:127.0.0.1:0", "{}"); - g_free(uri); - uri = migrate_get_socket_address(to2, "socket-address"); - wait_for_migration_status(from, "cancelled", NULL); migrate_ensure_non_converge(from); - migrate_qmp(from, to2, uri, "{}"); + migrate_qmp(from, to2, NULL, "{}"); migrate_wait_for_dirty_mem(from, to2); @@ -3394,7 +3331,7 @@ static void test_migrate_dirty_limit(void) migrate_dirty_limit_wait_showup(from, dirtylimit_period, dirtylimit_value); /* Start migrate */ - migrate_qmp(from, to, uri, "{}"); + migrate_qmp(from, to, args.connect_uri, "{}"); /* Wait for dirty limit throttle begin */ throttle_us_per_full = 0; @@ -3435,7 +3372,7 @@ static void test_migrate_dirty_limit(void) } /* Start migrate */ - migrate_qmp(from, to, uri, "{}"); + migrate_qmp(from, to, args.connect_uri, "{}"); /* Wait for dirty limit throttle begin */ throttle_us_per_full = 0; From patchwork Mon Mar 11 21:53:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13589351 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 04FFEC54E58 for ; Mon, 11 Mar 2024 21:56:44 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjnbc-0002wX-O8; Mon, 11 Mar 2024 17:54: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 1rjnbS-0002uX-QA for qemu-devel@nongnu.org; Mon, 11 Mar 2024 17:54: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 1rjnbN-0003Bq-JY for qemu-devel@nongnu.org; Mon, 11 Mar 2024 17:54:37 -0400 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 42BIALuq029947; Mon, 11 Mar 2024 14:54:32 -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=i4RdRFaxUEsxSzTGZvX2O+moHmZD0N8FE2jJrQg7e CU=; b=2NJWmWmVrAffd9uGoMvzQ7z7gey+c8CDU+YQv5Lg4nBWvDgtZOJZr4Aw2 +UuybfYYm2Ys9/sGQhD8Mwzpq7fWesXgeNHLJOnYBzxCuw0X1W7ILXtIzBHQpAc1 ep6XzVLy+AaynEgcALiRMtshAWqdlBrnaujk1ALKbC0/t6PMUiv7mYXMMTHqrx9j tPxpfwKu0ie+zpD/jdSXmwFODXffrFmkl2PYONysWoKvBlSX3FNdXE1SPMs2LRZv l+Bj9fP1t9tklXXxcHOZoTIEzDWkd1OHeGZC1W/TCcceM0W1lhH52Rx02OPoqDaX 1ZAEoJSDkwZOoLW9Mkb5lyrWCiyug== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3wrqqhm8d5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 14:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ita+0hUOMeOQyN2bdc93ttICwhd5xDwWAra3HE5OT5u01i3eQD2ZwY8ewBBbhNM8OFDaxlt3wW+mfFcBoIqCUs+uTHKXzKkZke0VpMHTGbC6GyCR2TgC27dNQR35O5bUjKHlJg6kKBCubgul2MWwt707IZWKabQNwUan2DehJCFBCBn+MaTQB3Z8DFrB6Kez05c2Xi1J+7/gJiypGh1xYMk6x6leWYr6P/WlzG1WUXTGlE+Q/uhoYI8g/3b2bnC4VVbRogwyOr17ebExTbx7PQpOiG/2+vJ4ZwgzwFxw1uNMAMDCDqIF8gP3NpNR1ZcUekfHC2YGHEXh9fkJGz0YCg== 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=i4RdRFaxUEsxSzTGZvX2O+moHmZD0N8FE2jJrQg7eCU=; b=RL3c4y8Cy+UB5pRw2dGU+WBL/KYGnEDoX6UYOgxIQX1rNX9X8nAyNyB9UbYLxeNWUmPVIjqGKSNZ3CkYlF7t0SunwKiaGwrBMXTW5GmyE9BH6kZjvwfZIFh0wRAOUjfJIMZjZzTkLULBFQUbNPaVco2X6jxfoTfXBs4tpzZNNUg7snI0+79LeFcFNBuEAeC51XA7UkaiXU1cx897maVlZix4pkd9slVWAe1rS+KDHzdhR3n/kS2d7BT1hx9Cxp6NhRLk4JdKTtfcC16xK7IqEW+acwth2OkBJfqJm9/GMekIB4moHj4ybMepmkizjTsKt7Qkj8QjBb4x69TIkrZ3bw== 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=i4RdRFaxUEsxSzTGZvX2O+moHmZD0N8FE2jJrQg7eCU=; b=IIguLs2G2hho2BN+oUpK4mxq4mwnV7AGwsNTkmmOjbno2IeqbQHxSFIgkACJIzJbYCn8sPS8OQCnqn+tXaIwx2qX4gk2Z5URe8YfmrJQ2vyft/W2ovISz1+FvzjPHfvIp/E5kAu7tE4F4rrQMroUxCxqkIwjvPp/RKqNbSBMp1Q5xVUfog8G8N8wcRngaR6DG3ffsswX3BQ0RCEz9hKj2bZ8ZcWeaKVZnfQrb5Rfd9b96dH/cxD+bjbZRFQPt0rlBs/1T84ygUW7ktSxPo6xTbwHVDvs2m2F+YTz1f4uYomfglMmXNDXxQn/Q/93S2VYGKVzyG0v6SoR5IAWPRFcWA== Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by BY5PR02MB6849.namprd02.prod.outlook.com (2603:10b6:a03:20c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.35; Mon, 11 Mar 2024 21:54:25 +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.035; Mon, 11 Mar 2024 21:54:25 +0000 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 v5 3/8] Replace migrate_get_connect_uri inplace of migrate_get_socket_address Date: Mon, 11 Mar 2024 21:53:53 +0000 Message-Id: <20240311215358.27476-4-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240311215358.27476-1-het.gala@nutanix.com> References: <20240311215358.27476-1-het.gala@nutanix.com> X-ClientProxiedBy: PH2PEPF0000385C.namprd17.prod.outlook.com (2603:10b6:518:1::6a) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|BY5PR02MB6849:EE_ X-MS-Office365-Filtering-Correlation-Id: 0665de50-1182-4e22-89f7-08dc4215ca85 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: 3FIUjCb+VqGBVBOjwt6tTGB8TW4BgsJ96HaiBWmfNsZ69SBGDHpokWODwKoPLexdEvtlYaugG4uAcAUC36fuSTZkHwlxXGt5EV94NStvBsTLC+T5x83uddVKdt5xLDnCwYLCYN9uDNFd7vY0ea/eGIoZtRMveam9u2s6ZtnXhVZmOPrkoUZNv6Z0T2yP/dbDRmzBCcq0rQued4+9L9nh3RqVUGURl3V92wZETFTcSWTVPbNJaHI/S2gzJLZhdubYINFv61m22E1tUNOl7ZxzKZpeIB/1mInLvtw+FghRXf6I8zhMWxOsmIHFc4bVga5hGqNwrFzrfSDbaoLKakXiSZ4SR/fPelH9wjFd/e1nuH/E3LjWRKkRPr/QlLybhUAbyFuy3sVuwOiNOmB/0PbeNyy3y9epLMcAu8qiItnfZFoQrgEHQBiB8J9dDj2Vx+CfNjfjKhfnHlvqdXxC9J0I8J383H43wQOBAw1Fg44fOxLpLY1F5tUbzcqSn7vMx3V2RiS2mD0WpLAaVnbD75pncb2MiesnAQYhsKF4Du86vrN9duiEovcud7WwPProv+5Ilxiz1CZSmn3I9MuJo1xAS8KCouL9bj6kjuLdyiirBO30VQojXcHf2MYiiDNrICAd9W6N4Rh1/VJqc1jKDr8UABHEIt7xm3v/h5ASbzsCxQPkNpy1Rbl5Tct7RSWLaKw0Xc8WUvkcpbtdIBP42bJGVUI2SUMFa8QD4Dw12wU4ckU= 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)(52116005)(1800799015)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bfUsEAR0m4X/C1Zp4pP30xMz8vJraLY3kY4xG7QZ5xb7yL1K3P1KVgxwKb+Y+Vl+jsdy3YBwoI8j8xoSOHjNeZFOdAF9OMBJLL0yACLiekSUCZlFy9sZMfryNzu8E/0EyVgVAiJ9fX9wvvCbd4B50o63soc2P3ZPkMGvznDWPebdnpHGHrxe9DHvlUWh1HcWKfT5Uy+hfIglyIRmP3UbIrPCsNcJydO4LqFFBikoEqwZ1b6NxcZH2tU6X1d8lpkBBOATERpAr6ERZWF43IVVGF66JdXiuArmHY5+sVduRaqRjFs6qIcEmG2v7QyONKB3fU0Dmancj09qRD4HP19UHvZxKinspW7QL2AX+uYJGaprQOi2CspJVnK4MwVaytPor/YGahvEY87/uT72pPRmhkItgQZZavuNV6p54GeVpu1Ab9r4SNAAVZXsdgBMr5mpRFLDNJQ2fhvxUTKM9wBNO5aglR+GBgd6ic+46Vq8PzJJ4IZHpPng0Gwp5tvcReCOO300MfPzNwpwv3TuNM/KEjQ4jl0GYS9LFuELWk2x5Wo2MmMYghXMwI1bu8tYOImZMdlN9SEJ2TcJYTkK5I0V/s8COF1ThvQuWwDqsZHmWBFQJC/I1hL1aQDNeC6paeEVpboR6mymUOE2X+34WBvseLlTlmRe+qcESi5LcY+rYLUfD1CcFrvDDnJ8DPoFqWQfcbuTWck35p6C2fU0tLK4g97Zv5C6AlL0ZeREWTp76pVxPoY8RkiK7MkAcdhF2clfaG6cioG6ObrZOFk+Yvanmnu5Tmk//FlxM18EaLLjVSioJmkaV3fDlwCWxjYPsblRJOZ3PrejCY/r9hVGkaZ6Uts+etMn6rFM9qlkghkw6yvdHNtI6EBu0/v/IdsPsA30Ni7GPs0GZsIdPIZvwUT135Ik9KsnGQKbeI2h3m2MBbTueg+F0bU9V9pcxFPzqA1rZIC8vhMdNqQy/jcNqvz4nAdq/Vmsy5tTISZgsQ9KDdZs3MrJTD5E0RJA64Wad2QkB2zu7TEtvUim1B2KStgHm7TKLtxClJdOG6jcYXjmtyC02xDC7UAA6fWy+MHQEILzwjUJXej22UDcdGj0odq492RHzw548LuE4dQ2rZi3KyzHVR6pMbRvtOT3NiswM9QKpHCFaxlPV0XO4dDsuxbTPO+8JQVE18I49Q2uOfxBtVOe68xjYkMZqC04UunPAn2xndwqn6zynX3wkuG/bdcgjKldRN3+on+Yo2IKs30RFEH8UN5oHW25EncOOMeJixWbknmXuRGaJKj9MacRqiQSGO5F4UgDWdSb4WKvyyxelobQ0V38TC/jwphoOghLY8k+N3YPCFMJYmFwo8NmqLmpc50xM9yFeeeHDTrEcxhGtSrhlIXfuu8Qu9JBbEnCrwaTz4MEBsMU9/KBBp5hLen/vkd7FWo6YkGhMH2B1xsFdaY+USyusBu06q7sIMJOQTmJw/ijKELpeYZ1oiXSceky0VzcTV/kxpOnNOjd6UxLXCkJ+D35TMLVsmjUIejpXDwYzp8XY+lSNKLUuuFtwJJf3yAURnJvVJYo3i2QmhrkT8360uDzGh1vVFNmRlKcc6Yg8UvvloFK27k5VziftF5ovw== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0665de50-1182-4e22-89f7-08dc4215ca85 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 21:54:14.0173 (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: 2bxUXZ+MQz7x2ZXdu6H7GDfjK7GbDW5qbVUWCFBeW5CWQcOjNjiJbLbx8LC3S89zAhvb47oEQRiWopR2ofdCZQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB6849 X-Proofpoint-ORIG-GUID: N2Yrn_QgdwIFmLI69kuKZespcJlcC0z6 X-Proofpoint-GUID: N2Yrn_QgdwIFmLI69kuKZespcJlcC0z6 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-11_11,2024-03-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: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.029, 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 Refactor migrate_get_socket_address to internally utilize 'socket-address' parameter, reducing redundancy in the function definition. migrate_get_socket_address implicitly converts SocketAddress into str. Move migrate_get_socket_address inside migrate_get_connect_uri which should return the uri string instead. Signed-off-by: Het Gala Suggested-by: Fabiano Rosas --- tests/qtest/migration-helpers.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c index 3e8c19c4de..8806dc841e 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -48,28 +48,37 @@ static char *SocketAddress_to_str(SocketAddress *addr) } } -static char * -migrate_get_socket_address(QTestState *who, const char *parameter) +static SocketAddress *migrate_get_socket_address(QTestState *who) { QDict *rsp; - char *result; SocketAddressList *addrs; + SocketAddress *addr; Visitor *iv = NULL; QObject *object; rsp = migrate_query(who); - object = qdict_get(rsp, parameter); + object = qdict_get(rsp, "socket-address"); iv = qobject_input_visitor_new(object); visit_type_SocketAddressList(iv, NULL, &addrs, &error_abort); + addr = addrs->value; visit_free(iv); - /* we are only using a single address */ - result = SocketAddress_to_str(addrs->value); - - qapi_free_SocketAddressList(addrs); qobject_unref(rsp); - return result; + return addr; +} + +static char * +migrate_get_connect_uri(QTestState *who) +{ + SocketAddress *addrs; + char *connect_uri; + + addrs = migrate_get_socket_address(who); + connect_uri = SocketAddress_to_str(addrs); + + qapi_free_SocketAddress(addrs); + return connect_uri; } bool migrate_watch_for_events(QTestState *who, const char *name, @@ -129,7 +138,7 @@ void migrate_qmp(QTestState *who, QTestState *to, const char *uri, g_assert(!qdict_haskey(args, "uri")); if (!uri) { - connect_uri = migrate_get_socket_address(to, "socket-address"); + connect_uri = migrate_get_connect_uri(to); } qdict_put_str(args, "uri", uri ? uri : connect_uri); From patchwork Mon Mar 11 21:53:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13589346 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 CDCCFC54E5D for ; Mon, 11 Mar 2024 21:55:20 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjnbS-0002uO-Op; Mon, 11 Mar 2024 17:54:39 -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 1rjnbO-0002tQ-LT for qemu-devel@nongnu.org; Mon, 11 Mar 2024 17:54:34 -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 1rjnbM-0003BS-Eg for qemu-devel@nongnu.org; Mon, 11 Mar 2024 17:54:34 -0400 Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42BD9aGi009722; Mon, 11 Mar 2024 14:54:28 -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=DtGEwYAi4oVRLd7aOP9RYQF/76jQEVXtPhA+MN7nM Qw=; b=QREEDxAww8Kzqcx+tnibQIiBfnxrTYv1wgfVNS3zaaRqbWHUE7LSVUV2w mu98cdlqnymp4CXt+eiUsLeG3oVXiVac1icZTLO8sDrhlPS7pBFuC/cjvTWpaBWF A/TzAe/yFUtXY2dRV2T8vUGuiwCs0s/1v/1j50h6KYaBsHy9HwjvRIbkL54M/TKI ArCzSfoa1IqriFsrPDmm3jTbOICbPjaJ4f/A9l0lVjAFeB0mTpuMHfM53IhMEjwr 75JcIQ2ivKC2nsqe18gUdTnjognCruiOl8FlPTkuRfWIOup9sP8FuE29tPll1L4t LtNnlmq7yC1FmSRgpGbdYpxAUHtrA== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3wrqygmc7y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 14:54:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YHgIq4VbEhTd1/ZZv8Cz4UVNaXpF4dz5NDhr3+agoTA7ZZPmNwDAbnGXBqGNxYU02Eb1QJQZO9MNEtVLaZoZ2aOluaOC7R8YpLegL5+zoOWRyVqq0msTjiRFxoWsU1HYmHqY59BC2GE4O8G2HWBAyv8Mz90dfmJ06K/A8svbWJ9VACCgqQj0qmXrWblNj+WegRDn6cwtrXBLGyZlqCSzt2DwmkZLTw+VfgO63Tekk8fSu4REZry5EJ3Pr471l6Ob5n70KBHEvBG26bxJasEdtD/ps8XXgPwCN7EceckCrcsAWdm76JMrMQfjJr9IIrj+ieRk+m6hwUiTtPugrwEfRQ== 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=DtGEwYAi4oVRLd7aOP9RYQF/76jQEVXtPhA+MN7nMQw=; b=Yms5ShFPQ/GTlanz/BFlDzPjIgD3QSmbfDJgJdqR3txPIEEM84BZlvOcDSEZ0Kp1hC372CATGi3CWSsnjL0vZl5Pywp9dgRp0UbzItBiZAXEh2xjXGJ/G+EictR4g/q84iySeue3AF+eC2UsdxYNP5u/qkXiy6x0nd1TOHvwl0vnDj8xshYYSOYugmUjPmR6Rwiw4k7Jz8Rx/sXwQQviYfm+YgoNt+RSd1j90ACCH//IPAJtF8tf9CcnjfNpwEPbQTs4oZ21kQVwgZOEYMl52AblXcZugPbWVCjrAofcND6OfYjpjtNycp1oNSS+5vdUh8roMzoMgEwVJ0ULV5BSsw== 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=DtGEwYAi4oVRLd7aOP9RYQF/76jQEVXtPhA+MN7nMQw=; b=eFYrrMln020oSPPKhhjpNbTAjQK+Qa8F9zji/3chXlHLD2+nbwNjAuHJFQS6eJkSIDBkN0pRXgIcIw81O1AK8Kxf1oszTHyEaRK8ydqgY+RacWkNZ9GoQMRqwb+Yn2VbZhiyxQnNVkkX5PrqpJxeJu01U8Xsuqg58qIyRFX7yWnyJzZRiaGz7ebgyJrJX014UJcyy/qf9LrWOX8mkJagKPfI/YjY4es5JXHUR621CqOkSFssdqyaS7+GqgMl1+QfWYMJ7UJ+U9ZtLAHFOYkVGi6zG/lYbfOzdZqpTlV7ab8Ii7HRjiQIgDyo77YwSC0JZT54lWElK36DcrnKX+FDGg== Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by BY5PR02MB6849.namprd02.prod.outlook.com (2603:10b6:a03:20c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.35; Mon, 11 Mar 2024 21:54:25 +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.035; Mon, 11 Mar 2024 21:54:25 +0000 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 v5 4/8] Add channels parameter in migrate_qmp_fail Date: Mon, 11 Mar 2024 21:53:54 +0000 Message-Id: <20240311215358.27476-5-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240311215358.27476-1-het.gala@nutanix.com> References: <20240311215358.27476-1-het.gala@nutanix.com> X-ClientProxiedBy: PH2PEPF0000385C.namprd17.prod.outlook.com (2603:10b6:518:1::6a) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|BY5PR02MB6849:EE_ X-MS-Office365-Filtering-Correlation-Id: 192b0eb9-ed97-4f62-de35-08dc4215cb9f 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: PqZcH7wnql2rh+89w+FAH1GcIsZZZBEq6Cg4ZsPb7mYBaHekwYo714HXmTAZ1PpmssIW3eg9SG7rt66WwdwccSl1o+LlwyBtLQxrz85iOBrdIonJgr6XFW2qBudaYLjt3EqMkZd+SR2BxIitpGF6GCh/vBmngIdkpnH4VzBgUhVJd/O/VWQcN2yJTAj0sb/FsfIQyeoYj3gafPBjEl7AeWjCXCODYeN6TruhUR2cGDiStn1UdQAfdV6BOJ101uVM237eSbkShK0sXwBjW1GfqFMxkZCLYEcyWbuGpRUFtlpSS8kGeaqWwTtofLwFG95asI+V7vrR6+8T2IorhnshEH+KQZ/f0KRbop79pghejBPd8AvRUqRf+k5WCSEgD+HyiQBhoQpPRAAshlp3LBIYdKwUOrfDep0GLsxBAPICqJ5WV+QhhQOgnTI9cUA9//jJef6NfZZ4nxhvXtEhw9pUToj+PwxsdoNl0hM/svtjzCvDZvgbUE/sM+7/gNVxXy/ARbbcdzA5Nm8LRvuytba+GS9xP09b64CDI023+yn2tpA6Y+z5lBYjDumUxUW36XxD8AO401JPx3UXPzY+YIz3mMkzUlTazxMCJwxIuv1e3FpbRthjTf2DE7KXYS/QHua404I/EM+uv4k7BT1nxCAbNRJm66K5VB1DlJOBh2G2GspyCZkICR9oWywhXN6TDVTZaaCJevzlYFXFRL0zL3EY4s1NzhZFCC9rYzVaIKDrxME= 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)(52116005)(1800799015)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WSqBMshiy/t4lkj3hvNw2xx4jAJ0pJtKCyMy3egufEtUlwpc54M22Vkn2XRls6kuq0gRaVN2H6a7tFXYoUiKYliS28K1U6IE1W2LmL5F1FA+8zSXY+xQOB3iD+RiWmyJIzqja+QtAqprnRzMlxV53gaDL1+x54MOBYyAHyapnirYzdTtlD5W7H9ajenoYe3rrSd62nUpD4tjGtiJGok6KMoe+Jmvsqfeihw4lOFyXAbkTRsmjUg8Ovsplj/5ebixCWQBNdWGOELySiwxVhoe48WzjnyhVYSxxViecPHfPqeb/hKbwE2v++KQJyjrEsdzOqHGerBcyHNLJ2iEnVKKFyo4QnmDwGj/qUVNJlO/wCujUHGBGQtq4uU22ge8WIbu/PwT41uex9NwMFPjKC6y0zNEbwV2RqOeutcZ5jJYt5VnAYd8m2PHw3Xff/W/R/ZxA/w1Nde9qDuLuL+8saueM3UicTRo7gxoH2oIvcSfguov1esjDZiw+EwpxsqTVuWadqJFPvOTyYDPkjn5TlczNkWeeLwXjt/iJtTESWb4epJ2VjQyyT6RBxGfKIGRGM04yMT7ibExEoFLSTZCIlxzfw5nNDFi+6YiClh2WPaaHRAKqphcZRXAqiJw5MBVuqCgyaE7YUNNe3guqW0gH60XYJxKagvSIBKqYAgvIzERvNx5tEOFFSDcDVUAUzd4ZCt1HO/FZMXGOXL70L1xt2f3BMTw/hMpZyYvr5XoI6d/XgfeirdJP6W/cE3UvphqlKnhqadH7McUedCNYSd1Vkph3YNZcyjeYBgGCFi0v6b3DiwseqzSACTs3xJBERQ7K6dVKqpsfyzW3urgRYzuh2N9zWBt8Ne/85MAUghuQmYGhn/M39fAruLYbF8lfC3KPnnKA7F2OchOMRCO13fQSIaf8mf7wH/9Nam5tPJ03+TnByUHa6FlWBOGHGpE2GXSJuZ+33Z2XuiUbpGbqaIs01O3iCbHNF5HGbUc/5CvIEJT1/UjQcnK7tfnKmp2wH/Ubog4IW/3UQyfnMvMQTu0F3c5S2daW+fcke/oxNQ40q8h1zI7BoxclTGDS41F0hCUHaZ39TT3mMo5Zbg386UWNkc5EIhLcUgpSdvC7suAC9FFUGXLzMaWwZ4TiixfD9EyLHuVQ0cD8qUp+dBFc4bfCi5gvnwfVYhpx5W2Oxr+1TCtcH9pQwqvEFPGuV7vL4QbB26RPsJXckDEBkwohEto4nCbOBVmxToRiRokX5h3y9Dk/kpXm+tpqK9CQ+SffGV8JvTWNn9hliPcILRIcqIfWLYxCHzoAn6xC0Y8rC8EvGgcYsh+LbCeyaLZokG//rR6lHWPFQyaU29VSf18flrGDhFfWV5ClUDperm6EoheCU0Nt+4cLMCcamMctY38OJzLtuZ4xcb4LUYe4AkIrdpluHHMBd32egh6ck4x+dvVSSiDqWpNBqfhupAtmDc5rvG/8ulIrdlamXsBxAt3HRWJtxJz+IWOJk4y1Dtw/wRbPlh9E4YQ6rL2Ex5YWKZ10waYeiexHoz7FsNVgw42l+8+yw31XNpqLu5UQxqjdENym862ErEyoQXo3fWPa2fpb2b0yyqkXT76js9V4k+bto9DcnUr8A== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 192b0eb9-ed97-4f62-de35-08dc4215cb9f X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 21:54:15.8818 (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: s5/yXvwqWn1ivIkrunnZmEG/zZO/ylVNFLddntr0tVTTKrwuXkucJCUKP5FUg8rkX+kfoy2Z1se44Xh3L9mfUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB6849 X-Proofpoint-ORIG-GUID: c0LeN31-MZih50qu28nxu3H9SX9rG_aZ X-Proofpoint-GUID: c0LeN31-MZih50qu28nxu3H9SX9rG_aZ 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-11_11,2024-03-11_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: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.029, 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 Alter migrate_qmp_fail() to allow both uri and channels independently. For channels, convert string to a Dict. No dealing with migrate_get_socket_address() here because we will fail before starting the migration anyway. Signed-off-by: Het Gala Suggested-by: Fabiano Rosas --- tests/qtest/migration-helpers.c | 13 +++++++++++-- tests/qtest/migration-helpers.h | 5 +++-- tests/qtest/migration-test.c | 4 ++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c index 8806dc841e..f215f44467 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -100,7 +100,8 @@ bool migrate_watch_for_events(QTestState *who, const char *name, return false; } -void migrate_qmp_fail(QTestState *who, const char *uri, const char *fmt, ...) +void migrate_qmp_fail(QTestState *who, const char *uri, + const char *channels, const char *fmt, ...) { va_list ap; QDict *args, *err; @@ -110,7 +111,15 @@ void migrate_qmp_fail(QTestState *who, const char *uri, const char *fmt, ...) va_end(ap); g_assert(!qdict_haskey(args, "uri")); - qdict_put_str(args, "uri", uri); + if (uri) { + qdict_put_str(args, "uri", uri); + } + + g_assert(!qdict_haskey(args, "channels")); + if (channels) { + QObject *channels_obj = qobject_from_json(channels, &error_abort); + qdict_put_obj(args, "channels", channels_obj); + } err = qtest_qmp_assert_failure_ref( who, "{ 'execute': 'migrate', 'arguments': %p}", args); diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helpers.h index e16a34c796..4e664148a5 100644 --- a/tests/qtest/migration-helpers.h +++ b/tests/qtest/migration-helpers.h @@ -33,8 +33,9 @@ G_GNUC_PRINTF(3, 4) void migrate_incoming_qmp(QTestState *who, const char *uri, const char *fmt, ...); -G_GNUC_PRINTF(3, 4) -void migrate_qmp_fail(QTestState *who, const char *uri, const char *fmt, ...); +G_GNUC_PRINTF(4, 5) +void migrate_qmp_fail(QTestState *who, const char *uri, + const char *channels, const char *fmt, ...); void migrate_set_capability(QTestState *who, const char *capability, bool value); diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 9bb24fd7c5..da4b0006c7 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1717,7 +1717,7 @@ static void test_precopy_common(MigrateCommon *args) } if (args->result == MIG_TEST_QMP_ERROR) { - migrate_qmp_fail(from, args->connect_uri, "{}"); + migrate_qmp_fail(from, args->connect_uri, NULL, "{}"); goto finish; } @@ -1812,7 +1812,7 @@ static void test_file_common(MigrateCommon *args, bool stop_src) } if (args->result == MIG_TEST_QMP_ERROR) { - migrate_qmp_fail(from, args->connect_uri, "{}"); + migrate_qmp_fail(from, args->connect_uri, NULL, "{}"); goto finish; } From patchwork Mon Mar 11 21:53:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13589353 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 81163C54E58 for ; Mon, 11 Mar 2024 21:56:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjnbf-0002yX-Q4; Mon, 11 Mar 2024 17:54:51 -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 1rjnbQ-0002th-9d for qemu-devel@nongnu.org; Mon, 11 Mar 2024 17:54:36 -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 1rjnbM-0003Bb-Ep for qemu-devel@nongnu.org; Mon, 11 Mar 2024 17:54:35 -0400 Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42BD9aGl009722; Mon, 11 Mar 2024 14:54:30 -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=3l3bMBC8Trpkn7vCOkiQAOET6Cayivg6A4Sma1s+Y Nc=; b=sW96tFvuiMSkHJ7URTxEpe0r8IfdOa9TKfKesLGl5nmPOF3Y9ygR7t5Dz 006DQBxWuRv2GdTIaolgqkERcVsbN7wLCMnfrTNcMblkVHxTAwvPo600TST2csiJ cHJTIdLDcokDW2sAltZ6L9DLcBKAAZbRIPGTNjbbnEx2T5wM46vLHlP0gVPQS5uD Fz8OzNzKZ06v9XuJeoa49fxCjVjzrQKoiXfmrLxK8Rw6iunMXXxiuMVJ5bZ41DFo b/B/I1DHEkvkM6yGvO0Db8vi2qhRcql+/dPhvd0Ob/ZagdMMs1s4cQ1g6HUijUX3 a15unuIqjsy4zM0xM3yNAJrx9jb7w== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3wrqygmc7y-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 14:54:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZWO1T1vVDtk7fQ3hRg6l+p1hAjsKBu1ux0t+qmP+Cy6LyPUZk1MmLT6y6qLsdOicPBnKdpyhiIv/az0xwRFvlQ51+BWNcX4Pdr+ndYmeGA5lg+PA/dk4k8FxoxHwZkViM+s+jRMHXmnaD3Kc1cX8Fd3MYrL09MAzUpht7PddHZLYIDLN95Sb0StafWSL+hvCAbqfagcqnKjRmv9Zmx1Ks0o53SSyvirmOL5QetEewiafOgeLpUWC+ayCIbDceGI0BrAtj/jH04FXFRCcXkwXA1rd8jqbXXOjt0xMTX7ua3OMSv9kyrrAIt+M9lP1PHqMjTqBRPs1Hns0N/UM8xiNRQ== 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=3l3bMBC8Trpkn7vCOkiQAOET6Cayivg6A4Sma1s+YNc=; b=ReTPAfI5335jekHJDVcaNvi+TQvNEynXzMTD3xonFncjWWOXaMEKwfSS2qsOJTFI1Q/p7mJFVyM7XwnKuVYjKkhOX9dYudsokh04AemIE0gRMtlVPI254I53k/qVyiGfeIKFT7uKvRjfE0mRUO0ocJfH91p7SwMDcqPxa/pZdtM8jtj+2K6BVXT96UmBkzNu4Jt5zlg3NHnHzBc4LspeD1aPg38Pba3C1fTKrEKc05LGxuXikBy5b9w8rTmsWsX5ytLdrtm+cRUtvI1H5DAoLzxYQGYzou+dUmaKmDjVSLDnlI6AgPJYleJx6eLpHzp841Dv4oBGilouQv1XTVdVtw== 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=3l3bMBC8Trpkn7vCOkiQAOET6Cayivg6A4Sma1s+YNc=; b=db58QKwRqQkQTzTzCNAIASOXaJZXnsqOnMT0PI+3DN4mUb8H4jsprP94vlJLbr4w66WlqRklY5xOMtgS2Fs8vLIr37ZHTn4PFo6kIxZE+yu0NYpIW/93VOkkpj8aX6nV8NvhmnbIP/xyhES1+oOhtSJ+n0Ny3a/u/uTMUw3Qq3EU6/nHEGKgG7dyUqm0+Bh4cRJ5DX9s1zvKdMkPKqjI47Ktq4SfWVCCyo7SeW8f4NjvZ/2ROggmIovHUqoewSKs11prHnc289UCt7ByP3/DQD1tLs5WpeBjZc4z70lAAY9abK/woJy/TSKiN7njyMHUyi+KE7eJimB0l6OBO79yDQ== Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by BY5PR02MB6849.namprd02.prod.outlook.com (2603:10b6:a03:20c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.35; Mon, 11 Mar 2024 21:54:25 +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.035; Mon, 11 Mar 2024 21:54:25 +0000 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 v5 5/8] Add migrate_set_ports into migrate_qmp to update migration port value Date: Mon, 11 Mar 2024 21:53:55 +0000 Message-Id: <20240311215358.27476-6-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240311215358.27476-1-het.gala@nutanix.com> References: <20240311215358.27476-1-het.gala@nutanix.com> X-ClientProxiedBy: PH2PEPF0000385C.namprd17.prod.outlook.com (2603:10b6:518:1::6a) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|BY5PR02MB6849:EE_ X-MS-Office365-Filtering-Correlation-Id: 45723cbf-840b-4de2-e314-08dc4215cc94 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: 63S+XIIqxVkMpGkAFJOmN8oOQXAbQXGNkNJNj7mjRiEADatKZMitC3AueLyCcMlDNlU7UrrhuLPUIY5DrVmjjLzLcgk/Yqw5XvuwpZcl88mZgf7dp3MLDWMcVKbN5lIkPmj8rsQ6KYR/9jazlE64mx+hpWJR23D04q9KMpB8GPhrtXnGMQYcuCAjmT1zLi4uDURysES0WxQCOSm2GpkxDzAPUolU0FZr4/fTf3TGOL2ys+BVeAomorAsi2k16lcs42tU6hpQzoPCUOSrtd+OiZhPZH2doXM5uCkbzdZgl6tFEZCpY3HVaXsFpEiQHzE4hYFmq5gWdfeNATzb22ubQFqxmxLWr5YZhD8yP3diGjAIG6RYFSBBI0eIPWS51NvjmKbejlBiGPwMbn41l5Qmxd3tXHeAvnHRGo+n2M5BH9d8yz1BCk4Uj6MjnxUw+7EZMCORHOfH/Xl2gdpQtRVZOyv+BzjQjcNZkz4f/vlCRqxTqDMPcT2h4vlEUm+0vE1c0BF1pE+Ap5MQqEoEtil8E3nMXCRtO4UGgaSGgccRC+XHH9MYY43DANELZWRol5HF+m1u2VQuFypwrtkIYb/88Am/Hx0CcF15m/kFMIfLUt24AR9gJXRdvYE0EEzBAsYOCbPAh4LAxF6LIsOueiv3xcdrI9A/jEslqqARxXQEOQGCRmAy6ZMfegPHdjE09i1I/QvFyXEUOPeR6ozSZUcTCYS3qnjTvnqZjc5PLJ1pKPA= 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)(52116005)(1800799015)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WEqSHnJbFq5CrbmuRIV7yh+BXtq5AMshqAx8+Tnj+X3KASzB02446TEK5KDG6ZVtGE7at7LaWjL2Bxx6OOC/yPuheeo5TBdjpS0LvQkS2V8ZPxey+UyeAy9UB4WpxUBh2EVmHYszUVX0PZNJMCeFmlzUlMlKQXehcn3bcq0aZM0fumj7qLHgPSGjTuJQlGI8MYPH444Dy7B6fgOEJejsSO2nkLzqivXjvlAVN6GLDIf/EyZisEH31vb67rHQM6X7h9shHIC/UPxbSS5Ypp1YybJ3f6K1fYGR1ReqhlH7XsPDIA6YETqyM4ARE89+dLzdr11TV8aztyFGuFfBQRkgP1ENjJHPyg+t/n0+DyTtFr+KHgsW5VxNla07ZotlRr3RG1hI/PggD5WR5HVipUt/8Js6O6sz0sNHlPghcwejftqDyXMSswWAAovo4iKCg+7iRCTjK4imATnaG6tuDNSkw5Oy9pfwRVOxX4HsjiOlKWvxRVDCAfrorfP5vLd+X43ohA0NkRuuHRvEq/LsS3lDPHvLADgeuKsvaxZS2RxvR/TUn40B4iVTgORiGN7K27m8kKXDisnbHGWBIPJ6kUVD5H+pk1uuR74C4DF9r1Gn5EgX2poIaWA4fSNb0uITsu4frs+DLtTCqUGo1NbewGw+4zx/1jelWhyQORSIbv/PNQ3iE+MaEJ39DoKRekXFY43zeRheP45yO+hjW7QQo+Cy71PC85VaTemmQt/RZWsMIpnA7sZTtWB7wtnlDJ1P48Iqap7TgluYJ4skT5AbcklpJcrnq9xG3oaRdaYBCk8Qf5DO4fdeFkeQNY60Vz7g3w4TVFSZHpF9S6EQe5n0G978RCgVKz0KBcahlaYPvUbgsp7RCcBKBVDMiKY9TI4UUOG6+8I+Jj/21Kv23Hgaq6HZg9vWnAxoRN6Lv4loETwgDptWuFpbvzUZValkyra8ESUplF3k4WA9jdeHuVNShRnYq4Xb9IERTsG/+e66diVfY9vzCnmparK+n4au7757KFWs003hE/d3ukI3FFdApPobw8WLJ+TlGRWlYKTG8zvX3d+DqN5YJ53OOlbKlxWIuDHrAngCCgjB0LXG3Leyhgb1663aMM29U12LmREjWrs60vW20nzJMjVV88wn+KS2F1ZtVm9631/ZvWBrvqi0OnHQTK6nlh+pV5CN+8Ays9AV65caSi+T1AokcjShY9m47NvwNNAQEuAbtJ4yzLPNSk2zkrTQyqNvogUDNKamKFnjxbibYKMkNTsepfytEjo6/Epu7WW/cCrVj9e4pzffd6mb7db+oQ9LpI1JbK4NfkxFbA0rDVnjnPiY7MsaSDD7iuhHYdfXlnWHZuAI75KSTImfBa6GIi8gijS8Y4+lH3gP5pvc/WwnILkyJGG2iiKXcv4hZHn+LwxOYrthgkOA7FSOhrl8YZ+J7YHOFBnH0kLbaDMoxwjfTfoPXoPFIP66yt5piWs7FIRXMANAywH9uRq8xwv6//uns2qIb7D+59Tf6TNtuzCIX1ms5u10RofRNUT/jCZX4tmflsUwWTlniX3MJ7a95IgsqBDpJLwAbpdStKVoIFrosa7D/eYJlYKb5Q7pjDC1HuDoHek/AtLZGNkd6Q== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45723cbf-840b-4de2-e314-08dc4215cc94 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 21:54:17.4894 (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: MwhWh9b45yJOcVK314flVbVxbH6s8BOVHZwlM+iow0s+A3dz8Rb9/f6BXXMbfwY38+75epuVwCDxzlt3EKzS3g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB6849 X-Proofpoint-ORIG-GUID: QwciuwYm2-31GiieWL44xC9qEYtYs2TK X-Proofpoint-GUID: QwciuwYm2-31GiieWL44xC9qEYtYs2TK 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-11_11,2024-03-11_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: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.029, 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 migrate_get_connect_qdict gets qdict with the dst QEMU parameters. migrate_set_ports() from list of channels reads each QDict for port, and fills the port with correct value in case it was 0 in the test. Signed-off-by: Het Gala Suggested-by: Fabiano Rosas --- tests/qtest/migration-helpers.c | 75 +++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c index f215f44467..ed8d812e9d 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -16,6 +16,8 @@ #include "qapi/qapi-visit-sockets.h" #include "qapi/qobject-input-visitor.h" #include "qapi/error.h" +#include "qapi/qmp/qlist.h" +#include "qemu/cutils.h" #include "migration-helpers.h" @@ -48,6 +50,37 @@ static char *SocketAddress_to_str(SocketAddress *addr) } } +static QDict *SocketAddress_to_qdict(SocketAddress *addr) +{ + QDict *dict = qdict_new(); + + switch (addr->type) { + case SOCKET_ADDRESS_TYPE_INET: + qdict_put_str(dict, "type", "inet"); + qdict_put_str(dict, "host", addr->u.inet.host); + qdict_put_str(dict, "port", addr->u.inet.port); + break; + case SOCKET_ADDRESS_TYPE_UNIX: + qdict_put_str(dict, "type", "unix"); + qdict_put_str(dict, "path", addr->u.q_unix.path); + break; + case SOCKET_ADDRESS_TYPE_FD: + qdict_put_str(dict, "type", "fd"); + qdict_put_str(dict, "str", addr->u.fd.str); + break; + case SOCKET_ADDRESS_TYPE_VSOCK: + qdict_put_str(dict, "type", "vsock"); + qdict_put_str(dict, "cid", addr->u.vsock.cid); + qdict_put_str(dict, "port", addr->u.vsock.port); + break; + default: + g_assert_not_reached(); + break; + } + + return dict; +} + static SocketAddress *migrate_get_socket_address(QTestState *who) { QDict *rsp; @@ -81,6 +114,46 @@ migrate_get_connect_uri(QTestState *who) return connect_uri; } +static QDict * +migrate_get_connect_qdict(QTestState *who) +{ + SocketAddress *addrs; + QDict *connect_qdict; + + addrs = migrate_get_socket_address(who); + connect_qdict = SocketAddress_to_qdict(addrs); + + qapi_free_SocketAddress(addrs); + return connect_qdict; +} + +static void migrate_set_ports(QTestState *to, QList *channel_list) +{ + QDict *addr; + QListEntry *entry; + g_autofree const char *addr_port = NULL; + + if (channel_list == NULL) { + return; + } + + addr = migrate_get_connect_qdict(to); + + QLIST_FOREACH_ENTRY(channel_list, entry) { + QDict *channel = qobject_to(QDict, qlist_entry_obj(entry)); + QDict *addrdict = qdict_get_qdict(channel, "addr"); + + if (qdict_haskey(addrdict, "port") && + qdict_haskey(addr, "port") && + (strcmp(qdict_get_str(addrdict, "port"), "0") == 0)) { + addr_port = qdict_get_str(addr, "port"); + qdict_put_str(addrdict, "port", addr_port); + } + } + + qobject_unref(addr); +} + bool migrate_watch_for_events(QTestState *who, const char *name, QDict *event, void *opaque) { @@ -139,6 +212,7 @@ void migrate_qmp(QTestState *who, QTestState *to, const char *uri, { va_list ap; QDict *args; + QList *channel_list = NULL; g_autofree char *connect_uri = NULL; va_start(ap, fmt); @@ -149,6 +223,7 @@ void migrate_qmp(QTestState *who, QTestState *to, const char *uri, if (!uri) { connect_uri = migrate_get_connect_uri(to); } + migrate_set_ports(to, channel_list); qdict_put_str(args, "uri", uri ? uri : connect_uri); qtest_qmp_assert_success(who, From patchwork Mon Mar 11 21:53:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13589348 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 7C056C5475B for ; Mon, 11 Mar 2024 21:55:36 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjnbh-0002zL-Ma; Mon, 11 Mar 2024 17:54: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 1rjnbS-0002uZ-Rr for qemu-devel@nongnu.org; Mon, 11 Mar 2024 17:54: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 1rjnbO-0003Bw-9m for qemu-devel@nongnu.org; Mon, 11 Mar 2024 17:54:38 -0400 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 42BIALur029947; Mon, 11 Mar 2024 14:54:32 -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=lpeZyO/AkWR3UvydOmRQiK24k2sCcPECdlmaeXVTW E4=; b=zqw6KyOdlKDqkRwkHMKCHeeREtBdxcTmHAYuYpMNz5XMCDaLbgqs2vXBR MIdj+7/hNoWkipZuxLDGOIgSiRRCZRj0zy3etCXn7xS0Rk+pz0pR9xXqDhTj6zRw Bv5Djt54nmzSmxR8YYDIqIE2O4p4HCrFMQ9jH3SzQkeYlS2pE0xJaoFUP6zgpey3 dnYHBYu2bUiMApxcUXaBXTtiHY1Yk2Q1hBokI59ObWO+/Az1ky1ytELFfoRJ669o YjY9wA4hP/7kg29RY63khGR3IxafVzxewxJrd13ufi2XitGpRJn7tUwFGy7wpqnd g3zB53HeqsXInnkhjJl+NLpmj+tsQ== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3wrqqhm8d5-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 14:54:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FeRGjfA0uWKziDezsnd87aQwuarIErm8vfjCbYMW7GEFqbowkY93mT6RThZh2MyGBjHXB0zue+ThPhmkAPqlN08GnCBqw2/CRn3lgk5HjKQ9yvTDfwVWlrq3L76A6uNZ/xUUCISOuweI3NiKJ/BxNGlIjZIyXmlFpF/5Gx8mmTZyjKlGWBbNiOPkzWYtaiGn4OpH45eZDTZM6z5u++N9i0zwGr1G8JPAqkoITltwY7OF2nahAJ99CLRS61fscfE21A4xyEWD/1fkXfoQJjhPNUIeOHLDjbIfhuE9VAq0MA4+lm8rYPyA//vitmGsrVvugiQpFQcnvKFQInj7QrncOg== 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=lpeZyO/AkWR3UvydOmRQiK24k2sCcPECdlmaeXVTWE4=; b=UebrxFeJ+tuw4RSt/wUcwUcle81KZRR9oot3202FdVQXtCl5gZOSQaKfwXvfhBpNdBRPYyWG7n4JRdk3zFmFmyZnLckoabjh6L9nmo2GLZFE3yIJl04F0iGdU8RV6FgXO05wZsmeraFNPffmb4Vffzzofyt05LopMqvc7KLNfZY3tpPr0T2y+1TQ9aKmCnYxAq4zypga8FaIlC78BTtY4VyEeQJqYoKDRnB76SWm9OvRRF9hCrihueKNq1WVdGBQKjpNFdwcAAbEvBI1YxoZjngP1O5v03a79Ex7cAZwHYLVm6eKDerQzDlSig/179Nuo95zhvpwCu9/ox+2+t2oXA== 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=lpeZyO/AkWR3UvydOmRQiK24k2sCcPECdlmaeXVTWE4=; b=ahclRB44zGiRkzKyuyHP9DTLcJJ34YlT680alFk+SUFidC2RkgH0tXYEH18k72aTohiGS5vUOdWpZMSSFOgH1NMloC2loopTXXrOQsk3SZSebybGw4moDg0oppVDLbZAtzQypNAJzo4YFHxpETeevkPKModM9gXIgKbYgsb85Hw3KxKvasJSDvnb9SOQmNYEHtDfKGaXop2e+g30JKgJBkSzpIJLgSjhjLGjIH4f7k86zq8B2evADSl8+KppyjKyKOPEEEDejaDZYTo+aJdDSDqiuOlM5hdUDcf8iKx5lXLUOChvNmpLTbSKYKcKKmhTwDaJsbfuo5ByYR756PavuQ== Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by BY5PR02MB6849.namprd02.prod.outlook.com (2603:10b6:a03:20c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.35; Mon, 11 Mar 2024 21:54:26 +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.035; Mon, 11 Mar 2024 21:54:26 +0000 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 v5 6/8] Add channels parameter in migrate_qmp Date: Mon, 11 Mar 2024 21:53:56 +0000 Message-Id: <20240311215358.27476-7-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240311215358.27476-1-het.gala@nutanix.com> References: <20240311215358.27476-1-het.gala@nutanix.com> X-ClientProxiedBy: PH2PEPF0000385C.namprd17.prod.outlook.com (2603:10b6:518:1::6a) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|BY5PR02MB6849:EE_ X-MS-Office365-Filtering-Correlation-Id: ea809c61-7a75-4203-58e2-08dc4215cd90 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: l94ld/Hyeo/dEK9FJgMaONsp+Se56sHadbl8MAA2MvD/mWSgc7oYEBALBk/QpH1wNhF8jtqp//T6qYwo6/4hj1Shg3hAc+8Aptj9gOHbmqwHr1sJ+zpRxWcwdipXS3eV8ObrX7ZPxDWSkOlAAYjZ5GusVEGtTJNjxmlaUuxhUF7QgEW3rJw5HN0/rXWvfFSk/tkqPwCrDlxcxZKz8D9cjZrNUL746uauedP/OpM+LiLyGRPGv2nY4hiRtH9XrvXh1hMe28dAfrea5O5mxONkOfV0NlhHMCzVcFxdlRHzbb2eqaA180nf2r4yml9BhKdRECrzUx2rzxX/pTxeZ62P+SS4YyQcXYbatxIYy6fgognMy1d/bxWHIBPflSbuPRGFpFGwEfMEXgeaBM9ovDzSQ2CoCb/T0xS4gzCzh1i4X7RzjWBUJTBpgTOmqbKllvOpYrr8zHsqvEJLSbJLsg2rsiUTQ6INQiuk0xd8wgpSCckdBqRPXteTfswFmANKZq2rlxoU80v1BAQEHnH7mRKRvl+I1DvnZCaSaruSmepfsq6VqZkE18eQS3hRTHJugHFFL7ARmAs/W8xBlvs3F3dqOh8FS6EQsuSA+XD4LupMSpCbqEa0USoAmAZKJ0snhlhV8m/g+S4fYCqgTbKminIYUUghw4ebpuCZ8UQ3Jd5FqLopZRKhMp8XMNZ5qa/E3vidNxRGNDeWChKWU1qAjopa8Q== 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)(52116005)(1800799015)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LMY4/MNMXSZ9s+om/yC95zPOSbSDMxoPw8dDZrvTvnOjX6xJQPaA/4SrWZQISDfe3SDsHots/EYhbMKbOFRq9jtjq26UAKEUW6HC1KklrainZ+jNz0r7cfqQ2MtlxTDPwJcwKWLLJum5/q/Eg8UBetPbHV4AaCMUZJA4yTmE9RGBqFQ6ytnngKmkgnTj04wi5HCmUhamJSodwh7RmKQMdoOZG2uiZwPb+C5LXnC1izqtZmPJKPQSDZH38zBxMtbRgGOMcwYGurQwZMwV7KMJ6svKHohtbJsz8SR4PI0Ist2q41RUuijmz8L4Cd/bt5mHeaqPg2mKgQKPxBcF2p7coC1dwxG3JRKGtnIDoNXjmDaP1FoYXXPi5dkKAYtx48uBs2ZIUZJ3mQd82v6HMSSkuUr2n+HpMp+I1og0mLzVZ1F0akBP3NVJpfcNcG16A59T/MB8yxb81OlCWrFXPW/fkTHKgXayV9RV0rTOPdW3aJi0eTRDln8JcrxWBs7y+wdyaar3LzzWZDK7u0jORlxGTPrJrb7qkIQSm9NHYq1RDt7/0skL7E/bhRetyBdJdlQfcIh+Bzj1Ky1usT002I3uZ8aV33Jqg21JYna/fpS97WYTGXhDb7ETusepizGiTrZy+9D6JNdpG7BaC3OSpLmO5IFKfzr4MADXoL31c/3dzX/tYyN/XCM1G4phBbMU+8pxJs5ItqRmptw3FJS8iRukeJ4I1sVqEUH8PBK2cu01hMJ1OH806eTmOx8GXrbUGHKgRiyoQH0h/NAH26Ew8kMHAfC3BQkUvuIecouODoC00BL3PcpkND9K9ZyALI8aoY4t9zUPWH2KhuRVIT3KqD8z7C+2Q1YYuSvfHANfbrkXGkzgYTe7wq82+PPfEl2QHOBuYGT3rsyz91UEughVA24lfxthyfyX3eSvow/65aGJ9SaaJcO4bunqosKyqS2FsoeSxEkKIqALr9LnGPfFpKJdsIWZkJsR56oD9It1tXyYlRSGcyFklHynoWzj0A242kXnzKYiifg7pSWptMrnpqsldZ/tLhqOVbCkUxLal93mfyREgvQPftRNgfpjvNyc4i0FyaFimUcJ+csK1xhFQWYW1/R1FawALvHyAgfFc2NXKtQEvqO6pjiKRBTlalWwUf/ea6gelXoDb+tG9QymWJsoJaJjPpK8HR7QGljFBgPPHugQn+D5eyBA9egpTFtBWGHqw5t3NHyCgE7iJdKhg8fZUhvY54XKYbaC3BCtdJ11+K6STMfK7VKMGnAWZszXyRPPo/HTj/AhVUb7OCx+GZ9VwOBPtWu4B4pt0YwWmymdNhppaR0DVhvWxNWAXsbBf2pUbfr9Ek8fFrsqLcaUZJg7HmYum2iGOHMjop7xXvCzANdmih7JfcOVt4JVVBl1jhr/Liz8fTtmLfo3QeCAeclSogy7qHz0rfK1A/4NX26+oETtFcEPyjBtz5e8fkj4DyQ29IavChTPl/sgIDaUWmaBHyHeCV2gt3O1zLYYb4meD/+yTfizwtvMMeXTJ96Fi11uDq2m90WeE3IpOit0F6BAgbbd1p+agukXspf7mQoIQV/2ZOp53wyUzapqnTiQDF+vnFJCspYwWKFLPYO0fqBdDg== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea809c61-7a75-4203-58e2-08dc4215cd90 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 21:54:19.1415 (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: GMKiZIWOjBGIx1w4Etnm6XNy+6EQbYPotviWq4dxEVre+GaotALPXUJ5ROd9PuTulk4MgLIQ8rVFoGuKRZNNdw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB6849 X-Proofpoint-ORIG-GUID: yagGChd_c8I4QIenWthMlWrRXvk6soTE X-Proofpoint-GUID: yagGChd_c8I4QIenWthMlWrRXvk6soTE 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-11_11,2024-03-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: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.029, 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 Alter migrate_qmp() to allow use of channels parameter, but only fill the uri with correct port number if there are no channels. Here we don't want to allow the wrong cases of having both or none (ex: migrate_qmp_fail). Signed-off-by: Het Gala Suggested-by: Fabiano Rosas --- tests/qtest/migration-helpers.c | 22 +++++++++++++--------- tests/qtest/migration-helpers.h | 4 ++-- tests/qtest/migration-test.c | 28 ++++++++++++++-------------- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c index ed8d812e9d..b2a90469fb 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -133,10 +133,6 @@ static void migrate_set_ports(QTestState *to, QList *channel_list) QListEntry *entry; g_autofree const char *addr_port = NULL; - if (channel_list == NULL) { - return; - } - addr = migrate_get_connect_qdict(to); QLIST_FOREACH_ENTRY(channel_list, entry) { @@ -208,11 +204,10 @@ void migrate_qmp_fail(QTestState *who, const char *uri, * qobject_from_jsonf_nofail()) with "uri": @uri spliced in. */ void migrate_qmp(QTestState *who, QTestState *to, const char *uri, - const char *fmt, ...) + const char *channels, const char *fmt, ...) { va_list ap; QDict *args; - QList *channel_list = NULL; g_autofree char *connect_uri = NULL; va_start(ap, fmt); @@ -220,11 +215,20 @@ void migrate_qmp(QTestState *who, QTestState *to, const char *uri, va_end(ap); g_assert(!qdict_haskey(args, "uri")); - if (!uri) { + if (uri) { + qdict_put_str(args, "uri", uri); + } else if (!channels) { connect_uri = migrate_get_connect_uri(to); + qdict_put_str(args, "uri", connect_uri); + } + + g_assert(!qdict_haskey(args, "channels")); + if (channels) { + QObject *channels_obj = qobject_from_json(channels, &error_abort); + QList *channel_list = qobject_to(QList, channels_obj); + migrate_set_ports(to, channel_list); + qdict_put_obj(args, "channels", channels_obj); } - migrate_set_ports(to, channel_list); - qdict_put_str(args, "uri", uri ? uri : connect_uri); qtest_qmp_assert_success(who, "{ 'execute': 'migrate', 'arguments': %p}", args); diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helpers.h index 4e664148a5..1339835698 100644 --- a/tests/qtest/migration-helpers.h +++ b/tests/qtest/migration-helpers.h @@ -25,9 +25,9 @@ typedef struct QTestMigrationState { bool migrate_watch_for_events(QTestState *who, const char *name, QDict *event, void *opaque); -G_GNUC_PRINTF(4, 5) +G_GNUC_PRINTF(5, 6) void migrate_qmp(QTestState *who, QTestState *to, const char *uri, - const char *fmt, ...); + const char *channels, const char *fmt, ...); G_GNUC_PRINTF(3, 4) void migrate_incoming_qmp(QTestState *who, const char *uri, diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index da4b0006c7..bf27766eb0 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1301,7 +1301,7 @@ static int migrate_postcopy_prepare(QTestState **from_ptr, wait_for_serial("src_serial"); wait_for_suspend(from, &src_state); - migrate_qmp(from, to, NULL, "{}"); + migrate_qmp(from, to, NULL, NULL, "{}"); migrate_wait_for_dirty_mem(from, to); @@ -1451,7 +1451,7 @@ static void postcopy_recover_fail(QTestState *from, QTestState *to) g_assert_cmpint(ret, ==, 1); migrate_recover(to, "fd:fd-mig"); - migrate_qmp(from, to, "fd:fd-mig", "{'resume': true}"); + migrate_qmp(from, to, "fd:fd-mig", NULL, "{'resume': true}"); /* * Make sure both QEMU instances will go into RECOVER stage, then test @@ -1539,7 +1539,7 @@ static void test_postcopy_recovery_common(MigrateCommon *args) * Try to rebuild the migration channel using the resume flag and * the newly created channel */ - migrate_qmp(from, to, uri, "{'resume': true}"); + migrate_qmp(from, to, uri, NULL, "{'resume': true}"); /* Restore the postcopy bandwidth to unlimited */ migrate_set_parameter_int(from, "max-postcopy-bandwidth", 0); @@ -1620,7 +1620,7 @@ static void test_baddest(void) if (test_migrate_start(&from, &to, "tcp:127.0.0.1:0", &args)) { return; } - migrate_qmp(from, to, "tcp:127.0.0.1:0", "{}"); + migrate_qmp(from, to, "tcp:127.0.0.1:0", NULL, "{}"); wait_for_migration_fail(from, false); test_migrate_end(from, to, false); } @@ -1659,7 +1659,7 @@ static void test_analyze_script(void) uri = g_strdup_printf("exec:cat > %s", file); migrate_ensure_converge(from); - migrate_qmp(from, to, uri, "{}"); + migrate_qmp(from, to, uri, NULL, "{}"); wait_for_migration_complete(from); pid = fork(); @@ -1721,7 +1721,7 @@ static void test_precopy_common(MigrateCommon *args) goto finish; } - migrate_qmp(from, to, args->connect_uri, "{}"); + migrate_qmp(from, to, args->connect_uri, NULL, "{}"); if (args->result != MIG_TEST_SUCCEED) { bool allow_active = args->result == MIG_TEST_FAIL; @@ -1816,7 +1816,7 @@ static void test_file_common(MigrateCommon *args, bool stop_src) goto finish; } - migrate_qmp(from, to, args->connect_uri, "{}"); + migrate_qmp(from, to, args->connect_uri, NULL, "{}"); wait_for_migration_complete(from); /* @@ -1972,7 +1972,7 @@ static void test_ignore_shared(void) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); - migrate_qmp(from, to, uri, "{}"); + migrate_qmp(from, to, uri, NULL, "{}"); migrate_wait_for_dirty_mem(from, to); @@ -2548,7 +2548,7 @@ static void do_test_validate_uuid(MigrateStart *args, bool should_fail) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); - migrate_qmp(from, to, uri, "{}"); + migrate_qmp(from, to, uri, NULL, "{}"); if (should_fail) { qtest_set_expected_status(to, EXIT_FAILURE); @@ -2651,7 +2651,7 @@ static void test_migrate_auto_converge(void) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); - migrate_qmp(from, to, uri, "{}"); + migrate_qmp(from, to, uri, NULL, "{}"); /* Wait for throttling begins */ percentage = 0; @@ -2969,7 +2969,7 @@ static void test_multifd_tcp_cancel(void) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); - migrate_qmp(from, to, NULL, "{}"); + migrate_qmp(from, to, NULL, NULL, "{}"); migrate_wait_for_dirty_mem(from, to); @@ -2998,7 +2998,7 @@ static void test_multifd_tcp_cancel(void) migrate_ensure_non_converge(from); - migrate_qmp(from, to2, NULL, "{}"); + migrate_qmp(from, to2, NULL, NULL, "{}"); migrate_wait_for_dirty_mem(from, to2); @@ -3331,7 +3331,7 @@ static void test_migrate_dirty_limit(void) migrate_dirty_limit_wait_showup(from, dirtylimit_period, dirtylimit_value); /* Start migrate */ - migrate_qmp(from, to, args.connect_uri, "{}"); + migrate_qmp(from, to, args.connect_uri, NULL, "{}"); /* Wait for dirty limit throttle begin */ throttle_us_per_full = 0; @@ -3372,7 +3372,7 @@ static void test_migrate_dirty_limit(void) } /* Start migrate */ - migrate_qmp(from, to, args.connect_uri, "{}"); + migrate_qmp(from, to, args.connect_uri, NULL, "{}"); /* Wait for dirty limit throttle begin */ throttle_us_per_full = 0; From patchwork Mon Mar 11 21:53:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13589352 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 32AA5C54E58 for ; Mon, 11 Mar 2024 21:56:48 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjnbf-0002yS-5c; Mon, 11 Mar 2024 17:54:51 -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 1rjnbQ-0002ti-A8 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 17:54:36 -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 1rjnbM-0003Bf-Et for qemu-devel@nongnu.org; Mon, 11 Mar 2024 17:54:36 -0400 Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42BD9aGm009722; Mon, 11 Mar 2024 14:54: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=UcXjmmQKyF9Gv4JJ8NiRj8iz+yLNYuK0TF5QsuoPQ 6w=; b=QqzTPN/Pb+RQXuvu/xF7wictbHFbVVDqkRqYXrkPacFcH3alednE6eodi 84DU8JibghWSmyB0n5Rrt6maQTN1YLOAI61PeE3f34RN6l8YOG1owhBAWLoXV3L9 ZAP4Jze26trX+6RA2RXmFPrQCh4mtcxvNoWNwTgs9t7QmhU04WmoWYcR+a7nG+Be nx7YyGewJEVkWCs5ji+5SmJ7rLh36GcPMhJnN8hGRwigRyKJBZd7EtAwbz8Fnq2Y t3IdmG0ma9d0MWna8tIHRsI+w4TkPQeulcYvOSFeQQixIaOC5yzr4pO5yaB6jSHj E1xEN3dCENhwLu/t1Dl+a7awKDc9g== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3wrqygmc7y-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 14:54:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N9y9M4H2+oyHtyRAfZd/YtunWY5jrnksPYX89p+//8SHqt0TssSJ2DPHpW+ch5J+tG+byUdn3vpMoxOoB7wG0Z+5qejB0QQrmHC+6gdWNNj4Tr+o/0fP62M9QE++tkrAD/lktbl/l8be2DnabbNQj8yx+Aq37nfu24nHf/51IDs/YB3eIMuI8Mit6GOEzsuu7r/oc/IOIP/gOdpkiCbErVWLYZn8m/i5S8mmbBTUAcdBrdnvsvJ0x4vS4ySuTeP03mfvclDxzx31kPlmyHsw+CnBq5b4oEVYimP26Cb2jW44HrVN7MDMzCekKcn1AbrvmsvY95CHyXWKKJ3Ul6CFpw== 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=UcXjmmQKyF9Gv4JJ8NiRj8iz+yLNYuK0TF5QsuoPQ6w=; b=YO/1dfKV3Ut2ti1ns7uU1aawbfPUEbLICrzWQLKRG3f/B/lC73LJMgrfDAVzjBf7B9qchLwjsW7hHUCefLiIi6JsmlrOE5eNj94lJpt1+AQ+32EdrBfU8ZzjMJz3dCDpRtytxcGhtw3bZBgyyGa3mTSF8CS8Awd1T04K/VYsErUPYu20r5tclqsW2sEXsadwf4kjOZJcSS5MYveP/8+0QgBcL0maQlwjc6KI8kajhoEb8o8gTxDVDiMLyY6v+8lZxRBu0C0c1rd0TDq8m/RS8qsREe4PbSqHkZtjDf4lG/oRM8hM+Ww9Ew+L4Fb1zqye4mpbnyGAZXYry/KptEtA+w== 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=UcXjmmQKyF9Gv4JJ8NiRj8iz+yLNYuK0TF5QsuoPQ6w=; b=T8soDD06GfrqM/z240iBJFSpWCidjvMPN25WSXkPf5n9j3dA+CXnLVj8fyonxmOVV4haUseXkd98QiZt2I7L8krCVG18YnmRcc9Gt6MluKbZzgE5yEsBkgHL0H9VMPi/ihg9mvxLBioWqXNaFGCOx+VcBUM7V/DTAO0UepqT/XEhyClHaqhf2nTBtb6bR5kAFNxxR4wvZQAh/Bql2mPrjY57negywbOFE/LohfnBEjAcnuCEIs20ZEJ/dPbjHuHdioYX4GbKIpgKvL6rSaAla6EM2bC13RJ2LRsUfopn+zy1qqPUF/MKiw7zfhzoOJwjq82zBBbOxwlwMxyMCTzhfA== Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by BY5PR02MB6849.namprd02.prod.outlook.com (2603:10b6:a03:20c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.35; Mon, 11 Mar 2024 21:54:26 +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.035; Mon, 11 Mar 2024 21:54:26 +0000 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 v5 7/8] Add multifd_tcp_plain test using list of channels instead of uri Date: Mon, 11 Mar 2024 21:53:57 +0000 Message-Id: <20240311215358.27476-8-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240311215358.27476-1-het.gala@nutanix.com> References: <20240311215358.27476-1-het.gala@nutanix.com> X-ClientProxiedBy: PH2PEPF0000385C.namprd17.prod.outlook.com (2603:10b6:518:1::6a) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|BY5PR02MB6849:EE_ X-MS-Office365-Filtering-Correlation-Id: f8828664-db69-429f-7178-08dc4215ce7a 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: dP7sR3JRPtlpBEDdocINxG+c9+WzjCbpu3KS4JyWbFNukdCygfblivFgzV4dp9EchlYre40bvvaNKES0hEz39UuLROClgnXJC4Z062iHdsYreSROqqGaIRSm0qCBwsTUaE8G0tNnMqEL5CvF859F9gtM9+XYznLKKw9Y/uQF2taJS9vdggavm1rkzOMEF9eVOxLwHeX/PLtxn5rkZ7iwWsn9iKR54i3zSEW5985Eg+r3pe77pyBN+1vfYxF2XFgnPSEx9sasOutpoyHTbXGoIAtlRw0bmKG8B5p3p1NmBSr0bOdEXrdA6fId97WcllJISbsqJd6g33nn0j13br2xjzpO+VfL1hzqHBdDIUQbDcV0rFks7frvpeVkrPTXsBOo21WkQROszgqrPsZWStxf860YqYnBOtsHcUW4X9UROkyqDEUPdcmY8it1tO6AjP8Qq7LMumYh3hupPubnf7svBj8h1WyAYMerRbvW92QythY2ULLzCmt+i3X0FclOUl7wfo40hHAiv0MZ1nf/5G9T81q3TgDl9gN/UvEMzXcud6/SVHAmthmC8zSQWZTw4ZIlpdlqUC4FmK06UAQY1xB9X8ZCrnQWGRUpJDUjaKDhZFWCEM91rTJK1urVjvoxiQhpvmULDzMCWP5nzaLbHPvFTzOmjHslx5uv2RKRwR/KSbzELLT3ZSikH/7Nox94AHCrPJ/ruhhr4aG3+oYIOrf3ZeUtczDTVNk89dEwff+V9bA= 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)(52116005)(1800799015)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QHekCeGzCOhh8spk87E2NWo2idjt+o0pUrcBRfVtS9XfnGJVK9tpSxbBKst0ZBbmq99y1EQcrXd5Hta2Udo1ntOOa/E2cdT1CSo6ULccZfEQemJOTmNZqXKq5pnSHSCVE2Bdj7bVa8QB+9Q4iCOOaKfaLAddPHQD2h4yygXl90Cg/D8/FqJ3IfuZU8pagbUvL6j+NtFX3CgK4rzzNGvGDcKquYcv6DsJfefugLEXDEejQ10D+QZJpmMJI5YIX9J5aRkA39UCRYzHPy+CB2Wv2ura6Lf6zRan5yRtbxorCUr5QdcqV4/nraqAqOyYVih0n+RjQNIIbPAEzHlMhnECwsNNBtDSnLINPIwM1o9p5T0bt6H6f8bHJ1fu8O1bEvEUaoDQ7DCpxnrIeNISCD0VweZPytQRbm0unOXDUKekkaoE/QAaudUxvHJJalzdMeYM/Wj2JFg6+K5GJjLg9VFqbP7Lp6g1eTXqqzX/8/NaIrr43HR30N0v/ogeyYthw6AW6celwvSw6nr2zvRrV94ZKq5kLsIf7nIthu03MwMBIEE+WP5uOxgSqVsVfUgDeLjOa11YQwdjxsuhRMAtDawI1/ha1JTvBbIMHHlvagEhpPX4++ciGHJlJ6u7hyOesabj6PvxsD+4SypAlx7YopO5E/OKsHBifSr3t0eABxW8hWsaBv/e+U4XOVQ1cX/QPWULnCmr3CCJY/VAH//DbdYD+q3iac090O4j3uLEA6CHITNFsGMtS2oorg9MMsUgkBOyb4vxFPEK0/tKkunGIwP7FtMLbKr3D4M28cwf4em8SlusEaZuXe3/o04dQumuRFvcMwpzvqKkPO3zG+YU0KFZVWTrErSbvrrhTSFBcV+y2Fv8aO0AxbbMDbIIM0fonp9kuEowon+DBcwOO7sHsrVoRkybag/xYBjmDODjGO3lYwzfwFtvdSewLXhkgB9w63+pBJkb6LZDtkKTrbVSj1FLM8styvhdDD0fdMHZAwwNZnwgAT2NiqPkFfOypjWhwyE3SGktjwqLbLat7ANfnMO48QChMGf5Q6b9dfl0vVeM74HVBpEqin2OwWs23UMn8jRrOt/noQX1DsdVjxzcpXbOLKAOQ8YY3AV7IZl9lnWEXAOPezbe1UWRsKii5Cz7H4OenQNfOPrz9cr4b14xBwcveJ7MrITbVcKk0c9OsbsT6ywqFfiGVHtJDjfHIbPIVTPwp85kYmNioucqXwu7E5vbtoCRdjMmptEpv0ZxZd4090T+QaM5c7AtlkeHXJGmzxBihYPFw37SuZwdHaIGwerxWl0efA6JbbOUgkkQw+ATkfpPrIxZmc5Hw5ltMB37Qp4Dt++qYGd+23jCtvpyKIR82z7DfVmMgg1uIuH7g3uItacnKokyTosiieetdKvQQBEkIO4lEIfc7iZNsvtdcjgfEFkUidNPR+Kgqj8ZvZf+PgLS8HZVpk5eDNG7c9TrbDrSKyG0wjFIH5D0U9jg5n+vUnSDtIr7nT0pZCPkK2WS5Z+ovew2tcJ+Nw2SMc2NVlWxwNtLnr9AoFUwTqEtmcrf4SsyVPPQ89wpbqWFY4Ch08JqT1WeC6dAxWfGWeBtb1dhuZ9FW3Y9NOtr4WpCoffpKQ== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: f8828664-db69-429f-7178-08dc4215ce7a X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 21:54:20.6563 (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: 6bBfjCBNG+fqe9nVh4ROhsngtZW+ysXDdXTh3XWrpDxExvOUAyOQTiKDq1Plc2pEkS7h+BpfbBAqimRNAv2xUg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB6849 X-Proofpoint-ORIG-GUID: V7D6CH4jVlTXS9F0OSjxcFD3xaRc_g1S X-Proofpoint-GUID: V7D6CH4jVlTXS9F0OSjxcFD3xaRc_g1S 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-11_11,2024-03-11_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: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.029, 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 a positive test to check multifd live migration but this time using list of channels (restricted to 1) as the starting point instead of simple uri string. Signed-off-by: Het Gala Suggested-by: Fabiano Rosas --- tests/qtest/migration-test.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index bf27766eb0..392d5d0b62 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -655,6 +655,13 @@ typedef struct { */ const char *connect_uri; + /* + * Optional: JSON-formatted list of src QEMU URIs. If a port is + * defined as '0' in any QDict key a value of '0' will be + * automatically converted to the correct destination port. + */ + const char *connect_channels; + /* Optional: callback to run at start to set migration parameters */ TestMigrateStartHook start_hook; /* Optional: callback to run at finish to cleanup */ @@ -2740,7 +2747,7 @@ test_migrate_precopy_tcp_multifd_zstd_start(QTestState *from, } #endif /* CONFIG_ZSTD */ -static void test_multifd_tcp_none(void) +static void test_multifd_tcp_uri_none(void) { MigrateCommon args = { .listen_uri = "defer", @@ -2755,6 +2762,21 @@ static void test_multifd_tcp_none(void) test_precopy_common(&args); } +static void test_multifd_tcp_channels_none(void) +{ + MigrateCommon args = { + .listen_uri = "defer", + .start_hook = test_migrate_precopy_tcp_multifd_start, + .live = true, + .connect_channels = "[ { 'channel-type': 'main'," + " 'addr': { 'transport': 'socket'," + " 'type': 'inet'," + " 'host': '127.0.0.1'," + " 'port': '0' } } ]", + }; + test_precopy_common(&args); +} + static void test_multifd_tcp_zlib(void) { MigrateCommon args = { @@ -3664,8 +3686,10 @@ int main(int argc, char **argv) test_migrate_dirty_limit); } } - migration_test_add("/migration/multifd/tcp/plain/none", - test_multifd_tcp_none); + migration_test_add("/migration/multifd/tcp/uri/plain/none", + test_multifd_tcp_uri_none); + migration_test_add("/migration/multifd/tcp/channels/plain/none", + test_multifd_tcp_channels_none); migration_test_add("/migration/multifd/tcp/plain/cancel", test_multifd_tcp_cancel); migration_test_add("/migration/multifd/tcp/plain/zlib", From patchwork Mon Mar 11 21:53:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13589350 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 DC266C5475B for ; Mon, 11 Mar 2024 21:56:43 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjnbf-0002wn-2I; Mon, 11 Mar 2024 17:54:51 -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 1rjnbQ-0002tj-AS for qemu-devel@nongnu.org; Mon, 11 Mar 2024 17:54:36 -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 1rjnbM-0003Ba-I9 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 17:54:36 -0400 Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42BD9aGk009722; Mon, 11 Mar 2024 14:54:30 -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=TyAq8jGJPXGONJOdso4TLpyyA94NLlLZDKZsk/3QN EQ=; b=eTIUGq8Dxumdf0AVWLWvBu0enF1pomy/njmQwHNo1Plz58YdaCC98gUbp ZScb3eRDORlJwclbRsMyBu+KeB8th9e0Gp54qjxqo8zXaK0GMagcm/d4QHfS2idF DJQojiEnxmGQ5DYtn0KAa+r487VcdCFCUoG1cyRomRGzGMhqgZvH81Jx8GcLqoEZ WH7lNdkSi21ASuv8+byzkBc+N4/WduOswhD1dCXdD4IDS0zk+ulfqsUi5Dwt91sO hsCQh+hqDBg5k2iwOYNYLTOp9V6sTiY5MVc24zghG5nUsEmrkrrHgm9G5QJxCpUk 7sUH1rhBH/ZaUqon17yAg/0kVI66g== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3wrqygmc7y-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 14:54:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SZHWV4m/ruIYIYudeG0YIEYiG7cpAdoF99Rva6h4tqL/McwHOjo7Dzk7Mwdk1BSZzNtnRdXYGq/4M37ZE8uu3t9FaqBhJmaPcH22Hm9J4Zef8VNrcXhae0K0QKkWolMonlzeUV4eoPjhCc5fqyWuM1Yf1beKlK69pmgiywxsevTtjsY+WP0hLoajR5oBvwX16cjb7D6b5zM64J98C1mwaXAu9gG+PigFTJ/hqvtffeSKLV9w8Z7W/ncOekD/h16TUtpETZiwnnIXBQ1nG+h1Kel2j43PBO8e+qpl3FMNZh7Tpan+C4iXX5I7IRqAzNbz2KaWOB4qQmyTdy2dr/IEcQ== 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=TyAq8jGJPXGONJOdso4TLpyyA94NLlLZDKZsk/3QNEQ=; b=oGJvJDTZbiihaEy8mivwUx6/L2N1BEy4PaX6ky20Hl6RKINT9if6pzfxDTirvdyxrjTxKV/NdwzUKp5hN9QTdJ5dtg2fUXBbB0MmEj2FRCHrtJlSM7kN/OsCVJuCqqzj0OQIFnAdyFRXYXe9XQoBSda89UX+Ihw1ppxJv+QrWOU2fTQ3FQiM/LD5aCyH9jt36RrYx/BxOT2lqU8Ol1xwErB5LZ1bCaPNW+qNMDTbx2D6F1UY5F4WImTN8iyQQMX6TMy5APhpMHo4T5cbUETQXAiUpcpK/N0hadb5yo7uFutaHW8QnpS07rhytecofpJ5hrviOJmmXzuhxkb6+7s/mQ== 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=TyAq8jGJPXGONJOdso4TLpyyA94NLlLZDKZsk/3QNEQ=; b=S1RYjo6NnodUXA+KkXPwHfk7PKv7guFMXBzGvncH/Teog6ph/Aw+T/MiKnKHqGiVxC6wBQmFnfs6u3Vcd1y8Azn5hNMvhoRhXUepwK8NceCcr5WuK49HHu/ZHJ7NeAk5wOJqg+4demKRIwZ/7alOtj6EaBxoGSs+KulNnH99NtSxE0bp5MiJqTo++7ysHyifOl9SmXtPFu1sT+6+beFbmChGTMuBm4BTarOkantE2Is5Hdii0ZYXGRCHsVXhiuSOWgyhxaGRIm3O+rpq13acVm0QPY0RYvXoraj08IL7FZgXkIuIaBcBq3RaYNsMT5TNyUTL0mTE5VTXHD+TxBLG0g== Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by BY5PR02MB6849.namprd02.prod.outlook.com (2603:10b6:a03:20c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.35; Mon, 11 Mar 2024 21:54:26 +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.035; Mon, 11 Mar 2024 21:54:26 +0000 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 v5 8/8] Add negative tests to validate migration QAPIs Date: Mon, 11 Mar 2024 21:53:58 +0000 Message-Id: <20240311215358.27476-9-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240311215358.27476-1-het.gala@nutanix.com> References: <20240311215358.27476-1-het.gala@nutanix.com> X-ClientProxiedBy: PH2PEPF0000385C.namprd17.prod.outlook.com (2603:10b6:518:1::6a) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|BY5PR02MB6849:EE_ X-MS-Office365-Filtering-Correlation-Id: 939489ae-321f-46ee-80b4-08dc4215d006 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: 4sw0xJmAy+Fe68TpvggXKER3eOkosYrV1lJtCWRXigh7vgULP2nkVhnxwAT80gq/ebNEKbGA512TnqlwVjVC1SbmIh8l2MTJ+3Fmj8tJsvqE3x3RXc/Tj8T4f0PElflSBf9pRtWVSpmd0Kqrfwte8u2lJ68AC2q+qdeB1mGPLrInt9TR774C6k1RoPggvfgmgD4Ouzgk6wEGMJ4MFugM7AHXY9iNZOeBiGAPalXI4bm0bGem5RJDLN5SUp1v9yS5MMG88C7p4HAyUB6T8vmsZ1dvC/8cvjs0Wktna6QKblObx1KR1gf6NyCPeksrI3daiGNp6BQe+czg4HCrSvphFUuoFwltMN2dtMgp6qlaj1gik46SIQubIF/pGksPPU9xGJL8DUpngxWjPfpZ3KZhJj71eELvmCv1/uOFjxlFKZZCDRh01fOmrBNNMfytSgu8Zc+SDt/7jJsvyFMdbRnruu+8Fmu6E6vrxp+zKxFOuxAZ5AVb7gAeLlw3ps2/BwcN+gSWQoMifIVOqlZvi2Wwan4SgcJeY4URhz+5deS/2CyJxnoAGsrH0eXnXnSdJ90dabSsvlOnQggltc3C/FsKE9ax3T9FT5SxfWNNLI4SlZbALEC50jA6sLwQQlHHoGOAqCfUa+xo22XNIoJbeDU8WK8PVa/3atJmoXjyzUmzybVhVSf1XSawJJ6KGZWsc67B1KZ5ykdknllnl8/8aOfO2s3WCnxE0EJLrt+wAS3J7Ps= 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)(52116005)(1800799015)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: egq1rsH5vxwdgDGeModpJgmMKcfARNtdC9OnHIRQhOb2VjH75is6mxgiQ11Uzwx33ByH2b8c+s6WE0MFtK4ECiisGqe5lAqDGRBo8oik6zQsXp4X3BBRdPTQr94nciAErKYBn8wPkA4xSyjP6VmRnelUGKSvQRKviVi9cDX08tNyft5V5uLUmNBQ3BhDImhEoCWMdohDOwE3wtHsc4hcTxYIeeLefBZ2CMk7HXHViyTJJ985aJGGQXomxv9mju9jCXBjpRdWdj9HlaKPzUOPIOTU0Hl/32gXlXr6tAYEWVV/onBpJX8Dhd//snINywdfgcRzn59azxVotFG67ZjZ24mFKvFagefWIHrCLLyxJCBTd3dD/E+R0mP5RiQE0wZSJqPlP/R3+n7quHXh/8WwBAONXDg0QxLv68dmBt87bot3P5X/MF8qYsQOxkq33LAssR5hGTPVLKdENuFdLrmYFx894yFObxMZDIJN/f29NtHRLts3nJdthu/5PuEsvxM21z30XfgS0v9pISHMxf3vDmcTX3x/cHn0hg2zhPtjZtjdCYSymYFTTlxlWJM37iq1KiGK120/KTBnlk943YNhgf+IFTxHOI9rvJk9bqRdin3zkT9QHmVPxmEWCqoa99W7s6emYz+/YLt8R3x7K8E/ZFaskphmqZZXfzQk7nPlP5PnPXIGB76RMNemHcenmyZMNEp1y8ziXsMuXFTtT5uUOAYLbIw4GLeb9zh5JgMt3mbd0S/0DltwaYWg3WjTv2WBnOk0qus9nHX0tt4Vbqmx/A28jO2i8xZYzWZpQ6SgNo32Pvo9m5UKQlIeYdUCaAk7Yyf0oJ2P/Iq8LoW9XEGmhE91L4BeWE7WII8Eovoj7mhx2Q6nlwEWS6yFB+3hSiAu2lnx9jHrIwBB7csvepJLTLdGmKhlJ1vYqfSSCcgGlbhnBJSIfhPCRde230m/qGbGWZ9Rz8ukOBKPv8Tj1FvR/E+7H53Ky1vwCS5ka2IGfzPCf8dOAjhTJ/hpH9w2RH+khGklKmtOJRzx7l42ubT1SyTnQSZbe1dCLnmpnu8Jegtn4E3WN6uMvOXlsgt3pK92925Jzuft5CtgCI9qga/81yGMfiU3D2G3WuWO2Jh33iPuA7WzX6oH15FCBS9GiK/EnNgwaJduK47MTW5EanYLCzOLBm4emsmO/rvfi25H+/a52FElRKxmPaPZEFDtqZMoslB2aaFWA5mwdZoWlsLZruzDQxVvj3Cbl/K6a9jhvWnEcyxvIXc/kdO+3b6MFf6oNqWKorKqkNc5kqdTml6vy3n+AI5bIEtH3m6Pm2iisMcDhV0rUr2oS5WOd1F7nM3KCOrf6jFQ6bUjJe/6CSmROR4sial6yrbkzza64DkDVCeXe1iKoqqhFwK9Knd6TdOasMks/0yFV5MiiAW4AHcOIrAV8V5dJZ+yST9MH09KuAkcVIKA8qt9J0IGIgL2gs69bHnLIyf/NFhFf+6LzbXQ9DpQj6hJw42LfCtlUDc0ruvefo//kXpPAxew0m+q8pwwB6x12/cIG1e+tvoWYvBFKx0LEoUV519SpEgDwMIrmEyw1z4JbAZ81NxIaOeIqp4vO+k/1Ft9k6P1NbOpv4xJJA== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 939489ae-321f-46ee-80b4-08dc4215d006 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 21:54:23.2771 (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: GZ0tnDF9m/jsTdQKXzG/QohgYPD4hPyIYgyFvTasxzxpPbbsjSsCvy+2HkIwQblUTnV2omtTMD+V4mM+Ny3keQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB6849 X-Proofpoint-ORIG-GUID: eNSSeGAzt4QnFBgSCEpBtk277xYBThGg X-Proofpoint-GUID: eNSSeGAzt4QnFBgSCEpBtk277xYBThGg 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-11_11,2024-03-11_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: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.029, 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 QAPI arguments - uri and channels are mutually exhaustive. Add negative validation tests, one with both arguments present and one with none present. Signed-off-by: Het Gala Suggested-by: Fabiano Rosas Reviewed-by: Fabiano Rosas --- tests/qtest/migration-test.c | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 392d5d0b62..9e3146d23f 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2608,6 +2608,55 @@ static void test_validate_uuid_dst_not_set(void) do_test_validate_uuid(&args, false); } +static void do_test_validate_uri_channel(MigrateCommon *args) +{ + QTestState *from, *to; + + if (test_migrate_start(&from, &to, args->listen_uri, &args->start)) { + return; + } + + /* Wait for the first serial output from the source */ + wait_for_serial("src_serial"); + + /* + * 'uri' and 'channels' validation is checked even before the migration + * starts. + */ + migrate_qmp_fail(from, args->connect_uri, args->connect_channels, "{}"); + test_migrate_end(from, to, false); +} + +static void test_validate_uri_channels_both_set(void) +{ + MigrateCommon args = { + .start = { + .hide_stderr = true, + }, + .listen_uri = "defer", + .connect_uri = "tcp:127.0.0.1:0", + .connect_channels = "[ { 'channel-type': 'main'," + " 'addr': { 'transport': 'socket'," + " 'type': 'inet'," + " 'host': '127.0.0.1'," + " 'port': '0' } } ]", + }; + + do_test_validate_uri_channel(&args); +} + +static void test_validate_uri_channels_none_set(void) +{ + MigrateCommon args = { + .start = { + .hide_stderr = true, + }, + .listen_uri = "defer", + }; + + do_test_validate_uri_channel(&args); +} + /* * The way auto_converge works, we need to do too many passes to * run this test. Auto_converge logic is only run once every @@ -3674,6 +3723,10 @@ int main(int argc, char **argv) test_validate_uuid_src_not_set); migration_test_add("/migration/validate_uuid_dst_not_set", test_validate_uuid_dst_not_set); + migration_test_add("/migration/validate_uri/channels/both_set", + test_validate_uri_channels_both_set); + migration_test_add("/migration/validate_uri/channels/none_set", + test_validate_uri_channels_none_set); /* * See explanation why this test is slow on function definition */