plugin : has_feature

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
Alexandre Derumier
2012-12-27 16:07:14 +01:00
committed by Dietmar Maurer
parent 99473759b2
commit f884fe1125

View File

@ -558,6 +558,24 @@ sub volume_snapshot_delete {
return undef;
}
sub volume_has_feature {
my ($class, $scfg, $feature, $storeid, $volname, $snapname, $running) = @_;
my $features = {
snapshot => { current => { qcow2 => 1}, snap => { qcow2 => 1} },
clone => { current => {qcow2 => 1, raw => 1, vmdk => 1} },
};
if ($volname =~ m!^(\d+)/(\S+)$!) {
my ($vmid, $name) = ($1, $2);
my (undef, $format) = parse_name_dir($name);
my $snap = $snapname ? 'snap' : 'current';
return 1 if defined($features->{$feature}->{$snap}->{$format});
}
return undef;
}
sub list_images {
my ($class, $storeid, $scfg, $vmid, $vollist, $cache) = @_;