INotify: use auto for ovs interfaces with ifupdown2
authorAlexandre Derumier <aderumier@odiso.com>
Fri, 21 Feb 2020 09:28:11 +0000 (10:28 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 7 Mar 2020 15:57:33 +0000 (16:57 +0100)
Need the ifupdown2 openvswitch addon !

src/PVE/INotify.pm

index d3998cd..0136f32 100644 (file)
@@ -1311,7 +1311,12 @@ sub __interface_to_string {
        $done->{ovs_type} = 1;
 
        if (my $bridge = $d->{ovs_bridge}) {
-           $raw = "allow-$bridge $iface\n$raw";
+           if ($ifupdown2) {
+               $raw = "auto $iface\n$raw";
+           } else {
+               $raw = "allow-$bridge $iface\n$raw";
+           }
+
            $raw .= "\tovs_bridge $bridge\n";
            $done->{ovs_bridge} = 1;
        }
@@ -1653,7 +1658,7 @@ NETWORKDOC
 
        $printed->{$iface} = 1;
        if ($d->{autostart}) {
-           if ($d->{type} eq 'OVSBridge') {
+           if ($d->{type} eq 'OVSBridge' && !$ifupdown2) {
                # cannot use 'auto' for OVS, would add race with systemd ifup@.service
                $raw .= "allow-ovs $iface\n";
            } else {