]> git.proxmox.com Git - pve-common.git/commitdiff
INotify: fix unknown for unknown ovs_type
authorAlexandre Derumier <aderumier@odiso.com>
Tue, 18 Feb 2020 05:33:47 +0000 (06:33 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 7 Mar 2020 16:37:53 +0000 (17:37 +0100)
if user defined manually ovs_type OVSTunnel or OVSPatchPort,
the type is empty.

set type=unknown first to avoid this kind of mistake

src/PVE/INotify.pm

index cf086f25cc40f73765ec7bcaba95fb8398351090..5fdd050fc4325abdc82dd2fd48b5bd5cd02ca75f 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');