From f884fe1125b44e9924bed4323b2007247779ac5c Mon Sep 17 00:00:00 2001 From: Alexandre Derumier Date: Thu, 27 Dec 2012 16:07:14 +0100 Subject: [PATCH] plugin : has_feature Signed-off-by: Alexandre Derumier --- PVE/Storage/Plugin.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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) = @_;