Commit 952159aa authored by Tarun Prabhu's avatar Tarun Prabhu
Browse files

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

parents 218822ca 8f592596
......@@ -315,6 +315,18 @@ my $types_result =
" a.attrvalue!='0'");
# Save the valid types in a new array for later.
my @mtypes_array;
if ($types_result->numrows) {
while (my ($type) = $types_result->fetchrow_array()) {
push(@mtypes_array, $type);
$xmlfields{"mtype_$type"} = ["mtype", $SLOT_OPTIONAL];
}
}
else {
@mtypes_array = ("pc");
$xmlfields{"mtype_pc"} = ["mtype", $SLOT_OPTIONAL];
}
while (my ($type) = $types_result->fetchrow_array()) {
push(@mtypes_array, $type);
$xmlfields{"mtype_$type"} = ["mtype", $SLOT_OPTIONAL];
......@@ -487,7 +499,8 @@ foreach $key (grep(/^mtype_/, keys(%newimageid_args))) {
UserError("Node Types: Must select at least one node type")
if ($node_types_selected == 0 && !$force);
my $typeclause = join(" or ", map("type='$_'", @mtype_keys));
my $typeclause =
($node_types_selected ? join(" or ", map("type='$_'", @mtype_keys)) : "0");
#
# Check sanity of node name and that user can create an image from it.
......
......@@ -319,10 +319,18 @@ my $types_result = DBQueryFatal($types_querystring);
# Save the valid types in a new array for later.
my @mtypes_array;
while (my ($type) = $types_result->fetchrow_array()) {
push(@mtypes_array, $type);
$xmlfields{"mtype_$type"} = ["mtype", $SLOT_OPTIONAL];
if ($types_result->numrows) {
while (my ($type) = $types_result->fetchrow_array()) {
push(@mtypes_array, $type);
$xmlfields{"mtype_$type"} = ["mtype", $SLOT_OPTIONAL];
}
}
else {
@mtypes_array = ("pc");
$xmlfields{"mtype_pc"} = ["mtype", $SLOT_OPTIONAL];
}
## printf "%s mtypes\n", $#mtypes_array + 1;
## foreach my $x (@mtypes_array) { printf "%s\n", $x; }
## print "\n";
......@@ -599,7 +607,8 @@ $newimageid_args{"loadlength"} = $loadlen;
$newimageid_args{"default_osid"} = $osid;
# Create the osidtoimageid mapping too.
$newimageid_args{"makedefault"} = 1;
$newimageid_args{"makedefault"} = 1
if ($node_types_selected);
my $new_image = Image->Create($project, $group, $this_user, $imagename, $osid,
\%newimageid_args, \$usrerr);
......
......@@ -410,16 +410,16 @@
<value>1</value>
</attribute>
<attribute name="version">
<value>6.2</value>
<value>4.10</value>
</attribute>
<attribute name="osfeatures">
<value>ping,ssh,ipod,isup,mlinks,linktest,linkdelays</value>
<value>ping,ssh,ipod,isup,veths,veth-ne,veth-en,mlinks,linktest,vlans</value>
</attribute>
<attribute name="path">
<value>/usr/testbed/images/FBSD62-STD.ndz</value>
<value>/usr/testbed/images/FBSD410-IPFW2.ndz</value>
</attribute>
<attribute name="reboot_waittime">
<value>120</value>
<value>150</value>
</attribute>
<attribute name="mbr_version">
<value>1</value>
......@@ -428,7 +428,7 @@
<value>1</value>
</attribute>
<attribute name="description">
<value>FreeBSD 6.2 pre-release</value>
<value>FreeBSD 4.10 with built-in IPFW2 support</value>
</attribute>
<attribute name="op_mode">
<value>NORMALv2</value>
......@@ -437,7 +437,7 @@
<value>0</value>
</attribute>
<attribute name="imagename">
<value>FBSD62-STD</value>
<value>FBSD410-IPFW2</value>
</attribute>
<attribute name="pid">
<value>emulab-ops</value>
......@@ -453,17 +453,17 @@
<attribute name="global">
<value>1</value>
</attribute>
<attribute name="part1_osid">
<value>emulab-ops,FBSD410-IPFW2</value>
</attribute>
<attribute name="default_osid">
<value>emulab-ops,FBSD410-IPFW2</value>
<attribute name="version">
<value>6.2</value>
</attribute>
<attribute name="part4_osid">
<value>none</value>
<attribute name="osfeatures">
<value>ping,ssh,ipod,isup,mlinks,linktest,linkdelays</value>
</attribute>
<attribute name="path">
<value>/usr/testbed/images/FBSD410-IPFW2.ndz</value>
<value>/usr/testbed/images/FBSD62-STD.ndz</value>
</attribute>
<attribute name="reboot_waittime">
<value>120</value>
</attribute>
<attribute name="mbr_version">
<value>1</value>
......@@ -472,25 +472,22 @@
<value>1</value>
</attribute>
<attribute name="description">
<value>FreeBSD 4.10 with built-in IPFW2 support</value>
<value>FreeBSD 6.2 pre-release</value>
</attribute>
<attribute name="part3_osid">
<value>none</value>
<attribute name="op_mode">
<value>NORMALv2</value>
</attribute>
<attribute name="shared">
<value>0</value>
</attribute>
<attribute name="imagename">
<value>FBSD410-IPFW2</value>
<value>FBSD62-STD</value>
</attribute>
<attribute name="pid">
<value>emulab-ops</value>
</attribute>
<attribute name="loadlength">
<value>1</value>
</attribute>
<attribute name="part2_osid">
<value>none</value>
<attribute name="OS">
<value>FreeBSD</value>
</attribute>
<attribute name="gid">
<value>emulab-ops</value>
......
......@@ -148,34 +148,17 @@ while (<OUTPUT>) {
close(OUTPUT);
#
# Prepass to make sure the XML files verify.
# Must create the OSids first since the images reference them. But must
# do this in two passes since there are nextosid references. But, the EZ
# imageIDs also create OSids that can be referenced by nextosid, so must
# do those after the first OSid pass but before the second one.
#
foreach my $osname (keys(%osinfos)) {
my ($xmlparse, $string) = @{ $osinfos{$osname} };
my $nextosid = exists($xmlparse->{'attribute'}->{"nextosid"});
open(NEW, "| $NEWOSID -v -")
or fatal("Cannot start $NEWOSID");
print NEW $string;
close(NEW)
or fatal("OS $osname does not verify");
}
foreach my $imagename (keys(%images)) {
my ($xmlparse, $string) = @{ $images{$imagename} };
my $ezid = exists($xmlparse->{'attribute'}->{"OS"});
my $which = ($ezid ? $NEWIMAGE_EZ : $NEWIMAGE);
open(NEW, "| $which -v -f -")
or fatal("Cannot start $which");
print NEW $string;
close(NEW)
or fatal("Image $imagename does not verify");
}
#
# Must create the OSids first since the images reference them.
#
foreach my $osname (keys(%osinfos)) {
my ($xmlparse, $string) = @{ $osinfos{$osname} };
next
if ($nextosid);
my $osinfo = OSinfo->Lookup("$PROTOPROJ,$osname");
if (defined($osinfo) && !$force) {
......@@ -190,10 +173,8 @@ foreach my $osname (keys(%osinfos)) {
fatal("$osname could not be created");
}
}
#
# Two passes. First do the ezid images, then the other. This is cause
# multiple images can reference the OSids created with an EZid.
# Do the EZ images
#
foreach my $imagename (keys(%images)) {
my ($xmlparse, $string) = @{ $images{$imagename} };
......@@ -217,6 +198,32 @@ foreach my $imagename (keys(%images)) {
fatal("Image $imagename could not be created");
}
}
#
# Now the rest of the OSids.
#
foreach my $osname (keys(%osinfos)) {
my ($xmlparse, $string) = @{ $osinfos{$osname} };
my $nextosid = exists($xmlparse->{'attribute'}->{"nextosid"});
next
if (!$nextosid);
my $osinfo = OSinfo->Lookup("$PROTOPROJ,$osname");
if (defined($osinfo) && !$force) {
print STDERR "OS $osname already exists. Skipping; use -f option\n";
next;
}
open(NEW, "| $NEWOSID -")
or fatal("Cannot start $NEWOSID");
print NEW $string;
if (!close(NEW)) {
print STDERR "$string\n";
fatal("$osname could not be created");
}
}
#
# And the rest of the images.
#
foreach my $imagename (keys(%images)) {
my ($xmlparse, $string) = @{ $images{$imagename} };
my $ezid = exists($xmlparse->{'attribute'}->{"OS"});
......
......@@ -5,6 +5,8 @@
-- these is not idempotent, since a site may have changed them for some reason.
--
INSERT IGNORE INTO `node_types` VALUES ('pc','pc',NULL,NULL,0,0,0,0,0,0,0,0,0,0,0,0);
INSERT IGNORE INTO`node_type_attributes` VALUES ('pc','imageable','1','boolean');
INSERT IGNORE INTO `node_types` VALUES ('pcvm','pcvm',NULL,NULL,1,0,1,1,0,0,0,0,0,0,0,0);
INSERT IGNORE INTO `node_types` VALUES ('pcvwa','pcvwa',NULL,NULL,1,0,0,1,1,0,0,0,0,0,0,0);
INSERT IGNORE INTO `node_type_attributes` VALUES ('pcvwa','default_osid','0','integer');
......
......@@ -3511,6 +3511,10 @@ sub AddLinkToSolution($$$$$$$$)
$member0->_lannode($nodeB);
$member0->_lanport($portB);
}
else {
$member0->_lannode("null");
$member0->_lanport("null");
}
}
}
elsif (($lan,$virtA) =
......@@ -4010,7 +4014,7 @@ sub AllocNodes($)
if (exists($self->solution()->{'TORESERVE'}->{$nodeid})) {
$self->newreserved()->{$nodeid} = $nodeid;
$pnode->SetAllocState(TBDB_ALLOCSTATE_RES_INIT_DIRTY())
if (!($self->impotent() || $self->alloconly()));
if ($self->impotent());
#
# Fix all of the nodes assigned to the pnode.
......@@ -4123,7 +4127,7 @@ sub AllocNodes($)
# Mark it for teardown by the caller (tbswap currently).
#
$pnode->SetAllocState(TBDB_ALLOCSTATE_RES_TEARDOWN())
if (!($self->impotent() || $self->alloconly()));
if (! $self->impotent());
}
elsif ($pnode->_reuse() eq "reboot") {
#
......@@ -4131,7 +4135,7 @@ sub AllocNodes($)
# it should be rebooted.
#
$pnode->SetAllocState(TBDB_ALLOCSTATE_RES_INIT_DIRTY())
if (!($self->impotent() || $self->alloconly()));
if (! $self->impotent());
}
}
skip:
......@@ -4488,8 +4492,7 @@ sub AllocVirtNodes($)
"nodeid" => $physical,
"debug" => 0,
"verbose" => $self->verbose(),
"impotent" => $self->impotent() ||
$self->alloconly(),
"impotent" => $self->impotent(),
"sharedokay" => $sharedokay,
"regression" => $self->regression()})
< 0) {
......@@ -4579,7 +4582,7 @@ sub AllocVirtNodes($)
# state they were in so that os_setup/vnode_setup know they
# need to reboot them.
#
if (!($self->impotent() || $self->alloconly())) {
if (! $self->impotent()) {
if (!exists($self->current_v2v()->{$virtual})) {
$pnode->SetAllocState(TBDB_ALLOCSTATE_RES_INIT_CLEAN());
}
......@@ -4588,6 +4591,12 @@ sub AllocVirtNodes($)
$pnode->SetAllocState(TBDB_ALLOCSTATE_RES_INIT_DIRTY());
}
}
#
# When doing alloconly, we have to set the vname for the
# physical nodes so that update works.
#
$pnode->ModifyReservation({"vname" => $virtual}) == 0
or return -1 if (!$self->impotent() && $self->alloconly());
}
# Since we have some extra physical vnodes reserved on this pnode,
......@@ -4600,7 +4609,9 @@ sub AllocVirtNodes($)
my $pnode = $self->pnodes()->{$pname};
$pnode->SetAllocState(TBDB_ALLOCSTATE_RES_TEARDOWN())
if (!($self->impotent() || $self->alloconly()));
if (!$self->impotent() &&
$pnode->allocstate() ne
TBDB_ALLOCSTATE_RES_INIT_CLEAN());
}
}
}
......
......@@ -58,7 +58,8 @@ $default_image = Image::LookupByName($emulab_ops, $default_imagename);
if ($freebsd_mfs == null || $default_image == null ||
$rhl_std == null || $fbsd_std == null || $frisbee_mfs == null) {
PAGEERROR("You must add images from Utah into your database" .
" before adding a nodetype. See installation documentation for details!",1);
" before adding a nodetype. ".
"See installation documentation for details!",1);
}
# This belongs elsewhere!
......
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