[pve-devel] [PATCH 06/31] lvm : add volume_protect

Alexandre Derumier aderumier at odiso.com
Tue Jan 22 12:36:04 CET 2013


we can't protect a lvm volume.

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/Storage/LVMPlugin.pm |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/PVE/Storage/LVMPlugin.pm b/PVE/Storage/LVMPlugin.pm
index 6b12b62..21d3ec9 100644
--- a/PVE/Storage/LVMPlugin.pm
+++ b/PVE/Storage/LVMPlugin.pm
@@ -444,4 +444,16 @@ sub volume_has_feature {
     return undef;
 }
 
+sub volume_protect {
+    my ($class, $scfg, $storeid, $volname, $snap, $read_only) = @_;
+
+    my $path = $class->path($scfg, $volname);
+
+    my $permission = $read_only ? 'r' : 'rw';
+
+    my $cmd = ['/sbin/lvchange', "-p$permission", $path];
+    run_command($cmd, errmsg => "can't activate LV '$path'");
+
+}
+
 1;
-- 
1.7.10.4




More information about the pve-devel mailing list