From acc8bcb76bb94241191fe13e4e4201df0ead6b4f Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 29 Nov 2016 13:31:22 -0500 Subject: [PATCH 001/100] Have snmpmon set the community string Some BMCs do not default to 'public' for alerts. Change this to do public for now, since other parts of the code are still hard baked. --- xCAT-server/lib/xcat/monitoring/snmpmon.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/monitoring/snmpmon.pm b/xCAT-server/lib/xcat/monitoring/snmpmon.pm index 1a7cf4d4d..c0bbb6c1e 100644 --- a/xCAT-server/lib/xcat/monitoring/snmpmon.pm +++ b/xCAT-server/lib/xcat/monitoring/snmpmon.pm @@ -514,8 +514,8 @@ sub configBMC { $ret_text .= "Changeing SNMP PEF policy for IPMI nodes $noderange:\n $result\n"; } } elsif ($action == 1) { - print "XCATBYPASS=Y rspconfig $noderange alert=en\n"; - my $result = `XCATBYPASS=Y rspconfig $noderange alert=en 2>&1`; + print "XCATBYPASS=Y rspconfig $noderange alert=en community=public\n"; + my $result = `XCATBYPASS=Y rspconfig $noderange alert=en community=public 2>&1`; if ($?) { $ret_val = 1; xCAT::MsgUtils->message('S', "[mon]: Changeing SNMP PEF policy for IPMI nodes $noderange:\n $result\n"); From 9e432dd6a8c75019be745545b694fd662794c79f Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 29 Nov 2016 13:37:32 -0500 Subject: [PATCH 002/100] Revert "Undefine the release number so that the spec files will continue" This reverts commit 505a1c0556f684b204c0d5cbf955648d1df14209. --- makerpm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/makerpm b/makerpm index 912ddf3db..471943f1c 100755 --- a/makerpm +++ b/makerpm @@ -55,7 +55,7 @@ function makenoarch { tar --exclude .svn -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm - rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz --define "version $VER" + rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz --define "version $VER" $REL "$EASE" RC=$? if [ $RPMNAME = "xCAT-UI" ]; then @@ -137,7 +137,7 @@ function makexcat { rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER*rpm echo "Building $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER-snap*.$ARCH.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec $TARGET --define "version $VER" + rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec $TARGET --define "version $VER" $REL "$EASE" RC=$? fi } @@ -170,7 +170,7 @@ function makegenesis { cd - >/dev/null rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $DIR/$RPMNAME.spec --define "version $VER" + rpmbuild $QUIET -ba $DIR/$RPMNAME.spec --define "version $VER" $REL "$EASE" } function makegenesisscripts { @@ -190,7 +190,7 @@ function makegenesisscripts { cd - >/dev/null rm -f $RPMROOT/SRPMS/$RPMNAME-$ARCH-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$ARCH-$VER*rpm echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$ARCH-$VER-snap*.noarch.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $DIR/$RPMNAME.spec $TARGET --define "version $VER" + rpmbuild $QUIET -ba $DIR/$RPMNAME.spec $TARGET --define "version $VER" $REL "$EASE" } From 4cae23ccf1372c828a0b41450a34b8057d767608 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 29 Nov 2016 13:39:34 -0500 Subject: [PATCH 003/100] Revert "Revert "Undefine the release number so that the spec files will continue"" This reverts commit 9e432dd6a8c75019be745545b694fd662794c79f. --- makerpm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/makerpm b/makerpm index 471943f1c..912ddf3db 100755 --- a/makerpm +++ b/makerpm @@ -55,7 +55,7 @@ function makenoarch { tar --exclude .svn -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm - rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz --define "version $VER" $REL "$EASE" + rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz --define "version $VER" RC=$? if [ $RPMNAME = "xCAT-UI" ]; then @@ -137,7 +137,7 @@ function makexcat { rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER*rpm echo "Building $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER-snap*.$ARCH.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec $TARGET --define "version $VER" $REL "$EASE" + rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec $TARGET --define "version $VER" RC=$? fi } @@ -170,7 +170,7 @@ function makegenesis { cd - >/dev/null rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $DIR/$RPMNAME.spec --define "version $VER" $REL "$EASE" + rpmbuild $QUIET -ba $DIR/$RPMNAME.spec --define "version $VER" } function makegenesisscripts { @@ -190,7 +190,7 @@ function makegenesisscripts { cd - >/dev/null rm -f $RPMROOT/SRPMS/$RPMNAME-$ARCH-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$ARCH-$VER*rpm echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$ARCH-$VER-snap*.noarch.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $DIR/$RPMNAME.spec $TARGET --define "version $VER" $REL "$EASE" + rpmbuild $QUIET -ba $DIR/$RPMNAME.spec $TARGET --define "version $VER" } From 009291262908027d016a12c1125c7195bedaa017 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 29 Nov 2016 13:39:50 -0500 Subject: [PATCH 004/100] Revert "Have snmpmon set the community string" This reverts commit acc8bcb76bb94241191fe13e4e4201df0ead6b4f. --- xCAT-server/lib/xcat/monitoring/snmpmon.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/monitoring/snmpmon.pm b/xCAT-server/lib/xcat/monitoring/snmpmon.pm index c0bbb6c1e..1a7cf4d4d 100644 --- a/xCAT-server/lib/xcat/monitoring/snmpmon.pm +++ b/xCAT-server/lib/xcat/monitoring/snmpmon.pm @@ -514,8 +514,8 @@ sub configBMC { $ret_text .= "Changeing SNMP PEF policy for IPMI nodes $noderange:\n $result\n"; } } elsif ($action == 1) { - print "XCATBYPASS=Y rspconfig $noderange alert=en community=public\n"; - my $result = `XCATBYPASS=Y rspconfig $noderange alert=en community=public 2>&1`; + print "XCATBYPASS=Y rspconfig $noderange alert=en\n"; + my $result = `XCATBYPASS=Y rspconfig $noderange alert=en 2>&1`; if ($?) { $ret_val = 1; xCAT::MsgUtils->message('S', "[mon]: Changeing SNMP PEF policy for IPMI nodes $noderange:\n $result\n"); From 2c36531a44dd59de99c88a75a2b4b825de940a43 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 8 Dec 2016 14:14:13 -0500 Subject: [PATCH 005/100] change the URL for go-xcat to github --- docs/source/guides/install-guides/common_sections.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/install-guides/common_sections.rst b/docs/source/guides/install-guides/common_sections.rst index d4fdad136..e9f7cc87e 100644 --- a/docs/source/guides/install-guides/common_sections.rst +++ b/docs/source/guides/install-guides/common_sections.rst @@ -64,7 +64,7 @@ The following sections describe the different methods for installing xCAT. #. Download the ``go-xcat`` tool using ``wget``: :: - wget http://xcat.org/files/go-xcat -O - >/tmp/go-xcat + wget https://raw.githubusercontent.com/xcat2/xcat-core/master/xCAT-server/share/xcat/tools/go-xcat -O - >/tmp/go-xcat chmod +x /tmp/go-xcat #. Run the ``go-xcat`` tool: :: From 97f9d4da8fbbd22a100e62b54c5d7648f7263315 Mon Sep 17 00:00:00 2001 From: chenglch Date: Fri, 23 Dec 2016 13:45:20 +0800 Subject: [PATCH 006/100] Do not update bootparams table when running nodeset With the nytprof tool, the buttleneck is the time to update the bootparams table.To optimize the performance on large scale nodes, this patch tranfer the bootparams hash through variable reference. posible impact: getdestiny can not get the information about bootparams. partial-issue: #2024 --- xCAT-server/lib/xcat/plugins/anaconda.pm | 45 +++++------------ xCAT-server/lib/xcat/plugins/debian.pm | 28 +++-------- xCAT-server/lib/xcat/plugins/destiny.pm | 16 +++--- xCAT-server/lib/xcat/plugins/grub2.pm | 9 ++-- xCAT-server/lib/xcat/plugins/petitboot.pm | 9 ++-- xCAT-server/lib/xcat/plugins/pxe.pm | 7 +-- xCAT-server/lib/xcat/plugins/sles.pm | 60 +++++++---------------- xCAT-server/lib/xcat/plugins/vsmppxe.pm | 7 +-- xCAT-server/lib/xcat/plugins/xnba.pm | 10 ++-- 9 files changed, 69 insertions(+), 122 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 6decce701..513cedb15 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -172,6 +172,7 @@ sub mknetboot if ($req->{command}->[0] =~ 'mkstatelite') { $statelite = "true"; } + my $bootparams = ${$req->{bootparams}}; my $globaltftpdir = "/tftpboot"; my $nodes = @{ $req->{node} }; my @args = @{ $req->{arg} } if (exists($req->{arg})); @@ -232,7 +233,6 @@ sub mknetboot my %donetftp = (); my %oents = %{ $ostab->getNodesAttribs(\@nodes, [qw(os arch profile provmethod)]) }; my $restab = xCAT::Table->new('noderes'); - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $hmtab = xCAT::Table->new('nodehm'); my $mactab = xCAT::Table->new('mac'); @@ -249,8 +249,6 @@ sub mknetboot $stateHash = $statetab->getNodesAttribs(\@nodes, ['statemnt']); } - #my $addkcmdhash = - # $bptab->getNodesAttribs(\@nodes, ['addkcmdline']); # Warning message for nodeset install/netboot/statelite foreach my $knode (keys %oents) @@ -950,15 +948,9 @@ sub mknetboot $kcmdline .= " MNTOPTS=$mntoptions"; } } - - $bptab->setNodeAttribs( - $node, - { - kernel => $kernstr, - initrd => $initrdstr, - kcmdline => $kcmdline - } - ); + $bootparams->{$node}->[0]->{kernel} = $kernstr; + $bootparams->{$node}->[0]->{initrd} = $initrdstr; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } } @@ -971,6 +963,7 @@ sub mkinstall my @nodes = @{ $request->{node} }; my $noupdateinitrd = $request->{'noupdateinitrd'}; my $ignorekernelchk = $request->{'ignorekernelchk'}; + my $bootparams = ${$request->{bootparams}}; #my $sitetab = xCAT::Table->new('site'); my $linuximagetab; @@ -1023,7 +1016,6 @@ sub mkinstall my $ostab = xCAT::Table->new('nodetype'); my %donetftp; my $restab = xCAT::Table->new('noderes'); - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $hmtab = xCAT::Table->new('nodehm'); my $mactab = xCAT::Table->new('mac'); my %osents = %{ $ostab->getNodesAttribs(\@nodes, [ 'profile', 'os', 'arch', 'provmethod' ]) }; @@ -1033,8 +1025,6 @@ sub mkinstall [ 'serialport', 'serialspeed', 'serialflow' ]) }; my %macents = %{ $mactab->getNodesAttribs(\@nodes, ['mac']) }; - #my $addkcmdhash = - # $bptab->getNodesAttribs(\@nodes, ['addkcmdline']); require xCAT::Template; # Warning message for nodeset install/netboot/statelite @@ -1668,14 +1658,9 @@ sub mkinstall xCAT::MsgUtils->trace($verbose_on_off, "d", "anaconda->mkinstall: kcmdline=$kcmdline kernal=$k initrd=$i"); - $bptab->setNodeAttribs( - $node, - { - kernel => $k, - initrd => $i, - kcmdline => $kcmdline - } - ); + $bootparams->{$node}->[0]->{kernel} = $k; + $bootparams->{$node}->[0]->{initrd} = $i; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } else { @@ -1701,6 +1686,7 @@ sub mksysclone my $callback = shift; my $doreq = shift; my @nodes = @{ $request->{node} }; + my $bootparams = ${$request->{bootparams}}; my $linuximagetab; my $osimagetab; my %img_hash = (); @@ -1727,7 +1713,6 @@ sub mksysclone my $ostab = xCAT::Table->new('nodetype'); my %donetftp; my $restab = xCAT::Table->new('noderes'); - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $hmtab = xCAT::Table->new('nodehm'); my $mactab = xCAT::Table->new('mac'); @@ -2064,15 +2049,9 @@ sub mksysclone $k = "xcat/$kernpath"; $i = "xcat/$initrdpath"; - - $bptab->setNodeAttribs( - $node, - { - kernel => $k, - initrd => $i, - kcmdline => $kcmdline - } - ); + $bootparams->{$node}->[0]->{kernel} = $k; + $bootparams->{$node}->[0]->{initrd} = $i; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } else { diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 89c405cbf..823e80b36 100644 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -445,6 +445,7 @@ sub mkinstall { my $callback = shift; my $doreq = shift; my @nodes = @{ $request->{node} }; + my $bootparams = ${$request->{bootparams}}; my $sitetab = xCAT::Table->new('site'); my $linuximagetab; my $osimagetab; @@ -490,7 +491,6 @@ sub mkinstall { my $ostab = xCAT::Table->new('nodetype'); my %donetftp; my $restab = xCAT::Table->new('noderes'); - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $hmtab = xCAT::Table->new('nodehm'); my $mactab = xCAT::Table->new('mac'); my %osents = %{ $ostab->getNodesAttribs(\@nodes, [ 'profile', 'os', 'arch', 'provmethod' ]) }; @@ -502,8 +502,6 @@ sub mkinstall { [ 'serialport', 'serialspeed', 'serialflow' ]) }; my %macents = %{ $mactab->getNodesAttribs(\@nodes, ['mac']) }; - #my $addkcmdhash = - # $bptab->getNodesAttribs(\@nodes, ['addkcmdline']); require xCAT::Template; # Warning message for nodeset install/netboot/statelite @@ -923,10 +921,9 @@ sub mkinstall { } xCAT::MsgUtils->trace($verbose_on_off, "d", "debian->mkinstall: kcmdline=$kcmdline kernal=$rtftppath/vmlinuz initrd=$rtftppath/initrd.img"); - - $bptab->setNodeAttribs($node, { kernel => "$rtftppath/vmlinuz", - initrd => "$rtftppath/initrd.img", - kcmdline => $kcmdline }); + $bootparams->{$node}->[0]->{kernel} = "$rtftppath/vmlinuz"; + $bootparams->{$node}->[0]->{initrd} = "$rtftppath/initrd.img"; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } else { $callback->({ error => ["Install image not found in $installroot/$os/$arch"], @@ -945,6 +942,7 @@ sub mknetboot if ($req->{command}->[0] =~ 'mkstatelite') { $statelite = "true"; } + my $bootparams = ${$request->{bootparams}}; my $tftpdir = "/tftpboot"; my $nodes = @{ $req->{node} }; my @args = @{ $req->{arg} }; @@ -991,7 +989,6 @@ sub mknetboot my %donetftp = (); my %oents = %{ $ostab->getNodesAttribs(\@nodes, [qw(os arch profile provmethod)]) }; my $restab = xCAT::Table->new('noderes'); - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $hmtab = xCAT::Table->new('nodehm'); my $mactab = xCAT::Table->new('mac'); @@ -1008,9 +1005,6 @@ sub mknetboot $stateHash = $statetab->getNodesAttribs(\@nodes, ['statemnt']); } - #my $addkcmdhash = - # $bptab->getNodesAttribs(\@nodes, ['addkcmdline']); - # Warning message for nodeset install/netboot/statelite foreach my $knode (keys %oents) { my $ent = $oents{$knode}->[0]; @@ -1589,15 +1583,9 @@ sub mknetboot $kcmdline .= " MNTOPTS=$mntoptions"; } } - - $bptab->setNodeAttribs( - $node, - { - kernel => "$kernstr", - initrd => "$initrdstr", - kcmdline => $kcmdline - } - ); + $bootparams->{$node}->[0]->{kernel} = $kernstr; + $bootparams->{$node}->[0]->{initrd} = $initrdstr; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } #my $rc = xCAT::TableUtils->create_postscripts_tar(); diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index d2eb6b26d..f43449209 100755 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -26,7 +26,6 @@ my $errored = 0; #DESTINY SCOPED GLOBALS my $chaintab; my $iscsitab; -my $bptab; my $typetab; my $restab; @@ -94,6 +93,7 @@ sub setdestiny { my $noupdate = shift; $chaintab = xCAT::Table->new('chain', -create => 1); my @nodes = @{ $req->{node} }; + my $bphash = $req->{bootparams}; @ARGV = @{ $req->{arg} }; my $noupdateinitrd; @@ -157,7 +157,6 @@ sub setdestiny { unless ($iscsitab) { $callback->({ error => "Unable to open iscsi table to get iscsiboot parameters", errorcode => [1] }); } - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $nodetype = xCAT::Table->new('nodetype'); my $ntents = $nodetype->getNodesAttribs($req->{node}, [qw(os arch profile)]); my $ients = $iscsitab->getNodesAttribs($req->{node}, [qw(kernel kcmdline initrd)]); @@ -168,11 +167,9 @@ sub setdestiny { unless ($ntent and $ntent->{arch} =~ /x86/ and -f ("$tftpdir/undionly.kpxe" or -f "$tftpdir/xcat/xnba.kpxe")) { $callback->({ error => "$_: No iscsi boot data available", errorcode => [1] }); } #If x86 node and undionly.kpxe exists, presume they know what they are doing next; } - my $hash; - $hash->{kernel} = $ient->{kernel}; - if ($ient->{initrd}) { $hash->{initrd} = $ient->{initrd} } - if ($ient->{kcmdline}) { $hash->{kcmdline} = $ient->{kcmdline} } - $bptab->setNodeAttribs($_, $hash); + $bphash->{kernel} = $ient->{kernel}; + if ($ient->{initrd}) { $bphash->{initrd} = $ient->{initrd} } + if ($ient->{kcmdline}) { $bphash->{kcmdline} = $ient->{kcmdline} } } } elsif ($state =~ /^install[=\$]/ or $state eq 'install' or $state =~ /^netboot[=\$]/ or $state eq 'netboot' or $state eq "image" or $state eq "winshell" or $state =~ /^osimage/ or $state =~ /^statelite/) { my %state_hash; @@ -389,7 +386,8 @@ sub setdestiny { $subreq->({ command => ["mk$tempstate"], node => $samestatenodes, noupdateinitrd => $noupdateinitrd, - ignorekernelchk => $ignorekernelchk, }, \&relay_response); + ignorekernelchk => $ignorekernelchk, + bootparams => \$bphash}, \&relay_response); if ($errored) { my @myself = xCAT::NetworkUtils->determinehostname(); my $myname = $myself[ (scalar @myself) - 1 ]; @@ -746,7 +744,7 @@ sub getdestiny { my $chaintab = xCAT::Table->new('chain'); my $chainents = $chaintab->getNodesAttribs(\@nodes, [qw(currstate chain)]); my $nrents = $restab->getNodesAttribs(\@nodes, [qw(tftpserver xcatmaster)]); - $bptab = xCAT::Table->new('bootparams', -create => 1); + my $bptab = xCAT::Table->new('bootparams', -create => 1); my $bpents = $bptab->getNodesAttribs(\@nodes, [qw(kernel initrd kcmdline xcatmaster)]); #my $sitetab= xCAT::Table->new('site'); diff --git a/xCAT-server/lib/xcat/plugins/grub2.pm b/xCAT-server/lib/xcat/plugins/grub2.pm index 34ddd9d8a..e5a03620d 100644 --- a/xCAT-server/lib/xcat/plugins/grub2.pm +++ b/xCAT-server/lib/xcat/plugins/grub2.pm @@ -571,17 +571,18 @@ sub process_request { if (exists($request->{inittime})) { $inittime = $request->{inittime}->[0]; } if (!$inittime) { $inittime = 0; } $errored = 0; + my %bphash; unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { xCAT::MsgUtils->trace($verbose_on_off, "d", "grub2: issue setdestiny request"); $sub_req->({ command => ['setdestiny'], node => \@nodes, inittime => [$inittime], - arg => \@args }, \&pass_along); + arg => \@args, + bootparams => \%bphash + }, \&pass_along); } if ($errored) { return; } - my $bptab = xCAT::Table->new('bootparams', -create => 1); - my $bphash = $bptab->getNodesAttribs(\@nodes, [ 'kernel', 'initrd', 'kcmdline', 'addkcmdline' ]); my $chaintab = xCAT::Table->new('chain', -create => 1); my $chainhash = $chaintab->getNodesAttribs(\@nodes, ['currstate']); my $noderestab = xCAT::Table->new('noderes', -create => 1); @@ -618,7 +619,7 @@ sub process_request { $linuximghash = $linuximgtab->getAttribs({ imagename => $osimgname }, 'boottarget', 'addkcmdline'); } - ($rc, $errstr) = setstate($_, $bphash, $chainhash, $machash, $tftpdir, $nrhash, $linuximghash); + ($rc, $errstr) = setstate($_, \%bphash, $chainhash, $machash, $tftpdir, $nrhash, $linuximghash); if ($rc) { $response{node}->[0]->{errorcode}->[0] = $rc; $response{node}->[0]->{errorc}->[0] = $errstr; diff --git a/xCAT-server/lib/xcat/plugins/petitboot.pm b/xCAT-server/lib/xcat/plugins/petitboot.pm index 3d3d7fa6d..cea7eeaea 100644 --- a/xCAT-server/lib/xcat/plugins/petitboot.pm +++ b/xCAT-server/lib/xcat/plugins/petitboot.pm @@ -460,12 +460,15 @@ sub process_request { if (exists($request->{inittime})) { $inittime = $request->{inittime}->[0]; } if (!$inittime) { $inittime = 0; } $errored = 0; + my %bphash; unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { xCAT::MsgUtils->trace($verbose_on_off, "d", "petitboot: issue setdestiny request"); $sub_req->({ command => ['setdestiny'], node => \@nodes, inittime => [$inittime], - arg => \@args }, \&pass_along); + arg => \@args, + bootparams => \%bphash}, + \&pass_along); } if ($errored) { return; } @@ -476,8 +479,6 @@ sub process_request { arg => ['default'] }); xCAT::MsgUtils->message("S", "xCAT: petitboot netboot: clear node(s): @nodes boot device setting."); } - my $bptab = xCAT::Table->new('bootparams', -create => 1); - my $bphash = $bptab->getNodesAttribs(\@nodes, [ 'kernel', 'initrd', 'kcmdline', 'addkcmdline' ]); my $chaintab = xCAT::Table->new('chain', -create => 1); my $chainhash = $chaintab->getNodesAttribs(\@nodes, ['currstate']); my $noderestab = xCAT::Table->new('noderes', -create => 1); @@ -510,7 +511,7 @@ sub process_request { my $linuximghash = $linuximghash = $linuximgtab->getAttribs({ imagename => $osimgname }, 'boottarget', 'addkcmdline'); - ($rc, $errstr) = setstate($_, $bphash, $chainhash, $machash, $tftpdir, $nodereshash, $linuximghash); + ($rc, $errstr) = setstate($_, \%bphash, $chainhash, $machash, $tftpdir, $nodereshash, $linuximghash); if ($rc) { $response{node}->[0]->{errorcode}->[0] = $rc; $response{node}->[0]->{errorc}->[0] = $errstr; diff --git a/xCAT-server/lib/xcat/plugins/pxe.pm b/xCAT-server/lib/xcat/plugins/pxe.pm index 4b0d937dc..f35afae12 100644 --- a/xCAT-server/lib/xcat/plugins/pxe.pm +++ b/xCAT-server/lib/xcat/plugins/pxe.pm @@ -497,6 +497,7 @@ sub process_request { $errored = 0; + my %bphash; my $inittime = 0; if (exists($::PXE_request->{inittime})) { $inittime = $::PXE_request->{inittime}->[0]; } if (!$inittime) { $inittime = 0; } @@ -505,19 +506,19 @@ sub process_request { $sub_req->({ command => ['setdestiny'], node => \@nodes, inittime => [$inittime], - arg => \@args }, \&pass_along); + arg => \@args, + bootparams => \%bphash + }, \&pass_along); } if ($errored) { return; } #Time to actually configure the nodes, first extract database data with the scalable calls - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $chaintab = xCAT::Table->new('chain'); my $mactab = xCAT::Table->new('mac'); #to get all the hostnames my $typetab = xCAT::Table->new('nodetype'); my $restab = xCAT::Table->new('noderes'); my $linuximgtab = xCAT::Table->new('linuximage', -create => 1); my %nrhash = %{ $restab->getNodesAttribs(\@nodes, [qw(tftpdir)]) }; - my %bphash = %{ $bptab->getNodesAttribs(\@nodes, [qw(kernel initrd kcmdline addkcmdline)]) }; my %chainhash = %{ $chaintab->getNodesAttribs(\@nodes, [qw(currstate)]) }; my %machash = %{ $mactab->getNodesAttribs(\@nodes, [qw(mac)]) }; my %nthash = %{ $typetab->getNodesAttribs(\@nodes, [qw(os provmethod)]) }; diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 0d14e4080..dcccc895b 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -54,6 +54,7 @@ sub mknetboot if ($req->{command}->[0] =~ 'mkstatelite') { $statelite = "true"; } + my $bootparams = ${$req->{bootparams}}; my $globaltftpdir = "/tftpboot"; my $nodes = @{ $req->{node} }; @@ -445,7 +446,6 @@ sub mknetboot } # TODO: move the table operations out of the foreach loop - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $hmtab = xCAT::Table->new('nodehm'); my $sent = $hmtab->getNodeAttribs($node, @@ -720,13 +720,9 @@ sub mknetboot $kcmdline .= "MNTOPTS=\'$mntoptions\'"; } } - $bptab->setNodeAttribs( - $node, - { - kernel => "$rtftppath/kernel", - initrd => $initrdstr, - kcmdline => $kcmdline - }); + $bootparams->{$node}->[0]->{kernel} = "$rtftppath/kernel"; + $bootparams->{$node}->[0]->{initrd} = $initrdstr; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } } @@ -770,6 +766,7 @@ sub mkinstall my $noupdateinitrd = $request->{'noupdateinitrd'}; my $ignorekernelchk = $request->{'ignorekernelchk'}; + my $bootparams = ${$request->{bootparams}}; my @nodes = @{ $request->{node} }; my $node; my $ostab = xCAT::Table->new('nodetype'); @@ -799,7 +796,6 @@ sub mkinstall my $installroot; $installroot = "/install"; my $restab = xCAT::Table->new('noderes'); - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $hmtab = xCAT::Table->new('nodehm'); my $resents = $restab->getNodesAttribs( @@ -1365,14 +1361,9 @@ sub mkinstall $kernelpath = "$rtftppath/linux"; $initrdpath = "$rtftppath/initrd"; xCAT::MsgUtils->trace($verbose_on_off, "d", "sles->mkinstall: kcmdline=$kcmdline kernal=$kernelpath initrd=$initrdpath"); - $bptab->setNodeAttribs( - $node, - { - kernel => $kernelpath, - initrd => $initrdpath, - kcmdline => $kcmdline - } - ); + $bootparams->{$node}->[0]->{kernel} = $kernelpath; + $bootparams->{$node}->[0]->{initrd} = $initrdpath; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } elsif ($arch eq "ppc64") { @@ -1384,14 +1375,9 @@ sub mkinstall $kernelpath = "$rtftppath/linux64"; $initrdpath = "$rtftppath/initrd64"; xCAT::MsgUtils->trace($verbose_on_off, "d", "sles->mkinstall: kcmdline=$kcmdline kernal=$kernelpath initrd=$initrdpath"); - $bptab->setNodeAttribs( - $node, - { - kernel => $kernelpath, - initrd => $initrdpath, - kcmdline => $kcmdline - } - ); + $bootparams->{$node}->[0]->{kernel} = $kernelpath; + $bootparams->{$node}->[0]->{initrd} = $initrdpath; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } elsif (-r "$tftppath/inst64") { @@ -1399,14 +1385,9 @@ sub mkinstall #suseboot/inst64 can not be run on Power8 BE $kernelpath = "$rtftppath/inst64"; xCAT::MsgUtils->trace($verbose_on_off, "d", "sles->mkinstall: kcmdline=$kcmdline kernal=$kernelpath initrd="); - $bptab->setNodeAttribs( - $node, - { - kernel => $kernelpath, - initrd => "", - kcmdline => $kcmdline - } - ); + $bootparams->{$node}->[0]->{kernel} = $kernelpath; + $bootparams->{$node}->[0]->{initrd} = ""; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } } } @@ -1436,6 +1417,7 @@ sub mksysclone my $callback = shift; my $doreq = shift; my @nodes = @{ $request->{node} }; + my $bootparams = ${$request->{bootparams}}; my $osimagetab; my %img_hash = (); @@ -1460,7 +1442,6 @@ sub mksysclone my $node; my $ostab = xCAT::Table->new('nodetype'); my $restab = xCAT::Table->new('noderes'); - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $hmtab = xCAT::Table->new('nodehm'); my %osents = %{ $ostab->getNodesAttribs(\@nodes, [ 'os', 'arch', 'provmethod' ]) }; my %rents = @@ -1645,14 +1626,9 @@ sub mksysclone if (-r "$tftpdir/xcat/genesis.fs.$arch.lzma") { $i = "xcat/genesis.fs.$arch.lzma"; } - $bptab->setNodeAttribs( - $node, - { - kernel => "xcat/genesis.kernel.$arch", - initrd => $i, - kcmdline => $kcmdline - } - ); + $bootparams->{$node}->[0]->{kernel} = "xcat/genesis.kernel.$arch"; + $bootparams->{$node}->[0]->{initrd} = $i; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } else { diff --git a/xCAT-server/lib/xcat/plugins/vsmppxe.pm b/xCAT-server/lib/xcat/plugins/vsmppxe.pm index 60e0cab30..aa22a24ed 100644 --- a/xCAT-server/lib/xcat/plugins/vsmppxe.pm +++ b/xCAT-server/lib/xcat/plugins/vsmppxe.pm @@ -402,6 +402,7 @@ sub process_request { $errored = 0; + my %bphash; my $inittime = 0; if (exists($::VSMPPXE_request->{inittime})) { $inittime = $::VSMPPXE_request->{inittime}->[0]; } if (!$inittime) { $inittime = 0; } @@ -409,15 +410,15 @@ sub process_request { $sub_req->({ command => ['setdestiny'], node => \@nodes, inittime => [$inittime], - arg => [ $args[0] ] }, \&pass_along); + arg => [ $args[0] ], + bootparams => \%bphash + }, \&pass_along); } if ($errored) { return; } #Time to actually configure the nodes, first extract database data with the scalable calls - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $chaintab = xCAT::Table->new('chain'); my $mactab = xCAT::Table->new('mac'); #to get all the hostnames - my %bphash = %{ $bptab->getNodesAttribs(\@nodes, [qw(kernel initrd kcmdline addkcmdline)]) }; my %chainhash = %{ $chaintab->getNodesAttribs(\@nodes, [qw(currstate)]) }; my %machash = %{ $mactab->getNodesAttribs(\@nodes, [qw(mac)]) }; foreach (@nodes) { diff --git a/xCAT-server/lib/xcat/plugins/xnba.pm b/xCAT-server/lib/xcat/plugins/xnba.pm index bdf93d294..fc485dd4e 100644 --- a/xCAT-server/lib/xcat/plugins/xnba.pm +++ b/xCAT-server/lib/xcat/plugins/xnba.pm @@ -108,7 +108,7 @@ sub setstate { my $linuximghashref = shift; if (ref $linuximghashref) { %linuximghash = %{$linuximghashref}; } my $imgaddkcmdline = ($linuximghash{'boottarget'}) ? undef : $linuximghash{'addkcmdline'}; - my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']); + my $kern = $bphash{$node}->[0]; unless ($::XNBA_addkcmdlinehandled->{$node}) { #Tag to let us know the plugin had a special syntax implemented for addkcmdline if ($kern->{addkcmdline} or ($imgaddkcmdline)) { @@ -520,22 +520,24 @@ sub process_request { if (exists($::XNBA_request->{inittime})) { $inittime = $::XNBA_request->{inittime}->[0]; } if (!$inittime) { $inittime = 0; } $errored = 0; + my %bphash; unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { xCAT::MsgUtils->trace($verbose_on_off, "d", "xnba: issue setdestiny request"); $sub_req->({ command => ['setdestiny'], node => \@nodes, inittime => [$inittime], - arg => \@args }, \&pass_along); + arg => \@args , + bootparams => \%bphash}, + \&pass_along); } + if ($errored) { return; } #Time to actually configure the nodes, first extract database data with the scalable calls - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $chaintab = xCAT::Table->new('chain'); my $noderestab = xCAT::Table->new('noderes'); #in order to detect per-node tftp directories my $mactab = xCAT::Table->new('mac'); #to get all the hostnames my %nrhash = %{ $noderestab->getNodesAttribs(\@nodes, [qw(tftpdir)]) }; - my %bphash = %{ $bptab->getNodesAttribs(\@nodes, [qw(kernel initrd kcmdline addkcmdline)]) }; my %chainhash = %{ $chaintab->getNodesAttribs(\@nodes, [qw(currstate)]) }; my %iscsihash; my $iscsitab = xCAT::Table->new('iscsi'); From 043806485b2de7433350bd9bfc3002dfccfad175 Mon Sep 17 00:00:00 2001 From: bybai Date: Fri, 30 Dec 2016 02:36:59 -0500 Subject: [PATCH 007/100] add statelite document --- .../manage_clusters/ppc64le/index.rst | 1 + .../ppc64le/statelite/advanced_features.rst | 266 +++++++++++++ .../ppc64le/statelite/config_statelite.rst | 160 ++++++++ .../ppc64le/statelite/hierarchy_support.rst | 43 +++ .../ppc64le/statelite/index.rst | 12 + .../ppc64le/statelite/overview.rst | 38 ++ .../ppc64le/statelite/provision_statelite.rst | 360 ++++++++++++++++++ 7 files changed, 880 insertions(+) create mode 100644 docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/advanced_features.rst create mode 100644 docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst create mode 100644 docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/hierarchy_support.rst create mode 100644 docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/index.rst create mode 100644 docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/overview.rst create mode 100644 docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/provision_statelite.rst diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/index.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/index.rst index 882086fa2..8744168df 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/index.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/index.rst @@ -13,6 +13,7 @@ These are machines use the IBM Power Architecture and is **IPMI** managed. management.rst diskful/index.rst diskless/index.rst + statelite/index.rst updatenode.rst parallel_cmd.rst virtual_machines/index.rst diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/advanced_features.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/advanced_features.rst new file mode 100644 index 000000000..6ab6c89b2 --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/advanced_features.rst @@ -0,0 +1,266 @@ +Advanced Statelite features +=========================== + +Both directory and its child items coexist in litefile table +------------------------------------------------------------ + +As described in the above chapters, we can add the files/directories to litefile table. Sometimes, it is necessary to put one directory and also its child item(s) into the litefile table. Due to the implementation of the statelite on Linux, some scenarios works, but some doesn't work. + +Here are some examples of both directory and its child items coexisting: + + Both the parent directory and the child file coexist: :: + + "ALL","/root/testblank/",,, + "ALL","/root/testblank/tempfschild","tempfs",, + + One more complex example: :: + + "ALL","/root/",,, + "ALL","/root/testblank/tempfschild","tempfs",, + + Another more complex example, but we don't intend to support such one scenario: :: + + "ALL","/root/",,, + "ALL","/root/testblank/",,, + "ALL","/root/testblank/tempfschild","tempfs",, + +For example, in scenario 1, the parent is ``/root/testblank/``, and the child is ``/root/testblank/tempfschild``. +In scenario 2, the parent is ``/root/``, and the child is ``/root/testblank/tempfschild``. + +In order to describe the hierarchy scenarios we can use , ``P`` to denote parent, and ``C`` to denote child. + ++--------------+-----------------------------------------------------+-------------------------------------------------+ +| Option | Example | Remarks | ++==============+=====================================================+=================================================+ +| P:tmpfs | "ALL","/root/testblank/",,, | Both the parent and the child are mounted to | +| | "ALL","/root/testblanktempfschild","tempfs",, | tmpfs on the booted node following their | +| | | respective options. Only the parent are mounted | +| | | to the local file system. | ++--------------+-----------------------------------------------------+-------------------------------------------------+ +| P:tmpfs | "ALL","/root/testblank/",,, | Both parent and child are mounted to tmpfs | +| C:persistent | "ALL","/root/testblank/testpersfile","persistent",, | on the booted node following their respective | +| | | options. Only the parent is mounted to the local| +| | | file | ++--------------+-----------------------------------------------------+-------------------------------------------------+ +| P:persistent | "ALL","/root/testblank/","persistent",, | Not permitted now. But plan to support it. | +| C:tmpfs | "ALL","/root/testblank/tempfschild",,, | | ++--------------+-----------------------------------------------------+-------------------------------------------------+ +| P:persistent | "ALL","/root/testblank/","persistent",, | Both parent and child are mounted to tmpfs | +| C:persistent | "ALL","/root/testblank/testpersfile","persistent",, | on the booted node following their respective | +| | | options. Only the parent is mounted to local | +| | | file system. | ++--------------+-----------------------------------------------------+-------------------------------------------------+ +| P:ro C:any | | Not permitted | ++--------------+-----------------------------------------------------+-------------------------------------------------+ +| P:tmpfs C:ro | | Both parent and child are mounted to tmpfs | +| | | on the booted node following their respective | +| | | options. Only the parent is mounted to local | +| | | file system. | ++--------------+-----------------------------------------------------+-------------------------------------------------+ +| P:tmpfs | | Both parent and child are mounted to tmpfs | +| C:con | | on the booted node following their respective | +| | | options. Only the parent is mounted to local | +| | | file system. | ++--------------+-----------------------------------------------------+-------------------------------------------------+ +| P:link | "ALL","/root/testlink/","link",, | Both parent and child are created in tmpfs | +| C:link | "ALL","/root/testlink/testlinkchild","link",, | on the booted node following their respective | +| | | options; there's only one symbolic link of | +| | | the parent is created in the local file system. | ++--------------+-----------------------------------------------------+-------------------------------------------------+ +| P: link C: | "ALL","/root/testlinkpers/","link",, | Both parent and child are created in tmpfs | +| link, | "ALL","/root/testlink/testlinkchild", | on the booted node following their respective | +| persistent | ,"link,persistent" | options; there's only one symbolic link of | +| | | the parent is created in the local file system. | ++--------------+-----------------------------------------------------+-------------------------------------------------+ +| P:link, | "ALL","/root/testlinkpers/","link,persistent",, | NOT permitted | +| persistent | | | +| C: link | "ALL","/root/testlink/testlinkchild","link" | | ++--------------+-----------------------------------------------------+-------------------------------------------------+ +| P:link, | "ALL","/root/testlinkpers/","link,persistent",, | Both parent and child are created in tmpfs | +| persistent | "ALL","/root/testlink | on the booted node following "link,persistent" | +| C:link, | | way; there's only one symbolic link of the | +| persistent | | parent is created in the local file system. | ++--------------+-----------------------------------------------------+-------------------------------------------------+ +| P:link | "ALL","/root/testlink/","link",, | Both parent and child are created in tmpfs | +| C:link,ro | "ALL","/root/testlink/testlinkro","link,ro",, | on the booted node, there's only one symbolic | +| | | link of the parent is created in the local | +| | | file system. | ++--------------+-----------------------------------------------------+-------------------------------------------------+ +| P:link | "ALL","/root/testlink/","link",, | Both parent and child are created in tmpfs | +| C:link,con | "ALL","/root/testlink/testlinkconchild","link,con",,| on the booted node, there's only one symbolic | +| | | link of the parent in the local file system. | ++--------------+-----------------------------------------------------+-------------------------------------------------+ +| P:link, | | NOT Permitted | +| persistent | | | +| C:link,ro | | | ++--------------+-----------------------------------------------------+-------------------------------------------------+ +| P:link, | | NOT Permitted | +| persistent | | | +| C:link,con | | | ++--------------+-----------------------------------------------------+-------------------------------------------------+ +| P:tmpfs | | NOT Permitted | +| C:link | | | ++--------------+-----------------------------------------------------+-------------------------------------------------+ +| P:link | | NOT Permitted | +| C:persistent | | | ++--------------+-----------------------------------------------------+-------------------------------------------------+ + +litetree table +-------------- + +The litetree table controls where the initial content of the files in the litefile table come from, and the long term content of the ``ro`` files. When a node boots up in statelite mode, it will by default copy all of its tmpfs files from the ``/.default`` directory of the root image, so there is not requirement to setup a litetree table. If you decide that you want some of the files pulled from different locations that are different per node, you can use this table. + +See litetree man page for description of attributes. + +For example, a user may have two directories with a different ``/etc/motd`` that should be used for nodes in two locations: :: + + 10.0.0.1:/syncdirs/newyork-590Madison/rhels5.4/x86_64/compute/etc/motd + 10.0.0.1:/syncdirs/shanghai-11foo/rhels5.4/x86_64/compute/etc/motd + +You can specify this in one row in the litetree table: :: + + 1,,10.0.0.1:/syncdirs/$nodepos.room/$nodetype.os/$nodetype.arch/$nodetype.profile + +When each statelite node boots, the variables in the litetree table will be substituted with the values for that node to locate the correct directory to use. Assuming that ``/etc/motd`` was specified in the litefile table, it will be searched for in all of the directories specified in the litetree table and found in this one. + +You may also want to look by default into directories containing the node name first: :: + + $noderes.nfsserver:/syncdirs/$node + +The litetree prioritizes where node files are found. The first field is the priority. The second field is the image name (ALL for all images) and the final field is the mount point. + +Our example is as follows: :: + + 1,,$noderes.nfsserver:/statelite/$node + 2,,cnfs:/gpfs/dallas/ + +The two directories ``/statelite/$node`` on the node's $noderes.nfsserver and the ``/gpfs/dallas`` on the node cnfs contain root tree structures that are sparsely populated with files that we want to place in those nodes. If files are not found in the first directory, it goes to the next directory. If none of the files can be found in the litetree hierarchy, then they are searched for in ``/.default`` on the local image. + +Installing a new Kernel in the statelite image +---------------------------------------------- + +Obtain you new kernel and kernel modules on the MN, for example here we have a new SLES kernel. + +#. Copy the kernel into /boot : :: + + cp **vmlinux-2.6.32.10-0.5-ppc64**/boot + +#. Copy the kernel modules into ``/lib/modules/`` :: + + /lib/modules # ls -al + total 16 + drwxr-xr-x 4 root root 4096 Apr 19 10:39 . + drwxr-xr-x 17 root root 4096 Apr 13 08:39 .. + drwxr-xr-x 3 root root 4096 Apr 13 08:51 2.6.32.10-0.4-ppc64 + **drwxr-xr-x 4 root root 4096 Apr 19 10:12 2.6.32.10-0.5-ppc64** + +#. Run genimage to update the statelite image with the new kernel :: + + genimage -k 2.6.32.10-0.5-ppc64 + +#. Then after a nodeset command and netbooti, shows the new kernel:: + + uname -a + +Enabling the localdisk Option +----------------------------- + +``Note``: You can skip this section if not using the ``localdisk`` option in your litefile table. + +Several things need to be done to enable the 'localdisk' support: + +Define how to partition the local disk +`````````````````````````````````````` + +When a node is deployed, the local hard disk needs to be partitioned and formatted before it can be used. This section explains how provide a configuration file that tells xCAT to partition a local disk and make it ready to use for the directories listed in the litefile table with the ``localdisk`` option. + +The configuration file needs to be specified in the ``partitionfile`` attribute of the osimage definition. The configuration file includes several parts: + + * Global parameters to control enabling or disabling the function + * [disk] part to control the partitioning of the disk + * [localspace] part to control which partition will be used to store the localdisk directories listed in the litefile table + * [swapspace] part to control the enablement of the swap space for the node. + +An example localdisk configuration file: :: + + enable=yes + enablepart=no + + [disk] + dev=/dev/sdb + clear=yes + parts=100M-200M,1G-2G + + [disk] + dev=/dev/sda + clear=yes + parts=10,20,30 + + [disk] + dev=/dev/sdc + clear=yes + parts=10,20,30 + + [localspace] + dev=/dev/sda1 + fstype=ext3 + + [swapspace] + dev=/dev/sda2 + +The two global parameters ``enable`` and ``enablepart`` can be used to control the enabling/disabling of the functions: + + * enable: The localdisk feature only works when ``enable`` is set to *yes*. If it is set to *no*, the localdisk configuration will not be run. + * enablepart: The partition action (refer to the ``[disk]`` section) will be run only when ``enablepart=yes``. + +The ``[disk]`` section is used to configure how to partition a hard disk: + + * dev: The path of the device file. + * clear: If set to ``yes`` it will clear all the existing partitions on this disk. + * fstype: The file system type for the new created partitions. ``ext3`` is the default value if not set. + * parts: A comma separated list of space ranges, one for each partition that will be created on the device. The valid format for each space range is ``-`` or ````. For example, you could set it to ``100M-10G`` or ``50``. If you set it to ``50``, that means 50% of the disk space will be assigned to that partition. + +The ``[localspace]`` section is used to specify which partition will be used as local storage for the node. + + * dev: The path of the partition. + * fstype: The file system type on the partition. + +the ``[swapspace]`` section is used to configure the swap space for the statelite node. + + * dev: The path of the partition file which will be used as the swap space. + +To enable the local disk capability, create the configuration file (for example in ``/install/custom``) and set the path in the partitionfile attribute for the osimage: :: + + chdef -t osimage partitionfile=/install/custom/cfglocaldisk + +Now all nodes that use this osimage (i.e. have their provmethod attribute set to this osimage definition name), will have its local disk configured. + +Configure the files in the litefile table +````````````````````````````````````````` + +For the files/directories that you would like xCAT to store on the local disk, add an entry in the litefile table like this: :: + + "ALL","/tmp/","localdisk",, + +``Note``: you do not need to specify the swap space in the litefile table. Just putting it in the partitionfile config file is enough. + +Add an entry in policy table to permit the running of the ``getpartitioin`` command from the node :: + + chtab priority=7.1 policy.commands=getpartition policy.rule=allow + +If Using the RAMdisk-based Image +```````````````````````````````` + +If you want to use the local disk option with a RAMdisk-based image, remember to follow the instructions in :ref:`Switch to the RAMdisk based solution`. + +If your reason for using a RAMdisk image is to avoid compute node runtime dependencies on the service node or management node, then the only entries you should have in the litefile table should be files/dirs that use the localdisk option. + +Debugging techniques +-------------------- + + When a node boots up in statelite mode, there is a script that runs called statelite that is in the root directory of ``$imageroot/etc/init.d/statelite``. This script is not run as part of the rc scripts, but as part of the pre-switch root environment. Thus, all the linking is done in this script. There is a ``set x`` near the top of the file. You can uncomment it and see what the script runs. You will then see lots of mkdirs and links on the console. + + You can also set the machine to shell. Just add the word ``shell`` on the end of the pxeboot file of the node in the append line. This will make the init script in the initramfs pause 3 times before doing a switch_root. + + When all the files are linked they are logged in ``/.statelite/statelite.log`` on the node. You can get into the node after it has booted and look in the ``/.statelite`` directory. + diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst new file mode 100644 index 000000000..3309bd4b1 --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst @@ -0,0 +1,160 @@ +Configure Statelite +=================== + +Getting started with statelite provisioning requires that you have xCAT set up and running. Before continuing with the rest of this document, the xCAT management node must be set up, and the nodes' hardware control, resource, and type attributes must be defined correctly. + +The operating system image files and the statelite files can be put on the service nodes or the management node, or any external NFS server. + +Statelite uses the following tables in xCAT: + +litefile table +-------------- + +The litefile table specifies the directories and files on the statelite nodes that should be read/write, persistent, or read-only overlay. All other files in the statelite nodes come from the read-only statelite image. + +#. The first column in the litefile table is the image name this row applies to. It can be an exact osimage definition name, an osimage group (set in the groups attribute of osimages), or the keyword ``ALL``. + +#. The second column in the litefile table is the full path of the directory or file on the node that you are setting options for. + +#. The third column in the litefile table specifies options for the directory or file: :: + + 1. tmpfs - It provides a file or directory for the node to use when booting, its permission will be the same as the original version on the server. In most cases, it is read-write; however, on the next statelite boot, the original version of the file or directory on the server will be used, it means it is non-persistent. This option can be performed on files and directories. + 2. rw - Same as Above.Its name "rw" does NOT mean it always be read-write, even in most cases it is read-write. Do not confuse it with the "rw" permission in the file system. + 3. persistent - It provides a mounted file or directory that is copied to the xCAT persistent location and then over-mounted on the local file or directory. Anything written to that file or directory is preserved. It means, if the file/directory does not exist at first, it will be copied to the persistent location. Next time the file/directory in the persistent location will be used. The file/directory will be persistent across reboots. Its permission will be the same as the original one in the statelite location. It requires the statelite table to be filled out with a spot for persistent statelite. This option can be performed on files and directories. + 3. con - The contents of the pathname are concatenated to the contents of the existing file. For this directive the searching in the litetree hierarchy does not stop when the first match is found. All files found in the hierarchy will be concatenated to the file when found. The permission of the file will be "-rw-r--r--", which means it is read-write for the root user, but readonly for the others. It is non-persistent, when the node reboots, all changes to the file will be lost. It can only be performed on files. Do not use it for one directory. + 4. ro - The file/directory will be overmounted read-only on the local file/directory. It will be located in the directory hierarchy specified in the litetree table. Changes made to this file or directory on the server will be immediately seen in this file/directory on the node. This option requires that the file/directory to be mounted must be available in one of the entries in the litetree table. This option can be performed on files and directories. + 5. tmpfs,rw - Only for compatibility it is used as the default option if you leave the options column blank. It has the same semantics with the link option, so when adding new items into the _litefile table, the link option is recommended. + 6. link - It provides one file/directory for the node to use when booting, it is copied from the server, and will be placed in tmpfs on the booted node. In the local file system of the booted node, it is one symbolic link to one file/directory in tmpfs. And the permission of the symbolic link is "lrwxrwxrwx", which is not the real permission of the file/directory on the node. So for some application sensitive to file permissions, it will be one issue to use "link" as its option, for example, "/root/.ssh/", which is used for SSH, should NOT use "link" as its option. It is non-persistent, when the node is rebooted, all changes to the file/directory will be lost. This option can be performed on files and directories. + 7. link,ro - The file is readonly, and will be placed in tmpfs on the booted node. In the local file system of the booted node, it is one symbolic link to the tmpfs. It is non-persistent, when the node is rebooted, all changes to the file/directory will be lost. This option requires that the file/directory to be mounted must be available in one of the entries in the litetree table. The option can be performed on files and directories. + 8. link,con - It works similar to the "con" option. All the files found in the litetree hierarchy will be concatenated to the file when found. The final file will be put to the tmpfs on the booted node. In the local file system of the booted node, it is one symbolic link to the file/directory in tmpfs. It is non-persistent, when the node is rebooted, all changes to the file will be lost. The option can only be performed on files. + + 9. link,persistent - It provides a mounted file or directory that is copied to the xCAT persistent location and then over-mounted to the tmpfs on the booted node, and finally the symbolic link in the local file system will be linked to the over-mounted tmpfs file/directory on the booted node. The file/directory will be persistent across reboots. The permission of the file/directory where the symbolic link points to will be the same as the original one in the statelite location. It requires the statelite table to be filled out with a spot for persistent statelite. The option can be performed on files and directories. + + 10. localdisk - The file or directory will be stored in the local disk of the statelite node. Refer to the section To enable the localdisk option to enable the 'localdisk' support. + +Currently, we don't handle the relative links very well. The relative links are commonly used by the system libraries, for example, under ``/lib/`` directory, there will be one relative link matching one ``.so`` file. So, when you add one relative link to the litefile table (We don't recommend ), make sure the real file also be included, or you can put its directory name into the litefile table. However, most of the users will not put the relative links in the litefile table. + +``Note``: It is recommended that you specify at least the entries listed below in the litefile table, because most of these files need to be writeable for the node to boot up successfully. When any changes are made to their options, make sure they won't affect the whole system. + +Sample Data for a RedHat statelite setup +```````````````````````````````````````` + +This is the minimal list of files needed, you can add additional files to the litefile table. + +Notice that all files are in tmpfs, the default for the options field. This gives you an NFS root solution with no persistent storage. :: + + #image,file,options,comments,disable + "ALL","/etc/adjtime","tmpfs",, + "ALL","/etc/fstab","tmpfs",, + "ALL","/etc/lvm/","tmpfs",, + "ALL","/etc/syslog.conf","tmpfs",, + "ALL","/etc/syslog.conf.XCATORIG","tmpfs",, + "ALL","/etc/ntp.conf","tmpfs",, + "ALL","/etc/ntp.conf.predhclient","tmpfs",, + "ALL","/etc/resolv.conf","tmpfs",, + "ALL","/etc/resolv.conf.predhclient","tmpfs",, + "ALL","/etc/ssh/","tmpfs",, + "ALL","/etc/sysconfig/","tmpfs",, + "ALL","/etc/inittab","tmpfs",, + "ALL","/tmp/","tmpfs",, + "ALL","/var/","tmpfs",, + "ALL","/opt/xcat/","tmpfs",, + "ALL","/xcatpost/","tmpfs",, + "ALL","/root/.ssh/","tmpfs",, + +Sample Data for Redhat6/7 statelite setup +````````````````````````````````````````` + +This is the minimal list of files needed, you can add additional files to the litefile table. :: + + #image,file,options,comments,disable + "ALL","/etc/adjtime","tmpfs",, + "ALL","/etc/securetty","tmpfs",, + "ALL","/etc/lvm/","tmpfs",, + "ALL","/etc/ntp.conf","tmpfs",, + "ALL","/etc/rsyslog.conf","tmpfs",, + "ALL","/etc/rsyslog.conf.XCATORIG","tmpfs",, + "ALL","/etc/udev/","tmpfs",, + "ALL","/etc/ntp.conf.predhclient","tmpfs",, + "ALL","/etc/resolv.conf","tmpfs",, + "ALL","/etc/yp.conf","tmpfs",, + "ALL","/etc/resolv.conf.predhclient","tmpfs",, + "ALL","/etc/sysconfig/","tmpfs",, + "ALL","/etc/ssh/","tmpfs",, + "ALL","/etc/inittab","tmpfs",, + "ALL","/tmp/","tmpfs",, + "ALL","/var/","tmpfs",, + "ALL","/opt/xcat/","tmpfs",, + "ALL","/xcatpost/","tmpfs",, + "ALL","/etc/systemd/system/multi-user.target.wants/","tmpfs",, + "ALL","/root/.ssh/","tmpfs",, + "ALL","/etc/rc3.d/","tmpfs",, + "ALL","/etc/rc2.d/","tmpfs",, + "ALL","/etc/rc4.d/","tmpfs",, + "ALL","/etc/rc5.d/","tmpfs",, + +Sample Data for SLES11 statelite setup +`````````````````````````````````````` + +This is the minimal list of files needed, you can add additional files to the litefile table. :: + + #image,file,options,comments,disable + "ALL","/etc/lvm/","tmpfs",, + "ALL","/etc/ntp.conf","tmpfs",, + "ALL","/etc/ntp.conf.org","tmpfs",, + "ALL","/etc/resolv.conf","tmpfs",, + "ALL","/etc/ssh/","tmpfs",, + "ALL","/etc/sysconfig/","tmpfs",, + "ALL","/etc/syslog-ng/","tmpfs",, + "ALL","/etc/inittab","tmpfs",, + "ALL","/tmp/","tmpfs",, + "ALL","/etc/init.d/rc3.d/","tmpfs",, + "ALL","/etc/init.d/rc5.d/","tmpfs",, + "ALL","/var/","tmpfs",, + "ALL","/etc/yp.conf","tmpfs",, + "ALL","/etc/fstab","tmpfs",, + "ALL","/opt/xcat/","tmpfs",, + "ALL","/xcatpost/","tmpfs",, + "ALL","/root/.ssh/","tmpfs",, + +``Note``: Sample Data for Fedora13/14 statelite setup refer to the setup of Redhat6. + +litetree table +-------------- + +The litetree table controls where the initial content of the files in the litefile table come from, and the long term content of the ``ro`` files. When a node boots up in statelite mode, it will by default copy all of its tmpfs files from the ``/.default`` directory of the root image, so there is not required to set up a litetree table. If you decide that you want some of the files pulled from different locations that are different per node, you can use this table. See Advanced Statelite features. + +You can choose to use the defaults and not set up a litetree table. + +statelite table +--------------- + +You may want some files in the image to be stored permanently, to survive reboots. This is done by entering the information into the statelite table. + +See the statelite man page for description of the attributes. + +``Note``: In the statelite table, the node or nodegroups in the table must be unique; that is a node or group should appear only once in the first column table. This makes sure that only one statelite image can be assigned to a node. + +An example would be: :: + + "compute",,":/gpfs/state",, + +Any nodes in the compute node group will have their state stored in the ``/gpfs/state`` directory on the machine with ```` as its IP address. The image attribute should be left blank - currently it is not used. + +When the node boots up, then the value of the statemnt attribute will be mounted to ``/.statelite/persistent``. The code will then create the following subdirectory ``/.statelite/persistent/`` if there are persistent files that have been added in the litefile table. This directory will be the root of the image for this node's persistent files. By default, xCAT will do a hard NFS mount of the directory. You can change the mount options by setting the mntopts attribute in the statelite table. + +Also, to set the statemnt attribute, you can use variables from xCAT database. It follows the same grammar as the litetree table. For example: :: + + #node,image,statemnt,mntopts,comments,disable + "cn1",,"$noderes.nfsserver:/lite/state/$nodetype.profile","soft,timeo=30",, + +``Note``: Do not name your persistent storage directory with the node name, as the node name will be added in the directory automatically. If you do, then a directory named ``/state/cn1`` will have its state tree inside ``/state/cn1/cn1``. + +Policy +------ + +Ensure policies are set up correctly in the Policy Table. When a node boots up, it queries the xCAT database to get the litefile and litetree table information. In order for this to work, the commands (of the same name) must be set in the policy table to allow nodes to request it. This should happen automatically when xCAT is installed, but you may want to verify that the following lines are in the policy table: :: + + chdef -t policy -o 4.7 commands=litefile rule=allow + chdef -t policy -o 4.8 commands=litetree rule=allow + diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/hierarchy_support.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/hierarchy_support.rst new file mode 100644 index 000000000..6591018d7 --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/hierarchy_support.rst @@ -0,0 +1,43 @@ +Hierarchy Support +----------------- + +In the ``statelite`` environment, the service node needs to provide NFS service for the compute node with ``statelite``, the service nodes must to be setup with diskfull installation. + +Setup the diskfull service node +``````````````````````````````` + +#. Setup one diskfull service node at first. + +#. Since statelite is a kind of NFS-hybrid method, you should remove the installloc attribute in the site table. This makes sure that the service node does not mount the ``/install`` directory from the management node on the service node. + +Generate the statelite image +```````````````````````````` + +To generate the statelite image for your own profile follow instructions in `Customize your statelite osimage`_. + +``NOTE``: if the NFS directories defined in the litetree table are on the service node, it is better to setup the NFS directories in the service node following the chapter. + +Sync the ``/install`` directory +``````````````````````````````` + +The command prsync is used to sync the ``/install`` directory to the service nodes. + +Run the following: :: + + cd / + prsync install :/ + +```` is the hostname of the service node you defined. + +Since the ``prsync`` command will sync all the contents in the ``/install`` directory to the service nodes, the first time will take a long time. But after the first time, it will take very short time to sync. + +``NOTE``: if you make any changes in the ``/install`` directory on the management node, and the changes can affect the statelite image, you need to sync the ``/install`` directory to the service node again. + +Set the boot state to statelite +``````````````````````````````` + +You can now deploy the node: :: + + rinstall osimage=rhel5.3-x86_64-statelite-compute + +This will create the necessary files in ``/tftpboot`` for the node to boot correctly. diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/index.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/index.rst new file mode 100644 index 000000000..8a91a2a82 --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/index.rst @@ -0,0 +1,12 @@ +Statelite Installation +====================== + +.. toctree:: + :maxdepth: 3 + + overview.rst + config_statelite.rst + provision_statelite.rst + update_nodes.rst + hierarchy_support.rst + advanced_features.rst diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/overview.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/overview.rst new file mode 100644 index 000000000..0a0139c37 --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/overview.rst @@ -0,0 +1,38 @@ +Overview +======== + +This document details the design and setup for the statelite solution of xCAT. ``Statelite`` is an intermediate mode between ``stateful`` and ``stateless``. + +Statelite provides two kinds of efficient and flexible solutions, most of the OS image can be NFS mounted read-only, or the OS image can be in the ramdisk with tmpfs type. Different from the stateless solution, statelite provides a configurable list of directories and files that can be read-write. These read-write directories and files can either be persistent across reboots, or volatile (which means restoring to the original state after reboot). + +Solutions +--------- + +There are two solutions, ``NFSROOT-based`` and ``RAMdisk-based``. + +There is an attribute named rootfstype in the osimage xCAT data objects. If it is set to ``ramdisk``, the ``RAMdisk-based`` statelite solution will be enabled. If it is left as blank, or set to ``nfs``, the ``NFSROOT-base`` statelite solution will be enabled. + +The default solution is ``NFSROOT-based``. In the ``NFSROOT-based`` solution, the ROOTFS is NFS mounted read-only. + +In the ``RAMdisk-based`` statelite solution, one image file will be downloaded when the node is booting up, and the file will be extracted to the ramdisk, and used as the ROOTFS. + +Advantages +---------- + +``Statelite`` offers the following advantages over xCAT's stateless (RAMdisk) implementation: + +#. Some files can be made persistent over reboot. This is useful for license files or database servers where some state is needed. However, you still get the advantage of only having to manage a single image. +#. Changes to hundreds of machines can take place instantly, and automatically, by updating one main image. In most cases, machines do not need to reboot for these changes to take affect. This is only for the ``NFSROOT-based`` solution. +#. Ease of administration by being able to lock down an image. Many parts of the image can be read-only, so no modifications can transpire without updating the central image. +#. Files can be managed in a hierarchical manner. For example: Suppose you have a machine that is in one lab in Tokyo and another in London. You could set table values for those machines in the xCAT database to allow machines to sync from different places based on their attributes. This allows you to have one base image with multiple sources of file overlay. +#. Ideal for virtualization. In a virtual environment, you may not want a disk image (neither stateless nor stateful) on every virtual node as it consumes memory and disk. Virtualizing with the statelite approach allows for images to be smaller, easier to manage, use less disk, less memory, and more flexible. + +Disadvantages +------------- + +However, there're still several disadvantages, especially for the ``NFSROOT-based`` solution. + +#. NFS Root requires more network traffic to run as the majority of the disk image runs over NFS. This may depend on your workload, but can be minimized. Since the bulk of the image is read-only, NFS caching on the server helps minimize the disk access on the server, and NFS caching on the client helps reduce the network traffic. +#. NFS Root can be complex to set up. As more files are created in different places, there are greater chances for failures. This flexibility is also one of the great virtues of Statelite. The image can work in nearly any environment. + +Only one statelite image may be defined for a node or noderange. diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/provision_statelite.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/provision_statelite.rst new file mode 100644 index 000000000..e87e5bb0c --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/provision_statelite.rst @@ -0,0 +1,360 @@ +Provision statelite +=================== + +Show current provmethod +----------------------- + +To determine the current provmethod of your node, run: :: + + lsdef | provmethod + +If an osimage name is specified for the provmethod, the osimage attribute settings stored in the osimage and linuximage table are used to locate the files for ``templates``, ``*pkglists``, ``syncfiles``, etc. + +``Note``: syncfiles is not currently supported for statelite nodes. + +See attributes in the osimage, linuximage and nimimage tables. For example: :: + + tabdump -d osimage + tabdump -d linuximage + tabdump -d nimimage + +For a hierarchical cluster, the files must be placed under the site table installdir attribute path, usually ``/install`` directory, so they will be available when mounted on the service nodes. The site table installdir directory, is mounted or copied to the service nodes during the hierarchical install of compute nodes from the service nodes. + +Generate default statelite image from distoro media +--------------------------------------------------- + +For our example, we are going to create a new compute node test osimage for ``rhels7.3`` on ``ppc64le``. This works fine for other archtectures ( e.g. ``x86_64``). Just substitute your architecture in the paths ( e.g. ``x86_64`` ). We will set up a test directory structure that we can use to create our image. Later we can just move that into production. + +Use the copycds command to copy the appropriate iso image into the ``/install`` directory for xCAT. The copycds commands will copy the contents to ``/install/rhels7.3/``. For example: :: + + mkdir /iso + cd /iso + copycds RHEL-7.3-20161019.0-Server-ppc64le-dvd1.iso + +The contents are copied into ``/install/rhels7.3/ppc64le/`` + +When copycds runs, it will automatically create default osimage names and paths in the osimage table and the linuximage table based on the os and architecture you are using. You can use these defaults as a starting point to create your own osimage definitions, or you can create your own image definition. We are going to use the statelite generated image for our example. + +The configuration files pointed to by the attributes are the defaults shipped with xCAT. We will want to copy them to the ``/install`` directory, in our example the ``/install/test`` directory and modify them as needed. :: + + lsdef -t osimage -o rhels7.3-ppc64le-statelite-compute + Object name: rhels7.3-ppc64le-statelite-compute + exlist=/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.exlist + imagetype=linux + osarch=ppc64le + osdistroname=rhels7.3-ppc64le + osname=Linux + osvers=rhels7.3 + otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le + permission=755 + pkgdir=/install/rhels7.3/ppc64le + pkglist=/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.pkglist + postinstall=/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall + profile=compute + provmethod=statelite + rootimgdir=/install/netboot/rhels7.3/ppc64le/compute + synclists=/install/custom/netboot/rh/compute.synclist + +Customize your statelite osimage +-------------------------------- + +Create the osimage definition +````````````````````````````` + +Setup your osimage/linuximage tables with new test image name, osvers,osarch, and paths to all the files for building and installing the node. So using the above generated ``rhels7.3-ppc64le-statelite-compute`` as an example, I am going to create my own image. The value for the provmethod attribute is osimage in my example.:: + + mkdef -t osimage -o redhat7img \ + profile=compute imagetype=linux provmethod=statelite osarch=ppc64le osname=linux osvers=rhels7.3 + +Check your setup: :: + + lsdef -t osimage redhat7img + Object name: redhat7img + imagetype=linux + osarch=ppc64le + osname=linux + osvers=rhels7.3 + profile=compute + provmethod=statelite + +Add the paths to your ``pkglist``, ``syncfile``, etc to the osimage definition, that you require. ``Note``, if you modify the files on the ``/opt/xcat/share/...`` path then copy to the appropriate ``/install/custom/...`` path. Remember all files must be under ``/install`` if using hierarchy (service nodes). + +Copy the sample ``*list`` files and modify as needed: :: + + mkdir -p /install/test/netboot/rh + cp -p /opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.pkglist \ + /install/test/netboot/rh/compute.pkglist + cp -p /opt/xcat/share/xcat/netboot/rh/compute.exlist \ + /install/test/netboot/rh/compute.exlist + + chdef -t osimage -o redhat7img \ + pkgdir=/install/rhels7.3/ppc64le \ + pkglist=/install/test/netboot/rh/compute.pkglist \ + exlist=/install/test/netboot/rh/compute.exlist \ + rootimgdir=/install/test/netboot/rh/ppc64le/compute + +Check your setup: :: + + lsdef -t osimage -o redhat7img + Object name: redhat7img + exlist=/install/test/netboot/rh/compute.exlist + imagetype=linux + osarch=ppc64 + osname=linux + osvers=rhels7.3 + pkgdir=/install/rhels7.3/ppc64le + pkglist=/install/test/netboot/rh/compute.pkglist + profile=compute + provmethod=statelite + rootimgdir=/install/test/netboot/rh/ppc64le/compute + +Setup pkglists +`````````````` + +In the above example, you have defined your pkglist to be in ``/install/test/netboot/rh/compute.pkglist``. + +Edit compute.pkglist and compute.exlist as needed. :: + + cd /install/test/netboot/rh/ + vi compute.pkglist compute.exlist + +For example to add vi to be installed on the node, add the name of the vi rpm to compute.pkglist. Make sure nothing is excluded in compute.exlist that you need. + +Install other specific packages +``````````````````````````````` + +Make the directory to hold additional rpms to install on the compute node. :: + + mkdir -p /install/test/post/otherpkgs/rh/ppc64le + +Now copy all the additional OS rpms you want to install into ``/install/test/post/otherpkgs/rh/ppc64le``. + +At first you need to create one text file which contains the complete list of files to include in the repository. The name of the text file is rpms.list and must be in ``/install/test/post/otherpkgs/rh/ppc64le`` directory. Create rpms.list: :: + + cd /install/test/post/otherpkgs/rh/ppc64le + ls *.rpm > rpms.list + +Then, run the following command to create the repodata for the newly-added packages: :: + + createrepo -i rpms.list /install/test/post/otherpkgs/rh/ppc64le + +The ``createrepo`` command with -i rpms.list option will create the repository for the rpm packages listed in the rpms.list file. It won't destroy or affect the rpm packages that are in the same directory, but have been included into another repository. + +Or, if you create a sub-directory to contain the rpm packages, for example, named other in ``/install/test/post/otherpkgs/rh/ppc64le``. Run the following command to create repodata for the directory ``/install/test/post/otherpkgs/rh/ppc64le``. :: + + createrepo /install/post/otherpkgs///**other** + +``Note``: Replace other with your real directory name. + +Define the location of of your otherpkgs in your osimage: :: + + chdef -t osimage -o redhat7img \ + otherpkgdir=/install/test/post/otherpkgs/rh/ppc64le \ + otherpkglist=/install/test/netboot/rh/compute.otherpkgs.pkglist + +There are examples under ``/opt/xcat/share/xcat/netboot/`` of typical ``*otherpkgs.pkglist`` files that can used as an example of the format. + +Set up Post install scripts for statelite +````````````````````````````````````````` + +The rules to create post install scripts for statelite image is the same as the rules for stateless/diskless install images. + +There're two kinds of postscripts for statelite (also for stateless/diskless). + +The first kind of postscript is executed at genimage time, it is executed again the image itself on the MN . It was setup in The postinstall file section before the image was generated. + +The second kind of postscript is the script that runs on the node during node deployment time. During init.d timeframe, ``/etc/init.d/gettyset`` calls ``/opt/xcat/xcatdsklspost`` that is in the image. This script uses wget to get all the postscripts under ``mn:/install/postscripts`` and copy them to the ``/xcatpost`` directory on the node. It uses openssl or stunnel to connect to the xcatd on the mn to get all the postscript names for the node from the postscripts table. It then runs the postscripts for the node. + +Setting up postinstall files (optional) +``````````````````````````````````````` + +Using postinstall files is optional. There are some examples shipped in ``/opt/xcat/share/xcat/netboot/``. + +If you define a postinstall file to be used by genimage, then :: + + chdef -t osimage -o redhat7img postinstall=. + +Setting up Files to be synchronized on the nodes +```````````````````````````````````````````````` + +Setup the node to use your osimage +`````````````````````````````````` +:: + chdef -t node -o node1 provmethod=redhat7img + lsdef node1 | grep provmethod + provmethod=redhat7img + +Generate the image +------------------ + +Run the following command to generate the image based on your osimage named redhat6img. Adjust your genimage parameters to your architecture and network settings. See man genimage. :: + + genimage redhat7img + +The genimage will create a default ``/etc/fstab`` in the image, for example: :: + + devpts /dev/pts devpts gid=5,mode=620 0 0 + tmpfs /dev/shm tmpfs defaults 0 0 + proc /proc proc defaults 0 0 + sysfs /sys sysfs defaults 0 0 + tmpfs /tmp tmpfs defaults,size=10m 0 2 + tmpfs /var/tmp tmpfs defaults,size=10m 0 2 + compute_x86_64 / tmpfs rw 0 1 + +If you want to change the defaults, on the management node, edit fstab in the image: :: + + cd /install/netboot/rhels6/x86_64/compute/rootimg/etc + cp fstab fstab.ORIG + vi fstab + +Change these settings: :: + + proc /proc proc rw 0 0 + sysfs /sys sysfs rw 0 0 + devpts /dev/pts devpts rw,gid=5,mode=620 0 0 + #tmpfs /dev/shm tmpfs rw 0 0 + compute_x86_64 / tmpfs rw 0 1 + none /tmp tmpfs defaults,size=10m 0 2 + none /var/tmp tmpfs defaults,size=10m 0 2 + +``Note``: adding ``/tmp`` and ``/var/tmp`` to ``/etc/fstab`` is optional, most installations can simply use ``/``. It was documented her to show that you can restrict the size of filesystems, if you need to. The indicated values are just and example, and you may need much bigger filessystems, if running applications like OpenMPI. + +Pack the image +-------------- +:: + liteimg redhat7img + +Boot the node +------------- +:: + rinstall node1 osimage=redhat7img + +Switch to the RAMdisk based solution +------------------------------------ + +It is optional, if you want to use RAMdisk-based solution, follow this section. + +Set rootfstype +`````````````` + +If you want the node to boot with a RAMdisk-based image instead of the NFS-base image, set the rootfstype attribute for the osimage to ``ramdisk``. For example: :: + + chdef -t osimage -o rhels6-ppc64-statelite-compute rootfstype=ramdisk + +Run liteimg command +``````````````````` + +The ``liteimg`` command will modify your statelite image (the image that ``genimage`` just created) by creating a series of links. Once you are satisfied with your image contains what you want it to, run ``liteimg ``: :: + + liteimg rhels6-ppc64-statelite-compute + +For files with link options, the ``liteimg`` command creates two levels of indirection, so that files can be modified while in their image state as well as during runtime. For example, a file like ``$imageroot/etc/ntp.conf`` with link option in the litefile table, will have the following operations done to it: + +In our case ``$imageroot`` is ``/install/netboot/rhels5.3/x86_64/compute/rootimg`` + +The ``liteimg`` script, for example, does the following to create the two levels of indirection. :: + + mkdir -p $imageroot/.default/etc + mkdir -p $imageroot/.statelite/tmpfs/etc + mv $imgroot/etc/ntp.conf $imgroot/.default/etc + cd $imgroot/.statelite/tmpfs/etc + ln -sf ../../../.default/etc/ntp.conf . + cd $imgroot/etc + ln -sf ../.statelite/tmpfs/etc/ntp.conf . + +When finished, the original file will reside in ``$imgroot/.default/etc/ntp.conf``. ``$imgroot/etc/ntp.conf`` will link to ``$imgroot/.statelite/tmpfs/etc/ntp.conf`` which will in turn link to ``$imgroot/.default/etc/ntp.conf``. + +But for files without link options, the ``liteimg`` command only creates clones in ``$imageroot/.default/`` directory, when the node is booting up, the mount command with ``--bind`` option will get the corresponding files from the ``litetree`` places or ``.default`` directory to the sysroot directory. + +``Note``: If you make any changes to your litefile table after running ``liteimg`` then you will need to rerun ``liteimg`` again. This is because files and directories need to have the two levels of redirects created. + +Boot the node +````````````` + +Make sure you have set up all the attributes in your node definitions correctly following the node installation instructions corresponding to your hardware: + +You can now deploy the node by running the following commmands: :: + + rinstall + +This will create the necessary files in ``/tftpboot/etc`` for the node to boot correctly. +You can then use ``rcons`` or ``wcons`` to watch the node boot up. + +Commands +-------- + +The following commands are in ``/opt/xcat/bin``: :: + + litefile : Shows all the statelite files that are not to be taken from the base of the image. + + litetree : Shows the NFS mount points for a node. + + liteimg : Creates a series of symbolic links in an image that is compatible with statelite booting. + + lslite -i : Displays a summary of the statelite information defined for . + + lslite : Displays a summary of the statelite information defined for the + +Statelite Directory Structure +----------------------------- + +Each statelite image will have the following directories: :: + + /.statelite/tmpfs/ + /.default/ + /etc/init.d/statelite + +All files with link options, which are symbolic links, will link to ``/.statelite/tmpfs``. + +tmpfs files that are persistent link to ``/.statelite/persistent//``, ``/.statelite/persistent/`` is the directory where the node's individual storage will be mounted to. + +``/.default`` is where default files will be copied to from the image to tmpfs if the files are not found in the litetree hierarchy. + +The noderes Table +````````````````` +``noderes.nfsserver`` attribute can be set for the NFSroot server. If this is not set, then the defaul is the Management Node. + +``noderes.nfsdir`` can be set. If this is not set, the the default is ``/install`` + +Adding/updating software and files for the running nodes +-------------------------------------------------------- + +Make changes to the files which configured in the litefile table +```````````````````````````````````````````````````````````````` + +During the preparation or booting of node against statelite mode, there are specific processes to handle the files which configured in the litefile table. The following operations need to be done after made changes to the statelite files. + +#. Run ``liteimg`` against the osimage and reboot the node : Added, removed or changed the entries in the litefile table. + +#. Reboot the node : + + * Changed the location directory in the litetree table. + * Changed the location directory in the statelite table. + * Changed, removed the original files in the location of litetree or statelite table. + +``Note``: Thing should not do: + + * When there are node running on the nfs-based statelite osimage, do not run the packimage against this osimage. + +Make changes to the common files +```````````````````````````````` + +Because most of system files for the nodes are NFS mounted on the Management Node with read-only option, installing or updating software and files should be done to the image. The image is located under ``/install/netboot////rootimg`` directory. + +To install or update an rpm, do the following: + + * Install the rpm package into rootimg :: + + rpm --root /install/netboot////rootimg -ivh rpm_name + + * Restart the software application on the nodes :: + + xdsh + +It is recommended to follow the section (Adding third party softeware) to add the new rpm to the otherpkgs.pkglist file, so that the rpm will get installed into the new image next time the image is rebuilt. + +``Note``: The newly added rpms are not shown when running ``rpm -qa`` on the nodes although the rpm is installed. It will shown next time the node is rebooted. + +To create or update a file for the nodes, just modify the file in the image and restart any application that uses the file. + +For the ramdisk-based node, you need to reboot the node to take the changes. From 15926176cc51d22db9c1565b6441d6bde6981451 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 23 Dec 2016 03:26:48 -0500 Subject: [PATCH 008/100] remove setupntp for sles12.1 ntpd doesn't synchronize to local clock anymore in version 4.2.8p4. see#2248 --- .../testcase/installation/Full_installation_flat_p8_le | 3 ++- .../testcase/installation/reg_linux_diskfull_installation_flat | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le index a058f5560..447f4a4fa 100644 --- a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le @@ -25,7 +25,8 @@ cmd:makeconservercf $$CN check:rc==0 cmd:cat /etc/conserver.cf | grep $$CN check:output=~$$CN -cmd:chdef -t node -o $$CN postscripts=setupntp +cmd:if [ "__GETNODEATTR($$CN,os)__" != "sles12.1" ];then chdef -t node -o $$CN postscripts=setupntp; fi +cmd:lsdef -l $$CN check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index b9c7d65bf..dfbab0873 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -33,7 +33,8 @@ check:rc==0 check:output=~$$CN cmd:copycds $$ISO check:rc==0 -cmd:chdef -t node -o $$CN postscripts=setupntp +cmd:if [ "__GETNODEATTR($$CN,os)__" != "sles12.1" ];then chdef -t node -o $$CN postscripts=setupntp; fi +cmd:lsdef -l $$CN check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 From 90f6ea83a52f1b15d501c30dd62ea080e6c14b9e Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Tue, 3 Jan 2017 22:27:16 -0500 Subject: [PATCH 009/100] complete --- xCAT-test/autotest/testcase/migration/redhat_migration | 10 ++++------ xCAT-test/autotest/testcase/migration/sles_migration | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/xCAT-test/autotest/testcase/migration/redhat_migration b/xCAT-test/autotest/testcase/migration/redhat_migration index a5fad7718..3840a2014 100644 --- a/xCAT-test/autotest/testcase/migration/redhat_migration +++ b/xCAT-test/autotest/testcase/migration/redhat_migration @@ -1,6 +1,6 @@ start:redhat_migration1 os:Linux -description:update xCAT from $$MIGRATION1_VERSION to $$LATEST_VERSION, these two global parameter defined in config file +description:update xCAT from $$MIGRATION1_VERSION to latest version, these two global parameter defined in config file #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN @@ -103,14 +103,13 @@ cmd:xdsh $$CN "lsdef" check:output=~node0001 cmd:xdsh $$CN "noderm node0001" check:rc==0 -cmd:xdsh $$CN "lsxcatd -v" +cmd:latest_version_info=`lsxcatd -v`;xdsh $$CN "lsxcatd -v" | grep "$latest_version_info" check:rc==0 -check:output=~$$LATEST_VERSION end start:redhat_migration2 os:Linux -description:update xCAT from $$MIGRATION2_VERSION to $$LATEST_VERSION, these two global parameter defined in config file +description:update xCAT from $$MIGRATION2_VERSION to latest version, these two global parameter defined in config file stop:yes #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi @@ -214,8 +213,7 @@ cmd:xdsh $$CN "lsdef" check:output=~node0001 cmd:xdsh $$CN "noderm node0001" check:rc==0 -cmd:xdsh $$CN "lsxcatd -v" +cmd:latest_version_info=`lsxcatd -v`;xdsh $$CN "lsxcatd -v" | grep "$latest_version_info" check:rc==0 -check:output=~$$LATEST_VERSION end diff --git a/xCAT-test/autotest/testcase/migration/sles_migration b/xCAT-test/autotest/testcase/migration/sles_migration index a41e56828..ab283ec77 100644 --- a/xCAT-test/autotest/testcase/migration/sles_migration +++ b/xCAT-test/autotest/testcase/migration/sles_migration @@ -1,6 +1,6 @@ start:sles_migration1 os:Linux -description:update xCAT from $$MIGRATION1_VERSION to $$LATEST_VERSION, these two global parameter defined in config file +description:update xCAT from $$MIGRATION1_VERSION to latest version, these two global parameter defined in config file #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN @@ -106,14 +106,13 @@ cmd:xdsh $$CN "lsdef" check:output=~node0001 cmd:xdsh $$CN "noderm node0001" check:rc==0 -cmd:xdsh $$CN "lsxcatd -v" +cmd:latest_version_info=`lsxcatd -v`;xdsh $$CN "lsxcatd -v" | grep "$latest_version_info" check:rc==0 -check:output=~$$LATEST_VERSION end start:sles_migration2 os:Linux -description:update xCAT from $$MIGRATION22VERSION to $$LATEST_VERSION, these two global parameter defined in config file +description:update xCAT from $$MIGRATION22VERSION to latest version, these two global parameter defined in config file #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN @@ -219,8 +218,7 @@ cmd:xdsh $$CN "lsdef" check:output=~node0001 cmd:xdsh $$CN "noderm node0001" check:rc==0 -cmd:xdsh $$CN "lsxcatd -v" +cmd:latest_version_info=`lsxcatd -v`;xdsh $$CN "lsxcatd -v" | grep "$latest_version_info" check:rc==0 -check:output=~$$LATEST_VERSION end From 48ec4470c53816b06fe6e502110e16eaa0f01d8a Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Wed, 11 Jan 2017 02:04:30 -0500 Subject: [PATCH 010/100] complete --- .../Diskless_installation_flat_p8_le | 11 +++-------- .../installation/Full_installation_flat_p8_le | 5 ++--- .../testcase/installation/SN_setup_case | 5 ++--- .../reg_linux_SN_installation_hierarchy | 6 ++---- .../reg_linux_diskfull_installation_flat | 10 ++-------- .../reg_linux_diskfull_installation_hierarchy | 8 ++------ .../reg_linux_diskless_installation_flat | 9 ++------- .../reg_linux_diskless_installation_hierarchy | 9 +++------ .../reg_linux_statelite_installation_flat | 17 +++++------------ ...inux_statelite_installation_hierarchy_by_nfs | 8 ++------ ..._statelite_installation_hierarchy_by_ramdisk | 9 +++------ .../ubuntu_diskless_installation_vm | 9 +++------ .../installation/ubuntu_full_installation_vm | 5 ++--- .../ubuntu_full_installation_vm_docker | 6 ++---- 14 files changed, 35 insertions(+), 82 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le index 51d18d4ad..95cfd0751 100644 --- a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le @@ -34,12 +34,9 @@ cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-comput check:rc==0 cmd:chdef $$CN status= check:rc==0 -cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -check:rc==0 -cmd:if [[ "__GETNODEATTR($$CN,mgt)__" = "ipmi" ]]; then rsetboot $$CN net; fi -check:rc==0 -cmd:rpower $$CN boot +cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 +check:output=~Provision node\(s\)\: $$CN cmd:sleep 200 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 100 ];then break;fi done cmd:lsdef -l $$CN | grep status @@ -48,9 +45,7 @@ cmd:xdsh $$CN date check:rc==0 check:output=~\d\d:\d\d:\d\d cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" -cmd:nodeset $$CN osimage -check:rc==0 -cmd:rpower $$CN reset +cmd:rinstall $$CN osimage check:rc==0 cmd:sleep 200 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 100 ];then break;fi done diff --git a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le index 107da18b7..9722176aa 100644 --- a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le @@ -27,10 +27,9 @@ check:output=~$$CN cmd:if [ "__GETNODEATTR($$CN,os)__" != "sles12.1" ];then chdef -t node -o $$CN postscripts=setupntp; fi cmd:lsdef -l $$CN check:rc==0 -cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -check:rc==0 -cmd:rpower $$CN boot +cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 +check:output=~Provision node\(s\)\: $$CN cmd:sleep 600 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 60;((a++));if [ $a -gt 50 ];then break;fi done cmd:ping $$CN -c 3 diff --git a/xCAT-test/autotest/testcase/installation/SN_setup_case b/xCAT-test/autotest/testcase/installation/SN_setup_case index 0593d88ea..1873a0efd 100644 --- a/xCAT-test/autotest/testcase/installation/SN_setup_case +++ b/xCAT-test/autotest/testcase/installation/SN_setup_case @@ -56,10 +56,9 @@ check:rc==0 #cmd:chdef -t osimage __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service pkgdir="/install/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__" #check:rc==0 -cmd:nodeset $$SN osimage=__GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service -check:rc==0 -cmd:if [[ "__GETNODEATTR($$SN,arch)__" = "ppc64" ]]; then rnetboot $$SN;else rpower $$SN boot; fi +cmd:rinstall $$SN osimage=__GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service check:rc==0 +check:output=~Provision node\(s\)\: $$SN cmd:/opt/xcat/share/xcat/tools/autotest/testcase/installation/customize_sleep_for_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__ diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy index 8cb7b89d1..b79e4e9fd 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy @@ -58,11 +58,9 @@ check:rc==0 cmd:chdef -t osimage __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service pkgdir="/install/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__" check:rc==0 - -cmd:nodeset $$SN osimage=__GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service -check:rc==0 -cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "ppc64" ]]; then rnetboot $$SN;elif [[ "__GETNODEATTR($$SN,arch)__" =~ "x86_64" ]];then rpower $$SN boot; fi +cmd:rinstall $$SN osimage=__GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service check:rc==0 +check:output=~Provision node\(s\)\: $$SN cmd:sleep 600 cmd:a=0;while ! `lsdef -l $$SN|grep status|grep booted >/dev/null`; do sleep 60;((a++));if [ $a -gt 70 ];then break;fi done diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index 0800aa5d7..76231d47f 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -32,15 +32,9 @@ check:rc==0 cmd:if [ "__GETNODEATTR($$CN,os)__" != "sles12.1" ];then chdef -t node -o $$CN postscripts=setupntp; fi cmd:lsdef -l $$CN check:rc==0 -cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -check:rc==0 -cmd:lsdef $$CN |grep provmethod -check:rc==0 -check:output=~__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -cmd:if [[ "__GETNODEATTR($$CN,mgt)__" = "ipmi" ]]; then rsetboot $$CN net; fi -check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [ "__GETNODEATTR($$CN,arch)__" = "ppc64" ];then rnetboot $$CN;else rpower $$CN boot;fi else rpower $$CN boot;fi +cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 +check:output=~Provision node\(s\)\: $$CN cmd:sleep 300 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 20;((a++));if [ $a -gt 300 ];then break;fi done diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy index 5e3ce50c8..86ac6d80f 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -28,13 +28,9 @@ check:rc==0 cmd:copycds $$ISO check:rc==0 -cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -check:rc==0 -cmd:lsdef $$CN |grep provmethod -check:rc==0 -check:output=~__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi +cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 +check:output=~Provision node\(s\)\: $$CN cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc" ]]; then sleep 120;elif [[ "__GETNODEATTR($$CN,arch)__" =~ "x86_64" ]];then sleep 200;else sleep 180;fi diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat index 9b3c04e60..42556e6f6 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -46,14 +46,9 @@ cmd:rm -rf /tmp/mountoutput cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 -cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -check:rc==0 -cmd:lsdef $$CN |grep provmethod -check:rc==0 -check:output=~__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute - -cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64" ]]; then rnetboot $$CN;elif [[ "__GETNODEATTR($$CN,arch)__" =~ "x86_64" ]];then rpower $$CN boot; fi +cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 +check:output=~Provision node\(s\)\: $$CN cmd:sleep 900 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy index 219d8cda9..0bb2aa173 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -42,13 +42,10 @@ check:rc==0 cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 -cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -check:rc==0 -cmd:lsdef $$CN |grep provmethod -check:rc==0 -check:output=~__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi + +cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 +check:output=~Provision node\(s\)\: $$CN cmd:sleep 900 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat index f70ef0b70..fe31a9c33 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -58,13 +58,9 @@ check:rc==0 cmd:liteimg __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 -cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -check:rc==0 -cmd:lsdef $$CN |grep provmethod -check:rc==0 -check:output=~statelite -cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi +cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 +check:output=~Provision node\(s\)\: $$CN cmd:sleep 900 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done @@ -93,13 +89,10 @@ check:rc==0 cmd:liteimg __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 -cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -check:rc==0 -cmd:lsdef $$CN |grep provmethod -check:rc==0 -check:output=~__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi +cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 +check:output=~Provision node\(s\)\: $$CN + cmd:sleep 900 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs index 316c12604..64098d579 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs @@ -66,13 +66,9 @@ check:rc==0 cmd:prsync /install $$SN:/ check:rc==0 -cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -check:rc==0 -cmd:lsdef $$CN |grep provmethod -check:rc==0 -check:output=~statelite -cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi +cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 +check:output=~Provision node\(s\)\: $$CN cmd:sleep 900 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk index e2bd85350..ab4d5d101 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk @@ -68,13 +68,10 @@ check:rc==0 cmd:prsync /install $$SN:/ check:rc==0 -cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -check:rc==0 -cmd:lsdef $$CN |grep provmethod -check:rc==0 -check:output=~__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi + +cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 +check:output=~Provision node\(s\)\: $$CN cmd:sleep 900 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm index 492a26820..107cca3dc 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm +++ b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm @@ -25,10 +25,9 @@ cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 -cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -check:rc==0 -cmd:rpower $$CN boot +cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 +check:output=~Provision node\(s\)\: $$CN cmd:sleep 200 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 300 ];then break;fi done cmd:lsdef -l $$CN | grep status @@ -37,9 +36,7 @@ cmd:xdsh $$CN date check:rc==0 check:output=~\d\d:\d\d:\d\d cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" -cmd:nodeset $$CN osimage -check:rc==0 -cmd:rpower $$CN reset +cmd:rinstall $$CN osimage check:rc==0 cmd:sleep 200 cmd:lsdef -l $$CN | grep status diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm index 951693ce7..35f0dd22b 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm +++ b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm @@ -16,10 +16,9 @@ cmd:makeconservercf $$CN check:rc==0 cmd:cat /etc/conserver.cf | grep $$CN check:output=~$$CN -cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -check:rc==0 -cmd:rpower $$CN boot +cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 +check:output=~Provision node\(s\)\: $$CN cmd:sleep 300 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 300 ];then break;fi done cmd:ping $$CN -c 3 diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker index 4ce2ba2f6..49ca2b478 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker +++ b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker @@ -20,11 +20,9 @@ cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu14.04" ]];then ver=`cat /etc/*-re check:rc==0 cmd: chdef $$CN -p postbootscripts="setupdockerhost mynet0=$$MYNET0VALUE@$$DOCKERHOSIP:$$NICNAME" check:rc==0 -cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-dockerhost +cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-dockerhost check:rc==0 -cmd:rpower $$CN boot -check:rc==0 - +check:output=~Provision node\(s\)\: $$CN cmd:sleep 900 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done From 86a7d4b6863a6aefda0ae7676ab553d715f221d7 Mon Sep 17 00:00:00 2001 From: bybai Date: Thu, 12 Jan 2017 01:40:54 -0500 Subject: [PATCH 011/100] polish statelite doc --- .../ppc64le/statelite/advanced_features.rst | 10 +- .../ppc64le/statelite/config_statelite.rst | 80 +++---- .../ppc64le/statelite/hierarchy_support.rst | 2 +- .../ppc64le/statelite/index.rst | 41 +++- .../ppc64le/statelite/provision_statelite.rst | 211 +++++------------- 5 files changed, 124 insertions(+), 220 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/advanced_features.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/advanced_features.rst index 6ab6c89b2..416f4a22c 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/advanced_features.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/advanced_features.rst @@ -1,5 +1,5 @@ -Advanced Statelite features -=========================== +Advanced features +================= Both directory and its child items coexist in litefile table ------------------------------------------------------------ @@ -68,8 +68,8 @@ In order to describe the hierarchy scenarios we can use , ``P`` to denote parent | | | the parent is created in the local file system. | +--------------+-----------------------------------------------------+-------------------------------------------------+ | P: link C: | "ALL","/root/testlinkpers/","link",, | Both parent and child are created in tmpfs | -| link, | "ALL","/root/testlink/testlinkchild", | on the booted node following their respective | -| persistent | ,"link,persistent" | options; there's only one symbolic link of | +| link, | "ALL","/root/testlink/testlinkchild",, | on the booted node following their respective | +| persistent | "link,persistent" | options; there's only one symbolic link of | | | | the parent is created in the local file system. | +--------------+-----------------------------------------------------+-------------------------------------------------+ | P:link, | "ALL","/root/testlinkpers/","link,persistent",, | NOT permitted | @@ -251,7 +251,7 @@ Add an entry in policy table to permit the running of the ``getpartitioin`` comm If Using the RAMdisk-based Image ```````````````````````````````` -If you want to use the local disk option with a RAMdisk-based image, remember to follow the instructions in :ref:`Switch to the RAMdisk based solution`. +If you want to use the local disk option with a RAMdisk-based image, remember to follow the instructions in :doc:`Switch to the RAMdisk based solution <./provision_statelite>`. If your reason for using a RAMdisk image is to avoid compute node runtime dependencies on the service node or management node, then the only entries you should have in the litefile table should be files/dirs that use the localdisk option. diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst index 3309bd4b1..00c9d24d8 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst @@ -1,11 +1,12 @@ -Configure Statelite -=================== +Configuration +============= -Getting started with statelite provisioning requires that you have xCAT set up and running. Before continuing with the rest of this document, the xCAT management node must be set up, and the nodes' hardware control, resource, and type attributes must be defined correctly. - -The operating system image files and the statelite files can be put on the service nodes or the management node, or any external NFS server. - -Statelite uses the following tables in xCAT: +Statelite configuration is done using the following tables in xCAT: + * litefile + * litetree + * statelite + * policy + * noderes litefile table -------------- @@ -16,7 +17,7 @@ The litefile table specifies the directories and files on the statelite nodes th #. The second column in the litefile table is the full path of the directory or file on the node that you are setting options for. -#. The third column in the litefile table specifies options for the directory or file: :: +#. The third column in the litefile table specifies options for the directory or file: 1. tmpfs - It provides a file or directory for the node to use when booting, its permission will be the same as the original version on the server. In most cases, it is read-write; however, on the next statelite boot, the original version of the file or directory on the server will be used, it means it is non-persistent. This option can be performed on files and directories. 2. rw - Same as Above.Its name "rw" does NOT mean it always be read-write, even in most cases it is read-write. Do not confuse it with the "rw" permission in the file system. @@ -26,44 +27,16 @@ The litefile table specifies the directories and files on the statelite nodes th 5. tmpfs,rw - Only for compatibility it is used as the default option if you leave the options column blank. It has the same semantics with the link option, so when adding new items into the _litefile table, the link option is recommended. 6. link - It provides one file/directory for the node to use when booting, it is copied from the server, and will be placed in tmpfs on the booted node. In the local file system of the booted node, it is one symbolic link to one file/directory in tmpfs. And the permission of the symbolic link is "lrwxrwxrwx", which is not the real permission of the file/directory on the node. So for some application sensitive to file permissions, it will be one issue to use "link" as its option, for example, "/root/.ssh/", which is used for SSH, should NOT use "link" as its option. It is non-persistent, when the node is rebooted, all changes to the file/directory will be lost. This option can be performed on files and directories. 7. link,ro - The file is readonly, and will be placed in tmpfs on the booted node. In the local file system of the booted node, it is one symbolic link to the tmpfs. It is non-persistent, when the node is rebooted, all changes to the file/directory will be lost. This option requires that the file/directory to be mounted must be available in one of the entries in the litetree table. The option can be performed on files and directories. - 8. link,con - It works similar to the "con" option. All the files found in the litetree hierarchy will be concatenated to the file when found. The final file will be put to the tmpfs on the booted node. In the local file system of the booted node, it is one symbolic link to the file/directory in tmpfs. It is non-persistent, when the node is rebooted, all changes to the file will be lost. The option can only be performed on files. - + 8. link,con - Similar to the "con" option. All the files found in the litetree hierarchy will be concatenated to the file when found. The final file will be put to the tmpfs on the booted node. In the local file system of the booted node, it is one symbolic link to the file/directory in tmpfs. It is non-persistent, when the node is rebooted, all changes to the file will be lost. The option can only be performed on files. 9. link,persistent - It provides a mounted file or directory that is copied to the xCAT persistent location and then over-mounted to the tmpfs on the booted node, and finally the symbolic link in the local file system will be linked to the over-mounted tmpfs file/directory on the booted node. The file/directory will be persistent across reboots. The permission of the file/directory where the symbolic link points to will be the same as the original one in the statelite location. It requires the statelite table to be filled out with a spot for persistent statelite. The option can be performed on files and directories. - 10. localdisk - The file or directory will be stored in the local disk of the statelite node. Refer to the section To enable the localdisk option to enable the 'localdisk' support. -Currently, we don't handle the relative links very well. The relative links are commonly used by the system libraries, for example, under ``/lib/`` directory, there will be one relative link matching one ``.so`` file. So, when you add one relative link to the litefile table (We don't recommend ), make sure the real file also be included, or you can put its directory name into the litefile table. However, most of the users will not put the relative links in the litefile table. +Currently, xCAT does not handle the relative links very well. The relative links are commonly used by the system libraries, for example, under ``/lib/`` directory, there will be one relative link matching one ``.so`` file. So, when you add one relative link to the litefile table (Not recommend), make sure the real file also be included, or put its directory name into the litefile table. -``Note``: It is recommended that you specify at least the entries listed below in the litefile table, because most of these files need to be writeable for the node to boot up successfully. When any changes are made to their options, make sure they won't affect the whole system. +**Note**: It is recommended that you specify at least the entries listed below in the litefile table, because most of these files need to be writeable for the node to boot up successfully. When any changes are made to their options, make sure they won't affect the whole system. -Sample Data for a RedHat statelite setup -```````````````````````````````````````` - -This is the minimal list of files needed, you can add additional files to the litefile table. - -Notice that all files are in tmpfs, the default for the options field. This gives you an NFS root solution with no persistent storage. :: - - #image,file,options,comments,disable - "ALL","/etc/adjtime","tmpfs",, - "ALL","/etc/fstab","tmpfs",, - "ALL","/etc/lvm/","tmpfs",, - "ALL","/etc/syslog.conf","tmpfs",, - "ALL","/etc/syslog.conf.XCATORIG","tmpfs",, - "ALL","/etc/ntp.conf","tmpfs",, - "ALL","/etc/ntp.conf.predhclient","tmpfs",, - "ALL","/etc/resolv.conf","tmpfs",, - "ALL","/etc/resolv.conf.predhclient","tmpfs",, - "ALL","/etc/ssh/","tmpfs",, - "ALL","/etc/sysconfig/","tmpfs",, - "ALL","/etc/inittab","tmpfs",, - "ALL","/tmp/","tmpfs",, - "ALL","/var/","tmpfs",, - "ALL","/opt/xcat/","tmpfs",, - "ALL","/xcatpost/","tmpfs",, - "ALL","/root/.ssh/","tmpfs",, - -Sample Data for Redhat6/7 statelite setup -````````````````````````````````````````` +Sample Data for Red hat statelite setup +``````````````````````````````````````` This is the minimal list of files needed, you can add additional files to the litefile table. :: @@ -117,33 +90,27 @@ This is the minimal list of files needed, you can add additional files to the li "ALL","/xcatpost/","tmpfs",, "ALL","/root/.ssh/","tmpfs",, -``Note``: Sample Data for Fedora13/14 statelite setup refer to the setup of Redhat6. - litetree table -------------- -The litetree table controls where the initial content of the files in the litefile table come from, and the long term content of the ``ro`` files. When a node boots up in statelite mode, it will by default copy all of its tmpfs files from the ``/.default`` directory of the root image, so there is not required to set up a litetree table. If you decide that you want some of the files pulled from different locations that are different per node, you can use this table. See Advanced Statelite features. +The litetree table controls where the initial content of the files in the litefile table come from, and the long term content of the ``ro`` files. When a node boots up in statelite mode, it will by default copy all of its tmpfs files from the ``.default`` directory of the root image, for example ``/install/netboot/rhels7.3/x86_64/compute/rootimg/.default``, so there is not required to set up a litetree table. If you decide that you want some of the files pulled from different locations that are different per node, you can use this table. You can choose to use the defaults and not set up a litetree table. statelite table --------------- -You may want some files in the image to be stored permanently, to survive reboots. This is done by entering the information into the statelite table. +The statelite table specifies location on an NFS server where a nodes persistent files are stored. This is done by entering the information into the statelite table. -See the statelite man page for description of the attributes. - -``Note``: In the statelite table, the node or nodegroups in the table must be unique; that is a node or group should appear only once in the first column table. This makes sure that only one statelite image can be assigned to a node. - -An example would be: :: +In the statelite table, the node or nodegroups in the table must be unique; that is a node or group should appear only once in the first column table. This makes sure that only one statelite image can be assigned to a node. An example would be: :: "compute",,":/gpfs/state",, -Any nodes in the compute node group will have their state stored in the ``/gpfs/state`` directory on the machine with ```` as its IP address. The image attribute should be left blank - currently it is not used. +Any nodes in the compute node group will have their state stored in the ``/gpfs/state`` directory on the machine with ```` as its IP address. -When the node boots up, then the value of the statemnt attribute will be mounted to ``/.statelite/persistent``. The code will then create the following subdirectory ``/.statelite/persistent/`` if there are persistent files that have been added in the litefile table. This directory will be the root of the image for this node's persistent files. By default, xCAT will do a hard NFS mount of the directory. You can change the mount options by setting the mntopts attribute in the statelite table. +When the node boots up, then the value of the ``statemnt`` attribute will be mounted to ``/.statelite/persistent``. The code will then create the following subdirectory ``/.statelite/persistent/``, if there are persistent files that have been added in the litefile table. This directory will be the root of the image for this node's persistent files. By default, xCAT will do a hard NFS mount of the directory. You can change the mount options by setting the mntopts attribute in the statelite table. -Also, to set the statemnt attribute, you can use variables from xCAT database. It follows the same grammar as the litetree table. For example: :: +Also, to set the ``statemnt`` attribute, you can use variables from xCAT database. It follows the same grammar as the litetree table. For example: :: #node,image,statemnt,mntopts,comments,disable "cn1",,"$noderes.nfsserver:/lite/state/$nodetype.profile","soft,timeo=30",, @@ -158,3 +125,10 @@ Ensure policies are set up correctly in the Policy Table. When a node boots up, chdef -t policy -o 4.7 commands=litefile rule=allow chdef -t policy -o 4.8 commands=litetree rule=allow +noderes +------- + +``noderes.nfsserver`` attribute can be set for the NFSroot server. If this is not set, then the default is the Management Node. + +``noderes.nfsdir`` can be set. If this is not set, the the default is ``/install`` + diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/hierarchy_support.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/hierarchy_support.rst index 6591018d7..449533bfe 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/hierarchy_support.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/hierarchy_support.rst @@ -13,7 +13,7 @@ Setup the diskfull service node Generate the statelite image ```````````````````````````` -To generate the statelite image for your own profile follow instructions in `Customize your statelite osimage`_. +To generate the statelite image for your own profile follow instructions in :doc:`Customize your statelite osimage <./provision_statelite>`. ``NOTE``: if the NFS directories defined in the litetree table are on the service node, it is better to setup the NFS directories in the service node following the chapter. diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/index.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/index.rst index 8a91a2a82..7ae22087e 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/index.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/index.rst @@ -1,12 +1,45 @@ Statelite Installation ====================== -.. toctree:: - :maxdepth: 3 +**Overview** + +This document details the design and setup for the statelite solution of xCAT. **Statelite** is an intermediate mode between **diskful** and **diskless**. + +Statelite provides two kinds of efficient and flexible solutions, most of the OS image can be NFS mounted read-only, or the OS image can be in the ramdisk with tmpfs type. Different from the stateless solution, statelite provides a configurable list of directories and files that can be read-write. These read-write directories and files can be configured to either persist or not persist across reboots. + +**Solutions** + +There are two solutions: ``NFSROOT-based`` and ``RAMdisk-based``. + +#. NFSROOT-based(default): + #. rootfstype in the osimage xCAT data objects is left as blank, or set to ``nfs``, the ``NFSROOT-base`` statelite solution will be enabled. + #. the ROOTFS is NFS mounted read-only. + +#. RAMdisk-based: + #. rootfstype in the osimage xCAT data objects is set to ``ramdisk``. + #. one image file will be downloaded when the node is booting up, and the file will be extracted to the ramdisk, and used as the ROOTFS. + +**Advantages** + +``Statelite`` offers the following advantages over xCAT's stateless (RAMdisk) implementation: + +#. Some files can be made persistent over reboot. This is useful for license files or database servers where some state is needed. However, you still get the advantage of only having to manage a single image. +#. Changes to hundreds of machines can take place instantly, and automatically, by updating one main image. In most cases, machines do not need to reboot for these changes to take affect. This is only for the ``NFSROOT-based`` solution. +#. Ease of administration by being able to lock down an image. Many parts of the image can be read-only, so no modifications can transpire without updating the central image. +#. Files can be managed in a hierarchical manner. For example: Suppose you have a machine that is in one lab in Tokyo and another in London. You could set table values for those machines in the xCAT database to allow machines to sync from different places based on their attributes. This allows you to have one base image with multiple sources of file overlay. +#. Ideal for virtualization. In a virtual environment, you may not want a disk image (neither stateless nor stateful) on every virtual node as it consumes memory and disk. Virtualizing with the statelite approach allows for images to be smaller, easier to manage, use less disk, less memory, and more flexible. + +**Disadvantages** + +However, there're still several disadvantages, especially for the ``NFSROOT-based`` solution. + +#. NFS Root requires more network traffic to run as the majority of the disk image runs over NFS. This may depend on your workload, but can be minimized. Since the bulk of the image is read-only, NFS caching on the server helps minimize the disk access on the server, and NFS caching on the client helps reduce the network traffic. +#. NFS Root can be complex to set up. As more files are created in different places, there are greater chances for failures. This flexibility is also one of the great virtues of Statelite. The image can work in nearly any environment. + +.. toctree:: + :maxdepth: 2 - overview.rst config_statelite.rst provision_statelite.rst - update_nodes.rst hierarchy_support.rst advanced_features.rst diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/provision_statelite.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/provision_statelite.rst index e87e5bb0c..240aed782 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/provision_statelite.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/provision_statelite.rst @@ -1,59 +1,42 @@ Provision statelite =================== -Show current provmethod ------------------------ +Show current provisioning method +-------------------------------- -To determine the current provmethod of your node, run: :: +To determine the current provisioning method of your node, execute: :: - lsdef | provmethod - -If an osimage name is specified for the provmethod, the osimage attribute settings stored in the osimage and linuximage table are used to locate the files for ``templates``, ``*pkglists``, ``syncfiles``, etc. + lsdef -i provmethod ``Note``: syncfiles is not currently supported for statelite nodes. -See attributes in the osimage, linuximage and nimimage tables. For example: :: - - tabdump -d osimage - tabdump -d linuximage - tabdump -d nimimage - -For a hierarchical cluster, the files must be placed under the site table installdir attribute path, usually ``/install`` directory, so they will be available when mounted on the service nodes. The site table installdir directory, is mounted or copied to the service nodes during the hierarchical install of compute nodes from the service nodes. - Generate default statelite image from distoro media --------------------------------------------------- -For our example, we are going to create a new compute node test osimage for ``rhels7.3`` on ``ppc64le``. This works fine for other archtectures ( e.g. ``x86_64``). Just substitute your architecture in the paths ( e.g. ``x86_64`` ). We will set up a test directory structure that we can use to create our image. Later we can just move that into production. +In this example, we are going to create a new compute node osimage for ``rhels7.3`` on ``ppc64le``. We will set up a test directory structure that we can use to create our image. Later we can just move that into production. Use the copycds command to copy the appropriate iso image into the ``/install`` directory for xCAT. The copycds commands will copy the contents to ``/install/rhels7.3/``. For example: :: - mkdir /iso - cd /iso copycds RHEL-7.3-20161019.0-Server-ppc64le-dvd1.iso The contents are copied into ``/install/rhels7.3/ppc64le/`` -When copycds runs, it will automatically create default osimage names and paths in the osimage table and the linuximage table based on the os and architecture you are using. You can use these defaults as a starting point to create your own osimage definitions, or you can create your own image definition. We are going to use the statelite generated image for our example. +The configuration files pointed to by the attributes are the defaults shipped with xCAT. We will want to copy them to the ``/install`` directory, in our example the ``/install/test`` directory and modify them as needed. -The configuration files pointed to by the attributes are the defaults shipped with xCAT. We will want to copy them to the ``/install`` directory, in our example the ``/install/test`` directory and modify them as needed. :: +Statelite Directory Structure +----------------------------- - lsdef -t osimage -o rhels7.3-ppc64le-statelite-compute - Object name: rhels7.3-ppc64le-statelite-compute - exlist=/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.exlist - imagetype=linux - osarch=ppc64le - osdistroname=rhels7.3-ppc64le - osname=Linux - osvers=rhels7.3 - otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le - permission=755 - pkgdir=/install/rhels7.3/ppc64le - pkglist=/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.pkglist - postinstall=/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall - profile=compute - provmethod=statelite - rootimgdir=/install/netboot/rhels7.3/ppc64le/compute - synclists=/install/custom/netboot/rh/compute.synclist +Each statelite image will have the following directories: :: + + /.statelite/tmpfs/ + /.default/ + /etc/init.d/statelite + +All files with link options, which are symbolic links, will link to ``/.statelite/tmpfs``. + +tmpfs files that are persistent link to ``/.statelite/persistent//``, ``/.statelite/persistent/`` is the directory where the node's individual storage will be mounted to. + +``/.default`` is where default files will be copied to from the image to tmpfs if the files are not found in the litetree hierarchy. Customize your statelite osimage -------------------------------- @@ -61,64 +44,41 @@ Customize your statelite osimage Create the osimage definition ````````````````````````````` -Setup your osimage/linuximage tables with new test image name, osvers,osarch, and paths to all the files for building and installing the node. So using the above generated ``rhels7.3-ppc64le-statelite-compute`` as an example, I am going to create my own image. The value for the provmethod attribute is osimage in my example.:: +Setup your osimage/linuximage tables with new test image name, osvers,osarch, and paths to all the files for building and installing the node. So using the above generated ``rhels7.3-ppc64le-statelite-compute`` as an example, I am going to create my own image. The value for the provisioning method attribute is osimage in my example.:: - mkdef -t osimage -o redhat7img \ - profile=compute imagetype=linux provmethod=statelite osarch=ppc64le osname=linux osvers=rhels7.3 + mkdef rhels7.3-custom-statelite -u profile=compute provmethod=statelite Check your setup: :: + + lsdef -t osimage rhels7.3-custom-statelite - lsdef -t osimage redhat7img - Object name: redhat7img - imagetype=linux - osarch=ppc64le - osname=linux - osvers=rhels7.3 - profile=compute - provmethod=statelite - -Add the paths to your ``pkglist``, ``syncfile``, etc to the osimage definition, that you require. ``Note``, if you modify the files on the ``/opt/xcat/share/...`` path then copy to the appropriate ``/install/custom/...`` path. Remember all files must be under ``/install`` if using hierarchy (service nodes). +Customize the paths to your ``pkglist``, ``syncfile``, etc to the osimage definition, that you require. ``Note``, if you modify the files on the ``/opt/xcat/share/...`` path then copy to the appropriate ``/install/custom/...`` path. Remember all files must be under ``/install`` if using hierarchy (service nodes). Copy the sample ``*list`` files and modify as needed: :: mkdir -p /install/test/netboot/rh cp -p /opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.pkglist \ - /install/test/netboot/rh/compute.pkglist + /install/test/netboot/rh/compute.rhels7.ppc64le.pkglist cp -p /opt/xcat/share/xcat/netboot/rh/compute.exlist \ /install/test/netboot/rh/compute.exlist - chdef -t osimage -o redhat7img \ + chdef -t osimage -o rhels7.3-custom-statelite \ pkgdir=/install/rhels7.3/ppc64le \ - pkglist=/install/test/netboot/rh/compute.pkglist \ + pkglist=/install/test/netboot/rh/compute.rhels7.ppc64le.pkglist \ exlist=/install/test/netboot/rh/compute.exlist \ rootimgdir=/install/test/netboot/rh/ppc64le/compute -Check your setup: :: - - lsdef -t osimage -o redhat7img - Object name: redhat7img - exlist=/install/test/netboot/rh/compute.exlist - imagetype=linux - osarch=ppc64 - osname=linux - osvers=rhels7.3 - pkgdir=/install/rhels7.3/ppc64le - pkglist=/install/test/netboot/rh/compute.pkglist - profile=compute - provmethod=statelite - rootimgdir=/install/test/netboot/rh/ppc64le/compute - Setup pkglists `````````````` -In the above example, you have defined your pkglist to be in ``/install/test/netboot/rh/compute.pkglist``. +In the above example, you have defined your pkglist to be in ``/install/test/netboot/rh/compute.rhels7.ppc64le.pkglist``. -Edit compute.pkglist and compute.exlist as needed. :: +Edit ``compute.rhels7.ppc64le.pkglist`` and ``compute.exlist`` as needed. :: - cd /install/test/netboot/rh/ - vi compute.pkglist compute.exlist + vi /install/test/netboot/rh/compute.rhels7.ppc64le.pkglist + vi /install/test/netboot/rh/compute.exlist -For example to add vi to be installed on the node, add the name of the vi rpm to compute.pkglist. Make sure nothing is excluded in compute.exlist that you need. +Make sure nothing is excluded in compute.exlist that you need. Install other specific packages ``````````````````````````````` @@ -148,14 +108,14 @@ Or, if you create a sub-directory to contain the rpm packages, for example, name Define the location of of your otherpkgs in your osimage: :: - chdef -t osimage -o redhat7img \ + chdef -t osimage -o rhels7.3-custom-statelite \ otherpkgdir=/install/test/post/otherpkgs/rh/ppc64le \ otherpkglist=/install/test/netboot/rh/compute.otherpkgs.pkglist There are examples under ``/opt/xcat/share/xcat/netboot/`` of typical ``*otherpkgs.pkglist`` files that can used as an example of the format. -Set up Post install scripts for statelite -````````````````````````````````````````` +Set up Post scripts for statelite +````````````````````````````````` The rules to create post install scripts for statelite image is the same as the rules for stateless/diskless install images. @@ -172,62 +132,36 @@ Using postinstall files is optional. There are some examples shipped in ``/opt/x If you define a postinstall file to be used by genimage, then :: - chdef -t osimage -o redhat7img postinstall=. - -Setting up Files to be synchronized on the nodes -```````````````````````````````````````````````` - -Setup the node to use your osimage -`````````````````````````````````` -:: - chdef -t node -o node1 provmethod=redhat7img - lsdef node1 | grep provmethod - provmethod=redhat7img + chdef -t osimage -o rhels7.3-custom-statelite postinstall=. Generate the image ------------------ -Run the following command to generate the image based on your osimage named redhat6img. Adjust your genimage parameters to your architecture and network settings. See man genimage. :: +Run the following command to generate the image based on your osimage named ``rhels7.3-custom-statelite``. Adjust your genimage parameters to your architecture and network settings. See man genimage. :: - genimage redhat7img + genimage rhels7.3-custom-statelite -The genimage will create a default ``/etc/fstab`` in the image, for example: :: +The genimage will create a default ``/etc/fstab`` in the image, if you want to change the defaults, on the management node, edit fstab in the image: :: - devpts /dev/pts devpts gid=5,mode=620 0 0 - tmpfs /dev/shm tmpfs defaults 0 0 - proc /proc proc defaults 0 0 - sysfs /sys sysfs defaults 0 0 - tmpfs /tmp tmpfs defaults,size=10m 0 2 - tmpfs /var/tmp tmpfs defaults,size=10m 0 2 - compute_x86_64 / tmpfs rw 0 1 - -If you want to change the defaults, on the management node, edit fstab in the image: :: - - cd /install/netboot/rhels6/x86_64/compute/rootimg/etc + cd /install/netboot/rhels7/ppc64le/compute/rootimg/etc cp fstab fstab.ORIG vi fstab -Change these settings: :: - - proc /proc proc rw 0 0 - sysfs /sys sysfs rw 0 0 - devpts /dev/pts devpts rw,gid=5,mode=620 0 0 - #tmpfs /dev/shm tmpfs rw 0 0 - compute_x86_64 / tmpfs rw 0 1 - none /tmp tmpfs defaults,size=10m 0 2 - none /var/tmp tmpfs defaults,size=10m 0 2 - ``Note``: adding ``/tmp`` and ``/var/tmp`` to ``/etc/fstab`` is optional, most installations can simply use ``/``. It was documented her to show that you can restrict the size of filesystems, if you need to. The indicated values are just and example, and you may need much bigger filessystems, if running applications like OpenMPI. Pack the image -------------- -:: - liteimg redhat7img -Boot the node -------------- -:: - rinstall node1 osimage=redhat7img +Execute liteimg :: + + liteimg rhels7.3-custom-statelite + +Boot the statelite node +----------------------- + +Execute ``rinstall`` :: + + rinstall node1 osimage=rhels7.3-custom-statelite Switch to the RAMdisk based solution ------------------------------------ @@ -239,14 +173,14 @@ Set rootfstype If you want the node to boot with a RAMdisk-based image instead of the NFS-base image, set the rootfstype attribute for the osimage to ``ramdisk``. For example: :: - chdef -t osimage -o rhels6-ppc64-statelite-compute rootfstype=ramdisk + chdef -t osimage -o rhels7.3-custom-statelite rootfstype=ramdisk Run liteimg command ``````````````````` The ``liteimg`` command will modify your statelite image (the image that ``genimage`` just created) by creating a series of links. Once you are satisfied with your image contains what you want it to, run ``liteimg ``: :: - liteimg rhels6-ppc64-statelite-compute + liteimg rhels7.3-custom-statelite For files with link options, the ``liteimg`` command creates two levels of indirection, so that files can be modified while in their image state as well as during runtime. For example, a file like ``$imageroot/etc/ntp.conf`` with link option in the litefile table, will have the following operations done to it: @@ -268,8 +202,8 @@ But for files without link options, the ``liteimg`` command only creates clones ``Note``: If you make any changes to your litefile table after running ``liteimg`` then you will need to rerun ``liteimg`` again. This is because files and directories need to have the two levels of redirects created. -Boot the node -````````````` +Boot the statelite node +``````````````````````` Make sure you have set up all the attributes in your node definitions correctly following the node installation instructions corresponding to your hardware: @@ -277,45 +211,8 @@ You can now deploy the node by running the following commmands: :: rinstall -This will create the necessary files in ``/tftpboot/etc`` for the node to boot correctly. You can then use ``rcons`` or ``wcons`` to watch the node boot up. -Commands --------- - -The following commands are in ``/opt/xcat/bin``: :: - - litefile : Shows all the statelite files that are not to be taken from the base of the image. - - litetree : Shows the NFS mount points for a node. - - liteimg : Creates a series of symbolic links in an image that is compatible with statelite booting. - - lslite -i : Displays a summary of the statelite information defined for . - - lslite : Displays a summary of the statelite information defined for the - -Statelite Directory Structure ------------------------------ - -Each statelite image will have the following directories: :: - - /.statelite/tmpfs/ - /.default/ - /etc/init.d/statelite - -All files with link options, which are symbolic links, will link to ``/.statelite/tmpfs``. - -tmpfs files that are persistent link to ``/.statelite/persistent//``, ``/.statelite/persistent/`` is the directory where the node's individual storage will be mounted to. - -``/.default`` is where default files will be copied to from the image to tmpfs if the files are not found in the litetree hierarchy. - -The noderes Table -````````````````` -``noderes.nfsserver`` attribute can be set for the NFSroot server. If this is not set, then the defaul is the Management Node. - -``noderes.nfsdir`` can be set. If this is not set, the the default is ``/install`` - Adding/updating software and files for the running nodes -------------------------------------------------------- From 66f15d8607e3752406823c4b085f0821628b6388 Mon Sep 17 00:00:00 2001 From: bybai Date: Thu, 12 Jan 2017 01:43:27 -0500 Subject: [PATCH 012/100] delete overview.rst --- .../ppc64le/statelite/overview.rst | 38 ------------------- 1 file changed, 38 deletions(-) delete mode 100644 docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/overview.rst diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/overview.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/overview.rst deleted file mode 100644 index 0a0139c37..000000000 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/overview.rst +++ /dev/null @@ -1,38 +0,0 @@ -Overview -======== - -This document details the design and setup for the statelite solution of xCAT. ``Statelite`` is an intermediate mode between ``stateful`` and ``stateless``. - -Statelite provides two kinds of efficient and flexible solutions, most of the OS image can be NFS mounted read-only, or the OS image can be in the ramdisk with tmpfs type. Different from the stateless solution, statelite provides a configurable list of directories and files that can be read-write. These read-write directories and files can either be persistent across reboots, or volatile (which means restoring to the original state after reboot). - -Solutions ---------- - -There are two solutions, ``NFSROOT-based`` and ``RAMdisk-based``. - -There is an attribute named rootfstype in the osimage xCAT data objects. If it is set to ``ramdisk``, the ``RAMdisk-based`` statelite solution will be enabled. If it is left as blank, or set to ``nfs``, the ``NFSROOT-base`` statelite solution will be enabled. - -The default solution is ``NFSROOT-based``. In the ``NFSROOT-based`` solution, the ROOTFS is NFS mounted read-only. - -In the ``RAMdisk-based`` statelite solution, one image file will be downloaded when the node is booting up, and the file will be extracted to the ramdisk, and used as the ROOTFS. - -Advantages ----------- - -``Statelite`` offers the following advantages over xCAT's stateless (RAMdisk) implementation: - -#. Some files can be made persistent over reboot. This is useful for license files or database servers where some state is needed. However, you still get the advantage of only having to manage a single image. -#. Changes to hundreds of machines can take place instantly, and automatically, by updating one main image. In most cases, machines do not need to reboot for these changes to take affect. This is only for the ``NFSROOT-based`` solution. -#. Ease of administration by being able to lock down an image. Many parts of the image can be read-only, so no modifications can transpire without updating the central image. -#. Files can be managed in a hierarchical manner. For example: Suppose you have a machine that is in one lab in Tokyo and another in London. You could set table values for those machines in the xCAT database to allow machines to sync from different places based on their attributes. This allows you to have one base image with multiple sources of file overlay. -#. Ideal for virtualization. In a virtual environment, you may not want a disk image (neither stateless nor stateful) on every virtual node as it consumes memory and disk. Virtualizing with the statelite approach allows for images to be smaller, easier to manage, use less disk, less memory, and more flexible. - -Disadvantages -------------- - -However, there're still several disadvantages, especially for the ``NFSROOT-based`` solution. - -#. NFS Root requires more network traffic to run as the majority of the disk image runs over NFS. This may depend on your workload, but can be minimized. Since the bulk of the image is read-only, NFS caching on the server helps minimize the disk access on the server, and NFS caching on the client helps reduce the network traffic. -#. NFS Root can be complex to set up. As more files are created in different places, there are greater chances for failures. This flexibility is also one of the great virtues of Statelite. The image can work in nearly any environment. - -Only one statelite image may be defined for a node or noderange. From 6059a5c09e27102527f6583ea5ba20672fc5f28d Mon Sep 17 00:00:00 2001 From: ertaozh Date: Fri, 13 Jan 2017 00:30:32 -0500 Subject: [PATCH 013/100] add 2.13.x release information in documents --- docs/source/overview/xcat2_release.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/source/overview/xcat2_release.rst b/docs/source/overview/xcat2_release.rst index ec71b0834..dffe7f196 100644 --- a/docs/source/overview/xcat2_release.rst +++ b/docs/source/overview/xcat2_release.rst @@ -7,6 +7,30 @@ The following table is a summary of the new operating system (OS), hardware, and * **SLES** - Suse Linux Enterprise Server * **UBT** - Ubuntu +xCAT 2.13.x +----------- + ++---------------------------------+---------------+-------------+----------------------------------+ +|xCAT |New OS |New |New Feature | +|Version | |Hardware | | ++=================================+===============+=============+==================================+ +|| xCAT 2.13.1 | | |- ONIE switch support | +|| 2017/1/13 | | |- refine xcatprobe subcommand: | +|| | | | xcatmn, osdeploy | +| `2.13.1 Release Notes `_ | | | | +| | | | | ++---------------------------------+---------------+-------------+----------------------------------+ +|| xCAT 2.13 |- SLES 12.2 | |- update drivers for genesis-base | +|| 2016/12/09 | | | mlx4-en 3.2-1.0.1.1 | +|| | | | i40e 1.5.16 | +| `2.13 Release Notes `_ | | |- statelite image create by copyds| +| | | | | ++---------------------------------+---------------+-------------+----------------------------------+ + xCAT 2.12.x ----------- From a7af376da2f0082578546bb29f9db479032f4064 Mon Sep 17 00:00:00 2001 From: bybai Date: Mon, 16 Jan 2017 02:07:41 -0500 Subject: [PATCH 014/100] polish format --- .../ppc64le/statelite/config_statelite.rst | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst index 00c9d24d8..9e8a9c312 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst @@ -19,24 +19,24 @@ The litefile table specifies the directories and files on the statelite nodes th #. The third column in the litefile table specifies options for the directory or file: - 1. tmpfs - It provides a file or directory for the node to use when booting, its permission will be the same as the original version on the server. In most cases, it is read-write; however, on the next statelite boot, the original version of the file or directory on the server will be used, it means it is non-persistent. This option can be performed on files and directories. - 2. rw - Same as Above.Its name "rw" does NOT mean it always be read-write, even in most cases it is read-write. Do not confuse it with the "rw" permission in the file system. - 3. persistent - It provides a mounted file or directory that is copied to the xCAT persistent location and then over-mounted on the local file or directory. Anything written to that file or directory is preserved. It means, if the file/directory does not exist at first, it will be copied to the persistent location. Next time the file/directory in the persistent location will be used. The file/directory will be persistent across reboots. Its permission will be the same as the original one in the statelite location. It requires the statelite table to be filled out with a spot for persistent statelite. This option can be performed on files and directories. - 3. con - The contents of the pathname are concatenated to the contents of the existing file. For this directive the searching in the litetree hierarchy does not stop when the first match is found. All files found in the hierarchy will be concatenated to the file when found. The permission of the file will be "-rw-r--r--", which means it is read-write for the root user, but readonly for the others. It is non-persistent, when the node reboots, all changes to the file will be lost. It can only be performed on files. Do not use it for one directory. - 4. ro - The file/directory will be overmounted read-only on the local file/directory. It will be located in the directory hierarchy specified in the litetree table. Changes made to this file or directory on the server will be immediately seen in this file/directory on the node. This option requires that the file/directory to be mounted must be available in one of the entries in the litetree table. This option can be performed on files and directories. - 5. tmpfs,rw - Only for compatibility it is used as the default option if you leave the options column blank. It has the same semantics with the link option, so when adding new items into the _litefile table, the link option is recommended. - 6. link - It provides one file/directory for the node to use when booting, it is copied from the server, and will be placed in tmpfs on the booted node. In the local file system of the booted node, it is one symbolic link to one file/directory in tmpfs. And the permission of the symbolic link is "lrwxrwxrwx", which is not the real permission of the file/directory on the node. So for some application sensitive to file permissions, it will be one issue to use "link" as its option, for example, "/root/.ssh/", which is used for SSH, should NOT use "link" as its option. It is non-persistent, when the node is rebooted, all changes to the file/directory will be lost. This option can be performed on files and directories. - 7. link,ro - The file is readonly, and will be placed in tmpfs on the booted node. In the local file system of the booted node, it is one symbolic link to the tmpfs. It is non-persistent, when the node is rebooted, all changes to the file/directory will be lost. This option requires that the file/directory to be mounted must be available in one of the entries in the litetree table. The option can be performed on files and directories. - 8. link,con - Similar to the "con" option. All the files found in the litetree hierarchy will be concatenated to the file when found. The final file will be put to the tmpfs on the booted node. In the local file system of the booted node, it is one symbolic link to the file/directory in tmpfs. It is non-persistent, when the node is rebooted, all changes to the file will be lost. The option can only be performed on files. - 9. link,persistent - It provides a mounted file or directory that is copied to the xCAT persistent location and then over-mounted to the tmpfs on the booted node, and finally the symbolic link in the local file system will be linked to the over-mounted tmpfs file/directory on the booted node. The file/directory will be persistent across reboots. The permission of the file/directory where the symbolic link points to will be the same as the original one in the statelite location. It requires the statelite table to be filled out with a spot for persistent statelite. The option can be performed on files and directories. - 10. localdisk - The file or directory will be stored in the local disk of the statelite node. Refer to the section To enable the localdisk option to enable the 'localdisk' support. + #. tmpfs - It provides a file or directory for the node to use when booting, its permission will be the same as the original version on the server. In most cases, it is read-write; however, on the next statelite boot, the original version of the file or directory on the server will be used, it means it is non-persistent. This option can be performed on files and directories. + #. rw - Same as Above.Its name "rw" does NOT mean it always be read-write, even in most cases it is read-write. Do not confuse it with the "rw" permission in the file system. + #. persistent - It provides a mounted file or directory that is copied to the xCAT persistent location and then over-mounted on the local file or directory. Anything written to that file or directory is preserved. It means, if the file/directory does not exist at first, it will be copied to the persistent location. Next time the file/directory in the persistent location will be used. The file/directory will be persistent across reboots. Its permission will be the same as the original one in the statelite location. It requires the statelite table to be filled out with a spot for persistent statelite. This option can be performed on files and directories. + #. con - The contents of the pathname are concatenated to the contents of the existing file. For this directive the searching in the litetree hierarchy does not stop when the first match is found. All files found in the hierarchy will be concatenated to the file when found. The permission of the file will be "-rw-r--r--", which means it is read-write for the root user, but readonly for the others. It is non-persistent, when the node reboots, all changes to the file will be lost. It can only be performed on files. Do not use it for one directory. + #. ro - The file/directory will be overmounted read-only on the local file/directory. It will be located in the directory hierarchy specified in the litetree table. Changes made to this file or directory on the server will be immediately seen in this file/directory on the node. This option requires that the file/directory to be mounted must be available in one of the entries in the litetree table. This option can be performed on files and directories. + #. tmpfs,rw - Only for compatibility it is used as the default option if you leave the options column blank. It has the same semantics with the link option, so when adding new items into the _litefile table, the link option is recommended. + #. link - It provides one file/directory for the node to use when booting, it is copied from the server, and will be placed in tmpfs on the booted node. In the local file system of the booted node, it is one symbolic link to one file/directory in tmpfs. And the permission of the symbolic link is "lrwxrwxrwx", which is not the real permission of the file/directory on the node. So for some application sensitive to file permissions, it will be one issue to use "link" as its option, for example, "/root/.ssh/", which is used for SSH, should NOT use "link" as its option. It is non-persistent, when the node is rebooted, all changes to the file/directory will be lost. This option can be performed on files and directories. + #. link,ro - The file is readonly, and will be placed in tmpfs on the booted node. In the local file system of the booted node, it is one symbolic link to the tmpfs. It is non-persistent, when the node is rebooted, all changes to the file/directory will be lost. This option requires that the file/directory to be mounted must be available in one of the entries in the litetree table. The option can be performed on files and directories. + #. link,con - Similar to the "con" option. All the files found in the litetree hierarchy will be concatenated to the file when found. The final file will be put to the tmpfs on the booted node. In the local file system of the booted node, it is one symbolic link to the file/directory in tmpfs. It is non-persistent, when the node is rebooted, all changes to the file will be lost. The option can only be performed on files. + #. link,persistent - It provides a mounted file or directory that is copied to the xCAT persistent location and then over-mounted to the tmpfs on the booted node, and finally the symbolic link in the local file system will be linked to the over-mounted tmpfs file/directory on the booted node. The file/directory will be persistent across reboots. The permission of the file/directory where the symbolic link points to will be the same as the original one in the statelite location. It requires the statelite table to be filled out with a spot for persistent statelite. The option can be performed on files and directories. + #. localdisk - The file or directory will be stored in the local disk of the statelite node. Refer to the section To enable the localdisk option to enable the 'localdisk' support. Currently, xCAT does not handle the relative links very well. The relative links are commonly used by the system libraries, for example, under ``/lib/`` directory, there will be one relative link matching one ``.so`` file. So, when you add one relative link to the litefile table (Not recommend), make sure the real file also be included, or put its directory name into the litefile table. **Note**: It is recommended that you specify at least the entries listed below in the litefile table, because most of these files need to be writeable for the node to boot up successfully. When any changes are made to their options, make sure they won't affect the whole system. -Sample Data for Red hat statelite setup -``````````````````````````````````````` +Sample Data for Redhat statelite setup +`````````````````````````````````````` This is the minimal list of files needed, you can add additional files to the litefile table. :: @@ -66,8 +66,8 @@ This is the minimal list of files needed, you can add additional files to the li "ALL","/etc/rc4.d/","tmpfs",, "ALL","/etc/rc5.d/","tmpfs",, -Sample Data for SLES11 statelite setup -`````````````````````````````````````` +Sample Data for SLES statelite setup +```````````````````````````````````` This is the minimal list of files needed, you can add additional files to the litefile table. :: From 13566de2a76e2c34cd5a7a87be16e521f26111b4 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Tue, 17 Jan 2017 14:02:12 -0500 Subject: [PATCH 015/100] makentp -a returns NTP maynot be synchronized on servicenode --- xCAT/postscripts/setupntp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT/postscripts/setupntp b/xCAT/postscripts/setupntp index 882a6161a..dc0985fed 100755 --- a/xCAT/postscripts/setupntp +++ b/xCAT/postscripts/setupntp @@ -126,9 +126,9 @@ if [ $OS_TYPE = Linux ]; then output=`eval $cmd 2>&1` rc=$? if [ "$rc" != "0" ] || (pmatch "$output" "*Time could not*");then - echo "$cmd failed, NTP maynot be synchronized, please wait for NTP synchronized then run updatenode nodename -P setupntp" + echo "$cmd failed, NTP may not be synchronized on server node" + echo "please wait for NTP synchronized, may take at least 15 mins" logger -t xcat "$cmd failed" - exit 1 fi else logger -t xcat "ntpdate -t5 $master " From 3586bea59b7bbc249b426748d11b72ee0863a334 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Wed, 18 Jan 2017 15:45:57 -0500 Subject: [PATCH 016/100] modify the message --- xCAT-server/lib/xcat/plugins/makentp.pm | 1 + xCAT/postscripts/setupntp | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/makentp.pm b/xCAT-server/lib/xcat/plugins/makentp.pm index 7d7466f8b..4e6f19a40 100755 --- a/xCAT-server/lib/xcat/plugins/makentp.pm +++ b/xCAT-server/lib/xcat/plugins/makentp.pm @@ -366,6 +366,7 @@ sub process_request { } if ($::RUNCMD_RC != 0) { send_msg(\%request, 1, "Error from command $cmd\n $result."); + send_msg(\%request, 1, "Please check $ntp_master, make sure time is synced (can be validated by 'ntpq -p'), then rerun makentp command again "); return 1; } } diff --git a/xCAT/postscripts/setupntp b/xCAT/postscripts/setupntp index dc0985fed..9fc3cff86 100755 --- a/xCAT/postscripts/setupntp +++ b/xCAT/postscripts/setupntp @@ -126,8 +126,11 @@ if [ $OS_TYPE = Linux ]; then output=`eval $cmd 2>&1` rc=$? if [ "$rc" != "0" ] || (pmatch "$output" "*Time could not*");then - echo "$cmd failed, NTP may not be synchronized on server node" - echo "please wait for NTP synchronized, may take at least 15 mins" + echo "WARNING: " + echo " $cmd failed, NTP may not be synchronized on NTP server " + echo " please wait for NTP synchronized, may take at least 15 mins" + echo " use 'ntpq -p' command (output has "*" or "+" sign) to validate the NTP server" + echo " run 'updatenode nodename -P setupntp' if NTP is synced on NTP server but nodename is not synced" logger -t xcat "$cmd failed" fi else @@ -144,7 +147,7 @@ if [ $OS_TYPE = Linux ]; then #setup the RTC is UTC format, which will be used by os if ( pmatch $OSVER "sles*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ];then - grep -i "HWCLOCK" /etc/sysconfig/clock + grep -i -q "HWCLOCK" /etc/sysconfig/clock if [ $? -eq 0 ];then sed -i 's/.*HWCLOCK.*/HWCLOCK=\"-u\"/' /etc/sysconfig/clock else @@ -154,7 +157,7 @@ if [ $OS_TYPE = Linux ]; then sed -i 's/.*UTC.*/UTC=\"yes\"/' /etc/default/rcS else if [ -f "/etc/sysconfig/clock" ];then - grep -i "utc" /etc/sysconfig/clock + grep -i -q "utc" /etc/sysconfig/clock if [ $? -eq 0 ];then sed -i 's/.*UTC.*/UTC=\"yes\"/' /etc/sysconfig/clock else @@ -167,18 +170,18 @@ if [ $OS_TYPE = Linux ]; then #update the hardware clock automaticly if [ -f "/etc/sysconfig/ntpd" ];then - grep -i "SYNC_HWCLOCK" /etc/sysconfig/ntpd + grep -i -q "SYNC_HWCLOCK" /etc/sysconfig/ntpd if [ $? -eq 0 ];then sed -i 's/.*SYNC_HWCLOCK.*/SYNC_HWCLOCK=\"yes\"/' /etc/sysconfig/ntpd else echo "SYNC_HWCLOCK=\"yes\"" >> /etc/sysconfig/ntpd fi elif [ -f /etc/sysconfig/ntp ];then - grep -i "NTPD_FORCE_SYNC_ON_STARTUP" /etc/sysconfig/ntp + grep -i -q "NTPD_FORCE_SYNC_ON_STARTUP" /etc/sysconfig/ntp if [ $? -eq 0 ];then sed -i 's/NTPD_FORCE_SYNC_ON_STARTUP=\"no\"/NTPD_FORCE_SYNC_ON_STARTUP=\"yes\"/' /etc/sysconfig/ntp fi - grep -i "NTPD_FORCE_SYNC_HWCLOCK_ON_STARTUP" /etc/sysconfig/ntp + grep -i -q "NTPD_FORCE_SYNC_HWCLOCK_ON_STARTUP" /etc/sysconfig/ntp if [ $? -eq 0 ];then sed -i 's/NTPD_FORCE_SYNC_HWCLOCK_ON_STARTUP=\"no\"/NTPD_FORCE_SYNC_HWCLOCK_ON_STARTUP=\"yes\"/' /etc/sysconfig/ntp fi From 36a8477e08b381f53861f0d974c0abc5a4bfc443 Mon Sep 17 00:00:00 2001 From: Samveen Gulati Date: Fri, 20 Jan 2017 08:38:27 +0000 Subject: [PATCH 017/100] [perl-xCAT]Add x86_64 Centos 5.4,7.2 discinfo, reorder --- perl-xCAT/xCAT/data/discinfo.pm | 52 ++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/perl-xCAT/xCAT/data/discinfo.pm b/perl-xCAT/xCAT/data/discinfo.pm index 43272157d..3a7d9d6dd 100755 --- a/perl-xCAT/xCAT/data/discinfo.pm +++ b/perl-xCAT/xCAT/data/discinfo.pm @@ -12,34 +12,41 @@ require Exporter; @EXPORT_OK = qw(distnames numdiscs); -%distnames = ( - "1310229985.226287" => "centos6", - "1323560292.885204" => "centos6.2", - "1341569670.539525" => "centos6.3", #x86 - "1362445555.957609" => "centos6.4", #x86_64 - "1385726732.061157" => "centos6.5", #x86_64 - "1438724467.511049" => "centos6.7", #x86_64 - "1463897259.552895" => "centos6.8", #x86_64 - "1404489053.504589" => "centos7.0", - "1427495138.035654" => "centos7.1", +my %distnames = ( "1450147276.351714" => "centos7.2", #ppc64le + "1449699925.561114" => "centos7.2", #x86_64 + "1427495138.035654" => "centos7.1", + "1404489053.504589" => "centos7.0", + + "1463897259.552895" => "centos6.8", #x86_64 + "1438724467.511049" => "centos6.7", #x86_64 + "1414159991.958686" => "centos6.6", + "1385726732.061157" => "centos6.5", #x86_64 + "1362445555.957609" => "centos6.4", #x86_64 + "1341569670.539525" => "centos6.3", #x86 + "1323560292.885204" => "centos6.2", + "1310229985.226287" => "centos6", + + "1381776971.473332" => "centos5.10", #x86_64 + "1357930415.252042" => "centos5.9", #x86_64 + "1330913492.861127" => "centos5.8", #x86_64 + "1301444731.448392" => "centos5.6", + "1272326751.405938" => "centos5.5", + "1254416275.453877" => "centos5.4", #x86_64 + "1237641529.260981" => "centos5.3", + "1214240246.285059" => "centos5.2", + "1213888991.267240" => "centos5.2", + "1195929637.060433" => "centos5.1", + "1195929648.203590" => "centos5.1", "1176234647.982657" => "centos5", + "1156364963.862322" => "centos4.4", "1178480581.024704" => "centos4.5", - "1195929648.203590" => "centos5.1", - "1195929637.060433" => "centos5.1", - "1213888991.267240" => "centos5.2", - "1214240246.285059" => "centos5.2", - "1237641529.260981" => "centos5.3", - "1272326751.405938" => "centos5.5", - "1330913492.861127" => "centos5.8", #x86_64 - "1357930415.252042" => "centos5.9", #x86_64 - "1381776971.473332" => "centos5.10", #x86_64 "1195488871.805863" => "centos4.6", "1195487524.127458" => "centos4.6", - "1301444731.448392" => "centos5.6", - "1414159991.958686" => "centos6.6", + "1170973598.629055" => "rhelc5", + "1170978545.752040" => "rhels5", "1192660014.052098" => "rhels5.1", "1192663619.181374" => "rhels5.1", @@ -87,6 +94,7 @@ require Exporter; "1446216863.790260" => "rhels7.2", #x86_64 "1446216863.764721" => "rhels7.2", #ppc64 "1446216863.771788" => "rhels7.2", #ppc64le + "1285193176.593806" => "rhelhpc6", #x86_64 "1305067719.718814" => "rhelhpc6.1", #x86_64 "1321545261.599847" => "rhelhpc6.2", #x86_64 @@ -99,6 +107,7 @@ require Exporter; "1399449226.140088" => "rhelhpc7.0", #x86_64, RHEL ComputeNode "1424360759.772760" => "rhelhpc7.1", #x86_64, RHEL ComputeNode "1446216863.725127" => "rhelhpc7.2", #x86_64, RHEL ComputeNode + "1194015916.783841" => "fedora8", "1194015385.299901" => "fedora8", "1210112435.291709" => "fedora9", @@ -113,6 +122,7 @@ require Exporter; "1372355769.065812" => "fedora19", #x86_64 DVD ISO "1372402928.663653" => "fedora19", #ppc64 DVD ISO "1386856788.124593" => "fedora20", #x86_64 DVD ISO + "1194512200.047708" => "rhas4.6", "1194512327.501046" => "rhas4.6", "1241464993.830723" => "rhas4.8", #x86-64 From edcd5eb8ff9517e50e5668257bae5d2d896ac9aa Mon Sep 17 00:00:00 2001 From: Samveen Gulati Date: Fri, 20 Jan 2017 08:38:40 +0000 Subject: [PATCH 018/100] [perl-xCAT]Add x86_64 Centos 7.3 discinfo --- perl-xCAT/xCAT/data/discinfo.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/perl-xCAT/xCAT/data/discinfo.pm b/perl-xCAT/xCAT/data/discinfo.pm index 3a7d9d6dd..75274be3e 100755 --- a/perl-xCAT/xCAT/data/discinfo.pm +++ b/perl-xCAT/xCAT/data/discinfo.pm @@ -13,6 +13,7 @@ require Exporter; my %distnames = ( + "1480943823.812754" => "centos7.3", #x86_64 "1450147276.351714" => "centos7.2", #ppc64le "1449699925.561114" => "centos7.2", #x86_64 "1427495138.035654" => "centos7.1", From 3971d0db7a6b6135503582cc16cc7532fc5b2bb7 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 20 Jan 2017 13:38:14 -0500 Subject: [PATCH 019/100] Fix spurious output in rcons on uninstalled console alternative. --- xCAT-client/bin/rcons | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-client/bin/rcons b/xCAT-client/bin/rcons index 1f6eadd74..98cbc69fe 100755 --- a/xCAT-client/bin/rcons +++ b/xCAT-client/bin/rcons @@ -73,7 +73,7 @@ fi if [ $USE_CONFLUENT == "1" ] && ([ -x "/opt/confluent/bin/confetty" ] || [ -x "/usr/bin/confetty" ] || [ -x "/usr/local/bin/confetty" ]); then # use confluent, make sure conserver is not also running - CONSERVER_RC=`service conserver status >> /dev/null; echo $?` + CONSERVER_RC=`service conserver status >& /dev/null; echo $?` if [[ ${CONSERVER_RC} == 0 ]]; then echo "Error: consoleservice is set to 'confluent' but conserver is running. Stop conserver, run makeconfluentcfg, and retry..." exit 1 @@ -107,7 +107,7 @@ elif [ -f "/usr/bin/console" ] || [ -f "/bin/console" ]; then # use conserver # make sure confluent is not also running, only if confluent is installed if [[ -f "/etc/init.d/confluent" ]]; then - CONFLUENT_RC=`service confluent status >> /dev/null; echo $?` + CONFLUENT_RC=`service confluent status >& /dev/null; echo $?` if [[ ${CONFLUENT_RC} == 0 ]]; then echo "Error: consoleservice is set to 'conserver' but confluent is running. Stop confluent, run makeconservercf, and retry..." exit 1 From 9244449c27306316c7d998deb435670efe54082a Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 18 Jan 2017 14:35:48 -0500 Subject: [PATCH 020/100] Amend man page for rvitals --- xCAT-client/pods/man1/rvitals.1.pod | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-client/pods/man1/rvitals.1.pod b/xCAT-client/pods/man1/rvitals.1.pod index c34a42b6b..3bce77fa8 100644 --- a/xCAT-client/pods/man1/rvitals.1.pod +++ b/xCAT-client/pods/man1/rvitals.1.pod @@ -82,12 +82,14 @@ Retrieves power status. =item B Retrieves total power uptime. This value only increases, unless -the Service Processor flash gets updated. +the Service Processor flash gets updated. This option is not valid +for x86 architecture systems. =item B Retrieves total number of reboots. This value only increases, -unless the Service Processor flash gets updated. +unless the Service Processor flash gets updated. This option +is not valid for x86 architecture systems. =item B From 4d7a8f9c8757a6be5148bffc407607efeac4399a Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 18 Jan 2017 14:47:27 -0500 Subject: [PATCH 021/100] Update rinv usage and man page --- perl-xCAT/xCAT/Usage.pm | 2 +- xCAT-client/pods/man1/rinv.1.pod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 5dfb9494c..8bc03a419 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -81,7 +81,7 @@ my %usage = ( rinv [all|model|serial] [-V|--verbose] rinv [-h|--help|-v|--version] BMC specific: - rinv [mprom|deviceid|uuid|guid|vpd|all] + rinv [mprom|deviceid|uuid|guid|vpd|dimm|all] OpenPOWER server specific: rinv [model|serial|deviceid|uuid|guid|vpd|mprom|firm|all] MPA specific: diff --git a/xCAT-client/pods/man1/rinv.1.pod b/xCAT-client/pods/man1/rinv.1.pod index 2a0540235..9da37c523 100644 --- a/xCAT-client/pods/man1/rinv.1.pod +++ b/xCAT-client/pods/man1/rinv.1.pod @@ -8,7 +8,7 @@ B [B<-h>|B<--help>|B<-v>|B<--version>] =head2 BMC/MPA specific: -B I {B|B|B|B|B|B|B|B|B|B|B|B|B|B} +B I {B|B|B|B|B|B|B|B|B|B|B|B|B|B|B} =head2 OpenPOWER server specific: From bdcf94d4c20ad9873629d97a2dcc39d5aae38e3c Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 20 Jan 2017 14:59:28 -0500 Subject: [PATCH 022/100] Fix various issues in confluent plugin confluent plugin was triggering perl warnings in various situations. Correct those mistakes. --- xCAT-server/lib/xcat/plugins/confluent.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/confluent.pm b/xCAT-server/lib/xcat/plugins/confluent.pm index 85b344f95..09fcaeb48 100644 --- a/xCAT-server/lib/xcat/plugins/confluent.pm +++ b/xCAT-server/lib/xcat/plugins/confluent.pm @@ -342,7 +342,7 @@ sub makeconfluentcfg { die "confluent does not currently support termserver"; $termservers{ $_->{termserver} } = 1; # dont add this one again } - if ($type{ $_->{node} } =~ /fsp|bpa|hmc|ivm/) { + if ($type{$_->{node}} and $type{ $_->{node} } =~ /fsp|bpa|hmc|ivm/) { $keepdoing = 0; # these types dont have consoles } } @@ -450,14 +450,16 @@ sub donodeent { } my %parameters; if ($cmeth) { $parameters{'console.method'} = $cmeth; } - if ($cmeth eq 'ipmi' or not $cmeth) { + if (not $cmeth or $cmeth eq 'ipmi') { $parameters{'secret.hardwaremanagementuser'} = $ipmiauthdata->{$node}->{username}; $parameters{'secret.hardwaremanagementpassword'} = $ipmiauthdata->{$node}->{password}; my $bmc = $ipmientries->{$node}->[0]->{bmc}; - $bmc =~ s/,.*//; - $parameters{'hardwaremanagement.manager'} = $bmc; + if ($bmc) { + $bmc =~ s/,.*//; + $parameters{'hardwaremanagement.manager'} = $bmc; + } } if (defined($cfgent->{consoleondemand})) { if ($cfgent->{consoleondemand}) { From f995129e2d870d52ba35cd3794ce78c783c833e4 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Sun, 22 Jan 2017 22:08:25 -0500 Subject: [PATCH 023/100] Modify expression of enhancing command.log depending on Mark's comment --- xCAT-server/sbin/xcatd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index dc9e3a6bc..99be4bef5 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -2863,7 +2863,7 @@ sub service_connection { # ----used for command log start------- my $reqhandletime = time()-$cmdlog_starttime; - $cmdlog_alllog .= "[TimeConsuming] $reqhandletime S\n"; + $cmdlog_alllog .= "[ElapsedTime] $reqhandletime s\n"; cmdlog_submitlog(); # ----used for command log end--------- @@ -2934,7 +2934,7 @@ sub relay_fds { # Relays file descriptors from pipes to children to the SSL sock # ----used for command log start------- $cmdlog_alllog .= "Client abort requested\n"; my $reqhandletime = time()-$cmdlog_starttime; - $cmdlog_alllog .= "[TimeConsuming] $reqhandletime S\n"; + $cmdlog_alllog .= "[ElapsedTime] $reqhandletime s\n"; cmdlog_submitlog(); # ----used for command log end--------- From 4320d950ddb9b70a841b721e6d15cfe6cb9b1f44 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Sun, 22 Jan 2017 22:47:00 -0500 Subject: [PATCH 024/100] complete --- xCAT-test/autotest/testcase/psh/cases0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/psh/cases0 b/xCAT-test/autotest/testcase/psh/cases0 index 94969c510..fed79f18a 100644 --- a/xCAT-test/autotest/testcase/psh/cases0 +++ b/xCAT-test/autotest/testcase/psh/cases0 @@ -49,7 +49,7 @@ description: psh -i interface CN 'uptime' in linux os:Linux cmd:cp /etc/hosts /etc/hostsBK check:rc==0 -cmd:interface=`xdsh $$CN 'ifconfig' | sed -n 1p | awk -F : '{print $2}' | awk -F ' ' '{print $1}'`;sed -i "/$$CN/s/$/$$CN-$interface/g" '/etc/hosts';psh -i $interface $$CN 'uptime' +cmd:interface=`xdsh $$CN 'ifconfig' | sed -n 1p | awk -F : '{print $2}' | awk -F ' ' '{print $1}'`;sed -i "/$$CN/s/$/ $$CN-$interface/g" '/etc/hosts';psh -i $interface $$CN 'uptime' check:output=~$$CN check:rc==0 cmd:rm -rf /etc/hosts From 97ca01394d701f5bf44ddc45bdedd01ed4141609 Mon Sep 17 00:00:00 2001 From: XuWei Date: Mon, 23 Jan 2017 00:46:26 -0500 Subject: [PATCH 025/100] xcatprobe osdeploy performance --- xCAT-probe/lib/perl/probe_global_constant.pm | 16 +- xCAT-probe/lib/perl/probe_utils.pm | 48 +++++ xCAT-probe/subcmds/osdeploy | 207 ++++++++++++++++++- 3 files changed, 255 insertions(+), 16 deletions(-) diff --git a/xCAT-probe/lib/perl/probe_global_constant.pm b/xCAT-probe/lib/perl/probe_global_constant.pm index db83a833d..454d58f36 100644 --- a/xCAT-probe/lib/perl/probe_global_constant.pm +++ b/xCAT-probe/lib/perl/probe_global_constant.pm @@ -27,12 +27,14 @@ $::STATE_BOOTLODER = 4; $::STATE_KERNEL = 5; $::STATE_INITRD = 6; $::STATE_KICKSTART = 7; -$::STATE_INSTALLING = 8; -$::STATE_INSTALLRPM = 9; -$::STATE_POSTSCRIPT = 10; -$::STATE_BOOTING = 11; -$::STATE_POSTBOOTSCRIPT = 12; -$::STATE_COMPLETED = 13; +$::STATE_NETBOOTING = 8; +$::STATE_ROOTIMG = 9; +$::STATE_INSTALLING = 10; +$::STATE_INSTALLRPM = 11; +$::STATE_POSTSCRIPT = 12; +$::STATE_BOOTING = 13; +$::STATE_POSTBOOTSCRIPT = 14; +$::STATE_COMPLETED = 15; #The description of every important stage of provision process %::STATE_DESC = ( @@ -77,5 +79,7 @@ $::STATE_DISCOVER_COMPLETED = 10; $::STATE_DISCOVER_COMPLETED => "discovery_complete", ); +$::DISKFUL = 1; +$::DISKLESS = 2; 1; diff --git a/xCAT-probe/lib/perl/probe_utils.pm b/xCAT-probe/lib/perl/probe_utils.pm index 99b59e46b..2400212c2 100644 --- a/xCAT-probe/lib/perl/probe_utils.pm +++ b/xCAT-probe/lib/perl/probe_utils.pm @@ -550,4 +550,52 @@ sub is_ntp_ready{ return 0; } +#------------------------------------------ + +=head3 + Description: + Convert second to time + Arguments: + second_in : the time in seconds + Returns: + xx:xx:xx xx hours xx minutes xx seconds +=cut + +#------------------------------------------ +sub convert_second_to_time { + my $second_in = shift; + $second_in = shift if (($second_in) && ($second_in =~ /probe_utils/)); + my @time = (); + my $result; + + if ($second_in == 0) { + return "00:00:00"; + } + + my $count = 0; + while ($count < 3) { + my $tmp_second; + if ($count == 2) { + $tmp_second = $second_in % 100; + } else { + $tmp_second = $second_in % 60; + } + if ($tmp_second == 0) { + push @time, "00"; + } elsif ($tmp_second < 10) { + push @time, "0" . "$tmp_second"; + } else { + push @time, "$tmp_second"; + } + + $second_in = ($second_in - $tmp_second) / 60; + $count++; + } + + my @time_result = reverse @time; + $result = join(":", @time_result); + + return $result; +} + 1; diff --git a/xCAT-probe/subcmds/osdeploy b/xCAT-probe/subcmds/osdeploy index 16a33f75c..c04c3af27 100755 --- a/xCAT-probe/subcmds/osdeploy +++ b/xCAT-probe/subcmds/osdeploy @@ -47,8 +47,8 @@ my $debug = 0; my $program_name = basename("$0"); $::USAGE = "Usage: $program_name -h - $program_name -n [-t ] [-V] - $program_name -n -r [-V] + $program_name -n [-t ] [-p ] [-V] + $program_name -n -r [-p ] [-V] Description: Probe operating system provision process. Supports two modes - 'Realtime monitor' and 'Replay history'. @@ -65,6 +65,9 @@ Options: -r : Trigger 'Replay history' mode. Follow the duration of rolling back. Units are 'h' (hour) or 'm' (minute) Supported format examples: 3h30m (3 hours and 30 minutes ago), 2h (2 hours ago), 40m (40 minutes ago) and 3 (3 hours ago). If unit is not specified, hour will be used by default. + -p : Performance of provision for each node and all. + Supported level: 1 (show how much time spent for provision), + 2 (show how much time spent for DHCP, Download RPM packages, Run Postscripts, Run Postbootscripts). "; @@ -82,6 +85,7 @@ if ( !GetOptions("--help|h|?" => \$help, "T" => \$test, "V" => \$verbose, + "p=s" => \$performance, "t=s" => \$maxwaittime, "r=s" => \$rollforward_time_of_replay, "n=s" => \$noderange)) @@ -107,6 +111,11 @@ unless ($noderange) { exit 1; } +my $command_input = "xcatprobe -w $program_name"; +$command_input .= " -n $noderange" if ($noderange); +$command_input .= " -p $performance" if ($performance); +$command_input .= " -V" if ($verbose); + if ($rollforward_time_of_replay) { if (($rollforward_time_of_replay !~ /(\d+)h(\d+)m/i) && ($rollforward_time_of_replay !~ /^(\d+)h*$/i) && ($rollforward_time_of_replay !~ /^(\d+)m$/i)) { probe_utils->send_msg("stdout", "f", "Unsupported time format for option '-r'"); @@ -127,6 +136,10 @@ if ($debug) { #if failed to pass pre-check, exit directly exit $rst if ($rst); +# record every status's start time and end time for each node +# $node_status_time{$node}{$status}{start_time} = $start_time; +my %node_status_time = () if ($performance); +my $provision_type = $::DISKFUL; if ($rollforward_time_of_replay) { $monitor = 0; @@ -468,6 +481,7 @@ sub conclusion_report { my $start_rpower = 0; my $isntalling = 0; my $postbootscript = 0; + my $completed = 0; #calculate node provision result #the max value of all state is the final stop stage @@ -476,6 +490,7 @@ sub conclusion_report { $start_rpower = 1 if ($_ == $::STATE_POWER_ON); $isntalling = 1 if ($_ == $::STATE_INSTALLING); $postbootscript = 1 if ($_ == $::STATE_POSTBOOTSCRIPT); + $completed = 1 if ($_ == $::STATE_COMPLETED) } # Cover limited non-privision error @@ -484,16 +499,11 @@ sub conclusion_report { # 2 When replay, if there isn't reboot operation for target node during the rollback time window # That means there isn't provision process happened - if ($monitor) { - if (!$isntalling && $postbootscript) { - $failed_node{$node}{non_provision_prediction} = "Target node just reboot from disk"; - next; - } - } else { + unless ($monitor) { if (! $start_rpower) { $failed_node{$node}{non_provision_prediction} = "Without provision process during rollback time window"; next; - } elsif (!$isntalling && $postbootscript) { + } elsif (!$isntalling && $postbootscript && !$completed) { $failed_node{$node}{non_provision_prediction} = "Target node just reboot from disk"; next; } @@ -505,7 +515,9 @@ sub conclusion_report { } } + my $is_success = 1; if (%failed_node) { + $is_success = 0; my $failed_node_num = keys %failed_node; if ($failed_node_num > 1) { probe_utils->send_msg("stdout", "d", "There are $failed_node_num node provision failures"); @@ -538,11 +550,144 @@ sub conclusion_report { } else { probe_utils->send_msg("stdout", "o", "All nodes provisioned successfully"); } + + performance_calculation($is_success) if ($performance); + return 0; } #------------------------------------------ +=head3 + Description: + Calculate the performance of provision (for each node) + Arguments: + performance: 1: calculate how much time spent for provision + 2: calculate how much time spent for each status (DHCP, RPM, POSTSCRIPTS, POSTBOOTSCRIPTS) + 3: reserve for diskless and diskful's other status + Returns: +=cut + +#------------------------------------------ +sub performance_calculation { + my $is_success = shift; + #print Dumper(%node_status_time); + + return if ((keys %node_status_time == 1 and $node_status_time{all}) or !%node_status_time); + + probe_utils->send_msg("stdout", "", "-----------node provision performance-----------"); + + my %all_spend_time = (); + my @status_for_time = (); + my $warninfo; + my $isnull = 0; + + my $length_node = 20; + my $space = " " x ($length_node - 4); + + # print table's first line + # @status_for_time: the status that needed to calculate time + if ($provision_type == $::DISKFUL and $performance == 3) { + print "NODE $space DHCP BOOTLOADER KERNEL INITRD KICKSTART RPM POST POSTBOOT COMPLETED\n"; + @status_for_time = ($::STATE_DHCP, $::STATE_BOOTLODER, $::STATE_KERNEL, $::STATE_INITRD, $::STATE_KICKSTART, $::STATE_INSTALLRPM, $::STATE_POSTSCRIPT, $::STATE_POSTBOOTSCRIPT, $::STATE_COMPLETED); + } elsif ($provision_type == $::DISKFUL and $performance == 2) { + print "NODE $space DHCP RPM POST POSTBOOT COMPLETED\n"; + @status_for_time = ($::STATE_DHCP, $::STATE_INSTALLRPM, $::STATE_POSTSCRIPT, $::STATE_POSTBOOTSCRIPT, $::STATE_COMPLETED); + } elsif ($provision_type == $::DISKLESS and $performance == 3) { + print "NODE $space DHCP BOOTLOADER KERNEL INITRD NETBOOTING ROOTIMG POSTBOOT COMPLETED\n"; + @status_for_time = ($::STATE_DHCP, $::STATE_BOOTLODER, $::STATE_KERNEL, $::STATE_INITRD, $::STATE_NETBOOTING, $::STATE_ROOTIMG, $::STATE_POSTBOOTSCRIPT, $::STATE_COMPLETED); + } elsif ($performance == 1) { + print "NODE $space COMPLETED\n"; + @status_for_time = ($::STATE_COMPLETED); + } + + # calculate time for each node and status + foreach my $node (keys %node_status_time) { + next if ($node eq "all"); + + # if did not get start time of power on, use osdeploy start time and show warning info + if ((!$node_status_time{$node}{$::STATE_POWER_ON}{start_time}) and $node_status_time{all}) { + $node_status_time{$node}{$::STATE_POWER_ON}{start_time} = $node_status_time{all}; + $warninfo = "Did not get start time from log during running, use xcatprobe start time"; + } + + if ($all_spend_time{start_time}) { + $all_spend_time{start_time} = ($all_spend_time{start_time} <= $node_status_time{$node}{$::STATE_POWER_ON}{start_time}) ? $all_spend_time{start_time} : $node_status_time{$node}{$::STATE_POWER_ON}{start_time}; + } else { + $all_spend_time{start_time} = $node_status_time{$node}{$::STATE_POWER_ON}{start_time}; + } + + if ($node_status_time{$node}{$::STATE_COMPLETED}{start_time}) { + $all_spend_time{end_time} = ($all_spend_time{end_time} >= $node_status_time{$node}{$::STATE_COMPLETED}{start_time}) ? $all_spend_time{end_time} : $node_status_time{$node}{$::STATE_COMPLETED}{start_time}; + } + + @timeinfo = (); + foreach my $status (@status_for_time) { + my $tmp_status; + my $tmp_detail_status; + if ($performance == 2 and $provision_type == $::DISKFUL) { + $tmp_detail_status = $::STATE_DHCP; + } else { + $tmp_detail_status = $::STATE_COMPLETED; + } + + # for some status, use time of power on as status's start time + if ($status <= $tmp_detail_status or $status == $::STATE_COMPLETED) { + $tmp_status = $::STATE_POWER_ON; + if ($warninfo) { + push @timeinfo, "NULL* "; + $isnull = 1; + $all_spend_time{$status}{rst} = "NULL* "; + next; + } + } else { + $tmp_status = $status; + } + + my $tmp_end_time; + $tmp_end_time = $node_status_time{$node}{$status}{end_time} if ($node_status_time{$node}{$status}{end_time}); + $tmp_end_time = $node_status_time{$node}{$status}{start_time} if ($status != $::STATE_DHCP and $status != $::STATE_INSTALLRPM and $status != $::STATE_POSTSCRIPT and $status != $::STATE_POSTBOOTSCRIPT and $node_status_time{$node}{$status}{start_time}); + + if ($node_status_time{$node}{$tmp_status}{start_time} && $tmp_end_time) { + if ($all_spend_time{$status}{start_time}) { + $all_spend_time{$status}{start_time} = ($all_spend_time{$status}{start_time} <= $node_status_time{$node}{$tmp_status}{start_time}) ? $all_spend_time{$status}{start_time} : $node_status_time{$node}{$tmp_status}{start_time}; + } else { + $all_spend_time{$status}{start_time} = $node_status_time{$node}{$tmp_status}{start_time}; + } + $all_spend_time{$status}{end_time} = ($all_spend_time{$status}{end_time} >= $tmp_end_time) ? $all_spend_time{$status}{end_time} : $tmp_end_time; + push @timeinfo, probe_utils->convert_second_to_time($tmp_end_time - $node_status_time{$node}{$tmp_status}{start_time}); + } else { + push @timeinfo, "NULL* "; + $all_spend_time{$status}{rst} = "NULL* "; + $isnull = 1; + } + } + + my $time_str = join(" ", @timeinfo); + $space = " " x ($length_node - length($node)); + print "$node $space $time_str\n"; + } + + my @time_rst = (); + foreach my $status (@status_for_time) { + if ($all_spend_time{$status}{rst} eq "NULL* ") { + push @time_rst, $all_spend_time{$status}{rst}; + } else { + my $status_time = probe_utils->convert_second_to_time($all_spend_time{$status}{end_time} - $all_spend_time{$status}{start_time}); + push @time_rst, $status_time; + } + } + + my $time_str = join(" ", @time_rst); + $space = " " x ($length_node - 3); + print "ALL $space $time_str\n"; + probe_utils->send_msg("stdout", "", "------------------------------------------------"); + probe_utils->send_msg("stdout", "", "$warninfo") if ($warninfo); + probe_utils->send_msg("stdout", "", "* : Did not get correct time, please run '$command_input -r xxhxxm' to get correct time") if ($isnull and $is_success); +} + +#------------------------------------------ + =head3 Description: Implement the monitor feature @@ -573,6 +718,8 @@ Start capturing every message during OS provision process.... "; probe_utils->send_msg("stdout", "", "$startline"); + $node_status_time{all} = time(); + my @openfilepids; my @openfilefds; my %fd_filetype_map; @@ -766,7 +913,7 @@ sub handle_dhcp_msg { my $ip = $1; my $mac = $2; my $nic = $3; - + if (exists $macmap{$mac}) { my $node = $macmap{$mac}{"node"}; my $record = $log_ref->{msg}; @@ -793,6 +940,7 @@ sub handle_dhcp_msg { $ipnodemap{$ip} = $node; set_node_state($node_state_ref, $node, $::STATE_DHCP); + $node_status_time{$node}{$::STATE_DHCP}{end_time} = $log_ref->{time} if ($performance and !$node_status_time{$node}{$::STATE_DHCP}{end_time}); } } elsif ($log_ref->{msg} =~ /BOOTREQUEST\s+from\s+(.+)\s+via\s+([^:]+)(.*)/) { my $mac = $1; @@ -802,6 +950,7 @@ sub handle_dhcp_msg { my $record = "Receive BOOTREQUEST from $mac via $nic"; probe_utils->send_msg("stdout", "d", "[$node] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{$node}{log} }, $log_ref->{msg}) if ($debug); + $node_status_time{$node}{$::STATE_DHCP}{start_time} = $log_ref->{time} if ($performance); } } elsif ($log_ref->{msg} =~ /BOOTREPLY\s+for\s+(.+)\s+to\s+.+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w).+via\s+(.+)/) { my $ip = $1; @@ -821,6 +970,7 @@ sub handle_dhcp_msg { $ipnodemap{$ip} = $node; set_node_state($node_state_ref, $node, $::STATE_DHCP); + $node_status_time{$node}{$::STATE_DHCP}{end_time} = $log_ref->{time} if ($performance); } } } @@ -852,10 +1002,13 @@ sub handle_tftp_msg { if ($file =~ /xcat\/xnba.*/i or $file =~ /\/boot\/grub2\/powerpc-ieee1275\//i or $file =~ /\/yb\/node\/yaboot\-/i) { set_node_state($node_state_ref, $ipnodemap{$ip}, $::STATE_BOOTLODER); + $node_status_time{$ipnodemap{$ip}}{$::STATE_BOOTLODER}{start_time} = $log_ref->{time} if ($performance); } elsif ($file =~ /vmlinuz|inst64|linux/) { set_node_state($node_state_ref, $ipnodemap{$ip}, $::STATE_KERNEL); + $node_status_time{$ipnodemap{$ip}}{$::STATE_KERNEL}{start_time} = $log_ref->{time} if ($performance); } elsif ($file =~ /initrd/i) { set_node_state($node_state_ref, $ipnodemap{$ip}, $::STATE_INITRD); + $node_status_time{$ipnodemap{$ip}}{$::STATE_INITRD}{start_time} = $log_ref->{time} if ($performance); } } } @@ -892,16 +1045,29 @@ sub handle_http_msg { if ($file =~ /vmlinuz|inst64/i or ($file =~ /linux/i and $file =~ /osimage/i)) { set_node_state($node_state_ref, $ipnodemap{$ip}, $::STATE_KERNEL); + $node_status_time{$ipnodemap{$ip}}{$::STATE_KERNEL}{start_time} = $log_ref->{time} if ($performance); push (@{ $node_state_ref->{ $ipnodemap{$ip} }{errors}{$::STATE_KERNEL} }, "$record failed with $http_code") if ($http_code >= 400); } elsif ($file =~ /initrd/i and $file =~ /osimage/i) { set_node_state($node_state_ref, $ipnodemap{$ip}, $::STATE_INITRD); + $node_status_time{$ipnodemap{$ip}}{$::STATE_INITRD}{start_time} = $log_ref->{time} if ($performance); push (@{ $node_state_ref->{ $ipnodemap{$ip} }{errors}{$::STATE_INITRD} }, "$record failed with $http_code") if ($http_code >= 400); } elsif (($file =~ /^\/install\/autoinst\//i) and ($file !~ /getinstdisk$/i) and ($file !~ /\.pre$/i) and ($file !~ /\.post$/i)) { set_node_state($node_state_ref, $ipnodemap{$ip}, $::STATE_KICKSTART); + $node_status_time{$ipnodemap{$ip}}{$::STATE_KICKSTART}{start_time} = $log_ref->{time} if ($performance); push (@{ $node_state_ref->{ $ipnodemap{$ip} }{errors}{$::STATE_KICKSTART} }, "$record failed with $http_code") if ($http_code >= 400); } elsif ($file =~ /\.deb$/i or $file =~ /\/Packages\/.+\.rpm$/ or $file =~ /\/suse\/noarch\/.+\.rpm$/i) { set_node_state($node_state_ref, $ipnodemap{$ip}, $::STATE_INSTALLRPM); + if ($performance) { + if ($node_status_time{$ipnodemap{$ip}}{$::STATE_INSTALLRPM}{start_time}) { + $node_status_time{$ipnodemap{$ip}}{$::STATE_INSTALLRPM}{end_time} = $log_ref->{time}; + } else { + $node_status_time{$ipnodemap{$ip}}{$::STATE_INSTALLRPM}{start_time} = $log_ref->{time}; + } + } push (@{ $node_state_ref->{ $ipnodemap{$ip} }{errors}{$::STATE_INSTALLRPM} }, "$record failed with $http_code") if ($http_code >= 400); + } elsif ($file =~ /rootimg/) { + set_node_state($node_state_ref, $ipnodemap{$ip}, $::STATE_ROOTIMG); + $node_status_time{$ipnodemap{$ip}}{$::STATE_ROOTIMG}{start_time} = $log_ref->{time} if ($performance); } } } @@ -939,6 +1105,7 @@ sub handle_cluster_msg { probe_utils->send_msg("stdout", "d", "[$node] $log_ref->{time_record} Use command $command to reboot node $node") if ($monitor); push(@{ $node_state_ref->{$node}{log} }, $log_ref->{msg}) if ($debug); set_node_state($node_state_ref, $node, $::STATE_POWER_ON); + $node_status_time{$node}{$::STATE_POWER_ON}{start_time} = $log_ref->{time} if ($performance); } } } @@ -955,10 +1122,16 @@ sub handle_cluster_msg { if ($status eq "installing") { set_node_state($node_state_ref, $node, $::STATE_INSTALLING); + $node_status_time{$node}{$::STATE_INSTALLING}{start_time} = $log_ref->{time} if ($performance); } elsif ($status eq "powering-on") { set_node_state($node_state_ref, $node, $::STATE_POWERINGON); + $node_status_time{$node}{$::STATE_POWERINGON}{start_time} = $log_ref->{time} if ($performance); } elsif ($status eq "booting") { set_node_state($node_state_ref, $node, $::STATE_BOOTING); + $node_status_time{$node}{$::STATE_BOOTING}{start_time} = $log_ref->{time} if ($performance); + } elsif ($status eq "netbooting") { + set_node_state($node_state_ref, $node, $::STATE_NETBOOTING); + $node_status_time{$node}{$::STATE_NETBOOTING}{start_time} = $log_ref->{time} if ($performance); } elsif ($status eq "failed") { $node_state_ref->{$node}{done} = 1; } @@ -990,6 +1163,11 @@ sub handle_compute_msg { push(@{ $node_state_ref->{$node}{log} }, $log_ref->{msg}) if ($debug); if ($log_ref->{msg} =~ /Running postscript:/i) { set_node_state($node_state_ref, $node, $::STATE_POSTSCRIPT); + if ($performance) { + if (!$node_status_time{$node}{$::STATE_POSTSCRIPT}{start_time}) { + $node_status_time{$node}{$::STATE_POSTSCRIPT}{start_time} = $log_ref->{time}; + } + } } elsif ($log_ref->{msg} =~ /postscript (.+) return with (\d+)/) { my $script_name = $1; my $return_code = $2; @@ -1000,8 +1178,14 @@ sub handle_compute_msg { push @{ $node_state_ref->{$node}{errors}{$::STATE_POSTSCRIPT} }, $error_str; } } + $node_status_time{$node}{$::STATE_POSTSCRIPT}{end_time} = $log_ref->{time} if ($performance); } elsif ($log_ref->{msg} =~ /Running postbootscript:/i) { set_node_state($node_state_ref, $node, $::STATE_POSTBOOTSCRIPT); + if ($performance) { + if (!$node_status_time{$node}{$::STATE_POSTBOOTSCRIPT}{start_time}) { + $node_status_time{$node}{$::STATE_POSTBOOTSCRIPT}{start_time} = $log_ref->{time}; + } + } } elsif ($log_ref->{msg} =~ /postbootscript (.+) return with (\d+)/) { my $script_name = $1; my $return_code = $2; @@ -1012,10 +1196,12 @@ sub handle_compute_msg { push @{ $node_state_ref->{$node}{errors}{$::STATE_POSTBOOTSCRIPT} }, $error_str; } } + $node_status_time{$node}{$::STATE_POSTBOOTSCRIPT}{end_time} = $log_ref->{time} if ($performance); } elsif ($log_ref->{msg} =~ /provision completed/) { set_node_state($node_state_ref, $node, $::STATE_COMPLETED); $node_state_ref->{$node}{done} = 1; probe_utils->send_msg("stdout", "o", "[$node] $log_ref->{time_record} provision completed") if ($monitor); + $node_status_time{$node}{$::STATE_COMPLETED}{start_time} = $log_ref->{time}; } } } @@ -1078,6 +1264,7 @@ sub set_node_state { @{ $node_state_ref->{$node}{statehistory} } = (); %{ $node_state_ref->{$node}{errors} } = (); push @{ $node_state_ref->{$node}{statehistory} }, $newstate; + $node_status_time{$node} = (); } else { my $index = @{ $node_state_ref->{$node}{statehistory} } - 1; From e413f232648707d7de3188a7cc139f3c6783d3a3 Mon Sep 17 00:00:00 2001 From: Chuck Brazie Date: Mon, 23 Jan 2017 10:05:07 -0500 Subject: [PATCH 026/100] Secure cookies merge into global xCAT team UI. A few other changes also. Change-Id: I529160b9e2c31c86aca7c2c1ad32559c43ab4aea --- xCAT-UI/etc/apache2/conf.d/xcat-ui.conf | 7 + xCAT-UI/js/configure/service.js | 2 +- xCAT-UI/js/configure/update.js | 25 +- xCAT-UI/js/custom/blade.js | 188 +++---- xCAT-UI/js/custom/customUtils.js | 176 +++--- xCAT-UI/js/custom/esx.js | 166 +++--- xCAT-UI/js/custom/ipmi.js | 40 +- xCAT-UI/js/custom/kvm.js | 164 +++--- xCAT-UI/js/custom/zvm.js | 12 +- xCAT-UI/js/custom/zvmUtils.js | 319 +++++++---- xCAT-UI/js/help/help.js | 713 +++++++++++++++++++++++- xCAT-UI/js/monitor/gangliamon.js | 206 +++---- xCAT-UI/js/nodes/nodes.js | 26 +- xCAT-UI/js/nodes/nodeset.js | 2 +- xCAT-UI/js/nodes/physical.js | 78 +-- xCAT-UI/js/nodes/updatenode.js | 78 +-- xCAT-UI/js/provision/images.js | 14 +- xCAT-UI/js/provision/provision.js | 4 +- xCAT-UI/js/service/service.js | 30 +- xCAT-UI/js/srv_xcatauth.js | 20 +- xCAT-UI/js/ui.js | 15 +- xCAT-UI/js/xcatauth.js | 31 +- xCAT-UI/lib/functions.php | 41 +- xCAT-UI/lib/srv_functions.php | 18 +- 24 files changed, 1616 insertions(+), 759 deletions(-) diff --git a/xCAT-UI/etc/apache2/conf.d/xcat-ui.conf b/xCAT-UI/etc/apache2/conf.d/xcat-ui.conf index 2d94d8887..11d5b3445 100644 --- a/xCAT-UI/etc/apache2/conf.d/xcat-ui.conf +++ b/xCAT-UI/etc/apache2/conf.d/xcat-ui.conf @@ -1,5 +1,12 @@ Alias /xcat "/opt/xcat/ui" PHPINIDir "/opt/xcat/ui" + +# Redirect all http request to https +RewriteEngine On +RewriteCond %{SERVER_PORT} 80 +RewriteCond %{HTTPS} !=on +RewriteRule ^/?xcat/(.*) https://%{SERVER_NAME}/xcat/$1 [R,L] + Options FollowSymLinks AllowOverride None diff --git a/xCAT-UI/js/configure/service.js b/xCAT-UI/js/configure/service.js index 352c01d14..515b86296 100644 --- a/xCAT-UI/js/configure/service.js +++ b/xCAT-UI/js/configure/service.js @@ -60,7 +60,7 @@ function loadServicePage(tabId) { title = 'z/VM'; // Get zVM host names - if (!$.cookie('zvms')){ + if (!$.cookie('xcat_zvms')){ $.ajax( { url : 'lib/cmd.php', dataType : 'json', diff --git a/xCAT-UI/js/configure/update.js b/xCAT-UI/js/configure/update.js index 1422f1023..65d339292 100644 --- a/xCAT-UI/js/configure/update.js +++ b/xCAT-UI/js/configure/update.js @@ -39,7 +39,7 @@ function loadUpdatePage() { /** * Show the RPM repository (it can use the user's last choice and input) - * + * * @param data Data returned from HTTP request */ function showRepository(data) { @@ -61,7 +61,7 @@ function showRepository(data) { // Display the Devel Repository, remember user's last selection show = show + "
  • "; @@ -70,7 +70,7 @@ function showRepository(data) { // Display the Stable Repository, remember user's last selection show = "
  • "; @@ -78,23 +78,23 @@ function showRepository(data) { repoList.append(show); // Display the Input Repository, remember user's last selection - if (($.cookie('xcatrepository')) && ($.cookie('xcatrepository') != 1) - && ($.cookie('xcatrepository') != 2)) { + if (($.cookie('xcat_repository')) && ($.cookie('xcat_repository') != 1) + && ($.cookie('xcat_repository') != 2)) { show = "
  • Other: "; show += ""; + + $.cookie('xcat_repository') + "'
  • "; } else { show = "
  • Other: "; show += ""; } repoList.append(show); - + $('#repository fieldset').append(repoList); } /** * Show all xCAT RPMs - * + * * @param data Data returned from HTTP request */ function showRpmInfo(data) { @@ -109,7 +109,7 @@ function showRpmInfo(data) { } rpms = data.rsp.split(/\n/); - + // No rpm installed, return if (1 > rpms.length) { $('#rpm fieldset').append("No RPMs installed!"); @@ -201,7 +201,7 @@ function updateRpm() { if (pattern.test(rpms)) { return true; } - + rpms = rpms + temp + ","; }); @@ -227,8 +227,9 @@ function updateRpm() { } // Remember users' choice and input - $.cookie('xcatrepository', rpmPathType, { + $.cookie('xcat_repository', rpmPathType, { path : '/xcat', + secure : true, expires : 10 }); @@ -255,7 +256,7 @@ function updateRpm() { /** * Show the results of the RPM update - * + * * @param data Data returned from HTTP request */ function showUpdateResult(data) { diff --git a/xCAT-UI/js/custom/blade.js b/xCAT-UI/js/custom/blade.js index bf722afc2..adbfefb66 100644 --- a/xCAT-UI/js/custom/blade.js +++ b/xCAT-UI/js/custom/blade.js @@ -14,14 +14,14 @@ var bladePlugin = function() { /** * Load node inventory - * + * * @param data Data from HTTP request */ bladePlugin.prototype.loadInventory = function(data) { var args = data.msg.split(','); var tabId = args[0].replace('out=', ''); var node = args[1].replace('node=', ''); - + // Get node inventory var inv = data.rsp; @@ -30,7 +30,7 @@ bladePlugin.prototype.loadInventory = function(data) { // Create division to hold inventory var invDiv = $('
    '); - + // Create a fieldset var fieldSet = $('
    '); var legend = $('Hardware'); @@ -58,7 +58,7 @@ bladePlugin.prototype.loadInventory = function(data) { /** * Load clone page - * + * * @param node Source node to clone */ bladePlugin.prototype.loadClonePage = function(node) { @@ -78,13 +78,13 @@ bladePlugin.prototype.loadClonePage = function(node) { // Add clone tab tab.add(newTabId, 'Clone', cloneForm, true); } - + tab.select(newTabId); }; /** * Load provision page - * + * * @param tabId The provision tab ID */ bladePlugin.prototype.loadProvisionPage = function(tabId) { @@ -142,14 +142,14 @@ bladePlugin.prototype.loadResources = function() { var tabId = 'bladeResourceTab'; // Remove loader $('#' + tabId).find('img').remove(); - + // Create info bar var infoBar = createInfoBar('Not yet supported'); // Create resource form var resrcForm = $('
    '); resrcForm.append(infoBar); - + $('#' + tabId).append(resrcForm); }; @@ -160,18 +160,18 @@ bladePlugin.prototype.addNode = function() { var addNodeForm = $('
    '); var info = createInfoBar('Add a BladeCenter node'); addNodeForm.append(info); - + var typeFS = $('
    '); var typeLegend = $('Type'); typeFS.append(typeLegend); addNodeForm.append(typeFS); - + var settingsFS = $('
    '); var nodeLegend = $('Settings'); settingsFS.append(nodeLegend); addNodeForm.append(settingsFS); - - typeFS.append('
    ' + + + typeFS.append('
    ' + '' + '' + '
    '); - + // Change dialog width $('#addBladeCenter').dialog('option', 'width', '400'); - + typeFS.find('#typeSelect').bind('change', function(){ // Remove any existing warnings $('#addBladeCenter .ui-state-error').remove(); settingsFS.find('div').remove(); - + // Change dialog width $('#addBladeCenter').dialog('option', 'width', '400'); - + var nodeType = $(this).val(); switch (nodeType) { case 'amm': @@ -208,17 +208,17 @@ bladePlugin.prototype.addNode = function() { break; case 'scan': settingsFS.append('
    '); - + // Change dialog width $('#addBladeCenter').dialog('option', 'width', '650'); break; } - + // Do not continue if node type is AMM if ($(this).val() == 'amm') { return; } - + // Gather AMM nodes settingsFS.find('select:eq(0)').after(createLoader()); $.ajax({ @@ -234,16 +234,16 @@ bladePlugin.prototype.addNode = function() { var position = 0; var tmp = ''; var options = ''; - + // Remove the loading image settingsFS.find('img').remove(); - + // Do not continue if no AMM nodes are found if (data.rsp.length < 1) { $('#addBladeCenter').prepend(createWarnBar('Please define an AMM node before continuing')); return; } - + // Create options for AMM nodes for (var i in data.rsp){ tmp = data.rsp[i]; @@ -257,7 +257,7 @@ bladePlugin.prototype.addNode = function() { if (data.msg != 'scan') { return; } - + // Create Scan button var scan = createButton('Scan'); scan.bind('click', function(){ @@ -273,10 +273,10 @@ bladePlugin.prototype.addNode = function() { args : '', msg : '' }, - + /** * Show scanned results for AMM - * + * * @param data Data returned from HTTP request */ success: function(data){ @@ -284,12 +284,12 @@ bladePlugin.prototype.addNode = function() { } }); }); - + settingsFS.find('select:eq(0)').after(scan); } }); }); - + // Create dialog for BladeCenter addNodeForm.dialog({ modal : true, @@ -306,7 +306,7 @@ bladePlugin.prototype.addNode = function() { // Remove any existing warnings $('#addBladeCenter .ui-state-error').remove(); var addMethod = $('#typeSelect').val(); - + if (addMethod == "amm") { addAmmNode(); } else if(addMethod == "blade") { @@ -320,7 +320,7 @@ bladePlugin.prototype.addNode = function() { } } }); - + addNodeForm.find('#typeSelect').trigger('change'); }; @@ -331,16 +331,16 @@ bladePlugin.prototype.addNode = function() { function addAmmNode(){ var args = ''; var errorMsg = ''; - + // Check for missing inputs $('#addBladeCenter input').each(function(){ if (!$(this).val()) { errorMsg = 'Please provide a value for each missing field!'; } - + args += $(this).val() + ','; }); - + // Do not continue if error was found if (errorMsg) { $('#addBladeCenter').prepend(createWarnBar(errorMsg)); @@ -348,7 +348,7 @@ function addAmmNode(){ } args = args.substring(0, args.length - 1); - + // Add the loader $('#addBladeCenter').append(createLoader()); $('.ui-dialog-buttonpane .ui-button').attr('disabled', true); @@ -385,17 +385,17 @@ function addBladeNode(){ var series = $('#bcSettings input[name="bladeSeries"]:selected').val(); var mpa = $('#bcSettings select[name="bladeMpa"]').val(); - var args = '-t;node;-o;' + name - + ';id=' + id - + ';nodetype=osi;groups=' + group - + ';mgt=blade;mpa=' + mpa + var args = '-t;node;-o;' + name + + ';id=' + id + + ';nodetype=osi;groups=' + group + + ';mgt=blade;mpa=' + mpa + ';serialflow=hard'; - + // Set the serial speed and port for LS series blade if (series != 'js') { args += ';serialspeed=19200;serialport=1'; } - + // Check for missing inputs if (!name || !group || !id || !mpa) { $('#addBladeCenter').prepend(createWarnBar("Please provide a value for each missing field!")); @@ -427,7 +427,7 @@ function addBladeNode(){ // Append response message to dialog $('#addBladeCenter').prepend(createInfoBar(rspMessage)); - + // Change dialog button $('#addBladeCenter').dialog("option", "buttons", { "Close" : function() { @@ -440,29 +440,29 @@ function addBladeNode(){ /** * Show rscan results - * + * * @param results Results from rscan of blade MPA */ function showScanAmmResult(results){ var rSection = $('
    '); - + // Create table to hold results var rTable = $('
    '); - + // Reset scan results area $('#addBladeCenter #scanResults').remove(); $('#bcSettings img').remove(); $('#bcSettings button').attr('disabled', ''); if (!results) return; - + // Do not continue if there are no results var rows = results.split("\n"); if (rows.length < 2){ $('#bcSettings').prepend(createWarnBar(rows[0])); return; } - + // Add the table header var fields = rows[0].match(/\S+/g); var column = fields.length; @@ -472,23 +472,23 @@ function showScanAmmResult(results){ row.append('' + fields[i] + ''); } rTable.append(row); - + // Add table body var line; for (var i = 1; i < rows.length; i++) { line = rows[i]; - + if (!line) continue; - + var fields = line.match(/\S+/g); if (fields[0] == 'mm') continue; - + // Create a row for each result var row = $(''); row.append(''); - + // Add column for each field for (var j = 0; j < column; j++){ if (fields[j]) { @@ -501,11 +501,11 @@ function showScanAmmResult(results){ row.append(''); } } - + // Append row to table rTable.append(row); } - + rSection.append(rTable); $('#bcSettings').prepend(rSection); } @@ -517,25 +517,25 @@ function addMmScanNode(){ // Get the AMM name var ammName = $('#bcSettings select').val(); var nodeName = ''; - + $('#bcSettings :checked').each(function() { if ($(this).attr('name')) { nodeName += $(this).attr('name') + ','; nodeName += $(this).parents('tr').find('input').eq(1).val() + ','; } }); - + if (!nodeName) { $('#addBladeCenter').prepend(createWarnBar('Please select a node!')); return; } - + // Disabled button $('.ui-dialog-buttonpane button').attr('disabled', 'disabled'); - + nodeName = nodeName.substr(0, nodeName.length - 1); $('#nodeAttrs').append(createLoader()); - + // Send add request $.ajax({ url : 'lib/cmd.php', @@ -554,7 +554,7 @@ function addMmScanNode(){ /** * Create provision existing node division - * + * * @param inst Provision tab instance * @return Provision existing node division */ @@ -566,22 +566,22 @@ function createBladeProvisionExisting(inst) { var nodeFS = $('
    '); var nodeLegend = $('Node'); nodeFS.append(nodeLegend); - + var nodeAttr = $('
    '); nodeFS.append($('
    ')); nodeFS.append(nodeAttr); - + // Create image fieldset var imgFS = $('
    '); var imgLegend = $('Image'); imgFS.append(imgLegend); - + var imgAttr = $('
    '); imgFS.append($('
    ')); imgFS.append(imgAttr); - + provExisting.append(nodeFS, imgFS); - + // Create group input var group = $('
    '); var groupLabel = $(''); @@ -589,7 +589,7 @@ function createBladeProvisionExisting(inst) { // Turn on auto complete for group var dTableDivId = 'bladeNodesDatatableDIV' + inst; // Division ID where nodes datatable will be appended - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Split group names into an array var tmp = groupNames.split(','); @@ -642,13 +642,13 @@ function createBladeProvisionExisting(inst) { method.append(methodLabel); method.append(methodSelect); imgAttr.append(method); - + // Create operating system input var os = $('
    '); var osLabel = $(''); var osInput = $(''); osInput.one('focus', function() { - var tmp = $.cookie('osvers'); + var tmp = $.cookie('xcat_osvers'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -665,7 +665,7 @@ function createBladeProvisionExisting(inst) { var archLabel = $(''); var archInput = $(''); archInput.one('focus', function() { - var tmp = $.cookie('osarchs'); + var tmp = $.cookie('xcat_osarchs'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -682,7 +682,7 @@ function createBladeProvisionExisting(inst) { var profileLabel = $(''); var profileInput = $(''); profileInput.one('focus', function() { - var tmp = $.cookie('profiles'); + var tmp = $.cookie('xcat_profiles'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -706,7 +706,7 @@ function createBladeProvisionExisting(inst) { // Get provision tab ID var thisTabId = 'bladeProvisionTab' + inst; - + // Get nodes that were checked var dTableId = 'bladeNodesDatatable' + inst; var tgts = getNodesChecked(dTableId); @@ -714,7 +714,7 @@ function createBladeProvisionExisting(inst) { errorMessage += 'You need to select a node. '; ready = false; } - + // Check booth method var boot = $('#' + thisTabId + ' select[name=bootMethod]'); if (!boot.val()) { @@ -724,7 +724,7 @@ function createBladeProvisionExisting(inst) { } else { boot.css('border', 'solid #BDBDBD 1px'); } - + // Check operating system image var os = $('#' + thisTabId + ' input[name=os]'); if (!os.val()) { @@ -734,7 +734,7 @@ function createBladeProvisionExisting(inst) { } else { os.css('border', 'solid #BDBDBD 1px'); } - + // Check architecture var arch = $('#' + thisTabId + ' input[name=arch]'); if (!arch.val()) { @@ -744,7 +744,7 @@ function createBladeProvisionExisting(inst) { } else { arch.css('border', 'solid #BDBDBD 1px'); } - + // Check profile var profile = $('#' + thisTabId + ' input[name=profile]'); if (!profile.val()) { @@ -754,12 +754,12 @@ function createBladeProvisionExisting(inst) { } else { profile.css('border', 'solid #BDBDBD 1px'); } - + // If all inputs are valid, ready to provision - if (ready) { + if (ready) { // Disable provision button $(this).attr('disabled', 'true'); - + // Prepend status bar var statBar = createStatusBar('bladeProvisionStatBar' + inst); statBar.append(createLoader('')); @@ -768,11 +768,11 @@ function createBladeProvisionExisting(inst) { // Disable all inputs var inputs = $('#' + thisTabId + ' input'); inputs.attr('disabled', 'disabled'); - + // Disable all selects var selects = $('#' + thisTabId + ' select'); selects.attr('disabled', 'disabled'); - + /** * (1) Set operating system */ @@ -801,7 +801,7 @@ function createBladeProvisionExisting(inst) { /** * Update the provision existing node status - * + * * @param data Data returned from HTTP request */ function updateBladeProvisionExistingStatus(data) { @@ -813,11 +813,11 @@ function updateBladeProvisionExistingStatus(data) { var cmd = args[0].replace('cmd=', ''); // Get provision tab instance var inst = args[1].replace('out=', ''); - + // Get provision tab and status bar ID var statBarId = 'bladeProvisionStatBar' + inst; var tabId = 'bladeProvisionTab' + inst; - + /** * (2) Remote install */ @@ -830,11 +830,11 @@ function updateBladeProvisionExistingStatus(data) { var os = $('#' + tabId + ' input[name="os"]').val(); var profile = $('#' + tabId + ' input[name="profile"]').val(); var arch = $('#' + tabId + ' input[name="arch"]').val(); - + // Get nodes that were checked var dTableId = 'bladeNodesDatatable' + inst; var tgts = getNodesChecked(dTableId); - + // Begin installation $.ajax( { url : 'lib/cmd.php', @@ -848,19 +848,19 @@ function updateBladeProvisionExistingStatus(data) { success : updateBladeProvisionExistingStatus }); - } - + } + /** * (3) Prepare node for boot */ if (cmd == 'nodeadd') { // Get provision method var bootMethod = $('#' + tabId + ' select[name=bootMethod]').val(); - + // Get nodes that were checked var dTableId = 'bladeNodesDatatable' + inst; var tgts = getNodesChecked(dTableId); - + // Prepare node for boot $.ajax( { url : 'lib/cmd.php', @@ -875,18 +875,18 @@ function updateBladeProvisionExistingStatus(data) { success : updateBladeProvisionExistingStatus }); } - + /** * (4) Power on node */ if (cmd == 'nodeset') { - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); - + // Get nodes that were checked var dTableId = 'bladeNodesDatatable' + inst; var tgts = getNodesChecked(dTableId); - + // Prepare node for boot $.ajax( { url : 'lib/cmd.php', @@ -901,16 +901,16 @@ function updateBladeProvisionExistingStatus(data) { success : updateBladeProvisionExistingStatus }); } - + /** * (5) Done */ else if (cmd == 'rpower') { // Write ajax response to status bar - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); $('#' + statBarId).find('img').remove(); - + // If installation was successful if (prg.html().indexOf('Error') == -1) { $('#' + statBarId).find('div').append('
    It will take several minutes before the nodes are up and ready. Use rcons to monitor the status of the install.
    '); diff --git a/xCAT-UI/js/custom/customUtils.js b/xCAT-UI/js/custom/customUtils.js index 51ab0498b..56b10854c 100644 --- a/xCAT-UI/js/custom/customUtils.js +++ b/xCAT-UI/js/custom/customUtils.js @@ -1,6 +1,6 @@ /** * Create nodes datatable for a given group - * + * * @param group Group name * @param outId Division ID to append datatable * @return Nodes datatable @@ -19,26 +19,26 @@ function createNodesDatatable(group, outId) { /** * Create nodes datatable - * + * * @param data Data returned from HTTP request */ success : function(data) { // Data returned var rsp = data.rsp; - + // Get output ID var outId = data.msg; // Get datatable ID var dTableId = outId.replace('DIV', ''); - + // Node attributes hash var attrs = new Object(); // Node attributes var headers = new Object(); - + // Clear nodes datatable division $('#' + outId).empty(); - + // Create nodes datatable var node = null; var args; @@ -48,22 +48,22 @@ function createNodesDatatable(group, outId) { if (pos > -1) { var temp = rsp[i].split(': '); node = jQuery.trim(temp[1]); - + // Create a hash for the node attributes attrs[node] = new Object(); i++; } - + // Get key and value args = rsp[i].split('='); var key = jQuery.trim(args[0]); var val = jQuery.trim(args[1]); - + // Create hash table attrs[node][key] = val; headers[key] = 1; } - + // Sort headers var sorted = new Array(); for ( var key in headers) { @@ -73,14 +73,14 @@ function createNodesDatatable(group, outId) { } } sorted.sort(); - + // Add column for check box and node sorted.unshift('', 'node'); - + // Create nodes datatable var dTable = new DataTable(dTableId); dTable.init(sorted); - + // Go through each node for ( var node in attrs) { // Create a row @@ -88,7 +88,7 @@ function createNodesDatatable(group, outId) { // Create a check box var checkBx = ''; row.push(checkBx, node); - + // Go through each header for ( var i = 2; i < sorted.length; i++) { // Add node attributes to the row @@ -100,11 +100,11 @@ function createNodesDatatable(group, outId) { row.push(''); } } - + // Add row to table dTable.add(row); } - + $('#' + outId).append(dTable.object()); $('#' + dTableId).dataTable({ 'iDisplayLength': 50, @@ -120,7 +120,7 @@ function createNodesDatatable(group, outId) { } } }); - + // Fix table styling $('#' + dTableId + '_wrapper .dataTables_filter label').css('width', '250px'); } // End of function(data) @@ -129,7 +129,7 @@ function createNodesDatatable(group, outId) { /** * Create provision existing node division - * + * * @param plugin Plugin name to create division for * @param inst Provision tab instance * @return Provision existing node division @@ -145,7 +145,7 @@ function createProvisionExisting(plugin, inst) { // Turn on auto complete for group var dTableDivId = plugin + 'NodesDatatableDIV' + inst; // Division ID where nodes datatable will be appended - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Split group names into an array var tmp = groupNames.split(','); @@ -215,7 +215,7 @@ function createProvisionExisting(plugin, inst) { var osLabel = $(''); var osInput = $(''); osInput.one('focus', function() { - var tmp = $.cookie('osvers'); + var tmp = $.cookie('xcat_osvers'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -232,7 +232,7 @@ function createProvisionExisting(plugin, inst) { var archLabel = $(''); var archInput = $(''); archInput.one('focus', function() { - var tmp = $.cookie('osarchs'); + var tmp = $.cookie('xcat_osarchs'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -249,7 +249,7 @@ function createProvisionExisting(plugin, inst) { var profileLabel = $(''); var profileInput = $(''); profileInput.one('focus', function() { - var tmp = $.cookie('profiles'); + var tmp = $.cookie('xcat_profiles'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -276,7 +276,7 @@ function createProvisionExisting(plugin, inst) { /** * Create provision new node division - * + * * @param inst Provision tab instance * @return Provision new node division */ @@ -293,7 +293,7 @@ function createProvisionNew(plugin, inst) { var groupLabel = $(''); var groupInput = $(''); groupInput.one('focus', function() { - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Turn on auto complete $(this).autocomplete({ @@ -336,7 +336,7 @@ function createProvisionNew(plugin, inst) { var osLabel = $(''); var osInput = $(''); osInput.one('focus', function() { - var tmp = $.cookie('osvers'); + var tmp = $.cookie('xcat_osvers'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -353,7 +353,7 @@ function createProvisionNew(plugin, inst) { var archLabel = $(''); var archInput = $(''); archInput.one('focus', function() { - var tmp = $.cookie('osarchs'); + var tmp = $.cookie('xcat_osarchs'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -370,7 +370,7 @@ function createProvisionNew(plugin, inst) { var profileLabel = $(''); var profileInput = $(''); profileInput.one('focus', function() { - var tmp = $.cookie('profiles'); + var tmp = $.cookie('xcat_profiles'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -397,31 +397,31 @@ function createProvisionNew(plugin, inst) { /** * Create section to provision node - * + * * @param plugin Plugin name * @param container Container to hold provision section */ function appendProvisionSection(plugin, container) { // Get provision tab ID var tabId = container.parents('.tab').attr('id'); - - if (plugin == 'quick') + + if (plugin == 'quick') appendProvision4Url(container); // For provisioning based on argmunents found in URL else appendProvision4NoUrl(plugin, container); - + // Add provision button var provisionBtn = createButton('Provision'); provisionBtn.bind('click', function(){ provisionNode(tabId); }); container.append(provisionBtn); - + // Bind image select to change event container.find('select[name=image]').bind('change', function() { createAdvancedOptions($(this).val(), tabId); }); - + $.ajax({ url : 'lib/cmd.php', dataType : 'json', @@ -441,15 +441,15 @@ function appendProvisionSection(plugin, container) { $('#' + tabId).prepend(createWarnBar('Please run copycds and genimage in provision page before continuing!')); return; } - + for (i in data.rsp) { imageName = data.rsp[i]; position = imageName.indexOf(' '); imageName = imageName.substr(0, position); - + $('#' + tabId + ' select[name=image]').append($('')); } - + // Trigger select change event $('#' + tabId + ' select[name=image]').trigger('change'); // Show provision button @@ -460,102 +460,102 @@ function appendProvisionSection(plugin, container) { /** * Create provision node section using URL - * + * * @param container Container to hold provision section * @returns Nothing */ -function appendProvision4Url(container){ +function appendProvision4Url(container){ // Create node fieldset var nodeFS = $('
    '); var nodeLegend = $('Node'); nodeFS.append(nodeLegend); container.append(nodeFS); - + var nodeAttr = $('
    '); nodeFS.append($('
    ')); nodeFS.append(nodeAttr); - + // Create image fieldset var imgFS = $('
    '); var imgLegend = $('Image'); imgFS.append(imgLegend); container.append(imgFS); - + var imgAttr = $('
    '); imgFS.append($('
    ')); imgFS.append(imgAttr); - + var query = window.location.search; var args = query.substr(1).split('&'); var parms = new Object(); var tmp; - + // Turn URL arguments into hash array for (var i = 0; i < args.length; i++) { tmp = args[i].split('='); parms[tmp[0]] = tmp[1]; } - + var master = ''; if (parms['master']) master = parms['master']; - + var nfsserver = ''; if (parms['nfsserver']) nfsserver = parms['nfsserver']; - + var tftpserver = ''; if (parms['tftpserver']) tftpserver = parms['tftpserver']; - + nodeAttr.append('
    '); - + imgAttr.append('
    '); imgAttr.append('
    '); imgAttr.append( '
    '); - imgAttr.append('
    '); + imgAttr.append('
    '); imgAttr.append('
    '); imgAttr.append('
    '); imgAttr.append('
    '); - + return; } /** * Create section to provision node using no URL - * + * * @param plugin Create provision section for given plugin * @param container Container to hold provision section */ function appendProvision4NoUrl(plugin, container){ // Get provision tab ID var tabId = container.parents('.tab').attr('id'); - + // Create node fieldset var nodeFS = $('
    '); var nodeLegend = $('Node'); nodeFS.append(nodeLegend); container.append(nodeFS); - + var nodeAttr = $('
    '); nodeFS.append($('
    ')); nodeFS.append(nodeAttr); - + // Create image fieldset var imgFS = $('
    '); var imgLegend = $('Image'); imgFS.append(imgLegend); container.append(imgFS); - + var imgAttr = $('
    '); imgFS.append($('
    ')); imgFS.append(imgAttr); - + // Select group name var group = $('
    ').append(''); var groupSelect = $(''); group.append(groupSelect); - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { var tmp = groupNames.split(','); groupSelect.append(''); // Append empty group name @@ -569,14 +569,14 @@ function appendProvision4NoUrl(plugin, container){ var nodesTable = $('

    Select a group to view its nodes

    '); nodes.append(nodesTable); nodeAttr.append(nodes); - + // Select architecture - var arch = $('
    ').append(''); - var archName = $.cookie('osarchs'); + var arch = $('
    ').append(''); + var archName = $.cookie('xcat_osarchs'); if (archName) { var archSelect = $(''); arch.append(archSelect); - + var tmp = archName.split(','); for (var i in tmp) archSelect.append(''); @@ -591,30 +591,30 @@ function appendProvision4NoUrl(plugin, container){ imgAttr.append('
    '); imgAttr.append('
    '); imgAttr.append('
    '); - + // When a group is selected, show the nodes belonging to that group groupSelect.bind('change', function() { var nodesTableId = '#' + tabId + ' #nodesTable'; $(nodesTableId).append(createLoader()); createNodesTable($(this).val(), nodesTableId); }); - + return; } /** * Provision node - * + * * @param tabId Provision tab ID */ function provisionNode(tabId) { var errorMessage = ""; var args = new Array(); var node = ""; - + // Delete any existing warnings $('#' + tabId + ' .ui-state-error').remove(); - + // Go through each input $('#' + tabId + ' input[type!="checkbox"]').each(function() { if (!$(this).val()) { @@ -624,13 +624,13 @@ function provisionNode(tabId) { args.push($(this).val()); } }); - + // Do not continue if error was found if (errorMessage) { $('#' + tabId).prepend(createWarnBar(errorMessage)); return; } - + // If jumped from nodes page, get node name if (tabId == 'quick') { node = args.shift(); @@ -639,25 +639,25 @@ function provisionNode(tabId) { args.unshift($('#' + tabId + ' input[name=arch]').val()); node = getCheckedByObj($('#' + tabId + ' #nodesTable')); } - + // Do not continue if a node is not given if (!node) { $('#' + tabId).prepend(createWarnBar('Please select a node!')); return; } - + var software = getCheckedByObj($('#' + tabId + ' #advanced')); var imageName = $('#' + tabId + ' select[name=image]').val(); var provision = args.join(','); - - var url = 'lib/cmd.php?cmd=webrun&tgt=&args=provision;' + + + var url = 'lib/cmd.php?cmd=webrun&tgt=&args=provision;' + node + ';' + imageName + ';' + provision + ';' + software + '&msg=&opts=flush'; $('#' + tabId).prepend(createIFrame(url)); } /** * Create advance option - * + * * @param image Image name * @param outId Output area ID */ @@ -678,29 +678,29 @@ function createAdvancedOptions(image, outId) { var provMethod = ''; var tmpStr = ''; var position = 0; - + for (var i = 0; i < data.rsp.length; i++) { tmpStr = data.rsp[i]; if (tmpStr.indexOf('osname') != -1) { position = tmpStr.indexOf('='); osName = tmpStr.substr(position + 1); } - + if (tmpStr.indexOf('provmethod') != -1) { position = tmpStr.indexOf('='); provMethod = tmpStr.substr(position + 1); } } - + $('#' + outId + ' #advanced').remove(); if (osName.toLowerCase() == 'aix') return; - + if (provMethod == 'install') { // Create advanced fieldset var advancedFS = $('
    ').append($('Advanced')); $('#' + outId + ' div.form fieldset:eq(1)').after(advancedFS); - + advancedFS.append('
    Install Ganglia monitoring
    '); } } @@ -709,11 +709,11 @@ function createAdvancedOptions(image, outId) { /** * Create nodes table - * + * * @param group Group name * @param outId Output section ID */ -function createNodesTable(group, outId) { +function createNodesTable(group, outId) { // Get group nodes $.ajax({ url : 'lib/cmd.php', @@ -728,26 +728,26 @@ function createNodesTable(group, outId) { success : function(data) { var outId = $(data.msg); var nodes = data.rsp; - + // Create table to hold nodes var nTable = $('
    '); var tHead = $(' Node '); nTable.append(tHead); var tBody = $(''); nTable.append(tBody); - + for (var i in nodes) { var node = nodes[i][0]; - + // Go to next node if there is nothing here if (!node) continue; // Insert node into table tBody.append('' + node + ''); } - + outId.empty().append(nTable); - + if (nodes.length > 10) outId.css('height', '300px'); else @@ -758,13 +758,13 @@ function createNodesTable(group, outId) { /** * Get select element names - * + * * @param obj Object to get selected element names * @return Nodes name seperate by a comma */ function getCheckedByObj(obj) { var str = ''; - + // Get nodes that were checked obj.find('input:checked').each(function() { if ($(this).attr('name')) { @@ -781,7 +781,7 @@ function getCheckedByObj(obj) { /** * Select all checkboxes in the table - * + * * @param event Event on element * @param obj Object triggering event */ diff --git a/xCAT-UI/js/custom/esx.js b/xCAT-UI/js/custom/esx.js index 901e8f95a..c20b05c3c 100644 --- a/xCAT-UI/js/custom/esx.js +++ b/xCAT-UI/js/custom/esx.js @@ -7,7 +7,7 @@ $(document).ready(function() { /** * Constructor - * + * * @return Nothing */ var esxPlugin = function() { @@ -17,9 +17,9 @@ var esxPlugin = function() { /** * Configure self-service page */ -esxPlugin.prototype.loadConfigPage = function(tabId) { +esxPlugin.prototype.loadConfigPage = function(tabId) { var configAccordion = $('
    '); - + // Create accordion panel for profiles var profileSection = $('
    '); var profileLnk = $('

    Profiles

    ').click(function () { @@ -34,11 +34,11 @@ esxPlugin.prototype.loadConfigPage = function(tabId) { // Add info bar $('#esxConfigProfile').append(createInfoBar('Not yet supported')); - + // Resize accordion configAccordion.accordion('resize'); }); - + // Create accordion panel for images var imgSection = $('
    '); var imgLnk = $('

    Images

    ').click(function () { @@ -50,7 +50,7 @@ esxPlugin.prototype.loadConfigPage = function(tabId) { queryImages('esxConfigImages'); }); - + // Create accordion panel for groups var groupsSection = $('
    '); var groupsLnk = $('

    Groups

    ').click(function () { @@ -62,17 +62,17 @@ esxPlugin.prototype.loadConfigPage = function(tabId) { queryGroups('esxConfigGroups'); }); - + configAccordion.append(profileLnk, profileSection, imgLnk, imgSection, groupsLnk, groupsSection); $('#' + tabId).append(configAccordion); configAccordion.accordion(); - + profileLnk.trigger('click'); }; /** * Migrate node - * + * * @param node Node to migrate */ esxPlugin.prototype.loadMigratePage = function(node) { @@ -81,7 +81,7 @@ esxPlugin.prototype.loadMigratePage = function(node) { /** * Clone node (service page) - * + * * @param node Node to clone */ esxPlugin.prototype.serviceClone = function(node) { @@ -90,7 +90,7 @@ esxPlugin.prototype.serviceClone = function(node) { /** * Load provision page (service page) - * + * * @param tabId * Tab ID where page will reside * @return Nothing @@ -101,23 +101,23 @@ esxPlugin.prototype.loadServiceProvisionPage = function(tabId) { /** * Show node inventory (service page) - * + * * @param data Data from HTTP request */ esxPlugin.prototype.loadServiceInventory = function(data) { - + }; /** * Load node inventory - * + * * @param data Data from HTTP request */ esxPlugin.prototype.loadInventory = function(data) { var args = data.msg.split(','); var tabId = args[0].replace('out=', ''); var node = args[1].replace('node=', ''); - + // Get node inventory var inv = data.rsp; @@ -127,12 +127,12 @@ esxPlugin.prototype.loadInventory = function(data) { // Create division to hold inventory var invDivId = tabId + 'Inventory'; var invDiv = $('
    '); - + // Create a fieldset var fieldSet = $('
    '); var legend = $('Hardware'); fieldSet.append(legend); - + var oList = $('
      '); fieldSet.append(oList); invDiv.append(fieldSet); @@ -156,7 +156,7 @@ esxPlugin.prototype.loadInventory = function(data) { /** * Load clone page - * + * * @param node Source node to clone */ esxPlugin.prototype.loadClonePage = function(node) { @@ -176,13 +176,13 @@ esxPlugin.prototype.loadClonePage = function(node) { // Add clone tab tab.add(newTabId, 'Clone', cloneForm, true); } - + tab.select(newTabId); }; /** * Load provision page - * + * * @param tabId The provision tab ID */ esxPlugin.prototype.loadProvisionPage = function(tabId) { @@ -223,36 +223,36 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { // Append to provision tab $('#' + tabId).append(provForm); - + // Create VM fieldset var vmFS = $('
      '); var vmLegend = $('Virtual Machine'); vmFS.append(vmLegend); - + var vmAttr = $('
      '); vmFS.append($('
      ')); vmFS.append(vmAttr); - + // Create hardware fieldset var hwFS = $('
      '); var hwLegend = $('Hardware'); hwFS.append(hwLegend); - + var hwAttr = $('
      '); hwFS.append($('
      ')); hwFS.append(hwAttr); - + // Create image fieldset var imgFS = $('
      '); var imgLegend = $('Image'); imgFS.append(imgLegend); - + var imgAttr = $('
      '); imgFS.append($('
      ')); imgFS.append(imgAttr); - + provForm.append(vmFS, hwFS, imgFS); - + // Create hypervisor input var host = $('
      '); var hostLabel = $(''); @@ -260,14 +260,14 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { var hostInput = $(''); host.append(hostInput); vmAttr.append(host); - + // Create group input var group = $('
      '); var groupLabel = $(''); group.append(groupLabel); // Turn on auto complete for group - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Split group names into an array var tmp = groupNames.split(','); @@ -303,7 +303,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { memory.append(memoryLabel); memory.append(memoryInput); hwAttr.append(memory); - + // Create processor dropdown var cpu = $('
      '); var cpuLabel = $(''); @@ -320,7 +320,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { cpu.append(cpuLabel); cpu.append(cpuSelect); hwAttr.append(cpu); - + // Create NIC dropdown var nic = $('
      '); var nicLabel = $(''); @@ -328,7 +328,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { nic.append(nicLabel); nic.append(nicInput); hwAttr.append(nic); - + // Create disk input var disk = $('
      '); var diskLabel = $(''); @@ -339,7 +339,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { ); disk.append(diskLabel, diskInput, diskSizeSelect); hwAttr.append(disk); - + // Create disk storage input var storage = $('
      '); var storageLabel = $(''); @@ -347,13 +347,13 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { storage.append(storageLabel); storage.append(storageInput); hwAttr.append(storage); - + // Create operating system input var os = $('
      '); var osLabel = $(''); var osInput = $(''); osInput.one('focus', function() { - var tmp = $.cookie('osvers'); + var tmp = $.cookie('xcat_osvers'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -364,13 +364,13 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { os.append(osLabel); os.append(osInput); imgAttr.append(os); - + // Create architecture input var arch = $('
      '); var archLabel = $(''); var archInput = $(''); archInput.one('focus', function() { - var tmp = $.cookie('osarchs'); + var tmp = $.cookie('xcat_osarchs'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -381,13 +381,13 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { arch.append(archLabel); arch.append(archInput); imgAttr.append(arch); - + // Create profile input var profile = $('
      '); var profileLabel = $(''); var profileInput = $(''); profileInput.one('focus', function() { - var tmp = $.cookie('profiles'); + var tmp = $.cookie('xcat_profiles'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -398,7 +398,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { profile.append(profileLabel); profile.append(profileInput); imgAttr.append(profile); - + // Create boot method dropdown var method = $('
      '); var methodLabel = $(''); @@ -422,10 +422,10 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { // Remove any warning messages $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); var ready = true; - + // Get tab ID var tabId = $(this).parents('.ui-tabs-panel').attr('id'); - + // Check if fields are properly filled in var inputs = $('#' + tabId + ' input:visible'); for ( var i = 0; i < inputs.length; i++) { @@ -436,7 +436,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { inputs.eq(i).css('border', 'solid #BDBDBD 1px'); } } - + var selects = $('#' + tabId + ' select:visible'); for ( var i = 0; i < selects.length; i++) { if (!selects.eq(i).val()) { @@ -446,30 +446,30 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { selects.eq(i).css('border', 'solid #BDBDBD 1px'); } } - + if (ready) { var inst = tabId.replace('kvmProvisionTab', ''); - + // Prepend status bar var statBar = createStatusBar('kvmProvisionStatBar' + inst); statBar.append(createLoader('')); statBar.prependTo($('#' + tabId)); - + var host = $('#' + tabId + ' input[name=host]').val(); var group = $('#' + tabId + ' select[name=group]').val(); var node = $('#' + tabId + ' input[name=node]').val(); - + var memory = $('#' + tabId + ' input[name=memory]').val(); var cpu = $('#' + tabId + ' select[name=cpu]').val(); var nic = $('#' + tabId + ' input[name=nic]').val(); var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val(); var storage = $('#' + tabId + ' input[name=storage]').val(); - + var os = $('#' + tabId + ' input[name=os]').val(); var arch = $('#' + tabId + ' input[name=arch]').val(); var profile = $('#' + tabId + ' input[name=profile]').val(); var boot = $('#' + tabId + ' select[name=bootMethod]').val(); - + /** * (1) Define node */ @@ -517,14 +517,14 @@ esxPlugin.prototype.loadResources = function() { var tabId = 'esxResourceTab'; // Remove loader $('#' + tabId).find('img').remove(); - + // Create info bar var infoBar = createInfoBar('Not yet supported'); // Create resource form var resrcForm = $('
      '); resrcForm.append(infoBar); - + $('#' + tabId).append(resrcForm); }; @@ -535,13 +535,13 @@ esxPlugin.prototype.addNode = function() { var dialog = $('
      '); var info = createInfoBar('Add a ESX node'); dialog.append(info); - + // Create node inputs dialog.append($('
      ')); dialog.append($('
      ')); dialog.append($('
      ')); dialog.append($('
      ')); - + dialog.dialog({ title: 'Add node', modal: true, @@ -560,13 +560,13 @@ esxPlugin.prototype.addNode = function() { function addEsxNode(){ var attr, args; var errorMessage = ''; - + // Remove existing warnings $('#addEsx .ui-state-error').remove(); - + // Return input border colors to normal $('#addEsx input').css('border', 'solid #BDBDBD 1px'); - + // Check node attributes $('#addEsx input').each(function(){ attr = $(this).val(); @@ -575,28 +575,28 @@ function addEsxNode(){ $(this).css('border', 'solid #FF0000 1px'); } }); - + // Show error message (if any) if (errorMessage) { $('#addEsx').prepend(createWarnBar(errorMessage)); return; } - + // Create loader $('#addEsx').append(createLoader()); - + // Change dialog buttons $('#addEsx').dialog('option', 'buttons', { 'Close':function() { $('#addEsx').dialog('destroy').remove(); } }); - + // Generate chdef arguments args = '-t;node;-o;' + $('#addEsx input[name="node"]').val() + ';ip=' + $('#addEsx input[name="ip"]').val() - + ';groups=' + $('#addEsx input[name="groups"]').val() - + ';vmhost=' + $('#addEsx input[name="vmhost"]').val() + + ';groups=' + $('#addEsx input[name="groups"]').val() + + ';vmhost=' + $('#addEsx input[name="vmhost"]').val() + ';mgt=esx;netboot=xnba;nodetype=osi;profile=compute'; $.ajax({ url : 'lib/cmd.php', @@ -619,16 +619,16 @@ function addEsxNode(){ msg : '' } }); - + // Remove loader $('#addEsx img').remove(); - + // Get return message var message = ''; for (var i in data.rsp) { message += data.rsp[i] + '
      '; } - + // Show return message if (message) $('#addEsx').prepend(createInfoBar(message)); @@ -638,7 +638,7 @@ function addEsxNode(){ /** * Update the provision node status - * + * * @param data Data returned from HTTP request */ function updateESXProvisionStatus(data) { @@ -650,24 +650,24 @@ function updateESXProvisionStatus(data) { var cmd = args[0].replace('cmd=', ''); // Get provision tab instance var inst = args[1].replace('out=', ''); - + // Get provision tab and status bar ID var statBarId = 'kvmProvisionStatBar' + inst; var tabId = 'kvmProvisionTab' + inst; - + var node = $('#' + tabId + ' input[name=node]').val(); - + /** * (2) Create virtual machine */ if (cmd == 'chdef') { // Write ajax response to status bar - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); // Get parameters var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val(); - + // Begin installation $.ajax( { url : 'lib/cmd.php', @@ -681,19 +681,19 @@ function updateESXProvisionStatus(data) { success : updateESXProvisionStatus }); - } - + } + /** * (3) Prepare node for boot */ if (cmd == 'mkvm') { // Write ajax response to status bar - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); - + // Get provision method var boot = $('#' + tabId + ' select[name=bootMethod]').val(); - + // Prepare node for boot $.ajax( { url : 'lib/cmd.php', @@ -708,14 +708,14 @@ function updateESXProvisionStatus(data) { success : updateESXProvisionStatus }); } - + /** * (4) Power on node */ if (cmd == 'nodeset') { - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); - + // Prepare node for boot $.ajax( { url : 'lib/cmd.php', @@ -730,16 +730,16 @@ function updateESXProvisionStatus(data) { success : updateESXProvisionStatus }); } - + /** * (5) Done */ else if (cmd == 'rpower') { // Write ajax response to status bar - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); $('#' + statBarId).find('img').remove(); - + // If installation was successful if (prg.html().indexOf('Error') == -1) { $('#' + statBarId).find('div').append('
      It will take several minutes before the nodes are up and ready. Use rcons to monitor the status of the install.
      '); diff --git a/xCAT-UI/js/custom/ipmi.js b/xCAT-UI/js/custom/ipmi.js index 839d94d60..8adf1c915 100644 --- a/xCAT-UI/js/custom/ipmi.js +++ b/xCAT-UI/js/custom/ipmi.js @@ -14,7 +14,7 @@ var ipmiPlugin = function() { /** * Steps for hardware discovery wizard - * + * * @return Discovery steps */ ipmiPlugin.prototype.getStep = function() { @@ -37,7 +37,7 @@ ipmiPlugin.prototype.getNextFunction = function() { /** * Load node inventory - * + * * @param data Data from HTTP request */ ipmiPlugin.prototype.loadInventory = function(data) { @@ -82,7 +82,7 @@ ipmiPlugin.prototype.loadInventory = function(data) { /** * Load clone page - * + * * @param node Source node to clone */ ipmiPlugin.prototype.loadClonePage = function(node) { @@ -108,7 +108,7 @@ ipmiPlugin.prototype.loadClonePage = function(node) { /** * Load provision page - * + * * @param tabId The provision tab ID */ ipmiPlugin.prototype.loadProvisionPage = function(tabId) { @@ -297,7 +297,7 @@ function addIdataplex() { /** * Create provision existing node division - * + * * @param inst Provision tab instance * @return Provision existing node division */ @@ -336,7 +336,7 @@ function createIpmiProvisionExisting(inst) { var dTableDivId = 'ipmiNodesDatatableDIV' + inst; // Division ID where // nodes datatable will // be appended - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Split group names into an array var tmp = groupNames.split(','); @@ -397,7 +397,7 @@ function createIpmiProvisionExisting(inst) { var osLabel = $(''); var osInput = $(''); osInput.one('focus', function() { - var tmp = $.cookie('osvers'); + var tmp = $.cookie('xcat_osvers'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -414,7 +414,7 @@ function createIpmiProvisionExisting(inst) { var archLabel = $(''); var archInput = $(''); archInput.one('focus', function() { - var tmp = $.cookie('osarchs'); + var tmp = $.cookie('xcat_osarchs'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -431,7 +431,7 @@ function createIpmiProvisionExisting(inst) { var profileLabel = $(''); var profileInput = $(''); profileInput.one('focus', function() { - var tmp = $.cookie('profiles'); + var tmp = $.cookie('xcat_profiles'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -553,7 +553,7 @@ function createIpmiProvisionExisting(inst) { /** * Update the provision existing node status - * + * * @param data Data returned from HTTP request */ function updateIpmiProvisionExistingStatus(data) { @@ -645,17 +645,17 @@ function idataplexInitBasic() { } showString += 'Start IP:'; - + showString += 'Nodes number
      per Frame:'; - + showString += '

      BMCs:

      '; showString += 'Name Range:'; - + if (getDiscoverEnv('idataplexbmcip')) { tempip = getDiscoverEnv('idataplexbmcip'); } else { @@ -663,12 +663,12 @@ function idataplexInitBasic() { } showString += 'Start IP:'; - + showString += '

      Switches:

      '; showString += 'Name Range:'; - + if (getDiscoverEnv('idataplexswitchip')) { tempip = getDiscoverEnv('idataplexswitchip'); } else { @@ -676,7 +676,7 @@ function idataplexInitBasic() { } showString += 'Start IP:'; - + showString += 'Nodes number
      per Switch:
      '); - + // Create accordion panel for profiles var profileSection = $('
      '); var profileLnk = $('

      Profiles

      ').click(function () { @@ -32,11 +32,11 @@ kvmPlugin.prototype.loadConfigPage = function(tabId) { // Add info bar $('#kvmConfigProfile').append(createInfoBar('Not yet supported')); - + // Resize accordion configAccordion.accordion('resize'); }); - + // Create accordion panel for images var imgSection = $('
      '); var imgLnk = $('

      Images

      ').click(function () { @@ -48,7 +48,7 @@ kvmPlugin.prototype.loadConfigPage = function(tabId) { queryImages('kvmConfigImages'); }); - + // Create accordion panel for groups var groupsSection = $('
      '); var groupsLnk = $('

      Groups

      ').click(function () { @@ -60,17 +60,17 @@ kvmPlugin.prototype.loadConfigPage = function(tabId) { queryGroups('kvmConfigGroups'); }); - + configAccordion.append(profileLnk, profileSection, imgLnk, imgSection, groupsLnk, groupsSection); $('#' + tabId).append(configAccordion); configAccordion.accordion(); - + profileLnk.trigger('click'); }; /** * Migrate node - * + * * @param node Node to migrate */ kvmPlugin.prototype.loadMigratePage = function(node) { @@ -79,7 +79,7 @@ kvmPlugin.prototype.loadMigratePage = function(node) { /** * Clone node (service page) - * + * * @param node Node to clone */ kvmPlugin.prototype.serviceClone = function(node) { @@ -88,7 +88,7 @@ kvmPlugin.prototype.serviceClone = function(node) { /** * Load provision page (service page) - * + * * @param tabId Tab ID where page will reside */ kvmPlugin.prototype.loadServiceProvisionPage = function(tabId) { @@ -97,23 +97,23 @@ kvmPlugin.prototype.loadServiceProvisionPage = function(tabId) { /** * Show node inventory (service page) - * + * * @param data Data from HTTP request */ kvmPlugin.prototype.loadServiceInventory = function(data) { - + }; /** * Load node inventory - * + * * @param data Data from HTTP request */ kvmPlugin.prototype.loadInventory = function(data) { var args = data.msg.split(','); var tabId = args[0].replace('out=', ''); var node = args[1].replace('node=', ''); - + // Get node inventory var inv = data.rsp; @@ -122,12 +122,12 @@ kvmPlugin.prototype.loadInventory = function(data) { // Create division to hold inventory var invDiv = $('
      '); - + // Create a fieldset var fieldSet = $('
      '); var legend = $('Hardware'); fieldSet.append(legend); - + var oList = $('
        '); fieldSet.append(oList); invDiv.append(fieldSet); @@ -151,7 +151,7 @@ kvmPlugin.prototype.loadInventory = function(data) { /** * Load clone page - * + * * @param node Source node to clone */ kvmPlugin.prototype.loadClonePage = function(node) { @@ -171,13 +171,13 @@ kvmPlugin.prototype.loadClonePage = function(node) { // Add clone tab tab.add(newTabId, 'Clone', cloneForm, true); } - + tab.select(newTabId); }; /** * Load provision page - * + * * @param tabId The provision tab ID */ kvmPlugin.prototype.loadProvisionPage = function(tabId) { @@ -218,36 +218,36 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { // Append to provision tab $('#' + tabId).append(provForm); - + // Create VM fieldset var vmFS = $('
        '); var vmLegend = $('Virtual Machine'); vmFS.append(vmLegend); - + var vmAttr = $('
        '); vmFS.append($('
        ')); vmFS.append(vmAttr); - + // Create hardware fieldset var hwFS = $('
        '); var hwLegend = $('Hardware'); hwFS.append(hwLegend); - + var hwAttr = $('
        '); hwFS.append($('
        ')); hwFS.append(hwAttr); - + // Create image fieldset var imgFS = $('
        '); var imgLegend = $('Image'); imgFS.append(imgLegend); - + var imgAttr = $('
        '); imgFS.append($('
        ')); imgFS.append(imgAttr); - + provForm.append(vmFS, hwFS, imgFS); - + // Create hypervisor input var host = $('
        '); var hostLabel = $(''); @@ -255,14 +255,14 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { var hostInput = $(''); host.append(hostInput); vmAttr.append(host); - + // Create group input var group = $('
        '); var groupLabel = $(''); group.append(groupLabel); // Turn on auto complete for group - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Split group names into an array var tmp = groupNames.split(','); @@ -298,7 +298,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { memory.append(memoryLabel); memory.append(memoryInput); hwAttr.append(memory); - + // Create processor dropdown var cpu = $('
        '); var cpuLabel = $(''); @@ -315,7 +315,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { cpu.append(cpuLabel); cpu.append(cpuSelect); hwAttr.append(cpu); - + // Create NIC dropdown var nic = $('
        '); var nicLabel = $(''); @@ -323,7 +323,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { nic.append(nicLabel); nic.append(nicInput); hwAttr.append(nic); - + // Create disk input var disk = $('
        '); var diskLabel = $(''); @@ -334,7 +334,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { ); disk.append(diskLabel, diskInput, diskSizeSelect); hwAttr.append(disk); - + // Create disk storage input var storage = $('
        '); var storageLabel = $(''); @@ -342,13 +342,13 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { storage.append(storageLabel); storage.append(storageInput); hwAttr.append(storage); - + // Create operating system input var os = $('
        '); var osLabel = $(''); var osInput = $(''); osInput.one('focus', function() { - var tmp = $.cookie('osvers'); + var tmp = $.cookie('xcat_osvers'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -359,13 +359,13 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { os.append(osLabel); os.append(osInput); imgAttr.append(os); - + // Create architecture input var arch = $('
        '); var archLabel = $(''); var archInput = $(''); archInput.one('focus', function() { - var tmp = $.cookie('osarchs'); + var tmp = $.cookie('xcat_osarchs'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -376,13 +376,13 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { arch.append(archLabel); arch.append(archInput); imgAttr.append(arch); - + // Create profile input var profile = $('
        '); var profileLabel = $(''); var profileInput = $(''); profileInput.one('focus', function() { - var tmp = $.cookie('profiles'); + var tmp = $.cookie('xcat_profiles'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -393,7 +393,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { profile.append(profileLabel); profile.append(profileInput); imgAttr.append(profile); - + // Create boot method dropdown var method = $('
        '); var methodLabel = $(''); @@ -417,10 +417,10 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { // Remove any warning messages $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); var ready = true; - + // Get tab ID var tabId = $(this).parents('.ui-tabs-panel').attr('id'); - + // Check if fields are properly filled in var inputs = $('#' + tabId + ' input:visible'); for ( var i = 0; i < inputs.length; i++) { @@ -431,7 +431,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { inputs.eq(i).css('border', 'solid #BDBDBD 1px'); } } - + var selects = $('#' + tabId + ' select:visible'); for ( var i = 0; i < selects.length; i++) { if (!selects.eq(i).val()) { @@ -441,30 +441,30 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { selects.eq(i).css('border', 'solid #BDBDBD 1px'); } } - + if (ready) { var inst = tabId.replace('kvmProvisionTab', ''); - + // Prepend status bar var statBar = createStatusBar('kvmProvisionStatBar' + inst); statBar.append(createLoader('')); statBar.prependTo($('#' + tabId)); - + var host = $('#' + tabId + ' input[name=host]').val(); var group = $('#' + tabId + ' select[name=group]').val(); var node = $('#' + tabId + ' input[name=node]').val(); - + var memory = $('#' + tabId + ' input[name=memory]').val(); var cpu = $('#' + tabId + ' select[name=cpu]').val(); var nic = $('#' + tabId + ' input[name=nic]').val(); var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val(); var storage = $('#' + tabId + ' input[name=storage]').val(); - + var os = $('#' + tabId + ' input[name=os]').val(); var arch = $('#' + tabId + ' input[name=arch]').val(); var profile = $('#' + tabId + ' input[name=profile]').val(); var boot = $('#' + tabId + ' select[name=bootMethod]').val(); - + /** * (1) Define node */ @@ -512,14 +512,14 @@ kvmPlugin.prototype.loadResources = function() { var tabId = 'kvmResourceTab'; // Remove loader $('#' + tabId).find('img').remove(); - + // Create info bar var infoBar = createInfoBar('Not yet supported'); // Create resource form var resrcForm = $('
        '); resrcForm.append(infoBar); - + $('#' + tabId).append(resrcForm); }; @@ -530,13 +530,13 @@ kvmPlugin.prototype.addNode = function() { var dialog = $('
        '); var info = createInfoBar('Add a KVM node'); dialog.append(info); - + // Create node inputs dialog.append($('
        ')); dialog.append($('
        ')); dialog.append($('
        ')); dialog.append($('
        ')); - + dialog.dialog({ title: 'Add node', modal: true, @@ -555,13 +555,13 @@ kvmPlugin.prototype.addNode = function() { function addKvmNode(){ var attr, args; var errorMessage = ''; - + // Remove existing warnings $('#addKvm .ui-state-error').remove(); - + // Return input border colors to normal $('#addKvm input').css('border', 'solid #BDBDBD 1px'); - + // Check node attributes $('#addKvm input').each(function(){ attr = $(this).val(); @@ -570,28 +570,28 @@ function addKvmNode(){ $(this).css('border', 'solid #FF0000 1px'); } }); - + // Show error message (if any) if (errorMessage) { $('#addKvm').prepend(createWarnBar(errorMessage)); return; } - + // Create loader $('#addKvm').append(createLoader()); - + // Change dialog buttons $('#addKvm').dialog('option', 'buttons', { 'Close':function(){ $('#addKvm').dialog('destroy').remove(); } }); - + // Generate chdef arguments args = '-t;node;-o;' + $('#addKvm input[name="node"]').val() + ';ip=' + $('#addKvm input[name="ip"]').val() - + ';groups=' + $('#addKvm input[name="groups"]').val() - + ';vmhost=' + $('#addKvm input[name="vmhost"]').val() + + ';groups=' + $('#addKvm input[name="groups"]').val() + + ';vmhost=' + $('#addKvm input[name="vmhost"]').val() + ';mgt=kvm;netboot=xnba;nodetype=osi;profile=compute'; $.ajax({ url : 'lib/cmd.php', @@ -614,16 +614,16 @@ function addKvmNode(){ msg : '' } }); - + // Remove loader $('#addKvm img').remove(); - + // Get return message var message = ''; for (var i in data.rsp) { message += data.rsp[i] + '
        '; } - + // Show return message if (message) $('#addKvm').prepend(createInfoBar(message)); @@ -633,7 +633,7 @@ function addKvmNode(){ /** * Update the provision node status - * + * * @param data Data returned from HTTP request */ function updateKVMProvisionStatus(data) { @@ -645,24 +645,24 @@ function updateKVMProvisionStatus(data) { var cmd = args[0].replace('cmd=', ''); // Get provision tab instance var inst = args[1].replace('out=', ''); - + // Get provision tab and status bar ID var statBarId = 'kvmProvisionStatBar' + inst; var tabId = 'kvmProvisionTab' + inst; - + var node = $('#' + tabId + ' input[name=node]').val(); - + /** * (2) Create virtual machine */ if (cmd == 'chdef') { // Write ajax response to status bar - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); // Get parameters var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val(); - + // Begin installation $.ajax( { url : 'lib/cmd.php', @@ -676,19 +676,19 @@ function updateKVMProvisionStatus(data) { success : updateKVMProvisionStatus }); - } - + } + /** * (3) Prepare node for boot */ if (cmd == 'mkvm') { // Write ajax response to status bar - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); - + // Get provision method var boot = $('#' + tabId + ' select[name=bootMethod]').val(); - + // Prepare node for boot $.ajax( { url : 'lib/cmd.php', @@ -703,14 +703,14 @@ function updateKVMProvisionStatus(data) { success : updateKVMProvisionStatus }); } - + /** * (4) Power on node */ if (cmd == 'nodeset') { - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); - + // Prepare node for boot $.ajax( { url : 'lib/cmd.php', @@ -725,16 +725,16 @@ function updateKVMProvisionStatus(data) { success : updateKVMProvisionStatus }); } - + /** * (5) Done */ else if (cmd == 'rpower') { // Write ajax response to status bar - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); $('#' + statBarId).find('img').remove(); - + // If installation was successful if (prg.html().indexOf('Error') == -1) { $('#' + statBarId).find('div').append('
        It will take several minutes before the nodes are up and ready. Use rcons to monitor the status of the install.
        '); diff --git a/xCAT-UI/js/custom/zvm.js b/xCAT-UI/js/custom/zvm.js index 98e1311d6..9d6525481 100644 --- a/xCAT-UI/js/custom/zvm.js +++ b/xCAT-UI/js/custom/zvm.js @@ -166,7 +166,7 @@ zvmPlugin.prototype.loadServiceProvisionPage = function(tabId) { loadGoldenImages(imgCol); // Get zVM host names - if (!$.cookie('zvms')){ + if (!$.cookie('xcat_zvms')){ $.ajax( { url : 'lib/srv_cmd.php', dataType : 'json', @@ -669,7 +669,7 @@ zvmPlugin.prototype.loadClonePage = function(node, nodeOS, nodeArch) { var groupLabel = $(''); var groupInput = $(''); groupInput.one('focus', function(){ - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Turn on auto complete $(this).autocomplete({ @@ -704,7 +704,7 @@ zvmPlugin.prototype.loadClonePage = function(node, nodeOS, nodeArch) { } // Get list of disk pools var temp = hcp.split('.'); - var diskPools = $.cookie(temp[0] + 'diskpools'); + var diskPools = $.cookie('xcat_' + temp[0] + 'diskpools'); // Create disk pool input var poolDiv = $('
        '); @@ -992,7 +992,7 @@ zvmPlugin.prototype.loadInventory = function(data) { // Get node var node = args[1].replace('node=', ''); // Clear any existing cookie - $.cookie(node + 'processes', null); + $.cookie('xcat_' + node + 'processes', null, {path: '/xcat', secure:true }); // Remove loader $('#' + tabId).find('img').remove(); @@ -1127,7 +1127,7 @@ zvmPlugin.prototype.loadInventory = function(data) { // Start off an ajax request to save the zhcp node name // in a cookie for possible later use by addNic dialog var hcpHostname = attrs['hcp']; - if (!$.cookie(node+'_hcpnodename')){ + if (!$.cookie('xcat_' + node+'_hcpnodename')){ $.ajax( { url : 'lib/cmd.php', dataType : 'json', @@ -2310,7 +2310,7 @@ zvmPlugin.prototype.addNode = function() { * @param tgtNode Targets to migrate */ zvmPlugin.prototype.loadMigratePage = function(tgtNode, fromhcp) { - var hosts = $.cookie('zvms').split(','); + var hosts = $.cookie('xcat_zvms').split(','); var radio, zvmBlock, args; var zvms = new Array(); var hcp = new Object(); diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js index 33926ad27..3ff044834 100644 --- a/xCAT-UI/js/custom/zvmUtils.js +++ b/xCAT-UI/js/custom/zvmUtils.js @@ -124,7 +124,7 @@ function loadHcpInfo(data) { if (userEntry[0].indexOf('Failed') < 0) { if (hcp) { // If there is no cookie for the disk pool names - if (!$.cookie(hcp + 'diskpools') || $.cookie(hcp + 'diskpools') === null) { + if (!$.cookie('xcat_' + hcp + 'diskpools') || $.cookie('xcat_' + hcp + 'diskpools') === null) { if (nodeInfoBar !== null) { nodeInfoBar.append("
        Finding pools and networks..."); findingPools = 1; @@ -152,7 +152,7 @@ function loadHcpInfo(data) { } // If there is no cookie for the zFCP pool names - if (!$.cookie(hcp + 'zfcppools') || $.cookie(hcp + 'zfcppools') === null) { + if (!$.cookie('xcat_' + hcp + 'zfcppools') || $.cookie('xcat_' + hcp + 'zfcppools') === null) { if (nodeInfoBar !== null) { if (findingPools = 0) { @@ -183,7 +183,7 @@ function loadHcpInfo(data) { } // If there is no cookie for the network names - if (!$.cookie(hcp + 'networks') || $.cookie(hcp + 'networks') === null) { + if (!$.cookie('xcat_' + hcp + 'networks') || $.cookie('xcat_' + hcp + 'networks') === null) { if (nodeInfoBar !== null) { if (findingPools = 0) { @@ -374,13 +374,13 @@ function loadUserEntry(data) { */ function incrementNodeProcess(node) { // Get current processes - var procs = $.cookie(node + 'processes'); + var procs = $.cookie('xcat_' + node + 'processes'); if (procs) { // One more process procs = parseInt(procs) + 1; - $.cookie(node + 'processes', procs); + $.cookie('xcat_' + node + 'processes', procs); } else { - $.cookie(node + 'processes', 1); + $.cookie('xcat_' + node + 'processes', 1); } } @@ -517,7 +517,7 @@ function updateZProvisionNewStatus(data) { // Set cookie for number of disks var diskRows = $('#' + tabId + ' table:eq(0):visible tbody tr'); - $.cookie('disks2add' + out2Id, diskRows.length); + $.cookie('xcat_disks2add' + out2Id, diskRows.length, {path: '/xcat', secure:true }); if (diskRows.length > 0) { for (var i = 0; i < diskRows.length; i++) { var diskArgs = diskRows.eq(i).find('td'); @@ -558,7 +558,7 @@ function updateZProvisionNewStatus(data) { // Set cookie for number of zFCP devices var zfcpRows = $('#' + tabId + ' table:eq(1):visible tbody tr'); - $.cookie('zfcp2add' + out2Id, zfcpRows.length); + $.cookie('xcat_zfcp2add' + out2Id, zfcpRows.length, {path: '/xcat', secure:true }); if (zfcpRows.length > 0) { for ( var i = 0; i < zfcpRows.length; i++) { var diskArgs = zfcpRows.eq(i).find('td'); @@ -581,10 +581,16 @@ function updateZProvisionNewStatus(data) { var args = '--addzfcp;' + pool + ';' + address + ';' + loaddev + ';' + size; if (tag && tag != "null") { args += ';' + tag; + } else { + args += ';'; } if (portName && tag != "null") { args += ';' + portName; + } else { + args += ';'; } if (unitNo && tag != "null") { args += ';' + unitNo; + } else { + args += ';'; } // Attach zFCP device to node @@ -625,19 +631,19 @@ function updateZProvisionNewStatus(data) { } else { // Set cookie for number of disks // One less disk to add - var disks2add = $.cookie('disks2add' + out2Id); + var disks2add = $.cookie('xcat_disks2add' + out2Id); if (lastCmd == 'chvm-disk') { if (disks2add > 0) { disks2add--; - $.cookie('disks2add' + out2Id, disks2add); + $.cookie('xcat_disks2add' + out2Id, disks2add, {path: '/xcat', secure:true }); } } - var zfcp2add = $.cookie('zfcp2add' + out2Id); + var zfcp2add = $.cookie('xcat_zfcp2add' + out2Id); if (lastCmd == 'chvm-zfcp') { if (zfcp2add > 0) { zfcp2add--; - $.cookie('zfcp2add' + out2Id, zfcp2add); + $.cookie('xcat_zfcp2add' + out2Id, zfcp2add, {path: '/xcat', secure:true }); } } @@ -887,10 +893,10 @@ function updateZNodeStatus(data) { var rsp = data.rsp; // Get cookie for number processes performed against this node - var actions = $.cookie(node + 'processes'); + var actions = $.cookie('xcat_' + node + 'processes'); // One less process actions = actions - 1; - $.cookie(node + 'processes', actions); + $.cookie('xcat_' + node + 'processes', actions, {path: '/xcat', secure:true }); if (actions < 1) { // Hide loader when there are no more processes @@ -1116,7 +1122,7 @@ function getZResources(data) { } // Set hardware control point cookie - $.cookie('hcp', hcps); + $.cookie('xcat_hcp', hcps, {path: '/xcat', secure:true }); // Delete loader $('#' + tabId).find('img[src="images/loader.gif"]').remove(); @@ -1137,10 +1143,10 @@ function getZResources(data) { // Create a array for hardware control points var hcps = new Array(); - if ($.cookie('hcp').indexOf(',') > -1) { - hcps = $.cookie('hcp').split(','); + if ($.cookie('xcat_hcp').indexOf(',') > -1) { + hcps = $.cookie('xcat_hcp').split(','); } else { - hcps.push($.cookie('hcp')); + hcps.push($.cookie('xcat_hcp')); } // Query the disk pools for each hcp @@ -1185,10 +1191,10 @@ function getZResources(data) { // Create a array for hardware control points var hcps = new Array(); - if ($.cookie('hcp').indexOf(',') > -1) { - hcps = $.cookie('hcp').split(','); + if ($.cookie('xcat_hcp').indexOf(',') > -1) { + hcps = $.cookie('xcat_hcp').split(','); } else { - hcps.push($.cookie('hcp')); + hcps.push($.cookie('xcat_hcp')); } @@ -1235,10 +1241,10 @@ function getZResources(data) { // Create a array for hardware control points var hcps = new Array(); - if ($.cookie('hcp').indexOf(',') > -1) { - hcps = $.cookie('hcp').split(','); + if ($.cookie('xcat_hcp').indexOf(',') > -1) { + hcps = $.cookie('xcat_hcp').split(','); } else { - hcps.push($.cookie('hcp')); + hcps.push($.cookie('xcat_hcp')); } // Query the networks for each @@ -1442,7 +1448,7 @@ function openAddProcDialog(node) { */ function openAddDiskDialog(node, hcp) { // Get list of disk pools - var cookie = $.cookie(hcp + 'diskpools'); + var cookie = $.cookie('xcat_' + hcp + 'diskpools'); var pools = new Array(); if (cookie) { pools = cookie.split(','); @@ -1605,7 +1611,7 @@ function openAddDiskDialog(node, hcp) { */ function openAddZfcpDialog(node, hcp, zvm) { // Get list of disk pools - var cookie = $.cookie(hcp + 'zfcppools'); + var cookie = $.cookie('xcat_' + hcp + 'zfcppools'); var pools = new Array(); if (cookie) { pools = cookie.split(','); @@ -2492,8 +2498,8 @@ function openAddScsi2SystemDialog(hcp) { var fcpWwpn = $(''); devPathRow.append(fcpWwpn); - if ($.cookie('zvms')) { - zvms = $.cookie('zvms').split(','); + if ($.cookie('xcat_zvms')) { + zvms = $.cookie('xcat_zvms').split(','); var zvm; for (var i in zvms) { if( !zvms[i] || 0 === zvms[i].length) continue; @@ -2807,7 +2813,7 @@ function openAddNicDialog(node, hcp) { // Get the hcp node name for the node // Should be in a cookie, else just take first part of hostname - var hcpNode = $.cookie(node+'_hcpnodename'); + var hcpNode = $.cookie('xcat_' + node+'_hcpnodename'); if (!hcpNode) { if (typeof console == "object"){ console.log("openAddNicDialog did not find cookie for <"+node+"_hcpnodename> Using first token in hostname"); @@ -2819,7 +2825,7 @@ function openAddNicDialog(node, hcp) { } // Get network names - var cookie = $.cookie(hcpNode + 'networks'); + var cookie = $.cookie('xcat_' + hcpNode + 'networks'); var networks = new Array(); if (cookie) { networks = cookie.split(','); @@ -3772,14 +3778,14 @@ function removeNic(node, nic) { * @param data Data from HTTP request */ function setNetworkCookies(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { var node = data.msg; var networks = data.rsp[0].split(node + ': '); // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (60 * 60 * 1000)); - $.cookie(node + 'networks', networks, { expires: exDate }); + $.cookie('xcat_' + node + 'networks', networks, { expires: exDate, path: '/xcat', secure:true }); } } @@ -3789,7 +3795,7 @@ function setNetworkCookies(data) { * @param data HTTP request data */ function getDiskPool(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1 && data.rsp[0].indexOf("Error") == -1) { var hcp = data.msg; var pools = data.rsp[0].split(hcp + ': '); @@ -3854,9 +3860,10 @@ function getZfcpPool(data) { if (typeof console == "object"){ console.log("Entering getZfcpPool."); } - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1 && data.rsp[0].indexOf("Error") == -1) { var hcp = data.msg; var pools = data.rsp[0].split(hcp + ': '); + zhcpQueryCountForZfcps = 0; // Get contents of each disk pool for (var i in pools) { pools[i] = jQuery.trim(pools[i]); @@ -3900,7 +3907,7 @@ function getZfcpPool(data) { * @param data HTTP request data */ function getNetwork(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1 && data.rsp[0].indexOf("Error") == -1) { var hcp = data.msg; var networks = data.rsp[0].split(hcp + ': '); if (typeof console == "object"){ @@ -3962,7 +3969,7 @@ function loadDiskPoolTable(data) { var args, hcp, pool, stat, tmp; if (data && typeof data.rsp != "undefined") { // Do not continue if the call failed - if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) { + if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0 && data.rsp[0].indexOf("Error") > 0) { return; } @@ -4065,10 +4072,10 @@ function loadDiskPoolTable(data) { // Create a array for hardware control points var hcps = new Array(); - if ($.cookie('hcp').indexOf(',') > -1) - hcps = $.cookie('hcp').split(','); + if ($.cookie('xcat_hcp').indexOf(',') > -1) + hcps = $.cookie('xcat_hcp').split(','); else - hcps.push($.cookie('hcp')); + hcps.push($.cookie('xcat_hcp')); zhcpQueryCountForDisks = hcps.length; // Query the disk pools for each @@ -4179,15 +4186,45 @@ function loadZfcpPoolTable(data) { } // Delete loader if last one var panelId = 'zfcpResource'; - if (!zhcpQueryCountForZfcps) { + if (zhcpQueryCountForZfcps <= 0) { $('#' + panelId).find('img[src="images/loader.gif"]').remove(); } var hcp2zvm = new Object(); var args, hcp, pool, tmp; + + // Resource tab ID + var info = $('#' + panelId).find('.ui-state-highlight'); + + // Is there any data passed? Process if some if (typeof data.rsp != "undefined") { - // Do not continue if the call failed - if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) { + // Do not continue if no data to add + if (!data.rsp.length) { + if (typeof console == "object"){ + console.log("data.rsp.length is 0."); + } + // If there is no info bar, create info bar + var msgError = '
        Unexpected, no data returned on the lsvm --zfcppool call.'; + if (!info.length) { + info = createInfoBar(msgError); + $('#' + panelId).append(info); + } else { + info.append(msgError); + } + return; + } + if (data.rsp[0].indexOf("Failed") > 0 || data.rsp[0].indexOf("Error") > 0) { + if (typeof console == "object"){ + console.log("Failed on lsvm call for --zfcppool"); + } + var msgError = '
        Error: Error on call to check zfcp pools: '+ data.rsp[0]; + // If there is no info bar, create info bar + if (!info.length) { + info = createInfoBar(msgError); + $('#' + panelId).append(info); + } else { + info.append(msgError); + } return; } @@ -4200,13 +4237,14 @@ function loadZfcpPoolTable(data) { tmp = data.rsp[0].split(hcp + ': '); } else { // Provide empty values so the table will be generated + if (typeof console == "object"){ + console.log("Creating empty zfcp pool table."); + } hcp = ''; pool = '' tmp = new Array(); } - // Resource tab ID - var info = $('#' + panelId).find('.ui-state-highlight'); // If there is no info bar, create info bar if (!info.length) { info = createInfoBar('Below are devices that are defined internally in the zFCP pools.'); @@ -4248,7 +4286,8 @@ function loadZfcpPoolTable(data) { tmp[i] = jQuery.trim(tmp[i]); var diskAttrs = tmp[i].split(','); diskAttrs[0] = diskAttrs[0].toLowerCase(); - var key = hcp2zvm[hcp] + '-' + pool + '-' + diskAttrs[2]; + // Key contains row data to be returned when the checkbox is selected + var key = hcp2zvm[hcp] + '-' + pool + '-' + diskAttrs[2] + '-' + diskAttrs[1]; dTable.fnAddData( [ '', hcp2zvm[hcp], pool, diskAttrs[0], diskAttrs[1], diskAttrs[2], diskAttrs[3], diskAttrs[4], diskAttrs[5], diskAttrs[6], diskAttrs[7] ]); } } @@ -4266,6 +4305,9 @@ function loadZfcpPoolTable(data) { // Delete disk from pool var removeLnk = $('Remove'); removeLnk.bind('click', function(event){ + if (typeof console == "object"){ + console.log("Remove button clicked for tableId:"+tableId); + } var disks = getNodesChecked(tableId); openRemoveZfcpFromPoolDialog(disks); }); @@ -4278,10 +4320,10 @@ function loadZfcpPoolTable(data) { // Create a array for hardware control points var hcps = new Array(); - if ($.cookie('hcp').indexOf(',') > -1) - hcps = $.cookie('hcp').split(','); + if ($.cookie('xcat_hcp').indexOf(',') > -1) + hcps = $.cookie('xcat_hcp').split(','); else - hcps.push($.cookie('hcp')); + hcps.push($.cookie('xcat_hcp')); // Query the disk pools for each zhcpQueryCountForZfcps = hcps.length; @@ -4643,7 +4685,11 @@ function openRemoveZfcpFromPoolDialog(devices2remove) { // Verify disks are in the same zFCP pool var devices = devices2remove.split(','); + if (typeof console == "object"){ + console.log("Entering openRemoveZfcpFromPoolDialog. Device to remove:<"+devices2remove+">"); + } var tmp, tgtPool, tgtHcp; + var tgtPort = ""; var tgtUnitNo = ""; for (var i in devices) { if( !devices[i] || 0 === devices[i].length) continue; @@ -4658,6 +4704,7 @@ function openRemoveZfcpFromPoolDialog(devices2remove) { tgtHcp = tmp[0]; // Assume it is just one zHCP. Otherwise, this cannot be done on multiple zHCPs. tgtUnitNo += tmp[2] + ","; + tgtPort = tmp[3]; } // Strip out last comma @@ -4673,7 +4720,7 @@ function openRemoveZfcpFromPoolDialog(devices2remove) { var pool = $('
        '); var unitNo = $('
        '); - var portName = $('
        '); + var portName = $('
        '); deleteDiskForm.append(system, pool, unitNo, portName); // Append options for hardware control points @@ -4760,7 +4807,9 @@ function openRemoveZfcpFromPoolDialog(devices2remove) { msg : dialogId }, - success : updateResourceDialog + success : function(data) { + updateResourceDialog(data); + } }); }, "Cancel": function() { @@ -4984,7 +5033,7 @@ function loadNetworkTable(data) { } // Get zVM host names - if (!$.cookie('zvms')) { + if (!$.cookie('xcat_zvms')) { $.ajax({ url : 'lib/cmd.php', dataType : 'json', @@ -5002,7 +5051,7 @@ function loadNetworkTable(data) { }); } - var zvms = $.cookie('zvms').split(','); + var zvms = $.cookie('xcat_zvms').split(','); var hcp2zvm = new Object(); var args, zvm, iHcp, tmp; for (var i in zvms) { @@ -5132,10 +5181,10 @@ function loadNetworkTable(data) { // Create a array for hardware control points var hcps = new Array(); - if ($.cookie('hcp').indexOf(',') > -1) - hcps = $.cookie('hcp').split(','); + if ($.cookie('xcat_hcp').indexOf(',') > -1) + hcps = $.cookie('xcat_hcp').split(','); else - hcps.push($.cookie('hcp')); + hcps.push($.cookie('xcat_hcp')); // Query networks zhcpQueryCountForNetworks = hcps.length; @@ -5206,7 +5255,7 @@ function connect2GuestLan(data) { $('#' + node + 'StatusBar').find('div').append(prg); // Continue if no errors found - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { // Connect NIC to Guest LAN $.ajax( { url : 'lib/cmd.php', @@ -5261,7 +5310,7 @@ function connect2VSwitch(data) { $('#' + node + 'StatusBar').find('div').append(prg); // Continue if no errors found - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { // Connect NIC to VSwitch $.ajax( { url : 'lib/cmd.php', @@ -5317,7 +5366,7 @@ function createZProvisionExisting(inst) { group.append(groupLabel); // Turn on auto complete for group - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Split group names into an array var tmp = groupNames.split(','); @@ -5363,7 +5412,7 @@ function createZProvisionExisting(inst) { var osSelect = $(''); osSelect.append($('')); - var imageNames = $.cookie('imagenames').split(','); + var imageNames = $.cookie('xcat_imagenames').split(','); if (imageNames) { imageNames.sort(); for (var i in imageNames) { @@ -5542,7 +5591,7 @@ function createZProvisionNew(inst) { var groupInput = $(''); // Get groups on-focus groupInput.one('focus', function(){ - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Turn on auto complete $(this).autocomplete({ @@ -5603,7 +5652,7 @@ function createZProvisionNew(inst) { }, success: function(data) { - if (data.rsp.length && (data.rsp[0].indexOf("Failed") > -1 || data.rsp[0].indexOf("Invalid") > -1) ) { + if (data.rsp.length && (data.rsp[0].indexOf("Failed") > -1 || data.rsp[0].indexOf("Invalid") > -1 || data.rsp[0].indexOf("Error") > -1) ) { // Remove the progress gif, since bailing out removeProvisionLoadingGif(provisionStatusBar); @@ -5711,7 +5760,7 @@ function createZProvisionNew(inst) { console.log("Looking for cookies from <" + zhcpToCheck + ">"); } - if (!$.cookie(zhcpToCheck + 'diskpools')) { + if (!$.cookie('xcat_' + zhcpToCheck + 'diskpools')) { // Get disk pools $.ajax({ url : 'lib/cmd.php', @@ -5732,7 +5781,7 @@ function createZProvisionNew(inst) { checkProvisionCallsDone(provisionStatusBar, ajaxCalls, "diskpoolnames"); } - if (!$.cookie(zhcpToCheck + 'zfcppools')) { + if (!$.cookie('xcat_' + zhcpToCheck + 'zfcppools')) { // Get zFCP pools $.ajax({ url : 'lib/cmd.php', @@ -5753,7 +5802,7 @@ function createZProvisionNew(inst) { checkProvisionCallsDone(provisionStatusBar, ajaxCalls, "zfcppoolnames"); } - if (!$.cookie(zhcpToCheck + 'userprofiles')) { + if (!$.cookie('xcat_' + zhcpToCheck + 'userprofiles')) { // Get zFCP pools $.ajax( { url : 'lib/cmd.php', @@ -5780,7 +5829,7 @@ function createZProvisionNew(inst) { var thisUserProfile = $('#' + thisTabId + ' select[name=userProfile]'); thisUserProfile.children().remove(); - var definedUserProfiles = $.cookie(zhcpToCheck + 'userprofiles').split(','); + var definedUserProfiles = $.cookie('xcat_' + zhcpToCheck + 'userprofiles').split(','); for (var i in definedUserProfiles) { if( !definedUserProfiles[i] || 0 === definedUserProfiles[i].length) continue; thisUserProfile.append(''); @@ -5789,7 +5838,7 @@ function createZProvisionNew(inst) { var thisNetwork = $('#' + thisTabId + ' select[name=network]'); thisNetwork.children().remove(); thisNetwork.append(''); // No profile option - var definedNetworks = $.cookie(zhcpToCheck + 'networks').split(','); + var definedNetworks = $.cookie('xcat_' + zhcpToCheck + 'networks').split(','); for (var i in definedNetworks) { if( !definedNetworks[i] || 0 === definedNetworks[i].length) continue; if (!jQuery.trim(definedNetworks[i])) @@ -5854,7 +5903,7 @@ function createZProvisionNew(inst) { var osSelect = $(''); osSelect.append($('')); - var imageNames = $.cookie('imagenames').split(','); + var imageNames = $.cookie('xcat_imagenames').split(','); if (imageNames) { imageNames.sort(); for (var i in imageNames) { @@ -5939,7 +5988,6 @@ function createZProvisionNew(inst) { '' + ''); var cpuSelect = $(''); + var zfcpTag = $(''); zfcpRow.append(zfcpTag); // Create device port name @@ -6399,6 +6447,35 @@ function createZProvisionNew(inst) { ready = false; } + // If this is basic mode, check for a disk with IPL radio button and zFCP with LOADDEV button + // Cannot have both. (In advanced mode they create the directory entries.) + if (hwTabIndex == 0) { + // Find a device to be IPLed? + var ECKD_FBA_diskRows = $('#' + thisTabId + ' table:eq(0):visible tbody tr'); + var iplSet = 0; + for (var i = 0; i < ECKD_FBA_diskRows.length; i++) { + var diskArgs = ECKD_FBA_diskRows.eq(i).find('td'); + if (diskArgs.eq(7).find('input').attr("checked") === true) { + iplSet = 1; + break; + } + } + + // Check if zFCP loaddev checked + var zfcpRows = $('#' + thisTabId + ' table:eq(1):visible tbody tr'); + if (zfcpRows.length > 0) { + for ( var i = 0; i < zfcpRows.length; i++) { + var diskArgs = zfcpRows.eq(i).find('td'); + // This is either true or false + var loaddev = diskArgs.eq(7).find('input').attr('checked'); + if (loaddev && iplSet) { + errMsg = errMsg + 'You cannot have both disk IPL and zFCP LOADDEV, can only IPL one device.
        '; + ready = false; + } + } + } + } + // If inputs are valid, ready to provision if (ready) { // Generate user directory entry if basic tab is selected @@ -6641,13 +6718,13 @@ function checkProvisionCallsDone(provisionStatBar, table, finishedKey) { */ function loadzVMs(col) { // Get group names and description and append to group column - if (!$.cookie('zvms')) { + if (!$.cookie('xcat_zvms')) { var infoBar = createInfoBar('No selectable z/VM available'); col.append(infoBar); return; } - var zNames = $.cookie('zvms').split(','); + var zNames = $.cookie('xcat_zvms').split(','); var radio, zBlock, args, zvm, hcp; for (var i in zNames) { @@ -6689,13 +6766,13 @@ function loadzVMs(col) { */ function loadSrvGroups(col) { // Get group names and description and append to group column - if (!$.cookie('srv_groups')) { + if (!$.cookie('xcat_srv_groups')) { var infoBar = createInfoBar('No selectable group available'); col.append(infoBar); return; } - var groupNames = $.cookie('srv_groups').split(','); + var groupNames = $.cookie('xcat_srv_groups').split(','); var groupBlock, radio, args, name, ip, hostname, desc; for (var i in groupNames) { @@ -6739,13 +6816,13 @@ function loadSrvGroups(col) { */ function loadOSImages(col) { // Get group names and description and append to group column - if (!$.cookie('srv_imagenames')) { + if (!$.cookie('xcat_srv_imagenames')) { var infoBar = createInfoBar('No selectable image available'); col.append(infoBar); return; } - var imgNames = $.cookie('srv_imagenames').split(','); + var imgNames = $.cookie('xcat_srv_imagenames').split(','); var imgBlock, radio, args, name, desc; for (var i in imgNames) { @@ -6790,13 +6867,13 @@ function loadOSImages(col) { */ function loadGoldenImages(col) { // Get group names and description and append to group column - if (!$.cookie('srv_goldenimages')) { + if (!$.cookie('xcat_srv_goldenimages')) { var infoBar = createInfoBar('No selectable master copies available'); col.append(infoBar); return; } - var imgNames = $.cookie('srv_goldenimages').split(','); + var imgNames = $.cookie('xcat_srv_goldenimages').split(','); var imgBlock, radio, args, name, desc; for (var i in imgNames) { @@ -6844,7 +6921,7 @@ function loadGoldenImages(col) { * @param data Data from HTTP request */ function setzVMCookies(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { var zvms = new Array(); var hosts = data.rsp[0].split("\n"); for ( var i = 0; i < hosts.length; i++) { @@ -6859,7 +6936,7 @@ function setzVMCookies(data) { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (60 * 60 * 1000)); - $.cookie('zvms', zvms, { expires: exDate }); + $.cookie('xcat_zvms', zvms, { expires: exDate, path: '/xcat', secure:true }); } } @@ -6869,7 +6946,7 @@ function setzVMCookies(data) { * @param data Data from HTTP request */ function setGoldenImagesCookies(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { var copies = new Array(); var tmp = data.rsp[0].split(","); for ( var i = 0; i < tmp.length; i++) { @@ -6881,7 +6958,7 @@ function setGoldenImagesCookies(data) { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (60 * 60 * 1000)); - $.cookie('srv_goldenimages', copies, { expires: exDate }); + $.cookie('xcat_srv_goldenimages', copies, { expires: exDate, path: '/xcat', secure:true }); } } @@ -6891,7 +6968,7 @@ function setGoldenImagesCookies(data) { * @param data Data from HTTP request */ function setDiskPoolCookies(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { var node = data.msg; var pools = data.rsp[0].split(node + ": "); var pools2 = []; @@ -6904,7 +6981,7 @@ function setDiskPoolCookies(data) { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (60 * 60 * 1000)); - $.cookie(node + 'diskpools', pools2, { expires: exDate }); + $.cookie('xcat_' + node + 'diskpools', pools2, { expires: exDate, path: '/xcat', secure:true }); } } @@ -6914,7 +6991,7 @@ function setDiskPoolCookies(data) { * @param data Data from HTTP request */ function setZfcpPoolCookies(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { var node = data.msg; var pools = data.rsp[0].split(node + ': '); var pools2 = []; @@ -6927,7 +7004,7 @@ function setZfcpPoolCookies(data) { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (60 * 60 * 1000)); - $.cookie(node + 'zfcppools', pools2, { expires: exDate }); + $.cookie('xcat_' + node + 'zfcppools', pools2, { expires: exDate, path: '/xcat', secure:true }); } } @@ -6941,7 +7018,7 @@ function setzHcpCookies(zhcps) { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (60 * 60 * 1000)); - $.cookie('zhcps', zhcps, { expires: exDate }); + $.cookie('xcat_zhcps', zhcps, { expires: exDate, path: '/xcat', secure:true }); } } @@ -6951,7 +7028,7 @@ function setzHcpCookies(zhcps) { * @param data Data from HTTP request */ function setUserProfilesCookies(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { var node = data.msg; var profiles = data.rsp[0].split(node + ': '); var profiles2 = []; @@ -6964,7 +7041,7 @@ function setUserProfilesCookies(data) { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (60 * 60 * 1000)); - $.cookie(node + 'userprofiles', profiles2, { expires: exDate }); + $.cookie('xcat_' + node + 'userprofiles', profiles2, { expires: exDate, path: '/xcat', secure:true }); } } @@ -7025,7 +7102,7 @@ function configProfilePanel(panelId) { table.init(['', 'Profile', 'Disk pool', 'Disk size', 'Directory entry']); // Insert profiles into table - var profiles = $.cookie('profiles').split(','); + var profiles = $.cookie('xcat_profiles').split(','); profiles.push('default'); // Add default profile for (var i in profiles) { if (profiles[i]) { @@ -7245,7 +7322,7 @@ function profileDialog() { // Insert profiles into select var profileSelect = $(''); - var profiles = $.cookie('profiles').split(','); + var profiles = $.cookie('xcat_profiles').split(','); profiles.push('default'); // Add default profile for (var i in profiles) { if (profiles[i]) { @@ -7420,7 +7497,7 @@ function editProfileDialog(profile, pool, size, entry) { // Insert profiles into select var profileSelect = $(''); - var profiles = $.cookie('profiles').split(','); + var profiles = $.cookie('xcat_profiles').split(','); profiles.push('default'); // Add default profile for (var i in profiles) { if (profiles[i]) { @@ -7541,7 +7618,7 @@ function editProfileDialog(profile, pool, size, entry) { */ function getHcpZvmHash() { // Get zVM host names - if (!$.cookie('zvms')) { + if (!$.cookie('xcat_zvms')) { $.ajax({ url : 'lib/cmd.php', dataType : 'json', @@ -7559,7 +7636,7 @@ function getHcpZvmHash() { }); } - var zvms = $.cookie('zvms').split(','); + var zvms = $.cookie('xcat_zvms').split(','); var hcp2zvm = new Object(); var args, zvm, iHcp, tmp; for (var i in zvms) { @@ -7656,6 +7733,20 @@ function updateUserEntry(tabId) { } } + // Check if zFCP loaddev checked, if so ipl the fcp card + var zfcpRows = $('#' + tabId + ' table:eq(1):visible tbody tr'); + if (zfcpRows.length > 0) { + for ( var i = 0; i < zfcpRows.length; i++) { + var diskArgs = zfcpRows.eq(i).find('td'); + var address = diskArgs.eq(1).find('input').val(); + // This is either true or false + var loaddev = diskArgs.eq(7).find('input').attr('checked'); + if (loaddev) { + ipl = address; + } + } + } + // Only update directory entry if the basic tab is selected var inst = tabId.replace('zvmProvisionTab', ''); var hwTabIndex = $("#hwConfig" + inst).tabs('option', 'selected'); @@ -7699,6 +7790,20 @@ function updateUserEntry(tabId) { } } + // Check if zFCP loaddev checked, if so ipl the fcp card + var zfcpRows = $('#' + tabId + ' table:eq(1):visible tbody tr'); + if (zfcpRows.length > 0) { + for ( var i = 0; i < zfcpRows.length; i++) { + var diskArgs = zfcpRows.eq(i).find('td'); + var address = diskArgs.eq(1).find('input').val(); + // This is either true or false + var loaddev = diskArgs.eq(7).find('input').attr('checked'); + if (loaddev) { + ipl = address; + } + } + } + // Only update directory entry if the basic tab is selected var inst = tabId.replace('zvmProvisionTab', ''); var hwTabIndex = $("#hwConfig" + inst).tabs('option', 'selected'); @@ -7742,6 +7847,20 @@ function updateUserEntry(tabId) { } } + // Check if zFCP loaddev checked, if so ipl the fcp card + var zfcpRows = $('#' + tabId + ' table:eq(1):visible tbody tr'); + if (zfcpRows.length > 0) { + for ( var i = 0; i < zfcpRows.length; i++) { + var diskArgs = zfcpRows.eq(i).find('td'); + var address = diskArgs.eq(1).find('input').val(); + // This is either true or false + var loaddev = diskArgs.eq(7).find('input').attr('checked'); + if (loaddev) { + ipl = address; + } + } + } + // Only update directory entry if the basic tab is selected var inst = tabId.replace('zvmProvisionTab', ''); var hwTabIndex = $("#hwConfig" + inst).tabs('option', 'selected'); @@ -7836,6 +7955,10 @@ function generateUserEntry(userId, password, memory, privilege, profile, cpuCoun userDirectoryEntry += "SPOOL 000D 2540 PUNCH A\n"; userDirectoryEntry += "SPOOL 000E 1403 A\n"; + if (typeof console == "object"){ + console.log("Exiting generateUserEntry. Directory created:"+userDirectoryEntry); + } + return userDirectoryEntry; } @@ -7936,7 +8059,7 @@ function getNetworkDetails(hcpNode, vswitchname, hashId, tabId) { console.log("getNetworkDetails. creating new hash[[]] table!!" + "hashindex<" + hashindex + ">" ); } } - if (data.rsp.length && (data.rsp[0].indexOf("Failed") > -1 || (foundInvalid == 1) ) ) { + if (data.rsp.length && (data.rsp[0].indexOf("Failed") > -1 || (foundInvalid == 1) || data.rsp[0].indexOf("Error") > -1 ) ) { if (typeof console == "object") { console.log("getNetworkDetails. failure getting the network data for " + hcpNode + " network "+ vswitchname); } @@ -7993,7 +8116,7 @@ function getNetworkDetails(hcpNode, vswitchname, hashId, tabId) { * @param data Data from HTTP request */ function setNodeZhcpNodename(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { var savedTokens = data.msg.split(';'); var node = savedTokens[0]; var hcphostname = savedTokens[1]; @@ -8010,7 +8133,7 @@ function setNodeZhcpNodename(data) { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (60 * 60 * 1000)); - $.cookie(node+'_hcpnodename', nodename, { expires: exDate }); + $.cookie('xcat_' + node+'_hcpnodename', nodename, { expires: exDate, path: '/xcat', secure:true }); } } } diff --git a/xCAT-UI/js/help/help.js b/xCAT-UI/js/help/help.js index a9b8ce454..694198e51 100644 --- a/xCAT-UI/js/help/help.js +++ b/xCAT-UI/js/help/help.js @@ -1,9 +1,29 @@ /** - * Load the help page + * Global variables + */ +var helpTab; // Help tabs +var ivpChoices = new Array; +var ivpChoiceValues = new Array; +var selectInfo = new Object(); + + +/** + * Load the help page and create the tabs. */ function loadHelpPage(){ + createHelpTab(); + createVerifyXCATTab(); +} + +/** + * Create the Help Tab + * + * @return Tab object + */ +function createHelpTab(){ // Create help tab var tab = new Tab(); + setHelpTab(tab); tab.init(); $('#content').append(tab.object()); @@ -28,4 +48,693 @@ function loadHelpPage(){ '' + ''); tab.add('helpTab', 'Help', helpForm, false); -} \ No newline at end of file +} + + +/** + * Create the Verify xCAT Tab + * + * @return Tab object + */ +function createVerifyXCATTab() { + var comments = 'Description of the IVP run'; + var ivpEnabled = 'checked'; + var ivpDisabled = ''; + + // Get the tab + var tab = getHelpTab(); + var fs, legend; + + // Generate new tab ID + var instance = 0; + var newTabId = 'verifyXCATTab' + instance; + while ($('#' + newTabId).length) { + // If one already exists, generate another one + instance = instance + 1; + newTabId = 'verifyXCATTab' + instance; + } + + // Build the list of IVPs in the table + readIvpTable(); + + // Create info bar and status bar + var infoBar = createInfoBar( 'Run or schedule Installation Verification Procedures to verify:
        ' + + '-xCAT MN/ZHCP Environment, or
        ' + + '-xCAT MN/ZHCP and OpenStack Environment.' ); + + var statBarId = 'verifyXCATStatusBar' + instance; + var statBar = createStatusBar(statBarId).hide(); + var loader = createLoader( '' ); + statBar.find('div').append( loader ); + + // Create the verify form and put info and status bars on the form. + var verifyXCATForm = $( '
        ' ); + verifyXCATForm.append( infoBar, statBar ); + + // Create 'Create a Verify xCAT' fieldset + fs = $( '
        ' ); + fs.append( $( 'Verify:' )); + fs.append( $( '
        ' + + '' + + '
        ' )); + fs.append( $('
        Type of IVP Run:
        ')); + fs.append( $('
        Basic IVP: xCAT MN/ZHCP Verification
        ' )); + fs.append( $('
        Full IVP: xCAT MN/ZHCP and OpenStack Verification
        ' )); + fs.append( $('
        Basic and Full IVP Parameters:
        ')); + fs.append( $('
        ' )); + fs.append( $('
        ' )); + fs.append( $('
        Full IVP Parameters:
        ')); + fs.append( $('
        ' )); + fs.append( $('
        ' )); + fs.append( $('
        ' )); + fs.append( $('
        Automated IVP Parameters:
        ')); + fs.append( $('
        ' )); + fs.append( '
        '+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + '
        ScheduleEvery hour
        Midnight1 am2 am3 am4 am5 am
        6 am7 am8 am9 am10 am11 am
        Noon1 pm2 pm3 pm4 pm5 pm
        6 pm7 pm8 pm9 pm10 pm11 pm
        '+ + '
        '); + fs.append( $('
        Disable or Enable the IVP Run:
        ')); + fs.append( $('
        Enabled to be run periodically
        ' )); + fs.append( $('
        Disabled from running periodically
        ' )); + verifyXCATForm.append( fs ); + + var verifyBtn = createButton( 'Run an IVP Now' ); + verifyBtn.click(function() { + var driveFunction = 1; + var argList = ''; + + // Remove any warning messages + $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); + + var runType = $(this).parent().find('input[name="runType"]:checked').val(); + if ( runType == 'verifyBasic' ) { + argList += '||--basicivp'; + } else if ( runType == 'verifyOpenStack' ) { + argList += '||--fullivp'; + var openstackIP = $(this).parent().find('input[name=openstackIP]').val(); + if ( openstackIP != '' ) { + argList += '||--openstackip ' + openstackIP; + } else { + // Show an information message. + $('#' + statBarId).find('div').append( + 'You did not specify the IP address of the OpenStack system. The IVP ' + + 'will use the IP address of the system running the xCAT management node as ' + + 'the OpenStack IP address.
        '); + } + var openstackUser = $(this).parent().find('input[name=openstackUser]').val(); + if ( openstackUser != '' ) { + argList += '||--openstackuser ' + hexEncode( openstackUser ); + } + var prepParms = $(this).parent().find('input[name=prepParms]').val(); + if ( prepParms != '' ) { + argList += '||--prepparms ' + hexEncode( prepParms ); + } + } else { + // Show warning message + var warn = createWarnBar('You did not select a basic or full IVP.'); + warn.prependTo($(this).parents('.ui-tabs-panel')); + driveFunction = 0; + } + var orchParms = $(this).parent().find('input[name=orchParms]').val(); + if ( orchParms != '' ) { + argList += '||--orchparms ' + hexEncode( orchParms ); + } + var mainParms = $(this).parent().find('input[name=mainParms]').val(); + if ( mainParms != '' ) { + argList += '||--zxcatparms ' + hexEncode( mainParms ); + } + argList += '||end'; + + if ( driveFunction == 1 ) { + $('#' + statBarId).find('div').append( 'Invoking verifynode to run the IVP.
        ' ); + $('#' + statBarId).find('img').show(); + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'webrun', + tgt : '', + args : 'verifynode '+ argList, + msg : 'out=' + statBarId + ';cmd=verifynode' + }, + success : updateStatusBar + }); + + // Show status bar + statBar.show(); + } + }); + verifyXCATForm.append( verifyBtn ); + + var scheduleBtn = createButton( 'Schedule an IVP Run' ); + scheduleBtn.click(function() { + var driveFunction = 1; + var argList = ''; + + // Remove any warning messages + $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); + + var ivpId = $(this).parent().find('select[name=ivpId]').val(); + if ( ivpId != 'NEW' ) { + argList += '||--id ' + ivpId; + } + var runType = $(this).parent().find('input[name="runType"]:checked').val(); + if ( runType == 'verifyBasic' ) { + argList += '||--type basicivp'; + } else if ( runType == 'verifyOpenStack' ) { + argList += '||--type fullivp'; + var openstackIP = $(this).parent().find('input[name=openstackIP]').val(); + if ( openstackIP != '' ) { + argList = argList + '||--openstackip ' + openstackIP; + } else { + // Show an information message. + $('#' + statBarId).find('div').append( + 'You did not specify the IP address of the OpenStack system. The IVP ' + + 'will use the IP address of the system running the xCAT management node as ' + + 'the OpenStack IP address.
        '); + } + var openstackUser = $(this).parent().find('input[name=openstackUser]').val(); + if ( openstackUser != '' ) { + argList += '||--openstackuser ' + hexEncode( openstackUser ); + } else { + argList += '||--openstackuser \'\''; + } + var prepParms = $(this).parent().find('input[name=prepParms]').val(); + if ( prepParms != '' ) { + argList += '||--prepparms ' + hexEncode( prepParms ); + } else { + argList += '||--prepparms \'\''; + } + } else { + // Show warning message + var warn = createWarnBar('You did not select a basic or full IVP.'); + warn.prependTo($(this).parents('.ui-tabs-panel')); + driveFunction = 0; + } + var checkboxes = $(this).parent().find('input[name="ivpSchedule"]:checked'); + var ivpSchedule = ""; + for ( var i=0, n=checkboxes.length; i' ); + $('#' + statBarId).find('img').show(); + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'webrun', + tgt : '', + args : 'verifynode '+ argList, + msg : 'out=' + statBarId + ';cmd=verifynode' + }, + success : function(data) { + updateStatusBar(data); + readIvpTable(); + } + }); + + // Show status bar + statBar.show(); + } + }); + verifyXCATForm.append( scheduleBtn ); + + var removeBtn = createButton( 'Remove an IVP Run' ); + removeBtn.click(function() { + var driveFunction = 1; + var argList = ''; + + // Remove any warning messages + $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); + + var ivpId = $(this).parent().find('select[name=ivpId]').val(); + if ( ivpId != 'NEW' ) { + argList = '||--remove' + '||--id ' + ivpId + '||end'; + } else { + // Show warning message + var warn = createWarnBar('You did not select the ID of an existing run.'); + warn.prependTo($(this).parents('.ui-tabs-panel')); + driveFunction = 0; + } + + if ( driveFunction == 1 ) { + $('#' + statBarId).find('div').append( 'Invoking verifynode to remove the IVP.
        ' ); + $('#' + statBarId).find('img').show(); + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'webrun', + tgt : '', + args : 'verifynode '+ argList, + msg : 'out=' + statBarId + ';cmd=verifynode' + }, + success : function(data) { + updateStatusBar(data); + readIvpTable(); + } + }); + + // Show status bar + statBar.show(); + } + }); + verifyXCATForm.append( removeBtn ); + + tab.add( newTabId, 'Verify xCAT', verifyXCATForm, false ); + +} + + +/** + * Get node tab + * + * @return Tab object + */ +function getHelpTab() { + return helpTab; +} + + +/** + * Drive the tabdump API to obtain the scheduled IVP information. + * + * @param None. + */ +function readIvpTable() { + // Get IVP information + if (!$.cookie('xcat_ivpinfo')){ + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'tabdump', + tgt : '', + args : 'zvmivp', + msg : '' + }, + + success : setArrays + }); + } +} + + +/** + * Decodes a printable hex string back into the javascript + * unicode string that it represents. + * + * @param hexVal Printable hex string to convert + * back into its original javascript string form. + */ +hexDecode = function( hexVal ){ + var result = ""; + + if ( hexVal.match("^HexEncoded:") ) { + hexVal = hexVal.replace( 'HexEncoded:', '' ); + var hexes = hexVal.match(/.{1,4}/g) || []; + for( var i = 0; i < hexes.length; i++ ) { + result += String.fromCharCode( parseInt( hexes[i], 16 ) ); + } + } else { + result = hexVal; + } + + return result; +} + + +/** + * Encode a string into printable hex. This avoids + * an issues with escaping quotes or handling unicode. + * + * @param str String to encode into printable hex. + */ +function hexEncode( str ){ + var hex; + + var result = 'HexEncoded:'; + for (var i=0; i < str.length; i++) { + hex = str.charCodeAt(i).toString(16); + result += ("000"+hex).slice(-4); + } + + return result; +} + + +/** + * Setup the arrays/hashes with the data from the zvmivp table + * + * @param data Data from HTTP request + */ +function setArrays(data) { + // Get response + var rsp = data.rsp; + + // Clear the list of IVP information. + ivpChoices = new Array(); + ivpChoiceValues = new Array(); + selectInfo = new Object(); + + // Get column value + var idPos = 0; + var ipPos = 0; + var schedulePos = 0; + var lrPos = 0; + var torPos = 0; + var aUserPos = 0; + var oParmsPos = 0; + var pParmsPos = 0; + var mainParmsPos = 0; + var cmntPos = 0; + + var colNameArray = rsp[0].substr(1).split(','); + for ( var i in colNameArray ) { + switch ( colNameArray[i] ) { + case 'id': + idPos = i; + break; + case 'ip': + ipPos = i; + break; + case 'schedule': + schedulePos = i; + break; + case 'last_run': + lrPos = i; + break; + case 'type_of_run': + typeOfRunPos = i; + break; + case 'access_user': + aUserPos = i; + break; + case 'orch_parms': + oParmsPos = i; + break; + case 'prep_parms': + pParmsPos = i; + break; + case 'main_ivp_parms': + mainParmsPos = i; + break; + case 'comments': + cmntPos = i; + break; + case 'disable': + disablePos = i; + break; + default : + break; + } + } + + // Get IVP information from the table data. + for (var i = 1; i < rsp.length; i++) { + var cols = rsp[i].split(','); + var id = cols[idPos].replace(new RegExp('"', 'g'), ''); + var ip = cols[ipPos].replace(new RegExp('"', 'g'), ''); + var schedule = cols[schedulePos].replace(new RegExp('"', 'g'), ''); + var typeOfRun = cols[typeOfRunPos].replace(new RegExp('"', 'g'), ''); + var openstackUser = cols[aUserPos].replace(new RegExp('"', 'g'), ''); + var orchParms = cols[oParmsPos].replace(new RegExp('"', 'g'), ''); + var prepParms = cols[pParmsPos].replace(new RegExp('"', 'g'), ''); + var mainParms = cols[mainParmsPos].replace(new RegExp('"', 'g'), ''); + var comments = cols[cmntPos].replace(new RegExp('"', 'g'), ''); + var disable = cols[disablePos].replace(new RegExp('"', 'g'), ''); + + ivpChoiceValues.push( id ); + selectInfo[id] = new Object(); + selectInfo[id]['id'] = id; + selectInfo[id]['ip'] = ip; + selectInfo[id]['schedule'] = schedule; + selectInfo[id]['typeOfRun'] = typeOfRun.toLowerCase(); + selectInfo[id]['openstackUser'] = hexDecode( openstackUser ); + selectInfo[id]['orchParms'] = hexDecode( orchParms ); + selectInfo[id]['prepParms'] = hexDecode( prepParms ); + selectInfo[id]['mainParms'] = hexDecode( mainParms ); + selectInfo[id]['comments'] = hexDecode(comments); + selectInfo[id]['disable'] = disable.toLowerCase(); + } + + // Sort the choices so we get a pretty list and build the choice strings. + ivpChoiceValues.sort( function(a, b) { + if ( ! isNaN(a) && ! isNaN(b) ) { + // Both are numbers, do a numeric compare + return a-b; + } else if ( isNaN(a) && isNaN(b) ) { + // Both are strings, do a string compare + return a.localeCompare( b ); + } else if ( isNaN(a) ) { + // Strings go after numbers + return 1; + } else { + // Numbers go before strings + return -1; + } + } ); + ivpChoiceValues.forEach( function( id ) { + var idComments; + if ( selectInfo[id]['comments'] != '' ) { + idComments = id + ': ' + selectInfo[id]['comments']; + } else { + idComments = id + ': A comment was not specified.'; + } + ivpChoices.push( idComments ); + }, this); + + // Clear out a hash element for the 'NEW' choice. + selectInfo['NEW'] = new Object(); + selectInfo['NEW']['id'] = ''; + selectInfo['NEW']['ip'] = ''; + selectInfo['NEW']['schedule'] = ''; + selectInfo['NEW']['typeOfRun'] = ''; + selectInfo['NEW']['openstackUser'] = ''; + selectInfo['NEW']['orchParms'] = ''; + selectInfo['NEW']['prepParms'] = ''; + selectInfo['NEW']['mainParms'] = ''; + selectInfo['NEW']['comments'] = ''; + selectInfo['NEW']['disable'] = ''; + + // Add in the NEW option at the top of the array. + ivpChoices.unshift( "NEW: New IVP" ); + ivpChoiceValues.unshift( "NEW" ); + + // Construct the new Select option choices + var ivpChoicesLen = ivpChoices.length; + var selectIdOptions = ''; + for ( var i = 0; i < ivpChoicesLen; i++ ) { + selectIdOptions += ''; + } + + // Find the division containing the select and replace its contents + var thisTabId = $(this).parents('.tab').attr('id'); + var thisIvpSelect = $( '#' + thisTabId + ' select[name=ivpId]' ); + thisIvpSelect.children().remove(); + thisIvpSelect.append( selectIdOptions ); +} + + +/** + * Set node tab + * + * @param tab + * Tab object + * @return Nothing + */ +function setHelpTab(tab) { + helpTab = tab; +} + + +/** + * Set IVP variables based on the chosen Id + * + * @param data Data from HTTP request + */ +function setVarsForId( selected ) { + var id = selected.value; + + // Change the form fields based on the selected ID. + var thisTabId = $(this).parents('.tab').attr('id'); + + var thisField = $( '#' + thisTabId + ' input[name="runType"]' ); + if ( selectInfo[id]['typeOfRun'] == 'basicivp' ) { + thisField.val(['verifyBasic']); + } else if ( selectInfo[id]['typeOfRun'] == 'fullivp' ) { + thisField.val(['verifyOpenStack']); + } else { + var warn = createWarnBar('IVP with the id of '+id+' has an unrecognized type of run value: '+selectInfo[id]['typeOfRun']); + warn.prependTo($(this).parents('.ui-tabs-panel')); + } + + thisField = $( '#' + thisTabId + ' input[name=orchParms]' ); + thisField.val( selectInfo[id]['orchParms'] ); + + thisField = $( '#' + thisTabId + ' input[name=prepParms]' ); + thisField.val( selectInfo[id]['prepParms'] ); + + var thisfield = $( '#' + thisTabId + ' input[name=mainParms]' ); + thisfield.val( selectInfo[id]['mainParms'] ); + + thisField = $( '#' + thisTabId + ' input[name=openstackIP]' ); + thisField.val( selectInfo[id]['ip'] ); + + thisField = $( '#' + thisTabId + ' input[name=openstackUser]' ); + thisField.val( selectInfo[id]['openstackUser'] ); + + var hours = new Object(); + var fullDay = 1; + var hour = selectInfo[id]['schedule'].split(' '); + for ( var j = 0; j < hour.length; j++ ) { + hours[hour[j]] = 1; + } + + for (var i = 0; i <= 23; i++) { + thisField = $( '#' + thisTabId + ' input[name=ivpSchedule][value='+i+']' ); + if ( hours[i] == 1 ) { + thisField.attr( 'checked', true ); + } else { + fullDay = 0; + thisField.attr( 'checked', false ); + } + } + if ( fullDay == 1 ) { + thisField = $( '#' + thisTabId + ' input[name=ivpSchedule][value=Every hour]' ); + thisField.attr( 'checked', true ); + for (var i = 0; i <= 23; i++) { + thisField = $( '#' + thisTabId + ' input[name=ivpSchedule][value='+i+']' ); + thisField.attr( 'checked', false ); + } + } + + thisField = $( '#' + thisTabId + ' input[name=comments]' ); + thisField.val( selectInfo[id]['comments'] ); + + thisField = $( '#' + thisTabId + ' input[name=disable]' ); + if ( selectInfo[id]['disable'] == 1 || selectInfo[id]['disable'] == 'yes' ) { + thisField.val(['disabled']); + } else if ( selectInfo[id]['disable'] == '' || selectInfo[id]['disable'] == 0 ) { + thisField.val(['enabled']); + } else { + var warn = createWarnBar('IVP with the id of '+id+' has an unrecognized disable value: '+selectInfo[id]['disable']); + warn.prependTo($(this).parents('.ui-tabs-panel')); + } +} + + +/** + * Update status bar of a given tab + * + * @param data Data returned from HTTP request + */ +function updateStatusBar(data) { + // Get ajax response + var rsp = data.rsp; + var args = data.msg.split(';'); + var statBarId = ''; + var cmd = ''; + for ( var i=0; i < args.length; i++ ) { + if ( args[i].match('^cmd=') ) { + cmd = args[i].replace('cmd=', ''); + } else if ( args[i].match('^out=') ) { + statBarId = args[i].replace('out=', ''); + } + } + + if (cmd == 'verifynode') { + // Hide loader + $('#' + statBarId).find('img').hide(); + + // Write ajax response to status bar + var prg = writeRsp(rsp, ''); + $('#' + statBarId).find('div').append(prg); + + // Put a check box after the response. + var icon = $('').css({ + 'vertical-align': 'top' + }); + $('#' + statBarId).find( 'div' ).append(icon); + $('#' + statBarId).find( 'div' ).append( '

        ' ); + } else { + // Hide loader + $('#' + statBarId).find('img').hide(); + + // Write ajax response to status bar + var prg = writeRsp(rsp, ''); + $('#' + statBarId).find('div').append(prg); + } +} diff --git a/xCAT-UI/js/monitor/gangliamon.js b/xCAT-UI/js/monitor/gangliamon.js index a5e93b656..411d6a382 100644 --- a/xCAT-UI/js/monitor/gangliamon.js +++ b/xCAT-UI/js/monitor/gangliamon.js @@ -8,8 +8,8 @@ var gridData; // Save nodes path, used for getting detail from rrd file var nodePath = new Object(); -// Save nodes current status, -// unknown = -2, error = -1, warning = 0, normal = 1 are used for sorting +// Save nodes current status, +// unknown = -2, error = -1, warning = 0, normal = 1 are used for sorting var nodeStatus = new Object(); // Update timer @@ -28,14 +28,14 @@ var otherhash; /** * Load Ganglia monitoring tool - * + * * @return Nothing */ function loadGangliaMon() { $('#gangliamon').append(createInfoBar('Checking RPMs')); - + // Get groups and set cookie - if (!$.cookie('groups')) { + if (!$.cookie('xcat_groups')) { $.ajax( { url : 'lib/cmd.php', dataType : 'json', @@ -49,7 +49,7 @@ function loadGangliaMon() { success : setGroupsCookies }); } - + // Check whether Ganglia RPMs are installed on the xCAT MN $.ajax({ url : 'lib/systemcmd.php', @@ -65,13 +65,13 @@ function loadGangliaMon() { /** * Check whether Ganglia RPMs are installed - * + * * @param data Data returned from HTTP request */ function checkGangliaRPMs(data) { var gangliaTab = $('#gangliamon'); gangliaTab.empty(); - + // Get the list of Ganglia RPMs installed var status = data.rsp.split(/\n/); var gangliaRPMs = ["rrdtool", "ganglia-gmetad", "ganglia-gmond"]; @@ -91,7 +91,7 @@ function checkGangliaRPMs(data) { warningBar.prependTo(gangliaTab); } else { gangliaTab.append(createInfoBar('Checking running status')); - + // Check if ganglia is running on the xCAT MN $.ajax( { url : 'lib/cmd.php', @@ -106,19 +106,19 @@ function checkGangliaRPMs(data) { success : checkGangliaRunning }); } - + return; } /** * Check whether Ganglia is running - * + * * @param data Data returned from HTTP request */ function checkGangliaRunning(data) { var gangliaTab = $('#gangliamon'); gangliaTab.empty(); - + // If Ganglia is not started if (data.rsp[0].indexOf("not-monitored") > -1) { // Create link to start Ganglia @@ -151,13 +151,13 @@ function checkGangliaRunning(data) { // If there are any warning messages, append this warning after it var curWarnings = $('#gangliamon').find('.ui-state-error'); - + if (curWarnings.length) { curWarnings.after(warningBar); } else { warningBar.prependTo(gangliaTab); } - + return; } @@ -168,7 +168,7 @@ function checkGangliaRunning(data) { ' Error' + ' Unknown' + ''; - + // Gganglia grid overview var showStr = '

        Grid Overview

        ' + '[Hide]

        ' + @@ -181,11 +181,11 @@ function checkGangliaRunning(data) { // Get summary data and draw on page $('#gangliaGridSummary').append('Getting grid summary data '); sendGridSummaryAjax(); - + // Get all nodes location data which can support the zoom monitor $('#gangliaNodes').append('Getting all nodes status '); sendLocationAjax(); - + // Bind the hide/show button event $('#gangliamon #hidesup').bind('click', function(){ if ('[Hide]' == $(this).text()) { @@ -193,7 +193,7 @@ function checkGangliaRunning(data) { } else { $(this).html('[Hide]'); } - + $('#gangliaGridSummary').toggle(); }); } @@ -211,16 +211,16 @@ function sendLocationAjax() { args : 'graph', msg : '' }, - + success: function(data){ if (!data.rsp[0]) { return; } - + extractLocationlData(data.rsp[0]); // Get nodes current status and draw on the page sendNodeCurrentAjax(); - + // Start the timer to update page per minute gangliaTimer = window.setTimeout('updateGangliaPage()', 60000); } @@ -235,14 +235,14 @@ function extractLocationlData(locationData) { cechash = new Object(); bladehash = new Object(); rackhash = new Object(); - + // Linux nodes which has no parent linuxArray = new Array(); - + // Other unknown nodes only have one parent, use number 1 as there parent otherhash = new Object(); otherhash[1] = new Array(); - + var allnodearray = locationData.split(';'); var temparray; var parent = ''; @@ -250,7 +250,7 @@ function extractLocationlData(locationData) { for (var i in allnodearray) { temparray = allnodearray[i].split(':'); name = temparray[0]; - + // If there is not parent (or mpa, or rack) information parent = temparray[2]; if (!parent) { @@ -258,26 +258,26 @@ function extractLocationlData(locationData) { otherhash[1].push(name); continue; } - + switch (temparray[1].toLowerCase()) { case 'blade': { if (!bladehash[parent]) { bladehash[parent] = new Array(); } - + bladehash[parent].push(name); } break; - + case 'systemx': { if (!rackhash[parent]) { rackhash[parent] = new Array(); } - + rackhash[parent].push(name); } break; - + case 'frame': { if (!framehash[name]) { framehash[name] = new Array(); @@ -289,21 +289,21 @@ function extractLocationlData(locationData) { if (!framehash[parent]) { framehash[parent] = new Array(); } - + framehash[parent].push(name); } break; - + case 'lpar': case 'lpar,osi': case 'osi,lpar': { if (!cechash[parent]) { cechash[parent] = new Array(); } - + cechash[parent].push(name); } - + break; default: { otherhash[1].push(name); @@ -327,7 +327,7 @@ function sendGridSummaryAjax() { args : 'gangliashow;_grid_;hour;_summary_', msg : '' }, - + success: function(data) { createGridSummaryData(data.rsp[0]); drawGridSummary(); @@ -339,7 +339,7 @@ function sendGridSummaryAjax() { * Send AJAX request to get nodes current load information */ function sendNodeCurrentAjax() { - + // Get all nodes current status $.ajax({ url : 'lib/cmd.php', @@ -350,7 +350,7 @@ function sendNodeCurrentAjax() { args : 'gangliacurrent;node;', msg : '' }, - + success: function(data){ createNodeStatusData(data.rsp[0]); drawGangliaNodesArea($('#gangliaorder').val()); @@ -372,7 +372,7 @@ function sendGridCurrentAjax(){ args : 'gangliacurrent;grid', msg : '' }, - + success: function(data){ updateGridSummaryData(data.rsp[0]); drawGridSummary(); @@ -381,13 +381,13 @@ function sendGridCurrentAjax(){ } /** - * Save the grid summary data to local global variable + * Save the grid summary data to local global variable */ function createGridSummaryData(summaryString){ // Empty the global data // The data structure looks like: metric1:time11,val11,time12,val12,...;metric2:time21,val21,time22,val22,...;.... gridData = new Object(); - + var metricArray = summaryString.split(';'); var metricname = ''; var valueArray = ''; @@ -395,13 +395,13 @@ function createGridSummaryData(summaryString){ var tempLength = 0; for (var index = 0; index < metricArray.length; index++) { position = metricArray[index].indexOf(':'); - + // Get the metric name and init its global array to save timestamp and value pair metricname = metricArray[index].substr(0, position); gridData[metricname] = new Array(); valueArray = metricArray[index].substr(position + 1).split(','); tempLength = valueArray.length; - + // Save timestamp and value into global array for (var i = 0; i < tempLength; i++) { gridData[metricname].push(Number(valueArray[i])); @@ -420,7 +420,7 @@ function updateGridSummaryData(currentString){ var tempLength = 0; var index = 0; var tempArray; - + tempLength = metricArray.length; for (index = 0; index < tempLength; index++) { position = metricArray[index].indexOf(':'); @@ -442,19 +442,19 @@ function drawGridSummary() { var gridDrawArea = $('#gangliaGridSummary'); var showStr = ''; var tempStr = $('#gangliamon').attr('class'); - + // jqflot only draws on the visible area // If the tab is hide, return directly if (tempStr.indexOf('hide') != -1) { return; } - + if ($('#gangliamon #hidesup').text() == '[Show]') { return; } - + gridDrawArea.empty(); - showStr = '' + + showStr = '
        ' + '' + '' + '' + @@ -470,7 +470,7 @@ function drawGridSummary() { /** * Draw the load flot by data (summary data or one node data) - * + * * @param areaid Which DIV draw this flot * @param loadpair The load timestamp and value pair * @param cpupair The CPU number and value pair @@ -481,7 +481,7 @@ function drawLoadFlot(areaid, titleprefix, loadpair, cpupair) { var index = 0; var yaxismax = 0; var interval = 1; - + $('#' + areaid).empty(); // Parse load pair, the timestamp must mutiply 1000, javascript time stamp is millisecond for (index = 0; index < loadpair.length; index += 2) { @@ -490,7 +490,7 @@ function drawLoadFlot(areaid, titleprefix, loadpair, cpupair) { yaxismax = loadpair[index + 1]; } } - + // Parse cpu pair for (index = 0; index < cpupair.length; index += 2) { cpunum.push([cpupair[index] * 1000, cpupair[index + 1]]); @@ -498,12 +498,12 @@ function drawLoadFlot(areaid, titleprefix, loadpair, cpupair) { yaxismax = cpupair[index + 1]; } } - + interval = parseInt(yaxismax / 3); if (interval < 1) { interval = 1; } - + $.jqplot(areaid, [load, cpunum], { title: titleprefix + ' Loads/Procs Last Hour', axes:{ @@ -531,7 +531,7 @@ function drawLoadFlot(areaid, titleprefix, loadpair, cpupair) { /** * Draw the CPU usage flot by data (maybe summary data or one node data) - * + * * @param areaid Which DIV draw this flot * @param titleprefix Title used name * @param cpupair The CPU timestamp and value pair @@ -539,15 +539,15 @@ function drawLoadFlot(areaid, titleprefix, loadpair, cpupair) { function drawCpuFlot(areaid, titleprefix, cpupair) { var cpu = new Array(); var index = 0; - + $('#' + areaid).empty(); - + // Time stamp should be mutiplied by 1000 // We get the CPU idle from server for (index = 0; index < cpupair.length; index +=2) { cpu.push([(cpupair[index] * 1000), (100 - cpupair[index + 1])]); } - + $.jqplot(areaid, [cpu],{ title: titleprefix + ' Cpu Use Last Hour', axes:{ @@ -571,7 +571,7 @@ function drawCpuFlot(areaid, titleprefix, cpupair) { /** * Draw the memory usage flot by data (summary data or one node data) - * + * * @param areaid Which DIV draw this flot * @param titleprefix Title used name * @param cpupair The CPU timestamp and value pair @@ -581,14 +581,14 @@ function drawMemFlot(areaid, titleprefix, freepair, totalpair){ var total = new Array(); var tempsize = 0; var index = 0; - + $('#' + areaid).empty(); if (freepair.length < totalpair.length) { tempsize = freepair.length; } else { tempsize = freepair.length; } - + for (index = 0; index < tempsize; index += 2) { var temptotal = totalpair[index + 1]; var tempuse = temptotal - freepair[index + 1]; @@ -597,7 +597,7 @@ function drawMemFlot(areaid, titleprefix, freepair, totalpair){ total.push([totalpair[index] * 1000, temptotal]); use.push([freepair[index] * 1000, tempuse]); } - + $.jqplot(areaid, [use, total], { title: titleprefix + ' Memory Use Last Hour', axes:{ @@ -625,7 +625,7 @@ function drawMemFlot(areaid, titleprefix, freepair, totalpair){ /** * Draw the disk usage flot by data (summary data or one node's data) - * + * * @param areaid Which div draw this flot * @param titleprefix Title used name * @param freepair The free disk number, Ganglia only logs the free data @@ -636,21 +636,21 @@ function drawDiskFlot(areaid, titleprefix, freepair, totalpair) { var total = new Array(); var tempsize = 0; var index = 0; - + $('#' + areaid).empty(); if (freepair.length < totalpair.length) { tempsize = freepair.length; } else{ tempsize = freepair.length; } - + for (index = 0; index < tempsize; index += 2) { var temptotal = totalpair[index + 1]; var tempuse = temptotal - freepair[index + 1]; total.push([totalpair[index] * 1000, temptotal]); use.push([freepair[index] * 1000, tempuse]); } - + $.jqplot(areaid, [use, total], { title: titleprefix + ' Disk Use Last Hour', axes:{ @@ -678,7 +678,7 @@ function drawDiskFlot(areaid, titleprefix, freepair, totalpair) { /** * Draw the network load flot by data (summary data or one node data) - * + * * @param areaid Which div draw this flot * @param titleprefix Title used name * @param inpair The timestamp and value pair for download @@ -691,19 +691,19 @@ function drawNetworkFlot(areaid, titleprefix, inpair, outpair) { var maxvalue = 0; var unitname = 'B'; var divisor = 1; - + for (index = 0; index < inpair.length; index += 2) { if (inpair[index + 1] > maxvalue) { maxvalue = inpair[index + 1]; } } - + for (index = 0; index < outpair.length; index += 2) { if (outpair[index + 1] > maxvalue) { maxvalue = outpair[index + 1]; } } - + if (maxvalue > 3000000) { divisor = 1000000; unitname = 'GB'; @@ -713,15 +713,15 @@ function drawNetworkFlot(areaid, titleprefix, inpair, outpair) { } else { // Do nothing } - + for (index = 0; index < inpair.length; index += 2) { inArray.push([(inpair[index] * 1000), (inpair[index + 1] / divisor)]); } - + for (index = 0; index < outpair.length; index += 2) { outArray.push([(outpair[index] * 1000), (outpair[index + 1] / divisor)]); } - + $.jqplot(areaid, [inArray, outArray], { title: titleprefix + ' Network Last Hour', axes:{ @@ -749,7 +749,7 @@ function drawNetworkFlot(areaid, titleprefix, inpair, outpair) { /** * Create node status data - * + * * @param nodesStatus Node status */ function createNodeStatusData(nodesStatus) { @@ -759,15 +759,15 @@ function createNodeStatusData(nodesStatus) { var index = 0; var tempArray; var tempStr = ''; - + for (index in nodePath) { delete(nodePath[index]); } - + for (index in nodeStatus) { delete(nodeStatus[index]); } - + for (index = 0; index < nodesArray.length; index++) { tempStr = nodesArray[index]; position = tempStr.indexOf(':'); @@ -785,18 +785,18 @@ function createNodeStatusData(nodesStatus) { */ function drawGangliaNodesArea() { var position = 0; - + // Find out the last child's type and name var currentobj = $('#zoomDiv span:last'); var type = currentobj.attr('name').toLowerCase(); var name = currentobj.text(); position = name.indexOf('('); - + if (position > -1) { name = name.substr(3, position - 3); } $('#gangliaNodes').empty(); - + switch (type) { // Draw the node current status case 'blade': @@ -806,7 +806,7 @@ function drawGangliaNodesArea() { drawGangliaNodesAreaPic(type, name); } break; - + // Draw a summary table case 'all': case 'frame': { @@ -825,7 +825,7 @@ function drawGangliaNodesAreaPic(type, name) { var showStr = ''; var nodename = ''; var temparray; - + switch(type) { case 'blade': { arraypoint = bladehash[name]; @@ -846,10 +846,10 @@ function drawGangliaNodesAreaPic(type, name) { break; } $('#gangliaNodes').html('
          '); - + temparray = arraypoint.sort(); templength = arraypoint.length; - + for (index = 0; index < templength; index++) { nodename = temparray[index]; switch (nodeStatus[nodename]) { @@ -868,7 +868,7 @@ function drawGangliaNodesAreaPic(type, name) { } $('#gangliaNodes ul').append(showStr); } - + // Bind all normal and warning nodes click event $('.monitor-normal,.monitorwarning').bind('click', function() { var nodename = $(this).attr('title'); @@ -881,45 +881,45 @@ function drawGangliaNodesAreaTable(type, name) { var table = $('
          '); var row = ''; var usedCec = new Object(); - + var header = $(' NameTypeNormalHeavy LoadErrorUnknown '); table.append(header); - + if (type == 'all') { for (var i in framehash) { var framename = i; - row = '' + framename + 'Frame' + + row = '' + framename + 'Frame' + monitorStatAgg('frame', framehash[i]) + ''; table.append(row); for(var j in framehash[i]){ usedCec[framehash[i][j]] = 1; } } - + for (var i in cechash) { if (usedCec[i]) { continue; } var cecname = i; - row = '' + cecname + 'CEC' + + row = '' + cecname + 'CEC' + monitorStatAgg('cec', cechash[i]) + ''; table.append(row); } - + for (var i in bladehash) { var bladename = i; - row = '' + bladename + 'Blade' + + row = '' + bladename + 'Blade' + monitorStatAgg('blade', bladehash[i]) + ''; table.append(row); } - + for (var i in rackhash) { var rackname = i; row = '' + rackname + 'Rack' + monitorStatAgg('rack', rackhash[i]) + ''; table.append(row); } - + if (otherhash[1].length > 0) { row = 'OtherOther' + monitorStatAgg('other', otherhash[1]) + ''; @@ -933,7 +933,7 @@ function drawGangliaNodesAreaTable(type, name) { table.append(row); } } - + $('#gangliaNodes').append(table); } @@ -947,7 +947,7 @@ function monitorStatAgg(type, inputarray) { var nuknownnum = 0; var tempArray; var tempname; - + switch (type) { case 'blade': case 'cec': @@ -970,7 +970,7 @@ function monitorStatAgg(type, inputarray) { return; break; } - + for (var i in tempArray) { tempname = tempArray[i]; switch(nodeStatus[tempname]) { @@ -988,12 +988,12 @@ function monitorStatAgg(type, inputarray) { break; } } - + normalnum = normalnum?normalnum:'-'; warningnum = warningnum?warningnum:'-'; errornum = errornum?errornum:'-'; nuknownnum = nuknownnum?nuknownnum:'-'; - + return ('' + normalnum + '' + warningnum + '' + errornum + '' + nuknownnum + ''); } @@ -1004,10 +1004,10 @@ function updateGangliaPage() { if ($('#gangliaNodes').size() < 1) { return; } - + sendGridCurrentAjax(); sendNodeCurrentAjax(); - + gangliaTimer = window.setTimeout('updateGangliaPage()', 60000); } @@ -1021,7 +1021,7 @@ function updateZoom(obj) { } $(obj).removeClass('monitor-zoom-link'); $(obj).unbind('click'); - + drawGangliaNodesArea(); } @@ -1031,16 +1031,16 @@ function updateZoom(obj) { function addZoomDiv(obj) { var name = $(obj).text(); var type = $(obj).attr('name'); - + var lastzoomobj = $('#zoomDiv span:last'); lastzoomobj.addClass('monitor-zoom-link'); lastzoomobj.bind('click', function() { updateZoom(this); }); - + var newcontent = ' > ' + name + '(' + type.toUpperCase() + ')'; var newli = '' + newcontent + ''; $('#zoomDiv').append(newli); - + drawGangliaNodesArea(); } \ No newline at end of file diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index 0ded38d52..769aa5e87 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -97,7 +97,7 @@ function loadNodesPage() { success : function(data){ loadGroups(data); - var cookieGroup = $.cookie('selectgrouponnodes'); + var cookieGroup = $.cookie('xcat_selectgrouponnodes'); if (cookieGroup) { $('#groups .groupdiv div').each(function(){ if ($(this).text() == cookieGroup){ @@ -231,7 +231,7 @@ function loadGroups(data) { $(this).addClass('selectgroup'); // Save selected group into cookie - $.cookie('selectgrouponnodes', thisGroup, { expires: 7 }); + $.cookie('xcat_selectgrouponnodes', thisGroup, { expires: 7, path: '/xcat', secure:true }); drawNodesArea(thisGroup,'',thisGroup); }); @@ -347,8 +347,8 @@ function drawNodesArea(targetgroup, cmdargs, message){ // Get last view (if any) // This can be summary, nodes, or graphic - if ($.cookie('tabindex_history')) { - var order = $.cookie('tabindex_history').split(','); + if ($.cookie('xcat_tabindex_history')) { + var order = $.cookie('xcat_tabindex_history').split(','); order[0] = parseInt(order[0]); order[1] = parseInt(order[1]); if (order[0] == 0 || order[1] == 0) { @@ -1095,7 +1095,7 @@ function loadNodes(data) { // Remove any warning messages $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); - var zhcpsCheck = $.cookie('zhcps').split(','); + var zhcpsCheck = $.cookie('xcat_zhcps').split(','); var zhcpHash = new Object(); for (var h in zhcpsCheck) { if (!zhcpHash[zhcpsCheck[h]]) { @@ -1917,7 +1917,7 @@ function loadNode(e) { newTabId = 'nodeTab' + inst; } // Reset node process - $.cookie(node + 'Processes', 0); + $.cookie('xcat_' + node + 'Processes', 0, { path: '/xcat', secure:true }); // Add new tab, only if one does not exist var loader = createLoader(newTabId + 'TabLoader'); @@ -2909,28 +2909,28 @@ function setOSImageCookies(data) { } // Save image names in a cookie - $.cookie('imagenames', imageNames); + $.cookie('xcat_imagenames', imageNames, { path: '/xcat', secure:true }); // Save profiles in a cookie var tmp = new Array; for (var key in profilesHash) { tmp.push(key); } - $.cookie('profiles', tmp); + $.cookie('xcat_profiles', tmp, { path: '/xcat', secure:true }); // Save OS versions in a cookie tmp = new Array; for (var key in osVersHash) { tmp.push(key); } - $.cookie('osvers', tmp); + $.cookie('xcat_osvers', tmp, { path: '/xcat', secure:true }); // Save OS architectures in a cookie tmp = new Array; for (var key in osArchsHash) { tmp.push(key); } - $.cookie('osarchs', tmp); + $.cookie('xcat_osarchs', tmp, { path: '/xcat', secure:true }); } /** @@ -2940,7 +2940,7 @@ function setOSImageCookies(data) { */ function setGroupsCookies(data) { var rsp = data.rsp; - $.cookie('groups', rsp); + $.cookie('xcat_groups', rsp, { path: '/xcat', secure:true }); } /** @@ -4202,7 +4202,7 @@ function advancedLoad(group){ zhcpHash[args[0]] = 1; // If there are no disk pools or network names cookie for this hcp - if (!$.cookie(args[0] + 'diskpools') || !$.cookie(args[0] + 'networks')) { + if (!$.cookie('xcat_' + args[0] + 'diskpools') || !$.cookie('xcat_' + args[0] + 'networks')) { // Check if SMAPI is online $.ajax({ url : 'lib/cmd.php', @@ -4226,7 +4226,7 @@ function advancedLoad(group){ setzHcpCookies(shortzHcps); // Retrieve z/VM hypervisors and their zHCPs - if (!$.cookie('zvms')) { + if (!$.cookie('xcat_zvms')) { $.ajax( { url : 'lib/cmd.php', dataType : 'json', diff --git a/xCAT-UI/js/nodes/nodeset.js b/xCAT-UI/js/nodes/nodeset.js index aea3ea310..c1b2acfe8 100644 --- a/xCAT-UI/js/nodes/nodeset.js +++ b/xCAT-UI/js/nodes/nodeset.js @@ -87,7 +87,7 @@ function loadNodesetPage(tgtNodes) { var osSelect = $(''); osSelect.append($('')); - var imageNames = $.cookie('imagenames').split(','); + var imageNames = $.cookie('xcat_imagenames').split(','); if (imageNames) { imageNames.sort(); for (var i in imageNames) { diff --git a/xCAT-UI/js/nodes/physical.js b/xCAT-UI/js/nodes/physical.js index 227a002cf..e8df2d4c8 100644 --- a/xCAT-UI/js/nodes/physical.js +++ b/xCAT-UI/js/nodes/physical.js @@ -9,7 +9,7 @@ var selectNode; /** * Get all nodes useful attributes from remote server - * + * * @param dataTypeIndex The index in the array which contains attributes we need. * @param attrNullNode The target node list for this attribute */ @@ -36,7 +36,7 @@ function initGraphicalData() { /** * Extract all nodes userful data into a hash, which will be used for creating graphical - * + * * @param data The response from xCAT command 'nodels all nodetype.nodetype ppc.parent ...' * @return nodes list for next time query */ @@ -115,7 +115,7 @@ function createPhysicalLayout(nodeList) { } function getNodesAndDraw() { - var groupName = $.cookie('selectgrouponnodes'); + var groupName = $.cookie('xcat_selectgrouponnodes'); $.ajax({ url : 'lib/cmd.php', dataType : 'json', @@ -183,64 +183,64 @@ function fillList(nodeName, defaultnodetype) { } switch (nodeType) { - case 'frame': + case 'frame': if (undefined == bpaList[nodeName]) { bpaList[nodeName] = new Array(); } - + break; case 'lpar,osi': case 'lpar': - case 'osi': + case 'osi': if ('' == parentName) { break; } - + if (undefined == fspList[parentName]) { fillList(parentName, 'cec'); } - + fspList[parentName]['children'].push(nodeName); lparList[nodeName] = status; - + break; - case 'cec': + case 'cec': if (undefined != fspList[nodeName]) { break; } - + fspList[nodeName] = new Object(); fspList[nodeName]['children'] = new Array(); fspList[nodeName]['mtm'] = mtm; - + if ('' == parentName) { break; } - + if (undefined == bpaList[parentName]) { fillList(parentName, 'frame'); } - + bpaList[parentName].push(nodeName); break; - case 'blade': + case 'blade': if (undefined == bladeList[mpa]) { bladeList[mpa] = new Array(); } bladeList[mpa].push(nodeName + ',' + unit); - + break; - case 'systemx': + case 'systemx': if (!rack) { rack = '_notsupply_'; } - + if (undefined == rackList[rack]) { rackList[rack] = new Array(); } - + rackList[rack].push(nodeName + ',' + unit); - + break; default: unknownList.push(nodeName); @@ -276,8 +276,8 @@ function createGraphical() { /** * Create the physical/graphical layout for System p machines - * - * @param bpa All BPA and their related FSPs + * + * @param bpa All BPA and their related FSPs * @param fsp All FSP and their related LPARs * @param area The element to append graphical layout */ @@ -310,7 +310,7 @@ function createSystempGraphical(bpa, fsp, area) { + '">'); - // For P7-IH, all the CECs are insert into the frame from bottom to up, + // For P7-IH, all the CECs are insert into the frame from bottom to up, // so we have to show the CECs same as the physical layout var tempBlankDiv = $('
          '); var tempHeight = 0; @@ -322,7 +322,7 @@ function createSystempGraphical(bpa, fsp, area) { if ((0 == fspIndex) && ('9125-F2C' == fsp[fspName]['mtm'])) { frameDiv.append(tempBlankDiv); } - + frameDiv.append(createFspDiv(fspName, fsp[fspName]['mtm'], fsp)); frameDiv.append(createFspTip(fspName, fsp[fspName]['mtm'], fsp)); @@ -430,7 +430,7 @@ function createSystempGraphical(bpa, fsp, area) { changeNode(lparName, 'unselect'); } } - + // No selected LPARs on the cec, so add all LPARs into selectNode hash else { for (var lparIndex in fspList[fspName]['children']) { @@ -458,8 +458,8 @@ function createSystempGraphical(bpa, fsp, area) { /** * Create the physical/graphical layout for blades - * - * @param blades The blade list in global + * + * @param blades The blade list in global * @param area The element to append the graphical layout */ function createBladeGraphical(blades, area) { @@ -529,8 +529,8 @@ function createBladeGraphical(blades, area) { /** * Create the physical/graphical layout for System x machines - * - * @param xnodes The system x node list in global + * + * @param xnodes The system x node list in global * @param area The element to append graphical layout */ function createSystemxGraphical(xnodes, area) { @@ -765,7 +765,7 @@ function createFspDiv(fspName, mtm, fsp) { if (lparIndex >= 8) { break; } - + var lparName = fsp[fspName]['children'][lparIndex]; var color = statusMap(lparList[lparName]); lparStatusRow += ''; @@ -778,11 +778,11 @@ function createFspDiv(fspName, mtm, fsp) { } else { temp = mtm; } - + if (!hardwareInfo[temp]){ hardwareInfo[temp] = ['unkown', 2]; } - + if (hardwareInfo[temp][1]) { divClass += 'fspDiv' + hardwareInfo[temp][1]; } else { @@ -830,7 +830,7 @@ function createFspTip(fspName, mtm, fsp) { } /** * Map the LPAR status into a color - * + * * @param status LPAR status in nodelist table * @return Corresponding color name */ @@ -844,7 +844,7 @@ function statusMap(status) { case 'sshd': case 'booting': case 'booted': - case 'ping': + case 'ping': color = 'green'; break; case 'noping': @@ -869,7 +869,7 @@ function selectAllLpars(checkbox) { /** * Export all LPAR names from selectNode - * + * * @return lpars' string */ function getSelectNodes() { @@ -904,7 +904,7 @@ function changeNode(lparName, status) { /** * The P7-IH's CECs are insert from bottom to up, so we had to calculate the blank height - * + * * @return Height for the CEC */ function calculateBlank(mtm) { @@ -917,13 +917,13 @@ function calculateBlank(mtm) { } switch (hardwareInfo[mtm][1]) { - case 1: + case 1: return 13; break; - case 2: + case 2: return 24; break; - case 4: + case 4: return 47; break; default: diff --git a/xCAT-UI/js/nodes/updatenode.js b/xCAT-UI/js/nodes/updatenode.js index a38b7db28..943972e8e 100644 --- a/xCAT-UI/js/nodes/updatenode.js +++ b/xCAT-UI/js/nodes/updatenode.js @@ -1,6 +1,6 @@ /** * Load updatenode page - * + * * @param tgtNodes Targets to run updatenode against */ function loadUpdatenodePage(tgtNodes) { @@ -17,7 +17,7 @@ function loadUpdatenodePage(tgtNodes) { success : setOSImageCookies }); - + // Get node OS var osHash = new Object(); var nodes = tgtNodes.split(','); @@ -28,7 +28,7 @@ function loadUpdatenodePage(tgtNodes) { nodes[osBase] = 1; } } - + // Get nodes tab var tab = getNodesTab(); @@ -40,10 +40,10 @@ function loadUpdatenodePage(tgtNodes) { inst = inst + 1; newTabId = 'updatenodeTab' + inst; } - + // Create rscan form var updatenodeForm = $('
          '); - + // Create status bar var statBarId = 'updatenodeStatusBar' + inst; var statusBar = createStatusBar(statBarId).hide(); @@ -55,35 +55,35 @@ function loadUpdatenodePage(tgtNodes) { // Create info bar var infoBar = createInfoBar('Update nodes in an xCAT environment'); updatenodeForm.append(statusBar, infoBar); - + // Create VM fieldset var vmFS = $('
          '); var vmLegend = $('Virtual Machine'); vmFS.append(vmLegend); updatenodeForm.append(vmFS); - + var vmAttr = $('
          '); vmFS.append($('
          ')); vmFS.append(vmAttr); - + // Create options fieldset var optionsFS = $('
          '); var optionsLegend = $('Options'); optionsFS.append(optionsLegend); updatenodeForm.append(optionsFS); - + var optionsAttr = $('
          '); optionsFS.append($('
          ')); optionsFS.append(optionsAttr); - + // Create target node or group input var tgt = $('
          '); vmAttr.append(tgt); - // Create options + // Create options var optionsList = $('
            '); optionsAttr.append(optionsList); - + // Create update all software checkbox (only AIX) if (osHash['AIX']) { var updateAllOption = $('
          • '); @@ -91,7 +91,7 @@ function loadUpdatenodePage(tgtNodes) { updateAllOption.append(updateAllChkBox); optionsList.append(updateAllOption); updateAllOption.append('Install or update all software contained in the source directory'); - + // Create source directory input var allSwScrDirectory = $('
          • '); // Browse server directory and files @@ -131,14 +131,14 @@ function loadUpdatenodePage(tgtNodes) { } }); } - + // Create update software checkbox var updateOption = $('
          • '); var updateChkBox = $(''); optionsList.append(updateOption); updateOption.append(updateChkBox); updateOption.append('Update existing software'); - + // Create source directory input var scrDirectory = $('
          • '); // Browse server directory and files @@ -168,27 +168,27 @@ function loadUpdatenodePage(tgtNodes) { scrDirectory.append(srcDirBrowse); scrDirectory.hide(); optionsList.append(scrDirectory); - + // Create other packages input var otherPkgs = $('
          • '); otherPkgs.hide(); optionsList.append(otherPkgs); - + // Create RPM flags input (only AIX) var aixRpmFlags = $('
          • '); aixRpmFlags.hide(); optionsList.append(aixRpmFlags); - + // Create installp flags input (only AIX) var aixInstallPFlags = $('
          • '); aixInstallPFlags.hide(); optionsList.append(aixInstallPFlags); - + // Create emgr flags input (only AIX) var aixEmgrFlags = $('
          • '); aixEmgrFlags.hide(); optionsList.append(aixEmgrFlags); - + // Show flags when checked updateChkBox.bind('click', function(event) { if ($(this).is(':checked')) { @@ -209,7 +209,7 @@ function loadUpdatenodePage(tgtNodes) { } } }); - + // Create postscripts input var postOption = $('
          • '); var postChkBox = $(''); @@ -219,7 +219,7 @@ function loadUpdatenodePage(tgtNodes) { var postscripts = $('
          • '); postscripts.hide(); optionsList.append(postscripts); - + // Show alternate source directory when checked postChkBox.bind('click', function(event) { if ($(this).is(':checked')) { @@ -230,7 +230,7 @@ function loadUpdatenodePage(tgtNodes) { }); optionsList.append('
          • Distribute and synchronize files
          • '); optionsList.append('
          • Update the ssh keys and host keys for the service nodes and compute nodes
          • '); - + // Create update OS checkbox if (!osHash['AIX']) { var osOption = $('
          • '); @@ -238,12 +238,12 @@ function loadUpdatenodePage(tgtNodes) { optionsList.append(osOption); osOption.append(osChkBox); osOption.append('Update the operating system'); - + var os = $('
          • ').hide(); var osLabel = $(''); var osInput = $(''); osInput.one('focus', function(){ - var tmp = $.cookie('osvers'); + var tmp = $.cookie('xcat_osvers'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -254,7 +254,7 @@ function loadUpdatenodePage(tgtNodes) { os.append(osLabel); os.append(osInput); optionsList.append(os); - + // Show alternate source directory when checked osChkBox.bind('click', function(event) { if ($(this).is(':checked')) { @@ -264,7 +264,7 @@ function loadUpdatenodePage(tgtNodes) { } }); } - + // Generate tooltips updatenodeForm.find('div input[title]').tooltip({ position: "center right", @@ -279,7 +279,7 @@ function loadUpdatenodePage(tgtNodes) { tooltip : "mouseover,mouseout" } }); - + /** * Ok */ @@ -292,7 +292,7 @@ function loadUpdatenodePage(tgtNodes) { // Remove any warning messages $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); var ready = true; - + // Generate arguments var chkBoxes = $("#" + newTabId + " input[type='checkbox']:checked"); var optionsStr = ''; @@ -300,7 +300,7 @@ function loadUpdatenodePage(tgtNodes) { for ( var i = 0; i < chkBoxes.length; i++) { option = chkBoxes.eq(i).attr('name'); optionsStr += '-' + option; - + // If update all software is checked if (option == 'S') { var srcDir = $('#' + newTabId + ' input[name=allSwSrcDirectory]').val(); @@ -316,50 +316,50 @@ function loadUpdatenodePage(tgtNodes) { if (srcDirectory) { optionsStr += ';-d;' + srcDirectory; } - + // Get otherpkgs var otherpkgs = $('#' + newTabId + ' input[name=otherpkgs]').val(); if (otherpkgs) { optionsStr += ';otherpkgs=' + otherpkgs; } - + // Get rpm_flags var rpm_flags = $('#' + newTabId + ' input[name=rpm_flags]').val(); if (rpm_flags) { optionsStr += ';rpm_flags=' + rpm_flags; } - + // Get installp_flags var installp_flags = $('#' + newTabId + ' input[name=installp_flags]').val(); if (installp_flags) { optionsStr += ';installp_flags=' + installp_flags; } - + // Get emgr_flags var emgr_flags = $('#' + newTabId + ' input[name=emgr_flags]').val(); if (emgr_flags) { optionsStr += ';emgr_flags=' + emgr_flags; } } - + // If postscripts is checked if (option == 'P') { // Get postscripts optionsStr += ';' + $('#' + newTabId + ' input[name=postscripts]').val(); } - + // If operating system is checked if (option == 'o') { // Get the OS optionsStr += ';' + $('#' + newTabId + ' input[name=os]').val(); } - + // Append ; to end of string if (i < (chkBoxes.length - 1)) { optionsStr += ';'; } } - + // If no inputs are empty if (ready) { // Get nodes @@ -368,7 +368,7 @@ function loadUpdatenodePage(tgtNodes) { // Disable all inputs and Ok button $('#' + newTabId + ' input').attr('disabled', 'disabled'); $(this).attr('disabled', 'true'); - + /** * (1) Boot to network */ diff --git a/xCAT-UI/js/provision/images.js b/xCAT-UI/js/provision/images.js index 59ad4c467..d1a6f174d 100644 --- a/xCAT-UI/js/provision/images.js +++ b/xCAT-UI/js/provision/images.js @@ -48,7 +48,7 @@ function loadImages(data) { // Data returned var rsp = data.rsp; if (rsp[0].indexOf('Could not find any object definitions') > -1) { - rsp = new Array(); + rsp = new Array(); } // Image attributes hash @@ -198,7 +198,7 @@ function loadImages(data) { // Turn table into a datatable var myDataTable = $('#' + imgTableId).dataTable({ - 'iDisplayLength': 50, + 'iDisplayLength': 50, 'bLengthChange': false, "bScrollCollapse": true, "sScrollY": "400px", @@ -502,7 +502,7 @@ function openAddImageDialog() { imageAttr.append(imageName, imageType, architecture, osName, osVersion, profile, provisionMethod); optionAttr.append(otherpkgDirectory, packageDirectory, packageList, template); - // Generate tooltips + // Generate tooltips addImageForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], @@ -720,9 +720,9 @@ function loadCreateImage() { return; } - var imageOsVers = $.cookie("osvers").split(","); - var imageArch = $.cookie("osarchs").split(","); - var profiles = $.cookie("profiles").split(","); + var imageOsVers = $.cookie("xcat_osvers").split(","); + var imageArch = $.cookie("xcat_osarchs").split(","); + var profiles = $.cookie("xcat_profiles").split(","); var createImgForm = $('
            '); var createImgFS = $('
            ').append('Create Image'); @@ -1329,7 +1329,7 @@ function openCopyCdDialog() { basePath : '/install' // Limit user to only install directory }); - // Generate tooltips + // Generate tooltips copyLinuxForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], diff --git a/xCAT-UI/js/provision/provision.js b/xCAT-UI/js/provision/provision.js index a732f5653..00a059080 100644 --- a/xCAT-UI/js/provision/provision.js +++ b/xCAT-UI/js/provision/provision.js @@ -33,7 +33,7 @@ function loadProvisionPage() { } // Get OS image names - if (!$.cookie('imagenames')){ + if (!$.cookie('xcat_imagenames')){ $.ajax( { url : 'lib/cmd.php', dataType : 'json', @@ -49,7 +49,7 @@ function loadProvisionPage() { } // Get groups - if (!$.cookie('groups')){ + if (!$.cookie('xcat_groups')){ $.ajax( { url : 'lib/cmd.php', dataType : 'json', diff --git a/xCAT-UI/js/service/service.js b/xCAT-UI/js/service/service.js index 96be4c75a..3d49b98d9 100644 --- a/xCAT-UI/js/service/service.js +++ b/xCAT-UI/js/service/service.js @@ -73,7 +73,7 @@ function initServicePage() { loadServicePage(); // Initialize tab index history - $.cookie('tabindex_history', '0,0'); + $.cookie('xcat_tabindex_history', '0,0', { path: '/xcat', secure:true }); } /** @@ -185,14 +185,14 @@ function loadServiceProvisionPage(tabId) { var okBtn = createButton('Ok'); okBtn.bind('click', function(event) { var userName = $.cookie('xcat_username'); - var tmp = $.cookie(userName + '_usrnodes'); + var tmp = $.cookie('xcat_' + userName + '_usrnodes'); // Get maximun number for nodes from cookie var nodes = ''; var maxVM = 0; if (tmp.length) { nodes = tmp.split(','); - maxVM = parseInt($.cookie(userName + '_maxvm')); + maxVM = parseInt($.cookie('xcat_' + userName + '_maxvm')); // Do not allow user to clone if the maximum number of VMs is reached if (nodes.length >= maxVM) { @@ -302,7 +302,7 @@ function loadManagePage(tabId) { */ function getUserNodesDef() { var userName = $.cookie('xcat_username'); - var userNodes = $.cookie(userName + '_usrnodes'); + var userNodes = $.cookie('xcat_' + userName + '_usrnodes'); if (userNodes) { // Get nodes definitions $.ajax( { @@ -597,7 +597,7 @@ function loadNodesTable(data) { // Refresh nodes table var userName = $.cookie('xcat_username'); - var userNodes = $.cookie(userName + '_usrnodes'); + var userNodes = $.cookie('xcat_' + userName + '_usrnodes'); if (userNodes) { // Get nodes definitions $.ajax( { @@ -932,7 +932,7 @@ function setGroupCookies(data) { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (240 * 60 * 1000)); - $.cookie('srv_groups', groups, { expires: exDate }); + $.cookie('xcat_srv_groups', groups, { expires: exDate, path: '/xcat', secure:true }); } } @@ -1041,28 +1041,28 @@ function setOSImageCookies(data) { } // Save image names in a cookie - $.cookie('srv_imagenames', imageNames); + $.cookie('xcat_srv_imagenames', imageNames); // Save profiles in a cookie var tmp = new Array; for (var key in profilesHash) { tmp.push(key); } - $.cookie('srv_profiles', tmp); + $.cookie('xcat_srv_profiles', tmp); // Save OS versions in a cookie tmp = new Array; for (var key in osVersHash) { tmp.push(key); } - $.cookie('srv_osvers', tmp); + $.cookie('xcat_srv_osvers', tmp); // Save OS architectures in a cookie tmp = new Array; for (var key in osArchsHash) { tmp.push(key); } - $.cookie('srv_osarchs', tmp); + $.cookie('xcat_srv_osarchs', tmp); } @@ -1111,7 +1111,7 @@ function setUserNodes(data) { // Set cookie to expire in 240 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (240 * 60 * 1000)); - $.cookie(userName + '_usrnodes', usrNodes, { expires: exDate }); + $.cookie('xcat_' + userName + '_usrnodes', usrNodes, { expires: exDate, path: '/xcat', secure:true }); } // End of if } @@ -1316,10 +1316,10 @@ function monitorNode(node, monitor) { function cloneNode(tgtNodes) { var userName = $.cookie('xcat_username'); var nodes = tgtNodes.split(','); - var tmp = $.cookie(userName + '_usrnodes'); + var tmp = $.cookie('xcat_' + userName + '_usrnodes'); var usrNodes = tmp.split(','); - var maxVM = parseInt($.cookie(userName + '_maxvm')); + var maxVM = parseInt($.cookie('xcat_' + userName + '_maxvm')); // Do not allow user to clone if the maximum number of VMs is reached if (usrNodes.length >= maxVM) { @@ -1596,7 +1596,7 @@ function unlockNode(tgtNodes) { */ function getNodesCurrentLoad(){ var userName = $.cookie('xcat_username'); - var nodes = $.cookie(userName + '_usrnodes'); + var nodes = $.cookie('xcat_' + userName + '_usrnodes'); // Get nodes current status $.ajax({ @@ -2147,7 +2147,7 @@ function setMaxVM() { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (240 * 60 * 1000)); - $.cookie(userName + '_maxvm', rsp, { expires: exDate }); + $.cookie('xcat_' + userName + '_maxvm', rsp, { expires: exDate }); } }); } \ No newline at end of file diff --git a/xCAT-UI/js/srv_xcatauth.js b/xCAT-UI/js/srv_xcatauth.js index c86d56af4..be3314432 100644 --- a/xCAT-UI/js/srv_xcatauth.js +++ b/xCAT-UI/js/srv_xcatauth.js @@ -4,30 +4,30 @@ $(document).ready(function() { $('#header').remove(); $('#content').remove(); - + var winHeight = document.body.clientHeight; var diagHeight = $('#login').css('height'); diagHeight = diagHeight.substr(0, diagHeight.length - 2); diagHeight = Number(diagHeight); - + // The window's height is to small to show the dialog var tmpHeight = 0; if ((winHeight - 50) < diagHeight){ tmpHeight = 0; } else { - tmpHeight = parseInt((winHeight - diagHeight - 50) / 2); + tmpHeight = parseInt((winHeight - diagHeight - 50) / 2); } - + $('#login').css('margin', tmpHeight + 'px auto'); $('button').bind('click', function(){ authenticate(); }).button(); - + if (document.location.protocol == 'http:') { $('#login-status').html('You are using an unencrypted session!'); $('#login-status').css('color', 'red'); } - + if (!$("#login input[name='username']").val()) { $("#login input[name='username']").focus(); } else { @@ -51,7 +51,7 @@ $(document).ready(function() { /** * Update login dialog - * + * * @param data Data returned from AJAX call * @param txtStatus Status of login */ @@ -62,11 +62,11 @@ function onlogin(data, txtStatus) { if (data.authenticated == 'yes') { $('#login-status').text('Login successful'); window.location = 'service.php'; - + // Set user name cookie var exDate = new Date(); exDate.setTime(exDate.getTime() + (240 * 60 * 1000)); - $.cookie('xcat_username', usrName, { expires: exDate }); + $.cookie('xcat_username', usrName, { expires: exDate, path: '/xcat', secure:true }); } else { $('#login-status').text('Authentication failure'); $('#login-status').css('color', '#FF0000'); @@ -79,7 +79,7 @@ function onlogin(data, txtStatus) { function authenticate() { $('#login-status').css('color', '#000000'); $('#login-status').html('Authenticating...'); - + var passwd = $("#login input[name='password']").val(); $.post('lib/srv_log.php', { username : $("#login input[name='username']").val(), diff --git a/xCAT-UI/js/ui.js b/xCAT-UI/js/ui.js index c0600d7a5..771fa5d65 100644 --- a/xCAT-UI/js/ui.js +++ b/xCAT-UI/js/ui.js @@ -1,8 +1,11 @@ /** * Tab constructor * - * @param tabId Tab ID - * @param tabName Tab name + * @param tabId + * Tab ID + * @param tabName + * Tab name + * @return Nothing */ var Tab = function(tabId) { this.tabId = tabId; @@ -29,8 +32,8 @@ Tab.prototype.init = function() { tabs.bind('tabsselect', function(event, ui){ // Save the order tabs were selected var order; - if ($.cookie('tabindex_history')) { - order = $.cookie('tabindex_history').split(','); + if ($.cookie('xcat_tabindex_history')) { + order = $.cookie('xcat_tabindex_history').split(','); order[1] = order[0]; // Set index 1 to last selected tab order[0] = ui.index; // Set index 0 to currently selected tab } else { @@ -40,7 +43,7 @@ Tab.prototype.init = function() { order[1] = ui.index; } - $.cookie('tabindex_history', order); + $.cookie('xcat_tabindex_history', order, { path: '/xcat', secure:true }); }); // Remove dummy tab @@ -97,7 +100,7 @@ Tab.prototype.add = function(tabId, tabName, tabCont, closeable) { // Go back to last tab if user is trying to close currently selected tab if (tabs.tabs('option', 'selected') == tabIndex) { // Get last selected tab from history - var order = $.cookie('tabindex_history').split(','); + var order = $.cookie('xcat_tabindex_history').split(','); if (order[1]) { tabs.tabs('select', parseInt(order[1])); } else { diff --git a/xCAT-UI/js/xcatauth.js b/xCAT-UI/js/xcatauth.js index ef363759d..3aad393d1 100644 --- a/xCAT-UI/js/xcatauth.js +++ b/xCAT-UI/js/xcatauth.js @@ -4,32 +4,32 @@ $(document).ready(function() { $('#header').remove(); $('#content').remove(); - + var winheight = document.body.clientHeight; var diaheight = $('#login').css('height'); diaheight = diaheight.substr(0, diaheight.length - 2); diaheight = Number(diaheight); - + // The window's height is to small to show the dialog var tempheight = 0; if ((winheight - 50) < diaheight){ tempheight = 0; } else { - tempheight = parseInt((winheight - diaheight - 50) / 2); + tempheight = parseInt((winheight - diaheight - 50) / 2); } - + $('#login').css('margin', tempheight + 'px auto'); $('button').bind('click', function(){ authenticate(); }); - + $('#login button').button(); - + if (document.location.protocol == "http:") { $("#login-status").html("You are using an unencrypted session!"); $("#login-status").css("color", "#ff0000"); } - + if ($("#login input[name='username']").val() == "") { $("#login input[name='username']").focus(); } else { @@ -53,7 +53,7 @@ $(document).ready(function() { /** * Update login dialog - * + * * @param data Data returned from AJAX call * @param txtStatus Status of login */ @@ -64,25 +64,26 @@ function onlogin(data, txtStatus) { $("#login-status").text("Login successful"); // Not the first time to log - if ($.cookie('logonflag')){ + if ($.cookie('xcat_logonflag')){ // Remembered what page they were trying to go to window.location = window.location.pathname; } else { window.location = 'help.php'; } - + // Set user name cookie var usrName = $("#login input[name='username']").val(); var exDate = new Date(); exDate.setTime(exDate.getTime() + (240 * 60 * 1000)); - $.cookie('xcat_username', usrName, { expires: exDate }); - + $.cookie('xcat_username', usrName, { expires: exDate, path: '/xcat', secure:true }); + // Set the logonflag - $.cookie('logonflag', 'yes', { + $.cookie('xcat_logonflag', 'yes', { path : '/xcat', - expires : 100 + expires : 100, + secure:true }); - + } else { $("#login-status").text("Authentication failure").css("color", "#FF0000"); } diff --git a/xCAT-UI/lib/functions.php b/xCAT-UI/lib/functions.php index 51827fc4e..20c27efa6 100644 --- a/xCAT-UI/lib/functions.php +++ b/xCAT-UI/lib/functions.php @@ -101,7 +101,7 @@ function submit_request($req, $skipVerify, $opts_array){ if ($flush){ echo str_pad('',1024)."\n"; } - + while (!feof($fp)) { // Read until there is no more // Remove newlines and add it to the response @@ -118,7 +118,7 @@ function submit_request($req, $skipVerify, $opts_array){ } else { $flushtail = ''; } - + $str = preg_replace('/.*<\/errorcode>/', '', $str); // Strip HTML tags from output if ($tmp = trim(strip_tags($str))) { @@ -127,7 +127,7 @@ function submit_request($req, $skipVerify, $opts_array){ format_TBD($tmp); } else { $tmp = preg_replace('/\n\s*/', "\n", $tmp); - + // Print out output by default echo '
            ' . $tmp . '
            '; ob_flush(); @@ -180,7 +180,7 @@ function submit_request($req, $skipVerify, $opts_array){ $rsp = FALSE; } } - + return $rsp; } @@ -201,10 +201,10 @@ function xorcrypt($data, $key) { * Get password */ function getpassword() { - if (isset($GLOBALS['xcatauthsecret'])) { - $cryptext = $GLOBALS['xcatauthsecret']; - } else if (isset($_COOKIE["xcatauthsecret"])) { - $cryptext = $_COOKIE["xcatauthsecret"]; + if (isset($GLOBALS['xcat_authsecret'])) { + $cryptext = $GLOBALS['xcat_authsecret']; + } else if (isset($_COOKIE["xcat_authsecret"])) { + $cryptext = $_COOKIE["xcat_authsecret"]; } else { return false; } @@ -214,7 +214,7 @@ function getpassword() { /** * Get the password splitting knowledge between server and client side persistant storage. - * Caller should regenerate session ID when contemplating a new user/password, + * Caller should regenerate session ID when contemplating a new user/password, * to preclude session fixation, though fixation is limited without the secret. * * @param $password Password @@ -226,8 +226,8 @@ function setpassword($password) { // Non-ascii characters, encode it in base64 $cryptext = base64_encode($cryptext); - setcookie("xcatauthsecret",$cryptext,0,'/'); - $GLOBALS["xcatauthsecret"] = $cryptext; + setcookie("xcat_authsecret",$cryptext,0,'/xcat','',true); + $GLOBALS["xcat_authsecret"] = $cryptext; $_SESSION["secretkey"] = $key; } @@ -342,18 +342,31 @@ function isRootAcess() { * Log out of current user session */ function logout() { + session_start(); // Clear the secret cookie from browser - if (isset($_COOKIE["xcatauthsecret"])) { - setcookie("xcatauthsecret",'',time()-86400*7,'/'); + if (isset($_COOKIE["xcat_authsecret"])) { + setcookie("xcat_authsecret",'',time()-86400*7,'/xcat','',true); + } + + // Clear any cookies where the key starts with "xcat_" + foreach ($_COOKIE as $key => $value) { + if (substr($key,0,5) === "xcat_") { + unset($_COOKIE[$key]); + setcookie($key, null, time() - 3600, '/xcat','',true); + } } // Expire session cookie if (isset($_COOKIE[session_name()])) { - setcookie(session_name(),"",time()-86400*7,"/"); + setcookie(session_name(),"",time()-86400*7,"/xcat",'',true); } + // Clear session id + setcookie(session_id(),"",time()-86400*7,"/"); + // Clear server store of data $_SESSION=array(); + session_destroy(); } /** diff --git a/xCAT-UI/lib/srv_functions.php b/xCAT-UI/lib/srv_functions.php index 6dafe540e..4481eba3c 100644 --- a/xCAT-UI/lib/srv_functions.php +++ b/xCAT-UI/lib/srv_functions.php @@ -208,10 +208,10 @@ function format_TBD($str) { * Get password */ function getpassword() { - if (isset($GLOBALS['xcatauthsecret'])) { - $cryptext = $GLOBALS['xcatauthsecret']; - } else if (isset($_COOKIE["xcatauthsecret"])) { - $cryptext = $_COOKIE["xcatauthsecret"]; + if (isset($GLOBALS['xcat_authsecret'])) { + $cryptext = $GLOBALS['xcat_authsecret']; + } else if (isset($_COOKIE["xcat_authsecret"])) { + $cryptext = $_COOKIE["xcat_authsecret"]; } else { return false; } @@ -233,8 +233,8 @@ function setpassword($password) { // Non-ascii characters, encode it in base64 $cryptext = base64_encode($cryptext); - setcookie("xcatauthsecret",$cryptext,0,'/'); - $GLOBALS["xcatauthsecret"] = $cryptext; + setcookie("xcat_authsecret",$cryptext,0,'/xcat','',true); + $GLOBALS["xcat_authsecret"] = $cryptext; $_SESSION["secretkey"] = $key; } @@ -285,13 +285,13 @@ function isAuthenticated() { */ function logout() { // Clear the secret cookie from browser - if (isset($_COOKIE["xcatauthsecret"])) { - setcookie("xcatauthsecret",'',time()-86400*7,'/'); + if (isset($_COOKIE["xcat_authsecret"])) { + setcookie("xcat_authsecret",'',time()-86400*7,'/xcat','',true); } // Expire session cookie if (isset($_COOKIE[session_name()])) { - setcookie(session_name(),"",time()-86400*7,"/"); + setcookie(session_name(),"",time()-86400*7,"/xcat",'',true); } // Clear server store of data From 8f724776ef6ae2d7b6794c09ce8731e44bc65009 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 24 Jan 2017 09:54:45 -0500 Subject: [PATCH 027/100] Remove the SVNUP code since git has replaced svn --- build-ubunturepo | 60 +++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/build-ubunturepo b/build-ubunturepo index 5c078b0dd..36aa5d2d9 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -6,10 +6,10 @@ # # # Getting Started: -# - Clone the xcat-core git repository int a directory called /src/xcat-core, where -# is the same name as the release dir it is uploaded to xcat.org (e.g devel, 2.9, 2.10) +# - Clone the xcat-core git repository under a directory named "xcat-core/src" # - make sure reprepro is installed on the build machine -# - Run this script from the local git repository you just created. It will create the other directories that are needed. +# - Run this script from the local git repository you just created. +# ./build-ubunturepo -c BUILDALL=1 # Usage: attr=value attr=value ... ./build-ubunturepo { -c | -d } # PROMOTE=1 - if the attribute "PROMOTE" is specified, means an official dot release. This does not @@ -146,47 +146,39 @@ done if [ "$c_flag" ] then - # strip the /src/xcat-core from the end of the dir to get the next dir up and use as the release + # + # The format of the directory for Ubuntu builds needs to be "xcat-core/src/xcat-core" so + # that the output build files are created under "xcat-core". + # TODO: This should be fixed in the future.... + # if [ -z "$REL" ]; then t=${curdir%/src/xcat-core} REL=`basename $t` fi + if [ "$REL" != "xcat-core" ]; then + echo "ERROR: REL='$REL'needs to be 'xcat-core'. Ensure the path is 'xcat-core/src/xcat-core'" + exit 1 + fi - ver=`cat Version` if [ "$PROMOTE" != 1 ]; then code_change=0 update_log='' - #get the version - if [ "$REL" = "xcat-core" ];then - git_flag=1 - REL=`git rev-parse --abbrev-ref HEAD` - if [ "$REL" = "master" ]; then - REL="devel" - fi - if [ -z "$GITUP" ];then - update_log=../coregitup - echo "git pull > $update_log" - git pull > $update_log - else - update_log=$GITUP - fi - - if ! grep -q 'Already up-to-date' $update_log; then - code_change=1 - fi + # get the version + git_flag=1 + REL=`git rev-parse --abbrev-ref HEAD` + if [ "$REL" = "master" ]; then + REL="devel" + fi + if [ -z "$GITUP" ];then + update_log=../coregitup + echo "git pull > $update_log" + git pull > $update_log else - git_flag=0 - if [ -z "$SVNUP" ]; then - update_log=../coresvnup - echo "svn up > $update_log" - svn up > $update_log - else - update_log=$SVNUP - fi + update_log=$GITUP + fi - if ! grep -q 'At revision' $update_log;then - code_change=1 - fi + if ! grep -q 'Already up-to-date' $update_log; then + code_change=1 fi ver=`cat Version` short_ver=`cat Version|cut -d. -f 1,2` From 0cd485cdfe79154db09989fd55724d459a885a32 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 24 Jan 2017 13:54:33 -0500 Subject: [PATCH 028/100] Create a buildinfo file for Ubuntu builds --- build-ubunturepo | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/build-ubunturepo b/build-ubunturepo index 36aa5d2d9..c53d18a53 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -183,6 +183,9 @@ then ver=`cat Version` short_ver=`cat Version|cut -d. -f 1,2` short_short_ver=`cat Version|cut -d. -f 1` + build_time=`date` + build_machine=`hostname` + commit_id=`git rev-parse --short HEAD` package_dir_name=debs$REL #TODO: define the core path and tarball name @@ -199,10 +202,9 @@ then #the package type: local | snap | alpha #the build introduce stirng - pkg_type="snap" build_string="Snap_Build" - cur_date=`date +%Y%m%d%H%M` - pkg_version="${ver}-${pkg_type}${cur_date}" + xcat_release="snap$(date '+%Y%m%d%H%M')" + pkg_version="${ver}-${xcat_release}" if [ ! -d ../../$package_dir_name ];then mkdir -p "../../$package_dir_name" @@ -369,6 +371,16 @@ __EOF__ chmod 775 mklocalrepo.sh + # + # Add a buildinfo file under xcat-core to track information about the build + # + buildinfo=$local_core_repo_path/buildinfo + echo "VERSION=$ver" > $buildinfo + echo "RELEASE=$xcat_release" >> $buildinfo + echo "BUILD_TIME=$build_time" >> $buildinfo + echo "BUILD_MACHINE=$build_machine" >> $buildinfo + echo "COMMIT_ID=$commit_id" >> $buildinfo + #create the xcat-core.list file cd ../ From 9eb044f9977e03c65e006f4f0ce11dbb63d7c751 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 24 Jan 2017 14:15:14 -0500 Subject: [PATCH 029/100] Clean up unused upload code from the ubuntu build script --- build-ubunturepo | 42 ++---------------------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/build-ubunturepo b/build-ubunturepo index c53d18a53..b13a91db3 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -22,7 +22,6 @@ # When you are ready to release this build, use PROMOTE=1 without PREGA # BUILDALL=1 - build all rpms, whether they changed or not. Should be used for snap builds that are in # prep for a release. -# UP=0 or UP=1 - override the default upload behavior # LOG= - provide an LOG file option to redirect some output into log file # # For the dependency packages 1. All the xcat dependency deb packages should be uploaded to @@ -96,13 +95,6 @@ if [ -z "$c_flag" -a -z "$d_flag" ];then exit 2 fi -USER="xcat" -SERVER="xcat.org" -FILES_PATH="files" -FRS="/var/www/${SERVER}/${FILES_PATH}" -APT_DIR="${FRS}/xcat" -APT_REPO_DIR="${APT_DIR}/repos/apt" - if [ "$c_flag" -a "$d_flag" ];then printusage exit 2 @@ -118,7 +110,7 @@ curdir=`pwd` local_core_repo_path="$curdir/../../xcat-core" local_dep_repo_path="$curdir/../../xcat-dep/xcat-dep" -#use flock to only one person build at the same time +# Use flock to only one person build at the same time # Get a lock, so can not do 2 builds at once exec 8>/var/lock/xcatbld.lock if ! flock -n 8; then @@ -201,7 +193,7 @@ then echo "###############################" #the package type: local | snap | alpha - #the build introduce stirng + #the build introduce string build_string="Snap_Build" xcat_release="snap$(date '+%Y%m%d%H%M')" pkg_version="${ver}-${xcat_release}" @@ -223,8 +215,6 @@ then do if grep -q $file $update_log || [ "$BUILDALL" == 1 -o "$file" = "perl-xCAT" ]; then rm -f ../../$package_dir_name/${file_low}_*.$target_arch.deb - #genesis scripts package, don't remove genesis amd64 files - #rm -f ../../$package_dir_name/${file_low}-amd64_*.deb cd $file CURDIR=$(pwd) dch -v $pkg_version -b -c debian/changelog $build_string @@ -505,33 +495,5 @@ __EOF__ chgrp root $dep_tar_name chmod g+w $dep_tar_name - # Decide whether to upload or not (default NOT to upload) - if [ "$UP" != "1" ]; then - echo "Upload not specified, Done! (rerun with UP=1, to upload)" - cd $old_pwd - exit 0 - fi - - #upload the dep packages - i=0 - echo "Uploading debs from xcat-dep to ${APT_REPO_DIR}/xcat-dep/ ..." - while [ $((i+=1)) -le 5 ] && ! rsync -urLv --delete xcat-dep $USER@${SERVER}:${APT_REPO_DIR}/ - do : ; done - - #upload the tarball - i=0 - echo "Uploading $dep_tar_name to ${APT_DIR}/xcat-dep/2.x_Ubuntu/ ..." - while [ $((i+=1)) -le 5 ] && ! rsync -v --force $dep_tar_name $USER@${SERVER}:${APT_DIR}/xcat-dep/2.x_Ubuntu/ - do : ; done - - #upload the README file - cd debs - i=0 - echo "Uploading README to ${APT_DIR}/xcat-dep/2.x_Ubuntu/ ..." - while [ $((i+=1)) -le 5 ] && ! rsync -v --force README $USER@${SERVER}:${APT_DIR}/xcat-dep/2.x_Ubuntu/ - do : ; done - - cd $old_pwd - exit 0 fi exit 0 From 6f698625db631759c2c9471d4f66d7cd35805860 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Tue, 24 Jan 2017 15:43:31 -0500 Subject: [PATCH 030/100] xdsh doesn't read credentials from the passwd table for IBSwitch --- perl-xCAT/xCAT/DSHCLI.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index a0b5788c9..0c98e7908 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -979,8 +979,9 @@ sub fork_fanout_dsh ) = @_; - #get username and passeword for ether net switches (EthSwitch type) - if ($$options{'devicetype'} =~ /EthSwitch/) { + #get username and passeword for switches + if (($$options{'devicetype'} =~ /EthSwitch/) { + ($$options{'devicetype'} =~ /IBSwitch/) ){ if (@$targets_waiting > 0) { if ($ENV{'DSH_REMOTE_PASSWORD'}) { foreach my $t (keys(%$resolved_targets)) { @@ -1010,13 +1011,15 @@ sub fork_fanout_dsh if (defined($entry->[0]->{protocol})) { $protocol = $entry->[0]->{protocol}; } - if ((!$username) && (!$password) && (!$protocol)) { #use passwd table as default + if ((!$username) && (!$password)) { #use passwd table as default if (defined($passwd_ent[0]->{username})) { $username = $passwd_ent[0]->{username}; } if (defined($passwd_ent[0]->{password})) { $password = $passwd_ent[0]->{password}; } + } + if (!$protocol){ if (defined($passwd_ent[0]->{comments}) && ($passwd_ent[0]->{comments} eq "telnet")) { $protocol = $passwd_ent[0]->{comments}; } From 8782186f6be4be3fc6c1aca3786ef1ae7d2b973e Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Tue, 24 Jan 2017 16:05:01 -0500 Subject: [PATCH 031/100] check if there is "-l" options --- perl-xCAT/xCAT/DSHCLI.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index 0c98e7908..8121f475d 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -980,8 +980,8 @@ sub fork_fanout_dsh = @_; #get username and passeword for switches - if (($$options{'devicetype'} =~ /EthSwitch/) { - ($$options{'devicetype'} =~ /IBSwitch/) ){ + if (($$options{'devicetype'} =~ /EthSwitch/) || + (($$options{'devicetype'} =~ /IBSwitch/) && !($$options{'user'})) ){ if (@$targets_waiting > 0) { if ($ENV{'DSH_REMOTE_PASSWORD'}) { foreach my $t (keys(%$resolved_targets)) { From 6fdf3bef665eea5fb899cdaded513cfc7ddb6c5b Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 24 Jan 2017 20:36:19 -0500 Subject: [PATCH 032/100] modified depending on comments --- xCAT-probe/lib/perl/probe_utils.pm | 7 +++---- xCAT-probe/subcmds/osdeploy | 7 ++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xCAT-probe/lib/perl/probe_utils.pm b/xCAT-probe/lib/perl/probe_utils.pm index 2400212c2..e309def96 100644 --- a/xCAT-probe/lib/perl/probe_utils.pm +++ b/xCAT-probe/lib/perl/probe_utils.pm @@ -580,10 +580,9 @@ sub convert_second_to_time { } else { $tmp_second = $second_in % 60; } - if ($tmp_second == 0) { - push @time, "00"; - } elsif ($tmp_second < 10) { - push @time, "0" . "$tmp_second"; + + if ($tmp_second < 10) { + push @time, "0$tmp_second"; } else { push @time, "$tmp_second"; } diff --git a/xCAT-probe/subcmds/osdeploy b/xCAT-probe/subcmds/osdeploy index c04c3af27..6a92ecc1a 100755 --- a/xCAT-probe/subcmds/osdeploy +++ b/xCAT-probe/subcmds/osdeploy @@ -65,9 +65,10 @@ Options: -r : Trigger 'Replay history' mode. Follow the duration of rolling back. Units are 'h' (hour) or 'm' (minute) Supported format examples: 3h30m (3 hours and 30 minutes ago), 2h (2 hours ago), 40m (40 minutes ago) and 3 (3 hours ago). If unit is not specified, hour will be used by default. - -p : Performance of provision for each node and all. - Supported level: 1 (show how much time spent for provision), - 2 (show how much time spent for DHCP, Download RPM packages, Run Postscripts, Run Postbootscripts). + -p Show elapsed time of each stage during provision for each node + Support 2 output format: + 1 Elapsed time of each stage during provision + 2 Elapsed time from power on node to each stage starting "; From bce2ee92d278f02794c017afa65dbc87444d2fc3 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 25 Jan 2017 15:44:45 -0500 Subject: [PATCH 033/100] format to use 4 spaces instead of tab --- .../share/xcat/netboot/rh/dracut_033/xcatroot | 478 +++++++++--------- 1 file changed, 239 insertions(+), 239 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot index 94e1f026e..9d9fddf7d 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot @@ -31,234 +31,234 @@ fi imgurl="$(getarg imgurl=)"; if [ ! -z "$imgurl" ]; then - if [ xhttp = x${imgurl%%:*} ]; then - NFS=0 - FILENAME=${imgurl##*/} - while [ ! -r "$FILENAME" ]; do + if [ xhttp = x${imgurl%%:*} ]; then + NFS=0 + FILENAME=${imgurl##*/} + while [ ! -r "$FILENAME" ]; do [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "downloading $imgurl...." - echo Getting $imgurl... - if ! wget -nv $imgurl; then + echo Getting $imgurl... + if ! wget -nv $imgurl; then [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "downloading $imgurl failed,retrying...." - rm -f $FILENAME - sleep 27 - fi - done - elif [ xnfs = x${imgurl%%:*} ]; then - NFS=1 - SERVER=${imgurl#nfs:} - SERVER=${SERVER#/} - SERVER=${SERVER#/} - ROOTDIR=$SERVER - SERVER=${SERVER%%/*} - SERVER=${SERVER%:} - ROOTDIR=/${ROOTDIR#*/} - fi + rm -f $FILENAME + sleep 27 + fi + done + elif [ xnfs = x${imgurl%%:*} ]; then + NFS=1 + SERVER=${imgurl#nfs:} + SERVER=${SERVER#/} + SERVER=${SERVER#/} + ROOTDIR=$SERVER + SERVER=${SERVER%%/*} + SERVER=${SERVER%:} + ROOTDIR=/${ROOTDIR#*/} + fi fi #echo 0 > /proc/sys/vm/zone_reclaim_mode #Avoid kernel bug if [ -r /rootimg.sfs ]; then - echo Setting up squashfs with ram overlay. - mknod /dev/loop0 b 7 0 - mkdir -p /ro - mkdir -p /rw - mount -t squashfs /rootimg.sfs /ro - mount -t tmpfs rw /rw - mount -t aufs -o dirs=/rw:/ro mergedroot $NEWROOT - mkdir -p $NEWROOT/ro - mkdir -p $NEWROOT/rw - mount --move /ro $NEWROOT/ro - mount --move /rw $NEWROOT/rw + echo Setting up squashfs with ram overlay. + mknod /dev/loop0 b 7 0 + mkdir -p /ro + mkdir -p /rw + mount -t squashfs /rootimg.sfs /ro + mount -t tmpfs rw /rw + mount -t aufs -o dirs=/rw:/ro mergedroot $NEWROOT + mkdir -p $NEWROOT/ro + mkdir -p $NEWROOT/rw + mount --move /ro $NEWROOT/ro + mount --move /rw $NEWROOT/rw elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...." - echo Setting up RAM-root tmpfs. - if [ -z $rootlimit ];then - mount -t tmpfs -o mode=755 rootfs $NEWROOT - else - mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT - fi + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...." + echo Setting up RAM-root tmpfs. + if [ -z $rootlimit ];then + mount -t tmpfs -o mode=755 rootfs $NEWROOT + else + mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT + fi - cd $NEWROOT - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" - echo -n "Extracting root filesystem:" - if [ -r /rootimg.cpio.gz ]; then - if [ -x /bin/cpio ]; then - gzip -cd /rootimg.cpio.gz |/bin/cpio -idum - else - gzip -cd /rootimg.cpio.gz |cpio -idum + cd $NEWROOT + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" + echo -n "Extracting root filesystem:" + if [ -r /rootimg.cpio.gz ]; then + if [ -x /bin/cpio ]; then + gzip -cd /rootimg.cpio.gz |/bin/cpio -idum + else + gzip -cd /rootimg.cpio.gz |cpio -idum + fi + elif [ -r /rootimg.cpio.xz ]; then + if [ -x /bin/cpio ]; then + xz -cd /rootimg.cpio.xz |/bin/cpio -idum + else + xz -cd /rootimg.cpio.xz |cpio -idum + fi fi - elif [ -r /rootimg.cpio.xz ]; then - if [ -x /bin/cpio ]; then - xz -cd /rootimg.cpio.xz |/bin/cpio -idum - else - xz -cd /rootimg.cpio.xz |cpio -idum - fi - fi - $NEWROOT/etc/init.d/localdisk - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." - echo Done + $NEWROOT/etc/init.d/localdisk + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." + echo Done elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...." - echo Setting up RAM-root tmpfs. - if [ -z $rootlimit ];then - mount -t tmpfs -o mode=755 rootfs $NEWROOT - else - mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT - fi + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...." + echo Setting up RAM-root tmpfs. + if [ -z $rootlimit ];then + mount -t tmpfs -o mode=755 rootfs $NEWROOT + else + mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT + fi - cd $NEWROOT - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" - echo -n "Extracting root filesystem:" - if [ -r /rootimg.tar.gz ]; then - tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz - if [ $? -ne 0 ]; then - tar --selinux -zxf /rootimg.tar.gz + cd $NEWROOT + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" + echo -n "Extracting root filesystem:" + if [ -r /rootimg.tar.gz ]; then + tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz + if [ $? -ne 0 ]; then + tar --selinux -zxf /rootimg.tar.gz + fi + elif [ -r /rootimg.tar.xz ]; then + tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz + if [ $? -ne 0 ]; then + tar --selinux -Jxf /rootimg.tar.xz + fi fi - elif [ -r /rootimg.tar.xz ]; then - tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz - if [ $? -ne 0 ]; then - tar --selinux -Jxf /rootimg.tar.xz - fi - fi - $NEWROOT/etc/init.d/localdisk - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." - echo Done + $NEWROOT/etc/init.d/localdisk + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." + echo Done elif [ -r /rootimg-statelite.gz ]; then - echo Setting up RAM-root tmpfs for statelite mode. + echo Setting up RAM-root tmpfs for statelite mode. - if [ -z $rootlimit];then - mount -t tmpfs -o mode=755 rootfs $NEWROOT - else - mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT - fi - - cd $NEWROOT - echo -n "Extracting root filesystem:" - if [ -x /bin/cpio ]; then - gzip -cd /rootimg-statelite.gz |/bin/cpio -idum - else - gzip -cd /rootimg-statelite.gz |cpio -idum - fi - echo Done - # then, the statelite staffs will be processed - echo Setting up Statelite - modprobe nfs - MAXTRIES=7 - ITER=0 - if [ ! -e "$NEWROOT/$RWDIR" ]; then - echo "" - echo "The /$RWDIR directory doesn't exist in the rootimg... " - echo "" - /bin/sh - fi - - if [ ! -e "$NEWROOT/etc/init.d/statelite" ]; then - echo "" - echo "$NEWROOT/etc/init.d/statelite doesn't exist... " - echo "" - /bin/sh - fi - - mount -t tmpfs rw $NEWROOT/$RWDIR - mkdir -p $NEWROOT/$RWDIR/tmpfs - ME=`hostname -s` - if [ ! -z $NODE ]; then - ME=$NODE - fi - - - # mount the SNAPSHOT directory here for persistent use. - if [ ! -z $STATEMNT ]; then - SNAPSHOTSERVER=${STATEMNT%:*} - SNAPSHOTROOT=${STATEMNT#*/} - if [ -z $SNAPSHOTROOT ]; then - SNAPSHOTROOT=$SNAPSHOTSERVER - SNAPSHOTSERVER= + if [ -z $rootlimit];then + mount -t tmpfs -o mode=755 rootfs $NEWROOT + else + mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT fi - fi - if [ ! -z $SNAPSHOTSERVER ]; then - mkdir -p $NEWROOT/$RWDIR/persistent - MAXTRIES=5 + cd $NEWROOT + echo -n "Extracting root filesystem:" + if [ -x /bin/cpio ]; then + gzip -cd /rootimg-statelite.gz |/bin/cpio -idum + else + gzip -cd /rootimg-statelite.gz |cpio -idum + fi + echo Done + # then, the statelite staffs will be processed + echo Setting up Statelite + modprobe nfs + MAXTRIES=7 ITER=0 - if [ -z $MNTOPTS ]; then - MNT_OPTIONS="nolock,rsize=32768,tcp,nfsvers=3,timeo=14" - else - MNT_OPTIONS=$MNTOPTS - fi - while ! mount $SNAPSHOTSERVER:/$SNAPSHOTROOT $NEWROOT/$RWDIR/persistent -o $MNT_OPTIONS; do - ITER=$(( ITER + 1 )) - if [ "$ITER" == "$MAXTRIES" ]; then - echo "You are dead, rpower $ME boot to play again." - echo "Possible problems: + if [ ! -e "$NEWROOT/$RWDIR" ]; then + echo "" + echo "The /$RWDIR directory doesn't exist in the rootimg... " + echo "" + /bin/sh + fi + + if [ ! -e "$NEWROOT/etc/init.d/statelite" ]; then + echo "" + echo "$NEWROOT/etc/init.d/statelite doesn't exist... " + echo "" + /bin/sh + fi + + mount -t tmpfs rw $NEWROOT/$RWDIR + mkdir -p $NEWROOT/$RWDIR/tmpfs + ME=`hostname -s` + if [ ! -z $NODE ]; then + ME=$NODE + fi + + + # mount the SNAPSHOT directory here for persistent use. + if [ ! -z $STATEMNT ]; then + SNAPSHOTSERVER=${STATEMNT%:*} + SNAPSHOTROOT=${STATEMNT#*/} + if [ -z $SNAPSHOTROOT ]; then + SNAPSHOTROOT=$SNAPSHOTSERVER + SNAPSHOTSERVER= + fi + fi + + if [ ! -z $SNAPSHOTSERVER ]; then + mkdir -p $NEWROOT/$RWDIR/persistent + MAXTRIES=5 + ITER=0 + if [ -z $MNTOPTS ]; then + MNT_OPTIONS="nolock,rsize=32768,tcp,nfsvers=3,timeo=14" + else + MNT_OPTIONS=$MNTOPTS + fi + while ! mount $SNAPSHOTSERVER:/$SNAPSHOTROOT $NEWROOT/$RWDIR/persistent -o $MNT_OPTIONS; do + ITER=$(( ITER + 1 )) + if [ "$ITER" == "$MAXTRIES" ]; then + echo "You are dead, rpower $ME boot to play again." + echo "Possible problems: 1. $SNAPSHOTSERVER is not exporting $SNAPSHOTROOT ? 2. Is DNS set up? Maybe that's why I can't mount $SNAPSHOTSERVER." - /bin/sh - exit - fi - RS=$(( $RANDOM % 20 )) - echo "Trying again in $RS seconds ..." - sleep $RS - done + /bin/sh + exit + fi + RS=$(( $RANDOM % 20 )) + echo "Trying again in $RS seconds ..." + sleep $RS + done + + # create directory which is named after my node name + mkdir -p $NEWROOT/$RWDIR/persistent/$ME + ITER=0 + # umount current persistent mount + while ! umount -l $NEWROOT/$RWDIR/persistent; do + ITER=$(( ITER + 1 )) + if [ "$ITER" == "$MAXTRIES" ]; then + echo "Your are dead, rpower $ME boot to play again." + echo "Cannot umount $NEWROOT/$RWDIR/persistent." + /bin/sh + exit + fi + RS=$(( $RANDOM % 20 )) + echo "Trying again in $RS seconds..." + sleep $RS + done - # create directory which is named after my node name - mkdir -p $NEWROOT/$RWDIR/persistent/$ME - ITER=0 - # umount current persistent mount - while ! umount -l $NEWROOT/$RWDIR/persistent; do - ITER=$(( ITER + 1 )) - if [ "$ITER" == "$MAXTRIES" ]; then - echo "Your are dead, rpower $ME boot to play again." - echo "Cannot umount $NEWROOT/$RWDIR/persistent." - /bin/sh - exit - fi - RS=$(( $RANDOM % 20 )) - echo "Trying again in $RS seconds..." - sleep $RS - done + # mount persistent to server:/rootpath/nodename + ITER=0 + while ! mount $SNAPSHOTSERVER:/$SNAPSHOTROOT/$ME $NEWROOT/$RWDIR/persistent -o $MNT_OPTIONS; do + ITER=$(( ITER + 1 )) + if [ "$ITER" == "$MAXTRIES" ]; then + echo "Your are dead, rpower $ME boot to play again." + echo "Possible problems: cannot mount to $SNAPSHOTSERVER:/$SNAPSHOTROOT/$ME." + /bin/sh + exit + fi + RS=$(( $RANDOM % 20 )) + echo "Trying again in $RS seconds..." + sleep $RS + done + fi - # mount persistent to server:/rootpath/nodename - ITER=0 - while ! mount $SNAPSHOTSERVER:/$SNAPSHOTROOT/$ME $NEWROOT/$RWDIR/persistent -o $MNT_OPTIONS; do - ITER=$(( ITER + 1 )) - if [ "$ITER" == "$MAXTRIES" ]; then - echo "Your are dead, rpower $ME boot to play again." - echo "Possible problems: cannot mount to $SNAPSHOTSERVER:/$SNAPSHOTROOT/$ME." - /bin/sh - exit - fi - RS=$(( $RANDOM % 20 )) - echo "Trying again in $RS seconds..." - sleep $RS - done - fi + $NEWROOT/etc/init.d/localdisk + $NEWROOT/etc/init.d/statelite + fastboot=yes + export fastboot + keep_old_ip=yes + export keep_old_ip - $NEWROOT/etc/init.d/localdisk - $NEWROOT/etc/init.d/statelite - fastboot=yes - export fastboot - keep_old_ip=yes - export keep_old_ip - - mount -n --bind /dev $NEWROOT/dev - mount -n --bind /proc $NEWROOT/proc - mount -n --bind /sys $NEWROOT/sys + mount -n --bind /dev $NEWROOT/dev + mount -n --bind /proc $NEWROOT/proc + mount -n --bind /sys $NEWROOT/sys else - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Failed to download image, panicing in 5..." - echo -n Failed to download image, panicing in 5... - for i in 4 3 2 1 0; do - /bin/sleep 1 - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "$i..." - echo -n $i... - done - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "You're dead. rpower nodename reset to play again." - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "* Did you packimage with -m cpio, -m squashfs, or -m nfs?" - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "* If using -m squashfs did you include aufs.ko with geninitrd? e.g.: -n tg3,squashfs,aufs,loop" - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "If using -m nfs did you export NFS and sync rootimg? And did you include the aufs and nfs modules in the proper order: e.g.: -n tg3,aufs,loop,sunrpc,lockd,nfs_acl,nfs" + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Failed to download image, panicing in 5..." + echo -n Failed to download image, panicing in 5... + for i in 4 3 2 1 0; do + /bin/sleep 1 + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "$i..." + echo -n $i... + done + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "You're dead. rpower nodename reset to play again." + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "* Did you packimage with -m cpio, -m squashfs, or -m nfs?" + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "* If using -m squashfs did you include aufs.ko with geninitrd? e.g.: -n tg3,squashfs,aufs,loop" + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "If using -m nfs did you export NFS and sync rootimg? And did you include the aufs and nfs modules in the proper order: e.g.: -n tg3,aufs,loop,sunrpc,lockd,nfs_acl,nfs" - echo - echo "You're dead. rpower nodename reset to play again. + echo + echo "You're dead. rpower nodename reset to play again. * Did you packimage with -m cpio, -m squashfs, or -m nfs? * If using -m squashfs did you include aufs.ko with geninitrd? @@ -268,8 +268,8 @@ else e.g.: -n tg3,aufs,loop,sunrpc,lockd,nfs_acl,nfs " - /bin/sh - exit + /bin/sh + exit fi cd / @@ -293,41 +293,41 @@ function getdevfrommac() { if [ -z $STATEMNT ]; then - for lf in /tmp/dhclient.*.lease; do - netif=${lf#*.} - netif=${netif%.*} - cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases" - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "saving $NEWROOT/var/lib/dhclient/dhclient-$netif.leases" - done + for lf in /tmp/dhclient.*.lease; do + netif=${lf#*.} + netif=${netif%.*} + cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases" + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "saving $NEWROOT/var/lib/dhclient/dhclient-$netif.leases" + done - ifname="$(getarg ifname=)" - netdev="$(getarg netdev=)" - BOOTIF="$(getarg BOOTIF=)" - if [ ! -z "$ifname" ]; then - MACX=${ifname#*:} - ETHX=${ifname%:$MACX*} - elif [ ! -z "$netdev" ]; then - ETHX=$netdev - MACX=`ip link show $netdev | grep ether | awk '{print $2}'` - elif [ ! -z "$BOOTIF" ]; then - MACX=$BOOTIF - MACX=${MACX#01-} - MACX=${MACX//-/:} - ETHX=$(getdevfrommac $MACX) - fi - - - if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then - if [ ! -e $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "creating $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX" - touch $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX + ifname="$(getarg ifname=)" + netdev="$(getarg netdev=)" + BOOTIF="$(getarg BOOTIF=)" + if [ ! -z "$ifname" ]; then + MACX=${ifname#*:} + ETHX=${ifname%:$MACX*} + elif [ ! -z "$netdev" ]; then + ETHX=$netdev + MACX=`ip link show $netdev | grep ether | awk '{print $2}'` + elif [ ! -z "$BOOTIF" ]; then + MACX=$BOOTIF + MACX=${MACX#01-} + MACX=${MACX//-/:} + ETHX=$(getdevfrommac $MACX) + fi + + + if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then + if [ ! -e $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX ]; then + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "creating $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX" + touch $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX + fi + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "writing $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX: DEVICE=$ETHX;BOOTPROTO=dhcp;HWADDR=$MACX;ONBOOT=yes" + echo "DEVICE=$ETHX" > $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX + echo "BOOTPROTO=dhcp" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX + echo "HWADDR=$MACX" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX + echo "ONBOOT=yes" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX fi - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "writing $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX: DEVICE=$ETHX;BOOTPROTO=dhcp;HWADDR=$MACX;ONBOOT=yes" - echo "DEVICE=$ETHX" > $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX - echo "BOOTPROTO=dhcp" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX - echo "HWADDR=$MACX" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX - echo "ONBOOT=yes" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX - fi fi [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "saving $NEWROOT/etc/resolv.conf" @@ -335,7 +335,7 @@ cp /etc/resolv.conf "$NEWROOT/etc/" if [ -d "$NEWROOT/etc/sysconfig" -a ! -e "$NEWROOT/etc/sysconfig/selinux" ]; then [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "disable selinux ..." - echo "SELINUX=disabled" >> "$NEWROOT/etc/sysconfig/selinux" + echo "SELINUX=disabled" >> "$NEWROOT/etc/sysconfig/selinux" fi [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "exiting xcatroot..." From 6ca6a80a560674c54db5aaada801e5f6f379f123 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 25 Jan 2017 15:48:58 -0500 Subject: [PATCH 034/100] Use a more informative logger tag and standard priority --- .../share/xcat/netboot/rh/dracut_033/xcatroot | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot index 9d9fddf7d..fee860920 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot @@ -1,4 +1,5 @@ #!/bin/sh +log_label="xcat.dracut_033" NEWROOT=$3 RWDIR=.statelite @@ -20,11 +21,11 @@ fi xcatdebugmode="$(getarg xcatdebugmode=)" -[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "running xcatroot...." -[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "MASTER=$MASTER XCATIPORT=$XCATIPORT" +[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "running xcatroot...." +[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "MASTER=$MASTER XCATIPORT=$XCATIPORT" if [ "$NODESTATUS" != "0" ]; then -[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "nodestatus: netbooting,reporting..." +[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "nodestatus: netbooting,reporting..." /tmp/updateflag $MASTER $XCATIPORT "installstatus netbooting" fi @@ -35,10 +36,10 @@ if [ ! -z "$imgurl" ]; then NFS=0 FILENAME=${imgurl##*/} while [ ! -r "$FILENAME" ]; do - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "downloading $imgurl...." + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "downloading $imgurl...." echo Getting $imgurl... if ! wget -nv $imgurl; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "downloading $imgurl failed,retrying...." + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "downloading $imgurl failed,retrying...." rm -f $FILENAME sleep 27 fi @@ -69,7 +70,7 @@ if [ -r /rootimg.sfs ]; then mount --move /ro $NEWROOT/ro mount --move /rw $NEWROOT/rw elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...." + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "rootimg downloaded,setting up RAM-root tmpfs...." echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -78,7 +79,7 @@ elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then fi cd $NEWROOT - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Extracting root filesystem:" echo -n "Extracting root filesystem:" if [ -r /rootimg.cpio.gz ]; then if [ -x /bin/cpio ]; then @@ -94,10 +95,10 @@ elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then fi fi $NEWROOT/etc/init.d/localdisk - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Done...." echo Done elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...." + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "rootimg downloaded,setting up RAM-root tmpfs...." echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -106,7 +107,7 @@ elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then fi cd $NEWROOT - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Extracting root filesystem:" echo -n "Extracting root filesystem:" if [ -r /rootimg.tar.gz ]; then tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz @@ -120,7 +121,7 @@ elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then fi fi $NEWROOT/etc/init.d/localdisk - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Done...." echo Done elif [ -r /rootimg-statelite.gz ]; then echo Setting up RAM-root tmpfs for statelite mode. @@ -245,17 +246,17 @@ elif [ -r /rootimg-statelite.gz ]; then mount -n --bind /sys $NEWROOT/sys else - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Failed to download image, panicing in 5..." + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Failed to download image, panicing in 5..." echo -n Failed to download image, panicing in 5... for i in 4 3 2 1 0; do /bin/sleep 1 - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "$i..." + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "$i..." echo -n $i... done - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "You're dead. rpower nodename reset to play again." - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "* Did you packimage with -m cpio, -m squashfs, or -m nfs?" - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "* If using -m squashfs did you include aufs.ko with geninitrd? e.g.: -n tg3,squashfs,aufs,loop" - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "If using -m nfs did you export NFS and sync rootimg? And did you include the aufs and nfs modules in the proper order: e.g.: -n tg3,aufs,loop,sunrpc,lockd,nfs_acl,nfs" + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "You're dead. rpower nodename reset to play again." + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "* Did you packimage with -m cpio, -m squashfs, or -m nfs?" + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "* If using -m squashfs did you include aufs.ko with geninitrd? e.g.: -n tg3,squashfs,aufs,loop" + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "If using -m nfs did you export NFS and sync rootimg? And did you include the aufs and nfs modules in the proper order: e.g.: -n tg3,aufs,loop,sunrpc,lockd,nfs_acl,nfs" echo echo "You're dead. rpower nodename reset to play again. @@ -297,7 +298,7 @@ if [ -z $STATEMNT ]; then netif=${lf#*.} netif=${netif%.*} cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases" - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "saving $NEWROOT/var/lib/dhclient/dhclient-$netif.leases" + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "saving $NEWROOT/var/lib/dhclient/dhclient-$netif.leases" done ifname="$(getarg ifname=)" @@ -319,10 +320,10 @@ if [ -z $STATEMNT ]; then if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then if [ ! -e $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "creating $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX" + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "creating $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX" touch $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX fi - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "writing $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX: DEVICE=$ETHX;BOOTPROTO=dhcp;HWADDR=$MACX;ONBOOT=yes" + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "writing $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX: DEVICE=$ETHX;BOOTPROTO=dhcp;HWADDR=$MACX;ONBOOT=yes" echo "DEVICE=$ETHX" > $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX echo "BOOTPROTO=dhcp" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX echo "HWADDR=$MACX" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX @@ -330,15 +331,15 @@ if [ -z $STATEMNT ]; then fi fi -[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "saving $NEWROOT/etc/resolv.conf" +[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "saving $NEWROOT/etc/resolv.conf" cp /etc/resolv.conf "$NEWROOT/etc/" if [ -d "$NEWROOT/etc/sysconfig" -a ! -e "$NEWROOT/etc/sysconfig/selinux" ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "disable selinux ..." + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "disable selinux ..." echo "SELINUX=disabled" >> "$NEWROOT/etc/sysconfig/selinux" fi -[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "exiting xcatroot..." +[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "exiting xcatroot..." # inject new exit_if_exists echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/xcat.sh # force udevsettle to break From 71a08a91f0b04cd2cd6fc9689eebea57c7b8a985 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 25 Jan 2017 15:59:26 -0500 Subject: [PATCH 035/100] Format the logger messages to be consistent with the echo --- .../share/xcat/netboot/rh/dracut_033/xcatroot | 53 ++++++++++--------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot index fee860920..d7a3fb13b 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot @@ -9,7 +9,9 @@ XCAT="$(getarg XCAT=)" XCATMASTER=$XCAT STATEMNT="$(getarg STATEMNT=)" rootlimit="$(getarg rootlimit=)" +xcatdebugmode="$(getarg xcatdebugmode=)" +[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "in dracut, executing xcatroot..." getarg nonodestatus NODESTATUS=$? @@ -19,13 +21,10 @@ if [ $? -ne 0 ]; then XCATIPORT="3002" fi -xcatdebugmode="$(getarg xcatdebugmode=)" - -[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "running xcatroot...." -[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "MASTER=$MASTER XCATIPORT=$XCATIPORT" +[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "MASTER=$MASTER XCATIPORT=$XCATIPORT NODESTATUS=$NODESTATUS" if [ "$NODESTATUS" != "0" ]; then -[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "nodestatus: netbooting,reporting..." +[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Reporting installstatus=netbooting..." /tmp/updateflag $MASTER $XCATIPORT "installstatus netbooting" fi @@ -36,10 +35,10 @@ if [ ! -z "$imgurl" ]; then NFS=0 FILENAME=${imgurl##*/} while [ ! -r "$FILENAME" ]; do - [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "downloading $imgurl...." + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Downloading $imgurl..." echo Getting $imgurl... if ! wget -nv $imgurl; then - [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "downloading $imgurl failed,retrying...." + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Downloading $imgurl FAILED, retrying..." rm -f $FILENAME sleep 27 fi @@ -54,6 +53,7 @@ if [ ! -z "$imgurl" ]; then SERVER=${SERVER%:} ROOTDIR=/${ROOTDIR#*/} fi + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Download complete." fi #echo 0 > /proc/sys/vm/zone_reclaim_mode #Avoid kernel bug @@ -70,7 +70,7 @@ if [ -r /rootimg.sfs ]; then mount --move /ro $NEWROOT/ro mount --move /rw $NEWROOT/rw elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "rootimg downloaded,setting up RAM-root tmpfs...." + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Downloaded rootimg.cpio.[gz/xz]...Setting up RAM-root tmpfs." echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -79,8 +79,8 @@ elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then fi cd $NEWROOT - [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Extracting root filesystem:" - echo -n "Extracting root filesystem:" + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Extracting the root filesystem..." + echo -n "Extracting the root filesystem..." if [ -r /rootimg.cpio.gz ]; then if [ -x /bin/cpio ]; then gzip -cd /rootimg.cpio.gz |/bin/cpio -idum @@ -95,10 +95,10 @@ elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then fi fi $NEWROOT/etc/init.d/localdisk - [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Done...." - echo Done + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Done extracting the root filesystem..." + echo "Done extracting the root filesystem..." elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "rootimg downloaded,setting up RAM-root tmpfs...." + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Downloaded rootimg.tar.[gz/xz]...Setting up RAM-root tmpfs." echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -107,8 +107,8 @@ elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then fi cd $NEWROOT - [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Extracting root filesystem:" - echo -n "Extracting root filesystem:" + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Extracting the root filesystem..." + echo -n "Extracting the root filesystem..." if [ -r /rootimg.tar.gz ]; then tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz if [ $? -ne 0 ]; then @@ -121,9 +121,10 @@ elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then fi fi $NEWROOT/etc/init.d/localdisk - [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Done...." - echo Done + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Done extracting the root filesystem." + echo "Done extracting the root filesystem." elif [ -r /rootimg-statelite.gz ]; then + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Setting up RAM-root tmpfs for statelite mode." echo Setting up RAM-root tmpfs for statelite mode. if [ -z $rootlimit];then @@ -133,13 +134,15 @@ elif [ -r /rootimg-statelite.gz ]; then fi cd $NEWROOT - echo -n "Extracting root filesystem:" + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Extracting the root filesystem..." + echo -n "Extracting root filesystem..." if [ -x /bin/cpio ]; then gzip -cd /rootimg-statelite.gz |/bin/cpio -idum else gzip -cd /rootimg-statelite.gz |cpio -idum fi - echo Done + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Done extracting the root filesystem." + echo "Done extracting the root filesystem." # then, the statelite staffs will be processed echo Setting up Statelite modprobe nfs @@ -246,8 +249,8 @@ elif [ -r /rootimg-statelite.gz ]; then mount -n --bind /sys $NEWROOT/sys else - [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Failed to download image, panicing in 5..." - echo -n Failed to download image, panicing in 5... + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Failed to download image, panic in 5..." + echo -n Failed to download image, panic in 5... for i in 4 3 2 1 0; do /bin/sleep 1 [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "$i..." @@ -298,7 +301,7 @@ if [ -z $STATEMNT ]; then netif=${lf#*.} netif=${netif%.*} cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases" - [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "saving $NEWROOT/var/lib/dhclient/dhclient-$netif.leases" + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Saving $NEWROOT/var/lib/dhclient/dhclient-$netif.leases" done ifname="$(getarg ifname=)" @@ -320,10 +323,10 @@ if [ -z $STATEMNT ]; then if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then if [ ! -e $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX ]; then - [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "creating $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX" + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Creating $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX" touch $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX fi - [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "writing $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX: DEVICE=$ETHX;BOOTPROTO=dhcp;HWADDR=$MACX;ONBOOT=yes" + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Writing $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX: DEVICE=$ETHX;BOOTPROTO=dhcp;HWADDR=$MACX;ONBOOT=yes" echo "DEVICE=$ETHX" > $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX echo "BOOTPROTO=dhcp" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX echo "HWADDR=$MACX" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX @@ -331,7 +334,7 @@ if [ -z $STATEMNT ]; then fi fi -[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "saving $NEWROOT/etc/resolv.conf" +[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Saving $NEWROOT/etc/resolv.conf" cp /etc/resolv.conf "$NEWROOT/etc/" if [ -d "$NEWROOT/etc/sysconfig" -a ! -e "$NEWROOT/etc/sysconfig/selinux" ]; then From 6e7f374a4a20520a8b0d4881ad4b066822d56874 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 25 Jan 2017 16:01:41 -0500 Subject: [PATCH 036/100] Improve the output message when switch information fails to refresh --- perl-xCAT/xCAT/FSPvm.pm | 4 ++-- perl-xCAT/xCAT/MacMap.pm | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/perl-xCAT/xCAT/FSPvm.pm b/perl-xCAT/xCAT/FSPvm.pm index 15badd518..a00285672 100644 --- a/perl-xCAT/xCAT/FSPvm.pm +++ b/perl-xCAT/xCAT/FSPvm.pm @@ -2037,7 +2037,7 @@ sub query_cec_info { if (scalar(@$rethash)) { push @result, @$rethash; } else { - push @result, [ $name, "No information got", -1 ]; + push @result, [ $name, "No information obtained.", -1 ]; last; } $lpar_hash{$name} = \%tmp_hash; @@ -2048,7 +2048,7 @@ sub query_cec_info { if (scalar(@$rethash)) { push @result, @$rethash; } else { - push @result, [ @td[3], "No information got", -1 ]; + push @result, [ @td[3], "No information obtained.", -1 ]; last; } diff --git a/perl-xCAT/xCAT/MacMap.pm b/perl-xCAT/xCAT/MacMap.pm index e857cf9f5..54edb1824 100644 --- a/perl-xCAT/xCAT/MacMap.pm +++ b/perl-xCAT/xCAT/MacMap.pm @@ -329,14 +329,14 @@ sub dump_mac_info { foreach my $switch (keys %{ $self->{switchparmhash} }) { if ($dump_all_switches or defined($switches_to_dump{$switch})) { if ($self->{show_verbose_info}) { - xCAT::MsgUtils->message("I", { data => ["$switch: Start to get information"] }, $self->{callback}); + xCAT::MsgUtils->message("I", { data => ["$switch: Attempting to refresh switch information..."] }, $self->{callback}); } $self->refresh_switch(undef, $community, $switch); if ($self->{show_verbose_info}) { - xCAT::MsgUtils->message("I", { data => ["$switch: Finish to get information"] }, $self->{callback}); + xCAT::MsgUtils->message("I", { data => ["$switch: Finished refreshing switch information."] }, $self->{callback}); } if (!defined($self->{macinfo}->{$switch})) { - $ret{$switch}->{ErrorStr} = "No information get"; + $ret{$switch}->{ErrorStr} = "No switch information obtained."; foreach my $defportname (keys %{ $self->{switches}->{$switch} }) { $ret{$switch}->{$defportname}->{Node} = $self->{switches}->{$switch}->{$defportname}; } From c028e764813c802539a35184f0bbf6176dcf5a9b Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 31 Jan 2017 13:03:53 -0500 Subject: [PATCH 037/100] Test for hostnamectl and if found, set the hostname using NODE and DOMAIN environment variables --- xCAT/postscripts/hardeths | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xCAT/postscripts/hardeths b/xCAT/postscripts/hardeths index be1411ede..e4aeef2c0 100755 --- a/xCAT/postscripts/hardeths +++ b/xCAT/postscripts/hardeths @@ -72,6 +72,17 @@ else echo "GATEWAY=$defgw" >> /etc/sysconfig/network fi fi + +HOSTNAMECTL=`which hostnamectl 2>&1 | grep -v "/usr/bin/which: no"` +if [ ! -z $HOSTNAMECTL ] && [ ! -z $NODE ]; then + SET_HOSTNAME=$NODE + if [ ! -z $DOMAIN ]; then + SET_HOSTNAME=$NODE.$DOMAIN + fi + echo "Setting hostname to: $SET_HOSTNAME" + hostnamectl set-hostname $SET_HOSTNAME +fi + for nic in `ip link |grep "BROADCAST" |awk '{print $2}' | sed s/://`; do IPADDRMASK=`ip addr show dev $nic | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1` IPADDR=`echo $IPADDRMASK | awk -F'/' '{print $1}'` From defecc74961129f2c224b4b452dfaa7475524754 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 31 Jan 2017 13:52:14 -0500 Subject: [PATCH 038/100] Fix typo in bmcsetup if test --- xCAT-genesis-scripts/bin/bmcsetup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-scripts/bin/bmcsetup b/xCAT-genesis-scripts/bin/bmcsetup index 80829fe0a..13a6eb47d 100755 --- a/xCAT-genesis-scripts/bin/bmcsetup +++ b/xCAT-genesis-scripts/bin/bmcsetup @@ -253,7 +253,7 @@ elif [ "$IPMIMFG" == "674" ]; then # DELL logger -s -t $log_label -p local4.info "BMCPORT is $BMCPORT" if [ "$BMCPORT" == "0" ]; then # dedicated ipmitool delloem lan set dedicated &>/dev/null - elif [ "$BMCPORT" == "1" -o "$BMCPORT" == "2" -o "$BMCPORT" == "3" -o "$BMCPORT" == "4"]; then # shared + elif [ "$BMCPORT" == "1" -o "$BMCPORT" == "2" -o "$BMCPORT" == "3" -o "$BMCPORT" == "4" ]; then # shared ipmitool delloem lan set shared &>/dev/null ipmitool delloem lan set shared with lom$BMCPORT &>/dev/null ipmitool delloem lan set shared with failover all loms &>dev/null From d1088318bcce0076d4369e80c4344711617782f4 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 31 Jan 2017 16:00:36 -0500 Subject: [PATCH 039/100] Update mlnxofed_ib_install_v2_diskless.rst --- .../infiniband/mlnxofed_ib_install_v2_diskless.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskless.rst b/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskless.rst index ae1be14ca..36af543e7 100644 --- a/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskless.rst +++ b/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskless.rst @@ -44,14 +44,12 @@ Diskless Installation packimage -#. Provision the node +#. Provision the node :: + rinstall osimage=rhels7.2-ppc64le-netboot-compute + #. Verification - * The Mellanox IB drivers are located at: ``/lib/modules//extra/`` - - * Use the ``ibv_devinfo`` comamnd to obtain information about the InfiniBand adapter - * Check the status of ``openibd`` service sysVinit: :: @@ -62,3 +60,6 @@ Diskless Installation systemctl status openibd.service + * Verify that the Mellanox IB drivers are located at: ``/lib/modules//extra/`` + + * Use the ``ibv_devinfo`` comamnd to obtain information about the InfiniBand adapter. From 1a400c31abb898bbcea220572ab198acc4f0fa40 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 31 Jan 2017 16:01:55 -0500 Subject: [PATCH 040/100] Update mlnxofed_ib_install_v2_diskful.rst --- .../infiniband/mlnxofed_ib_install_v2_diskful.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskful.rst b/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskful.rst index 0db6df69e..610dd6384 100644 --- a/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskful.rst +++ b/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskful.rst @@ -24,14 +24,12 @@ Diskful Installation -p postscripts="mlnxofed_ib_install -p /install// \ -m --add-kernel-support -end-" -#. Provision the node +#. Provision the node :: + + rinstall osimage= #. Verification - * The Mellanox IB drivers are located at: ``/lib/modules//extra/`` - - * Use the ``ibv_devinfo`` comamnd to obtain information about the InfiniBand adapter - * Check the status of ``openibd`` service sysVinit: :: @@ -42,3 +40,6 @@ Diskful Installation systemctl status openibd.service + * Verify that the Mellanox IB drivers are located at: ``/lib/modules//extra/`` + + * Use the ``ibv_devinfo`` comamnd to obtain information about the InfiniBand adapter. From d6d235fbd3b2594d6fbaa8cdd7bbfe8e9c08aebc Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 31 Jan 2017 16:09:28 -0500 Subject: [PATCH 041/100] Clean up formatting of MySQL spelling --- .../service_node/changing_hostname_ip.rst | 6 +----- .../hamn/setup_ha_mgmt_node_with_shared_data.rst | 10 +++++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/docs/source/advanced/cluster_maintenance/service_node/changing_hostname_ip.rst b/docs/source/advanced/cluster_maintenance/service_node/changing_hostname_ip.rst index e99134962..f971eb7ba 100644 --- a/docs/source/advanced/cluster_maintenance/service_node/changing_hostname_ip.rst +++ b/docs/source/advanced/cluster_maintenance/service_node/changing_hostname_ip.rst @@ -36,11 +36,7 @@ Database Connection Changes Granting or revoking access privilege in the database for the service node. -* For mysql, refer to :ref:`grante_revoke_mysql_access_label`. -.. There is no procedure in old document on sourceforge for postgress to - grant or revoke the access privilege for service node. - -* For postgress, refer to `TODO `_. +* For MySQL, refer to :ref:`grante_revoke_mysql_access_label`. Update Provision Environment on Service Node -------------------------------------------- diff --git a/docs/source/advanced/hamn/setup_ha_mgmt_node_with_shared_data.rst b/docs/source/advanced/hamn/setup_ha_mgmt_node_with_shared_data.rst index 5a80aade9..6a3e1b98a 100644 --- a/docs/source/advanced/hamn/setup_ha_mgmt_node_with_shared_data.rst +++ b/docs/source/advanced/hamn/setup_ha_mgmt_node_with_shared_data.rst @@ -56,7 +56,7 @@ The configuration procedure will be quite different based on the shared data mec / -``Note``:For mysql, the database directory is ``/var/lib/mysql``; for postgresql, the database directory is ``/var/lib/pgsql``; for DB2, the database directory is specified with the site attribute databaseloc; for sqlite, the database directory is /etc/xcat, already listed above. +``Note``:For MySQL, the database directory is ``/var/lib/mysql``; for PostGreSQL, the database directory is ``/var/lib/pgsql``; for DB2, the database directory is specified with the site attribute databaseloc; for sqlite, the database directory is /etc/xcat, already listed above. Here is an example of how to make directories be shared data through NFS: :: @@ -125,7 +125,7 @@ Setup xCAT on the Primary Management Node service dhcpd stop chkconfig --level 2345 dhcpd off -#. Stop Database and prevent the database from auto starting at boot time, use mysql as an example: :: +#. Stop Database and prevent the database from auto starting at boot time, use MySQL as an example: :: service mysqld stop chkconfig mysqld off @@ -180,7 +180,7 @@ Setup xCAT on the Standby Management Node service dhcpd stop chkconfig --level 2345 dhcpd off -#. Stop Database and prevent the database from auto starting at boot time. Use mysql as an example: :: +#. Stop Database and prevent the database from auto starting at boot time. Use MySQL as an example: :: service mysqld stop chkconfig mysqld off @@ -303,7 +303,7 @@ If the management node is still available and running the cluster, perform the f #. Stop database - Use mysql as an example: :: + Use MySQL as an example: :: service mysqld stop @@ -346,7 +346,7 @@ On the new primary management node: mount /.xcat mount /db2database -#. Start database, use mysql as an example: :: +#. Start database, use MySQL as an example: :: service mysql start From 4de4fa8fae5f237f1937035d6390ccfa53357368 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 31 Jan 2017 16:10:38 -0500 Subject: [PATCH 042/100] Add security Bulletin for 1/26/17 --- docs/source/security/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/security/index.rst b/docs/source/security/index.rst index 4f9535ac9..911c9ec62 100644 --- a/docs/source/security/index.rst +++ b/docs/source/security/index.rst @@ -4,5 +4,6 @@ Security Notices .. toctree:: :maxdepth: 2 + 2017/index.rst 2016/index.rst 2015/index.rst From 19f6e8d2422dd02ca09ff6c9a614cdf79a17c071 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 31 Jan 2017 16:34:26 -0500 Subject: [PATCH 043/100] fix random errors in documentation build --- .../mgmt_node/changing_hostname_ip.rst | 64 ++++++------- .../switch_based_switch_discovery.rst | 91 +++++++++---------- .../additionalpkg/ubuntu_os_other_pkg.rst | 5 +- .../ppc64le/statelite/advanced_features.rst | 2 +- 4 files changed, 77 insertions(+), 85 deletions(-) diff --git a/docs/source/advanced/cluster_maintenance/mgmt_node/changing_hostname_ip.rst b/docs/source/advanced/cluster_maintenance/mgmt_node/changing_hostname_ip.rst index fda96e1ad..72282f3fb 100644 --- a/docs/source/advanced/cluster_maintenance/mgmt_node/changing_hostname_ip.rst +++ b/docs/source/advanced/cluster_maintenance/mgmt_node/changing_hostname_ip.rst @@ -52,7 +52,7 @@ Change the Management Hostname hostname -* Edit hostname configuration file +* Update the hostname configuration files: | Add hostname in ``/etc/hostname`` | Add HOSTNAME attribute in ``/etc/sysconfig/network`` (only for [RHEL]) @@ -60,29 +60,29 @@ Change the Management Hostname Update Database Files --------------------- -You need to update the new MN hostname or IP address in several database -configuration files. +You need to update the new MN hostname or IP address in several database configuration files. SQLite ^^^^^^ Nothing to do. -Postgresql +PostgreSQL ^^^^^^^^^^ -- Edit ``/etc/xcat/cfgloc`` file, replace ``Pg:dbname=xcatdb;host=|xcatadm|xcat20`` - with ``Pg:dbname=xcatdb;host=|xcatadm|xcat20``. +- Edit ``/etc/xcat/cfgloc`` file... -- Edit config database config file ``/var/lib/pgsql/data/pg_hba.conf``, - replace ``host all all /32 md5`` - with ``host all all /32 md5``. + Replace ``Pg:dbname=xcatdb;host=|xcatadm|xcat20`` with ``Pg:dbname=xcatdb;host=|xcatadm|xcat20``. -Mysql +- Edit config database config file ``/var/lib/pgsql/data/pg_hba.conf``... + + Replace ``host all all /32 md5`` with ``host all all /32 md5`` + +MySQL ^^^^^ -Edit ``/etc/xcat/cfglooc``, replace ``mysql:dbname=xcatdb;host=|xcatadmin|xcat20`` -with ``mysql:dbname=xcatdb;host=|xcatadmin|xcat20``. +- Edit ``/etc/xcat/cfglooc``... + Replace ``mysql:dbname=xcatdb;host=|xcatadmin|xcat20`` with ``mysql:dbname=xcatdb;host=|xcatadmin|xcat20`` Start the database ------------------ @@ -116,12 +116,12 @@ Change the site table master attribute Change all IP address attribute relevant to the MN IP address ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -For example, old address was "10.6.0.1" +For example, the old IP address was "10.6.0.1" -* Query the attributes with old address :: +* Query all the attributes with old address :: lsdef -t node -l | grep "10.6.0.1" - # the output may looks like + ... conserver=10.6.0.1 conserver=10.6.0.1 conserver=10.6.0.1 @@ -138,26 +138,23 @@ For example, old address was "10.6.0.1" servicenode=10.6.0.1 xcatmaster=10.6.0.1 -* As the attribute with the old IP address is list above, take conserver as - a example, query the nodes with ``conserver=10.6.0.1``. - - :: +* Looking at the list above, taking ``conserver`` as an example, query the nodes with ``conserver=10.6.0.1``: :: lsdef -t node -w conserver="10.6.0.1" - # the output looks like + ... cn1 (node) cn2 (node) cn3 (node) cn4 (node) -* Change the conserver address for cn1,cn2,cn3,cn4 :: +* Change the conserver address for nodes ``cn1,cn2,cn3,cn4`` :: chdef -t node cn1-cn4 conserver= -Repeat the same process for the other attributes. +* Repeat the same process for the other attributes containing the old IP address. Change networks table -^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^ Check your networks table to see if the network definitions are still correct, if not edit accordingly :: @@ -166,7 +163,7 @@ if not edit accordingly :: chdef -t network Check Result -^^^^^^^^^^^^^ +^^^^^^^^^^^^ You can check whether all the old address has been changed using :: @@ -174,25 +171,24 @@ You can check whether all the old address has been changed using :: cd fgrep "10.6.0.1" *.csv -If the old address still exists in the ``*.csv` file, you can edit this file, -then use the following command to restore the records :: +If the old address still exists in the ``*.csv`` file, you can edit this file, then use the following command to restore the records :: tabrestore Generate SSL credentials(optional) ---------------------------------- -If you do not generate new credentials, skip this section. -If you decide generate new credentials, then you will use the following -command. +Use the following command to generate new SSL credentials: ``xcatconfig -c``. -* Generate new credentials :: +Then update the following in xCAT: - xcatconfig -c +* Update the policy table with new management node name and replace: :: -* Update the policy table with new MN name, - replace ``"1.4","old_MN_name",,,,,,"trusted",,`` with - ``"1.4","new_MN_name",,,,,,"trusted",,`` + "1.4","old_MN_name",,,,,,"trusted",, + + with: :: + + "1.4","new_MN_name",,,,,,"trusted",,`` * Setup up conserver with new credentials :: diff --git a/docs/source/advanced/networks/switchdiscover/switch_based_switch_discovery.rst b/docs/source/advanced/networks/switchdiscover/switch_based_switch_discovery.rst index f67b76d10..d2b9df8b7 100644 --- a/docs/source/advanced/networks/switchdiscover/switch_based_switch_discovery.rst +++ b/docs/source/advanced/networks/switchdiscover/switch_based_switch_discovery.rst @@ -8,34 +8,28 @@ Pre-requirement In order to do switch-based switch discovery, the admin -1. Needs to manually setup and configure core-switch, SNMP v3 needs to be enabled in order for xCAT access to it. **username** and **userpassword** attributes are for the remote login. It can be for **ssh** or **telnet**. If it is for **telnet**, set protocol to “telnet”. If the **username** is blank, the **username** and **password** will be retrieved from the passwd table with “switch” as the key. SNMP attributes will used for SNMPv3 communication. **nodetype** has to be set to "switch" to differentiate between switch-based node discovery or switch-based switch discovery. Refer to switches table attributes. Example of core-switch definition: +1. Needs to manually setup and configure core-switch, SNMP v3 needs to be enabled in order for xCAT access to it. **username** and **userpassword** attributes are for the remote login. It can be for **ssh** or **telnet**. If it is for **telnet**, set protocol to “telnet”. If the **username** is blank, the **username** and **password** will be retrieved from the passwd table with “switch” as the key. SNMP attributes will used for SNMPv3 communication. **nodetype** has to be set to "switch" to differentiate between switch-based node discovery or switch-based switch discovery. Refer to switches table attributes. Example of core-switch definition: :: -:: + lsdef switch-10-5-23-1 + Object name: switch-10-5-23-1 + groups=switch + ip=10.5.23.1 + mac=ab:cd:ef:gh:dc + mgt=switch + nodetype=switch + password=admin + postbootscripts=otherpkgs + postscripts=syslog,remoteshell,syncfiles + protocol=telnet + snmpauth=sha + snmppassword=userpassword + snmpusername=snmpadmin + snmpversion=3 + switchtype=BNT + usercomment=IBM + username=root - lsdef switch-10-5-23-1 - Object name: switch-10-5-23-1 - groups=switch - ip=10.5.23.1 - mac=ab:cd:ef:gh:dc - mgt=switch - nodetype=switch - password=admin - postbootscripts=otherpkgs - postscripts=syslog,remoteshell,syncfiles - protocol=telnet - snmpauth=sha - snmppassword=userpassword - snmpusername=snmpadmin - snmpversion=3 - switchtype=BNT - usercomment=IBM - username=root - - - -2. Predefine all top-rack switches which connect to core-switch. The attribute **ip** is static ip address for the switch. When ``switchdiscover --setup`` command is issued, this ip address will replace dhcp IP address on the switch. **nodetype=switch** needs to be set to differentiate between switch-based node discovery or switch-based switch discovery during discovery process. the attribute **switch** is hostname of core-switch and **switchport** is the port number in the core-switch that top-rack switch is connected to. - -:: +2. Predefine all top-rack switches which connect to core-switch. The attribute **ip** is static IP address for the switch. When ``switchdiscover --setup`` command is issued, this IP address will replace dhcp IP address on the switch. **nodetype=switch** needs to be set to differentiate between switch-based node discovery or switch-based switch discovery during discovery process. the attribute **switch** is hostname of core-switch and **switchport** is the port number in the core-switch that top-rack switch is connected to. :: lsdef switch-192-168-5-22 objtype=node @@ -50,13 +44,13 @@ In order to do switch-based switch discovery, the admin 3. Add switches to /etc/hosts for hostname lookup and xdsh command. :: - makehosts switch-192-168-5-23 - makehosts switch-192-168-5-22 + makehosts switch-192-168-5-23 + makehosts switch-192-168-5-22 4. Setup Dynamic IP range in network table for discovered switches to use. :: - # tabdump networks + # tabdump networks #netname,net,mask,mgtifname,gateway,dhcpserver,tftpserver,nameservers,ntpservers,logservers,dynamicrange,staticrange,staticrangeincrement,nodehostname,ddnsdomain,vlanid,domain,mtu,comments,disable "192_168_0_0-255_255_0_0","192.168.0.0","255.255.0.0","enP4p1s0f2","",,"192.168.3.29",,,,"192.168.5.150-192.168.5.170",,,,,,,,, @@ -67,7 +61,7 @@ dhcp should be restarted after seting up dynamic IP range. Discover Switches ~~~~~~~~~~~~~~~~~ -xCAT supports **switchdiscover** command to discover the switches that are attached to the subnets on xCAT management node. Refer to http://xcat-docs.readthedocs.io/en/latest/advanced/networks/switchdiscover/switches_discovery.html for more info. +xCAT supports **switchdiscover** command to discover the switches that are attached to the subnets on xCAT management node. Refer to :doc:`/advanced/networks/switchdiscover/switches_discovery` for more info. For the switch-based switch discovery, we add **–setup** flag: :: @@ -125,13 +119,11 @@ if **--setup** flag is specified, the command will perform following steps: Configure switches ~~~~~~~~~~~~~~~~~~ -The **switchdiscover** command with ``--setup`` flag will set up switches with static ip address, change the hostname from predefine switches and enable snmpv3 configuration. For other switches configuration, Refer to http://xcat-docs.readthedocs.io/en/latest/advanced/networks/ethernet_switches/ethernet_switches.html and http://xcat-docs.readthedocs.io/en/latest/advanced/networks/infiniband/switch_configuration.html +The **switchdiscover** command with ``--setup`` flag will set up switches with static IP address, change the hostname from predefine switches and enable snmpv3 configuration. For other switches configuration, refer to :doc:`/advanced/networks/ethernet_switches/ethernet_switches` and :doc:`/advanced/networks/infiniband/switch_configuration`. -These two config files are located in the **/opt/xcat/share/xcat/scripts**. The **switchdiscover** process will call the config files with ``--all`` option. User can call these scripts to setup one of options manually. +These two config files are located in the **/opt/xcat/share/xcat/scripts** directory. The **switchdiscover** process will call the config files with ``--all`` option. User can call these scripts to setup one of options manually. -1. **configBNT** is for configure BNT switches. - -:: +1. **configBNT** is for configure BNT switches. :: ./configBNT --help Usage: @@ -142,21 +134,22 @@ These two config files are located in the **/opt/xcat/share/xcat/scripts**. The configBNT [--switches switchnames] [--snmp] [--user snmp_user] [--password snmp_password] [--group snmp_group] configBNT [--switches switchnames] [--port port] [--vlan vlan] -2. **configMellanox** is for configuring Mellanox switch. The script will configure ntp service on the switch with xCAT MN and will use rspconfig command to - * enable ssh - * enable snmp function on the switch - * enable the snmp trap - * set logging destination to xCAT MN +2. **configMellanox** is for configuring Mellanox switch. The script will configure ntp service on the switch with xCAT MN and will use rspconfig command to -:: + * enable ssh + * enable snmp function on the switch + * enable the snmp trap + * set logging destination to xCAT MN - ./configMellanox --help - Usage: - configMellonax [-?│-h│--help] - configMellonax [--switches switchnames] [--all] - configMellonax [--switches switchnames] [--ip] - configMellonax [--switches switchnames] [--name] - configMellonax [--switches switchnames] [--config] + :: + + ./configMellanox --help + Usage: + configMellonax [-?│-h│--help] + configMellonax [--switches switchnames] [--all] + configMellonax [--switches switchnames] [--ip] + configMellonax [--switches switchnames] [--name] + configMellonax [--switches switchnames] [--config] Switch Status @@ -166,7 +159,7 @@ During the switch-based switch discovery process, there are four states displaye **Matched** --- Discovered switch is matched to predefine switch, **otherinterfaces** attribute is updated to dhcp IP address, and mac address, **switch type** and **usercomment** also updated with vendor information for the predefined switch. -**ip_configed** --- switch is set up to static ip address based on predefine switch IP address. If failure to set up IP address, the status will stay as **Matched**. +**ip_configed** --- switch is set up to static IP address based on predefine switch IP address. If failure to set up IP address, the status will stay as **Matched**. **hostname_configed** -- switch host name is changed based on predefine switch hostname. If failure to change hostname on the switch, the status will stay as **ip_configed**. diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/additionalpkg/ubuntu_os_other_pkg.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/additionalpkg/ubuntu_os_other_pkg.rst index e7a3fa7db..f8caa0e95 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/additionalpkg/ubuntu_os_other_pkg.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/additionalpkg/ubuntu_os_other_pkg.rst @@ -32,5 +32,8 @@ Compute nodes can access the internet Compute nodes can not access the internet ------------------------------------------ -If compute nodes cannot access the internet, there are two ways to install additional packages:use apt proxy or use local mirror according to :ref:`ubuntu-install-non-internet` +If compute nodes cannot access the internet, there are two ways to install additional packages + + * use apt proxy + * use local mirror diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/advanced_features.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/advanced_features.rst index 416f4a22c..cb5aca4e9 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/advanced_features.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/advanced_features.rst @@ -69,7 +69,7 @@ In order to describe the hierarchy scenarios we can use , ``P`` to denote parent +--------------+-----------------------------------------------------+-------------------------------------------------+ | P: link C: | "ALL","/root/testlinkpers/","link",, | Both parent and child are created in tmpfs | | link, | "ALL","/root/testlink/testlinkchild",, | on the booted node following their respective | -| persistent | "link,persistent" | options; there's only one symbolic link of | +| persistent | "link,persistent" | options; there's only one symbolic link of | | | | the parent is created in the local file system. | +--------------+-----------------------------------------------------+-------------------------------------------------+ | P:link, | "ALL","/root/testlinkpers/","link,persistent",, | NOT permitted | From ff2c6351af0ae672770dbaf7a81a61e7b2dfb7c7 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 31 Jan 2017 16:41:15 -0500 Subject: [PATCH 044/100] Add security bulletin files --- .../source/security/2017/20170126_openssl.rst | 27 +++++++++++++++++++ docs/source/security/2017/index.rst | 7 +++++ 2 files changed, 34 insertions(+) create mode 100644 docs/source/security/2017/20170126_openssl.rst create mode 100644 docs/source/security/2017/index.rst diff --git a/docs/source/security/2017/20170126_openssl.rst b/docs/source/security/2017/20170126_openssl.rst new file mode 100644 index 000000000..037ad97cb --- /dev/null +++ b/docs/source/security/2017/20170126_openssl.rst @@ -0,0 +1,27 @@ +2017-01-27 - OpenSSL Vulnerabilities +==================================== + +*Jan 26, 2017*, OpenSSL announced the following security advisories: https://www.openssl.org/news/secadv/20170126.txt + + +Advisory CVEs +------------- + +* CVE-2017-3731 - **Truncated packet could crash via OOB read** (Severity:Moderate) + +* CVE-2017-3730 - **Bad (EC)DHE parameters cause a client crash** (Severity: Moderate) + +* CVE-2017-3732 - **BN_mod_exp may produce incorrect results on x86_64** (Severity: Moderate) + +* CVE-2016-7055 - **Montgomery multiplication may produce incorrect results** (Severity: Low) + +Please see the security bulletin above for patch, upgrade, or suggested work around information. + +Action +------ + +xCAT uses OpenSSL for client-server communication but **does not** ship it. + +It is highly recommended to keep your OpenSSL levels up-to-date with the indicated versions in the security bulletins to prevent any potential security threats. Obtain the updated software packages from your Operating system distribution channels. + + diff --git a/docs/source/security/2017/index.rst b/docs/source/security/2017/index.rst new file mode 100644 index 000000000..7c5b764ff --- /dev/null +++ b/docs/source/security/2017/index.rst @@ -0,0 +1,7 @@ +2017 Notices +============ + +.. toctree:: + :maxdepth: 1 + + 20170126_openssl.rst From b60c007f274a06612fde896ec5d80f01b84127fa Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 1 Feb 2017 13:05:19 -0500 Subject: [PATCH 045/100] Clean up commented code that is useless in the console files --- xCAT-server/share/xcat/cons/blade | 41 ------ xCAT-server/share/xcat/cons/fsp | 197 -------------------------- xCAT-server/share/xcat/cons/hmc | 199 +-------------------------- xCAT-server/share/xcat/cons/hpblade | 38 ----- xCAT-server/share/xcat/cons/ipmi | 26 +--- xCAT-server/share/xcat/cons/ivm | 190 ------------------------- xCAT-server/share/xcat/cons/kvm | 17 --- xCAT-server/share/xcat/cons/multiple | 5 - xCAT-server/share/xcat/cons/xen | 19 --- 9 files changed, 3 insertions(+), 729 deletions(-) diff --git a/xCAT-server/share/xcat/cons/blade b/xCAT-server/share/xcat/cons/blade index 66e50dfbc..cb4bb08d5 100755 --- a/xCAT-server/share/xcat/cons/blade +++ b/xCAT-server/share/xcat/cons/blade @@ -32,57 +32,19 @@ BEGIN exit 0; } get_lock(); - - #my $sleepint=int(rand(10)); #Stagger start to avoid overwhelming conserver/xCATd - #print "Opening console in ".(2+(0.5*$sleepint))." seconds...\n"; - #sleep $sleepint; } my $sleepint = int(rand(10)); #Stagger start to avoid overwhelming conserver/xCATd use lib "$::XCATROOT/lib/perl"; require xCAT::Client; - -#require xCAT::Table; -#require xCAT::Utils; require File::Basename; import File::Basename; my $scriptname = $0; -#$mptab = xCAT::Table->new('mp'); -#unless ($mptab) { -#sleep 5; #Try not to overwhelm logfiles... -# die "mp table must be configured"; -#} -#$mpatab = xCAT::Table->new('mpa'); -#$passtab = xCAT::Table->new('passwd'); - my $username = "USERID"; my $passsword = "PASSW0RD"; my $mm; my $slot; -#my $dba; -#if ($passtab) { -# ($dba) = $passtab->getAttribs({key=>blade},qw(username password)); -# if ($dba->{username}) { -# $username = $dba->{username}; -# } -# if ($dba->{password}) { -# $password = $dba->{password}; -# } -#} - -#$dba = $mptab->getNodeAttribs($ARGV[0],[qw(mpa id)]); -#$mm = $dba->{mpa}; -#$slot = $dba->{id}; -#if ($mpatab) { -# ($dba) = $mpatab->getAttribs({mpa=>$mm},qw(username password)); -# if ($dba) { -# if ($dba->{username}) { $username = $dba->{username}; } -# if ($dba->{password}) { $password = $dba->{password}; } -# } -#} -#xCAT::Utils::close_all_dbhs; -#sleep 5; #Slow start, I know, but with exec, can't return sub getans { my $rsp = shift; if ($rsp->{node}) { @@ -117,9 +79,6 @@ while ($solstatus !~ /SOL Session: Ready/ and $solstatus !~ /SOL Session: Active } exec "ssh -t $username" . "@" . "$mm console -o -T blade[$slot]"; -#my $pathtochild= dirname($scriptname). "/"; -#exec $pathtochild."blade.expect $mm $slot $username $password"; - #SECURITY: In this case, the authentication is expected to be done using the script user's ssh keys. As such, #this script does not receive any particularly sensitive data from the xCAT server. diff --git a/xCAT-server/share/xcat/cons/fsp b/xCAT-server/share/xcat/cons/fsp index b2030b127..3abd0b46e 100755 --- a/xCAT-server/share/xcat/cons/fsp +++ b/xCAT-server/share/xcat/cons/fsp @@ -32,24 +32,14 @@ BEGIN exit 0; } get_lock(); - - #my $sleepint=int(rand(10)); #Stagger start to avoid overwhelming conserver/xCATd - #print "Opening console in ".(2+(0.5*$sleepint))." seconds...\n"; - #sleep $sleepint; } my $sleepint = int(rand(10)); use lib "$::XCATROOT/lib/perl"; require xCAT::Client; require xCAT::Utils; use strict; - -#use Getopt::Long; -#use xCAT::Table; -#use xCAT::PPCdb; use Expect; -#use xCAT::DBobjUtils; -#use Data::Dumper; require File::Basename; import File::Basename; my $scriptname = $0; @@ -63,108 +53,6 @@ my $ips; my $id; my $hwtype; -########################################## -# Database errors -########################################## -#my %errmsg = ( -# NODE_UNDEF =>"Node not defined in '%s' database", -# NO_ATTR =>"'%s' not defined in '%s' database", -# DB_UNDEF =>"'%s' database not defined" -#); - - - -########################################################################## -# Parse the command line for options and operands -########################################################################## -#sub parse_args { - -# my %opt = (); -# my @VERSION = qw( 2.0 ); -# -# ############################################# -# # Responds with usage statement -# ############################################# -# local *usage = sub { -# -# my $cmd = __FILE__; -# $cmd =~ s/.*([\w]{3}$)/$1/; -# -# if ( defined( $_[0] )) { -# print STDERR "$_[0]\n"; -# } -# my @msg = ( -# "$cmd -h|--help\n", -# "$cmd -v|--version\n", -# "$cmd singlenode [-V|-Verbose]\n" ); -# print STDERR @msg; -# }; -# ############################################# -# # Process command-line arguments -# ############################################# -# if ( !defined( @ARGV )) { -# usage( "No node specified" ); -# return(1); -# } -# ############################################# -# # Checks case in GetOptions, allows opts -# # to be grouped (e.g. -vx), and terminates -# # at the first unrecognized option. -# ############################################# -# $Getopt::Long::ignorecase = 0; -# Getopt::Long::Configure( "bundling" ); -# -# if ( !GetOptions( \%opt, qw(h|help V|Verbose v|version) )) { -# usage(); -# return(1); -# } -# ####################################### -# # Option -h for Help -# ####################################### -# if ( exists( $opt{h} )) { -# usage(); -# return(1); -# } -# ####################################### -# # Option -v for version -# ####################################### -# if ( exists( $opt{v} )) { -# print STDERR \@VERSION; -# return(1); -# } -# ####################################### -# # Option -V for verbose output -# ####################################### -# if ( exists( $opt{V} )) { -# $verbose = 1; -# } -# ####################################### -# # Check for "-" with no option -# ####################################### -# if ( grep(/^-$/, @ARGV )) { -# usage( "Missing option: -" ); -# return(1); -# } -# ####################################### -# # Get node -# ####################################### -# if ( !defined( $ARGV[0] )) { -# usage( "No node specified" ); -# return(1); -# } -# ####################################### -# # Check for extra argument -# ####################################### -# $node = shift @ARGV; -# if ( defined( $ARGV[0] )) { -# usage( "Invalid Argument: $ARGV[0]" ); -# return(1); -# } -# return(0); -#} - - - ########################################################################## # Open remote console ########################################################################## @@ -179,88 +67,16 @@ sub invoke_cmd { } else { $machine = "CEC"; } - - #my @attribs = qw(id parent hcp); - #my %tabs = (); - - ################################## - # Open databases needed - ################################## - #foreach ( qw(ppc vpd nodetype) ) { - # $tabs{$_} = xCAT::Table->new($_); - # - # if ( !exists( $tabs{$_} )) { - # return( sprintf( $errmsg{DB_UNDEF}, $_ )); - # } - #} - ################################## - # Get node power type - ################################## - #my $hwtype = __FILE__; - #$hwtype =~ s/.*([\w]{3})$/$1/; - # - ################################# - # Get node type - ################################# - #my ($ent) = $tabs{nodetype}->getNodeAttribs($node, ["nodetype"] ); - #if ( !defined( $ent )) { - # return( sprintf( $errmsg{NODE_UNDEF}, "nodetype" )); - #} - ################################# - # Check for type - ################################# - #if ( !exists( $ent->{nodetype} )) { - # return( sprintf( $errmsg{NO_ATTR}, $ent->{nodetype},"nodetype" )); - #} - ################################# - # Check for valid "type" - ################################# - #my @types = split /,/, $ent->{nodetype}; - #my ($type) = grep( /^(lpar|osi)$/, @types ); - # - #if ( !defined( $type )) { - # return( "Invalid node type: $ent->{nodetype}" ); - #} - ################################# - # Get attributes - ################################# - #my ($att) = $tabs{ppc}->getAttribs({'node'=>$node}, @attribs ); - # - #if ( !defined( $att )) { - # return( sprintf( $errmsg{NODE_UNDEF}, "ppc" )); - #} - ################################# - # Verify required attributes - ################################# - #foreach my $at ( @attribs ) { - # if ( !exists( $att->{$at} )) { - # return( sprintf( $errmsg{NO_ATTR}, $at, "ppc" )); - # } - #} - # - #my $fsp_name = $att->{hcp}; - #my $id = $att->{id}; - #use xcatd to get the attribute $fsp_name and $id of the node. - - #my $fsp_api ="/opt/xcat/sbin/fsp-api"; my $fsp_api = ($::XCATROOT) ? "$::XCATROOT/sbin/fsp-api" : "/opt/xcat/sbin/fsp-api"; my $action = "console"; my $type = "0"; - - #my $fsp_ip = (); my $Rc = 0; - - #$fsp_ip = xCAT::NetworkUtils::getNodeIPaddress( $fsp_name ); - #if(!defined($fsp_ip)) { - # return "Failed to get the $fsp_name\'s ip"; - #} my $power_state_cmd = "$fsp_api -a cec_state -t $type:$fsp_ip:$id:$node: 2>&1"; my $res; my $index = 0; my $pre_state = undef; - #my $wait_interval =20; my $ipl_num = 0; while (1) { $res = xCAT::Utils->runcmd($power_state_cmd, -1); @@ -317,18 +133,11 @@ sub invoke_cmd { sleep 5; } else { $pre_state = $res; - - #print "."; sleep 20; } - - #$wait_interval =20+int(rand(20)); - #sleep $wait_interval; } my $cmd = "$fsp_api -a $action -t $type:$fsp_ip:$id:$node:\r"; - - #print "cmd: $cmd\n"; my $running_failed_code = "Reason code: 0x1000000"; my $fsp_standby_msg = "Reason code: 0x1300"; my $fsp_lock_msg = "Reason code: 0x1f00"; @@ -397,9 +206,6 @@ sub invoke_cmd { ############################################## # Start main body of code ############################################## -#if ( parse_args() ) { -# exit(1); -#} sub getans { my $rsp = shift; if ($rsp->{node}) { @@ -434,6 +240,3 @@ if ($result ne "0") { } exit(0); - - - diff --git a/xCAT-server/share/xcat/cons/hmc b/xCAT-server/share/xcat/cons/hmc index b956f4f0f..ae0425731 100644 --- a/xCAT-server/share/xcat/cons/hmc +++ b/xCAT-server/share/xcat/cons/hmc @@ -32,19 +32,11 @@ BEGIN exit 0; } get_lock(); - - #my $sleepint=int(rand(10)); #Stagger start to avoid overwhelming conserver/xCATd - #print "Opening console in ".(2+(0.5*$sleepint))." seconds...\n"; - #sleep $sleepint; } my $sleepint = int(rand(10)); use lib "$::XCATROOT/lib/perl"; require xCAT::Client; use strict; - -#use Getopt::Long; -#use xCAT::Table; -#use xCAT::PPCdb; use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR); use Data::Dumper; require File::Basename; @@ -62,192 +54,10 @@ my $mtms; my @cred; my $credencial; -########################################## -# Database errors -########################################## -#my %errmsg = ( -# NODE_UNDEF =>"Node not defined in '%s' database", -# NO_ATTR =>"'%s' not defined in '%s' database", -# DB_UNDEF =>"'%s' database not defined" -#); - - - -########################################################################## -# Parse the command line for options and operands -########################################################################## -#sub parse_args { -# -# my %opt = (); -# my @VERSION = qw( 2.0 ); -# -# ############################################# -# # Responds with usage statement -# ############################################# -# local *usage = sub { -# -# my $cmd = __FILE__; -# $cmd =~ s/.*([\w]{3}$)/$1/; -# -# if ( defined( $_[0] )) { -# print STDERR "$_[0]\n"; -# } -# my @msg = ( -# "$cmd -h|--help\n", -# "$cmd -v|--version\n", -# "$cmd singlenode [-V|-Verbose]\n" ); -# print STDERR @msg; -# }; -# ############################################# -# # Process command-line arguments -# ############################################# -# if ( !defined( @ARGV )) { -# usage( "No node specified" ); -# return(1); -# } -# ############################################# -# # Checks case in GetOptions, allows opts -# # to be grouped (e.g. -vx), and terminates -# # at the first unrecognized option. -# ############################################# -# $Getopt::Long::ignorecase = 0; -# Getopt::Long::Configure( "bundling" ); -# -# if ( !GetOptions( \%opt, qw(h|help V|Verbose v|version) )) { -# usage(); -# return(1); -# } -# ####################################### -# # Option -h for Help -# ####################################### -# if ( exists( $opt{h} )) { -# usage(); -# return(1); -# } -# ####################################### -# # Option -v for version -# ####################################### -# if ( exists( $opt{v} )) { -# print STDERR \@VERSION; -# return(1); -# } -# ####################################### -# # Option -V for verbose output -# ####################################### -# if ( exists( $opt{V} )) { -# $verbose = 1; -# } -# ####################################### -# # Check for "-" with no option -# ####################################### -# if ( grep(/^-$/, @ARGV )) { -# usage( "Missing option: -" ); -# return(1); -# } -# ####################################### -# # Get node -# ####################################### -# if ( !defined( $ARGV[0] )) { -# usage( "No node specified" ); -# return(1); -# } -# ####################################### -# # Check for extra argument -# ####################################### -# $node = shift @ARGV; -# if ( defined( $ARGV[0] )) { -# usage( "Invalid Argument: $ARGV[0]" ); -# return(1); -# } -# return(0); -#} - - - ########################################################################## # Open remote console ########################################################################## sub invoke_cmd { - - #my @attribs = qw(id parent hcp); - #my %tabs = (); - # - ################################### - ## Open databases needed - ################################### - #foreach ( qw(ppc vpd nodetype) ) { - # $tabs{$_} = xCAT::Table->new($_); - # - # if ( !exists( $tabs{$_} )) { - # return( sprintf( $errmsg{DB_UNDEF}, $_ )); - # } - #} - ################################### - ## Get node power type - ################################### - #my $hwtype = __FILE__; - #$hwtype =~ s/.*([\w]{3})$/$1/; - # - ################################## - ## Get node type - ################################## - #my ($ent) = $tabs{nodetype}->getNodeAttribs($node, ["nodetype"] ); - #if ( !defined( $ent )) { - # return( sprintf( $errmsg{NODE_UNDEF}, "nodetype" )); - #} - ################################## - ## Check for type - ################################## - #if ( !exists( $ent->{nodetype} )) { - # return( sprintf( $errmsg{NO_ATTR}, $ent->{nodetype},"nodetype" )); - #} - ################################## - ## Check for valid "type" - ################################## - #my @types = split /,/, $ent->{nodetype}; - #my ($type) = grep( /^(lpar|osi)$/, @types ); - # - #if ( !defined( $type )) { - # return( "Invalid node type: $ent->{nodetype}" ); - #} - ################################## - ## Get attributes - ################################## - #my ($att) = $tabs{ppc}->getAttribs({'node'=>$node}, @attribs ); - # - #if ( !defined( $att )) { - # return( sprintf( $errmsg{NODE_UNDEF}, "ppc" )); - #} - ################################## - ## Verify required attributes - ################################## - #foreach my $at ( @attribs ) { - # if ( !exists( $att->{$at} )) { - # return( sprintf( $errmsg{NO_ATTR}, $at, "ppc" )); - # } - #} - ################################## - ## Find MTMS in vpd database - ################################## - #my @attrs = qw(mtm serial); - #my ($vpd) = $tabs{vpd}->getNodeAttribs($att->{parent}, \@attrs ); - # - #if ( !defined( $vpd )) { - # return( sprintf( $errmsg{NODE_UNDEF}, "vpd" )); - #} - ################################# - ## Verify both vpd attributes - ################################# - #foreach ( @attrs ) { - # if ( !exists( $vpd->{$_} )) { - # return( sprintf( $errmsg{NO_ATTR}, $_, "vpd" )); - # } - #} - #my $mtms = "$vpd->{mtm}*$vpd->{serial}"; - #my $host = $att->{hcp}; - #my $lparid = $att->{id}; - #$type = "lpar"; - my $type = "lpar"; my $hwtype = "hmc"; my %request = ( @@ -257,7 +67,6 @@ sub invoke_cmd { ################################# # Get userid and password ################################# - #my @cred = xCAT::PPCdb::credentials( $host, $hwtype ); @cred = split(/,/, $credencial); $request{$host}{cred} = \@cred; ################################# @@ -281,9 +90,6 @@ sub invoke_cmd { ############################################## # Start main body of code ############################################## -#if ( parse_args() ) { -# exit(1); -#} sub getans { my $rsp = shift; if ($rsp->{node}) { @@ -308,7 +114,7 @@ until ($lparid and $host and $mtms) { get_lock(); xCAT::Client::submit_request($cmdref, \&getans); } -release_lock(); #done with xcatd, can run with near impunity +release_lock(); #done with xcatd, can run with near impunity $node = $ARGV[0]; @@ -319,6 +125,3 @@ if ($result ne "0") { } exit(0); - - - diff --git a/xCAT-server/share/xcat/cons/hpblade b/xCAT-server/share/xcat/cons/hpblade index 2fe780c51..1a63bfd6e 100755 --- a/xCAT-server/share/xcat/cons/hpblade +++ b/xCAT-server/share/xcat/cons/hpblade @@ -38,10 +38,6 @@ BEGIN exit 0; } get_lock(); - - #my $sleepint=int(rand(10)); #Stagger start to avoid overwhelming conserver/xCATd - #print "Opening console in ".(2+(0.5*$sleepint))." seconds...\n"; - #sleep $sleepint; } my $sleepint = int(rand(10)); #Stagger start to avoid overwhelming conserver/xCATd use lib "$::XCATROOT/lib/perl"; @@ -51,43 +47,11 @@ require xCAT::Client; require File::Basename; import File::Basename; my $scriptname = $0; - -#$mptab = xCAT::Table->new('mp'); -#unless ($mptab) { -#sleep 5; #Try not to overwhelm logfiles... -# die "mp table must be configured"; -#} -#$mpatab = xCAT::Table->new('mpa'); -#$passtab = xCAT::Table->new('passwd'); - my $username = "admin"; my $passsword = "PASSW0RD"; my $mm; my $slot; -#my $dba; -#if ($passtab) { -# ($dba) = $passtab->getAttribs({key=>blade},qw(username password)); -# if ($dba->{username}) { -# $username = $dba->{username}; -# } -# if ($dba->{password}) { -# $password = $dba->{password}; -# } -#} - -#$dba = $mptab->getNodeAttribs($ARGV[0],[qw(mpa id)]); -#$mm = $dba->{mpa}; -#$slot = $dba->{id}; -#if ($mpatab) { -# ($dba) = $mpatab->getAttribs({mpa=>$mm},qw(username password)); -# if ($dba) { -# if ($dba->{username}) { $username = $dba->{username}; } -# if ($dba->{password}) { $password = $dba->{password}; } -# } -#} -#xCAT::Utils::close_all_dbhs; -#sleep 5; #Slow start, I know, but with exec, can't return sub getans { my $rsp = shift; if ($rsp->{node}) { @@ -115,8 +79,6 @@ $sleepint = 10 + int(rand(30)); #Stagger sleep to take it easy on AMM/hosting se exec "ssh -t $username" . "@" . "$mm vsp"; my $pathtochild = dirname($scriptname) . "/"; -#exec $pathtochild."hpblade.expect"; - #SECURITY: In this case, the authentication is expected to be done using the script user's ssh keys. As such, #this script does not receive any particularly sensitive data from the xCAT server. diff --git a/xCAT-server/share/xcat/cons/ipmi b/xCAT-server/share/xcat/cons/ipmi index 48d22d406..6dc4a4ed0 100755 --- a/xCAT-server/share/xcat/cons/ipmi +++ b/xCAT-server/share/xcat/cons/ipmi @@ -94,28 +94,6 @@ if ($password) { $pass = ''; } -#require xCAT::Table; -#require xCAT::Utils; -#my $dba; -#my $ipmitab = xCAT::Table->new('ipmi'); -#unless ($ipmitab) { die "Unable to open IPMI table"; } -#my $passtab = xCAT::Table->new('passwd'); -#if ($passtab) { -# ($dba) = $passtab->getAttribs({key=>'ipmi'},qw(username password)); -# if ($dba) { -# if ($dba->{username}) { $username = $dba->{username}; } -# if ($dba->{password}) { $password = $dba->{password}; } -# } -#} - -#$dba = $ipmitab->getNodeAttribs($ARGV[0],[qw(bmc username password)]); -#if ($dba) { -# if ($dba->{bmc}) { $bmc = $dba->{bmc}; } -# if ($dba->{username}) { $username = $dba->{username}; } -# if ($dba->{password}) { $password = $dba->{password}; } -#} -#xCAT::Utils::close_all_dbhs; -#my $isintel = system "ipmitool -I lanplus -U $username -P $password -H $bmc chassis status > /dev/null 2>&1"; my $isintel = 0; my $sleepint; my $rc; @@ -123,7 +101,7 @@ my $ipmitool = "ipmitool"; if (-x "$XCATROOT/bin/ipmitool-xcat") { $ipmitool = "$XCATROOT/bin/ipmitool-xcat"; } -my @mcinfo = `$ipmitool -I lanplus $user $pass -H $bmc mc info`; #| grep 'Manufacturer ID : 343' > /dev/null 2>&1"; +my @mcinfo = `$ipmitool -I lanplus $user $pass -H $bmc mc info`; $rc = $?; if ($rc) { #some shoddy vendors ignore the IPMI 2.0 requirement to support IPMI 1.5 formats for BMC capability determination, attempt IPMI 2.0 even without the ability to confirm IPMI 2.0 support. Though SOL was not baked in prior IPMI 2.0, this script supports pre-2.0 'ISOL' on older devices, hence why we are checking for 1.5/2.0 before proceeding normally @mcinfo = `$ipmitool -I lan $user $pass -H $bmc mc info`; @@ -133,7 +111,7 @@ while ($rc != 0) { $sleepint = 10 + int(rand(20)); print "Failure to reach IPMI device, retrying in $sleepint seconds (Hit Ctrl-E,c,o to skip)\n"; sleep ($sleepint); - @mcinfo = `$ipmitool -I lanplus $user $pass -H $bmc mc info`; #| grep 'Manufacturer ID : 343' > /dev/null 2>&1"; + @mcinfo = `$ipmitool -I lanplus $user $pass -H $bmc mc info`; $rc = $?; if ($rc) { #repeat workaround for shoddy vendors @mcinfo = `$ipmitool -I lan $user $pass -H $bmc mc info`; diff --git a/xCAT-server/share/xcat/cons/ivm b/xCAT-server/share/xcat/cons/ivm index 40e847b52..a84e7f659 100755 --- a/xCAT-server/share/xcat/cons/ivm +++ b/xCAT-server/share/xcat/cons/ivm @@ -62,192 +62,10 @@ my $mtms; my @cred; my $credencial; -########################################## -# Database errors -########################################## -#my %errmsg = ( -# NODE_UNDEF =>"Node not defined in '%s' database", -# NO_ATTR =>"'%s' not defined in '%s' database", -# DB_UNDEF =>"'%s' database not defined" -#); - - - -########################################################################## -# Parse the command line for options and operands -########################################################################## -#sub parse_args { -# -# my %opt = (); -# my @VERSION = qw( 2.0 ); -# -# ############################################# -# # Responds with usage statement -# ############################################# -# local *usage = sub { -# -# my $cmd = __FILE__; -# $cmd =~ s/.*([\w]{3}$)/$1/; -# -# if ( defined( $_[0] )) { -# print STDERR "$_[0]\n"; -# } -# my @msg = ( -# "$cmd -h|--help\n", -# "$cmd -v|--version\n", -# "$cmd singlenode [-V|-Verbose]\n" ); -# print STDERR @msg; -# }; -# ############################################# -# # Process command-line arguments -# ############################################# -# if ( !defined( @ARGV )) { -# usage( "No node specified" ); -# return(1); -# } -# ############################################# -# # Checks case in GetOptions, allows opts -# # to be grouped (e.g. -vx), and terminates -# # at the first unrecognized option. -# ############################################# -# $Getopt::Long::ignorecase = 0; -# Getopt::Long::Configure( "bundling" ); -# -# if ( !GetOptions( \%opt, qw(h|help V|Verbose v|version) )) { -# usage(); -# return(1); -# } -# ####################################### -# # Option -h for Help -# ####################################### -# if ( exists( $opt{h} )) { -# usage(); -# return(1); -# } -# ####################################### -# # Option -v for version -# ####################################### -# if ( exists( $opt{v} )) { -# print STDERR \@VERSION; -# return(1); -# } -# ####################################### -# # Option -V for verbose output -# ####################################### -# if ( exists( $opt{V} )) { -# $verbose = 1; -# } -# ####################################### -# # Check for "-" with no option -# ####################################### -# if ( grep(/^-$/, @ARGV )) { -# usage( "Missing option: -" ); -# return(1); -# } -# ####################################### -# # Get node -# ####################################### -# if ( !defined( $ARGV[0] )) { -# usage( "No node specified" ); -# return(1); -# } -# ####################################### -# # Check for extra argument -# ####################################### -# $node = shift @ARGV; -# if ( defined( $ARGV[0] )) { -# usage( "Invalid Argument: $ARGV[0]" ); -# return(1); -# } -# return(0); -#} - - - ########################################################################## # Open remote console ########################################################################## sub invoke_cmd { - - #my @attribs = qw(id parent hcp); - #my %tabs = (); - # - ################################### - ## Open databases needed - ################################### - #foreach ( qw(ppc vpd nodetype) ) { - # $tabs{$_} = xCAT::Table->new($_); - # - # if ( !exists( $tabs{$_} )) { - # return( sprintf( $errmsg{DB_UNDEF}, $_ )); - # } - #} - ################################### - ## Get node power type - ################################### - #my $hwtype = __FILE__; - #$hwtype =~ s/.*([\w]{3})$/$1/; - # - ################################## - ## Get node type - ################################## - #my ($ent) = $tabs{nodetype}->getNodeAttribs($node, ["nodetype"] ); - #if ( !defined( $ent )) { - # return( sprintf( $errmsg{NODE_UNDEF}, "nodetype" )); - #} - ################################## - ## Check for type - ################################## - #if ( !exists( $ent->{nodetype} )) { - # return( sprintf( $errmsg{NO_ATTR}, $ent->{nodetype},"nodetype" )); - #} - ################################## - ## Check for valid "type" - ################################## - #my @types = split /,/, $ent->{nodetype}; - #my ($type) = grep( /^(lpar|osi)$/, @types ); - # - #if ( !defined( $type )) { - # return( "Invalid node type: $ent->{nodetype}" ); - #} - ################################## - ## Get attributes - ################################## - #my ($att) = $tabs{ppc}->getAttribs({'node'=>$node}, @attribs ); - # - #if ( !defined( $att )) { - # return( sprintf( $errmsg{NODE_UNDEF}, "ppc" )); - #} - ################################## - ## Verify required attributes - ################################## - #foreach my $at ( @attribs ) { - # if ( !exists( $att->{$at} )) { - # return( sprintf( $errmsg{NO_ATTR}, $at, "ppc" )); - # } - #} - ################################## - ## Find MTMS in vpd database - ################################## - #my @attrs = qw(mtm serial); - #my ($vpd) = $tabs{vpd}->getNodeAttribs($att->{parent}, \@attrs ); - # - #if ( !defined( $vpd )) { - # return( sprintf( $errmsg{NODE_UNDEF}, "vpd" )); - #} - ################################# - ## Verify both vpd attributes - ################################# - #foreach ( @attrs ) { - # if ( !exists( $vpd->{$_} )) { - # return( sprintf( $errmsg{NO_ATTR}, $_, "vpd" )); - # } - #} - #my $mtms = "$vpd->{mtm}*$vpd->{serial}"; - #my $host = $att->{hcp}; - #my $lparid = $att->{id}; - #$type = "lpar"; - my $type = "lpar"; my $hwtype = "ivm"; my %request = ( @@ -257,7 +75,6 @@ sub invoke_cmd { ################################# # Get userid and password ################################# - #my @cred = xCAT::PPCdb::credentials( $host, $hwtype ); @cred = split(/,/, $credencial); $request{$host}{cred} = \@cred; ################################# @@ -281,9 +98,6 @@ sub invoke_cmd { ############################################## # Start main body of code ############################################## -#if ( parse_args() ) { -# exit(1); -#} sub getans { my $rsp = shift; @@ -322,7 +136,3 @@ if ($result ne "0") { exit(1); } exit(0); - - - - diff --git a/xCAT-server/share/xcat/cons/kvm b/xCAT-server/share/xcat/cons/kvm index c122799ad..c5b9899cd 100755 --- a/xCAT-server/share/xcat/cons/kvm +++ b/xCAT-server/share/xcat/cons/kvm @@ -33,19 +33,8 @@ BEGIN } get_lock(); - #my $sleepint=int(rand(10)); - #print "Opening console in ".(2+(0.5*$sleepint))." seconds...\n"; - #sleep $sleepint; } -#BEGIN -#{ -# use Time::HiRes qw(sleep); -# $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; -# my $sleepint=int(rand(10)); -# print "Opening console in ".(0.5*$sleepint)." seconds...\n"; -# sleep (0.5*$sleepint); -#} my $sleepint; use lib "$::XCATROOT/lib/perl"; require xCAT::Client; @@ -90,9 +79,3 @@ if (!$ENV{'TERM'}) { exec "ssh -t $dsthost screen -U -a -O -e ^]a -d -R -S serial-" . $ARGV[0] . "-cons -A $dstty $speed"; -#my $pathtochild= dirname($scriptname). "/"; -#exec $pathtochild."blade.expect $mm $slot $username $password"; - - - - diff --git a/xCAT-server/share/xcat/cons/multiple b/xCAT-server/share/xcat/cons/multiple index ff0feccf6..8e7d41f1e 100755 --- a/xCAT-server/share/xcat/cons/multiple +++ b/xCAT-server/share/xcat/cons/multiple @@ -138,7 +138,6 @@ sub invoke_hmc { ################################# # Get userid and password ################################# - #my @cred = xCAT::PPCdb::credentials( $host, $hwtype ); @cred = split(/,/, $credencial); $request{$host}{cred} = \@cred; ################################# @@ -228,7 +227,3 @@ for my $thishcp (keys %{ ${$hcps}[0] }) { } } exit(0); - - - - diff --git a/xCAT-server/share/xcat/cons/xen b/xCAT-server/share/xcat/cons/xen index 2cdf0b051..0d475b039 100755 --- a/xCAT-server/share/xcat/cons/xen +++ b/xCAT-server/share/xcat/cons/xen @@ -32,20 +32,8 @@ BEGIN exit 0; } get_lock(); - - #my $sleepint=int(rand(10)); - #print "Opening console in ".(2+(0.5*$sleepint))." seconds...\n"; - #sleep $sleepint; } -#BEGIN -#{ -# use Time::HiRes qw(sleep); -# $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; -# my $sleepint=int(rand(10)); -# print "Opening console in ".(0.5*$sleepint)." seconds...\n"; -# sleep (0.5*$sleepint); -#} my $sleepint; use lib "$::XCATROOT/lib/perl"; require xCAT::Client; @@ -81,10 +69,3 @@ until ($dsthost and $speed and $dstty) { } release_lock(); exec "ssh -t $dsthost screen -U -a -O -e ^]a -d -R -S serial-" . $ARGV[0] . "-cons -A $dstty $speed"; - -#my $pathtochild= dirname($scriptname). "/"; -#exec $pathtochild."blade.expect $mm $slot $username $password"; - - - - From 808a2ed5e9f8183de703ab6b016bd1142317a14d Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 3 Feb 2017 09:37:48 -0500 Subject: [PATCH 046/100] Rename edgecore_switches to onie_switches --- docs/source/advanced/networks/index.rst | 2 +- .../networks/{edgecore_switches => onie_switches}/index.rst | 2 +- .../onie_switches.rst => onie_switches/onie.rst} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename docs/source/advanced/networks/{edgecore_switches => onie_switches}/index.rst (83%) rename docs/source/advanced/networks/{edgecore_switches/onie_switches.rst => onie_switches/onie.rst} (100%) diff --git a/docs/source/advanced/networks/index.rst b/docs/source/advanced/networks/index.rst index 5f19f7890..cd29cd51f 100644 --- a/docs/source/advanced/networks/index.rst +++ b/docs/source/advanced/networks/index.rst @@ -5,7 +5,7 @@ Networks :maxdepth: 2 ethernet_switches/index.rst + onie_switches/index.rst switchdiscover/index.rst infiniband/index.rst ipv6/index.rst - edgecore_switches/index.rst diff --git a/docs/source/advanced/networks/edgecore_switches/index.rst b/docs/source/advanced/networks/onie_switches/index.rst similarity index 83% rename from docs/source/advanced/networks/edgecore_switches/index.rst rename to docs/source/advanced/networks/onie_switches/index.rst index 0c897d340..05aeec41f 100644 --- a/docs/source/advanced/networks/edgecore_switches/index.rst +++ b/docs/source/advanced/networks/onie_switches/index.rst @@ -4,4 +4,4 @@ ONIE Compatible Bare Metal Switches .. toctree:: :maxdepth: 2 - onie_switches.rst + onie.rst diff --git a/docs/source/advanced/networks/edgecore_switches/onie_switches.rst b/docs/source/advanced/networks/onie_switches/onie.rst similarity index 100% rename from docs/source/advanced/networks/edgecore_switches/onie_switches.rst rename to docs/source/advanced/networks/onie_switches/onie.rst From 4b9eb870d7cada3df6308a468456f4614f1a248b Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Fri, 3 Feb 2017 10:07:11 -0500 Subject: [PATCH 047/100] config snmp and interface for onie switch --- xCAT/postscripts/configinterface | 48 ++++++++++++++++++++++++++++++++ xCAT/postscripts/enablesnmp | 10 +++++++ 2 files changed, 58 insertions(+) create mode 100755 xCAT/postscripts/configinterface diff --git a/xCAT/postscripts/configinterface b/xCAT/postscripts/configinterface new file mode 100755 index 000000000..40deeb269 --- /dev/null +++ b/xCAT/postscripts/configinterface @@ -0,0 +1,48 @@ +#!/bin/bash + +#the postscript to configure interface in ONIE compatible switches + +if ! cat /etc/os-release |grep -i '^NAME=[ "]*Cumulus Linux[ "]*$' >/dev/null 2>&1 ; then + echo "This script is only supported on Cumulus OS in ONIE switch" + exit 2 +fi + +xcat_intf="/etc/network/interfaces.d/xCAT.intf" + +echo "#This is sample interface file provided by xCAT" > $xcat_intf +echo "# bridge-vlan-aware: set to yes to indicate that the bridge is VLAN-aware. " >> $xcat_intf +echo "# bridge-access: declares the access port. " >> $xcat_intf +echo "# bridge-pvid: specifies native VLANs if the ID is other than 1. " >> $xcat_intf +echo "# bridge-vids: declares the VLANs associated with this bridge. " >> $xcat_intf +echo " " >> $xcat_intf + +#create default bridge +echo "auto br0" >> $xcat_intf +echo "iface br0" >> $xcat_intf +echo " bridge-vlan-aware yes" >> $xcat_intf +echo " bridge-ports glob swp1-52" >> $xcat_intf +echo " bridge-stp on" >> $xcat_intf +echo " bridge-vids 1 " >> $xcat_intf +echo " bridge-pvid 1" >> $xcat_intf +echo " " >> $xcat_intf + +#create each interface + +for i in `seq 1 52`; +do + echo "auto swp$i">> $xcat_intf + echo "iface swp$i" >> $xcat_intf + echo " mstpctl-portadminedge yes" >> $xcat_intf + echo " " >> $xcat_intf +done + +# license needs to set before start switchd +if [ ! -e /etc/cumulus/.license* ]; then + echo "ERROR: cumulus license file is not exist"; + exit 1; +fi + +systemctl enable switchd +systemctl restart switchd +ifreload -a + diff --git a/xCAT/postscripts/enablesnmp b/xCAT/postscripts/enablesnmp index d6365d977..2d4f2fd96 100755 --- a/xCAT/postscripts/enablesnmp +++ b/xCAT/postscripts/enablesnmp @@ -1,4 +1,5 @@ #!/bin/bash + #the postscript to enable snmpd in ONIE compatible switches if ! cat /etc/os-release |grep -i '^NAME=[ "]*Cumulus Linux[ "]*$' >/dev/null 2>&1 ; then @@ -20,6 +21,15 @@ sed -i "/rocommunity\s*public\s*default/s/^#//" $snmp_conf sed -i "/rocommunity\s*public\s*default\s*-V\s*systemonly/s/^#//" $snmp_conf sed -i "/#\s*createUser\s*authPrivUser\s*SHA/{n;s/^.*$/createUser $snmp_user SHA $snmp_passwd/}" $snmp_conf sed -i "/#rwuser\s*authPrivUser\s*priv/{n;s/^.*$/rwuser $snmp_user/}" $snmp_conf +sed -i "/view\s*systemonly\s*included\s*.1.3.6.1.2.1.17/s/^#//" $snmp_conf +sed -i "/pass_persist\s*.1.3.6.1.2.1.17\s*\/usr\/share\/snmp\/bridge_pp.py/s/^#//" $snmp_conf + +#create snmpd restart conf file +mkdir -p /etc/systemd/system/snmpd.service.d +restart_conf="/etc/systemd/system/snmpd.service.d/restart.conf" +echo "[Service]" > $restart_conf +echo "Restart=always" >> $restart_conf +echo "RestartSec=60" >> $restart_conf systemctl enable snmpd systemctl restart snmpd From df7b859fc45fe998748a187eeb71b178a3dea1c5 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 3 Feb 2017 15:52:42 -0500 Subject: [PATCH 048/100] Refactor the onie documentation --- .../advanced/networks/onie_switches/index.rst | 10 +- .../advanced/networks/onie_switches/onie.rst | 135 ------------------ .../onie_switches/os_cumulus/index.rst | 12 ++ .../onie_switches/os_cumulus/install.rst | 92 ++++++++++++ .../onie_switches/os_cumulus/manage.rst | 21 +++ .../onie_switches/os_cumulus/prepare.rst | 18 +++ 6 files changed, 150 insertions(+), 138 deletions(-) delete mode 100644 docs/source/advanced/networks/onie_switches/onie.rst create mode 100644 docs/source/advanced/networks/onie_switches/os_cumulus/index.rst create mode 100644 docs/source/advanced/networks/onie_switches/os_cumulus/install.rst create mode 100644 docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst create mode 100644 docs/source/advanced/networks/onie_switches/os_cumulus/prepare.rst diff --git a/docs/source/advanced/networks/onie_switches/index.rst b/docs/source/advanced/networks/onie_switches/index.rst index 05aeec41f..cb330a164 100644 --- a/docs/source/advanced/networks/onie_switches/index.rst +++ b/docs/source/advanced/networks/onie_switches/index.rst @@ -1,7 +1,11 @@ -ONIE Compatible Bare Metal Switches -=================================== +Open Network Install Environment Switches +========================================= + +The Open Network Install Environment, or "ONIE" [1]_. is an open source project definining an **install environment** for bare metal switches. This environment allows choice for the end users when selecting a network operating system to install onto these bare metal switches. + +.. [1] Open Network Install Environment: Created by Cumulus Networks, Inc. in 2012, the Open Network Install Environment (ONIE) Project is a small operating system, pre-installed as firmware on bare metal network switches, that provides an environment for automated operating system provisioning. .. toctree:: :maxdepth: 2 - onie.rst + os_cumulus/index.rst diff --git a/docs/source/advanced/networks/onie_switches/onie.rst b/docs/source/advanced/networks/onie_switches/onie.rst deleted file mode 100644 index ba079c23c..000000000 --- a/docs/source/advanced/networks/onie_switches/onie.rst +++ /dev/null @@ -1,135 +0,0 @@ -ONIE compatible bare metal switch -================================= - -The ONIE [1]_. compatible bare metal switches(abbreviated as "ONIE switch") from vendors such as Mellanox or Edgecore are often used as top-of-rack switches in the cluster. Usually, the switches are shipped with a Cumulus Network OS(https://cumulusnetworks.com) and a license pre-installed. In some cases, user may get whitebox switch hardware with a standalone Cumulus installer and license file. This documentation presents a typical workflow on how to setup ONIE switch from white box, then configure and manage the switch with xCAT. - -.. [1] Open Network Install Environment: Created by Cumulus Networks, Inc. in 2012, the Open Network Install Environment (ONIE) Project is a small operating system, pre-installed as firmware on bare metal network switches, that provides an environment for automated operating system provisioning. - -Create an ONIE switch object -------------------------------- - -The ONIE switch object can be created with the "onieswitch" template shipped in xCAT, the ip address and mac of the switch management ethernet port should be specified : :: - - mkdef edgecoresw1 --template onieswitch arch=armv71 ip=192.168.5.191 mac=8C:EA:1B:12:CA:40 - -Provision the Cumulus OS on ONIE switch ---------------------------------------- - -To provision Cumulus OS, the Cumulus installation file, a binary shipped with the switch, should be saved in a directory exported in the http server. - -Run ``chdef`` to specify the "provmethod" attribute of the switch object to the full path of the installation file: :: - - chdef edgecoresw1 netboot=onie provmethod="/install/custom/sw/edgecore/cumulus-linux-3.1.0-bcm-armel-1471981017.dc7e2adzfb43f6b.bin" - -Run ``makedhcp`` to prepare the DHCP/BOOTP lease. :: - - makedhcp -a edgecoresw1 - -The command or operation to start the provision dependes on the status of switch: - -1. If the switch is a white box without Cumulus OS installed, simply connect the management ethernet port of the switch to xCAT management node, then power on the switch. - -2. If a Cumulus OS has been installed on the switch, you need to login to the switch(the default user is ``cumulus`` and the password is ``CumulusLinux!``) and run a batch of commands: :: - - sudo onie-select -i - sudo reboot - -If the passwordless-ssh of "root" has been enabled, the commands can be issued with: :: - - xdsh edgecoresw1 "/usr/cumulus/bin/onie-select -i -f;reboot" - -After reboot, the switch will enter ONIE install mode and begin the installation. The provision might take about 50 minutes. - - -Switch Configuration --------------------- - -Enable the passwordless ssh for "root" -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -In a newly installed Cumulus OS, a default user ``cumulus`` will be created, the switch can be accessed via ssh with the default password ``CumulusLinux!``. - -The passwordless ssh access of "root" should be enabled with the script ``/opt/xcat/share/xcat/scripts/configonie`` :: - - /opt/xcat/share/xcat/scripts/configonie --switches edgecoresw1 --ssh - -After the passwordless access for "root" is setup successfully, the switch can be managed with the node management commands such as ``xdsh``, ``xdcp`` and ``updatenode``, etc. - -Licence file installation -~~~~~~~~~~~~~~~~~~~~~~~~~ - -On the newly installed switch, only the serial console and the management ethernet port are enabled. To activate the data ports, the licence file shipped with the switch should be installed: :: - - xdcp edgecoresw1 /install/custom/sw/edgecore/licensefile.txt /tmp - xdsh edgecoresw1 "/usr/cumulus/bin/cl-license -i /tmp/licensefile.txt" - -To check whether the license file is installed successfully: :: - - ~: xdsh edgecoresw1 /usr/cumulus/bin/cl-license - edgecoresw1: xxx@xx.com|xxxxxxxxxxxxxxx - -Reboot the switch to apply the licence file: :: - - xdsh edgecoresw1 reboot - -Enable SNMP -~~~~~~~~~~~ - -The snmpd in the switch is not enabled by default, xCAT ships a postscript to enable it: :: - - updatenode edgecoresw1 -P enablesnmp - - -Switch Discovery ----------------- - -The ONIE switch can be scaned and discovered with ``switchdiscover`` :: - - ~: switchdiscover --range 192.168.23.1-10 - Discovering switches using nmap for 192.168.23.1-10. It may take long time... - ip name vendor mac - ------------ ------------ ------------ ------------ - 192.168.23.1 edgecoresw1 Edgecore switch 8C:EA:1B:12:CA:40 - Switch discovered: edgecoresw1 - -Once SNMP on the ONIE switch is enabled, the ONIE switch can be discovered with "snmp" method: :: - - ~: switchdiscover --range 192.168.23.1-10 -s snmp - Discovering switches using snmpwalk for 192.168.23.1-10 .... - ip name vendor mac - ------------ ------------ ------------ ------------ - 192.168.23.1 edgecoresw1 Linux edgecoresw1 4.1.0-cl-2-iproc #1 SMP Debian 4.1.25-1+cl3u4 (2016-08-13) armv7l 8c:ea:1b:12:ca:40 - Switch discovered: edgecoresw1 - - -Switch Management ------------------ - -File Dispatch -~~~~~~~~~~~~~ - -The files can be dispatched to ONIE switches with ``xdcp`` :: - - xdcp edgecoresw1 - -Refer to :doc:`xdcp manpage ` for details. - -Remote Commands -~~~~~~~~~~~~~~~ - -Commands can be run on ONIE switches remotely with ``xdsh`` :: - - xdsh edgecoresw1 - -Refer to :doc:`xdsh manpage ` for details. - -Run scripts remotely -~~~~~~~~~~~~~~~~~~~~ - -The scripts under "/install/postscripts" can be run on ONIE switches with ``updatenode -P`` :: - - updatenode edgecoresw1 -P