From nobody Tue Nov 26 09:49:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); dmarc=pass(p=none dis=none) header.from=nutanix.com ARC-Seal: i=2; a=rsa-sha256; t=1708703302; cv=pass; d=zohomail.com; s=zohoarc; b=EOfCGBhF3yXAMI5wRa6GdSD3jpR3coAkIzKIlRz5zezxvXqvgjlp/O5AhYX8hSGjbAedkJSqC0M7arUFp3hs/uqmw4EY+6DgepycYuJQLGjT0heqzYOHG3MET95YljknitdOJhD6Shn5bZXkm7RIZ9t4Xtj8pIynvY42HvfcAFY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708703302; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wXm7FrxFG/zmt2dEvIAKX5g0Ckp6+sjWsoE5P0mI3qI=; b=KMxk9QF8Ea2QmSc+VzXo9yw32Y9GyXC6b6O4UFBEiB/H4cjwCBX569AmPMczLvHGxbe9/uKe7vgp6TtjORXgye5UEb3MWymVG7egHvk+unIqkW1dPpOQqDOpqQR2Pbdesx1D9WsDyzuEDdS1a9Koxhx7jKLUMwpvmA5owG2xFN8= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708703302640492.1087310626234; Fri, 23 Feb 2024 07:48:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdXl8-0008Bb-F0; Fri, 23 Feb 2024 10:46:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdXQd-0007Jw-3F for qemu-devel@nongnu.org; Fri, 23 Feb 2024 10:25:35 -0500 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 1rdXQZ-00033B-O7 for qemu-devel@nongnu.org; Fri, 23 Feb 2024 10:25:34 -0500 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 41N71Pds007010; Fri, 23 Feb 2024 07:25:26 -0800 Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3wd21882g8-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 07:25:25 -0800 (PST) Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by DM6PR02MB6794.namprd02.prod.outlook.com (2603:10b6:5:214::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.24; Fri, 23 Feb 2024 15:25:24 +0000 Received: from SJ2PR02MB9955.namprd02.prod.outlook.com ([fe80::225c:2edd:87e:7cf0]) by SJ2PR02MB9955.namprd02.prod.outlook.com ([fe80::225c:2edd:87e:7cf0%7]) with mapi id 15.20.7316.023; Fri, 23 Feb 2024 15:25:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= proofpoint20171006; bh=wXm7FrxFG/zmt2dEvIAKX5g0Ckp6+sjWsoE5P0mI3 qI=; b=WCzpMpv+fr66Erssy3Ftbr0IPT1sZARbaYgUH24a7l/CCoTyB/WXdjyXI lezNUmAVgSN4QAd+fbRHp8NtWIFrEBVfGhCdkbYmMJsdNNC+DLNv4IzvTdT0JWO/ vCxyeh9DarbqgKeJYFzcgi58JKUeMr4p8jNhMF8UCUjPC0k2SohPOAErecAQn37R d9RCFITfH/vqJRDy4FvmuN/j0y2ThOIiIudVNxT7xBayGfqf6igC6sFuoigK+4UP EnHBXTajfwrg+Upek5WrEbUXt4wzBIf3selunkT0VtlHLnPeb0RfOnRpdLINKbAH jXjJtqRzszA+IhDztKQ3ts5UXcKsw== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aoNlRKJ8Vh9D3vQ55WhLD4bE9MPSZZr6d9i15kFvZIjTGwhiIy0FmfwA5UrO8bwpmuvJNkcDIGs5bzmMdftjzw13ClRWx16aPyP2xJ+6y8LevRaPNpjVsuuoi0rPKzwZdYkyhhnal141+YK6Q4hlhwuW/JM0yeOAdqmPqfCRKgYUB5w9hDP0NwGqfkHjLNgP/pmzKvvQwBBB/wt5Eyn6/m0VD+gwpAyujp299LsNHdu9Zwk3aWBcaVbqZ9YW05/yjWQ1ds3eHqtccZjP8IsBdvizJzVlBflQp3C+bRlPMTxXxCpeIJgANvGek1ssYdBwQW9Mmo9ejF42lyFGZO2KsQ== 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=wXm7FrxFG/zmt2dEvIAKX5g0Ckp6+sjWsoE5P0mI3qI=; b=K+6qzhMxhFEfiH9AOAzakhcwgp0u5H4Hkl700k3D0AxyVb1jvlpC+V/KeTOGGX0oylU+crgUpqSi6A4chgKAVMIdpeqj2oXXYAcnQ7JzkCnqayayneFrFCZkq1mLB9s0v1I4t/B5GaGIhAsrhi/IB6YiXfxS43bD4r4xB82my/hlU5kQzFkEJOG56GksdDdu2dB5H5ydOrfVDQsCdXv7MDHhAqNaVnJHdVfC7gYhe1TDuOTfMt0tbVL162xly4kPsCnBkiArV10S/2azmCHEwts8wsAE9iutMR/7KYBZMrsArLkvMFuWB/zm7jQtabWiNGXzA8+c1OmFqgFlg9tYfQ== 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=wXm7FrxFG/zmt2dEvIAKX5g0Ckp6+sjWsoE5P0mI3qI=; b=yqCCWGnct+Hn0NljEG+04kI9idMha0C80KPm9KualRyAL60FKqIPkPz1M5DmlCfjrziIwEvaWqz5KQ4T1fNQz6NXaCVIRFcS3171aUnGJ/98nIOqc3mNnHQHJ9D/FueA2VImzuLyO+NkXNVGq2zB8jp/W/xNt2HRk7HOYlrGI77ofQr0zOOobJn4TCRjW+fjhpXWfPFX9APS7o5RY/V+3jv3iWbov7YFskOGB3OL0v5TV/MRrh4gQ/5C87a2PpB85wpwt7amzosopj+N2q1lECbpacVYAxl9rKGo9m9tVkhlTEh3uPYEed6YglU6lNsS7fr5TjwzF0bE+x+gqX+NeA== 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 v2 1/3] qtest: migration: Enhance qtest migration functions to support 'channels' argument Date: Fri, 23 Feb 2024 15:25:15 +0000 Message-Id: <20240223152517.7834-2-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240223152517.7834-1-het.gala@nutanix.com> References: <20240223152517.7834-1-het.gala@nutanix.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: PH8PR07CA0002.namprd07.prod.outlook.com (2603:10b6:510:2cd::9) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|DM6PR02MB6794:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c916545-8275-4870-54c2-08dc3483a7d1 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: 2XUIkdeNNkveEgYsnCLDPtcCfPo6qGOCXK+LYoGuq4i2Fqd8ZqVJQj/9l3c4eXcRnI/Sb/aLNwxar73UvHIYczxNtgfYmVko0yRpaUWreCPPDkWuH/Q9jtdnNpRpx8q8mF6pATnYclF+QNTZ+CqZPUmuzQFDy7MAJFjs1fyy1ujQpR7pZkq4Ucc/o6uW59JGs7RNgwQ8+qh3ikm3GlfTTyy2eD/VFvF8mtcnXwpPV+cXhLWF5A624nqmSI0fT1MbIPntUQVeLDvnbYNGLSaFAXcU3xoejkLiiXLw/CjpwC3w4yiGmLGGNfFriHyLvo0Zi9zXJL878haRy8lDG1OwnN2/RYUuKuLo6/RiPaVI4r2owC1RvOfD/7XNFxK5V7/tyJ8LMy5xVDj5tyxfT4Gdrp7DZy/vSuvqs5w+iAj6OMOy4JFRZ+SogYgwiNvrtXYSlcI4FWafxI+MaBJWLlRq2aKekVFzVOiTxtSi8UbQ0uIe/HJ7woKM1O6JxKIls2IxTHnV8IOpiwxV6zhfCR+jdyQIj04ntF31hCC/QjkRvLtAOdGqQ9duisSRH5IQJLI1UBNJ6uu4fJahfM6XUx7n6UzVg2CfGb9q+UEkbJYV1cV445z5FkCCEn6fs1H6CTEq 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)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?DD8LGwUXlFeDqyilN8OXwADJ6fHFK5XOHvSIZfqZXy7lZttRvxv1vqskf+mn?= =?us-ascii?Q?1fTIXzKzAHnUJXMiD5n0pjFp61Dvv2/GMuAdkxa1+3IIbFIfjERfEe+sYhw9?= =?us-ascii?Q?BihudmXNywE7zr3sDk2BD3bikwmdRb6VM8En1um7hVAI7hlkK/dulkT0HKnn?= =?us-ascii?Q?sIIXXoJ7RLCoG2W0W9sMgnkIiIbdKlgc+2kBYBpl3ICZWKBylZAWc3MMQjyy?= =?us-ascii?Q?GB0TC5a/wyI9UGAwSVP62dmr56L+D3/6t36hcE8iaBMnv7RnE1yVbRg2MqPI?= =?us-ascii?Q?FqhpwtWONrvsQ7TmIPpRqO1LnettATtWmM9zBYPxTAO080YeVuNspTp5HJJz?= =?us-ascii?Q?n4bIfdfwkKI6dGy0viW7s3xy2tIeQEuSVkO5z4feLwJLOwaQxzyc7nf/l8CR?= =?us-ascii?Q?sLMQTXrS3h1nCpVXobuCU+9Ue9qEE94u3GbMBTSzxQnR3FX5gSZXEFXL07qa?= =?us-ascii?Q?qiMHoNMX9VtV5usQImR5W/6Oqx2pU3T/zMIMH74WWBanYnZ7VyNd8/idTUmR?= =?us-ascii?Q?MJcsQG3BdOhbtyLl/KCbomz0HWQvb8M3h/JlNfNAUE4giE0u+VnD3r/Lz+2w?= =?us-ascii?Q?AP6WyLSjzllwc5VPC2Rm7u1Jz12VWv8DM0+I0KsA/XJTlxkT8FGpkGm1m57F?= =?us-ascii?Q?4eRHIxpP6xRjoGGa1np4jjOwx68Z4zHeowe03ejIvcZbxsYKpl2YFFeGc0KY?= =?us-ascii?Q?k2zmesIM0pgY1o7vA6HxH6HAGx2UnhDbobcfUVVH/BoRVC5BfeTCSVX1JMWU?= =?us-ascii?Q?WYMH58VxmHvzJ3jXKuy2RlFFEpd1ZdmR4+WLgbnhEMu0CaQCDCTZHawBSeUW?= =?us-ascii?Q?WnK3olEYIxq6HnBQXiHOyL01EzifPUqFJXBlUYDRiRdb9cJrRztQ3d464TQy?= =?us-ascii?Q?89VTVB6oBZSJ2fjFGRjLcg0w5Y82l9IHXEo2T1SHFWkFiTaoN8FLDX3evseV?= =?us-ascii?Q?PBMOGOF0HL9x2VHOo58rCWzqceYAJRK3BUWHWLeQtsxS12SJBPrjB9D40f0o?= =?us-ascii?Q?kxMorL37hbJk2/nnljb+7ys+obwFAHLgd7VUIyTg6CLOcWI3cTzYbQ73WOv2?= =?us-ascii?Q?SQuHgA75uO6XpjsTH40syTRsuM3oIajI34ati79crrbXZJyQVwcsLxu83W38?= =?us-ascii?Q?vwcQfrngxi0GFvGOXULr5IPeMMZp9oOs7r4moo3bE8SVTECFTy6MlSfHAoje?= =?us-ascii?Q?Qfu3OX3xdii4cDEbLnZw9pIhDisTTawEKDzF1WHRW9K00mCPfTvK/4PlNDln?= =?us-ascii?Q?c3us2i/jeRYIQueoXDHpDP/XRTetpcprZLPQ3/tU7NsDlG61jSn8Tsn3BOes?= =?us-ascii?Q?huVx2TwMSIRsIhooH60NkMs0wLEtuoDi+r26rFdu+yoLfKwP9M5Cm1z6Oyme?= =?us-ascii?Q?Vviv8Eej1wX4CVSm/jONAoO93QFyIWaIIgSVWo3/PqWuCQ51ClpD1bi/IMMK?= =?us-ascii?Q?3Vfli5yJm16ltQnOiOjlkpQTG+51y8HCtffXHUkDvIsteOwWlcik6USkDj0h?= =?us-ascii?Q?X9K194SmQlRyc3ipx/a4Yb4fZLC6tS/M0KAiuNZ2LKtTZXbT+IXWWIQ+VWtm?= =?us-ascii?Q?9PsArTVi7iM1xS/clde6IPwI3byrQrfZXa5IUFVq2M2cYTx0O3EycLIBnjUI?= =?us-ascii?Q?nQ=3D=3D?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c916545-8275-4870-54c2-08dc3483a7d1 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2024 15:25:24.1739 (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: KgSp7lCH1sG/RFqaCCZtcmXf9m58q6BzHCYqTvjzrE/MfSyGLja2dAKmtC3cvlauzu1iPgCdzi5EzsfBcOzW0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB6794 X-Proofpoint-ORIG-GUID: 8aMY65Q-X3GKW3KxsvTk1j1H3PM8AUBa X-Proofpoint-GUID: 8aMY65Q-X3GKW3KxsvTk1j1H3PM8AUBa 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-02-23_01,2024-02-23_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.066, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @nutanix.com) X-ZM-MESSAGEID: 1708703303529100001 Content-Type: text/plain; charset="utf-8" Introduce support for adding a 'channels' argument to migrate_qmp_fail, migrate_incoming_qmp and migrate_qmp functions within the migration qtest framework, enabling enhanced control over migration scenarios. Signed-off-by: Het Gala --- tests/qtest/dbus-vmstate-test.c | 2 +- tests/qtest/migration-helpers.c | 78 +++++++++++++++++++++++++++---- tests/qtest/migration-helpers.h | 15 +++--- tests/qtest/migration-test.c | 43 ++++++++--------- tests/qtest/virtio-net-failover.c | 8 ++-- 5 files changed, 105 insertions(+), 41 deletions(-) diff --git a/tests/qtest/dbus-vmstate-test.c b/tests/qtest/dbus-vmstate-tes= t.c index 6c990864e3..0ca572e29b 100644 --- a/tests/qtest/dbus-vmstate-test.c +++ b/tests/qtest/dbus-vmstate-test.c @@ -229,7 +229,7 @@ test_dbus_vmstate(Test *test) =20 thread =3D g_thread_new("dbus-vmstate-thread", dbus_vmstate_thread, lo= op); =20 - migrate_qmp(src_qemu, uri, "{}"); + migrate_qmp(src_qemu, uri, NULL, "{}"); test->src_qemu =3D src_qemu; if (test->migrate_fail) { wait_for_migration_fail(src_qemu, true); diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helper= s.c index e451dbdbed..15c3650b55 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "qemu/ctype.h" #include "qapi/qmp/qjson.h" +#include "qapi/qmp/qlist.h" =20 #include "migration-helpers.h" =20 @@ -43,7 +44,67 @@ bool migrate_watch_for_events(QTestState *who, const cha= r *name, return false; } =20 -void migrate_qmp_fail(QTestState *who, const char *uri, const char *fmt, .= ..) +static QList *MigrationChannelList_to_QList(MigrationChannelList *channels) +{ + MigrationChannel *channel =3D NULL; + MigrationAddress *addr =3D NULL; + SocketAddress *saddr =3D NULL; + QList *channelList =3D qlist_new(); + QDict *channelDict =3D qdict_new(); + QDict *addrDict =3D qdict_new(); + + channel =3D channels->value; + if (!channel || channel->channel_type =3D=3D MIGRATION_CHANNEL_TYPE__M= AX) { + fprintf(stderr, "%s: Channel or its type is NULL\n", + __func__); + } + g_assert(channel); + if (channel->channel_type =3D=3D MIGRATION_CHANNEL_TYPE_MAIN) { + qdict_put_str(channelDict, "channel-type", g_strdup("main")); + } + + addr =3D channel->addr; + if (!addr || addr->transport =3D=3D MIGRATION_ADDRESS_TYPE__MAX) { + fprintf(stderr, "%s: addr or its transport is NULL\n", + __func__); + } + g_assert(addr); + if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { + qdict_put_str(addrDict, "transport", g_strdup("socket")); + } + + saddr =3D &addr->u.socket; + if (!saddr) { + fprintf(stderr, "%s: saddr is NULL\n", __func__); + } + g_assert(saddr); + qdict_put_str(addrDict, "type", SocketAddressType_str(saddr->type)); + qdict_put_str(addrDict, "port", saddr->u.inet.port); + qdict_put_str(addrDict, "host", saddr->u.inet.host); + + qdict_put_obj(channelDict, "addr", QOBJECT(addrDict)); + qlist_append_obj(channelList, QOBJECT(channelDict)); + + return channelList; +} + +static void migrate_qmp_attach_ports(QDict *args, const char *uri, + MigrationChannelList *channels) +{ + if (uri) { + g_assert(!qdict_haskey(args, "uri")); + qdict_put_str(args, "uri", uri); + } + + if (channels) { + g_assert(!qdict_haskey(args, "channels")); + QList *channelList =3D MigrationChannelList_to_QList(channels); + qdict_put_obj(args, "channels", QOBJECT(channelList)); + } +} + +void migrate_qmp_fail(QTestState *who, const char *uri, + MigrationChannelList *channels, const char *fmt, ...) { va_list ap; QDict *args, *err; @@ -52,8 +113,7 @@ void migrate_qmp_fail(QTestState *who, const char *uri, = const char *fmt, ...) args =3D qdict_from_vjsonf_nofail(fmt, ap); va_end(ap); =20 - g_assert(!qdict_haskey(args, "uri")); - qdict_put_str(args, "uri", uri); + migrate_qmp_attach_ports(args, uri, channels); =20 err =3D qtest_qmp_assert_failure_ref( who, "{ 'execute': 'migrate', 'arguments': %p}", args); @@ -68,7 +128,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, const char *uri, + MigrationChannelList *channels, const char *fmt, ...) { va_list ap; QDict *args; @@ -77,8 +138,7 @@ void migrate_qmp(QTestState *who, const char *uri, const= char *fmt, ...) args =3D qdict_from_vjsonf_nofail(fmt, ap); va_end(ap); =20 - g_assert(!qdict_haskey(args, "uri")); - qdict_put_str(args, "uri", uri); + migrate_qmp_attach_ports(args, uri, channels); =20 qtest_qmp_assert_success(who, "{ 'execute': 'migrate', 'arguments': %p}", a= rgs); @@ -95,7 +155,8 @@ void migrate_set_capability(QTestState *who, const char = *capability, capability, value); } =20 -void migrate_incoming_qmp(QTestState *to, const char *uri, const char *fmt= , ...) +void migrate_incoming_qmp(QTestState *to, const char *uri, + MigrationChannelList *channels, const char *fmt,= ...) { va_list ap; QDict *args, *rsp, *data; @@ -104,8 +165,7 @@ void migrate_incoming_qmp(QTestState *to, const char *u= ri, const char *fmt, ...) args =3D qdict_from_vjsonf_nofail(fmt, ap); va_end(ap); =20 - g_assert(!qdict_haskey(args, "uri")); - qdict_put_str(args, "uri", uri); + migrate_qmp_attach_ports(args, uri, channels); =20 migrate_set_capability(to, "events", true); =20 diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helper= s.h index 3bf7ded1b9..390e386274 100644 --- a/tests/qtest/migration-helpers.h +++ b/tests/qtest/migration-helpers.h @@ -14,6 +14,7 @@ #define MIGRATION_HELPERS_H =20 #include "libqtest.h" +#include "migration/migration.h" =20 typedef struct QTestMigrationState { bool stop_seen; @@ -25,15 +26,17 @@ typedef struct QTestMigrationState { bool migrate_watch_for_events(QTestState *who, const char *name, QDict *event, void *opaque); =20 -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, const char *uri, + MigrationChannelList *channels, const char *fmt, ...); =20 -G_GNUC_PRINTF(3, 4) +G_GNUC_PRINTF(4, 5) void migrate_incoming_qmp(QTestState *who, const char *uri, - const char *fmt, ...); + MigrationChannelList *channels, const char *fmt, .= ..); =20 -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, + MigrationChannelList *channels, const char *fmt, ...= ); =20 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 8a5bb1752e..e5547b8746 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -18,6 +18,7 @@ #include "qemu/module.h" #include "qemu/option.h" #include "qemu/range.h" +#include "migration/migration.h" #include "qemu/sockets.h" #include "chardev/char.h" #include "qapi/qapi-visit-sockets.h" @@ -1350,7 +1351,7 @@ static int migrate_postcopy_prepare(QTestState **from= _ptr, wait_for_suspend(from, &src_state); =20 g_autofree char *uri =3D migrate_get_socket_address(to, "socket-addres= s"); - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, uri, NULL, "{}"); =20 migrate_wait_for_dirty_mem(from, to); =20 @@ -1500,7 +1501,7 @@ static void postcopy_recover_fail(QTestState *from, Q= TestState *to) g_assert_cmpint(ret, =3D=3D, 1); =20 migrate_recover(to, "fd:fd-mig"); - migrate_qmp(from, "fd:fd-mig", "{'resume': true}"); + migrate_qmp(from, "fd:fd-mig", NULL, "{'resume': true}"); =20 /* * Make sure both QEMU instances will go into RECOVER stage, then test @@ -1588,7 +1589,7 @@ static void test_postcopy_recovery_common(MigrateComm= on *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, uri, NULL, "{'resume': true}"); =20 /* Restore the postcopy bandwidth to unlimited */ migrate_set_parameter_int(from, "max-postcopy-bandwidth", 0); @@ -1669,7 +1670,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, "tcp:127.0.0.1:0", NULL, "{}"); wait_for_migration_fail(from, false); test_migrate_end(from, to, false); } @@ -1708,7 +1709,7 @@ static void test_analyze_script(void) uri =3D g_strdup_printf("exec:cat > %s", file); =20 migrate_ensure_converge(from); - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, uri, NULL, "{}"); wait_for_migration_complete(from); =20 pid =3D fork(); @@ -1773,11 +1774,11 @@ static void test_precopy_common(MigrateCommon *args) } =20 if (args->result =3D=3D MIG_TEST_QMP_ERROR) { - migrate_qmp_fail(from, connect_uri, "{}"); + migrate_qmp_fail(from, connect_uri, NULL, "{}"); goto finish; } =20 - migrate_qmp(from, connect_uri, "{}"); + migrate_qmp(from, connect_uri, NULL, "{}"); =20 if (args->result !=3D MIG_TEST_SUCCEED) { bool allow_active =3D args->result =3D=3D MIG_TEST_FAIL; @@ -1869,18 +1870,18 @@ static void test_file_common(MigrateCommon *args, b= ool stop_src) } =20 if (args->result =3D=3D MIG_TEST_QMP_ERROR) { - migrate_qmp_fail(from, connect_uri, "{}"); + migrate_qmp_fail(from, connect_uri, NULL, "{}"); goto finish; } =20 - migrate_qmp(from, connect_uri, "{}"); + migrate_qmp(from, connect_uri, NULL, "{}"); wait_for_migration_complete(from); =20 /* * We need to wait for the source to finish before starting the * destination. */ - migrate_incoming_qmp(to, connect_uri, "{}"); + migrate_incoming_qmp(to, connect_uri, NULL, "{}"); wait_for_migration_complete(to); =20 if (stop_src) { @@ -2029,7 +2030,7 @@ static void test_ignore_shared(void) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, uri, NULL, "{}"); =20 migrate_wait_for_dirty_mem(from, to); =20 @@ -2387,7 +2388,7 @@ static void *test_migrate_fd_start_hook(QTestState *f= rom, close(pair[0]); =20 /* Start incoming migration from the 1st socket */ - migrate_incoming_qmp(to, "fd:fd-mig", "{}"); + migrate_incoming_qmp(to, "fd:fd-mig", NULL, "{}"); =20 /* Send the 2nd socket to the target */ qtest_qmp_fds_assert_success(from, &pair[1], 1, @@ -2455,7 +2456,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"); =20 - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, uri, NULL, "{}"); =20 if (should_fail) { qtest_set_expected_status(to, EXIT_FAILURE); @@ -2558,7 +2559,7 @@ static void test_migrate_auto_converge(void) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, uri, NULL, "{}"); =20 /* Wait for throttling begins */ percentage =3D 0; @@ -2609,7 +2610,7 @@ test_migrate_precopy_tcp_multifd_start_common(QTestSt= ate *from, migrate_set_capability(to, "multifd", true); =20 /* Start incoming migration from the 1st socket */ - migrate_incoming_qmp(to, "tcp:127.0.0.1:0", "{}"); + migrate_incoming_qmp(to, "tcp:127.0.0.1:0", NULL, "{}"); =20 return NULL; } @@ -2862,14 +2863,14 @@ static void test_multifd_tcp_cancel(void) migrate_set_capability(to, "multifd", true); =20 /* Start incoming migration from the 1st socket */ - migrate_incoming_qmp(to, "tcp:127.0.0.1:0", "{}"); + migrate_incoming_qmp(to, "tcp:127.0.0.1:0", NULL, "{}"); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 uri =3D migrate_get_socket_address(to, "socket-address"); =20 - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, uri, NULL, "{}"); =20 migrate_wait_for_dirty_mem(from, to); =20 @@ -2892,7 +2893,7 @@ static void test_multifd_tcp_cancel(void) migrate_set_capability(to2, "multifd", true); =20 /* Start incoming migration from the 1st socket */ - migrate_incoming_qmp(to2, "tcp:127.0.0.1:0", "{}"); + migrate_incoming_qmp(to2, "tcp:127.0.0.1:0", NULL, "{}"); =20 g_free(uri); uri =3D migrate_get_socket_address(to2, "socket-address"); @@ -2901,7 +2902,7 @@ static void test_multifd_tcp_cancel(void) =20 migrate_ensure_non_converge(from); =20 - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, uri, NULL, "{}"); =20 migrate_wait_for_dirty_mem(from, to2); =20 @@ -3234,7 +3235,7 @@ static void test_migrate_dirty_limit(void) migrate_dirty_limit_wait_showup(from, dirtylimit_period, dirtylimit_va= lue); =20 /* Start migrate */ - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, uri, NULL, "{}"); =20 /* Wait for dirty limit throttle begin */ throttle_us_per_full =3D 0; @@ -3275,7 +3276,7 @@ static void test_migrate_dirty_limit(void) } =20 /* Start migrate */ - migrate_qmp(from, uri, "{}"); + migrate_qmp(from, uri, NULL, "{}"); =20 /* Wait for dirty limit throttle begin */ throttle_us_per_full =3D 0; diff --git a/tests/qtest/virtio-net-failover.c b/tests/qtest/virtio-net-fai= lover.c index 73dfabc272..e263ecd80e 100644 --- a/tests/qtest/virtio-net-failover.c +++ b/tests/qtest/virtio-net-failover.c @@ -772,7 +772,7 @@ static void test_migrate_in(gconstpointer opaque) check_one_card(qts, true, "standby0", MAC_STANDBY0); check_one_card(qts, false, "primary0", MAC_PRIMARY0); =20 - migrate_incoming_qmp(qts, uri, "{}"); + migrate_incoming_qmp(qts, uri, NULL, "{}"); =20 resp =3D get_failover_negociated_event(qts); g_assert_cmpstr(qdict_get_str(resp, "device-id"), =3D=3D, "standby0"); @@ -894,7 +894,7 @@ static void test_off_migrate_in(gconstpointer opaque) check_one_card(qts, true, "standby0", MAC_STANDBY0); check_one_card(qts, true, "primary0", MAC_PRIMARY0); =20 - migrate_incoming_qmp(qts, uri, "{}"); + migrate_incoming_qmp(qts, uri, NULL, "{}"); =20 check_one_card(qts, true, "standby0", MAC_STANDBY0); check_one_card(qts, true, "primary0", MAC_PRIMARY0); @@ -1021,7 +1021,7 @@ static void test_guest_off_migrate_in(gconstpointer o= paque) check_one_card(qts, true, "standby0", MAC_STANDBY0); check_one_card(qts, false, "primary0", MAC_PRIMARY0); =20 - migrate_incoming_qmp(qts, uri, "{}"); + migrate_incoming_qmp(qts, uri, NULL, "{}"); =20 check_one_card(qts, true, "standby0", MAC_STANDBY0); check_one_card(qts, false, "primary0", MAC_PRIMARY0); @@ -1746,7 +1746,7 @@ static void test_multi_in(gconstpointer opaque) check_one_card(qts, true, "standby1", MAC_STANDBY1); check_one_card(qts, false, "primary1", MAC_PRIMARY1); =20 - migrate_incoming_qmp(qts, uri, "{}"); + migrate_incoming_qmp(qts, uri, NULL, "{}"); =20 resp =3D get_failover_negociated_event(qts); g_assert_cmpstr(qdict_get_str(resp, "device-id"), =3D=3D, "standby0"); --=20 2.22.3 From nobody Tue Nov 26 09:49:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); dmarc=pass(p=none dis=none) header.from=nutanix.com ARC-Seal: i=2; a=rsa-sha256; t=1708702353; cv=pass; d=zohomail.com; s=zohoarc; b=Hnk9L67T8bj3N1EV76UWDU0zicR3GUQxA4VZkGi67ebiXb8jrTKV+ggbpAIAniM8W6/ym2ObNqyZHOOjVV1CsCOhj0pCZL3VbtGX+dZu0s+hAN3XQFv8AZ+8FunN6gZxQTEBQI/yx9fiu0XjFzaxbJGM7IzZ/uqbXct5zuxbdK4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708702353; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jPCpuQ+toVNWlXhpAET3psDJO71znfKvGKAJ2dc58gg=; b=byY0E8D14/ro62elYiZYnclUGwd1pnoz9rF0WN5JNYutW9fLarIHAfgbiB4dvKV3wOayO+Ol7kYxsd7YgwXLJnZgKnxov95P7wnh4myA485A6MZqURRXAqhubpboVvSstO6xF+AsJ1NZEzb2miHZr2K9Wzf8MY2E7QwGgNPQAyw= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708702352992795.5287976389386; Fri, 23 Feb 2024 07:32:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdXW6-0000Z0-5V; Fri, 23 Feb 2024 10:31:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdXQd-0007Ju-1y for qemu-devel@nongnu.org; Fri, 23 Feb 2024 10:25:35 -0500 Received: from mx0a-002c1b01.pphosted.com ([148.163.151.68]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdXQZ-00033Q-Oe for qemu-devel@nongnu.org; Fri, 23 Feb 2024 10:25:34 -0500 Received: from pps.filterd (m0127840.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41NBN8iL030719; Fri, 23 Feb 2024 07:25:28 -0800 Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3wd21u7wrn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 07:25:27 -0800 (PST) Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by DM6PR02MB6794.namprd02.prod.outlook.com (2603:10b6:5:214::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.24; Fri, 23 Feb 2024 15:25:25 +0000 Received: from SJ2PR02MB9955.namprd02.prod.outlook.com ([fe80::225c:2edd:87e:7cf0]) by SJ2PR02MB9955.namprd02.prod.outlook.com ([fe80::225c:2edd:87e:7cf0%7]) with mapi id 15.20.7316.023; Fri, 23 Feb 2024 15:25:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= proofpoint20171006; bh=jPCpuQ+toVNWlXhpAET3psDJO71znfKvGKAJ2dc58 gg=; b=kpy312Nyk/LDBTK++Gz5yZ/H/wXlIgCMXm2GBCydeBrDYS199xiQ1fzAY eWA1JXBGr9schKFTQaf5+ACjmCpSGf7GjJQ1RnFBdIoIkp+WQUR0lcUhataJhYvA AgTui+ffUjMMoLAV9eo3yU2+n6uX3yeTiAzKYyT/eysVW39g/IyNxKViWDG9a7JP AfHYdq5qwZBe3JoJ8n0oNY6I1AduTyaD/8rua4kFfsOGblA/agP9SNorubcD4T6+ GrT5qvjqKCLeO3zZdYIgqlpZGsUtdIEJrVrl0KucOp5ExxMB7mBXqHT4O2h2v//A qaW+Tx13ClnBCkpey9E5wS2j3FNEA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QsCaP5raXCwXSTAPOtsyo/EsE2HHGoPaV7rMLBZlCOGpGsrL1u8lpzT1pgKFAVdhgMvELbyhjYJM33GavRMfNdtZtHJ53cHIE/Q9kaQe5FQN1Ey/Zoss2mcvlHcsDjW2atZWghJ8obJoVg+l+mZRh5VSutJ0qnQ73v4xarbidFIxloXuLHt2zQIu+ybZmsvHLyobaa453fUkr5EqKwAwoz6sdBuQnDH+P0LGNo2JywdUY/Km1IEWlbawORrgiuQhyqBm5NAkrHu5vup9LY8wSqutOJ4lpKGH+N6TAl04iE3quEB2PlFSrP31MxH4B3hKqAGr4tmRJ3rBxVMhPPZoXg== 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=jPCpuQ+toVNWlXhpAET3psDJO71znfKvGKAJ2dc58gg=; b=PK9bK9UzGV+ZrSgXvGe4xKgakJiyrYKvaY2uoBzgaUMXzd9XpCFuFFndiWwvoSzThN+NKiZGJIVR3lNLj5NQttbQ3f4czJfN3d74ND3kT7o5AtluAyLg1OF8fNISFDWjaw2a3IMBRGfPy9hAY4sOwLnNrPspNTmOVAI83dNzAKu1cASKAYpE2k1Gcs0IM5lJs6SW0QnnKiJ7aFs6nvntzReK29et+cvkExJFLUe7TeBkmR9eQNGBXAQQv//AQZX6Y+Gb5cZGt89yx317X3onKH8dp6y0rBOFQXpzZhxdVo4TtOub021+D0fU1QaNkL73Bu4Iq6soEEoyTozeNjNiwg== 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=jPCpuQ+toVNWlXhpAET3psDJO71znfKvGKAJ2dc58gg=; b=IWqSIUBy8miOWANd1klll6w6+bStGpBnlGa7sGc9O7Pg4VJsw9sPJstj3rzRTfG3VkH5D7h1DOgLLpWkLXfxPCy1bztvpNsBJgZunpi3y3UfmnSfmHcrEBXfvO6ejfAvoLFj9YpupBQ3aNOso3LoRkU8hlhFWHDbcRi3ynVHMLV8bsBEtTPMrHtobs/lcdt+UTDjNj72JovYGRfCK97uhGUCo5/4FHDhGvXHjQdVqoKGyAr+PFz7jdpFwOgKdt6edUDj9QsPIKJK3rZ7jW87tVUFOrl2/VseqUpAqySwdi8U4gEemPDIxhk0fCFrAuINT1nRX/H2l9L5cQwVbet7cQ== 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 v2 2/3] qtest: migration: Add negative validation tests for 'uri' and 'channels' Date: Fri, 23 Feb 2024 15:25:16 +0000 Message-Id: <20240223152517.7834-3-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240223152517.7834-1-het.gala@nutanix.com> References: <20240223152517.7834-1-het.gala@nutanix.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: PH8PR07CA0002.namprd07.prod.outlook.com (2603:10b6:510:2cd::9) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|DM6PR02MB6794:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e396905-9917-493f-98f7-08dc3483a8ab 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: sqx3KnsncHSLLYs2kEGCnWnH3KkGvV8PGcQJWTh2wzW54zbu2iRqpbgW7kJjanLXy5nJdwGgIgDfwb9wRkCd2Nls0Baxp9joH/Lj6/dgBwcvsvxyunfxx3BA9BDr3v9ufqTY8/1ErydFNpmITTXKiwXZ67e8YXEZ55pyktGGc1YVElHwQup13La1iPDjmZ09uqoBR163d+WRhJrnjmdHXtKT4P0Ij/CRlh36z26b0q8lOkuiaUQg4VXmIcI8nBQyqyCSWH37BqjqJNfh6NjNca6ijSsZ+DYMWkHyJwlmw79fwMytIjRJfHl+MfHBh4SPj/tksjDNejl0XBxlsQw6DxiLChfBXhJ6BXfpHG17WcECm+oyhfWIQzHPSwT7XvAqB2tCEMxDyVE/kTFAVUuXE4emkN8QcCdJW91HKiIxQgaXRSsDidpPz1Hy9lZ+aPhapC4gkeAK+3clmxWt3zYoqDGp4tL8eNBQlWUolZMlFWHHnNuc1YRTlT262Wv+A6DoKQ6NWtC3sA5G7fvWmUyIF1kMiwFpN1M2MigIK6rsDz7mlO3pU6ITS6+E4vgbMO4zNyZb12xQh2qhPUak2EZ/CWBY9XXh3+NeV5A85nxfBn9P0opPbFfHpLiVe6BgebCG 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)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?zXEjDfR5mrtnHxq1AhAHy9MnUFdTp0n2B6lNtaMDqWOvCrTidqm92Rbx0nik?= =?us-ascii?Q?KhahxNuHccwtRtBPGN/WqlObWi8PtIBdLZ9CCN73IVHT9NMr+cMSxlS5LAzI?= =?us-ascii?Q?ryK7Z5Gx48OXbxSZ0H6AasBvz+VgNHPBXCXc5hFvzLIuqUaXzjEfjfadxrZc?= =?us-ascii?Q?Iw+t2aYZekXVqda+5stbTWaRdzRVg2rGTPN41CCEICgs9LIZMlwwbO50sQ2H?= =?us-ascii?Q?1wo989+WkIe8zKfT/W1HacuY85T+5Pgr45M/l2Odn2soTScafC6CoXnhstcH?= =?us-ascii?Q?ciUPcLsWtmFFyRT0GWrNTQt53uN3Yv3uudoVadmNvLhUBDQzWSwL1o0Ytocp?= =?us-ascii?Q?T0bHz5Vt4HlGOlLiZHsNsXwnFocvyJEOWegkKni1tOOX0Kg7LjS5GgHdOqVt?= =?us-ascii?Q?f8rR2mPzt1F1SxyGxVT0VhgwpawiUbTVsuDNBJdI7lxGHbKgk0puwfEQ0M6u?= =?us-ascii?Q?JvYEiDnGLY1V/S8Cg/4LmePrJX2mzM2JXl3SUVY9zu+IlB729gqR90B0BTp/?= =?us-ascii?Q?gyh8mSJ6TqNBsNcTKbLbmDd+f6cDLxAtwKEQpkKPgeBKIsoDjzwkw037tIHE?= =?us-ascii?Q?2xQolIu4ZIoYNuNyB9aIw6MOKhsa7UX8c5e94lq1lAvx56tVmAVEVvq61UjU?= =?us-ascii?Q?R4SAO/eGD+V1eFkInGq03XwF5sZyeg7XR+BsCMqRz+AL+i+mht32GqJ+8Ih/?= =?us-ascii?Q?GHhtfvBlkwP9Kp2me6tWD+ukwF9+aSlk/Jw6TqZi9TtXjw9oEvRWVIo6FVXD?= =?us-ascii?Q?Fw3j5GZakhJzKKiWBF2jsxa3xLgySVyiJNE7vrI+ZgD0qlal9lLhgLsgBMIi?= =?us-ascii?Q?QLo/1aOQSnign0U+r/1OxOx6X/DIROPN8Orl9VyEPrH7p0V3yVIWj2klRnWr?= =?us-ascii?Q?165RmyF2L+Bmx3wVxgT66JeW1VQj8dnPwJ8DNkZG97HYAQTJwkmiQ6jr0KV+?= =?us-ascii?Q?JP2f10I8L0vYIf9BvUVBF7KVzCtqlBBrxA2hKlNUU8u9UhkqHY7/87oHw22t?= =?us-ascii?Q?3rGWW3ATIV3yTec+msQXXyqzCS/BrTz8zyozhKJaFRdZqn8JksRqPjZ7OnU+?= =?us-ascii?Q?8Z2KeTPkoOCZhqOXlzYg22IkJeAg5WdD68ejVFmhHTkSfPCMvL3Uv7rdPj4z?= =?us-ascii?Q?9oLecGIDW4pBq9j8kJrpLvTYrB7cSSkX3uGSp3VIlx+A+kRq+ltQxb0HyBI1?= =?us-ascii?Q?4d90KJg87U0l73T2jMYiUOT974oQEFBxjMVgSP0lSje7TDhhSIJxnv2P5yAs?= =?us-ascii?Q?lnNqZS8RQMRza/3iqIgPp+Co9p8rLirDmfUSmGp7EAdWao4qhJ7+gCKxB4dF?= =?us-ascii?Q?x7f5ZtLKGBAihPuFLd4Ub4piYY5vt1EBuF+cbLjfbuErL235u4ruP80iPsiE?= =?us-ascii?Q?E5qPYMcr5LRQlb/NUPOXRO9ZJvjEMDNpzZP5eP4YM2OMQDmtiFyyF4sHyx7j?= =?us-ascii?Q?uT2nN4ZDHnE+oPjPw03NEfKQHQspJBbRPpGDh+t8JPftubEi50N60XRhnNmB?= =?us-ascii?Q?qn0wS2Acm4a5w9GFtcUOKDjaudR3hAUf3NeTHwxQHsmpNjY3APrVwHPLtikf?= =?us-ascii?Q?Py0TFAm12XTrIypoulPM7KirMYDvK4e6DNRgCeftZTDs8c7rgZxcf7yY5twB?= =?us-ascii?Q?ug=3D=3D?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e396905-9917-493f-98f7-08dc3483a8ab X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2024 15:25:25.6099 (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: BxuGc5qjikxNKjApFh1534RIQ/hvGgesLiApHlfOXNZuVgJpid9jxUwt86rvfyahNnbD0I1157xmJIw41mNd1A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB6794 X-Proofpoint-ORIG-GUID: gdSmFv64r0udfGcP7Q7sghlPFfEDP8Cy X-Proofpoint-GUID: gdSmFv64r0udfGcP7Q7sghlPFfEDP8Cy 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-02-23_01,2024-02-23_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.066, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @nutanix.com) X-ZM-MESSAGEID: 1708702354784100001 Content-Type: text/plain; charset="utf-8" Ideally 'migrate' and 'migrate-incoming' QAPIs should not allow 'uri' and 'channels' both arguments to be present simultaneously, but also one of them should be present in the QAPI. IOW they are mututally exhaustive arguments for QAPI Add negative test cases to validate the same. Even before the migration connection is established, qmp command should error out with MIG_TEST_QMP_ERROR. Signed-off-by: Het Gala --- tests/qtest/migration-test.c | 91 ++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index e5547b8746..c1d9ee6466 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -370,6 +370,30 @@ static void cleanup(const char *filename) unlink(path); } =20 +static MigrationChannelList *uri_to_channels(const char *uri) +{ + MigrationChannelList *channels =3D g_new0(MigrationChannelList, 1); + MigrationChannel *val =3D g_new0(MigrationChannel, 1); + MigrationAddress *addr =3D g_new0(MigrationAddress, 1); + char **saddr; + + addr->transport =3D MIGRATION_ADDRESS_TYPE_SOCKET; + + saddr =3D g_strsplit((char *)uri, ":", 3); + g_assert(saddr[0] && strcmp(saddr[0], "tcp") =3D=3D 0); + + addr->u.socket.type =3D SOCKET_ADDRESS_TYPE_INET; + addr->u.socket.u.inet.host =3D g_strdup(saddr[1]); + addr->u.socket.u.inet.port =3D g_strdup(saddr[2]); + g_strfreev(saddr); + + val->channel_type =3D MIGRATION_CHANNEL_TYPE_MAIN; + val->addr =3D addr; + channels->value =3D val; + + return channels; +} + static char *SocketAddress_to_str(SocketAddress *addr) { switch (addr->type) { @@ -704,6 +728,13 @@ typedef struct { */ const char *connect_uri; =20 + /* + * Optional: bool variable to connect list of migration stream + * channels, to a dest QEMU, can be utilized instead of a URI to + * accomplish the same task as listen_uri or connect_uri. + */ + bool connect_channels; + /* Optional: callback to run at start to set migration parameters */ TestMigrateStartHook start_hook; /* Optional: callback to run at finish to cleanup */ @@ -2509,6 +2540,62 @@ static void test_validate_uuid_dst_not_set(void) do_test_validate_uuid(&args, false); } =20 +static void do_test_validate_uri_channel(MigrateCommon *args) +{ + QTestState *from, *to; + g_autofree char *connect_uri =3D NULL; + g_autofree MigrationChannelList *connect_channels =3D NULL; + + 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"); + + if (strcmp(args->listen_uri, "defer") !=3D 0) { + connect_uri =3D migrate_get_socket_address(to, "socket-address"); + } + + if (args->connect_channels) { + connect_channels =3D uri_to_channels(connect_uri); + } + /* + * 'uri' and 'channels' validation is checked even before the migration + * starts. + */ + migrate_qmp_fail(from, connect_uri, connect_channels, "{}"); + test_migrate_end(from, to, false); +} + +static void +test_validate_uri_channels_both_set(void) +{ + MigrateCommon args =3D { + .start =3D { + .hide_stderr =3D true, + }, + .connect_channels =3D true, + .listen_uri =3D "tcp:127.0.0.1:0", + }; + + do_test_validate_uri_channel(&args); +} + +static void +test_validate_uri_channels_none_set(void) +{ + MigrateCommon args =3D { + .start =3D { + .hide_stderr =3D true, + }, + .connect_channels =3D false, + .listen_uri =3D "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 @@ -3537,6 +3624,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 */ --=20 2.22.3 From nobody Tue Nov 26 09:49:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); dmarc=pass(p=none dis=none) header.from=nutanix.com ARC-Seal: i=2; a=rsa-sha256; t=1708702705; cv=pass; d=zohomail.com; s=zohoarc; b=nuK6SHhtZ5HQM3XQChL0uncrkRsKeVSqAIJKQHlDR/BYc2Et6BWKyeyVz+jhZR2uHlGHFVMO7mvnsFmS4k2bVR5Vqw8bHgRRsknOlOvCDktRUBTtejD8F3K6TSX77ImFCyoTW+jLcvYQemtp8SQDGYZ0XUcTRPb5yYTjxIveefI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708702705; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=FT6h2purXtdvxYBTixoMMzyI4TT5v+l7QFkYsidJrZ4=; b=PUiOBC+ROWzgDS/d//k9fR8wsxyvhzT5LtIUoong6sodu8kbpIOTxdhFwNcWnmOw2dcKWAqehKGwSfGIT8SecCSeI1UINu8A2kmsndxQbb4s6UHPwfvg6txtyRtHtjNOGmFjNmztRToA4V+BEroiLOmGazFQMIboMwZOimGqowU= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708702705904916.9167318954177; Fri, 23 Feb 2024 07:38:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdXcG-0002Xf-IJ; Fri, 23 Feb 2024 10:37:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdXQd-0007Jv-26 for qemu-devel@nongnu.org; Fri, 23 Feb 2024 10:25:35 -0500 Received: from mx0a-002c1b01.pphosted.com ([148.163.151.68]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdXQZ-00033x-Oa for qemu-devel@nongnu.org; Fri, 23 Feb 2024 10:25:34 -0500 Received: from pps.filterd (m0127840.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41NBN8iM030719; Fri, 23 Feb 2024 07:25:28 -0800 Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3wd21u7wrn-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 07:25:28 -0800 (PST) Received: from SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) by DM6PR02MB6794.namprd02.prod.outlook.com (2603:10b6:5:214::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.24; Fri, 23 Feb 2024 15:25:27 +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.7316.023; Fri, 23 Feb 2024 15:25:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= proofpoint20171006; bh=FT6h2purXtdvxYBTixoMMzyI4TT5v+l7QFkYsidJr Z4=; b=llth3KedzwDWCmBM9Fedc0ngPHpLbT7xgq+58zNpaE/1JqvA6V26s+xiB UaCqErKO3GFRJxMtaAyiolVvmpM4Cd363tzGrS7VlZIXoymHe/vAVa4gUbSF9jAK Nq5imIzE9DZUSWJCFlQi5y5cgsuIRZsm/JpjNjWwsfBJxzHldauyhqZXGZjaSSdE 9Y1CUHDw/soXi25V72k3ADKggScWjCEbL/EYqrhXVuDwfj4eiUz+AFS2CFXtLn6p 8SbNUjBDMBJyGFXwat+I8T7MfycdEtAMxEQ+0CkFjhpdNOT3o0rHj+mP1/eC7pgn Ob3JT4PPzk/IEd3WYL8Mti146ExOg== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ThVdz2+NzwKP1sPdsgRFGPQ2/GLHDNw8Nf+I7etVpgqE902B+U5+nMpse/uI5N34nFE/g97Pg0zbsShLFjIQK/Xuz+xVeJK4MT0iT1xblPhP+CePCNq9mWR0AKHkdh0FJcZ6rwC6O/TEIzE5uvNhbZ4kFt8exkjY4Pz4DuCFe9M/tH8DJ9N5SqknV+dtGYh3Jt1QnYNilHakUB2H/IPcn5yzYrarUNzsrdQwo6GlEfojKrl2K//GWCqBXb2oNLd83G5k70LpELpKNkfT8Rfrsg2GFI2Pf3PAcKb1QUleWcS1RvnQTFZ2KaB8c5yAtYNiXR54Tri96yrhXGzYBstGwg== 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=FT6h2purXtdvxYBTixoMMzyI4TT5v+l7QFkYsidJrZ4=; b=OQswG4cB00Qkxid9F0HmsOlC9a4f5CUqGlltEHX8UHMEQQ7PRu++BaXmS2BdYuClXOxXpE2UYOEYDfEuXhO8VVfu2GfNdrhTrHX8w3CG3R05Rm2SqpNE/MZtVizYMkSlNkkYF3lSpK4Q+HiMF4r8DF9SfVyMkAHha/UbAGKCsjGjokHjhhPkUN5bMhdSDEwPYQVy1faQGYep10iyi/LsdFGByengC2GaPVd8iEcSwXLrwn7AoCGNDcXWpcZ5In6yOUPXqY58ZMjxPNnW1e3WYOTa3cVpL8SEzj19Trz4WjFm/A8vAuyGtnvbuPty84uvcK3/Wo4Lp6gSjVtKqJNIfA== 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=FT6h2purXtdvxYBTixoMMzyI4TT5v+l7QFkYsidJrZ4=; b=JFS5Xguq6+fnjsenJ3TVR8fMOcbpcArHdySGK6Gv/dGt8KS0MHr47h+Do2b8VrA66XJKuzlWGSAER28T25oqKULHdufkNRIFqNjrSTnScL4mlngwpvRCANt6Xwm7rhhDXBhO5h7sRwMPtprXnTndASfGHvIQAbBrnzfvr3dGoEYwLWTsqPn3xgCdWAtsdBppg9JrFf/O9CoTNHhFG+IQW5JxmHNTmXt9jmX54LMLUf18+y7X0wvWAIFnLMQ8s6ACf/duRXYK5J92BMepvgpWj8bjFwXRe05kUiLZtKfu9RdeqrBLLfVtNinCEAuVM7o4RjVictZKDxsuRYQKHG4uNA== 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 v2 3/3] qtest: migration: Start migration with 'channels' argument Date: Fri, 23 Feb 2024 15:25:17 +0000 Message-Id: <20240223152517.7834-4-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20240223152517.7834-1-het.gala@nutanix.com> References: <20240223152517.7834-1-het.gala@nutanix.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: PH8PR07CA0002.namprd07.prod.outlook.com (2603:10b6:510:2cd::9) To SJ2PR02MB9955.namprd02.prod.outlook.com (2603:10b6:a03:55f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR02MB9955:EE_|DM6PR02MB6794:EE_ X-MS-Office365-Filtering-Correlation-Id: fe732d63-0eef-4a0d-9e24-08dc3483a97a 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: KBcb/rDcTGniiunxXZCdOKvWHvbGD1bQSGGcPZCAYcQBcei7HT4c893yQEAYWMn71VvwMaD2V6g62UZIoB/CSRAgxvJTYjjMN8/WO7FR+ydbGhTB0vpvOcrIbX0ie1dta7vZxGIpswJ9380jg+1X+OtCEAqwRK3KkbomgEW7IpAOuTpaU0Wsvfh+O0zFirWsRiSiINZDO2pfi9Ee8TL6pwWH8VZD4WKbX12Wqoyc386CxKqSbFSX+x9IlLampIhqQHsJeovqi72OwM+/AWaXQfgCifdcKEp/74w9YxvujTi1NWwBTPqDpdr5lJbXGt2m90gMk5kgi8V8uc6bTaD3BR7U/XQJiL4qhYc8b3WnOGtzMQNkLSlm4rSi/+A84K5M0D1CIMv46bw8I1HUPA99AmucB9r/72J9NL6ua0gfYyjo87ZAySNpWkT71/VsPivlViNLMbrZQPzgy//6wDw0PYsMeleqU0PO5VEnJXB1g2HxnQgbRDqMjQTUUOrR6jUcKsc9lusuXw2EhtNOXlpQXrtYcXZmcOzAK15defEOYK2/fge3HypUau3Nnk55S8cG6KIEC/trwGsiSQ3FqzD341VjRnZoVNe+BiQR0eznJcFUeNxeyiPOO1g2JKe089pB 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)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?pZOuixIQGvoR5oHgmqTzZ/FfbZF/6bX7f+eQNAJ+IJuuoQu68jzsDuv3Qhww?= =?us-ascii?Q?M4wwOk0Fhjnd43z315MZkJ0WkM74KT7+Yf8nXz1Qze5VBdSpGC/42AUcDArA?= =?us-ascii?Q?Hb2OgZbKuzZwYGVh1q1DONOamQvjFwd15RjLNraN/Oj1cXajV4DEM5juRvBW?= =?us-ascii?Q?0M1WnRhCguu6k5KjUbSWQqBg8AL5gv6E2RRgrRHnsfYg4V4eQd2sBK0gqSW3?= =?us-ascii?Q?NUx826WyAc/00QaY/5LE+P9NwWyaouCmTEeRiI3UIMMHEIvGTVxgIBmN+0ym?= =?us-ascii?Q?yU/pZ2mI8PcePA4Q9JC1AKOqBbM8VkDnYyD9hssUN0lpcuK+GpgTUZ+MDuNe?= =?us-ascii?Q?63Hcg5J6SbFQapJcJW9ZEyryq5Bqf3YBrvlwJTYk4Axxkyp5fATNoyHqc2H4?= =?us-ascii?Q?Ly1vI5q2Jl97ZZxN5umGqE6LAtzbkKZjfAKzB5Dal2UL8IYYcAoBfZ66WzW+?= =?us-ascii?Q?aHohBQNUyA3jjkSe/eQLt7VnfEsJlfZlUapD5CJMMZr9Xwd8b0f4eYZchfMQ?= =?us-ascii?Q?e1GFTIIhA1ONzVadDUz3R+QLNBkjsXy1iehgRrx/GnYkqaPVopCqlscxtXpz?= =?us-ascii?Q?U0lX+L3sbkk78PNrvmTGJg3jxo0/xvlO4nWgA6/SfoHMOi0MECAzFIpGNGB7?= =?us-ascii?Q?XqT5oVJRxeNHWELC8fTBY+5PsjtzFq00z7ijlwdmQK+5ddC9Vt3hh+Sa50/o?= =?us-ascii?Q?FFcC7yD/5m+O+SQpCoCv7wLnc3gOVmA1uCagQFzCMCwNp+g2JwWrO/SmbhBY?= =?us-ascii?Q?lBfoWqbz2pwW+mrxbaixqguEIrkL1KCwo6fAnpn4FPgEtpbzB06kJ2hllbFv?= =?us-ascii?Q?pObIoH98IXvrRQpShYObJfoddGejqNp8Qb+TS03wk7XLWpU5/MPTu/JRGDGk?= =?us-ascii?Q?5tre6vDuANrTNCeuGQwkUpR5crmuSANvGBSV03aEfKxALDrUHr7iFhtYW0I7?= =?us-ascii?Q?Ql53b5iONwgAfNDwt9KzGPzSpaztSwxQI0lGy6XpBhxD6cdWCP1lIGsyPtHB?= =?us-ascii?Q?4hfuky6RmI2ImArjYBdSVDKBvPOzDT4KiavAwG/vlpzlNZqPZjEdjf2pYCje?= =?us-ascii?Q?h/YsTtK5+QPJsfoMZjWXDSamzJXATC1LiHOFuKOg/Qpqh669bSxmDbVfikZi?= =?us-ascii?Q?uyqadgXhvQBNqjZV6gNuQXsRApI2ZkmSO9+MjixDVrwsL5YedMMqGMZMQnmq?= =?us-ascii?Q?7Nktsym4FQIug9/lbq1w0ZI/geZ5XTyHSLVlR1fWWy7JIAk3BH7DoT25PpP/?= =?us-ascii?Q?yipV4fwO+3K4hOJ2pRK7QBAPdrMElR+riK0caaCqBNSAmSd3anb1otfKrjI3?= =?us-ascii?Q?x9LjEUtpm205r1X1f6DwEYa0oGDLjzHnhuW3ip5NuURyPnJPlGeUnbDEQvob?= =?us-ascii?Q?ckjkn31rX8ESTCaA7RfirB54DO03fpsbfbrnyj6vijM4BQC3JABl/BV7TQHs?= =?us-ascii?Q?imVTHUxyzJBxPg6kkL0mpBQQHNWahtD9NCeVRVn4TZCpoDjj/ojmraeeh25C?= =?us-ascii?Q?PShc3204JlxhJlcDCwEWxC//JQCOzd6I8jRdZjdTsuOsd4Y1TRO6rID23dvE?= =?us-ascii?Q?iAWy1gvnqZmEMHUFcBU7Kc13az/On9jT/KRCZInXJzmISwJ6JyMtYaVQWOM2?= =?us-ascii?Q?Jw=3D=3D?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe732d63-0eef-4a0d-9e24-08dc3483a97a X-MS-Exchange-CrossTenant-AuthSource: SJ2PR02MB9955.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2024 15:25:26.9594 (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: 76RgKqZmOus3xIQLEHzRY7TGMuwrEej1G+RG9jYMdpgtfdIRruXYDmCXXiYHhyQ+tem6Y2prLQx1xfIXf576yA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB6794 X-Proofpoint-ORIG-GUID: Sy2HVvOPPjEvOdXxNVITNEOh2WFf3UfN X-Proofpoint-GUID: Sy2HVvOPPjEvOdXxNVITNEOh2WFf3UfN 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-02-23_01,2024-02-23_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.066, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @nutanix.com) X-ZM-MESSAGEID: 1708702707428100002 Content-Type: text/plain; charset="utf-8" 'uri' and 'channels' arguments are mutually exhaustive in nature for migration QAPIs. All existing migration qtests solely use 'uri' argument and lack 'channels' as the entrypoint for migration QAPIs. This commit addresses this gap by introducing support for 'channels' as an alternative entrypoint argument. Additionally, validates the functionality of MigrationChannelList in the context of establishing migration connection. Signed-off-by: Het Gala --- tests/qtest/migration-test.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index c1d9ee6466..f044a3018a 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1766,6 +1766,7 @@ static void test_precopy_common(MigrateCommon *args) QTestState *from, *to; void *data_hook =3D NULL; g_autofree char *connect_uri =3D NULL; + g_autofree MigrationChannelList *channels =3D NULL; =20 if (test_migrate_start(&from, &to, args->listen_uri, &args->start)) { return; @@ -1804,12 +1805,21 @@ static void test_precopy_common(MigrateCommon *args) connect_uri =3D g_strdup(args->connect_uri); } =20 + if (args->connect_channels) { + channels =3D uri_to_channels(connect_uri); + } + if (args->result =3D=3D MIG_TEST_QMP_ERROR) { - migrate_qmp_fail(from, connect_uri, NULL, "{}"); + migrate_qmp_fail(from, connect_uri, channels, "{}"); goto finish; } =20 - migrate_qmp(from, connect_uri, NULL, "{}"); + if (args->connect_channels) { + migrate_qmp(from, NULL, channels, "{}"); + } else { + migrate_qmp(from, connect_uri, NULL, "{}"); + } + =20 if (args->result !=3D MIG_TEST_SUCCEED) { bool allow_active =3D args->result =3D=3D MIG_TEST_FAIL; @@ -2725,7 +2735,7 @@ test_migrate_precopy_tcp_multifd_zstd_start(QTestStat= e *from, } #endif /* CONFIG_ZSTD */ =20 -static void test_multifd_tcp_none(void) +static void test_multifd_tcp_none_uri(void) { MigrateCommon args =3D { .listen_uri =3D "defer", @@ -2740,6 +2750,17 @@ static void test_multifd_tcp_none(void) test_precopy_common(&args); } =20 +static void test_multifd_tcp_none_channels(void) +{ + MigrateCommon args =3D { + .listen_uri =3D "defer", + .start_hook =3D test_migrate_precopy_tcp_multifd_start, + .live =3D true, + .connect_channels =3D true, + }; + test_precopy_common(&args); +} + static void test_multifd_tcp_zlib(void) { MigrateCommon args =3D { @@ -3640,8 +3661,11 @@ 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/plain/none/uri", + test_multifd_tcp_none_uri); + migration_test_add("/migration/multifd/tcp/plain/none/channels", + test_multifd_tcp_none_channels); + migration_test_add("/migration/multifd/tcp/plain/cancel", test_multifd_tcp_cancel); migration_test_add("/migration/multifd/tcp/plain/zlib", --=20 2.22.3