[pve-devel] applied-series: [PATCH firewall 1/3] Check if corosync.conf exists before calling parser
Fabian Grünbichler
f.gruenbichler at proxmox.com
Wed Jul 3 16:03:46 CEST 2019
thanks, applied all three with the following follow-up(s):
diff --git a/src/PVE/Service/pve_firewall.pm b/src/PVE/Service/pve_firewall.pm
index 39ceb39..d78bcb1 100755
--- a/src/PVE/Service/pve_firewall.pm
+++ b/src/PVE/Service/pve_firewall.pm
@@ -272,14 +272,14 @@ __PACKAGE__->register_method ({
print "\naccepting corosync traffic from/to:\n";
PVE::Corosync::for_all_corosync_addresses($corosync_conf, undef, sub {
- my ($node_name, $node_ip, $node_ipversion, $key) = @_;
+ my ($curr_node_name, $curr_node_ip, undef, $key) = @_;
- if (!$corosync_node_found) {
- $corosync_node_found = 1;
- }
+ return if $curr_node_name eq $nodename;
+
+ $corosync_node_found = 1;
$key =~ m/(?:ring|link)(\d+)_addr/;
- print " - $node_name: $node_ip (link: $1)\n";
+ print " - $curr_node_name: $curr_node_ip (link: $1)\n";
});
if (!$corosync_node_found) {
On Wed, Jul 03, 2019 at 02:27:33PM +0200, Stefan Reiter wrote:
> 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 <s.reiter at proxmox.com>
> ---
> 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.20.1
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
More information about the pve-devel
mailing list