Commit 72dbbd39 authored by Daniel P. Berrangé's avatar Daniel P. Berrangé

lib: allow marking the scratch disk as shareable

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.
Reviewed-by: 's avatarLaine Stump <laine@laine.org>
Signed-off-by: 's avatarDaniel P. Berrangé <berrange@redhat.com>
parent 29676fb6
......@@ -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);
......
......@@ -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}) : ());
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment