From c688b8e6838029e62c5f12638e107c25888c07b0 Mon Sep 17 00:00:00 2001 From: Alexandre Derumier Date: Tue, 18 Feb 2020 06:33:47 +0100 Subject: [PATCH] INotify: fix unknown for unknown ovs_type 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 | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm index cf086f2..5fdd050 100644 --- a/src/PVE/INotify.pm +++ b/src/PVE/INotify.pm @@ -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'); -- 2.39.2