]> git.proxmox.com Git - pve-container.git/commit
clone_vm: refactor locking further
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 18 Jun 2021 12:51:22 +0000 (14:51 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 18 Jun 2021 15:53:13 +0000 (17:53 +0200)
commitb062187acae382f413641ebc43862652740ace12
tree13499bb7879608b61694a1fb74f5127b9d291211
parent5da8f4128f5da1317c4c538cd33e825b6b2b5ac7
clone_vm: refactor locking further

introduce a new helper handling
- obtaining the flock
- (re)loading the config
- checking that the 'create' lock is still there

before calling a passed-in sub with the current config, since this
pattern was used quite a lot here.

intentionally changed behaviour:
- flock is now held for the post_clone hook call
- failure to remove the 'create' lock or to move the config to the
  target node if applicable will not undo the clone, since either is
  trivially fixable ('pct unlock' or a no-op migration), and copying all
  those volumes might have been quite expensive..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
src/PVE/API2/LXC.pm