Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
82321694
Commit
82321694
authored
Sep 29, 2004
by
Mike Hibler
Browse files
Add hostinfo command for host to return..um, info. Right now returns
CDVERSION= for CD-booted machines.
parent
934eb81e
Changes
3
Hide whitespace changes
Inline
Side-by-side
tmcd/common/libtmcc.pm
View file @
82321694
...
...
@@ -28,7 +28,7 @@ use Exporter;
TMCCCMD_NTPINFO TMCCCMD_NTPDRIFT TMCCCMD_EVENTKEY TMCCCMD_ROUTELIST
TMCCCMD_ROLE TMCCCMD_RUSAGE TMCCCMD_WATCHDOGINFO TMCCCMD_HOSTKEYS
TMCCCMD_FIREWALLINFO TMCCCMD_EMULABCONFIG
TMCCCMD_CREATOR
TMCCCMD_CREATOR
TMCCCMD_HOSTINFO
)
;
# Must come after package declaration!
...
...
@@ -158,6 +158,7 @@ my %commandset =
"
firewallinfo
"
=>
{
TAG
=>
"
firewallinfo
"},
"
emulabconfig
"
=>
{
TAG
=>
"
emulabconfig
"},
"
creator
"
=>
{
TAG
=>
"
creator
"},
"
hostinfo
"
=>
{
TAG
=>
"
hostinfo
"},
);
#
...
...
@@ -204,6 +205,7 @@ sub TMCCCMD_HOSTKEYS() { $commandset{"hostkeys"}->{TAG}; }
sub
TMCCCMD_FIREWALLINFO
(){
$commandset
{"
firewallinfo
"}
->
{
TAG
};
}
sub
TMCCCMD_EMULABCONFIG
(){
$commandset
{"
emulabconfig
"}
->
{
TAG
};
}
sub
TMCCCMD_CREATOR
(){
$commandset
{"
creator
"}
->
{
TAG
};
}
sub
TMCCCMD_HOSTINFO
(){
$commandset
{"
hostinfo
"}
->
{
TAG
};
}
#
# Caller uses this routine to set configuration of this library
...
...
tmcd/freebsd/cdboot/rc.cdboot
View file @
82321694
...
...
@@ -136,6 +136,16 @@ sub doboot()
$bootdev
=
WhichRawDisk
();
print
("
Using
$bootdev
for config sector ...
\n
");
#
# Report back the CD version
# XXX may want to consider not doing then on every boot
#
if
(
-
e
"
$ETCDIR
/emuboot-volid
")
{
my
$cdversion
=
`
cat
$ETCDIR
/emuboot-volid
`;
chomp
(
$cdversion
);
tmcc
(
TMCCCMD_HOSTINFO
,
"
CDVERSION=
$cdversion
");
}
bootinfo:
#
# If this is first install on this disk, or if the disk has just been
...
...
tmcd/tmcd.c
View file @
82321694
...
...
@@ -226,6 +226,7 @@ COMMAND_PROTOTYPE(dodoginfo);
COMMAND_PROTOTYPE
(
dohostkeys
);
COMMAND_PROTOTYPE
(
dotmcctest
);
COMMAND_PROTOTYPE
(
dofwinfo
);
COMMAND_PROTOTYPE
(
dohostinfo
);
/*
* The fullconfig slot determines what routines get called when pushing
...
...
@@ -300,6 +301,7 @@ struct command {
{
"hostkeys"
,
FULLCONFIG_NONE
,
0
,
dohostkeys
},
{
"tmcctest"
,
FULLCONFIG_NONE
,
F_MINLOG
,
dotmcctest
},
{
"firewallinfo"
,
FULLCONFIG_ALL
,
0
,
dofwinfo
},
{
"hostinfo"
,
FULLCONFIG_NONE
,
0
,
dohostinfo
},
};
static
int
numcommands
=
sizeof
(
command_array
)
/
sizeof
(
struct
command
);
...
...
@@ -5027,6 +5029,28 @@ COMMAND_PROTOTYPE(dodoginfo)
return
0
;
}
/*
* Stash info returned by the host into the DB
* Right now we only recognize CDVERSION=<str> for CD booted systems.
*/
COMMAND_PROTOTYPE
(
dohostinfo
)
{
char
*
bp
,
buf
[
MYBUFSIZE
];
bp
=
rdata
;
if
(
sscanf
(
bp
,
"CDVERSION=%31[a-zA-Z0-9-]"
,
buf
)
==
1
)
{
if
(
verbose
)
info
(
"HOSTINFO CDVERSION=%s
\n
"
,
buf
);
if
(
mydb_update
(
"update nodes set cd_version='%s' "
"where node_id='%s'"
,
buf
,
reqp
->
nodeid
))
{
error
(
"HOSTINFO: %s: DB update failed
\n
"
,
reqp
->
nodeid
);
return
1
;
}
}
return
0
;
}
/*
* XXX Stash ssh host keys into the DB.
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment