Commit ebf850d3 authored by frankiejol's avatar frankiejol
Browse files

refactor: refresh backing store after spinoff

Suggested by @fv3rdugo
parent f8494e49
...@@ -931,6 +931,7 @@ sub spinoff { ...@@ -931,6 +931,7 @@ sub spinoff {
next if !$bf; next if !$bf;
$volume->spinoff; $volume->spinoff;
} }
$self->_set_volumes_backing_store() if $self->type eq 'KVM';
} }
......
...@@ -13,6 +13,24 @@ use Test::Ravada; ...@@ -13,6 +13,24 @@ use Test::Ravada;
############################################################## ##############################################################
sub test_xml($domain) {
my $doc = XML::LibXML->load_xml(string => $domain->domain->get_xml_description);
for my $disk ($doc->findnodes('/domain/devices/disk')) {
my $is_disk;
my $bs='';
for my $child ($disk->childNodes) {
$is_disk++ if $child->nodeName eq 'source';
if ( $child->nodeName eq 'backingStore' ) {
($bs) = $child->findnodes("source");
$bs = $bs->toString;
}
}
next if !$is_disk;
is($bs,'');
}
}
sub test_spinoff($base) { sub test_spinoff($base) {
my $clone = $base->clone(name => new_domain_name, user => user_admin); my $clone = $base->clone(name => new_domain_name, user => user_admin);
is($clone->id_base,$base->id); is($clone->id_base,$base->id);
...@@ -26,6 +44,8 @@ sub test_spinoff($base) { ...@@ -26,6 +44,8 @@ sub test_spinoff($base) {
$clone = Ravada::Domain->open($clone->id); $clone = Ravada::Domain->open($clone->id);
is($clone->id_base,undef) or exit; is($clone->id_base,undef) or exit;
test_xml($clone) if $clone->type eq 'KVM';
for my $vol ( $clone->list_volumes_info ) { for my $vol ( $clone->list_volumes_info ) {
next if ref($vol) =~ /ISO/; next if ref($vol) =~ /ISO/;
......
Supports Markdown
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