Commit dd332ab4 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Big fix; createVlan() is suppsed to return the new vlan number.

parent f9f867b2
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# EMULAB-LGPL # EMULAB-LGPL
# Copyright (c) 2000-2005 University of Utah and the Flux Group. # Copyright (c) 2000-2009 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
...@@ -417,29 +417,27 @@ sub createVlan($$$;$$$) { ...@@ -417,29 +417,27 @@ sub createVlan($$$;$$$) {
# What we do here depends on whether this stack uses VTP to synchronize # What we do here depends on whether this stack uses VTP to synchronize
# VLANs or not # VLANs or not
# #
my $okay = 1; my $vlan_number;
if ($self->{VTP} || $self->{PRUNE_VLANS}) { if ($self->{VTP} || $self->{PRUNE_VLANS}) {
# #
# We just need to create the VLAN on the stack leader # We just need to create the VLAN on the stack leader
# #
# #
my $vlan_number = $self->{LEADER}->createVlan($vlan_id,undef,@otherargs); $vlan_number = $self->{LEADER}->createVlan($vlan_id,undef,@otherargs);
$okay = ($vlan_number != 0);
} else { } else {
# #
# We need to create the VLAN on all devices # We need to create the VLAN on all devices
# XXX - should we do the leader first? # XXX - should we do the leader first?
# #
my $vlan_number = undef; foreach my $devicename (sort {tbsort($a,$b)} keys %{$self->{DEVICES}}){
foreach my $devicename (sort {tbsort($a,$b)} keys %{$self->{DEVICES}}) { print "Creating VLAN on switch $devicename ... \n"
print "Creating VLAN on switch $devicename ... \n" if $self->{DEBUG}; if $self->{DEBUG};
my $device = $self->{DEVICES}{$devicename}; my $device = $self->{DEVICES}{$devicename};
my $res = $device->createVlan($vlan_id,$vlan_number,@otherargs); my $res = $device->createVlan($vlan_id,$vlan_number,@otherargs);
if (!$res) { if (!$res) {
# #
# Ooops, failed. Don't try any more # Ooops, failed. Don't try any more
# #
$okay = 0;
last; last;
} else { } else {
# #
...@@ -454,13 +452,12 @@ sub createVlan($$$;$$$) { ...@@ -454,13 +452,12 @@ sub createVlan($$$;$$$) {
# We need to add the ports to VLANs at the stack level, since they are # We need to add the ports to VLANs at the stack level, since they are
# not necessarily on the leader # not necessarily on the leader
# #
if ($okay && @ports) { if ($vlan_number && @ports) {
if ($self->setPortVlan($vlan_id,@ports)) { if ($self->setPortVlan($vlan_id,@ports)) {
$okay = 0; print STDERR "*** Failed to add ports to vlan\n";
} }
} }
return return $vlan_number;
return $okay;
} }
# #
......
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