[pve-devel] [PATCH 1/8] storage: add volume_lock && volume_unlock
Alexandre Derumier
aderumier at odiso.com
Thu Nov 29 10:38:48 CET 2012
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/Storage.pm | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index b13df21..152ef87 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -183,6 +183,36 @@ sub volume_snapshot_delete {
}
}
+sub volume_lock {
+ my ($cfg, $volid, $snap) = @_;
+
+ 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_lock($scfg, $storeid, $volname, $snap);
+ } elsif ($volid =~ m|^(/.+)$| && -e $volid) {
+ die "lock a device is not possible";
+ } else {
+ die "can't lock";
+ }
+}
+
+sub volume_unlock {
+ my ($cfg, $volid, $snap) = @_;
+
+ 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_unlock($scfg, $storeid, $volname, $snap);
+ } elsif ($volid =~ m|^(/.+)$| && -e $volid) {
+ die "unlock a device is not possible";
+ } else {
+ die "can't unlock";
+ }
+}
+
sub get_image_dir {
my ($cfg, $storeid, $vmid) = @_;
--
1.7.10.4
More information about the pve-devel
mailing list