[pve-devel] [PATCH cluster 1/2] cfs_lock: add firewall lock helper

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Apr 29 10:52:48 CEST 2020


Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
alternatively we could re-use 'cfs_lock_domain', which is currently
only used by HA and was intended as general-purpose cfs_lock wrapper..
I'd shorten the firewall- prefix to fw- in that case though.

domain-fw-host-$foo might be more confusing to end users though, as it's
pretty visible in error messages.

 data/PVE/Cluster.pm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index 068d626..b4de989 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -659,6 +659,14 @@ sub cfs_lock_authkey {
     $cfs_lock->('authkey', $timeout, $code, @param);
 }
 
+sub cfs_lock_firewall {
+    my ($scope, $timeout, $code, @param) = @_;
+
+    my $lockid = "firewall-$scope";
+
+    $cfs_lock->($lockid, $timeout, $code, @param);
+}
+
 my $log_levels = {
     "emerg" => 0,
     "alert" => 1,
-- 
2.20.1





More information about the pve-devel mailing list