From: Alexandre Derumier Date: Thu, 27 Dec 2012 15:07:14 +0000 (+0100) Subject: plugin : has_feature X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=f884fe1125b44e9924bed4323b2007247779ac5c;p=pve-storage.git plugin : has_feature Signed-off-by: Alexandre Derumier --- diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm index 886117b..25e012c 100644 --- a/PVE/Storage/Plugin.pm +++ b/PVE/Storage/Plugin.pm @@ -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) = @_;