mirror of
git://git.proxmox.com/git/pve-common.git
synced 2025-01-10 09:17:37 +03:00
parent
ef69578b74
commit
21d32c95cd
@ -1216,6 +1216,7 @@ sub __write_etc_network_interfaces {
|
|||||||
my $n = $ifaces->{$p};
|
my $n = $ifaces->{$p};
|
||||||
die "OVS bridge '$iface' - unable to find port '$p'\n"
|
die "OVS bridge '$iface' - unable to find port '$p'\n"
|
||||||
if !$n;
|
if !$n;
|
||||||
|
$n->{autostart} = 0;
|
||||||
if ($n->{type} eq 'eth') {
|
if ($n->{type} eq 'eth') {
|
||||||
$n->{type} = 'OVSPort';
|
$n->{type} = 'OVSPort';
|
||||||
$n->{ovs_bridge} = $iface;
|
$n->{ovs_bridge} = $iface;
|
||||||
@ -1229,6 +1230,19 @@ sub __write_etc_network_interfaces {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Remove autostart from linux bridge ports
|
||||||
|
foreach my $iface (keys %$ifaces) {
|
||||||
|
my $d = $ifaces->{$iface};
|
||||||
|
if ($d->{type} eq 'bridge' && $d->{bridge_ports}) {
|
||||||
|
foreach my $p (split (/\s+/, $d->{bridge_ports})) {
|
||||||
|
my $n = $ifaces->{$p};
|
||||||
|
die "bridge '$iface' - unable to find port '$p'\n"
|
||||||
|
if !$n;
|
||||||
|
$n->{autostart} = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# check OVS bond ports
|
# check OVS bond ports
|
||||||
foreach my $iface (keys %$ifaces) {
|
foreach my $iface (keys %$ifaces) {
|
||||||
my $d = $ifaces->{$iface};
|
my $d = $ifaces->{$iface};
|
||||||
|
24
test/etc_network_interfaces/t.bridge_eth_remove_auto.pl
Normal file
24
test/etc_network_interfaces/t.bridge_eth_remove_auto.pl
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
use strict;
|
||||||
|
|
||||||
|
# access to the current config
|
||||||
|
our $config;
|
||||||
|
|
||||||
|
# replace proc_net_dev with one with a bunch of interfaces
|
||||||
|
save('proc_net_dev', <<'/proc/net/dev');
|
||||||
|
eth0:
|
||||||
|
eth1:
|
||||||
|
/proc/net/dev
|
||||||
|
|
||||||
|
r('');
|
||||||
|
update_iface('eth0', [], autostart => 1);
|
||||||
|
update_iface('eth1', [], autostart => 1);
|
||||||
|
r(w());
|
||||||
|
die "autostart lost" if !$config->{ifaces}->{eth0}->{autostart};
|
||||||
|
die "autostart lost" if !$config->{ifaces}->{eth1}->{autostart};
|
||||||
|
new_iface("vmbr0", 'bridge', [{ family => 'inet' }], bridge_ports => 'eth0');
|
||||||
|
new_iface("vmbr1", 'OVSBridge', [{ family => 'inet' }], ovs_ports => 'eth1');
|
||||||
|
r(w());
|
||||||
|
die "autostart not removed for linux bridge port" if $config->{ifaces}->{eth0}->{autostart};
|
||||||
|
die "autostart not removed for ovs bridge port" if $config->{ifaces}->{eth1}->{autostart};
|
||||||
|
|
||||||
|
1;
|
@ -48,19 +48,18 @@ iface vmbr0 inet static
|
|||||||
|
|
||||||
/etc/network/interfaces
|
/etc/network/interfaces
|
||||||
|
|
||||||
# Adding an interface to the bridge needs to add allow- lines:
|
# Adding an interface to the bridge needs to add allow- lines and remove
|
||||||
|
# its autostart property.
|
||||||
update_iface('vmbr0', [], ovs_ports => 'eth1 eth2');
|
update_iface('vmbr0', [], ovs_ports => 'eth1 eth2');
|
||||||
expect load('loopback') . <<"/etc/network/interfaces";
|
expect load('loopback') . <<"/etc/network/interfaces";
|
||||||
auto eth0
|
auto eth0
|
||||||
iface eth0 inet manual
|
iface eth0 inet manual
|
||||||
|
|
||||||
auto eth1
|
|
||||||
allow-vmbr0 eth1
|
allow-vmbr0 eth1
|
||||||
iface eth1 inet manual
|
iface eth1 inet manual
|
||||||
ovs_type OVSPort
|
ovs_type OVSPort
|
||||||
ovs_bridge vmbr0
|
ovs_bridge vmbr0
|
||||||
|
|
||||||
auto eth2
|
|
||||||
allow-vmbr0 eth2
|
allow-vmbr0 eth2
|
||||||
iface eth2 inet manual
|
iface eth2 inet manual
|
||||||
ovs_type OVSPort
|
ovs_type OVSPort
|
||||||
|
Loading…
Reference in New Issue
Block a user