[libvirt] [PATCH v2] libvirt-tck: prefer kvm domains if multiple domain types exist

Daniel P. Berrange berrange at redhat.com
Thu Mar 27 11:38:52 UTC 2014


On Fri, Mar 07, 2014 at 11:06:35AM -0700, Mike Latimer wrote:
> When matching capabilities of a guest, if multiple domain types exist (for
> example, 'qemu' and 'kvm') the order in which they are returned can change.
> 
> To avoid unpredictable test results, this patch prefers kvm if that domain
> type exists. If not, the behavior matches what existed before, and the first
> domain type is returned.
> 
> 
> ---
>  lib/Sys/Virt/TCK.pm | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm
> index b2c16e7..a3a2732 100644
> --- a/lib/Sys/Virt/TCK.pm
> +++ b/lib/Sys/Virt/TCK.pm
> @@ -502,9 +502,12 @@ sub match_kernel {
>  	    my @domains = $caps->guest_domain_types($i);
>  	    next unless int(@domains);
>  
> -	    return ($domains[0],
> -		    $caps->guest_domain_emulator($i, $domains[0]),
> -		    $caps->guest_domain_loader($i, $domains[0]));
> +	    # Prefer kvm if multiple domain types are returned
> +	    my $domain = (grep /^kvm$/, @domains) ? "kvm" : $domains[0];
> +
> +	    return ($domain,
> +		    $caps->guest_domain_emulator($i, $domain),
> +		    $caps->guest_domain_loader($i, $domain));
>  	}
>      }

ACK

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




More information about the libvir-list mailing list