Commit e3a86905 authored by Leigh Stoller's avatar Leigh Stoller

No longer push osinfo/image tables into the inner boss, just rely on the

images we import as part of the normal boss setup. This reduces a bunch
of confusing clutter inside, and improves the testing of the image
import/usage path. As per Mike, remove the elabinelab option to
mfrisbeed that would ask the outer boss for a missing image.
parent 5428dbbe
......@@ -61,6 +61,9 @@ $| = 1;
use lib "@prefix@/lib";
use libdb;
use libtestbed;
use OSImage;
use Node;
use NodeType;
# Defined in libdb ...
my $TBOPSPID = TBOPSPID();
......@@ -342,6 +345,68 @@ if (1) {
#mysystem("$TB/sbin/dhcpd_makeconf -ir");
}
if (1) {
#
# Need to fix up imported images; there was no type table at the
# time of import, so we could not use architecture or type slots
# when creating the new image descriptors. Lets just get the list
# of images and the list of pc types, and do them all.
#
my @alltypes = NodeType->AllTypes();
my $query_result =
DBQueryFatal("select imageid from images where pid='$TBOPSPID'");
while (my ($imageid) = $query_result->fetchrow_array()) {
my $image = OSImage->Lookup($imageid);
if (!defined($image)) {
print STDERR "Could not lookup imageid $imageid\n";
next;
}
foreach my $type (@alltypes) {
next
if ($type->class() ne "pc" || $type->type() eq "pc");
# See if we have any actual nodes of this type.
my @nodes = Node->LookupByType($type->type());
next
if (!@nodes);
$image->SetRunsOnNodeType($type->type());
}
}
#
# We also have to set the default image/os for real types, since
# the stuff in the table we imported from the outer Emulab refers
# to image IDs that are not valid in this inner Emulab. So just
# pick whatever UBUNTU image we happen to have.
#
$query_result =
DBQueryFatal("select imageid from images ".
"where imagename like 'UBUNTU%' and pid='$TBOPSPID'");
if (!$query_result->numrows) {
die("*** $0:\n".
" Could not find a suitable UBUNTU image");
}
my ($imageid) = $query_result->fetchrow_array();
my $image = OSImage->Lookup($imageid);
if (! defined($image)) {
die("*** $0:\n".
" Could not lookup image $imageid");
}
foreach my $type (@alltypes) {
next
if ($type->class() ne "pc" || $type->type() eq "pc");
# See if we have any actual nodes of this type.
my @nodes = Node->LookupByType($type->type());
next
if (!@nodes);
$type->SetAttribute("default_imageid", $image->imageid());
$type->SetAttribute("default_osid", $image->imageid());
}
}
#
# Run a command string.
#
......
......@@ -80,10 +80,7 @@ rm -f /var/run/frisbeed-*.pid
args="-C emulab -i @BOSSNODE_IP@"
# to allow broadcast, uncomment the following line
#args="$args -x ucast,mcast,bcast"
# if an inner elab, use outer boss as our parent
if [ "@ELABINELAB@" = "1" -a -n "@OUTERBOSS_NODENAME@" ]; then
args="$args -S @OUTERBOSS_NODENAME@"
fi
# see if we need to be an IGMP querier
if [ "@NEEDMCQUERIER@" = "1" ]; then
args="$args -Q 30"
......
......@@ -937,82 +937,6 @@ sub DumpDBGoo()
or die("*** $0:\n".
" Could not dump table group_membership\n");
#
# Initial images; note that these images are not going to exist inside!
# Note that we exclude any encrypted images because we cannot expose
# the encryption keys that they would need to decode the images!
#
DBQueryWarn("select i.* from images as i ".
"left join image_versions as v on ".
" v.imageid=i.imageid and v.version=i.version ".
"where (i.pid='$pid' or (i.pid='$TBOPSPID' and v.global=1)) ".
" and decryption_key is null ".
"into outfile '$statedir/images'")
or die("*** $0:\n".
" Could not dump table images\n");
DBQueryWarn("select v.* from images as i ".
"left join image_versions as v on ".
" v.imageid=i.imageid and v.version=i.version ".
"where (i.pid='$pid' or (i.pid='$TBOPSPID' and v.global=1)) ".
" and decryption_key is null ".
"into outfile '$statedir/image_versions'")
or die("*** $0:\n".
" Could not dump table image_versions\n");
DBQueryWarn("select o.* from os_info as o ".
"left join os_info_versions as v on ".
" v.osid=o.osid and v.vers=o.version ".
"where o.pid='$pid' or (o.pid='$TBOPSPID' and v.shared=1) ".
"into outfile '$statedir/os_info'")
or die("*** $0:\n".
" Could not dump table os_info\n");
DBQueryWarn("create temporary table temp_os_info ".
"select v.* from os_info as o ".
"left join os_info_versions as v on ".
" v.osid=o.osid and v.vers=o.version ".
"where o.pid='$pid' or (o.pid='$TBOPSPID' and v.shared=1)")
or die("*** $0:\n".
" Could not create table temp_os_info\n");
# Ack. The MFS paths have a hardcoded "boss" in them, but that is going
# to resolve incorrectly to an inner control IP, which will not work
# from the pxeboot kernel since it uses the outer control network.
# Just remove the host spec; pxeboot will do the right thing.
my $query_result =
DBQueryFatal("select osid,path from temp_os_info ".
"where path like '%:%'");
while (my ($osid,$hostpath) = $query_result->fetchrow_array()) {
my ($host,$path) = $hostpath =~ /^(.*):(.*)$/;
DBQueryFatal("update temp_os_info set path='$path' where osid='$osid'");
}
DBQueryWarn("select * from temp_os_info ".
"into outfile '$statedir/os_info_versions'")
or die("*** $0:\n".
" Could not dump table os_info_versions\n");
DBQueryWarn("select o.* from osidtoimageid as o ".
"left join image_versions as i on i.imageid=o.imageid ".
"where i.pid='$pid' or (i.pid='$TBOPSPID' and i.global=1) ".
"into outfile '$statedir/osidtoimageid'")
or die("*** $0:\n".
" Could not dump table osidtoimageid\n");
# Subosids. Only take the mapping to parents for those children that
# are in the e-in-e pid or are in emulab-ops and are shared.
DBQueryWarn("select osm.* from os_submap as osm ".
"left join os_info as osi on osm.osid=osi.osid ".
"left join os_info_versions as osv on ".
" osv.osid=osi.osid and osv.vers=osi.version ".
"where osi.pid='$pid' or (osi.pid='$TBOPSPID' and osv.shared=1) ".
"into outfile '$statedir/os_submap'")
or die("*** $0:\n".
" Could not dump table os_submap\n");
#
# interfaces table. Need to tag the interfaces being used as the control
# network, with the proper tag so they do not say they experimental
......
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