Commit 4db21c93 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents 7d1f5299 e428c661
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved.
#
# Emulab constants.
......@@ -21,7 +21,7 @@ use vars qw(@ISA @EXPORT);
NODESTARTSTATUS_NOSTATUS PROJMEMBERTRUST_NONE PROJMEMBERTRUST_USER
PROJMEMBERTRUST_ROOT PROJMEMBERTRUST_GROUPROOT
PROJMEMBERTRUST_PROJROOT PROJMEMBERTRUST_LOCALROOT
NODEILL_PID NODEILL_EID
NODEILL_PID NODEILL_EID VLAN_PID VLAN_EID
TBOPSPID EXPTLOGNAME
PLABMOND_PID PLABMOND_EID PLABHOLDING_PID PLABHOLDING_EID
......@@ -208,6 +208,8 @@ sub PLABHOLDING_PID() { $TBOPSPID; }
sub PLABHOLDING_EID() { "plabnodes"; }
sub PLABDOWN_PID() { $TBOPSPID; }
sub PLABDOWN_EID() { "hwdown"; }
sub VLAN_PID() { $TBOPSPID; }
sub VLAN_EID() { "vlan-holding"; }
sub OLDRESERVED_PID() { $TBOPSPID; }
sub OLDRESERVED_EID() { "oldreserved"; }
sub NFREELOCKED_PID() { $TBOPSPID; }
......
......@@ -564,6 +564,13 @@ sub CompareVlansWithSwitches2($$)
"where lanid='$newid'")
or return -1;
}
# From the cache.
delete($lans{"$newid"});
delete($lans{"$oldid"});
# XXX we should not use this slot anymore.
$vlan = VLan->Lookup($oldid);
$vlan->SetAttribute("vlantag", $tag);
}
return 0;
}
......@@ -1029,7 +1036,7 @@ sub Initialize($)
"Could not create vlan $vname ($id) in $experiment\n";
return -1;
}
$vlan->SetTag($tag);
$vlan->ReserveVlanTag($tag);
#
# Split apart the space-separated list of members
......@@ -2501,26 +2508,22 @@ sub GetRole($;$)
}
return $role;
}
sub SetTag($$)
{
my ($self, $tag) = @_;
if (!$initialize) {
my $vlanid = $self->lanid();
DBQueryWarn("update vlans set tag='$tag' ".
"where id='$vlanid'");
}
return $self->GetLan()->SetAttribute("vlantag", $tag);
}
sub GetTag($$)
{
my ($self, $ptag) = @_;
my $tag;
my $lanid = $self->lanid();
#
# Go to vlans table for this, since that ensures that things are
# consistent.
#
my $query_result =
DBQueryWarn("select tag from vlans where id='$lanid'");
return -1
if ($self->GetAttribute("vlantag", \$tag) != 0);
if (! (defined($query_result) || $query_result->numrows));
my ($tag) = $query_result->fetchrow_array();
if (defined($ptag)) {
$$ptag = $tag;
......@@ -2554,15 +2557,16 @@ sub GetClass($)
}
# VLan reservation for a specific lan in an experiment.
sub ReserveVlanTag($$;$)
sub ReserveVlanTag($$;$$)
{
my ($self, $tag, $checkonly) = @_;
my ($self, $tag, $checkonly, $force) = @_;
my $lanid = $self->lanid();
my $vname = $self->vname();
my $pid = $self->pid();
my $eid = $self->eid();
my $exptidx = $self->exptidx();
$checkonly = 0 if (!defined($checkonly));
$force = 0 if (!defined($force));
DBQueryWarn("lock tables lan_attributes write, lans write, ".
" reserved_vlantags write, vlans read")
......@@ -2581,16 +2585,19 @@ sub ReserveVlanTag($$;$)
# But because of swapmod and syncvlansfromtables, must also check
# the vlans table since that is what is currently on the switches.
#
$query_result =
DBQueryWarn("select id from vlans where tag='$tag'");
goto inuse
if (!$query_result || $query_result->numrows);
# Skip the vlans check when we want to force consistency.
#
if (!$force) {
$query_result =
DBQueryWarn("select id from vlans where tag='$tag'");
# Just checking ...
goto isfree
if ($checkonly);
goto inuse
if (!$force || !$query_result || $query_result->numrows);
# Just checking ...
goto isfree
if ($checkonly);
}
goto inuse
if (!DBQueryWarn("insert into reserved_vlantags set ".
" lanid='$lanid', tag='$tag', vname='$vname', ".
......@@ -2694,6 +2701,34 @@ sub VlanTagAvailable($$)
return 1;
}
#
# Who has a vlan tag reserved.
#
sub FindVlanByTag($$)
{
my ($class, $tag) = @_;
my $query_result =
DBQueryWarn("select lanid from reserved_vlantags where tag='$tag'");
return undef
if (!$query_result);
if ($query_result->numrows) {
my ($lanid) = $query_result->fetchrow_array();
return VLan->Lookup($lanid);
}
$query_result =
DBQueryWarn("select id from vlans where tag='$tag'");
return undef
if (!$query_result || !$query_result->numrows);
my ($lanid) = $query_result->fetchrow_array();
return VLan->Lookup($lanid);
}
# Find out which stack a VLAN resides on
sub GetStack($) {
my ($self) = @_;
......@@ -2749,6 +2784,26 @@ sub IsManual($)
return 0;
}
#
# Mark/Get the "internal" bit on a vlan. These are special vlans
# not associated with an experiment.
#
sub MarkInternal($)
{
my ($self) = @_;
return $self->GetLan()->SetAttribute("internal", "1");
}
sub IsInternal($)
{
my ($self) = @_;
my $flag;
return $flag
if ($self->GetAttribute("internal", \$flag) == 0);
return 0;
}
#
# Check to see if we think the VLAN actually exists on any switches at the
# moment (ie. has a vlans table entry).
......@@ -2890,19 +2945,22 @@ sub UnInstantiate($;$)
#
sub RecordVlanInsertion($$$$)
{
my ($class, $experiment, $lanid, $stack) = @_;
my ($class, $experiment, $vlan, $stack) = @_;
my $pid = $experiment->pid();
my $eid = $experiment->eid();
my $exptidx = $experiment->idx();
my $vlan = VLan->Lookup($lanid);
if (!ref($vlan)) {
$vlan = VLan->Lookup($vlan);
}
return -1
if (!defined($vlan));
my $lanid = $vlan->lanid();
my $vname = $vlan->vname();
my $tag = $vlan->GetTag(undef);
my $tag = $vlan->GetReservedVlanTag();
return -1
if ($tag <= 0);
if (!defined($tag));
my @portlist;
$vlan->PortList(\@portlist) == 0
......
......@@ -223,6 +223,11 @@ my %EXPERIMENTS =
"description" => "Nodes in shared mode"},
"hwcheckup" => {"pid" => "emulab-ops",
"description" => "Nodes being testing after failure"},
"external-holding" => {"pid" => "emulab-ops",
"description" => "Holding experiment for fake nodes"},
"vlan-holding" => {"pid" => "emulab-ops",
"description" =>
"Holding experiment for internal vlans"},
);
#
......
......@@ -682,19 +682,17 @@ ClientNetFindServer(in_addr_t sip, in_port_t sport,
close(msock);
return 0;
}
close(msock);
if (strncmp((char *)msg.hdr.version, MS_MSGVERS_1,
sizeof(msg.hdr.version))) {
fprintf(stderr, "Got incorrect version from master server\n");
close(msock);
return 0;
}
if (ntohl(msg.hdr.type) != MS_MSGTYPE_GETREPLY) {
fprintf(stderr, "Got incorrect reply from master server\n");
close(msock);
return 0;
}
close(msock);
/*
* Convert the reply info to host order
......
......@@ -22,6 +22,7 @@
name="urn:publicid:IDN+uky.emulab.net+image+emulab-ops//FEDORA10-STD" />
</node>
<link virtual_id="ionlink">
<bandwidth>100000</bandwidth>
<component_manager
name="urn:publicid:IDN+emulab.net+authority+cm"/>
<component_manager
......@@ -39,7 +40,7 @@
<component_hop
component_urn="urn:publicid:IDN+uky.emulab.net+link+ion">
<interface_ref
component_node_urn="urn:publicid:IDN+uky.emulab.net+node+ion"
component_node_urn="urn:publicid:IDN+emulab.net+node+ion"
component_interface_id="eth0"/>
</component_hop>
</link>
......
<?xml version="1.0" encoding="UTF-8"?>
<rspec xmlns="http://www.protogeni.net/resources/rspec/0.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.protogeni.net/resources/rspec/0.1 http://www.protogeni.net/resources/rspec/0.1/request.xsd"
type="request" >
<node virtual_id="geni1"
virtualization_type="emulab-vnode"
exclusive="1"
component_manager_urn="urn:publicid:IDN+emulab.net+authority+cm">
<node_type type_name="pcpg-i2" type_slots="1"/>
<interface virtual_id="if0"/>
<disk_image
name="urn:publicid:IDN+emulab.net+image+emulab-ops//FEDORA10-STD" />
</node>
<node virtual_id="geni2"
virtualization_type="emulab-vnode"
exclusive="1"
component_manager_urn="urn:publicid:IDN+schooner.wail.wisc.edu+authority+cm">
<node_type type_name="pc" type_slots="1"/>
<interface virtual_id="if0"/>
<disk_image
name="urn:publicid:IDN+schooner.wail.wisc.edu+image+emulab-ops//FC8-STD" />
</node>
<link virtual_id="gpenilink">
<bandwidth>100000</bandwidth>
<component_manager
name="urn:publicid:IDN+emulab.net+authority+cm"/>
<component_manager
name="urn:publicid:IDN+schooner.wail.wisc.edu+authority+cm"/>
<interface_ref virtual_node_id="geni1"
virtual_interface_id="if0" />
<interface_ref virtual_node_id="geni2"
virtual_interface_id="if0" />
<component_hop
component_urn="urn:publicid:IDN+emulab.net+link+gpeni">
<interface_ref
component_node_urn="urn:publicid:IDN+emulab.net+node+gpeni"
component_interface_id="eth0"/>
</component_hop>
<component_hop
component_urn="urn:publicid:IDN+schooner.wail.wisc.edu+link+gpeni">
<interface_ref
component_node_urn="urn:publicid:IDN+emulab.net+node+gpeni"
component_interface_id="eth0"/>
</component_hop>
</link>
</rspec>
......@@ -189,7 +189,12 @@ sub RemoteDoVlansFromTables($@)
}
my $vlan = $vlans{$vlanid};
if ($vlan->SetTag($tag) != 0) {
#
# This is should always succeed since we do whatever the
# outer emulab says to do.
#
if (! ($vlan->HasVlanTagReserved($tag) ||
$vlan->ReserveVlanTag($tag))) {
print STDERR "could not set vlan tag for $vlan\n";
$errors++;
}
......
......@@ -18,6 +18,7 @@ use snmpit_lib;
use libdb;
use libtestbed;
use overload ('""' => 'Stringify');
our %devices;
our $parallelized = 1;
......@@ -152,6 +153,18 @@ sub new($$$@) {
return $self;
}
#
# Stringify for output.
#
sub Stringify($)
{
my ($self) = @_;
my $stack_id = $self->{STACKID};
return "[Stack ${stack_id}]";
}
#
# List all VLANs on all switches in the stack
#
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007, 2009 University of Utah and the Flux Group.
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -85,7 +85,7 @@ frisbee-mfs-install: destdircheck
@if [ -r $(SRCDIR)/master.passwd ]; then \
$(INSTALL) -m 600 $(SRCDIR)/master.passwd $(SYSETCDIR); \
pwd_mkdb -d $(SYSETCDIR) $(SYSETCDIR)/master.passwd; \
if [ ! -e $(DESTDIR)/bin/csh ]; then \
if [ ! -e $(DESTDIR)/bin/csh -a -e $(DESTDIR)/bin/sh ]; then \
ln $(DESTDIR)/bin/sh $(DESTDIR)/bin/csh; \
fi \
fi
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006, 2009 University of Utah and the Flux Group.
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -66,6 +66,7 @@ frisbee-mfs-install: destdircheck
rm -f $(SYSETCDIR)/rc.early
$(INSTALL) -m 644 $(SRCDIR)/frisbee/rc.conf $(SYSETCDIR)/rc.conf
$(INSTALL) -m 644 $(SRCDIR)/frisbee/rc.local $(SYSETCDIR)/rc.local
$(INSTALL) -m 755 -o root -g wheel -d $(SYSETCDIR)/rc.conf.d
$(INSTALL) -m 444 $(SRCDIR)/rc.dhclient $(SYSETCDIR)/rc.conf.d/dhclient
cdboot-install: destdircheck basefbsdcdboot-install etc-install \
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2009 University of Utah and the Flux Group.
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -104,6 +104,7 @@ script-install: dir-install
# (til we switch to 6.x rc.d files)
#
frisbee-mfs-install:
$(INSTALL) -m 755 -o root -g wheel -d $(DESTDIR)/usr/local/etc
(cd ../freebsd5; $(MAKE) all frisbee-mfs-install)
rm -f $(SYSETCDIR)/testbed/dhclient
rm -f $(DESTDIR)/usr/local/etc/dhclient*
......
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