my $n = $ifaces->{$p};
die "OVS bridge '$iface' - unable to find port '$p'\n"
if !$n;
+ $n->{autostart} = 0;
if ($n->{type} eq 'eth') {
$n->{type} = 'OVSPort';
$n->{ovs_bridge} = $iface;
}
}
+ # 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
foreach my $iface (keys %$ifaces) {
my $d = $ifaces->{$iface};
--- /dev/null
+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;
/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');
expect load('loopback') . <<"/etc/network/interfaces";
auto eth0
iface eth0 inet manual
-auto eth1
allow-vmbr0 eth1
iface eth1 inet manual
ovs_type OVSPort
ovs_bridge vmbr0
-auto eth2
allow-vmbr0 eth2
iface eth2 inet manual
ovs_type OVSPort