From 49cc7802f752be39ad880146094270e936081d5b Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 14 Nov 2018 14:43:29 +0100 Subject: [PATCH] LVM: lock on volume_resize 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 --- 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.39.2