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
b81402d7
Commit
b81402d7
authored
Aug 09, 2013
by
Leigh B Stoller
Browse files
Add option to reset the ilo so that it reboots. Capture license key
from control node.
parent
a7eda783
Changes
1
Hide whitespace changes
Inline
Side-by-side
install/genirack/initilo.pl.in
View file @
b81402d7
...
...
@@ -33,22 +33,25 @@ use POSIX ":sys_wait_h";
# Setup management interfaces for nodes, given a data file we get
# from HP.
#
# This needs to be redone as a library!
#
sub
usage
()
{
print
STDERR
"
Usage: initilo.pl [-d] [-n] <ilopswd> <nodeid>
\n
";
print
STDERR
"
Usage: initilo.pl [-d] [-n] -b <nodeid>
\n
";
print
STDERR
"
Usage: initilo.pl [-d] [-n] -o <nodeid>
\n
";
print
STDERR
"
Usage: initilo.pl [-d] [-n] -k <nodeid> ...
\n
";
print
STDERR
"
Usage: initilo.pl [-d] [-n] -c <ip> <ilopswd>
\n
";
print
STDERR
"
Usage: initilo.pl [-d] [-n]
[
-c
| -r]
<ip> <ilopswd>
\n
";
exit
(
-
1
);
}
my
$optlist
=
"
dncobsk
";
my
$optlist
=
"
dncobsk
r
";
my
$debug
=
0
;
my
$impotent
=
0
;
my
$control
=
0
;
my
$dooutlet
=
0
;
my
$doilokey
=
0
;
my
$bootorder
=
0
;
my
$resetilo
=
0
;
my
$tempfile
=
"
/tmp/$$.xml
";
#
...
...
@@ -70,6 +73,7 @@ sub SendXML($$);
sub
SetupControlNode
($$);
sub
DoOutlet
($);
sub
DoIloKey
($);
sub
DoResetILO
($$);
# un-taint path
$ENV
{'
PATH
'}
=
'
/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/site/bin
';
...
...
@@ -116,6 +120,9 @@ if (defined($options{"b"})) {
if
(
defined
(
$options
{"
o
"}))
{
$dooutlet
=
1
;
}
if
(
defined
(
$options
{"
r
"}))
{
$resetilo
=
1
;
}
Fatal
("
$ILOPSWD
does not exist
")
if
(
!
-
e
$ILOPSWD
);
...
...
@@ -153,6 +160,12 @@ if ($control) {
exit
(
SetupControlNode
(
$ARGV
[
0
],
$ARGV
[
1
]));
}
if
(
$resetilo
)
{
usage
()
if
(
@ARGV
!=
2
);
exit
(
DoResetILO
(
$ARGV
[
0
],
$ARGV
[
1
]));
}
if
(
$dooutlet
)
{
usage
()
if
(
@ARGV
!=
1
);
...
...
@@ -241,13 +254,17 @@ if (ChangeBootOrder($iloIP)) {
Fatal
("
Failed to change the boot order on
$iloIP
")
}
#
# Harvest the ILO license key.
#
DoIloKey
(
$node_id
);
#
# This resets the ilo.
#
$xmlgoo
=
sprintf
(
$resetgoo
,
$elabmanpswd
);
if
(
SendXML
(
$iloIP
,
$xmlgoo
))
{
Fatal
("
Failed to send xmlgoo to
$iloIP
");
}
DoResetILO
(
$iloIP
,
$elabmanpswd
);
exit
(
0
);
#
# SSH over to change the boot order,
...
...
@@ -438,6 +455,15 @@ sub SetupControlNode($$)
if
(
SendXML
(
$ip
,
$xmlgoo
))
{
Fatal
("
Failed to send addsshkey xml to
$ip
");
}
#
# Save this off. Maybe we should put the control node into the
# Emulab DB?
#
my
$cmd
=
"
wget -q -O - --no-check-certificate
"
.
"
'https://
$ip
/xmldata?item=CpqKey' >
$TB
/etc/control-ilo.txt
";
if
(
system
(
$cmd
))
{
Fatal
("
Failed to get control node ilo key info
");
}
return
0
;
}
...
...
@@ -500,3 +526,18 @@ sub DoIloKey($)
"
node_id='
$node_id
', keytype='ilo', keydata=
$safe_ilokey
");
return
0
;
}
#
# Reset the ILO.
#
sub
DoResetILO
($$)
{
my
(
$ip
,
$pswd
)
=
@_
;
my
$xmlgoo
=
sprintf
(
$resetgoo
,
$pswd
);
if
(
SendXML
(
$ip
,
$xmlgoo
))
{
Fatal
("
Failed to send xmlgoo to
$ip
");
}
return
0
;
}
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