Commit b2c92d3e authored by Mike Hibler's avatar Mike Hibler

Added "admin MFS OSID" and "disk loader MFS OSID" fields to node_types

so that different types can use different MFSes as necessary.  This
ultimately replaces the quadruple-X libos hack which I removed quite some
time ago.
parent bd627836
......@@ -138,7 +138,7 @@ use vars qw(@ISA @EXPORT);
TBNodeEventStateUpdated
TBSetNodeAllocState TBGetNodeAllocState
TBSetNodeOpMode TBGetNodeOpMode TBSetNodeNextOpMode
TB_OSID_MBKERNEL TB_OSID_PXEBOOT TB_OSID_FRISBEE
TB_OSID_MBKERNEL
TB_OSID_FREEBSD_MFS TB_OSID_FRISBEE_MFS
TBBootWhat TBNodeStateTimeout
TBDB_TBCONTROL_RESET TBDB_TBCONTROL_RELOADDONE
......@@ -176,6 +176,7 @@ use vars qw(@ISA @EXPORT);
TBClearExptFirewallVlan
TBNodeSubNodes
TBNodeAdminOSID TBNodeDiskloadOSID
TBNodeType TBNodeTypeProcInfo TBNodeTypeBiosWaittime
TBExptRemoveVirtualState TBExptBackupVirtualState
......@@ -453,8 +454,6 @@ sub TB_OSID_MAX() { TB_OSID_DESTROY; }
# Magic OSID constants
sub TB_OSID_MBKERNEL() { "_KERNEL_"; } # multiboot kernel OSID
sub TB_OSID_PXEBOOT() { "PXEBOOT"; } # osid for def pxe_boot_path
sub TB_OSID_FRISBEE() { "PXEFRISBEE"; }
# Magic MFS constants
sub TB_OSID_FREEBSD_MFS() { "FREEBSD-MFS" };
......@@ -3337,6 +3336,42 @@ sub TBNodeType($)
}
}
sub TBNodeAdminOSID($)
{
my ($node) = @_;
my $result = DBQueryFatal("SELECT nt.adminmfs_osid FROM node_types AS nt ".
"LEFT JOIN nodes as n on nt.type = n.type ".
"WHERE n.node_id='$node'");
if ($result->num_rows() != 1) {
return undef;
}
my ($mfs) = $result->fetchrow();
if (!$mfs) {
$mfs = TB_OSID_FREEBSD_MFS();
}
return $mfs;
}
sub TBNodeDiskloadOSID($)
{
my ($node) = @_;
my $result = DBQueryFatal("SELECT nt.diskloadmfs_osid FROM node_types AS nt ".
"LEFT JOIN nodes as n on nt.type = n.type ".
"WHERE n.node_id='$node'");
if ($result->num_rows() != 1) {
return undef;
}
my ($mfs) = $result->fetchrow();
if (!$mfs) {
$mfs = TB_OSID_FRISBEE_MFS();
}
return $mfs;
}
#
# Return a node's type CPU type and speed, in a two-element array
# Returns undef if the type can't be found
......
......@@ -1142,6 +1142,8 @@ CREATE TABLE node_types (
trivlink_maxspeed int(11) unsigned NOT NULL default '0',
isrebootable tinyint(1) default '1',
bios_waittime int(10) unsigned default NULL,
adminmfs_osid varchar(35) default 'FREEBSD-MFS',
diskloadmfs_osid varchar(35) default 'FRISBEE-MFS',
PRIMARY KEY (type)
) TYPE=MyISAM;
......
......@@ -2836,3 +2836,10 @@ last_net_act,last_cpu_act,last_ext_act);
default NULL after destination_orientation;
alter table nodes add service_tag varchar(32) \
default NULL after serial;
4.14: Add disk loader and admin MFS fields to node_types.
alter table node_types add adminmfs_osid varchar(35) \
default 'FREEBSD-MFS' after bios_waittime;
alter table node_types add diskloadmfs_osid varchar(35) \
default 'FRISBEE-MFS' after adminmfs_osid;
......@@ -37,7 +37,6 @@ my $MAXRETRIES = 1;
my $FRISBEELAUNCHER = "$TB/sbin/frisbeelauncher";
my $osselect = "$TB/bin/os_select";
my $TBUISP = "$TB/bin/tbuisp";
my $FRISBEEOSID = TB_OSID_FRISBEE_MFS();
# Locals
my %imageinfo = (); # Per imageid DB info.
......@@ -431,7 +430,7 @@ sub osload ($$) {
= GetNodesRequiringReboot(\%reload_info, @nodes);
if (@$reboot_nodes) {
# Reboot them all.
print "osload: Issuing reboot for @nodes and then waiting ...\n";
print "osload: Issuing reboot for @$reboot_nodes and then waiting ...\n";
my %reboot_args = ();
my %reboot_failures = ();
......@@ -649,7 +648,7 @@ sub WaitTillReloadDone($$$@)
sub SetupReloadFrisbee($$$$)
{
my ($node, $imageid, $osid_notused, $zerofree) = @_;
my $osid = $FRISBEEOSID;
my $osid = TBNodeDiskloadOSID($node);
#
# Put it in the current_reloads table so that nodes can find out which
......
......@@ -74,7 +74,6 @@ my %imageid_row = ();
my $debug = 0;
my $imageid;
my $imagepid = TB_OPSPID;
my $ADMINOSID = TB_OSID_FREEBSD_MFS;
my $logname;
my @row;
my $dbuid;
......@@ -401,9 +400,10 @@ my $maxslack = (3 * 60) / $sleepwait; # NFS cache slop factor
#
$needcleanup = 1;
my $adminmfs = TBNodeAdminOSID($node);
while ($tries) {
system("$osselect -t $ADMINOSID $node") and
fatal("*** Failed to set temp boot to $ADMINOSID for $node!");
system("$osselect -t $adminmfs $node") and
fatal("*** Failed to set temp boot to $adminmfs for $node!");
print "Setting startupcmd to '${command}'\n";
......
......@@ -176,15 +176,18 @@ NODE: foreach my $node_id (@node_ids) {
# Make sure that the new node is of a valid type, and grab a few other
# things to fill in as initial values
#
$query_result = DBQueryFatal("SELECT control_iface,virtnode_capacity ".
$query_result = DBQueryFatal("SELECT control_iface,virtnode_capacity,adminmfs_osid ".
"FROM node_types WHERE type='$type'");
if (!$query_result->num_rows()) {
warn "Node $node_id failed: Type $type does not exist!\n";
next NODE;
}
my ($control_iface,$virtnode_capacity) = $query_result->fetchrow();
my ($control_iface,$virtnode_capacity,$admin_mfs) =
$query_result->fetchrow();
$virtnode_capacity = 0
if (!defined($virtnode_capacity));
$admin_mfs = $MFS_INITIAL
if (!defined($admin_mfs));
#
# Grab the node's MACs from the new_interfaces table
......@@ -266,7 +269,7 @@ NODE: foreach my $node_id (@node_ids) {
if ($role eq "ctrlnode") {
$osid = $OS_OPSNODE;
} else {
$osid = $MFS_INITIAL;
$osid = $admin_mfs;
}
#
......
......@@ -53,7 +53,6 @@ delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
#
my $nodereboot = "$TB/bin/node_reboot";
my $osselect = "$TB/bin/os_select";
my $ADMINOSID = TB_OSID_FREEBSD_MFS;
my @nodes = ();
#
......@@ -163,9 +162,17 @@ else {
# Switcheroo the osids on the nodes.
if ($onoff eq "on") {
system("$osselect -t $ADMINOSID @nodes") and
my %adminosid = ();
for my $node (@nodes) {
my $osid = TBNodeAdminOSID($node);
push @{$adminosid{$osid}}, $node;
}
for my $osid (keys %adminosid) {
my @n = @{$adminosid{$osid}};
system("$osselect -t $osid @n") and
die("*** $0:\n".
" Failed to set temp boot to $ADMINOSID for some nodes!\n");
" Failed to set temp boot to $osid for some of: @n\n");
}
}
else {
system("$osselect -c -t @nodes") and
......
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