Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ncm-network: fix multi bonding configuration and arp_ip_target bonding options #1640

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ncm-network/src/main/perl/network.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions ncm-network/src/main/perl/nmstate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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};
Expand Down Expand Up @@ -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;
}
Expand Down