From 1aa76f2f0b77f2806a792137cba7b657b6d059cf Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 18 Oct 2019 08:47:31 +0200 Subject: [PATCH] base guest config: add common destroy_config implementation copied over from pve-containers implementation with the same name. Signed-off-by: Thomas Lamprecht --- PVE/AbstractConfig.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PVE/AbstractConfig.pm b/PVE/AbstractConfig.pm index e0d0f10..26235fa 100644 --- a/PVE/AbstractConfig.pm +++ b/PVE/AbstractConfig.pm @@ -95,6 +95,15 @@ sub create_and_lock_config { }); } +# destroys configuration, only applyable for configs owned by the callers node. +# dies if removal fails, e.g., when inquorate. +sub destroy_config { + my ($class, $vmid) = @_; + + my $config_fn = $class->config_file($vmid, $nodename); + unlink $config_fn or die "failed to remove config file: $!\n"; +} + # Lock config file using flock, run $code with @param, unlock config file. # $timeout is the maximum time to aquire the flock # $shared eq 1 creates a non-exclusive ("read") flock -- 2.39.2