From fde98d5e11dfe2dc5d9095f2a2b47e9ad9779786 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Thu, 23 Jan 2020 11:01:55 +0100 Subject: [PATCH] config trait: allow to pass lock to create_and_lock_config allows us to reuse this for clone, where we want to create a "clone" locked config for the target guest. Signed-off-by: Thomas Lamprecht --- PVE/AbstractConfig.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PVE/AbstractConfig.pm b/PVE/AbstractConfig.pm index a94a379..b63a744 100644 --- a/PVE/AbstractConfig.pm +++ b/PVE/AbstractConfig.pm @@ -223,14 +223,14 @@ sub lock_config_full { } sub create_and_lock_config { - my ($class, $vmid, $allow_existing) = @_; + my ($class, $vmid, $allow_existing, $lock) = @_; $class->lock_config_full($vmid, 5, sub { PVE::Cluster::check_vmid_unused($vmid, $allow_existing); my $conf = eval { $class->load_config($vmid) } || {}; $class->check_lock($conf); - $conf->{lock} = 'create'; + $conf->{lock} = $lock // 'create'; $class->write_config($vmid, $conf); }); }