Commit 0c77892f authored by Keith Sklower's avatar Keith Sklower

can't go to the middle of a loop, move common error case out.

parent 257078f0
......@@ -3,7 +3,7 @@
#
# EMULAB-LGPL
# Copyright (c) 2000-2009 University of Utah and the Flux Group.
# Copyright (c) 2004-2008 Regents, University of California.
# Copyright (c) 2004-2009 Regents, University of California.
# All rights reserved.
#
......@@ -446,6 +446,7 @@ sub createVlan($$$;$$$) {
my @otherargs = @_;
my $vlan_number;
my %map;
my $errortype = "Creating";
# We ignore other args for now, since generic stacks don't support
......@@ -473,12 +474,23 @@ sub createVlan($$$;$$$) {
$device = $self->{DEVICES}{$devicename};
$res = $device->createVlan($vlan_id, $vlan_number);
if (!$res) {
goto failed;
}
}
#
# We need to populate each VLAN on each switch.
#
$self->debug( "adding ports @ports to VLAN $vlan_id \n");
if (@ports) {
if ($self->setPortVlan($vlan_id,@ports)) {
$errortype = "Adding Ports to";
failed:
#
# Ooops, failed. Don't try any more
#
if ($self->{QUIET}) {
print "Creating VLAN $vlan_id as VLAN #$vlan_number on ".
if (! $self->{QUIET}) {
print "$errortype VLAN $vlan_id as VLAN #$vlan_number on ".
"stack $self->{STACKID} failed\n";
}
else {
......@@ -488,16 +500,6 @@ sub createVlan($$$;$$$) {
last LOCKBLOCK;
}
}
#
# We need to populate each VLAN on each switch.
#
$self->debug( "adding ports @ports to VLAN $vlan_id \n");
if (@ports) {
if ($self->setPortVlan($vlan_id,@ports)) {
goto failed;
}
}
print "Succeeded\n" if (! $self->{QUIET});
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment