[pve-devel] [PATCH storage] LVM: lock on volume_resize

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Nov 14 14:43:29 CET 2018


This is important for shared LVM storages. As with deletes and
creates of images, as else we may have not the up-to-date metadata
and extents may get reused if another node created an image during
the same time, for example.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 PVE/Storage/LVMPlugin.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/PVE/Storage/LVMPlugin.pm b/PVE/Storage/LVMPlugin.pm
index f4a2566..79d527d 100644
--- a/PVE/Storage/LVMPlugin.pm
+++ b/PVE/Storage/LVMPlugin.pm
@@ -491,7 +491,10 @@ sub volume_resize {
 
     my $path = $class->path($scfg, $volname);
     my $cmd = ['/sbin/lvextend', '-L', $size, $path];
-    run_command($cmd, errmsg => "error resizing volume '$path'");
+
+    $class->cluster_lock_storage($storeid, $scfg->{shared}, undef, sub {
+	run_command($cmd, errmsg => "error resizing volume '$path'");
+    });
 
     return 1;
 }
-- 
2.19.1





More information about the pve-devel mailing list