From patchwork Tue Mar 12 20:26:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13590583 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 C46F0C54E58 for ; Tue, 12 Mar 2024 20:28:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk8iA-0002CE-Ug; Tue, 12 Mar 2024 16:26:58 -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 1rk8i6-0002AW-1U for qemu-devel@nongnu.org; Tue, 12 Mar 2024 16:26:54 -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 1rk8i0-0003AH-3r for qemu-devel@nongnu.org; Tue, 12 Mar 2024 16:26:53 -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 42CHa6DW029332; Tue, 12 Mar 2024 13:26:42 -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=CLNPfbaUCeArFvd6JmUcyANr77lFeaCYh/Ads3GND I8=; b=LgM3eSGF4hmcCe4LkmuzffbiaFgDlkOuUmx/FozIREe4+WFCK92qpoR99 gK47WZo3wIaJy+PEQbn/dfL1qtRtWNxUwI4JRSLR4HXO0Nb2oP/RyesJOOlyk9cy K6ChGAkVpNuVi0J7oQoNER2F5ys8Sln45TXCoURRd+QIBqLBQYnaQNPKOJTCwPSl B8pBFCKJ8/eO9Bnsc+3IWy/ZUhgN/XyOxLhB4LsZ2cuTK2bdptX8fzPPJwRqgv0U vQEH2EU76JJcbE4YNWgtzpSP+6D8Ycd2xfxJ0YFgc/bCkKjrfOakUKh1ug5t7V6N ynvDjUDIdfQFOzhiBmEn+xSKEq2mQ== Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2169.outbound.protection.outlook.com [104.47.57.169]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3wrqqhpvh1-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 13:26:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ejOpeDGrK/XDEIaTsJcuHWO8+TGD+qTkMfXDo3107hTWw/Y3h9EQdHnhNZDmkf3BNEowrj2BGQGwpcPDumhQPi6aK3xOCVgJ6K3LEefZi4jRhKwn33NnP5jQPedi4EHbBGt5cGXxaKAH+pZ2Gk38B8G2wa+4AbgVRhCMIqATUgl4mTDzcXVp3/4w/raGY+lK5HIsVuOcn2bPmA0QhN15dJNtJmAcG6sn5awEtdv24xZsNVWGmUMASlWnVipEQeHFmC9Lc9qjseEB1sjTWTXDXMU9MbzCWM4050mYCBXJE4yHIbkCt+9DTwfCs5g2PSq6rHoKSn5IY0qYD0awKJm2Xw== 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=CLNPfbaUCeArFvd6JmUcyANr77lFeaCYh/Ads3GNDI8=; b=anPfn/bw4hxHWtDZdiuqXjtYKed+HUuzy1Nu2trJ0MRBe6LS0gHzGPNZfY1OYS+4uBBrEcEKyxDd+eHiKaJzkFp3RCzwBAWJLL/xLU/Ixf+1yFCVf+8h7vJZsxdAUwoGHzWuL2iHCwiaeZ27b4qMglXP1c8hujxJQ6FY2kFYjQ/b7XczjTe7/uNoL+cNqErKFJd1ATfpSmVtpwAfYaILAnqhHITuMdKvK2yzTtdKYPbi6tlrEu26Dp3c9Il2RKyqQf3t1sLclVFYYjXiSrH56nfFBQdysc+L39/rQy1s4JNquQXCMn/9p+i06lASTAJjG+vCmqrhucmre7TuZ0ZpZg== 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=CLNPfbaUCeArFvd6JmUcyANr77lFeaCYh/Ads3GNDI8=; b=rDoyVLd86l0u1xUpZ+2hCs4ANE2uZAkxPi3kdf4cCKv3YU++xBH/+dDUWThSBInpxmZfUqLycOlttcZA5BeKLiAa4oeMbHLyBjtBGg8hbKaa4Cd10UdMTS/UZaIajXERRNVNVS4To5aRPY7mtK/FpqcUala7T7e1mVhJRfdougJi9QgVd0B+IPXzlmX765Bxo6muLnKaM9vDsWpox8YQxWEaoDFyAtg6YfsYeEhuING9mxE15FmUCxMzYKwCffTQ6jT+dtSAL+r4FNvcb1uoUeGsbJ0ZMz3m5ws6VemClqiLAd1f8ZWMpXo5i6BBtlkQO+B8icGfoaPBAepwWRzlSg== Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by CH2PR02MB6613.namprd02.prod.outlook.com (2603:10b6:610:79::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36; Tue, 12 Mar 2024 20:26:38 +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; Tue, 12 Mar 2024 20:26:38 +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 v7 1/8] tests/qtest/migration: Add 'to' object into migrate_qmp() Date: Tue, 12 Mar 2024 20:26:27 +0000 Message-Id: <20240312202634.63349-2-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240312202634.63349-1-het.gala@nutanix.com> References: <20240312202634.63349-1-het.gala@nutanix.com> X-ClientProxiedBy: BY5PR03CA0024.namprd03.prod.outlook.com (2603:10b6:a03:1e0::34) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|CH2PR02MB6613:EE_ X-MS-Office365-Filtering-Correlation-Id: 340d67aa-9d13-45ba-66d3-08dc42d2b828 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: yYkNuSmQjBWuBBw1L5n4tSMVxSb1OCXZprS91hErKIgBQakAmboOL1rYoOx7v4a/NSh3+x9BREr0xrC158S0/Z2iJM85N1He79Dt8wUsQekNTQewmwxBhNMRrpxW2/tg+5CQc160DAN6sAjS5lxuTtIhnmkeonCT+p0w8CihF+ywu/dL5gWf7Jyd4gHuay9LYshhww33z1g39563ijcw+Cbkt5qts3o84qYBBuuan2yVE5CUbvG9OYxfXLkKxAyl99Dm8X2mN6GeIslqpUKx5Cb0MaxImeqxfm3gfPV1Wc1OGR6qNuMHILwV7VEvrBqYzl2Aiqm2DcgenBNtt+6SEyw3mVTcEgYhEmMNHv6psaS6cWEbLwv8dNLVDqY9HSalKCZDXp2c0M+InxUV1Ewc4JiH6vEHMh3iYnxhYSy7XpjEwPwXHhoSeL86fHYSlfd45ekx+Le7yChLuC/6W7etS/QKjb/Y7Rw8BQDPOGf7q6fCl77tK773+vI/J+c4bcZujnf+d/xPM+4uK0OW2Y6J5JXDctEr45j/jypyIxc6NO27ht+/EB7zuNANM9/bZY4J36lBZRXfRbgYUROW0+xzGLoC/pWDdhacfN8Lr5WsczTYNPo3zO0YnYvBLoQW1PFVMoZS/NBpFPiIOHY2KLLFRDbfT5twwesHYmCuaCm0eCY4ciOFqIr9uczWcNZyRQjN1UzphaepeWJnA3AwHLB2mf70Xfu3BLMM2ODQI+iM9D4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ2PR02MB9955.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(52116005)(1800799015)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tq6SoIxLFyV6dU3pvwLkSp4McCL5gWET9NrbyWDioTPB9D85kJlh94aa0s7uKl2dH6f9nf7WbY19bo5FtbOd1EDBiP8FPJe4XHmWgbjYZ/HL39GdF0zTHwMVGYNv1RTOlGaqwc0pUilMuT6hPXSc7/ckKmsOcr/MxhtMd7jzmzwXIwiZJ4oKM1JeGoZQNWlBtsb8UMSGSpefEIcUmTrNkjRi9Tyvfm7f49zi6dWp7EUJm5Uqx6Pq3lRF2+7kwLJnWIavAtKDhX4r3woDeTnJpO8qWI+HpzZYL5xaRn+b3uwPPyBwN/9ghAMTmsI1wzAXhZ1ZuaXJabrJLNiWDTJWs5pK3cDX6ReHrQ7XLsMTjzfwWX452FUF0DQvP4WPEhnznyaKxTSv3FQyitZlJIK4hU7oCmC29zrGrX2KKLx2l/mBqZVy2W0UPd2NJvENz9t8E+tMQYv8/1NDgr9vjlqcG7PN0T3vVt861ier4Hml6F9g2MpcYAm4WBlhwcuV8kssLtzGbHSkBRl7+LPVLjhZZ4cnfWxA7dFIcCj5OVyc6iSGOAk2N357XL5XVH46BVStDH8WVQVCJMyi1mpd7a7u+PUrRPoTqittTBQvtCBVOsx1jT4K9ERvWbEUFY5scdUEwCYO6OPCjRAXOfPjys37JbTcuGM9bAbqzMzwAwdwuF/dhleRHoehNdgsGNCmucRv85tlTseqpl5lnTj93c74IINSW0Z5xo4hiKYOc/HXe3ToiHq6+T9dC4jnJ5jHIjOLsq8mJX/XNkTH2Q5cAerh/Hd6mY17Rc9vhBKEn7ae6gMRn9psTF+S3TpCxJ3x+ceUiyid2uDiGEzkcnEXQjJYYGQxtHzl+XOHGZ9mtuec+SNF06sHkz7KR73CwYC66V2RFTbxAn5211d+Y8htIEfnhBi90aUeut/gTj6KHf+mvyU4KvFnfFX355kqvopPIYwD584TSHzGCFHUyKTi/i05UhbuNAErKw6QHQ1J5gCm1cWuEmKxxBMe4S+cB9ZuRNH4C2WghnRQ6+UdCHAz6eYttY8yuLJY5xzDdMMsEM4sWTiHhFlslAeFfSBNSlQ2zVR3XDbkdy5gJQumXxCDdBHGNMW6LjckoeHc391N6CDIKm8nqVdPOxDVAseUsZQL3sS9/7T1JbNxrdtIGgp0E+EAS1lXCDj08FWw/EwL0v2FaOTa8tjiJ6KO5kEW56DIcBqSWI6bV2CBCZsrvKYC5Oeo6/3Ztwj0zr7jTsa23x2AM6S1b2Gl7rKVD4ZAzF94gp4fGQglmdJy5m/vlB1nbsO/gKuVRRIn9M6Ej0zmBcRhHxQJ5dyl7TjdRvk5wwfCBJh4TD/e+3An6uTwXCbDQXQHG5wxl+2sLQzuI9Yxh5HCBHOPDgzIGU+aNlEyVHdEZUQhog8qtSqrSv52g/LX4JHL1968l/pdshwHu+1bo1HMHE3qYDQ3hTCYFLmVwkN4FUKyJeDfqRxKU/hM9uJCJSVXszXkJ+bGE9SxynmFQCJwJPG6kQy+WPPzPQ2KgNTyWEXiSgPMkANiHX2cam3H+W3zjBlkBdtWhZraF0IavzauzxdEtxbZCMq1ej6PZBQMii9BtXTfZxSPmJZ2CMAaoYN0QQ== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 340d67aa-9d13-45ba-66d3-08dc42d2b828 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2024 20:26:38.1225 (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: YNc6wj6yXRS4yY/LyKN/AWrRAPa10DCtVim9H0wUUxCZBjF6/R0i6nvB6iaNsdntjV+CBUraDpeQZsdXsWTrQA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR02MB6613 X-Proofpoint-ORIG-GUID: 4rJwEF564LvkDXsHc2NVDBOM1F-MyiRG X-Proofpoint-GUID: 4rJwEF564LvkDXsHc2NVDBOM1F-MyiRG 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-12_13,2024-03-12_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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, 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 71895abb7f..dc1fc002f5 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; @@ -3077,7 +3077,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); @@ -3109,7 +3109,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); @@ -3442,7 +3442,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; @@ -3483,7 +3483,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 Tue Mar 12 20:26:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13590579 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 B6AC7C54E5D for ; Tue, 12 Mar 2024 20:27:51 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk8iB-0002CW-OK; Tue, 12 Mar 2024 16:26:59 -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 1rk8i6-0002Ah-Aj for qemu-devel@nongnu.org; Tue, 12 Mar 2024 16:26:54 -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 1rk8i0-0003AJ-5n for qemu-devel@nongnu.org; Tue, 12 Mar 2024 16:26:53 -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 42CCX4uQ012798; Tue, 12 Mar 2024 13:26:42 -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=lggMEGI2IW/k9MFI8/VUwWezZOPlK4o83eTiatX81 U0=; b=oKv/6uvx4c5ua2DuNtoh3gtTrF2kd/9R4EE0ueCZeEeUAqrfBSrJYF7Wn OSgKjrl5w8nKiIuy1ypyCTZVO1vMUsbindCf3AAVYromVG21+72PCrPSXX+kOIqB DVqTUeHEqcz59Z7Av7XgDn5HmrM80zesKvsYK13Q6gJH5dBNLTi1qSDD9l4q0v/x 1pxD1rWSYX8LS39v3v/s+T8R9Ax8SlIPEdiRtuRBwSK0R2tPXNsba1ANm4qaLsZh OevaY7nTNOZSEcsM0LLjL1DFNouQ7qeBimA5Mk+VlZQvuX71mFIp5uDaTIBv/4nI ty78WjmyLbuF23aKiId8OxgxB6xww== Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2169.outbound.protection.outlook.com [104.47.57.169]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3wrqygpuec-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 13:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IttPINEAgVt4S1u/qld1uNgv1PFHHtMBwroUBHETfEjcxqgLB/RbCJiiRuK9wkzoQ7440O8cvE5f/qfTA1joEyYaMzsjJBgOjiislw00F3dCxdCztWhALjN9m0hH2N6DQxWOUZUv8q3xgwSXif2ZCczOIDY3CHYbWRuPNFOPvv4JJHslr7TL1MDqyH7A3IF7+/0JLZgi262n0k+z91O3ZjECwep/yKvN6rQBdHEt29IKrk40NcEQ5D9+QcyNP5EKLzB6T4QaMnlS9OOvAQS7zIIcvfC+oUS7ZujoHTqmWAkVfZnfZZI/ZSr9uK/tGh/5J0qLKpL2sIfcPIjjgmpfBA== 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=lggMEGI2IW/k9MFI8/VUwWezZOPlK4o83eTiatX81U0=; b=Qp1hi3twzirisIzUg9iD1D9ZCIKY2zOwJ0aGVOqr/ykEg7Uj5jHY0Nhj4/Qi85+wvAdBxhwnjE0Lx0H8yMfgjlmjWF+T4nHsl5DvL0UknYsgfVowIplCMSbvBjB/tJbVLV8fJTFMt/MiEjoilvg932ByLXZkrwDcQASvbB8FW4v56Bn0EIdKQLKEwjQFytEu8CBgnWBrHKLFqbbWMM8MaMJON92fWts1JVfYcOoF0uTt29amPyfWxDCBbrbZwAzaLn4j9YitKcKC1c+LeccK/a4B9AhfCJJTrlA+6z4WgyIUWOXGH8FmSbDb18cz8BM7rK6N8lZD11EphZiY4Y8hyQ== 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=lggMEGI2IW/k9MFI8/VUwWezZOPlK4o83eTiatX81U0=; b=WGt4qYsV28TfhtEkXUeZrxYbzb2vq0XOWzifliWRz1wQjuTazfMqWh2C81boePn04O6IqXI0GLRr45yYmTRI/OOLb3qW5DUeENQaR6o4U2og+fAzvKQ4TwgTKLwUC9DSclMAVES4OjFXbGZy8GAYccumD9JMn68S+EVh06XKqoOQrSW0KbFTihd+Qq/NHL8/R4A77stTbAhP2WAZZERMgg94FUyfqcUtIIYskJItO3sUQj4RsUEKUNxCOf+UsCSNtK/G2uiVb5nzA4Haz3WYiNTTiRsW0H+3YeAnt29xDc8Z46lzFO+1T7cGmcaMbnpCQ/zTntaF6mRL/5I1dx8xAg== Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by CH3PR02MB10057.namprd02.prod.outlook.com (2603:10b6:610:19b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36; Tue, 12 Mar 2024 20:26:39 +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; Tue, 12 Mar 2024 20:26:39 +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 v7 2/8] tests/qtest/migration: Replace connect_uri and move migrate_get_socket_address inside migrate_qmp Date: Tue, 12 Mar 2024 20:26:28 +0000 Message-Id: <20240312202634.63349-3-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240312202634.63349-1-het.gala@nutanix.com> References: <20240312202634.63349-1-het.gala@nutanix.com> X-ClientProxiedBy: BY5PR03CA0024.namprd03.prod.outlook.com (2603:10b6:a03:1e0::34) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|CH3PR02MB10057:EE_ X-MS-Office365-Filtering-Correlation-Id: d188ce96-3120-4e49-83b7-08dc42d2b90a 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: 5Fwk4bldD0bOM9rDZKRiWnVeAV3vEbLbd+K3VqBcPXaDCYRiYFp95GAJj+M7MPgvkOBahsWOkxyV7TRb0c3YGv9phSPql3HueJ7bP2QTETYpHAocbqDHOqQSnvSdsZ22jfVXJsDbqL+hN9Gd/v/VRVLigtsN/pchwU3QbIk6hu4i/QyFZO0tZ+T0e4puu4iAyBZj8pB0fY8qPzcEcZBptPZilym1V8pxp+VwGMCJxdQrrXMy6vc2k00xuF+bttTnZ0V4rnzQB6b6bHFz0UrTvGYBNMEWO8+4E/z0mohO8SW/coFEftIogiF0PrklVNvkzUpp6c7ZIXchUyWdGJTgh6nzKuGSEitu+hpW49kTE19+mt/PDO//6V8cU9JdfLlkZGyPMDvk8eLqzQayOSeN0M1Vs5UsinBctVMlfd1q6gf2IwV0KbOxznLrJaL/gAS3ERhlbOTnG/wweaqQRKKaAsbFtj8TcgEQJA+OMwU3uuiaXY8YSG0LyRmJhrMUGPaylQVxXINvTRZfDCDWkgA9cMzX5CCf5O9tMOeaAe2ue+uLWjOPCpQpSTzeou9znkA6Sv9aPlhrs0alg1ui7EOU3yUo8kNJxe/T8yrzps262k9E687eiWpJUe9pbil8L1KYUqBM6tVLFcbtWMd7DMksO3Vw2lPdxD9rNe16mjFjWK4Tx2It9pTPndTzI7HHjLGuvy5Dw0PbSJfF3Dlt+zxpX7cjz1l4C6cB74z8KdVpJ58= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ2PR02MB9955.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(52116005)(1800799015)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cJ2JDx35WczLLJdDGKXvC5NMzfBkjjYzlkRp9TC8V+bMrY03tKgyCPS7ovnJQGTeoDAXgPaIfyNA+C4JE1IB05zt8tXguf3EyEKTgypun14sr6iaiDWnffgORnZX8uSMS9KnoNDPSTxbBQuBx7RE5SnY0kp+2+nKwSbruVH0phZMtG0bNO/tb3+pxggEs+Z7skb6LSMzTT6aG4lpGfarXDM0UCkcLfNbRIrbfhWA+N2LxQmUgjtjh7qohjVhMGVGy598CjtEhlTzeIqzJZrmZ7IStRAEwAffwZ6Hs6h/DEVsEQFvBZM8VM2txQKXG6408TRXscEzaaC2niCfhHVjPaowUx2XBVEa5/QZx3jSbb8c05fvJPzjeAyhJiYx7sX1CY9R0FZ5lYuN+Ke1HqVqOhgRfp9FBevOfF3rlHp1xolP6UsrVayyX/WWCsvGROWwde922JbIyBF4/0VOlkbu8lKMBoCpxKc2mrb7mF11rVkcH2MdnI8evAtWfmR6LHfqzBeySUbLtrTgcnWjW4fc4SyNChjBxk7a+PKfWyg4pqfv4/tGTAZ7yPvyJVh7tHDMVYPqBamfaulMBkE1jdgM1Gz33w4r0UGRNg5HvsOoYJGfm0jM2vY4zSCA/YlXx6qPE7dWfhuzWdSJYlEZC2BWbDdPQPZ1doTP5Z99c7aroebX9rQ1CmfksGnWBFfSzEDIA5OxqZ9szTbNd1eMYHNLZEb/htn1iO5X3L3EPpjheBkOO5oVUeBELmLXKR0wzr7+0CWvYrAqvNSIy2uW4rHCs6n259rGJIn2isUyU0u3+7FrDuNz7F8dX2ysDS7J9uSjMGQnqodjlNSwBaMr0xzYpnaEUtZKE5HFQpo0FfiklTpRTHXF5osrjloT/R0ppR43MeYE4fNj5/qMGH26BxUUXFv8qH8V4evM2LLf4cGolIJ9oqhLdZgxq9bQ3ziwhZtXeKEubLTkgPAVVpoAz+MetVtXrTDq09VMvELheTVPMB0lSnXbKdnwk+wh26zOD0Z/iCHLDBn3xf+FhuviUDPplTgpbURMbRjPmy684B+DMvCzATkUyZp/9+ZOG0rf5RErFzt3A29c9QZI8qXgjeNhCZWKDWCo8trRjewCQc86XAZ0GSq7+YRIgt19C6J3v4erKKDwdtkp/mo38X2ACRydt8bGsnXBsguTbwplTPtfjze4ZOTd2Ev4VON6rlQOrUNWU0bfJ+69Ck9o6/N0ywjHUMe0NAX+FdQAFG6Mdklmbdy7AiUaf/1QYlVEnl5PmCHTWywBQhKs/rDuypSbk7xh8vFgo2GaD6pd770ZDmUkjCrQFlwCTN1mmCqKGex7BBcQOLjy4EfEGq6cg31rdnOQsrElGYVw08Zeppx3efqxIfmIg/VWThXlhlrJQhlIpzeP/koopt4MzQF5XIrKAzUNlCshMrQ/yYvQWS0vz+MDMdETdkgb5nRiKP6A3lDZ6+PmU+au9yNPC7L4PLdaG0KGMoskEUhaKsldEAIyLCpUUa8srJYfuxujFaIecHViGVuDwoukrWVK0WTFdgowTH3w1DpRF9pRFBMtuDc1zQYdlYeamuTxsB2V5pqo/xNcBz8/g7QO3cFPafstMKExAzKqGg== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: d188ce96-3120-4e49-83b7-08dc42d2b90a X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2024 20:26:39.6017 (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: YQhvcvYyTH8ugKJzg3lAx17l3l9UEA2UbvqAqMLGsWIh/crNIXmWkovnSXD5gl3p75qcw5KpHCz+mhLBQv4iSQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR02MB10057 X-Proofpoint-ORIG-GUID: 93U9awH9ipzq64FEj2g58oh5yBumzP7O X-Proofpoint-GUID: 93U9awH9ipzq64FEj2g58oh5yBumzP7O 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-12_13,2024-03-12_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, 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 Reviewed-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 dc1fc002f5..7f6a14b19a 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) { @@ -3054,7 +2997,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; @@ -3075,9 +3017,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); @@ -3102,14 +3042,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); @@ -3442,7 +3379,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; @@ -3483,7 +3420,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 Tue Mar 12 20:26:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13590580 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 0D1F8C54E58 for ; Tue, 12 Mar 2024 20:27:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk8i4-00029c-IP; Tue, 12 Mar 2024 16:26:52 -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 1rk8i3-00029R-1L for qemu-devel@nongnu.org; Tue, 12 Mar 2024 16:26:51 -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 1rk8i0-0003AP-4K for qemu-devel@nongnu.org; Tue, 12 Mar 2024 16:26:50 -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 42CCX4uR012798; Tue, 12 Mar 2024 13:26:43 -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=O6TeGdLuTKgLcGcj5ZcEavvYgy5Xsqp/pD9DTS15T gw=; b=X2gG3PEiW8uvVQMhqR3T8MGU4pvVzFYDKY0aA2/nX6RYMhsGiUZ1o1CpT vPEVHVC8M2Nm+smPkDD67P/3asM6DznRChkS/2Ojs3WFNprulik/bLG62lSIWXF6 KDljF8YiJTbO+NGAEisIuvEzSQihDW9AG8H/p/w/Utp2mVQNApg3CCJmpVr3uavo 1sz+9SGa6+zk0/yEj0qAZmFSV/Ie4kggBE7gXF5fSR4PmJW1+nm92XyrBhgkBiq1 XEK+f0/wM8DRNCh2Pvn/r9qpz2+JWl6EymjxeYcAlxgghn9hZsLqiNeazHFwoRML HHMWytjwfxG6JTrQWSH0Zj4iLgMaw== Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2169.outbound.protection.outlook.com [104.47.57.169]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3wrqygpuec-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 13:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XRp23H6P2Ohh2G6Xc8pMj7zjhIGukdfjqXKl8aD8cwsBy3krtKzWaWwEY/q2I+Jk1FDUN78oxTs4Ke/Od9dDClxeGjhbfH4Ezjd8DB9FJB+K6jqxPyg76GkDnl5b2yoHJS+6vXrb9TTk8KL24jNdoabsiQIQS6dW+BCfN/Tdmb/rVxYBB2Lpq67jGoHfpVA+BGmjig7ehsaTV+/TSwURTZTTkVEX8Ke4mZ1a5h7cy5HWBn7z5Dwn/QQVMrUV7DE/AggXAqR5L6t0C92QqsD5NJKEiib4nJGRHMw/5cHfLGax3Az/1cUPLMzgyXTBX7IA2QmK7x/AfxqjfPvlg79V4Q== 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=O6TeGdLuTKgLcGcj5ZcEavvYgy5Xsqp/pD9DTS15Tgw=; b=bfU5HUpneQlOw8R8aEca+3Lz9/kvBAA3Ukzu2DgJQxh8kHQWYbFNYQyN1JTgVxHjZKmQ6kASanTYLyj4Qa9ZQgz9RL3tFYwb0TotdmxGNgN8EwzrDL8Mr3OTBzQU2ydyGV4EYK1e04pDKFa4bXKk3Sm8YFiXyGS7APNAChVnQNIKW3Lcz1Y88r8cul+XdmQnHiOV+kEK/pjBTn8yN+dxoKtzxJa+P6dPHO4T78TABWIRZkKp8UNWMgi4LP94tGKB/j4yxJmWfmMJ9/ymcOnCezUWD1GAbBaathhWYsqxElaiEYrTsrqBK0BsZpJ+V/D6jFn2lx9oJyqA5EPuIFqKcA== 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=O6TeGdLuTKgLcGcj5ZcEavvYgy5Xsqp/pD9DTS15Tgw=; b=aN5+eHvtYeHbgSSrG5iWQUwuBtCZF38bh2A2NRs5IHT8c5g95/txEzHWIw5fem8pFZI0qPar+ux8udJt9Y9uzCRJHDm3zT1bdayFWUvF2ODiiuNdM7PyA0PRX7BzmldO/LBm4qOoJzBKS2H286iNoEbnIdz0bF8IW7WrkR4BvYxrDn1mEpdgjWvN3zLW9p5WK+OnGLAaBD6NwpCoSsgChgz1Tts50mZg45T81g/GYx6njg3W+hXCOjkH3ppyUE7X/PbS5OdPwv1ltscIXiECETQHykorye+5jVNTsJa+vMHaqmXe/Jeg3ALlBNOv7oDnke7FfK82rRWEmxgQrBMm7g== Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by CH3PR02MB10057.namprd02.prod.outlook.com (2603:10b6:610:19b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36; Tue, 12 Mar 2024 20:26:41 +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; Tue, 12 Mar 2024 20:26:41 +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 v7 3/8] tests/qtest/migration: Replace migrate_get_connect_uri inplace of migrate_get_socket_address Date: Tue, 12 Mar 2024 20:26:29 +0000 Message-Id: <20240312202634.63349-4-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240312202634.63349-1-het.gala@nutanix.com> References: <20240312202634.63349-1-het.gala@nutanix.com> X-ClientProxiedBy: BY5PR03CA0024.namprd03.prod.outlook.com (2603:10b6:a03:1e0::34) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|CH3PR02MB10057:EE_ X-MS-Office365-Filtering-Correlation-Id: 5e137920-1592-4864-1b36-08dc42d2b9d7 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: UNghYDrz+dfEzfhSegmnH7uhYkjhS1ApjmUWulRYjdLPddzMx7wB1pwuYYJgtIf09RZjc5+XuUgdZ86dKjLodozaM2Jju6wG8ItOLz7WbukwB0thCWmogUQQpjruRjwYvCHbWRA7135IMDiJfQF4XVo7O6nwd7x8Zl8C5kUNeKUUR+m7atfEVYlHsOOMvyx6n3boNDw5y83tpsiyEfY6xfURctOjaVbw9vUX7AwsSEWIVyRde6k85JpfYU+rZU01wWs2809jQM4NeNi4AS/BZSmpMgZ7ThfudzdVrYVf8AnawJsEe7hTi6h16XwX++UJlkN9jkd41bWDF9ihcwsjzvtA7J/0rPtPL+rfQdIQJQ+ZSPtvs/An9B8T9TJ+ZIxM1/68QRRvEQ/LZuSAOFEPyE9YK3NVrJXA/GOZ3zQBQDC7XhhA3BfeoCJY4q3m3qSmUwl63LoftfIur0JfIyuTxEOeCI5QbdsmAc+QV9QF9933H7mdrzMDoRGImi2jTidSdMCTyzsUJoo9/Bc32QXI5N0zHFHPIA5PlihgKBc2I6W7tUgYFcjilakNSFN/NSl6+HvZZJXA6zx4PN11X2SPWfVYCrSldtD06u0pkN9tS3PF+26MyWEZ1dKGE/ZPOMg0KBFBouI6VvJOj2ZPrwx6OBHvd+RT6cb1vcWKjRMXTHhG75HfoChSmgzFlcuJdri0CBw65dW9iml2xHcH+kaVhnoz4X4iXu5dRhscbqTScBg= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ2PR02MB9955.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(52116005)(1800799015)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rdtiXwcuY3MVWPQHkOKmWSJnsmAggGawPCQ6/gjCFCVrG5jjBXHHzOlW+37ThfjHGXyRjPflgKABm4qhDDeCoPICWL4VRZdQ42LdsPUtO5jtobmZk7wEsoysRavCSaaYDPZPCRmJPv8QxLiziwxLk9AnqaR8gPJQJEPvzE4isNLVPvdf7qM7pMlwUu1AsKKOXn5DYB7x1K0i8ttmaCQJHkgGntoym3/DEL168/fghIZdafl9p5TAYOgookucftY8DNZVYPZo0YTASm4t5+HvPxPcMvSr96NdsGbusN5to9BvbQAmXRO5t7d3ZgZ/dd4Dff47AxXMqUio01axVnc4DcUQYUT5J7Utc2gwc+Hk2rnMANn6Ev2IEo+5rmn6PgCeJBYGPFszSv1VpmEhL0QLcy/h6tbP7ae6ghsEdPmKD5WHi6ZFpmTqwzYnOdXi66U2f4KBVl1+yB4vSBYITZW8LtmxybujLHlnoRUgP+THphdXWyfJUeKptd1FoaMho16QjNwz8W51m9i4VLfo4SVayN5g44ajO4JwaWrVZ7HvsUlqHspimWKDyt+nLPJkpVZXg4aMz9P3QP8zXNvFjmsXXpj51iKs5xosZJeQdvAVFV9jleAKr9uBl25rRlAR0h9ci4EGv4az14/JCVT0KweEQOvmhsGZKKMq+DvTdXyMlA9gWM08Cmsl+9qqN6nnoa6ZAcUYiwdHi++DShDCK/qF7ggf2T70prXZykPnkhMXhm8WA5Pa1hGbOb+KQ9R5C5Rufb2bDSltjiKxc+DBNRmBT/08Y0PT9sXU3mcZKTiIQ45cdOZfxQsogUH3Lvbv9MhH6u2f3Ol20X8j51hgKDxcMMBpQyKB++8aZxy5pfTvNePHZRRIQx2+bUdZkjSmenjcz/qYpHX4700I/a/4XuE6blGEgZZrZabKDTkxwAIM4SctBRkpwf/U9mi3qQ+yZKJdpJg+KYMjsRbD4JJudHfzXvMku55jMWDfCVhbI6KDtwELX3ky5T9dgIntOSgooNmGn0mgQeNi4naUY01H9X9Mii5yf+Pmg4fE20i2erOMWubvItc8mF9IN8Lqc9U3pCe1NsmRSkU/PbQNBWi5irRJ/zWjcyIuWmll7+XwcL1GdfuUCYwd1c7JeVYvzIg/CmL7EN4Xu9pfFED9k9N5yuzHcjk0V4QmZ1nRbZ+VWukz5pSD8e6puALcm05w7b84E1mv4pYuloODs5mxwy1XnysiQGpB6KQG3fr2ro37EoKYGJCQFIBD2u9xtUxuDFxkvOMpPo9o0Es0Av5/84+InCAROFiHSOC59efnknnNOmnG2dw6wRCuXnKNrCXpvbuX/w4cvTDkGoiEMj82KQ/m1pAXY6YDMNRju5u2qrBmngcshVCrPc/yTELYsD4iUo1JR7e+ZuMsM9Eqh1ZtaWKwUXsbMiGR+QLIplG51GhZmPyyG1lVtgiij9TBV0N4Xalj8Gpx6a3Lhp+e8OUDrNyuyUKCOWzZpTB13cqp71gMTMqF7rdLQFDzCf5bfOHETogDVLser/mPVrQDbGobEFxDda9CKPm/2Tt2EjAwZT3CL/K0ias3pVFjpJOeSPEhc3Do7sII3gtrRqqrM6KCnTP/18gr+g== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e137920-1592-4864-1b36-08dc42d2b9d7 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2024 20:26:40.9270 (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: P2iK0/jfHOoK8kYsywLFepEt8Ho2tnDFlfajPzx+gNTS77K/KhzN5KR3xZMun1Y169YHM81DbDodUZa4/MFxWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR02MB10057 X-Proofpoint-ORIG-GUID: HLe2Pjeaag9fNKCKjiml7_kAxqXJ32f- X-Proofpoint-GUID: HLe2Pjeaag9fNKCKjiml7_kAxqXJ32f- 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-12_13,2024-03-12_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, 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 Reviewed-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 Tue Mar 12 20:26:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13590584 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 E9B47C54E5D for ; Tue, 12 Mar 2024 20:28:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk8i6-0002AV-5L; Tue, 12 Mar 2024 16:26:54 -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 1rk8i4-00029d-G2 for qemu-devel@nongnu.org; Tue, 12 Mar 2024 16:26:52 -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 1rk8i0-0003AT-3g for qemu-devel@nongnu.org; Tue, 12 Mar 2024 16:26:52 -0400 Received: from pps.filterd (m0127841.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42CBw4WA019265; Tue, 12 Mar 2024 13:26:44 -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=T0+gkrie4MpAnkSoOjkYys1AqJRplc8D8Lrr8HmCf 0E=; b=b2xsEvPDjHjRA3mP/UFwXB+fc4s8VQNIjJgPEeZEc8Rrdi/Ig+4V0WVHn DF8S7fcZTR6eOJJybJukJuDAWF7+DI8YK6yn+smGguesfDHZPpZJllr6bdWyIuQc 6w7d7CfW50F7RBrQs5jaguYej1RESwYC/daAeXNdUmX2H4GvQra5siJV/Ua2V3PG AXRzcEzNlpi87K0eK/RIkp9e0dMLJhA2nnBRsOhpIUK23Is8ZORZfcwiL8Kbd3LG bfjohkNsAzIJEdC7Q/JCVFcYaKcAzaXnH5Nw1jABGMFZ7W6sP+RwLCb7OeeLMlYd /1CPFpmMSGvc3NS37UL2k1Oma/iDQ== Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3wrp6axxgg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 13:26:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FqaXkv0T7CdMtVojeuRsXB87JohAGUjjnqrI0P9t2dPC8i5u9Y/LFFSVBxDQlFeaLSDcF67v/1MWHi3BGYxk1JMz8KIOpyu+lLQ8GD21k3BfbXa5Km2ErnJ4wKo3M7hOpDdGg/YAL4WraMxpmK67wL7IoVNHKSijmGztODkhbLTu3LE5H8H303ip6BXAzmrrmGZCZitQ8Yum81zmCnUIN99CCoOjxy6gSwHJsVx/+Of8dZOJp/OnaQk+hlrsUuth9eZJ5aaOlmgKWBIMlmIu5qJnNYgu4fmW8KGR3n0OIxcO+iOgC1drrrLhUC9otsJGuDvADWXoy4eBFjEPe5FF9g== 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=T0+gkrie4MpAnkSoOjkYys1AqJRplc8D8Lrr8HmCf0E=; b=M6JNZgc2lOQ8ziyTUX8RY0A4KdOFYdggysKv/d6i7D0BB5FQPaMgRNGQ3nhizJpFs3//2YZbeJFSzPfbhO9mfVb4BY+q/WKQc51kK6YwHG32Dkhm+GI64qvFwACaAQrlTKwGkh5QkQfVfjkdvysMUBOwA5RwjUy5bWpiaEcwXOVGQi7k19GJibP8j1JDAFn2clIIrksy/0VFBgw0poW/TxKjZ37UPvfgtmnCjKPd5JnJVlTq0/PKm4zXpb270JnCvDsAbiYBcqdtnd6NiVowdN1wWqUZwkb4P1U9X7aWAoZXkmmCy41ILXxMMNNbwjZK36OF97Tb/Kwq4R3rWPJ7kg== 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=T0+gkrie4MpAnkSoOjkYys1AqJRplc8D8Lrr8HmCf0E=; b=b6hLq3qPordSNWZhR/kvxWa5wuLo5EQcGJ0xMxEgH3Gc0OYKj7U6sPlCvkkVgA0fv16rcDzJwvTwAtcG5AsIl9Kh1j3/p7diJBi5+4cUnwCKaHeRZFIzeNSHJ48d5R5XKM1bgyEIZCZckXDiOOcWprbMxbK4fumQooFHBZwU2EsEPdvkt3kWJ727pZGp9s94NQAtItCYyWsUKR+7TQOaycHTmqiVysUh/RTNlIz5PrQBnMuWeDI3n0LprDQt68RrWdN1SOXDePqwhB4++XAVEvOKTU02TScImz0YRa8NXi+oyRup8rdG3vh8p8GoawvSzrV6W45YzxOTYXs0KZcgGw== Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by CH3PR02MB10057.namprd02.prod.outlook.com (2603:10b6:610:19b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36; Tue, 12 Mar 2024 20:26:42 +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; Tue, 12 Mar 2024 20:26:42 +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 v7 4/8] tests/qtest/migration: Add channels parameter in migrate_qmp_fail Date: Tue, 12 Mar 2024 20:26:30 +0000 Message-Id: <20240312202634.63349-5-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240312202634.63349-1-het.gala@nutanix.com> References: <20240312202634.63349-1-het.gala@nutanix.com> X-ClientProxiedBy: BY5PR03CA0024.namprd03.prod.outlook.com (2603:10b6:a03:1e0::34) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|CH3PR02MB10057:EE_ X-MS-Office365-Filtering-Correlation-Id: 50f23675-d054-4df5-569e-08dc42d2ba97 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: +K1emRW1d26iHBpzAPDFnft8Ab7K/Q6itATJqrLFGLLokaYxHbvYXjVQrEvmOzV9UP7jqiqRudqnl7RpY8gRjmnGhgMzVkV/Cpf+VCuWC2bTC3r8Jmk8SCjLXTSNlmYh9a2ioXcDPRffV9daQfS6LeVd3sq/va3Z39DdbMyLDNyHEAuiOrZBBVnl0XM2y7yIsLx56fehmd9Dos2mvGo//0e9NWdbdtsvroI2ocxIcEnYceJsNZWlGD0tw7dyKy4Zymqei0PvuJ8WIssfwYvC+5/weZtgQCkESr2KtwF05ufourm1Z4Ed3SYYBHWC0lWUxa5cs6pIES59ReflquCvu4/Taso9ap4uk+X8ZoDdYh8VyVNohf7SROEo+ETsAhBS7F6O9zHbK5r2kku0igtvN84AmnSbf+nC3rTdn91I97MjlfuYw3kw1qbZK55wrY14ewSjzND7xwA/J/R1JVJDeqWE3gC48IScHEvC3KpiRvnsojlFVauaD4bPUUe+MqBeYjyAtYFom33Ynx1kmTWXw/vTBHw6HpF158rncwJGE9q+GjFK7P85mcluyYoB2FTXhe07tB24YScQ6af4Itk1sTX+PALi1hlEPeRfP5hRcbCoUeurYL/0bW9uIED3OrqNj/kgh89xxxh7/hw7DcL05+k9dkXQxhY4Vb6Do7GUXvLvRa1BOxOUB0vulC5S8kkgZPwvPR1/dJqA/tI+1OhHAVSWXm/OtC3FyXcZqAEDJLs= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ2PR02MB9955.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(52116005)(1800799015)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HPv31gtnaLfXxRvGaTeKMqt2UdTvTZnJSWLR8kj6pvSdxU9kKYOa8neI4BjY650nL3FyxC80sPklAVcr0Pra+kR5fp/6I9OTzbkv+lO/RaOhHXSPpkU5jAMjpOhrTNVCz0X/OmOmS5zHrbj3IBrjm358PZgnnVHKljY0GliWNzMBQCmCth9BC0VPlogpjrg2FXwku+cJ25bw//11F5w0gpmTqWLTDd7Pvjw2Wc+hyTOXWWYSKTxAz1nGJpw3XwwmLB7eHjcVziuxr5seZRQqGu7VJu/G4eleUS6Fttl14fhtc0qTMHwiBm7r4OQ0WJf2MUzQxdFBXKP9UMYfp5vYz2lxU6sUI5hsSRab9RJeixk0IQ/O8WE5C5AbdQXxRswfREjWFNg7OA8lTbj4hHyh4RFXZ/v9P5Zxee0VGzbA4MVocPSjoL4Iwc8uFswzOYj20KbEAlye61ifmuyj5Mews7GEYCCPns7wtA/0129llwLB6aRC1mV5V73Hb3t3zpGl+kXVzQlwN/ssVKAbOjxLbjTGPI7aUTiGQIxIEDiYkIPYPlxYrCHxFnlYZk6Y2tP2uMxnKjaQKX4kgHrse3+D/OiKDj1sK7Eu9whjeH7OaqKN+odcAqHfvLj3WGzcLu7y8VW8mIlaxYeLFP5kfluaJMjQ6784hHZ4a3D95XpbhZxYyrBi3z52tDjxUy+EbyS74juHmJuC++NfTyfLxgIaAjdQp8Ye9P6Bm82/7oc4c+rIV+pfnIHFSNC9n/9cn2xOXQwqJTtrMNWkNbZZkXfLpsvdQVKYLyFgwrSM2qNxNu3jvbAYOATdPKqe85gZa3oZoVz6RHr8M0ZM3y6VgJCgMGsGRn/1aEb21SCblnSuG2rXtpunoAhH17/2FxpMSnwBEIfNrIuyr9rVmiKQ3Gt9r1olnBzYcavNyHF38PAgBatTl+EYVi1LJ7Ttbek4o8HXLvZm1TXDf6vodUG1NL5IE8JSD1R4BIWN/FiGWApPjwEoxIGms/JJFC+MNcsT1dmgA90Zd8Gpnuc55po3YBeTvy4l5ZbuwZVmpfjFuqp5e0CZRa1Bb8rLpGZk7ruZCdZHoIGnYa7zOo3WTUDx7uPdzA22+z81E/pSt+RWNviBhTPBfPudcAlNtsiNfFzak1mBReEgTcVGsaju+vCvI9GnTiy3DaHjWUZk3blcysO7m+z1bLd3lH8ubpN8pAgAWLQJ46to4WIqqO7DurCsMSb+y2P2FDH047zSSOFpT38213xEUjl0A/WBZME9SgFeWSt9SWtqbYJoVfUuiKoOptEkdE3jMCLX/37V3Pd1MXj+AWmnvblk5l4F12eYqwb8ooBtpgsUzEx7tNPY2A+xA5t9kQgGPVP0MEH+83uiTGOwsneHcTZV1FQbxjLar9mHAx9dqvlJay3Js71Gi4OB2C1gNgJUSMNn7ajHyeoI9VMwU2SQiYT/xOJft7DmCAxGliL2Ok/a+5Ai4IfwVzcluN3ysF94Zy8i+poyNWgrAM1AOmXCPjJPrSI+ffdMngPZt9GTXbmAh6KL1wuQP0avlC+M311OMIJxbEZ/L+LdSahrHqi1af3IppWfZuUp8oVxGxggUr7SY09i1nP7Q7Vaz2ItqQ== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50f23675-d054-4df5-569e-08dc42d2ba97 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2024 20:26:42.2429 (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: 1pEi7QCyM7Pixxle0hrm1PDRZHTbujfTmrlrfFEDPsUGq731+/xZwc8NS6u+EtZGaNxgedoPxZC48FwpUx0krA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR02MB10057 X-Proofpoint-ORIG-GUID: WmOjHEm40b5si5Lt7XQGVNySXQe8H-Pl X-Proofpoint-GUID: WmOjHEm40b5si5Lt7XQGVNySXQe8H-Pl 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-12_13,2024-03-12_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, 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 Reviewed-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 7f6a14b19a..cda07f8f97 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 Tue Mar 12 20:26:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13590581 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 7B08AC54E69 for ; Tue, 12 Mar 2024 20:27:53 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk8i6-0002Ab-Dv; Tue, 12 Mar 2024 16:26:54 -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 1rk8i4-00029h-Ii for qemu-devel@nongnu.org; Tue, 12 Mar 2024 16:26:52 -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 1rk8i0-0003Ae-67 for qemu-devel@nongnu.org; Tue, 12 Mar 2024 16:26:52 -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 42CJix4V012993; Tue, 12 Mar 2024 13:26:46 -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=99jZ1PbsY8XqInEdiuKTKl/deCt5a3tVT/+s8lvC6 ts=; b=o8jb9oS2NyWO6PfM257IDqPB6NxUmou5FUcgH9Brw2hEv6/hQpNzOIN8L tjhnbpz5cUcx3QES8qeJIj6/vIGo/8/rVbZbNh3kaLey10WFgUC3k35QZhNEAltU 0Q5xot+eaXJBpxl99qkReq+gULStOaGzqXNkRA63FXdOsfBabWqudw8A48yrjGIi m68GmU2G5JFn4VUuQjYZUuSKEswNr2glxc8wyiZxfvvEp+FWkp6Ds6nu4lhllEw5 sHqks7ePZX33CP3OxqnL2C3w5mvWDNFloZEtuWRrlXgePIk0qztCuh4UJitOSYW0 AnSVOTuNFLMf7YCIaOoLLVKzBn+mg== Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3wrqygpuee-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 13:26:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Da1iOAbxasncypzBTSmUctBG3y+/zt3glLtxDN5fd5y/3tCNAueMuH0Dd2+8830BjqC5RTA4y+17yxKHoQ1eKz7+yO4G3BGIW9xKdb8oAkaYX+VcIul8ZFmorSaoWmQ5Fu8TcIa8qywDv/dqDku2S1humSrv/IeuXveCWKEBKYcy0aLkh+EIXJqop3pYos7kYjobGjJeLbzfmFX8UIz/y8CZdJMLWl257UyECiQbpuFp6zakevJsKxmtMp25TJAKXY2SLjxdX7+/sorPW8y4pcO0hT4Owtwlhqt4vlVpoq9hdoLHABEEl+OeDjnL28D7SJvmwRZliWDTaOSRpSbrlg== 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=99jZ1PbsY8XqInEdiuKTKl/deCt5a3tVT/+s8lvC6ts=; b=HaO/V/9bfuvKO50wEhqrz+brDxjHes4LkM/k/7j532HLjSzqnjvT3yumhwcMZ9UUVhzsqaIpCYZ1FYM3NkoSvYKg/+LzhIg4uvud8ctyY+2CMhgQcdZWTpM1tOOdrs7fa4CyJwfMZ16XEF7QWuCVcB9//QY5F8W9359owqxLkUdEmwV4LttPn7nCvLBHHQpSFHS1BH9yh+/dikVjFhcbIm4o+EaTdAwKev+Evekt8jDP2KoREX89LGp21E2R/Kz33EWt/aFNnd6GqNul+1NafNTsl7MLsGkz6DImHElfRAJlM7ilysYuY0WVMYs2Rr0xHAlZWb+tIE93Qr39U2Bwbw== 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=99jZ1PbsY8XqInEdiuKTKl/deCt5a3tVT/+s8lvC6ts=; b=gy8Apg/tXL7fSgdbvPmrKPOiGvq7geskLfnv7tU+vSy4miDipL66XLu87EWfzk1AoP7VuLNtl5TxriBleaK7Drpt8RrlmGsQbzXoYyc63W1pANCrdPgEbMw2/Pxtnpt6UV4KnYqQw3v/SudG3kZwvYjS3qH+vVVcHOiJHyT5SurzmfP0G26SPMQZSLFxU1htSKt1ud3Z1h0sLPr8GMJYY1ZLLTvEM282nY1zlTOCBUuzcE9e39V2bhxiFe28bdlqvA84hV+MTk4/0xsFTNPFGKD4quMyIZ1a4tZGoV/JOr9oMCPIVEm7523FjbY/jy/fb90b2RKGb+x8cuCV5OaJbA== Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by CH3PR02MB10057.namprd02.prod.outlook.com (2603:10b6:610:19b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36; Tue, 12 Mar 2024 20:26:43 +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; Tue, 12 Mar 2024 20:26:43 +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 v7 5/8] tests/qtest/migration: Add migrate_set_ports into migrate_qmp to update migration port value Date: Tue, 12 Mar 2024 20:26:31 +0000 Message-Id: <20240312202634.63349-6-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240312202634.63349-1-het.gala@nutanix.com> References: <20240312202634.63349-1-het.gala@nutanix.com> X-ClientProxiedBy: BY5PR03CA0024.namprd03.prod.outlook.com (2603:10b6:a03:1e0::34) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|CH3PR02MB10057:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c8f46a2-6b7b-4a4a-43ae-08dc42d2bb60 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: NLephLe2mCGzF5fDKnmG53aBv9FR51lDlmM6Z9R8N+IMUi6vUCaHDPy9nBFCil8kS5j7tsyo0K0c4uepcG2D8cvxBk10gffQYsheuS45y41oJoFPISNcfPDu2HNxhr2CS4bRVUXBnJU0xKb+1ohGpknppM62kZTaCqylna6tSBrAzwhj3xtkeKMuMKkfJNFvkC2RZOmoxjygE3cfPqElRBCXwK9J5jW9UT5khRwfr0crmuBpEnklDEpaaXTAg76ETaTP3BhercTgiyLyU1+dx6X/7g+Xfst6T5dE00Cg8UAW8UziDsTVjAEdEDwGxnF33hr4eqgDWHpWEVH46OGXK6jiOgLtcZGF9NoVB2JZWVQm95fy1bhLnfgzzJd2qE3fUSN3iKu3Db/ZYK7/mlucrkQK4yaYWYO++h9b77nYQn6ptiU1UXhN9ZF9NxkR3cUPHRCFEwbCthqpgVcIkZth0suMWv9h4nzIZETRLMYrum9c86xUXHNk8Yp22sbpFRK2tduJmL+CmJUb5Oj7nGrgXzJ3Ct/LLwUBbHF/bgr3nh2ut02RiAgwr9KuRL+RUatS0D90EyxjZPLo11fTCNLb5LIDnK2k1VUjerzqsb8jdDtuUq9QUIfUcH4R4g8hbFHzM5zCqbcM9kyKuz+s8LUl65LZLkVJrxrGCpxfQpnZsbm4uzptW8OjDvr6JKnabz11q58Pua3x/RzSV3//2dPFR9G4sAPeFm4YLIIfP8BS3IU= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ2PR02MB9955.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(52116005)(1800799015)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0lUNOgKkmjtqaykZTOArMtPPvIrUhYBAQbP9SpnS2Bco+BRClt1VjhOiFAuyf0Jr3kivyQFxnVP5kTK5PFOe8zZH6cMzQ7NAKHuZrgmXfL3xsQNEeZ8DtfGuwZJq32SQq9LfuhrHz9yKCsJXHNzZwcG13SeMnSFxCoK40IPt5MsuJz5W2wH76lFUvCWDAXTxO1Faawm63lf7HRm8WK7IqqF/B0Dtd8wfR+nI2Ff+xcA8D9bKN6MXC3jB/chorMLsEaStyduEyQgDJoB8ZqBRpip4zRGfN8uLkFC2ZAmN9zxvGxVpoqPkul30xxUu9cVL6exl6yKatTmTqQUflBTHfIgfU1QrFoh69Pu587KoiWE2XqEFbIknOmSU0oX0kfiAYcsbgXFfLuTXmPW1+kNEsgAJkoND6pgHd9VBCRjM58/By890xdwKgVecc319zWJGCWUl8U7kTefCl0x76uZ9Y7b4+hX0Dqvow9I1dQ07DuOEENxdYMp3Qiw4y5mD6uYxy2bmwKdodf2IFowv5PvS1AM3NZZGm638wCSpijDVgmUU+lu66AtXhSLHjeqU+qyRTeYPBjO59KdZoeLj0Jd6g6CZ8DosyvnQ8lT4V3B4txEPpLEqApjb3F64lx5cLSZfpp3Fe92y4dOwO8xLjPMh4EuWsc7AaNNVF9PZd/wzmZNzQ3SCe9Z3fSvJbpYSrjPAfUXRqGkmtymmbUAhPj8V285A/a8kcJ8NbKRcvTp5n9aBBKaLGMVpLaoOaCk0+jJJVBW6Tl+5H7DiPuDL1cXs2cseRw7PfwZr6/nvzyttcOLE04MioZ7EOF85fJGfqC2HgmJF9LcgaxpJcbXgudtZsixweq0MnB1yirhkkYc8wy0aal4p0QmL/epjmHftBbYI+iKLhRUirawlYrsDcBsmBsqMSuL//gmtEW93l8b9jX+9VWjkPbDLTBU+MTzy0EDYCNxMitRzqNC5wDKwOgTmiUP0Skrj6U2+wnHaFQEUub+xO/a9f4HW5+yxqYkqgadGzkaRpRYQubvTcbKCw7ae1a9d94Czj4JYR8zBOpmOXzlfcqhKCZECLN/o1yz/QSkw3SkL6xhzpmc28tKw4+DIlZy1NlFr83VK/OjY1Vy8lSi/eiEaDjjZYT4Dj7XdLcLXzkSmJAvZ+15HxXsbY/F0ndqty2S5zlvbcw/2HXRUeIeKzpBEoPnwOYJzj/Ry66Pruwg8YPlPlvzO7wI1R4M8S28rMpxbn3M2dMaHqxqlqCFuTwBdStvjF5m47/VpOJFfQRfaUG7Z2JTWOCIl9FC9/kaQImvUGXS2EaQd/HVynwl+gfJx7FkSprcO9mJrzqTPxh7ePV+sTeaHIWu26ZQHmLX0e9R1Wx9UY1VKdnxJ1sFSGMwPxjTcZ5ptiKpAyIbzfryP26ggVy2N2gKFk+SeAEgYCSOjFiaOjHx7ubZ3ihWNQirE73wiC/gjY8UCwtulIkBPQwP9/I+6g9ZdzD3BnWKIVDMTf5v0dnipwSZMrwqW5ujtPiCGaliSgmBjqKtTmdDDTsJ+QiJkUKG6lWy3AmmXMFZ3GW7mKBgQvs7zPtULPFWePyCv2SPws1iHMGi8V0rO2hVxTijYDM1OBH+LLg== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c8f46a2-6b7b-4a4a-43ae-08dc42d2bb60 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2024 20:26:43.5219 (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: P9CCFyDFIneuTNSKCClrMpGAsPp/BP/6Loc1YIJHSLjf8dAVrT0F15C8DAKRUjMMtKk86a/hpWr36gA3ilX+kg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR02MB10057 X-Proofpoint-ORIG-GUID: Rfdowv6nJa-1vBGFF1sepKYubos9ugpl X-Proofpoint-GUID: Rfdowv6nJa-1vBGFF1sepKYubos9ugpl 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-12_13,2024-03-12_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, 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 Reviewed-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 Tue Mar 12 20:26:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13590585 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 95673C54E58 for ; Tue, 12 Mar 2024 20:28:42 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk8i5-0002AU-V4; Tue, 12 Mar 2024 16:26: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 1rk8i4-00029t-NS for qemu-devel@nongnu.org; Tue, 12 Mar 2024 16:26:52 -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 1rk8i0-0003Ay-J0 for qemu-devel@nongnu.org; Tue, 12 Mar 2024 16:26:52 -0400 Received: from pps.filterd (m0127841.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42CJgASa018660; Tue, 12 Mar 2024 13:26:47 -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=jxChpN1xW9+jt2YWnERa7o6NC/nb8i2+41QdZqBf/ Mw=; b=qdwpcs2hTeYxG9IkTY4dCwAy0RsKPTxJbXngXny2TOddm6/Zbt/un332C Ie3y8ABgBbmXnvn+MshZjxFUBgYWAy4cj/Tfca2TGRN2fYLeXgWC+QevHk48F6Uq BEvTKU5L41MXxBy1iOfy/CoCO8TKpw3FbwrU1ah8gy0wFY6YQRDHdgDhk8FM4BsV KwoFicgF55KVyxMGSkv/Bv+QjBSM/QS2BdJjF6rd8kIcDnYvS0RikR/M2kTAImCd w810omtVx0pkOREL14Q9mQzRxaIvFWXzyDVLjJRr+wP7z/HBBX39jz2BLpIsjIF+ QkCfUd7/qaySo0QdKfxgWhrdRMhhw== Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2169.outbound.protection.outlook.com [104.47.57.169]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3wrp6axxgk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 13:26:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T5v3YOsK3Vq6Q3XbnlxiPBdLcxxIqttYt6XpjPlSmbzfTpcbtR47rl4Dvn/hZBLjJesVAe9pjlx57WQsVGSCnrohl5QH9K0oPgjkGXO4tmNxomtvBLyT/9KbtJFsIzy3O7B+wTcS5qHvVm06RbjYR9fFq8lC0AM6stZ2l8LnV0CA2QI7fweDllpXmdM71diYOAuhh1yLl37i7BXXvDz5tG/msMxQdWEM4CKRu7yMofwsalpYCIHGKICxxnqNWR5M+ZR8EHooqN5xYY18owN3tjwSc89Eozpk/PD321TzlQWoogMEzWymROsGmT7yE6sHPQz6n0/K5rSKQYQth2yigw== 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=jxChpN1xW9+jt2YWnERa7o6NC/nb8i2+41QdZqBf/Mw=; b=ChrfbosWYZksGX6T/UbIMN2pIbaJzIiI+Y3iIPSxjc37OG4++V9xspEUj8sgy5LWLkBSg9/vNu3bss0I1L3ww4VGue8bHYRxytwmFMxnSBYv1/oZh+Dkab4wJS1VKTrWzuv2106MJfsK2qXeQj63u8pac1zdrWxshSXk8SByrrmmFrOO3PUs44dKx78zLtECh0JCCSTKsqY/l7pfhnXWHLZIoBs6I8aIJ4ET3+a1TS9xOAzPxdAytFRuwwQUKsSdA+IvcHAHWXVhCKrg3PYYp6ukRI7ySHENpwpDp3PWKXBftZN8yGQ4d406xTUlZXKmre6bZTTgGCh9nOiKzyFORw== 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=jxChpN1xW9+jt2YWnERa7o6NC/nb8i2+41QdZqBf/Mw=; b=GSbqg0JYUO8saVRLYR6cI6irisssrWwztIgX/KjGIk7C7O+eY1B00mXvmkCFKbLcRL/ZaHnclkr4awIFuk3ii5ROKNxujkluAh05P5vLpsrTF9RaBqoubWS7hv/t5B9InbqpvzKZEvbPI5HOu4Gz4d9xISS0o6L08XBPaHW5qx8CzTfjuZTKgMeRjegBKuwBAZdPq+YssM2k6PZIbGBvWnWiRmxOfHU8zGB/+Kl34jpOgQV5bpGvvEo3HwTFe4hwFtAHDi82hS4pCxgwtzidViwIgmkfKT5BGm+Elug4WOz48pO63fn7CpQ9dERM57cPuSK1QNWdr1JTK2PwFz5Q+w== Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by CH3PR02MB10057.namprd02.prod.outlook.com (2603:10b6:610:19b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36; Tue, 12 Mar 2024 20:26:44 +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; Tue, 12 Mar 2024 20:26:44 +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 v7 6/8] tests/qtest/migration: Add channels parameter in migrate_qmp Date: Tue, 12 Mar 2024 20:26:32 +0000 Message-Id: <20240312202634.63349-7-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240312202634.63349-1-het.gala@nutanix.com> References: <20240312202634.63349-1-het.gala@nutanix.com> X-ClientProxiedBy: BY5PR03CA0024.namprd03.prod.outlook.com (2603:10b6:a03:1e0::34) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|CH3PR02MB10057:EE_ X-MS-Office365-Filtering-Correlation-Id: e2427d43-962c-4918-1af3-08dc42d2bc28 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: iEnKuPk3X9hDYEEnk6vxPvXT9CTWuJw5n6w4KGEFl8hqvRHKFtkDOBWwK1vCU5LSg5isBedxM7+B2cVvfkwjdNoDPeJ8qzTI0OgKCAGgLm8mHI9jf3CFVywKYT4P1I4uXX/r/c2AvLM99ENCOTRusTU0JMN6Q/MA8deIyCOUiI2n4/dKcopvJnX7yaVwRTSxrs5yAk1gVBqfODCZL/C8KlGWhVbF6Ns5k7Un/EkKUebX4X4rLMTrDO4j9hEFEiaD6dsYyrhXtPvGN+YV4w6NmvFpZqpEsi9V0jCJKIV/3lhc7smUJOeSDQGoRbhPAeTUsl0FPZPNuiByaQN9Onbj0/diE4DR/7+Xcu2FEGVfGZCtNrak8p6lK7RCCqYKSQHxumanS+qJnTLECYFcr2slG7R0kz5LGza07hJI3C7PApxJczfmXeBV4xKaH9/fr/ui3bOVVbQx10iFvO7Gqps/gv9yge8Jf7Ny6/wamI4E6kEiakv/lycP2GMBr2Vbt1U3b2twKz60XWsWfkcMBf9D5y2xoMjnhTNIVczhk4uMrP7mlZ4+McIqL4fmbWWt7vGEy9XbG/wudNWAJ+EN/OhyI4nqw7XbdrhyIhF1syvDwZadi2zcSZ7Cd3twY6GQ+mYd20K2qCj8l67a5luwhtp0CRwzQvHLK0GYRP9tp6cvpYIjFDLLqW3larT9JpIj9YjOUSZ+IPBpRwU4fgKvF7fMSw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ2PR02MB9955.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(52116005)(1800799015)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VEvtYcZIV1xWUrm+ficI7X+8ZR386E/NVunMs4ykl67HmEknS65OmhfQTG5+gGGPPAC6pSM+iKdbFGmut62BxyCAXkFQwjBOZup+W1KDwrSU//zSu19G6wUR/7ZmdsiuSkKd7RFW9w8R5yt2cUGZKILFB16EYoGaY9Eawh2N+fU0feuHGAnHXXdNesHbJjLtSafQmd4q60YMW1gAHBNBqXgDHqhdpp/kQzR3pNDzcDG2h1Z6s6JE8wcFdRE7P1xJyKyKSgIngMxSrFpOCyIPRsk5tKPjFcNvJLteMJIiFMZCB4sMfZLw8FX2c4/+EcFJAq7OzAcvYBK7a6y5CST5bz9e0IyXpN9ZmEq9DhfPEc36n0Fw5JIl7mDkf4sApn07DQ5UfttxCS5cyUYeX7H/5szWmM8fezjktG/Fkfrgc/5lRXOoGfjbZ3VFQoNvXXkhByKs9sJbD5Y01QiDx1EHfT662WMBe9fPN6WNgJwOatiPFNI0w3mmF4MLNpwrVqEUInaSonCBky4+vMeiv3GJ/4oq1q960UKDifo6cekCzr8syrlJLHu3fNPNC7kRDkQP66mxbd737nmgWhpCOWoO5pDCEhwxoIHsUv+WsPetuvyBdsobBSveT8idtZyqTeRvwxT5OAlNMwqHXC8W4Fhii3p5F4F/A0X+dW8RfXNGFf9/T2Ryo/Vh30HPb9x+u5REw1znBf+evCwreY2epxV7mifCGMYio1Lgd5bIfvzm9WnJh/05Aun2dRQ9QPx5KTm25U2r0NvQBWkiigVcIhdKvdQ0K7MA8WNNss5wyF14jy3md6rIdmWLogLZdTK9hGl4/JwEP4Mptrf3HxaJ4IfV6lJqMdqzZjUGsm43SBh+m9Dn7U5oBmVJoxtUPAqUF2/mOUWUvUl3lXpwvovANEsjyaKZj5U9nVd3s7wJ7kM1uJHaYA0vj8NqARTtAZu945duv1CxvhKqkAYXtnvVDr2Y9p5z6LyTNLwO5UcFq7ykrXP80K//JIsXl2pPpc34fPWdqgOruHz515lU3KbYaeXv3y8cSY9TxSjbvKkUXgUNRGpczqNW+shOk95zQDzvQd8/ZBH1rpQtGzx4J6jEU8QIrgdhyGJAcGx/fEKUEtMA7DdHZ8SR3sTJhjl/9hT4FE5M3QIPMmoB9ZXc6J/j12z3vGHRfvO8H6OFMsqqoIpVjAcalm+qSM347QHzdyWDEj//ypi8XBMgA1Ai59uGecAQT/yrUFRfdeARigYnP4desGqdAe705W8w1DR/cRQCVkFfHnqfnWcB5aBtDrTy1a/cHe1lL3so1KKdGlXFFd9St0lWGKqp2unGga7W+PCy3YecVa8oO17j1Gflci1O/+1t2OjSmeKGeOdASArJCNWBrGO///GncjoZSgpFLihJvbhT62duI7Q1tTJ+e3FA9qfbpRSpurHuXQFQa3QGmJ/EPIOvBO6jo/fVrfQGwfIvLeV8WN9P9yrXTJ5FDKojJITGmBHSeDHvD2m4oU4/kOC3ZBNjXuZbRZrXOh119DAKtn8aORkSTSmwpKmPotkekce6p2oobNZ2hHxpC8ZEQX8x/9wJfi01yrNF4wENiFcNvNOB2Q4CSFxwKe57wn87/E4jYg== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: e2427d43-962c-4918-1af3-08dc42d2bc28 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2024 20:26:44.8297 (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: y5L7T50vH/YTvSjqJC7ap758tuNEirbXsXGnOiOiEuZaENAVp2tblIko9hNoRTGJ7V1AuRJ0ptSW/pQuvDEzJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR02MB10057 X-Proofpoint-ORIG-GUID: IZx2vQsPIAjDWEyd4YEd6uTUPKKGA0zZ X-Proofpoint-GUID: IZx2vQsPIAjDWEyd4YEd6uTUPKKGA0zZ 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-12_13,2024-03-12_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, 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 Reviewed-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 cda07f8f97..62e52a29cc 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; @@ -3017,7 +3017,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); @@ -3046,7 +3046,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); @@ -3379,7 +3379,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; @@ -3420,7 +3420,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 Tue Mar 12 20:26:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13590578 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 C6CDCC54E66 for ; Tue, 12 Mar 2024 20:27:51 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk8i9-0002CC-Ne; Tue, 12 Mar 2024 16:26:57 -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 1rk8i6-0002Aa-6F for qemu-devel@nongnu.org; Tue, 12 Mar 2024 16:26:54 -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 1rk8i1-0003Bm-1v for qemu-devel@nongnu.org; Tue, 12 Mar 2024 16:26:53 -0400 Received: from pps.filterd (m0127841.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42CJgASb018660; Tue, 12 Mar 2024 13:26:48 -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=a8i/sEB0bP9Bt3NfwKvZ0XupNjb/yphsk7Y4bu8rd F0=; b=hAV6bdf7y26zntFkjWUxIu9bNegIYgnswNaCeTfLzYqAYkyi4rSatjV1y vbcDE74kdDmUXqOo6phNFmz4jbk828v8U34zvT+nxS/jAbnWB181wC3Jk6dmULz8 JfATkNsIvPpFnpAgsF4CuJq3eViL4aRCTN/FhzqduAEhID+DI4zLItgokZ02zhg/ vtICUzN+fJMYBU9vMTA7vjd7PiE7Nb3RvJxJETHZhBaNeJM0TuriaJcQW0ABtPGc W4wGpqpV9fGMqZH8NQEQT7ZknziVKGyK3rORKv1VDYZ6l+qcKscXgqIgyqzP0Cha bU5EnUN3Cu0j4Lgd0CkJeYvmWHWlg== Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2169.outbound.protection.outlook.com [104.47.57.169]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3wrp6axxgk-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 13:26:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TZYHd8QmaPFfH84GiMAwYPyC6dT832+0qgoGf7NJ0zazcnt1vEaiin4BKHggHx2NJ/S47/EHIHE1abswk/fBVyqmPSIscYCpNqxR4SAJP5el2IpIq6aE3WBqfRmImXsT0aoka5J5z3W2fGeoaD/mu5A0Da2Ys7/JxK1Xx8HddqdVee2vwMtASVMah3FxziUdBO1Jz80J+QlpKSJuJHghrR1F2v7y367mTapD1Dj5vs4BcTCQc25arB26wVXsmdrVcQ3vnrTggis5rEOwqRkgBf4grKN72a6V4ilzwPVjoUGWIHPeNveBcb9HwFs9pmPIOTe0TqsSoZzJ0ypTE1ft7w== 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=a8i/sEB0bP9Bt3NfwKvZ0XupNjb/yphsk7Y4bu8rdF0=; b=ES4NZ+pgPsr+kdQQOLFGdBsJy3FvQOi2chp/baj1rV7UVr36t5qqHS1RgNioTwcJYS+WdpO+in8sOpLccJD9DOuR7Eu5RP+jBwNPdnvkCcFa3TTGJj+1ck36k94ipNXLkso+H0hhrZPX6M2vDZvwJLUr2qmMi39vUtwBYYoYWjdaLNfU27FolDEJ4InQaGKhNwjAijSP7Fns6G9OX8Mx1YdbufkBnQs1gv8U7DYkPu4AeaN6X+RSkptayIdkhd4uIErhwjMZMvwAhlrJnA6iENaUxM7VEO60KsK9EeDEWGwfqH9GEXsr1z42uRtiaoJPaS7xlBx2ALR/CYLCF5katw== 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=a8i/sEB0bP9Bt3NfwKvZ0XupNjb/yphsk7Y4bu8rdF0=; b=GkFSRXC8DJDWpw6QsT3tgAQjARUfNrJWVgw76A7HRxUaWzf7H8HWrV1tGTPP0gGQ1QCRcm0dOWlfOkx2wAiu6NIhA1oy5TO/Q03HCRIsh6G/xiubR3u4XOW7Y+WwBDO2oL7Q2V03FNVQrwaH79UvgvcFvUMcIGi+pQm/08h/4QenU7dNOgsbFcfWm9Paviks3o9Uj5KiAu9Folfg9TggsBJij7cbS8b9LZ4SMt58SOqZ9nnjTVhUTclOfkru24NIY6C9ZatvzXveF8aAS5ciKGCixXD7socn0WTB9Qd57gZr/P7aehdyk8GVxnQ/3u5X25gR710YR/QVHfGA7ieiOQ== Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by CH3PR02MB10057.namprd02.prod.outlook.com (2603:10b6:610:19b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36; Tue, 12 Mar 2024 20:26:46 +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; Tue, 12 Mar 2024 20:26:46 +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 v7 7/8] tests/qtest/migration: Add multifd_tcp_plain test using list of channels instead of uri Date: Tue, 12 Mar 2024 20:26:33 +0000 Message-Id: <20240312202634.63349-8-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240312202634.63349-1-het.gala@nutanix.com> References: <20240312202634.63349-1-het.gala@nutanix.com> X-ClientProxiedBy: BY5PR03CA0024.namprd03.prod.outlook.com (2603:10b6:a03:1e0::34) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|CH3PR02MB10057:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ddd55d1-1c2b-4602-95bf-08dc42d2bceb 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: nfou6iCIyBtzfuDd8LiirIjGNqqouIt8wpGaASPneEOrs8AHYaWaM8ZEjhlaAxzkRAQZC+hCBaD588fiXgJoTPlIFtpjpyRALfTw9XKLmBJO2nY3CnGbIawgxAJ/MXao3D0TklDJy+TRGLSdY5SiRAG1Hk9MG3m3PudTxiVvRqpC0vYM3Q909lQuunF5DeCuU65MIlZ/UIGjLp72TkmlvkVG9CvUntfIdYkUcRBh0xeMIxAOvzx+BKgXemtxApIz/MKP/xpUXUdPxZpHT6yS3zCQOganQSKzmbMhgiuhFy5Bph2/4/z5fCiLdzQiBMtUtH8jXTZju6UdyQiYxuWzPS8bGAl18GZbJLPdyFdluuTS9vCq7HvH/TWT6U7L1t5mq67h4CEaSwwV4MPQhW+Q13U0W7O1G14D0dxtSGekrAGcCCUndQjylN2kwUxLCZKbg9blafXCnxUHsfEQ9XAI4ddOFBEWf2OACKTNfpLoR4EK4QuzEO8gKrwc/qudQ1N4c9inPf9MDhDN7OtJcx9aBLcUBoAPyQs+8B/TTsn26rZvtCTMTrbEr+x1xSRFQXsyosGr6EheeO+dMWJLa124tKHUSKSs3Wz86QnNftObzUlyGfSdLhej8OwUpbdb6R/ek1blwGkR+j2MVjjT/WfGW/v5cTrACKZLm/cPQ0ZIOzTPOjnkr6Fqdx2faV8dQb3EINQSGtxkoOFkE7mLxxbiRUrEJyu6YMB1VTT1pGKewQo= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ2PR02MB9955.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(52116005)(1800799015)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pfC41BoOnzmc46IXQNV7rIRSdqx6gmPFGedKgXAx3Kkfc/CghIPxUCFt9+VfjUimAC9zaeWtUpGKPswZRNIB14VqsK5s6hQxBmLdUOZnohUV3v5P0f2Hqhx6TkGXCJbdOK1oULHdDEgXjY9/zq62gPmNNKKurvoa8xep4q9r51jVpkxDd7OreciCjdYLCfwdMXBmoUtH7KpFQjaS3gVXa0xacz21dmCDIHqXvC7QomCOnop2MV6w3aDMmlM9JayXrCN+INr+avjLWAim5KdAS4NC0ey6fIFcAYCcCuJt4ntxt3fN+VlhezqU1ahNYibxYWm8Xz1HL51jaUOc40BhrQ+hN9NNnSnKosrwhKh5mebbJv1pRjTK0SMfDf6RnZvHiEPC89A4vrkKhrFYKVzQ2bSc2J0IbV4VPLDWCWpDuJbdEB9U50BiqENxlv65aZUELps4I4He7oNLtFMxKmC7IhOFl1mUxjgcwbxlAIZFznIg82RVMIZpsXElteQmNDXdZ1NIGUSlrkwV3IYoGCRt0LKI2VsLMhBGvRy9ousGixvdF8WpPA3FHGjHeJUWX+lBsmF5kXEF/Fve/ZxfDM4WQKznN37WB7MfmZmI56Q31zbOS8lqbm8UFumY6vWTmwBmJPnMsrxFxKTG8bsF1SulovgA9OSJ78FpvgdQhtTr9ZxKLHqSdCV18yuHywqsKImGw2pCljzJ5F3i8jmzEW1LZCdecqOP15VadAkYwRkRjkrZFs9H7SJJI9LGOMky6QVechhweDyvTa56orJoz4NFoDYWReB0rtNZVk/xQbsx5iONi1DI9TJun+4JyAvpkiMtWApfZ/FRa8cBdZmG4arCKLDXPtBtiGQEA/33bYUtLKKUgNad2MaTx1eAjGhBhDVy3kDAR33FUQpAnWcfMbO3UnvNKIxwM2vhfUx48RkulJL+Y9iNT6WgvWgAFosQHhiEB0dlXDYnmAhG1VkVLFN1lfpkFANfbIeCaW54gEy+MY1nAVfTILJE9yz/u/uOdYVGZbh+9Cd0a7JS9nJ6IpVqHbZlZGVtyyvvpB++iwUGTnjiVcTPXpzNvqSZXeUvOjRgMMlLeC2uIhUrGj4igJcD016+MqCTcJBqbK1rsoas12lnkdNyviVCwglrEW+hhRYYpWcQ8T9bOPfBxLhKh3uzoizWMXWtIdITlkorUd1OvKLGgfvFRTZ9GWdx4DiVEuGf2tc6vmrJib0TfE793cQkeNXngIoSNi+VfPT+uCYeiiHNXJ5MIw3XVdXmaMN0d1KbZ8hYAK6bE3jUHsoJxw4ZfZ+d+Z9rc2SnCF+XLEF8LgCxY6zESTO15P3KatYGUN6u2qN4Vx8Su+ZdGNxnx7rhzyBq52j4l9kthPjZltfVZU0nw1MQdIbJ6VWe9h0zq7s9VT3UNBiiC/NO4EKaxr+P35mZNN8Lozik6+TG2fAiA3BMXkxgAGr/1h0pNxykKf3/zCoKYi43qbQxhz0zxEAMIFvOqjjCCRcT2zXFTC/sC0jTUkmJVNco+JcA74OSqoJ+eQMJeQqcK0EOPb5DwZYi/usF/WV3pTz2sXb2WRxGRmGow3XzbU4xJ/eFvVovJhm+shaPPit+xS7SJRuNn090ig== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ddd55d1-1c2b-4602-95bf-08dc42d2bceb X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2024 20:26:46.1346 (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: Zn8CWeHljR9zK3O6GJlu7T29XF4XVBCJCmWzDrnMzcu5O6kqE+6+cGK8oJzVQalZ0dmgQSiJjHr3FBY6Qevr5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR02MB10057 X-Proofpoint-ORIG-GUID: jWXKO766XxKOX_RUqmDRxCdOYktGy7bq X-Proofpoint-GUID: jWXKO766XxKOX_RUqmDRxCdOYktGy7bq 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-12_13,2024-03-12_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, 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 Reviewed-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 62e52a29cc..7ea13c8e5b 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 */ @@ -2758,7 +2765,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", @@ -2803,6 +2810,21 @@ static void test_multifd_tcp_no_zero_page(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 = { @@ -3712,8 +3734,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/zero-page/legacy", test_multifd_tcp_zero_page_legacy); migration_test_add("/migration/multifd/tcp/plain/zero-page/none", From patchwork Tue Mar 12 20:26:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13590582 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 1CEB3C54E5D for ; Tue, 12 Mar 2024 20:27:56 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk8iB-0002CN-BP; Tue, 12 Mar 2024 16:26:59 -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 1rk8i6-0002AY-5J for qemu-devel@nongnu.org; Tue, 12 Mar 2024 16:26:54 -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 1rk8i2-0003C2-FS for qemu-devel@nongnu.org; Tue, 12 Mar 2024 16:26:53 -0400 Received: from pps.filterd (m0127844.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42CCE6eK010077; Tue, 12 Mar 2024 13:26:49 -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=5Sf2kCtS0xadPN9mj4qZn01slTsmgbkM5fV3CbjG1 HY=; b=JCy7lPyRUkEuYP2TM/b5abtnRUZWlOAuurAE1Hovp+42ynHLvHcJbmZi/ zwhYl/tFtVWTblWp4I4/oVpnWCY0mWz2rGQrePSULsmFshGkufgCOEQoxCd6MyWO q8FiBAzzYgD75S2vD7Iongty69re2mTQBDgGNjY0Er/J0N+B8s+u5A5XsHBgtsV6 95cJpmEphWw8sYhdfE2ryISOsoy64rxl7Xp3faciI3f6gGWslskdd2qV+H8uV8dv QR6Ssp1j6jApBIYDF6WvRwXV+IaPVhTe4H2vMI8ty3jJoCLhLkmW/R7K1v1rOQS3 k2U7GTYathVyqsh/szj9eXZcCQJqg== Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2169.outbound.protection.outlook.com [104.47.57.169]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3wrr63pt25-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 13:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ry/jRsf+0PaA1gnO9VPk2293v0nub+1JvcRvGAbOmS5Cp7o3aIV1lBIrqLb8MT4l7JGyh5CfSLfUYlu/DhqLuXDLVlWQM+PsdPzhKEDo+1/s7BVVmhe0CgqNtXv59fd/m36i+B+ib5y6ryhUCfWiYSnAcDajxlvbR+hc6wb0sWTd52sTG0XvmxpcYYjc2g3pUi5vRYQTNxwqmV6dfF98R1NtI0335tCU24Vgv5Rl/VdekqHs0vZtUZMzul7GSa5Bf6h7/6tHAGv0TUMhTzCtwxrXcW/cogPHbdsU7XHD919yMFUCOlgejkngogFGb//6M7h5jwI7iFauseiKtFgvuQ== 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=5Sf2kCtS0xadPN9mj4qZn01slTsmgbkM5fV3CbjG1HY=; b=B7HGNoXjuPmUT1Gvc7xnBCpIAK4HuRrCsrYhB46fMXXk5cNCnsAbD2OSnJkFI9ju4QZav/Gu/tO5Ncw+9jVqCAMV28B5erHKZOBSI5JttUiFfSmwrAYTpFLQEdDL28V/Vc3xSI7mVbxm72R4c7a7XaOy1lZhm4SBOpBf2ohjyHfOaKHDbNx61fkBA4Scv7qkIYwOrrcq4dvAtR6nPFvKR0s04ITSeqBa9mLPZCUxWhwWmXxd1d7bV+3sQ9TRe6KScxtaUgMRKG5cdzdaqBSJtWOsnCZ5EQ68IGoFINY4wz/ZNbd556ml5hymCpeZ4L/aowI3YoZzCG2qKhnX5k1+mA== 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=5Sf2kCtS0xadPN9mj4qZn01slTsmgbkM5fV3CbjG1HY=; b=NkAUiKQZ6xmOSBvqALoLa3aQTH3aumtOQeF9DdK1Q/KX1opOZHcI68trshsnjw+igQN1hQ6tGiZbb39UXCMy2H+yYkWlzTGlo44ri2tmYJCQYZ+bXXCabpHiKrPiuAo8xyFHBhwBO5V6Kp3NdPfif4ZO1HogUzG2/cOYmVp2LWX4doRFucUM5PMebnMyOFXS5u6CR+mBD52dpqwSfdOHtCFKJiefwy/krcgbERwR29mHtKKaz0P8N3r0VluOvTc8jSy6rTFC31u3fqSh6d5fK/fmqVKoIZW3cKGqAQs7FVZ795X+l4VSiIJUNSI7cgEYPqq3pAunc35UkipZ8WzhZw== Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by CH3PR02MB10057.namprd02.prod.outlook.com (2603:10b6:610:19b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36; Tue, 12 Mar 2024 20:26:47 +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; Tue, 12 Mar 2024 20:26:47 +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 v7 8/8] tests/qtest/migration: Add negative tests to validate migration QAPIs Date: Tue, 12 Mar 2024 20:26:34 +0000 Message-Id: <20240312202634.63349-9-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240312202634.63349-1-het.gala@nutanix.com> References: <20240312202634.63349-1-het.gala@nutanix.com> X-ClientProxiedBy: BY5PR03CA0024.namprd03.prod.outlook.com (2603:10b6:a03:1e0::34) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|CH3PR02MB10057:EE_ X-MS-Office365-Filtering-Correlation-Id: 8238d0a7-6354-40d8-8f53-08dc42d2bdcc 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: Pa6xhp8w0hmLj+UhCGxFf69v6wnBkZm/1JRFQObSffficTQRqxJNelpu823wnBS6m3gPtAahxQl4yZ9VbtkGTtZpn/oeUNjqEeN/FHd1prre/Qhjo0QxEXzgl+3J3x8xgfZEvbhnPR6FQR8obdypzTTuLQ+GY8eWU34BgqYq7mjwWcjquy2cJcnSzkSQhSwlphJiRUDPyDoOwCzbknmedDaRbico4kgl7oFkvh32gjjMDy8CsO5bAsodrLMXmfi2MGNMm2m5ozIUXpdcwlGX7mmMS5vW8Ojf1qFOkxKHSZoN6Ejdpli5SlclTIcTCkZbpSPEDhse+BCOox+wA2VuTX1NBP6CuaUeSDktFdJro+M6FJTlbLe2oOtQekJx1DPePFYcpeTOiQsQtc9aEShxP42tG8bk70VlwIOiU0atoTRgP5SgMy2/bHGnDAuQ+AYbhvo6WK1Y28suIYzgWhkKO9Sedq9AWslJpwmLPCrrer/AwqGqSkSWxt1Z4U1uwGdWsHM1zfSFzqUBvuoJ3zFAdWvBT+TXKFb3zEPGo6uUlPldKK5vV2psh87eLqpBRxgXhzVnGHhiHLk7y1IUy29yuLLUlh/OW3n58RhI8muSSN+0+/S26fZSroD1sMqWq1oHnZi8p4kdE0x6ltb41ESTk6t4jtE5jkEd8HbMAcWLjNou/RlOe1KSxot677QdDgO8aGbqSqa//R72Hiz9XasohV2tXRaLD3eiFckjVh7vGAU= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ2PR02MB9955.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(52116005)(1800799015)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: o1EvNWcOC3VJiGEnrCZ6eOH+HXTpGyanidE1OsHkMxU12r9IInbZg8UC2mX5dpY4JM8Du8LxVdUUbY1A7sGysXiZk3sHFb+VNJw6TT3jHwbHY9joWIGlUmaBLGIav1Rh5mzc6nLYBXonkm+UJvCVhAKcaokECDEpTVBcnr9Ig4ykLT0zAzt8JNmx0YO9LSnDiVf+MOBciv1FG+k9ZmEHHofZ157m2P0Va0n6n+B4tRtM82YuKd6gKhvV97hja68aNowZLHtsNVhy2WuL+GKr1wj4Dk7TuCt0DbGlimhep4D10bYQAVNsRsOj9ad9dgi/ReLDfTVKhiNLZ7laa05WSvRaIquVdzsXgpwndWku8/GTMJRGl/RpSVB/DLgoi5rza/N4SLcYxAyRBNSeeUHpiFLASJjmeJf/UO2BF8gkt4A2ZL1LhdYLA3rjJHwpYgxf1OejW4MU6msxvqhxvW6ePqlum0UE8+m8ejwW7VtL854JF0L6WbewOv/DfoUZ6nQwvZF8eVQubxZyzQwSh+JJ2oK7ND2iedLpebzkz7Z1dgI8JehTttIQ0czQOljZGgWGtige7K1o98I//S/tide5hDI7T5npj3FwN0m3QkkliwP3XrguSY74vlmk9LsbRW0I9Jx197W56WhGjp8GXLZD8s/UKQGCJFfNCJwLWlmkIXUQ/WZrBdKevuXa/+5TzWgoZI7XI9j1mdgvr6BJZS2ImcrrYSdVc7T4i0E1xl55IiK+/pfc35hvDRJ5LRAAN2hph/7oUxm9OgWmShcjdazhQHSoJ5fLFNCyU76Krpgg3UplpPi7jEDeD2WS2+FElI0V7tt9DNo5usybLdl4LCMEj4UuFJaCWkeuloYa90/KkPvLJqy1h+aHFmZ93i4yRlXSD0MlspaWnq3L3/X8WELrAleYVgWK66DzlyO45xXwWz4VeDwJDBcw+DAuZHby76LAcy3NQKZSTG72HC6doEy/b873SbEo6P9VkiOch/Dlgx41+3kr9C3/DLC2rPU4kHUfaoi+5S0PsnFXsL5NX0naRCSCx7W1ZzpjBdN41zrk5Zsfv258nHFZqJtkGtwfI66FM+ZCx1X89NuwYAdM6KzuUmG3oxISumDUo+1llPfIZeWv5g/bUiOzeNcjFArD3utWUqJ2qqMigP658nk86X7Lk7e6fQzm7y1ezKR3vA4qbJl5U6J08HZN4gpyl83uchjx1+p+iWr9bIPQbHOReTd/+JQLD95EYfwtYJppdviZrCcowO3D8jcowFUaO7xiomOgyaif4T211nC6K3AIwyEG/Wbw9g8zhAFbVs4lvqNWTqyzLoSbv5Pf8OMRUKrwky4DP97z7DwFo1+O29Kh0mBRYaz7xR3459v3Ri2Fub8+YgH5Tz3ux+fPKXM8CUYICEjBaL3O+qKjHYqHBaJiH1l6H6/8Tq3DMlos87iIKS41VC+xeJlzNNwfwmkvHbLsp+ewcK4U9iLHZQL30FTCNsBGLYNHesS9GCg9dhEQhO70tr5akwfU9flOVGVf+9lZJPYsay4k+LNDmu+pBS6pPn8UdOxKw7VdlwEdTtjiizrR+VYCMpWkJVfCuxPGR/PVUxXuAM0t3tNQWCU2DmDsd62W6g== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8238d0a7-6354-40d8-8f53-08dc42d2bdcc X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2024 20:26:47.5810 (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: wTIS2aItBQgjgreibtL3MRP0ClZ/XDE1ZBlOwS5PbevqK+LRR+ZTfGyo+/x1/datiCLJpyO1yC5GCGFG+wgXoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR02MB10057 X-Proofpoint-GUID: RBz2EZE6rfVkqvQOGf0XaVYbI9TwDJWX X-Proofpoint-ORIG-GUID: RBz2EZE6rfVkqvQOGf0XaVYbI9TwDJWX 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-12_13,2024-03-12_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, 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 | 55 +++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 7ea13c8e5b..bd9f4b9dbb 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1724,7 +1724,7 @@ static void test_precopy_common(MigrateCommon *args) } if (args->result == MIG_TEST_QMP_ERROR) { - migrate_qmp_fail(from, args->connect_uri, NULL, "{}"); + migrate_qmp_fail(from, args->connect_uri, args->connect_uri, "{}"); goto finish; } @@ -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 @@ -3722,6 +3771,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 */