Commit 272b2e25 authored by Leigh Stoller's avatar Leigh Stoller

Fixes to noipmi; watch for timeout cause ILO is dead. This

appears to happen quite a bit. Sigh.

Also turn off SNMP, but watch for old ilo, which returns
Feature Not Supported (no snmp at all).

Install the xml files so that the script can be run outside
of the build directory.
parent 0639a119
#
# Copyright (c) 2000-2012 University of Utah and the Flux Group.
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -50,7 +50,8 @@ all: $(TARGETS) all-subdirs
include $(TESTBED_SRCDIR)/GNUmakerules
install: $(INSTALL_LIBDIR)/libinstall.pm \
install: install-subdirs \
$(INSTALL_LIBDIR)/libinstall.pm \
$(INSTALL_LIBDIR)/installvars.pm \
$(INSTALL_SBINDIR)/update-install \
$(INSTALL_SBINDIR)/update-testbed \
......
#
# Copyright (c) 2000-2013 University of Utah and the Flux Group.
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -27,7 +27,8 @@ SUBDIR = install/genirack
include $(OBJDIR)/Makeconf
TARGETS = initnodes.pl initilo.pl mknewconfig
TARGETS = initnodes.pl initilo.pl mknewconfig
LIBFILES = addsshkey.xml resetilo.xml chpswd.xml noipmi.xml setupilo.xml
#
# Force dependencies on the scripts so that they will be rerun through
......@@ -37,7 +38,13 @@ all: $(TARGETS)
include $(TESTBED_SRCDIR)/GNUmakerules
install: $(INSTALL_SBINDIR)/initilo.pl
install: $(INSTALL_SBINDIR)/initilo.pl \
$(addprefix $(INSTALL_LIBDIR)/ilo/, $(LIBFILES))
clean:
rm -f $(TARGETS)
$(INSTALL_LIBDIR)/ilo/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_LIBDIR)/ilo
$(INSTALL) $< $@
......@@ -61,7 +61,7 @@ my $tempfile = "/tmp/$$.xml";
my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
my $ILOPSWD = "$TB/etc/ilo.pswd";
my $SRCDIR = "@srcdir@";
my $XMLDIR = "$TB/lib/ilo";
my $CURL = "/usr/local/bin/curl";
my $DSAKEY = "/root/.ssh/id_dsa";
my $SUDO = "/usr/local/bin/sudo";
......@@ -143,11 +143,11 @@ my $elabmanpswd = `cat $ILOPSWD`;
chomp($elabmanpswd);
# The XML goo.
my $setupgoo = `cat $SRCDIR/setupilo.xml`;
my $resetgoo = `cat $SRCDIR/resetilo.xml`;
my $chpswdgoo = `cat $SRCDIR/chpswd.xml`;
my $sshkeygoo = `cat $SRCDIR/addsshkey.xml`;
my $noipmigoo = `cat $SRCDIR/noipmi.xml`;
my $setupgoo = `cat $XMLDIR/setupilo.xml`;
my $resetgoo = `cat $XMLDIR/resetilo.xml`;
my $chpswdgoo = `cat $XMLDIR/chpswd.xml`;
my $sshkeygoo = `cat $XMLDIR/addsshkey.xml`;
my $noipmigoo = `cat $XMLDIR/noipmi.xml`;
# The pubkey.
my $pubkey = `cat ${DSAKEY}.pub`;
......@@ -180,9 +180,14 @@ if ($dooutlet) {
}
if ($noipmi) {
usage()
if (@ARGV != 1);
if (!@ARGV);
exit(NoIPMI($ARGV[0], $elabmanpswd));
while (@ARGV) {
my $who = shift(@ARGV);
NoIPMI($who, $elabmanpswd);
}
exit(0);
}
if ($doilokey) {
usage()
......@@ -408,12 +413,15 @@ sub SendXML($$)
#
# Ship this off with curl.
#
my $cmd = "$CURL -k --data-binary \@${tempfile} https://$ip/ribcl";
my $cmd = "$CURL -m 15 -k --data-binary \@${tempfile} https://$ip/ribcl";
print "$cmd\n";
if (!$impotent) {
my $output = emutil::ExecQuiet($cmd);
if ($?) {
print $output;
if ($? >> 8 == 28) {
return 28;
}
Fatal("ribcl failed");
}
my @lines = split('\n', $output);
......@@ -427,6 +435,9 @@ sub SendXML($$)
my $line = shift(@lines);
$line =~ s/\s*MESSAGE=//;
print "$line\n";
if ($line =~ /not supported/i) {
return 1;
}
Fatal("ribcl failed");
}
}
......@@ -565,7 +576,7 @@ sub NoIPMI($$)
$iloIP = $nodeid;
}
else {
my $node = Node->Lookup($ARGV[0]);
my $node = Node->Lookup($nodeid);
if (!defined($node)) {
Fatal("No such node");
}
......@@ -577,8 +588,11 @@ sub NoIPMI($$)
$iloIP = $management_interface->IP();
}
my $xmlgoo = sprintf($noipmigoo, $pswd);
if (SendXML($iloIP, $xmlgoo)) {
Fatal("Failed to send xmlgoo to $iloIP");
if (my $ret = SendXML($iloIP, $xmlgoo)) {
print STDERR "Failed to send xmlgoo to $nodeid ($iloIP)\n"
if ($ret == 28);
exit(1)
if ($ret < 0);
}
return 0;
}
......@@ -6,6 +6,7 @@
<!-- Set the autologout timeout to 120 minutes -->
<MOD_GLOBAL_SETTINGS>
<IPMI_DCMI_OVER_LAN_ENABLED value="N"/>
<SNMP_ACCESS_ENABLED value="N"/>
</MOD_GLOBAL_SETTINGS>
</RIB_INFO>
</LOGIN>
......
......@@ -24,6 +24,7 @@
<MOD_GLOBAL_SETTINGS>
<SESSION_TIMEOUT value="120"/>
<IPMI_DCMI_OVER_LAN_ENABLED value="N"/>
<SNMP_ACCESS_ENABLED value="N"/>
</MOD_GLOBAL_SETTINGS>
</RIB_INFO>
</LOGIN>
......
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