mirror of
https://git.proxmox.com/git/pve-guest-common
synced 2025-08-05 18:09:50 +00:00
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 <t.lamprecht@proxmox.com>
This commit is contained in:
parent
fb73d112aa
commit
fde98d5e11
@ -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);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user