When TCK cleans up a test domain, existing snapshots are deleted. However,
not all drivers (e.g. libxl) support snapshots. When such a driver is
involved, the following error is reported and the testkit fails to cleanup
the domain:
libvirt error code: 3, message: this function is not supported by the
connection driver: virDomainSnapshotNum
Rather than erroring out, list_snapshots should be protected using eval. In
the event the underlying driver does not support snapshots, an empty list is
returned, and no snapshot deletion is attempted. (Note - It is the listing
of snapshots that is causing the error, not the attempt to delete them.)
---
lib/Sys/Virt/TCK.pm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm
index f8fa75d..a3d06a2 100644
--- a/lib/Sys/Virt/TCK.pm
+++ b/lib/Sys/Virt/TCK.pm
@@ -145,7 +145,8 @@ sub reset_snapshots {
my $self = shift;
my $dom = shift;
- my @domss = $dom->list_snapshots;
+ # Use eval as not all drivers support snapshots
+ my @domss = eval { $dom->list_snapshots };
foreach my $domss (@domss) {
$domss->delete;
}
--
1.8.4.5