Re: [PATCH perl-Sys-Virt] Don't die if snapshots are unsupported

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

 



On Mon, Apr 21, 2014 at 02:19:12PM -0600, Mike Latimer wrote:
> 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);

Unfortunately this is a change in API behaviour that affects more
than just the TCK. You need todo the equivalent change to the TCK
code instead really.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
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]