From nobody Thu May 15 00:27:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1520359021034650.5369302294333; Tue, 6 Mar 2018 09:57:01 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 9FFA5C057FA7; Tue, 6 Mar 2018 17:56:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 40B705C460; Tue, 6 Mar 2018 17:56:59 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9BD9118033EE; Tue, 6 Mar 2018 17:56:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w26HuukE001377 for ; Tue, 6 Mar 2018 12:56:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id B3F0F2144B21; Tue, 6 Mar 2018 17:56:56 +0000 (UTC) Received: from vhost2.laine.org (ovpn-116-195.phx2.redhat.com [10.3.116.195]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B3612144B20; Tue, 6 Mar 2018 17:56:56 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Tue, 6 Mar 2018 12:56:46 -0500 Message-Id: <20180306175647.520402-2-laine@laine.org> In-Reply-To: <20180306175647.520402-1-laine@laine.org> References: <20180306175647.520402-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [tck PATCH 1/2] cleanup all nwfilters beginning with ^tck X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 06 Mar 2018 17:57:00 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Just as we do with domains, network, etc, do a pre-test check for any existing nwfilters that start with "tck" (the test will be aborted in that case unless "--force" is added to the commandline), and remove same during the cleanup at the end. Signed-off-by: Laine Stump Reviewed-by: Daniel P. Berrang=C3=A9 --- lib/Sys/Virt/TCK.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm index f9d9f30..e7ff71b 100644 --- a/lib/Sys/Virt/TCK.pm +++ b/lib/Sys/Virt/TCK.pm @@ -130,6 +130,11 @@ sub sanity_check { die "there is/are " . int(@nets) . " pre-existing inactive network= (s) in this driver"; } =20 + my @nwfilters =3D grep { $_->get_name =3D~ /^tck/ } $conn->list_nwfilt= ers; + if (@nwfilters) { + die "there is/are " . int(@nwfilters) . " pre-existing nwfilter(s)= in this driver"; + } + my @pools =3D grep { $_->get_name =3D~ /^tck/ } $conn->list_storage_po= ols; if (@pools) { die "there is/are " . int(@pools) . " pre-existing active storage_= pool(s) in this driver"; @@ -188,6 +193,16 @@ sub reset_networks { } } =20 +sub reset_nwfilters { + my $self =3D shift; + my $conn =3D shift; + + my @nwfilters =3D grep { $_->get_name =3D~ /^tck/ } $conn->list_nwfilt= ers; + foreach my $nwfilter (@nwfilters) { + $nwfilter->undefine; + } +} + sub reset_storage_pools { my $self =3D shift; my $conn =3D shift; @@ -217,6 +232,7 @@ sub reset { =20 $self->reset_domains($conn); $self->reset_networks($conn); + $self->reset_nwfilters($conn); $self->reset_storage_pools($conn); } =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list