Skip to content

Commit

Permalink
Merge pull request #1640 from aka7/bond_fix
Browse files Browse the repository at this point in the history
ncm-network: fix multi bonding configuration and arp_ip_target bonding options
  • Loading branch information
jrha committed Dec 20, 2023
2 parents 533badd + a05cbd1 commit 14a5f7d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion ncm-network/src/main/perl/network.pm
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
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, $default_gw) = @_;

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 @@ -314,6 +313,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

0 comments on commit 14a5f7d

Please sign in to comment.