From nobody Fri May 17 06:43:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1625577710359133.17800330656337; Tue, 6 Jul 2021 06:21:50 -0700 (PDT) Received: from localhost ([::1]:51138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0l1J-0000mS-6u for importer@patchew.org; Tue, 06 Jul 2021 09:21:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0kxi-00026j-Jg for qemu-devel@nongnu.org; Tue, 06 Jul 2021 09:18:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24853) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0kxW-0007ny-Na for qemu-devel@nongnu.org; Tue, 06 Jul 2021 09:18:04 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-49-e9mWifFhO4C-Se1hTML3_g-1; Tue, 06 Jul 2021 09:17:51 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9421719251A0; Tue, 6 Jul 2021 13:17:50 +0000 (UTC) Received: from laptop.redhat.com (ovpn-113-159.ams2.redhat.com [10.36.113.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id B6BB269CB8; Tue, 6 Jul 2021 13:17:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625577473; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L9zucO0YT73veOSaGVS1qVMDfBuyR92BI+w+N+d4NXg=; b=iVM4oUly0KOUN56dueN4MZ2WSStKmtYd1IBp1U66zgCj+E6cLrGiC/IqseBpK8MvsocIbM teDqwkoacAHMNQAdjDQLX88RhOgoLUlxl2nGSsA3tU3GrU5yUUUyOWZCd9NFlhsO/5t/Iv QwXNPubTqSM0RNG1wqiGplbDWtbxzxs= X-MC-Unique: e9mWifFhO4C-Se1hTML3_g-1 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, philmd@redhat.com, crosa@redhat.com, wainersm@redhat.com Subject: [PATCH v5 1/4] avocado_qemu: Fix KNOWN_DISTROS map into the LinuxDistro class Date: Tue, 6 Jul 2021 15:17:26 +0200 Message-Id: <20210706131729.30749-2-eric.auger@redhat.com> In-Reply-To: <20210706131729.30749-1-eric.auger@redhat.com> References: <20210706131729.30749-1-eric.auger@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eric.auger@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=216.205.24.124; envelope-from=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.442, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: wrampazz@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1625577713897100001 Content-Type: text/plain; charset="utf-8" From: Willian Rampazzo As the KNOWN_DISTROS grows, more loosely methods will be created in the avocado_qemu/__init__.py file. Let's refactor the code so that KNOWN_DISTROS and related methods are packaged in a class Signed-off-by: Wainer dos Santos Moschetta Signed-off-by: Eric Auger Acked-by: Wainer dos Santos Moschetta --- tests/acceptance/avocado_qemu/__init__.py | 74 +++++++++++++---------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index 81ac90bebb..af93cd63ea 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -299,29 +299,43 @@ def ssh_command(self, command): f'Guest command failed: {command}') return stdout_lines, stderr_lines =20 +class LinuxDistro: + """Represents a Linux distribution =20 -#: A collection of known distros and their respective image checksum -KNOWN_DISTROS =3D { - 'fedora': { - '31': { - 'x86_64': - {'checksum': 'e3c1b309d9203604922d6e255c2c5d098a309c2d46215d8f= c026954f3c5c27a0'}, - 'aarch64': - {'checksum': '1e18d9c0cf734940c4b5d5ec592facaed2af0ad0329383d5= 639c997fdf16fe49'}, - 'ppc64': - {'checksum': '7c3528b85a3df4b2306e892199a9e1e43f991c506f2cc390= dc4efa2026ad2f58'}, - 's390x': - {'checksum': '4caaab5a434fd4d1079149a072fdc7891e354f834d355069= ca982fdcaf5a122d'}, + Holds information of known distros. + """ + #: A collection of known distros and their respective image checksum + KNOWN_DISTROS =3D { + 'fedora': { + '31': { + 'x86_64': + {'checksum': 'e3c1b309d9203604922d6e255c2c5d098a309c2d4621= 5d8fc026954f3c5c27a0'}, + 'ppc64': + {'checksum': '7c3528b85a3df4b2306e892199a9e1e43f991c506f2c= c390dc4efa2026ad2f58'}, + 's390x': + {'checksum': '4caaab5a434fd4d1079149a072fdc7891e354f834d35= 5069ca982fdcaf5a122d'}, } } } =20 + def __init__(self, name, version, arch): + self.name =3D name + self.version =3D version + self.arch =3D arch + try: + self._info =3D self.KNOWN_DISTROS.get(name).get(version).get(a= rch) + except AttributeError: + # Unknown distro + self._info =3D {} =20 -def get_known_distro_checksum(distro, distro_version, arch): - try: - return KNOWN_DISTROS.get(distro).get(distro_version).get(arch).get= ('checksum') - except AttributeError: - return None + @property + def checksum(self): + """Gets the cloud-image file checksum""" + return self._info.get('checksum', None) + + @checksum.setter + def checksum(self, value): + self._info['checksum'] =3D value =20 =20 class LinuxTest(Test, LinuxSSHMixIn): @@ -332,24 +346,24 @@ class LinuxTest(Test, LinuxSSHMixIn): """ =20 timeout =3D 900 - distro_checksum =3D None + distro =3D None username =3D 'root' password =3D 'password' =20 def _set_distro(self): - distro =3D self.params.get( + distro_name =3D self.params.get( 'distro', default=3Dself._get_unique_tag_val('distro')) - if not distro: - distro =3D 'fedora' - self.distro =3D distro + if not distro_name: + distro_name =3D 'fedora' =20 distro_version =3D self.params.get( 'distro_version', default=3Dself._get_unique_tag_val('distro_version')) if not distro_version: distro_version =3D '31' - self.distro_version =3D distro_version + + self.distro =3D LinuxDistro(distro_name, distro_version, self.arch) =20 # The distro checksum behaves differently than distro name and # version. First, it does not respect a tag with the same @@ -358,13 +372,9 @@ def _set_distro(self): # order of precedence is: parameter, attribute and then value # from KNOWN_DISTROS. distro_checksum =3D self.params.get('distro_checksum', - default=3Dself.distro_checksum) - if not distro_checksum: - distro_checksum =3D get_known_distro_checksum(self.distro, - self.distro_versio= n, - self.arch) + default=3DNone) if distro_checksum: - self.distro_checksum =3D distro_checksum + self.distro.checksum =3D distro_checksum =20 def setUp(self, ssh_pubkey=3DNone, network_device_type=3D'virtio-net'): super(LinuxTest, self).setUp() @@ -406,14 +416,14 @@ def download_boot(self): self.log.info('Downloading/preparing boot image') # Fedora 31 only provides ppc64le images image_arch =3D self.arch - if self.distro =3D=3D 'fedora': + if self.distro.name =3D=3D 'fedora': if image_arch =3D=3D 'ppc64': image_arch =3D 'ppc64le' =20 try: boot =3D vmimage.get( - self.distro, arch=3Dimage_arch, version=3Dself.distro_vers= ion, - checksum=3Dself.distro_checksum, + self.distro.name, arch=3Dimage_arch, version=3Dself.distro= .version, + checksum=3Dself.distro.checksum, algorithm=3D'sha256', cache_dir=3Dself.cache_dirs[0], snapshot_dir=3Dself.workdir) --=20 2.26.3 From nobody Fri May 17 06:43:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1625577571437227.11617445804234; Tue, 6 Jul 2021 06:19:31 -0700 (PDT) Received: from localhost ([::1]:44044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0kz2-0004Gv-7U for importer@patchew.org; Tue, 06 Jul 2021 09:19:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0kxe-00024s-Ov for qemu-devel@nongnu.org; Tue, 06 Jul 2021 09:18:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47827) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0kxY-0007oV-3N for qemu-devel@nongnu.org; Tue, 06 Jul 2021 09:18:00 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-412-3XO-hEnrM5ioqqb2JYKxXQ-1; Tue, 06 Jul 2021 09:17:53 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C4D3F800D62; Tue, 6 Jul 2021 13:17:52 +0000 (UTC) Received: from laptop.redhat.com (ovpn-113-159.ams2.redhat.com [10.36.113.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id E971169CB8; Tue, 6 Jul 2021 13:17:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625577475; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=njBhfYwuH1NBHBs9DZXYkWA0dgadP10WVKW92Z50E1Q=; b=JfIUEDCPfOsGO1b0Wht7z9L0HWn5qz1JQNbXZ6X/uBfoF1cnFsPSTRZcsV1rOpkSm5DRJO L0HlUgz0iTWK/tdsuGfbqV1sUMoRJyRN56PyY9gOjmNgY2zGfJBkauwvN8UQTWsVg6mH58 6muR4ZEaO6uICZXoNfe8EaexZZo49ts= X-MC-Unique: 3XO-hEnrM5ioqqb2JYKxXQ-1 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, philmd@redhat.com, crosa@redhat.com, wainersm@redhat.com Subject: [PATCH v5 2/4] Acceptance Tests: Add default kernel params and pxeboot url to the KNOWN_DISTROS collection Date: Tue, 6 Jul 2021 15:17:27 +0200 Message-Id: <20210706131729.30749-3-eric.auger@redhat.com> In-Reply-To: <20210706131729.30749-1-eric.auger@redhat.com> References: <20210706131729.30749-1-eric.auger@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eric.auger@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=170.10.133.124; envelope-from=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.442, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: wrampazz@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1625577573811100001 Content-Type: text/plain; charset="utf-8" From: Willian Rampazzo When running LinuxTests we may need to run the guest with custom params. It is practical to store the pxeboot URL and the default kernel params so that the tests just need to fetch those and augment the kernel params. Signed-off-by: Eric Auger Reviewed-by: Willian Rampazzo --- v4 -> v5: - fixed some indentation issues (William) - added William's R-b --- tests/acceptance/avocado_qemu/__init__.py | 53 ++++++++++++++++++++++- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index af93cd63ea..ee354eb458 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -309,12 +309,51 @@ class LinuxDistro: 'fedora': { '31': { 'x86_64': - {'checksum': 'e3c1b309d9203604922d6e255c2c5d098a309c2d4621= 5d8fc026954f3c5c27a0'}, + {'checksum': 'e3c1b309d9203604922d6e255c2c5d098a309c2d4621= 5d8fc026954f3c5c27a0', + 'pxeboot_url': 'https://archives.fedoraproject.org/' + 'pub/archive/fedora/linux/releases/31/' + 'Everything/x86_64/os/images/pxeboot/', + 'kernel_params': 'root=3DUUID=3Db1438b9b-2cab-4065-a99a-08= a96687f73c' + ' ro no_timer_check net.ifnames=3D0' + ' console=3Dtty1 console=3DttyS0,115200n8' + }, + 'aarch64': + {'checksum': '1e18d9c0cf734940c4b5d5ec592facaed2af0ad03293= 83d5639c997fdf16fe49', + 'pxeboot_url': 'https://archives.fedoraproject.org/' + 'pub/archive/fedora/linux/releases/31/' + 'Everything/aarch64/os/images/pxeboot/', + 'kernel_params': 'root=3DUUID=3Db6950a44-9f3c-4076-a9c2-35= 5e8475b0a7' + ' ro earlyprintk=3Dpl011,0x9000000' + ' ignore_loglevel no_timer_check' + ' printk.time=3D1 rd_NO_PLYMOUTH' + ' console=3DttyAMA0' + }, 'ppc64': {'checksum': '7c3528b85a3df4b2306e892199a9e1e43f991c506f2c= c390dc4efa2026ad2f58'}, 's390x': {'checksum': '4caaab5a434fd4d1079149a072fdc7891e354f834d35= 5069ca982fdcaf5a122d'}, - } + }, + '32': { + 'aarch64': + {'checksum': 'b367755c664a2d7a26955bbfff985855adfa2ca15e90= 8baf15b4b176d68d3967', + 'pxeboot_url': 'http://dl.fedoraproject.org/pub/fedora/lin= ux/' + 'releases/32/Server/aarch64/os/images/pxebo= ot/', + 'kernel_params': 'root=3DUUID=3D3df75b65-be8d-4db4-8655-14= d95c0e90c5' + ' ro no_timer_check net.ifnames=3D0' + ' console=3Dtty1 console=3DttyS0,115200n8= ', + }, + }, + '33': { + 'aarch64': + {'checksum': 'e7f75cdfd523fe5ac2ca9eeece68edc1a81f386a17f9= 69c1d1c7c87031008a6b', + 'pxeboot_url': 'http://dl.fedoraproject.org/pub/fedora/lin= ux/' + 'releases/33/Server/aarch64/os/images/pxebo= ot/', + 'kernel_params': 'root=3DUUID=3Dd20b3ffa-6397-4a63-a734-11= 26a0208f8a' + ' ro no_timer_check net.ifnames=3D0' + ' console=3Dtty1 console=3DttyS0,115200n8' + ' console=3Dtty0', + }, + }, } } =20 @@ -337,6 +376,16 @@ def checksum(self): def checksum(self, value): self._info['checksum'] =3D value =20 + @property + def pxeboot_url(self): + """Gets the repository url where pxeboot files can be found""" + return self._info.get('pxeboot_url', None) + + @property + def default_kernel_params(self): + """Gets the default kernel parameters""" + return self._info.get('kernel_params', None) + =20 class LinuxTest(Test, LinuxSSHMixIn): """Facilitates having a cloud-image Linux based available. --=20 2.26.3 From nobody Fri May 17 06:43:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1625577712345868.0795592034907; Tue, 6 Jul 2021 06:21:52 -0700 (PDT) Received: from localhost ([::1]:51222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0l1K-0000q7-Va for importer@patchew.org; Tue, 06 Jul 2021 09:21:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0kxf-000250-PL for qemu-devel@nongnu.org; Tue, 06 Jul 2021 09:18:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:27158) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0kxa-0007pa-MX for qemu-devel@nongnu.org; Tue, 06 Jul 2021 09:18:02 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-175-24hHYGEMNq-YomHkbq_fVA-1; Tue, 06 Jul 2021 09:17:56 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 04E39801B1C; Tue, 6 Jul 2021 13:17:55 +0000 (UTC) Received: from laptop.redhat.com (ovpn-113-159.ams2.redhat.com [10.36.113.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2611C69CB8; Tue, 6 Jul 2021 13:17:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625577477; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+8cDTqGlRIM3TzE0xdQ8Mm6+bZacDPPSdwR5W8Tyj6k=; b=FHtTSM2sckxDNMwQ+SQJqa2P11VuReXZqh6RGob7ix9BjiLVVE+DmyC5sX9j12+SGDr28X SSHKG8Myv7bOvfETmALM2qrbD0l+31o64nn2PCMkpbXKPOEBCvbaRi0smcNHk5QElYgtRx GweqNyKb8d3wDVRgQmw3cCD/rqRlWaI= X-MC-Unique: 24hHYGEMNq-YomHkbq_fVA-1 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, philmd@redhat.com, crosa@redhat.com, wainersm@redhat.com Subject: [PATCH v5 3/4] avocado_qemu: Add SMMUv3 tests Date: Tue, 6 Jul 2021 15:17:28 +0200 Message-Id: <20210706131729.30749-4-eric.auger@redhat.com> In-Reply-To: <20210706131729.30749-1-eric.auger@redhat.com> References: <20210706131729.30749-1-eric.auger@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eric.auger@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=216.205.24.124; envelope-from=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.442, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: wrampazz@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1625577715732100003 Content-Type: text/plain; charset="utf-8" Add new tests checking the good behavior of the SMMUv3 protecting 2 virtio pci devices (block and net). We check the guest boots and we are able to install a package. Different guest configs are tested: standard, passthrough an strict=3D0. This is tested with both fedora 31 and 33. The former uses a 5.3 kernel without range invalidation whereas the latter uses a 5.8 kernel that features range invalidation. Signed-off-by: Eric Auger Reviewed-by: Willian Rampazzo Reviewed-by: Wainer dos Santos Moschetta Tested-by: Wainer dos Santos Moschetta --- v4 -> v5: - Added the skipIf statement (William) and William's R-b - added Wainer's R-b and T-b --- tests/acceptance/smmu.py | 133 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 tests/acceptance/smmu.py diff --git a/tests/acceptance/smmu.py b/tests/acceptance/smmu.py new file mode 100644 index 0000000000..b7ed980067 --- /dev/null +++ b/tests/acceptance/smmu.py @@ -0,0 +1,133 @@ +# SMMUv3 Functional tests +# +# Copyright (c) 2021 Red Hat, Inc. +# +# Author: +# Eric Auger +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. +import os + +from avocado import skipIf +from avocado_qemu import LinuxTest, BUILD_DIR + +@skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab') +class SMMU(LinuxTest): + """ + :avocado: tags=3Daccel:kvm + :avocado: tags=3Dcpu:host + :avocado: tags=3Darch:aarch64 + :avocado: tags=3Dmachine:virt + :avocado: tags=3Ddistro:fedora + :avocado: tags=3Dsmmu + """ + + IOMMU_ADDON =3D ',iommu_platform=3Don,disable-modern=3Doff,disable-leg= acy=3Don' + kernel_path =3D None + initrd_path =3D None + kernel_params =3D None + + def set_up_boot(self): + path =3D self.download_boot() + self.vm.add_args('-device', 'virtio-blk-pci,bus=3Dpcie.0,scsi=3Dof= f,' + + 'drive=3Ddrv0,id=3Dvirtio-disk0,bootindex=3D1,' + 'werror=3Dstop,rerror=3Dstop' + self.IOMMU_ADDON) + self.vm.add_args('-drive', + 'file=3D%s,if=3Dnone,cache=3Dwritethrough,id=3Ddr= v0' % path) + + def setUp(self): + super(SMMU, self).setUp(None, 'virtio-net-pci' + self.IOMMU_ADDON) + + def common_vm_setup(self, custom_kernel=3DFalse): + self.require_accelerator("kvm") + self.vm.add_args("-accel", "kvm") + self.vm.add_args("-cpu", "host") + self.vm.add_args("-machine", "iommu=3Dsmmuv3") + self.vm.add_args("-d", "guest_errors") + self.vm.add_args('-bios', os.path.join(BUILD_DIR, 'pc-bios', + 'edk2-aarch64-code.fd')) + self.vm.add_args('-device', 'virtio-rng-pci,rng=3Drng0') + self.vm.add_args('-object', + 'rng-random,id=3Drng0,filename=3D/dev/urandom') + + if custom_kernel is False: + return + + kernel_url =3D self.distro.pxeboot_url + 'vmlinuz' + initrd_url =3D self.distro.pxeboot_url + 'initrd.img' + self.kernel_path =3D self.fetch_asset(kernel_url) + self.initrd_path =3D self.fetch_asset(initrd_url) + + def run_and_check(self): + if self.kernel_path: + self.vm.add_args('-kernel', self.kernel_path, + '-append', self.kernel_params, + '-initrd', self.initrd_path) + self.launch_and_wait() + self.ssh_command('cat /proc/cmdline') + self.ssh_command('dnf -y install numactl-devel') + + + # 5.3 kernel without RIL # + + def test_smmu_noril(self): + """ + :avocado: tags=3Dsmmu_noril + :avocado: tags=3Dsmmu_noril_tests + :avocado: tags=3Ddistro_version:31 + """ + self.common_vm_setup() + self.run_and_check() + + def test_smmu_noril_passthrough(self): + """ + :avocado: tags=3Dsmmu_noril_passthrough + :avocado: tags=3Dsmmu_noril_tests + :avocado: tags=3Ddistro_version:31 + """ + self.common_vm_setup(True) + self.kernel_params =3D self.distro.default_kernel_params + ' iommu= .passthrough=3Don' + self.run_and_check() + + def test_smmu_noril_nostrict(self): + """ + :avocado: tags=3Dsmmu_noril_nostrict + :avocado: tags=3Dsmmu_noril_tests + :avocado: tags=3Ddistro_version:31 + """ + self.common_vm_setup(True) + self.kernel_params =3D self.distro.default_kernel_params + ' iommu= .strict=3D0' + self.run_and_check() + + # 5.8 kernel featuring range invalidation + # >=3D v5.7 kernel + + def test_smmu_ril(self): + """ + :avocado: tags=3Dsmmu_ril + :avocado: tags=3Dsmmu_ril_tests + :avocado: tags=3Ddistro_version:33 + """ + self.common_vm_setup() + self.run_and_check() + + def test_smmu_ril_passthrough(self): + """ + :avocado: tags=3Dsmmu_ril_passthrough + :avocado: tags=3Dsmmu_ril_tests + :avocado: tags=3Ddistro_version:33 + """ + self.common_vm_setup(True) + self.kernel_params =3D self.distro.default_kernel_params + ' iommu= .passthrough=3Don' + self.run_and_check() + + def test_smmu_ril_nostrict(self): + """ + :avocado: tags=3Dsmmu_ril_nostrict + :avocado: tags=3Dsmmu_ril_tests + :avocado: tags=3Ddistro_version:33 + """ + self.common_vm_setup(True) + self.kernel_params =3D self.distro.default_kernel_params + ' iommu= .strict=3D0' + self.run_and_check() --=20 2.26.3 From nobody Fri May 17 06:43:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1625577860789468.52484913718047; Tue, 6 Jul 2021 06:24:20 -0700 (PDT) Received: from localhost ([::1]:55636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0l3j-0004AX-JL for importer@patchew.org; Tue, 06 Jul 2021 09:24:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0kxj-0002AT-LW for qemu-devel@nongnu.org; Tue, 06 Jul 2021 09:18:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60096) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0kxg-0007rU-Fg for qemu-devel@nongnu.org; Tue, 06 Jul 2021 09:18:07 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-415-sbCeCpcpNoKchwb6EsIM-Q-1; Tue, 06 Jul 2021 09:18:01 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BD2B01018723; Tue, 6 Jul 2021 13:18:00 +0000 (UTC) Received: from laptop.redhat.com (ovpn-113-159.ams2.redhat.com [10.36.113.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 596E769CB8; Tue, 6 Jul 2021 13:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625577483; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=52OlAWPyUSED172AQIxU9FUULofFk+qa0gHUmdfuPWI=; b=PZRMuC0tPWodZyzRSTwWGnYLg4V409tr7buZUiZ3+cmDrsN1+fugLLYtswVbLF85ev1Sa3 5KKtP2cmnMIGYjrlIVyWipAz+VWN1pdXnps34p1RqLhOd32vYcpGiFWniQp/eWAezztqxH uR6aDWaNJKrWtzra+OAzqggnZz9hdCo= X-MC-Unique: sbCeCpcpNoKchwb6EsIM-Q-1 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, philmd@redhat.com, crosa@redhat.com, wainersm@redhat.com Subject: [PATCH v5 4/4] avocado_qemu: Add Intel iommu tests Date: Tue, 6 Jul 2021 15:17:29 +0200 Message-Id: <20210706131729.30749-5-eric.auger@redhat.com> In-Reply-To: <20210706131729.30749-1-eric.auger@redhat.com> References: <20210706131729.30749-1-eric.auger@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eric.auger@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=216.205.24.124; envelope-from=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.442, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: wrampazz@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1625577863286100001 Content-Type: text/plain; charset="utf-8" Add Intel IOMMU functional tests based on fedora 31. Different configs are checked: - strict - caching mode, strict - passthrough. Signed-off-by: Eric Auger Signed-off-by: Willian Rampazzo Acked-by: Peter Xu Tested-by: Wainer dos Santos Moschetta --- v4 -> v5: - import cleanup (William) - IntelIOMMU becomes the class name (William) - Added William's Sob --- tests/acceptance/intel_iommu.py | 115 ++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 tests/acceptance/intel_iommu.py diff --git a/tests/acceptance/intel_iommu.py b/tests/acceptance/intel_iommu= .py new file mode 100644 index 0000000000..ad10491d89 --- /dev/null +++ b/tests/acceptance/intel_iommu.py @@ -0,0 +1,115 @@ +# INTEL_IOMMU Functional tests +# +# Copyright (c) 2021 Red Hat, Inc. +# +# Author: +# Eric Auger +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. +import os + +from avocado import skipIf +from avocado_qemu import LinuxTest + +@skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab') +class IntelIOMMU(LinuxTest): + """ + :avocado: tags=3Darch:x86_64 + :avocado: tags=3Ddistro:fedora + :avocado: tags=3Ddistro_version:31 + :avocado: tags=3Dmachine:q35 + :avocado: tags=3Daccel:kvm + :avocado: tags=3Dintel_iommu + """ + + IOMMU_ADDON =3D ',iommu_platform=3Don,disable-modern=3Doff,disable-leg= acy=3Don' + kernel_path =3D None + initrd_path =3D None + kernel_params =3D None + + def set_up_boot(self): + path =3D self.download_boot() + self.vm.add_args('-device', 'virtio-blk-pci,bus=3Dpcie.0,scsi=3Dof= f,' + + 'drive=3Ddrv0,id=3Dvirtio-disk0,bootindex=3D1,' + 'werror=3Dstop,rerror=3Dstop' + self.IOMMU_ADDON) + self.vm.add_args('-device', 'virtio-gpu-pci' + self.IOMMU_ADDON) + self.vm.add_args('-drive', + 'file=3D%s,if=3Dnone,cache=3Dwritethrough,id=3Ddr= v0' % path) + + def setUp(self): + super(IntelIOMMU, self).setUp(None, 'virtio-net-pci' + self.IOMMU_= ADDON) + + def add_common_args(self): + self.vm.add_args('-device', 'virtio-rng-pci,rng=3Drng0') + self.vm.add_args('-object', + 'rng-random,id=3Drng0,filename=3D/dev/urandom') + + def common_vm_setup(self, custom_kernel=3DNone): + self.require_accelerator("kvm") + self.add_common_args() + self.vm.add_args("-accel", "kvm") + + if custom_kernel is None: + return + + kernel_url =3D self.distro.pxeboot_url + 'vmlinuz' + initrd_url =3D self.distro.pxeboot_url + 'initrd.img' + self.kernel_path =3D self.fetch_asset(kernel_url) + self.initrd_path =3D self.fetch_asset(initrd_url) + + def run_and_check(self): + if self.kernel_path: + self.vm.add_args('-kernel', self.kernel_path, + '-append', self.kernel_params, + '-initrd', self.initrd_path) + self.launch_and_wait() + self.ssh_command('cat /proc/cmdline') + self.ssh_command('dmesg | grep -e DMAR -e IOMMU') + self.ssh_command('find /sys/kernel/iommu_groups/ -type l') + self.ssh_command('dnf -y install numactl-devel') + + def test_intel_iommu(self): + """ + :avocado: tags=3Dintel_iommu_intremap + """ + + self.common_vm_setup(True) + self.vm.add_args('-device', 'intel-iommu,intremap=3Don') + self.vm.add_args('-machine', 'kernel_irqchip=3Dsplit') + + self.kernel_params =3D self.distro.default_kernel_params + ' quiet= intel_iommu=3Don' + self.run_and_check() + + def test_intel_iommu_strict(self): + """ + :avocado: tags=3Dintel_iommu_strict + """ + + self.common_vm_setup(True) + self.vm.add_args('-device', 'intel-iommu,intremap=3Don') + self.vm.add_args('-machine', 'kernel_irqchip=3Dsplit') + self.kernel_params =3D self.distro.default_kernel_params + ' quiet= intel_iommu=3Don,strict' + self.run_and_check() + + def test_intel_iommu_strict_cm(self): + """ + :avocado: tags=3Dintel_iommu_strict_cm + """ + + self.common_vm_setup(True) + self.vm.add_args('-device', 'intel-iommu,intremap=3Don,caching-mod= e=3Don') + self.vm.add_args('-machine', 'kernel_irqchip=3Dsplit') + self.kernel_params =3D self.distro.default_kernel_params + ' quiet= intel_iommu=3Don,strict' + self.run_and_check() + + def test_intel_iommu_pt(self): + """ + :avocado: tags=3Dintel_iommu_pt + """ + + self.common_vm_setup(True) + self.vm.add_args('-device', 'intel-iommu,intremap=3Don') + self.vm.add_args('-machine', 'kernel_irqchip=3Dsplit') + self.kernel_params =3D self.distro.default_kernel_params + ' quiet= intel_iommu=3Don iommu=3Dpt' + self.run_and_check() --=20 2.26.3