]> git.proxmox.com Git - pve-guest-common.git/commitdiff
config trait: allow to pass lock to create_and_lock_config
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 23 Jan 2020 10:01:55 +0000 (11:01 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 23 Jan 2020 10:01:56 +0000 (11:01 +0100)
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>
PVE/AbstractConfig.pm

index a94a379fee0eb82647c765b9b300356295999e85..b63a744dc0f5801c2cf2157db7e42ae998a747db 100644 (file)
@@ -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);
     });
 }