mirror of
https://git.proxmox.com/git/pve-common
synced 2025-07-09 19:50:15 +00:00
network_interfaces: use allow-ovs for OVSBridge
new openvswitch-switch service use "ifup --allow-ovs",
and this race with "auto ..." used by networking service
bug reported here:
https://forum.proxmox.com/threads/so-is-openvswitch-bonding-just-broken-on-pve-6-whats-going-on.58020/
This is also fixing ovs with ifupdown2
Openvswitch github have a note about this:
e0dfd67b45 (diff-555e6da95251766b76e83867900bd8fe)
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
parent
9bbc4e174c
commit
4ac94c72a2
@ -1142,7 +1142,9 @@ sub __read_etc_network_interfaces {
|
|||||||
# from the {options} hash for them to be removed correctly.
|
# from the {options} hash for them to be removed correctly.
|
||||||
@$options = grep {defined($_)} map {
|
@$options = grep {defined($_)} map {
|
||||||
my ($pri, $line) = @$_;
|
my ($pri, $line) = @$_;
|
||||||
if ($line =~ /^allow-(\S+)\s+(.*)$/) {
|
if ($line =~ /^allow-ovs\s+(.*)$/) {
|
||||||
|
undef;
|
||||||
|
} elsif ($line =~ /^allow-(\S+)\s+(.*)$/) {
|
||||||
my $bridge = $1;
|
my $bridge = $1;
|
||||||
my @ports = split(/\s+/, $2);
|
my @ports = split(/\s+/, $2);
|
||||||
if (defined(my $br = $ifaces->{$bridge})) {
|
if (defined(my $br = $ifaces->{$bridge})) {
|
||||||
@ -1254,6 +1256,7 @@ sub __interface_to_string {
|
|||||||
$done->{ovs_type} = 1;
|
$done->{ovs_type} = 1;
|
||||||
|
|
||||||
$raw .= "\tovs_ports $d->{ovs_ports}\n" if $d->{ovs_ports};
|
$raw .= "\tovs_ports $d->{ovs_ports}\n" if $d->{ovs_ports};
|
||||||
|
|
||||||
$done->{ovs_ports} = 1;
|
$done->{ovs_ports} = 1;
|
||||||
} elsif ($d->{type} eq 'OVSPort' || $d->{type} eq 'OVSIntPort' ||
|
} elsif ($d->{type} eq 'OVSPort' || $d->{type} eq 'OVSIntPort' ||
|
||||||
$d->{type} eq 'OVSBond') {
|
$d->{type} eq 'OVSBond') {
|
||||||
@ -1293,12 +1296,7 @@ sub __interface_to_string {
|
|||||||
|
|
||||||
if ($d->{ovs_bridge}) {
|
if ($d->{ovs_bridge}) {
|
||||||
|
|
||||||
if ($ifupdown2) {
|
$raw = "allow-$d->{ovs_bridge} $iface\n$raw";
|
||||||
$raw = "auto $iface\n$raw";
|
|
||||||
} else {
|
|
||||||
$raw = "allow-$d->{ovs_bridge} $iface\n$raw";
|
|
||||||
}
|
|
||||||
|
|
||||||
$raw .= "\tovs_bridge $d->{ovs_bridge}\n";
|
$raw .= "\tovs_bridge $d->{ovs_bridge}\n";
|
||||||
$done->{ovs_bridge} = 1;
|
$done->{ovs_bridge} = 1;
|
||||||
}
|
}
|
||||||
@ -1592,7 +1590,6 @@ NETWORKDOC
|
|||||||
return $a cmp $b;
|
return $a cmp $b;
|
||||||
} keys %$ifaces) {
|
} keys %$ifaces) {
|
||||||
next if $printed->{$iface};
|
next if $printed->{$iface};
|
||||||
|
|
||||||
my $d = $ifaces->{$iface};
|
my $d = $ifaces->{$iface};
|
||||||
my $pri = $d->{priority} // 0;
|
my $pri = $d->{priority} // 0;
|
||||||
if (@options && $options[0]->[0] < $pri) {
|
if (@options && $options[0]->[0] < $pri) {
|
||||||
@ -1603,7 +1600,12 @@ NETWORKDOC
|
|||||||
}
|
}
|
||||||
|
|
||||||
$printed->{$iface} = 1;
|
$printed->{$iface} = 1;
|
||||||
$raw .= "auto $iface\n" if $d->{autostart};
|
if ($d->{type} eq 'OVSBridge') {
|
||||||
|
$raw .= "allow-ovs $iface\n";
|
||||||
|
} elsif ($d->{autostart}) {
|
||||||
|
$raw .= "auto $iface\n" if $d->{autostart};
|
||||||
|
}
|
||||||
|
|
||||||
my $i = 0; # some options should be printed only once
|
my $i = 0; # some options should be printed only once
|
||||||
$raw .= __interface_to_string($iface, $d, $_, !$i++, $ifupdown2) foreach @{$d->{families}};
|
$raw .= __interface_to_string($iface, $d, $_, !$i++, $ifupdown2) foreach @{$d->{families}};
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ iface vmbr0 inet6 static
|
|||||||
|
|
||||||
source-directory before-ovs.d
|
source-directory before-ovs.d
|
||||||
|
|
||||||
auto vmbr1
|
allow-ovs vmbr1
|
||||||
iface vmbr1 inet static
|
iface vmbr1 inet static
|
||||||
address $wanted{vmbr1}->{address}
|
address $wanted{vmbr1}->{address}
|
||||||
netmask $wanted{vmbr1}->{netmask}
|
netmask $wanted{vmbr1}->{netmask}
|
||||||
|
@ -39,7 +39,7 @@ iface eth2 inet manual
|
|||||||
|
|
||||||
iface eth3 inet manual
|
iface eth3 inet manual
|
||||||
|
|
||||||
auto vmbr0
|
allow-ovs vmbr0
|
||||||
iface vmbr0 inet static
|
iface vmbr0 inet static
|
||||||
address $ip
|
address $ip
|
||||||
netmask $nm
|
netmask $nm
|
||||||
@ -67,7 +67,7 @@ iface eth2 inet manual
|
|||||||
|
|
||||||
iface eth3 inet manual
|
iface eth3 inet manual
|
||||||
|
|
||||||
auto vmbr0
|
allow-ovs vmbr0
|
||||||
iface vmbr0 inet static
|
iface vmbr0 inet static
|
||||||
address $ip
|
address $ip
|
||||||
netmask $nm
|
netmask $nm
|
||||||
@ -102,7 +102,7 @@ iface eth3 inet manual
|
|||||||
|
|
||||||
iface eth2 inet manual
|
iface eth2 inet manual
|
||||||
|
|
||||||
auto vmbr0
|
allow-ovs vmbr0
|
||||||
iface vmbr0 inet static
|
iface vmbr0 inet static
|
||||||
address $ip
|
address $ip
|
||||||
netmask $nm
|
netmask $nm
|
||||||
|
Loading…
Reference in New Issue
Block a user