From 46baee6cc7dc3e5a2d5a4667ca55d977a7bf0b49 Mon Sep 17 00:00:00 2001 From: bp-sawyers Date: Thu, 28 Oct 2010 11:59:22 +0000 Subject: [PATCH] Added LL and CNM specific settings to db in xcatsetup git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7955 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/pods/man8/xcatsetup.8.pod | 47 ++++++++++++++++++- xCAT-server/lib/xcat/plugins/setup.pm | 67 +++++++++++++++++++++++++-- 2 files changed, 107 insertions(+), 7 deletions(-) diff --git a/xCAT-client/pods/man8/xcatsetup.8.pod b/xCAT-client/pods/man8/xcatsetup.8.pod index 82422234f..5c7f0601c 100644 --- a/xCAT-client/pods/man8/xcatsetup.8.pod +++ b/xCAT-client/pods/man8/xcatsetup.8.pod @@ -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 +If you want to delete all of the nodes that xcatsetup created, and start over, use L and give it all of the ranges +specified in the config file. + =head2 Restrictions =over 3 @@ -94,6 +97,8 @@ The hostnames specified must sort correctly. I.e. use node01-node80, instead of domain = cluster.com # currently only direct fsp control is supported use-direct-fsp-control = 1 + # ISR network topology. For example, one of the following: 128D, 64D, 32D, 16D, 8D, 4D, 2D, 1D + topology = 32D xcat-hmcs: hostname-range = hmc1-hmc3 @@ -196,10 +201,12 @@ in the stanza, some attributes might not be filled in. =item B -site table: domain, nameservers +site table: domain, nameservers, topology =item B +site table: ea_primary_hmc, ea_backup_hmc + nodelist table: node, groups hosts table: node, ip @@ -234,13 +241,15 @@ nodetype table: node, nodetype nodehm table: node, mgt +nodegroup table: groupname, grouptype, members, wherevals + =item B site table: sharedtftp ppc table: node, parent (for frame) -=item B +=item B nodelist table: node, groups @@ -256,6 +265,40 @@ noderes table: netboot servicenode table: node, nameserver, dhcpserver, tftpserver, nfsserver, conserver, monserver, ftpserver, nimserver, ipforward +nodegroup table: groupname, grouptype, members, wherevals + +=item B + +nodelist table: node, groups + +hosts table: node, ip, hostnames, otherinterfaces + +ppc table: node, id, hcp, parent + +nodetype table: node, nodetype, arch + +nodehm table: node, mgt, cons + +noderes table: netboot, xcatmaster, servicenode + +=item B + +nodelist table: node, groups + +hosts table: node, ip, hostnames, otherinterfaces + +ppc table: node, id, hcp, parent + +nodetype table: node, nodetype, arch + +nodehm table: node, mgt, cons + +noderes table: netboot, xcatmaster, servicenode + +=item B + +postscripts: postscripts + =back =head1 OPTIONS diff --git a/xCAT-server/lib/xcat/plugins/setup.pm b/xCAT-server/lib/xcat/plugins/setup.pm index 4670ee5b5..7497b9343 100644 --- a/xCAT-server/lib/xcat/plugins/setup.pm +++ b/xCAT-server/lib/xcat/plugins/setup.pm @@ -142,6 +142,7 @@ my %tables = ('site' => 0, 'nodetype' => 0, 'nodehm' => 0, 'noderes' => 0, + 'postscripts' => 0, ); sub writedb { @@ -170,7 +171,7 @@ sub writedb { # Write HMC info (hash key=xcat-hmcs) my $hmcrange = $STANZAS{'xcat-hmcs'}->{'hostname-range'}; - if ($hmcrange && (!scalar(keys(%$sections))||$$sections{'xcat-site'})) { writehmc($hmcrange); } + if ($hmcrange && (!scalar(keys(%$sections))||$$sections{'xcat-hmcs'})) { writehmc($hmcrange); } # Write frame info (hash key=xcat-frames) my $framerange = $STANZAS{'xcat-frames'}->{'hostname-range'}; @@ -224,7 +225,11 @@ sub writesite { if ($ref) { $tables{'site'}->setAttribs({key => 'nameservers'}, {value => $ref->{value} }); } - $tables{'site'}->close(); + + # set the HFI switch topology + if ($STANZAS{'xcat-site'}->{topology}) { + $tables{'site'}->setAttribs({key => 'topology'}, {value => $STANZAS{'xcat-site'}->{topology} }); + } #todo: put dynamic range in networks table #todo: set site.dhcpinterfaces @@ -232,7 +237,7 @@ sub writesite { sub writehmc { - #using hostname-range, write: nodelist.node, nodelist.groups + # using hostname-range, write: nodelist.node, nodelist.groups my $hmcrange = shift; infomsg('Defining HMCs...'); my $nodes = [noderange($hmcrange, 0)]; @@ -243,7 +248,7 @@ sub writehmc { $tables{'nodelist'}->setNodesAttribs($nodes, { groups => 'hmc,all' }); } - #using hostname-range and starting-ip, write regex for: hosts.node, hosts.ip + # using hostname-range and starting-ip, write regex for: hosts.node, hosts.ip my $hmcstartip = $STANZAS{'xcat-hmcs'}->{'starting-ip'}; if ($hmcstartip) { my $hmchash = parsenoderange($hmcrange); @@ -255,9 +260,14 @@ sub writehmc { $tables{'hosts'}->setNodeAttribs('hmc', {ip => $regex}); } - #using hostname-range, write regex for: ppc.node, nodetype.nodetype + # using hostname-range, write regex for: ppc.node, nodetype.nodetype $tables{'ppc'}->setNodeAttribs('hmc', {comments => 'hmc'}); $tables{'nodetype'}->setNodeAttribs('hmc', {nodetype => 'hmc'}); + + # Set the 1st two hmcs as the ones CNM should send service events to + $nodes = [noderange($hmcrange, 0)]; + $tables{'site'}->setAttribs({key => 'ea_primary_hmc'}, {value => $$nodes[0]}); + if (scalar(@$nodes) >= 2) { $tables{'site'}->setAttribs({key => 'ea_backup_hmc'}, {value => $$nodes[1]}); } } @@ -416,6 +426,19 @@ sub writecec { $tables{'ppc'}->setNodesAttribs(\%ppchash); $tables{'nodelist'}->setNodesAttribs(\%nodehash); } + + # Create dynamic groups for the nodes in each cec + my $ntab = xCAT::Table->new('nodegroup', -create=>1,-autocommit=>0); + if (!$ntab) { errormsg("Can not open nodegroup table in database.", 3); } + else { + $nodes = [noderange($cecrange, 0)]; # the setNodesAttribs() function blanks out the nodes array + foreach my $n (@$nodes) { + $ntab->setAttribs({groupname => "${n}nodes"}, {grouptype => 'dynamic', members => 'dynamic', wherevals => "parent==$n" }); + } + $ntab->commit(); + $ntab->close(); + } + } # Read/parse the supernode-list file and return the values in a hash of arrays @@ -512,6 +535,17 @@ sub writesn { else { $sntab->setNodeAttribs('service', {nameserver=>1, dhcpserver=>1, tftpserver=>1, nfsserver=>1, conserver=>1, monserver=>1, ftpserver=>1, nimserver=>1, ipforward=>1}); } + if ($STANZAS{'ll-config'}->{'central_manager_list'}) { # write the LL postscript for service nodes + my $ref = $tables{'postscripts'}->getNodeAttribs('service', 'postscripts'); + #print Dumper($ref); + my $posts; + if ($ref && $ref->{postscripts}=~/\S/) { + $posts = $ref->{postscripts}; + if ($posts !~ /(^|,)llserver\.sh(,|$)/) { $posts .= ",llserver.sh"; } + } + else { $posts = "llserver.sh"; } + $tables{'postscripts'}->setNodeAttribs('service', {postscripts => $posts }); + } # Figure out what cec each sn is in and write ppc.hcp and ppc.parent #todo: also write nodepos table @@ -557,6 +591,18 @@ sub writesn { } $tables{'ppc'}->setNodesAttribs(\%nodehash); $tables{'nodelist'}->setNodesAttribs(\%grouphash); + + # Create dynamic groups for the nodes in each cec + my $ntab = xCAT::Table->new('nodegroup', -create=>1,-autocommit=>0); + if (!$ntab) { errormsg("Can not open nodegroup table in database.", 3); } + else { + $nodes = [noderange($range, 0)]; # the setNodesAttribs() function blanks out the nodes array + foreach my $n (@$nodes) { + $ntab->setAttribs({groupname => "${n}nodes"}, {grouptype => 'dynamic', members => 'dynamic', wherevals => "xcatmaster==$n" }); + } + $ntab->commit(); + $ntab->close(); + } } @@ -722,6 +768,17 @@ sub writecompute { $tables{'nodetype'}->setNodeAttribs('compute', {nodetype => 'osi', arch => 'ppc64'}); $tables{'nodehm'}->setNodeAttribs('compute', {mgt => 'fsp', cons => 'fsp'}); $tables{'noderes'}->setNodeAttribs('compute', {netboot => 'yaboot'}); + if ($STANZAS{'ll-config'}->{'central_manager_list'}) { # write the LL postscript for compute nodes + my $ref = $tables{'postscripts'}->getNodeAttribs('compute', 'postscripts'); + #print Dumper($ref); + my $posts; + if ($ref && $ref->{postscripts}=~/\S/) { + $posts = $ref->{postscripts}; + if ($posts !~ /(^|,)llcompute\.sh(,|$)/) { $posts .= ",llcompute.sh"; } + } + else { $posts = "llcompute.sh"; } + $tables{'postscripts'}->setNodeAttribs('compute', {postscripts => $posts }); + } # Figure out what cec each compute node is in and write ppc.hcp, ppc.parent, ppc.id, noderes.xcatmaster, noderes.servicenode #todo: also write nodepos table