]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/INotify.pm
INotify : fix OVSBond && OvsintPort order + tests
[pve-common.git] / src / PVE / INotify.pm
index 0136f326bb89d93c407f4ad55ed01992a347c609..d0d9ba6c35b86103ced909d9de19f553afcdef72 100644 (file)
@@ -1032,6 +1032,7 @@ sub __read_etc_network_interfaces {
 
     foreach my $iface (keys %$ifaces) {
        my $d = $ifaces->{$iface};
+       $d->{type} = 'unknown';
        if ($iface =~ m/^bond\d+$/) {
            if (!$d->{ovs_type}) {
                $d->{type} = 'bond';
@@ -1051,8 +1052,6 @@ sub __read_etc_network_interfaces {
                }
                my $tag = &$extract_ovs_option($d, 'tag');
                $d->{ovs_tag} = $tag if defined($tag);
-           } else {
-               $d->{type} = 'unknown';
            }
        } elsif ($iface =~ m/^vmbr\d+$/) {
            if (!$d->{ovs_type}) {
@@ -1066,8 +1065,6 @@ sub __read_etc_network_interfaces {
                }
            } elsif ($d->{ovs_type} eq 'OVSBridge') {
                $d->{type} = $d->{ovs_type};
-           } else {
-               $d->{type} = 'unknown';
            }
        } elsif ($iface =~ m/^(\S+):\d+$/) {
            $d->{type} = 'alias';
@@ -1094,16 +1091,12 @@ sub __read_etc_network_interfaces {
                $d->{type} = $d->{ovs_type};
                my $tag = &$extract_ovs_option($d, 'tag');
                $d->{ovs_tag} = $tag if defined($tag);
-           } else {
-               $d->{type} = 'unknown';
            }
        } elsif ($iface =~ m/^lo$/) {
            $d->{type} = 'loopback';
        } else {
            if ($d->{'vxlan-id'}) {
                $d->{type} = 'vxlan';
-           } elsif (!$d->{ovs_type}) {
-               $d->{type} = 'unknown';
            } elsif ($d->{ovs_type} eq 'OVSIntPort') {
                $d->{type} = $d->{ovs_type};
                my $tag = &$extract_ovs_option($d, 'tag');
@@ -1352,7 +1345,7 @@ sub __interface_to_string {
 
 sub write_etc_network_interfaces {
     my ($filename, $fh, $config) = @_;
-    my $ifupdown2 = -e '/usr/share/ifupdown2';
+    my $ifupdown2 = -e '/usr/share/ifupdown2/ifupdown2';
     my $raw = __write_etc_network_interfaces($config, $ifupdown2);
     PVE::Tools::safe_print($filename, $fh, encode('UTF-8', $raw));
 }
@@ -1608,12 +1601,13 @@ NETWORKDOC
        loopback => 100000,
        eth => 200000,
        OVSPort => 200000,
-       OVSIntPort => 200000,
-       bond => 300000,
-       bridge => 400000,
-       OVSBridge => 400000,
-       vlan => 500000,
-       vxlan => 500000,
+       OVSIntPort => 300000,
+       OVSBond => 400000,
+       bond => 400000,
+       bridge => 500000,
+       OVSBridge => 500000,
+       vlan => 600000,
+       vxlan => 600000,
    };
 
     my $lookup_type_prio = sub {