Commit a5fe0bdd authored by Jonathon Duerig's avatar Jonathon Duerig

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

parents aa8f83ff 4aba2e66
......@@ -239,7 +239,7 @@ sub BulkLookup($$$)
$node->{"TYPEINFO"} = undef;
$node->{"ATTRS"} = undef;
$node->{"IFACES"} = undef;
$self->{"WAROW"} = undef;
$node->{"WAROW"} = undef;
$node->{"HASH"} = {};
$nodelist{$nodeid} = $node;
......
......@@ -319,6 +319,33 @@ sub isdedicatedremote($;$) {
}
sub control_interface($;$) { return control_iface($_[0], $_[1]); }
#
# Set the value of an attribute
#
sub SetAttribute($$$;$)
{
my ($self, $attrkey, $attrvalue, $attrtype) = @_;
goto bad
if (!ref($self));
$self->LoadAttributes() == 0
or return -1;
$attrtype = "string"
if (!defined($attrtype));
my $safe_attrvalue = DBQuoteSpecial($attrvalue);
my $type = $self->type();
DBQueryWarn("replace into node_type_attributes set ".
" type='$type', attrkey='$attrkey', ".
" attrtype='$attrtype', attrvalue=$safe_attrvalue")
or return -1;
$self->{"ATTRS"}->{$attrkey} = $attrvalue;
return 0;
}
# _Always_ make sure that this 1 is at the end of the file...
1;
#!/usr/bin/perl -w
use File::Temp qw/ tempfile /;
if (scalar(@ARGV) < 5) {
print STDERR 'run-standalone <run-level> <run-path> <var-path> <log-path> <host-list> [node-list]
......@@ -30,15 +32,16 @@ be a single unqualified name (like node-0).
($level, $runpath, $varpath, $logpath, $hosts, $nodes) = @ARGV;
open HOSTS, ">hosts.txt";
($fh, $filename) = tempfile();
@hostList = split(",", $hosts);
print HOSTS join("\n", @hostList);
close HOSTS;
print $fh join("\n", @hostList);
close $fh;
if (! defined($nodes)) {
$nodes = $hosts;
}
$command = "pssh -h hosts.txt -o out -e err -t 3000 sh $runpath/standalone.sh $level $runpath $varpath $logpath $nodes";
$command = "sh -i -c 'pssh -h $filename -o out -e err -t 3000 sh $runpath/standalone.sh $level $runpath $varpath $logpath $nodes'";
print($command."\n");
system($command);
<descriptors>
<osid>
<attribute name="magic">
<value></value>
</attribute>
<attribute name="features">
<value>ping,ssh,isup,veths,veth-ne,veth-en,mlinks,vlans</value>
<image>
<attribute name="global">
<value>1</value>
</attribute>
<attribute name="version">
<value>0.1</value>
<value>1.0</value>
</attribute>
<attribute name="reboot_waittime">
<value>600</value>
<attribute name="osfeatures">
<value>ping,ssh</value>
</attribute>
<attribute name="description">
<value>Phoney OSID for GENI nodes</value>
<attribute name="path">
<value>/usr/testbed/images/GENI.ndz</value>
</attribute>
<attribute name="mustclean">
<attribute name="reboot_waittime">
<value>60</value>
</attribute>
<attribute name="mbr_version">
<value>1</value>
</attribute>
<attribute name="shared">
<attribute name="loadpart">
<value>1</value>
</attribute>
<attribute name="description">
<value>Dummy descriptor for GENI physical nodes</value>
</attribute>
<attribute name="op_mode">
<value>MINIMAL</value>
<value>NORMALv2</value>
</attribute>
<attribute name="pid">
<value>emulab-ops</value>
<attribute name="shared">
<value>0</value>
</attribute>
<attribute name="osname">
<attribute name="imagename">
<value>GENI</value>
</attribute>
<attribute name="pid">
<value>emulab-ops</value>
</attribute>
<attribute name="OS">
<value>Other</value>
</attribute>
</osid>
<osid>
<attribute name="magic">
<value></value>
<attribute name="gid">
<value>emulab-ops</value>
</attribute>
<attribute name="features">
<value>ping,ssh,isup,veths,veth-ne,veth-en,mlinks,vlans</value>
<attribute name="mtype_pcfedphys">
<value>1</value>
</attribute>
</image>
<image>
<attribute name="global">
<value>1</value>
</attribute>
<attribute name="version">
<value>0.1</value>
<value>1.0</value>
</attribute>
<attribute name="reboot_waittime">
<value>600</value>
<attribute name="osfeatures">
<value>ping,ssh</value>
</attribute>
<attribute name="description">
<value>Phony OSID for Geni vnodes</value>
<attribute name="path">
<value>/usr/testbed/images/GENIVM.ndz</value>
</attribute>
<attribute name="reboot_waittime">
<value>60</value>
</attribute>
<attribute name="mustclean">
<attribute name="mbr_version">
<value>1</value>
</attribute>
<attribute name="shared">
<attribute name="loadpart">
<value>1</value>
</attribute>
<attribute name="description">
<value>Dummy descriptor for GENI virtual nodes</value>
</attribute>
<attribute name="op_mode">
<value>MINIMAL</value>
<value>NORMALv2</value>
</attribute>
<attribute name="pid">
<value>emulab-ops</value>
<attribute name="shared">
<value>0</value>
</attribute>
<attribute name="osname">
<attribute name="imagename">
<value>GENIVM</value>
</attribute>
<attribute name="pid">
<value>emulab-ops</value>
</attribute>
<attribute name="OS">
<value>Other</value>
</attribute>
<attribute name="nextosid">
<value>emulab-ops,GENI</value>
<attribute name="gid">
<value>emulab-ops</value>
</attribute>
<attribute name="mtype_pcfed">
<value>1</value>
</attribute>
</osid>
</descriptors>
</image>
......@@ -74,6 +74,7 @@ sub SET_TESTBED_VERSION($) { $updatemode = $MAGIC_TESTBED_VERSION = $_[0]; }
my $impotent = 0;
my $logfp;
sub SET_IMPOTENT_MODE($) { $impotent = 1; $logfp = $_[0]; };
sub IMPOTENT_MODE() { return $impotent; }
#
# Some programs we may call
......
......@@ -14,7 +14,12 @@ use Data::Dumper;
#
sub usage()
{
print STDERR "Usage: update-testbed [-v] [-f]\n";
print STDERR "Usage: update-testbed\n";
print STDERR "-v - Verify install scripts by loading them only\n";
print STDERR "-n - Run install script in impotent mode\n";
print STDERR "-d - Debugging mode\n";
print STDERR "-i - Run 'gmake boss-install' after running scripts\n";
print STDERR "-s - Stop/Restart the testbed before/after running scripts\n";
exit(-1);
}
my $optlist = "idsvfn";
......
#
# Do things to set up cooked mode support.
#
use strict;
use libinstall;
use emdb;
use Image;
use NodeType;
sub InstallUpdate($$)
{
my ($version, $phase) = @_;
my $pid = "emulab-ops";
#
# If something should run in the pre-install phase.
#
if ($phase eq "pre") {
my $SUDO = "/usr/local/bin/sudo";
my $IDIR = "$TOP_OBJDIR/install";
my $DUMPDESC = "$TBROOT/sbin/dumpdescriptor";
my $LOADDESC = "$IDIR/load-descriptors";
my $DESCRIPTORS = "$TOP_SRCDIR/install/descriptors-pgeni.xml";
Phase "cooked-mode", "Setting up cooked mode support", sub {
Phase "pcfedphys", "Creating pcfedphys node type", sub {
my $nodetype = NodeType->Lookup("pcfedphys");
if (!defined($nodetype)) {
if (IMPOTENT_MODE()) {
PhaseWouldHave("Created pcfedphys");
}
else {
if (DBQueryWarn("REPLACE INTO node_type_attributes VALUES ".
"('pcfedphys','nobootinfo','1','boolean')") &&
DBQueryWarn("REPLACE INTO node_type_attributes VALUES ".
"('pcfedphys','virtnode_capacity','1','integer')") &&
DBQueryWarn("REPLACE INTO node_type_attributes VALUES ".
"('pcfedphys','imageable','0','boolean')") &&
DBQueryWarn("REPLACE INTO node_type_attributes VALUES ".
"('pcfedphys','rebootable','1','boolean')") &&
DBQueryWarn("REPLACE INTO node_type_attributes VALUES ".
"('pcfedphys','bios_waittime','60','integer')") &&
DBQueryWarn("REPLACE INTO `node_types` VALUES ".
"('pcfedphys','pcfedphys',NULL,NULL, ".
" 0,0,0,0,1,0,0,0,0,0,1,0)")) {
PhaseSucceed();
}
else {
PhaseFail("Could not create pcfedphys");
}
}
}
else {
PhaseSkip("pcfedphys already exists");
}
};
Phase "pcfed", "Creating pcfed node type", sub {
my $nodetype = NodeType->Lookup("pcfed");
if (!defined($nodetype)) {
if (IMPOTENT_MODE()) {
PhaseWouldHave("Created pcfed");
}
else {
if (DBQueryWarn("REPLACE INTO node_type_attributes VALUES ".
"('pcfed','rebootable','1','boolean')") &&
DBQueryWarn("REPLACE INTO node_type_attributes VALUES ".
"('pcfed','nobootinfo','1','boolean')") &&
DBQueryWarn("REPLACE INTO `node_types` VALUES ".
"('pcfed','pcfed',NULL,NULL, ".
" 1,0,0,1,1,0,0,0,0,0,1,0)")) {
PhaseSucceed();
}
else {
PhaseFail("Could not create pcfed");
}
}
}
else {
PhaseSkip("pcfed already exists");
}
};
Phase "descriptors", "Creating cooked mode descriptors", sub {
my $image = Image->Lookup("$pid,GENI");
if (!defined($image)) {
if (IMPOTENT_MODE()) {
PhaseWouldHave("Creating descriptors");
}
else {
ExecQuietFatal("$SUDO -u $PROTOUSER $WAP ".
" perl $LOADDESC $DESCRIPTORS");
PhaseSucceed();
}
}
else {
PhaseSkip("Descriptors exist");
}
};
Phase "GENI", "Setting up default osid for pcfedphys", sub {
my $nodetype = NodeType->Lookup("pcfedphys");
if (!defined($nodetype)) {
if (IMPOTENT_MODE()) {
PhaseWouldHave("Updated osid for pcfedphys");
}
else {
PhaseFail("Could not lookup pcfedphys");
}
}
my $osid = $nodetype->default_osid();
if (!defined($osid)) {
if (IMPOTENT_MODE()) {
PhaseWouldHave("Updated osid for pcfedphys");
}
}
else {
PhaseSkip("osid already set");
}
my $image = Image->Lookup("$pid,GENI");
if (!defined($image)) {
if (IMPOTENT_MODE()) {
PhaseWouldHave("Updated osid for pcfedphys");
}
else {
PhaseFail("Could not lookup $pid,GENI");
}
}
PhaseWouldHave("Updated osid for pcfedphys")
if (IMPOTENT_MODE());
$osid = $image->default_osid();
if ($nodetype->SetAttribute("default_osid", $osid)) {
PhaseFail("Could not set default_osid for pcfedphys");
}
if (!DBQueryWarn("replace into osidtoimageid set ".
"osid='$osid',imageid='$osid',type='pcfedphys'")) {
PhaseFail("Could not initialize osidtoimageid for pcfedphys");
}
PhaseSucceed();
};
Phase "GENIVM", "Setting up default osid for pcfed", sub {
my $nodetype = NodeType->Lookup("pcfed");
if (!defined($nodetype)) {
if (IMPOTENT_MODE()) {
PhaseWouldHave("Updated osid for pcfed");
}
else {
PhaseFail("Could not lookup pcfed");
}
}
my $osid = $nodetype->default_osid();
if (!defined($osid)) {
if (IMPOTENT_MODE()) {
PhaseWouldHave("Updated osid for pcfed");
}
}
else {
PhaseSkip("osid already set");
}
my $image = Image->Lookup("$pid,GENIVM");
if (!defined($image)) {
if (IMPOTENT_MODE()) {
PhaseWouldHave("Updated osid for pcfed");
}
else {
PhaseFail("Could not lookup $pid,GENIVM");
}
}
PhaseWouldHave("Updated osid for pcfed")
if (IMPOTENT_MODE());
$osid = $image->default_osid();
if ($nodetype->SetAttribute("default_osid", $osid)) {
PhaseFail("Could not set default_osid for pcfed");
}
if (!DBQueryWarn("replace into osidtoimageid set ".
"osid='$osid',imageid='$osid',type='pcfed'")) {
PhaseFail("Could not initialize osidtoimageid for pcfed");
}
PhaseSucceed();
};
};
}
#
# If something should run in the post-install phase.
#
if ($phase eq "post") {
}
return 0;
}
1;
......@@ -1009,6 +1009,7 @@ sub GetTicketAuxAux($$$$$$$$$)
$linkref)->get_nodelist();
my %managers = ();
my $ifacenum = 1;
my $vindex = 0;
my $trivial_ok = 0;
if (!defined($lanname)) {
......@@ -1152,6 +1153,7 @@ sub GetTicketAuxAux($$$$$$$$$)
{"vname" => $lanname,
"vnode" => $node_nickname,
"vport" => $iface_vport,
"vindex" => $vindex,
"trivial_ok" => $trivial_ok,
"ip" => $ip,
"delay" => 0.0,
......@@ -1165,6 +1167,7 @@ sub GetTicketAuxAux($$$$$$$$$)
"fixed_iface" => $iface_name});
$vportmap{$member}->{"virtlan"} = $virtlan;
$ifacenum++;
$vindex++;
}
$linknum++;
}
......@@ -1319,6 +1322,9 @@ sub GetTicketAuxAux($$$$$$$$$)
my $colocate = GeniXML::GetColocate($rspec);
my $subnode_of = GeniXML::GetSubnodeOf($rspec);
# Need to do this after the mapper has run.
$node->Refresh();
#
# Regardless of whether the user asked for an exclusive node
# or not, we have to change the rspec (ticket) to reflect
......@@ -2094,6 +2100,9 @@ sub SliverWorkAux($$$$$$$)
$message = "Unknown resource_id in ticket: $resource_id";
goto bad;
}
# Must do this after mapper has run
$node->Refresh();
my $sliver = GeniSliver::Node->Create($slice, $owner, $node, $ref);
if (!defined($sliver)) {
$message = "Could not create GeniSliver object for $virtual_id";
......@@ -2336,6 +2345,9 @@ sub SliverWorkAux($$$$$$$)
$message = "Could not find node object for $nodesliver";
goto bad;
}
# Must do this after mapper has run
$node->Refresh();
$vinterface =
Interface::VInterface->LookupByVirtLan($experiment,
$linkname, $node_id);
......
......@@ -195,6 +195,14 @@ sub GetElementByVirtualId($$$)
my ($name, $type, $node) = @_;
my @list = FindNodes('n:'.$type.'[@virtual_id = "'.$name.'"]',
$node)->get_nodelist();
if (scalar(@list) == 0) {
@list = FindNodes('n:'.$type.'[@nickname = "'.$name.'"]',
$node)->get_nodelist();
}
if (scalar(@list) == 0) {
@list = FindNodes('n:'.$type.'[@client_id = "'.$name.'"]',
$node)->get_nodelist();
}
my $result = undef;
if (scalar(@list) > 0)
{
......
......@@ -2740,6 +2740,7 @@ sub GenVirtLans($)
'virtual_interface_id' => "$member1" },
{'virtual_node_id' => $delayname,
'virtual_interface_id' =>"$member0" },
($top_bw == 0 ? "*" : $top_bw),
$protocol, $others);
$self->printdb("Delay node $plink ($delayname) = " .
......
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