From fe8595ac520a48aa37788bd1819cd73e652fce0d Mon Sep 17 00:00:00 2001 From: Abdul Karim Date: Thu, 7 Dec 2023 10:25:23 +0000 Subject: [PATCH 1/2] ncm-network: fix multi bonding configuration fix to enable configuration for mutiple bonding interfaces. closes #1638 --- ncm-network/src/main/perl/nmstate.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ncm-network/src/main/perl/nmstate.pm b/ncm-network/src/main/perl/nmstate.pm index 029877b509..46e93c53c1 100644 --- a/ncm-network/src/main/perl/nmstate.pm +++ b/ncm-network/src/main/perl/nmstate.pm @@ -163,12 +163,12 @@ sub make_nm_ip_route # - port in nmstate config file sub get_bonded_eth { - my ($self, $interfaces) = @_; + my ($self, $bond_name, $interfaces) = @_; my @data = (); foreach my $name (sort keys %$interfaces) { my $iface = $interfaces->{$name}; if ( $iface->{master} ){ - push @data, $name; + push @data, $name if $iface->{master} eq $bond_name; } } return \@data; @@ -279,7 +279,6 @@ sub generate_nmstate_config { my ($self, $name, $net, $ipv6, $routing_table) = @_; - my $bonded_eth = get_bonded_eth($self, $net->{interfaces}); my $iface = $net->{interfaces}->{$name}; my $device = $iface->{device} || $name; my $is_eth = $iface->{set_hwaddr}; @@ -313,6 +312,7 @@ sub generate_nmstate_config # if bond device $ifaceconfig->{type} = "bond"; $ifaceconfig->{'link-aggregation'} = $iface->{link_aggregation}; + my $bonded_eth = get_bonded_eth($self, $name, $net->{interfaces}); if ($bonded_eth){ $ifaceconfig->{'link-aggregation'}->{port} = $bonded_eth; } From a05cbd1c541c75a4a178c40cb7a764b32d318327 Mon Sep 17 00:00:00 2001 From: Abdul Karim Date: Thu, 7 Dec 2023 14:40:35 +0000 Subject: [PATCH 2/2] ncm-network: convert arp_ip_target bonding option to string for nmstate nmstate backend change to convert bonding option arp_ip_target to string. closes #1639 --- ncm-network/src/main/perl/network.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ncm-network/src/main/perl/network.pm b/ncm-network/src/main/perl/network.pm index 51706023a4..a2ad136ef4 100755 --- a/ncm-network/src/main/perl/network.pm +++ b/ncm-network/src/main/perl/network.pm @@ -800,7 +800,12 @@ sub process_network $la->{options} ||= {}; $la = $la->{options}; } - $la->{$opt} = $opts->{$opt}; + # nmstate config requires arp_ip_target as comma seperated string + if ($opt eq 'arp_ip_target') { + $la->{$opt} = join(',', @{$opts->{$opt}}); + } else { + $la->{$opt} = $opts->{$opt}; + } } } # TODO for briging_opts