]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/INotify.pm
Inotify: allow bond of bond
[pve-common.git] / src / PVE / INotify.pm
index 1eaec2191f365fc901793cd411678ec23ee08ef0..c5067de9043f557a1f2743333f645fe2c2790c28 100644 (file)
@@ -1236,8 +1236,8 @@ sub __interface_to_string {
        # not printing out options
     } elsif ($d->{type} eq 'bridge') {
 
-       $d->{bridge_ports} =~ s/[;,\s]+/ /g;
        my $ports = $d->{bridge_ports} || 'none';
+       $ports =~ s/[;,\s]+/ /g;
        $raw .= "\tbridge-ports $ports\n";
        $done->{bridge_ports} = 1;
 
@@ -1487,6 +1487,7 @@ sub __write_etc_network_interfaces {
        if ($d->{type} eq 'OVSBond' && $d->{ovs_bonds}) {
            foreach my $p (split (/\s+/, $d->{ovs_bonds})) {
                my $n = $ifaces->{$p};
+               $n->{autostart} = 1;
                die "OVS bond '$iface' - unable to find slave '$p'\n"
                    if !$n;
                die "OVS bond '$iface' - wrong interface type on slave '$p' " .
@@ -1503,11 +1504,12 @@ sub __write_etc_network_interfaces {
            my $bond_primary_is_slave = undef;
            foreach my $p (split (/\s+/, $d->{slaves})) {
                my $n = $ifaces->{$p};
+               $n->{autostart} = 1;
 
                die "bond '$iface' - unable to find slave '$p'\n"
                    if !$n;
                die "bond '$iface' - wrong interface type on slave '$p' " .
-                   "('$n->{type}' != 'eth')\n" if $n->{type} ne 'eth';
+                   "('$n->{type}' != 'eth or bond')\n" if ($n->{type} ne 'eth' && $n->{type} ne 'bond');
                &$check_mtu($ifaces, $iface, $p);
                $bond_primary_is_slave = 1 if $d->{'bond-primary'} && $d->{'bond-primary'} eq $p;
            }
@@ -1603,7 +1605,7 @@ sub __write_etc_network_interfaces {
     foreach my $iface (keys %$ifaces_copy) {
        my $d = $ifaces_copy->{$iface};
        if ($d->{type} eq 'bridge') {
-           foreach my $p (split (/\s+/, $d->{bridge_ports})) {
+           foreach my $p (split (/\s+/, $d->{bridge_ports} // '')) {
                if($p =~ m/(\S+)\.(\d+)$/) {
                    my $vlanparent = $1;
                    if (!defined($ifaces_copy->{$p})) {