From dfdb1c19025674c6168e8a628ac794e603460ea3 Mon Sep 17 00:00:00 2001 From: bp-sawyers <bp-sawyers@8638fb3e-16cb-4fca-ae20-7b5d299a9bcd> Date: Sun, 26 Sep 2010 10:24:49 +0000 Subject: [PATCH] Added class b network support for compute nodes in xcatsetup git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7647 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/pods/man8/xcatsetup.8.pod | 18 +++++++++++++++--- xCAT-server/lib/xcat/plugins/setup.pm | 15 ++++++++++----- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/xCAT-client/pods/man8/xcatsetup.8.pod b/xCAT-client/pods/man8/xcatsetup.8.pod index 9056bec3d..7d958846a 100644 --- a/xCAT-client/pods/man8/xcatsetup.8.pod +++ b/xCAT-client/pods/man8/xcatsetup.8.pod @@ -48,9 +48,21 @@ Run nodeset and rpower/rnetboot to boot up the nodes. =back The B<xcatsetup> command is intended as a quick way to fill out the database for a cluster that has very regular -naming patterns. The only thing is done is fill in database attributes. If your cluster does not follow consistent +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 -B<xcatsetup>. +B<xcatsetup>. 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 +the new ones. This is because xcatsetup uses some regular expressions for groups (e.g. frame, cec, compute) that would +be calculated incorrectly if the config file told xcatsetup about only the new nodes. + +Speaking of regular expressions, xcatsetup creates some pretty complicated regular expressions in the database. +These are useful because they keep most of the tables small, even for large clusters. But if you want to +tweak them, they may be hard to understand. If after running xcatsetup, you want to convert your database to +use individual rows for every node, you can do the following: + + lsdef -z all >tmp.stanza + cat tmp.stanza | chdef -z Note: currently the B<xcatsetup> command has only been implemented and tested for system p servers. @@ -123,7 +135,7 @@ in L<xcatstanzafile(5)|xcatstanzafile.5>. Here is a sample file: mtm=9A00-100 side=A -The supernode-list file lists what supernode numbers should be given to each CEC in each frame. +The B<supernode-list> file lists what supernode numbers should be given to each CEC in each frame. Here is a sample file: bpc01: 0, 1, 16 diff --git a/xCAT-server/lib/xcat/plugins/setup.pm b/xCAT-server/lib/xcat/plugins/setup.pm index 1283516d6..42d591abb 100644 --- a/xCAT-server/lib/xcat/plugins/setup.pm +++ b/xCAT-server/lib/xcat/plugins/setup.pm @@ -556,7 +556,6 @@ sub writecompute { my $range = shift; infomsg('Defining compute nodes...'); my $nodes = [noderange($range, 0)]; - my ($startnum) = $$nodes[0] =~/^\D+(\d+)$/; # save this value for later if (scalar(@$nodes)) { $tables{'nodelist'}->setNodesAttribs($nodes, { groups => 'compute,all' }); } @@ -564,9 +563,14 @@ sub writecompute { # Write regex for: hosts.node, hosts.ip my $startip = $STANZAS{'xcat-lpars'}->{'compute-node-starting-ip'}; if ($startip) { - my ($ipbase, $ipstart) = $startip =~/^(\d+\.\d+\.\d+)\.(\d+)$/; + my ($ipbase, $ip3rd, $ip4th) = $startip =~/^(\d+\.\d+)\.(\d+)\.(\d+)$/; # take the number from the nodename, and as it increases, increase the ip addr - my $regex = '|\D+(\d+)|' . "$ipbase.($ipstart+" . '$1' . "-$startnum)|"; + my $nodehash = parsenoderange($range); + my $startnum = $$nodehash{'primary-start'}; + # Math for 4th field: (ip4th-1+nodenum-startnum)%254 + 1 + # Math for 3rd field: (ip4th-1+nodenum-startnum)/254 + ip3rd + my $regex = '|\D+(\d+)|' . "$ipbase.((${ip4th}-1+" . '$1' . "-$startnum)/254+$ip3rd).((${ip4th}-1+" . '$1' . "-$startnum)%254+1)|"; + #my $regex = '|\D+(\d+)|' . "$ipbase.($ipstart+" . '$1' . "-$startnum)|"; my %hash = (ip => $regex); my $otherint = $STANZAS{'xcat-lpars'}->{'compute-node-otherinterfaces'}; if ($otherint) { @@ -574,8 +578,9 @@ sub writecompute { my @ifs = split(/[\s,]+/, $otherint); foreach my $if (@ifs) { my ($nic, $startip) = split(/:/, $if); - ($ipbase, $ipstart) = $startip =~/^(\d+\.\d+\.\d+)\.(\d+)$/; - $if = "$nic:$ipbase.($ipstart+" . '$1' . "-$startnum)"; + ($ipbase, $ip3rd, $ip4th) = $startip =~/^(\d+\.\d+)\.(\d+)\.(\d+)$/; + #$if = "$nic:$ipbase.($ipstart+" . '$1' . "-$startnum)"; + $if = "$nic:$ipbase.((${ip4th}-1+" . '$1' . "-$startnum)/254+$ip3rd).((${ip4th}-1+" . '$1' . "-$startnum)%254+1)|"; } $regex = '|\D+(\d+)|' . join(',', @ifs) . '|'; #print "regex=$regex\n";