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@laine.org>
---
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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Tue, Mar 06, 2018 at 12:56:46PM -0500, Laine Stump wrote: > 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@laine.org> > --- > lib/Sys/Virt/TCK.pm | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2025 Red Hat, Inc.