From 8f0584730ec6cd53c08b199eb2113bdb0ed3a898 Mon Sep 17 00:00:00 2001 From: bp-sawyers Date: Thu, 3 Mar 2011 18:41:59 +0000 Subject: [PATCH] Allow simpler config files for xcatsetup git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8975 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/pods/man8/xcatsetup.8.pod | 40 ++++++++++++++++++++------- xCAT-server/lib/xcat/plugins/setup.pm | 36 ++++++++++++++++++++++-- 2 files changed, 63 insertions(+), 13 deletions(-) diff --git a/xCAT-client/pods/man8/xcatsetup.8.pod b/xCAT-client/pods/man8/xcatsetup.8.pod index 36abc7093..42acf6f35 100644 --- a/xCAT-client/pods/man8/xcatsetup.8.pod +++ b/xCAT-client/pods/man8/xcatsetup.8.pod @@ -49,7 +49,7 @@ Run nodeset and rpower/rnetboot to boot up the nodes. The B command is intended as a quick way to fill out the database for a cluster that has very regular naming patterns. The only thing it does is fill in database attributes. If your cluster does not follow consistent -naming patterns, or has some other special configuration, you should define attribute values manually instead of using +naming patterns, or has some other special configuration, you should define attribute values manually using L, instead of using B. The cluster config file is meant to be an easy way to prime the database; it is not meant to be a long living file that you update as the cluster changes. If you do want to run xcatsetup again at a later time, because, for example, you added a lot of nodes, you should put the total list of nodes in the config file, not just @@ -64,6 +64,9 @@ use individual rows for every node, you can do the following: lsdef -z all >tmp.stanza cat tmp.stanza | chdef -z +Many of the sections and attributes in the configuration file can be omitted, if you have a simple cluster, or if you want +to create just 1 or 2 of the object types at this time. See the section B for an example of this. + If you want to delete all of the nodes that xcatsetup created, and start over, use the B<--yesreallydeletenodes> option. =head2 Restrictions @@ -174,34 +177,51 @@ in the cluster must be specified (A-side only). Here is a sample file: - bpc01: + bpc1: objtype=node serial=99200G1 mtm=9A00-100 side=A - bpc02: + bpc2: objtype=node serial=99200D1 mtm=9A00-100 side=A + ... + =head2 Supernode Numbers for CECs The B file lists what supernode numbers should be given to each CEC in each frame. Here is a sample file: - bpc01: 0, 1, 16 - bpc02: 17, 32 - bpc03: 33, 48, 49 - bpc04: 64 , 65, 80 - bpc05: 81, 96 - bpc06: 97(1), 112(1), 113(1) + bpc1: 0, 1, 16 + bpc2: 17, 32 + bpc3: 33, 48, 49 + bpc4: 64 , 65, 80 + bpc5: 81, 96 + bpc6: 97(1), 112(1), 113(1), 37(1), 55, 71 The name before the colon is the node name of the frame BPC. The numbers after the colon are the supernode numbers to assign to the groups of CECs in that frame from bottom to top. Each supernode contains 4 CECs, unless it is immediately followed by "(#)", in which case the number in parenthesis indicates how many CECs are in this supernode. +=head2 A Simpler Configuration File + +This is an example of a simple cluster config file that just defines the frames and CECs for 2 frames, without specifying +VPD data or supernode numbers at this time. + + xcat-site: + use-direct-fsp-control = 1 + + xcat-frames: + hostname-range = bpc[1-2] + + xcat-cecs: + hostname-range = cec[01-24] + num-cecs-per-frame = 12 + =head2 Database Attributes Written The following lists which database attributes are filled in as a result of each stanza. Note that depending on the values @@ -361,5 +381,5 @@ using this option. =head1 SEE ALSO -L, L, L, L, L, L +L, L, L, L, L, L diff --git a/xCAT-server/lib/xcat/plugins/setup.pm b/xCAT-server/lib/xcat/plugins/setup.pm index 670b10d12..f427fbf3c 100644 --- a/xCAT-server/lib/xcat/plugins/setup.pm +++ b/xCAT-server/lib/xcat/plugins/setup.pm @@ -81,6 +81,7 @@ sub process_request foreach my $s (split(/[\s,]+/, $SECT)) { $SECTIONS{$s} = 1; } } + #todo: support reading the config file from stdin my $input; my $filename = fullpath($ARGV[0], $request->{cwd}->[0]); if (!open($input, $filename)) { @@ -441,9 +442,38 @@ sub writecec { # Create dynamic groups for the nodes in each cec $nodes = [noderange($cecrange, 0)]; # the setNodesAttribs() function blanks out the nodes array dynamicGroups('add', $nodes, 'parent=='); - - # Write supernode-list in ppc.supernode. While we are at it, also assign the cage id and parent. + $nodes = [noderange($cecrange, 0)]; # the setNodesAttribs() function blanks out the nodes array + + # If they are taking the simple approach for now of not assigning supernode #s, but just told + # us how many cecs should be in each frame, write: ppc.id, ppc.parent, nodelist.groups, nodepos.rack, nodepos.u + if (!($STANZAS{'xcat-cecs'}->{'supernode-list'}) && $STANZAS{'xcat-cecs'}->{'num-cecs-per-frame'}) { + # Loop thru all cecs, incrementing the cageid and frameindex appropriately, and put the cec attrs in the hashes. + my $cecsperframe = $STANZAS{'xcat-cecs'}->{'num-cecs-per-frame'}; + my %ppchash; + my %nodehash; + my %nodeposhash; + my $numcecs = 1; # the # of cecs we have assigned to the current frame + my $cageid = 5; #todo: p7 ih starts at 5, but what about other models? + my $frames = [noderange($STANZAS{'xcat-frames'}->{'hostname-range'}, 0)]; + my $frameindex = 0; + foreach my $cec (@$nodes) { + my $framename = $$frames[$frameindex]; + $ppchash{$cec} = { id => $cageid, parent => $framename }; + $nodehash{$cec} = { groups => "${framename}cecs,cec,all" }; + my ($framenum) = $framename =~ /\S+?(\d+)$/; + $nodeposhash{$cec} = { rack => $framenum+0, u => $cageid }; + # increment indexes for the next iteration of the loop + $cageid += 2; + $numcecs++; + if ($numcecs > $cecsperframe) { $frameindex++; $numcecs=1; $cageid=5; } #todo: p7 ih starts at 5 + } + $tables{'ppc'}->setNodesAttribs(\%ppchash); + $tables{'nodelist'}->setNodesAttribs(\%nodehash); + $tables{'nodepos'}->setNodesAttribs(\%nodeposhash); + } + + # If they specified supernode-list, write ppc.supernode. While we are at it, also assign the cage id and parent. my %framesupers; if (!($STANZAS{'xcat-cecs'}->{'supernode-list'})) { return 1; } my $filename = fullpath($STANZAS{'xcat-cecs'}->{'supernode-list'}, $cwd); @@ -460,7 +490,7 @@ sub writecec { foreach my $k (sort keys %framesupers) { my $f = $framesupers{$k}; # $f is a ptr to an array of super node numbers if (!$f) { next; } # in case some frame nums did not get filled in by user - my $cageid = 3; #todo: p7 ih starts at 3, but what about other models? + my $cageid = 5; #todo: p7 ih starts at 5, but what about other models? my $numcecs = 0; foreach my $s (@$f) { # loop thru the supernode nums in this frame my $supernum = $s;