diff --git a/xCAT-web/lib/functions.php b/xCAT-web/lib/functions.php index 3f06126e7..5f4d65168 100644 --- a/xCAT-web/lib/functions.php +++ b/xCAT-web/lib/functions.php @@ -452,6 +452,10 @@ function dumpGlobals() { foreach ($_POST as $key => $val) { trace("$key=$val."); } trace('$_COOKIE:'); foreach ($_COOKIE as $key => $val) { trace("$key=$val."); } + trace('$_ENV:'); + foreach ($_ENV as $key => $val) { trace("$key=$val."); } + trace('$_SERVER:'); + foreach ($_SERVER as $key => $val) { trace("$key=$val."); } if (isset($_SESSION)) { trace('$_SESSION:'); foreach ($_SESSION as $key => $val) { trace("$key=$val."); } diff --git a/xCAT-web/lib/phpinfo.php b/xCAT-web/lib/phpinfo.php index 87f26f583..e97e4f660 100644 --- a/xCAT-web/lib/phpinfo.php +++ b/xCAT-web/lib/phpinfo.php @@ -11,7 +11,7 @@ echo "
\n"; //insertLogin(); dumpGlobals(); -echo ''; print_r($_SESSION['editable-hosts']); echo "
\n"; +//echo ''; print_r($_SESSION['editable-hosts']); echo "
\n"; //foreach ($_SESSION['editable-deps'] as $key => $val) { trace("$key=$val."); } /* diff --git a/xCAT-web/lib/wizard.css b/xCAT-web/lib/wizard.css index 2378af087..918217f2f 100644 --- a/xCAT-web/lib/wizard.css +++ b/xCAT-web/lib/wizard.css @@ -52,7 +52,7 @@ .WizardProgressTable P#output { margin-left: 35px; } -.WizardProgressTable IFRAME#output { margin-left: 35px; width: 400px; } +.WizardProgressTable IFRAME#output { margin-left: 35px; width: 400px; height: 400px; } .WizardProgressOutput { margin: 0px; } diff --git a/xCAT-web/machines/discover.php b/xCAT-web/machines/discover.php index 59f1dd4b9..0d0773202 100644 --- a/xCAT-web/machines/discover.php +++ b/xCAT-web/machines/discover.php @@ -117,26 +117,6 @@ echo "", implode(',',$hmcs), "
\n"; -$total = count($hmcs) + count($bpas) + count($fsps); +$total = count($hmcs) + count($bpas); if (!$_SESSION['portsPerSwitch']) { $numswitches = 1; } else { $numswitches = (integer) ((($total-1) / $_SESSION['portsPerSwitch']) + 1); } //echo "$numswitches
\n"; @@ -171,6 +153,7 @@ foreach ($switches as $k => $sw) { echo "
Discovered and defined ", $_SESSION['hmcHostname'], ".
\n"; myflush(); +$discoveryIP = @$_SESSION["discoveryIP"]; +// Discover HMCs +$xml = docmd('nodeadd',NULL,array($_SESSION['hmcHostname'],'groups=hmc,all','nodetype.nodetype=hmc','nodehm.mgt=hmc')); +if (getXmlErrors($xml,$errors)) { msg('E',"nodeadd hmc failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; } +echo "Defined ", $_SESSION['hmcHostname'], ".
\n"; myflush(); + +echo "Discovering HMCs...
\n"; myflush(); +$xml = docmd('lsslp','',array('-s','HMC','-w','-H','-i',$discoveryIP,'-t','3')); +if (getXmlErrors($xml,$errors)) { msg('E',"lsslp HMC failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; } +$numfound = 0; +foreach ($xml->children() as $response) foreach ($response->children() as $line) { + $line = (string) $line; + //echo "$line
\n"; myflush(); + $parts = array(); + if (preg_match('/^\s+(\S+)\s+=>/', $line, $parts)) { + $hostname = $parts[1]; + //if (preg_match('/^Received SLP response from\s+(\d+\.\d+\.\d+\.\d+)/', $line, $parts)) { + // $hostname = gethostbyaddr($parts[1]); + // if ($hostname != $parts[1]) { + echo "found $hostname
\n"; myflush(); + $numfound++; + // } + } +} +echo "Found $numfound HMCs.
\n"; myflush(); + +// Discover BPAs //$xml = docmd('nodeadd',NULL,array($_SESSION['bpaHostname'],'groups=frame,all','nodetype.nodetype=bpa','nodehm.mgt=hmc','nodehm.power=hmc','ppc.comments=bpa','vpd.mtm=9A00-100' /* ,'vpd.serial=|(\D+)(\d+)|($2)|' */ )); $xml = docmd('nodeadd',NULL,array($_SESSION['bpaHostname'],'groups=frame,all','nodetype.nodetype=bpa','ppc.hcp=|^(.+)$|($1)|','ppc.comments=bpa')); if (getXmlErrors($xml,$errors)) { msg('E',"nodeadd bpa failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; } echo "Defined ", $_SESSION['bpaHostname'], ".
\n"; myflush(); echo "Discovering BPAs...
\n"; myflush(); -//$xml = docmd('lsslp','',array('-s','BPA','-w','-H','-i',$discoverIP,'-c','1000,2000,2000,3000,4000')); -$xml = docmd('lsslp','',array('-s','BPA','-w','-H','-i',$discoverIP,'-t','9')); +//$xml = docmd('lsslp','',array('-s','BPA','-w','-H','-i',$discoveryIP,'-c','1000,2000,2000,3000,4000')); +$xml = docmd('lsslp','',array('-s','BPA','-w','-H','-i',$discoveryIP,'-t','3')); if (getXmlErrors($xml,$errors)) { msg('E',"lsslp BPA failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; } $numfound = 0; foreach ($xml->children() as $response) foreach ($response->children() as $line) { $line = (string) $line; //echo "$line
\n"; myflush(); $parts = array(); - if (!preg_match('/^\s+(\S+)\s+=>/', $line, $parts)) { continue; } - echo "found $parts[1]
\n"; myflush(); - $numfound++; + if (preg_match('/^\s+(\S+)\s+=>/', $line, $parts)) { + $hostname = $parts[1]; + //if (preg_match('/^Received SLP response from\s+(\d+\.\d+\.\d+\.\d+)/', $line, $parts)) { + // $hostname = gethostbyaddr($parts[1]); + // if ($hostname != $parts[1]) { + echo "found $hostname
\n"; myflush(); + $numfound++; + // } + } } echo "Found $numfound BPAs.
\n"; myflush(); - -//$parts = array(); -//preg_match('/^(\D+)/', $_SESSION['bpaHostname'], $parts); -//$bpaprefix = $parts[1]; -//todo: we are hardcoding the cage # offset for now +//nextStep(++$step,TRUE); return; //todo: REMOVE!!!!!! + +// Discover FSPs +//todo: we are hardcoding the cage # offset for now. On the bp cluster, most frames start with cage # 5. This value should be input from the user. //todo: now that we use the real lsslp, it is not setting nodepos attrs //$xml = docmd('nodeadd',NULL,array($_SESSION['fspHostname'],'groups=cec,all','nodetype.nodetype=fsp','nodehm.mgt=hmc','nodehm.power=hmc','ppc.id=|\D+(\d+)|((((($1-1)%5)+1)*2)-1)|','ppc.parent=|\D+(\d+)|'.$bpaprefix.'((($1-1)/5)+1)|','nodepos.u=|\D+(\d+)|((((($1-1)%5)+1)*2)-1)|','nodepos.rack=|\D+(\d+)|((($1-1)/5)+1)|','vpd.mtm=9125-F2A' /* ,'vpd.serial=|(\D+)(\d+)|($2)|' */ )); $xml = docmd('nodeadd',NULL,array($_SESSION['fspHostname'],'groups=cec,all','nodetype.nodetype=fsp','ppc.hcp=|^(.+)$|($1)|','ppc.id=|\D+(\d+)|((($1-1)%'.$_SESSION['numFspsPerFrame'].')+5)|')); if (getXmlErrors($xml,$errors)) { msg('E',"nodeadd fsp failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; } -//todo: because of the irregularity in the cage numbers in frame 4 and 8, we have to do something special +//todo: because of the irregularity in the cage numbers in the bp cluster in frame 4 and 8, we have to do something special $fsps = expandNR($_SESSION['fspHostname']); $xml = docmd('nodech',"$fsps[36]-$fsps[41],$fsps[84]-$fsps[89]",array('ppc.id=|\D+(\d+)|((($1-1)%'.$_SESSION['numFspsPerFrame'].')+1)|')); if (getXmlErrors($xml,$errors)) { msg('E',"nodech frame failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; } @@ -435,16 +442,22 @@ if (getXmlErrors($xml,$errors)) { msg('E',"nodech frame failed: " . implode(' ', echo "
Defined ", $_SESSION['fspHostname'], ".
Discovering FSPs...
\n"; myflush(); -//$xml = docmd('lsslp','',array('-s','FSP','-w','-H','-i',$discoverIP,'-t','2','-c','3000,3000,3000,3000,3000')); -$xml = docmd('lsslp','',array('-s','FSP','-w','-H','-i',$discoverIP,'-t','9')); +//$xml = docmd('lsslp','',array('-s','FSP','-w','-H','-i',$discoveryIP,'-t','2','-c','3000,3000,3000,3000,3000')); +$xml = docmd('lsslp','',array('-s','FSP','-w','-H','-i',$discoveryIP,'-t','9')); if (getXmlErrors($xml,$errors)) { msg('E',"lsslp FSP failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; } $numfound = 0; foreach ($xml->children() as $response) foreach ($response->children() as $line) { $line = (string) $line; $parts = array(); - if (!preg_match('/^\s+(\S+)\s+=>/', $line, $parts)) { continue; } - echo "found $parts[1]
\n"; myflush(); - $numfound++; + if (preg_match('/^\s+(\S+)\s+=>/', $line, $parts)) { + $hostname = $parts[1]; + //if (preg_match('/^Received SLP response from\s+(\d+\.\d+\.\d+\.\d+)/', $line, $parts)) { + // $hostname = gethostbyaddr($parts[1]); + // if ($hostname != $parts[1]) { + echo "found $hostname
\n"; myflush(); + $numfound++; + // } + } } echo "Found $numfound FSPs.
\n"; myflush(); @@ -483,9 +496,13 @@ elseif ($step == 4) { nameres($step); } //----------------------------------------------------------------------------- // Give frame numbers to each bpa function assignframenums($step) { -//todo: this just uses the number from the nodename of the frame. Should instead count from the beginning. -$xml = docmd('nodech','frame',array('ppc.id=|\D+(\d+)|($1)|')); -if (getXmlErrors($xml,$errors)) { msg('E',"nodech frame failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; } +$bpas = expandNR($_SESSION['bpaHostname']); +$num = 0; +foreach ($bpas as $b) { + $num++; + $xml = docmd('nodech',$b,array("ppc.id=$num")); + if (getXmlErrors($xml,$errors)) { msg('E',"nodech $b failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; } +} nextStep(++$step,FALSE); } @@ -539,7 +556,7 @@ nextStep(++$step,FALSE); //----------------------------------------------------------------------------- function createhcpgroups($step) { -//todo: may need to do this once we are using the real lsslp +// since we had to create skeleton definitions for the hmcs, bpas, and fsps before discovering them via lsslp, we already created the groups nextStep(++$step,FALSE); } @@ -551,9 +568,10 @@ function nameres($step) { $xml = docmd('makehosts',NULL,NULL); if (getXmlErrors($xml,$errors)) { msg('E',"makehosts failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; } -//todo: enable this on non-aix -//$xml = docmd('makedns',NULL,NULL); -//if (getXmlErrors($xml,$errors)) { msg('E',"makedns failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; } +if (!isAIX()) { + $xml = docmd('makedns',NULL,NULL); + if (getXmlErrors($xml,$errors)) { msg('E',"makedns failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; } +} nextStep(++$step,TRUE); } @@ -599,21 +617,29 @@ elseif ($step == 1) { createlpars($step); } function createlpars($step) { $numlpars = $_SESSION['numLPARs']; $fsps = expandNR($_SESSION['fspHostname']); +$bpas = expandNR($_SESSION['bpaHostname']); $nodes = expandNR($_SESSION['computeNodename']); $n = 0; // index into the nodes array //$parts = array(); //preg_match('/^(\D+)/', $_SESSION['fspHostname'], $parts); //$fspprefix = $parts[1]; $fspattrs = getNodes($_SESSION['fspHostname'], array('ppc.hcp','ppc.parent')); +$bpaattrs = getNodes($_SESSION['bpaHostname'], array('ppc.id')); +//foreach ($bpaattrs as $k => $v) { echo "$k:$v.
\n"; myflush(); } // Go thru each fsp and create/define the nodes that should be in that fsp foreach ($fsps as $f) { $length = min($numlpars, count($nodes)-$n); $hcp = $fspattrs[$f]['ppc.hcp']; $bpa = $fspattrs[$f]['ppc.parent']; + $framenum = $bpaattrs[$bpa]; + //echo "$bpa:$framenum.
\n"; myflush(); - //todo: currently can not create the 1st lpar in the cec - $xml = docmd('nodeadd',NULL,array($nodes[$n],"groups=lpars-$f,lpars-$bpa,lpars-$hcp,lpar,compute,all",'nodetype.nodetype=lpar,osi', + //todo: currently can not create the 1st lpar in the cec, but should at least set the lpar name, etc. (See configCEC.) + //todo: for p7, we should accept an lsvm file, or clone the 1st lpar of the 1st cec. + //todo: add lpars- groups back in + //$xml = docmd('nodeadd',NULL,array($nodes[$n],"groups=lpars-$f,lpars-$bpa,f$framenum,lpars-$hcp,lpar,compute,all",'nodetype.nodetype=lpar,osi', + $xml = docmd('nodeadd',NULL,array($nodes[$n],"groups=f$framenum,compute,lpar,all",'nodetype.nodetype=lpar,osi', 'nodehm.mgt=hmc','nodehm.power=hmc','nodehm.cons=hmc', 'nodetype.arch=ppc64','ppc.id=1', "ppc.parent=$f","ppc.hcp=$hcp","ppc.pprofile=$nodes[$n]")); @@ -672,7 +698,7 @@ nextStep(++$step,TRUE); //----------------------------------------------------------------------------- // Flush the output buffers function myflush() { - if ($_SERVER["SERVER_SOFTWARE"] != 'IBM_HTTP_Server') { ob_flush(); } // for some reason ob_flush() does not work on aix + if (!isAIX()) { ob_flush(); } // for some reason ob_flush() does not work on aix flush(); }