]> git.proxmox.com Git - pve-firewall.git/commitdiff
helpers: move over missing lock_vmfw_conf
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 16 Nov 2022 16:03:12 +0000 (17:03 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 16 Nov 2022 16:03:12 +0000 (17:03 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/Firewall.pm
src/PVE/Firewall/Helpers.pm

index 955c4874028c0e9ddc72d9234c73986e2f9266eb..d40a9b17328144fefd9c6ef308a460d9566a6664 100644 (file)
@@ -3182,16 +3182,9 @@ sub read_local_vm_config {
     return $vmdata;
 };
 
+# FIXME: move use sites over to moved helper and break older packages, then remove this here
 sub lock_vmfw_conf {
-    my ($vmid, $timeout, $code, @param) = @_;
-
-    die "can't lock VM firewall config for undefined VMID\n"
-       if !defined($vmid);
-
-    my $res = PVE::Cluster::cfs_lock_firewall("vm-$vmid", $timeout, $code, @param);
-    die $@ if $@;
-
-    return $res;
+    return PVE::Firewall::Helpers::lock_vmfw_conf(@_);
 }
 
 sub load_vmfw_conf {
index 3112ebcfef36d57303850e4892da25fd24d743d0..154fca5381723aaac9246783266018e9ef8160a2 100644 (file)
@@ -3,16 +3,30 @@ package PVE::Firewall::Helpers;
 use strict;
 use warnings;
 
+use PVE::Cluster;
 use PVE::Tools qw(file_get_contents file_set_contents);
 
 use base 'Exporter';
 our @EXPORT_OK = qw(
+lock_vmfw_conf
 remove_vmfw_conf
 clone_vmfw_conf
 );
 
 my $pvefw_conf_dir = "/etc/pve/firewall";
 
+sub lock_vmfw_conf {
+    my ($vmid, $timeout, $code, @param) = @_;
+
+    die "can't lock VM firewall config for undefined VMID\n"
+       if !defined($vmid);
+
+    my $res = PVE::Cluster::cfs_lock_firewall("vm-$vmid", $timeout, $code, @param);
+    die $@ if $@;
+
+    return $res;
+}
+
 sub remove_vmfw_conf {
     my ($vmid) = @_;
 
@@ -38,4 +52,4 @@ sub clone_vmfw_conf {
     });
 }
 
-1;
\ No newline at end of file
+1;