]> git.proxmox.com Git - pve-guest-common.git/commitdiff
base guest config: add common destroy_config implementation
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 18 Oct 2019 06:47:31 +0000 (08:47 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 18 Oct 2019 06:47:33 +0000 (08:47 +0200)
copied over from pve-containers implementation with the same name.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/AbstractConfig.pm

index e0d0f10af44c890d84df3d019222d1d3040439aa..26235fa47563cab1ae45cd855ae248851df9e0ee 100644 (file)
@@ -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