[pve-devel] applied: [PATCH guest-common] config trait: allow to pass lock to create_and_lock_config
Thomas Lamprecht
t.lamprecht at proxmox.com
Thu Jan 23 11:20:43 CET 2020
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 <t.lamprecht at proxmox.com>
---
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);
});
}
--
2.20.1
More information about the pve-devel
mailing list