Compare commits

..

180 Commits

Author SHA1 Message Date
arif cb2d15cf29 update work on mkvlan 2014-05-04 18:26:29 +01:00
arif 397e964364 add lsvlan, a few initial changes 2014-05-04 16:09:33 +01:00
arif e6315798fc start work on mkvlan support 2014-05-04 15:30:04 +01:00
lissav 3ecda8287a old unused xCAT1 code defect 4077 2014-05-02 06:31:00 -04:00
lissav 5221b6b413 old unused xCAT1 code defect 4077 2014-05-02 06:27:59 -04:00
lissav 8564fec9d0 add new xcatconfig using timezone utility defect 4077 2014-04-30 12:09:41 -04:00
immarvin 6bbca1da9c avoid running rpm command during package installation 2014-04-30 09:38:29 -07:00
Jarrod Johnson 4d60f2b270 Fix inifinite loop on well formed and malformed multirecrd areas
There were mistakes in the parsing of multirecord IPMI fru area.
Most critically, the index never advanced.  Additionally, ensure
that the index always increases and check against the length of the structure
so that a malformed area would not send our parser into an infinite loop.
2014-04-30 10:30:36 -04:00
Jarrod Johnson 84bf9dbf48 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core 2014-04-30 09:49:33 -04:00
immarvin e0d5594d67 #3987 partitionfile=s: issues when using variables 2014-04-30 07:23:07 -07:00
lissav 7f4e4a5283 add gettimezone common routine 2014-04-30 08:45:28 -04:00
zhaoertao 2426c38282 fix bug 4109 mkvm failed with non-int parameters 2014-04-30 02:29:21 -07:00
Jarrod Johnson 7983748b45 Fix UpdateExpress under genesis
Newer versions would experience a hard failure if the embedded CIM implementation
cannot start.  strace revealed that said process was failing because /var/tmp did not
exist
2014-04-30 02:45:10 -04:00
Jarrod Johnson ba5341a21d Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core 2014-04-29 15:00:48 -04:00
Jarrod Johnson 4790c45b4d Fix UpdateExpress under genesis
Newer versions would experience a hard failure if the embedded CIM implementation
cannot start.  strace revealed that said process was failing because /var/tmp did not
exist
2014-04-29 14:59:23 -04:00
lissav e43e18ba9b support MariaDB defect 4097 2014-04-29 10:20:50 -04:00
lissav 7b5aa8aed1 support MariaDB defect 4097 2014-04-29 10:10:45 -04:00
lissav 99ef971862 Defect 4061 2014-04-29 09:05:33 -04:00
immarvin 71ed00d1a4 fix defect #3997 node reinstall loop when site.nodestatus=0 Edit 2014-04-29 00:22:25 -07:00
zhaoertao 7112eaed3f fix bug 3934: mkdef/chdef -u needs better doc and 1 fix 2014-04-28 22:17:10 -07:00
ligc 9766383d68 add vlan support for configeth, could use the syntax eth1.2 to specify vlan tagging 2014-04-29 10:31:11 -05:00
zhaoertao 963deac240 fix bugs about partitioning 2014-04-28 06:21:51 -07:00
yinle 2ff5605034 Add new check item cmdcheck to run script to check auto-test result 2014-04-28 08:08:26 -07:00
daniceexi e68ce246df defect 4065: add the description for site.externaldns in makedns.8.pod 2014-04-28 09:57:00 -04:00
immarvin 8756aa4cd8 add a new ubuntu dependency libcrypt-cbc-perl 2014-04-28 00:23:45 -07:00
immarvin 694b3eac6c add dependency libcrypt-rijndael-perl for ubuntu 2014-04-27 20:42:39 -07:00
Bruce Potter 1bdbd9242e fix but in xCAT-SoftLayer spec file 2014-04-26 18:38:26 -04:00
Bruce Potter dbfd2a8909 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
sysclone working in softlayer
2014-04-26 18:29:37 -04:00
Bruce Potter 4cb37a0a7d sysclone working in softlayer 2014-04-26 18:29:01 -04:00
Jarrod Johnson e2a3db7844 Fix mistakes in bmcsetup 2014-04-25 13:18:39 -04:00
Jarrod Johnson 36a23efcfb Remove deprecated timezones 2014-04-24 14:15:40 -04:00
daniceexi 5c563748bc defect 4096: add the virtio driver for sles diskless so that sles kvm could boot with virtio driver 2014-04-24 04:12:25 -04:00
lissav 2e1aa300ec Redhat7 support defect 4092 2014-04-23 14:53:43 -04:00
lissav 72d312347d better examples for setAttribs XML interface 2014-04-23 09:06:25 -04:00
arif 065eb7b9dd defect #4061: fix DSHCLI.pm for append in hierarchy 2014-04-23 11:23:57 +01:00
litingt 70ee283f90 add suse support 2014-04-23 02:28:15 -07:00
daniceexi 14b8749111 add handling for the error happens in table resource operation 2014-04-23 06:12:07 -04:00
lissav 852e6d8bd0 remove getFacingIP. It is not used and does not support Redhat7 defect 4091 2014-04-22 11:06:29 -04:00
daniceexi 08d73347c8 split table src to multiple ones; replace xcatws.cgi with the content from restapi.pl 2014-04-22 14:22:19 -04:00
zhaoertao 1057bd5b91 modify DHCP parameters for pkvm 2014-04-22 03:11:09 -07:00
litingt 5ccbf223d6 add strict release check 2014-04-22 03:01:23 -07:00
zhaoertao 8ee1cb7457 Modify the dhcp config file use ip address of MN rather than a static IP address 2014-04-21 19:47:21 -07:00
lissav 8fecce3cd1 remove unused code 2014-04-21 12:54:08 -04:00
Bruce Potter 058d969467 changed table resource to tables in genrestapidoc.pm 2014-04-21 10:36:08 -04:00
Bruce Potter e57afa23c1 change table resource to tables in rest api 2014-04-21 10:18:51 -04:00
litingt acf8491a0a modify initialze in confing_mn 2014-04-21 05:13:34 -07:00
immarvin 4554c35541 fix defect #4044 xCAT spec file %post additons not checking for AIX Edit 2014-04-21 03:20:55 -07:00
zhaoertao 3b826ad2be fix bug 4088:xdsh to IBM RackSwitch does not work 2014-04-21 01:32:29 -07:00
litingt 7b4f28da60 add pro_result() declare 2014-04-21 01:45:22 -07:00
litingt 921b94a6e8 remove debug comments 2014-04-21 00:43:38 -07:00
yinle d4da5664b6 Modify the way of process mn arg 2014-04-21 02:21:06 -07:00
litingt eaaf75d74d add fork 2014-04-20 21:00:43 -07:00
Bruce Potter 5d13cf0d36 added table put and delete calls to rest api 2014-04-20 18:56:24 -04:00
Bruce Potter 89e71c874b Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
updates
2014-04-18 14:57:12 -04:00
Jarrod Johnson 566859fad4 Recognize mpt3sas class adapters 2014-04-18 10:50:58 -04:00
Bruce Potter 41483a0023 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
doxcat change for static ip
2014-04-18 04:28:32 -04:00
Lei Ai b0daa95209 Merge fix from branch 2.8: create non-blocking call for nodechprofile 2014-04-18 15:45:44 +08:00
ligc c79270ac4b a typo in the comment 2014-04-17 23:00:21 -05:00
ligc dc4a67cfe3 fix for bug 4084: AIX rpm spec does not allow %if inside %ifos 2014-04-17 22:57:41 -05:00
lissav 6bb5a53c37 4072 2014-04-17 10:17:21 -04:00
ligc 204737f826 fix for bug 4074: different ifconfig -a output on RHEL7 2014-04-17 21:23:27 -05:00
Bruce Potter bf3e88261b Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
change to doxcat
2014-04-17 08:22:55 -04:00
immarvin eb381a3b96 add description of managedaddressmode 2014-04-17 03:16:12 -07:00
immarvin 7235387417 enhance the dhcp unicast for some specific cases on nameservers and gateway value 2014-04-17 03:10:15 -07:00
zhaoertao a4fb366485 modify the manpage of rpower not to use internal node names 2014-04-17 01:49:47 -07:00
zhaoertao e571778118 fix bug 3893:rpower man page should note the need for the required ASU Power.S3Enable setting 2014-04-17 01:46:21 -07:00
Lei Ai 74ab5d1110 Merge fix for 2.8 branch about node status update for profiled nodes into mainline 2014-04-17 15:56:59 +08:00
litingt d5877d2db5 modify log file location 2014-04-17 00:15:21 -07:00
litingt 747d5cef6e minor changes 2014-04-16 23:51:21 -07:00
litingt 8e0ac00c37 packimage osimage 2014-04-16 21:44:34 -07:00
zhaoertao ca0101fec1 issue for pkvm host not use eth0 2014-04-16 20:34:58 -07:00
ligc e0bd432201 fix for bug 4084: AIX should not require grub2-xcat 2014-04-16 23:28:51 -04:00
zhaoertao a221d8698d for bug 4070 2014-04-16 19:54:00 -07:00
lissav f90cdb8a1b defect 4072 2014-04-16 15:10:16 -04:00
lissav 0274937478 defect 4072 2014-04-16 12:34:09 -04:00
lissav 2b4a12d785 defect 4072 2014-04-16 10:17:05 -04:00
lissav e93507ecbd defect 4071 2014-04-16 10:13:31 -04:00
daniceexi ae95af8dbb add the site attribute description for dnsupdaters and persistkvmguests 2014-04-16 08:56:23 -04:00
yinle 4ed50aeb3c Add debug mode. 2014-04-16 04:48:18 -07:00
zhaoertao c1bdc749b8 The HMC version 8 drop the prompt space when log on to it 2014-04-15 22:14:36 -07:00
daniceexi 87947d7fca Fixed that is external dns is used, don't try to start local dns; refine the ddns.pm that replace the tab with 4spaces. 2014-04-16 04:12:56 -04:00
lissav b0d5cd593f add more comments about externaldns 2014-04-15 13:26:00 -04:00
lissav 553aa59bb1 defect 4061 2014-04-15 11:39:28 -04:00
lissav e850c050ef defect 4064 2014-04-15 10:02:17 -04:00
Jarrod Johnson 0ee24e839a Revert "Have openssl req use better message digest"
This reverts commit 98bc658385.
2014-04-15 09:12:00 -04:00
Jarrod Johnson 3ea7bafb9a Revert "Use sha256 by default in openssl.cnf"
This reverts commit e02a913e86.
2014-04-15 09:11:47 -04:00
daniceexi 2e24d9a008 add the site description for externaldns attribute 2014-04-15 13:12:45 -04:00
daniceexi 758235d4dd restructure the xcatws-test.sh to make it can handle server certificate checking and token checking 2014-04-15 09:53:48 -04:00
yinle a2b241d6d3 Adjust formate, add fork progress, move code into sub-routines 2014-04-15 07:42:30 -07:00
zhaoertao f5c0758921 add powerkvm VM support for mkvm,chvm,rmvm,rpower 2014-04-15 01:23:08 -07:00
Bruce Potter abab2914af Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
modified doxcat to optionally use static ip
2014-04-14 15:56:56 -04:00
Bruce Potter 9d6318d70e update doxcat to optionally use static ip, but still one problem 2014-04-14 15:56:35 -04:00
Jarrod Johnson a8f675b80a Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core 2014-04-14 15:47:42 -04:00
Jarrod Johnson 5c4558c06c Implement auto-downgrade to operator in IPMI
In some circumstances, xCAT can only have Operator privilege in
an IPMI environment.  In such a scenario, auto-degrade to operator
and try again before giving up.
2014-04-14 15:46:44 -04:00
lissav 0635157d1a defect 4061 2014-04-14 13:07:08 -04:00
immarvin 78b2d75c94 enhance the getNodeNetworkCfg to return the gateway info 2014-04-14 02:21:17 -07:00
ligc 7b7a6ab894 fix for bug 4062: add autocommit=0 when opening the nodelist table 2014-04-14 16:09:08 -05:00
huweihua a9650d0df1 fix defect 4006 2014-04-14 01:16:10 -04:00
zhaoertao 8cd052a03e change the bug fix of 3993:DFM support Powerlinux,chvm doesn't update node attributes 2014-04-13 20:10:17 -07:00
Jarrod Johnson 6e7009e9e6 Backdate the CA certificate itself 2014-04-11 14:13:08 -04:00
Jarrod Johnson c1e873d37f Backdate SSL certificates by default for 'startDate' 2014-04-11 13:26:31 -04:00
Jarrod Johnson dd90516371 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core 2014-04-11 11:27:48 -04:00
Jarrod Johnson a05b6bbcb1 Undo the increase in efi volume and instead influence anaconda's perspective of the 'bios' drive 2014-04-11 11:27:13 -04:00
immarvin a3b85a2d42 support unicast dhcp during provisioning and 1st boot, including diskful for sles and rh 2014-04-11 07:46:15 -07:00
lissav dd1bb50118 fix vbox defect 4057 2014-04-11 05:45:37 -04:00
litingt c930087fd7 modify some minor error init and do_test 2014-04-11 02:06:40 -07:00
ligc 3d5bc652c1 fix for bug 4059: trim the / at the end of pkgdir 2014-04-11 15:44:02 -05:00
Bruce Potter a2dc620bc6 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
start sysclone support for softlayer and fix getslnodes bug
2014-04-10 15:07:14 -04:00
Bruce Potter d09b8faa6a start sysclone support for softlayer and fix getslnodes bug 2014-04-10 15:06:47 -04:00
lissav 357a53589c defect 4049 broadcast updatenode -g if sharedtftp=0 2014-04-10 12:45:56 -04:00
Jarrod Johnson 027f599527 Increase /boot/efi on RHEL installs
Sometimes, anaconda decides that 50MB is not enough.  Their doucmentation calls out '100 MB', so go with documentation minimun
2014-04-10 09:42:27 -04:00
zhaoertao cea9a4e427 fix bug 3993 DFM support Powerlinux, chvm doesn't update node attributes 2014-04-10 04:10:19 -07:00
daniceexi 207388d424 did some minor changes for the output of examples; adjusted the resource order in the auto generated doc 2014-04-10 10:15:28 -04:00
yinle 7845eef34d Modify policy and site; remove tab 2014-04-10 06:57:10 -07:00
lissav 656469da5c defect 4053 2014-04-09 11:14:43 -04:00
lissav f6aaf5eba0 defect 4052 2014-04-09 09:40:45 -04:00
junxiaw 9f160dfd1d wangjunxiaw update code for restapi 2014-04-09 02:42:30 -07:00
root 9c0ca92a63 wangjunxiaw update genrestapidoc code 2014-04-09 02:39:49 -07:00
zhaoertao 99f1eba251 add examples and usage for osiamge in RESTAPI 2014-04-09 02:12:14 -07:00
daniceexi 217dee1244 removed the unused require of table.pm; fix the issue to handle the servicedone key in the xcat xml output 2014-04-09 07:22:29 -04:00
ligc e721b46e6d add the rhelhpc6.5 support 2014-04-09 13:56:13 -05:00
ligc c358897336 add the discinfo for CentOS 5.10 2014-04-09 13:24:13 -05:00
mellor f196c720ef defect 4049 change Postage.pm to call my_if_facing if xcatmaster attr not set 2014-04-08 17:15:40 -04:00
lissav c358b14b03 do not build ipmi.pm for AIX 2014-04-08 15:01:19 -04:00
lissav a8a82224eb force a build 2014-04-08 14:35:15 -04:00
lissav 42a8457618 comment back ipmi.pm on AIX 2014-04-08 14:26:53 -04:00
lissav 53fb99d748 defect 4051 do not ship ipmi.pm on AIX 2014-04-08 12:34:05 -04:00
lissav 9f11ec4d2f defect 4050 2014-04-08 07:50:28 -04:00
zhaoertao 97b9c613cc fix bug 4032:$password not single quoted in /opt/xcat/share/xcat/cons/ipmi 2014-04-08 02:17:49 -07:00
ligc cbdbf16c39 fix syntax errors in xCATreg, blocks build process 2014-04-08 03:35:11 -04:00
ligc d13ee30dcd fix syntax errors in xCATreg, blocks build process 2014-04-08 03:34:21 -04:00
root 9ff7194b45 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core 2014-04-07 19:26:28 -07:00
root b1e6d991b3 wangjunxia update xcatreg code 2014-04-07 19:17:24 -07:00
lissav 679cab11a0 do not build softlayer on AIX defect 4048 2014-04-07 13:01:39 -04:00
lissav 8a7857f57f defect 4047 2014-04-07 10:54:06 -04:00
lissav 066be36003 defect 4047 perl warnings 2014-04-07 10:38:49 -04:00
arif 6a4db6c0ff defect #4045: fix gpfs_updates to use MASTER instead of SITEMASTER for hierarchical situations 2014-04-07 14:05:24 +01:00
arif 54f99d0849 defect 4033: fix device based routing in makeroutes 2014-04-07 13:20:16 +01:00
daniceexi 5fd991246a added the resource to POST token for an account 2014-04-07 08:11:23 -04:00
daniceexi 6bb22d2342 added the token authentication mechanism in the xcatd 2014-04-07 07:57:57 -04:00
Jarrod Johnson d5cb13be6d Fix windows install problem where tmplfile was masked out in scope 2014-04-04 23:27:36 -04:00
linggao 3c7870afbc removed the dependency on openrc file, fixed defect 4040 and 4041 2014-04-05 04:42:28 -04:00
zhaoertao b169de45ef Modify doc output for osimage/osimage_allattr 2014-04-04 03:47:02 -07:00
zhaoertao bc8d13c9c0 use ext4 for powerkvm VM 2014-04-04 02:00:41 -07:00
ligc 997a8e36d0 Temporary remove the grub2-xcat dependency for PCM, it blockes PCM test 2014-04-04 04:34:33 -04:00
litingt 51e53737a2 merge 2.8 case to 2.9 2014-04-04 01:32:56 -07:00
ligc 69598e32f7 Build a separate xCAT-server for PCM, because of the perl-JSON dependency caused by RESTAPI 2014-04-04 14:46:26 -05:00
zhaoertao ebbfe29f5c nodeset supporting ubuntu LE for pkvm VM 2014-04-03 20:20:54 -07:00
yinle 7848b733b3 Modify doc for policy and site. 2014-04-04 01:52:49 -07:00
yinle 69455327e6 Modify doc output of policy and site. 2014-04-04 01:46:33 -07:00
linggao 469126c759 added verbose output for opsaddimage and opsaddbmnode commands. 2014-04-04 06:32:07 -04:00
lissav af908aafdf add timeout option on usage 2014-04-03 07:24:09 -04:00
lissav c5172263b9 fix syntax in hellp 2014-04-03 07:08:40 -04:00
yinle 788b616458 Modify auto-test script, add new configuration file keys. 2014-04-03 07:50:59 -07:00
ligc d84f7d5e9e pull build-debs-all from 2.8 to master 2014-04-03 15:30:02 -05:00
litingt 0579db7baa re-org all the code in this script 2014-04-03 01:24:15 -07:00
ligc f252d167a1 fix for 4029: do not try to modify /, will cause rpm install failure on RHEL7 2014-04-03 15:06:02 -05:00
daniceexi a0bbb92921 refine the output/doc of nodeshell,nodecopy,sw,postscript; Added the support of slpnodes 2014-04-03 04:29:42 -04:00
ligc b572e045fb fix for bug 4038: do not override --installdir with xcatdsklspost 2014-04-03 09:44:29 -05:00
mellor af9b887d23 defect 4026 add service node to error msg 2014-04-02 13:05:07 -04:00
ligc 40319ab858 fix a problem in perl-xCAT.spec for git commit id 2014-04-02 05:30:14 -04:00
ligc f88f454e9a fix a problem in perl-xCAT.spec for git commit id 2014-04-02 05:23:53 -04:00
ligc 9a71aee476 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core 2014-04-02 05:15:34 -04:00
daniceexi a2e384931a add more comments 2014-04-02 10:23:08 -04:00
ligc 09df503e1e add the git commit id in xCAT version 2014-04-02 15:50:41 -05:00
ligc 3a65f12683 undo the last checkin for buildcore.sh, wrong local repo 2014-04-02 05:12:17 -04:00
GONG Jie e867ef90e9 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core 2014-04-02 15:32:57 +08:00
litingt 276554154f add CURDIR to specify directory 2014-04-01 20:58:53 -07:00
Chuck Brazie 1ece21a021 Comment out the horizontal whitespace escape char 2014-04-01 13:23:24 -04:00
daniceexi c6486a6228 Add more comments and remove not used subroutines 2014-04-01 12:41:51 -04:00
daniceexi c540c616ab make the output of nodeshell src is grouped with the nodename; support the xcoll flag to group the output with the output message instead of node 2014-04-01 10:16:02 -04:00
mellor a698e1757d defect 4020 - correctly handle results from gethostbyaddr in xcatd installmonitor 2014-03-31 17:50:05 -04:00
lissav 9e3dfa484b fix defect 4034 2014-03-31 14:26:29 -04:00
daniceexi 8887485857 support subnodes resource 2014-03-31 10:17:54 -04:00
daniceexi cf5fc84937 add the support of makedns/makedhcp, nodestat and bootstate=offline for node 2014-03-29 04:36:15 -04:00
GONG Jie da3d528caf Add mn_install 2014-03-28 22:48:12 +08:00
daniceexi 843a32e664 add the URI support for group and makedns/makedhcp 2014-03-28 10:09:17 -04:00
litingt 9ceb62cdaa checkin for Junxia 2014-03-28 00:16:49 -07:00
litingt e62178aee8 add repo file creation 2014-03-27 22:21:51 -07:00
daniceexi c418e9aeb9 More uri definition changes 2014-03-28 03:04:55 -04:00
107 changed files with 9295 additions and 8916 deletions
Executable
+88
View File
@@ -0,0 +1,88 @@
#!/bin/bash
###########
#
# This script call make<package>deb and create the deb packages
# for xCAT
#
# Author: Leonardo Tonetto <tonetto@linux.vnet.ibm.com>
# Revisor: Adalberto Medeiros <adalbas@linux.vnet.ibm.com>
# Revisor2: Arif Ali <aali@ocf.co.uk>
#
# Input:
#
# $1 is the build type/location
# $2 is the string added to the debian/changelog of each package
#
############
##############
# Get input
##############
PKG_LOCATION=$1 # local | snap | alpha
if [ -z $PKG_LOCATION ]; then
PKG_LOCATION="local"
fi
BUILD_STRING=$2
if [ -z $BUILD_STRING ]; then
BUILD_STRING="Personal Build"
fi
XCAT_VERSION=`cat Version`
TRUNK_REVISION=`svnversion | cut -d ":" -f1`
CUR_DATE=`date +%Y%m%d`
VERSION="${XCAT_VERSION}-${PKG_LOCATION}${CUR_DATE}"
function makedeb {
SRC_ROOT=$1
PKG_LOCATION=$2
BUILD_STRING=$3
VERSION=$4
#
# Make DEBs
#
# build perl-xCAT - deps are libsoap-lite-perl, libdigest-sha1-perl, libdbi-perl
#
find $SRC_ROOT -maxdepth 2 -name debian -type d | while read DEBIAN_DIR
do
DIR=`echo ${DEBIAN_DIR} | sed -e 's/[/]debian$//'`
cd ${DIR}
dch -v $VERSION -b -c debian/changelog "$BUILD_STRING"
dpkg-buildpackage
cd -
RC=$?
if [ ${RC} -gt 0 ]
then
echo "Warning: ${DEBIAN_DIR} failed exit code ${RC}"
fi
done
#
# Clean up
#
# Eliminate unnecessary directories and debian/files made by dpkg-buildpackage
find $SRC_ROOT -maxdepth 3 -type d -name "xcat-*" | grep debian | xargs rm -rf
find $SRC_ROOT -maxdepth 3 -type f -name "files" | grep debian | xargs rm -f
}
# build all debian packages
packages="xCAT-client xCAT-nbroot xCAT-nbroot2 perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-IBMhpc xCAT-rmc"
for file in `echo $packages`
do
makedeb $file $PKG_LOCATION "$BUILD_STRING" $VERSION
done
if [ -d debs ]; then
rm -rf debs
fi
mkdir debs
mv xcat* debs/
mv perl-xcat* debs/
echo $VERSION > latest_version
exit 0
+5 -2
View File
@@ -44,8 +44,10 @@ FRS=/home/frs/project/x/xc/xcat
ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-OpenStack xCAT-SoftLayer xCAT-OpenStack-baremetal"
ZVMBUILD="perl-xCAT xCAT-server xCAT-UI"
ZVMLINK="xCAT-client xCAT xCATsn"
PCMBUILD="xCAT"
PCMLINK="perl-xCAT xCAT-client xCAT-server xCAT-buildkit xCAT-genesis-scripts-x86_64"
# xCAT has PCM specific configuration - conserver-xcat, syslinux-xcat
# xCAT-server has PCM specific configuration - RESTAPI(perl-JSON)
PCMBUILD="xCAT xCAT-server"
PCMLINK="perl-xCAT xCAT-client xCAT-buildkit xCAT-genesis-scripts-x86_64"
# Note: for FSM, the FlexCAT rpm is built separately from gsa/git
FSMBUILD="perl-xCAT xCAT-client xCAT-server"
FSMLINK=""
@@ -241,6 +243,7 @@ for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xC
#if [ "$EMBED" = "zvm" -a "$rpmname" != "xCAT-server" -a "$rpmname" != "xCAT-UI" ]; then continue; fi # for zvm embedded env only need to build server and UI
if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi # do not build xCAT-buildkit on aix
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-SoftLayer" ]; then continue; fi # do not build xCAT-softlayer on aix
if $GREP $rpmname $GITUP || [ "$BUILDALL" == 1 ]; then
UPLOAD=1
maker $rpmname
+73 -19
View File
@@ -8,10 +8,29 @@
OSNAME=$(uname)
NAMEALL=$(uname -a)
for i in $*; do
# upper case the variable name
varstring=`echo "$i"|cut -d '=' -f 1|tr '[a-z]' '[A-Z]'`=`echo "$i"|cut -d '=' -f 2`
export $varstring
done
if [ -z "$CURDIR" ]; then
echo "get current directory!"
CURDIR=$(pwd)
fi
echo "CURDIR is $CURDIR"
echo "OSNAME is $OSNAME!"
echo "NAMEALL is $NAMEALL"
ls /code/xcat-core
grep -i 'SUSE' /etc/issue
if [ $? -eq 0 ]; then
echo "This is a SUSE system!"
OS="SUSE";
fi
ls $CURDIR/makerpm
if [ $? -gt 0 ]; then
echo "Error:no repo exist, exit 1."
@@ -25,10 +44,9 @@ if ! flock -n 8; then
exit 1
fi
#used only for hard code, will change later
cd /code/xcat-core
rm -rf build/
#delete old package if there is
rm -rf $CURDIR/build/
cd $CURDIR
echo "==============================================="
echo $NAMEALL | egrep "Ubuntu"
@@ -43,7 +61,7 @@ echo "This is an Ubuntu system"
short_ver=`cat Version|cut -d. -f 1,2`
pkg_version="${short_ver}-${pkg_type}${cur_date}"
mkdir -p /code/xcat-core/build
mkdir -p $CURDIR/build
for rpmname in xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT xCATsn xCAT-test; do
rpmname_low=`echo $rpmname | tr '[A-Z]' '[a-z]'`
@@ -57,49 +75,85 @@ echo "This is an Ubuntu system"
echo "Error: $rpmname build package failed exit code $rc"
fi
cd -
mv ${rpmname_low}* /code/xcat-core/build
mv ${rpmname_low}* $CURDIR/build
done
#delete all files except .deb file
find /code/xcat-core/build/* ! -name *.deb | xargs rm -f
find $CURDIR/build/* ! -name *.deb | xargs rm -f
else
#This is not an Ubuntu system
echo "This is an $OSNAME system"
rm -rf /root/rpmbuild/RPMS/noarch/*
rm -rf /root/rpmbuild/RPMS/x86_64/*
rm -rf /root/rpmbuild/RPMS/ppc64/*
mkdir build/
if [ "$OS" = "SUSE" ]; then
rm -rf /usr/src/packages/RPMS/noarch/*
rm -rf /usr/src/packages/RPMS/x86_64/*
rm -rf /usr/src/packages/RPMS/ppc64/*
else
rm -rf /root/rpmbuild/RPMS/noarch/*
rm -rf /root/rpmbuild/RPMS/x86_64/*
rm -rf /root/rpmbuild/RPMS/ppc64/*
fi
mkdir -p $CURDIR/build/
#always build perl-xCAT
$CURDIR/makerpm perl-xCAT
# Build the rest of the noarch rpms
for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-test xCAT-buildkit; do
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi
./makerpm $rpmname
$CURDIR/makerpm $rpmname
done
#build xCAT-genesis-scripts if it is x86_64 platform
ARCH=$(uname -p)
if [ "$ARCH" = "x64_64" ]; then
./makerpm xCAT-genesis-scripts x86_64
$CURDIR/makerpm xCAT-genesis-scripts x86_64
fi
# Build the xCAT and xCATsn rpms for all platforms
for rpmname in xCAT xCATsn; do
if [ "$OSNAME" = "AIX" ]; then
./makerpm $rpmname
$CURDIR/makerpm $rpmname
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname"; fi
else
for arch in x86_64 ppc64 s390x; do
./makerpm $rpmname $arch
$CURDIR/makerpm $rpmname $arch
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname-$arch"; fi
done
fi
done
cp /root/rpmbuild/RPMS/noarch/* build/
cp /root/rpmbuild/RPMS/x86_64/* build/
cp /root/rpmbuild/RPMS/ppc64/* build/
if [ "$OS" = "SUSE" ]; then
cp /usr/src/packages/RPMS/noarch/* $CURDIR/build/
cp /usr/src/packages/RPMS/x86_64/* $CURDIR/build/
cp /usr/src/packages/RPMS/ppc64/* $CURDIR/build/
else
cp /root/rpmbuild/RPMS/noarch/* $CURDIR/build/
cp /root/rpmbuild/RPMS/x86_64/* $CURDIR/build/
cp /root/rpmbuild/RPMS/ppc64/* $CURDIR/build/
fi
#begin to create repo for redhat platform
grep -i 'Red' /etc/issue;
if [ "$OSNAME" != "AIX" -a $? -eq 0 ]; then
cat >$CURDIR/build/xCAT-core.repo << EOF
[xcat-2-core]
name=xCAT 2 Core packages
baseurl=file://$CURDIR/build
enabled=1
gpgcheck=0
EOF
cp $CURDIR/build/xCAT-core.repo /etc/yum.repos.d/
else
rm -f /etc/zypp/repos.d/xCAT-core.repo
zypper ar file://$CURDIR/build xCAT-core
fi
fi
+4 -3
View File
@@ -1,20 +1,21 @@
#!/bin/sh
# Put the version, svn revision #, and build date into the Version function in Version.pm
if [ -z "$1" ]
if [ -z "$2" ]
then
echo "modifyUtils: Error: must specify the xCAT version as an argument" >&2
exit
fi
VER=$1
GITREF="git commit $2, "
BUILDDATE=`date`
#echo ". '(built $BUILDDATE)'"
if [ "$(uname)" = "AIX" ]
then
sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (built $BUILDDATE)'"/ xCAT/Version.pm >xCAT/Version.pm.new
sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${GITREF}built $BUILDDATE)'"/ xCAT/Version.pm >xCAT/Version.pm.new
mv xCAT/Version.pm.new xCAT/Version.pm
else
if [ -f "/etc/debian_version" ];then
@@ -22,5 +23,5 @@ else
else
FILENAME="xCAT/Version.pm"
fi
sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (built $BUILDDATE)'"/ $FILENAME
sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${GITREF}built $BUILDDATE)'"/ $FILENAME
fi
+3 -1
View File
@@ -23,6 +23,8 @@ Provides: perl-xCAT = %{epoch}:%{version}
Provides perl xCAT libraries for core functionality. Required for all xCAT installations.
Includes xCAT::Table, xCAT::NodeRange, among others.
%define gitinfo %(git log -n 1 | head -n 1 | cut -f 2 -d ' ')
%define zvm %(if [ "$zvm" = "1" ];then echo 1; else echo 0; fi)
%define fsm %(if [ "$fsm" = "1" ];then echo 1; else echo 0; fi)
@@ -36,7 +38,7 @@ Includes xCAT::Table, xCAT::NodeRange, among others.
%if %fsm
%else
# Modify the Version() function in xCAT/Utils.pm to automatically have the correct version
./modifyUtils %{version}
./modifyUtils %{version} %{gitinfo}
# Build the pod version of the man pages for each DB table. It puts them in the man5 and man7 subdirs.
# Then convert the pods to man pages and html pages.
+34 -24
View File
@@ -598,7 +598,7 @@ sub _execute_dsh
}
else
{
# LKV: This is where the output shows up
# HERE: This is where the output shows up
#print STDOUT @{$output_buffers{$user_target}};
#print STDERR @{$error_buffers{$user_target}};
chomp(@{$output_buffers{$user_target}});
@@ -3993,8 +3993,7 @@ sub parse_and_run_dsh
{
$options{'user'} = $ENV{'DSH_TO_USERID'};
}
if ((!(defined(@$nodes))) && (!(defined($options{'rootimg'}))))
if ((!(defined($nodes))) && (!(defined($options{'rootimg'}))))
{ # no nodes and not -i option, error
my $rsp = ();
$rsp->{error}->[0] = "Unless using -i option, noderange is required.";
@@ -4033,7 +4032,7 @@ sub parse_and_run_dsh
{ # from sinv, discard this name
undef @$nodes;
}
if (defined(@$nodes))
if (@$nodes)
{
my $rsp = {};
$rsp->{error}->[0] =
@@ -4405,7 +4404,7 @@ sub parse_and_run_dcp
return;
}
}
if ((!(defined(@$nodes))) && (!(defined($options{'rootimg'}))))
if ((!(defined($nodes))) && (!(defined($options{'rootimg'}))))
{ # no nodes and not -i option, error
my $rsp = {};
$rsp->{error}->[0] = "Unless using -i option, noderange is required.";
@@ -4502,7 +4501,7 @@ sub parse_and_run_dcp
#
# build list of nodes
my @nodelist;
if (defined(@$nodes))
if (@$nodes)
{ # there are nodes
@nodelist = @$nodes;
$options{'nodes'} = join(',', @nodelist);
@@ -4972,7 +4971,8 @@ sub parse_rsync_input_file_on_MN
$::process_line = 0;
my $destfileisdir;
my $clause=0;
my $addmergescript =0;
my $addappendscript =0;
open(INPUTFILE, "< $input_file") || die "File $input_file does not exist\n";
while (my $line = <INPUTFILE>)
{
@@ -5013,12 +5013,16 @@ sub parse_rsync_input_file_on_MN
# this triggers the running of the appendscript
$::appendscript ="/opt/xcat/share/xcat/scripts/xdcpappend.sh";
}
# add the append script to the sync
my $appscript ="/opt/xcat/share/xcat/scripts/xdcpappend.sh";
my $appendscriptline = "$appscript -> $appscript";
$syncappendscript=1; # syncing the xdcpappend.sh script
&build_append_rsync($appendscriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncappendscript);
}
if ($addappendscript == 0) { # only add once
my $appscript ="/opt/xcat/share/xcat/scripts/xdcpappend.sh";
my $appendscriptline = "$appscript -> $appscript";
$syncappendscript=1; # syncing the xdcpappend.sh script
&build_append_rsync($appendscriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncappendscript);
$addappendscript=1;
}
} # end APPEND clause
if ($clause =~ /MERGE:/) {
# location of the base merge script
# for MERGE we have to sync the mergescript and the
@@ -5030,12 +5034,16 @@ sub parse_rsync_input_file_on_MN
# this triggers the running of the mergescript
$::mergescript ="/opt/xcat/share/xcat/scripts/xdcpmerge.sh";
}
# add the merge script to the sync
my $mergescript ="/opt/xcat/share/xcat/scripts/xdcpmerge.sh";
my $mergescriptline = "$mergescript -> $mergescript";
$syncmergescript=1; # syncing the xdcpmerge.sh script
&build_merge_rsync($mergescriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncmergescript);
}
if ($addmergescript == 0) { # only add once
my $mergescript ="/opt/xcat/share/xcat/scripts/xdcpmerge.sh";
my $mergescriptline = "$mergescript -> $mergescript";
$syncmergescript=1; # syncing the xdcpmerge.sh script
&build_merge_rsync($mergescriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncmergescript);
$addmergescript=1;
}
} # end MERGE clause
}
} else { # not processing EXECUTE, EXECUTEALWAYS or APPEND
@@ -5199,6 +5207,7 @@ sub build_append_rsync
push @::appendlines,$line;
}
my $src_file = $1; # append file left of arror
my $orig_src_file = $1; # append file left of arror
# it will be sync'd to $nodesyncfiledir/$append_file
my $dest_file = $nodesyncfiledir;
$dest_file .= $src_file;
@@ -5227,7 +5236,7 @@ sub build_append_rsync
# to pick up files from /var/xcat/syncfiles...
if ($onServiceNode == 1) {
my $newsrcfile = $syncdir; # add SN syndir on front
$newsrcfile .= $src_file;
$newsrcfile .= $orig_src_file;
$src_file=$newsrcfile;
}
# destination file name
@@ -5310,7 +5319,8 @@ sub build_merge_rsync
if ($syncmergescript == 0) { # don't add the xdcpmerge.sh line
push @::mergelines,$line;
}
my $src_file = $1; # merge file left of arror
my $src_file = $1; # merge file left of arrow
my $orig_src_file = $1;
# it will be sync'd to $nodesyncfiledir/$merge_file
my $dest_file = $nodesyncfiledir;
$dest_file .= $src_file;
@@ -5339,7 +5349,7 @@ sub build_merge_rsync
# to pick up files from /var/xcat/syncfiles...
if ($onServiceNode == 1) {
my $newsrcfile = $syncdir; # add SN syndir on front
$newsrcfile .= $src_file;
$newsrcfile .= $orig_src_file;
$src_file=$newsrcfile;
}
# destination file name
@@ -6029,11 +6039,11 @@ sub run_always_rsync_postscripts
# if on the service node need to add the $syncdir directory
# to the path
if (xCAT::Utils->isServiceNode()) {
my $tmpp=$syncdir . $ps;
$ps=$tmpp;
my $tmps=$syncdir . $ps;
push @args, $tmps;
} else{
push @args, $ps;
}
push @args, $ps;
push (@nodes, @{$$dshparms{'postscripts'}{$ps}});
$out=xCAT::Utils->runxcmd( { command => ['xdsh'],
-58
View File
@@ -253,64 +253,6 @@ use strict;
#---------------------------------------------------------------------------
=head3
ifconfig_inet
Builds a list of all IP Addresses bound to the local host and
stores them in a global list
Arguments:
None
Returns:
None
Globals:
@local_inet
Error:
None
Example:
xCAT::DSHCore->ifconfig_inet;
Comments:
Internal routine only
=cut
#---------------------------------------------------------------------------
sub ifconfig_inet
{
my @local_inet = ();
if ($^O eq 'aix')
{
my @ip_address = ();
my @output = `/usr/sbin/ifconfig -a`;
foreach my $line (@output)
{
($line =~ /inet ((\d{1,3}?\.){3}(\d){1,3})\s/o)
&& (push @local_inet, $1);
}
}
elsif ($^O eq 'linux')
{
my @ip_address = ();
my @output = `/sbin/ifconfig -a`;
foreach my $line (@output)
{
($line =~ /inet addr:((\d{1,3}?\.){3}(\d){1,3})\s/o)
&& (push @local_inet, $1);
}
}
}
#---------------------------------------------------------------------------
+198 -30
View File
@@ -16,7 +16,7 @@ use xCAT::Usage;
use xCAT::NodeRange;
use xCAT::FSPUtils;
use xCAT::VMCommon;
#use Data::Dumper;
use Data::Dumper;
use xCAT::MsgUtils qw(verbose_message);
##############################################
# Globals
@@ -48,6 +48,15 @@ sub parse_args {
##########################################################################
# Parse the chvm command line for options and operands
##########################################################################
my @query_array = ();
my %param_list_map = (
'vmcpus' => 'part_get_lpar_processing',
'vmmemory' => 'part_get_lpar_memory',
'vmphyslots' => 'part_get_all_io_bus_info',
'vmnics' => 'part_get_all_vio_info',
'vmstorage' => 'part_get_all_vio_info',
'del_vadapter' => 'part_get_all_vio_info'
);
sub chvm_parse_extra_options {
my $args = shift;
@@ -57,6 +66,7 @@ sub chvm_parse_extra_options {
if (ref($args) ne 'ARRAY') {
return "$args";
}
my %tmp_hash = ();
foreach (@$args) {
my ($cmd, $value) = split (/\=/, $_);
if (!defined($value)) {
@@ -75,14 +85,24 @@ sub chvm_parse_extra_options {
# return "'$value' invalid";
# }
} elsif (grep(/^$cmd$/, @support_ops)) {
if (exists($param_list_map{$cmd})) {
$tmp_hash{$param_list_map{$cmd}} = 1;
}
if (exists($opt->{p775})) {
return "'$cmd' doesn't work for Power 775 machines.";
} elsif ($cmd eq "del_vadapter") {
if ($value !~ /^\d+$/) {
return "Invalid param '$value', only one slot id can be specified";
}
} elsif ($cmd eq "vmothersetting") {
if ($value =~ /hugepage:\s*(\d+)/i) {
$opt->{huge_page} = $1;
$tmp_hash{'get_huge_page'} = 1;
}
if ($value =~ /bsr:\s*(\d+)/i) {
$opt->{bsr} = $1;
$tmp_hash{'get_cec_bsr'} = 1;
}
next;
} elsif ($cmd eq "vmstorage") {
@@ -157,6 +177,7 @@ sub chvm_parse_extra_options {
}
$opt->{$cmd} = $value;
}
@query_array = keys(%tmp_hash);
return undef;
}
@@ -719,7 +740,7 @@ sub lsvm_parse_args {
$Getopt::Long::ignorecase = 0;
Getopt::Long::Configure( "bundling" );
if ( !GetOptions( \%opt, qw(V|verbose l|long p775) )) {
if ( !GetOptions( \%opt, qw(V|verbose l|long p775 updatedb) )) {
return( usage() );
}
if (exists($opt{l}) && !exists($opt{p775})) {
@@ -758,11 +779,12 @@ sub modify {
return op_extra_cmds ($request, $hash) if ($request->{opt}->{lparname} || $request->{opt}->{huge_page});
return ([["Error", "Miss argument\n".$usage_string, 1]]);
}
sub do_op_extra_cmds {
my $request = shift;
my $hash = shift;
my @values = ();
my %lpar_hash = ();
while (my ($mtms, $h) = each(%$hash)) {
my $memhash;
while (my($name, $d) = each(%$h)) {
@@ -827,17 +849,17 @@ sub do_op_extra_cmds {
if ($2 == "G" or $2 == '') {
$min = $min * 1024;
}
$min = $min/$memsize;
$min = int($min/$memsize);
my $cur = $3;
if ($4 == "G" or $4 == '') {
$cur = $cur * 1024;
}
$cur = $cur/$memsize;
$cur = int($cur/$memsize);
my $max = $5;
if ($6 == "G" or $6 == '') {
$max = $max * 1024;
}
$max = $max/$memsize;
$max = int($max/$memsize);
$request->{opt}->{$op} ="$min/$cur/$max";
$param = $request->{opt}->{$op};
} else {
@@ -870,8 +892,15 @@ sub do_op_extra_cmds {
push @values, [$name, "Success", '0'];
}
}
my $rethash = query_cec_info_actions($request, $name, $d, 1, \@query_array);
# need to add update db here
$lpar_hash{$name} = $rethash;
$lpar_hash{$name}->{parent} = @$d[3];
}
}
if (%lpar_hash) {
update_vm_db($request, \%lpar_hash);
}
return \@values;
}
sub check_node_info {
@@ -1652,6 +1681,7 @@ my @partition_query_actions = qw(part_get_partition_cap part_get_hyp_process_and
sub parse_part_get_info {
my $hash = shift;
my $data = shift;
my $lparid = shift;
my @array = split /\n/, $data;
foreach my $line (@array) {
chomp($line);
@@ -1672,9 +1702,12 @@ sub parse_part_get_info {
$hash->{bus}->{$3}->{cur_lparid} = $1;
$hash->{bus}->{$3}->{bus_slot} = $2;
$hash->{bus}->{$3}->{des} = $4;
if ($lparid and $lparid eq $1) {
push @{$hash->{lpar_phy_bus}}, $3;
}
} elsif ($line =~ /Phy drc_index:(\w+), Port group: (\w+), Phy port id: (\w+)/) {
$hash->{phy_drc_group_port}->{$1}->{$2}->{$3} = '1';
} elsif ($line =~ /adapter_id=(\w+),lpar_id=([\d|-]+).*port_group=(\d+),phys_port_id=(\d+).*drc_index=(\w+),.*/) {
#} elsif ($line =~ /adapter_id=(\w+),lpar_id=([\d|-]+).*port_group=(\d+),phys_port_id=(\d+).*drc_index=(\w+),.*/) {
if (($2 == -1) && ($4 == 255)) {
$hash->{logic_drc_phydrc}->{$3}->{$5} = $1;
#$hash->{logic_drc_phydrc}->{$5}->{$1} = [$2,$3,$4];
@@ -1687,12 +1720,49 @@ sub parse_part_get_info {
$hash->{lpar0_used_mem} = $2;
$hash->{phy_min_mem_req} = $3;
#print "===>lpar0_used_mem:$hash->{lpar0_used_mem}.\n";
} elsif ($line =~ /Curr Memory Req:[^\(]*\((\d+)\s*regions\)/) {
$hash->{lpar_used_regions} = $1;
} elsif ($line =~ /Curr Memory (Min|Req|Max):\s*([\d]*)[^\(]*\((\d+)\s*regions\)/) {
if ($1 eq 'Min') {
$hash->{lpar_mem_min} = $2
} elsif ($1 eq 'Max') {
$hash->{lpar_mem_max} = $2;
} else {
$hash->{lpar_mem_req} = $2;
$hash->{lpar_used_regions} = $3;
}
} elsif ($line =~ /Curr Processor (Min|Req|Max):\s*(\d+)/) {
if ($1 eq 'Min') {
$hash->{lpar_cpu_min} = $2;
} elsif ($1 eq 'Max') {
$hash->{lpar_cpu_max} = $2;
} else {
$hash->{lpar_cpu_req} = $2;
}
} elsif ($line =~ /\s*lpar_id=(\d+),type=vSCSI,slot=(\d+),attr=(\d+).*remote_lpar_id=0x(\w+),remote_slot_num=0x(\w+)/) {
if ($3 eq '0') {
my $lparid = hex($4);
my $slotid = hex($5);
push @{$hash->{lpar_vmstorage_client}}, "$lparid:$slotid";
} else {
if (exists($hash->{lpar_vmstorage_server})) {
$hash->{lpar_vmstorage_server}++;
} else {
$hash->{lpar_vmstorage_server} = 1;
}
}
} elsif ($line =~ /\s*lpar_id=(\d+),type=(vEth),slot=(\d+).*port_vlan_id=(\d+),mac_addr=(\w+)/) {
push @{$hash->{lpar_vmnics}}, "vlan$4";
} elsif ($line =~ /Available huge page memory\(in pages\):\s*(\d+)/) {
$hash->{huge_page_avail} = $1;
} elsif ($line =~ /Available BSR array:\s*(\d+)/) {
$hash->{cec_bsr_avail} = $1;
} elsif ($line =~ /^\d+\/(\d+)\/\d+$/) {
if ($1 ne 0) {
push @{$hash->{lpar_othersetting}}, "hugepage:$1";
}
} elsif ($line =~ /^(\d+)\.$/) {
if ($1 ne 0) {
push @{$hash->{lpar_othersetting}}, "bsr:$1";
}
}
}
}
@@ -1703,6 +1773,7 @@ sub query_cec_info_actions {
my $td = shift;
my $usage = shift;
my $action_array = shift;
my $lpar_hash = shift;
my $lparid = @$td[0];
my $data;
my @array = ();
@@ -1717,12 +1788,16 @@ sub query_cec_info_actions {
chomp(@$values[1]);
#if ($action eq "part_get_partition_cap" and (@$values[1] =~ /Error:/i or @$values[2] ne 0)) {
if (@$values[1] =~ /Error:/i or @$values[2] ne 0) {
return ([[@$values]]);
next; #return ([[@$values]]);
}
if (@$values[1] =~ /^$/) {
next;
}
if ($usage eq 0) {
if ($usage eq 1 or $usage eq 2) {
&parse_part_get_info(\%hash, @$values[1], $lparid);
}
if ($usage eq 0 or $usage eq 2) {
if ($lparid) {
if ($action eq "lpar_lhea_mac") {
my @output = split /\n/,@$values[1];
@@ -1777,18 +1852,72 @@ sub query_cec_info_actions {
}
#$data .= "@$values[1]\n\n";
push @array, [$name, @$values[1], @$values[2]];
} else {
&parse_part_get_info(\%hash, @$values[1]);
}
}
}
if ($usage eq 0) {
if ($usage eq 0 or $usage eq 2) {
#return $data;
if ($usage eq 2) {
%$lpar_hash = %hash;
}
return \@array;
} else {
return \%hash;
}
}
sub update_vm_db {
my $request = shift;
my $lpar_hash = shift;
my $vm_hd = xCAT::Table->new('vm');
my %name_id_map = ();
my $commit = 0;
foreach (keys (%$lpar_hash)) {
my %db_update = ();
my $node_hash = $lpar_hash->{$_};
if (exists($node_hash->{lpar_cpu_min})) {
$db_update{cpus} = "$node_hash->{lpar_cpu_min}/$node_hash->{lpar_cpu_req}/$node_hash->{lpar_cpu_max}";
}
if (exists($node_hash->{lpar_mem_min})) {
$db_update{memory} = "$node_hash->{lpar_mem_min}/$node_hash->{lpar_mem_req}/$node_hash->{lpar_mem_max}";
}
if (exists($node_hash->{lpar_vmstorage_server})) {
$db_update{storage} = $node_hash->{lpar_vmstorage_server};
} elsif (exists($node_hash->{lpar_vmstorage_client})) {
my @tmp_array = ();
foreach (@{$node_hash->{lpar_vmstorage_client}}) {
if (/(\d+):(\d+)/) {
if (exists($name_id_map{$1})) {
push @tmp_array, "$name_id_map{$1}:$2";
} else {
my $vios_name = &find_lpar_name($request, $node_hash->{parent}, $1);
if (defined($vios_name)) {
$name_id_map{$1} = $vios_name;
push @tmp_array, "$vios_name:$2";
}
}
}
}
$db_update{storage} = join(",",@tmp_array);
}
if (exists($node_hash->{lpar_vmnics})) {
$db_update{nics} = join(",",@{$node_hash->{lpar_vmnics}});
}
if (exists($node_hash->{lpar_phy_bus})) {
$db_update{physlots} = join(",",@{$node_hash->{lpar_phy_bus}});
}
if (exists($node_hash->{lpar_othersetting})) {
$db_update{othersettings} = join(",",@{$node_hash->{lpar_othersetting}});
}
if (%db_update) {
$vm_hd->setNodeAttribs($_,\%db_update);
$commit = 1;
}
}
if ($commit) {
$vm_hd->commit;
}
}
#my @partition_query_actions = qw(part_get_partition_cap part_get_num_of_lpar_slots part_get_hyp_config_process_and_mem part_get_hyp_avail_process_and_mem part_get_service_authority_lpar_id part_get_shared_processing_resource part_get_all_vio_info lpar_lhea_mac part_get_all_io_bus_info part_get_lpar_processing part_get_lpar_memory get_huge_page get_cec_bsr);
sub query_cec_info {
my $request = shift;
@@ -1796,25 +1925,36 @@ sub query_cec_info {
my $args = $request->{opt};
my @td = ();
my @result = ();
my $usage = 0;
my %lpar_hash = ();
#print Dumper($request);
#print Dumper($hash);
while (my ($mtms,$h) = each(%$hash) ) {
while (my ($name, $d) = each (%$h)) {
my %tmp_hash = ();
@td = @$d;
if (@$d[0] == 0 && @$d[4] !~ /lpar|vios/) {
last;
}
#my $rethash = query_cec_info_actions($request, $name, $d, 0, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_vio_info","lpar_lhea_mac","part_get_all_io_bus_info","get_huge_page","get_cec_bsr"]);
my $rethash = query_cec_info_actions($request, $name, $d, 0, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_io_bus_info","part_get_all_vio_info","get_huge_page","get_cec_bsr"]);
if ($args->{updatedb}) {
$usage = 2;
}
my $rethash = query_cec_info_actions($request, $name, $d, $usage, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_io_bus_info","part_get_all_vio_info","get_huge_page","get_cec_bsr"], \%tmp_hash);
#push @result, [$name, $rethash, 0];
push @result, @$rethash;
$lpar_hash{$name} = \%tmp_hash;
$lpar_hash{$name}->{parent} = @$d[3];
}
if (@td[0] == 0) {
my $rethash = query_cec_info_actions($request, @td[3],\@td, 0);
my $rethash = query_cec_info_actions($request, @td[3],\@td, $usage);
#push @result, [@td[3], $rethash, 0];
push @result, @$rethash;
}
}
if ($args->{updatedb} and %lpar_hash) {
update_vm_db($request, \%lpar_hash);
}
return \@result;
}
@@ -1931,6 +2071,19 @@ sub find_lpar_id {
return undef;
}
sub find_lpar_name {
my $request = shift;
my $parent = shift;
my $id = shift;
my %mapping = %{$request->{ppc}->{$parent}->{mapping}};
foreach (keys %mapping) {
if ($mapping{$_} eq $id) {
return $_;
}
}
return undef;
}
sub create_lpar {
my $request = shift;
my $name = shift;
@@ -2054,6 +2207,7 @@ sub mkspeclpar {
my $opt = $request->{opt};
my $values;
my @result = ();
my %lpar_hash = ();
my $vmtab = xCAT::Table->new( 'vm');
unless($vmtab) {
return([["Error","Cannot open vm table", 1]]);
@@ -2126,9 +2280,9 @@ sub mkspeclpar {
return([[$name, "Parameter for 'vmmemory' is invalid", 1]]);
}
my $memsize = $memhash->{mem_region_size};
$mmin = ($mmin + $memsize) / $memsize;
$mcur = ($mcur + $memsize) / $memsize;
$mmax = ($mmax + $memsize) / $memsize;
$mmin = int(($mmin + $memsize - 1) / $memsize);
$mcur = int(($mcur + $memsize - 1) / $memsize);
$mmax = int(($mmax + $memsize - 1) / $memsize);
$tmp_ent->{memory} = "$mmin/$mcur/$mmax";
$tmp_ent->{mem_region_size} = $memsize;
} else {
@@ -2178,21 +2332,27 @@ sub mkspeclpar {
$tmp_ent->{storage} = \@array;
}
} else {
if (exists($tmp_ent->{storage}) and $tmp_ent->{storage} !~ /^[\w_-]*:\d+$/) {
return ([[$name, "Parameter for 'vmstorage' is invalid", 1]]);
} elsif (exists($tmp_ent->{storage})) {
if ($tmp_ent->{storage} =~ /([\w_-]*):(\d+)/) {
my $vios = &find_lpar_id($request, @$d[3], $1);
my $r_slotid = $2;
if (!defined($vios)) {
return ([[$name, "Cannot find lparid for Server lpar:$1"]]);
if (exists($tmp_ent->{storage})) {
my @tmp_array = split ",",$tmp_ent->{storage};
my $storage_array = undef;
foreach (@tmp_array) {
if (/([\w_-]*):(\d+)/) {
my $vios = &find_lpar_id($request, @$d[3], $1);
my $r_slotid = $2;
if (defined($vios)) {
push @$storage_array, "0,$vios,$r_slotid";
} else {
return ([[$name, "Cannot find lparid for Server lpar:$1"]]);
}
} else {
return ([[$name, "Parameter for 'vmstorage' is invalid", 1]]);
}
$tmp_ent->{storage} = ["0,$vios,$r_slotid"];
}
$tmp_ent->{storage} = $storage_array;
}
}
$tmp_ent->{hyp_config_mem} = $memhash->{hyp_config_mem};
$tmp_ent->{hyp_avail_mem} = $memhash->{hyp_avail_mem};
if (exists($tmp_ent->{othersettings})) {
@@ -2213,10 +2373,18 @@ sub mkspeclpar {
$tmp_ent->{logic_drc_phydrc} = $memhash->{logic_drc_phydrc};
$values = &create_lpar($request, $name, $d, $tmp_ent);
push @result, $values;
#need to add update db here
my $rethash = query_cec_info_actions($request, $name, $d, 1, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_vio_info","part_get_all_io_bus_info","get_huge_page","get_cec_bsr"]);
$lpar_hash{$name} = $rethash;
$lpar_hash{$name}->{parent} = @$d[3];
$name = undef;
$d = undef;
}
}
if (%lpar_hash) {
update_vm_db($request, \%lpar_hash);
}
return \@result;
}
+1 -1
View File
@@ -1023,7 +1023,7 @@ sub dolitesetup
$nrange = join(',',@nodel);
}
my @flist = xCAT::Utils->runcmd("/opt/xcat/bin/litefile $nrange", -1);
@flist = xCAT::Utils->runcmd("/opt/xcat/bin/litefile $nrange", -1);
if (scalar(@flist) > 0) {
foreach my $l (@flist) {
my ($j1, $j2, $file) = split /\s+/, $l;
+128 -9
View File
@@ -19,6 +19,7 @@ use File::Path;
use Math::BigInt;
use Socket;
use xCAT::GlobalDef;
use Data::Dumper;
use strict;
use warnings "all";
my $socket6support = eval { require Socket6 };
@@ -696,19 +697,26 @@ sub get_nic_ip
# Base address:0x2600 Memory:fbfe0000-fc0000080
#
# eth1 ...
# Redhat7
#eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
# inet 10.1.0.178 netmask 255.255.0.0 broadcast 10.1.255.255
#
##############################################################
my @adapter= split /\n{2,}/, $result;
foreach ( @adapter ) {
if ( !($_ =~ /LOOPBACK / ) and
$_ =~ /UP / and
$_ =~ /$mode / ) {
if ( !($_ =~ /LOOPBACK/ ) and
$_ =~ /UP( |,|>)/ and
$_ =~ /$mode/ ) {
my @ip = split /\n/;
for my $ent ( @ip ) {
if ($ent =~ /^(eth\d|ib\d|hf\d)\s+/) {
$nic = $1;
}
if ( $ent =~ /^\s*inet addr:\s*(\d+\.\d+\.\d+\.\d+)/ ) {
}
if ($ent =~ /^(eth\d:|ib\d:|hf\d:)\s+/) {
$nic = $1;
}
$ent=~ s/addr://; # works for Redhat7 also
if ( $ent =~ /^\s*inet \s*(\d+\.\d+\.\d+\.\d+)/ ) {
$iphash{$nic} = $1;
next;
}
@@ -1620,8 +1628,10 @@ sub gethost_ips
else
{
my ($inet, $addr1, $Bcast, $Mask) = split(" ", $addr);
@ip = split(":", $addr1);
push @ipaddress, $ip[1];
#@ip = split(":", $addr1);
#push @ipaddress, $ip[1];
$addr1 =~ s/.*://;
push @ipaddress, $addr1;
}
}
else
@@ -1981,6 +1991,108 @@ sub isIpaddr
}
}
#-------------------------------------------------------------------------------
=head3 getSubnetGateway
Description:
Get gateway from the networks table of the specified net.
Arguments:
net: the net, ie. the "net" field of the networks table
Returns:
Return a string, of the gateway
undef - Failed to get the gateway
Globals:
none
Error:
none
Example:
my $gateway = xCAT::NetworkUtils::getSubnetGateway('192.168.1.0');
Comments:
none
=cut
#-------------------------------------------------------------------------------
sub getSubnetGateway
{
my $netname=shift;
if( $netname =~ /xCAT::NetworkUtils/)
{
$netname=shift;
}
my $gateway=undef;
my $nettab = xCAT::Table->new("networks");
unless($nettab) { die "No entry defined in networks"; }
my @nets = $nettab->getAllAttribs('net','gateway');
foreach(@nets)
{
if("$_->{net}" eq "$netname")
{
$gateway = $_->{gateway};
last;
}
}
return $gateway;
}
#-------------------------------------------------------------------------------
=head3 getNodeNameservers
Description:
Get nameservers of specified nodes.
The priority: noderes.nameservers > networks.nameservers > site.nameservers
Arguments:
node: node name list
Returns:
Return a hash ref, of the $nameservers{$node}
undef - Failed to get the nameservers
Globals:
none
Error:
none
Example:
my $nameservers = xCAT::NetworkUtils::getNodeNameservers(\@node);
Comments:
none
=cut
#-------------------------------------------------------------------------------
sub getNodeNameservers{
my $nodes=shift;
if( $nodes =~ /xCAT::NetworkUtils/)
{
$nodes=shift;
}
my @nodelist = @$nodes;
my %nodenameservers;
my $nrtab = xCAT::Table->new('noderes',-create=>0);
my %nrhash = %{$nrtab->getNodesAttribs(\@nodelist,['nameservers'])};
my $nettab = xCAT::Table->new("networks");
my %nethash = xCAT::DBobjUtils->getNetwkInfo( \@nodelist );
my @nameservers = xCAT::TableUtils->get_site_attribute("nameservers");
my $sitenameservers=$nameservers[0];
foreach my $node (@nodelist){
if ($nrhash{$node} and $nrhash{$node}->[0] and $nrhash{$node}->[0]->{nameservers})
{
$nodenameservers{$node}=$nrhash{$node}->[0]->{nameservers};
}elsif($nethash{$node}{nameservers})
{
$nodenameservers{$node}=$nethash{$node}{nameservers};
}elsif($sitenameservers)
{
$nodenameservers{$node}=$sitenameservers;
}
}
return \%nodenameservers;
}
#-------------------------------------------------------------------------------
=head3 getNodeNetworkCfg
@@ -2007,17 +2119,23 @@ sub isIpaddr
sub getNodeNetworkCfg
{
my $node = shift;
if( $node =~ /xCAT::NetworkUtils/)
{
$node =shift;
}
my $nets = xCAT::NetworkUtils::my_nets();
my $ip = xCAT::NetworkUtils->getipaddr($node);
my $mask = undef;
my $gateway = undef;
for my $net (keys %$nets)
{
my $netname;
($netname,$mask) = split /\//, $net;
$gateway=xCAT::NetworkUtils::getSubnetGateway($netname);
last if ( xCAT::NetworkUtils::isInSameSubnet( $netname, $ip, $mask, 1));
}
return ($ip, $node, undef, xCAT::NetworkUtils::formatNetmask($mask,1,0));
return ($ip, $node, $gateway, xCAT::NetworkUtils::formatNetmask($mask,1,0));
}
#-------------------------------------------------------------------------------
@@ -2195,6 +2313,7 @@ sub isValidHostname
return 0;
}
#-------------------------------------------------------------------------------
=head3 isValidFQDN
+1 -1
View File
@@ -156,7 +156,7 @@ sub connect {
# Shell prompt regexp based on HW Type
##################################################
my %prompt = (
hmc => "~> \$",
hmc => "~>\\s*\$",
ivm => "\\\$ \$"
);
##################################################
+27 -1
View File
@@ -921,6 +921,11 @@ site => {
" '0' value means include all the nodes in the subnet.\n\n".
" pruneservices: Whether to enable service pruning when noderm is run (i.e.\n".
" removing DHCP entries when noderm is executed)\n\n".
" managedaddressmode: The mode of networking configuration during node provision.\n".
" If set to 'static', the network configuration will be configured \n".
" in static mode based on the node and network definition on MN.\n".
" If set to 'dhcp', the network will be configured with dhcp protocol.\n".
" The default is 'dhcp'.\n\n".
" ------------\n".
"DNS ATTRIBUTES\n".
" ------------\n".
@@ -941,6 +946,12 @@ site => {
" \"<xcatmaster>\" to mean the DNS server for each node should be the\n".
" node that is managing it (either its service node or the management\n".
" node).\n\n".
" externaldns: To specify that external dns is used. If externaldns is set to any value\n".
" then, makedns command will not start the local nameserver on xCAT MN. \n".
" Default is to start the local nameserver.\n\n".
" dnsupdaters: The value are \',\' separated string which will be added to the zone config\n".
" section. This is an interface for user to add configuration entries to\n".
" the zone sections in named.conf.\n\n".
" -------------------------\n".
"HARDWARE CONTROL ATTRIBUTES\n".
" -------------------------\n".
@@ -1096,6 +1107,10 @@ site => {
" will not interfere.\n\n".
" vmwarereconfigonpower: When set to no, the VMWare plugin will make no effort to\n".
" push vm.cpus/vm.memory updates from xCAT to VMWare.\n\n".
" persistkvmguests: Keep the kvm definition on the kvm hypervisor when you power off\n".
" the kvm guest node. This is useful for you to manually change the \n".
" kvm xml definition file in virsh for debugging. Set anything means\n".
" enable.\n\n".
" --------------------\n".
"XCAT DAEMON ATTRIBUTES\n".
" --------------------\n".
@@ -1568,7 +1583,18 @@ hwinv => {
disable => "Set to 'yes' or '1' to comment out this row.",
},
},
token => {
cols => [qw(tokenid username expire comments disable)],
keys => [qw(tokenid)],
table_desc => 'The token of users for authentication.',
descriptions => {
tokenid => 'It is a UUID as an unified identify for the user.',
username => 'The user name.',
expire => 'The expire time for this token.',
comments => 'Any user-provided notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
},
},
); # end of tabspec definition
Regular → Executable
+4 -3
View File
@@ -429,7 +429,6 @@ rmdir \"/tmp/$to_userid\" \n";
# Need to check if nodes are in a zone.
my @zones;
my $tab = xCAT::Table->new("zone");
my @zones;
if ($tab)
{
# if we have zones, need to send the zone keys to each node in the zone
@@ -623,7 +622,7 @@ sub sendkeysTOzones
my ($class, $ref_nodes,$expecttimeout) = @_;
my @nodes=$ref_nodes;
my $n_str = $nodes[0];
my @nodes= split(",", $n_str);
@nodes= split(",", $n_str);
my $rsp = ();
my $cmd;
my $roothome = xCAT::Utils->getHomeDir("root");
@@ -1178,7 +1177,9 @@ sub getAppStatus
my ($class, $nodes_ref, $application) = @_;
my @nodes = @$nodes_ref;
my $nltab = xCAT::Table->new('nodelist');
# FIXME: why autocommit matters for a read-only subroutine getNodesAttribs?
# but could not get the appstatus without the autocommit=0
my $nltab = xCAT::Table->new('nodelist', -autocommit => 0);
my $nodeappstat = $nltab->getNodesAttribs(\@nodes,['appstatus']);
my $ret_nodeappstat;
+1 -1
View File
@@ -222,7 +222,7 @@ my %usage = (
lsvm <noderange> [-a|--all]
PPC (using Direct FSP Management) specific:
lsvm <noderange> [-l|--long] --p775
lsvm <noderange>
lsvm <noderange>
zVM specific:
lsvm noderange
lsvm noderange --getnetworknames
+56
View File
@@ -3487,4 +3487,60 @@ sub fullpathbin
return $fullpath;
}
#--------------------------------------------------------------------------------
=head3 gettimezone
returns the name of the timezone defined on the Linux distro.
This routine was written to replace the use of /etc/sysconfig/clock which in no
longer supported on future Linux releases such as RHEL7. It is suppose to be a routine
that can find the timezone on any Linux OS or AIX.
Arguments:
none
Returns:
Name of timezone, for example US/Eastern
Globals:
none
Error:
None
Example:
my $timezone = xCAT::Utils->gettimezone();
Comments:
none
=cut
#--------------------------------------------------------------------------------
sub gettimezone
{
my ($class) = @_;
my $tz;
if (xCAT::Utils->isAIX()) {
$tz= $ENV{'TZ'};
} else { # all linux
my $localtime = "/etc/localtime";
my $zoneinfo = "/usr/share/zoneinfo";
my $cmd = "find $zoneinfo -type f -exec cmp -s $localtime {} \\; -print | grep -v posix | grep -v SystemV";
my $zone_result = xCAT::Utils->runcmd("$cmd", 0);
if ($::RUNCMD_RC != 0)
{
$tz="Could not determine timezone checksum";
return $tz;
}
my @zones = split /\n/, $zone_result;
$zones[0] =~ s/$zoneinfo\///;
if (!$zones[0]) { # if we still did not get one, then default
$tz = `cat /etc/timezone`;
chomp $tz;
} else {
$tz=$zones[0];
}
}
return $tz;
}
1;
+2
View File
@@ -29,6 +29,7 @@ require Exporter;
"1272326751.405938" => "centos5.5",
"1330913492.861127" => "centos5.8",#x86_64
"1357930415.252042" => "centos5.9",#x86_64
"1381776971.473332" => "centos5.10",#x86_64
"1195488871.805863" => "centos4.6",
"1195487524.127458" => "centos4.6",
"1301444731.448392" => "centos5.6",
@@ -70,6 +71,7 @@ require Exporter;
"1321545261.599847" => "rhelhpc6.2",#x86_64
"1339640148.070971" => "rhelhpc6.3",#x86_64
"1359576195.413831" => "rhelhpc6.4",#x86_64, RHEL ComputeNode
"1384196516.465862" => "rhelhpc6.5",#x86_64, RHEL ComputeNode
"1194015916.783841" => "fedora8",
"1194015385.299901" => "fedora8",
"1210112435.291709" => "fedora9",
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -2393,7 +2393,7 @@ sub getFreeRepoSpace {
if ($master eq $ip) {
# If the master IP and node IP match, then it is the management node
my $out = `$sudo /bin/df -h /install | sed 1d`;
$out =~ s/\h+/ /g;
# causing problems on other platforms $out =~ s/\h+/ /g;$out =~ s/\h+/ /g;
my @results = split(' ', $out);
return ($results[3]);
}
@@ -41,8 +41,8 @@ if [ $OS != "AIX" ]; then
mkdir -p /tmp/gpfs_updates
rm -f -R /tmp/gpfs_updates/*
cd /tmp/gpfs_updates
# wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=3 ftp://$SITEMASTER/$UPDATES_DIR/*.rpm 2> /tmp/wget.log
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=4 --reject "index.html*" --no-parent http://$SITEMASTER$INSTALL_DIR/$UPDATES_DIR/ 2> /tmp/wget.log
# wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=3 ftp://$MASTER/$UPDATES_DIR/*.rpm 2> /tmp/wget.log
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=4 --reject "index.html*" --no-parent http://$MASTER$INSTALL_DIR/$UPDATES_DIR/ 2> /tmp/wget.log
if [ -n "`ls *.rpm 2> /dev/null`" ] ; then
rpm -Uvh *.rpm
fi
@@ -67,11 +67,13 @@ sub opsaddbmnode {
my $help;
my $version;
my $verbose;
my $host;
if(!GetOptions(
'h|help' => \$help,
'v|version' => \$version,
'V|verbose' => \$verbose,
's=s' => \$host,
))
{
@@ -243,7 +245,18 @@ sub opsaddbmnode {
$disk = 1;
}
#print "$bmc, $bmc_user, $bmc_password, $mac, $cpu, $memory, $disk\n";
if ($verbose) {
my $rsp;
push @{$rsp->{data}}, "Attributes gathered from the xCAT database:";
push @{$rsp->{data}}, " bmc=$bmc";
push @{$rsp->{data}}, " bmc_user=$bmc_user";
push @{$rsp->{data}}, " bmc_password=$bmc_password";
push @{$rsp->{data}}, " mac=$mac";
push @{$rsp->{data}}, " cpu=$cpu";
push @{$rsp->{data}}, " memory=$memory";
push @{$rsp->{data}}, " disk=$disk";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
#call OpenStack command to add the node into the OpenStack as
#a baremetal node.
@@ -263,7 +276,14 @@ sub opsaddbmnode {
}
$cmd_tmp .= " $host $cpu $memory $disk $mac";
my $cmd = qq~source \~/openrc;$cmd_tmp~;
my $cmd = qq~$cmd_tmp~;
if ($verbose) {
my $rsp;
push @{$rsp->{data}}, "The command to run on $host:";
push @{$rsp->{data}}, " $cmd";
push @{$rsp->{data}}, " ";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
#print "cmd=$cmd\n";
my $output =
xCAT::InstUtils->xcmd($callback, $doreq, "xdsh", [$host], $cmd, 0);
@@ -271,8 +291,17 @@ sub opsaddbmnode {
my $rsp;
push @{$rsp->{data}}, "OpenStack creating baremetal node $node:";
push @{$rsp->{data}}, "$output";
push @{$rsp->{data}}, "The command was: $cmd";
xCAT::MsgUtils->message("E", $rsp, $callback);
} else {
if (($verbose) && ($output)) {
my $rsp;
push @{$rsp->{data}}, "$output";
push @{$rsp->{data}}, " ";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
}
@@ -296,6 +325,7 @@ sub opsaddimage {
my $help;
my $version;
my $verbose;
#my $cloud;
my $ops_img_names;
my $controller;
@@ -303,6 +333,7 @@ sub opsaddimage {
if(!GetOptions(
'h|help' => \$help,
'v|version' => \$version,
'V|verbose' => \$verbose,
'c=s' => \$controller,
'n=s' => \$ops_img_names,
))
@@ -391,16 +422,46 @@ sub opsaddimage {
}
my $cmd_tmp = "glance image-create --name $new_name --public --disk-format qcow2 --container-format bare --property xcat_image_name=\'$image\' < /tmp/$image.qcow2";
my $cmd = qq~touch /tmp/$image.qcow2;source \~/openrc;$cmd_tmp;rm /tmp/$image.qcow2~;
#print "cmd=$cmd\ncontroller=$controller\n";
my $cmd = qq~touch /tmp/$image.qcow2;$cmd_tmp~;
if ($verbose) {
my $rsp;
push @{$rsp->{data}}, "The command to run on $controller:";
push @{$rsp->{data}}, " $cmd";
push @{$rsp->{data}}, " ";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
my $output =
xCAT::InstUtils->xcmd($callback, $doreq, "xdsh", [$controller], $cmd, 0);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "OpenStack creating image $new_name:";
push @{$rsp->{data}}, "$output";
push @{$rsp->{data}}, "The command was: $cmd";
xCAT::MsgUtils->message("E", $rsp, $callback);
} else {
if (($verbose) && ($output)) {
my $rsp;
push @{$rsp->{data}}, "$output";
push @{$rsp->{data}}, " ";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
my $cmd1 = qq~rm /tmp/$image.qcow2~;
if ($verbose) {
my $rsp;
push @{$rsp->{data}}, "The command to run on $controller:";
push @{$rsp->{data}}, " $cmd1";
push @{$rsp->{data}}, " ";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
my $output1 =
xCAT::InstUtils->xcmd($callback, $doreq, "xdsh", [$controller], $cmd1, 0);
if (($verbose) && ($output1)) {
my $rsp;
push @{$rsp->{data}}, "$output1";
push @{$rsp->{data}}, " ";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
@@ -845,7 +906,7 @@ sub opsaddbmnode_usage {
$rsp->{data}->[0]= "Usage: opsaddbmnode -h";
$rsp->{data}->[1]= " opsaddbmnode -v";
$rsp->{data}->[2]= " opsaddbmnode <noderange> -s <service_host>";
$rsp->{data}->[2]= " opsaddbmnode <noderange> -s <service_host> [-V]";
$cb->($rsp);
}
@@ -863,7 +924,7 @@ sub opsaddimage_usage {
$rsp->{data}->[0]= "Usage: opsaddimage -h";
$rsp->{data}->[1]= " opsaddimage -v";
$rsp->{data}->[2]= " opsaddimage <image1,image2...> [-n <new_name1,new_name2...> -c <controller>";
$rsp->{data}->[2]= " opsaddimage <image1,image2...> [-n <new_name1,new_name2...> -c <controller> [-V]";
$cb->($rsp);
}
@@ -4,7 +4,7 @@ B<opsaddbmnode> - It adds xCAT baremetal nodes to an OpenStack cloud.
=head1 SYNOPSIS
B<opsaddbmnode> I<noderange> B<-s> I<service_host>
B<opsaddbmnode> I<noderange> B<-s> I<service_host> [B<-V>|B<--verbose>]
B<opsaddbmnode> [B<-h>|B<--help>]
@@ -59,6 +59,8 @@ I<noderage> is a comma separated node or node group names.
=item B<-v|--version> The Command Version.
=item B<-V|--verbose> Verbose output.
=back
=head1 RETURN VALUE
@@ -4,7 +4,7 @@ B<opsaddimage> - It adds or removes nodes for the vlan.
=head1 SYNOPSIS
B<opsaddimage> I<image1,image2,...> B<-n> I<new_name1,new_name2,...> [B<-c> I<controller>]
B<opsaddimage> I<image1,image2,...> B<-n> I<new_name1,new_name2,...> [B<-c> I<controller>] [B<-V>|B<--verbose>]
B<opsaddimage> [B<-h>|B<--help>]
@@ -35,6 +35,8 @@ I<image1,image1...> a comma separated xCAT images names.
=item B<-v|--version> The Command Version.
=item B<-V|--verbose> Verbose output.
=back
=head1 RETURN VALUE
+13 -4
View File
@@ -38,8 +38,6 @@ if (scalar(@ARGV)>1) { $usage->(1); }
my $hnmatch = $ARGV[0]; # if they specified a hostname match, only show svrs that start with that
readconf("$ENV{HOME}/.slconfig"); # get the userid and api key from the config file
#my $api_username = 'SL276540';
#my $api_key = '799d5d9267a927a330ec016f00bfe17e6fc532d203cf68b3b0d997b2d27a3ce1';
my $slinstalled = eval { push @INC, $CONFIG{apidir}; require SoftLayer::API::SOAP; };
if (!$slinstalled) { die "Error: the SoftLayer::API::SOAP perl module is not installed. Download it using 'git clone https://github.com/softlayer/softlayer-api-perl-client' and put the directory in ~/.slconfig ."; }
@@ -64,12 +62,23 @@ foreach my $server (@$servers) {
print "\tbmc=".$server->{remoteManagementComponent}->{ipmiIpAddress}."\n";
print "\tbmcusername=".$server->{remoteManagementAccounts}->[0]->{username}."\n";
print "\tbmcpassword=".$server->{remoteManagementAccounts}->[0]->{password}."\n";
print "\tmac=".$server->{backendNetworkComponents}->[0]->{macAddress}."\n";
print "\tip=".$server->{privateIpAddress}."\n";
# find the 1st active private nic that is not the bmc
foreach my $nic (@{$server->{backendNetworkComponents}}) {
#print "nic:\n"; foreach my $key (keys(%$nic)) { print " $key = ", $nic->{$key}, "\n"; }
if ($nic->{status} eq 'ACTIVE' && $nic->{name} eq 'eth' && $nic->{macAddress} && $nic->{primaryIpAddress}) {
# found it
print "\tmac=".$nic->{macAddress}."\n";
print "\tip=".$nic->{primaryIpAddress}."\n";
}
}
#print "\tip=".$server->{privateIpAddress}."\n"; # getting this from the backendNetworkComponents instead
print "\tserial=".$server->{manufacturerSerialNumber}."\n";
print "\tnetboot=xnba\n";
print "\tarch=x86_64\n";
print "\tusercomment=hostname:".$server->{fullyQualifiedDomainName}.", user:".$server->{operatingSystem}->{passwords}->[0]->{username}.", pw:".$server->{operatingSystem}->{passwords}->[0]->{password}."\n";
verbose('SoftLayer API bare metal server entry: ' . Dumper($server));
#print Dumper($server->{remoteManagementAccounts});
#print "#Softlayer_account_info_for ".$server->{fullyQualifiedDomainName} . " Username: ";
#print $server->{operatingSystem}->{passwords}->[0]->{username} . " Password: ";
+57 -15
View File
@@ -13,11 +13,12 @@ use Socket;
my $HELP;
my $VERBOSE;
my $WAITTIME;
my $PROVMETHOD;
my $XCATNETBOOTTITLE = 'xCAT network boot kernel and initrd';
my $usage = sub {
my $exitcode = shift @_;
print "Usage: modifygrub [-?|-h|--help] [-v|--verbose] [-w <waittime>] <kernel-path> <initrd-path> <kernel-parms> <mn-ip>\n\n";
print "Usage: modifygrub [-?|-h|--help] [-v|--verbose] [-w <waittime>] [-p <provmethod] <kernel-path> <initrd-path> <kernel-parms> <mn-ip>\n\n";
if (!$exitcode) {
print "Modify the grub config file on the node to boot the specified kernel and initrd.\n";
}
@@ -30,7 +31,7 @@ if (-f '/etc/os-release') { die "This script doesn't support ubuntu yet.\n"; }
Getopt::Long::Configure("bundling");
#Getopt::Long::Configure("pass_through");
Getopt::Long::Configure("no_pass_through");
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'w|waittime=s' => \$WAITTIME)) { $usage->(1); }
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'w|waittime=s' => \$WAITTIME, 'p|provmethod=s' => \$PROVMETHOD)) { $usage->(1); }
if ($HELP) { $usage->(0); }
if (scalar(@ARGV) != 4) { $usage->(1); }
@@ -60,13 +61,29 @@ sub addKernelParms {
$args->{kernelparms} =~ s/<nodename>/$nodename/g;
# get node ip and add it to the kernel parms
my ($nic, $ip, $netmask, $gateway) = getNodeIpInfo($args);
my ($nic, $ip, $netmask, $network, $broadcast, $gateway, $mac) = getNodeIpInfo($args);
if (!$ip) { die "Error: could not find the NIC that would connect to the xCAT mgmt node's IP (".$args->{mnip}.").\n"; }
$args->{kernelparms} .= " hostip=$ip netmask=$netmask gateway=$gateway dns=$mnip hostname=$nodename netdevice=$nic netwait=$WAITTIME textmode=1";
# if we are booting genesis, need to add the BOOTIF parm
my $bootif;
if ($args->{kernelpath} =~ m/genesis\.kernel\.x86_64/) {
$bootif = $mac;
$bootif =~ s/:/-/g;
$bootif = "BOOTIF=01-$bootif";
}
if (defined($PROVMETHOD) && $PROVMETHOD eq 'sysclone') {
# add additional parms for sysclone
# DEVICE=eth0 IPADDR=10.0.0.99 NETMASK=255.255.255.0 NETWORK=10.0.0.0 BROADCAST=10.0.0.255 GATEWAY=10.0.0.1 GATEWAYDEV=eth0
#todo: should we also add ETHER_SLEEP=$WAITTIME textmode=1 dns=$mnip ?
$args->{kernelparms} .= " $bootif IPADDR=$ip NETMASK=$netmask NETWORK=$network BROADCAST=$broadcast GATEWAY=$gateway HOSTNAME=$nodename DEVICE=$nic GATEWAYDEV=$nic";
}
else { # scripted install or genesis shell
$args->{kernelparms} .= " $bootif hostip=$ip netmask=$netmask gateway=$gateway dns=$mnip hostname=$nodename netdevice=$nic netwait=$WAITTIME textmode=1";
}
}
# get this nodes nic, ip, netmask, and gateway. Returns them in a 4 element array.
# get this nodes nic, ip, netmask, gateway, and mac. Returns them in a 5 element array.
sub getNodeIpInfo {
my $args = shift @_;
my ($ipprefix) = $args->{mnip}=~m/^(\d+\.\d+)\./; #todo: this is a hack, just using the 1st 2 octets of the mn ip addr
@@ -74,13 +91,14 @@ sub getNodeIpInfo {
# parse ip addr show output, looking for ipprefix, to determine nic and ip
my @output = runcmd("ip addr show");
my ($nic, $ipandmask);
my ($nic, $mac, $ipandmask);
foreach my $line (@output) {
my ($nictmp, $iptmp);
my ($nictmp, $mactmp, $iptmp);
if (($nictmp) = $line=~m/^\d+:\s+(\S+): /) { $nic = $nictmp; } # new stanza, remember it
if (($mactmp) = $line=~m|^\s+link/ether\s+(\S+) |) { $mac = $mactmp; } # got mac, remember it
if (($iptmp) = $line=~m/^\s+inet\s+($ipprefix\S+) /) { $ipandmask = $iptmp; last; } # got ip, we are done
}
my ($ip, $netmask) = convertIpAndMask($ipandmask);
my ($ip, $netmask, $network, $broadcast) = convertIpAndMask($ipandmask);
# if the nic is a bonded nic (common on sl), then find the 1st real nic that is part of it
my $realnic = $nic;
@@ -88,6 +106,12 @@ sub getNodeIpInfo {
my @nics = grep(m/\s+master\s+$nic\s+/, @output);
if (!scalar(@nics)) { die "Error: can't find the NICs that are part of $nic.\n"; }
($realnic) = $nics[0]=~m/^\d+:\s+(\S+): /;
# go back thru the ip add show output and find the mac of this nic
foreach my $line (@output) {
my ($nictmp, $mactmp, $foundnic);
if (($nictmp) = $line=~m/^\d+:\s+(\S+): / && $nictmp eq $realnic) { $foundnic = 1; }
if (($mactmp) = $line=~m|^\s+link/ether\s+(\S+) | && $foundnic) { $mac = $mactmp; last; } # got mac, we are done
}
}
# finally, find the gateway
@@ -102,19 +126,37 @@ sub getNodeIpInfo {
verbose("using xCAT mgmt node IP as the fall back gateway.");
}
verbose("IP info: realnic=$realnic, ip=$ip, netmask=$netmask, gateway=$gateway");
return ($realnic, $ip, $netmask, $gateway);
verbose("IP info: realnic=$realnic, ip=$ip, netmask=$netmask, gateway=$gateway, mac=$mac");
return ($realnic, $ip, $netmask, $network, $broadcast, $gateway, $mac);
}
# Convert an ip/mask in slash notation (like 10.0.0.1/26) to separate ip and netmask like 10.0.0.1 and 255.255.255.192
# Convert an ip/mask in slash notation (like 10.1.1.1/26) to separate ip, netmask, network, and broadcast values,
# like: 10.1.1.1, 255.255.255.192, 10.1.1.0, 10.1.1.63
sub convertIpAndMask {
my $ipandmask = shift @_;
my ($ip, $masknum) = split('/', $ipandmask);
my $netbin = oct("0b" . '1' x $masknum . '0' x (32-$masknum)); # create a str like '1111100', then convert to binary
my @netarr=unpack('C4',pack('N',$netbin)); # separate into the 4 octets
my $netmask=join('.',@netarr); # put them together into the normal looking netmask
return ($ip, $netmask);
# build the netmask
my $nmbin = oct("0b" . '1' x $masknum . '0' x (32-$masknum)); # create a str like '1111100', then convert to binary
my @nmarr=unpack('C4',pack('N',$nmbin)); # separate into the 4 octets
my $netmask=join('.',@nmarr); # put them together into the normal looking netmask
# create binary form of ip
my @iparr=split(/\./,$ip);
my ( $ipbin ) = unpack('N', pack('C4',@iparr ) );
# Calculate network address by logical AND operation of ip & netmask and convert network address to IP address format
my $netbin = ( $ipbin & $nmbin );
my @netarr=unpack('C4', pack('N',$netbin ) );
my $network=join(".",@netarr);
# Calculate broadcast address by inverting the netmask and adding it to the network address
my $bcbin = ( $ipbin & $nmbin ) + ( ~ $nmbin );
my @bcarr=unpack('C4', pack('N',$bcbin ) ) ;
my $broadcast=join(".",@bcarr);
return ($ip, $netmask, $network, $broadcast);
}
+68 -12
View File
@@ -45,7 +45,9 @@ copyFilesToNodes($noderange, \%bootparms);
updateGrubOnNodes($noderange, \%bootparms);
if (!$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
if ($bootparms{osimageprovmethod} eq 'install' && !$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
if ($bootparms{osimageprovmethod} eq 'sysclone') { copySyscloneFiles(); }
exit(0);
@@ -54,23 +56,28 @@ exit(0);
sub getBootParms {
my $nr = shift @_;
my %bootparms;
my @output = runcmd("nodels $nr bootparams.kernel bootparams.initrd bootparams.kcmdline");
my @output = runcmd("nodels $nr bootparams.kernel bootparams.initrd bootparams.kcmdline nodetype.provmethod");
# the attributes can be displayed in a different order than requested, so need to grep for them
my @gresults;
foreach my $a (qw(kernel initrd kcmdline)) {
my $attr = "bootparams.$a";
@gresults = grep(/^\S+:\s+$attr:/, @output);
foreach my $attr (qw(bootparams.kernel bootparams.initrd bootparams.kcmdline nodetype.provmethod)) {
my ($a) = $attr =~ m/\.(.*)$/;
my @gresults = grep(/^\S+:\s+$attr:/, @output);
if (!scalar(@gresults)) { die "Error: attribute $attr not defined for the noderange. Did you run 'nodeset <noderange> osimage=<osimage>' ?\n"; }
# for now just pick the 1st one. They should all be the same, except for the node name in kcmdline
chomp($gresults[0]);
$gresults[0] =~ s/^\S+:\s+$attr:\s*//;
$bootparms{$a} = $gresults[0];
if ($a eq 'kcmdline') { $bootparms{$a} =~ s|/install/autoinst/\S+|/install/autoinst/<nodename>|; }
}
$bootparms{kcmdline} =~ s|/install/autoinst/\S+|/install/autoinst/<nodename>|;
# from the nodes provmethod, get the osimage provmethod, so we know the type of install
@output = runcmd("lsdef -t osimage $bootparms{provmethod} -ci provmethod");
chomp($output[0]);
my ($junk, $provmethod) = split(/=/, $output[0]);
$bootparms{osimageprovmethod} = $provmethod;
# get the mgmt node cluster-facing ip addr
@output = runcmd('lsdef -t site -i master -c');
@output = runcmd('lsdef -t site -ci master');
chomp($output[0]);
my ($junk, $ip) = split(/=/, $output[0]);
$bootparms{mnip} = $ip;
@@ -99,7 +106,7 @@ sub copyFilesToNodes {
# Form the remote file name, using the last 2 parts of the path, separated by "-"
sub remoteFilename {
my $f = shift @_;
$f =~ s|^.*/([^/]+)/([^/]+)$|$1-$2|;
$f =~ s|^.*?([^/]+)/([^/]+)$|$1-$2|;
return $f;
}
@@ -113,7 +120,7 @@ sub updateGrubOnNodes {
my @output = runcmd('which modifygrub');
my $modifygrub = $output[0];
chomp($modifygrub);
my $cmd = "xdsh $nr -e $modifygrub $vtxt -w $WAITTIME " . remoteFilename($bootparms->{kernel}) . ' ' . remoteFilename($bootparms->{initrd}) . ' ';
my $cmd = "xdsh $nr -e $modifygrub $vtxt -w $WAITTIME -p " . $bootparms->{osimageprovmethod} . ' ' . remoteFilename($bootparms->{kernel}) . ' ' . remoteFilename($bootparms->{initrd}) . ' ';
# we need to quote the kernel parms, both here when passing it to xdsh, and on the node
# when xdsh is passing it to modifygrub. The way to get single quotes inside single quotes
# is to quote each of the outer single quotes with double quotes.
@@ -138,15 +145,55 @@ sub modifyAutoinstFiles {
# Edit each file to have chroot.sles insert a wait at the end of /etc/init.d/network
# this finds the end of boot.sh script (which is chroot.sles)
my $search = '\n\]\]>\s*</source>\s*</script>\s*</chroot-scripts>';
# hack the /etc/init.d/network script to put a wait in it
my $file = '/mnt/etc/init.d/network'; # at this point in the installation, the permanent file system is just mounted
#my $waitstring = 'echo Sleeping for 55s;sleep 55';
# this is the string to insert in the nodes /etc/init.d/network script. It is a while loop pinging the mn, but some of the chars need to be escape for sed
my $waitstring = 'echo Waiting to reach xCAT mgmt node...;while \[ \$\(\(xcati+=1\)\) -le 60 \] \&\& ! ping -c2 -w3 ' . $bootparms->{mnip} .'; do echo i=\$xcati ; done; sleep 10';
# this is the string to insert in the nodes /etc/init.d/network script. It is a while loop pinging the mn, but some of the chars need to be escaped for sed
my $waitstring = 'echo -n Waiting to reach xCAT mgmt node ' . $bootparms->{mnip} . '.;xcatretries=60;while \[ \$\(\(xcati+=1\)\) -le \$xcatretries \] \&\& ! ping -c2 -w3 ' . $bootparms->{mnip} .' \>\/dev\/null 2\>\&1; do echo -n .; done; if \[ \$xcati -le \$xcatretries \]; then echo success; else echo failed; fi; sleep 3';
# this crazy sed string is from google. It gathers up the whole file into the hold buffer, and then the substitution is done on the whole file
my $sedstring = q|sed -n '1h;1!H;${;g;s/\(\t\treload_firewall\n\)\n/\1\t\t| . $waitstring . q(\n\n/g;p;}') . " $file > $file.new";
# finally create the perl replace string that will be used to modify the autoinst file
my $replace = "$sedstring\nchmod 755 $file.new; mv -f $file.new $file";
# Now instead we add a script that gets invoked by the OS after the nic is brought up
# these are specific to SLES
#my $netdir = '/etc/sysconfig/network';
#my $filename = '/etc/sysconfig/network/if-up.d/xcat-sl-wait';
#my $mnip = $bootparms->{mnip};
#todo: to support rhel, use these values instead
#my $netdir='/etc/sysconfig/network-scripts';
#my $filename='/sbin/ifup-local';
# this does not work, because midway thru the autoyast process, the if-up.d scripts do not seem to get invoked
# so autoyast fails to get he media
#my $replace = qq(
#FILENAME=$filename
#NETDIR=$netdir
#MNIP=$mnip
#);
# $replace .= q(
#cat >$FILENAME << EOF1
#MNIP=$MNIP
#NETDIR=$NETDIR
#EOF1
#
# this part of the file we do NOT want to expand the variables in the content
#cat >>$FILENAME << 'EOF2'
#NIC="$1"
# look in this ifcfg script to get the nics ip to see if this is the one we should be waiting on
#NICIP=`awk -F= '/^IPADDR/ {print $2}' $NETDIR/ifcfg-$NIC | tr -d \' `
#if [ "${NICIP%.*.*}" != "${MNIP%.*.*}" ]; then exit; fi # hack: compare the 1st 2 octets
#echo -n Waiting to reach xCAT mgmt node $MNIP.
#xcatretries=60
#while [ $((xcati+=1)) -le $xcatretries ] && ! ping -c2 -w3 $MNIP >/dev/null 2>&1; do echo -n .; done
#if [ $xcati -le $xcatretries ]; then echo " success"; else echo " failed"; fi
#sleep 3
#EOF2
#
#chmod +x $FILENAME
#);
# now actually update the file
print "Updating /install/autoinst files.\n";
foreach my $n (@nodes) {
@@ -157,6 +204,15 @@ sub modifyAutoinstFiles {
}
# Copy softlayer specific systemimager post-install scripts to the systemimager location.
# These cause si to use static ip and insert a wait into the bring up of the network.
sub copySyscloneFiles {
my $cmd = "cp -f /opt/xcat/share/xcat/sysclone/post-install/* /install/sysclone/scripts/post-install";
print "Copying SoftLayer-specific post scripts to the SystemImager post-install directory.\n";
runcmd($cmd);
}
# this is like multi-line sed replace function
# Args: filename, search-string, replace-string
sub sed {
+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash
# Add a script that will run when the network is brought up to wait until the
# xcat mn can be pinged.
. /tmp/post-install/variables.txt
if [ -d "/etc/sysconfig/network-scripts/" ];then
#redhat
NETDIR=/etc/sysconfig/network-scripts
filename=/sbin/ifup-local
elif [ -d "/etc/sysconfig/network/" ];then
#suse
NETDIR=/etc/sysconfig/network
filename=/etc/sysconfig/network/if-up.d/xcat-sl-wait
else
#ubuntu
echo "Does not support ubuntu."
exit 1
fi
# Create the wait script, overwriting a copy that may have come from the golden client
# (in case the mn/image server is different).
# this part of the file we want to expand the variables in the content
cat >$filename << EOF1
MNIP=$IMAGESERVER
NETDIR=$NETDIR
EOF1
# this part of the file we do NOT want to expand the variables in the content
cat >>$filename << 'EOF2'
NIC="$1"
# look in this ifcfg script to get the nics ip to see if this is the one we should be waiting on
NICIP=`awk -F= '/^IPADDR/ {print $2}' $NETDIR/ifcfg-$NIC | tr -d \' `
if [ "${NICIP%.*.*}" != "${MNIP%.*.*}" ]; then exit; fi # hack: compare the 1st 2 octets
echo -n Waiting to reach xCAT mgmt node $MNIP.
xcatretries=60
while [ $((xcati+=1)) -le $xcatretries ] && ! ping -c2 -w3 $MNIP >/dev/null 2>&1; do echo -n .; done
if [ $xcati -le $xcatretries ]; then echo " success"; else echo " failed"; fi
sleep 3
EOF2
chmod +x $filename
+101
View File
@@ -0,0 +1,101 @@
#!/bin/bash
# Configure network settings after SI has installed the OS
. /tmp/post-install/variables.txt
# determine if we should be using a static ip or dhcp
staticIP () {
# Eventually we should use the SI variable IP_ASSIGNMENT_METHOD below to determine this.
# But this requires a patch in both xcat/sysclone (to set si_getimage -ip-assignment method)
# and SI (to set IP_ASSIGNMENT_METHOD as a result of that). Until both of those patches
# are in the main releases, assume that if we have set the IPADDR kernel parm for the boot
# kernel to use static ip, that the final OS should use static ip too.
# Note: the IPADDR environment variable will be set by SI, even if it got it thru dhcp, so
# that is not a reliable way to decide.
str=`cat /proc/cmdline`
#str='netmask=255.255.255.192 IPADDR=10.54.51.11 GATEWAY=10.54.51.1 dns=10.54.51.2 hostname=sap64-4 DEVICE=eth0'
for parm in $str; do
key=`echo $parm|awk -F= '{print $1}'`
value=`echo $parm|awk -F= '{print $2}'`
if [[ $key == "IPADDR" || $key == "ipaddr" ]]; then
return 0 # yes, we should use static ip
fi
done
if [[ -n $IP_ASSIGNMENT_METHOD && ${IP_ASSIGNMENT_METHOD,,} == "static" ]]; then
return 0 # this means yes/true
fi
return 1
}
#delete the udev rule in the image
rule_file=`ls /etc/udev/rules.d/*net_persistent_names.rules 2>/dev/null`
if [ -n "$rule_file" ];then
rm -f $rule_file
fi
hostname $HOSTNAME
device_names=`ifconfig -a | grep -i hwaddr | grep -i 'Ethernet' | grep -v usb| awk '{print $1}'`
str_cfg_file=''
if [ -d "/etc/sysconfig/network-scripts/" ];then
#redhat
grep -i HOSTNAME /etc/sysconfig/network
if [ $? -eq 0 ];then
sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /etc/sysconfig/network
else
echo "HOSTNAME=$HOSTNAME" >> /etc/sysconfig/network
fi
if staticIP; then
# set static ip from variables in variables.txt
i="$DEVICE"
str_cfg_file="/etc/sysconfig/network-scripts/ifcfg-$i"
echo "DEVICE=$i" > $str_cfg_file
echo "BOOTPROTO=static" >> $str_cfg_file
echo "ONBOOT=yes" >> $str_cfg_file
echo "IPADDR=$IPADDR" >> $str_cfg_file
echo "NETMASK=$NETMASK" >> $str_cfg_file
echo "NETWORK=$NETWORK" >> $str_cfg_file
echo "BROADCAST=$BROADCAST" >> $str_cfg_file
#todo: add gateway config? Not sure, because the boot kernels gateway might not be the final OS gateway
else
# use dhcp for all nics
for i in $device_names;do
str_cfg_file="/etc/sysconfig/network-scripts/ifcfg-$i"
echo "DEVICE=$i" > $str_cfg_file
echo "BOOTPROTO=dhcp" >> $str_cfg_file
echo "NM_CONTROLLED=yes" >> $str_cfg_file
echo "ONBOOT=yes" >> $str_cfg_file
done
fi
elif [ -d "/etc/sysconfig/network/" ];then
#suse
echo "$HOSTNAME" > /etc/HOSTNAME
if staticIP; then
# set static ip from variables in variables.txt
i="$DEVICE"
str_cfg_file="/etc/sysconfig/network/ifcfg-$i"
echo "DEVICE=$i" > $str_cfg_file
echo "BOOTPROTO=static" >> $str_cfg_file
echo "STARTMODE=onboot" >> $str_cfg_file
echo "IPADDR=$IPADDR" >> $str_cfg_file
echo "NETMASK=$NETMASK" >> $str_cfg_file
echo "NETWORK=$NETWORK" >> $str_cfg_file
echo "BROADCAST=$BROADCAST" >> $str_cfg_file
#todo: add gateway config? Not sure, because the boot kernels gateway might not be the final OS gateway
else
# use dhcp for all nics
for i in $device_names;do
str_cfg_file="/etc/sysconfig/network/ifcfg-$i"
echo "DEVICE=$i" > $str_cfg_file
echo "BOOTPROTO=dhcp" >> $str_cfg_file
echo "STARTMODE=onboot" >> $str_cfg_file
echo "DHCLIENT_PRIMARY_DEVICE=yes" >> $str_cfg_file
done
fi
else
#ubuntu
echo "Does not support ubuntu."
exit 1
fi
+4
View File
@@ -47,6 +47,7 @@ mkdir -p $RPM_BUILD_ROOT/install/postscripts
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/man/man1
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/man1
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install
cp -p -R share/xcat/install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/
@@ -56,6 +57,9 @@ chmod 755 $RPM_BUILD_ROOT/%{prefix}/bin/*
cp -d postscripts/* $RPM_BUILD_ROOT/install/postscripts
chmod 755 $RPM_BUILD_ROOT/install/postscripts/*
cp -d si-post-install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install/*
cp LICENSE.html $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer
chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer/*
+59 -28
View File
@@ -8,10 +8,9 @@
This is script is called after the installation or upgrade of MySQL
on xCAT. It will automate the setup of the MySQL and xCAT to run
xCAT on the MySQL DB.
Note: if will setup an xcatdb,a xcatadmin, and a MySQL root password.
This script automates the setup of the MySQL/MariaDB server and creates the xCAT database to run
xCAT on MySQL/MariaDB.
Note: it will setup an xcat database (xcatdb),a xcatadmin id , and a MySQL root password.
It will interact for the
password to assign, unless the XCATMYSQLADMIN_PW and the XCATMYSQLROOT_PW
env variables are set to the admin and mysql root password, resp.
@@ -150,8 +149,8 @@ $::linuxos = xCAT::Utils->osver();
#
# check to see if mysql is installed
#
my $cmd = "rpm -qa | grep mysql";
#
my $cmd = "rpm -qa | grep -i perl-DBD-mysql";
if ( $::debianflag ){
$cmd = "dpkg -l | grep mysql-server";
}
@@ -159,10 +158,17 @@ xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{
my $message =
"\nMySQL is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before running this command.\n If on Linux, install from the OS CDs.";
"\nMySQL perl DBD is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before running this command.\n If on Linux, install from the OS CDs.";
xCAT::MsgUtils->message("E", " $cmd failed. $message");
exit(1);
}
# is this MariaDB or MySQL
$::MariaDB=0;
$cmd = "rpm -qa | grep -i mariadb"; # check this is MariaDB not MySQL
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC == 0) {
$::MariaDB=1;
}
# check to see if MySQL is running
$::mysqlrunning = 0;
@@ -328,7 +334,6 @@ if (($::INIT) && ($::xcatrunningmysql == 0))
# MySQL not running, then initialize the database
if ($::mysqlrunning == 0)
{
# Add mysql user and group for AIX
# Correct directory permissions
#
@@ -436,7 +441,7 @@ sub usage
{
xCAT::MsgUtils->message(
'I',
"Usage:\nmysqlsetup - Performs the setup of MySQL for xCAT to use as its database. See man mysqlsetup for more information."
"Usage:\nmysqlsetup - Performs the setup of MySQL or MariaDB for xCAT to use as its database. See man mysqlsetup for more information."
);
my $msg =
"mysqlsetup <-h|--help>\n <-v|--version>\n <-i|--init> [-f|hostfile] [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-u|--update> <-f|hostfile> [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-o|--odbc> [-V|--verbose]\n <-L|--LL> [-V|--verbose]";
@@ -870,14 +875,20 @@ sub mysqlstart
}
else
{
if ($::linuxos =~ /rh.*/)
{
if ($::MariaDB==1) { # running MariaDB
$cmd = "service mariadb start";
} else { # it is mysql
if ($::linuxos =~ /rh.*/)
{
$cmd = "service mysqld start";
}
else
{ # sles
}
else
{ # sles
$cmd = "service mysql start";
}
}
}
}
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
@@ -973,16 +984,21 @@ sub mysqlreboot
}
else # linux
{
if ($::linuxos =~ /rh.*/)
{
$cmd = "chkconfig mysqld on";
}
else
{ # sles
$cmd = "chkconfig mysql on";
if ( $::debianflag ){
$cmd = "update-rc.d mysql defaults";
}
if ($::MariaDB==1 ) { # MariaDB not MySQL
$cmd = "chkconfig mariadb on";
} else { # mysql
if ($::linuxos =~ /rh.*/)
{
$cmd = "chkconfig mysqld on";
}
else
{ # sles
$cmd = "chkconfig mysql on";
if ( $::debianflag ){
$cmd = "update-rc.d mysql defaults";
}
}
}
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
@@ -1058,7 +1074,12 @@ sub setupxcatdb
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
my $pwd_sent = 0;
my $pwd_prompt = 'Enter password: ';
my $mysql_prompt = 'mysql> ';
my $mysql_prompt;
if ($::MariaDB == 1) { # setup MariaDB
$mysql_prompt = 'MariaDB \[\(none\)\]> ';
} else {
$mysql_prompt = 'mysql> ';
}
my $expect_log = undef;
my $debug = 0;
#if ($::VERBOSE)
@@ -1178,7 +1199,12 @@ sub setupLL
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
my $pwd_sent = 0;
my $pwd_prompt = 'Enter password: ';
my $mysql_prompt = 'mysql> ';
my $mysql_prompt;
if ($::MariaDB == 1) { # setup MariaDB
$mysql_prompt = 'MariaDB \[\(none\)\]> ';
} else {
$mysql_prompt = 'mysql> ';
}
my $expect_log = undef;
my $debug = 0;
#if ($::VERBOSE)
@@ -1308,7 +1334,12 @@ sub addhosts
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
my $pwd_sent = 0;
my $pwd_prompt = 'Enter password: ';
my $mysql_prompt = 'mysql> ';
my $mysql_prompt;
if ($::MariaDB == 1) { # setup MariaDB
$mysql_prompt = 'MariaDB \[\(none\)\]> ';
} else {
$mysql_prompt = 'mysql> ';
}
my $expect_log = undef;
foreach my $host (@hosts)
+1 -1
View File
@@ -65,7 +65,7 @@ else { # the normal case of the user running the cmd - expand the noderange us
SSL_cert_file=> xCAT::Utils->getHomeDir()."/.xcat/client-cred.pem",
SSL_ca_file => xCAT::Utils->getHomeDir()."/.xcat/ca.pem",
SSL_use_cert => 1,
#SSL_verify_mode => 1,
SSL_verify_mode => 1,
);
die "Connection failure: $!\n" unless ($client);
my %cmdref = (command => 'noderange', noderange => $noderange);
+1 -1
View File
@@ -31,7 +31,7 @@ if (!GetOptions(
"nonodecheck" => \$::NONODECHECK, #does not check the noderange, in this case, noderange need to be a list of nodes.
'h|help' => \$help,
) || $help || scalar(@ARGV)<2 ) {
print "Usage: psh [-i <interface>] [-l <user>] [-f <fanout>] [--nonodecheck] <noderange> <command>\n";
print "Usage: psh [-i <interface>] [-l <user>] [-f <fanout>] [--nonodecheck] [-t <timeout value in seconds>] <noderange> <command>\n";
exit;
}
my %nodehdl;
+74
View File
@@ -0,0 +1,74 @@
=head1 Name
B<mkvlan> - Create vlan on switches
=head1 B<Synopsis>
B<mkvlan> [B<-h>|B<--help>|B<?>|B<-v>|B<--version>]
B<mkvlan> {Ivlanid} -n I<noderange> {B-i <interface>|B-m <netmask> |B-t <subnet>}
=head1 B<Description>
B<mkvlan> creates tagged vlan on the switches corresponding to the attributes defined in the B<switch> table
=head1 B<Options>
=over 7
=item B<vlanid>
The vlan to tag on the switch.
=item B<interface>
List all buses for each I/O slot.
=item B<netmask>
Retrieves number of processors, speed, total memory, and DIMM
locations.
=item B<subnet>
Retrieves model number.
=item B<-h>|B<--help>|B<?>
Print help.
=item B<-v>|B<--version>
Print version.
=back
=back
=head1 B<Examples>
=over 4
=item *
To make a private vlan for stand-alone nodes for the management network, enter:
mkvlan -n node1,node2,node3
=item *
You can specify vlan id, subnet and netmask etc, enter:
mkvlan 3 -n node1,node2,node3 -t 10.3.2.0 -m 255.255.255.0
=item *
To create a tagged vlan on an interface, enter:
mkvlan -n node1,node2,node3 -i eth1
=back
=head1 SEE ALSO
L<noderange(3)|noderange.3>, L<lsvlan(1)|lsvlan.1>
+5 -4
View File
@@ -1,6 +1,6 @@
=head1 NAME
B<mysqlsetup> - Sets up the MySQL database for xCAT to use.
B<mysqlsetup> - Sets up the MySQL or MariaDB database for xCAT to use.
=head1 SYNOPSIS
@@ -19,9 +19,10 @@ B<mysqlsetup> {B<-L>|B<--LL>} [-V|--verbose]
=head1 DESCRIPTION
B<mysqlsetup> - Sets up the MySQL database for xCAT to use. The mysqlsetup script is run on the Management Node as root after the MySQL code has been installed. Before running the init option, the MySQL server should be stopped. The xCAT daemon, xcatd, must be running, do not stop it. No xCAT commands should be run during the init process, because we will be migrating the xCAT database to MySQL and restarting the xcatd daemon as well as the MySQL daemon. For full information on all the steps that will be done, read the "Configure MySQL and Migrate xCAT Data to MySQL" sections in
B<mysqlsetup> - Sets up the MySQL or MariaDB database (linux only for MariaDB) for xCAT to use. The mysqlsetup script is run on the Management Node as root after the MySQL code or MariaDB code has been installed. Before running the init option, the MySQL server should be stopped, if it is running. The xCAT daemon, xcatd, must be running, do not stop it. No xCAT commands should be run during the init process, because we will be migrating the xCAT database to MySQL or MariaDB and restarting the xcatd daemon as well as the MySQL daemon. For full information on all the steps that will be done, read the "Configure MySQL and Migrate xCAT Data to MySQL" sections in
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Setting_Up_MySQL_as_the_xCAT_DB
Two passwords must be supplied for the setup, a password for the xcatadmin id and a password for the root id in the MySQL database. These will be prompted for interactively, unless the environment variables XCATMYSQLADMIN_PW and XCATMYSQLROOT_PW are set to the passwords for the xcatadmin id and root id in the database,resp.
Note below we refer to MySQL but it works the same for MariaDB.
=head1 OPTIONS
@@ -41,8 +42,8 @@ Displays verbose messages.
=item B<-i|--init>
The init option is used to setup an installed MySQL database so that xCAT can use the database. This involves creating the xcatdb database, the xcatadmin id, allowing access to the xcatdb database by the Management Node. It customizes the my.cnf configuration file for xcat and starts the MySQL server. It also backs up the current xCAT database and restores it into the newly setup xcatdb MySQL database. It creates the /etc/xcat/cfgloc file to point the xcatd daemon to the MySQL database and restarts the xcatd daemon using the database.
On AIX, it additionally setup the mysql id and group and corrects the permissions in the MySQL install directories. For AIX, you should be using the MySQL rpms available from the xCAT website. For Linux, you should use the MySQL rpms shipped with the OS. You can chose the -f and/or the -o option, to run after the init.
The init option is used to setup a xCAT database on an installed MySQL or MariaDB server for xCAT to use. The mysqlsetup script will check for the installed MariaDB server rpm first and will use MariaDB if it is installed. This involves creating the xcatdb database, the xcatadmin id, allowing access to the xcatdb database by the Management Node. It customizes the my.cnf configuration file for xcat and starts the MySQL server. It also backs up the current xCAT database and restores it into the newly setup xcatdb MySQL database. It creates the /etc/xcat/cfgloc file to point the xcatd daemon to the MySQL database and restarts the xcatd daemon using the database.
On AIX, it additionally setup the mysql id and group and corrects the permissions in the MySQL install directories. For AIX, you should be using the MySQL rpms available from the xCAT website. For Linux, you should use the MySQL or MariaDB rpms shipped with the OS. You can chose the -f and/or the -o option, to run after the init.
=item B<-u|--update>
+22
View File
@@ -123,6 +123,28 @@ Wake up the target nodes which is in B<suspend> state.
Don't try to run B<wake> against the 'on' state node, it would cause the node gets to 'off' state.
For some of xCAT hardware such as NeXtScale, it may need to enable S3 before using B<wake>. The following steps can be used to enable S3. Please reference L<pasu(1)|pasu.1> for "pasu" usage.
[root@xcatmn home]# echo "set Power.S3Enable Enable" > power-setting
[root@xcatmn home]# pasu -b power-setting node01
node01: Batch mode start.
node01: [set Power.S3Enable Enable]
node01: Power.S3Enable=Enable
node01:
node01: Beginning intermediate batch update.
node01: Waiting for command completion status.
node01: Command completed successfully.
node01: Completed intermediate batch update.
node01: Batch mode completed successfully.
[root@xcatmn home]# pasu node01 show all|grep -i s3
node01: IMM.Community_HostIPAddress3.1=
node01: IMM.Community_HostIPAddress3.2=
node01: IMM.Community_HostIPAddress3.3=
node01: IMM.DNS_IP_Address3=0.0.0.0
node01: IMM.IPv6DNS_IP_Address3=::
node01: Power.S3Enable=Enable
=item B<stat>|B<state>
Print the current power state/status.
+2
View File
@@ -49,6 +49,8 @@ Remove the DNS records.
Update DNS records to the external DNS server listed in /etc/resolv.conf.
Enabling the site attribute I<externaldns> means use 'external' DNS by default. If setting I<externaldns> to 1, you need NOT use B<-e> flag in every makedns call.
=item B<noderange>
A set of comma delimited node names and/or group names. See the "noderange" man page for details on additional supported formats.
-6
View File
@@ -253,9 +253,6 @@ dracut_install /usr/share/zoneinfo/posix/America/Knox_IN
dracut_install /usr/share/zoneinfo/posix/America/Goose_Bay
dracut_install /usr/share/zoneinfo/posix/EET
dracut_install /usr/share/zoneinfo/posix/EST5EDT
dracut_install /usr/share/zoneinfo/posix/Mideast/Riyadh89
dracut_install /usr/share/zoneinfo/posix/Mideast/Riyadh88
dracut_install /usr/share/zoneinfo/posix/Mideast/Riyadh87
dracut_install /usr/share/zoneinfo/posix/MST
dracut_install /usr/share/zoneinfo/posix/Iceland
dracut_install /usr/share/zoneinfo/posix/Atlantic/Faeroe
@@ -396,7 +393,6 @@ dracut_install /usr/share/zoneinfo/posix/NZ-CHAT
dracut_install /usr/share/zoneinfo/posix/Asia/Istanbul
dracut_install /usr/share/zoneinfo/posix/Asia/Kuwait
dracut_install /usr/share/zoneinfo/posix/Asia/Saigon
dracut_install /usr/share/zoneinfo/posix/Asia/Riyadh89
dracut_install /usr/share/zoneinfo/posix/Asia/Urumqi
dracut_install /usr/share/zoneinfo/posix/Asia/Brunei
dracut_install /usr/share/zoneinfo/posix/Asia/Ujung_Pandang
@@ -438,7 +434,6 @@ dracut_install /usr/share/zoneinfo/posix/Asia/Tokyo
dracut_install /usr/share/zoneinfo/posix/Asia/Macao
dracut_install /usr/share/zoneinfo/posix/Asia/Riyadh
dracut_install /usr/share/zoneinfo/posix/Asia/Rangoon
dracut_install /usr/share/zoneinfo/posix/Asia/Riyadh88
dracut_install /usr/share/zoneinfo/posix/Asia/Jakarta
dracut_install /usr/share/zoneinfo/posix/Asia/Aden
dracut_install /usr/share/zoneinfo/posix/Asia/Calcutta
@@ -476,7 +471,6 @@ dracut_install /usr/share/zoneinfo/posix/Asia/Tel_Aviv
dracut_install /usr/share/zoneinfo/posix/Asia/Taipei
dracut_install /usr/share/zoneinfo/posix/Asia/Kabul
dracut_install /usr/share/zoneinfo/posix/Asia/Macau
dracut_install /usr/share/zoneinfo/posix/Asia/Riyadh87
dracut_install /usr/share/zoneinfo/posix/Asia/Choibalsan
dracut_install /usr/share/zoneinfo/posix/Asia/Vientiane
dracut_install /usr/share/zoneinfo/posix/Asia/Dacca
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/bash
instmods nfs sunrpc
instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb ixgbe qlge mptsas mpt2sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net vfat ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf
instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb ixgbe qlge mptsas mpt2sas mpt3sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net vfat ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf
instmods macvlan macvtap 8021q bridge bonding vmxnet3 cpufreq_ondemand acpi-cpufreq powernow-k8 cdc_ether
instmods mptctl #LSI firmware management requires this
instmods mlx4_ib ib_umad #make the mellanox ib available enough to examine /sys
+1 -1
View File
@@ -59,4 +59,4 @@ fi
%Files
%defattr(-,root,root)
/
/opt/xcat/share/xcat/netboot/genesis/%{tarch}
+1
View File
@@ -5,6 +5,7 @@ clear
echo PS1="'"'[xCAT Genesis running on \H \w]\$ '"'" > /.bashrc
echo PS1="'"'[xCAT Genesis running on \H \w]\$ '"'" > /.bash_profile
mkdir -p /etc/ssh
mkdir -p /var/tmp/
mkdir -p /var/empty/sshd
echo root:x:0:0::/:/bin/bash >> /etc/passwd
echo sshd:x:30:30:SSH User:/var/empty/sshd:/sbin/nologin >> /etc/passwd
+2 -2
View File
@@ -204,7 +204,7 @@ for bmcu in $BMCUS; do
if [ "$bmcu" = "" ]; then continue; fi
DISABLEUSERS="1 2 3 4"
if [ ! -z "$LOCKEDUSERS" ]; then
USERSLOT=`ipmitool -d $idev user list $LANCHAN |grep -v ^ID|awk '{print $1 " " $2}'|grep " $BMCUS"|awk '{print $1}'`
USERSLOT=`ipmitool -d $idev user list $LANCHAN |grep -v ^ID|awk '{print $1 " " $2}'|grep -w "$BMCUS"|awk '{print $1}'`
if [ -z "$USERSLOT" ]; then
USERSLOT=4
fi
@@ -239,7 +239,7 @@ done
TRIES=0
# Last param in ipmitool user priv is the channel to set it on.
# Penguin boxes are all channel 2
CURRPRIV=`ipmitool -d $idev user list 1|grep ^$USERSLOT|awk '{print $6}'`
CURRPRIV=`ipmitool -d $idev user list $LANCHAN|grep ^$USERSLOT|awk '{print $6}'`
if [ "$CURRPRIV" != "ADMINISTRATOR" ]; then
while ! ipmitool -d $idev user priv $USERSLOT 4 $LANCHAN; do
sleep 1
+89 -18
View File
@@ -4,11 +4,13 @@
# Bug reported by Jeff Lang <jrlang@uwyo.edu>. Thanks, Jeff!
#
modprobe acpi_cpufreq
modprobe acpi_cpufreq 2>/dev/null # on some machines this fails
modprobe cpufreq_ondemand
for gov in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
echo -n ondemand > $gov
done
if ls /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor &>/dev/null; then
for gov in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
echo -n ondemand > $gov
done
fi
if [ ! -z "$BOOTIF" ]; then
BOOTIF=`echo $BOOTIF|sed -e s/01-// -e s/-/:/g`
echo -n "Waiting for device with address $BOOTIF to appear.."
@@ -74,21 +76,90 @@ echo '};' >> /var/lib/lldpad/lldpad.conf
done
echo '};' >> /var/lib/lldpad/lldpad.conf
lldpad -d
dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$bootnic.pid $bootnic &
#we'll kick of IPv6 and IPv4 on all nics, but not wait for them to come up unless doing discovery, to reduce
#chances that we'll perform a partial discovery
#in other scenarios where downed non-bootnics cause issues, will rely on retries to fix things up
dhclient -6 -pf /var/run/dhclient6.$bootnic.pid $bootnic -lf /var/lib/dhclient/dhclient6.leases &
NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v $bootnic|grep -v usb|grep -v ,UP|awk -F: '{print $2}'`
export NICSTOBRINGUP
for nic in $NICSTOBRINGUP; do
(while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$nic.pid $nic ) &
(while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -6 -pf /var/run/dhclient6.$nic.pid -lf /var/lib/dhclient/dhclient6.leases $nic ) &
done
openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 &
# Caclulate the broadcast address of a given IP address and mask.
bcastcalc(){
read oct1 oct2 oct3 oct4 << HERE
$(echo "$1" | sed -e 's/\./ /g')
HERE
read msk1 msk2 msk3 msk4 << HERE
$(echo "$2" | sed -e 's/\./ /g')
HERE
ipa=$(($oct1+(255-($oct1 | $msk1))))
ipb=$(($oct2+(255-($oct2 | $msk2))))
ipc=$(($oct3+(255-($oct3 | $msk3))))
ipd=$(($oct4+(255-($oct4 | $msk4))))
echo "$ipa.$ipb.$ipc.$ipd"
}
# Calculates the number of bits in a netmask for converting something like 255.255.255.192 to 26 so
# you can use the notation 10.0.0.1/26
mask2prefix() {
nbits=0
old_ifs=$IFS
IFS=.
for dec in $1 ; do
case $dec in
255) let nbits+=8;;
254) let nbits+=7;;
252) let nbits+=6;;
248) let nbits+=5;;
240) let nbits+=4;;
224) let nbits+=3;;
192) let nbits+=2;;
128) let nbits+=1;;
0);;
*) echo "Error: $dec is not recognised"; exit 1
esac
done
IFS=$old_ifs
echo "$nbits"
}
# see if they specified static ip info, otherwise use dhcp
for parm in `cat /proc/cmdline`; do
key=`echo $parm|awk -F= '{print $1}'`
value=`echo $parm|awk -F= '{print $2}'`
if [[ ${key,,} == "hostip" || ${key,,} == "ipaddr" ]]; then
hostip=$value
elif [[ ${key,,} == "netmask" ]]; then
netmask=$value
elif [[ ${key,,} == "gateway" ]]; then
gateway=$value
elif [[ ${key,,} == "netdevice" || ${key,,} == "device" ]]; then
netdevice=$value
fi
done
if [[ -n $hostip && -n $netmask && -n $gateway && -n $netdevice ]]; then
# doing static ip
numbits=$(mask2prefix $netmask)
broadcast=$(bcastcalc $hostip $netmask)
echo "Setting static IP=$hostip/$numbits broadcast=$broadcast gateway=$gateway netdevice=$netdevice ..."
ip addr add $hostip/$numbits broadcast $broadcast dev $netdevice scope global label $netdevice
ip link set $netdevice up
ip route replace to default via $gateway dev $netdevice
# in softlayer it takes up to 60 seconds for the nic to actually be able to communicate
echo -n Waiting to reach xCAT mgmt node $gateway.
xcatretries=60
while [ $((xcati+=1)) -le $xcatretries ] && ! ping -c2 -w3 $gateway >/dev/null 2>&1; do echo -n .; done
if [ $xcati -le $xcatretries ]; then echo " success"; else echo " failed"; fi
sleep 3
else
echo "Setting IP via DHCP..."
dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$bootnic.pid $bootnic &
#we'll kick of IPv6 and IPv4 on all nics, but not wait for them to come up unless doing discovery, to reduce
#chances that we'll perform a partial discovery
#in other scenarios where downed non-bootnics cause issues, will rely on retries to fix things up
dhclient -6 -pf /var/run/dhclient6.$bootnic.pid $bootnic -lf /var/lib/dhclient/dhclient6.leases &
NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v $bootnic|grep -v usb|grep -v ,UP|awk -F: '{print $2}'`
export NICSTOBRINGUP
for nic in $NICSTOBRINGUP; do
(while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$nic.pid $nic ) &
(while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -6 -pf /var/run/dhclient6.$nic.pid -lf /var/lib/dhclient/dhclient6.leases $nic ) &
done
fi
openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 &
gripeiter=101
echo -n "Acquiring network addresses.."
+1 -1
View File
@@ -7,6 +7,6 @@ Standards-Version: 3.7.2
Package: xcat-server
Architecture: all
Depends: ${perl:Depends}, grub2-xcat, perl-xcat (>= 2.5.0-1), xcat-client (>= 2.5.0-1), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl
Depends: ${perl:Depends}, grub2-xcat, perl-xcat (>= 2.5.0-1), xcat-client (>= 2.5.0-1), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl,libcrypt-rijndael-perl,libcrypt-cbc-perl
Description: Server and configuration utilities of the xCAT management project
xCAT-server provides the core server and configuration management components of xCAT. This package should be installed on your management server
+13 -5
View File
@@ -122,6 +122,7 @@ sub new {
unless ($ipmi2support) {
$self->{ipmi15only} = 1;
}
$self->{privlevel} = 4;
unless ($args{'bmc'} and defined $args{'userid'} and defined $args{'password'}) {
$self->{error}="bmc, userid, and password must be specified";
return $self;
@@ -309,7 +310,7 @@ sub session_activated {
sub set_admin_level {
my $self= shift;
$self->subcmd(netfn=>0x6,command=>0x3b,data=>[4],callback=>\&admin_level_set,callback_args=>$self);
$self->subcmd(netfn=>0x6,command=>0x3b,data=>[$self->{privlevel}],callback=>\&admin_level_set,callback_args=>$self);
}
sub admin_level_set {
my $rsp = shift;
@@ -687,7 +688,7 @@ sub send_rakp3 {
$self->{rmcptag}+=1;
my @payload = ($self->{rmcptag},0,0,0,@{$self->{pendingsessionid}});
my @user = unpack("C*",$self->{userid});
push @payload,unpack("C*",hmac_sha1(pack("C*",@{$self->{remoterandomnumber}},@{$self->{sidm}},4,scalar @user,@user),$self->{password}));
push @payload,unpack("C*",hmac_sha1(pack("C*",@{$self->{remoterandomnumber}},@{$self->{sidm}},$self->{privlevel},scalar @user,@user),$self->{password}));
$self->sendpayload(payload=>\@payload,type=>$payload_types{'rakp3'});
}
@@ -701,7 +702,7 @@ sub send_rakp1 {
push @{$self->{randomnumber}},$randomnumber;
}
push @payload, @{$self->{randomnumber}};
push @payload,(4,0,0); # request admin
push @payload,($self->{privlevel},0,0); # request priv
my @user = unpack("C*",$self->{userid});
push @payload,scalar @user;
push @payload,@user;
@@ -817,6 +818,13 @@ sub got_rakp2 {
}
$byte = shift @data;
unless ($byte == 0x00) {
if ($byte == 0x9 and $self->{privlevel} == 4) {
# this is probably an environment that wants to give us only operator
# try to connect again at 3.
$self->{privlevel} = 3;
$self->relog();
return;
}
if ($byte == 0x02) { #invalid session id is almost certainly because a retry on rmcp+ open session response rendered our session id invalid, ignore this in the hope that we'll get an answer for our retry that invalidated us..
#$self->relog();
#TODO: probably should disable RAKP1 retry here... high likelihood that we'll just spew a bad RAKP1 and Open Session Request retry would be more appropriate to try to discern a valid session id
@@ -841,7 +849,7 @@ sub got_rakp2 {
#Data now represents authcode.. sha1 only..
my @user = unpack("C*",$self->{userid});
my $ulength = scalar @user;
my $hmacdata = pack("C*",(@{$self->{sidm}},@{$self->{pendingsessionid}},@{$self->{randomnumber}},@{$self->{remoterandomnumber}},@{$self->{remoteguid}},4,$ulength,@user));
my $hmacdata = pack("C*",(@{$self->{sidm}},@{$self->{pendingsessionid}},@{$self->{randomnumber}},@{$self->{remoterandomnumber}},@{$self->{remoteguid}},$self->{privlevel},$ulength,@user));
my @expectedhash = (unpack("C*",hmac_sha1($hmacdata,$self->{password})));
foreach (0..(scalar(@expectedhash)-1)) {
if ($expectedhash[$_] != $data[$_]) {
@@ -850,7 +858,7 @@ sub got_rakp2 {
return 9;
}
}
$self->{sik} = hmac_sha1(pack("C*",@{$self->{randomnumber}},@{$self->{remoterandomnumber}},4,$ulength,@user),$self->{password});
$self->{sik} = hmac_sha1(pack("C*",@{$self->{randomnumber}},@{$self->{remoterandomnumber}},$self->{privlevel},$ulength,@user),$self->{password});
$self->{k1} = hmac_sha1(pack("C*",1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),$self->{sik});
$self->{k2} = hmac_sha1(pack("C*",2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2),$self->{sik});
my @aeskey = unpack("C*",$self->{k2});
+3 -1
View File
@@ -1392,7 +1392,9 @@ sub collect_all_attribs_for_tables_in_template
$::GLOBAL_TAB_HASH{$tabname}{$node}{$attrib} = $ent->{$node}->[0]->{$attrib};
#for noderes.xcatmaster
if ($tabname =~ /^noderes$/ && $attrib =~ /^xcatmaster$/ && ! exists($::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster}))
if ($tabname =~ /^noderes$/ && $attrib =~ /^xcatmaster$/ &&
( ! exists($::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster}) ||
$::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster} == "" ) )
{
my $value;
$value = xCAT::NetworkUtils->my_ip_facing($node);
+1
View File
@@ -115,6 +115,7 @@ sub run_remote_shell_api {
my $rc=1;
if ($t) {
#Wait for command prompt
$t->print("\t");
my ($prematch, $match) = $t->waitfor(Match => '/login[: ]*$/i',
Match => '/username[: ]*$/i',
Match => '/password[: ]*$/i',
+266 -5
View File
@@ -14,6 +14,7 @@ use xCAT::ADUtils; #to allow setting of one-time machine passwords
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::NetworkUtils;
use XML::Simple;
BEGIN
{
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
@@ -103,6 +104,13 @@ sub subvars {
$ENV{NODESTATUS}=$tmp;
}
my @managedaddressmode = xCAT::TableUtils->get_site_attribute("managedaddressmode");
my $tmp=$managedaddressmode[0];
if( defined($tmp) ){
$ENV{MANAGEDADDRESSMODE}=$tmp;
}
#replace the env with the right value so that correct include files can be found
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
@@ -229,6 +237,7 @@ sub subvars {
$inc =~ s/#CRYPT:([^:]+):([^:]+):([^#]+)#/crydb($1,$2,$3)/eg;
$inc =~ s/#COMMAND:([^#]+)#/command($1)/eg;
$inc =~ s/#KICKSTARTNET#/kickstartnetwork()/eg;
$inc =~ s/#YAST2NET#/yast2network()/eg;
$inc =~ s/#ESXIPV6SETUP#/esxipv6setup()/eg;
$inc =~ s/#WINTIMEZONE#/xCAT::TZUtils::get_wintimezone()/eg;
$inc =~ s/#WINPRODKEY:([^#]+)#/get_win_prodkey($1)/eg;
@@ -272,7 +281,9 @@ sub subvars {
my $tempstr = "%include /tmp/partitionfile\n";
$inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$tempstr/;
#modify the content in the file, and write into %pre part
$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
#$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
$partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
$partcontent .= "chmod 755 /tmp/partscript\n";
$partcontent .= "/tmp/partscript\n";
#replace the #XCA_PARTITION_SCRIPT#
@@ -282,7 +293,8 @@ sub subvars {
elsif ($inc =~ /<!-- XCAT-PARTITION-START -->/){
my $tempstr = "<drive><device>XCATPARTITIONTEMP</device></drive>";
$inc =~ s/<!-- XCAT-PARTITION-START -->[\s\S]*<!-- XCAT-PARTITION-END -->/$tempstr/;
$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
#$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
$partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
$partcontent .= "chmod 755 /tmp/partscript\n";
$partcontent .= "/tmp/partscript\n";
$inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;
@@ -651,9 +663,12 @@ sub esxipv6setup {
return 'esxcfg-vmknic -i '.$v6addr.'/64 "Management Network"'." #ESXISTATICV6\n";
}
sub kickstartnetwork {
my $line = "network --onboot=yes --bootproto=";
my $hoststab;
my $line = "network --onboot=yes --bootproto=";
my $hoststab;
my $mactab = xCAT::Table->new('mac',-create=>0);
unless ($mactab) { die "mac table should always exist prior to template processing when doing autoula"; }
my $ent = $mactab->getNodeAttribs($node,['mac'],prefetchcache=>1);
@@ -667,12 +682,258 @@ sub kickstartnetwork {
$hoststab->setNodeAttribs($node,{ip=>$ulaaddr});
$line .= $ulaaddr;
} elsif ($::XCATSITEVALS{managedaddressmode} =~ /static/) {
return "#KSNET static unsupported";
my ($ipaddr,$hostname,$gateway,$netmask)=xCAT::NetworkUtils->getNodeNetworkCfg($node);
unless($ipaddr) { die "cannot resolve the network configuration of $node"; }
if($gateway eq '<xcatmaster>'){
$gateway = xCAT::NetworkUtils->my_ip_facing($ipaddr);
}
$line .="static --device=$suffix --ip=$ipaddr --netmask=$netmask --gateway=$gateway --hostname=$hostname ";
my %nameservers=%{xCAT::NetworkUtils->getNodeNameservers([$node])};
my @nameserverARR=split (",",$nameservers{$node});
my @nameserversIP;
foreach (@nameserverARR)
{
my $ip;
if($_ eq '<xcatmaster>'){
$ip = xCAT::NetworkUtils->my_ip_facing($gateway);
}else{
(undef,$ip) = xCAT::NetworkUtils->gethostnameandip($_);
}
push @nameserversIP, $ip;
}
if (scalar @nameserversIP) {
$line .=" --nameserver=". join(",",@nameserversIP);
}
#return "#KSNET static unsupported";
} else {
$line .= "dhcp --device=$suffix";
}
return $line;
}
sub yast2network {
my $line;
my $hoststab;
my $mactab = xCAT::Table->new('mac',-create=>0);
unless ($mactab) { die "mac table should always exist prior to template processing when doing autoula"; }
my $ent = $mactab->getNodeAttribs($node,['mac'],prefetchcache=>1);
unless ($ent and $ent->{mac}) { die "missing mac data for $node"; }
my $suffix = $ent->{mac};
$suffix = lc($suffix);
if ($::XCATSITEVALS{managedaddressmode} eq "autoula") {
#TODO
return "#YAST2NET autoula unsupported"
} elsif ($::XCATSITEVALS{managedaddressmode} =~ /static/) {
my ($ipaddr,$hostname,$gateway,$netmask)=xCAT::NetworkUtils->getNodeNetworkCfg($node);
unless($ipaddr) { die "cannot resolve the network configuration of $node"; }
if($gateway eq '<xcatmaster>'){
$gateway = xCAT::NetworkUtils->my_ip_facing($ipaddr);
}
my %nameservers=%{xCAT::NetworkUtils->getNodeNameservers([$node])};
my @nameserverARR=split (",",$nameservers{$node});
my @nameserversIP;
foreach (@nameserverARR)
{
my $ip;
if($_ eq '<xcatmaster>'){
$ip = xCAT::NetworkUtils->my_ip_facing($gateway);
}else{
(undef,$ip) = xCAT::NetworkUtils->gethostnameandip($_);
}
push @nameserversIP, $ip;
}
# get the domains for each node - one call for all nodes in hosts file
my $nd = xCAT::NetworkUtils->getNodeDomains([$node]);
my %nodedomains = %$nd;
my $domain=$nodedomains{$node};
my $networkhash={
'networking' => [
{
'dns' => [
{
'domain' => [
"$domain"
],
'dhcp_hostname' => [
{
'content' => 'false',
'config:type' => 'boolean'
}
],
'dhcp_resolv' => [
{
'content' => 'false',
'config:type' => 'boolean'
}
],
'nameservers' => [
{
'config:type' => 'list',
'nameserver' => [@nameserversIP]
}
],
'hostname' => [
$hostname
],
'searchlist' => [
{
'search' => [
$domain
],
'config:type' => 'list'
}
]
}
],
'interfaces' => [
{
'interface' => [
{
'bootproto' => [
'static'
],
'startmode' => [
'onboot'
],
'netmask' => [
$netmask
],
'device' => [
'eth0'
],
'ipaddr' => [
$ipaddr
]
}
],
'config:type' => 'list'
}
],
'routing' => [
{
'ip_forward' => [
{
'content' => 'false',
'config:type' => 'boolean'
}
],
'routes' => [
{
'route' => [
{
'destination' => [
'default'
],
'gateway' => [
$gateway
],
'netmask' => [
'-'
],
'device' => [
'-'
]
}
],
'config:type' => 'list'
}
]
}
]
}
]
};
my $xml = new XML::Simple(KeepRoot => 1);
$line=$xml->XMLout($networkhash);
#return "#KSNET static unsupported";
} else {
my $networkhash={
'networking' => [
{
'dns' => [
{
'domain' => [
'local'
],
'dhcp_hostname' => [
{
'content' => 'true',
'config:type' => 'boolean'
}
],
'hostname' => [
'linux'
],
'dhcp_resolv' => [
{
'content' => 'true',
'config:type' => 'boolean'
}
]
}
],
'interfaces' => [
{
'interface' => [
{
'startmode' => [
'onboot'
],
'bootproto' => [
'dhcp'
],
'device' => [
'eth0'
]
}
],
'config:type' => 'list'
}
],
'routing' => [
{
'ip_forward' => [
{
'content' => 'false',
'config:type' => 'boolean'
}
],
'routes' => [
{
'config:type' => 'list'
}
]
}
]
}
]
};
my $xml = new XML::Simple(KeepRoot => 1);
$line=$xml->XMLout($networkhash);
}
return $line;
}
sub autoulaaddress {
my $suffix = shift;
my $prefix = $::XCATSITEVALS{autoulaprefix};
+64
View File
@@ -10,6 +10,7 @@ use xCAT::Table;
use xCAT::MsgUtils;
use Data::Dumper;
use xCAT::NodeRange;
use xCAT::Utils;
#--------------------------------------------------------------------------------
=head1 xCAT::XCATD
@@ -270,4 +271,67 @@ sub validate {
xCAT::MsgUtils->message("S","Request matched no policy rule: peername=$peername, peerhost=$peerhost ".$request->{command}->[0]);
return 0;
}
my $tokentimeout = 86400; # one day
# this subroutine search the token table
# 1. find the existed token entry for the user and reset the expire time
# 1.1. if not find existed token, create a new one and add it to token table
# 2. clean up the expired token
#
# this subroutine is called after the account has been authorized
sub gettoken {
my $class=shift;
my $req = shift;
my $user = $req->{gettoken}->[0]->{username}->[0];
my $tokentb = xCAT::Table->new('token');
unless ($tokentb) {
return undef;
}
my $tokens = $tokentb->getAllEntries;
my $expiretime = time() + $tokentimeout;
foreach my $token (@{$tokens}) {
if ($token->{username} eq $user) {
#delete old token
$tokentb->delEntries({'tokenid'=>$token->{tokenid}});
} else {
#clean the expired token
if ($token->{expire} > $expiretime) {
$tokentb->delEntries({'tokenid'=>$token->{tokenid}});
}
}
}
# create a new token for this request
my $uuid = xCAT::Utils->genUUID();
$tokentb->setAttribs({tokenid=>$uuid, username => $user}, {expire => $expiretime});
$tokentb->close();
return ($uuid, $expiretime);
}
# verify the token has correct entry in token table and expire time is not exceeded.
sub verifytoken {
my $class=shift;
my $req = shift;
my $tokenid = $req->{tokens}->[0]->{tokenid}->[0];
my $tokentb = xCAT::Table->new('token');
unless ($tokentb) {
return undef;
}
my $token = $tokentb->getAttribs({'tokenid' => $tokenid}, ('username', 'expire'));
if (defined ($token) && defined ($token->{'username'}) && defined ($token->{'expire'})) {
my $expiretime = time() + $tokentimeout;
if ($token->{'expire'} < time()) {
$tokentb->delEntries({'tokenid'=>$token->{tokenid}});
return undef;
} else {
return $token->{'username'};
}
} else {
return undef;
}
}
1;
+29 -14
View File
@@ -379,8 +379,7 @@ sub parse_attr_for_osimage{
sub processArgs
{
my $gotattrs = 0;
if (defined(@{$::args})) {
if ( defined ($::args) && @{$::args} ) {
@ARGV = @{$::args};
} else {
if ($::command eq "lsdef") {
@@ -391,8 +390,9 @@ sub processArgs
return 2;
}
}
if ( scalar(@{$::args}) eq 1 and $::args->[0] eq '-S')
{
if ( defined ($::args) && @{$::args} ) {
if ( scalar(@{$::args}) eq 1 and $::args->[0] eq '-S')
{
if ($::command eq "lsdef") {
push @ARGV, "-t";
push @ARGV, "node";
@@ -400,6 +400,7 @@ sub processArgs
} else {
return 2;
}
}
}
if ($::command eq "lsdef") {
@@ -2463,15 +2464,21 @@ sub defch
# give results
my $rsp;
$rsp->{data}->[0] =
"The database was updated for the following objects:";
xCAT::MsgUtils->message("I", $rsp, $::callback);
my $nodenum = scalar(keys %::FINALATTRS);
if ($nodenum) {
$rsp->{data}->[0] =
"The database was updated for the following objects:";
xCAT::MsgUtils->message("I", $rsp, $::callback);
my $n = 1;
foreach my $o (sort(keys %::FINALATTRS))
{
$rsp->{data}->[$n] = "$o\n";
$n++;
my $n = 1;
foreach my $o (sort(keys %::FINALATTRS))
{
$rsp->{data}->[$n] = "$o\n";
$n++;
}
} else {
$rsp->{data}->[0] =
"No database was updated";
}
xCAT::MsgUtils->message("I", $rsp, $::callback);
}
@@ -2479,8 +2486,13 @@ sub defch
{
my $rsp;
my $nodenum = scalar(keys %::FINALATTRS);
$rsp->{data}->[0] =
"$nodenum object definitions have been created or modified.";
if ($nodenum) {
$rsp->{data}->[0] =
"$nodenum object definitions have been created or modified.";
} else {
$rsp->{data}->[0] =
"No object definitions have been created or modified.";
}
xCAT::MsgUtils->message("I", $rsp, $::callback);
if (scalar(keys %newobjects) > 0)
{
@@ -2628,6 +2640,9 @@ sub setFINALattrs
{
# special case for the nic* attributes
# merge nic*.eth0, nic*.eth1
unless(exists($::CLIATTRS{$objname})) {
next;
}
if ($::CLIATTRS{$objname}{objtype} eq 'node')
{
# Even if only the nicips.eth0 is specified with CLI,
+1 -2
View File
@@ -232,8 +232,7 @@ sub parse_args
my $args = $request->{arg};
my $gotattrs = 0;
my %opt =();
if (defined(@{$args})) {
if ( defined ($args) && @{$args}) {
@ARGV = @{$args};
} else {
return 2;
+21 -14
View File
@@ -154,6 +154,13 @@ sub preprocess_request
# - either the NIMprime attr of the site table or the management node
my $nimprime = xCAT::InstUtils->getnimprime();
chomp $nimprime;
if (!defined($nimprime))
{
my $rsp={};
$rsp->{error}->[0] = "Could not determine nimprime. Check if nimprime defined in site table or site table master is not resolvable to the MN name.";
xCAT::MsgUtils->message("E", $rsp, $cb,1);
return undef;
}
my $nimprimeip = xCAT::NetworkUtils->getipaddr($nimprime);
if ($nimprimeip =~ /:/) #IPv6
{
@@ -617,7 +624,7 @@ sub nimnodeset
my $Sname = xCAT::InstUtils->myxCATname();
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -1793,7 +1800,7 @@ sub chkosimage
my $image_name;
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -2260,7 +2267,7 @@ sub mknimimage
my $dump_name;
my $install_dir = xCAT::TableUtils->getInstallDir();
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -4233,7 +4240,7 @@ sub mk_spot
if ($::RUNCMD_RC != 0)
{
my $rsp;
push @{$rsp->{data}}, " The cpcosi command failed. \n$output\n";
push @{$rsp->{data}}, " The cpcosi command failed. \n$output\n";
push @{$rsp->{data}},
"Could not create a NIM definition for \'$spot_name\'.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
@@ -5698,7 +5705,7 @@ sub prermnimimage
my @servicenodes = (); # pass back list of service nodes
my %imagedef; # pass back image def hash
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -6208,7 +6215,7 @@ sub rmnimimage
%allsn = %{$nodehash};
}
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -7815,7 +7822,7 @@ sub prenimnodecust
@nodelist = @$nodes;
}
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -8053,7 +8060,7 @@ sub nimnodecust
@nodelist = @$nodes;
}
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -8210,7 +8217,7 @@ sub prenimnodeset
my $subreq = shift;
my $error = 0;
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -9937,7 +9944,7 @@ sub define_SN_resource
}
my %attrs;
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -10976,7 +10983,7 @@ sub mkdsklsnode
# - just set global for now
$::callback = $callback;
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -12986,7 +12993,7 @@ sub make_SN_resource
}
my %attrs;
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -13646,7 +13653,7 @@ sub prermdsklsnode
{
my $callback = shift;
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -13756,7 +13763,7 @@ sub rmdsklsnode
# - just set global for now
$::callback = $callback;
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
+50 -2
View File
@@ -1381,18 +1381,24 @@ sub mkinstall
$instserver=$ent->{nfsserver};
}
if ($::XCATSITEVALS{managedaddressmode} =~ /static/){
unless($instserver eq '!myipfn!'){
my($host,$ip)=xCAT::NetworkUtils->gethostnameandip($instserver);
$instserver=$ip;
}
}
my $httpprefix=$pkgdir;
if ($installroot =~ /\/$/) {
$httpprefix =~ s/^$installroot/\/install\//;
} else {
$httpprefix =~ s/^$installroot/\/install/;
}
my $kcmdline;
if ($pkvm) {
$kcmdline = "ksdevice=bootif kssendmac text selinux=0 rd.dm=0 rd.md=0 repo=$httpmethod://$instserver:$httpport$httpprefix/packages/ kvmp.inst.auto=$httpmethod://$instserver:$httpport/install/autoinst/$node root=live:$httpmethod://$instserver:$httpport$httpprefix/LiveOS/squashfs.img";
} else {
$kcmdline =
"quiet repo=$httpmethod://$instserver:$httpport$httpprefix ks=$httpmethod://"
$kcmdline ="quiet repo=$httpmethod://$instserver:$httpport$httpprefix ks=$httpmethod://"
. $instserver . ":". $httpport
. "/install/autoinst/"
. $node;
@@ -1446,6 +1452,48 @@ sub mkinstall
unless ($ksdev eq "bootif" and $os =~ /7/) {
$kcmdline .= " ksdevice=" . $ksdev;
}
#if site.managedaddressmode=static, specify the network configuration as kernel options
#to avoid multicast dhcp
if($::XCATSITEVALS{managedaddressmode} =~ /static/){
my ($ipaddr,$hostname,$gateway,$netmask)=xCAT::NetworkUtils->getNodeNetworkCfg($node);
unless($ipaddr) {
$callback->(
{
error => [
"cannot resolve the ip address of $node"
],
errorcode => [1]
}
);
}
if($gateway eq '<xcatmaster>'){
$gateway = xCAT::NetworkUtils->my_ip_facing($ipaddr);
}
$kcmdline .=" ip=$ipaddr netmask=$netmask gateway=$gateway hostname=$hostname ";
my %nameservers=%{xCAT::NetworkUtils->getNodeNameservers([$node])};
my @nameserverARR=split (",",$nameservers{$node});
my @nameserversIP;
foreach (@nameserverARR)
{
my $ip;
if($_ eq '<xcatmaster>'){
$ip = xCAT::NetworkUtils->my_ip_facing($gateway);
}else{
(undef,$ip) = xCAT::NetworkUtils->gethostnameandip($_);
}
push @nameserversIP, $ip;
}
if(scalar @nameserversIP){
$kcmdline .=" dns=".join(",",@nameserversIP);
}
}
#TODO: dd=<url> for driver disks
if (defined($sent->{serialport}))
+187 -186
View File
@@ -51,7 +51,7 @@ sub getzonesfornet {
die "Not supporting having a mask like $mask on an ipv6 network like $net";
}
my $netnum= getipaddr($net,GetNumber=>1);
unless ($netnum) { return (); }
unless ($netnum) { return (); }
$netnum->brsft(128-$maskbits);
my $prefix=$netnum->as_hex();
my $nibbs=$maskbits/4;
@@ -229,7 +229,7 @@ sub process_request {
}
}
if ($::XCATSITEVALS{externaldns}) {
$external=1;
$external=1;
}
if ($help)
@@ -325,73 +325,73 @@ sub process_request {
if ($allnodes) {
#read all nodelist specified nodes
} else {
if (not $request->{node} and $deletemode) {
#when this was permitted, it really ruined peoples' days
xCAT::SvrUtils::sendmsg([1,"makedns -d without noderange or -a is not supported"],$callback);
umask($oldmask);
return;
}
my @contents;
my $domain;
if ($request->{node}) { #leverage makehosts code to flesh out the options
require xCAT_plugin::hosts;
my @content1;
my @content2;
xCAT_plugin::hosts::add_hosts_content(nodelist=>$request->{node},callback=>$callback,hostsref=>\@content1);
xCAT_plugin::hosts::donics(nodes=>$request->{node},callback=>$callback,hostsref=>\@content2);
if (not $request->{node} and $deletemode) {
#when this was permitted, it really ruined peoples' days
xCAT::SvrUtils::sendmsg([1,"makedns -d without noderange or -a is not supported"],$callback);
umask($oldmask);
return;
}
my @contents;
my $domain;
if ($request->{node}) { #leverage makehosts code to flesh out the options
require xCAT_plugin::hosts;
my @content1;
my @content2;
xCAT_plugin::hosts::add_hosts_content(nodelist=>$request->{node},callback=>$callback,hostsref=>\@content1);
xCAT_plugin::hosts::donics(nodes=>$request->{node},callback=>$callback,hostsref=>\@content2);
@contents = (@content1, @content2);
} else {
#legacy behavior, read from /etc/hosts
my $hostsfile;
open($hostsfile,"<","/etc/hosts");
flock($hostsfile,LOCK_SH);
@contents = <$hostsfile>;
flock($hostsfile,LOCK_UN);
close($hostsfile);
}
} else {
#legacy behavior, read from /etc/hosts
my $hostsfile;
open($hostsfile,"<","/etc/hosts");
flock($hostsfile,LOCK_SH);
@contents = <$hostsfile>;
flock($hostsfile,LOCK_UN);
close($hostsfile);
}
my $addr;
my $name;
my $canonical;
my $aliasstr;
my @aliases;
my $names;
my @hosts;
my %nodehash;
my @hosts;
my %nodehash;
foreach (@contents) {
chomp; #no newline
s/#.*//; #strip comments;
s/^[ \t\n]*//; #remove leading whitespace
next unless ($_); #skip empty lines
($addr,$names) = split /[ \t]+/,$_,2;
chomp; #no newline
s/#.*//; #strip comments;
s/^[ \t\n]*//; #remove leading whitespace
next unless ($_); #skip empty lines
($addr,$names) = split /[ \t]+/,$_,2;
if ($addr !~ /^\d+\.\d+\.\d+\.\d+$/ and $addr !~ /^[abcdef0123456789:]+$/) {
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, address seems malformed.", $callback);
next;
}
unless ($names =~ /^[a-z0-9\. \t\n-]+$/i) {
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, names $names contain invalid characters (valid characters include a through z, numbers and the '-', but not '_'", $callback);
next;
}
my ($host, $ip) = xCAT::NetworkUtils->gethostnameandip($addr);
push @hosts, $host;
$nodehash{$addr}{names}=$names;
$nodehash{$addr}{host}=$host;
}
if ($addr !~ /^\d+\.\d+\.\d+\.\d+$/ and $addr !~ /^[abcdef0123456789:]+$/) {
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, address seems malformed.", $callback);
next;
}
unless ($names =~ /^[a-z0-9\. \t\n-]+$/i) {
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, names $names contain invalid characters (valid characters include a through z, numbers and the '-', but not '_'", $callback);
next;
}
my ($host, $ip) = xCAT::NetworkUtils->gethostnameandip($addr);
push @hosts, $host;
$nodehash{$addr}{names}=$names;
$nodehash{$addr}{host}=$host;
}
# get the domains for each node - one call for all nodes in hosts file
my $nd = xCAT::NetworkUtils->getNodeDomains(\@hosts);
my %nodedomains = %$nd;
foreach my $n (keys %nodehash) {
$addr=$n;
$names=$nodehash{$n}{names};
# - need domain for this node
my $host = $nodehash{$n}{host};
$domain=$nodedomains{$host};
# remove the first . at domain name since it's not accepted by high dns parser
if ($domain =~ /^\./) { $domain =~ s/^\.//;; }
# get the domains for each node - one call for all nodes in hosts file
my $nd = xCAT::NetworkUtils->getNodeDomains(\@hosts);
my %nodedomains = %$nd;
foreach my $n (keys %nodehash) {
$addr=$n;
$names=$nodehash{$n}{names};
# - need domain for this node
my $host = $nodehash{$n}{host};
$domain=$nodedomains{$host};
# remove the first . at domain name since it's not accepted by high dns parser
if ($domain =~ /^\./) { $domain =~ s/^\.//;; }
($canonical,$aliasstr) = split /[ \t]+/,$names,2;
if ($aliasstr) {
@@ -407,7 +407,7 @@ sub process_request {
unless ($canonical =~ /$domain/) {
$canonical.=".".$domain;
}
# for only the sake of comparison, ensure consistant dot suffix
# for only the sake of comparison, ensure consistant dot suffix
unless ($canonical =~ /\.\z/) { $canonical .= '.' }
foreach my $alias (@aliases) {
unless ($alias =~ /$domain/) {
@@ -419,13 +419,13 @@ sub process_request {
if ($alias eq $canonical) {
next;
}
# remember alias for CNAM records later
# remember alias for CNAM records later
$ctx->{aliases}->{$node}->{$alias}=1;
}
# exclude the nodes not belong to any nets defined in networks table
# because only the nets defined in networks table will be add
# zones later.
# zones later.
my $found = 0;
foreach (@networks)
{
@@ -508,13 +508,13 @@ sub process_request {
$ctx->{domain} =~ s/^\.//; # remove . if it's the first char of domain name
$ctx->{zonestotouch}->{$ctx->{domain}}=1;
foreach (@networks) {
if ($_->{domain}) {
$_->{domain} =~ s/^\.//; # remove . if it's the first char of domain name
$ctx->{zonestotouch}->{$_->{domain}}=1;
}
}
foreach (@networks) {
if ($_->{domain}) {
$_->{domain} =~ s/^\.//; # remove . if it's the first char of domain name
$ctx->{zonestotouch}->{$_->{domain}}=1;
}
}
xCAT::SvrUtils::sendmsg("Getting reverse zones, this may take several minutes for a large cluster.", $callback);
foreach (@nodes) {
@@ -528,10 +528,10 @@ sub process_request {
xCAT::SvrUtils::sendmsg("Completed getting reverse zones.", $callback);
if (1) {
#TODO: function to detect and return 1 if the master server is
# DNS SOA for all the zones we care about here, we are examining
#TODO: function to detect and return 1 if the master server is
# DNS SOA for all the zones we care about here, we are examining
# files to assure that our key is in named.conf, the zones we
# care about are there, and that if active directory is in use,
# care about are there, and that if active directory is in use,
# allow the domain controllers to update specific zones
@entries = xCAT::TableUtils->get_site_attribute("directoryprovider");
$site_entry = $entries[0];
@@ -541,13 +541,13 @@ sub process_request {
if ( defined($site_entry)) {
my @dservers = split /[ ,]/,$site_entry;
$ctx->{adservers} = \@dservers;
############################
# - should this include all domains?
# - multi-domains not supported with activedirectory
# - TODO in future release
###################
############################
# - should this include all domains?
# - multi-domains not supported with activedirectory
# - TODO in future release
###################
$ctx->{adzones} = {
"_msdcs.". $ctx->{domain} => 1,
"_sites.". $ctx->{domain} => 1,
@@ -556,51 +556,51 @@ sub process_request {
};
}
}
@entries = xCAT::TableUtils->get_site_attribute("dnsupdaters");
$site_entry = $entries[0];
if ( defined($site_entry) ) {
my @nservers = split /[ ,]/,$site_entry;
$ctx->{dnsupdaters} = \@nservers;
my @nservers = split /[ ,]/,$site_entry;
$ctx->{dnsupdaters} = \@nservers;
}
unless ($external) {
if ($zapfiles || $slave) { #here, we unlink all the existing files to start fresh
if (xCAT::Utils->isAIX())
{
system("/usr/bin/stopsrc -s $service");
}
else
{
system("service $service stop"); #named may otherwise hold on to stale journal filehandles
}
my $conf = get_conf();
unlink $conf;
my $DBDir = get_dbdir();
foreach (<$DBDir/db.*>) {
unlink $_;
}
}
#We manipulate local namedconf
$ctx->{dbdir} = get_dbdir();
$ctx->{zonesdir} = get_zonesdir();
chmod 0775, $ctx->{dbdir}; # assure dynamic dns can actually execute against the directory
update_namedconf($ctx, $slave);
unless ($slave)
unless ($external) { # only generate the named.conf and zone files for xCAT dns when NOT using external dns
if ($zapfiles || $slave) { #here, we unlink all the existing files to start fresh
if (xCAT::Utils->isAIX())
{
update_zones($ctx);
system("/usr/bin/stopsrc -s $service");
}
else
{
system("service $service stop"); #named may otherwise hold on to stale journal filehandles
}
my $conf = get_conf();
unlink $conf;
my $DBDir = get_dbdir();
foreach (<$DBDir/db.*>) {
unlink $_;
}
}
#We manipulate local namedconf
$ctx->{dbdir} = get_dbdir();
$ctx->{zonesdir} = get_zonesdir();
chmod 0775, $ctx->{dbdir}; # assure dynamic dns can actually execute against the directory
update_namedconf($ctx, $slave);
unless ($slave)
{
update_zones($ctx);
}
if ($ctx->{restartneeded}) {
xCAT::SvrUtils::sendmsg("Restarting $service", $callback);
if ($ctx->{restartneeded}) {
xCAT::SvrUtils::sendmsg("Restarting $service", $callback);
if (xCAT::Utils->isAIX())
{
#try to stop named
my $cmd = "/usr/bin/stopsrc -s $service";
my @output=xCAT::Utils->runcmd($cmd, 0);
$cmd = "/usr/bin/startsrc -s $service";
@output=xCAT::Utils->runcmd($cmd, 0);
my $outp = join('', @output);
@@ -624,7 +624,7 @@ sub process_request {
xCAT::MsgUtils->message("E", $rsp, $callback);
return;
}
$cmd = "service $service start";
@output=xCAT::Utils->runcmd($cmd, 0);
$outp = join('', @output);
@@ -636,56 +636,57 @@ sub process_request {
return;
}
}
xCAT::SvrUtils::sendmsg("Restarting named complete", $callback);
}
}
xCAT::SvrUtils::sendmsg("Restarting named complete", $callback);
}
}
} else {
unless ($ctx->{privkey}) {
xCAT::SvrUtils::sendmsg([1,"Unable to update DNS due to lack of credentials in passwd to communicate with remote server"], $callback);
}
}
if ($slave)
{
return;
}
# check if named is active before update dns records.
if (xCAT::Utils->isAIX())
{
my $cmd = "/usr/bin/lssrc -s $service |grep active";
my @output=xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
unless ($external) { # only start xCAT local dns when NOT using external dns
if (xCAT::Utils->isAIX())
{
$cmd = "/usr/bin/startsrc -s $service";
@output=xCAT::Utils->runcmd($cmd, 0);
my $outp = join('', @output);
my $cmd = "/usr/bin/lssrc -s $service |grep active";
my @output=xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
return;
$cmd = "/usr/bin/startsrc -s $service";
@output=xCAT::Utils->runcmd($cmd, 0);
my $outp = join('', @output);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
return;
}
}
}
}
else
{
my $cmd = "service $service status|grep running";
my @output=xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
else
{
$cmd = "service $service start";
@output=xCAT::Utils->runcmd($cmd, 0);
my $outp = join('', @output);
my $cmd = "service $service status|grep running";
my @output=xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
return;
$cmd = "service $service start";
@output=xCAT::Utils->runcmd($cmd, 0);
my $outp = join('', @output);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
return;
}
}
}
}
@@ -693,12 +694,12 @@ sub process_request {
#now we stick to Net::DNS style updates, with TSIG if possible. TODO: kerberized (i.e. Windows) DNS server support, maybe needing to use nsupdate -g....
if ($external)
{
# based on /etc/resolv.conf
# based on /etc/resolv.conf
$ctx->{resolver} = Net::DNS::Resolver->new();
}
else
{
# default to localhost
# default to localhost
$ctx->{resolver} = Net::DNS::Resolver->new(nameservers=>['127.0.0.1']);
}
@@ -716,9 +717,9 @@ sub get_zonesdir {
my @entries = xCAT::TableUtils->get_site_attribute("bindzones");
my $site_entry = $entries[0];
if ( defined($site_entry) ) {
$ZonesDir= $site_entry;
}
if ( defined($site_entry) ) {
$ZonesDir= $site_entry;
}
return "$ZonesDir";
}
@@ -727,16 +728,16 @@ sub get_conf {
my $conf="/etc/named.conf";
# is this ubuntu ?
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
$conf="/etc/bind/named.conf";
}
my @entries = xCAT::TableUtils->get_site_attribute("bindconf");
my $site_entry = $entries[0];
if ( defined($site_entry) ) {
$conf= $site_entry;
}
if ( defined($site_entry) ) {
$conf= $site_entry;
}
return "$conf";
}
@@ -746,9 +747,9 @@ sub get_dbdir {
my @entries = xCAT::TableUtils->get_site_attribute("binddir");
my $site_entry = $entries[0];
if ( defined($site_entry) ) {
$DBDir = $site_entry;
}
if ( defined($site_entry) ) {
$DBDir = $site_entry;
}
if ( -d "$DBDir" ) {
return "$DBDir"
@@ -789,13 +790,13 @@ sub update_zones {
my $name = hostname;
my $node = $name;
# get the domain for the node - which is the local hostname
my ($host, $nip) = xCAT::NetworkUtils->gethostnameandip($node);
my @hosts;
push (@hosts, $host);
my $nd = xCAT::NetworkUtils->getNodeDomains(\@hosts);
my %nodedomains = %$nd;
my $domain = $nodedomains{$host};
# get the domain for the node - which is the local hostname
my ($host, $nip) = xCAT::NetworkUtils->gethostnameandip($node);
my @hosts;
push (@hosts, $host);
my $nd = xCAT::NetworkUtils->getNodeDomains(\@hosts);
my %nodedomains = %$nd;
my $domain = $nodedomains{$host};
xCAT::SvrUtils::sendmsg("Updating zones.", $callback);
@@ -829,7 +830,7 @@ sub update_zones {
my $serial = ($mday * 100) + (($mon + 1) * 10000) + (($year + 1900) * 1000000);
foreach $currzone (@neededzones) {
my $zonefilename = $currzone;
my $zonefilename = $currzone;
if ($currzone =~ /IN-ADDR\.ARPA/) {
$currzone =~ s/\.IN-ADDR\.ARPA.*//;
my @octets = split/\./,$currzone;
@@ -853,7 +854,7 @@ sub update_zones {
}
flock($zonehdl,LOCK_UN);
close($zonehdl);
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
chown(scalar(getpwnam('root')),scalar(getgrnam('bind')),$dbdir."/db.$zonefilename");
}
else{
@@ -889,7 +890,7 @@ sub update_namedconf {
$gotoptions=1;
my $skip=0;
do {
#push @newnamed,"\t\t//listen-on-v6 { any; };\n";
#push @newnamed,"\t\t//listen-on-v6 { any; };\n";
if ($ctx->{forwarders} and $line =~ /forwarders {/) {
push @newnamed,"\tforwarders \{\n";
$skip=1;
@@ -1005,11 +1006,11 @@ sub update_namedconf {
}
}
unless ($gotoptions) {
push @newnamed,"options {\n";
push @newnamed,"options {\n";
unless ($slave && xCAT::Utils->isLinux()) {
push @newnamed,"\tdirectory \"".$ctx->{zonesdir}."\";\n";
}
push @newnamed,"\t\t//listen-on-v6 { any; };\n";
push @newnamed,"\t\t//listen-on-v6 { any; };\n";
if ($ctx->{forwarders}) {
push @newnamed,"\tforwarders {\n";
foreach (@{$ctx->{forwarders}}) {
@@ -1128,7 +1129,7 @@ sub update_namedconf {
for my $l (@newnamed) { print $newnameconf $l; }
flock($newnameconf,LOCK_UN);
close($newnameconf);
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
chown (scalar(getpwnam('root')),scalar(getgrnam('bind')),$namedlocation);
}
else{
@@ -1156,9 +1157,9 @@ sub add_or_delete_records {
$ctx->{nsmap} = {}; #will store a map to known NS records to avoid needless redundant queries to sort nodes into domains
$ctx->{updatesbyzone}={}; #sort all updates into their respective zones for bulk update for fewer DNS transactions
# get node domains
my $nd = xCAT::NetworkUtils->getNodeDomains(\@{$ctx->{nodes}});
my %nodedomains = %{$nd};
# get node domains
my $nd = xCAT::NetworkUtils->getNodeDomains(\@{$ctx->{nodes}});
my %nodedomains = %{$nd};
foreach $node (@{$ctx->{nodes}}) {
my $name = $node;
@@ -1168,8 +1169,8 @@ sub add_or_delete_records {
next;
}
my $domain = $nodedomains{$node};
if ($domain =~ /^\./) { $domain =~ s/^\.//; } # remove . if it's the first char of domain name
my $domain = $nodedomains{$node};
if ($domain =~ /^\./) { $domain =~ s/^\.//; } # remove . if it's the first char of domain name
unless ($name =~ /$domain/) { $name .= ".".$domain } # $name needs to represent fqdn, but must preserve $node as a nodename for cfg lookup
@@ -1177,9 +1178,9 @@ sub add_or_delete_records {
@ips = ($ctx->{hoststab}->{$node}->[0]->{ip});
} else {
@ips = getipaddr($node,GetAllAddresses=>1);
if (not @ips and keys %{$ctx->{nodeips}->{$node}}) {
@ips = keys %{$ctx->{nodeips}->{$node}};
}
if (not @ips and keys %{$ctx->{nodeips}->{$node}}) {
@ips = keys %{$ctx->{nodeips}->{$node}};
}
if (!defined($ips[0])) {
xCAT::SvrUtils::sendmsg([1,"Unable to find an IP for $node in hosts table or via system lookup (i.e. /etc/hosts)"], $callback);
next;
@@ -1214,7 +1215,7 @@ sub add_or_delete_records {
}
my $zone;
foreach $zone (keys %{$ctx->{updatesbyzone}}) {
my $ip = xCAT::NetworkUtils->getipaddr($ctx->{nsmap}->{$zone});
my $ip = xCAT::NetworkUtils->getipaddr($ctx->{nsmap}->{$zone});
if( !defined $ip) {
xCAT::SvrUtils::sendmsg([1,"Please make sure $ctx->{nsmap}->{$zone} exist either in /etc/hosts or DNS."], $callback);
return 1;
@@ -1296,9 +1297,9 @@ sub find_nameserver_for_dns {
}
if (defined $ctx->{aliases}->{$node}) {
foreach (keys %{$ctx->{aliases}->{$node}}) {
push @rrcontent, "$_ IN CNAME $name";
}
foreach (keys %{$ctx->{aliases}->{$node}}) {
push @rrcontent, "$_ IN CNAME $name";
}
}
if ($ctx->{deletemode}) {
push @rrcontent,"$name TXT";
@@ -1311,7 +1312,7 @@ sub find_nameserver_for_dns {
unless (defined $ctx->{nsmap}->{$zone}) { #ok, we already thought about this zone and made a decision
if ($zone =~ /^\.*192.IN-ADDR.ARPA\.*/ or $zone =~ /^\.*172.IN-ADDR.ARPA\.*/ or $zone =~ /127.IN-ADDR.ARPA\.*/ or $zone =~ /^\.*IN-ADDR.ARPA\.*/ or $zone =~ /^\.*ARPA\.*/) {
$ctx->{nsmap}->{$zone} = 0; #ignore zones that are likely to appear, but probably not ours
} elsif ($::XCATSITEVALS{ddnsserver}) {
} elsif ($::XCATSITEVALS{ddnsserver}) {
$ctx->{nsmap}->{$zone} = $::XCATSITEVALS{ddnsserver};
} else {
my $reply = $ctx->{resolver}->query($zone,'NS');
@@ -1392,9 +1393,9 @@ sub get_dns_slave
foreach my $sn (@ents)
{
if ($sn->{'nameserver'} == 2)
{
{
push @sns, $sn->{'node'};
}
}
}
@slaves = xCAT::NodeRange::noderange(join(',',@sns));
+20 -1
View File
@@ -663,6 +663,11 @@ sub mkinstall
my $prescript = "$::XCATROOT/share/xcat/install/scripts/pre.$platform";
my $postscript = "$::XCATROOT/share/xcat/install/scripts/post.$platform";
# for powerkvm VM ubuntu LE#
if ($arch =~ /ppc64/i and $platform eq "ubuntu") {
$prescript = "$::XCATROOT/share/xcat/install/scripts/pre.$platform.ppc64";
}
if (-r "$prescript"){
$preerr =
@@ -687,6 +692,12 @@ sub mkinstall
$callback->({node =>[{name => [$node], error => [$errtmp], errorcode => [1]}]});
next;
}
if ($arch =~ /ppc64/i and !(-e "$pkgdir/install/netboot/initrd.gz")) {
$callback->({error => ["The netboot initrd not found in $pkgdir/install/netboot, pls download first"],
errorcode=>[1]});
next;
}
my $tftpdir = "/tftpboot";
# create the node-specific post scripts
@@ -697,7 +708,7 @@ sub mkinstall
if (
(
$arch =~ /x86/ and
($arch =~ /x86/ and
(
( -r "$pkgdir/install/netboot/ubuntu-installer/$darch/linux"
and $kernpath = "$pkgdir/install/netboot/ubuntu-installer/$darch/linux"
@@ -710,6 +721,14 @@ sub mkinstall
and $initrdpath = "$pkgdir/install/netboot/initrd.gz"
)
)
) or (
$arch =~ /ppc64/i and (
-r "$pkgdir/install/vmlinux"
and $kernpath = "$pkgdir/install/vmlinux"
and -r "$pkgdir/install/netboot/initrd.gz"
and $initrdpath = "$pkgdir/install/netboot/initrd.gz"
)
)
)
){
+3 -1
View File
@@ -323,7 +323,9 @@ sub setdestiny {
noupdateinitrd=>$noupdateinitrd,
ignorekernelchk=>$ignorekernelchk,}, \&relay_response);
if ($errored) {
$callback->({error=>"Some nodes failed to set up $state resources, aborting"});
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
$callback->({error=>"Some nodes failed to set up $state resources on server $myname, aborting"});
return;
}
+3 -2
View File
@@ -881,8 +881,8 @@ sub check_options
xCAT::MsgUtils->message("I", $rsp, $callback, 0);
return 0;
}
# if not help, dhcpd needs to be running
if (!($opt->{h})) {
# if not help and not -n, dhcpd needs to be running
if (!($opt->{h})&& (!($opt->{n}))) {
if (xCAT::Utils->isLinux()) {
my @output = xCAT::Utils->runcmd("service dhcpd status", -1);
if ($::RUNCMD_RC != 0) { # not running
@@ -2647,6 +2647,7 @@ sub newconfig
push @dhcpconf, "#xCAT generated dhcp configuration\n";
push @dhcpconf, "\n";
push @dhcpconf, "authoritative;\n";
push @dhcpconf, "option conf-file code 209 = text;\n";
push @dhcpconf, "option space isan;\n";
push @dhcpconf, "option isan-encap-opts code 43 = encapsulate isan;\n";
push @dhcpconf, "option isan.iqn code 203 = string;\n";
+4 -3
View File
@@ -1332,7 +1332,7 @@ sub fpc_firmxfer_watch {
return;
}
my $percent = 0;
if ($rsp->{data} and (length(@{$rsp->{data}}) > 0)) {
if ($rsp->{data} and (scalar(@{$rsp->{data}}) > 0)) {
$percent = $rsp->{data}->[0];
}
#$callback->({sinfo=>"$percent%"});
@@ -2971,12 +2971,13 @@ sub parsefru {
my $currsize;
if ($bytes->[$curridx] <= 5) { #don't even try to parse unknown stuff
#some records don't comply to any SPEC
while (not $last) {
while (not $last and $curridx < (scalar @$bytes)) {
if ($bytes->[$curridx+1] & 128) {
$last=1;
}
$currsize=$bytes->[$curridx+2];
push @{$fruhash->{extra}},$bytes->[$curridx..$curridx+4+$currsize-1];
push @{$fruhash->{extra}},@{$bytes}[$curridx..$curridx+4+$currsize-1];
$curridx += 5 + $currsize;
}
}
}
+3 -4
View File
@@ -3563,8 +3563,7 @@ sub create_error_response {
#-----------------------------------------------------------------------------
sub lskit_processargs {
if ( defined( @{$::args} ) ) {
if ( defined ($::args) && @{$::args} ){
@ARGV = @{$::args};
}
@@ -3665,7 +3664,7 @@ sub lskit_processargs {
#-----------------------------------------------------------------------------
sub lskitcomp_processargs {
if ( defined( @{$::args} ) ) {
if ( defined ($::args) && @{$::args} ){
@ARGV = @{$::args};
}
@@ -3758,7 +3757,7 @@ sub lskitcomp_processargs {
#-----------------------------------------------------------------------------
sub lskitdeployparam_processargs {
if ( defined( @{$::args} ) ) {
if ( defined ($::args) && @{$::args} ){
@ARGV = @{$::args};
}
+1 -1
View File
@@ -192,7 +192,7 @@ sub lskmodules_usage {
#-----------------------------------------------------------------------------
sub processArgs {
if ( defined( @{$::args} ) ) {
if ( defined ($::args) && @{$::args} ) {
@ARGV = @{$::args};
}
+52 -23
View File
@@ -470,26 +470,7 @@ sub build_diskstruct {
my $currdev;
my @suffixes=('a','b','d'..'zzz');
my $suffidx=0;
if ($cdloc) {
my $cdhash;
$cdhash->{device}='cdrom';
if ($cdloc =~ /^\/dev/) {
$cdhash->{type}='block';
} else {
$cdhash->{type}='file';
}
$cdhash->{source}->{file}=$cdloc;
$cdhash->{readonly};
$cdhash->{target}->{dev}='hdc';
push @returns,$cdhash;
} else { #give the VM an empty optical drive, to allow chvm live attach/remove
my $cdhash;
$cdhash->{device}='cdrom';
$cdhash->{type}='file';
$cdhash->{readonly};
$cdhash->{target}->{dev}='hdc';
push @returns,$cdhash;
}
my $storagemodel = $confdata->{vm}->{$node}->[0]->{storagemodel};
my $cachemethod = "none";
if ( $confdata->{vm}->{$node}->[0]->{storagecache}) {
$cachemethod = $confdata->{vm}->{$node}->[0]->{storagecache};
@@ -506,7 +487,7 @@ sub build_diskstruct {
my $model = $1;
unless ($model) {
#if not defined, model will stay undefined like above
$model = $confdata->{vm}->{$node}->[0]->{storagemodel};
$model = $storagemodel;
unless ($model) { $model = 'ide'; } #if still not defined, ide
}
my $prefix='hd';
@@ -574,6 +555,34 @@ sub build_diskstruct {
push @returns,$diskhash;
}
}
my $cdprefix='hd';
if ($storagemodel eq 'virtio') {
$cdprefix='vd';
} elsif ($storagemodel eq 'scsi') {
$cdprefix='sd';
}
$suffidx += 1;
if ($cdloc) {
my $cdhash;
$cdhash->{device}='cdrom';
if ($cdloc =~ /^\/dev/) {
$cdhash->{type}='block';
} else {
$cdhash->{type}='file';
}
$cdhash->{source}->{file}=$cdloc;
$cdhash->{readonly};
$cdhash->{target}->{dev}=$cdprefix.$suffixes[$suffidx];
push @returns,$cdhash;
} else { #give the VM an empty optical drive, to allow chvm live attach/remove
my $cdhash;
$cdhash->{device}='cdrom';
$cdhash->{type}='file';
$cdhash->{readonly};
$cdhash->{target}->{dev}=$cdprefix.$suffixes[$suffidx];
push @returns,$cdhash;
}
return \@returns;
}
sub getNodeUUID {
@@ -654,10 +663,16 @@ sub build_xmldesc {
my %args=@_;
my $cdloc=$args{cd};
my %xtree=();
my $hypcpumodel = $confdata->{$confdata->{vm}->{$node}->[0]->{host}}->{cpumodel};
$xtree{type}='kvm';
$xtree{name}->{content}=$node;
$xtree{uuid}->{content}=getNodeUUID($node);
$xtree{os} = build_oshash();
if (defined($hypcpumodel) and $hypcpumodel eq "ppc64") {
$xtree{os}->{type}->{arch} = "ppc64";
$xtree{os}->{type}->{machine} = "pseries";
delete $xtree{os}->{bios};
}
if ($args{memory}) {
$xtree{memory}->{content}=getUnits($args{memory},"M",1024);
if ($confdata->{vm}->{$node}->[0]->{memory}) {
@@ -723,8 +738,12 @@ sub build_xmldesc {
} else {
$xtree{devices}->{graphics}->{password}=genpassword(20);
}
$xtree{devices}->{sound}->{model}='ac97';
if (defined($hypcpumodel) and $hypcpumodel eq 'ppc64') {
$xtree{devices}->{emulator}->{content} = "/usr/bin/qemu-system-ppc64";
} else {
$xtree{devices}->{sound}->{model}='ac97';
}
$xtree{devices}->{console}->{type}='pty';
$xtree{devices}->{console}->{target}->{port}='1';
return XMLout(\%xtree,RootName=>"domain");
@@ -2988,7 +3007,17 @@ sub dohyp {
return 1,"General error establishing libvirt communication";
}
}
if (($command eq 'mkvm' or $command eq 'chvm') and $hypconn) {
my $nodeinfo = $hypconn->get_node_info();
if (exists($nodeinfo->{model})) {
$confdata->{$hyp}->{cpumodel} = $nodeinfo->{model};
}
}
foreach $node (sort (keys %{$hyphash{$hyp}->{nodes}})) {
if ($confdata->{$hyp}->{cpumodel} and $confdata->{$hyp}->{cpumodel} =~ /ppc64/i) {
$confdata->{vm}->{$node}->[0]->{storagemodel} = "scsi";
}
my ($rc,@output) = guestcmd($hyp,$node,$command,@$args);
foreach(@output) {
+2 -3
View File
@@ -26,8 +26,7 @@ sub preprocess_request
my @requests = ({%$req}); #first element is local instance
$::args = $req->{arg};
if (defined(@{$::args})) {
if ( defined ($::args) && @{$::args} ) {
@ARGV = @{$::args};
}
@@ -88,7 +87,7 @@ sub process_request
$::args = $request->{arg};
if (defined(@{$::args})) {
if ( defined ($::args) && @{$::args} ) {
@ARGV = @{$::args};
}
+2 -2
View File
@@ -412,13 +412,13 @@ sub create_imgconf_file {
my $rootpw = undef;
my $passwdtab = xCAT::Table->new('passwd');
if ($passwdtab) {
my $et = $passwdtab->getAttribs({key => 'system', username => 'root'}, 'password');
my $et = $passwdtab->getAttribs({key => 'vios', username => 'padmin'}, 'password');
if ($et and defined ($et->{'password'})) {
$rootpw = $et->{'password'};
}
}
unless (defined($rootpw)) {
return "Unable to find requested password from passwd, with key=system,username=root";
return "Unable to find requested password from passwd, with key=vios,username=padmin";
}
unless (-e $bootimg_root."/viobootimg") {
return "Unable to find VIOS bootimg file";
+15 -13
View File
@@ -447,20 +447,22 @@ sub process_request {
if ($do_dhcpsetup) {
foreach my $node (@normalnodeset) {
my $fpath = "http://9.3.190.175/tftpboot/petitboot/$node";
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],
node=> [$node],
arg=>['-l','-s','conf-file = \"'.$fpath.'\";']},$callback);
} else {
$sub_req->({command=>['makedhcp'],
node=> [$node],
arg=>['-s','conf-file = \"'.$fpath.'\";']},$callback);
}
my $server = xCAT::TableUtils->GetMasterNodeName($node);
my $ipfn = xCAT::NetworkUtils->my_ip_facing($server);
if(($server != 1) and defined($ipfn)) {
my $fpath = "http://$ipfn/tftpboot/petitboot/$node";
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],
node=> [$node],
arg=>['-l','-s','option conf-file \"'.$fpath.'\";']},$callback);
} else {
$sub_req->({command=>['makedhcp'],
node=> [$node],
arg=>['-s','option conf-file \"'.$fpath.'\";']},$callback);
}
}
}
}
}
}
#now run the end part of the prescripts
+62 -48
View File
@@ -54,6 +54,7 @@ my $command;
my $args;
# Put arguments in a hash.
my %args_dict;
my %general_arg;
#-------------------------------------------------------
@@ -100,6 +101,8 @@ sub process_request {
$command = $request->{command}->[0];
$args = $request->{arg};
my $gereral_arg = get_general_args();
# There is no need to acquire lock for command nodediscoverstatus, nodediscoverls and noderegenips.
if ($command eq "nodediscoverstatus"){
nodediscoverstatus();
@@ -112,7 +115,11 @@ sub process_request {
return;
}
my $lock = xCAT::Utils->acquire_lock("nodemgmt", 1);
my $non_block = 1;
if ( $general_arg{'blockmode'} == 1) {
$non_block = 0;
}
my $lock = xCAT::Utils->acquire_lock("nodemgmt", $non_block);
if (! $lock){
setrsp_errormsg("Cannot acquire lock, another process is already running.");
return;
@@ -131,7 +138,7 @@ sub process_request {
);
setrsp_errormsg("Cannot $errormsg_dict{$command} while node discovery is running.");
xCAT::Utils->release_lock($lock, 1);
xCAT::Utils->release_lock($lock, $non_block);
return;
}
}
@@ -156,7 +163,32 @@ sub process_request {
nodechmac();
}
xCAT::Utils->release_lock($lock, 1);
xCAT::Utils->release_lock($lock, $non_block);
}
sub get_general_args
{
my ($help, $ver, $blockmode);
%general_arg = ();
@ARGV = ();
if($args) {
@ARGV = @$args;
}
GetOptions(
'h|help' => \$help,
'v|version' => \$ver,
'b|block' => \$blockmode,
);
if($help){
$general_arg{'help'} = 1;
}
if($ver){
$general_arg{'version'} = 1;
}
if ($blockmode) {
$general_arg{'blockmode'} = 1;
}
}
#-------------------------------------------------------
@@ -202,37 +234,21 @@ sub validate_args{
my $enabledparamsref = shift;
my $mandatoryparamsref = shift;
# The -h -v are handled by seqdiscovery.pm
# -t -u -l only works for nodediscoverls, and them only handled by seqdiscovery.pm
my ($help, $ver, $type, $uuid, $long);
if ($general_arg{'help'} == 1){
my %process_help_commands = (
'nodediscoverstart' => 1,
'nodediscoverstop' => 1,
'nodediscoverls' => 1,
'nodediscoverstatus' => 1,
);
@ARGV = ();
if($args) {
@ARGV = @$args;
}
GetOptions(
'h|help' => \$help,
'v|version' => \$ver,
't=s' => \$type,
'u=s' => \$uuid,
'l' => \$long,
);
if($help){
# just return to make sequential discovery to handle it
return 0;
# do not process help message for these noddiscover* commands, cover them in seqdiscovery.pm
unless ($process_help_commands{$command} == 1) {
setrsp_infostr($helpmsg);
return 0;
}
}
if($ver){
# just return to make sequential discovery to handle it
return 0;
}
if ($type || $uuid || $long) {
# these args for general discovery, return directly
return 0;
}
my $parseret = parse_args();
if ($parseret){
setrsp_errormsg($parseret);
@@ -482,6 +498,8 @@ Usage:
$warnstr = "Warning: failed to import some nodes.";
setrsp_progress($warnstr);
}
# setup node provisioning status.
xCAT::Utils->runxcmd({command=>["updatenodestat"], node=>\@nodelist, arg=>['defined']}, $request_command, -1, 2);
setrsp_progress("Configuring nodes...");
my $retref = xCAT::Utils->runxcmd({command=>["kitnodeadd"], node=>\@nodelist, sequential=>[1], macflag=>[$mac_addr_mode]}, $request_command, 0, 2);
@@ -726,9 +744,6 @@ Usage:
# Update nodes' attributes
foreach (@$nodes) {
$updatenodeshash{$_}{'groups'} .= $profile_groups;
if ($profile_status){
$updatenodeshash{$_}{'status'} = $profile_status;
}
}
#update DataBase.
@@ -737,6 +752,11 @@ Usage:
$nodetab->setNodesAttribs(\%updatenodeshash);
$nodetab->close();
#update node's status:
if($profile_status eq "defined"){
xCAT::Utils->runxcmd({command=>["updatenodestat"], node=>$nodes, arg=>['defined']}, $request_command, -1, 2);
}
my $retref;
my $retstrref;
# Call update plugins first.
@@ -1154,17 +1174,7 @@ Usage:
# Update node's status.
setrsp_progress("Updating node status...");
my $nodelisttab = xCAT::Table->new('nodelist',-create=>1);
my (
$sec, $min, $hour, $mday, $mon,
$year, $wday, $yday, $isdst
) = localtime(time);
my $currtime = sprintf("%02d-%02d-%04d %02d:%02d:%02d",
$mon + 1, $mday, $year + 1900,
$hour, $min, $sec);
$nodelisttab->setNodeAttribs($hostname, {status=>'defined', statustime=>$currtime});
$nodelisttab->close();
xCAT::Utils->runxcmd({command=>["updatenodestat"], node=>[$hostname], arg=>['defined']}, $request_command, -1, 2);
setrsp_progress("Updated MAC address.");
}
@@ -1440,7 +1450,9 @@ Usage:
my $mactab = xCAT::Table->new("mac");
my $macsref = $mactab->getNodesAttribs(\@nodes, ['mac']);
my $nodelisttab = xCAT::Table->new("nodelist");
my $statusref = $nodelisttab->getNodesAttribs(\@nodes, ['status']);
# Get node current provisioning status.
my $provisionapp = "provision";
my $provision_status = xCAT::TableUtils->getAppStatus(\@nodes,$provisionapp);
my $rspentry;
my $i = 0;
@@ -1461,8 +1473,8 @@ Usage:
}
}
if ($statusref->{$_}->[0]){
$rspentry->{node}->[$i]->{"status"} = $statusref->{$_}->[0]->{status};
if ($provision_status->{$_}){
$rspentry->{node}->[$i]->{"status"} = $provision_status->{$_};
} else{
$rspentry->{node}->[$i]->{"status"} = "defined";
}
@@ -1626,6 +1638,8 @@ sub findme{
}
my @nodelist = keys %hostinfo_dict;
# setup node provisioning status.
xCAT::Utils->runxcmd({command=>["updatenodestat"], node=>\@nodelist, arg=>['defined']}, $request_command, -1, 2);
# call makehosts to get the IP by resolving the name
my $retref = xCAT::Utils->runxcmd({command=>["makehosts"], node=>\@nodelist, sequential=>[1]}, $request_command, 0, 2);
+1 -1
View File
@@ -250,7 +250,7 @@ sub runrollupdate_usage {
sub processArgs {
my $gotattrs = 0;
if ( defined( @{$::args} ) ) {
if ( defined ($::args) && @{$::args} ) {
@ARGV = @{$::args};
}
else {
+92 -33
View File
@@ -449,7 +449,7 @@ sub process_makeroutes {
delete_route($callback, $route_hash->{net}, $route_hash->{mask}, $gw_ip, $gw_name, $route_hash->{ifname});
}
else {
set_route($callback, $route_hash->{net}, $route_hash->{mask}, $gw_ip, $gw_name,$route_hash->{ifname});
set_route($callback, $route_hash->{net}, $route_hash->{mask}, $gw_ip, $gw_name, $route_hash->{ifname});
}
}
}
@@ -526,6 +526,7 @@ sub route_exists {
my $mask = shift;
my $gw_ip = shift;
my $gw=shift;
my $ifname = shift;
my $islinux=xCAT::Utils->isLinux();
@@ -557,7 +558,8 @@ sub route_exists {
my $net1=$a[0];
my $mask1=$a[2];
my $gw1=$a[1];
if (($net1 eq $net) && ($mask1 eq $mask) && (($gw1 eq $gw) || ($gw1 eq $gw_ip))) {
my $ifname1=$a[7];
if (($net1 eq $net) && ($mask1 eq $mask) && (($gw1 eq $gw) || ($gw1 eq $gw_ip) || ($ifname1 eq $ifname))) {
return 1;
}
}
@@ -602,20 +604,24 @@ sub set_route {
#print "set_route get called\n";
my $result;
if (!route_exists($net, $mask, $gw_ip, $gw)) {
if (!route_exists($net, $mask, $gw_ip, $gw, $ifname)) {
#set temporay route
my $cmd;
# ipv6 network
if ($net =~ /:/) {
if (xCAT::Utils->isLinux()) {
$cmd="ip -6 route add $net/$mask via $gw_ip";
if ( $gw_ip == "" || $gw_ip == "::" ) {
$cmd="ip -6 route add $net/$mask dev $ifname";
} else {
$cmd="ip -6 route add $net/$mask via $gw_ip";
}
} else {
# AIX TODO
}
} else {
if (xCAT::Utils->isLinux()) {
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$cmd="route add -net $net netmask $mask dev $ifname";
$cmd="route add -net $net netmask $mask dev $ifname";
} else {
$cmd="route add -net $net netmask $mask gw $gw_ip";
}
@@ -680,18 +686,26 @@ sub delete_route {
#print "delete_route get called\n";
my $result;
if (route_exists($net, $mask, $gw_ip, $gw)) {
if (route_exists($net, $mask, $gw_ip, $gw, $ifname)) {
#delete route temporarily
my $cmd;
if ($net =~ /:/) {
if (xCAT::Utils->isLinux()) {
$cmd = "ip -6 route delete $net/$mask via $gw_ip";
if ( $gw_ip == "" || $gw_ip == "::" ) {
$cmd = "ip -6 route delete $net/$mask dev $ifname";
} else {
$cmd = "ip -6 route delete $net/$mask via $gw_ip";
}
} else {
# AIX TODO
}
} else {
if (xCAT::Utils->isLinux()) {
$cmd="route delete -net $net netmask $mask gw $gw_ip";
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$cmd="route delete -net $net netmask $mask dev $ifname";
} else {
$cmd="route delete -net $net netmask $mask gw $gw_ip";
}
} else {
$cmd="route delete -net $net -netmask $mask $gw_ip";
}
@@ -831,14 +845,22 @@ sub addPersistentRoute_Sles {
#print "old output=" . join("\n", @output) . "\n";
my $hasConfiged=0;
if (@output && (@output > 0)) {
$hasConfiged=checkConfig_Sles($net, $mask, $gw_ip, $gw, \@output);
$hasConfiged=checkConfig_Sles($net, $mask, $gw_ip, $gw, $ifname, \@output);
}
#print "hasConfiged=$hasConfiged\n";
my $new_config;
if ($net =~ /:/) {
$new_config = "$net/$mask $gw_ip - -\n";
if ( $gw_ip == "" || $gw_ip == "::" ) {
$new_config = "$net/$mask :: - $ifname\n";
} else {
$new_config = "$net/$mask $gw_ip - -\n";
}
} else {
$new_config="$net $gw_ip $mask $ifname\n";
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$new_config="$net 0.0.0.0 $mask $ifname\n";
} else {
$new_config="$net $gw_ip $mask $ifname\n";
}
}
if (!$hasConfiged) {
push(@output, $new_config);
@@ -876,7 +898,7 @@ sub deletePersistentRoute_Sles {
my @new_output=();
my $bigfound=0;
foreach my $tmp_conf (@output) {
my $found = checkConfig_Sles($net, $mask, $gw_ip, $gw, [$tmp_conf]);
my $found = checkConfig_Sles($net, $mask, $gw_ip, $gw, $ifname, [$tmp_conf]);
if (!$found) {
push(@new_output, $tmp_conf);
} else {
@@ -913,13 +935,18 @@ sub checkConfig_Sles {
my $mask = shift;
my $gw_ip = shift;
my $gw=shift;
my $ifname=shift;
my $output=shift;
# Format:
# DESTINATION GATEWAY NETMASK INTERFACE
# DESTINATION/PREFIXLEN GATEWAY - INTERFACE
# ipv4 format: 192.168.0.0 207.68.156.51 255.255.0.0 eth1
# ipv6 format: fd59::/64 fd57:faaf:e1ab:336:21a:64ff:fe01:1 - -
foreach my $line (@$output) {
my @a=split(' ', $line);
my ($net1,$mask1,$gw1);
my ($net1,$mask1,$gw1,$ifname1);
if ($net =~ /:/) {
if (@a>0) {
my $ipv6net = $a[0];
@@ -929,6 +956,10 @@ sub checkConfig_Sles {
$gw1=$a[1];
if ($gw1 eq '-') { $gw1=$gw_ip; }
}
if (@a>3) {
$ifname1=$a[3];
if ($ifname1 eq '-') { $ifname1=$ifname;}
}
} else {
if (@a>0) {
@@ -943,10 +974,14 @@ sub checkConfig_Sles {
$mask1=$a[2];
if ($mask1 eq '-') { $mask1=$mask;}
}
if (@a>3) {
$ifname1=$a[3];
if ($ifname1 eq '-') { $ifname1=$ifname;}
}
}
#print "net=$net1,$net mask=$mask1,$mask gw=$gw1,$gw_ip\n";
if (($net1 && $net1 eq $net) && ($mask1 && $mask1 eq $mask) && (($gw1 && $gw1 eq $gw) || ($gw1 && $gw1 eq $gw_ip))) {
#print "net=$net1,$net mask=$mask1,$mask gw=$gw1,$gw_ip ifname=$ifname1\n";
if (($net1 && $net1 eq $net) && ($mask1 && $mask1 eq $mask) && (($gw1 && $gw1 eq $gw) || ($gw1 && $gw1 eq $gw_ip) || ($ifname1 && $ifname1 eq $ifname))) {
return 1;
}
}
@@ -970,13 +1005,13 @@ sub addPersistentRoute_RH {
if ($net =~ /:/) {
$filename="/etc/sysconfig/static-routes-ipv6";
} else {
$filename="/etc/sysconfig/sysconfig/route-$ifname";
$filename="/etc/sysconfig/static-routes";
}
my @output=getConfig($filename);
#print "old output=" . join("\n", @output) . "\n";
my $hasConfiged=0;
if (@output && (@output > 0)) {
$hasConfiged=checkConfig_RH($net, $mask, $gw_ip, $gw, \@output);
$hasConfiged=checkConfig_RH($net, $mask, $gw_ip, $gw, $ifname, \@output);
}
#print "hasConfiged=$hasConfiged\n";
my $new_config;
@@ -991,7 +1026,11 @@ sub addPersistentRoute_RH {
$new_config="$ifname $net/$mask $gw_ip";
} else {
$new_config="$net/$mask via $gw_ip dev $ifname\n";
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$new_config="any net $net netmask $mask dev $ifname\n";
} else {
$new_config="any net $net netmask $mask gw $gw_ip\n";
}
}
if (!$hasConfiged) {
push(@output, $new_config);
@@ -1028,14 +1067,14 @@ sub deletePersistentRoute_RH {
if ($net =~ /:/) {
$filename="/etc/sysconfig/static-routes-ipv6";
} else {
$filename="/etc/sysconfig/network-scripts/route-$ifname";
$filename="/etc/sysconfig/static-routes";
}
my @output=getConfig($filename);
#print "old output=" . join("\n", @output) . "\n";
my @new_output=();
my $bigfound=0;
foreach my $tmp_conf (@output) {
my $found = checkConfig_RH($net, $mask, $gw_ip, $gw, [$tmp_conf]);
my $found = checkConfig_RH($net, $mask, $gw_ip, $gw, $ifname, [$tmp_conf]);
if (!$found) {
push(@new_output, $tmp_conf);
} else {
@@ -1050,7 +1089,7 @@ sub deletePersistentRoute_RH {
if ($net =~ /:/) {
$rsp->{data}->[0]= "$host: Removed persistent route \"$ifname $net/$mask $gw_ip\" from $filename.";
} else {
$rsp->{data}->[0]= "$host: Removed persistent route \"$net/$mask via $gw_ip dev $ifname\" from $filename.";
$rsp->{data}->[0]= "$host: Removed persistent route \"any net $net netmask $mask gw $gw_ip $ifname\" from $filename.";
}
$callback->($rsp);
} else {
@@ -1058,7 +1097,7 @@ sub deletePersistentRoute_RH {
if ($net =~ /:/) {
$rsp->{data}->[0]= "$host: Persistent route \"$ifname $net/$mask $gw_ip\" does not exist in $filename.";
} else {
$rsp->{data}->[0]= "$host: Persistent route \"$net/$mask via $gw_ip dev $ifname\" does not exist in $filename.";
$rsp->{data}->[0]= "$host: Persistent route \"any net $net netmask $mask gw $gw_ip $ifname\" does not exist in $filename.";
}
$callback->($rsp);
}
@@ -1069,14 +1108,16 @@ sub checkConfig_RH {
my $mask = shift;
my $gw_ip = shift;
my $gw=shift;
my $ifname=shift;
my $output=shift;
foreach my $line (@$output) {
my @a=split(' ', $line);
#The format is: any net 172.16.0.0 netmask 255.240.0.0 gw 192.168.0.1 eth0
# ipv6 format: eth1 fd60::/64 fd57::214:5eff:fe15:1
my ($net1,$mask1,$gw1);
my ($net1,$mask1,$gw1,$ifname1);
if ($net =~ /:/) {
$ifname1 = $a[0];
if (@a>1) {
my $ipv6net = $a[1];
($net1,$mask1) = split("/",$ipv6net);
@@ -1094,13 +1135,18 @@ sub checkConfig_RH {
if ($mask1 eq '-') { $mask1=$mask;}
}
if (@a>6) {
$gw1=$a[6];
if ($gw1 eq '-') { $gw1=$gw_ip; }
if ( $a[5] eq 'dev' ) {
$ifname1=$a[6];
if ($ifname1 eq '-') { $ifname1=$ifname;}
} else {
$gw1=$a[6];
if ($gw1 eq '-') { $gw1=$gw_ip; }
}
}
}
#print "net=$net1,$net mask=$mask1,$mask gw=$gw1,$gw_ip\n";
if (($net1 && $net1 eq $net) && ($mask1 && $mask1 eq $mask) && (($gw1 && $gw1 eq $gw) || ($gw1 && $gw1 eq $gw_ip))) {
#print "net=$net1,$net mask=$mask1,$mask gw=$gw1,$gw_ip ifname=$ifname1,ifname\n";
if (($net1 && $net1 eq $net) && ($mask1 && $mask1 eq $mask) && (($gw1 && $gw1 eq $gw) || ($gw1 && $gw1 eq $gw_ip) || ($ifname1 && $ifname1 eq $ifname))) {
return 1;
}
}
@@ -1124,15 +1170,20 @@ sub addPersistentRoute_Debian{
#ipv6
if ( $net =~ /:/){
$cmd = "grep \"$net/$mask gw $gw_ip\" $conf_file";
$route_conf = " up route -A inet6 add $net/$mask gw $gw_ip \n down route -A inet6 del $net/$mask gw $gw_ip \n";
if ( $gw_ip == "" || $gw_ip == "::" ) {
$cmd = "grep \"$net/$mask dev $ifname\" $conf_file";
$route_conf = " up route -A inet6 add $net/$mask dev $ifname \n down route -A inet6 del $net/$mask dev $ifname \n";
} else {
$cmd = "grep \"$net/$mask gw $gw_ip\" $conf_file";
$route_conf = " up route -A inet6 add $net/$mask gw $gw_ip \n down route -A inet6 del $net/$mask gw $gw_ip \n";
}
}
else { #ipv4
$cmd = "grep \"-net $net netmask $mask gw $gw_ip\" $conf_file";
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$route_conf = " up route add -net $net netmask $mask dev $ifname \n down route del -net $net netmask $mask dev $ifname\n";
$route_conf = " up route add -net $net netmask $mask dev $ifname \n down route del -net $net netmask $mask dev $ifname \n";
} else {
$route_conf = " up route add -net $net netmask $mask gw $gw_ip \n down route del -net $net netmask $mask gw $gw_ip\n";
$route_conf = " up route add -net $net netmask $mask gw $gw_ip \n down route del -net $net netmask $mask gw $gw_ip\n";
}
}
@@ -1191,10 +1242,18 @@ sub deletePersistentRoute_Debian{
preParse_Debian();
#ipv6
if ( $net =~ /:/){
$match = "$net/$mask gw $gw_ip";
if ( $gw_ip == "" || $gw_ip == "::" ) {
$match = "$net/$mask dev $ifname";
} else {
$match = "$net/$mask gw $gw_ip";
}
}
else {
$match = "net $net netmask $mask gw $gw_ip";
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$match = "net $net netmask $mask dev $ifname";
} else {
$match = "net $net netmask $mask gw $gw_ip";
}
}
open(FH, "<", $conf_file);
+52
View File
@@ -956,6 +956,8 @@ sub mkinstall
my $tmppkgdir=$pkgdir;
my @srcdirs = split(",", $pkgdir);
$pkgdir = $srcdirs[0];
# trim the "/" in /install/sles11.3/x86_64/
$pkgdir =~ s/\/$//;
if( $pkgdir =~/^($installroot\/$os\/$arch)$/) {
$srcdirs[0]="$pkgdir/1";
$tmppkgdir=join(",", @srcdirs);
@@ -1072,6 +1074,14 @@ sub mkinstall
{
$netserver = $ent->{nfsserver};
}
if ($::XCATSITEVALS{managedaddressmode} =~ /static/){
unless($netserver eq '!myipfn!'){
my($host,$ip)=xCAT::NetworkUtils->gethostnameandip($netserver);
$netserver=$ip;
}
}
my $httpprefix = $pkgdir;
if ($installroot =~ /\/$/) { #must prepend /install/
$httpprefix =~ s/^$installroot/\/install\//;
@@ -1136,6 +1146,48 @@ sub mkinstall
$kcmdline .= " dud=file:/cus_driverdisk/$_";
}
#if site.managedaddressmode=static, specify the network configuration as kernel options
#to avoid multicast dhcp
if($::XCATSITEVALS{managedaddressmode} =~ /static/){
my ($ipaddr,$hostname,$gateway,$netmask)=xCAT::NetworkUtils->getNodeNetworkCfg($node);
unless($ipaddr) {
$callback->(
{
error => [
"cannot resolve the ip address of $node"
],
errorcode => [1]
}
);
}
if($gateway eq '<xcatmaster>'){
$gateway = xCAT::NetworkUtils->my_ip_facing($ipaddr);
}
$kcmdline .=" hostip=$ipaddr netmask=$netmask gateway=$gateway hostname=$hostname ";
my %nameservers=%{xCAT::NetworkUtils->getNodeNameservers([$node])};
my @nameserverARR=split (",",$nameservers{$node});
my @nameserversIP;
foreach (@nameserverARR)
{
my $ip;
if($_ eq '<xcatmaster>'){
$ip = xCAT::NetworkUtils->my_ip_facing($gateway);
}else{
(undef,$ip) = xCAT::NetworkUtils->gethostnameandip($_);
}
push @nameserversIP, $ip;
}
if(scalar @nameserversIP){
$kcmdline .=" dns=".join(",",@nameserversIP);
}
}
if (defined $sent->{serialport})
{
unless ($sent->{serialspeed})
+15
View File
@@ -2975,6 +2975,21 @@ sub getAttribs
# <comments>This is a comment</comments>
#</xcatrequest>
#
#
#<xcatrequest>
#<clienttype>PCM</clienttype>
#<command>setAttribs</command>
#<table>networks</table>
#<keys>
# <net>10.0.1.0</net>
# <mask>255.255.255.0</mask>
#</keys>
#<attr>
# <netname>mynet</netname>
# <gateway>10.0.1.254</gateway>
#</attr>
#</xcatrequest>
sub setAttribs
{
my $request = shift;
+89 -32
View File
@@ -14,6 +14,7 @@ use xCAT::Schema;
use Data::Dumper;
use xCAT::Utils;
use xCAT::SvrUtils;
use xCAT::Scope;
use xCAT::Usage;
use Storable qw(dclone);
use xCAT::TableUtils;
@@ -188,6 +189,7 @@ sub preprocess_updatenode
my @requests = ();
my $installdir = xCAT::TableUtils->getInstallDir();
my $localhost = hostname();
# subroutine to display the usage
sub updatenode_usage
@@ -251,20 +253,40 @@ sub preprocess_updatenode
$callback->($rsp);
return;
}
# Just generate mypostscripts file and get out
# preprocess generate mypostscripts files (-g) for hierarchy
# if no sharedtftp then we need to broadcast this updatenode -g to all service nodes inorder
# to be able to support service node pools
#
if ($::GENMYPOST)
{
# precreatemypostscript has to be yes/1 or do nothing
my @entries = xCAT::TableUtils->get_site_attribute("precreatemypostscripts");
if ($entries[0] ) {
$entries[0] =~ tr/a-z/A-Z/;
if ($entries[0] =~ /^(1|YES)$/ ) {
my $notmpfiles=1;
my $nofiles=0;
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
my $rsp = {};
$rsp->{data}->[0] = "Generated new mypostscript files";
$callback->($rsp);
# now check if sharedtftp = 0, if it is we need to broadcast to all the servicenode
# if there are service nodes
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $t_entry = $entries[0];
if ( defined($t_entry) and ($t_entry eq "0" or $t_entry eq "no" or $t_entry eq "NO")) {
# see if there are any servicenodes. If so then run updatenode -g on all of them
my @SN;
my @CN;
my $nodes = $request->{node};
xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN);
if (@CN >0 ) { # if compute nodes broadcast to all servicenodes
return xCAT::Scope->get_broadcast_scope($request,@_);
}
} else { # sharedtftp=yes, just run on MN
my $notmpfiles=1;
my $nofiles=0;
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
my $rsp = {};
$rsp->{data}->[0] = "Generated new mypostscript files on $localhost";
$callback->($rsp);
return 0;
}
} else { # not valid unless precreatemypostscripts enabled
my $rsp = {};
$rsp->{error}->[0] =
@@ -273,7 +295,7 @@ sub preprocess_updatenode
$callback->($rsp);
return ;
}
} else { # not in the site table
} else { # precreatemypostscripts not in the site table
my $rsp = {};
$rsp->{error}->[0] =
"This option is only valid if site table precreatemypostscripts attribute is 1 or YES";
@@ -281,8 +303,9 @@ sub preprocess_updatenode
$callback->($rsp);
return ;
}
return 0;
}
} # end GENMYPOST
# -c must work with -S for AIX node
if ($::CMDLINE && !$::SWMAINTENANCE)
@@ -1010,27 +1033,6 @@ sub updatenode
}
#create each /tftpboot/mypostscript/mypostscript.<nodename> for each node
# This first removes the old one if precreatemypostscripts =0 or undefined
# call create files but no tmp files
my $notmpfiles=1;
my $nofiles=0;
#my $nofiles=1;
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
# convert the hashes back to the way they were passed in
my $flatreq = xCAT::InstUtils->restore_request($request, $callback);
my $imgdefs;
my $updates;
if ($flatreq->{imagedef})
{
$imgdefs = $flatreq->{imagedef};
}
if ($flatreq->{updateinfo})
{
$updates = $flatreq->{updateinfo};
}
# get the NIM primary server name
my $nimprime = xCAT::InstUtils->getnimprime();
chomp $nimprime;
@@ -1043,6 +1045,7 @@ sub updatenode
'A|updateallsw' => \$::ALLSW,
'c|cmdlineonly' => \$::CMDLINE,
'd=s' => \$::ALTSRC,
'g|genmypost' => \$::GENMYPOST,
'h|help' => \$::HELP,
'v|version' => \$::VERSION,
'V|verbose' => \$::VERBOSE,
@@ -1085,6 +1088,60 @@ sub updatenode
$::attrres{$attr} = $value;
}
}
# Just generate mypostscripts file and get out
if ($::GENMYPOST)
{
my @entries = xCAT::TableUtils->get_site_attribute("precreatemypostscripts");
if ($entries[0] ) {
$entries[0] =~ tr/a-z/A-Z/;
if ($entries[0] =~ /^(1|YES)$/ ) {
my $notmpfiles=1;
my $nofiles=0;
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
my $rsp = {};
$rsp->{data}->[0] = "Generated new mypostscript files on $localhostname";
$callback->($rsp);
} else { # not valid unless precreatemypostscripts enabled
my $rsp = {};
$rsp->{error}->[0] =
"This option is only valid if site table precreatemypostscripts attribute is 1 or YES";
$rsp->{errorcode}->[0] =1;
$callback->($rsp);
return ;
}
} else { # not in the site table
my $rsp = {};
$rsp->{error}->[0] =
"This option is only valid if site table precreatemypostscripts attribute is 1 or YES";
$rsp->{errorcode}->[0] =1;
$callback->($rsp);
return ;
}
return 0;
}
#create each /tftpboot/mypostscript/mypostscript.<nodename> for each node
# This first removes the old one if precreatemypostscripts =0 or undefined
# call create files but no tmp files
my $notmpfiles=1;
my $nofiles=0;
#my $nofiles=1;
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
# convert the hashes back to the way they were passed in
my $flatreq = xCAT::InstUtils->restore_request($request, $callback);
my $imgdefs;
my $updates;
if ($flatreq->{imagedef})
{
$imgdefs = $flatreq->{imagedef};
}
if ($flatreq->{updateinfo})
{
$updates = $flatreq->{updateinfo};
}
# if not just using the -k flag, then set all nodes to syncing in
# nodelist updatestatus for the other updatenode options
if (!($::SECURITY)) {
File diff suppressed because it is too large Load Diff
+183
View File
@@ -0,0 +1,183 @@
#!/usr/bin/perl
package xCAT_plugin::vlan;
BEGIN
{
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
}
use lib "$::XCATROOT/lib/perl";
use strict;
use warnings "all";
use xCAT::GlobalDef;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::SvrUtils;
use xCAT::Usage;
use xCAT::NodeRange;
sub handled_commands {
return {
mkvlan => 'switch:vlan,port,switch', # in progress
chvlan => 'switch:vlan,port,switch', # in progress
lsvlan => 'switch:vlan,port,switch', # in progress
rmvlan => 'switch:vlan,port,switch', # in progress
}
}
use POSIX "WNOHANG";
use IO::Handle;
use IO::Socket;
use IO::Select;
#local to module
my $callback;
my $timeout;
my $port;
my $debug;
my $ndebug = 0;
my $sock;
my $noclose;
my %sessiondata; #hold per session variables, in preparation for single-process strategy
my %pendingtransactions; #list of peers with callbacks, callback arguments, and timer expiry data
my $enable_cache="yes";
my $cache_dir = "/var/cache/xcat";
my $vlanid;
sub process_request
{
my $req = shift;
my $callback = shift;
my $reqcmd = shift;
if ($command eq 'mkvlan')
{
return mkvlan($req, $callback, $reqcmd);
}
elsif ($command eq 'chvlan')
{
return chvlan($req, $callback, $reqcmd);
}
elsif ($command eq 'lsvlan')
{
return lsvlan($req, $callback, $reqcmd);
}
elsif ($command eq 'rmvlan')
{
return rmvlan($req, $callback, $reqcmd);
}
}
sub mkvlan
{
my $request = shift;
my $callback = shift;
my $reqcmd = shift;
# Variables for this function
my $vlanid;
# A quick function for usage information for the command
my $mkvlan_usage = sub {
my $exitcode = shift @_;
my %rsp;
push @{$rsp{data}}, "Usage: mkvlan [vlanid] -n noderange [-t subnet | -m netmask | -i interface]";
push @{$rsp{data}}, " mkvlan [-?|-h|--help]";
if ($exitcode) { $rsp{errorcode} = $exitcode; }
$callback->(\%rsp);
};
# Go through the arguments, and get the relevant information
@ARGV = @{$req->{arg}};
#Detect if the first variable is a number or not, as it may be the vlanid
if ($ARGV[0] !~ /\D/) {$vlanid=$ARGV[0];}
GetOptions(
't=s' => \$subnet,
'm=s' => \$mask,
'n=s' => \$noderange,
'i=s' => \$interface,
'h|?|help' => \$help,
'v|version' => \$VERSION,
);
# Show usage info if help is defined
if ($help) { $mkvlan_usage->(0); return;}
# Node range must be defined
if (!defined($noderange)) { $mkvlan_usage->(1); return;}
# Display the version of the code
if ($VERSION) {
my %rsp;
my $version = xCAT::Utils->Version();
$rsp{data}->[0] = "$version";
$cb->(\%rsp);
return;
}
# put the nodes in an array
my @nodes = split(/,/,$noderange);
my $swtab = xCAT::Table->new('switch');
my $swhash = $swtab->getNodesAttribs(\@nodes,['switch','vlan','port','interface']);
foreach (@nodes)
{
my $node = $_;
foreach (@$swhash->{$node})
{
my $nswhash = $_;
my $switch = $nswhash->{'switch'};
my $vlan = $nswhash->{'vlan'};
my $port = $nswhash->{'port'};
my $swinterface = $nswhash->{'interface'};
if ($vlanid == "" || !defined($vlanid)) {$vlanid = $vlan;}
if ($interface == "" || !defined($interface)) { $interface = $swinterface;}
}
}
sub lsvlan
{
my $request = shift;
my $callback = shift;
my $reqcmd = shift;
my @args = @{$req->{arg}} if(exists($req->{arg}));
# A quick function for usage information for the command
my $lsvlan_usage = sub {
my $exitcode = shift @_;
my %rsp;
push @{$rsp{data}}, "Usage: mkvlan vlanid";
push @{$rsp{data}}, " mkvlan [-?|-h|--help]";
if ($exitcode) { $rsp{errorcode} = $exitcode; }
$callback->(\%rsp);
};
# Go through the arguments, and get the relevant information
@ARGV = @{$req->{arg}};
#Detect if the first variable is a number or not, as it may be the vlanid
if ($ARGV[0] !~ /\D/) {$vlanid=$ARGV[0];}
GetOptions(
'h|?|help' => \$help,
);
# Show usage info if help is defined
if ($help) { $lsvlan_usage->(0); return; }
# Show usage if we have less then 2 arguments, or the vlan option is not defined
if (scalar(@ARGV)<1 || !defined($vlanid)) { $lsvlan_usage->(1); return; }
}
1;
+1 -1
View File
@@ -412,7 +412,7 @@ sub mkinstall
$custmplpath = "$installroot/custom/install/hyperv";
$tmplpath = "$::XCATROOT/share/xcat/install/hyperv";
}
my $tmplfile=xCAT::SvrUtils::get_tmpl_file_name($custmplpath, $profile, $os, $arch);
$tmplfile=xCAT::SvrUtils::get_tmpl_file_name($custmplpath, $profile, $os, $arch);
if (! $tmplfile) { $tmplfile=xCAT::SvrUtils::get_tmpl_file_name($tmplpath, $profile, $os, $arch); }
}
+2 -2
View File
@@ -199,7 +199,7 @@ sub prexcat2nim
my @nodelist=(); # pass back list of nodes - if applicable
my @servicenodes=(); # pass back list of service nodes - if applicable
if (defined(@{$::args})) {
if ( defined ($::args) && @{$::args} ) {
@ARGV = @{$::args};
} else {
&xcat2nim_usage($callback);
@@ -359,7 +359,7 @@ sub processArgs
my $gotattrs = 0;
if (defined(@{$::args})) {
if ( defined ($::args) && @{$::args} ) {
@ARGV = @{$::args};
} else {
return 3;
+38 -2
View File
@@ -131,6 +131,16 @@ sub process_request
&usage($callback,$command);
exit 1;
}
# if the ARGS still have data we have invalid input
if (@ARGV) {
my $args=join(',', @ARGV);
my $rsp = {};
$rsp->{error}->[0] =
"The input to the command: $command contained invalid arguments: $args.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
exit 1;
}
if ($options{'help'})
{
&usage($callback,$command);
@@ -170,6 +180,14 @@ sub process_request
}
}
}
# cannot enter -K and -k
if (($options{'sshkeypath'}) && ($options{'gensshkeys'})) {
my $rsp = {};
$rsp->{error}->[0] =
"The input of -k and -K is not valid on the command : $command.";
xCAT::MsgUtils->message("E", $rsp, $callback);
exit 1;
}
# check for site.sshbetweennodes attribute, put out a warning it will not be used as long
# as zones are defined in the zone table.
@@ -473,6 +491,18 @@ sub rmzone
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
# see if they input invalid flags
if (($$options{'sshkeypath'}) || ($$options{'gensshkeys'}) ||
( $$options{'addnoderange'}) || ( $$options{'rmnoderange'}) ||
( $$options{'defaultzone'}) ||
($$options{'sshbetweennodes'})) {
my $rsp = {};
$rsp->{error}->[0] =
"The following flags are not valid input for the rmzone command: -k,-K,-a,-r,-f,-s ";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
# check to see if the input zone already exists
# cannot remove it if it is not defined
my $zonename=$request->{zonename};
@@ -590,11 +620,11 @@ sub usage
my $usagemsg2="";
if ($command eq "mkzone") {
$usagemsg1 = " mkzone -h \n mkzone -v \n";
$usagemsg2 = " mkzone <zonename> [-V] [--defaultzone] [-k <full path to the ssh RSA private key] \n [-a <noderange>] [-g] [-f] [-s <yes/no>]";
$usagemsg2 = " mkzone <zonename> [-V] [--defaultzone] [-k <full path to the ssh RSA private key>] \n [-a <noderange>] [-g] [-f] [-s <yes/no>]";
} else {
if ($command eq "chzone") {
$usagemsg1 = " chzone -h \n chzone -v \n";
$usagemsg2 = " chzone <zonename> [-V] [--defaultzone] [-k <full path to the ssh RSA private key] \n [-K] [-a <noderange>] [-r <noderange>] [-g] [-s <yes/no>]";
$usagemsg2 = " chzone <zonename> [-V] [--defaultzone] [-k <full path to the ssh RSA private key>] \n [-K] [-a <noderange>] [-r <noderange>] [-g] [-s <yes/no>]";
} else {
if ($command eq "rmzone") {
$usagemsg1 = " rmzone -h \n rmzone -v \n";
@@ -705,6 +735,9 @@ sub addtozonetable
my $curdefaultzone = xCAT::Zone->getdefaultzone($callback);
if (!(defined ($curdefaultzone))) { # no default defined
$tb_cols{defaultzone} ="yes";
$tab->setAttribs({zonename => $zonename}, \%tb_cols);
$tab->commit();
$tab->close();
} else { # already a default
if ($$options{'force'}) { # force the default
$tb_cols{defaultzone} ="yes";
@@ -780,6 +813,9 @@ sub updatezonetable
my $curdefaultzone = xCAT::Zone->getdefaultzone($callback);
if (!(defined ($curdefaultzone))) { # no default defined
$tb_cols{defaultzone} ="yes";
$tab->setAttribs({zonename => $zonename}, \%tb_cols);
$tab->commit();
$tab->close();
} else { # already a default
if ($$options{'force'}) { # force the default
$tb_cols{defaultzone} ="yes";
+1
View File
@@ -12,6 +12,7 @@ use Getopt::Long;
use strict;
#This or something like this must always be available and not depend on server
#Otherwise, can't set things to let server run in the first place
#
sub usage {
print "Usage:\n";
+5 -93
View File
@@ -1020,44 +1020,6 @@ sub genSSHNodeHostKey
}
# is_lsb_ubuntu return value indicates whether system appears to be Ubuntu.
# Using required /etc/lsb-release file, instead of optional lsb_release command.
sub is_lsb_ubuntu
{
if (open(my $relfile, "<", "/etc/lsb-release")) {
my @text = <$relfile>;
close($relfile);
chomp(@text);
my $distrib_id = '';
foreach (@text) {
if ( $_ =~ /^\s*DISTRIB_ID=(.*)$/ ) {
$distrib_id = $1; # last DISTRIB_ID value in file used
}
}
if ( $distrib_id =~ /^(Ubuntu|"Ubuntu")\s*$/ ) {
return 1; # return "true"
}
}
return 0; # return "false"
}
sub is_debian
{
if ( -e "/etc/debian_version" && -e "/etc/issue"){
open(my $relfile, "<", "/etc/issue");
my $line = <$relfile>;
close($relfile);
if ( $line =~ /debian.*/i ){
return 1;
}
}
return 0;
}
sub is_redhat6sp4
{
if( -e "/etc/redhat-release" ){
@@ -1072,21 +1034,6 @@ sub is_redhat6sp4
}
# on Ubuntu need to painstakingly compare /etc/localtime with files under
# /usr/share/zoneinfo since /etc/localtime # isn't always a symbolic link
sub discover_timezone_ubuntu
{
my $localtime = "/etc/localtime";
my $zoneinfo = "/usr/share/zoneinfo";
my $zone_result = `find $zoneinfo -type f -exec cmp -s $localtime {} \\; -print | grep -v posix | grep -v SystemV`;
my @zones = split /\n/, $zone_result;
$zones[0] =~ s/$zoneinfo\///;
return $zones[0];
}
#-----------------------------------------------------------------------------
@@ -1158,6 +1105,7 @@ sub initDB
# set value based on OS
my ($domain, $timezone);
my $timezone = xCAT::Utils->gettimezone();
if ($::osname eq 'AIX')
{
my ($name, $rest) = split('\.', $hname);
@@ -1170,35 +1118,10 @@ sub initDB
$domain = "";
}
$timezone = $ENV{'TZ'};
}
else # linux
{
$domain = `hostname -d`;
my $tz;
if (-f "/etc/redhat-release")
{
# on Redhat look for "ZONE"
$tz =
`grep ^ZONE /etc/sysconfig/clock|cut -d= -f 2|sed -e 's/"//g'`;
}
elsif ( is_lsb_ubuntu() || is_debian() )
{
$tz = discover_timezone_ubuntu;
if (!$tz){
$tz = `cat /etc/timezone`;
chomp $tz;
}
}
else
{
# on SuSE look for "TIMEZONE"
$tz =
`grep ^TIMEZONE /etc/sysconfig/clock|cut -d= -f 2|sed -e 's/"//g'`;
}
$timezone = $tz;
}
chomp $timezone;
@@ -1973,6 +1896,7 @@ sub setuphttp
{
my $cmd;
my $distro = xCAT::Utils->osver();
# restart httpd
if (-e "/etc/init.d/apache2")
{ #for sles/ubuntu
@@ -2000,8 +1924,7 @@ sub setuphttp
# enable httpd
if (-e "/etc/init.d/apache2")
{
if (is_lsb_ubuntu() || is_debian() )
{ # for ubuntu
if ( $distro =~ /ubuntu.*/ || $distro =~ /debian.*/i) {
$cmd = "/usr/sbin/update-rc.d apache2 enable";
}
else
@@ -2009,18 +1932,6 @@ sub setuphttp
$cmd = "/sbin/chkconfig apache2 on";
}
}
# elsif (-e "/sbin/chkconfig")
# {
# $cmd = "/sbin/chkconfig httpd on";
# }
# elsif (-e "/usr/sbin/chkconfig")
# {
# $cmd = "/usr/sbin/chkconfig httpd on";
# }
# else
# {
# $cmd = "chkconfig httpd on";
# }
else
{
my $CHKCONFIG = xCAT::Utils->fullpathbin("chkconfig");
@@ -2253,6 +2164,7 @@ sub setupMNinDB
sub startnamedonboot
{
# start named on boot
my $distro = xCAT::Utils->osver();
if (xCAT::Utils->isAIX())
{
#/etc/inittab
@@ -2272,7 +2184,7 @@ sub startnamedonboot
#chkconfig
my $serv = "named";
my $cmd = "/sbin/chkconfig $serv on";
if ( is_lsb_ubuntu() || is_debian() ){
if ( $distro =~ /ubuntu.*/ || $distro =~ /debian.*/i) {
$serv = "bind9";
$cmd = "update-rc.d $serv enable";
}
+63 -22
View File
@@ -328,35 +328,42 @@ sleep 0.05; #up to 50 ms outage possible
my $conn;
next unless $conn = $socket->accept;
my @clients;
if ($inet6support) {
@clients = gethostbyaddr($conn->peeraddr,AF_INET6);
unless (@clients) { @clients = gethostbyaddr($conn->peeraddr,AF_INET); }
} else {
@clients = gethostbyaddr($conn->peeraddr,AF_INET);
}
my $client_name;
my $client_aliases;
my @clients;
if ($inet6support) {
($client_name,$client_aliases) = gethostbyaddr($conn->peeraddr,AF_INET6);
unless ($client_name) { ($client_name,$client_aliases) = gethostbyaddr($conn->peeraddr,AF_INET); }
} else {
($client_name,$client_aliases) = gethostbyaddr($conn->peeraddr,AF_INET);
}
$clients[0] = $client_name;
if ($client_aliases) {
push @clients, split(/\s+/,$client_aliases);
}
my $validclient=0;
my $node;
my $domain;
my $nd = xCAT::NetworkUtils->getNodeDomains(\@clients);
my %nodedomains = %{$nd};
foreach my $client (@clients) {
$domain = $nodedomains{$client};
my @ndn = ($client);
my $nd = xCAT::NetworkUtils->getNodeDomains(\@ndn);
my %nodedomains = %{$nd};
$domain = $nodedomains{$client};
$client =~ s/\..*//;
if ($domain) {
$client =~ s/\.$domain//;
} else {
$client =~ s/\..*//;
if ($domain) {
$client =~ s/\.$domain//;
} else {
$client =~ s/\..*//;
}
#ensure this is coming from a node IP at least
($node) = noderange($client);
if ($node) { #Means the source isn't valid
$validclient=1;
last;
}
}
#ensure this is coming from a node IP at least
($node) = noderange($client);
if ($node) { #Means the source isn't valid
$validclient=1;
last;
}
}
unless ($validclient) {
@@ -2089,6 +2096,40 @@ sub service_connection {
delete($req->{becomeuser}); #Remove it to keep it from view
}
# If the request is to aquire a token for a specific account
if (defined $req->{gettoken}) {
# authencitate the username:password
$peername=becomeuser($req->{gettoken}->[0]->{username}->[0],
$req->{gettoken}->[0]->{password}->[0]);
my $resp;
if ($peername) {
# for a valid account, get a token
my ($tokenid, $exptime) = xCAT::xcatd->gettoken($req);
my ($sec,$min,$hour,$mday,$mon,$year) = localtime($exptime);
$year += 1900;
my $htime = "$year-$mon-$mday $hour:$min:$sec";
$resp = {data=>[{token => [{id => $tokenid, expire => $htime}]}]};
} else {
$resp={error=>["Authentication failure"],errorcode=>[1]};
}
$resp->{serverdone}=[ undef ] ;
send_response($resp,$sock);
return;
}
# If user trying to use 'token' to authenticate
if (defined $req->{tokens}) {
# get the valid user name by the token id
$peername = xCAT::xcatd->verifytoken($req);
unless (defined $peername) {
my $resp={error=>["Authentication failure"],errorcode=>[1]};
$resp->{serverdone}=[ undef ] ;
send_response($resp,$sock);
return;
}
delete($req->{tokenid});
}
#we have a full request..
#printf $request."\n";
$request="";
+1 -2
View File
@@ -67,7 +67,7 @@ cert_opt = ca_default # Certificate field options
default_days = 7300 # how long to certify for
default_crl_days= 30 # how long before next CRL
default_md = sha256 # which md to use.
default_md = sha1 # which md to use.
preserve = no # keep passed DN ordering
# A few difference way of specifying how similar the request should look
@@ -98,7 +98,6 @@ emailAddress = optional
####################################################################
[ req ]
default_md = sha256
default_bits = 2048
default_keyfile = private/ca-key.pem
distinguished_name = req_distinguished_name
+2 -2
View File
@@ -72,12 +72,12 @@ release_lock();
my ($user,$pass);
if ($username) {
$user = "-U $username";
$user = "-U '$username'";
} else {
$user = '';
}
if ($password) {
$pass = "-P $password";
$pass = "-P '$password'";
} else {
$pass = '';
}
@@ -27,7 +27,7 @@ rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password#
#partition / --ondisk=/dev/mapper/ibmpkvm_vg_root-ibmpkvm_lv_root
partition / --ondisk=/dev/sda
network --device eth0 --bootproto dhcp
network --bootproto dhcp
%post
touch "/startpost"
@@ -1,7 +1,8 @@
#
lang en_US
network --bootproto dhcp
#network --bootproto dhcp
#KICKSTARTNET#
#
# Where's the source?
@@ -1,6 +1,10 @@
#!/bin/sh
export MANAGEDADDRESSMODE="#XCATVAR:MANAGEDADDRESSMODE#"
cd /etc/sysconfig/network
if [ "$MANAGEDADDRESSMODE" != "static" ]
then
rm -f ifcfg-eth-id*
rm -f ifcfg-myri*
cat >ifcfg-eth0 <<EOF
@@ -8,7 +12,7 @@ DEVICE=eth0
BOOTPROTO=dhcp
STARTMODE=onboot
EOF
fi
. /tmp/prinicsetting
rm /tmp/prinicsetting
if [ "$PRINIC" != "eth0" ]
@@ -22,7 +26,12 @@ then
# echo "DHCLIENT_PRIMARY_DEVICE=yes" >> ifcfg-$PRINIC
fi
fi
if [ "$MANAGEDADDRESSMODE" != "static" ]
then
echo "DHCLIENT_PRIMARY_DEVICE=yes" >> ifcfg-$PRINIC
fi
perl -pi -e 's/^FIREWALL="yes"/FIREWALL="no"/' /etc/sysconfig/network/config
/etc/init.d/network restart
@@ -182,9 +182,10 @@ addsiteyum
/xcatpost/mypostscript
sed -i 's/^serial/#serial/' /boot/grub/grub.conf
sed -i 's/^terminal/#terminal/' /boot/grub/grub.conf
if [ -z "$NODESTATUS" ] || [ "$NODESTATUS" != "0" -a "$NODESTATUS" != "N" -a "$NODESTATUS" != "n" ]; then
updateflag.awk $MASTER 3002
fi
#the following command should always be run to prevent infinite installation loops
updateflag.awk $MASTER 3002
cd /
#rm -Rf /xcatpost
#rm -f /xcatpost/mypostscript
@@ -184,7 +184,7 @@ if [ -z "$instdisk" ]; then
"ata_piix4"|"PMC MaxRAID"|"ahci"|"megaraid_sas") #certainly direct
if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resort
;;
"mptsas"|"mpt2sas") #*PROBABLY* not SAN, but SAS SAN is possible
"mptsas"|"mpt2sas"|"mpt3sas") #*PROBABLY* not SAN, but SAS SAN is possible
if [ -z "$probablyfirstdirectdisk" ]; then probablyfirstdirectdisk=$disk; fi #remember first disk as a guess of medium resort
;;
*)
@@ -219,7 +219,10 @@ if [ `uname -m` = "ppc64" ]; then
echo 'part None --fstype "PPC PReP Boot" --ondisk '$instdisk' --size 8' >> /tmp/partitioning
fi
if [ -d /sys/firmware/efi ]; then
echo 'bootloader --driveorder='$instdisk >> /tmp/partitioning
echo 'part /boot/efi --size 50 --ondisk '$instdisk' --fstype vfat' >> /tmp/partitioning
else
echo 'bootloader' >> /tmp/partitioning
fi
#TODO: ondisk detection, /dev/disk/by-id/edd-int13_dev80 for legacy maybe, and no idea about efi. at least maybe blacklist SAN if mptsas/mpt2sas/megaraid_sas seen...
@@ -159,7 +159,7 @@ if [ -z "$instdisk" ]; then
"ata_piix4"|"PMC MaxRAID"|"ahci"|"megaraid_sas") #certainly direct
if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resort
;;
"mptsas"|"mpt2sas") #*PROBABLY* not SAN, but SAS SAN is possible
"mptsas"|"mpt2sas"|"mpt3sas") #*PROBABLY* not SAN, but SAS SAN is possible
if [ -z "$probablyfirstdirectdisk" ]; then probablyfirstdirectdisk=$disk; fi #remember first disk as a guess of medium resort
;;
*)
@@ -145,7 +145,7 @@ if [ -z "$instdisk" ]; then
"ata_piix4"|"PMC MaxRAID"|"ahci"|"megaraid_sas") #certainly direct
if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resort
;;
"mptsas"|"mpt2sas") #*PROBABLY* not SAN, but SAS SAN is possible
"mptsas"|"mpt2sas"|"mpt3sas") #*PROBABLY* not SAN, but SAS SAN is possible
if [ -z "$probablyfirstdirectdisk" ]; then probablyfirstdirectdisk=$disk; fi #remember first disk as a guess of medium resort
;;
*)
@@ -0,0 +1,148 @@
#!/bin/sh
if [ ! -c /dev/vcs ]; then
mknod /dev/vcs c 7 0
fi
debconf-get open-iscsi/targets > /tmp/q
cat >/tmp/foo.sh <<EOF
#!/bin/sh
#
# If no arguments:
#
# 1) Start child process to connect as client to master, and re-execute this script to send
# "installmonitor" to master. Do not wait for child process.
#
# 2) Loop forever. For each iteration, start child process as server waiting for a client
# connection. Once a connection is established, child process re-executes this script to
# handle request from that particular client.
#
if [ \$# -eq 0 ]; then
xcatdhost="#XCATVAR:XCATMASTER#"
xcatdport="#TABLE:site:key=xcatiport:value#"
NODESTATUS="#TABLEBLANKOKAY:site:key=nodestatus:value#"
/usr/bin/nc "\$xcatdhost" "\$xcatdport" -e /tmp/foo.sh install_monitor &
if [ -z "\$NODESTATUS" ] || [ "\$NODESTATUS" != "0" -a "\$NODESTATUS" != "N" -a "\$NODESTATUS" != "n" ];
then
/usr/bin/nc "\$xcatdhost" "\$xcatdport" -e /tmp/foo.sh installstatus installing &
fi
while true; do
/usr/bin/nc -l -p 3001 -e /tmp/foo.sh serve_client
done
exit 1 # never reached; reboot ends this
fi
#
# If the script was called with the "install_monitor" argument, stdin and stdout are
# connected to an xCAT daemon on the master. Write the "installmonitor" request to the
# daemon.
#
if [ "\$1" = "install_monitor" ]; then
cmd=""
while [ "\$cmd" != "done" ]; do
read cmd remainder
if [ "\$cmd" == "ready" ]; then
echo "installmonitor"
fi
done
exit 0
fi
#
# If the script was called with the "installstatus" argument, stdin and stdout are
# connected to an xCAT daemon on the master.
# Write the "installstatus xx" request to the daemon to update thenode installation status.
if [ "\$1" = "installstatus" ]; then
cmd=""
while [ "\$cmd" != "done" ]; do
read cmd remainder
if [ "\$cmd" == "ready" ]; then
echo "installstatus \$2"
fi
done
exit 0
fi
#
# When execution reaches here, script called with "serve_client" argument, which means
# stdin and stdout are connected to a client. Read the request from the client, provide
# the answer to the client, and terminate.
#
read cmd arg remainder
case "\$cmd" in
# "sh") #TODO: ENABLE IF DEBUG
# output=\$(eval \$arg \$remainder)
# echo "\$output"
# echo "EOO"
# ;;
"screendump")
output=\$(eval chvt \$arg; cat /dev/vcs)
echo "\$output"
;;
"stat")
sedcmds='/^[^ ]+ +[^ ]+ +install /h; \${ g; s,^[^ ]+ +[^ ]+ +install +([^ ]+) +[^ ]+ ([^ ]+).*,installing \1 \2,; p }'
output=\$(sed -nre "\$sedcmds" /target/var/log/dpkg.log 2>/dev/null)
if [ -z "\$output" ]; then
output="installing prep"
fi
echo "\$output"
;;
esac
exit 0
EOF
chmod 755 /tmp/foo.sh
/tmp/foo.sh >/tmp/foo.log 2>&1 &
if [ -d /sys/firmware/efi ]; then
echo "ubuntu-efi ::" > /tmp/partitioning
echo " 512 512 1024 fat16" >> /tmp/partitioning
echo ' $iflabel{ gpt } $reusemethod{ } method{ efi } format{ }' >> /tmp/partitioning
echo " ." >> /tmp/partitioning
else
echo "ubuntu-boot ::" > /tmp/partitioning
echo "8 1 1 prep" >> /tmp/partitioning
echo ' $primary{ } $bootable{ } method{ prep }' >> /tmp/partitioning
echo " ." >> /tmp/partitioning
echo "100 50 100 ext4" >> /tmp/partitioning
echo ' $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } filesystem{ ext4 } mountpoint{ /boot }' >> /tmp/partitioning
echo " ." >> /tmp/partitioning
fi
echo "500 10000 1000000000 ext4" >> /tmp/partitioning
echo " method{ format } format{ } use_filesystem{ } filesystem{ ext4 } mountpoint{ / }" >> /tmp/partitioning
echo " ." >> /tmp/partitioning
echo "2048 512 300% linux-swap" >> /tmp/partitioning
echo " method{ swap } format{ }" >> /tmp/partitioning
echo " ." >> /tmp/partitioning
exit 0
@@ -63,25 +63,7 @@
<surname/>
</user>
</users>
<networking>
<dns>
<dhcp_hostname config:type="boolean">true</dhcp_hostname>
<dhcp_resolv config:type="boolean">true</dhcp_resolv>
<domain>local</domain>
<hostname>linux</hostname>
</dns>
<interfaces config:type="list">
<interface>
<bootproto>dhcp</bootproto>
<device>eth0</device>
<startmode>onboot</startmode>
</interface>
</interfaces>
<routing>
<ip_forward config:type="boolean">false</ip_forward>
<routes config:type="list"/>
</routing>
</networking>
#YAST2NET#
<scripts>
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.sles#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/chroot.sles#
@@ -1,138 +0,0 @@
#!/bin/sh
#
# stateless
#
# chkconfig: 345 11 99
# description: action stateless
#
# Source the library functions
. /etc/rc.d/init.d/functions
ZONE="US/Mountain"
case "$1" in
start)
echo -n "Starting stateless configuration: "
if [ -r /etc/stateless_done ]
then
echo_failure
echo
echo " already run!"
exit $?
fi
#initrd=xcat/netboot/fedora8/x86_64/compute/initrd.gz imgurl=nfs://rro000/install/netboot/fedora8/x86_64/compute/rootimg console=ttyS1,19200n8r BOOT_IMAGE=xcat/netboot/fedora8/x86_64/compute/kernel
cat /proc/cmdline | grep imgurl >/dev/null 2>&1
if [ "$?" != "0" ]
then
echo_failure
echo
echo " imgurl missing from /proc/cmdline, i.e. stateful!"
exit $?
fi
for i in $(cat /proc/cmdline)
do
KEY=$(echo $i | awk -F= '{print $1}')
VALUE=$(echo $i | awk -F= '{print $2}')
if [ "$KEY" = "imgurl" ]
then
SERVER=$(echo $VALUE | awk -F/ '{print $3}')
fi
done
if [ -z "$SERVER" ]
then
echo_failure
echo
echo "bogus server in imgurl"
exit $?
fi
echo
echo " Universal Server: $SERVER"
echo -n " Syslog: "
echo "*.* @$SERVER" >/etc/rsyslog.conf
echo_success
echo
if [ -r /etc/rc.d/init.d/ntpd ]
then
echo -n " NTP: "
if [ ! -r /etc/sysconfig/clock ]
then
echo "ZONE=\"$ZONE\"
UTC=true
ARC=false" >/etc/sysconfig/clock
fi
echo "server $SERVER
driftfile /etc/ntp/drift
multicastclient
broadcastdelay 0.008
disable auth
keys /etc/ntp/keys
trustedkey 65535
requestkey 65535
controlkey 65535" >/etc/ntp.conf
echo "$SERVER" >/etc/ntp/step-tickers
echo_success
echo
fi
if [ -r /etc/ldap.conf -a -r /etc/resolv.conf ]
then
echo -n " LDAP: "
DC=$(
cat /etc/resolv.conf | \
egrep '(domain|search)' | \
head -1 | \
awk '{print $2}' | \
sed 's/\./,dc=/g' | \
sed 's/^/dc=/'
)
echo "host $SERVER
base $DC
nss_base_passwd ou=People,$DC
nss_base_shadow ou=People,$DC
nss_base_group ou=Group,$DC
timelimit 120
bind_timelimit 120
idle_timelimit 3600
nss_initgroups_ignoreusers root,ldap,named,avahi,haldaemon,dbus,radvd,tomcat,radiusd,news,mailman,nscd
ssl no
tls_cacertdir /etc/openldap/cacerts
pam_password md5" >/etc/ldap.conf
echo "URI ldap://$SERVER
BASE $DC
TLS_CACERTDIR /etc/openldap/cacerts" >/etc/openldap/ldap.conf
cd /etc
cp nsswitch.conf nsswitch.conf.ORIG
sed -r 's/^((passwd|shadow|group):.*)/\1 ldap/' <nsswitch.conf.ORIG >nsswitch.conf
cd /etc/pam.d
cp system-auth system-auth.ORIG
sed -r 's/(account\s+required\s+pam_unix.so)/account sufficient pam_ldap.so\n\1/' <system-auth.ORIG >system-auth
echo_success
echo
fi
touch /etc/stateless_done
;;
stop)
;;
*)
echo "Usage: stateless {start|stop}"
exit 1
esac
@@ -1,170 +0,0 @@
################################################################################
# Create a generic HPC image
# This script is an example of how to create an HPC image with xCAT stateless.
# in this example you may need to change some of the parameters. In the future
# we should probably place this in the database...
# All good sys admins can reproduce their environments. Creating a stateless
# image should be reproducable. Doing this with a script is a good idea.
#
################################################################################
# specify the OS stuff. You'll probably want to change this. If you do then you'll
# need to make sure there is a *.pkglist and *.exlist
PROFILE=compute
ARCH=x86_64
OS=centos5.3
# this is where the OS image will reside
IMGROOT=/install/netboot/$OS/$ARCH/$PROFILE/rootimg
# remove the old image if it exists.
rm -rf /install/netboot/$OS/$ARCH/$PROFILE
# generate the base image
# for IBM: tg3 in older blades, bnx in newer stuff, and igb in the nehalem based products.
/opt/xcat/share/xcat/netboot/centos/genimage -i eth0 -n libphy,tg3,bnx2,igb -o $OS -p $PROFILE
# update the yum database in the image
rm -rf $IMGROOT/etc/yum.repos.d
yum --installroot=$IMGROOT clean all
cp -a /etc/yum.repos.d/ $IMGROOT/etc/
rm -rf $IMGROOT/etc/yum.repos.d/xCAT-*
# no selinux!!
echo SELINUX=disabled > $IMGROOT/etc/sysconfig/selinux
# fix respawns
cp $IMGROOT/etc/inittab $IMGROOT/etc/inittab.ORIG
grep -v 38400 $IMGROOT/etc/inittab.ORIG > $IMGROOT/etc/inittab
# filesystem setup, you'll want to customize this. We have swap and scratch
# configured here. But if you don't have disks then this may not help.
# we name our / partition the image name (compute by default) plus a timestamp.
TIME=`date +%s`
cp $IMGROOT/etc/fstab $IMGROOT/etc/fstab.ORIG
echo "proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
$PROFILE-$TIME / tmpfs rw 0 1
#/dev/sda1 swap swap defaults 0 0
#/dev/sda2 /scratch ext3 defaults 0 0
" > $IMGROOT/etc/fstab
mkdir $IMGROOT/scratch
### get ntp to start on boot
chroot $IMGROOT chkconfig --level 345 ntpd on
#### user stuff so that we can do some work ####
cp /etc/shadow $IMGROOT/etc/
cp /etc/group $IMGROOT/etc/
cp /etc/passwd $IMGROOT/etc/
cp /etc/hosts $IMGROOT/etc/
### scaling fixes #####
echo "# increase TCP max buffer size
net.core.rmem_max = 33554432
net.core.wmem_max = 33554432
net.core.rmem_default = 65536
net.core.wmem_default = 65536
# increase Linux autotuning TCP buffer limits
# min, default, and max number of bytes to use
net.ipv4.tcp_rmem = 4096 33554432 33554432
net.ipv4.tcp_wmem = 4096 33554432 33554432
net.ipv4.tcp_mem= 33554432 33554432 33554432
net.ipv4.route.flush=1
net.core.netdev_max_backlog=1500
#GPFS / NFS Tuning
net.ipv4.conf.all.arp_filter = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.neigh.default.gc_thresh1 = 1024
net.ipv4.neigh.default.gc_thresh2 = 4096
net.ipv4.neigh.default.gc_thresh3 = 8192
net.ipv4.neigh.default.gc_stale_time = 24" >> $IMGROOT/etc/sysctl.conf
## Limits: need to make sure users can have unlimited memory (ulimit -l unlimited)
cp /etc/security/limits.conf $IMGROOT/etc/security/
### add torque ###
/opt/xcat/share/xcat/netboot/add-on/torque/add_torque $IMGROOT mgt /opt/torque / local
# update the limit on pegged memory limit and if they have old xCAT then make sure
# it says torque instead of pbs in the paths of the config file.
perl -pi -e 's/ulimit -n 20000/ulimit -n 20000; ulimit -l unlimited/g' $IMGROOT/etc/init.d/pbs_mom
perl -pi -e 's/spool\/pbs/spool\/torque/g' $IMGROOT/etc/init.d/pbs_mom
perl -pi -e 's/spool\/pbs/spool\/torque/g' $IMGROOT/etc/init.d/pbs_mom
perl -pi -e 's/PBS_HOME=\/var\/spool\/pbs/PBS_HOME=\/var\/spool\/torque/g' $IMGROOT/var/spool/torque/mom_priv/epilogue
perl -pi -e 's/PBS_HOME=\/var\/spool\/pbs/PBS_HOME=\/var\/spool\/torque/g' $IMGROOT/var/spool/torque/mom_priv/prologue
perl -pi -e 's/PBS_HOME=\/var\/spool\/pbs/PBS_HOME=\/var\/spool\/torque/g' $IMGROOT/var/spool/torque/mom_priv/takedownnode
### stateless init script does NTP, syslog, etc. ####
cp /etc/localtime $IMGROOT/etc/
cp /opt/xcat/share/xcat/netboot/add-on/stateless/stateless $IMGROOT/etc/init.d/
perl -pi -e 's!Mountain!Mexico/General!g' $IMGROOT/etc/init.d/stateless
perl -pi -e 's/driftfile \/etc\/ntp/driftfile \/var\/lib\/ntp/g' $IMGROOT/etc/init.d/stateless
perl -pi -e 's/keys \/etc\/ntp/keys \/var\/lib\/ntp/g' $IMGROOT/etc/init.d/stateless
rm -rf $IMGROOT/etc/sysconfig/clock
chroot $IMGROOT chkconfig --level 345 stateless on
chroot $IMGROOT chkconfig --level 345 rsyslog on
### make sure dhcp boot protocol is set to none ###
perl -pi -e 's/dhcp/none/g' $IMGROOT/etc/sysconfig/network-scripts/ifcfg-eth0
#### add GPFS stuff ###
# this is an example of a stateless GPFS implementation. Uncomment the below if you
# want GPFS. Make sure you have the GPFS RPMs to do this.
#GPFSSRCDIR=/install/GPFS
#yum --installroot=$IMGROOT -y install glibc ksh compat-libstdc++-33 binutils rsh
#rpm -ivh --root=$IMGROOT $GPFSSRCDIR/gpfs.base*rpm
#rpm -ivh --root=$IMGROOT $GPFSSRCDIR/gpfs.gpl*rpm
#rpm -ivh --root=$IMGROOT $GPFSSRCDIR/gpfs.msg*rpm
#rpm -Uivh --root=$IMGROOT $GPFSSRCDIR/updates/gpfs.base*rpm
#rpm -Uivh --root=$IMGROOT $GPFSSRCDIR/updates/gpfs.gpl*rpm
#rpm -Uivh --root=$IMGROOT $GPFSSRCDIR/updates/gpfs.msg*rpm
##
#AUTOGPFSDIR=/opt/xcat/share/xcat/netboot/add-on/autogpfs
#cp $AUTOGPFSDIR/autogpfsc.pl $IMGROOT/usr/sbin
#cp $AUTOGPFSDIR/autogpfsc $IMGROOT/etc/init.d/
#echo "SERVERS=mgt
#PORT=3003
#BLOCK=no" >> $IMGROOT/etc/sysconfig/autogpfsc
#
#chroot $IMGROOT chkconfig --level 345 autogpfsc on
#cp $GPFSSRCDIR/2.6.18-128.el5/* $IMGROOT/usr/lpp/mmfs/bin/
#cp /etc/profile.d/gpfs.sh $IMGROOT/etc/profile.d/
### End GPFS Stuff ####
### IB Stuff ####
# if you have InfiniBand on your machines then you probably have an OFED distribution you
# need to add. Here is an example of how to add it.
#echo "Adding InfiniBand"
#yum --installroot=$IMGROOT -y install bind-utils which rpm tcl tk glibc-devel.i386 pciutils expat libgfortran.x86_64 libgomp.x86_64 tcsh
#
#IBROOT=/install/voltaire/VoltaireOFED-1.4.2_2-k2.6.18-128.el5-x86_64
#mount -o bind /proc $IMGROOT/proc
#mount -o bind /sys $IMGROOT/sys
#mount -o bind $IBROOT $IMGROOT/mnt
#chroot $IMGROOT /mnt/install.sh --without-mpi
#umount $IMGROOT/mnt
#umount $IMGROOT/sys
#umount $IMGROOT/proc
# configure IB IP address
#echo "IP=\`host \$HOSTNAME-ib0 | awk '{ print \$4 }' | head -1\`" >> $IMGROOT/etc/rc.d/rc.local
#echo "ifconfig ib0 \$IP" >> $IMGROOT/etc/rc.d/rc.local
#echo "ifconfig ib0 netmask 255.255.0.0" >> $IMGROOT/etc/rc.d/rc.local
### End IB Stuff ####
# configure name resolution
# change this to what you want it to be. (this is in site.tab as the domain and nameservers)
echo "search cluster.foo
nameserver 172.20.0.1" >$IMGROOT/etc/resolv.conf
### uniq-i-fy Torque OS name
echo "opsys compute_centos5.3" >> $IMGROOT/var/spool/torque/mom_priv/config
packimage -p $PROFILE -a $ARCH -o $OS
echo "Image $PROFILE-$TIME created"
+1 -1
View File
@@ -177,7 +177,7 @@ if ($netdriver) {
# Add the default driver list
if ($arch eq 'x86' or $arch eq 'x86_64') {
push @ndrivers, qw/tg3 bnx2 bnx2x e1000 e1000e igb mlx_en be2net/;
push @ndrivers, qw/tg3 bnx2 bnx2x e1000 e1000e virtio_net virtio_balloon igb mlx_en be2net/;
} elsif ($arch eq 'ppc64') {
push @ndrivers, qw/tg3 e1000 e1000e igb ibmveth ehea be2net/;
} elsif ($arch eq "s390x") {
@@ -46,7 +46,7 @@ fi
# remove user from index
index=`grep $CNA /etc/xcat/ca/index | cut -f4 2>&1`
for id in $index; do
openssl ca -config /etc/xcat/ca/openssl.cnf -revoke /etc/xcat/ca/certs/$id.pem
openssl ca -startdate 19600101010101Z -config /etc/xcat/ca/openssl.cnf -revoke /etc/xcat/ca/certs/$id.pem
done
mkdir -p $USERHOME/.xcat
cd $USERHOME/.xcat
@@ -60,7 +60,7 @@ cd $XCATDIR/ca
# - seems to be a problem with the use of the wildcard in the Makefile
# - calling cmds directly instead - should be safe
# make sign
openssl ca -config openssl.cnf -in root.csr -out root.cert
openssl ca -startdate 600101010101Z -config openssl.cnf -in root.csr -out root.cert
if [ -f root.cert ]; then
rm root.csr
fi
@@ -33,7 +33,7 @@ cd $XCATDIR/ca
# - call cmds directly instead - seems safe
# make sign
openssl ca -config openssl.cnf -in `hostname`.csr -out `hostname`.cert -extensions server
openssl ca -startdate 600101010101Z -config openssl.cnf -in `hostname`.csr -out `hostname`.cert -extensions server
if [ -f `hostname`.cert ]; then
rm `hostname`.csr
fi
@@ -30,5 +30,9 @@ sed -e "s@##XCATCADIR##@$XCATCADIR@" $XCATROOT/share/xcat/ca/openssl.cnf.tmpl >
cp $XCATROOT/share/xcat/ca/Makefile $XCATCADIR/
cd $XCATCADIR
make init
openssl req -nodes -config openssl.cnf -days 7300 -x509 -newkey rsa:2048 -out ca-cert.pem -extensions v3_ca -outform PEM -subj /CN="$CNA"
#openssl req -nodes -config openssl.cnf -days 7300 -x509 -newkey rsa:2048 -out ca-cert.pem -extensions v3_ca -outform PEM -subj /CN="$CNA"
openssl genrsa -out private/ca-key.pem 2048
chmod 600 private/ca-key.pem
openssl req -new -key private/ca-key.pem -config openssl.cnf -out ca-req.csr -subj /CN="$CNA" -outform PEM
openssl ca -selfsign -keyfile private/ca-key.pem -in ca-req.csr -startdate 700101010101Z -days 7305 -extensions v3_ca -config openssl.cnf -out ca-cert.pem
cd -
File diff suppressed because it is too large Load Diff
Executable → Regular
+20 -10
View File
@@ -16,19 +16,29 @@ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
AutoReqProv: no
%endif
# AIX will build with an arch of "ppc"
# also need to fix Requires for AIX
%ifos linux
BuildArch: noarch
Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser grub2-xcat
Obsoletes: atftp-xcat
%endif
%define fsm %(if [ "$fsm" = "1" ];then echo 1; else echo 0; fi)
%define pcm %(if [ "$pcm" = "1" ];then echo 1; else echo 0; fi)
%define notpcm %(if [ "$pcm" = "1" ];then echo 0; else echo 1; fi)
# AIX will build with an arch of "ppc"
# also need to fix Requires for AIX
%ifos linux
BuildArch: noarch
Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser
Obsoletes: atftp-xcat
%endif
# The aix rpm cmd forces us to do this outside of ifos type stmts
%if %notpcm
%ifos linux
%ifnarch s390x
# PCM does not use or ship grub2-xcat
Requires: grub2-xcat
%endif
%endif
%endif
%if %fsm
# nothing needed here
%else
@@ -157,7 +167,7 @@ rm $RPM_BUILD_ROOT/%{prefix}/sbin/stopstartxcatd
#rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/blade.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/hpblade.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/hpilo.pm
#rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/ipmi.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/ipmi.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/nodediscover.pm
#rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/switch.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/xen.pm
@@ -379,7 +389,7 @@ fi
%post
%ifos linux
ln -sf $RPM_INSTALL_PREFIX0/sbin/xcatd /usr/sbin/xcatd
if [ "$1" = "1" ]; then #Only if installing for the first time..
if [ -x /usr/lib/lsb/install_initd ]; then
/usr/lib/lsb/install_initd /etc/init.d/xcatd
+116 -59
View File
@@ -4,34 +4,64 @@ package genrestapidoc;
my @apigroups = (
{
groupname => 'node',
groupname => 'tokens',
header => "Token Resources",
desc => "The URI list which can be used to create tokens for account .",
resources => ['tokens'],
},
{
groupname => 'nodes',
header => "Node Resources",
desc => "The URI list which can be used to create, query, change and manage nodes.",
resources => ['allnode', 'nodeallattr', 'nodeattr', 'power', 'energy', 'energyattr', 'serviceprocessor', 'nextboot',
'vitals', 'vitalsattr', 'inventory', 'inventoryattr', 'eventlog', 'beacon', 'bootstat',
'updating','filesyncing','software_maintenance','postscript', 'nodeshell', 'nodecopy',]
desc => "The URI list which can be used to create, query, change and manage node objects.",
resources => ['allnode', 'nodeallattr', 'nodeattr', 'nodehost', 'nodedns', 'nodedhcp', 'nodestat', 'subnodes',
'power', 'energy', 'energyattr', 'serviceprocessor', 'nextboot', 'bootstate',
'vitals', 'vitalsattr', 'inventory', 'inventoryattr', 'eventlog', 'beacon',
'updating','filesyncing','software_maintenance','postscript', 'nodeshell', 'nodecopy',
]
},
{
groupname => 'osimages',
header => "Osimage resources",
desc => "URI list which can be used to query, create osimage resources.",
resources => ['osimage', 'osimage_allattr', 'osimage_attr', 'osimage_op']
},
{
groupname => 'networks',
header => "Network Resources",
desc => "The URI list which can be used to create, query, change and manage network objects.",
resources => ['allnetwork', 'network_allattr','network_attr']
},
{
groupname => 'policy',
header => "Policy Resources",
desc => "URI list which can be used to create, query, change and manage policy entries.",
desc => "The URI list which can be used to create, query, change and manage policy entries.",
resources => ['policy', 'policy_allattr', 'policy_attr']
},
{
groupname => 'groups',
header => "Group Resources",
desc => "The URI list which can be used to create, query, change and manage group objects.",
resources => ['all_groups','group_allattr','group_attr',
]
},
{
groupname => 'globalconf',
header => "Global Configuration Resources",
desc => "URI list which can be used to create, query, change global configuration.",
resources => ['all_site']
desc => "The URI list which can be used to create, query, change global configuration.",
resources => ['all_site', 'site']
},
{
groupname => 'table',
groupname => 'services',
header => "Service Resources",
desc => "The URI list which can be used to manage the host, dns and dhcp services on xCAT MN.",
resources => ['dns','dhcp','host', 'slpnodes', 'specific_slpnodes',]
},
{
groupname => 'tables',
header => "Table Resources",
desc => "URI list which can be used to create, query, change global configuration.",
resources => ['table_nodes', 'table_rows']
},
{
# groupname => 'network',
resources => ['network', 'network_allattr']
desc => "URI list which can be used to create, query, change table entries.",
resources => ['table_nodes', 'table_nodes_attrs', 'table_all_rows', 'table_rows', 'table_rows_attrs']
},
);
@@ -80,31 +110,41 @@ sub outtext {
print " Returns: $parts[2]\n";
}
}
if (defined ($def->{example})) {
my @parts = split ('\|', $def->{example});
print " Example:\n";
if ($parts[1]) {
print " $parts[1]\n";
} else {
push @errmsg, "Error format in:[".$def->{desc}."]\n";
}
if ($parts[2] && $parts[3] && $parts[4]) {
my ($uri, $data);
if ($parts[3] =~ /\s+/) {
($uri, $data) = split(/ /, $parts[3]);
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$uri$postfix\' -H Content-Type:application/json --data \'$data\'\n";
} else {
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$parts[3]$postfix\'\n";
my @example_array = ();
if (defined($def->{example})) {
push @example_array, $def->{example};
} else {
foreach (1..10) {
if (defined($def->{'example'.$_})) {
push @example_array, $def->{'example'.$_};
}
$parts[4] =~ s/\n/\n /g;
print " $parts[4]\n";
} else {
push @errmsg, "Error format in:[".$def->{desc}."]\n";
}
}
if (@example_array) {
foreach my $line (@example_array) {
my @parts = split ('\|', $line);
print " Example:\n";
if ($parts[1]) {
print " $parts[1]\n";
} else {
push @errmsg, "Error format in:[".$def->{desc}."]\n";
}
if ($parts[2] && $parts[3] && ($parts[4] || $opt ne "GET")) {
my ($uri, $data);
if ($parts[3] =~ /\s+/) {
($uri, $data) = split(/ /, $parts[3]);
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$uri$postfix\' -H Content-Type:application/json --data \'$data\'\n";
} else {
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$parts[3]$postfix\'\n";
}
$parts[4] =~ s/\n/\n /g;
print " $parts[4]\n";
} else {
push @errmsg, "Error format in:[".$def->{desc}."]\n";
}
}
} else {
push @errmsg, "Error format in:[".$def->{desc}."]\n";
}
@@ -158,30 +198,42 @@ sub outwiki {
}
}
if (defined ($def->{example})) {
my @parts = split ('\|', $def->{example});
print "'''Example:'''\n\n";
if ($parts[1]) {
print "$parts[1]\n";
} else {
push @errmsg, "Error format for:[".$def->{desc}."]\n";
}
if ($parts[2] && $parts[3] && $parts[4]) {
my ($uri, $data);
if ($parts[3] =~ /\s+/) {
($uri, $data) = split(/ /, $parts[3]);
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$uri$postfix\' -H Content-Type:application/json --data \'$data\'\n";
} else {
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$parts[3]$postfix\'\n";
my @example_array = ();
if (defined($def->{example})) {
push @example_array, $def->{example};
} else {
foreach (1..10) {
if (defined($def->{'example'.$_})) {
push @example_array, $def->{'example'.$_};
}
$parts[4] =~ s/\n/\n /g;
print " $parts[4]\n";
} else {
push @errmsg, "Error format for:[".$def->{desc}."]\n";
}
}
if (@example_array) {
foreach my $line (@example_array) {
my @parts = split ('\|', $line);
print "'''Example:'''\n\n";
if ($parts[1]) {
print "$parts[1]\n";
} else {
push @errmsg, "Error format for:[".$def->{desc}."]\n";
}
if ($parts[2] && $parts[3] && ($parts[4] || $opt ne "GET")) {
my ($uri, $data);
if ($parts[3] =~ /\s+/) {
($uri, $data) = split(/ /, $parts[3]);
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$uri$postfix\' -H Content-Type:application/json --data \'$data\'\n";
} else {
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$parts[3]$postfix\'\n";
}
$parts[4] =~ s/\n/\n /g;
print " $parts[4]\n";
} else {
push @errmsg, "Error format for:[".$def->{desc}."]\n";
}
}
} else {
push @errmsg, "Error format for:[".$def->{desc}."]\n";
}
@@ -239,9 +291,14 @@ sub gendoc {
} else {
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{PUT}, "PUT", $URIdef->{$groupname}->{$res});
}
$headdone = 1;
}
if (defined ($URIdef->{$groupname}->{$res}->{POST})) {
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{POST}, "POST");
if ($headdone) {
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{POST}, "POST");
} else {
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{POST}, "POST", $URIdef->{$groupname}->{$res});
}
}
if (defined ($URIdef->{$groupname}->{$res}->{DELETE})) {
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{DELETE}, "DELETE");
File diff suppressed because it is too large Load Diff
+183 -121
View File
@@ -1,135 +1,197 @@
#!/bin/bash
# IBM(c) 2014 EPL license http://www.eclipse.org/legal/epl-v10.html
#! /bin/sh
# Test driver for xcatws.cgi, pass 3 arguments to it: user, password, noderange
# This test driver will create to dummy nodes, wstest1 and wstest2, so make sure those
# names don't conflict with your nodes on this MN.
# You also have to pass in a noderange of 2 real system x nodes that can be used
# to test some of the r cmds, xdsh, xdcp, nodestat.
user=$1
pw=$2
nr=$3
if [ -z "$3" ]; then
echo "Usage: chkrc <user> <pw> <noderange>"
exit
fi
# Get all the parameters
for i in $@
do
if [ "$paramname" = "USER" ]; then
USER=$i
paramname=
fi
if [ "$paramname" = "PW" ]; then
PW=$i
paramname=
fi
if [ "$paramname" = "HOST" ]; then
HOST=$i
paramname=
fi
format='format=json&pretty=1'
ctype='-H Content-Type:application/json'
if [ $i = '-u' ]; then
paramname=USER
fi
if [ $i = '-p' ]; then
paramname=PW
fi
if [ $i = '-h' ]; then
paramname=HOST
fi
if [ $i = '-c' ]; then
cert=yes
fi
if [ $i = '-t' ]; then
token=yes
fi
done
function chkrc
{
rc=$?
{ set +x; } 2>/dev/null
if [[ $1 == "not" ]]; then
if [[ $rc -eq 0 ]]; then
echo "Test failed!"
exit
fi
else
if [[ $rc -gt 0 ]]; then
echo "Test failed!"
exit
fi
fi
echo ''
set -x
# display the usage message
function usage {
echo "Usage:"
echo " xcatws-test.sh -u <USER> -p <pw> [-t]"
echo " xcatws-test.sh -u <USER> -p <pw> -h <FQDN - Full hostname of server> [-c] [-t]"
echo " -u The username of xCAT user which is used to access xCAT resource"
echo " -p The password of username"
echo " <FQDN of xCAT MN> The fully qualified hostname of xCAT management node. It can be an IP if using -k."
echo " -c Check the server identity. The server certificate authentication must be enabled."
echo " -t Using token authentication method."
}
# pcregrep -M 'abc.*(\n|.)*efg' test.txt
if [ "$USER" = "" ] || [ "$PW" = "" ]; then
echo "Error: Miss username or password"
usage
exit 1
fi
#todo: add a test case for every api call that is documented
set -x
# clean up from last time
curl -# -X DELETE -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw" >/dev/null; echo ''
if [ "$cert" = "yes" ] && [ "$HOST" = "" ]; then
echo "Error: -c must be used with -h that user needs specify the FQDN of xCAT MN"
usage
exit 1
fi
# create test nodes
curl -# -X POST -k "https://127.0.0.1/xcatws/node/wstest1-wstest2?userName=$user&password=$pw&$format" $ctype --data '{"groups":"wstest","netboot":"xnba"}' \
| grep -q '2 object definitions have been created'; chkrc
# list all nodes and make sure they are in the list
curl -# -X GET -k "https://127.0.0.1/xcatws/node?userName=$user&password=$pw&$format" \
| pcregrep -qM '"wstest1",\n\s*"wstest2"'; chkrc
# list all node's group and netboot attributes
curl -# -X GET -k "https://127.0.0.1/xcatws/node?userName=$user&password=$pw&field=groups&field=netboot" \
| grep -qE '"nodename":"wstest1".*"groups":"wstest"'; chkrc
# list all attributes of all nodes
curl -# -X GET -k "https://127.0.0.1/xcatws/node?userName=$user&password=$pw&field=ALL" \
| grep -qE '"nodename":"wstest1".*"groups":"wstest"'; chkrc
# list the noderange and make sure they are in the list
curl -# -X GET -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&$format" \
| pcregrep -qM '"wstest1",\n\s*"wstest2"'; chkrc
# list all node's group and netboot attributes
curl -# -X GET -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&field=groups&field=netboot" \
| grep -qE '"nodename":"wstest1".*"groups":"wstest"'; chkrc
# list all attributes of all nodes
curl -# -X GET -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&field=ALL" \
| grep -qE '"nodename":"wstest1".*"groups":"wstest"'; chkrc
# change some attributes
curl -# -X PUT -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&$format" $ctype --data '{"room":"222","netboot":"pxe"}' \
| grep -q '2 object definitions have been created or modified'; chkrc
# verify they got the new values
curl -# -X GET -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&field=room&field=netboot" \
| grep -qE '"nodename":"wstest1".*"room":"222"'; chkrc
# delete the nodes
curl -# -X DELETE -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&$format" \
| grep -q '2 object definitions have been removed'; chkrc
# list all nodes and make sure they are not in the list
curl -# -X GET -k "https://127.0.0.1/xcatws/node?userName=$user&password=$pw&$format" \
| pcregrep -qM '"wstest1",\n\s*"wstest2"'; chkrc not
# list the power state of the noderange
curl -# -X GET -k "https://127.0.0.1/xcatws/node/$nr/power?userName=$user&password=$pw&$format" \
| grep -q '"power":"on"'; chkrc
# list the nodestat state of the noderange
curl -# -X GET -k "https://127.0.0.1/xcatws/node/$nr/status?userName=$user&password=$pw&$format" \
| grep -q '":"sshd"'; chkrc
# list the node inventory of the noderange
curl -# -X GET -k "https://127.0.0.1/xcatws/node/$nr/inventory?userName=$user&password=$pw&$format" \
| grep -q '"Board manufacturer":"IBM"'; chkrc
# list the node vitals of the noderange
curl -# -X GET -k "https://127.0.0.1/xcatws/node/$nr/vitals?userName=$user&password=$pw&$format" \
| grep -q '"Cooling Fault":"false"'; chkrc
# list the node energy settings of the noderange
curl -# -X GET -k "https://127.0.0.1/xcatws/node/$nr/energy?userName=$user&password=$pw&$format&field=cappingstatus&field=cappingmaxmin" \
| grep -q '"cappingstatus":"off"'; chkrc
# run a cmd on the noderange
curl -# -X POST -k "https://127.0.0.1/xcatws/node/$nr/dsh?userName=$user&password=$pw&$format" $ctype --data '{"command":"pwd"}' \
| grep -q '"/root"'; chkrc
# copy a file to the noderange
curl -# -X POST -k "https://127.0.0.1/xcatws/node/$nr/dcp?userName=$user&password=$pw&$format" $ctype --data '{"source":"/root/.bashrc","target":"/tmp/"}' \
| grep -q '"errorcode":"0"'; chkrc
# test the table calls
curl -# -X GET -k "https://127.0.0.1/xcatws/table/nodelist/wstest?userName=$user&password=$pw&$format"
if [ "$HOST" = "" ]; then
HOST="127.0.0.1"
fi
exit
ctype='-H Content-Type:application/json'
# Perform the REST API request
function REST {
METHOD=$1 # it should be GET/PUT/POST/DELETE
SRC=$2 # The resource path like /nodes/node1
DATA=$3 # The operation data for PUT/POST/DELETE
if [ "$DATA" != "" ]; then
datamsg="$ctype -d $DATA"
fi
if [ "$cert" = "yes" ]; then
if [ "$token" = "yes" ]; then
CMD="curl -X $METHOD --cacert /tmp/ca-cert.pem -H X-Auth-Token:$TOKENID $datamsg https://$HOST/xcatws$SRC?pretty=1"
else
CMD="curl -X $METHOD --cacert /tmp/ca-cert.pem $datamsg https://$HOST/xcatws$SRC?pretty=1&userName=$USER&password=$PW"
fi
else
if [ "$token" = "yes" ]; then
CMD="curl -X $METHOD -k -H X-Auth-Token:$TOKENID $datamsg https://$HOST/xcatws$SRC?pretty=1"
else
CMD="curl -X $METHOD -k $datamsg https://$HOST/xcatws$SRC?pretty=1&userName=$USER&password=$PW"
fi
fi
echo "-------------------------------------------------------------------------------"
echo "Run: [$RESTMSG]"
echo " $CMD"
echo "Output:"
`$CMD 2>/dev/null >/tmp/xcatws-test.log`
cat "/tmp/xcatws-test.log"
echo ""
ERROR=`grep "errorcode" "/tmp/xcatws-test.log"`
if [ "$ERROR" != "" ]; then
echo "FAILED to continue. See the error message in 'error' section."
echo ""
exit 2
fi
}
function PUT {
SRC=$1
}
# echo debug message
echo "***********************************************************"
echo "** Username: $USER"
echo "** Password: $PW"
echo "** Hostname: $HOST"
#curl -X GET -k "https://127.0.0.1/xcatws/groups?userName=$user&password=$pw&$format"
# get the CA of server certificate
if [ "$cert" = "yes" ]; then
rm -f /tmp/ca-cert.pem
cd /tmp
wget http://$HOST/install/postscripts/ca/ca-cert.pem 2>1 1>/dev/null
echo "** Using CA /tmp/ca-cert.pem for server certificate checking"
fi
#curl -X GET -k "https://127.0.0.1/xcatws/images?userName=$user&password=$pw&$format"
#curl -X GET -k "https://127.0.0.1/xcatws/images?userName=$user&password=$pw&$format&field=osvers"
#curl -X GET -k "https://127.0.0.1/xcatws/images/bp-netboot?userName=$user&password=$pw&$format"
#curl -X GET -k "https://127.0.0.1/xcatws/images/bp-netboot?userName=$user&password=$pw&$format&field=osvers"
# get a token
if [ "$token" = "yes" ]; then
TOKENID=$(curl -X POST -k "https://$HOST/xcatws/tokens?pretty=1" -H Content-Type:application/json --data "{\"userName\":\"$USER\",\"password\":\"$PW\"}" 2>/dev/null | grep '"id"' | awk -F: {'print $2'} | awk -F \" {'print $2'})
echo "** Using Token: $TOKENID to authenticate"
fi
echo "***********************************************************"
echo ""
# clean the env
rmdef -t node restapinode[1-9] 1>/dev/null 2>1
rmdef -t group restapi 1>/dev/null 2>1
# get all resources
RESTMSG="Get all available resource"
REST GET "/"
# test global conf
RESTMSG="Get all global configuration resource"
REST GET "/globalconf"
RESTMSG="Change the global configuration domain to cluster.com"
REST PUT "/globalconf/attrs/domain" '{"domain":"cluster.com"}'
RESTMSG="Get the global configuration domain"
REST GET "/globalconf/attrs/domain"
# test node create/change/list/delete
RESTMSG="Create node restapinode1"
REST POST "/nodes/restapinode1" '{"groups":"restapi","arch":"x86_64","mgt":"ipmi","netboot":"xnba"}'
RESTMSG="Display the node restapinode1"
REST GET "/nodes/restapinode1"
RESTMSG="Change the attributes for node restapinode1"
REST PUT "/nodes/restapinode1" '{"mgt":"fsp","netboot":"yaboot"}'
RESTMSG="Display the node restapinode1"
REST GET "/nodes/restapinode1"
RESTMSG="Delete node restapinode1"
REST DELETE "/nodes/restapinode1"
# test multiple nodes manipulation
RESTMSG="Create node restapinode1 and restapinode2"
REST POST "/nodes/restapinode1,restapinode2" '{"groups":"restapi","arch":"x86_64","mgt":"ipmi","netboot":"xnba"}'
RESTMSG="Display the node restapinode1 and restapinode2"
REST GET "/nodes/restapinode1,restapinode2"
RESTMSG="Change the attributes for node restapinode1 and restapinode2"
REST PUT "/nodes/restapinode1,restapinode2" '{"mgt":"hmc","netboot":"grub2"}'
RESTMSG="Display the node restapinode1 and restapinode2"
REST GET "/nodes/restapinode1,restapinode2"
RESTMSG="Display all the nodes in the cluster"
REST GET "/nodes"
# test group
RESTMSG="Display the group restapi"
REST GET "/groups/restapi"
RESTMSG="Change attributes for group restapi"
REST PUT "/groups/restapi" '{"os":"rh7"}'
RESTMSG="Display the group restapi"
REST GET "/groups/restapi"
RESTMSG="Display the nodes in group restapi"
REST GET "/nodes/restapi"
#todo: remove when these test cases are in xcatws-test.pl
#./xcatws-test.pl -u "https://127.0.0.1/xcatws/node/test001?userName=$user&password=$pw" -m GET
#./xcatws-test.pl -u "https://127.0.0.1/xcatws/node/test001?userName=$user&password=$pw" -m PUT "nodepos.room=foo"
File diff suppressed because it is too large Load Diff
@@ -25,7 +25,7 @@ cmd:copycds $$ISO
check:rc==0
cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
check:rc==0
cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__
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

Some files were not shown because too many files have changed in this diff Show More