]> git.proxmox.com Git - pve-common.git/commitdiff
Delayed vlan interface creation until all checks are done.
authorPablo Ruiz Garcia <pablo.ruiz@gmail.com>
Wed, 12 Feb 2014 07:55:30 +0000 (08:55 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 19 Mar 2014 05:47:03 +0000 (06:47 +0100)
Signed-off-by: Pablo Ruiz Garcia <pablo.ruiz@gmail.com>
data/PVE/Network.pm

index dc7ee8663c68cca63b8c5674160900e4b1c2c369..ce06a96f187af20a3c62ba1feb1e79b906d702c4 100644 (file)
@@ -165,6 +165,14 @@ sub activate_bridge_vlan {
 
     my $bridgevlan = "${bridge}v$tag";
 
+    my @ifaces = ();
+    my $dir = "/sys/class/net/$bridge/brif";
+    PVE::Tools::dir_glob_foreach($dir, '((eth|bond)\d+)', sub {
+        push(@ifaces, $_[0]);
+    });
+
+    die "no physical interface on bridge '$bridge'\n" if $ifcount == 0;
+
     # add bridgevlan if it doesn't already exist
     if (! -d "/sys/class/net/$bridgevlan") {
         system("/sbin/brctl addbr $bridgevlan") == 0 ||
@@ -172,15 +180,9 @@ sub activate_bridge_vlan {
     }
 
     # for each physical interface (eth or bridge) bind them to bridge vlan
-    my $ifcount = 0;
-    my $dir = "/sys/class/net/$bridge/brif";
-    PVE::Tools::dir_glob_foreach($dir, '((eth|bond)\d+)', sub {
-        my ($slave) = @_;
-        activate_bridge_vlan_slave($bridgevlan, $slave, $tag);
-        $ifcount++;
-    });
-
-    die "no physical interface on bridge '$bridge'\n" if $ifcount == 0;
+    foreach my $iface (@ifaces) {
+        activate_bridge_vlan_slave($bridgevlan, $iface, $tag);
+    }
 
     #fixme: set other bridge flags