[pve-devel] [PATCH 01/31] storage: add volume_protect

2013-01-22 Thread Alexandre Derumier
Signed-off-by: Alexandre Derumier aderum...@odiso.com
---
 PVE/Storage.pm |   15 +++
 1 file changed, 15 insertions(+)

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index 6a274c6..f8cf5ad 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -198,6 +198,21 @@ sub volume_has_feature {
 }
 }
 
+sub volume_protect {
+my ($cfg, $volid, $snap, $read_only) = @_;
+
+my ($storeid, $volname) = parse_volume_id($volid, 1);
+if ($storeid) {
+my $scfg = storage_config($cfg, $storeid);
+my $plugin = PVE::Storage::Plugin-lookup($scfg-{type});
+return $plugin-volume_protect($scfg, $storeid, $volname, $snap, 
$read_only);
+} elsif ($volid =~ m|^(/.+)$|  -e $volid) {
+die protect a device is not possible;
+} else {
+die can't protect;
+}
+}
+
 sub get_image_dir {
 my ($cfg, $storeid, $vmid) = @_;
 
-- 
1.7.10.4

___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH 01/31] storage: add volume_protect

2013-01-08 Thread Alexandre Derumier
Signed-off-by: Alexandre Derumier aderum...@odiso.com
---
 PVE/Storage.pm |   15 +++
 1 file changed, 15 insertions(+)

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index 6a274c6..f8cf5ad 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -198,6 +198,21 @@ sub volume_has_feature {
 }
 }
 
+sub volume_protect {
+my ($cfg, $volid, $snap, $read_only) = @_;
+
+my ($storeid, $volname) = parse_volume_id($volid, 1);
+if ($storeid) {
+my $scfg = storage_config($cfg, $storeid);
+my $plugin = PVE::Storage::Plugin-lookup($scfg-{type});
+return $plugin-volume_protect($scfg, $storeid, $volname, $snap, 
$read_only);
+} elsif ($volid =~ m|^(/.+)$|  -e $volid) {
+die protect a device is not possible;
+} else {
+die can't protect;
+}
+}
+
 sub get_image_dir {
 my ($cfg, $storeid, $vmid) = @_;
 
-- 
1.7.10.4

___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel