plugin : has_feature : clone from base + fix
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
committed by
Dietmar Maurer
parent
201345af42
commit
dc4f2cb33d
@ -683,16 +683,23 @@ sub volume_has_feature {
|
|||||||
|
|
||||||
my $features = {
|
my $features = {
|
||||||
snapshot => { current => { qcow2 => 1}, snap => { qcow2 => 1} },
|
snapshot => { current => { qcow2 => 1}, snap => { qcow2 => 1} },
|
||||||
clone => { current => {qcow2 => 1, raw => 1, vmdk => 1} },
|
clone => { base => {qcow2 => 1, raw => 1, vmdk => 1} },
|
||||||
};
|
};
|
||||||
|
|
||||||
if ($volname =~ m!^(\d+)/(\S+)$!) {
|
my ($vtype, $name, $vmid, $basename, $basevmid, $isBase) =
|
||||||
my ($vmid, $name) = ($1, $2);
|
$class->parse_volname($volname);
|
||||||
my (undef, $format) = parse_name_dir($name);
|
|
||||||
my $snap = $snapname ? 'snap' : 'current';
|
|
||||||
return 1 if defined($features->{$feature}->{$snap}->{$format});
|
|
||||||
|
|
||||||
|
my (undef, $format) = parse_name_dir($name);
|
||||||
|
|
||||||
|
my $key = undef;
|
||||||
|
if($snapname){
|
||||||
|
$key = $snapname
|
||||||
|
}else{
|
||||||
|
$key = $isBase ? 'base' : 'current';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 1 if defined($features->{$feature}->{$key}->{$format});
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user