]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/INotify.pm
PVE/JSONSchema: add pve-task-status-type
[pve-common.git] / src / PVE / INotify.pm
index 2bb87bb2dd71e79057dcaa2da391316686e7bc23..562a243fd7ec098f5ae7e22c59cc1f7c6f08a088 100644 (file)
@@ -723,14 +723,15 @@ register_file('active', "/var/log/pve/tasks/active",
              \&write_active_workers);
 
 
-our $bond_modes = { 'balance-rr' => 0,
-                  'active-backup' => 1,
-                  'balance-xor' => 2,
-                  'broadcast' => 3,
-                  '802.3ad' => 4,
-                  'balance-tlb' => 5,
-                  'balance-alb' => 6,
-              };
+our $bond_modes = {
+    'balance-rr' => 0,
+    'active-backup' => 1,
+    'balance-xor' => 2,
+    'broadcast' => 3,
+    '802.3ad' => 4,
+    'balance-tlb' => 5,
+    'balance-alb' => 6,
+};
 
 my $ovs_bond_modes = {
     'active-backup' => 1,
@@ -960,6 +961,7 @@ sub __read_etc_network_interfaces {
                        'bond_miimon' => 1,
                        'bond_xmit_hash_policy' => 1,
                        'bond-primary' => 1,
+                       'link-type'   => 1,
                        'uplink-id' => 1,
                        'vlan-protocol' => 1,
                        'vlan-raw-device' => 1,
@@ -1077,10 +1079,19 @@ sub __read_etc_network_interfaces {
                $ifaces->{$1}->{exists} = 0;
                $d->{exists} = 0;
            }
-       } elsif ($iface =~ m/^(\S+)\.\d+$/ || $d->{'vlan-raw-device'}) {
+       } elsif ($iface =~ m/^(\S+)\.(\d+)$/ || $d->{'vlan-raw-device'}) {
            $d->{type} = 'vlan';
 
-           my $raw_iface = $d->{'vlan-raw-device'} ? $d->{'vlan-raw-device'} : $1;
+           my ($dev, $id) = ($1, $2);
+           $d->{'vlan-raw-device'} = $dev if defined($dev) && !$d->{'vlan-raw-device'};
+
+           if (!$id && $iface =~ m/^vlan(\d+)$/) { # VLAN id 0 is not valid, so truthy check it is
+               $id = $1;
+           }
+           $d->{'vlan-id'} = $id if $id;
+
+           my $raw_iface = $d->{'vlan-raw-device'};
+
            if (defined ($ifaces->{$raw_iface})) {
                $d->{exists} = $ifaces->{$raw_iface}->{exists};
            } else {
@@ -1106,6 +1117,8 @@ sub __read_etc_network_interfaces {
                    my $tag = &$extract_ovs_option($d, 'tag');
                    $d->{ovs_tag} = $tag if defined($tag);
                }
+           } elsif (defined($d->{'link-type'})) {
+               $d->{type} = $d->{'link-type'} if $d->{'link-type'} eq 'dummy';
            }
        }
 
@@ -1660,6 +1673,7 @@ NETWORKDOC
 
     my $if_type_hash = {
        loopback => 100000,
+       dummy => 100000,
        eth => 200000,
        OVSPort => 200000,
        OVSIntPort => 300000,