- system p discovery done

- rvitals done
- frame view fixed

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2511 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
bp-sawyers 2008-11-19 21:26:43 +00:00
parent 0daa69aac8
commit 14856756e3
24 changed files with 433 additions and 230 deletions

View File

@ -29,9 +29,7 @@ else {
$editable = & $_SESSION["editable-$tab"];
# Modify the array with the new value from the editable widget
//$oldValue = $editable[$theLine][$theField];
$editable[$theLine][$theField] = $value;
//$s = 's=' . $editable[$theLine][$theField] . '.';
// This value goes back to the javascript editable object in the browser
echo "$value";

View File

@ -24,6 +24,15 @@
margin-right: 0.6em;
}
#tableHeading { margin-top: 0px; margin-bottom: 0px; }
#helpLinks { margin-top: 0px; }
#helpLinks A {
margin-left: 2em;
margin-right: 2em;
}
.middlepane {
/* float: left; */
padding: 5px;

View File

@ -31,9 +31,9 @@ function makeEditable(table, cellclass, imgclass, linkclass) {
// Form a table row to add to the table
function formRow(linenum, numCells, ooe) {
var newrow = '<tr class=ListLine' + ooe + ' id=row' + linenum + '><td class=Xcell><a class=Xlink2 title="Delete row"><img class=Ximg2 src=../images/red-x2-light.gif></a></td>';
for (var i=1; i<=numCells; i++) {
for (var i=0; i<numCells; i++) {
var val = '';
if (i == 1) { val = 'x'; }
if (i == 0) { val = 'x'; }
newrow += '<td class=editme2 id="' + linenum + '-' + i + '">' + val + '</td>';
}
newrow += '</tr>';

View File

@ -22,7 +22,7 @@ echo "\n</div>\n";
if(isset($_REQUEST['tab'])) { $tab = $_REQUEST['tab']; }
else { $tab = "nodelist"; }
$p = "edittab.php?tab=$tab";
//$p = "edittab.php?tab=$tab";
echo "<div class=middlepane id=middlepane>Loading $tab ...</div>\n";
//echo "<div class=bottompane></div>\n";

View File

@ -23,10 +23,19 @@ if(isset($_REQUEST['save'])) {
// Get table contents
//$f = splitTableFields2('"node01","node02","5000","off",,'); echo '<p>'; foreach ($f as $k => $v) { echo "$k=$v<br>"; } echo "</p>\n";
/*
echo "<h1>$tab Table</h1>";
echo "<table border=0><tr><td rowspan=2>", getTabDescription($tab), "</td>\n";
echo "<table><tr><td rowspan=2>", getTabDescription($tab), "</td>\n";
echo "<td><a href='" . getDocURL('dbtable',$tab) . "' target='_blank'>Column Descriptions</a></td></tr>\n";
echo "<tr><td><a href='" . getDocURL('dbtable') . "' target='_blank'>Regular Expression Support</a></td></tr></table>\n";
*/
echo "<table cellpadding=8><tr valign=middle><td nowrap><h2 id=tableHeading>$tab Table:</h2></td><td>", getTabDescription($tab), "</td></tr></table>\n";
echo "<p id=helpLinks><a href='" . getDocURL('dbtable',$tab) . "' target='_blank'>Column Descriptions</a>\n";
echo "<a href='" . getDocURL('dbtable') . "' target='_blank'>Regular Expression Support</a></p>\n";
insertButtons(array('label' => 'Save', 'id' => 'saveit'),
array('label' => 'Cancel', 'id' => 'reset')
);
// Display the column names
$xml = docmd('tabdump','',array($tab));
@ -69,10 +78,9 @@ echo "</table>\n";
$_SESSION["editable-$tab"] = & $editable; // save the array so we can access it in the next call of this file or change.php
//unset($_SESSION["editable-$tab"]);
insertButtons(array('label' => 'Add Row', 'id' => 'newrow'),
array('label' => 'Save', 'id' => 'saveit'),
array('label' => 'Cancel', 'id' => 'reset')
);
echo "<p>";
insertButtons(array('label' => 'Add Row', 'id' => 'newrow'));
echo "</p>\n";
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -237,7 +237,9 @@ function insertMenuRow($current, $isTop, $items) {
//-----------------------------------------------------------------------------
// Inserts the html for each pages footer
function insertFooter() {
echo '<div class=PageFooter><p id=disclaimer>This interface is still under construction and not yet ready for production use.</p></div></BODY></HTML>';
//echo "<div class=PageFooter><p id=disclaimer>This interface is still under construction and not yet ready for production use.</p></div>\n";
echo "<div class=PageFooter><p class='Emphasis Center'>This interface is still under development - use accordingly.</p></div>\n";
echo '</BODY></HTML>';
}
@ -251,7 +253,20 @@ function doTabrestore($tab, & $data){
$usernode->addChild('password',getpassword());
foreach($data as $line){
foreach ($line as &$f) { if (!empty($f) && !preg_match('/^".*"$/', $f)) { $f = '&quot;'.$f.'&quot;'; } }
// Combine the elements of the array, but have to handle sparse arrays
ksort($line, SORT_NUMERIC);
$keys = array_keys($line);
$maxindex = count($line)-1;
//echo "<p>"; print_r($line); echo "</p>";
//trace("$maxindex, $keys[$maxindex]");
if ($keys[$maxindex] != $maxindex) { // need to fill in some values
for ($i=0; $i<=$keys[$maxindex]; $i++) { if (!isset($line[$i])) {$line[$i]='';} }
ksort($line, SORT_NUMERIC);
}
$linestr = implode(",",$line);
//trace($linestr);
$linestr = str_replace('"', '&quot;',$linestr); //todo: should we use the htmlentities function?
$linestr = str_replace("'", '&apos;',$linestr);
//echo "<p>addChild:$linestr.</p>\n";
@ -677,11 +692,11 @@ $HWTypeInfo = array (
'p5-595' => array ( 'image'=>'590.gif', 'rackimage'=>'p5-590-front', 'u'=>42, 'aliases'=>'' ), # 9119
# POWER 6 servers
'520' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'8203' ),
'550' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'8204' ),
'570' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9117' ),
'575' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'9125' ),
'595' => array ( 'image'=>'590.gif', 'rackimage'=>'p5-590-front', 'u'=>42, 'aliases'=>'9119' ),
'p6-520' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'8203,520' ),
'p6-550' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'8204,550' ),
'p6-570' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9117,570' ),
'p6-575' => array ( 'image'=>'342.gif', 'rackimage'=>'p6-575-front', 'u'=>2, 'aliases'=>'9125,575' ),
'p6-595' => array ( 'image'=>'590.gif', 'rackimage'=>'p5-590-front', 'u'=>42, 'aliases'=>'9119,595' ),
);
@ -801,7 +816,7 @@ function getPref($key) {
//-----------------------------------------------------------------------------
// Returns a list of some or all of the nodes in the cluster and some of their attributes.
// Pass in a node range (or NULL to get all nodes) and an array of attribute names (or NULL for none).
// Returns an array where each key is the node name and each value is an array of attr/value pairs.
// Returns an array where each key is the node name and each value is an array of attr/value pairs (unless only 1 attr was request, in which case it is just the attr value).
// attrs is an array of attributes that should be returned.
function getNodes($noderange, $attrs) {
//my ($hostname, $type, $osname, $distro, $version, $mode, $status, $conport, $hcp, $nodeid, $pmethod, $location, $comment) = split(/:\|:/, $na);
@ -810,19 +825,21 @@ function getNodes($noderange, $attrs) {
if (empty($noderange)) { $nodrange = '/.*'; }
//$xml = docmd('nodels',$noderange,implode(' ',$attrs));
$xml = docmd('nodels',$noderange,$attrs);
//echo "<p>"; print_r($xml); echo "</p>\n";
foreach ($xml->children() as $response) foreach ($response->children() as $o) {
$nodename = (string)$o->name;
$data = & $o->data;
$attrval = (string)$data->contents;
if (empty($attrval)) { continue; }
$attrname = (string)$data->desc;
//echo "<p> $attrname = $attrval </p>\n";
//echo "<p>"; print_r($nodename); echo "</p>\n";
//echo "<p>"; print_r($o); echo "</p>\n";
//$nodes[$nodename] = array('osversion' => $attr);
if (!array_key_exists($nodename,$nodes)) { $nodes[$nodename] = array(); }
$attributes = & $nodes[$nodename];
$attributes[$attrname] = $attrval;
if (count($attrs) > 1) { // if more than 1 attr requested, the output will include the attr description (name)
$attrname = (string)$data->desc;
if (!array_key_exists($nodename,$nodes)) { $nodes[$nodename] = array(); }
$attributes = & $nodes[$nodename];
$attributes[$attrname] = $attrval;
}
else { // only 1 attr, so no attr name
$nodes[$nodename] = $attrval;
}
}
return $nodes;
}

View File

@ -1,49 +1,18 @@
<?php
//setcookie("history", "", time() - 3600); //to delete a cookie, but did not seem to work
$TOPDIR = '..';
//require_once "../lib/functions.php";
echo <<<EOS1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>phpinfo</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=iso-8859-1">
<link href="$TOPDIR/jq/theme/jquery-ui-themeroller.css" rel=stylesheet type='text/css'>
<script src="$TOPDIR/jq/jquery.min.js" type="text/javascript"></script>
<script src="$TOPDIR/jq/jquery-ui-all.min.js" type="text/javascript"></script>
</head>
<body>
EOS1;
echo <<<EOS
<div id=tabs>
<ul>
<li class="ui-tabs-nav-item"><a href="#fragment-1"><span>One</span></a></li>
<li class="ui-tabs-nav-item"><a href="#fragment-2"><span>Two</span></a></li>
</ul>
<div id="fragment-1">
<p>First tab is active by default</p>
</div>
<div id="fragment-2">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() { $("#tabs > ul").tabs(); } );
</script>
EOS;
require_once "../lib/functions.php";
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
echo "<html><head>\n";
echo "<link href='../lib/style.css' rel=stylesheet type='text/css'>\n";
echo "</head><body>\n";
//insertLogin();
/*
dumpGlobals();
/*
$xml = docmd("authcheck","",NULL);
echo "<p>authcheck:<br>\n";
foreach ($xml->children() as $response) foreach ($response->children() as $t) { echo (string) $t, "<br>\n"; }
@ -53,9 +22,9 @@ $xml = docmd('tabdump','',NULL);
echo "<p>tabdump:<br>\n";
foreach ($xml->children() as $response) foreach ($response->children() as $t) { echo (string) $t, "<br>\n"; }
echo "</p>\n";
*/
phpinfo();
*/
echo "</body></html>\n";
?>

View File

@ -209,6 +209,7 @@ TEXTAREA {vertical-align : middle; font-size : 8pt; font-family : sans-serif; fo
.Hidden { visibility : hidden ;}
.Txtfld {font-size : 8pt; font-family : sans-serif; font-weight : bold;}
.NotDone { font-weight: bold; font-size: 11pt; color: red; text-align: center; margin: 5px; }
.Emphasis { font-weight: bold; }
/*

View File

@ -13,16 +13,31 @@ echo "<html><head>\n";
<script type="text/javascript" src="http://dev.jquery.com/view/tags/ui/latest/ui/ui.tabs.js"></script>
*/
echo "</head><body>\n";
echo "<p>adfasd asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf</p>\n";
echo "<iframe src='test.php?iframe=1' width='100%' height=600></iframe>\n";
$a = array('a', 'b', 'c');
$b = array('d', 'e');
$c = array_merge($a, $b);
echo "<p>"; print_r($c); echo "</p>\n";
$d = array('f');
echo "<p>implode(a):", implode(',',$a), ".</p>\n";
echo "<p>implode(d):", implode(',',$d), ".</p>\n";
$var2 = @$somevar;
echo "<p>unset var is:", $var2, ".</p>\n";
//echo "<script type='text/javascript'>window.myfunvar='abc';function myfun() {alert('In myfun():'+window.myfunvar+'!');}</script>";
//echo "<p>adfasd asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf</p>\n";
//echo "<iframe src='test.php?iframe=1' width='100%' height=600></iframe>\n";
//echo "<object data='test.php?iframe=1' width='100%' height=600></object>\n";
echo "</body></html>\n";
}
else {
for ($i=1; $i<=5; $i++) {
for ($i=1; $i<=2; $i++) {
sleep(1);
echo "<p>Line $i adfasd asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf ads fasdf asdf asdf asdf asdf asdf asdf asfd asdf asdf asdf asdf asdf asdf asdf adsf asdf asdf asd ff asdf adsf asdf asdf asdf asdf asd f</p>\n";
ob_flush(); flush();
}
echo "<script type='text/javascript'>parent.myfun();</script>";
}
?>

View File

@ -24,10 +24,16 @@
margin-bottom: 5px;
}
.WizardInputSection { background-color: #EAEAFF; /* #E5E5FF; */ }
.NonCurrentSummaryItem {}
.CurrentSummaryItem { background-color: yellow; }
.WizardInputTable {
margin-bottom: 20px;
}
.WizardProgressTable {
margin: 10px 0px;
/* text-align: left; */
@ -44,6 +50,12 @@
.WizardProgressTable IMG { margin-right: 1em; margin-left: 1em; }
.WizardProgressTable P#output { margin-left: 35px; }
.WizardProgressTable IFRAME#output { margin-left: 35px; width: 400px; }
.WizardProgressOutput { margin: 0px; }
.WizardProgressCurrent {
/* font-weight: bold; */
background-color: #D8E8FF; /* yellow; */

View File

@ -21,12 +21,11 @@ $("#wizardPane").load("?a=1", props);
// Repeatedly make a json call to the server until it tells us there are no more steps
function wizardStep(step, done, error) {
//todo: handle errors
function wizardStep(step, done) {
// Mark the previous step as complete
if (step > 1) {
var prevstep = step -1;
$(".WizardProgressTable #step"+prevstep).removeClass("WizardProgressCurrent");
$(".WizardProgressTable #step"+prevstep+" #task").removeClass("WizardProgressCurrent");
$(".WizardProgressTable #step"+prevstep+" #chk").attr('src','../images/checked-box.gif');
//$(".WizardProgressTable #step"+prevstep+" #spinner").hide();
$(".WizardProgressTable #step"+prevstep+" #spinner").attr('src', '../images/invisible.gif');
@ -36,7 +35,7 @@ if (done) { return; }
//alert('here');
// Make the current item bold
$(".WizardProgressTable #step"+step).addClass("WizardProgressCurrent");
$(".WizardProgressTable #step"+step+" #task").addClass("WizardProgressCurrent");
//$(".WizardProgressTable #step"+step).append("<img id=spinner src='../images/throbber.gif'/>");
$(".WizardProgressTable #step"+step+" #spinner").attr('src', '../images/throbber.gif');
@ -44,10 +43,15 @@ $(".WizardProgressTable #step"+step+" #spinner").attr('src', '../images/throbber
var props = { page: window.currentPage, action: 'step', step: step };
//alert('props page:'+props.page+ ' action:'+props.action+' step:'+props.step);
//jQuery.getJSON('?page='+window.currentPage+'&action=step&step='+step, {}, function(json) {
/*
jQuery.post('?a=1', props, function(json, textStatus) {
wizardStep(json.step, json.done, json.error);
}, 'json');
*/
// Decide if this task has a P or IFRAME for the output and invoke the function appropriately.
var output = $(".WizardProgressTable #step"+step+" #output");
if (output.is('IFRAME')) { output.attr('src','?page='+props.page+'&action='+props.action+'&step='+props.step+'&output=1'); }
else { output.load("?a=1", props); }
}

View File

@ -43,6 +43,7 @@ if (isset($_REQUEST['page'])) { // navigate to another page in the wizard
// Run the function for this page
//dumpGlobals();
if (isset($_REQUEST['output'])) { insertWizardOutputHeader(); }
if ($action != 'step') configureButtons($k, $pages);
$keys[$k]($action, $step);
}
@ -102,12 +103,53 @@ echo "</script>\n";
//-----------------------------------------------------------------------------
// Display a list of tasks to be done.
function insertProgressTable($tasks) {
global $TOPDIR;
echo "<table class=WizardProgressTable><ul>\n";
foreach ($tasks as $k => $t) {
echo "<li id=step", $k+1, "><img id=chk src='$TOPDIR/images/unchecked-box.gif'>$t<img id=spinner src='$TOPDIR/images/invisible.gif' width=16 height=16></li>\n";
if (is_array($t)) {
$text = $t[0];
$type = $t[1];
}
else {
$text = $t;
$type = 'onlyerrors';
}
if ($type == 'disabled') $cl = 'class=Disabled';
else $cl = '';
echo "<li id=step", $k+1, " $cl><p id=task><img id=chk src='$TOPDIR/images/unchecked-box.gif'>$text<img id=spinner src='$TOPDIR/images/invisible.gif' width=16 height=16></p>\n";
if ($type == 'output') {
echo "<iframe id=output></iframe></li>\n";
}
else { echo "<p id=output></p></li>\n"; }
}
echo "</ul></table>\n";
}
//-----------------------------------------------------------------------------
// Instruct the client-side to move on to the next step in this page.
function nextStep($step, $done) {
// Was using JSON, but that is more difficult with all the utilities that can directly display errors they encounter.
//echo json_encode(array('step' => (integer)++$step, 'done' => FALSE, 'error' => ''));
$func = (isset($_REQUEST['output']) ? 'parent.wizardStep' : 'wizardStep');
echo "<script type='text/javascript'>", $func, "($step,", ($done?'true':'false'), ");</script>";
}
//-----------------------------------------------------------------------------
// Used for the html that we send to the iframe
function insertWizardOutputHeader() {
echo <<<EOS1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<LINK rel=stylesheet href='../lib/wizard.css' type='text/css'>
</head><body>
EOS1;
}
?>

View File

@ -10,6 +10,8 @@
#nodeAttrTable { background-color: #F9F9F9; }
#nodeAttrTable TD { white-space: nowrap; }
.colHeaders {
font-weight: bold;
text-align: center;

View File

@ -49,6 +49,7 @@ function expandNR($nr) {
// see pping as an example of the client/server for noderange expansion
$a = array();
if (empty($nr)) return $a;
if (strpos($nr,'-')===FALSE) { $a[] = $nr; return $a; } // a single node
list($begin, $end) = explode('-', $nr);
$begParts = array();
if (!preg_match('/^(\D+)(\d+)$/', $begin, $begParts)) { msg('E',"Error in noderange syntax: $nr"); return NULL; }
@ -72,13 +73,34 @@ echo " Choose which type of hardware you want to discover, and then click Next.<
echo "<form><table class=WizardListTable><tr><td><ul class=NoBullet>\n";
echo "<li><label class=Disabled><input type=radio name=hwType value=systemx disabled> System x hardware (not implemented yet)</label></li>\n";
echo "<li><label><input type=radio name=hwType value=systemp checked> System p hardware (only partially implemented)</label></li>\n";
echo "<p>&nbsp;<br><br><br><br></p>\n";
echo "</ul></td></tr></table></form>\n";
}
//-----------------------------------------------------------------------------
function patterns($action, $step) {
echo "<form><table cellspacing=5>\n";
echo "<form><table cellpadding=5 cellspacing=0 class=WizardInputTable>\n";
echo "<tr><td colspan=5 class=Center><h3>Service LAN Switches</h3></td></tr>\n";
echo "<tr class=WizardInputSection><td class=Right><label for=switchHostname>Hostname Range:</label></td><td class=Left><input type=text name=switchHostname id=switchHostname value='", @$_SESSION['switchHostname'], "'></td>\n";
echo "<td width=10></td><td class=Right><label for=switchIP>Starting IP Address:</label></td><td class=Left><input type=text name=switchIP id=switchIP value='", @$_SESSION['switchIP'], "'></td></tr>\n";
echo "<tr class=WizardInputSection><td class=Right><label for=portsPerSwitch>Number of Ports Per Switch:</label></td><td class=Left><input type=text name=portsPerSwitch id=portsPerSwitch value='", @$_SESSION['portsPerSwitch'], "'></td>\n";
echo "<td></td><td class=Right><label for=portPrefix>Switch Port Prefix:</label></td><td class=Left><input type=text name=portPrefix id=portPrefix value='", @$_SESSION["portPrefix"], "'></td></tr>\n";
echo "<tr><td colspan=5 class=Center><h3>HMCs</h3></td></tr>\n";
echo "<tr class=WizardInputSection><td class=Right><label for=hmcHostname>Hostname Range:</label></td><td class=Left><input type=text name=hmcHostname id=hmcHostname value='", @$_SESSION['hmcHostname'], "'></td>\n";
echo "<td width=10></td><td class=Right><label for=hmcIP>Starting IP Address:</label></td><td class=Left><input type=text name=hmcIP id=hmcIP value='", @$_SESSION['hmcIP'], "'></td></tr>\n";
echo "<tr class=WizardInputSection><td class=Right><label for=numFramesPerHMC>Number of Frames per HMC:</label></td><td class=Left><input type=text name=numFramesPerHMC id=numFramesPerHMC value='", @$_SESSION['numFramesPerHMC'], "'></td><td></td><td></td><td></td></tr>\n";
echo "<tr><td colspan=5 class=Center><h3>Frames (BPAs)</h3></td></tr>\n";
echo "<tr class=WizardInputSection><td class=Right><label for=bpaHostname>Hostname Range:</label></td><td class=Left><input type=text name=bpaHostname id=bpaHostname value='", @$_SESSION['bpaHostname'], "'></td>\n";
echo "<td width=10></td><td class=Right><label for=bpaIP>Starting IP Address:</label></td><td class=Left><input type=text name=bpaIP id=bpaIP value='", @$_SESSION['bpaIP'], "'></td></tr>\n";
echo "<tr><td colspan=5 class=Center><h3>Drawers (FSPs/CECs)</h3></td></tr>\n";
echo "<tr class=WizardInputSection><td class=Right><label for=fspHostname>Hostname Range:</label></td><td class=Left><input type=text name=fspHostname id=fspHostname value='", @$_SESSION['fspHostname'], "'></td>\n";
echo "<td width=10></td><td class=Right><label for=fspIP>Starting IP Address:</label></td><td class=Left><input type=text name=fspIP id=fspIP value='", @$_SESSION['fspIP'], "'></td></tr>\n";
/*
echo "<tr><td colspan=2 class=Center><h3>Switch Patterns</h3></td></tr>\n";
echo "<tr><td class=Right><label for=switchHostname>Switch Hostname Pattern:</label></td><td class=Left><input type=text name=switchHostname id=switchHostname value='", @$_SESSION['switchHostname'], "'></td></tr>\n";
echo "<tr><td class=Right><label for=switchIP>Switch IP Address Pattern:</label></td><td class=Left><input type=text name=switchIP id=switchIP value='", @$_SESSION['switchIP'], "'></td></tr>\n";
@ -96,6 +118,8 @@ echo "<tr><td class=Right><label for=bpaIP>BPA IP Address Pattern:</label></td><
echo "<tr><td colspan=2 class=Center><h3>Drawer (FSP/CEC) Patterns</h3></td></tr>\n";
echo "<tr><td class=Right><label for=fspHostname>FSP Hostname Pattern:</label></td><td class=Left><input type=text name=fspHostname id=fspHostname value='", @$_SESSION['fspHostname'], "'></td></tr>\n";
echo "<tr><td class=Right><label for=fspIP>FSP IP Address Pattern:</label></td><td class=Left><input type=text name=fspIP id=fspIP value='", @$_SESSION['fspIP'], "'></td></tr>\n";
*/
echo "</table></form>\n";
//todo: get HCP userids/pws from the user
@ -117,18 +141,19 @@ if (!$_SESSION['portsPerSwitch']) { $numswitches = 1; }
else { $numswitches = (integer) ((($total-1) / $_SESSION['portsPerSwitch']) + 1); }
//echo "<p>$numswitches</p>\n";
echo "<form><table cellspacing=5>\n";
echo "<form><table cellpadding=5 cellspacing=0 class=WizardInputTable>\n";
echo "<tr><td colspan=2 class=Center><h3>Switch Port Assignments</h3></td></tr>\n";
$switches = expandNR($_SESSION['switchHostname']);
//todo: if count($switches) != $numswitches, then we have a problem
foreach ($switches as $k => $sw) {
$num = $k + 1;
echo "<tr><td class=Right><label for=switchSequence$num>Switch Port Sequence for $sw:</label></td><td class=Left><input type=text name=switchSequence$num id=switchSequence$num value='", @$_SESSION["switchSequence$num"], "'></td></tr>\n";
echo "<tr class=WizardInputSection><td class=Right><label for=switchSequence$num>Switch Port Sequence for $sw:</label></td><td class=Left><input type=text name=switchSequence$num id=switchSequence$num value='", @$_SESSION["switchSequence$num"], "'></td></tr>\n";
}
echo "<tr><td colspan=2 class=Center><h3>Discovery Information</h3></td></tr>\n";
echo "<tr><td class=Right><label for=dynamicIP>Dynamic IP Range for DHCP:</label></td><td class=Left><input type=text size=30 name=dynamicIP id=dynamicIP value='", @$_SESSION["dynamicIP"], "'></td></tr>\n";
echo "<tr class=WizardInputSection><td class=Right><label for=dynamicIP>Dynamic IP Range for DHCP:</label></td><td class=Left><input type=text size=30 name=dynamicIP id=dynamicIP value='", @$_SESSION["dynamicIP"], "'></td></tr>\n";
echo "<p>&nbsp;<br></p>\n";
echo "</table></form>\n";
}
@ -136,20 +161,20 @@ echo "</table></form>\n";
//-----------------------------------------------------------------------------
function patterns2($action, $step) {
savePostVars();
echo "<form><table cellspacing=5>\n";
echo "<form><table cellpadding=5 cellspacing=0 class=WizardInputTable>\n";
// For now, many of the BB fields are disabled
echo "<tr><td colspan=2 class=Center><h3 class=Disabled>Building Blocks</h3></td></tr>\n";
echo "<tr><td class=Right><label for=numFrames class=Disabled>Number of Frames per Building Block:</label></td><td class=Left><input type=text name=numFrames id=numFrames disabled></td></tr>\n";
echo "<tr><td class=Right><label for=subnet>Subnet Pattern for Cluster Mgmt LAN:</label></td><td class=Left><input type=text name=subnet id=subnet value='", @$_SESSION['subnet'], "'></td></tr>";
echo "<tr><td colspan=2 class='Center Disabled'>(Subnet address for nodes in each Building Block)</td></tr>\n";
echo "<tr><td class=Right><label for=ioNodename class=Disabled>I/O Node Name Pattern:</label></td><td class=Left><input type=text name=ioNodename id=ioNodename disabled></td></tr>\n";
echo "<tr><td class=Right><label for=computeNodename>Compute Node Name Pattern:</label></td><td class=Left><input type=text name=computeNodename id=computeNodename value='", @$_SESSION['computeNodename'], "'></td></tr>\n";
echo "<tr><td class=Right><label for=hfiHostname class=Disabled>HFI NIC Hostname Pattern:</label></td><td class=Left><input type=text name=hfiHostname id=hfiHostname disabled></td></tr>\n";
echo "<tr><td class=Right><label for=hfiIP class=Disabled>HFI NIC IP Address Pattern:</label></td><td class=Left><input type=text name=hfiIP id=hfiIP disabled></td></tr>\n";
echo "<tr><td colspan=2 class=Center><h3>Building Blocks</h3></td></tr>\n";
echo "<tr class=WizardInputSection><td class=Right><label for=numFrames class=Disabled>Number of Frames per Building Block:</label></td><td class=Left><input type=text name=numFrames id=numFrames disabled></td></tr>\n";
echo "<tr class=WizardInputSection><td class=Right><label for=subnet>Starting Subnet IP for Cluster Mgmt LAN:</label></td><td class=Left><input type=text name=subnet id=subnet value='", @$_SESSION['subnet'], "'></td></tr>";
echo "<tr class=WizardInputSection><td colspan=2 class='Center Disabled'>(Subnet address for nodes in each Building Block)</td></tr>\n";
echo "<tr class=WizardInputSection><td class=Right><label for=ioNodename class=Disabled>I/O Node Name Pattern:</label></td><td class=Left><input type=text name=ioNodename id=ioNodename disabled></td></tr>\n";
echo "<tr class=WizardInputSection><td class=Right><label for=computeNodename>Compute Node Hostname Range:</label></td><td class=Left><input type=text name=computeNodename id=computeNodename value='", @$_SESSION['computeNodename'], "'></td></tr>\n";
echo "<tr class=WizardInputSection><td class=Right><label for=hfiHostname class=Disabled>HFI NIC Hostname Range:</label></td><td class=Left><input type=text name=hfiHostname id=hfiHostname disabled></td></tr>\n";
echo "<tr class=WizardInputSection><td class=Right><label for=hfiIP class=Disabled>HFI NIC IP Address Range:</label></td><td class=Left><input type=text name=hfiIP id=hfiIP disabled></td></tr>\n";
echo "<tr><td colspan=2 class=Center><h3>LPAR Information</h3></td></tr>\n";
echo "<tr><td class=Right><label for=numLPARs>Number of LPARs per Drawer:</label></td><td class=Left><input type=text name=numLPARs id=numLPARs value='", @$_SESSION['numLPARs'], "'></td></tr>\n";
echo "<tr class=WizardInputSection><td class=Right><label for=numLPARs>Number of LPARs per Drawer:</label></td><td class=Left><input type=text name=numLPARs id=numLPARs value='", @$_SESSION['numLPARs'], "'></td></tr>\n";
echo "</table></form>\n";
// do we need to get any info about the resources that should be in each lpar, or do we just divide them evenly?
}
@ -160,17 +185,17 @@ global $TOPDIR;
if ($step == 0) {
savePostVars();
insertProgressTable(array('Write xCAT switch table.',
'Write xCAT hosts table.',
'Define networks.',
'Configure DHCP.',
insertProgressTable(array('Wrote xCAT switch table.',
'Wrote xCAT hosts table.',
'Defined networks.',
'Configured DHCP.',
));
if ($action != 'back') { echo "<script type='text/javascript'>wizardStep(1,false,'');</script>"; }
if ($action != 'back') { nextStep(1,FALSE); }
}
elseif ($step == 1) { writeSwitchTable($step); }
elseif ($step == 2) { writeHostsTable($step); }
elseif ($step == 3) { setDynRange($_SESSION["dynamicIP"], $step); }
elseif ($step == 3) { setDynRange(@$_SESSION["dynamicIP"], $step); }
elseif ($step == 4) { makedhcp($step); }
}
@ -196,11 +221,12 @@ foreach ($switches as $k => $sw) {
if (preg_match('/^hmc$/i',$type)) $ar=&$hmcs;
elseif (preg_match('/^bpa$/i',$type)) $ar=&$bpas;
elseif (preg_match('/^fsp$/i',$type)) $ar=&$fsps;
elseif (preg_match('/^space$/i',$type)) {if ($num=='*') {break;} $port+=$num; if ($port>$numports) break; else continue;}
else { msg('E', "Invalid HW control point type in $s"); return; }
if ($num == '*') { $num = count($ar); }
for ($i=1; $i<=$num; $i++) {
$node = array_shift($ar);
$data[] = array($node,$sw,$port);
$data[] = array($node,$sw,@$_SESSION['portPrefix'].$port);
/* $xml = docmd('nodeadd',NULL,array($node,'groups=all',"switch.node=$node","switch.switch=$sw","switch.port=$port"));
if (getXmlErrors($xml,$errors)) { msg('E',"nodeadd failed: " . implode(' ',$errors)); return; }
else { echo "Wrote: $node,$sw,$port<br>\n"; }*/
@ -211,12 +237,9 @@ foreach ($switches as $k => $sw) {
//echo "</p>\n"; ob_flush(); flush();
//array_unshift($data, array('#node,switch,port,vlan,interface,comments,disable'));
$xml = doTabrestore('switch', $data);
//$errors = array();
if (getXmlErrors($xml,$errors)) { msg('E',"tabrestore switch failed: " . implode(' ',$errors)); return; }
if (getXmlErrors($xml,$errors)) { msg('E',"tabrestore switch failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; }
// Send JSON data back to the browser. Todo: handle the errors too.
echo json_encode(array('step' => (integer)++$step, 'done' => FALSE, 'error' => ''));
//echo "<script type='text/javascript'>wizardStep(", ++$step, ",false,'');</script>";
nextStep(++$step,FALSE);
}
@ -234,22 +257,26 @@ $data = array(array('#node,ip,hostnames,comments,disable'));
foreach ($machines as $ip => $ar) { // this loop goes thru each type of hw
foreach ($ar as $hostname) { // this loop goes thru each of the hostnames for that type of hw
$data[] = array($hostname,$ip);
//echo "Wrote: $hostname,$ip<br>\n";
//echo "<p class=WizardProgressOutput>Wrote: $hostname,$ip</p>\n"; ob_flush(); flush();
//sleep(1); // remove
incrementIP($ip);
}
}
//echo "</p>\n"; ob_flush(); flush();
$xml = doTabrestore('hosts', $data);
$errors = array();
if (getXmlErrors($xml,$errors)) { msg('E',"tabrestore hosts failed: " . implode(' ',$errors)); return; }
if (getXmlErrors($xml,$errors)) { msg('E',"tabrestore hosts failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; }
// Send JSON data back to the browser. Todo: handle the errors too.
echo json_encode(array('step' => (integer)++$step, 'done' => FALSE, 'error' => ''));
nextStep(++$step,FALSE);
}
//-----------------------------------------------------------------------------
function incrementIP(& $ip) {
//todo: hard coded for the percs demo cluster - remove
if ($ip == '192.168.200.233') { $ip='192.168.200.237'; return; }
if ($ip == '192.168.200.237') { $ip='192.168.200.239'; return; }
$parts = explode('.', $ip);
$parts[3]++;
if ($parts[3] >= 255) {
@ -263,38 +290,44 @@ $ip = implode('.', $parts);
//-----------------------------------------------------------------------------
//todo: we need a better way to change the networks table than tabdump/tabrestore. We can not use chtab because its not client/svr. We can not use chdef because there is no netname defined by makenetworks.
function setDynRange($range, $step) {
// Get the whole table via tabdump
$xml = docmd('tabdump','',array('networks'));
$data = array();
foreach ($xml->children() as $response) foreach ($response->children() as $line) {
$line = (string) $line;
if(ereg("^#", $line)) { // handle the header specially
$data[] = array($line);
continue;
if (isset($range) && !empty($range)) { // only set the dyn range if they entered it, otherwise another machine may be providing dynamic ranges
// Get the whole table via tabdump
$xml = docmd('tabdump','',array('networks'));
if (getXmlErrors($xml,$errors)) { msg('E',"tabdump networks failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; }
$data = array();
foreach ($xml->children() as $response) foreach ($response->children() as $line) {
$line = (string) $line;
if(ereg("^#", $line)) { // handle the header specially
$data[] = array($line);
continue;
}
$values = splitTableFields($line);
//todo: only give the dynamic range to the network that has same ip as the dyn range
$values[8] = '"' . $range . '"'; // dynamicrange is the 9th field
$data[] = $values;
}
$values = splitTableFields($line);
$values[8] = '"' . $range . '"'; // dynamicrange is the 9th field
$data[] = $values;
// Now restore that data back into the networks table
$xml = doTabrestore('networks', $data);
if (getXmlErrors($xml,$errors)) { msg('E',"tabrestore networks failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; }
}
// Now restore that data back into the networks table
$xml = doTabrestore('networks', $data);
$errors = array();
if (getXmlErrors($xml,$errors)) { msg('E',"tabrestore networks failed: " . implode(' ',$errors)); return; }
// Send JSON data back to the browser. Todo: handle the errors too.
echo json_encode(array('step' => (integer)++$step, 'done' => FALSE, 'error' => ''));
nextStep(++$step,FALSE);
}
//-----------------------------------------------------------------------------
function makedhcp($step) {
$xml = docmd('makedhcp',NULL,array('-n'));
$errors = array();
if (getXmlErrors($xml,$errors)) { msg('E',"makedhcp failed: " . implode(' ',$errors)); return; }
//todo: remove this check because we should always be running makedhcp, but it is starting dhcpd, which we do not want on the demo system
if (isset($_SESSION["dynamicIP"]) && !empty($_SESSION["dynamicIP"])) {
$xml = docmd('makedhcp',NULL,array('-n'));
if (getXmlErrors($xml,$errors)) { msg('E',"makedhcp failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; }
}
// Send JSON data back to the browser. Todo: handle the errors too.
echo json_encode(array('step' => (integer)++$step, 'done' => TRUE, 'error' => ''));
//todo: also need to restart makedhcp so the omapi config takes hold
nextStep(++$step,TRUE);
}
@ -305,6 +338,7 @@ echo "<p>Do the following manual steps now:</p>\n";
echo "<ol><li>Power on all of the HMCs.</li>\n";
echo "<li>Then power on all of frames.</li>\n";
echo "<li>Then click Next to discover the hardware on the service network.</li>\n";
echo "<p>&nbsp;<br><br><br><br></p>\n";
echo "</ol></td></tr></table>\n";
}
@ -313,8 +347,8 @@ echo "</ol></td></tr></table>\n";
function discover($action, $step) {
global $TOPDIR;
if ($step == 0) {
insertProgressTable(array('Discover HMCs, BPAs, and FSPs.'));
if ($action != 'back') { echo "<script type='text/javascript'>wizardStep(1,false,'');</script>"; }
insertProgressTable(array(array('Discovered HMCs, BPAs, and FSPs.','output')));
if ($action != 'back') { nextStep(1,FALSE); }
}
elseif ($step == 1) { lsslp($step); }
@ -324,24 +358,24 @@ elseif ($step == 1) { lsslp($step); }
//-----------------------------------------------------------------------------
//todo: we are just simulating lsslp right now
function lsslp($step) {
/* todo: show this
echo "<p>";
echo "Discovered HMCs: ", $_SESSION['hmcHostname'], "<br>\n";
echo "Discovered BPAs: ", $_SESSION['bpaHostname'], "<br>\n";
echo "Discovered FSPs: ", $_SESSION['fspHostname'], "<br>\n";
echo "</p>\n";
*/
//$errors = array();
$xml = docmd('nodeadd',NULL,array($_SESSION['hmcHostname'],'groups=hmc,all','nodetype.nodetype=hmc'));
if (getXmlErrors($xml,$errors)) { msg('E',"nodeadd hmc failed: " . implode(' ',$errors)); return; }
$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 "<p class=WizardProgressOutput>Discovered and defined ", $_SESSION['hmcHostname'], ".</p>\n"; ob_flush(); flush();
$xml = docmd('nodeadd',NULL,array($_SESSION['bpaHostname'],'groups=bpa,all','nodetype.nodetype=bpa','nodehm.mgt=hmc','nodehm.power=hmc','ppc.comments=bpa','vpd.serial=|(\D+)(\d+)|($2)|','vpd.mtm=|(\D+)(\d+)|($1)|'));
if (getXmlErrors($xml,$errors)) { msg('E',"nodeadd bpa failed: " . implode(' ',$errors)); return; }
$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)|' */ ));
if (getXmlErrors($xml,$errors)) { msg('E',"nodeadd bpa failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; }
echo "<p class=WizardProgressOutput>Discovered and defined ", $_SESSION['bpaHostname'], ".</p>\n"; ob_flush(); flush();
// We are assuming there are 4 fsps in each bpa
$xml = docmd('nodeadd',NULL,array($_SESSION['fspHostname'],'groups=fsp,all','nodetype.nodetype=fsp','nodehm.mgt=hmc','nodehm.power=hmc','ppc.id=|\D+(\d+)|((($1-1)%4)+1)|','ppc.parent=|(\D+)(\d+)|b((($2-1)/4)+1)|','vpd.serial=|(\D+)(\d+)|($2)|','vpd.mtm=|(\D+)(\d+)|($1)|'));
if (getXmlErrors($xml,$errors)) { msg('E',"nodeadd fsp failed: " . implode(' ',$errors)); return; }
$parts = array();
preg_match('/^(\D+)/', $_SESSION['bpaHostname'], $parts);
$bpaprefix = $parts[1];
// We are assuming there are 5 fsps in each bpa
//todo: when we use the real lsslp, it probably will not set 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)|' */ ));
if (getXmlErrors($xml,$errors)) { msg('E',"nodeadd fsp failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; }
echo "<p class=WizardProgressOutput>Discovered and defined ", $_SESSION['fspHostname'], ".</p>\n"; ob_flush(); flush();
/*
$xml = docmd('chdef',NULL,array('-t','group','bpa','serial=|(\D+)(\d+)|($2)|','mtm=|(\D+)(\d+)|($1)|'));
@ -350,8 +384,7 @@ $xml = docmd('chdef',NULL,array('-t','group','fsp','serial=|(\D+)(\d+)|($2)|','m
if (getXmlErrors($xml,$errors)) { msg('E',"chdef fsp failed: " . implode(' ',$errors)); return; }
*/
// Send JSON data back to the browser. Todo: handle the errors too.
echo json_encode(array('step' => (integer)++$step, 'done' => TRUE, 'error' => ''));
nextStep(++$step,TRUE);
}
@ -359,49 +392,76 @@ echo json_encode(array('step' => (integer)++$step, 'done' => TRUE, 'error' => ''
function updatedefs($action, $step) {
global $TOPDIR;
if ($step == 0) {
insertProgressTable(array('Determine which CECs each HMC should manage.',
'Create HW control point node groups.',
'Assign frame numbers.',
/* 'Assign supernode numbers and building block numbers.',
'Assign building block subnets.', */
'Update name resolution.',
insertProgressTable(array('Assigned frame numbers.',
'Determined which CECs/Frames each HMC should manage.',
'Created HW control point node groups.',
/* 'Assigned supernode numbers and building block numbers.',
'Assigned building block subnets.', */
'Updated name resolution.',
));
if ($action != 'back') { echo "<script type='text/javascript'>wizardStep(1,false,'');</script>"; }
if ($action != 'back') { nextStep(1,FALSE); }
}
elseif ($step == 1) { assigncecs($step); }
elseif ($step == 2) { createhcpgroups($step); }
elseif ($step == 3) { assignframenums($step); }
elseif ($step == 1) { assignframenums($step); }
elseif ($step == 2) { assigncecs($step); }
elseif ($step == 3) { createhcpgroups($step); }
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; }
nextStep(++$step,FALSE);
}
//-----------------------------------------------------------------------------
function assigncecs($step) {
$numCECs = $_SESSION['numCECs'];
$numFrames = $_SESSION['numFramesPerHMC'];
$hmcs = expandNR($_SESSION['hmcHostname']);
$bpas = expandNR($_SESSION['bpaHostname']);
$fsps = expandNR($_SESSION['fspHostname']);
// 1st query ppc.parent of all fsps and save in a hash, so we can assign the bpa and its fsps to the
// same hmc.
$fspparent = getNodes($_SESSION['fspHostname'], array('ppc.parent'));
$bpacecs = array();
foreach ($fspparent as $fsp => $parent) { $bpacecs[$parent][] = $fsp; }
$h = 0; // start with the 1st hmc
$f = 0;
$errors = array();
// Go thru the fsps taking groups of numCECs and assigning them to the next hmc
$b = 0;
// Go thru the bpas taking groups of numFrames and assigning them to the next hmc
while (TRUE) {
// Get the next group of fsps
$length = min($numCECs, count($fsps)-$f);
$fslice = array_slice($fsps, $f, $length);
$xml = docmd('nodech',implode(',',$fslice),array("ppc.hcp=$hmcs[$h]"));
if (getXmlErrors($xml,$errors)) { msg('E',"nodech fsp failed: " . implode(' ',$errors)); return; }
$length = min($numFrames, count($bpas)-$b);
$bslice = array_slice($bpas, $b, $length);
// Decide if we are all out of fsps
// Assign the bpa to the hmc
//trace("b=$b, numFrames=$numFrames, length=$length.");
//echo "<p>bpas:"; print_r($bpas); "</p>\n";
//trace("nodech ".implode(',',$bslice));
$xml = docmd('nodech',implode(',',$bslice),array("ppc.hcp=$hmcs[$h]","ppc.parent=$hmcs[$h]"));
if (getXmlErrors($xml,$errors)) { msg('E',"nodech bpa failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; }
// Collect the list of the fsps in these bpas
$fsprange = array();
foreach ($bslice as $b2) { $fsprange = array_merge($fsprange, $bpacecs[$b2]); }
//trace("nodech ".implode(',',$fsprange));
$xml = docmd('nodech',implode(',',$fsprange),array("ppc.hcp=$hmcs[$h]"));
if (getXmlErrors($xml,$errors)) { msg('E',"nodech fsp failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; }
// Decide if we are all out of bpas
$h++;
$f += $length;
if ($h>=count($hmcs) || $f>=count($fsps)) break;
$b += $length;
if ($h>=count($hmcs) || $b>=count($bpas)) break;
}
//todo: how do we decide what bpas to assign to which hmcs?
// Send JSON data back to the browser. Todo: handle the errors too.
echo json_encode(array('step' => (integer)++$step, 'done' => FALSE, 'error' => ''));
nextStep(++$step,FALSE);
}
@ -409,34 +469,19 @@ echo json_encode(array('step' => (integer)++$step, 'done' => FALSE, 'error' => '
function createhcpgroups($step) {
//todo: may need to do this once we are using the real lsslp
// Send JSON data back to the browser. Todo: handle the errors too.
echo json_encode(array('step' => (integer)++$step, 'done' => FALSE, 'error' => ''));
}
//-----------------------------------------------------------------------------
// Give frame numbers to each bpa
function assignframenums($step) {
$errors = array();
$xml = docmd('nodech','bpa',array('ppc.id=|\D+(\d+)|($1)|'));
if (getXmlErrors($xml,$errors)) { msg('E',"nodech bpa failed: " . implode(' ',$errors)); return; }
// Send JSON data back to the browser. Todo: handle the errors too.
echo json_encode(array('step' => (integer)++$step, 'done' => FALSE, 'error' => ''));
nextStep(++$step,FALSE);
}
//-----------------------------------------------------------------------------
// Run makehosts and makedns
function nameres($step) {
$errors = array();
$xml = docmd('makehosts',NULL,NULL);
if (getXmlErrors($xml,$errors)) { msg('E',"makehosts failed: " . implode(' ',$errors)); return; }
if (getXmlErrors($xml,$errors)) { msg('E',"makehosts failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; }
$xml = docmd('makedns',NULL,NULL);
if (getXmlErrors($xml,$errors)) { msg('E',"makedns failed: " . implode(' ',$errors)); return; }
if (getXmlErrors($xml,$errors)) { msg('E',"makedns failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; }
// Send JSON data back to the browser. Todo: handle the errors too.
echo json_encode(array('step' => (integer)++$step, 'done' => TRUE, 'error' => ''));
nextStep(++$step,TRUE);
}
@ -444,11 +489,11 @@ echo json_encode(array('step' => (integer)++$step, 'done' => TRUE, 'error' => ''
function configurehcps($action, $step) {
global $TOPDIR;
if ($step == 0) {
insertProgressTable(array('Assign CECs to their HMC.',
'Set frame numbers in BPAs.',
'Power on CECs to Standby.',
insertProgressTable(array(array('Assigned CECs to their HMC.','disabled'),
array('Set frame numbers in BPAs.','disabled'),
array('Powered on CECs to Standby.','disabled'),
));
if ($action != 'back') { echo "<script type='text/javascript'>wizardStep(1,false,'');</script>"; }
if ($action != 'back') { nextStep(1,FALSE); }
}
elseif ($step == 1) { cecs2hmcs($step); }
@ -458,21 +503,21 @@ elseif ($step == 3) { cecs2standby($step); }
//todo: set HCP userids/pws
}
function cecs2hmcs($step) {echo json_encode(array('step' => (integer)++$step, 'done' => FALSE, 'error' => ''));}
function setframenum($step) {echo json_encode(array('step' => (integer)++$step, 'done' => FALSE, 'error' => ''));}
function cecs2standby($step) {echo json_encode(array('step' => (integer)++$step, 'done' => TRUE, 'error' => ''));}
function cecs2hmcs($step) {nextStep(++$step,FALSE);}
function setframenum($step) {nextStep(++$step,FALSE);}
function cecs2standby($step) {nextStep(++$step,TRUE);}
//-----------------------------------------------------------------------------
function createnodes($action, $step) {
global $TOPDIR;
//todo: need to show progress for each CEC
if ($step == 0) {
insertProgressTable(array('Create LPARs in each CEC and save node definitions in xCAT database.'));
if ($action != 'back') { echo "<script type='text/javascript'>wizardStep(1,false,'');</script>"; }
insertProgressTable(array(array('Created LPARs in each CEC and save node definitions in xCAT database.','output')));
if ($action != 'back') { nextStep(1,FALSE); }
}
elseif ($step == 1) { createlpars($step); }
//todo: set up rcons for the lpars (makeconserver.cf)
}
@ -481,34 +526,70 @@ function createlpars($step) {
$numlpars = $_SESSION['numLPARs'];
$fsps = expandNR($_SESSION['fspHostname']);
$nodes = expandNR($_SESSION['computeNodename']);
$samplenode = ''; //todo: ???
$errors = array();
$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'));
// 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);
$nslice = array_slice($nodes, $n, $length);
//todo: actually make the lpars
//$xml = docmd('mkvm',NULL,array($samplenode,'-i','1','-n',implode(',',$nslice)));
//if (getXmlErrors($xml,$errors)) { msg('E',"mkvm failed: " . implode(' ',$errors)); return; }
$hcp = $fspattrs[$f]['ppc.hcp'];
$bpa = $fspattrs[$f]['ppc.parent'];
//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,all",'nodetype.nodetype=lpar,osi',
'nodehm.mgt=hmc','nodehm.power=hmc','nodehm.cons=hmc','noderes.netboot=yaboot',
'nodetype.arch=ppc64','ppc.id=3',
"ppc.parent=$f","ppc.hcp=$hcp",'ppc.pprofile=diskless2'));
if (getXmlErrors($xml,$errors)) { msg('E',"nodeadd nodes failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; }
echo "<p class=WizardProgressOutput>Created and defined $nodes[$n] in $f.</p>\n"; ob_flush(); flush();
$length--; $n++;
$nmax = $length + $n;
$numnodes = 5; // how many lpars to create before displaying some output
$n2 = $n;
// Go thru $length nodes, $numnodes at a time, creating the lpars and defining the nodes in the db
while (TRUE) {
$length2 = min($numnodes, $nmax-$n2);
$nslice = array_slice($nodes, $n2, $length2);
$nstr = implode(',',$nslice);
//todo: this assumes the lpar id starts at 3 for a cec
$xml = docmd('nodeadd',NULL,array($nstr,"groups=lpars-$f,lpars-$bpa,lpars-$hcp,lpar,all",'nodetype.nodetype=lpar,osi',
'nodehm.mgt=hmc','nodehm.power=hmc','nodehm.cons=hmc','noderes.netboot=yaboot',
'nodetype.arch=ppc64','ppc.id=|\D+(\d+)|((($1-1)%'.$numlpars.')+3)|',
"ppc.parent=$f","ppc.hcp=$hcp",'ppc.pprofile=diskless2'));
if (getXmlErrors($xml,$errors)) { msg('E',"nodeadd nodes failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; }
// Actually make the lpar profiles. Todo: this is not actually creating the lpar, just a new profile for the existing lpars.
if ($_SERVER["SERVER_ADDR"] != '192.168.153.128') { //todo: remove this check
$xml = docmd('chvm',$nstr,array('-p','diskless2'));
if (getXmlErrors($xml,$errors)) { msg('E',"chvm failed for $nstr: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; }
}
echo "<p class=WizardProgressOutput>Created and defined $nstr in $f.</p>\n"; ob_flush(); flush();
$n2 += $length2;
if ($n2 >= $nmax) break;
}
// Decide if we are all out of nodes
$n += $length;
if ($n >= count($nodes)) break;
}
//todo: Change this when mkvm is creating the base node definition.
// Also, the following assumes the node range starts with 1 and the fsp node range is simple.
// Really need to do individual nodeadd for each node.
$parts = array();
preg_match('/^(\D+)/', $_SESSION['fspHostname'], $parts);
$fsp = $parts[1];
/*
$xml = docmd('nodeadd',NULL,array($_SESSION['computeNodename'],'groups=lpar,all','nodetype.nodetype=lpar,osi',
'nodehm.mgt=hmc','nodehm.power=hmc','nodehm.cons=hmc','noderes.netboot=yaboot',
'nodetype.arch=ppc64','ppc.id=|\D+(\d+)|((($1-1)%'.$numlpars.')+1)|',
'ppc.parent=|(\D+)(\d+)|'.$fsp.'((($2-1)/'.$numlpars.')+1)|'));
if (getXmlErrors($xml,$errors)) { msg('E',"nodeadd nodes failed: " . implode(' ',$errors)); return; }
'ppc.parent=|(\D+)(\d+)|'.$fspprefix.'((($2-1)/'.$numlpars.')+1)|'));
if (getXmlErrors($xml,$errors)) { msg('E',"nodeadd nodes failed: " . implode(' ',$errors)); nextStep(++$step,TRUE); return; }
*/
echo json_encode(array('step' => (integer)++$step, 'done' => TRUE, 'error' => ''));
nextStep(++$step,TRUE);
}
@ -530,5 +611,6 @@ function done($action, $step) {
global $TOPDIR;
echo "<p id=wizardDone>Cluster set up successfully completed!</p>\n";
echo "<p>You can now <a href='$TOPDIR/machines/groups.php'>view your node definitions</a> and start to <a href='$TOPDIR/deploy/osimages.php'>deploy nodes</a>.</p>\n";
echo "<p>&nbsp;<br><br><br><br></p>\n";
}
?>

View File

@ -13,7 +13,7 @@
font-size: 1px;
}
.RackTable IMG { vertical-align: baseline; }
.RackTable IMG { vertical-align: middle; /*baseline;*/ }
.RackEmptyCell { background-color: #999999; }

View File

@ -38,9 +38,7 @@ foreach ($nodes as $nodename => $attrs) {
$isBlade=0;
// Get the display info for this node (image, size, etc.)
$info = getHWInfo(array_key_exists('vpd.mtm',$attrs)?$attrs['vpd.mtm']:'',
array_key_exists('nodehm.power',$attrs)?$attrs['nodehm.power']:'',
array_key_exists('nodehm.mgt',$attrs)?$attrs['nodehm.mgt']:'');
$info = getHWInfo(@$attrs['vpd.mtm'], @$attrs['nodehm.power'], @$attrs['nodehm.mgt']);
if (empty($info)) { continue; }
$image = $info['rackimage'];
$size = $info['u'];
@ -50,7 +48,7 @@ foreach ($nodes as $nodename => $attrs) {
else { $isMM = 0; }
// If this is a blade, have to get the position from its MM
if ($size == 7 && !$isMM) { # blade
if ((@$attrs['nodehm.mgt']=='blade' || @$attrs['nodehm.power']=='blade') && !$isMM) { # blade
$isBlade = 1;
if (!array_key_exists('mp.mpa',$attrs) || !array_key_exists('mp.id',$attrs)) { continue; }
if (!array_key_exists($attrs['mp.mpa'],$nodes)) { continue; }
@ -103,14 +101,14 @@ echo "<TABLE class=AllRacksTable><TBODY valign=bottom><TR>\n";
# xSeries frames are 78.7in H x 23.6in W (3.3 ratio). The server enclosure area is approx 71.4 x 19 (3.75 ratio). Each U is approx 1.725
ksort($frames, SORT_NUMERIC);
foreach ($frames as $fnum => $frame) {
foreach ($frames as $fnum => $frm) {
echo "<TD><INPUT type=checkbox name=selAll${fnum}Checkbox onclick='selectAll(this,$fnum)'><B> Rack $fnum</B>\n";
echo "<TABLE class=RackTable cellpadding=0 cellspacing=2><TBODY>\n";
// Go thru each u position and either draw the svr or fill in an empty slot
for ($i=1; $i<=42;) {
if (array_key_exists($i,$frame)) { # this slot has a server in it
$u = & $frame[$i]; // $u is the machine info at that u #
if (array_key_exists($i,$frm)) { # this slot has a server in it
$u = & $frm[$i]; // $u is the machine info at that u #
// $u has keys of (nodename, image, alt, size) for rack mounted and (nodename, chassis, size) for blades
if (array_key_exists('chassis',$u)) { # this a bladecenter chassis
$chassis = & $u['chassis']; # this is really a ref to an array of blades
@ -161,7 +159,7 @@ function getHWInfo($mtm, $powermethod, $mgt) {
}
# No matches yet. Use the power method to get a generic type.
if (!empty($powermethod)) { $powermethod = $powermethod; }
if (!empty($powermethod)) {}
elseif (!empty($mgt)) { $powermethod = $mgt; }
if (!empty($powermethod)) { return getHWTypeInfo($powermethod); }
else { return NULL; }

View File

@ -14,6 +14,12 @@
padding: 0.5em 0.5em;
}
#nodetabs-a-disabled {
font-size : 8pt;
padding: 0.5em 0.5em;
color: #BFBFBF;
}
/*
#nodepane: { float: left; clear: left; }
#nodetabs { float: left; }

View File

@ -4,6 +4,7 @@ $(document).ready(function(){
window.nodetabs = $("#nodetabs > ul").tabs( { cookie: { expires: 30, path: '/' },
show: function(e,ui) {
if (ui.tab.href.search('#attributes-tab$') > -1) { loadAttrTab($(ui.panel)); }
if (ui.tab.href.search('#rvitals-tab$') > -1) { loadVitalsTab($(ui.panel)); }
}
}); // ends the properties passed to tabs()
});

View File

@ -7,7 +7,7 @@ require_once "$TOPDIR/lib/functions.php";
if (isAIX()) { $aixDisabled = 'disabled'; }
insertHeader('xCAT Groups and Nodes', array("$TOPDIR/jq/jsTree/tree_component.css",'groups.css','attributes.css',"$TOPDIR/manage/dsh.css"),
array("$TOPDIR/jq/jsTree/css.js","$TOPDIR/jq/jsTree/jquery.listen.js","$TOPDIR/jq/jsTree/tree_component.js","$TOPDIR/jq/jquery.cookie.js",'noderangetree.js','groups.js','attributes.js'),
array("$TOPDIR/jq/jsTree/css.js","$TOPDIR/jq/jsTree/jquery.listen.js","$TOPDIR/jq/jsTree/tree_component.js","$TOPDIR/jq/jquery.cookie.js",'noderangetree.js','groups.js','attributes.js','rvitals.js'),
array('machines','groups'));
echo "<div id=content>\n";
@ -19,8 +19,9 @@ echo "<td><div id=nrtree></div></td>\n"; // nrtree is the place to put the node
$tabs = array('Attributes' => '#attributes-tab',
'Run Cmd' => '../manage/dsh.php?intab=1',
'Rpower' => 'rpower.php',
'Rvitals/Rinv' => 'rvitals.php',
'Rvitals' => '#rvitals-tab',
);
$tabsDisabled = array('Rpower' => 'rpower.php',
'Ping' => 'ping.php',
'Copy' => 'copyfiles.php',
'SP Config' => 'spconfig.php',
@ -34,8 +35,12 @@ echo "<ul>\n";
foreach ($tabs as $key => $url) {
echo "<li class='ui-tabs-nav-item'><a id='nodetabs-a' href='$url'>$key</a></li>\n";
}
foreach ($tabsDisabled as $key2 => $url2) {
echo "<li class='ui-tabs-nav-item'><a id='nodetabs-a-disabled' href='$url2'>$key2</a></li>\n";
}
echo "</ul>\n";
echo "<div id='attributes-tab'></div>\n";
echo "<div id='rvitals-tab'></div>\n";
echo "</div></td></tr></table>\n";

View File

@ -15,6 +15,9 @@ function updatenoderange() {
//window.nodetabs.tabs('select', index); // simulate selecting it, so it reloads. Did not work.
loadAttrTab($('#attributes-tab'));
}
if (index == 2) {
loadVitalsTab($('#rvitals-tab'));
}
}
}

View File

@ -0,0 +1,10 @@
// Javascript functions for the Rvitals/rinv tab
function loadVitalsTab(panel) {
//alert('showing vitals tab');
var nr = '';
if (window.noderange && window.noderange != "") { nr = window.noderange; }
panel.children().remove(); // get rid of previous content
panel.append('<p>Loading node vitals... <img src="../images/throbber.gif"></p>');
panel.load('rvitals.php?noderange='+nr);
}

View File

@ -6,12 +6,33 @@ require_once "$TOPDIR/lib/functions.php";
//echo "<LINK rel=stylesheet href='$TOPDIR/manage/dsh.css' type='text/css'>\n";
//echo "<script type='text/javascript' src='$TOPDIR/manage/dsh.js'></script>\n";
echo "<FORM NAME=rvitalsForm>\n";
// Get the noderange
$noderange = @$_REQUEST['noderange'];
//echo "<p>noderange=$noderange.</p>\n";
if (empty($noderange)) { echo "<p>Select one or more groups or nodes for rvitals.</p>\n"; exit; }
//insertButtons(array('label' => 'Show Attributes', 'id' => 'attrButton', 'onclick' => ''));
$xml = docmd('rvitals',$noderange,array('all'));
//echo "<p>"; print_r($xml); echo "</p>\n";
if (getXmlErrors($xml,$errors)) { echo "<p class=Error>rvitals failed: ", implode(' ',$errors), "</p>\n"; exit; }
//echo "<p>"; print_r($xml); echo "</p>\n";
echo "</FORM>\n";
//<script type='text/javascript'>dshReady();</script>
echo "<p>\n";
foreach ($xml->children() as $response) foreach ($response->children() as $o) {
$nodename = (string)$o->name;
$data = & $o->data;
$contents = (string)$data->contents;
$desc = (string)$data->desc;
//echo "<p>"; print_r($data); echo "</p>\n";
echo "$nodename: $desc: $contents<br>\n";
}
echo "</p>\n";
insertNotDoneYet();
//echo "<FORM NAME=rvitalsForm>\n";
//echo "</FORM>\n";
//echo "<script type='text/javascript'>vitalsReady();</script>\n";
//insertNotDoneYet();
?>

View File

@ -86,8 +86,8 @@ fi
if [ "$1" = 1 ] || [ "$1" = 2 ] # initial install, or upgrade and this is the newer rpm
then
#todo: can remove this after a few releases, unless we change xcat-web.conf again
/etc/init.d/$apachedaemon reload
# Uncomment this if we change xcat-web.conf again
#/etc/init.d/$apachedaemon reload
true
fi