From 59738f65f91407a39d0e65a0eeababa11e10c26f Mon Sep 17 00:00:00 2001 From: cxhong Date: Mon, 10 Jul 2017 23:17:15 -0400 Subject: [PATCH] Configure Cumulus switch via switchdiscover --setup options (#3375) --- .../lib/xcat/plugins/switchdiscover.pm | 4 +++- xCAT-server/share/xcat/scripts/configonie | 23 ++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index 70970480d..cef5c4801 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -1428,7 +1428,9 @@ sub switchsetup { if (-r -x $config_script) { my $switches = join(",",@{${nodes_to_config}->{$mytype}}); if ($mytype eq "onie") { - send_msg($request, 0, "onie switch needs to take 50 mins to install, please run /opt/xcat/share/xcat/script/configonie after Cumulus OS installed on switch\n"); + send_msg($request, 0, "Call to config $switches\n"); + my $out = `$config_script --switches $switches --all`; + send_msg($request, 0, "output = $out\n"); } else { send_msg($request, 0, "call to config $mytype switches $switches\n"); my $out = `$config_script --switches $switches --all`; diff --git a/xCAT-server/share/xcat/scripts/configonie b/xCAT-server/share/xcat/scripts/configonie index f3e49a59b..c113e7c9a 100755 --- a/xCAT-server/share/xcat/scripts/configonie +++ b/xCAT-server/share/xcat/scripts/configonie @@ -99,16 +99,17 @@ if (($::SSH) || ($::ALL)) config_ssh(); } -if (($::LICENSE) || ($::ALL)) +if ($::LICENSE) { install_license(); } -if (($::SNMP) || ($::ALL)) +if ($::SNMP) { config_snmp(); } -if (($::NTP) || ($::ALL)) + +if ($::NTP) { config_ntp(); } @@ -171,9 +172,19 @@ sub config_ssh { if (@config_switches) { #update switch status my $csw = join(",",@config_switches); - $cmd = "chdef $csw status=ssh_configed "; + $cmd = "chdef $csw status=ssh_configured otherinterfaces="; $rc= xCAT::Utils->runcmd($cmd, 0); print "ssh configured for $csw\n"; + if ($::ALL) { + $cmd = "updatenode $csw -P hardeths,enablesnmp,configinterface"; + $rc= xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message("E","Failed to run updatenode, please check the switch"); + } + $cmd = "chdef $csw status=configured"; + $rc= xCAT::Utils->runcmd($cmd, 0); + print "switch: $csw configured\n"; + } } } @@ -369,7 +380,7 @@ sub config_ntp { if (@config_switches) { #update switch status my $csw = join(",",@config_switches); - $cmd = "chdef $csw status=ntp_configed"; + $cmd = "chdef $csw status=ntp_configured"; $rc= xCAT::Utils->runcmd($cmd, 0); } @@ -394,7 +405,7 @@ sub usage configonie --switches switchnames --snmp configonie --switches switchnames --ntp - To set ssh, install license(license file: /root/license.txt), config snmp and ntp: + To setup ssh passwordless, change ip to static, enable snmp configuration and configure basic interface : configonie --switches switchnames --all \n"; }