Commit 67cd8518 authored by Leigh Stoller's avatar Leigh Stoller

Pull nodetype from tmcd fullconfig instead of ltpmap.

parent 61dd9317
......@@ -62,7 +62,7 @@ use Exporter;
TMGATEDCONFIG TMSYNCSERVER TMKEYHASH TMNODEID TMNODEUUID TMEVENTKEY
TMCREATOR TMSWAPPER TMFWCONFIG TMGENVNODECONFIG
TMSTORAGEMAP TMDISKINFO TMEXTRAFS
INXENVM INVZVM INDOCKERVM
INXENVM INVZVM INDOCKERVM TMNODETYPE
);
# Must come after package declaration!
......@@ -382,6 +382,7 @@ sub TMSYNCSERVER() { CONFDIR() . "/syncserver";}
sub TMKEYHASH() { CONFDIR() . "/keyhash";}
sub TMEVENTKEY() { CONFDIR() . "/eventkey";}
sub TMNODEID() { CONFDIR() . "/nodeid";}
sub TMNODETYPE() { CONFDIR() . "/nodetype";}
sub TMNODEUUID() { CONFDIR() . "/nodeuuid";}
sub TMROLE() { CONFDIR() . "/role";}
sub TMSIMRC() { CONFDIR() . "/rc.simulator";}
......@@ -746,6 +747,7 @@ sub donodeid()
# Do this too.
donodeuuid();
donodetype();
if (tmcc(TMCCCMD_NODEID, undef, \@tmccresults) < 0) {
warn("*** WARNING: Could not get nodeid from server!\n");
......@@ -772,6 +774,39 @@ sub donodeid()
return 0;
}
#
# Get the nodetype
#
sub donodetype()
{
my $nodetype;
my @tmccresults;
if (tmcc(TMCCCMD_NODETYPE, undef, \@tmccresults) < 0) {
warn("*** WARNING: Could not get nodetype from server!\n");
return -1;
}
return 0
if (! @tmccresults);
#
# There should be just one string. Ignore anything else.
#
if ($tmccresults[0] =~ /([-\w]*)/) {
$nodetype = $1;
}
else {
warn "*** WARNING: Bad nodetype line: $tmccresults[0]";
return -1;
}
system("echo '$nodetype' > ". TMNODETYPE);
if ($?) {
warn "*** WARNING: Could not write nodetype to " . TMNODETYPE() . "\n";
}
return 0;
}
#
# Get the nodeuuid
#
......
#!/usr/bin/perl -wT
#
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
# Copyright (c) 2000-2016, 2018 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -55,6 +55,7 @@ use Exporter;
TMCCCMD_NODEUUID TMCCCMD_NODEATTRIBUTES TMCCCMD_DISKS
TMCCCMD_ARPINFO TMCCCMD_STORAGE TMCCCMD_IMAGESIZE
TMCCCMD_PNETNODEATTRS TMCCCMD_SERVINCEINFO TMCCCMD_PUBLICADDRINFO
TMCCCMD_NODETYPE
);
# Must come after package declaration!
......@@ -180,6 +181,7 @@ my %commandset =
"syncserver" => {TAG => "syncserver"},
"keyhash" => {TAG => "keyhash"},
"nodeid" => {TAG => "nodeid"},
"nodetype" => {TAG => "nodetype"},
"ipodinfo" => {TAG => "ipodinfo", PERM => "0600"},
"ntpinfo" => {TAG => "ntpinfo"},
"ntpdrift" => {TAG => "ntpdrift"},
......@@ -261,6 +263,7 @@ sub TMCCCMD_PROGRAMS() { $commandset{"programs"}->{TAG}; }
sub TMCCCMD_SYNCSERVER(){ $commandset{"syncserver"}->{TAG}; }
sub TMCCCMD_KEYHASH() { $commandset{"keyhash"}->{TAG}; }
sub TMCCCMD_NODEID() { $commandset{"nodeid"}->{TAG}; }
sub TMCCCMD_NODETYPE() { $commandset{"nodetype"}->{TAG}; }
sub TMCCCMD_NTPINFO() { $commandset{"ntpinfo"}->{TAG}; }
sub TMCCCMD_NTPDRIFT() { $commandset{"ntpdrift"}->{TAG}; }
sub TMCCCMD_EVENTKEY() { $commandset{"eventkey"}->{TAG}; }
......
#!/bin/sh
#
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# Copyright (c) 2000-2011, 2018 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -23,6 +23,13 @@
#
. /etc/emulab/paths.sh
# We can ditch this script, I think.
if [ -r $BOOTDIR/nodeid -a -r $BOOTDIR/nodetype ]; then
nt=`cat $BOOTDIR/nodetype`
echo $nt
exit 0
fi
# Why am I trying to fix this script!?
if [ -r $BOOTDIR/nodeid -a -r $BOOTDIR/ltpmap ]; then
nid=`cat $BOOTDIR/nodeid`
......
#!/bin/sh
#
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# Copyright (c) 2000-2011, 2018 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -23,6 +23,13 @@
#
. /etc/emulab/paths.sh
# We can ditch this script, I think.
if [ -r $BOOTDIR/nodeid -a -r $BOOTDIR/nodetype ]; then
nt=`cat $BOOTDIR/nodetype`
echo $nt
exit 0
fi
# Why am I trying to fix this script!?
if [ -r $BOOTDIR/nodeid -a -r $BOOTDIR/ltpmap ]; then
nid=`cat $BOOTDIR/nodeid`
......
#!/bin/sh
#
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2002, 2018 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -23,6 +23,13 @@
#
. /etc/emulab/paths.sh
# We can ditch this script, I think.
if [ -r $BOOTDIR/nodeid -a -r $BOOTDIR/nodetype ]; then
nt=`cat $BOOTDIR/nodetype`
echo $nt
exit 0
fi
if [ -x $BINDIR/cpuspeed.awk ]; then
cpuspeed=`$BINDIR/cpuspeed.awk /var/run/dmesg.boot`;
else
......
......@@ -313,6 +313,7 @@ static event_handle_t event_handle = NULL;
COMMAND_PROTOTYPE(doreboot);
COMMAND_PROTOTYPE(donodeid);
COMMAND_PROTOTYPE(donodetype);
COMMAND_PROTOTYPE(donodeuuid);
COMMAND_PROTOTYPE(domanifest);
COMMAND_PROTOTYPE(dostatus);
......@@ -454,6 +455,7 @@ struct command {
} command_array[] = {
{ "reboot", FULLCONFIG_NONE, 0, doreboot },
{ "nodeid", FULLCONFIG_ALL, 0, donodeid },
{ "nodetype", FULLCONFIG_ALL, 0, donodetype },
{ "nodeuuid", FULLCONFIG_ALL, 0, donodeuuid },
{ "manifest", FULLCONFIG_ALL, 0, domanifest },
{ "status", FULLCONFIG_NONE, 0, dostatus },
......@@ -1628,6 +1630,18 @@ COMMAND_PROTOTYPE(donodeid)
return 0;
}
/*
* Return emulab node type.
*/
COMMAND_PROTOTYPE(donodetype)
{
char buf[MYBUFSIZE];
OUTPUT(buf, sizeof(buf), "%s\n", reqp->type);
client_writeback(sock, buf, strlen(buf), tcp);
return 0;
}
/*
* Return emulab node uuid.
*/
......
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