From 328d1e87c8134b77c785d70312b40e9e854c5dfc Mon Sep 17 00:00:00 2001 From: Stefan Reiter Date: Wed, 3 Jul 2019 14:27:33 +0200 Subject: [PATCH] Check if corosync.conf exists before calling parser Calling cfs_read_file with no corosync.conf (i.e. on a standalone node) returns {} instead of undef. The previous patches assumes undef for this scenario. To avoid confusing checks all over the place, simply leave the config as undef if no file exists. Signed-off-by: Stefan Reiter --- src/PVE/Firewall.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm index 16d7301..96c45e9 100644 --- a/src/PVE/Firewall.pm +++ b/src/PVE/Firewall.pm @@ -3519,7 +3519,8 @@ sub compile { $hostfw_conf = load_hostfw_conf($cluster_conf, undef) if !$hostfw_conf; # cfs_update is handled by daemon or API - $corosync_conf = PVE::Cluster::cfs_read_file("corosync.conf") if !$corosync_conf; + $corosync_conf = PVE::Cluster::cfs_read_file("corosync.conf") + if !defined($corosync_conf) && PVE::Corosync::check_conf_exists(1); $vmdata = read_local_vm_config(); $vmfw_configs = read_vm_firewall_configs($cluster_conf, $vmdata, undef); -- 2.39.2