to avoid a potential race for two processes trying to allocate the same volume.
Signed-off-by: Fabian Ebner <f.eb...@proxmox.com>
---

This is conceptually independent from patches 2+3 (but patch 3 modfies the same
hunk as this one).

 PVE/Storage.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index bb3b874..ae2ea53 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -1402,8 +1402,10 @@ sub volume_import {
     die "cannot import into volume '$volid'\n" if !$storeid;
     my $scfg = storage_config($cfg, $storeid);
     my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
-    return $plugin->volume_import($scfg, $storeid, $fh, $volname, $format,
-                                  $base_snapshot, $with_snapshots);
+    return $plugin->cluster_lock_storage($storeid, $scfg->{shared}, undef, sub 
{
+       return $plugin->volume_import($scfg, $storeid, $fh, $volname, $format,
+                                     $base_snapshot, $with_snapshots);
+    });
 }
 
 sub volume_export_formats {
-- 
2.20.1


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to