diff --git a/build-ubunturepo b/build-ubunturepo index a6cfe25de..eb1f37fa7 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -29,9 +29,12 @@ # 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. 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 diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm old mode 100644 new mode 100755 index 16815a68c..d30b9edd2 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -117,6 +117,7 @@ my %usage = ( BMC specific: rspconfig [ip|netmask|gateway|backupgateway|garp] rspconfig [garp=] + rspconfig [userid= username= password=] iDataplex specific: rspconfig [thermprofile] rspconfig [thermprofile=] @@ -288,7 +289,7 @@ my %usage = ( [-u] [--range IPranges][-t tries][--vpdtable][-C counts][-T timeout]", "switchdiscover" => "Usage: switchdiscover [-h|--help|-v|--version] - switchdiscover [][-V|--verbose][-i adpt[,adpt..]][-w][-r|-x|-z][-n][-s scan_methods]", + switchdiscover [|--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 [install|shell|boot|runcmd=bmcsetup|netboot|iscsiboot|osimage[=]|statelite|offline]", + nodeset [shell|boot|runcmd=bmcsetup|iscsiboot|osimage[=]|offline]", "rmflexnode" => "Usage: rmflexnode [-h|--help|-v|--version] diff --git a/xCAT-client/bin/genimage b/xCAT-client/bin/genimage index 2e00040b0..aa61089b9 100755 --- a/xCAT-client/bin/genimage +++ b/xCAT-client/bin/genimage @@ -56,7 +56,6 @@ sub print_usage print "Usage:\n"; print " genimage\n\n"; print " genimage --dryrun\n\n"; - print ' genimage -o [-a ] -p -i -n [--onlyinitrd] [-r ] [-k ] [-g ] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission ] [--interactive] [--dryrun] [--noupdate]'."\n\n"; print ' genimage [-o ] [-a ] [-p ] [-i ] [-n ] [--onlyinitrd] [-r ] [-k ] [-g ] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission ] [--interactive] [--dryrun] [--noupdate] '."\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"; } diff --git a/xCAT-client/pods/man1/genimage.1.pod b/xCAT-client/pods/man1/genimage.1.pod index 7f8f17f02..be5aa81c9 100644 --- a/xCAT-client/pods/man1/genimage.1.pod +++ b/xCAT-client/pods/man1/genimage.1.pod @@ -8,8 +8,6 @@ B B [B<-o> I] [B<-a> I] [B<-p> I] [B<-i> I] [B<-n> I] [B<--onlyinitrd>] [B<-r> I] [B<-k> I] [B<-g> I] [B<-m> I] [B<-l> I] [B<--permission> I] [B<--interactive>] [B<--dryrun>] [B<--ignorekernelchk>] [B<--noupdate>] I -B B<-o> I [B<-a> I] B<-p> I B<-i> I B<-n> I [B<--onlyinitrd>] [B<-r> I] [B<-k> I] [B<-g> I] [B<-m> I] [B<-l> I] [B<--permission> I] [B<--interactive>] [B<--dryrun>] [B<--noupdate>] - B [B<-h> | B<--help> | B<-v> | B<--version>] @@ -18,27 +16,7 @@ B [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 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 is not specified (old method): - - the default packages included (and excluded) in the image are specified by -/opt/xcat/share/xcat/netboot//[.][.].pkglist and - -/opt/xcat/share/xcat/netboot//[.][.].exlist. - - - Additional packages that are not from the os distro can be specified in a - -/opt/xcat/share/xcat/netboot//[.][.].otherpkgs.pkglist file. - - - Customized package list files will override these files and can be specified under /install/custom/netboot/ directory. - - The generated image will be put in /install/netboot/// directory. - - - osimage definitions will be created in the I and I tables. The newly generated image names will have the following format: - - for stateless: --netboot- - - for statelite: --statelite- - +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 runs on the management node, both the I table and I 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///. The B command will generate two initial ramdisks, one is B for B mode, the other one is B for B 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 diff --git a/xCAT-client/pods/man1/imgcapture.1.pod b/xCAT-client/pods/man1/imgcapture.1.pod index d299d7832..ea9adb3c7 100644 --- a/xCAT-client/pods/man1/imgcapture.1.pod +++ b/xCAT-client/pods/man1/imgcapture.1.pod @@ -4,9 +4,7 @@ B - Captures an image from a Linux diskful node and create a diskles =head1 SYNOPSIS -B node B<-t>|B<--type> diskless [B<-p>|B<--profile> I] [B<-o>|B<--osimage> I] [B<-i> I] [B<-n> I] [B<-V>|B<--verbose>] - -B node B<-t>|B<--type> sysclone B<-o>|B<--osimage> I [B<-V>|B<--verbose>] +B node B<-t>|B<--type> {diskless|sysclone} B<-o>|B<--osimage> I [B<-V>|B<--verbose>] B [B<-h> | B<--help>] | [B<-v> | B<--version>] @@ -20,7 +18,7 @@ The B command supports two image types: B and B. The B type: -The I is pre-defined, the attributes of osimage will be used to capture and prepare the root image. The B, B and B attributes for the stateless/statelite image to be created are duplicated from the B's attribute. If the B<-p|--profile> I option is specified, the image will be created under "/>/netboot///>/rootimg". +The attributes of osimage will be used to capture and prepare the root image. The B, B and B attributes for the stateless/statelite image to be created are duplicated from the B's attribute. If the B<-p|--profile> I option is specified, the image will be created under "/>/netboot///>/rootimg". The default files/directories excluded in the image are specified by /opt/xcat/share/xcat/netboot//>...imgcapture.exlist; also, you can put your customized file (>...imgcapture.exlist) to /install/custom/netboot/. 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 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 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, and the network interface the diskless node will boot over is B, the driver modules for this network interface is B. - -imgcapture node1 -t diskless -p hpc -i eth0 -n e1000e - -4. There's one pre-defined I. In order to capture and prepare the diskless root image for I, run the command: +1. There's one pre-defined I. In order to capture and prepare the diskless root image for I, run the command: imgcapture node1 -t diskless -o osimage -5. In order to capture the diskful image from B and create the I B, run the command: +2. In order to capture the diskful image from B and create the I B, run the command: imgcapture node1 -t sysclone -o img1 diff --git a/xCAT-client/pods/man1/liteimg.1.pod b/xCAT-client/pods/man1/liteimg.1.pod index 741a4c031..f28130dec 100644 --- a/xCAT-client/pods/man1/liteimg.1.pod +++ b/xCAT-client/pods/man1/liteimg.1.pod @@ -8,8 +8,6 @@ I I -I - I =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 +I =head1 FILES diff --git a/xCAT-client/pods/man1/packimage.1.pod b/xCAT-client/pods/man1/packimage.1.pod index a0d42a340..9f4561e8a 100644 --- a/xCAT-client/pods/man1/packimage.1.pod +++ b/xCAT-client/pods/man1/packimage.1.pod @@ -8,9 +8,6 @@ I I - -I - I =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 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 is specified, this command will get all the necessary os image definition files from the I and I tables. +This command will get all the necessary os image definition files from the I and I 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 +I -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 diff --git a/xCAT-client/pods/man1/rmimage.1.pod b/xCAT-client/pods/man1/rmimage.1.pod index b3556c4fa..ae9a1259c 100644 --- a/xCAT-client/pods/man1/rmimage.1.pod +++ b/xCAT-client/pods/man1/rmimage.1.pod @@ -7,8 +7,6 @@ B - Removes the Linux stateless or statelite image from the file system I -I I<-o > I<-a > I<-p > - I =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 - -or - -I +I 2. To remove a rhels5.5 statelite image for a compute node architecture ppc64 and the osimage definition, enter: I -or - -I - =head1 FILES /opt/xcat/sbin/rmimage diff --git a/xCAT-client/pods/man1/switchdiscover.1.pod b/xCAT-client/pods/man1/switchdiscover.1.pod index b756b2b47..af17fd3e1 100755 --- a/xCAT-client/pods/man1/switchdiscover.1.pod +++ b/xCAT-client/pods/man1/switchdiscover.1.pod @@ -11,7 +11,7 @@ I I -I +I @@ -30,15 +30,13 @@ B 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. diff --git a/xCAT-client/pods/man8/nodeset.8.pod b/xCAT-client/pods/man8/nodeset.8.pod index 2c8bd55cd..5c610996c 100644 --- a/xCAT-client/pods/man8/nodeset.8.pod +++ b/xCAT-client/pods/man8/nodeset.8.pod @@ -4,7 +4,7 @@ B - set the boot state for a noderange =head1 B -B [I] [I|I|I|I|I|I|I|I|I>]|I|I] +B [I] [I|I|I|I|I|I>]|I|I] B I I> [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|B|B> - -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|B|B> - -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|B|B> - -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, B and B 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 Cleanup the current pxe/tftp boot configuration files for the nodes requested diff --git a/xCAT-client/pods/man8/rinstall.8.pod b/xCAT-client/pods/man8/rinstall.8.pod index 1923a8f9f..62696dc88 100644 --- a/xCAT-client/pods/man8/rinstall.8.pod +++ b/xCAT-client/pods/man8/rinstall.8.pod @@ -4,8 +4,6 @@ B - Begin OS provision on a noderange =head1 B -B [I<-o>|I<--osver>] [I<-p>|I<--profile>] [I<-a>|I<--arch>] [I<-c>|I<--console>] [I] - B [I<-O>|I<--osimage>] [I<-c>|I<--console>] [I] =head1 B @@ -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. - -=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. - - -=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. - =item B<-O>|B<--osimage> Specifies the osimage to provision. @@ -58,10 +43,6 @@ B I Provison nodes 1 through 20, using their current configuration. -B I -o rhels5.1 -p compute - -Provision nodes 1 through 20, forcing rhels5.1 and compute profile. - B I -O rhels6.4-ppc64-netboot-compute Provision nodes 1 through 20 with the osimage rhels6.4-ppc64-netboot-compute. diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index 196806bde..ddd4a39f0 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -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= profile= [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=]|[profile=]|[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})) { diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 7a56a453e..90e96c252 100755 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -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) { diff --git a/xCAT-server/lib/xcat/plugins/grub2.pm b/xCAT-server/lib/xcat/plugins/grub2.pm index c3b128b48..233a5ade4 100644 --- a/xCAT-server/lib/xcat/plugins/grub2.pm +++ b/xCAT-server/lib/xcat/plugins/grub2.pm @@ -23,7 +23,7 @@ my $globaltftpdir = xCAT::TableUtils->getTftpDir(); my %usage = ( - "nodeset" => "Usage: nodeset [install|shell|boot|runcmd=bmcsetup|netboot|iscsiboot|osimage[=]|offline]", + "nodeset" => "Usage: nodeset [shell|boot|runcmd=bmcsetup|iscsiboot|osimage[=]|offline]", ); sub handled_commands { # process noderes:netboot like "grub2-" diff --git a/xCAT-server/lib/xcat/plugins/imgcapture.pm b/xCAT-server/lib/xcat/plugins/imgcapture.pm old mode 100644 new mode 100755 index 5a2ff9946..6bb88b83e --- a/xCAT-server/lib/xcat/plugins/imgcapture.pm +++ b/xCAT-server/lib/xcat/plugins/imgcapture.pm @@ -46,7 +46,7 @@ sub process_request { @ARGV = @{$request->{arg}} if (defined $request->{arg}); my $argc = scalar @ARGV; - my $usage = "Usage: imgcapture -t|--type diskless [-p | --profile ] [-o|--osimage ] [-i ] [-n ] [-d | --device ] [-V | --verbose] \n imgcapture -t|--type sysclone -o|--osimage [-V | --verbose] \n imgcapture [-h|--help] \n imgcapture [-v|--version]"; + my $usage = "Usage:\n imgcapture -t|--type {diskless|sysclone} -o|--osimage [-V | --verbose] \n imgcapture [-h|--help] \n imgcapture [-v|--version]"; my $os; my $arch; diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index ae863b24f..574ceeb72 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -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}; diff --git a/xCAT-server/lib/xcat/plugins/nimol.pm b/xCAT-server/lib/xcat/plugins/nimol.pm index ae02590fc..8257a8b08 100644 --- a/xCAT-server/lib/xcat/plugins/nimol.pm +++ b/xCAT-server/lib/xcat/plugins/nimol.pm @@ -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"); diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm old mode 100644 new mode 100755 index 79e231270..02af3abc3 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -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; } diff --git a/xCAT-server/lib/xcat/plugins/pxe.pm b/xCAT-server/lib/xcat/plugins/pxe.pm index bdeb8034f..abc766aef 100644 --- a/xCAT-server/lib/xcat/plugins/pxe.pm +++ b/xCAT-server/lib/xcat/plugins/pxe.pm @@ -16,7 +16,7 @@ my $globaltftpdir = xCAT::TableUtils->getTftpDir(); #my $dhcpver = 3; my %usage = ( - "nodeset" => "Usage: nodeset [install|shell|boot|runcmd=bmcsetup|netboot|iscsiboot|osimage[=]|statelite|offline]", + "nodeset" => "Usage: nodeset [shell|boot|runcmd=bmcsetup|iscsiboot|osimage[=]|offline]", ); sub handled_commands { return { diff --git a/xCAT-server/lib/xcat/plugins/rinstall.pm b/xCAT-server/lib/xcat/plugins/rinstall.pm index 7799577f6..bb139d753 100644 --- a/xCAT-server/lib/xcat/plugins/rinstall.pm +++ b/xCAT-server/lib/xcat/plugins/rinstall.pm @@ -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] "; - } else { # winstall - $rsp->{data}->[1] = " [-o|--osver] [-p|--profile] [-a|--arch] "; - } - if ($command =~ /rinstall/) { - $rsp->{data}->[2] = " [-O|--osimage] [-c|--console] "; + $rsp->{data}->[1] = " [-O|--osimage] [-c|--console] "; } else { # wininstall - $rsp->{data}->[2] = " [-O|--osimage] "; + $rsp->{data}->[1] = " [-O|--osimage] "; } - $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); } diff --git a/xCAT-server/lib/xcat/plugins/rmimage.pm b/xCAT-server/lib/xcat/plugins/rmimage.pm index 3125cbc4c..bbfae5994 100644 --- a/xCAT-server/lib/xcat/plugins/rmimage.pm +++ b/xCAT-server/lib/xcat/plugins/rmimage.pm @@ -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 -a -p \n rmimage [-V | --verbose] imagename [--xcatde]"; + my $usage = "\nUsage:\n rmimage [-h | --help]\n rmimage [-V | --verbose] imagename [--xcatde]"; @ARGV = @{$request->{arg}}; diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index 95e3a606b..37152b921 100755 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -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; diff --git a/xCAT-server/lib/xcat/plugins/xnba.pm b/xCAT-server/lib/xcat/plugins/xnba.pm index 8ed6da148..084ae60ac 100644 --- a/xCAT-server/lib/xcat/plugins/xnba.pm +++ b/xCAT-server/lib/xcat/plugins/xnba.pm @@ -18,7 +18,7 @@ my $globaltftpdir = xCAT::TableUtils->getTftpDir(); #my $dhcpver = 3; my %usage = ( - "nodeset" => "Usage: nodeset [install|shell|boot|runcmd=bmcsetup|netboot|iscsiboot|osimage[=]|statelite|offline]", + "nodeset" => "Usage: nodeset [shell|boot|runcmd=bmcsetup|iscsiboot|osimage[=]|offline]", ); sub handled_commands { return { diff --git a/xCAT-server/lib/xcat/plugins/yaboot.pm b/xCAT-server/lib/xcat/plugins/yaboot.pm index 319d363bd..7061270ba 100644 --- a/xCAT-server/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server/lib/xcat/plugins/yaboot.pm @@ -20,7 +20,7 @@ my $globaltftpdir = xCAT::TableUtils->getTftpDir(); #my $dhcpver = 3; my %usage = ( - "nodeset" => "Usage: nodeset [install|shell|boot|runcmd=bmcsetup|netboot|iscsiboot|osimage[=]|offline]", + "nodeset" => "Usage: nodeset [shell|boot|runcmd=bmcsetup|iscsiboot|osimage[=]|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"); } } diff --git a/xCAT-server/share/xcat/install/rh/compute.rhels7.tmpl b/xCAT-server/share/xcat/install/rh/compute.rhels7.tmpl index 0f69955bd..b3949c8d7 100644 --- a/xCAT-server/share/xcat/install/rh/compute.rhels7.tmpl +++ b/xCAT-server/share/xcat/install/rh/compute.rhels7.tmpl @@ -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# diff --git a/xCAT-server/share/xcat/install/rh/kvm.rhels7.tmpl b/xCAT-server/share/xcat/install/rh/kvm.rhels7.tmpl index b32f1f01d..0bfd40ebe 100644 --- a/xCAT-server/share/xcat/install/rh/kvm.rhels7.tmpl +++ b/xCAT-server/share/xcat/install/rh/kvm.rhels7.tmpl @@ -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# diff --git a/xCAT-server/share/xcat/install/rh/service.rhels7.tmpl b/xCAT-server/share/xcat/install/rh/service.rhels7.tmpl index 9e6e91652..209f766e4 100644 --- a/xCAT-server/share/xcat/install/rh/service.rhels7.tmpl +++ b/xCAT-server/share/xcat/install/rh/service.rhels7.tmpl @@ -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# diff --git a/xCAT-server/share/xcat/install/scripts/pre.rh.rhel7 b/xCAT-server/share/xcat/install/scripts/pre.rh.rhels7 similarity index 100% rename from xCAT-server/share/xcat/install/scripts/pre.rh.rhel7 rename to xCAT-server/share/xcat/install/scripts/pre.rh.rhels7 diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index 6bbeafebe..db11448ba 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -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 @@ -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 = {}; } diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_cudafull b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_cudafull new file mode 100644 index 000000000..b9335eeb7 --- /dev/null +++ b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_cudafull @@ -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 diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_cudaruntime b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_cudaruntime new file mode 100644 index 000000000..777916ec6 --- /dev/null +++ b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_cudaruntime @@ -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 diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_cudafull b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_cudafull new file mode 100644 index 000000000..24f9b4827 --- /dev/null +++ b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_cudafull @@ -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 diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_cudaruntime b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_cudaruntime new file mode 100644 index 000000000..1695429e1 --- /dev/null +++ b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_cudaruntime @@ -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 diff --git a/xCAT/postscripts/confignics b/xCAT/postscripts/confignics index 7122d7749..2868a9a31 100755 --- a/xCAT/postscripts/confignics +++ b/xCAT/postscripts/confignics @@ -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"