[libvirt] [tck PATCH v2 13/13] lib: allow marking the scratch disk as shareable

Laine Stump laine at laine.org
Sat Jun 2 01:58:44 UTC 2018


On 05/21/2018 12:46 PM, Daniel P. Berrangé wrote:
> One of the tests checks the ability to boot multiple guests at once, and
> it is using the same (empty) disk image for all. Modern QEMU rejects
> this sharing, but it is harmless in context of this test case, so we
> mark the disk as shareable to allow it.
>
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>

Reviewed-by: Laine Stump <laine at laine.org>

> ---
>  lib/Sys/Virt/TCK.pm                   | 6 +++++-
>  lib/Sys/Virt/TCK/DomainBuilder.pm     | 3 +++
>  scripts/domain/081-unique-id-create.t | 4 ++--
>  3 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm
> index e7ff71b..ac9c125 100644
> --- a/lib/Sys/Virt/TCK.pm
> +++ b/lib/Sys/Virt/TCK.pm
> @@ -782,6 +782,7 @@ sub generic_machine_domain {
>      my $caps = exists $params{caps} ? $params{caps} : die "caps parameter is required";
>      my $ostype = exists $params{ostype} ? $params{ostype} : "hvm";
>      my $fullos = exists $params{fullos} ? $params{fullos} : 0;
> +    my $shareddisk = exists $params{shareddisk} ? $params{shareddisk} : 0;
>      my $filterref = exists $params{filterref} ? $params{filterref} : undef;
>      my %filterparams = exists $params{filterparams} ? %{$params{filterparams}} : ();
>  
> @@ -857,7 +858,8 @@ sub generic_machine_domain {
>  
>          $b->disk(src => $config{root},
>                   dst => $config{dev},
> -                 type => "file");
> +                 type => "file",
> +                 shareable => $shareddisk);
>          return $b;
>      }
>  }
> @@ -915,6 +917,7 @@ sub generic_domain {
>      my $ostype = exists $params{ostype} ? $params{ostype} : "hvm";
>      my $fullos = exists $params{fullos} ? $params{fullos} : 0;
>      my $netmode = exists $params{netmode} ? $params{netmode} : undef;
> +    my $shareddisk = exists $params{shareddisk} ? $params{shareddisk} : 0;
>      my $filterref = exists $params{filterref} ? $params{filterref} : undef;
>      my %filterparams = exists $params{filterparams} ? %{$params{filterparams}} : ();
>  
> @@ -936,6 +939,7 @@ sub generic_domain {
>          $b = $self->generic_machine_domain(name => $name,
>                                             caps => $caps,
>                                             ostype => $ostype,
> +					   shareddisk => $shareddisk,
>                                             fullos => $fullos,
>                                             filterref => $filterref,
>                                             filterparams => \%filterparams);
> diff --git a/lib/Sys/Virt/TCK/DomainBuilder.pm b/lib/Sys/Virt/TCK/DomainBuilder.pm
> index b6adbd3..5ca2a07 100644
> --- a/lib/Sys/Virt/TCK/DomainBuilder.pm
> +++ b/lib/Sys/Virt/TCK/DomainBuilder.pm
> @@ -409,6 +409,9 @@ sub as_xml {
>              $w->emptyTag("source",
>                           file => $disk->{src});
>          }
> +        if ($disk->{shareable}) {
> +            $w->emptyTag("shareable");
> +        }
>          $w->emptyTag("target",
>                       dev => $disk->{dst},
>                       $disk->{bus} ? (bus => $disk->{bus}) : ());
> diff --git a/scripts/domain/081-unique-id-create.t b/scripts/domain/081-unique-id-create.t
> index 07143a5..0d53599 100644
> --- a/scripts/domain/081-unique-id-create.t
> +++ b/scripts/domain/081-unique-id-create.t
> @@ -54,13 +54,13 @@ my $uuid1 = "11111111-1111-1111-1111-111111111111";
>  my $uuid2 = "22222222-1111-1111-1111-111111111111";
>  
>  # The initial config
> -my $xml = $tck->generic_domain(name => $name1)->uuid($uuid1)->as_xml;
> +my $xml = $tck->generic_domain(name => $name1, shareddisk => 1)->uuid($uuid1)->as_xml;
>  # One with a different UUID, matching name
>  my $xml_diffuuid = $tck->generic_domain(name => $name1)->uuid($uuid2)->as_xml;
>  # One with a matching UUID, different name
>  my $xml_diffname = $tck->generic_domain(name => $name2)->uuid($uuid1)->as_xml;
>  # One with a different UUID, different name
> -my $xml_diffboth = $tck->generic_domain(name => $name2)->uuid($uuid2)->as_xml;
> +my $xml_diffboth = $tck->generic_domain(name => $name2, shareddisk => 1)->uuid($uuid2)->as_xml;
>  
>  diag "Defining persistent domain config";
>  my ($dom, $dom1);





More information about the libvir-list mailing list