[tck PATCH 1/2] cleanup all nwfilters beginning with ^tck

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <laine@xxxxxxxxx>
---
 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";
     }
 
+    my @nwfilters = grep { $_->get_name =~ /^tck/ } $conn->list_nwfilters;
+    if (@nwfilters) {
+        die "there is/are " . int(@nwfilters) . " pre-existing nwfilter(s) in this driver";
+    }
+
     my @pools = grep { $_->get_name =~ /^tck/ } $conn->list_storage_pools;
     if (@pools) {
         die "there is/are " . int(@pools) . " pre-existing active storage_pool(s) in this driver";
@@ -188,6 +193,16 @@ sub reset_networks {
     }
 }
 
+sub reset_nwfilters {
+    my $self = shift;
+    my $conn = shift;
+
+    my @nwfilters = grep { $_->get_name =~ /^tck/ } $conn->list_nwfilters;
+    foreach my $nwfilter (@nwfilters) {
+        $nwfilter->undefine;
+    }
+}
+
 sub reset_storage_pools {
     my $self = shift;
     my $conn = shift;
@@ -217,6 +232,7 @@ sub reset {
 
     $self->reset_domains($conn);
     $self->reset_networks($conn);
+    $self->reset_nwfilters($conn);
     $self->reset_storage_pools($conn);
 }
 
-- 
2.14.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux