2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 03:32:04 +00:00

Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core

This commit is contained in:
jjohnson2 2015-05-18 15:24:39 -04:00
commit bb7da9ab61
34 changed files with 624 additions and 276 deletions

View File

@ -29,9 +29,12 @@
# UP=0 or UP=1 - override the default upload behavior
# LOG=<filename> - provide an LOG file option to redirect some output into log file
#
# For the dependency packages 1. please run the build-debs-all in xcat-dep svn first( there is usage detail in that script)
# For the dependency packages 1. All the xcat dependency deb packages should be uploaded to
# "pokgsa/projects/x/xcat/build/ubuntu/xcat-dep/debs/" on GSA
# 2. run ./build-ubunturepo -d
#
# 3. the built xcat-dep deb packages tarball can be found in "../../xcat-dep"
# related to the path of this script
############################
printusage()
{
@ -87,6 +90,8 @@ if [ "$c_flag" -a "$d_flag" ];then
exit 2
fi
uploader="litingt"
# Find where this script is located to set some build variables
old_pwd=`pwd`
@ -378,6 +383,21 @@ then
echo "# Creating xcat-dep repository #"
echo "################################"
#the path of ubuntu xcat-dep deb packages on GSA
GSA="/gsa/pokgsa/projects/x/xcat/build/ubuntu/xcat-dep"
if [ ! -d $GSA ]; then
echo "build-ubunturepo: It appears that you do not have gsa installed to access the xcat-dep pkgs."
exit 1;
fi
# Sync from the GSA master copy of the dep rpms
echo "Syncing RPMs from $GSA/ to $local_dep_repo_path/../ ..."
rsync -ilrtpu --delete $GSA/ $local_dep_repo_path/../
#clean all old files
if [ -e $local_dep_repo_path ];then
rm -rf $local_dep_repo_path
@ -386,6 +406,7 @@ then
cd $local_dep_repo_path
mkdir conf
#create the conf/distributions file
for dist in $dists; do
if [ "$dist" = "trusty" ] || [ "$dist" = "utopic" ]; then

5
perl-xCAT/xCAT/Usage.pm Normal file → Executable file
View File

@ -117,6 +117,7 @@ my %usage = (
BMC specific:
rspconfig <noderange> [ip|netmask|gateway|backupgateway|garp]
rspconfig <noderange> [garp=<number of 1/2 second>]
rspconfig <noderange> [userid=<userid> username=<username> password=<password>]
iDataplex specific:
rspconfig <noderange> [thermprofile]
rspconfig <noderange> [thermprofile=<two digit number from chassis>]
@ -288,7 +289,7 @@ my %usage = (
[-u] [--range IPranges][-t tries][--vpdtable][-C counts][-T timeout]",
"switchdiscover" =>
"Usage: switchdiscover [-h|--help|-v|--version]
switchdiscover [<noderange>][-V|--verbose][-i adpt[,adpt..]][-w][-r|-x|-z][-n][-s scan_methods]",
switchdiscover [<noderange>|--range ipranges] [-s scan_methods] [-r|-x|-z][-n] [-w] [-V|--verbose]",
"rflash" =>
"Usage:
rflash [ -h|--help|-v|--version]
@ -435,7 +436,7 @@ Options:
"Usage:
Common:
nodeset [-h|--help|-v|--version]
nodeset <noderange> [install|shell|boot|runcmd=bmcsetup|netboot|iscsiboot|osimage[=<imagename>]|statelite|offline]",
nodeset <noderange> [shell|boot|runcmd=bmcsetup|iscsiboot|osimage[=<imagename>]|offline]",
"rmflexnode" =>
"Usage:
rmflexnode [-h|--help|-v|--version]

View File

@ -56,7 +56,6 @@ sub print_usage
print "Usage:\n";
print " genimage\n\n";
print " genimage --dryrun\n\n";
print ' genimage -o <osver> [-a <arch>] -p <profile> -i <nodebootif> -n <nodenetdrivers> [--onlyinitrd] [-r <otherifaces>] [-k <kernelver>] [-g <krpmver>] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission <permission>] [--interactive] [--dryrun] [--noupdate]'."\n\n";
print ' genimage [-o <osver>] [-a <arch>] [-p <profile>] [-i <nodebootif>] [-n <nodenetdrivers>] [--onlyinitrd] [-r <otherifaces>] [-k <kernelver>] [-g <krpmver>] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission <permission>] [--interactive] [--dryrun] [--noupdate] <imagename>'."\n\n";
print " --permission is used for statelite only\n";
print " -g is used for SLES only\n\n";
@ -64,11 +63,6 @@ sub print_usage
print "Examples:\n";
print " genimage\n";
print " genimage --interactive\n";
print " genimage -i eth0 -n tg3 -o sles11 -p compute\n";
print " genimage -i eth0 -n tg3 -o sles11 -p compute --onlyinitrd\n";
print " genimage -i eth0 -r eth1,eth2 -n tg3,bnx2 -o centos5.1 -p compute --interactive\n";
print " genimage -i eth0 -n tg3,bnx2 -o sles11 -p compute --dryrun\n";
print " genimage -i eth0 -n igb,e1000e,e1000,bnx2,tg3 -o centos5.4 -p nfsroot --permission 777\n";
print " genimage -i eth0 -n tg3 --interactive myimagename\n";
print " genimage myimagename\n";
}

View File

@ -8,8 +8,6 @@ B<genimage>
B<genimage> [B<-o> I<osver>] [B<-a> I<arch>] [B<-p> I<profile>] [B<-i> I<nodebootif>] [B<-n> I<nodenetdrivers>] [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>] [B<--ignorekernelchk>] [B<--noupdate>] I<imagename>
B<genimage> B<-o> I<osver> [B<-a> I<arch>] B<-p> I<profile> B<-i> I<nodebootif> B<-n> I<nodenetdrivers> [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>] [B<--noupdate>]
B<genimage> [B<-h> | B<--help> | B<-v> | B<--version>]
@ -18,27 +16,7 @@ B<genimage> [B<-h> | B<--help> | B<-v> | B<--version>]
Generates a stateless and a statelite image that can be used to boot xCAT nodes in a diskless mode.
The I<imagename> format of the command is recommended. When specified, genimage will use the osimage definition for information to generate this image. Additional options specified on the command line will override any corresponding previous osimage settings, and will be written back to the osimage definition.
If I<imagename> is not specified (old method):
- the default packages included (and excluded) in the image are specified by
/opt/xcat/share/xcat/netboot/<os>/<profile>[.<osver>][.<arch>].pkglist and
/opt/xcat/share/xcat/netboot/<os>/<profile>[.<osver>][.<arch>].exlist.
- Additional packages that are not from the os distro can be specified in a
/opt/xcat/share/xcat/netboot/<os>/<profile>[.<osver>][.<arch>].otherpkgs.pkglist file.
- Customized package list files will override these files and can be specified under /install/custom/netboot/<os> directory.
- The generated image will be put in /install/netboot/<osver>/<arch>/<profile> directory.
- osimage definitions will be created in the I<linuximage> and I<osimage> tables. The newly generated image names will have the following format:
for stateless: <osver>-<arch>-netboot-<profile>
for statelite: <osver>-<arch>-statelite-<profile>
genimage will use the osimage definition for information to generate this image. Additional options specified on the command line will override any corresponding previous osimage settings, and will be written back to the osimage definition.
If B<genimage> runs on the management node, both the I<osimage> table and I<linuximage> table will be updated with the given values from the options.
@ -112,7 +90,6 @@ Regenerates the initrd for a stateless image to be used for a diskless install.
Regenerates the initrd that is part of a stateless/statelite image that is used to boot xCAT nodes in a stateless/stateli
te mode.
The generated initrd will be put in /install/netboot/<OS>/<arch>/<profile>.
The B<genimage --onlyinitrd> command will generate two initial ramdisks, one is B<initrd-statelite.gz> for B<statelite> mode, the other one is B<initrd-stateless.gz> for B<stateless> mode.
@ -205,36 +182,6 @@ To generate an image, replacing some values in the osimage definition:
genimage -i eth0 -n tg3 myimagename
=item 6
(old method) To generate a fedora8 image for a compute node architecture
x86_64 and place it in the
/install/netboot/fedora8/x86_64/compute/rootimg directory:
genimage -i eth0 -o fedora8 -p compute
=item 7
(old method)
genimage -i eth0 -r eth1,eth2 -n tg3,bnx2 -o centos5.1 -p compute
=item 8
(old method)
genimage -i eth0 -n tg3,bnx2 -o sles11 -p compute --interactive
=item 9
(old method)
genimage -i eth0 -n igb,e1000e,e1000,bnx2,tg3 -o centos5.4 -p nfsroot --permission 777
=item 10
(old method)
To regenerate the initrd for a fedora8 image for a compute node architecture x86_64 and place it in the /install/netboot/fedora8/x86_64/compute/rootimg directory:
cd /opt/xcat/share/xcat/netboot/fedora
./genimage --onlyinitrd -i eth0 -n tg3,bnx2 -o fedora8 -p compute
=back

View File

@ -4,9 +4,7 @@ B<imgcapture> - Captures an image from a Linux diskful node and create a diskles
=head1 SYNOPSIS
B<imgcapture> node B<-t>|B<--type> diskless [B<-p>|B<--profile> I<profile>] [B<-o>|B<--osimage> I<osimage>] [B<-i> I<nodebootif>] [B<-n> I<nodenetdrivers>] [B<-V>|B<--verbose>]
B<imgcapture> node B<-t>|B<--type> sysclone B<-o>|B<--osimage> I<osimage> [B<-V>|B<--verbose>]
B<imgcapture> node B<-t>|B<--type> {diskless|sysclone} B<-o>|B<--osimage> I<osimage> [B<-V>|B<--verbose>]
B<imgcapture> [B<-h> | B<--help>] | [B<-v> | B<--version>]
@ -20,7 +18,7 @@ The B<imgcapture> command supports two image types: B<diskless> and B<sysclone>.
The B<diskless> type:
The I<osimage> is pre-defined, the attributes of osimage will be used to capture and prepare the root image. The B<osver>, B<arch> and B<profile> attributes for the stateless/statelite image to be created are duplicated from the B<node>'s attribute. If the B<-p|--profile> I<profile> option is specified, the image will be created under "/<I<installroot>>/netboot/<osver>/<arch>/<I<profile>>/rootimg".
The attributes of osimage will be used to capture and prepare the root image. The B<osver>, B<arch> and B<profile> attributes for the stateless/statelite image to be created are duplicated from the B<node>'s attribute. If the B<-p|--profile> I<profile> option is specified, the image will be created under "/<I<installroot>>/netboot/<osver>/<arch>/<I<profile>>/rootimg".
The default files/directories excluded in the image are specified by /opt/xcat/share/xcat/netboot/<os>/<I<profile>>.<osver>.<arch>.imgcapture.exlist; also, you can put your customized file (<I<profile>>.<osver>.<arch>.imgcapture.exlist) to /install/custom/netboot/<osplatform>. The directories in the default I<.imgcapture.exlist> file are necessary to capture image from the diskful Linux node managed by xCAT, please don't remove it.
@ -100,23 +98,11 @@ Verbose output.
B<node1> is one diskful Linux node, which is managed by xCAT.
1. In order to capture and prepare the diskless root image, run the following command:
imgcapture node1 -t diskless
2. In order to capture and prepare the diskless root image with B<hpc> as profile, run the command:
imgcapture node1 -t diskless -p hpc
3. In order to capture and prepare the diskless root image: its profile is B<hpc>, and the network interface the diskless node will boot over is B<eth0>, the driver modules for this network interface is B<e1000e>.
imgcapture node1 -t diskless -p hpc -i eth0 -n e1000e
4. There's one pre-defined I<osimage>. In order to capture and prepare the diskless root image for I<osimage>, run the command:
1. There's one pre-defined I<osimage>. In order to capture and prepare the diskless root image for I<osimage>, run the command:
imgcapture node1 -t diskless -o osimage
5. In order to capture the diskful image from B<node1> and create the I<osimage> B<img1>, run the command:
2. In order to capture the diskful image from B<node1> and create the I<osimage> B<img1>, run the command:
imgcapture node1 -t sysclone -o img1

View File

@ -8,8 +8,6 @@ I<liteimg [-h| --help]>
I<liteimg [-v| --version]>
I<liteimg [-o OS] [ -p profile] [-a architecture] [-t rootfstype]>
I<liteimg imagename>
=head1 DESCRIPTION
@ -53,15 +51,6 @@ B<-h> Display usage message.
B<-v> Command Version.
B<-o> Operating system (fedora8, rhel5, sles10,etc)
B<-p> Profile (compute,service)
B<-a> Architecture (ppc64,x86_64,etc)
B<-t> The type of rootfs for the image (nfs, ramdisk). It is optional, nfs is used to be the rootfs type when B<-t> is not specified.
=head1 RETURN VALUE
0 The command completed successfully.
@ -70,9 +59,9 @@ B<-t> The type of rootfs for the image (nfs, ramdisk). It is optional,
=head1 EXAMPLES
1. To lite a fedora8 image for a compute node architecture x86_64 enter:
1. To lite a RHEL 6.6 statelite image for a compute node architecture x86_64 enter:
I<liteimg -o fedora8 -p compute -a x86_64>
I<liteimg rhels6.6-x86_64-statelite-compute>
=head1 FILES

View File

@ -8,9 +8,6 @@ I<packimage [-h| --help]>
I<packimage [-v| --version]>
I<packimage [-o OS] [ -p profile] [-a architecture] [-m method]>
I<packimage imagename>
=head1 DESCRIPTION
@ -20,8 +17,7 @@ sent to the node for a diskless install.
The install dir is setup by using "installdir" attribute set in the site table.
The nodetype table "profile" attribute for the node should reflect the profile of the install image.
If no I<imagename> is specified, this command uses the os image definition files from /install/custom/netboot/[os] directory first. If not found, it falls back to the default directory /opt/xcat/share/xcat/netboot/[os].
If a I<imagename> is specified, this command will get all the necessary os image definition files from the I<osimage> and I<linuximage> tables.
This command will get all the necessary os image definition files from the I<osimage> and I<linuximage> tables.
=head1 Parameters
@ -51,11 +47,10 @@ B<-m> Method (default cpio)
=head1 EXAMPLES
1. To pack a fedora8 image for a compute node architecture x86_64 and place it in the /install/netboot/fedora8/x86_64/compute/rootimg.gz file enter:
1. To pack the osimage rhels7.1-x86_64-netboot-compute:
I<packimage -o fedora8 -p compute -a x86_64>
I<packimage rhels7.1-x86_64-netboot-compute>
This would use the package information from the /install/custom/netboot/fedora/compute* files first. If not found it uses /opt/xcat/share/xcat/netboot/fedora/compute* files.
=head1 FILES

View File

@ -7,8 +7,6 @@ B<rmimage> - Removes the Linux stateless or statelite image from the file system
I<rmimage [-h | --help]>
I<rmimage [-V | --verbose]> I<-o <OS>> I<-a <architecture>> I<-p <profile>>
I<rmimage [-V | --verbose] imagename [--xcatdef]>
=head1 DESCRIPTION
@ -40,12 +38,6 @@ B<-h | --help> Display usage message.
B<-V | --verbose> Verbose mode.
B<-o> Operating system (fedora9,rhels5.5,sles11,etc)
B<-p> Profile (compute,service,etc)
B<-a> Architecture (ppc64,x86_64,etc)
B<--xcatdef> Remove the xCAT osimage definition
@ -57,22 +49,14 @@ B<--xcatdef> Remove the xCAT osimage definition
=head1 EXAMPLES
1. To remove a fedora9 stateless image for a compute node architecture x86_64, enter:
1. To remove a RHEL 7.1 stateless image for a compute node architecture x86_64, enter:
I<rmimage fedora9-x86_64-netboot-compute>
or
I<rmimage -o fedora9 -p compute -a x86_64>
I<rmimage rhels7.1-x86_64-netboot-compute>
2. To remove a rhels5.5 statelite image for a compute node architecture ppc64 and the osimage definition, enter:
I<rmimage rhels5.5-ppc64-statelite-compute --xcatdef>
or
I<rmimage -o rhels5.5 -p compute -a ppc64 --xcatdef>
=head1 FILES
/opt/xcat/sbin/rmimage

View File

@ -11,7 +11,7 @@ I<switchdiscover [-h| --help]>
I<switchdiscover [-v| --version]>
I<switchdiscover [noderange] [-V] [-i adpt[,adpt..]][-w][-r|-x|-z][-n][-s scan_methods]>
I<switchdiscover [noderange|--range ip_ranges] [-V] [-w][-r|-x|-z][-n][-s scan_methods]>
@ -30,15 +30,13 @@ B<noderange> The switches which the user want to discover.
switches will be defined in /etc/hosts file. This command will fill the switch
attributes for the switches defined.
B<-i> adapter(s) the command will search through (defaults to all available adapters).
B<-h> Display usage message.
B<-n> Only display and write the newly discovered switches.
B<--range> Specify one or more IP ranges.
It accepts multiple formats. For example, 192.168.1.1/24, 40-41.1-2.3-4.1-100.
If the range is huge, for example, 192.168.1.1/8, lsslp may take a very long
If the range is huge, for example, 192.168.1.1/8, switchdiscover may take a very long
time for node scan. So the range should be exactly specified.
B<-r> Display Raw response.

View File

@ -4,7 +4,7 @@ B<nodeset> - set the boot state for a noderange
=head1 B<Synopsis>
B<nodeset> [I<noderange>] [I<boot>|I<install>|I<stat>|I<iscsiboot>|I<netboot>|I<statelite>|I<offline>|I<runcmd=bmcsetup>|I<osimage[=<imagename>>]|I<shell>|I<shutdown>]
B<nodeset> [I<noderange>] [I<boot>|I<stat>|I<iscsiboot>|I<offline>|I<runcmd=bmcsetup>|I<osimage[=<imagename>>]|I<shell>|I<shutdown>]
B<nodeset> I<noderange> I<osimage=<imagename>> [I<--noupdateinitrd>] [I<--ignorekernelchk>]
@ -43,24 +43,6 @@ A user can supply their own scripts to be run on the mn or on the service node (
Instruct network boot loader to be skipped, generally meaning boot to hard disk
=item B<install>|B<install=profilename>|B<install=<os-architecture-profilename>>
Prepare server for installing a node according to the table configuration. This will
typically mean an unattended install file is created (i.e. kickstart or autoyast),
install resources will be verified in tftp and the bulk transfer method (http, ftp, or nfs for example), and the boot loader configuration file will be written.
Note: this option has been deprecated and will be removed in a future release. You should change to using the osimage option instead.
=item B<netboot>|B<netboot=profilename>|B<netboot=<os-architecture-profilename>>
Prepare server for deploying diskless nodes. With the diskless solution, the os image will reside in the RAM of the node.
Note: this option has been deprecated and will be removed in a future release. You should change to using the osimage option instead.
=item B<statelite>|B<statelite=profilename>|B<statelite=<os-architecture-profilename>>
Prepare server for deploying statelite nodes. Statelite provides an efficient and flexible diskless solution because most of the OS image is NFS mounted read-only, but a configurable list of directories and files can be read-write. The read-write files can either be persistent across reboots, or volatile (restoring to pristine state after reboot). The configuration can be done through B<litefile>, B<litetree> and B<statelite> tables.
Note: this option has been deprecated and will be removed in a future release. You should change to using the osimage option instead.
=item B<offline>
Cleanup the current pxe/tftp boot configuration files for the nodes requested

View File

@ -4,8 +4,6 @@ B<rinstall> - Begin OS provision on a noderange
=head1 B<Synopsis>
B<rinstall> [I<-o>|I<--osver>] [I<-p>|I<--profile>] [I<-a>|I<--arch>] [I<-c>|I<--console>] [I<noderange>]
B<rinstall> [I<-O>|I<--osimage>] [I<-c>|I<--console>] [I<noderange>]
=head1 B<Description>
@ -28,19 +26,6 @@ Display usage message.
Display version.
=item B<-o>|B<--osver>
Specifies which os version to provision. If unspecified, the current node os setting is used. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
=item B<-p>|B<--profile>
Specifies what profile should be used of the operating system. If not specified the current node profile setting is used. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
=item B<-a>|B<--arch>
Specifies what architecture of the OS to provision. Typically this is unneeded, but if provisioning between x86_64 and x86 frequently, this may be a useful flag. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
=item B<-O>|B<--osimage>
Specifies the osimage to provision.
@ -58,10 +43,6 @@ B<rinstall> I<node1-node20>
Provison nodes 1 through 20, using their current configuration.
B<rinstall> I<node1-node20> -o rhels5.1 -p compute
Provision nodes 1 through 20, forcing rhels5.1 and compute profile.
B<rinstall> I<node1-node20> -O rhels6.4-ppc64-netboot-compute
Provision nodes 1 through 20 with the osimage rhels6.4-ppc64-netboot-compute.

View File

@ -4047,11 +4047,9 @@ sub defmk_usage
" [-d | --dynamic] [-w attr==val [-w attr=~val] ...]";
$rsp->{data}->[4] =
" [-f | --force] [noderange] [attr=val [attr=val...]]";
$rsp->{data}->[5] =
" [-u provmethod=<install|netboot|statelite> profile=<xxx> [osvers=value] [osarch=value]]\n";
$rsp->{data}->[6] =
$rsp->{data}->[5] =
"\nThe following data object types are supported by xCAT.\n";
my $n = 7;
my $n = 6;
foreach my $t (sort(keys %{xCAT::Schema::defspec}))
{
@ -4097,11 +4095,9 @@ sub defch_usage
" [-z | --stanza] [-m | --minus] [-p | --plus]";
$rsp->{data}->[5] =
" [-w attr==val [-w attr=~val] ... ] [noderange] [attr=val [attr=val...]]\n";
$rsp->{data}->[6] =
" [-u [provmethod=<install|netboot|statelite>]|[profile=<xxx>]|[osvers=value]|[osarch=value]]";
$rsp->{data}->[7] =
$rsp->{data}->[6] =
"\nThe following data object types are supported by xCAT.\n";
my $n = 8;
my $n = 7;
foreach my $t (sort(keys %{xCAT::Schema::defspec}))
{

View File

@ -593,6 +593,18 @@ sub addnode
} elsif ($guess_next_server) {
$nxtsrv='${next-server}'; #if floating IP support, cause gPXE command-line expansion patch to drive inheritence from network
}
# The hostname could not be resolved, print a warning message
if (!$ip)
{
$callback->(
{
warning => [
"The hostname $hname of node $node could not be resolved."
]
}
);
}
my $doiscsi=0;
if ($ient and $ient->{server} and $ient->{target}) {
$doiscsi=1;
@ -652,7 +664,7 @@ sub addnode
} elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'petitboot') {
$lstatements = 'option conf-file \"http://'.$nxtsrv.'/tftpboot/petitboot/'.$node.'\";'.$lstatements;
} elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'nimol') {
$lstatements = 'supersede server.filename=\"/vios/nodes/'.$node.'\"'.$lstatements;
$lstatements = 'supersede server.filename=\"/vios/nodes/'.$node.'\";'.$lstatements;
}
@ -715,6 +727,18 @@ sub addnode
{
if ($ip and not ipIsDynamic($ip)) {
print $omshell "set ip-address = $ip\n";
} else {
# only if when ip is not blank, blank ip warning already done earlier in the code
if ($ip)
{
$callback->(
{
warning => [
"The ip address $ip of node $node overlaps with the DHCP dynamic range specified in networks table, will not add this ip address into dhcpd.leases file."
]
}
);
}
}
if ($lstatements)
{

View File

@ -23,7 +23,7 @@ my $globaltftpdir = xCAT::TableUtils->getTftpDir();
my %usage = (
"nodeset" => "Usage: nodeset <noderange> [install|shell|boot|runcmd=bmcsetup|netboot|iscsiboot|osimage[=<imagename>]|offline]",
"nodeset" => "Usage: nodeset <noderange> [shell|boot|runcmd=bmcsetup|iscsiboot|osimage[=<imagename>]|offline]",
);
sub handled_commands {
# process noderes:netboot like "grub2-<transfer protocol>"

2
xCAT-server/lib/xcat/plugins/imgcapture.pm Normal file → Executable file
View File

@ -46,7 +46,7 @@ sub process_request {
@ARGV = @{$request->{arg}} if (defined $request->{arg});
my $argc = scalar @ARGV;
my $usage = "Usage: imgcapture <node> -t|--type diskless [-p | --profile <profile>] [-o|--osimage <osimage>] [-i <nodebootif>] [-n <nodenetdrivers>] [-d | --device <devicesToCapture>] [-V | --verbose] \n imgcapture <node> -t|--type sysclone -o|--osimage <osimage> [-V | --verbose] \n imgcapture [-h|--help] \n imgcapture [-v|--version]";
my $usage = "Usage:\n imgcapture <node> -t|--type {diskless|sysclone} -o|--osimage <osimage> [-V | --verbose] \n imgcapture [-h|--help] \n imgcapture [-v|--version]";
my $os;
my $arch;

View File

@ -509,16 +509,20 @@ sub on_bmc_connect {
} elsif($command eq "rsetboot") {
return setboot($sessdata);
} elsif($command eq "rspconfig") {
shift @{$sessdata->{extraargs}};
shift @{$sessdata->{extraargs}};
# set username or/and password for specified userid #
if ($sessdata->{subcommand} =~ /userid|username|password/) {
setpassword($sessdata);
} else {
if ($sessdata->{subcommand} =~ /=/) {
if ($sessdata->{subcommand} =~ /password/) {
setpassword($sessdata);
} else {
setnetinfo($sessdata);
}
setnetinfo($sessdata);
} else {
getnetinfo($sessdata);
}
}
} elsif($command eq "rvitals") {
vitals($sessdata);
} elsif($command eq "rinv") {
@ -642,26 +646,97 @@ sub resetedbmc {
sub setpassword {
my $sessdata = shift;
my $subcommand = $sessdata->{subcommand};
my $argument;
($subcommand, $argument) = split(/=/, $subcommand);
my $subcmd = $sessdata->{subcommand};
my $netfun = 0x06;
my $command = 0x47;
my @data = ();
@data = unpack("C*", $argument);
if ($#data > 19 or $#data < 0) {
xCAT::SvrUtils::sendmsg([1, "The new password is invalid"],$callback,$sessdata->{node},%allerrornodes);
return(1,"The new password is invalid.");
my $command = undef;
my ($subcommand, $argument) = split(/=/, $subcmd);
if ($subcommand eq "userid") {
if ($argument !~ /^\d+$/) {
return(1,"The value for $subcommand is invalid");
}
$sessdata->{onuserid} = $argument;
$sessdata->{subcommand} = shift @{$sessdata->{extraargs}};
if ($sessdata->{subcommand} and $sessdata->{subcommand} ne '') {
setpassword($sessdata);
}
} elsif ($subcommand eq "username") {
unless($sessdata->{onuserid}) {
my @cmdargv = @{$sessdata->{extraargs}};
if (grep /userid/,@cmdargv) {
foreach my $opt (@cmdargv) {
if ($opt =~ m/userid=\s*(\d+)/) {
$sessdata->{onuserid} = $1;
last;
} else {
return(1,"The value for $subcommand is invalid");
}
}
} else {
$sessdata->{onuserid} = '1';# User ID 1 is permanently associated with User 1, the null user name
}
}
my @data = ();
$command = 0x45;
@data = unpack("C*", $argument);
if ($#data > 15 or $#data < 0) {
xCAT::SvrUtils::sendmsg([1, "The username is invalid"],$callback,$sessdata->{node},%allerrornodes);
return(1,"The username is invalid.");
}
$sessdata->{newusername}=$argument;
my $index = $#data;
while($index < 15) { # Username must be padded with 0 to 16 bytes for IPMI 2.0
push @data, 0;
$index += 1;
}
unshift @data, $sessdata->{onuserid} - '0'; # byte 1, userID, User ID 1 is permanently associated with User 1, the null user name
unless (exists($sessdata->{setuseraccess})) {
$sessdata->{setuseraccess} = 1;
}
$sessdata->{ipmisession}->subcmd(netfn=>$netfun,command=>$command,data=>\@data,callback=>\&password_set,callback_args=>$sessdata);
} elsif ($subcommand eq "password") {
unless($sessdata->{onuserid}) {
my @cmdargv = @{$sessdata->{extraargs}};
if (grep /userid/,@cmdargv) {
foreach my $opt (@cmdargv) {
if ($opt =~ m/userid=\s*(\d+)/) {
$sessdata->{onuserid} = $1;
last;
} else {
return(1,"The value for $subcommand is invalid");
}
}
} else {
$sessdata->{onuserid} = '1';
}
}
$command = 0x47;
my @data = ();
@data = unpack("C*", $argument);
if ($#data > 15 or $#data < 0) {
xCAT::SvrUtils::sendmsg([1, "The new password is invalid"],$callback,$sessdata->{node},%allerrornodes);
return(1,"The new password is invalid.");
}
$sessdata->{newpassword}=$argument;
my $index = $#data;
while($index < 15) { # Password must be padded with 0 to 20 bytes for IPMI 2.0
push @data, 0;
$index += 1;
}
unless(exists($sessdata->{enableuserdone})) {
unshift @data, 0x01; # byte 2, operation: 0x00 disable user, 0x01 enable user, 0x02 set password, 0x03 test password
unshift @data, ($sessdata->{onuserid} - '0'); # byte 1, userID, User ID 1 is permanently associated with User 1, the null user name
$sessdata->{enableuserdone} = 1;
$sessdata->{ipmisession}->subcmd(netfn=>$netfun,command=>$command,data=>\@data,callback=>\&password_set,callback_args=>$sessdata);
} else {
unshift @data, 0x02; # byte 2, operation: 0x00 disable user, 0x01 enable user, 0x02 set password, 0x03 test password
unshift @data, ($sessdata->{onuserid} - '0'); # byte 1, userID, User ID 1 is permanently associated with User 1, the null user name
unless (exists($sessdata->{setuseraccess})) {
$sessdata->{setuseraccess} = 1;
}
$sessdata->{ipmisession}->subcmd(netfn=>$netfun,command=>$command,data=>\@data,callback=>\&password_set,callback_args=>$sessdata);
}
}
$sessdata->{newpassword}=$argument;
my $index = $#data;
while($index < 19) { # Password must be padded with 0 to 20 bytes for IPMI 2.0
push @data, 0;
$index += 1;
}
unshift @data, 0x02; # byte 2, operation: 0x00 disable user, 0x01 enable user, 0x02 set password, 0x03 test password
unshift @data, 0x01; # byte 1, userID, User ID 1 is permanently associated with User 1, the null user name
$sessdata->{ipmisession}->subcmd(netfn=>$netfun,command=>$command,data=>\@data,callback=>\&password_set,callback_args=>$sessdata);
return;
}
sub password_set {
@ -679,16 +754,52 @@ sub password_set {
}
return;
}
my $ipmitab = xCAT::Table->new('ipmi');
if (!$ipmitab) {
xCAT::SvrUtils::sendmsg([1, "Failed to update ipmi table."],$callback,$sessdata->{node},%allerrornodes);
} else {
$ipmitab->setNodeAttribs($sessdata->{node}, {'password'=>$sessdata->{newpassword}});
xCAT::SvrUtils::sendmsg("Done",$callback,$sessdata->{node},%allerrornodes);
if ($sessdata->{setuseraccess}) {
setuseraccess($sessdata);
return;
}
if ($sessdata->{enableuserdone}) {
$sessdata->{enableuserdone} = 0;
setpassword($sessdata);
return;
}
# Won't update ipmi table, since option username=<> and password=<> can be run Respectively
#my $ipmitab = xCAT::Table->new('ipmi');
#if (!$ipmitab) {
# xCAT::SvrUtils::sendmsg([1, "Failed to update ipmi table."],$callback,$sessdata->{node},%allerrornodes);
#} else {
# if ($sessdata->{subcommand} =~ m/username/) {
# $ipmitab->setNodeAttribs($sessdata->{node}, {'username'=>$sessdata->{newusername}});
# xCAT::SvrUtils::sendmsg("set username Done",$callback,$sessdata->{node},%allerrornodes);
# } elsif ($sessdata->{subcommand} =~ m/password/) {
# $ipmitab->setNodeAttribs($sessdata->{node}, {'password'=>$sessdata->{newpassword}});
# xCAT::SvrUtils::sendmsg("set password Done",$callback,$sessdata->{node},%allerrornodes);
# }
#}
$sessdata->{subcommand} = shift @{$sessdata->{extraargs}};
if ($sessdata->{subcommand} and $sessdata->{subcommand} ne '') {
setpassword($sessdata);
}
return;
}
sub setuseraccess {
my $sessdata = shift;
my $channel_number = $sessdata->{ipmisession}->{currentchannel};
unless($sessdata->{onuserid}) {
return;
}
$sessdata->{setuseraccess} = 0;
my @data = ();
push @data, (0xc0 | $channel_number);
push @data, ($sessdata->{onuserid} - '0');
push @data, 0x04;
push @data, 0;
$sessdata->{ipmisession}->subcmd(netfn=>0x06,command=>0x43,data=>\@data,callback=>\&password_set,callback_args=>$sessdata);
return;
}
sub setnetinfo {
my $sessdata = shift;
my $subcommand = $sessdata->{subcommand};

View File

@ -361,7 +361,8 @@ sub update_export {
push @tmp_options, "insecure";
$need_update = 1;
}
push @new_export, join(',',@tmp_options);
my $option = join(',',@tmp_options);
push @new_export, "/install *($option)";
} else {
push @new_export, $line;
}
@ -391,7 +392,7 @@ sub update_syslog {
close($syslog_fd);
unless (grep /local2.*nimol\.log/, @curr_syslog) {
my $new_syslog_fd;
open($new_syslog_fd, ">>", "/etc/exports");
open($new_syslog_fd, ">>", "/etc/rsyslog.conf");
print $new_syslog_fd "local2.* /var/log/nimol.log\n";
close($new_syslog_fd);
#system("service rsyslog restart");
@ -412,6 +413,7 @@ sub create_imgconf_file {
my $bootimg_link = "/tftpboot/vios/nodes";
my $relative_path = $bootimg_link;
$relative_path =~ s/^\/tftpboot//;
$bootimg_root =~ s/^\/tftpboot//;
# check the dir where the bootimage link file and bootimage configuration file stored
unless (-e $bootimg_link) {
mkpath($bootimg_link);
@ -430,10 +432,11 @@ sub create_imgconf_file {
unless (defined($rootpw)) {
return "Unable to find requested password from passwd, with key=vios,username=padmin";
}
unless (-e $bootimg_root."/viobootimg") {
chdir($bootimg_link);
unless (-e "../../".$bootimg_root."/viobootimg") {
return "Unable to find VIOS bootimg file";
}
chdir($bootimg_link);
foreach my $node (@$nodes) {
my $bootimg_conf_fd;
my $gateway = $nethash{$node}{gateway};
@ -444,7 +447,7 @@ sub create_imgconf_file {
my $master_ip = xCAT::NetworkUtils->getipaddr($master);
my $node_ip = xCAT::NetworkUtils->getipaddr($node);
unless (-e "$node") {
symlink($bootimg_root."/viobootimg", "$node");
symlink("../../".$bootimg_root."/viobootimg", "$node");
}
if (-e $bootimg_link."/$node.info") {
unlink($bootimg_link."/$node.info");

4
xCAT-server/lib/xcat/plugins/packimage.pm Normal file → Executable file
View File

@ -39,7 +39,7 @@ sub process_request {
@ARGV = @{$request->{arg}};
my $argc = scalar @ARGV;
if ($argc == 0) {
$callback->({info=>["packimage -h \npackimage -v \npackimage [-p profile] [-a architecture] [-o OS] [-m method]\npackimage imagename"]});
$callback->({info=>["packimage -h \npackimage -v \npackimage imagename"]});
return;
}
my $osver;
@ -68,7 +68,7 @@ sub process_request {
return;
}
if ($help) {
$callback->({info=>["packimage -h \npackimage -v \npackimage [-p profile] [-a architecture] [-o OS] [-m method]\npackimage imagename"]});
$callback->({info=>["packimage -h \npackimage -v \npackimage imagename"]});
return;
}

View File

@ -16,7 +16,7 @@ my $globaltftpdir = xCAT::TableUtils->getTftpDir();
#my $dhcpver = 3;
my %usage = (
"nodeset" => "Usage: nodeset <noderange> [install|shell|boot|runcmd=bmcsetup|netboot|iscsiboot|osimage[=<imagename>]|statelite|offline]",
"nodeset" => "Usage: nodeset <noderange> [shell|boot|runcmd=bmcsetup|iscsiboot|osimage[=<imagename>]|offline]",
);
sub handled_commands {
return {

View File

@ -412,18 +412,13 @@ sub usage
my $rsp = {};
$rsp->{data}->[0] = "$command usage:";
if ($command =~ /rinstall/) {
$rsp->{data}->[1] = " [-o|--osver] [-p|--profile] [-a|--arch] [-c|--console] <noderange>";
} else { # winstall
$rsp->{data}->[1] = " [-o|--osver] [-p|--profile] [-a|--arch] <noderange>";
}
if ($command =~ /rinstall/) {
$rsp->{data}->[2] = " [-O|--osimage] [-c|--console] <noderange>";
$rsp->{data}->[1] = " [-O|--osimage] [-c|--console] <noderange>";
} else { # wininstall
$rsp->{data}->[2] = " [-O|--osimage] <noderange>";
$rsp->{data}->[1] = " [-O|--osimage] <noderange>";
}
$rsp->{data}->[3] = " [-h|--help]";
$rsp->{data}->[4] = " [-v|--version]";
$rsp->{data}->[2] = " [-h|--help]";
$rsp->{data}->[3] = " [-v|--version]";
xCAT::MsgUtils->message("I", $rsp, $callback);
}

View File

@ -30,7 +30,7 @@ sub process_request {
my $installroot = xCAT::TableUtils->getInstallDir();
my $tftproot = xCAT::TableUtils->getTftpDir();
my $usage = "\nUsage:\n rmimage [-h | --help]\n rmimage [-V | --verbose] -o <OS> -a <architecture> -p <profile>\n rmimage [-V | --verbose] imagename [--xcatde]";
my $usage = "\nUsage:\n rmimage [-h | --help]\n rmimage [-V | --verbose] imagename [--xcatde]";
@ARGV = @{$request->{arg}};

View File

@ -8,15 +8,18 @@ BEGIN
}
use lib "$::XCATROOT/lib/perl";
use strict;
use Getopt::Long;
use xCAT::Usage;
use xCAT::NodeRange;
use xCAT::Utils;
use XML::Simple;
no strict;
use Data::Dumper;
#global variables for this module
my %globalopt;
my @filternodes;
my @iprange;
my %global_scan_type = (
lldp => "lldp_scan",
nmap => "nmap_scan",
@ -131,7 +134,7 @@ sub parse_args {
# Process command-line flags
#############################################
if (!GetOptions( \%opt,
qw(h|help V|Verbose v|version i=s x z w r n range=s s=s))) {
qw(h|help V|Verbose v|version x z w r n range=s s=s))) {
return( usage() );
}
@ -146,6 +149,9 @@ sub parse_args {
unless (@filternodes) {
return(usage( "Invalid Argument: $ARGV[0]" ));
}
if ( exists( $opt{range} )) {
return(usage( "--range flag cannot be used with noderange." ));
}
} elsif ( scalar(@ARGV) > 1 ) {
return(usage( "Invalid flag, please check and retry." ));
}
@ -182,12 +188,14 @@ sub parse_args {
}
#############################################
# Check the validation of -i option
# Check the --range ip range option
#############################################
if ( exists( $opt{i} )) {
foreach ( split /,/, $opt{i} ) {
if ( exists( $opt{range} )) {
$globalopt{range} = $opt{range};
my @ips = split /,/, $opt{range};
foreach (@ips) {
push @iprange, $_;
}
$globalopt{i} = $opt{i};
}
#############################################
@ -218,12 +226,6 @@ sub parse_args {
$globalopt{z} = 1;
}
#########################################################
# only list the nodes that discovered for the first time
#########################################################
if ( exists( $opt{n} )) {
$globalopt{n} = 1;
}
#########################################################
# only list the nodes that discovered for the first time
@ -303,15 +305,83 @@ sub process_request {
if (exists($globalopt{scan_types})) {
@scan_types = @{$globalopt{scan_types}};
}
my $all_result;
foreach my $st (@scan_types) {
no strict;
my $fn = $global_scan_type{$st};
my $result = &$fn(\%request, $callback);
my $tmp_result = &$fn(\%request, $callback);
$all_result->{$st} = $tmp_result;
}
#consolidate the results by merging the swithes with the same ip
my $result;
foreach my $st (keys %$all_result) {
my $tmp_result = $all_result->{$st};
foreach my $key (keys %$tmp_result) {
if (! exists($result->{$key})) {
$result->{$key} = $tmp_result->{$key};
} else {
if (exists($tmp_result->{$key}->{name})) {
$result->{$key}->{name} = $tmp_result->{$key}->{name};
}
if (exists($tmp_result->{$key}->{mac})) {
$result->{$key}->{mac} = $tmp_result->{$key}->{mac};
}
if (exists($tmp_result->{$key}->{vendor})) {
$result->{$key}->{vendor} .= $tmp_result->{$key}->{vendor};
}
}
}
}
my $display_done = 0;
if (exists($globalopt{r})) {
#do nothing since is done by the scan functions.
$display_done = 1;
}
if (exists($globalopt{x})) {
$display_done = 1;
}
if (exists($globalopt{z})) {
$display_done = 1;
}
if (!$display_done) {
#display header
$format = "%-12s\t%-12s\t%-20.20s\t%-12s";
$header = sprintf $format, "ip", "name","vendor", "mac";
send_msg(\%request, 0, $header);
my $sep = "------------";
send_msg(\%request, 0, sprintf($format, $sep, $sep, $sep, $sep ));
#display switches one by one
foreach my $key (keys(%$result)) {
my $name=" ";
my $mac = " ";
my $vendor = " ";
if (exists($result->{$key}->{name})) {
$name = $result->{$key}->{name};
}
if (exists($result->{$key}->{mac})) {
$mac = $result->{$key}->{mac};
}
if (exists($result->{$key}->{vendor})) {
$vendor = $result->{$key}->{vendor};
}
my $msg = sprintf $format, $key, $name, $vendor, $mac;
send_msg(\%request, 0, $msg);
}
}
# writes the data into xCAT db
if (exists($globalopt{w})) {
send_msg(\%request, 0, "Writing the data into xCAT DB....");
}
return;
}
#--------------------------------------------------------------------------------
@ -326,17 +396,71 @@ sub process_request {
"1.2.3.5" =>{name=>"switch1", vendor=>"ibm", mac=>"AABBCCDDEEFA"},
"1.2.4.6" =>{name=>"switch2", vendor=>"cisco", mac=>"AABBCCDDEEFF"}
}
returns 1 if there are errors occurred.
=cut
#--------------------------------------------------------------------------------
sub lldp_scan {
my $request = shift;
send_msg($request, 0, "Discovering switches using lldpd...");
my %switches = (
"1.2.3.5" => { name=>"switch1", vendor=>"ibm", mac=>"AABBCCDDEEFA" },
"1.2.4.6" => { name=>"switch2", vendor=>"cisco", mac=>"AABBCCDDEEFF" }
);
return %switches
# get the PID of the currently running lldpd if it is running.
# If it is not running start it up.
my $pid;
chomp($pid= `ps -ef | grep lldpd | grep -v grep | awk '{print \$2}'`);
unless($pid){
my $dcmd = "lldpd -c -s -e -f";
my $outref = xCAT::Utils->runcmd($dcmd, 0);
if ($::RUNCMD_RC != 0)
{
send_msg($request, 1, "Could not start lldpd process. The command was: $dcmd" );
return 1;
}
# TODO: how to determin if the lldpd has done all the scanning or not?
xCAT::Utils->runcmd("sleep 30");
}
#now run the lldpcli to collect the data
my $ccmd = "lldpcli show neighbors -f xml";
my $result = xCAT::Utils->runcmd($ccmd, 0);
if ($::RUNCMD_RC != 0)
{
send_msg($request, 1, "Could not start lldpd process. The command was: $ccmd" );
return 1;
}
#display the raw output
if (exists($globalopt{r})) {
my $ccmd = "lldpcli show neighbors";
my $raw_result = xCAT::Utils->runcmd($ccmd, 0);
if ($::RUNCMD_RC == 0)
{
send_msg($request, 0, "$raw_result\n\n");
}
}
my $result_ref = XMLin($result, KeyAttr => 'interface', ForceArray => 1);
my $switches;
if ($result_ref) {
if (exists($result_ref->{interface})) {
my $ref1 = $result_ref->{interface};
foreach my $interface (@$ref1) {
if (exists($interface->{chassis})) {
my $chassis = $interface->{chassis}->[0];
my $ip = $chassis->{'mgmt-ip'}->[0]->{content};
if ($ip) {
my $name = $chassis->{name}->[0]->{content};
my $id = $chassis->{id}->[0]->{content};
my $desc = $chassis->{descr}->[0]->{content};
$switches->{$ip}->{name} = $name;
$switches->{$ip}->{mac} = $id;
$switches->{$ip}->{vendor} = $desc;
}
}
}
}
}
return $switches
}
@ -352,17 +476,62 @@ sub lldp_scan {
"1.2.3.5" =>{name=>"switch1", vendor=>"ibm", mac=>"AABBCCDDEEFA"},
"1.2.4.6" =>{name=>"switch2", vendor=>"cisco", mac=>"AABBCCDDEEFF"}
}
returns 1 if there are errors occurred.
=cut
#--------------------------------------------------------------------------------
sub nmap_scan {
my $request = shift;
send_msg($request, 0, "Discovering switches using nmap...");
my %switches = (
"1.2.3.5" => { name=>"switch1", vendor=>"ibm", mac=>"AABBCCDDEEFA" },
"1.2.4.6" => { name=>"switch2", vendor=>"cisco", mac=>"AABBCCDDEEFF" }
);
return %switches
my $ccmd;
send_msg($request, 0, "Discovering switches using nmap...");
if ( scalar(@filternodes) eq 0)
{
$ccmd = "/usr/bin/nmap -sn -oX - @iprange";
} else {
$ccmd = "/usr/bin/nmap -sn -oX - @filternodes";
}
print $ccmd;
my $result = xCAT::Utils->runcmd($ccmd, 0);
if ($::RUNCMD_RC != 0)
{
send_msg($request, 1, "Could not process this command: $ccmd" );
return 1;
}
#display the raw output
if (exists($globalopt{r})) {
send_msg($request, 0, "$result\n" );
}
#compose the switch hash
my $result_ref = XMLin($result, ForceArray => 1);
my $switches;
if ($result_ref) {
if (exists($result_ref->{host})) {
my $host_ref = $result_ref->{host};
foreach my $host ( @$host_ref ) {
my $ip;
if (exists($host->{address})) {
my $addr_ref = $host->{address};
foreach my $addr ( @$addr_ref ) {
my $type = $addr->{addrtype};
if ( $type ne "mac" ) {
$ip = $addr->{addr};
}
if ($addr->{vendor}) {
$switches->{$ip}->{mac} = $addr->{addr};
$switches->{$ip}->{vendor} = $addr->{vendor};
$switches->{$ip}->{name} = $host->{hostname};
}
} #end for each address
}
} #end for each host
}
}
return $switches
}
@ -379,17 +548,18 @@ sub nmap_scan {
"1.2.3.5" =>{name=>"switch1", vendor=>"ibm", mac=>"AABBCCDDEEFA"},
"1.2.4.6" =>{name=>"switch2", vendor=>"cisco", mac=>"AABBCCDDEEFF"}
}
returns 1 if there are errors occurred.
=cut
#--------------------------------------------------------------------------------
sub snmp_scan {
my $request = shift;
send_msg($request, 0, "Discovering switches using snmp...");
my %switches = (
my $switches = {
"1.2.3.5" => { name=>"switch1", vendor=>"ibm", mac=>"AABBCCDDEEFA" },
"1.2.4.6" => { name=>"switch2", vendor=>"cisco", mac=>"AABBCCDDEEFF" }
);
return %switches
};
return $switches
}
1;

View File

@ -18,7 +18,7 @@ my $globaltftpdir = xCAT::TableUtils->getTftpDir();
#my $dhcpver = 3;
my %usage = (
"nodeset" => "Usage: nodeset <noderange> [install|shell|boot|runcmd=bmcsetup|netboot|iscsiboot|osimage[=<imagename>]|statelite|offline]",
"nodeset" => "Usage: nodeset <noderange> [shell|boot|runcmd=bmcsetup|iscsiboot|osimage[=<imagename>]|offline]",
);
sub handled_commands {
return {

View File

@ -20,7 +20,7 @@ my $globaltftpdir = xCAT::TableUtils->getTftpDir();
#my $dhcpver = 3;
my %usage = (
"nodeset" => "Usage: nodeset <noderange> [install|shell|boot|runcmd=bmcsetup|netboot|iscsiboot|osimage[=<imagename>]|offline]",
"nodeset" => "Usage: nodeset <noderange> [shell|boot|runcmd=bmcsetup|iscsiboot|osimage[=<imagename>]|offline]",
);
sub handled_commands {
return {
@ -679,11 +679,12 @@ sub process_request {
#}
if ($do_dhcpsetup) {
if (%osimagenodehash) {
chdir("$tftpdir");
unless (-e "$tftpdir/yb/node") {
system("mkdir -p $tftpdir/yb/node");
}
chdir("$tftpdir/yb/node");
foreach my $osimage (keys %osimagenodehash) {
unless (-e "$tftpdir/yb/node") {
system("mkdir -p $tftpdir/yb/node");
}
my $osimgent = $osimagetab->getAttribs({imagename => $osimage },'osvers');
my $osentry = $osimgent->{'osvers'};
@ -702,10 +703,10 @@ sub process_request {
}
if (($osv =~ /rh/ and int($osn) >= 6) or
($osv =~ /sles/ and int($osn) >= 11)) {
my $fpath = "/yb/". $osentry."/yaboot";
foreach my $tmp_node (@{$osimagenodehash{$osimage}}) {
unless (-e "yb/node/yaboot-$tmp_node") {
symlink("yb/$osentry/yaboot", "yb/node/yaboot-$tmp_node");
unless (-e "yaboot-$tmp_node") {
symlink("../$osentry/yaboot", "yaboot-$tmp_node");
#symlink("/tftpboot/yb/$osentry/yaboot", "yb/node/yaboot-$tmp_node");
}
}
if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
@ -718,8 +719,8 @@ sub process_request {
}
} else {
foreach my $tmp_node (@{$osimagenodehash{$osimage}}) {
unless (-e "yb/node/yaboot-$tmp_node") {
symlink("yaboot", "yb/node/yaboot-$tmp_node");
unless (-e "yaboot-$tmp_node") {
symlink("../../yaboot", "yb/node/yaboot-$tmp_node");
}
}

View File

@ -148,7 +148,7 @@ reboot
#INCLUDE_DEFAULT_PKGLIST#
%end
%pre
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rh.rhel7#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rh.rhels7#
%end
%post
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat#

View File

@ -147,7 +147,7 @@ reboot
#INCLUDE_DEFAULT_PKGLIST#
%end
%pre
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rh.rhel7#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rh.rhels7#
%end
%post
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat#

View File

@ -146,7 +146,7 @@ reboot
#INCLUDE_DEFAULT_PKGLIST#
%end
%pre
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rh.rhel7#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rh.rhels7#
%end
%post
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat#

View File

@ -1470,6 +1470,9 @@ sub defout {
foreach my $l (@$lines) {
if ($l =~ /No responses/) { # handle the case that no output from lsslp command
return;
} elsif ($l =~ /Could not find any object definitions/) {
$json->{info} = $l;
last;
}
if ($l =~ /^Object name: / || $l =~ /^\S+:$/) { # start new node
if ($l =~ /^Object name:\s+(\S+)/) { # handle the output of lsdef -t <type> <obj>
@ -1517,6 +1520,9 @@ sub defout_remove_appended_type {
foreach my $l (@$lines) {
if ($l =~ /^(\S*)\s+\(.*\)$/) { # start new node
push @{$json}, $1;
} elsif ($l =~ /Could not find any object definitions/) {
push @{$json}, $l;
last;
}
}
}
@ -1880,8 +1886,16 @@ sub actionhdl {
} elsif ($params->{'resourcename'} eq "serviceprocessor") {
if (isGET()) {
push @args, $urilayers[3];
} elsif ($paramhash->{'value'}) {
push @args, $urilayers[3]."=".$paramhash->{'value'};
} elsif (isPut() or isPost()) {
if ($paramhash->{'value'} and defined($urilayers[3])) {
push @args, $urilayers[3]."=".$paramhash->{'value'};
} else {
foreach my $key (keys %$paramhash) {
if (($key ne '') and (exists($paramhash->{$key}))) {
push @args, $key."=".$paramhash->{$key};
}
}
}
}
} elsif ($params->{'resourcename'} eq "eventlog") {
if (isGET()) {
@ -2908,12 +2922,13 @@ sub fetchParameters {
if (ref($phash) ne 'HASH') { error("put or post data must be a json object (hash/dict).", $STATUS_BAD_REQUEST); }
# if any general parms are in the put/post data, move them to genparms
foreach my $k (keys %$phash) {
if (grep(/^$k$/, @generalparamlist)) {
$genparms->{$k} = $phash->{$k};
delete($phash->{$k});
}
}
# Do not think this is neccessary and it caused the issue that set any 'password' key would fail.
# foreach my $k (keys %$phash) {
# if (grep(/^$k$/, @generalparamlist)) {
# $genparms->{$k} = $phash->{$k};
# delete($phash->{$k});
# }
# }
}
else { $phash = {}; }

View File

@ -0,0 +1,39 @@
start:Ubuntu_diskless_installation_p8le_vm_cudafull
os:Linux
cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu14.04" ]];then ver=ubuntu1404;elif [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu14.10" ]];then ver=ubuntu1410; fi;echo "deb http://developer.download.nvidia.com/compute/cuda/repos/$ver/__GETNODEATTR($$CN,arch)__ /" >> /etc/apt/sources.list
cmd:makedns -n
check:rc==0
cmd:makeconservercf $$CN
check:rc==0
cmd:makedhcp -n
check:rc==0
cmd:makedhcp -a
check:rc==0
cmd:if [ ! -d /install/custom/netboot/ubuntu ]; then mkdir -p /install/custom/netboot/ubuntu; fi
check:rc==0
cmd:if [ ! -e /install/custom/netboot/ubuntu/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/ubuntu/compute.synclist; fi
check:rc==0
cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://ports.ubuntu.com/ubuntu-ports trusty main,http://ports.ubuntu.com/ubuntu-ports trusty-updates main"
cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu14.04" ]];then ver=ubuntu1404;elif [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu14.10" ]];then ver=ubuntu1410; fi;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute otherpkgdir="http://developer.download.nvidia.com/compute/cuda/repos/$ver/__GETNODEATTR($$CN,arch)__ /" otherpkglist="/opt/xcat/share/xcat/netboot/ubuntu/cudafull.otherpkgs.pkglist" pkglist="/opt/xcat/share/xcat/netboot/ubuntu/cudafull.__GETNODEATTR($$CN,os)__.__GETNODEATTR($$CN,arch)__-.pkglist" rootimgdir="/install/netboot/ __GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/cudafull"
cmd:apt-get install -y acpid
check:rc==0
cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/x86_64/compute
check:rc==0
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 reset
check:rc==0
cmd:sleep 200
cmd:lsdef -l $$CN | grep status
check:output=~booted
cmd:xdsh $$CN date
check:rc==0
check:output=~\d\d:\d\d:\d\d
cmd:xdsh $$CN dpkg -l |grep cuda
check:rc==0
check:output=~cuda
end

View File

@ -0,0 +1,39 @@
start:Ubuntu_diskless_installation_vm_cudaruntime
os:Linux
cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu14.04" ]];then ver=ubuntu1404;elif [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu14.10" ]];then ver=ubuntu1410; fi;echo "deb http://developer.download.nvidia.com/compute/cuda/repos/$ver/__GETNODEATTR($$CN,arch)__ /" >> /etc/apt/sources.list
cmd:makedns -n
check:rc==0
cmd:makeconservercf $$CN
check:rc==0
cmd:makedhcp -n
check:rc==0
cmd:makedhcp -a
check:rc==0
cmd:if [ ! -d /install/custom/netboot/ubuntu ]; then mkdir -p /install/custom/netboot/ubuntu; fi
check:rc==0
cmd:if [ ! -e /install/custom/netboot/ubuntu/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/ubuntu/compute.synclist; fi
check:rc==0
cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://ports.ubuntu.com/ubuntu-ports trusty main,http://ports.ubuntu.com/ubuntu-ports trusty-updates main "
cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu14.04" ]];then ver=ubuntu1404;elif [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu14.10" ]];then ver=ubuntu1410; fi;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute otherpkgdir="http://developer.download.nvidia.com/compute/cuda/repos/$ver/__GETNODEATTR($$CN,arch)__ /" otherpkglist="/opt/xcat/share/xcat/netboot/ubuntu/cudaruntime.otherpkgs.pkglist" pkglist="/opt/xcat/share/xcat/netboot/ubuntu/cudaruntime.__GETNODEATTR($$CN,os)__.__GETNODEATTR($$CN,arch)__-.pkglist" rootimgdir="/install/netboot/ __GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/cudaruntime"
cmd:apt-get install -y acpid
check:rc==0
cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/x86_64/compute
check:rc==0
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 reset
check:rc==0
cmd:sleep 200
cmd:lsdef -l $$CN | grep status
check:output=~booted
cmd:xdsh $$CN date
check:rc==0
check:output=~\d\d:\d\d:\d\d
cmd:xdsh $$CN dpkg -l |grep cuda
check:rc==0
check:output=~cuda
end

View File

@ -0,0 +1,35 @@
start:Ubuntu_full_installation_flat_cudafull
os:Linux
cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu14.04" ]];then ver=ubuntu1404;elif [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu14.10" ]];then ver=ubuntu1410; fi;echo "deb http://developer.download.nvidia.com/compute/cuda/repos/$ver/__GETNODEATTR($$CN,arch)__ /" >> /etc/apt/sources.list
cmd:makedns -n
check:rc==0
cmd:makeconservercf $$CN
check:rc==0
cmd:cat /etc/conserver.cf | grep $$CN
check:output=~$$CN
cmd:sleep 60
cmd:makedhcp -n
check:rc==0
cmd:makedhcp -a
check:rc==0
cmd:copycds $$ISO
check:rc==0
cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu14.04" ]];then ver=ubuntu1404;elif [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu14.10" ]];then ver=ubuntu1410; fi;chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -p pkgdir="http://ports.ubuntu.com/ubuntu-ports trusty main,http://ports.ubuntu.com/ubuntu-ports trusty-updates main,http://developer.download.nvidia.com/compute/cuda/repos/$ver/__GETNODEATTR($$CN,arch)__/ /"
cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute pkglist="/opt/xcat/share/xcat/install/ubuntu/cudafull.__GETNODEATTR($$CN,os)__.__GETNODEATTR($$CN,arch)__.pkglist"
cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute template="/opt/xcat/share/xcat/install/ubuntu/cudafull.tmpl"
cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute
check:rc==0
cmd:rpower $$CN reset
check:rc==0
cmd:sleep 2000
cmd:ping $$CN -c 3
check:output=~64 bytes from $$CN
cmd:lsdef -l $$CN | grep status
check:output=~booted
cmd:xdsh $$CN date
check:rc==0
check:output=~\d\d:\d\d:\d\d
cmd:xdsh $$CN dpkg -l |grep cuda
check:rc==0
check:output=~cuda
end

View File

@ -0,0 +1,38 @@
start:Ubuntu_full_installation_flat_cudaruntime
os:Linux
cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu14.04" ]];then ver=ubuntu1404;elif [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu14.10" ]];then ver=ubuntu1410; fi;echo "deb http://developer.download.nvidia.com/compute/cuda/repos/$ver/__GETNODEATTR($$CN,arch)__ /" >> /etc/apt/sources.list
cmd:makedns -n
check:rc==0
cmd:makeconservercf $$CN
check:rc==0
cmd:cat /etc/conserver.cf | grep $$CN
check:output=~$$CN
cmd:sleep 60
cmd:makedhcp -n
check:rc==0
cmd:makedhcp -a
check:rc==0
cmd:copycds $$ISO
check:rc==0
cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu14.04" ]];then ver=ubuntu1404;elif [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu14.10" ]];then ver=ubuntu1410; fi;chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -p pkgdir="/install/__GETNODEATTR($$CN,os)__/ppc64el,http://ports.ubuntu.com/ubuntu-ports trusty main,http://ports.ubuntu.com/ubuntu-ports trusty-updates main, http://developer.download.nvidia.com/compute/cuda/repos/__GETNODEATTR($$CN,os)__/$ver /"
cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute pkglist="/opt/xcat/share/xcat/install/ubuntu/cudaruntime.__GETNODEATTR($$CN,os)__.__GETNODEATTR($$CN,arch)__.pkglist"
cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute template="/opt/xcat/share/xcat/install/ubuntu/cudaruntime.tmpl"
cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute
check:rc==0
cmd:rpower $$CN reset
check:rc==0
cmd:sleep 2000
cmd:ping $$CN -c 3
check:output=~64 bytes from $$CN
cmd:lsdef -l $$CN | grep status
check:output=~booted
cmd:xdsh $$CN date
check:rc==0
check:output=~\d\d:\d\d:\d\d
cmd:xdsh $$CN dpkg -l |grep cuda
check:rc==0
check:output=~cuda
cmd:xdsh $$CN dpkg -l |grep cuda
check:rc==0
check:output=~cuda
end

View File

@ -7,7 +7,7 @@
#
# You can run the following commands on MN:
# updatenode noderange confignics
# updatenode noderange "confignics -s" (this one configures the installation nic also)
# updatenode noderange "confignics -s" (configures the installation nic by default and no need to configure the install nic in nics table)
#
#
#=cut
@ -209,11 +209,15 @@ fi
bool_exit_flag=0
#check the required attributes
if [ -z "$NICIPS" ];then
logger -t xcat -p local4.info "confignics: nicips attribute is not defined. "
echo "confignics on $NODE: nicips attribute is not defined. "
exit 0
if [ $bool_cfg_inst_nic -eq 1 ];then
logger -t xcat -p local4.info "confignics: configure the install nic. "
echo "confignics on $NODE:configure the install nic. "
else
logger -t xcat -p local4.info "confignics: nicips attribute is not defined. "
echo "confignics on $NODE: nicips attribute is not defined. "
exit 0
fi
fi
splitconfig "$NICIPS"
splitconfig "$NICCUSTOMSCRIPTS"