Many libvirt-tck tests do not explicitly cleanup test domains before exiting.
In this case Sys::Virt::TCK->cleanup is triggered, and the environment is
reset automatically. During this reset, any existing snapshots are found for
deletion through Sys::Virt::Domain->list_snapshots. If the underlying
connection driver does not support snapshot functions (such as lxc or libxl),
the process dies with the following error:
libvirt error code: 3, message: this function is not supported by the
connection driver: virDomainSnapshotListNames
The best resolution would be to add snapshot support to the driver(s), but as
this requires a long term effort, it is better to catch the error and return
an empty list of snapshots to the calling function. In the case of
libvirt-tck, this allows the cleanup to succeed and subsequent testing to
continue normally.
---
Domain.pm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/lib/Sys/Virt/Domain.pm 2014-04-07 04:35:31.000000000 -0600
+++ b/lib/Sys/Virt/Domain.pm 2014-04-21 13:48:22.868956838 -0600
@@ -1416,7 +1416,10 @@ recommended as a more efficient alternat
sub list_snapshots {
my $self = shift;
- my $nnames = $self->num_of_snapshots();
+ # If snapshots are not supported by the driver (lxc, libxl...), catch the
+ # function not supported error and simply return as there are no snapshots
+ my $nnames = eval { $self->num_of_snapshots() };
+ return if($@ =~ /function is not supported/);
my @names = $self->list_snapshot_names($nnames);
my @snapshots;