Compare commits

...

331 Commits

Author SHA1 Message Date
arif ca7cc188a0 add allowed entries for pkgdir to have http, so that we can have external repos
* This will only work though has more than one repo defined, where the first one is the local one
2014-07-08 21:30:56 +01:00
baiyuan f7d1f6c17b back to original for xdsh non-root support 2014-07-08 02:46:27 -04:00
zhaoertao 06e6eb38ae fix bug 4186 [FVT on Power 8 DFM]chvm can't delete a assigned adapter for physical partition 2014-07-07 15:47:08 -07:00
lissav 61540b6d43 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-07-07 10:30:04 -04:00
lissav 87fc929900 defect 4182 2014-07-07 10:29:32 -04:00
baiyuan 9aa68aa497 enhance code for both root and non-root user 2014-07-07 09:35:14 -04:00
baiyuan 37ccddadf6 support both root user and non-root user in xcat mn 2014-07-07 08:50:48 -04:00
baiyuan f0a8697c62 support for non-root user 2014-07-07 01:12:52 -04:00
baiyuan 0ad769155e support for non-root 2014-07-07 01:12:27 -04:00
ligc 54a98d30c1 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-07-07 10:20:39 -05:00
ligc bfacd0f253 fix for bug 4187: uncomment the SSL_verify_mode in prsync for RHEL7 2014-07-07 10:19:20 -05:00
immarvin 243d2b7434 fix defect #4190 [DEV]apache2 configuration file /etc/apache2/conf-enabled/xcat.conf.apach24 failed to be applied on ubuntu14.04 MN 2014-07-05 04:53:49 -07:00
immarvin 17598cf257 fix defect #4190 [DEV]apache2 configuration file /etc/apache2/conf-enabled/xcat.conf.apach24 failed to be applied on ubuntu14.04 MN 2014-07-05 02:50:38 -07:00
immarvin a504b0f45b fix defect #4189 [DEV] ubuntu14.04-x86_64-netboot-compute provision complains (/tmp/updateflag: line 4: nc: command not found) and defect #4188 [DEV]2 warning message during genimage ubuntu14.04-x86_64-netboot-compute 2014-07-04 23:32:01 -07:00
immarvin bb6bbbb4e4 add support for Upstart of ubuntu on service management 2014-07-04 09:06:56 -07:00
immarvin d48717fdc7 add support for Upstart of ubuntu on service management 2014-07-04 02:10:20 -07:00
daniceexi 76701f2a02 defect 4111: enhance the [routeop replace] to support redhat and sles. /etc/sysconfig/network-scripts/route-ifname is used for redhat to store the persistent route setting. The ip command is used to replace route command. 2014-07-03 16:27:58 -04:00
immarvin 45d3f869a9 add net-tools to the compute.rhel7.pkglist 2014-07-03 01:39:32 -07:00
ligc 8dde7b2e89 update xCAT-genesis-builder makerpm for ppc64 platform 2014-07-02 22:22:25 -05:00
ligc ae7398e33f remove efibootmgr from xCAT-genesis-builder.spec, efibootmgr will be installed on x86_64 Linux, and the efibootmgr prerequisite breaks genesis on ppc64 platform 2014-07-02 17:53:43 -05:00
huweihua b7d3c4732f modify defect: miss boot_root attr in legacy mode 2014-07-02 05:19:26 -04:00
huweihua 06703120e0 delete some comments 2014-07-02 05:14:37 -04:00
immarvin f947c49b9f fix defect #4180 [DEV](xcatconfig -i) complains (Command failed: find /usr/share/zoneinfo -type f -exec cmp -s /etc/localtime {} \; -print | grep -v posix | grep -v SystemV 2>&1. Error message: .) on ubuntu14.04 2014-07-01 03:04:25 -07:00
daniceexi 471a104632 defect 4178,4179: pass the [all] parameter to inventory and vitals resource, this is must have for ppc node; make the return code of rinv and rvitals always to be 0 so that rest api could handle the return message which has both success and failure. 2014-06-30 12:59:46 -04:00
daniceexi 3a3568d1cc Change the default operator of setroute script to be replace from add. If you want to use add, run it as [setroute add] 2014-06-30 04:21:10 -04:00
Jarrod Johnson 7a467bcb1b Modify strategy in case where login succeeds but set priv does not
Previously it would go all the way back.  Instead, go back just one step.
2014-06-27 11:51:14 -04:00
immarvin 5894a5dbca add ubuntu14.04 build support 2014-06-26 21:12:46 -07:00
lissav e274591a1b defect 4171 2014-06-25 07:08:20 -04:00
huweihua d6c92d6753 add some dir/file to exclude configuration file 2014-06-25 04:46:44 -04:00
ligc 9fd5e2c095 fix for bug 4177: rhel7 uses interface names ethp1s2/enp1s2 2014-06-25 14:42:07 -05:00
Lei Ai 2c266e9ac9 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-06-25 08:50:59 +08:00
Lei Ai 17c516e885 PCM:remove DNS records while change node's IP address 2014-06-25 08:50:41 +08:00
Bruce Potter 918f0b520c Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-06-24 16:40:26 -04:00
Bruce Potter 417606b01a adapter xcat softlayer rpm for 2.8.5 2014-06-24 16:40:06 -04:00
lissav 0d4e736b6d defect 4164 2014-06-24 12:17:54 -04:00
lissav a3b3656ed8 defect 4164 2014-06-24 12:15:39 -04:00
immarvin 4691f35799 fix defect#4171 [FVT]:xcatd is not running after rh7 sn is setup 2014-06-24 07:58:13 -07:00
lissav b24d5bdda4 add rinstall plugin 2014-06-24 07:50:36 -04:00
lissav 3c327578e4 Defect 4164, change rinstall to a plugin 2014-06-24 07:41:06 -04:00
huweihua 908fdf8429 sysclone: fix some bug in Softlayer environment 2014-06-23 05:05:30 -04:00
huweihua 54c2870408 sysclone: fix some bug in Softlayer environment 2014-06-23 05:00:26 -04:00
Jarrod Johnson a8e96b90e6 Correct mistake in the FRU parsing code in the product area 2014-06-20 15:41:13 -04:00
Jarrod Johnson 15f6241aeb Improve robustness in downgrade of session privilege 2014-06-20 15:40:46 -04:00
Jarrod Johnson 4b4ffe1441 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-06-20 15:40:38 -04:00
daniceexi bbefb20cb7 configbond: ifdown the bond before ifup it for the case it has been configured 2014-06-20 04:38:24 -04:00
immarvin b701bed5f1 add some packages to service node pkglist for rhel7 2014-06-19 20:42:33 -07:00
daniceexi 43681ede40 code drop for postscript configbond 2014-06-20 03:00:17 -04:00
daniceexi 014b82f976 fix the issue that cannot handle the case that XX in #INCLUDE:XX# also replacable 2014-06-19 12:52:07 -04:00
huweihua 7a2c5dca1e sysclone add feature: update delta change from golden client to target node 2014-06-19 04:44:25 -04:00
huweihua 0fa1ebf7a8 sysclone add feature: update delta change from golden client to target node 2014-06-19 04:38:20 -04:00
huweihua bda289858d sysclone add feature: update delta change from golden client to target node 2014-06-19 04:31:58 -04:00
huweihua ae1fc3d297 add some comment for sysclone 2014-06-19 04:26:53 -04:00
huweihua cba796dd8d add some comment for sysclone 2014-06-19 04:22:41 -04:00
huweihua 1068c2db5b sysclone add feature: update delta change from golden client to target node 2014-06-19 04:14:44 -04:00
huweihua 3c0e4ebf57 sysclone add feature: update delta change from golden client to target node 2014-06-19 04:08:53 -04:00
huweihua 481b70c330 add feature: update delta change from golden client to target node 2014-06-19 03:50:46 -04:00
immarvin d378feca92 add *.tmpl and *.pkglist files for rhel7 service node 2014-06-19 00:34:18 -07:00
immarvin 147b7b2ced correct a typo 2014-06-18 00:43:21 -07:00
Jia Zhao 5c946182b5 fix noderegenips generate conflict ips 2014-06-18 13:33:07 +08:00
Lei Ai 6229cea13f Update switches format. 2014-06-17 17:09:54 +08:00
immarvin 4eacb904a1 add discinfo of rhelhpc7.0 2014-06-16 01:59:26 -07:00
immarvin 5dd913d220 replace ifconfig with ip 2014-06-14 08:51:41 -07:00
immarvin 5c278f3396 replace ifconfig with ip 2014-06-13 20:14:40 -07:00
immarvin fb152e9131 replace ifconfig with ip 2014-06-13 19:36:34 -07:00
immarvin f2f8b983c3 replace ifconfig with ip 2014-06-13 09:35:41 -07:00
immarvin 47454dba0e replace ifconfig with ip,replace service with systemd 2014-06-13 09:11:31 -07:00
immarvin b75e2139a8 replace ifconfig with ip 2014-06-13 10:37:18 -04:00
immarvin 66d5ac4091 fix defext #4162 Wrong value of kernel argument ifname= - diskless/stateless node failed to boot in RHEL7 environment 2014-06-13 04:32:25 -07:00
lissav b672c8ea08 fix incorrect call 2014-06-13 05:44:40 -04:00
Lei Ai a3adbd7669 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-06-13 14:20:02 +08:00
daniceexi 53d70830f5 minor change for partition file handling 2014-06-13 06:56:52 -04:00
daniceexi 293fe015ce use the base64 coding to pass the partition file into kickstart/autoyast pre script 2014-06-13 06:33:20 -04:00
daniceexi 73c420eefc make subvars could handle the var in #INCLUDE 2014-06-12 09:06:42 -04:00
zhaoertao 1fcadbd9f4 fix bug 4069 'rspconfig hmc sshcfg=enable' failed in rhel7.0 environment 2014-06-11 23:19:12 -07:00
daniceexi 5e3832753f Make ping test in SMS could accept timeout value which exported from ENV:TIMEOUT4PINGTEST 2014-06-12 04:33:25 -04:00
Lei Ai 66cab13065 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-06-12 11:54:41 +08:00
Lei Ai 8ac69f0630 Enhancement for nodeimport: switch, ports, interfaces relation setup 2014-06-12 11:53:10 +08:00
Jarrod Johnson e7168c2d00 Try failing over to another syntax for wvid http call 2014-06-11 15:54:39 -04:00
mellor 3795edd2a8 defect 4082 - disable warnings when calling setlogsock 2014-06-11 13:21:38 -04:00
lissav 7e4fa98e00 fix 4161 2014-06-11 08:27:44 -04:00
immarvin ee1521f080 fix 4132 [DEV]sles11.3 provision hang when site.managedaddressmode=static 2014-06-11 02:56:16 -07:00
junxiaw 66ca2f0003 modify xcattest code for autotest code 2014-06-11 01:54:03 -07:00
immarvin 3e3be8425b replace sysvinit with newly added subroutines in xCAT::Utils 2014-06-11 01:38:16 -07:00
daniceexi 991e039470 support replace operation for routeop postscript. So far only supports the persistent route setting for sles. 2014-06-11 07:14:28 -04:00
mellor 32c39eb1e9 defect 4147 fix snmove route add and updatenode calls 2014-06-10 16:46:46 -04:00
Jarrod Johnson 966e66e9e3 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-06-10 14:07:11 -04:00
Jarrod Johnson 5b71f2638a Elaborate upon ipmi.bmcport behavior for a number of IBM system x systems 2014-06-10 14:07:00 -04:00
immarvin 5065feab5a replace the service/chkconfig related stuff with newly added subroutine in xCAT::Utils 2014-06-10 08:54:31 -07:00
mellor d18e7d8646 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-06-10 09:19:29 -04:00
immarvin 0b4e207e73 replace service stuff with newly added subrotines in xCAT::Utils 2014-06-10 06:47:35 -07:00
mellor b9bee92289 defect 4035 fix merge error in previous checkin to handle multiple servicenode entries 2014-06-10 08:53:14 -04:00
huweihua a5cf74fa66 add rootimgdir attr for sysclone osimage definition 2014-06-10 05:07:59 -04:00
huweihua c764fe725c add rootimgdir attr for sysclone osimage definition 2014-06-10 04:33:52 -04:00
daniceexi 862f1459a1 restructure the code in Template.pm->subvars to handle recusive #INCLUDE. It also fixed the support of #INCLUDE in osimage.partitionfile 2014-06-10 08:16:37 -04:00
immarvin e7e8a28f7f replace the service stuff with newly added systemd subroutines 2014-06-09 20:18:05 -07:00
immarvin 580ffb203f add systemctl support for xCAT-sn 2014-06-09 08:58:56 -07:00
immarvin 7beb515aa0 correct the message 2014-06-09 06:55:13 -07:00
immarvin 69e6dd69cf repleace the servcie stuff with newly added generic subroutines in xcat-client 2014-06-09 06:55:00 -07:00
huweihua 58dc9496cf change indent and comment 2014-06-08 22:42:32 -04:00
immarvin c02119ea54 replace the service stuff with new added generic routines 2014-06-08 08:23:10 -07:00
immarvin b979de76b6 add generic subroutine and functions for service management 2014-06-08 05:42:23 -07:00
Bruce Potter 210239303c improved msg for getslnodes when missing dependencies for sl api 2014-06-07 09:18:43 -04:00
lissav 5487553e41 defect 4154 2014-06-05 09:08:55 -04:00
baiyuan 63497743c7 imgimport does not support kit related in 2.8.x,warning replace error for defect 4093 2014-06-05 01:49:25 -04:00
huweihua cd2cb8112e Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-06-04 23:02:52 -04:00
immarvin 3c862b2451 fix defect #4128 [fvt]2.8.4:ubuntu 12.04 lsxcat -v could get version info 2014-06-04 20:48:47 -07:00
huweihua b148e997e9 fix bug: in sysclone, provmethod attribute gets cleared 2014-06-04 22:57:23 -04:00
daniceexi 1b9e2b16cf defect 4153: resolve the merge conflict which introduced by commit 899cb5028d 2014-06-04 08:44:40 -04:00
daniceexi e40f69e508 defect 4152: fix a typo which was introduced when support rh7 that using -N for dracut command 2014-06-04 07:37:20 -04:00
daniceexi b60378d8e4 update the doc part in xcatws.cgi for GET action against nodes/networks/osimages/policy to use keyword ALLRESOURCES 2014-06-04 06:19:11 -04:00
Jarrod Johnson f910d5bab8 Avoid requesting IBM VPD data for FRU locator records that do not advertise such data. 2014-06-03 15:34:07 -04:00
mellor 899cb5028d defect 4147 - allow nodeset to continue if prescript errors 2014-06-03 14:15:26 -04:00
mellor 7a5fa1df0e defect 4147 again - fix prescripts preprocess_request to only process nodes that have prescripts defined 2014-06-03 11:32:07 -04:00
mellor 5a52fb253d defect 4147 - fix prescripts preprocess_request to only process nodes that have prescripts defined 2014-06-03 11:27:09 -04:00
daniceexi 44452f4cd8 defect 4151:restapi: add error message if using incorrect authorize keys/passwd 2014-06-03 07:29:47 -04:00
daniceexi d3a9856f9d REST API: support keyword ALLRESOURCES for GET nodes,networks,osimage,policy 2014-06-03 05:04:02 -04:00
Jarrod Johnson 9f39989eb4 Support shortname directive for templates that may require it 2014-06-02 16:27:42 -04:00
Jarrod Johnson bafbe2361a Change RHEL7 to use lvm for / by default 2014-06-02 15:14:50 -04:00
mellor 2a44f59f15 clarify osimage partitionfile description 2014-06-02 15:14:55 -04:00
Jarrod Johnson 437c8a4863 Fix mistakes in the adjustment to rhel7 default FS cohice 2014-06-02 13:48:49 -04:00
Jarrod Johnson ab2f4e9dfd Apply previous changes to the pre for rhel7 specifically 2014-06-02 13:38:18 -04:00
Jarrod Johnson e574664a50 Update auto-partitioning for RHEL7
In RHEL7, the preferred filesystem is now xfs and the efi partition
type is unambiguously present.
2014-06-02 13:35:02 -04:00
lissav 742f8b611b force build 2014-06-02 13:20:20 -04:00
lissav 2dc79ab397 force build 2014-06-02 13:19:55 -04:00
lissav 1f377385a0 fix syntax errors 2014-06-02 13:19:02 -04:00
lissav 9b5f66ba3c Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-06-02 13:02:51 -04:00
lissav 8a2f7bc617 force a build 2014-06-02 12:57:32 -04:00
Bruce Potter db3c98cffe backported SI files to 2.8 branch 2014-06-02 11:59:47 -04:00
lissav 5e85167b7b defect 4091 2014-06-02 09:13:41 -04:00
lissav f48da3fc64 defect 4091 2014-06-02 09:07:54 -04:00
Jarrod Johnson 0c29a9c630 Fix problem where firmware was erroneously marked pending 2014-05-30 11:27:17 -04:00
Jarrod Johnson dbbed4ef1f Mark pending firmware to be clear that firmware is not yet active 2014-05-30 11:24:13 -04:00
Jarrod Johnson 54af542d35 Fix BMCPORT specification working with spaces 2014-05-30 11:05:30 -04:00
Jarrod Johnson 321e6696f8 Fix rpower wake turning off an on system 2014-05-30 10:24:12 -04:00
immarvin f1472b029d fix defect #4146 post.rh.common scipt has ifconfig that does work even on Redhat6 2014-05-30 03:12:08 -07:00
Bruce Potter d3d959d0e2 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8
fixed bug in xcatws.cgi for handling attrs with = in it
2014-05-29 16:11:35 -04:00
Bruce Potter 6ef42b3ae8 fixed bug in xcatws.cgi handling attr values with = in it 2014-05-29 16:10:55 -04:00
Jarrod Johnson bca4a317f4 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-05-29 10:32:41 -04:00
Jarrod Johnson db70dcfaa3 Fix output that occurs on require xCAT::Client when ip is not in path 2014-05-29 10:32:02 -04:00
immarvin a292d019d6 backup xcat.conf.apach22 in /etc/xcat/conf.orig/ 2014-05-29 03:41:04 -07:00
immarvin c976cb43a1 correct xCATsn.spec to support apache2/httpd 2.4.x 2014-05-29 02:52:35 -07:00
immarvin 357baafde0 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-05-29 01:31:27 -07:00
daniceexi 92aedad727 defect 4144: to allow the recursion call for local named that the dns resolve request from other network is also allowed 2014-05-29 07:30:16 -04:00
immarvin b6658bd232 fix defect #4145 [DEV] /etc/httpd/conf.d/xcat.conf is missing after xcat upgrade 2014-05-29 01:30:42 -07:00
Jia Zhao 37ceb9fc13 not regenerate ips for BMC/FSP NIC in pcm 2014-05-29 14:02:45 +08:00
Jia Zhao 1f8574c8fc support fuzzy matching mode in cfmsync 2014-05-29 11:02:03 +08:00
lissav de8815cb0b defect 4091 RHEL7 support 2014-05-28 10:07:07 -04:00
daniceexi fd2055c51c defect 4079: to support rh7 that hostname is cfged in /etc/hostname. Check the existence of /etc/hostname, use itif yes, otherwise use /etc/sysconfig/network 2014-05-28 10:28:54 -04:00
immarvin 543b2d23af correct the build spec and script 2014-05-28 02:25:50 -07:00
lissav 6ec9da5de7 defect 4077 2014-05-27 13:25:00 -04:00
lissav 76d749c270 defect 4091 2014-05-27 13:04:44 -04:00
lissav 103f32d2a2 defect 4091 2014-05-27 13:01:50 -04:00
lissav 8311ef3f4d defect 4091 2014-05-27 12:39:03 -04:00
lissav 8ec332fbc4 defect 4091 2014-05-27 12:31:27 -04:00
lissav e397ebaeac Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-05-27 12:07:19 -04:00
lissav 39c9881cc1 defect 4097 Support MariaDB 2014-05-27 12:06:15 -04:00
Jarrod Johnson ef3653559f Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-05-27 11:28:25 -04:00
Jarrod Johnson befcde6768 Add 8.1/2012r2 KMS keys 2014-05-27 11:28:22 -04:00
lissav e3517ad904 defect 4076 + DB2 updates 2014-05-27 10:03:50 -04:00
lissav bd774c768f defect 4076 + DB2 updates 2014-05-27 10:01:22 -04:00
lissav 4bcc4e2dbc defect 4076 2014-05-27 09:52:06 -04:00
lissav 15b679b907 defect 4076 2014-05-27 09:50:30 -04:00
lissav ccccc1e743 defect 4138 2014-05-27 09:31:50 -04:00
ligc 76a8941cbc fix for bug 4142: add vios as a new device type 2014-05-27 16:58:08 -05:00
daniceexi 16ecce4057 defect 4083: the dash and busybox rpm packages have been removed from rh7 iso and xcat stateless and satelite do not need them any more for rh7, so remove them from the stateless and statelite pkglist 2014-05-27 09:44:35 -04:00
daniceexi ceb6370771 fix a minor typo in destiny.pm 2014-05-27 08:33:55 -04:00
daniceexi 1039462c44 xcatws.cgi: fix the output when slpnodes resource has no output; fix the output message for nodestat resource 2014-05-27 07:46:47 -04:00
immarvin 0b999b2888 add grub2-xcat as the dependency of xCAT-server 2014-05-26 21:13:54 -07:00
immarvin 43998b11e2 correct the getNodeNetworkCfg to get the network gateway 2014-05-25 20:46:36 -07:00
daniceexi 70e64d8b68 defect 4133: continue the fix for the xml escape char conversion when getting mypostscript 2014-05-26 02:07:46 -04:00
daniceexi f56d9b0c12 defect: 4133: fix the code to transfer escape character for the output of getpostscript.awk 2014-05-26 01:05:30 -04:00
daniceexi c3129c1701 defect 4125:support to have parameters in niccustomscripts attribute 2014-05-26 01:03:25 -04:00
daniceexi 2bd823ec59 defect 4134: missing the use of xCAT::SvrUtils in conserver.pm so that when makeconservercf walks into error path to call SverUtils->sendmsg, an code error is displayed 2014-05-26 01:02:58 -04:00
daniceexi c616532194 defect 4133: transfer the xml specific character which starts with & to general format 2014-05-26 01:02:39 -04:00
daniceexi 50322fae7d rh stateless support. remove the tmp and root dir mount requirement in fstab. They can be handled correctly by dracut and dracut cfg file 2014-05-26 01:02:19 -04:00
daniceexi 990b282fc7 rh7 statelite support. remove the root dir from fstab to avoiding the remount which overwrite the root dir to rw 2014-05-26 01:01:58 -04:00
daniceexi b8cacc08b5 rh7 statelite support. create /etc/sysconfig/network-scripts/ifcfg-ethx for statelite node 2014-05-26 01:01:46 -04:00
daniceexi 641b6c7aa9 rh7 diskless support that don't cfg tmp in fstab 2014-05-26 01:01:34 -04:00
daniceexi 2000a8c562 for rh7, the initrd for stateless has to been built first to make the installkernel cfg file added first 2014-05-26 01:01:18 -04:00
daniceexi 6a50b11ffc use ip command to replace ifconfig in xcatroot for diskless on rh3 2014-05-26 01:00:58 -04:00
daniceexi 137e201aba add dracut support scripts for dracut-033. Most of them are copied from dracut 2014-05-26 00:59:24 -04:00
daniceexi 5fa4bdb407 code change for rh7 stateless support 2014-05-26 00:58:55 -04:00
litingt f2f22c029d xCAT 2.8.5 version file 2014-05-23 01:16:49 -07:00
root 9394d1bb66 Add the Version file 2014-05-22 23:52:26 -07:00
qyin 212e4ef603 driver patch code submit 2014-05-22 15:57:44 +08:00
Jia Zhao acd44f27ee fix bugs that duplicate mac could be imported 2014-05-19 14:28:58 +08:00
Jarrod Johnson 77dcec5195 Further changes for ADK 8.1 2014-05-16 15:16:22 -04:00
Jarrod Johnson 672fab87a9 Update for 8.1 version of ADK 2014-05-16 15:13:20 -04:00
Jarrod Johnson 8f9350ed61 Implement bittorrent support for RHEL stateless/statelite with ramfs 2014-05-15 10:24:54 -04:00
baiyuan ed3b0046da Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-05-15 03:53:49 -04:00
yinle f9f111fd08 minor fix 2014-05-15 06:45:50 -07:00
yinle abfd87772a Modify match info 2014-05-15 06:13:41 -07:00
yinle a00a818197 Merge branch '2.8' of ssh://git.code.sf.net/p//xcat/xcat-core into 2.8 2014-05-15 06:08:57 -07:00
baiyuan 2bcd1f152c support compiler xlf15 and xlc13 on aix 2014-05-15 03:49:41 -04:00
mellor 9b152fedd7 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-05-14 09:29:23 -04:00
yinle 10680eb9db Modify flag and help information 2014-05-13 05:39:51 -07:00
lissav 5451c4eb59 defect 4124 2014-05-12 12:47:14 -04:00
immarvin ded873f998 change the uploader to ligc 2014-05-12 02:20:56 -07:00
immarvin 30d891e341 fix defect #4123 [fvt]2.8.4:ubuntu 12.04 diskfull install failed 2014-05-12 01:46:04 -07:00
immarvin 961d68cd85 fix defect 4117 and 4113 2014-05-09 08:27:06 -07:00
immarvin ed76d20ea9 correct the dns configuration during node provision when unicast dhcp is enabled 2014-05-09 02:02:45 -07:00
yinle 467d54c4a3 Add some debug info for the script 2014-05-08 08:02:30 -07:00
yinle 854f6fde3b Add cmdcheck for xcattest 2014-05-08 06:09:20 -07:00
yinle a8835bef34 Add a new file restapitest 2014-05-08 05:15:30 -07:00
yinle bd70bdd89e Add a new restapitest script 2014-05-08 05:03:03 -07:00
immarvin b94432d9f1 add replace token in kickstart template file for rhels6.x86_64 and rhel7 to support unicast dhcp 2014-05-08 03:47:09 -07:00
immarvin f3f19a6ff6 fix the problem that redhat provisioning on X will enter infinite installation loop when unicats dhcp is enabled 2014-05-08 03:22:23 -07:00
daniceexi cb0f268589 defect 4116: fix the issue that send_response subroutine doesnot exist in xcatd 2.8.4 but was used. 2014-05-08 04:48:33 -04:00
Jarrod Johnson 94b107f138 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-05-07 14:17:22 -04:00
Jarrod Johnson ff49bb5e07 Recognize Win2012R2 media 2014-05-07 14:17:19 -04:00
mellor 564ded27a4 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-05-06 14:11:17 -04:00
lissav 80ce5532e7 defect 4112 2014-05-05 11:52:41 -04:00
lissav 9dca191638 old unused xCAT1 code defect 4077 2014-05-02 06:30:08 -04:00
lissav 571643a0d0 old unused xCAT1 code defect 4077 2014-05-02 06:27:12 -04:00
mellor 22b4999589 defect 4035 handle multiple servicenode entries 2014-04-30 17:49:31 -04:00
immarvin d9441efd57 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-04-30 09:36:44 -07:00
immarvin a31d548205 avoid running rpm command during package installation 2014-04-30 09:36:02 -07:00
Jarrod Johnson 73f2226193 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-04-30 10:32:12 -04:00
Jarrod Johnson 823798b9f2 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:32:08 -04:00
immarvin a8c10fa199 #3987 partitionfile=s: issues when using variables 2014-04-30 07:21:58 -07:00
lissav 91dadc8f23 add gettimezone common routine 2014-04-30 08:43:56 -04:00
zhaoertao f1aa61bcad fix bug 4109 mkvm failed with non-int parameters 2014-04-30 02:27:50 -07:00
Jarrod Johnson 715b868dbc Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-04-29 15:00:32 -04:00
Jarrod Johnson a0c4cdd996 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 15:00:23 -04:00
lissav f92c936704 Defect 4061 2014-04-29 09:04:31 -04:00
immarvin e071f801b2 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-04-29 00:19:43 -07:00
immarvin bb4ff64e33 fix defect #3997 node reinstall loop when site.nodestatus=0 Edit 2014-04-29 00:18:59 -07:00
zhaoertao b9d2723e86 fix bug 3934: mkdef/chdef -u needs better doc and 1 fix 2014-04-28 22:13:31 -07:00
immarvin 3a59513346 eliminate grub2-xcat dependency in xcat2.8.4 2014-04-28 20:51:29 -07:00
ligc a171f853fd add vlan support for configeth, could use the syntax eth1.2 to specify vlan tagging 2014-04-29 10:30:21 -05:00
zhaoertao c24ad60464 fix bugs about partitioning 2014-04-28 06:19:32 -07:00
yinle 6bf14a8c9a add new check item cmdcheck 2014-04-28 08:12:34 -07:00
daniceexi c17315bf74 defect 4065: add the description for site.externaldns in makedns.8.pod 2014-04-28 09:57:52 -04:00
immarvin 1c732974f8 add a new ubuntu dependency libcrypt-cbc-perl 2014-04-28 00:28:32 -07:00
immarvin 1f207f3815 add dependency libcrypt-rijndael-perl for ubuntu 2014-04-27 20:29:32 -07:00
Jarrod Johnson b53bce2abf Fix mistakes in bmcsetup 2014-04-25 13:19:45 -04:00
Jarrod Johnson 13c7ac5387 Remove deprecated timezones 2014-04-24 14:15:12 -04:00
daniceexi 0c7029f968 The script is used to run rest api test. 2014-04-24 04:37:18 -04:00
daniceexi bdabf1656d Code drop for the new REST API implementation. It's ported back from master. 2014-04-24 04:36:30 -04:00
daniceexi 9bb9da56ad added the token authentication mechanism in the xcatd 2014-04-24 04:32:04 -04:00
daniceexi 50b8eaff0a defect 4096: add the virtio driver for sles diskless so that sles kvm could boot with virtio driver 2014-04-24 04:13:15 -04:00
lissav 692f1b3fc8 Redhat7 support defect 4092 2014-04-23 14:52:42 -04:00
lissav a6956838bf better examples for setAttribs XML interface 2014-04-23 09:05:08 -04:00
arif ecd697995b defect #4061: fix DSHCLI.pm for append in hierarchy 2014-04-23 11:25:15 +01:00
litingt afd527f569 add suse support 2014-04-23 02:29:54 -07:00
lissav 2bb41a0363 remove getFacingIP. It is not used and does not support Redhat7 defect 4091 2014-04-22 11:05:16 -04:00
lissav 7306ca8abf remove unused code 2014-04-21 12:53:26 -04:00
immarvin 6795ff6d11 fix defect #4044 xCAT spec file %post additons not checking for AIX Edit 2014-04-21 03:23:14 -07:00
zhaoertao ba21ba9e80 fix bug 4088:xdsh to IBM RackSwitch does not work 2014-04-21 01:34:26 -07:00
zhaoertao b14184d3c8 fix bug 4075:nimol plugin has syntax errors 2014-04-21 00:15:07 -07:00
Jarrod Johnson 672fea4fa3 Recognize mpt3sas class adapters
Conflicts:

	xCAT-genesis-builder/installkernel
2014-04-18 10:52:08 -04:00
Lei Ai 91d901ae47 Create non-block mode call for nodechprofile 2014-04-18 15:43:41 +08:00
ligc 2a1481068e a typo in the comment 2014-04-17 23:00:56 -05:00
ligc 8c8e2978a8 fix for bug 4084: AIX rpm spec does not allow %if inside %ifos 2014-04-17 22:55:20 -05:00
lissav dd3ddd189b 4072 2014-04-17 10:16:49 -04:00
ligc 95f45af6b2 fix for bug 4074: different ifconfig -a output on RHEL7 2014-04-17 21:24:11 -05:00
immarvin 7a3555f5d4 add description of managedaddressmode 2014-04-17 03:15:26 -07:00
immarvin 60dc663290 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-04-17 03:05:54 -07:00
immarvin 534265abe9 enhance the dhcp unicast for some specific cases on nameservers and gateway value 2014-04-17 03:04:54 -07:00
zhaoertao 24e04c803f modify the manpage of rpower not to use internal node names 2014-04-17 01:52:59 -07:00
zhaoertao 2207e8401f fix bug 3893:rpower man page should note the need for the required ASU Power.S3Enable setting 2014-04-17 01:44:40 -07:00
Lei Ai 32a4c828ad Update node status correctly while operating profiled nodes. 2014-04-17 15:49:25 +08:00
litingt d3e5c6689c packimage osimage 2014-04-16 21:49:03 -07:00
ligc 256193a7b5 fix for bug 4084: AIX should not require grub2-xcat 2014-04-16 23:27:41 -04:00
zhaoertao 205ffb2499 for bug 4070 2014-04-16 19:55:45 -07:00
lissav f39aacb66a defect 4072 2014-04-16 15:09:43 -04:00
lissav 2690fa2e1f defect 4072 2014-04-16 12:05:04 -04:00
lissav f34cc4eddb defect 4072 2014-04-16 10:16:13 -04:00
lissav 22be9798a8 defect 4071 2014-04-16 10:12:38 -04:00
daniceexi 4b989a7133 add the site attribute description for dnsupdaters and persistkvmguests 2014-04-16 08:43:37 -04:00
zhaoertao fa892a7212 The HMC version 8 drop the prompt space when log on to it 2014-04-15 22:07:55 -07:00
daniceexi ab463f13fe 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:10:29 -04:00
lissav e580d74003 add more comments about externaldns 2014-04-15 13:28:34 -04:00
lissav 300bc61da3 defect 4061 2014-04-15 11:38:13 -04:00
Jarrod Johnson e6df2e97a4 Revert "Have openssl req use better message digest"
This reverts commit 73b9ef07ad.
2014-04-15 09:13:04 -04:00
daniceexi 1aeffad4c9 add the site description for externaldns attribute 2014-04-15 13:13:24 -04:00
daniceexi 571828264d back port the missed checked in from 2.9 branch: Add support for external DNS and DHCP servers 2014-04-15 13:03:01 -04:00
lissav 430b645907 defect 4061 2014-04-14 13:06:09 -04:00
immarvin 66337343c9 enhance the getNodeNetworkCfg to return the gateway info 2014-04-14 02:20:07 -07:00
ligc 414d609d48 fix for bug 4062: add autocommit=0 when opening the nodelist table 2014-04-14 16:10:37 -05:00
huweihua 290b28a5be fix defect 4006 2014-04-14 01:29:55 -04:00
zhaoertao 4e637eedb5 change the bug fix of 3993:DFM support Powerlinux,chvm doesn't update node attributes 2014-04-13 20:05:02 -07:00
Jarrod Johnson ff8463b32c Undo the increase in efi volume and instead influence anaconda's perspective of the 'bios' drive 2014-04-11 11:29:28 -04:00
lissav 2673c5fb1a fix vbox defect 4057 2014-04-11 05:43:40 -04:00
immarvin 35d65f1a0b support unicast dhcp during provisioning and 1st boot, including diskful for sles and rh 2014-04-11 02:40:34 -07:00
ligc bbe9bc188c fix for bug 4059: trim the / at the end of pkgdir 2014-04-11 15:43:13 -05:00
lissav 8a592c77aa defect 4049 broadcast updatenode -g if sharedtftp=0 2014-04-10 12:44:54 -04:00
Jarrod Johnson df9d6651ec 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:40:53 -04:00
zhaoertao 7bdf705d16 fix bug 3993 DFM support Powerlinux, chvm doesn't update node attributes 2014-04-10 04:07:25 -07:00
lissav 0d75780fce defect 4053 2014-04-09 11:13:21 -04:00
lissav f6b3d0322f defect 4052 2014-04-09 09:39:53 -04:00
ligc 27d31e7293 add the rhelhpc6.5 support 2014-04-09 13:57:11 -05:00
ligc fd85a8a619 add the discinfo for CentOS 5.10 2014-04-09 13:23:21 -05:00
mellor 9c572d1e27 defect 4049 change Postage.pm to call my_if_facing if xcatmaster attr not set 2014-04-08 17:14:37 -04:00
lissav e8e7d91a2e defect 4051 do not ship ipmi.pm on AIX 2014-04-08 12:32:12 -04:00
lissav 984b9e4d51 defect 4050 2014-04-08 07:49:27 -04:00
zhaoertao e636416bfe fix bug 4032: not single quoted in /opt/xcat/share/xcat/cons/ipmi 2014-04-08 02:05:57 -07:00
lissav a5b01dbd24 force a build 2014-04-07 13:44:09 -04:00
lissav 6019c0d697 do not build softlayer on AIX defect 4048 2014-04-07 12:58:53 -04:00
lissav c76cd5f2f8 defect 4047 2014-04-07 10:52:29 -04:00
lissav 3d93b9ba93 defect 4047 perl warnings 2014-04-07 10:36:18 -04:00
arif 26b4569508 defect #4045: fix gpfs_updates to use MASTER instead of SITEMASTER for hierarchical situations 2014-04-07 14:06:13 +01:00
arif 0e6d87f5a4 Merge branch 'fix/makeroutes-part2' into 2.8 2014-04-07 13:10:35 +01:00
Jarrod Johnson 55d47839c4 Fix windows install problem where tmplfile was masked out in scope 2014-04-04 23:28:17 -04:00
linggao 572a0bb460 Merge branch '2.8' of ssh://linggao@git.code.sf.net/p/xcat/xcat-core into 2.8 2014-04-05 04:38:21 -04:00
linggao b370907634 removed the dependency on openrc file, fixed defect 4040 and 4041 2014-04-05 04:36:52 -04:00
linggao 89e2fc66ef added verbose output for opsaddimage and opsaddbmnode commands. 2014-04-04 06:36:43 -04:00
ligc 2474427a83 Temporary remove the grub2-xcat dependency for PCM, it blockes PCM test 2014-04-04 04:33:37 -04:00
litingt f41edd8ea9 merge 2.9 case to 2.8 2014-04-04 01:38:35 -07:00
litingt ff91be5c39 merge 2.9 case to 2.8 2014-04-04 01:36:01 -07:00
litingt 3b57c88ab7 add case from 2.9 to 2.8 2014-04-04 01:29:25 -07:00
litingt dec6b1959a merge 2.8 with 2.9 2014-04-04 01:27:07 -07:00
litingt 04cc48fdb0 add case from 2.9 to 2.8 branch 2014-04-04 01:24:46 -07:00
litingt 28ef6ce19e merge 2.8 and 2.9 code 2014-04-04 01:18:26 -07:00
litingt 5366151b02 merge 2.8 and 2.9 code 2014-04-04 01:15:13 -07:00
litingt 23a7490fb5 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-04-04 01:06:46 -07:00
ligc 3a3eff189f Build a separate xCAT-server for PCM, because of the perl-JSON dependency caused by RESTAPI 2014-04-04 14:47:38 -05:00
litingt 5485ab5079 merge different with 2.9 2014-04-04 01:05:14 -07:00
lissav 8a38dbf685 fix syntax in hellp 2014-04-03 07:08:04 -04:00
ligc 840ac69826 fix for 4029: do not try to modify /, will cause rpm install failure on RHEL7 2014-04-03 15:08:39 -05:00
ligc c65f529c55 add README: backport from master branch 2014-04-02 23:24:34 -04:00
ligc d3c33681c8 fix for bug 4038: do not override --installdir with xcatdsklspost 2014-04-03 09:46:25 -05:00
mellor 99a04964c7 defect 4026 add service node to error msg 2014-04-02 13:04:05 -04:00
ligc bb06e4479e add the git commit information with xCAT version 2014-04-02 17:33:18 -05:00
Chuck Brazie a087fedb68 fix missspelling 2014-04-01 13:41:55 -04:00
Chuck Brazie 51920d7e58 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-04-01 13:11:19 -04:00
Lissa Valletta ce87bdceac fixup Zone.pm 2014-04-01 07:02:11 -04:00
mellor a3b09614f6 defect 4020 - correctly handle results from gethostbyaddr in xcatd installmonitor 2014-03-31 17:48:58 -04:00
lissav 9f475a70f7 fix defect 4034 2014-03-31 14:25:26 -04:00
Lissa Valletta 8fd5c23330 zone updates 2014-02-18 10:44:13 -05:00
Chuck Brazie 82715fac09 Comment out \ h escape character 2014-01-15 07:49:29 -05:00
216 changed files with 13573 additions and 8892 deletions
+14
View File
@@ -0,0 +1,14 @@
xCAT - eXtreme Cloud Administration Toolkit
xCAT is a toolkit for the deployment and administration of clusters.
xCAT documentation is available at: http://xcat.sourceforge.net/
xCAT is made available as open source software under the EPL license:
http://www.opensource.org/licenses/eclipse-1.0.php
+1 -1
View File
@@ -1 +1 @@
2.8.4
2.8.5
+4 -4
View File
@@ -53,7 +53,7 @@ for i in $*; do
done
# Supported distributions
dists="maverick natty oneiric precise saucy"
dists="maverick natty oneiric precise saucy trusty"
c_flag= # xcat-core (trunk-delvel) path
d_flag= # xcat-dep (trunk) path
@@ -86,7 +86,7 @@ if [ "$c_flag" -a "$d_flag" ];then
exit 2
fi
uploader="bp-sawyers"
uploader="ligc"
# Find where this script is located to set some build variables
old_pwd=`pwd`
cd `dirname $0`
@@ -279,7 +279,7 @@ __EOF__
cat << '__EOF__' > mklocalrepo.sh
. /etc/lsb-release
cd `dirname $0`
echo deb file://"`pwd`" $DISTRIB_CODENAME main > /etc/apt/sources.list.d/xcat-core.list
echo deb [arch=amd64] file://"`pwd`" $DISTRIB_CODENAME main > /etc/apt/sources.list.d/xcat-core.list
__EOF__
chmod 775 mklocalrepo.sh
@@ -380,7 +380,7 @@ __EOF__
cat << '__EOF__' > mklocalrepo.sh
. /etc/lsb-release
cd `dirname $0`
echo deb file://"`pwd`" $DISTRIB_CODENAME main > /etc/apt/sources.list.d/xcat-dep.list
echo deb [arch=amd64] file://"`pwd`" $DISTRIB_CODENAME main > /etc/apt/sources.list.d/xcat-dep.list
__EOF__
chmod 775 mklocalrepo.sh
+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
Executable
+160
View File
@@ -0,0 +1,160 @@
#######################################################################
#build script for local usage
#used for Linux/AIX/Ubuntu
#
###########################################################################
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"
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."
exit 1
fi
# Get a lock, so can not do 2 builds at once
exec 8>/var/lock/xcatbld.lock
if ! flock -n 8; then
echo "Can't get lock /var/lock/xcatbld.lock. Someone else must be doing a build right now. Exiting...."
exit 1
fi
#delete old package if there is
rm -rf $CURDIR/build/
cd $CURDIR
echo "==============================================="
echo $NAMEALL | egrep "Ubuntu"
#Check if it is an Ubuntu system
if [ $? -eq 0 ]; then
echo "This is an Ubuntu system"
pkg_type="snap"
build_string="Snap_Build"
cur_date=`date +%Y%m%d`
short_ver=`cat Version|cut -d. -f 1,2`
pkg_version="${short_ver}-${pkg_type}${cur_date}"
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]'`
echo "============================================"
echo "$rpmname_low"
cd $rpmname
dch -v $pkg_version -b -c debian/changelog $build_string
dpkg-buildpackage -uc -us
rc=$?
if [ $rc -gt 0 ]; then
echo "Error: $rpmname build package failed exit code $rc"
fi
cd -
mv ${rpmname_low}* $CURDIR/build
done
#delete all files except .deb file
find $CURDIR/build/* ! -name *.deb | xargs rm -f
else
#This is not an Ubuntu system
echo "This is an $OSNAME system"
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
$CURDIR/makerpm $rpmname
done
#build xCAT-genesis-scripts if it is x86_64 platform
ARCH=$(uname -p)
if [ "$ARCH" = "x64_64" ]; then
$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
$CURDIR/makerpm $rpmname
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname"; fi
else
for arch in x86_64 ppc64 s390x; do
$CURDIR/makerpm $rpmname $arch
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname-$arch"; fi
done
fi
done
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
+1
View File
@@ -85,6 +85,7 @@ function makexcat {
cd `dirname $0`/$RPMNAME
tar --exclude .svn -czf $RPMROOT/SOURCES/license.tar.gz LICENSE.html
cp xcat.conf $RPMROOT/SOURCES
cp xcat.conf.apach24 $RPMROOT/SOURCES
cp xCATSN $RPMROOT/SOURCES
cd - >/dev/null
elif [ "$RPMNAME" = "xCAT-buildkit" ]; then
+1 -1
View File
@@ -48,7 +48,7 @@ binary-arch: build install
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/share/doc/man5/*
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/share/man/man7/*
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/share/doc/man7/*
./modifyUtils `cat ../Version` `svn info | grep Revision | cut -d" " -f 2`
./modifyUtils `cat ../Version` `git log -n 1 | head -n 1 | cut -f 2 -d ' '`
# dh_installmenu
# dh_installdebconf
# dh_installlogrotate
+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
Regular → Executable
+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.
+125 -2
View File
@@ -500,6 +500,7 @@ sub setCFMPkglistFile {
Arguments:
$imagename - the specified linuximage name
@curospkgs - the currently selected OS packages list
$mode - using Fuzzy Matching or Exact Matching to check packages
Returns:
0 - update successfully
1 - update failed
@@ -509,13 +510,22 @@ sub setCFMPkglistFile {
none
Example:
my $ret = CAT::CFMUtils->updateCFMPkglistFile($imagename, @cur_selected_pkgs);
my $ret = CAT::CFMUtils->updateCFMPkglistFile($imagename, @cur_selected_pkgs, 1);
=cut
#-----------------------------------------------------------------------------
sub updateCFMPkglistFile {
my ($class, $img, $ospkgs) = @_;
my ($class, $img, $ospkgs, $mode) = @_;
if(defined($mode)){
# Exact Matching
$mode = 1;
}else {
# Fuzzy Matching
$mode = 0;
}
my @cur_selected = @$ospkgs;
my $cfmpkglist = "/install/osimages/$img/pkglist.cfm";
@@ -549,6 +559,14 @@ sub updateCFMPkglistFile {
my @selected = @$selected_ref;
@basepkgs = xCAT::CFMUtils->arrayops("U", \@basepkgs, \@selected);
}
# Fuzzy Matching
if (not $mode){
my ($ref1, $ref2, $ref3) = xCAT::CFMUtils->updateSelectedPkgs(\@pre_selected, \@pre_removed, \@cur_selected);
@pre_selected = @$ref1;
@pre_removed = @$ref2;
@cur_selected = @$ref3;
}
# get diff between previous and current selected OS packages lists
my @diff = xCAT::CFMUtils->getPkgsDiff(\@pre_selected, \@cur_selected);
@@ -661,6 +679,48 @@ sub getPreOSpkgsList {
return (\@selected, \@removed);
}
#-----------------------------------------------------------------------------
=head3 getPreBaseOSpkgsList
Get previously selected and removed base OS packages lists from pkglist file. Packages named with "example.xxx" should be the base name "example"
Arguments:
$ospkglist - the path for ospkglist file
Returns:
refs for selected and removed OS packages arrays
Globals:
none
Error:
none
Example:
my $pre_selected_ref = xCAT::CFMUtils->getPreOSpkgsList($ospkglist);
=cut
#-----------------------------------------------------------------------------
sub getPreBaseOSpkgsList {
my ($class, $pkglist) = @_;
my ($pre_selected_ref, $pre_removed_ref) = xCAT::CFMUtils->getPreOSpkgsList($pkglist);
my %pre_selected_hash = ();
foreach (@$pre_selected_ref) {
my @names = split(/\./, $_);
my $basename = $names[0];
if ($_ =~ /^$basename\.([^\.]+)$/) {
$pre_selected_hash{$basename} = 1;
}else {
$pre_selected_hash{$_} = 1;
}
}
my @pre_selected = keys %pre_selected_hash;
return \@pre_selected;
}
#-----------------------------------------------------------------------------
=head3 getPkgsDiff
@@ -819,3 +879,66 @@ sub arrayops {
#return (\@union, \@intersection, \@difference);
}
#-----------------------------------------------------------------------------
=head3 updateSelectedPkgs
Update previous selected, previous removed and current selected packages based on fuzzy matching rules. Packages named with "example.i686" should be same with package "example"
Arguments:
\@pre_selected - reference to previous selected packages
\@pre_removed - reference to previous removed packages
\@cur_selected - reference to current selected packages
Returns:
new previous selected, previous removed, current selected packages
Globals:
none
Error:
none
Example:
my ($ref1, $ref2, $ref3) = xCAT::CFMUtils->arrayops(\@pre_selected, \@pre_removed, \@cur_selected);
=cut
#-----------------------------------------------------------------------------
sub updateSelectedPkgs() {
my ($class, $pre_selected_ref, $pre_removed_ref, $cur_selected_ref) = @_;
my %pre_selected_hash = map{$_ => 1} @$pre_selected_ref;
my %pre_removed_hash = map{$_ => 1} @$pre_removed_ref;
my %cur_selected_hash = map{$_ => 1} @$cur_selected_ref;
my %new_pre_selected_hash = %pre_selected_hash;
my %new_pre_removed_hash = %pre_removed_hash;
my %new_cur_selected_hash = %cur_selected_hash;
foreach (keys %cur_selected_hash) {
my $father = $_;
my $flag = 0;
foreach (keys %pre_selected_hash) {
my $child = $_;
if ($child =~ /^$father\.([^\.]+)$/) {
$new_cur_selected_hash{$child} = 1;
$flag = 1;
}
}
if ($flag and not exists $pre_selected_hash{$father}){
delete $new_cur_selected_hash{$father} if exists $new_cur_selected_hash{$father};
}
foreach (keys %pre_removed_hash) {
my $child = $_;
if ($child =~ /^$father\.([^\.]+)$/) {
delete $new_pre_removed_hash{$child} if exists $new_pre_removed_hash{$child};
}
}
}
my @new_cur_selected = keys %new_cur_selected_hash;
my @new_pre_selected = keys %new_pre_selected_hash;
my @new_pre_removed = keys %new_pre_removed_hash;
return (\@new_pre_selected, \@new_pre_removed, \@new_cur_selected);
}
+1 -1
View File
@@ -27,7 +27,7 @@ if ($inet6support) {
if ($^O =~ /^linux/i) {
# Is IPv6 enabled on the MN or xcat client node at all?
my $ipv6enabled = `ip addr | grep inet6`;
my $ipv6enabled = `ip addr 2> /dev/null | grep inet6`;
if (!$ipv6enabled) {
$inet6support = 0;
}
+40 -26
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}});
@@ -1020,6 +1020,7 @@ sub fork_fanout_dsh
}
}
# save the original exports, we are going to add the unique node name below
my $firstpass=0;
while (@$targets_waiting
&& (keys(%$targets_active) < $$options{'fanout'}))
{
@@ -1046,6 +1047,7 @@ sub fork_fanout_dsh
}
if ($$options{'environment'})
{
if ($firstpass ==0) { # do the servicenode stuff only once
# if we are on a servicenode need to get the environment file
# from the SNsyncfiledir, not local
if (xCAT::Utils->isServiceNode()) {
@@ -1068,8 +1070,10 @@ sub fork_fanout_dsh
$rsp->{error}->[0] = "File $$options{'environment'} does not exist";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
}
# build the xdsh command
push @dsh_command,
$firstpass=1;
}
# build the xdsh command
push @dsh_command,
"$exportnode$$options{'pre-command'} . $$options{'environment'} ; $$options{'command'}$$options{'post-command'}";
}
@@ -3993,8 +3997,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 +4036,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 +4408,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 +4505,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 +4975,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 +5017,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 +5038,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 +5211,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 +5240,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 +5323,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 +5353,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 +6043,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);
}
}
}
#---------------------------------------------------------------------------
+4 -4
View File
@@ -264,7 +264,7 @@ sub temp {
# No frame commands for IVM
#################################
if ( $hwtype eq "ivm" ) {
push @result, [$name,"$prefix Not available (No BPA)",1];
push @result, [$name,"$prefix Not available (No BPA)",0];
next;
}
#################################
@@ -272,14 +272,14 @@ sub temp {
#################################
if ( @$d[4] !~ /^(fsp|lpar|cec)$/ ) {
my $text = "$prefix Only available for CEC/LPAR";
push @result, [$name,$text,1];
push @result, [$name,$text,0];
next;
}
#################################
# Error - No frame
#################################
if ( $mtms eq "0" ) {
push @result, [$name,"$prefix Not available (No BPA)",1];
push @result, [$name,"$prefix Not available (No BPA)",0];
next;
}
#################################
@@ -352,7 +352,7 @@ sub rackenv {
#################################
if ( @$d[4] !~ /^(bpa|frame)$/ ) {
my $text = "$prefix Only available for BPA/Frame";
push @result, [$name,$text,1];
push @result, [$name,$text,0];
next;
}
+212 -33
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,15 +48,26 @@ 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',
'del_physlots' => '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;
my $opt = shift;
# Partition used attributes #
my @support_ops = qw(vmcpus vmmemory vmphyslots vmothersetting vmstorage vmnics del_vadapter);
my @support_ops = qw(vmcpus vmmemory vmphyslots vmothersetting vmstorage vmnics del_vadapter del_physlots);
if (ref($args) ne 'ARRAY') {
return "$args";
}
my %tmp_hash = ();
foreach (@$args) {
my ($cmd, $value) = split (/\=/, $_);
if (!defined($value)) {
@@ -75,14 +86,30 @@ 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 "del_physlots") {
my @tmp_array = split ",",$value;
foreach (@tmp_array) {
unless (/(0x\w{8})/) {
return "'$_' is invalid";
}
}
} 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 +184,7 @@ sub chvm_parse_extra_options {
}
$opt->{$cmd} = $value;
}
@query_array = keys(%tmp_hash);
return undef;
}
@@ -719,7 +747,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 +786,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)) {
@@ -775,7 +804,7 @@ sub do_op_extra_cmds {
$action = "set_huge_page";
} elsif ($op eq "vmcpus") {
$action = "part_set_lpar_pending_proc";
} elsif ($op eq "vmphyslots") {
} elsif ($op eq "vmphyslots" or $op eq "del_physlots") {
$action = "set_io_slot_owner_uber";
} elsif ($op eq "del_vadapter") {
$action = "part_clear_vslot_config";
@@ -827,17 +856,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 {
@@ -863,15 +892,26 @@ sub do_op_extra_cmds {
}
my $tmp_value = ($param eq '*') ? $name : $param;
xCAT::MsgUtils->verbose_message($request, "$request->{command} $action for node:$name, parm:$tmp_value.");
my $value = xCAT::FSPUtils::fsp_api_action($request, $name, $d, $action, 0, $tmp_value);
my @tmpd = @$d;
if ($op eq "del_physlots") {
@tmpd[0] = "-1";
}
my $value = xCAT::FSPUtils::fsp_api_action($request, $name, \@tmpd, $action, 0, $tmp_value);
if (@$value[1] && ((@$value[1] =~ /Error/i) && (@$value[2] ne '0'))) {
return ([[$name, @$value[1], '1']]) ;
} else {
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 +1692,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 +1713,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 +1731,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 +1784,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 +1799,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 +1863,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 +1936,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 +2082,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 +2218,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 +2291,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 +2343,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 +2384,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;
}
+6 -8
View File
@@ -217,14 +217,13 @@ sub is_me
#my ($b1, $b2, $b3, $b4) = split /\./, $nameIP;
# get all the possible IPs for the node I'm running on
my $ifcmd = "ifconfig -a | grep 'inet'";
my $result = xCAT::Utils->runcmd($ifcmd, -1, 1);
my $ipcmd = "ip addr | grep 'inet'";
my $result = xCAT::Utils->runcmd($ipcmd, -1, 1);
if ($::RUNCMD_RC != 0)
{
my $rsp;
# push @{$rsp->{data}}, "Could not run $ifcmd.\n";
# xCAT::MsgUtils->message("E", $rsp, $callback);
$::VERBOSE = $verb;
my $str="Error running ipcmd";
xCAT::MsgUtils->message("S", $str);
$::VERBOSE = $verb;
return 0;
}
@@ -232,7 +231,6 @@ sub is_me
{
my ($inet, $myIP, $str) = split(" ", $int);
chomp $myIP;
$myIP =~ s/addr://;
$myIP =~ s/\/.*//; # ipv6 address 4000::99/64
$myIP =~ s/\%.*//; # ipv6 address ::1%1/128
@@ -1023,7 +1021,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;
+8 -2
View File
@@ -1240,6 +1240,12 @@ sub ping_server{
$msg[3] = "Status: ping return code now on stack\n";
$newstate[3] = 4;
# get the timeout for ping test
my $to4pt;
if ( $ENV{TIMEOUT4PINGTEST} =~ /^\d+$/ ) {
$to4pt = ",$ENV{TIMEOUT4PINGTEST}";
}
#IPv6
if ( $server_ip =~ /:/ ) {
#::1, calculate link local address
@@ -1249,9 +1255,9 @@ sub ping_server{
} else {
$linklocal_ip = $client_ip;
}
$cmd[3] = "ping $full_path_name:ipv6,$server_ip,$linklocal_ip,$gateway_ip\r";
$cmd[3] = "ping $full_path_name:ipv6,$server_ip,$linklocal_ip,$gateway_ip$to4pt\r";
} else {
$cmd[3] = "ping $full_path_name:$server_ip,$client_ip,$gateway_ip\r";
$cmd[3] = "ping $full_path_name:$server_ip,$client_ip,$gateway_ip$to4pt\r";
}
$pattern[3] = ".*ping(.*)ok(.*)0 >(.*)";
+265 -177
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 };
@@ -642,16 +643,11 @@ sub get_nic_ip
{
my $nic;
my %iphash;
my $cmd = "ifconfig -a";
my $result = `$cmd`;
my $mode = "MULTICAST";
my $payingattention=0;
my $interface;
my $keepcurrentiface;
#############################################
# Error running command
#############################################
if ( !$result ) {
return undef;
}
if (xCAT::Utils->isAIX()) {
##############################################################
@@ -663,6 +659,14 @@ sub get_nic_ip
# en1: ...
#
##############################################################
my $cmd = "ifconfig -a";
my $result = `$cmd`;
#############################################
# Error running command
#############################################
if ( !$result ) {
return undef;
}
my @adapter = split /(\w+\d+):\s+flags=/, $result;
foreach ( @adapter ) {
if ($_ =~ /^(en\d)/) {
@@ -682,37 +686,39 @@ sub get_nic_ip
}
}
}
else {
##############################################################
# Should look like this for Linux:
# eth0 Link encap:Ethernet HWaddr 00:02:55:7B:06:30
# inet addr:9.114.154.193 Bcast:9.114.154.223
# inet6 addr: fe80::202:55ff:fe7b:630/64 Scope:Link
# UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
# RX packets:1280982 errors:0 dropped:0 overruns:0 frame:0
# TX packets:3535776 errors:0 dropped:0 overruns:0 carrier:0
# collisions:0 txqueuelen:1000
# RX bytes:343489371 (327.5 MiB) TX bytes:870969610 (830.6 MiB)
# Base address:0x2600 Memory:fbfe0000-fc0000080
#
# eth1 ...
#
##############################################################
my @adapter= split /\n{2,}/, $result;
foreach ( @adapter ) {
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+)/ ) {
$iphash{$nic} = $1;
next;
}
else { # linux
my @ipoutput = `ip addr`;
#############################################
# Error running command
#############################################
if ( !@ipoutput ) {
return undef;
}
foreach my $line (@ipoutput) {
if ($line =~ /^\d/) { # new interface, new context..
if ($interface and not $keepcurrentiface) {
#don't bother reporting unusable nics
delete $iphash{$interface};
}
$keepcurrentiface=0;
if ( !($line =~ /LOOPBACK/ ) and
$line =~ /UP( |,|>)/ and
$line =~ /$mode/ ) {
$payingattention=1;
$line =~ /^([^:]*): ([^:]*):/;
$interface=$2;
} else {
$payingattention=0;
next;
}
}
unless ($payingattention) { next; }
if ($line =~ /inet/) {
$keepcurrentiface=1;
}
if ( $line =~ /^\s*inet \s*(\d+\.\d+\.\d+\.\d+)/ ) {
$iphash{$interface} = $1;
}
}
}
@@ -1595,56 +1601,124 @@ sub thishostisnot
=cut
#-----------------------------------------------------------------------------
#sub gethost_ips1
#{
# my ($class) = @_;
# my $cmd;
# my @ipaddress;
# $cmd = "ifconfig" . " -a";
# $cmd = $cmd . "| grep \"inet\"";
# my @result = xCAT::Utils->runcmd($cmd, 0);
# if ($::RUNCMD_RC != 0)
# {
# xCAT::MsgUtils->message("S", "Error from $cmd\n");
# exit $::RUNCMD_RC;
# }
# foreach my $addr (@result)
# {
# my @ip;
# if (xCAT::Utils->isLinux())
# {
# if ($addr =~ /inet6/)
# {
# #TODO, Linux ipv6
# }
# else
# {
# my ($inet, $addr1, $Bcast, $Mask) = split(" ", $addr);
# #@ip = split(":", $addr1);
# #push @ipaddress, $ip[1];
# $addr1 =~ s/.*://;
# push @ipaddress, $addr1;
# }
# }
# else
# { #AIX
# if ($addr =~ /inet6/)
# {
# $addr =~ /\s*inet6\s+([\da-fA-F:]+).*\/(\d+)/;
# my $v6ip = $1;
# my $v6mask = $2;
# if ($v6ip)
# {
# push @ipaddress, $v6ip;
# }
# }
# else
# {
# my ($inet, $addr1, $netmask, $mask1, $Bcast, $bcastaddr) =
# split(" ", $addr);
# push @ipaddress, $addr1;
# }
#
# }
# }
# my @names = @ipaddress;
# foreach my $ipaddr (@names)
# {
# my $hostname = xCAT::NetworkUtils->gethostname($ipaddr);
# if ($hostname)
# {
# my @shorthost = split(/\./, $hostname);
# push @ipaddress, $shorthost[0];
# }
# }
#
# return @ipaddress;
#}
sub gethost_ips
{
my ($class) = @_;
my $cmd;
my @ipaddress;
$cmd = "ifconfig" . " -a";
$cmd = $cmd . "| grep \"inet\"";
my @result = xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
if (xCAT::Utils->isLinux())
{
xCAT::MsgUtils->message("S", "Error from $cmd\n");
exit $::RUNCMD_RC;
$cmd="ip -4 --oneline addr show |awk -F ' ' '{print \$4}'|awk -F '/' '{print \$1}'";
my @result =xCAT::Utils->runcmd($cmd);
if ($::RUNCMD_RC != 0)
{
xCAT::MsgUtils->message("S", "Error from $cmd\n");
exit $::RUNCMD_RC;
}
push @ipaddress, @result;
}
foreach my $addr (@result)
{
my @ip;
if (xCAT::Utils->isLinux())
{
if ($addr =~ /inet6/)
{
#TODO, Linux ipv6
}
else
{
my ($inet, $addr1, $Bcast, $Mask) = split(" ", $addr);
@ip = split(":", $addr1);
push @ipaddress, $ip[1];
}
}
else
{ #AIX
if ($addr =~ /inet6/)
{
$addr =~ /\s*inet6\s+([\da-fA-F:]+).*\/(\d+)/;
my $v6ip = $1;
my $v6mask = $2;
if ($v6ip)
{
push @ipaddress, $v6ip;
}
}
else
{
my ($inet, $addr1, $netmask, $mask1, $Bcast, $bcastaddr) =
split(" ", $addr);
push @ipaddress, $addr1;
}
else
{ #AIX
$cmd = "ifconfig" . " -a";
$cmd = $cmd . "| grep \"inet\"";
my @result = xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{
xCAT::MsgUtils->message("S", "Error from $cmd\n");
exit $::RUNCMD_RC;
}
foreach my $addr (@result)
{
if ($addr =~ /inet6/)
{
$addr =~ /\s*inet6\s+([\da-fA-F:]+).*\/(\d+)/;
my $v6ip = $1;
my $v6mask = $2;
if ($v6ip)
{
push @ipaddress, $v6ip;
}
}
else
{
my ($inet, $addr1, $netmask, $mask1, $Bcast, $bcastaddr) =
split(" ", $addr);
push @ipaddress, $addr1;
}
}
}
}
my @names = @ipaddress;
foreach my $ipaddr (@names)
{
@@ -1655,9 +1729,9 @@ sub gethost_ips
push @ipaddress, $shorthost[0];
}
}
return @ipaddress;
}
#-------------------------------------------------------------------------------
=head3 get_subnet_aix
@@ -1833,102 +1907,6 @@ sub validate_ip
}
return([0]);
}
#-------------------------------------------------------------------------------
=head3 getFacingIP
Gets the ip address of the adapter of the localhost that is facing the
the given node.
Assume it is the same as my_ip_facing...
Arguments:
The name of the node that is facing the localhost.
Returns:
The ip address of the adapter that faces the node.
=cut
#-------------------------------------------------------------------------------
sub getFacingIP
{
my ($class, $node) = @_;
my $ip;
my $cmd;
my @ipaddress;
my $nodeip = inet_ntoa(inet_aton($node));
unless ($nodeip =~ /\d+\.\d+\.\d+\.\d+/)
{
return 0; #Not supporting IPv6 here IPV6TODO
}
$cmd = "ifconfig" . " -a";
$cmd = $cmd . "| grep \"inet \"";
my @result = xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{
xCAT::MsgUtils->message("S", "Error from $cmd\n");
exit $::RUNCMD_RC;
}
# split node address
my ($n1, $n2, $n3, $n4) = split('\.', $nodeip);
foreach my $addr (@result)
{
my $ip;
my $mask;
if (xCAT::Utils->isLinux())
{
my ($inet, $addr1, $Bcast, $Mask) = split(" ", $addr);
if ((!$addr1) || (!$Mask)) { next; }
my @ips = split(":", $addr1);
my @masks = split(":", $Mask);
$ip = $ips[1];
$mask = $masks[1];
}
else
{ #AIX
my ($inet, $addr1, $netmask, $mask1, $Bcast, $bcastaddr) =
split(" ", $addr);
if ((!$addr1) && (!$mask1)) { next; }
$ip = $addr1;
$mask1 =~ s/0x//;
$mask =
`printf "%d.%d.%d.%d" \$(echo "$mask1" | sed 's/../0x& /g')`;
}
if ($ip && $mask)
{
# split interface IP
my ($h1, $h2, $h3, $h4) = split('\.', $ip);
# split mask
my ($m1, $m2, $m3, $m4) = split('\.', $mask);
# AND this interface IP with the netmask of the network
my $a1 = ((int $h1) & (int $m1));
my $a2 = ((int $h2) & (int $m2));
my $a3 = ((int $h3) & (int $m3));
my $a4 = ((int $h4) & (int $m4));
# AND node IP with the netmask of the network
my $b1 = ((int $n1) & (int $m1));
my $b2 = ((int $n2) & (int $m2));
my $b3 = ((int $n3) & (int $m3));
my $b4 = ((int $n4) & (int $m4));
if (($b1 == $a1) && ($b2 == $a2) && ($b3 == $a3) && ($b4 == $a4))
{
return $ip;
}
}
}
xCAT::MsgUtils->message("S", "Cannot find master for the node $node\n");
return 0;
}
#-------------------------------------------------------------------------------
=head3 isIpaddr
@@ -1981,6 +1959,108 @@ sub isIpaddr
}
}
#-------------------------------------------------------------------------------
=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 getNodeGateway
Description:
Get gateway from the networks table of the node.
Arguments:
ip: the ip address of the node
Returns:
Return a string, of the gateway
undef - Failed to get the gateway
Globals:
none
Error:
none
Example:
my $gateway = xCAT::NetworkUtils::getNodeGateway('192.168.1.0');
Comments:
none
=cut
#-------------------------------------------------------------------------------
sub getNodeGateway
{
my $ip=shift;
if( $ip =~ /xCAT::NetworkUtils/)
{
$ip=shift;
}
my $gateway=undef;
my $nettab = xCAT::Table->new("networks");
if ($nettab) {
my @nets = $nettab->getAllAttribs('net','mask','gateway');
foreach my $net (@nets) {
if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $ip, $net->{'mask'}, 0)) {
$gateway=$net->{'gateway'};
}
}
}
return $gateway;
}
#-------------------------------------------------------------------------------
=head3 getNodeNetworkCfg
@@ -2007,19 +2087,27 @@ 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;
last if ( xCAT::NetworkUtils::isInSameSubnet( $netname, $ip, $mask, 1));
}
return ($ip, $node, undef, xCAT::NetworkUtils::formatNetmask($mask,1,0));
$gateway=xCAT::NetworkUtils::getNodeGateway($ip);
return ($ip, $node, $gateway, xCAT::NetworkUtils::formatNetmask($mask,1,0));
}
#-------------------------------------------------------------------------------
=head3 get_hdwr_ip
+3 -3
View File
@@ -436,9 +436,9 @@ sub sshcfg {
#####################################
# userid@host not found in key file
#####################################
if ( $sshkey !~ /\s+(\S+\@\S+$)/ ) {
return( [[$server,"Cannot find userid\@host in '$fname'",RC_ERROR]] );
}
#if ( $sshkey !~ /\s+(\S+\@\S+$)/ ) {
# return( [[$server,"Cannot find userid\@host in '$fname'",RC_ERROR]] );
#}
my $logon = $1;
#####################################
+1 -1
View File
@@ -156,7 +156,7 @@ sub connect {
# Shell prompt regexp based on HW Type
##################################################
my %prompt = (
hmc => "~> \$",
hmc => "~>\\s*\$",
ivm => "\\\$ \$"
);
##################################################
+2 -2
View File
@@ -347,7 +347,7 @@ sub bus {
#################################
# Output header
#################################
push @result, [$name,"I/O Bus Information"];
push @result, [$name,"I/O Bus Information", 0];
#################################
# Output error
@@ -532,7 +532,7 @@ sub config {
#################################
# Output header
#################################
push @result, [$name,"Machine Configuration Info"];
push @result, [$name,"Machine Configuration Info", 0];
my $i;
foreach ( @prefix ) {
+4 -4
View File
@@ -203,7 +203,7 @@ sub voltage {
# Voltages available in frame
#################################
if ( @$d[4] ne "bpa" ) {
push @result, [$name,"$text Only available for BPA",1];
push @result, [$name,"$text Only available for BPA",0];
next;
}
my $volt = enumerate_volt( $exp, $d );
@@ -256,7 +256,7 @@ sub temp {
# No frame commands for IVM
#################################
if ( $hwtype eq "ivm" ) {
push @result, [$name,"$prefix Not available (No BPA)",1];
push @result, [$name,"$prefix Not available (No BPA)",0];
next;
}
#################################
@@ -264,14 +264,14 @@ sub temp {
#################################
if ( @$d[4] !~ /^(fsp|cec|lpar)$/ ) {
my $text = "$prefix Only available for CEC/LPAR";
push @result, [$name,$text,1];
push @result, [$name,$text,0];
next;
}
#################################
# Error - No frame
#################################
if ( $mtms eq "0" ) {
push @result, [$name,"$prefix Not available (No BPA)",1];
push @result, [$name,"$prefix Not available (No BPA)",0];
next;
}
#################################
+4
View File
@@ -810,6 +810,10 @@ sub senddeviceskeys
# add to the command
$setupcmd .=$key;
$setupcmd .="\"";
# Special case for vios
if ($ENV{DEVICETYPE} eq 'vios') {
$setupcmd = "\"echo $key | tee -a ~/.ssh/authorized_keys2\"";
}
# For each input device
my @nodelist=split(/,/,$nodes);
foreach my $node (@nodelist) {
+70 -4
View File
@@ -389,7 +389,46 @@ ipmi => {
descriptions => {
node => 'The node name or group name.',
bmc => 'The hostname of the BMC adapater.',
bmcport => 'In systems with selectable shared/dedicated ethernet ports, this parameter can be used to specify the preferred port. 0 means use the shared port, 1 means dedicated, blank is to not assign',
bmcport => ' In systems with selectable shared/dedicated ethernet ports,
this parameter can be used to specify the preferred port. 0
means use the shared port, 1 means dedicated, blank is to not
assign.
The following special cases exist for IBM System x servers:
For x3755 M3 systems, 0 means use the dedicated port, 1 means
shared, blank is to not assign.
For certain systems which have a mezzaine or ML2 adapter, there is a second
value to include:
For x3750 M4 (Model 8722):
0 2 1st 1Gbps interface for LOM
0 0 1st 10Gbps interface for LOM
0 3 2nd 1Gbps interface for LOM
0 1 2nd 10Gbps interface for LOM
For x3750 M4 (Model 8752), x3850/3950 X6, dx360 M4, x3550 M4, and x3650 M4:
0 Shared (1st onboard interface)
1 Dedicated
2 0 First interface on ML2 or mezzanine adapter
2 1 Second interface on ML2 or mezzanine adapter
2 2 Third interface on ML2 or mezzanine adapter
2 3 Fourth interface on ML2 or mezzanine adapter',
taggedvlan => 'Have bmcsetup place the BMC on the specified vlan tag on a shared netwirk interface. Some network devices may be incompatible with this option',
bmcid => 'Unique identified data used by discovery processes to distinguish known BMCs from unrecognized BMCs',
username => 'The BMC userid. If not specified, the key=ipmi row in the passwd table is used as the default.',
@@ -708,7 +747,7 @@ linuximage => {
table_desc => 'Information about a Linux operating system image that can be used to deploy cluster nodes.',
descriptions => {
imagename => 'The name of this xCAT OS image definition.',
template => 'The fully qualified name of the template file that is used to create the kick start file for diskful installation.',
template => 'The fully qualified name of the template file that will be used to create the OS installer configuration file for stateful installations (e.g. kickstart for RedHat, autoyast for SLES).',
boottarget => 'The name of the boottarget definition. When this attribute is set, xCAT will use the kernel, initrd and kernel params defined in the boottarget definition instead of the default.',
addkcmdline=> 'User specified arguments to be passed to the kernel. The user arguments are appended to xCAT.s default kernel arguments. This attribute is ignored if linuximage.boottarget is set.',
pkglist => 'The fully qualified name of the file that stores the distro packages list that will be included in the image. Make sure that if the pkgs in the pkglist have dependency pkgs, the dependency pkgs should be found in one of the pkgdir',
@@ -727,7 +766,7 @@ linuximage => {
permission => 'The mount permission of /.statelite directory is used, its default value is 755',
dump => qq{The NFS directory to hold the Linux kernel dump file (vmcore) when the node with this image crashes, its format is "nfs://<nfs_server_ip>/<kdump_path>". If you want to use the node's "xcatmaster" (its SN or MN), <nfs_server_ip> can be left blank. For example, "nfs:///<kdump_path>" means the NFS directory to hold the kernel dump file is on the node's SN, or MN if there's no SN.},
crashkernelsize => 'the size that assigned to the kdump kernel. If the kernel size is not set, 256M will be the default value.',
partitionfile => 'The path of the configuration file which is used to part the disk for the node. For stateful: two types of value can be set for this attribute. One is "<partition file absolute path>", the content of the partition file must use the corresponding format with the OS type. The other one is "s:<partition file absolute path>", the content of the partition file should be a shell script which must write the partition definition into /tmp/partitionfile on the node. For statelite: the valid value is <partition file absolute path>, refer to the statelite doc for the xCAT defined format of the configuration file.',
partitionfile => 'The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "<partition file absolute path>" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES). "s:<partitioning script absolute path>" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify "<partition file absolute path>"; see the xCAT Statelite documentation for the xCAT defined format of this configuration file.',
driverupdatesrc => 'The source of the drivers which need to be loaded during the boot. Two types of driver update source are supported: Driver update disk and Driver rpm package. The value for this attribute should be comma separated sources. Each source should be the format tab:full_path_of_srouce_file. The tab keyword can be: dud (for Driver update disk) and rpm (for driver rpm). If missing the tab, the rpm format is the default. e.g. dud:/install/dud/dd.img,rpm:/install/rpm/d.rpm',
comments => 'Any user-written notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
@@ -742,7 +781,7 @@ winimage => {
imagename => 'The name of this xCAT OS image definition.',
template => 'The fully qualified name of the template file that is used to create the windows unattend.xml file for diskful installation.',
installto => 'The disk and partition that the Windows will be deployed to. The valid format is <disk>:<partition>. If not set, default value is 0:1 for bios boot mode(legacy) and 0:3 for uefi boot mode; If setting to 1, it means 1:1 for bios boot and 1:3 for uefi boot',
partitionfile => 'The path of partition configuration file. Since the partition configuration for bios boot mode and uefi boot mode are different, this configuration file should include two parts if customer wants to support both bios and uefi mode. If customer just wants to support one of the modes, specify one of them anyway. Example of partition configuration file: [BIOS]xxxxxxx[UEFI]yyyyyyy. To simplify the setting, you also can set installto in partitionfile with section likes [INSTALLTO]0:1',
partitionfile => 'The path of partition configuration file. Since the partition configuration for bios boot mode and uefi boot mode are different, this configuration file can include both configurations if you need to support both bios and uefi mode. Either way, you must specify the boot mode in the configuration. Example of partition configuration file: [BIOS]xxxxxxx[UEFI]yyyyyyy. To simplify the setting, you also can set installto in partitionfile with section like [INSTALLTO]0:1',
winpepath => 'The path of winpe which will be used to boot this image. If the real path is /tftpboot/winboot/winpe1/, the value for winpepath should be set to winboot/winpe1',
comments => 'Any user-written notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
@@ -916,6 +955,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".
@@ -936,6 +980,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".
@@ -1091,6 +1141,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".
@@ -1563,6 +1617,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;
+2 -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
@@ -243,6 +243,7 @@ my %usage = (
chvm <noderange> [vmcpus=min/req/max] [vmmemory=min/req/max]
[vmphyslots=drc_index1,drc_index2...] [vmothersetting=hugepage:N,bsr:N]
[vmnics=vlan1,vlan2] [vmstorage=<N|viosnode:slotid>] [--vios]
chvm <noderange> [del_physlots=drc_index1,drc_index2...]
chvm <noderange> [del_vadapter=slotid]
VMware specific:
chvm <noderange> [-a size][-d disk][-p disk][--resize disk=size][--cpus count][--mem memory]
+587 -5
View File
@@ -1339,11 +1339,30 @@ sub runxcmd_output
}
}
}
if (defined($node->{error}))
{
if (ref(\($node->{error}->[0])) eq 'SCALAR')
{
$desc = $desc . ": " . $node->{error}->[0];
}
}
if (defined($node->{errorcode}))
{
if (ref(\($node->{errorcode}->[0])) eq 'SCALAR')
{
$::RUNCMD_RC |= $node->{errorcode}->[0];
}
}
push @$::xcmd_outref, $desc;
}
if (defined($resp->{error}))
{
push @$::xcmd_outref, @{$resp->{error}};
if (ref($resp->{error}) eq 'ARRAY')
{
push @$::xcmd_outref, @{$resp->{error}};
} else {
push @$::xcmd_outref, $resp->{error};
}
}
if (defined($resp->{errorcode}))
{
@@ -1829,8 +1848,7 @@ sub get_image_name
#-------------------------------------------------------------------------------
=head3 StartService
Supports AIX and Linux as long as the service is registered with
lssrc or startsrc.
Supports AIX only, for Linux use startservice
Used by the service node plugin (AAsn.pm) to start requested services.
Checks to see if the input service is already started. If it is started
it stops and starts the service. Otherwise
@@ -1850,7 +1868,9 @@ sub get_image_name
Example:
if (xCAT::Utils->startService("named") { ...}
Comments:
none
this subroutine is deprecated,
will be used as an internal function to process AIX service,
for linux, use xCAT::Utils->startservice instead
=cut
@@ -3425,10 +3445,11 @@ sub version_cmp {
string of the bin file name
Returns:
string of the full path name of the binary executable file
string of the bin file name in the argument if failed
Globals:
none
Error:
string of the bin file name in the argument
none
Example:
my $CHKCONFIG = xCAT::Utils->fullpathbin("chkconfig");
Comments:
@@ -3459,5 +3480,566 @@ 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 -xtype f -exec cmp -s $localtime {} \\; -print | grep -v posix | grep -v SystemV | grep -v right | grep -v localtime ";
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;
}
#--------------------------------------------------------------------------------
=head3 servicemap
returns the name of service unit(for systemd) or service daemon(for SYSVinit).
Arguments:
$svcname: the name of the service
$svcmgrtype: the service manager type:
0: SYSVinit
1: systemd
2: upstart
Returns:
the name of service unit or service daemon
undef on fail
Globals:
none
Error:
None
Example:
my $svc = xCAT::Utils->servicemap($svcname,1);
Comments:
none
=cut
#--------------------------------------------------------------------------------
sub servicemap{
my $svcname=shift;
if( $svcname =~ /xCAT::Utils/)
{
$svcname=shift;
}
my $svcmgrtype=shift;
#hash structure:
#"service name $svcname" =>{
#"service manager name(SYSVinit/systemd) $svcmgrtype"
#=> ["list of possible service file names for the specified $svcname under the specified $svcmgrtype "]
# }
my %svchash=(
"dhcp" => ["dhcp3-server","dhcpd","isc-dhcp-server"],
"nfs" => ["nfsserver","nfs-server","nfs","nfs-kernel-server"],
"named" => ["named","bind9"],
"syslog" => ["syslog","syslogd","rsyslog"],
"firewall" => ["iptables","firewalld","SuSEfirewall2_setup","ufw"],
"http" => ["apache2","httpd"],
"ntpserver" =>["ntpd","ntp"],
"mysql" => ["mysqld","mysql"],
);
my $path=undef;
my $postfix="";
my $retdefault=$svcname;
if($svcmgrtype == 0){
$path="/etc/init.d/";
}elsif ($svcmgrtype == 1){
$path="/usr/lib/systemd/system/";
$postfix=".service";
$retdefault=$svcname.".service";
}elsif ($svcmgrtype == 2){
$path="/etc/init/";
$postfix=".conf";
}
my $ret=undef;
if($svchash{$svcname}){
foreach my $file (@{$svchash{$svcname}}){
if(-e $path.$file.$postfix ){
$ret=$file;
last;
}
}
}else{
if(-e $path.$retdefault.$postfix){
$ret=$retdefault;
}
}
return $ret;
}
#--------------------------------------------------------------------------------
=head3 startservice
start a service
Arguments:
service name
Returns:
0 on success
nonzero otherwise
Globals:
none
Error:
none
Example:
xCAT::Utils->startservice("nfs");
Comments:
none
=cut
#--------------------------------------------------------------------------------
sub startservice{
my $svcname=shift;
if( $svcname =~ /xCAT::Utils/)
{
$svcname=shift;
}
my $cmd="";
#for Systemd
my $svcunit=undef;
#for sysVinit
my $svcd=undef;
#for upstart
my $svcjob=undef;
$svcunit=servicemap($svcname,1);
$svcjob=servicemap($svcname,2);
$svcd=servicemap($svcname,0);
if($svcunit)
{
$cmd="systemctl start $svcunit";
}
elsif( $svcjob )
{
$cmd="initctl start $svcjob";
}
elsif( $svcd )
{
$cmd="service $svcd start";
}
#print "$cmd\n";
if( $cmd eq "" )
{
return -1;
}
#xCAT::Utils->runcmd($cmd, -1); # do not use runcmd (backtics), must use system to not fork
system($cmd);
$::RUNCMD_RC=$?;
return $::RUNCMD_RC;
}
#--------------------------------------------------------------------------------
=head3 stopservice
stop a service
Arguments:
service name
Returns:
0 on success
nonzero otherwise
Globals:
none
Error:
none
Example:
xCAT::Utils->stopservice("nfs");
Comments:
none
=cut
#--------------------------------------------------------------------------------
sub stopservice{
my $svcname=shift;
if( $svcname =~ /xCAT::Utils/)
{
$svcname=shift;
}
my $cmd="";
my $svcunit=undef;
my $svcd=undef;
my $svcjob=undef;
$svcunit=servicemap($svcname,1);
$svcjob=servicemap($svcname,2);
$svcd=servicemap($svcname,0);
if($svcunit)
{
$cmd="systemctl stop $svcunit";
}
elsif( $svcjob )
{
$cmd="initctl status $svcjob |grep stop; if [ \"\$?\" != \"0\" ]; then initctl stop $svcjob ; fi";
}
elsif( $svcd )
{
$cmd="service $svcd stop";
}
#print "$cmd\n";
if( $cmd eq "" )
{
return -1;
}
#xCAT::Utils->runcmd($cmd, -1); # do not use runcmd (backtics), must use system to not fork
system($cmd);
$::RUNCMD_RC=$?;
return $::RUNCMD_RC;
}
#--------------------------------------------------------------------------------
=head3 restartservice
restart a service
Arguments:
service name
Returns:
0 on success
nonzero otherwise
Globals:
none
Error:
none
Example:
xCAT::Utils->restartservice("nfs");
Comments:
none
=cut
#--------------------------------------------------------------------------------
sub restartservice{
my $svcname=shift;
if( $svcname =~ /xCAT::Utils/)
{
$svcname=shift;
}
my $cmd="";
my $svcunit=undef;
my $svcd=undef;
my $svcjob=undef;
$svcunit=servicemap($svcname,1);
$svcjob=servicemap($svcname,2);
$svcd=servicemap($svcname,0);
if($svcunit)
{
$cmd="systemctl restart $svcunit";
}
elsif( $svcd )
{
$cmd="service $svcd restart";
}
elsif( $svcjob )
{
$cmd="initctl status $svcjob |grep stop; if [ \"\$?\" != \"0\" ]; then initctl restart $svcjob ; else initctl start $svcjob; fi";
}
#print "$cmd\n";
if( $cmd eq "" )
{
return -1;
}
xCAT::Utils->runcmd($cmd, -1);
return $::RUNCMD_RC;
}
#--------------------------------------------------------------------------------
=head3 checkservicestatus
returns theservice status.
Arguments:
$svcname: the name of the service
$outputoption[optional]:
the output option
1: return a hashref with the keys:"retcode","retmsg"
otherwise: return retcode only
Returns:
undef on fail
a hashref if $outputoption is 1,the hash structure is:
{"retcode"=>(status code, 0 for running/active,1 for stopped/inactive,2 for failed)
"retmsg" =>(status string, running/active/stopped/inactive/failed)
}
the status code otherwise
Globals:
none
Error:
None
Example:
my $ret = xCAT::Utils-checkservicestatus($svcname,1);
my $retcode = xCAT::Utils-checkservicestatus($svcname);
Comments:
none
=cut
#--------------------------------------------------------------------------------
sub checkservicestatus{
my $svcname=shift;
if( $svcname =~ /xCAT::Utils/)
{
$svcname=shift;
}
my $outputoption=shift;
my $cmd="";
my $svcunit=undef;
my $svcd=undef;
my $svcjob=undef;
my %ret;
$svcunit=servicemap($svcname,1);
$svcjob=servicemap($svcname,2);
$svcd=servicemap($svcname,0);
my $output=undef;
if($svcunit)
{
#for systemd, parse the output since it is formatted
$cmd="systemctl show --property=ActiveState $svcunit|awk -F '=' '{print \$2}'";
$output=xCAT::Utils->runcmd($cmd, -1);
if($output =~ /^active$/i){
$ret{retcode}=0;
}elsif($output =~ /^failed$/i){
$ret{retcode}=2;
}elsif($output =~ /^inactive$/i){
$ret{retcode}=1;
}
}
elsif ( $svcjob )
{
#for upstart, parse the output
$cmd="initctl status $svcjob";
$output=xCAT::Utils->runcmd($cmd, -1);
if($output =~ /waiting/i){
$ret{retcode}=2;
}elsif($output =~ /running/i){
$ret{retcode}=0;
}
}
elsif( $svcd )
{
#for SYSVinit, check the return value since the "service" command output is confused
$cmd="service $svcd status";
$output=xCAT::Utils->runcmd($cmd, -1);
$ret{retcode}=$::RUNCMD_RC;
# if($output =~ /stopped|not running/i){
# $ret{retcode}=1;
# }elsif($output =~ /running/i){
# $ret{retcode}=0;
# }
}
if($output)
{
$ret{retmsg}=$output;
}
if(defined $outputoption and $outputoption == 1 ){
return \%ret;
}elsif(exists $ret{retcode}){
return $ret{retcode};
}
return undef;
}
#--------------------------------------------------------------------------------
=head3 enableservice
enable a service to start it on the system bootup
Arguments:
service name
Returns:
0 on success
nonzero otherwise
Globals:
none
Error:
none
Example:
xCAT::Utils->enableservice("nfs");
Comments:
none
=cut
#--------------------------------------------------------------------------------
sub enableservice{
my $svcname=shift;
if( $svcname =~ /xCAT::Utils/)
{
$svcname=shift;
}
my $cmd="";
my $svcunit=undef;
my $svcd=undef;
my $svcjob=undef;
$svcunit=servicemap($svcname,1);
$svcjob=servicemap($svcname,2);
$svcd=servicemap($svcname,0);
if($svcunit)
{
$cmd="systemctl enable $svcunit";
}
elsif($svcjob)
{
$cmd="update-rc.d $svcjob defaults";
}
elsif( $svcd )
{
my $CHKCONFIG = xCAT::Utils->fullpathbin("chkconfig");
if($CHKCONFIG ne "chkconfig"){
$cmd="$CHKCONFIG $svcd on";
}else{
$CHKCONFIG = xCAT::Utils->fullpathbin("update-rc.d");
if($CHKCONFIG ne "update-rc.d"){
$cmd="$CHKCONFIG $svcd defaults";
}
}
}
if( $cmd eq "" )
{
return -1;
}
xCAT::Utils->runcmd($cmd, -1);
return $::RUNCMD_RC;
}
#--------------------------------------------------------------------------------
=head3 disableservice
disable a service to prevent it from starting on system bootup
Arguments:
service name
Returns:
0 on success
nonzero otherwise
Globals:
none
Error:
none
Example:
xCAT::Utils->disableservice("nfs");
Comments:
none
=cut
#--------------------------------------------------------------------------------
sub disableservice{
my $svcname=shift;
if( $svcname =~ /xCAT::Utils/)
{
$svcname=shift;
}
my $cmd="";
my $svcunit=undef;
my $svcjob=undef;
my $svcd=undef;
$svcunit=servicemap($svcname,1);
$svcjob=servicemap($svcname,2);
$svcd=servicemap($svcname,0);
if($svcunit)
{
$cmd="systemctl disable $svcunit";
}
elsif($svcjob)
{
$cmd="update-rc.d -f $svcjob remove";
}
elsif( $svcd )
{
my $CHKCONFIG = xCAT::Utils->fullpathbin("chkconfig");
if($CHKCONFIG ne "chkconfig"){
$cmd="$CHKCONFIG $svcd off";
}else{
$CHKCONFIG = xCAT::Utils->fullpathbin("update-rc.d");
if($CHKCONFIG ne "update-rc.d"){
$cmd="$CHKCONFIG -f $svcd remove";
}
}
}
# print "$cmd\n";
if( $cmd eq "" )
{
return -1;
}
xCAT::Utils->runcmd($cmd, -1);
return $::RUNCMD_RC;
}
1;
+3
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,8 @@ 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
"1399449226.140088" => "rhelhpc7.0",#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
@@ -2405,7 +2405,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;
my @results = split(' ', $out);
if ( $results[3] eq "0" ) {
$results[3] = "0M";
@@ -0,0 +1,10 @@
# AIX Bundle file for compiler runtime packages
I:xlC.aix61
I:xlC.rte
I:xlfrte
I:xlfrte.aix61
I:xlfrte.msg.en_US
I:xlsmp.aix61.rte
I:xlsmp.msg.en_US.rte
I:xlsmp.rte
@@ -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
@@ -62,7 +62,8 @@ else
file=$1
fi
ifconfig -a | grep 'inet ' | awk ' { print $2 } ' | grep -v 127.0.0.1 |
#ifconfig -a | grep 'inet ' | awk ' { print $2 } ' | grep -v 127.0.0.1 |
ip -4 -oneline addr show 2>/dev/null |grep inet | sed -ne "s/.*inet //p"|awk -F ' ' '{print $1}'|awk -F '/' '{print $1}'|
while read my_address ; do
##print "checking $my_address"
grep -q " ${my_address}$" $file
@@ -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
@@ -100,8 +100,8 @@ change_host_name()
if [ "$str_os_type" = "sles" ];then
echo "Persistently changing the hostname not implemented yet."
#debian ubuntu
elif [ "$str_os_type" = "debian" ];then
#debian ubuntu and rh7
elif [ -f "/etc/hostname" ];then
conf_file="/etc/hostname"
echo "$str_hostname" > $conf_file
else
@@ -36,8 +36,8 @@ change_host_name()
if [ "$str_os_type" = "sles" ];then
echo "Persistently changing the hostname not implemented yet."
#debian ubuntu
elif [ "$str_os_type" = "debian" ];then
#debian ubuntu and rh7
elif [ -f "/etc/hostname" ];then
conf_file="/etc/hostname"
echo "$str_hostname" > $conf_file
else
+1 -1
View File
@@ -92,7 +92,7 @@ rm -rf $RPM_BUILD_ROOT
%ifos linux
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
if [ -f $RPM_INSTALL_PREFIX0/sbin/xcatd ]; then
/etc/init.d/xcatd reload
/etc/init.d/xcatd restart
fi
fi
%endif
+14 -5
View File
@@ -38,11 +38,9 @@ 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 ."; }
if (!$slinstalled) { die "$@\nError: either the SoftLayer::API::SOAP perl module is not installed, or some dependencies are missing. Download it using 'git clone https://github.com/softlayer/softlayer-api-perl-client', put the directory in ~/.slconfig , and ensure its dependencies are installed."; }
my $client = SoftLayer::API::SOAP->new('SoftLayer_Account', undef, $CONFIG{userid}, $CONFIG{apikey});
@@ -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: ";
+88
View File
@@ -0,0 +1,88 @@
#!/usr/bin/perl
# remove entries from the .ssh/known_hosts file for a node
use strict;
use Getopt::Long;
use Data::Dumper;
#$Data::Dumper::Maxdepth=2;
# Globals - these are set once and then only read.
my $HELP;
my $VERBOSE;
my $file = '~/.ssh/known_hosts';
my $usage = sub {
my $exitcode = shift @_;
print "Usage: khrem <node>\n";
print " Removes the entries in the .ssh/known_hosts file associated with this node.\n";
exit $exitcode;
};
# Process the cmd line args
Getopt::Long::Configure("bundling");
#Getopt::Long::Configure("pass_through");
Getopt::Long::Configure("no_pass_through");
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE)) { $usage->(1); }
if ($HELP) { $usage->(0); }
if (scalar(@ARGV)!=1) { $usage->(1); }
my $node = $ARGV[0]; # if they specified a hostname match, only show svrs that start with that
my @output = runcmd("host $node");
my $hostname;
my $line = shift @output;
#print "line=$line\n";
if ($line =~ m/is an alias for /) {
($hostname) = $line =~ m/is an alias for ([^\.]+)/;
#print "hostname=$hostname\n";
$line = shift @output;
}
#print "line=$line\n";
my ($ip) = $line =~ m/has address (.+)$/;
if (defined($hostname)) {
print "Removing entries from $file for: $node, $hostname, $ip\n";
runcmd("sed -i '/^$node/d;/^$hostname/d;/^$ip/d' $file");
}
else {
print "Removing entries from $file for: $node, $ip\n";
runcmd("sed -i '/^$node/d;/^$ip/d' $file");
}
exit(0);
# Pring msg only if -v was specified
sub verbose { if ($VERBOSE) { print shift, "\n"; } }
# Run a command. If called in the context of return an array, it will capture the output
# of the cmd and return it. Otherwise, it will display the output to stdout.
# If the cmd has a non-zero rc, this function will die with a msg.
sub runcmd
{
my ($cmd) = @_;
my $rc;
$cmd .= ' 2>&1' ;
verbose($cmd);
my @output;
if (wantarray) {
@output = `$cmd`;
$rc = $?;
}
else {
system($cmd);
$rc = $?;
}
if ($rc) {
$rc = $rc >> 8;
if ($rc > 0) { die "Error: rc $rc return from cmd: $cmd\n"; }
else { die "Error: system error returned from cmd: $cmd\n"; }
}
elsif (wantarray) { return @output; }
}
+102 -23
View File
@@ -12,12 +12,14 @@ use Socket;
# Globals - these are set once and then only read.
my $HELP;
my $VERBOSE;
my $DRYRUN;
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] [--dryrun] [-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 +32,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, 'dryrun' => \$DRYRUN, 'w|waittime=s' => \$WAITTIME, 'p|provmethod=s' => \$PROVMETHOD)) { $usage->(1); }
if ($HELP) { $usage->(0); }
if (scalar(@ARGV) != 4) { $usage->(1); }
@@ -58,41 +60,95 @@ sub addKernelParms {
# replace <nodename> with the nodename
my $nodename = $ENV{NODE}; # this env var is set by xdsh
$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";
}
#todo: if you are running genesis shell (nodeset <node> shell), this if-else will depend on the nodeset done before that.
# really should check for currstate=shell, or something like that
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
#todo: the parameters for kickstart are likely different
$args->{kernelparms} .= " $bootif hostip=$ip netmask=$netmask gateway=$gateway dns=$mnip hostname=$nodename netdevice=$nic netwait=$WAITTIME textmode=1";
# print Dumper($args->{kernelparms})
}
}
# 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
my ($ipprefix) = $args->{mnip}=~m/^(\d+)\./; #todo: this is a hack, just using the 1st octet of the mn ip addr
verbose("using IP prefix $ipprefix");
# parse ip addr show output, looking for ipprefix, to determine nic and ip
my @output = runcmd("ip addr show");
my ($nic, $ipandmask);
# parse ip addr show output, looking for ipprefix, to determine nic, ip, mac
my @output = runcmd("/sbin/ip addr show");
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);
if (!defined($ipandmask)) { die "Error: can't find a NIC with a prefix $ipprefix that communicates with".$args->{mnip}.".\n"; }
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;
# if the nic is a bonded nic (common on sl), then find the 1st real nic that is up that is part of it.
# also find that real nics real mac
my $realnic;
if ($nic =~ /^bond/) {
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+): /;
foreach my $line (@nics) {
my ($nictmp, $state) = $line=~m/^\d+:\s+(\S+): .* state\s+(\S+)/;
if (defined($nictmp) && defined($state) && $state eq 'UP') { $realnic = $nictmp; last; } # got ip, we are done
}
if (!defined($realnic)) { die "Error: can't find a physical NIC that is up and part of $nic.\n"; }
# now get the real mac of this real nic (when 2 nics are bonded, ip addr show displays one of the nics
# macs for both nics and the bond). So we have to depend on /proc/net/bonding/$bond instead.
my @bondout = runcmd("cat /proc/net/bonding/$nic");
my $foundnic;
foreach my $line (@bondout) {
my $mactmp;
if ($line=~m/^Slave Interface:\s+$realnic/) { $foundnic = 1; } # found the stanza for this nic, remember it
if ($foundnic && (($mactmp) = $line=~m/^Permanent HW addr:\s+(\S+)/)) { $mac = $mactmp; last; }
}
}
else { $realnic = $nic; }
# centos/redhat seems to name the nic in a different order than sles on some svrs.
# sles seems to name them in the same order as 'ip addr show' displays them, centos does not.
# so if we are on centos right now, we need to count down to determine the number that sles
# will give the nic that we have selected, because it is the sles naming that we care about,
# because that is the initrd that will be running in the scripted install case.
# For the sysclone case, genesis doxcat should be changed to use the mac to find the nic.
if (isRedhat()) {
my @nics = grep(m/^\d+:\s+eth/, @output);
my $i = 0;
foreach my $line (@nics) {
my ($nictmp) = $line=~m/^\d+:\s+(\S+):/;
if (defined($nictmp) && $nictmp eq $realnic) { $realnic = "eth$i"; last; } # got ip, we are done
$i++;
}
}
print "Determined that SLES will call the install NIC $realnic (it has mac $mac)\n";
# finally, find the gateway
my $gateway;
my @output = runcmd("ip route");
my @output = runcmd("/sbin/ip route");
# we are looking for a line like: 10.0.0.0/8 via 10.54.51.1 dev bond0
my @networks = grep(m/ via .* $nic\s*$/, @output);
if (scalar(@networks)) { ($gateway) = $networks[0]=~m/ via\s+(\S+)/; }
@@ -102,19 +158,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);
}
@@ -155,6 +229,11 @@ sub updateGrub {
"\tkernel " . $fileprefix . $args->{kernelpath} . ' ' . $args->{kernelparms} . "\n",
"\tinitrd " . $fileprefix . $args->{initrdpath} . "\n",
);
if ($DRYRUN) {
print "Dry run: would add this stanza to $grubfile:\n";
foreach my $l (@entry) { print $l; }
return;
}
my $needtowritefile = 1;
if (grep(/^title\s+$XCATNETBOOTTITLE/, @lines)) { $needtowritefile = updateGrubEntry(\@lines, \@entry); } # there is already an entry in there
+155 -21
View File
@@ -13,12 +13,13 @@ use Data::Dumper;
# Globals - these are set once and then only read.
my $HELP;
my $VERBOSE;
my $DRYRUN;
my $WAITTIME;
my $NOAUTOINST;
my $usage = sub {
my $exitcode = shift @_;
print "Usage: pushinitrd [-?|-h|--help] [-v|--verbose] [-w <waittime>] <noderange>\n\n";
print "Usage: pushinitrd [-?|-h|--help] [-v|--verbose] [--dryrun] [-w <waittime>] <noderange>\n\n";
if (!$exitcode) {
print "Copy the initrd, kernel, params, and static IP info to nodes, so they can net install\n";
print "even across vlans (w/o setting up pxe/dhcp broadcast relay). This assumes a working\n";
@@ -32,7 +33,7 @@ my $usage = sub {
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, 'a|noautoinst' => \$NOAUTOINST)) { $usage->(1); }
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'dryrun' => \$DRYRUN, 'w|waittime=s' => \$WAITTIME, 'a|noautoinst' => \$NOAUTOINST)) { $usage->(1); }
if ($HELP) { $usage->(0); }
if (scalar(@ARGV) != 1) { $usage->(1); }
@@ -45,32 +46,45 @@ copyFilesToNodes($noderange, \%bootparms);
updateGrubOnNodes($noderange, \%bootparms);
if (!$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
if ($DRYRUN) { exit(0); }
if ($bootparms{osimageprovmethod} eq 'install' && !$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
if ($bootparms{osimageprovmethod} eq 'sysclone') { copySyscloneFiles(); }
exit(0);
sub isRedhat { return (-e '/etc/redhat-release' || -e '/etc/centos-release' || -e '/etc/fedora-release'); }
# Query the db for the kernel, initrd, and kcmdline attributes of the 1st node in the noderange
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*//;
#print "gresults='$gresults[0]'\n";
if ($gresults[0] !~ m/\S/) { die "Error: attribute $attr not defined for the noderange. Did you run 'nodeset <noderange> osimage=<osimage>' ?\n"; }
$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]);
if ($output[0] =~ m/^Could not find/) { die "Error: provmethod $bootparms{provmethod} is set for the node, but there is no osimage definition by that name."; }
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;
@@ -90,8 +104,13 @@ sub copyFilesToNodes {
my $localfile = "/tftpboot/$file";
# for the
my $remotefile = '/boot/' . remoteFilename($file);
print "Copying $localfile to $nr:$remotefile\n";
runcmd("xdcp $nr -p $localfile $remotefile");
if ($DRYRUN) {
print "Dry run: would copy $localfile to $nr:$remotefile\n";
}
else {
print "Copying $localfile to $nr:$remotefile\n";
runcmd("xdcp $nr -p $localfile $remotefile");
}
}
}
@@ -99,7 +118,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;
}
@@ -110,10 +129,12 @@ sub updateGrubOnNodes {
my $nr = shift @_;
my $bootparms = shift @_;
my $vtxt = ($VERBOSE ? '-v' : '');
my $dtxt = ($DRYRUN ? '--dryrun' : '');
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 $euser ="root";
my $cmd = "xdsh $nr -l $euser -e $modifygrub $vtxt $dtxt -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.
@@ -124,8 +145,7 @@ sub updateGrubOnNodes {
}
# Hack the autoinst files to wait in a key spot to make them work even tho it takes
# the NICs almost a min before they can transmit after a state change.
# Hack the autoinst files to overcome the nic coming up delay.
#todo: this has only been tested with SLES nodes
sub modifyAutoinstFiles {
my $nr = shift @_;
@@ -135,30 +155,144 @@ sub modifyAutoinstFiles {
my @nodes = runcmd("nodels $nr");
chomp(@nodes);
# Modify chroot.sles to insert a wait in the /etc/init.d/network of each node. This is
# necessary because even tho compute.sles11.softlayer.tmpl configures bonding, when autoyast
# reboots the node after installing the rpms, it does not bring up the network in the normal way
# at first and seems to skip any bonding and the if-up.d scripts. So we are left doing this.
# (After autoyast is done with all of its post-configuration, it brings up the network in the
# normal way, so bonding gets done then, which is good at least.)
# 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';
# 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 actually update the file
# Add a script that gets invoked by the OS after the nic is brought up
# Note: 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 the media
# 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';
#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
#);
# The compute.sles11.softlayer.tmpl file contains 2 variables (node ip and netmask) that are
# not replaced by Template.pm. Substitute those in the autoinst files now.
# Also use our own multiline sed to put the network script hack in.
print "Updating /install/autoinst files.\n";
foreach my $n (@nodes) {
my $f = "/install/autoinst/$n";
my ($ip, $netmask, $gateway) = getNodeIpInfo($n);
runcmd("sudo sed -i 's/#NODEIPADDR#/$ip/;s/#NODENETMASK#/$netmask/;s/#NODEGATEWAY#/$gateway/' $f");
my $matches = sed($f, $search, $replace, mode=>'insertbefore');
if (!$matches) { die "Error: could not find the right place in $f to insert the sed of the network wait.\n"; }
}
}
# 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);
}
# Get IP and network of a node
sub getNodeIpInfo {
my $node = shift;
# get ip for the node
my @output = runcmd("nodels $node hosts.ip");
chomp($output[0]);
my ($junk, $ip) = split(/\s+/, $output[0]);
#todo: also support getting the ip from name resolution
if (!$ip) { die "Error: the ip attribute must be set for $node.\n"; }
# find relevant network in the networks table
# first get the networks in a hash
my %networks;
@output = runcmd("lsdef -t network -ci net,mask,gateway");
foreach my $line (@output) {
chomp($line);
my ($netname, $attr, $val) = $line =~ m/^(.+):\s+(.+?)=(.+)$/;
$networks{$netname}->{$attr} = $val;
}
# now go thru the networks looking for the correct one
my ($netmask, $gateway);
foreach my $key (keys %networks) {
if (isIPinNet($ip, $networks{$key}->{net}, $networks{$key}->{mask})) { # found it
$netmask = $networks{$key}->{mask};
$gateway = $networks{$key}->{gateway};
last;
}
}
if (!$netmask) { die "Error: could not find a network in the networks table that $node $ip is part of.\n"; }
if (!$gateway) { die "Error: gateway not specified in the networks table for the network that $node $ip is part of.\n"; }
verbose("IP info for $node: ip=$ip, netmask=$netmask, gateway=$gateway");
return ($ip, $netmask, $gateway);
}
# Is the IP in the network/netmask combo
sub isIPinNet {
my ($ip, $net, $mask) = @_;
my $ipbin = convert2bin($ip);
my $netbin = convert2bin($net);
my $maskbin = convert2bin($mask);
$ipbin &= $maskbin;
if ($ipbin && $netbin && ($ipbin == $netbin)) { return 1; }
else { return 0; }
}
# Convert dotted decimal format (1.2.3.4) to a binary number
sub convert2bin {
my @arr=split(/\./, shift);
my ($bin) = unpack('N', pack('C4',@arr ) );
return $bin;
}
# this is like multi-line sed replace function
# Args: filename, search-string, replace-string
# Args: filename, search-string, replace-string, options (mode=>{insertbefore,insertafter,replace})
sub sed {
my ($file, $search, $replace, %options) = @_;
#my $opts = 's';
+248
View File
@@ -0,0 +1,248 @@
#!/usr/bin/perl
# xCAT postscript for configuring bonding of nics.
# Usage: configbond bond1 eth1 [eth3]
#
# Note: this postscript currently has some assumptions that are specific to the softlayer environment.
# We only use this to configure bond1, because bond0 gets configured by the node provisioning process.
# (altho this script would work for bond0)
use strict;
# Check number of args
my $nargs = $#ARGV + 1;
if (scalar(@ARGV) < 2 || scalar(@ARGV) > 3) {
system("logger -t xcat -p local4.err 'Usage: configbond <bond> <dev0> [<dev1>]'");
exit 1;
}
my $bond = shift(@ARGV);
my $nic = $ARGV[0];
my @devs;
foreach my $a (@ARGV) { push(@devs,split('@',$a)); } # support the new syntax in the xcat configbond postscript
my $nicips = $ENV{NICIPS};
my $nicnetworks = $ENV{NICNETWORKS};
my $net_cnt = $ENV{NETWORKS_LINES};
#todo: change this script so they dont need to specify nicnetworks
if (!$nicips || !$nicnetworks) { system("logger -t xcat -p local4.err 'configbond: must specify attributes nicips and nicnetworks in the xcat db for this node.'"); exit 1; }
#todo: these are specific to softlayer. They should be another attribute or argument
my $bondingopts = 'mode=4 miimon=100 downdelay=0 updelay=0 lacp_rate=fast xmit_hash_policy=1';
my $netmask ='';
my $ipaddr = '';
my $nic_num = '';
my $subnet = '';
my $nic_net = '';
my $net_name = '';
my @nic_nets = (); # array of networks for this nic
my @nic_ips =(); # array of ipaddresses for this nic
my @networks = (); # array of all networks from networks table.
# { network_name, subnet, netmask }
system("logger -t xcat -p local4.err 'configbond: Master: $bond'");
system("logger -t xcat -p local4.err 'configbond: Slaves: @devs'");
#system("logger -t xcat -p local4.err 'configbond: NIC: $nic'");
system("logger -t xcat -p local4.err 'configbond: NICNETWORKS: $nicnetworks'");
system("logger -t xcat -p local4.err 'configbond: NICIPS: $nicips'");
# Update modprobe
my $file = "/etc/modprobe.d/$bond.conf";
if (!open(FILE, ">$file")) { system("logger -t xcat -p local4.err 'configbond: cannot open $file.'"); exit 1; }
print FILE "alias $bond bonding\n";
# the bonding options are put in the ifcfg file instead
#print FILE "options $bond mode=balance-rr miimon=100\n";
close FILE;
# create array of network info. Needed in case where there are
# more than one ip address per nic and shouldn't be many networks.
my $net_info;
my $cnt = 1;
while ( $cnt <= $net_cnt ) {
$net_info = $ENV{"NETWORKS_LINE$cnt"};
$net_info =~ /^netname=([^\|]*)\|\|/;
$net_name = $1;
$net_info =~ /net=([^\|]*)\|\|/;
$subnet = $1;
$net_info =~ /mask=([^\|]*)\|\|/;
$netmask = $1;
push @{ $networks[$cnt-1] }, ($net_name, $subnet, $netmask);
$cnt +=1;
}
# get network or networks for this nic from NICNETWORKS:
# eth0:1_0_0_0-255_255_0_0|network2,eth1:1_1_0_0
# create array of networks for this nic
foreach my $nic_networks (split(/,/,$nicnetworks)) {
my @net = ();
if ( $nic_networks =~ /!/ ) {
@net = split(/!/,$nic_networks);
} else {
@net = split(/:/,$nic_networks);
}
if ($net[0] eq $nic) {
@nic_nets = split(/\|/,$net[1]);
last;
}
}
# get all nic ipaddress from $nicips: i.e. eth0:1.0.0.1|2.0.0.1,eth1:1.1.1.1
# Then get all ips for this specific nic, i.e. eth0.
foreach my $ips (split(/,/,$nicips)) {
my @ip = ();
if ( $ips =~ /!/ ) {
@ip = split(/!/,$ips);
} else {
@ip = split(/:/,$ips);
}
if ($ip[0] eq $nic ) {
@nic_ips = split(/\|/,$ip[1]);
}
}
my $i;
for ($i=0; $i < (scalar @nic_ips) ; $i++ ) {
# Time to create the interfaces.
# loop through the nic networks, find the matching networks to get the
# subnet and netmask and then create the appropriate ifcfg file for linux
my $specific_nic = $nic;
if ($i > 0) {
$specific_nic = $nic . ":" . ($i);
}
#todo: support case in which nicnetworks is not specified, find the correct network by calculation
$cnt = 0;
$subnet = "";
$netmask = "";
$net_name = "";
while ( $cnt < $net_cnt ) {
if ( $networks[$cnt][0] eq $nic_nets[$i] ) {
$subnet = $networks[$cnt][1];
$netmask = $networks[$cnt][2];
$cnt = $net_cnt; # found match - get out.
}
else {
$cnt++;
}
}
# check that there is a subnet and netmask set
if ( !(length($subnet) > 0) || !(length($netmask) > 0) ) {
system("logger -t xcat -p local4.err 'configbond: network subnet or netmask not set.'");
exit 1;
}
system("logger -t xcat -p local4.err 'configbond: network subnet and netmask: $subnet, $netmask'");
system("logger -t xcat -p local4.err 'configbond: $specific_nic, $nic_ips[$i]'");
# Write the master info to the ifcfg file
if (-d "/etc/sysconfig/network-scripts") {
# rhel/centos/fedora
my $dir = "/etc/sysconfig/network-scripts";
if (!open(FILE, ">$dir/ifcfg-$bond")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$bond.'"); exit 1; }
print FILE "DEVICE=$bond\n";
print FILE "BOOTPROTO=none\n";
print FILE "IPADDR=$nic_ips[$i]\n";
print FILE "NETMASK=$netmask\n";
print FILE "ONBOOT=yes\n";
print FILE "USERCTL=no\n";
print FILE qq(BONDING_OPTS="$bondingopts"\n);
close FILE;
# Configure slaves
my @output = `ip addr show 2>&1`; # to check for existance of the device later
foreach my $dev (@devs) {
# as a convenience, make sure the device exists before adding it to the bond
if (!grep(m/^\d+:\s+$dev:/, @output)) {
system("logger -t xcat -p local4.err 'configbond: not configuring $dev because it does not exist.'");
unlink("$dir/ifcfg-$dev"); # in case it was left over in the image we are cloning
next;
}
system("logger -t xcat -p local4.err 'configbond: slave dev: $dev'");
if (!open(FILE, ">$dir/ifcfg-$dev")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$dev'"); exit 1; }
print FILE "DEVICE=$dev\n";
print FILE "BOOTPROTO=none\n";
print FILE "MASTER=$bond\n";
print FILE "ONBOOT=yes\n";
print FILE "SLAVE=yes\n";
print FILE "USERCTL=no\n";
close FILE;
}
}
elsif (-d "/etc/sysconfig/network") {
# sles
my $dir = "/etc/sysconfig/network";
if (!open(FILE, ">$dir/ifcfg-$bond")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$bond.'"); exit 1; }
print FILE "BOOTPROTO=static\n";
print FILE "BONDING_MASTER=yes\n";
print FILE "BONDING_MODULE_OPTS='$bondingopts'\n";
print FILE "NAME='Bonded Interface'\n";
print FILE "IPADDR=$nic_ips[$i]\n";
print FILE "NETMASK=$netmask\n";
print FILE "STARTMODE=onboot\n";
print FILE "USERCONTROL=no\n";
my $devnum = 0;
my @output = `ip addr show 2>&1`; # to check for existance of the device later
foreach my $dev (@devs) {
if (!grep(m/^\d+:\s+$dev:/, @output)) { next; }
print FILE "BONDING_SLAVE_$devnum=$dev\n";
$devnum++;
}
close FILE;
# Configure slaves
foreach my $dev (@devs) {
# as a convenience, make sure the device exists before adding it to the bond
if (!grep(m/^\d+:\s+$dev:/, @output)) {
system("logger -t xcat -p local4.err 'configbond: not configuring $dev because it does not exist.'");
unlink("$dir/ifcfg-$dev"); # in case it was left over in the image we are cloning
next;
}
system("logger -t xcat -p local4.err 'configbond: slave dev: $dev'");
if (!open(FILE, ">$dir/ifcfg-$dev")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$dev'"); exit 1; }
print FILE "BOOTPROTO=none\n";
print FILE "STARTMODE=hotplug\n";
close FILE;
}
}
else {
# do not recognize this distro
system("logger -t xcat -p local4.err 'configbond: network directory is not either the Red Hat or SuSE format.'");
exit 1;
}
# Apply the changes. Since we are only doing bond1 right now, lets not restart the whole network
# so we dont disrupt the installnic connection. Instead we just need to bring down the slave nics,
# and then bring up the bond nic.
#runcmd("service network restart");
foreach my $dev (@devs) {
runcmd("ifdown $dev");
}
runcmd("ifdown $bond"); # in case it was already up
runcmd("ifup $bond"); # note: this wont reload the bonding kernel module, so we are depending on the provisioning process to already have set the correct bonding options
system("logger -t xcat -p local4.info 'configbond: successfully configured $specific_nic.'");
}
exit 0;
sub runcmd {
my $cmd = shift @_;
$cmd .= ' 2>&1';
my @output = `$cmd`;
my $rc = $? >> 8;
if ($rc) {
system("logger -t xcat -p local4.err 'configeth: command $cmd failed with rc $rc: " . join('',@output) . "'");
my $errout= "configeth: command $cmd failed with rc $rc.";
`echo $errout`;
exit $rc;
}
}
+24 -2
View File
@@ -1,6 +1,28 @@
#!/bin/bash
# set the default route of the node to the ip address and nic passed in
# this should be added to the postbootscripts, NOT postscripts
set -x
ip route replace to default via $1 dev $2
gateway="$1"
nic="$2"
# set it temporarily
echo "ip route replace to default via $gateway dev $nic"
ip route replace to default via $gateway dev $nic
# set it permanently
#todo: this is only for sles right now
file=/etc/sysconfig/network/routes
if grep -q -E '^default ' $file; then
# replace the default route that is already in there
sed -i 's/^default .*$/default '$gateway' - -/' $file
else
# no default route yet, append to file
echo "default $gateway - -" >>$file
fi
# While we are here, clean up the network wait hack, if it is still there.
# (It was added during scripted install, because autoyast will not use the bond
# configuration for 1 part of the process.) Do not know a better place to clean
# this up.
sed -i '/Waiting to reach xCAT mgmt node/d' /etc/init.d/network
@@ -67,7 +67,6 @@
</user>
</users>
<networking>
<keep_install_network config:type="boolean">true</keep_install_network>
<dns>
<domain>#TABLE:site:key=domain:value#</domain>
<hostname>#TABLE:nodelist:$NODE:node#</hostname>
@@ -78,10 +77,53 @@
<search>#TABLE:site:key=domain:value#</search>
</searchlist>
</dns>
<interfaces config:type="list">
<interface>
<bonding_master>yes</bonding_master>
<bonding_module_opts>mode=4 miimon=100 downdelay=0 updelay=0 lacp_rate=fast xmit_hash_policy=1</bonding_module_opts>
<bonding_slave0>eth0</bonding_slave0>
<bonding_slave1>eth2</bonding_slave1>
<device>bond0</device>
<bootproto>static</bootproto>
<startmode>auto</startmode>
<ipaddr>#NODEIPADDR#</ipaddr>
<netmask>#NODENETMASK#</netmask>
<usercontrol>no</usercontrol>
</interface>
<interface>
<bootproto>none</bootproto>
<device>eth0</device>
<name>Ethernet Card 0</name>
<startmode>off</startmode>
</interface>
<interface>
<bootproto>none</bootproto>
<device>eth2</device>
<name>Ethernet Card 2</name>
<startmode>off</startmode>
</interface>
</interfaces>
<routing>
<ip_forward config:type="boolean">false</ip_forward>
<routes config:type="list">
<route>
<destination>default</destination>
<device>-</device>
<gateway>#NODEGATEWAY#</gateway>
<netmask>-</netmask>
</route>
</routes>
</routing>
</networking>
<files config:type="list">
<file>
<file_contents><![CDATA[alias bond0 bonding
]]></file_contents>
<file_owner>root</file_owner>
<file_path>/etc/modprobe.d/bond0.conf</file_path>
<file_permissions>644</file_permissions>
</file>
</files>
<scripts>
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.sles#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/chroot.sles#
+82
View File
@@ -0,0 +1,82 @@
#!/bin/bash
# SI post-install script to configure the efi boot mgr or grub after SI has installed the OS
# SI post-install scripts run in a chroot environment of the final OS image
if [ -d /sys/firmware/efi ]; then
echo "Setting Boot Manager for the next boot."
echo "delete all sysclone boot list"
str_bootnums=`efibootmgr | grep 'syscloneLinux' | awk '{print $1}' | sed 's/boot//i' | sed 's/*//'`
for str_num in $str_bootnums
do
efibootmgr -b $str_num -B -q
done
if [ -f "/boot/efi/EFI/redhat/grub.efi" ];then
efibootmgr -c -l \\EFI\\redhat\\grub.efi -L syscloneLinux
elif [ -f "/boot/efi/efi/SuSE/elilo.efi" ];then
efibootmgr -c -l \\efi\\SuSE\\elilo.efi -L syscloneLinux
else
echo "Can not find the boot loader."
exit 1
fi
else
echo "run grub-install to configure the MBR."
if [ -e /etc/mtab ];then
mv /etc/mtab /etc/mtab.bak
fi
grep -v rootfs /proc/mounts > /etc/mtab
boot_device=''
if [ -f "/etc/systemconfig/systemconfig.conf" ];then
boot_device=`cat /etc/systemconfig/systemconfig.conf | grep BOOTDEV | awk '{print $3}'`
else
boot_root=`mount | grep -E ' on\s+/ type ' | awk '{print $1}'`
boot_device=`echo $boot_root | sed -e 's/[0-9]*$//'`
#str_temp=`mount | awk '{print $1","$3}'`
#for line in $str_temp
#do
# mp=`echo $line | awk -F, '{print $2}'`
# if [ "$mp" = "/" ];then
# boot_device=`echo $line | awk -F, '{print $1}' | sed -e 's/[0-9]*$//'`
# break
# fi
#done
fi
if [ -n "$boot_device" ];then
echo "The boot device is $boot_device"
echo "The boot root device is $boot_root"
else
echo "Can not find the boot device, return error"
exit 1
fi
# set grub to use this boot device
if grep -qe '^VERSION\s*=\s*11' /etc/SuSE-release; then
#sles11, run grub-install.unsupported directly
echo "grub-install.unsupported --no-floppy --recheck $boot_device"
grub-install.unsupported --no-floppy --recheck $boot_device
# note: the error about grub-set-default not existing is harmless, because we want the default to be 0 anyway
else
#for sles10, should run grub-install with parameters
echo "grub-install --no-floppy --recheck $boot_device"
grub-install --no-floppy --recheck $boot_device
fi
# change the entries in the grub conf file to use the correct boot root device
# (not the one leftover from the golden image)
if [ -f "/boot/grub/grub.conf" ];then
conffile="/boot/grub/grub.conf"
else
conffile="/boot/grub/menu.lst"
fi
sed -i 's| root=\S*| root='$boot_root'|' $conffile
sed -i 's| resume=\S*| noresume|' $conffile
if [ -e /etc/mtab.bak ];then
mv -f /etc/mtab.bak /etc/mtab
else
rm -f /etc/mtab
fi
fi
+209
View File
@@ -0,0 +1,209 @@
#!/bin/bash
# SI post-install script to configure network settings after SI has installed the OS
# SI post-install scripts run in a chroot environment of the final OS image
. /tmp/post-install/variables.txt
bondingopts='mode=4 miimon=100 downdelay=0 updelay=0 lacp_rate=fast xmit_hash_policy=1'
# 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
bond=bond0
# this is a softlayer assumption that the two devices on the private net will be eth0 and eth2
if [[ $DEVICE == "eth0" ]]; then
DEVICE2=eth2
elif [[ $DEVICE == "eth2" ]]; then
DEVICE2=eth0
fi
ip addr show|grep -q -E "^[0-9]+:\s+$DEVICE2:" # make sure it exists on the system
if [[ $? == 0 ]]; then
DEVICE2EXISTS="yes"
fi
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
dir="/etc/sysconfig/network-scripts"
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
# delete all nic cfg files left over from the golden node
for i in $device_names;do
rm -f "$dir/ifcfg-$i"
done
# set static ip from variables in variables.txt
# write ifcfg-bond0. For now we assume the installnic should be part of bond0,
# because in SL i think that is always the case.
i="$bond"
str_cfg_file="$dir/ifcfg-$i"
echo "DEVICE=$i" > $str_cfg_file
echo "BOOTPROTO=none" >> $str_cfg_file
echo "ONBOOT=yes" >> $str_cfg_file
echo "USERCTL=no" >> $str_cfg_file
echo 'BONDING_OPTS="'$bondingopts'"' >> $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
# write ifcfg-eth0
i="$DEVICE"
str_cfg_file="$dir/ifcfg-$i"
echo "DEVICE=$i" > $str_cfg_file
echo "BOOTPROTO=none" >> $str_cfg_file
echo "MASTER=$bond" >> $str_cfg_file
echo "ONBOOT=yes" >> $str_cfg_file
echo "SLAVE=yes" >> $str_cfg_file
echo "USERCTL=no" >> $str_cfg_file
i="$DEVICE2"
str_cfg_file="$dir/ifcfg-$i"
if [[ $DEVICE2EXISTS == "yes" ]]; then
# write ifcfg-eth2
echo "DEVICE=$i" > $str_cfg_file
echo "BOOTPROTO=none" >> $str_cfg_file
echo "MASTER=$bond" >> $str_cfg_file
echo "ONBOOT=yes" >> $str_cfg_file
echo "SLAVE=yes" >> $str_cfg_file
echo "USERCTL=no" >> $str_cfg_file
else
rm -f $str_cfg_file # in case it was left over in the image that was captured
fi
# write modprobe alias config
str_cfg_file="/etc/modprobe.d/$bond.conf"
echo "alias $bond bonding" > $str_cfg_file
#todo: figure out how to set the default gateway in rhel
else
# use dhcp for all nics
for i in $device_names;do
str_cfg_file="$dir/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
dir="/etc/sysconfig/network"
echo "$HOSTNAME" > /etc/HOSTNAME
if staticIP; then
# delete all nic cfg files left over from the golden node
for i in $device_names;do
rm -f "$dir/ifcfg-$i"
done
# set static ip from variables in variables.txt
# write ifcfg-bond0. For now we assume the installnic should be part of bond0,
# because in SL i think that is always the case.
i="$bond"
str_cfg_file="$dir/ifcfg-$i"
echo "BOOTPROTO=static" > $str_cfg_file
echo "STARTMODE=onboot" >> $str_cfg_file
echo "BONDING_MASTER=yes" >> $str_cfg_file
echo "BONDING_MODULE_OPTS='$bondingopts'" >> $str_cfg_file
echo "NAME='Bonded Interface'" >> $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
echo "USERCONTROL=no" >> $str_cfg_file
echo "BONDING_SLAVE_0=$DEVICE" >> $str_cfg_file
if [[ $DEVICE2EXISTS == "yes" ]]; then
echo "BONDING_SLAVE_1=$DEVICE2" >> $str_cfg_file
fi
# write ifcfg-eth0
i="$DEVICE"
str_cfg_file="$dir/ifcfg-$i"
echo "BOOTPROTO=none" > $str_cfg_file
echo "STARTMODE=hotplug" >> $str_cfg_file
i="$DEVICE2"
str_cfg_file="$dir/ifcfg-$i"
if [[ $DEVICE2EXISTS == "yes" ]]; then
# write ifcfg-eth2
echo "BOOTPROTO=none" > $str_cfg_file
echo "STARTMODE=hotplug" >> $str_cfg_file
else
rm -f $str_cfg_file # in case it was left over in the image that was captured
fi
# write modprobe alias config
str_cfg_file="/etc/modprobe.d/$bond.conf"
echo "alias $bond bonding" > $str_cfg_file
# set the default gateway (at this point this is the private nic gateway, to handle provision across vlans)
file=/etc/sysconfig/network/routes
if grep -q -E '^default ' $file; then
# replace the default route that is already in there
sed -i 's/^default .*$/default '$GATEWAY' - -/' $file
else
# no default route yet, append to file
echo "default $GATEWAY - -" >>$file
fi
# this was the original config of the eth0 nic (without bonding)
#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="$dir/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
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
#Used only by sysclone
# This SI post-install script is needed because the initrd that autoyast/kickstart/ubuntu builds when installing
# sles/rh/ubuntu on the golden node may not have the drivers when that initrd runs on the node that is
# being deployed with this image (specifically, drivers to be able to mount the disk).
# So rebuild the initrd on the to-node after putting the image on the disk, but before rebooting.
#todo: Make this script work on red hat by checking for dracut and using that if it exists.
# And do whatever is necessary on ubuntu.
if [[ -f /sbin/dracut ]]; then
# redhat/centos
echo "Running dracut to regenerate the initrd with the drivers needed by this node:"
dracut --force
else
# suse/sles
echo "Running mkinitrd to regenerate the initrd with the drivers needed by this node:"
mkinitrd
fi
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
# SI post-install script, run after SI has installed the OS, to kill processes SI does not kill
# (so /a can be umounted cleanly)
# SI post-install scripts run in a chroot environment of the final OS image
if [ -f "/etc/SuSE-release" ];then
str_out=`ps -ef | grep -v grep | grep syslog-ng`
if [ $? -eq 0 ];then
str_id=`echo $str_out | awk '{print $2}'`
kill -9 $str_id
fi
fi
# SI starts klogd in the chroot, but does not kill it. Remove this line when SI fixes their bug.
killall klogd
# flush all write buffers, just in case SI can not umount /a
echo "Syncing file systems"
sync
#todo: remove
#echo "Processes still using /:"
#fuser -v /
#sleep 30
+22 -4
View File
@@ -17,6 +17,11 @@ BuildArch: noarch
Requires: xCAT-server
#Requires: xCAT-server >= %{epoch}:%(cat Version|cut -d. -f 1,2)
# perl-ExtUtils-MakeMaker, perl-CPAN, perl-Test-Harness are only available in rhel.
# When this rpm supports being installed in sles, need to add these to xcat-dep.
# perl-SOAP-Lite is already in xcat-dep
Requires: perl-ExtUtils-MakeMaker perl-CPAN perl-Test-Harness perl-SOAP-Lite
Provides: xCAT-SoftLayer = %{epoch}:%{version}
%description
@@ -43,18 +48,22 @@ xCAT-SoftLayer provides Utilities to make xCAT work in a SoftLayer environment.
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{prefix}/bin
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/install
mkdir -p $RPM_BUILD_ROOT/install/postscripts
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/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/
cp -d bin/* $RPM_BUILD_ROOT/%{prefix}/bin
chmod 755 $RPM_BUILD_ROOT/%{prefix}/bin/*
cp -d postscripts/* $RPM_BUILD_ROOT/install/postscripts
chmod 755 $RPM_BUILD_ROOT/install/postscripts/*
cp -d postscripts/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/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/*
@@ -71,4 +80,13 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root)
#%doc LICENSE.html
%{prefix}
/install/postscripts
%post
# We are shipping the postscripts in a sysclone dir and then copying them to /install/postscripts here,
# because we want to allow base xcat to eventually ship them and not conflict on the file name/path
# But base xcat now has a newer/better configbond written in bash, so if that is there do not overwrite it.
head /install/postscripts/configbond | grep -q -E '^#! */bin/bash'
if [[ $? != 0 ]]; then
# the new configbond from xcat 2.8.5 is not there, so copy ours
cp -f /%{prefix}/share/xcat/sysclone/postscripts/* /install/postscripts
fi
+38 -18
View File
@@ -590,13 +590,16 @@ sub startxcatd
} else {
$xcmd = "$::XCATROOT/sbin/restartxcatd";
}
system($xcmd);
}
else
{
$xcmd = "service xcatd restart";
#$xcmd = "service xcatd restart";
my $ret=xCAT::Utils->restartservice("xcatd");
return $ret;
}
system($xcmd);
}
#-----------------------------------------------------------------------------
@@ -618,13 +621,16 @@ sub shutdownxcatd
if ($::osname eq 'AIX')
{
$xcmd = "stopsrc -s xcatd";
system($xcmd);
}
else
{
$xcmd = "service xcatd stop";
#$xcmd = "service xcatd stop";
my $ret=xCAT::Utils->stopservice("xcatd");
return $ret;
}
system($xcmd);
}
#-----------------------------------------------------------------------------
@@ -2073,11 +2079,12 @@ sub adddb2paths
#-----------------------------------------------------------------------------
sub remove
{
my $cmd;
my @output;
my $error = 0;
#see if DB2 is installed
if (!(-e ($::installdb2dir)))
my $cmd;
my @output;
my $error = 0;
my $retcode=0;
#see if DB2 is installed
if (!(-e ($::installdb2dir)))
{
my $message =
"\nDB2 is not installed.";
@@ -2120,18 +2127,23 @@ sub remove
my $cmd = "ps -elf|grep xcatd";
my @output = xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC == 0)
{
if ($::osname eq 'AIX')
{
my $cmd = "startsrc -s xcatd";
xCAT::Utils->runcmd($cmd, -1);
$retcode=$::RUNCMD_RC;
}
else
{
my $cmd = "service xcatd start";
#my $cmd = "service xcatd start";
$retcode=xCAT::Utils->startservice("xcatd");
}
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC !=0)
#xCAT::Utils->runcmd($cmd, -1);
#if ($::RUNCMD_RC !=0)
if($retcode!=0)
{
my $message = "can't start xcatd";
$error += 1;
@@ -2155,13 +2167,17 @@ sub remove
if ($::osname eq 'AIX')
{
my $cmd = "stopsrc -s xcatd";
xCAT::Utils->runcmd($cmd, -1);
$retcode=$::RUNCMD_RC;
}
else
{
my $cmd = "service xcatd stop";
#my $cmd = "service xcatd stop";
$retcode=xCAT::Utils->stopservice("xcatd");
}
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC !=0)
#xCAT::Utils->runcmd($cmd, -1);
#if ($::RUNCMD_RC !=0)
if($retcode!=0)
{
my $message = "can't stop xcatd";
xCAT::MsgUtils->message("E", "$message");
@@ -2198,13 +2214,17 @@ sub remove
if ($::osname eq 'AIX')
{
my $cmd = "startsrc -s xcatd";
xCAT::Utils->runcmd($cmd, -1);
$retcode=$::RUNCMD_RC;
}
else
{
my $cmd = "service xcatd start";
#my $cmd = "service xcatd start";
$retcode=xCAT::Utils->startservice("xcatd");
}
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC !=0)
#xCAT::Utils->runcmd($cmd, -1);
#if ($::RUNCMD_RC !=0)
if($retcode!=0)
{
my $message = "can't start xcatd";
xCAT::MsgUtils->message("E", "$message");
+79 -38
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, -1);
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]";
@@ -603,13 +608,16 @@ sub shutdownxcatd
if ($::osname eq 'AIX')
{
$xcmd = "stopsrc -s xcatd";
system($xcmd);
}
else
{
$xcmd = "service xcatd stop";
#$xcmd = "service xcatd stop";
my $ret=xCAT::Utils->stopservice("xcatd");
return $ret;
}
system($xcmd);
}
#-----------------------------------------------------------------------------
@@ -856,6 +864,7 @@ sub initmysqldb
sub mysqlstart
{
my $cmd;
my $ret=0;
if ($::osname eq 'AIX')
{
my $hostname = `hostname`;
@@ -867,22 +876,32 @@ sub mysqlstart
$cmd = $cmd2;
$cmd .=
"$::installdir/bin/mysqld --user=mysql --basedir=$::installdir --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/$hostname.err --pid-file=/var/lib/mysql/$hostname.pid --socket=/tmp/mysql.sock --port=3306 &";
$ret=xCAT::Utils->runcmd($cmd, 0);
}
else
{
if ($::linuxos =~ /rh.*/)
{
$cmd = "service mysqld start";
}
else
{ # sles
$cmd = "service mysql start";
}
if ($::MariaDB==1) { # running MariaDB
#$cmd = "service mariadb start";
$ret=xCAT::Utils->startservice("mariadb");
} else { # it is mysql
#if ($::linuxos =~ /rh.*/)
#{
# $cmd = "service mysqld start";
#}
#else
#{ # sles
# $cmd = "service mysql start";
#}
$ret=xCAT::Utils->startservice("mysql");
}
}
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
if ($ret != 0)
{
xCAT::MsgUtils->message("E", " $cmd failed.");
xCAT::MsgUtils->message("E", " failed to start mysql/mariadb.");
exit(1);
}
@@ -973,16 +992,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 +1082,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 +1207,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 +1342,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)
@@ -1778,12 +1817,14 @@ sub restorexcatdb
if ($::osname eq 'AIX')
{
$xcmd = "$::XCATROOT/sbin/restartxcatd";
system($xcmd);
}
else
{
$xcmd = "service xcatd restart";
#$xcmd = "service xcatd restart";
my $ret=xCAT::Utils->restartservice("xcatd");
return $ret;
}
system($xcmd);
}
+43 -24
View File
@@ -444,13 +444,16 @@ sub shutdownxcatd
if ($::osname eq 'AIX')
{
$xcmd = "stopsrc -s xcatd";
system($xcmd);
}
else
{
$xcmd = "service xcatd stop";
# $xcmd = "service xcatd stop";
my $ret=xCAT::Utils->stopservice("xcatd");
return $ret;
}
system($xcmd);
}
#-----------------------------------------------------------------------------
@@ -832,6 +835,7 @@ sub initpgdb
sub pgstart
{
my $cmd;
my $ret=0;
xCAT::MsgUtils->message("I", "Starting the PosgreSQL Server");
if ($::osname eq 'AIX')
{
@@ -843,27 +847,35 @@ sub pgstart
else # linux
{
if (defined($::postgres9)) { # set to the PTF level of postgresql 9.X
$cmd = "service postgresql-9.$::postgres9 start";
#$cmd = "service postgresql-9.$::postgres9 start";
$cmd = "postgresql-9.$::postgres9";
} else {
$cmd = "service postgresql start";
#$cmd = "service postgresql start";
$cmd = "postgresql";
}
system($cmd);
if ($? > 0) {
xCAT::MsgUtils->message("E", " $cmd failed.");
#system($cmd)
#if ($? > 0) {
$ret=xCAT::Utils->startservice($cmd);
if ($ret != 0) {
xCAT::MsgUtils->message("E", " failed to start $cmd.");
exit(1);
}
# check to see if running before continuing
my $retries =0;
my $pgstarted =0;
if (defined($::postgres9)) { # set to the PTF level of postgresql 9.X
$cmd = "service postgresql-9.$::postgres9 status";
} else {
$cmd = "service postgresql status";
}
#if (defined($::postgres9)) { # set to the PTF level of postgresql 9.X
# #$cmd = "service postgresql-9.$::postgres9 status";
# $ret=xCAT::Utils->checkservicestatus("postgresql-9.$::postgres9");
#} else {
# #$cmd = "service postgresql status";
# $ret=xCAT::Utils->checkservicestatus("postgresql");
#}
while ($retries < 30) {
$retries++;
my @status=xCAT::Utils->runcmd($cmd, -1);
if (grep(/[r|R]unning/, @status)) {
#my @status=xCAT::Utils->runcmd($cmd, -1);
#if (grep(/[r|R]unning/, @status)) {
$ret=xCAT::Utils->checkservicestatus($cmd);
if($ret == 0){
$pgstarted=1;
last;
}
@@ -903,18 +915,22 @@ sub pgreboot
else # linux
{
if (defined($::postgres9)) { # set to the postgresql ptf level
$cmd = "chkconfig postgresql-9.$::postgres9 on";
# $cmd = "chkconfig postgresql-9.$::postgres9 on";
$cmd = "postgresql-9.$::postgres9";
} else {
$cmd = "chkconfig postgresql on";
#$cmd = "chkconfig postgresql on";
$cmd = "postgresql";
}
if ($debianflag){
$cmd = "update-rc.d postgresql defaults";
}
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
#if ($debianflag){
#$cmd = "update-rc.d postgresql defaults";
#}
#xCAT::Utils->runcmd($cmd, 0);
#if ($::RUNCMD_RC != 0)
my $ret=xCAT::Utils->enableservice($cmd);
if($cmd !=0 )
{
xCAT::MsgUtils->message("E",
" $cmd failed. PostgreSQL will not restart on reboot.");
"enable service $cmd failed. PostgreSQL will not restart on reboot.");
}
}
@@ -1347,12 +1363,15 @@ sub restorexcatdb
if ($::osname eq 'AIX')
{
$xcmd = "startsrc -s xcatd";
system($xcmd);
}
else
{
$xcmd = "service xcatd start";
#$xcmd = "service xcatd start";
my $ret=xCAT::Utils->startservice("xcatd");
return $ret;
}
system($xcmd);
}
+1 -1
View File
@@ -66,7 +66,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
@@ -69,7 +69,7 @@ my $client = IO::Socket::SSL->new(
SSL_cert_file=>$homedir."/.xcat/client-cred.pem",
SSL_ca_file => $homedir."/.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);
+5 -1
View File
@@ -115,7 +115,11 @@ else
length=`expr $index2 - $index1`
length=`expr $length - 1`
cons_ip=`expr substr "$result" $pos $length`
ifconfig |grep "$cons_ip"
if [ "$os" == "AIX" ]; then
ifconfig |grep "$cons_ip"
else
ip addr |grep "$cons_ip"
fi
if [ $? -eq 0 ]; then
CONSERVER=""
fi
+56 -168
View File
@@ -1,12 +1,11 @@
#!/usr/bin/env perl
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
# Used as a convience command combined of [nodech]-nodeset-rpower-[rcons/wcons]
# Used as a convience command combined of [nodech]-nodeset-rsetboot-rpower-[rcons/wcons]
# to make ease of node OS provision
# To use this, sym link your cmd name to this script.
# This is the client front-end to rinstall/winstall commands
use strict;
BEGIN
{
@@ -20,180 +19,69 @@ use lib "$::XCATROOT/lib/perl";
use File::Basename;
use Getopt::Long;
use xCAT::MsgUtils;
use xCAT::Table;
use xCAT::NodeRange;
use xCAT::Utils;
use xCAT::Client;
use Cwd;
use strict;
sub usage {
print basename($0)." usage:\n";
print " ".basename($0)." [-o|--osver] [-p|--profile] [-a|--arch] [-O|--osimage] [-c|--console] <noderange>\n"
}
my $OSVER;
my $PROFILE;
my $ARCH;
my $CONSOLE;
my $OSIMAGE;
Getopt::Long::Configure("bundling");
unless (GetOptions(
'o|osver=s' => \$OSVER,
'p|profile=s' => \$PROFILE,
'a|arch=s' => \$ARCH,
'O|osimage=s' => \$OSIMAGE,
'c|console' => \$CONSOLE
)) {
usage;
exit 1;
}
my $arraysize=@ARGV;
if ($arraysize > 1) {
print "noderange invalid\n";
usage;
exit 1;
}
if ($arraysize == 0) {
print "noderange not supplied\n";
usage;
exit 1;
}
my $noderange=@ARGV[0];
my $rc=0;
my %pnhash;
my @allnodes;
#use Data::Dumper;
# check and complain about the invalid combination of the options,
# called when -O is specified or nodetype.provmethod=<osimage>,
# ignore -o,-p and -a options and prompt a warning message
sub checkoption{
my $optstring=shift;
if($OSVER) {print 'warning: "'.$optstring.'" specified, "[-o|--osver] '.$OSVER."\" ignored\n"};
if($PROFILE) {print 'warning: "'.$optstring.'" specified, "[-p|--profile] '.$PROFILE."\" ignored\n"};
if($ARCH) {print 'warning: "'.$optstring.'" specified, "[-a|--arch] '.$OSVER."\" ignored\n"};
}
@allnodes=noderange($noderange);
if($OSIMAGE){
# -O|--osimage is specified, ignore any -a,-p,-o options,
# call "nodeset ... osimage= ..." to set the boot state of the noderange to the specified osimage,
# "nodeset" will handle the updating of node attributes such as os,arch,profile,provmethod
&checkoption("[-O|--osimage] $OSIMAGE");
$rc=system("nodeset $noderange osimage=$OSIMAGE");
if ($rc) {
xCAT::MsgUtils->message("E","nodeset failure");
exit 1;
};
}else
# build a request to go the rinstall plugin
my $bname = basename($0);
my $cmdref;
$cmdref->{command}->[0] = $bname;
$cmdref->{cwd}->[0] = cwd();
# allows our plugins to get the stdin of the cmd that invoked the plugin
my $data;
if ( (($^O =~ /^linux/i) && ($ENV{'SHELL'} =~ /\/ksh$/)) || !defined($ENV{'TERM'}) )
{
# no osimage specified, update the node attributes specified by -a,-p,-o options thru "nodech",
# then set the boot state of each node based on the nodetype.provmethod:
# 1) if nodetype.provmethod = <osimage>, ignore any -p,-o,-a option, then call "nodeset ... osimage"
# 2) if nodetype.provmethod = [install/netboot/statelite], update the node attributes specified by -a,-p,-o options thru "nodech", call "nodeset ... [install/netboot/statelite]"
# 3) if nodetype.provmethod is not set, use 'install' as the default value
# group the nodes according to the nodetype.provmethod
foreach(@allnodes){
my $tab=xCAT::Table->new("nodetype");
my $nthash=$tab->getNodeAttribs($_,['provmethod']);
$tab->close();
if(defined($nthash) and defined($nthash->{'provmethod'}))
{
push(@{$pnhash{$nthash->{'provmethod'}}},$_);
}
else
{
#if nodetype.provmethod is not specified,
push(@{$pnhash{'install'}},$_);
}
}
foreach my $key (keys %pnhash)
{
my $rclocal=0;
my $nodes=join(',',@{$pnhash{$key}});
if($key =~ /^(install|netboot|statelite)$/)
{
# nodetype.provmethod = [install|netboot|statelite]
my $nodechline = "";
if ($OSVER) {
$nodechline = "nodetype.os=$OSVER";
}
if ($PROFILE) {
$nodechline .= " nodetype.profile=$PROFILE";
}
if ($ARCH) {
$nodechline .= " nodetype.arch=$ARCH";
}
if ($nodechline) {
$rclocal=system("nodech $nodes $nodechline");
if ($rclocal) {
print "nodech failure\n";
$rc=$rclocal;
}
}
unless($rc){
$rclocal=system("nodeset $nodes $key");
if ($rclocal) {
print "nodeset $nodes failure\n";
$rc=$rclocal;
}
}
}
else
{
# nodetype.provmethod = <osimage>
&checkoption("nodetype.provmethod=$key");
$rclocal=system("nodeset $nodes osimage");
if ($rclocal) {
print "nodeset $nodes failure\n";
$rc=$rclocal;
}
}
}
my $rin="";
my $rout;
vec($rin,fileno(STDIN),1)=1;
my $nfound=select($rout=$rin,"","",1);
if ($nfound)
{
while ( <STDIN> ) { $data.=$_; }
$cmdref->{stdin}->[0]=$data;
}
}
if($rc){
xCAT::MsgUtils->message("E","nodeset failure");
exit 1;
else
{
if (-p STDIN) {
while ( <STDIN> ) { $data.=$_; }
$cmdref->{stdin}->[0]=$data;
}
}
my $arg;
my @tmpargv = @ARGV;
# first
$arg=shift(@ARGV);
# first 1st non-hyphen arg is the noderange
while ($arg =~ /^-/) {
push (@{$cmdref->{arg}}, $arg);
$arg=shift(@ARGV);
}
$cmdref->{noderange}->[0]=$arg;
push (@{$cmdref->{arg}}, @ARGV);
# call "rsetboot" to set the boot order of the nodehm.mgt=ipmi nodes,for others, assume user has set the correct boot order before "rinstall"
system("rsetboot $noderange net");
my $noderange=$cmdref->{noderange}->[0]; # save the noderange
# call "rpower" to start the node provision process
$rc=system("rpower $noderange boot");
if ($rc) {
xCAT::MsgUtils->message("E","rpower failure");
exit 1;
};
# ok call Client to run the plugin rinstall.pm
xCAT::Client::submit_request($cmdref,\&xCAT::Client::handle_response);
if ($xCAT::Client::EXITCODE == 0) # no errors
{
my $startconsole=$cmdref->{startconsole}->[0];
# if startconsole requested ( -c flag) for rinstall always for winstall
# This is set in the rinstall plugin
if ($startconsole == 1) {
if (basename($0) =~ /rinstall/) {
if (basename($0) =~ /rinstall/) {
# for rinstall, the -c|--console option can provide the remote console for only 1 node
if ($CONSOLE) {
if(scalar @allnodes ne 1){
xCAT::MsgUtils->message("E","rinstall [-c|--console] will only work if there is only one node in the noderange. See winstall(8) for consoles on multiple systems");
exit 1;
}
exec("rcons $noderange");
}
} elsif (basename($0) =~ /winstall/) {
# winstall can commence a wcons command to the noderange for monitoring the provision cycle
elsif (basename($0) =~ /winstall/) {
# winstall can commence a wcons command to the noderange for monitoring the provision cycle
exec("wcons $noderange");
exec("wcons $noderange");
}
}
}
exit $xCAT::Client::EXITCODE;
+7 -2
View File
@@ -25,6 +25,7 @@ B<chvm> I<noderange> [B<lparname>={B<*>|B<name>}]
B<chvm> I<noderange> [B<vmcpus=min/req/max>] [B<vmmemory=min/req/max>]
[B<vmphyslots=drc_index1,drc_index2...>] [B<vmothersetting=hugepage:N,bsr:N>]
[B<vmnics=vlan1[,vlan2..]]> [B<vmstorage=<N|viosnode:slotid>>] [B<--vios>]
[B<del_physlots=drc_index1,drc_index2...>]
[B<del_vadapter=slotid>]
=head2 VMware/KVM specific:
@@ -205,9 +206,13 @@ To specify the parameters that will be modified.
To create new virtual adapter for the specified node.
=item B<del_vadapter=value>
=item B<del_physlots=drc_index1,drc_index2...>
To specify the slot id of the virtual adapter will be deleted.
To delete physical slots which are specified by the I<drc_index1,drc_index2...>.
=item B<del_vadapter=slotid>
To delete a virtual adapter specified by the I<slotid>.
=back
+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>
+3 -8
View File
@@ -120,8 +120,7 @@ To import nodes using a profile, follow the following steps:
# hostinfo begin
# This entry defines a blade.
__hostname__:
switch=myswitch
switchport=9
switches=eth0!switch1!1,eth0!switch2!1!eth1
Example of a node information file that specifies a CEC-based rack-mounted Power node that uses direct FSP management:
# Node information file begins
@@ -141,13 +140,9 @@ B<mac=<mac-address>> This is a mandatory item.
Description: Specify the MAC address for the NIC used by the provisionging node, where <mac-address> is the NICs MAC address.
B<switch=<switch-name>> This is a mandatory item, when define a switch auto discovery node.
B<switches=<nic-name!switch-name!switch-port>> This is a mandatory item, when define switch, switchport and node nic name relationship.
Description: Specify switch name that the provisionging node is connected, where <switch-name> is the switch name.
B<switchport=<switch-port>> This is a mandatory item, when define a switch auto discovery node.
Description: Specify switch port that the provisionging node is connected, where <switch-port> is the connected port.
Description: Specify nic name, switch name and switch port to define node and switch relationship. We can define multi nic-switch-port relations here, looks like: switches=eth0!switch1!1,eth1!switch1,2
B<slotid=<slot-id>> This is a mandatory item while define a PureFlex node.
+22
View File
@@ -119,6 +119,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.
+21 -11
View File
@@ -4,32 +4,42 @@ B<rinstall> - Begin OS provision on a noderange
=head1 B<Synopsis>
B<rinstall> [I<-o>|I<--osver>] [I<-p>|I<--profile>] [I<-a>|I<--arch>] [I<-O>|I<--osimage>] [I<-c>|I<--console>] [I<noderange>]
B<rinstall> [I<-o>|I<--osver>] [I<-p>|I<--profile>] [I<-a>|I<--arch>] [I<-c>|I<--console>] [I<noderange>]
B<rinstall> [I<-O>|I<--osimage>] [I<-c>|I<--console>] [I<noderange>]
=head1 B<Description>
B<rinstall> is a convience command that will change tables as requested for operating system version, profile, and architecture, call B<nodeset> to modify the network boot configuration, call B<rsetboot> net to set the next boot over network (only support nodes with "nodetype.mgt=ipmi", for other nodes, make sure the correct boot order has been set before B<rinstall>), and B<rpower> to begin a boot cycle.
B<rinstall> is a convenience command that will change tables as requested for operating system version, profile, and architecture, call B<nodeset> to modify the network boot configuration, call B<rsetboot> net to set the next boot over network (only support nodes with "nodetype.mgt=ipmi", for other nodes, make sure the correct boot order has been set before B<rinstall>), and B<rpower> to begin a boot cycle.
If [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage> is set, provision the noderange with the osimage specified/configured, ignore the table change options if specified.
If -c is specified, it will then become the text console of the node. If wanting consoles on multiple nodes with a similar command, see L<winstall(8)|winstall.8>.
If -c is specified, it will then run rcons on the node. This is allowed only if one node in the noderange. If need consoles on multiple nodes , see L<winstall(8)|winstall.8>.
=head1 B<Options>
=over 7
=item B<-h>|B<--help>
Display usage message.
=item B<-v>|B<--version>
Display version.
=item B<-o>|B<--osver>
Specifies which os version to provision. If unspecified, the current table values are used. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
Specifies which os version to provision. If unspecified, the current node os setting is used. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
=item B<-p>|B<--profile>
Specifies what profile should be used of the operating system. If not specified the tables are used as is. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
Specifies what profile should be used of the operating system. If not specified the current node profile setting is used. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
=item B<-a>|B<--arch>
Specifies what architecture of the OS to provision. Typically this is unneeded, but if provisioning betweer x86_64 and x86 frequently, this may be a useful flag. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
Specifies what architecture of the OS to provision. Typically this is unneeded, but if provisioning between x86_64 and x86 frequently, this may be a useful flag. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
=item B<-O>|B<--osimage>
@@ -37,7 +47,7 @@ Specifies the osimage to provision.
=item B<-c>|B<--console>
Requests that rinstall become rcons once the provision commences. This will only work if there is only one node in the noderange. See L<winstall(8)|winstall.8> for consoles on multiple systems.
Requests that rinstall runs rcons once the provision starts. This will only work if there is only one node in the noderange. See L<winstall(8)|winstall.8> for starting nsoles on multiple nodes.
=back
@@ -46,17 +56,17 @@ Requests that rinstall become rcons once the provision commences. This will onl
B<rinstall> I<node1-node20>
Provison nodes 1 through 20, using configuration as is from tables.
Provison nodes 1 through 20, using their current configuration.
B<rinstall> -o rhels5.1 -p compute I<node1-node20>
B<rinstall> I<node1-node20> -o rhels5.1 -p compute
Provision nodes 1 through 20, forcing rhels5.1 and compute profile.
B<rinstall> -O rhels6.4-ppc64-netboot-compute I<node1-node20>
B<rinstall> I<node1-node20> -O rhels6.4-ppc64-netboot-compute
Provision nodes 1 through 20 with the osimage rhels6.4-ppc64-netboot-compute.
B<rinstall> -c I<node1>
B<rinstall> I<node1> -c
Provisoon node1 and start a console to monitor the process.
+24 -13
View File
@@ -1,53 +1,64 @@
=head1 Name
B<winstall> - Begin OS provision on a noderange and display in wcons
B<winstall> - Begin OS provision on a noderange
=head1 B<Synopsis>
B<winstall> [I<-o>|I<--osver>] [I<-p>|I<--profile>] [I<-a>|I<--arch>] [I<-O>|I<--osimage>] [I<noderange>]
B<winstall> [I<-o>|I<--osver>] [I<-p>|I<--profile>] [I<-a>|I<--arch>] [I<noderange>]
B<winstall> [I<-O>|I<--osimage>] [I<noderange>]
=head1 B<Description>
B<winstall> is a convience command that will change tables as requested for operating system version, profile, and architecture, call nodeset to modify the network boot configuration, and rpower to begin a boot cycle.
B<winstall> is a convenience tool that will change attributes as requested for operating system version, profile, and architecture, call B<nodeset> to modify the network boot configuration, call B<rsetboot> net to set the next boot over network (only support nodes
with "nodetype.mgt=ipmi", for other nodes, make sure the correct boot order has been set before B<winstall>), and B<rpower> to begin a boot cycle.
If [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage> is set, provision the noderange with the osimage specified/configured, ignore the table change options if specified
If [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage> is set, provision the noderange with the osimage specified/configured, ignore the table change options if specified.
It will then commence a wcons command to the noderange for monitoring.
It will then run wcons on the nodes.
=head1 B<Options>
=over 7
=item B<-h>|B<--help>
Display usage message.
=item B<-v>|B<--version>
Display version.
=item B<-o>|B<--osver>
Specifies which os version to provision. If unspecified, the current table values are used. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
Specifies which os version to provision. If unspecified, the current node os setting is used. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
=item B<-p>|B<--profile>
Specifies what profile should be used of the operating system. If not specified the tables are used as is. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
Specifies what profile should be used of the operating system. If not specified the current node profile setting is used. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
=item B<-a>|B<--arch>
Specifies what architecture of the OS to provision. Typically this is unneeded, but if provisioning betweer x86_64 and x86 frequently, this may be a useful flag. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
Specifies what architecture of the OS to provision. Typically this is unneeded, but if provisioning between x86_64 and x86 frequently, this may be a useful flag. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
=item B<-O>|B<--osimage>
Specifies the osimage to provision.
Specifies the osimage to provision.
=back
=head1 B<Examples>
B<rinstall> I<node1-node20>
B<winstall> I<node1-node20>
Provison nodes 1 through 20, using configuration as is from tables.
Provison nodes 1 through 20, using their current configuration.
B<rinstall> -o rhels5.1 -p compute I<node1-node20>
B<winstall> I<node1-node20> -o rhels5.1 -p compute
Provision nodes 1 through 20, forcing rhels5.1 and compute profile.
B<rinstall> -O rhels6.4-ppc64-netboot-compute I<node1-node20>
B<winstall> I<node1-node20> -O rhels6.4-ppc64-netboot-compute
Provision nodes 1 through 20 with the osimage rhels6.4-ppc64-netboot-compute.
+11
View File
@@ -13,6 +13,17 @@ DIR=`readlink -f $DIR`
DRACUTMODDIR=/usr/share/dracut/modules.d/97xcat
mkdir -p $DRACUTMODDIR
cp $DIR/* $DRACUTMODDIR
# For ppc64 platform, needs to remove some files,
# and some files are in different directories
if [ `uname -m` = "ppc64" ]; then
sed -i 's/dracut_install efibootmgr//' $DRACUTMODDIR/install
sed -i 's/ dmidecode//' $DRACUTMODDIR/install
sed -i 's/\/lib\/libncurses.so.5.7/\/lib64\/libncurses.so.5.7/' $DRACUTMODDIR/install
sed -i 's/\/usr\/lib\/libstdc++.so.6.0.13/\/usr\/lib64\/libstdc++.so.6.0.13/' $DRACUTMODDIR/install
sed -i 's/\/lib\/libgcc_s.so.1/\/lib64\/libgcc_s.so.1/' $DRACUTMODDIR/install
sed -i 's/\/lib\/libtinfo.so.5.7/\/lib64\/libtinfo.so.5.7/' $DRACUTMODDIR/install
fi
if [ "$HOSTOS" = "mcp" ]; then
sed -i 's/mkfs.btrfs//' $DRACUTMODDIR/install
sed -i 's/\/etc\/redhat-release/\/etc\/base-release \/etc\/system-release/' $DRACUTMODDIR/install
-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 enic 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 enic 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
+4 -2
View File
@@ -44,8 +44,10 @@ while [ $WAITING -gt 0 ]; do
done
WAITING=0
if [ ! -z "$FORCENICS" ]; then
for nic in `ifconfig|grep HWaddr|awk '{print $1}'|egrep "$FORCENICS"`; do
if ! ifconfig $nic|grep "inet addr" > /dev/null; then
#for nic in `ifconfig|grep HWaddr|awk '{print $1}'|egrep "$FORCENICS"`; do
for nic in `ip -oneline link show |grep -i ether |awk -F ':' '{print $2}'|grep -o "[^ ]\+\( \+[^ ]\+\)*"|egrep "$FORCENICS"`; do
# if ! ifconfig $nic|grep "inet addr" > /dev/null; then
if ! ip -4 -oneline addr show $nic|grep -i inet > /dev/null; then
WAITING=1
fi
done
+1 -1
View File
@@ -59,4 +59,4 @@ fi
%Files
%defattr(-,root,root)
/
/opt/xcat/share/xcat/netboot/genesis/%{tarch}
@@ -4,7 +4,7 @@ BuildArch: noarch
Release: snap%(date +"%Y%m%d%H%M")
Epoch: 1
AutoReq: false
Requires: efibootmgr ipmitool screen btrfs-progs lldpad rpm-build compat-libstdc++-33
Requires: ipmitool screen btrfs-progs lldpad rpm-build compat-libstdc++-33
Prefix: /opt/xcat
AutoProv: false
+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
+8 -2
View File
@@ -51,11 +51,13 @@ if [ "$IPMIMFG" == 2 ]; then #IBM
BMCPORT=`grep bmcport /tmp/ipmicfg.xml |awk -F\> '{print $2}'|awk -F\< '{print $1}'`
if [ ! -z "$BMCPORT" ]; then
let idev=0
IFS=','
for p in $BMCPORT; do
ipmitool -d $idev raw 0xc 1 1 0xc0 $p > /dev/null
ipmitool -d $idev raw 0x04 0x12 0x09 0x01 0x18 0x${p}1 0x00 > /dev/null
let idev=idev+1
done
unset IFS
fi
elif [ "$XPROD" == "291" ]; then
LOCKEDUSERS=1
@@ -65,10 +67,12 @@ if [ "$IPMIMFG" == 2 ]; then #IBM
BMCPORT=`grep bmcport /tmp/ipmicfg.xml |awk -F\> '{print $2}'|awk -F\< '{print $1}'`
if [ ! -z "$BMCPORT" ]; then
let idev=0
IFS=','
for p in $BMCPORT; do
ipmitool -d $idev raw 0xc 1 1 0xc0 $p > /dev/null
let idev=idev+1
done
unset IFS
fi
fi
fi
@@ -82,6 +86,7 @@ elif [ "$IPMIMFG" == 20301 ] ; then
BMCPORT=`grep bmcport /tmp/ipmicfg.xml |awk -F\> '{print $2}'|awk -F\< '{print $1}'`
if [ ! -z "$BMCPORT" ]; then
let idev=0
IFS=','
for p in $BMCPORT; do
ipmitool -d $idev raw 0xc 1 1 0xc0 $p > /dev/null
NEWPORT=`ipmitool -d $idev raw 0xc 2 1 0xc0 0 0|awk '{print $2}'`
@@ -89,6 +94,7 @@ elif [ "$IPMIMFG" == 20301 ] ; then
let idev=idev+1
done
unset IFS
fi
elif [ "$IPMIMFG" == "47488" ]; then
LOCKEDUSERS=1
@@ -185,7 +191,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
@@ -220,7 +226,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
+88 -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,89 @@ 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
fi
done
if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then
# doing static ip
# the device was determined above from the bootif mac, and put in bootnic
numbits=$(mask2prefix $netmask)
broadcast=$(bcastcalc $hostip $netmask)
echo "Setting static IP=$hostip/$numbits broadcast=$broadcast gateway=$gateway device=$bootnic BOOTIF=$BOOTIF ..."
ip addr add $hostip/$numbits broadcast $broadcast dev $bootnic scope global label $bootnic
ip link set $bootnic up
ip route replace to default via $gateway dev $bootnic
# 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.."
+2 -1
View File
@@ -1590,7 +1590,8 @@ send_monitor_msg() {
# Get the client mac address.
if [ -z "$mac" ]; then
mac=`ifconfig $DEVICE 2>/dev/null | sed -ne "s/.*HWaddr //p" | sed "s/ //g" | sed s/:/./g`
#mac=`ifconfig $DEVICE 2>/dev/null | sed -ne "s/.*HWaddr //p" | sed "s/ //g" | sed s/:/./g`
mac=`ip -4 -oneline link show $DEVICE 2>/dev/null|grep -i ether|sed -ne "s/.*ether //p"|awk -F ' ' '{print $1}'|sed s/:/./g`
fi
# Collect some special info only after proc file system is mounted.
+12 -3
View File
@@ -10,12 +10,17 @@
checks for errors.
=cut
#------------------------------------------------------------------------------#
BEGIN
{
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
}
use lib "$::XCATROOT/lib/perl";
use strict;
use locale;
use Getopt::Long;
use IPC::SysV qw(IPC_STAT S_IRWXU IPC_PRIVATE IPC_CREAT S_IRUSR S_IWUSR );
use IPC::Msg;
use xCAT::Utils;
BEGIN
{
@@ -109,8 +114,9 @@ if (&first_time_run)
runcmd("/usr/bin/mkfifo $fifo");
}
runcmd("echo \"$embedinfo\" >> $syslogconf");
my $cmd = service("syslog", "restart");
runcmd($cmd);
#my $cmd = service("syslog", "restart");
#runcmd($cmd);
xCAT::Utils->restartservice("syslog");
}
touchFile($runfile);
}
@@ -512,6 +518,9 @@ sub createRandomName
'stop' or 'status'.
Returns:
A full cli for the service script.
Comment:
this subroutine is deprecated, use service subroutines in xCAT::Utils
instead
=cut
#--------------------------------------------------------------------------------
+1 -1
View File
@@ -106,7 +106,7 @@ fi
%ifos linux
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
if [ -f $RPM_INSTALL_PREFIX0/sbin/xcatd ]; then
/etc/init.d/xcatd reload
/etc/init.d/xcatd restart
fi
fi
%else
+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
Depends: ${perl:Depends}, 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,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
+21 -5
View File
@@ -121,6 +121,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;
@@ -308,7 +309,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;
@@ -319,6 +320,12 @@ sub admin_level_set {
0x82 => "Cannot disable User Level authentication",
);
my $code = $rsp->{code};
if (($code == 0x80 or $code == 0x81) and $self->{privlevel} == 4) {
$self->{privlevel} = 3;
$self->subcmd(netfn=>0x6,command=>0x3b,data=>[$self->{privlevel}],callback=>\&admin_level_set,callback_args=>$self);
return;
}
if ($code) {
my $errtxt = sprintf("ERROR: Failed requesting administrator privilege %02xh",$code);
if ($localcodes{$code}) {
@@ -686,7 +693,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'});
}
@@ -700,7 +707,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;
@@ -709,6 +716,8 @@ sub send_rakp1 {
}
sub init {
my $self = shift;
$self->{confalgo} = undef;
$self->{integrityalgo}=undef;
$self->{sessionestablishmentcontext} = 0;
$self->{'sequencenumber'} = 0; #init sequence number
$self->{'sequencenumberbytes'} = [0,0,0,0]; #init sequence number
@@ -816,6 +825,13 @@ sub got_rakp2 {
}
$byte = shift @data;
unless ($byte == 0x00) {
if (($byte == 0x9 or $byte == 0xd) 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
@@ -840,7 +856,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[$_]) {
@@ -849,7 +865,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
@@ -1394,7 +1394,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',
+433 -147
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,8 @@ sub subvars {
$ENV{NODESTATUS}=$tmp;
}
#replace the env with the right value so that correct include files can be found
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
@@ -148,161 +151,179 @@ sub subvars {
}
}
#do *all* includes, recursive and all
my $doneincludes=0;
while (not $doneincludes) {
$doneincludes=1;
if ($inc =~ /#INCLUDE_PKGLIST:[^#^\n]+#/) {
$doneincludes=0;
$inc =~ s/#INCLUDE_PKGLIST:([^#^\n]+)#/includefile($1, 0, 1)/eg;
}
if ($inc =~ /#INCLUDE_PTRNLIST:[^#^\n]+#/) {
$doneincludes=0;
$inc =~ s/#INCLUDE_PTRNLIST:([^#^\n]+)#/includefile($1, 0, 2)/eg;
}
if ($inc =~ /#INCLUDE_RMPKGLIST:[^#^\n]+#/) {
$doneincludes=0;
$inc =~ s/#INCLUDE_RMPKGLIST:([^#^\n]+)#/includefile($1, 0, 3)/eg;
}
if ($inc =~ /#INCLUDE:[^#^\n]+#/) {
$doneincludes=0;
$inc =~ s/#INCLUDE:([^#^\n]+)#/includefile($1, 0, 0)/eg;
}
}
#support multiple paths of osimage in rh/sles diskfull installation
my @pkgdirs;
if ( defined($media_dir) ) {
@pkgdirs = split(",", $media_dir);
my $source;
my $source_in_pre;
my $c = 0;
foreach my $pkgdir(@pkgdirs) {
if( $platform =~ /^(rh|SL|centos|fedora)$/ ) {
if ( $c == 0 ) {
# After some tests, if we put the repo in pre scripts in the kickstart like for rhels6.x
# the rhels5.9 will not be installed successfully. So put in kickstart directly.
$source_in_pre .= "echo 'url --url http://'\$nextserver'/$pkgdir' >> /tmp/repos";
$source .= "url --url http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; #For rhels5.9
} else {
$source_in_pre .= "\necho 'repo --name=pkg$c --baseurl=http://'\$nextserver'/$pkgdir' >> /tmp/repos";
$source .= "repo --name=pkg$c --baseurl=http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; #for rhels5.9
}
} elsif ($platform =~ /^(sles|suse)/) {
my $http = "http://#TABLE:noderes:\$NODE:nfsserver#$pkgdir";
$source .= " <listentry>
<media_url>$http</media_url>
<product>SuSE-Linux-pkg$c</product>
<product_dir>/</product_dir>
<ask_on_error config:type=\"boolean\">false</ask_on_error> <!-- available since openSUSE 11.0 -->
<name>SuSE-Linux-pkg$c</name> <!-- available since openSUSE 11.1/SLES11 (bnc#433981) -->
</listentry>";
$source_in_pre .="<listentry><media_url>http://'\$nextserver'$pkgdir</media_url><product>SuSE-Linux-pkg$c</product><product_dir>/</product_dir><ask_on_error config:type=\"boolean\">false</ask_on_error><name>SuSE-Linux-pkg$c</name></listentry>";
#if user specify the partion file, replace the default partition strategy
my $partcontent;
my $scriptflag = 0;
if ($partitionfile){
if ($partitionfile =~ /^s:(.*)/){
$scriptflag = 1;
$partitionfile = $1;
}
if (-r $partitionfile){
open ($inh, "<", $partitionfile);
while (<$inh>){
$partcontent .= $_;
}
$c++;
close ($inh);
}
$inc =~ s/#INSTALL_SOURCES#/$source/g;
$inc =~ s/#INSTALL_SOURCES_IN_PRE#/$source_in_pre/g;
# append the partition file into the $inc to do the replacement
$inc .= "\nFFFFFFFFFFFFPARTITIONFILESTART\n".$partcontent;
}
#do *all* includes, recursive for all
my $doneincludes=0;
while (not $doneincludes) {
$doneincludes=1;
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg; # handle the variable in #INCLUDE
if ($inc =~ /#INCLUDE_PKGLIST:[^\n]+#/) {
# get in this section but might not do the replace since it needs wait
# for the replace of sting inside the #INCLUDE_PKGLIST:xx#
$doneincludes=0;
$inc =~ s/#INCLUDE_PKGLIST:([^#^\n]+)#/includefile($1, 0, 1)/eg;
}
if ($inc =~ /#INCLUDE_PTRNLIST:[^\n]+#/) {
$doneincludes=0;
$inc =~ s/#INCLUDE_PTRNLIST:([^#^\n]+)#/includefile($1, 0, 2)/eg;
}
if ($inc =~ /#INCLUDE_RMPKGLIST:[^\n]+#/) {
$doneincludes=0;
$inc =~ s/#INCLUDE_RMPKGLIST:([^#^\n]+)#/includefile($1, 0, 3)/eg;
}
if ($inc =~ /#INCLUDE:[^\n]+#/) {
$doneincludes=0;
$inc =~ s/#INCLUDE:([^#^\n]+)#/includefile($1, 0, 0)/eg;
}
#support multiple paths of osimage in rh/sles diskfull installation
my @pkgdirs;
if ( defined($media_dir) ) {
@pkgdirs = split(",", $media_dir);
my $source;
my $source_in_pre;
my $c = 0;
foreach my $pkgdir(@pkgdirs) {
my $http = "http://#TABLE:noderes:\$NODE:nfsserver#$pkgdir";
my $http2 = "http://'\$nextserver'$pkgdir";
if ( $pkgdir =~ /^http/ ) {
$http = $pkgdir;
$http2 = $pkgdir;
}
if( $platform =~ /^(rh|SL|centos|fedora)$/ ) {
if ( $c == 0 ) {
# After some tests, if we put the repo in pre scripts in the kickstart like for rhels6.x
# the rhels5.9 will not be installed successfully. So put in kickstart directly.
$source_in_pre .= "echo 'url --url $http2 >> /tmp/repos";
$source .= "url --url $http\n"; #For rhels5.9
} else {
$source_in_pre .= "\necho 'repo --name=pkg$c --baseurl=$http2' >> /tmp/repos";
$source .= "repo --name=pkg$c --baseurl=$http\n"; #for rhels5.9
}
} elsif ($platform =~ /^(sles|suse)/) {
$source .= " <listentry>
<media_url>$http</media_url>
<product>SuSE-Linux-pkg$c</product>
<product_dir>/</product_dir>
<ask_on_error config:type=\"boolean\">false</ask_on_error> <!-- available since openSUSE 11.0 -->
<name>SuSE-Linux-pkg$c</name> <!-- available since openSUSE 11.1/SLES11 (bnc#433981) -->
</listentry>";
$source_in_pre .="<listentry><media_url>$http2</media_url><product>SuSE-Linux-pkg$c</product><product_dir>/</product_dir><ask_on_error config:type=\"boolean\">false</ask_on_error><name>SuSE-Linux-pkg$c</name></listentry>";
}
$c++;
}
$inc =~ s/#INSTALL_SOURCES#/$source/g;
$inc =~ s/#INSTALL_SOURCES_IN_PRE#/$source_in_pre/g;
}
#ok, now do everything else..
my $shortname = $node;
$shortname =~ s/\..*//;
$inc =~ s/#TABLE:([^:]+):([^:]+):([^#]+)#/tabdb($1,$2,$3)/eg;
$inc =~ s/#TABLEBLANKOKAY:([^:]+):([^:]+):([^#]+)#/tabdb($1,$2,$3,'1')/eg;
$inc =~ s/#INCLUDE_NOP:([^#^\n]+)#/includefile($1,1,0)/eg;
$inc =~ s/#XCATVAR:([^#]+)#/envvar($1)/eg;
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
$inc =~ s/#MACHINEPASSWORD#/machinepassword()/eg;
$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;
$inc =~ s/#WINNETCFG#/windows_net_cfg()/eg;
$inc =~ s/#WINADJOIN#/windows_join_data()/eg;
$inc =~ s/#WINDNSCFG#/windows_dns_cfg()/eg;
$inc =~ s/#WINACCOUNTDATA#/windows_account_data()/eg;
$inc =~ s/#WINDISABLENULLADMIN#/windows_disable_null_admin()/eg;
$inc =~ s/#MANAGEDADDRESSMODE#/managed_address_mode()/eg;
$inc =~ s/#HOSTNAME#/$node/g;
$inc =~ s/#SHORTNAME#/$shortname/g;
$inc =~ s/#GETNODEDOMAIN:([^#]+)#/get_node_domain($1)/eg;
my $nrtab = xCAT::Table->new("noderes");
my $tftpserver = $nrtab->getNodeAttribs($node, ['tftpserver']);
my $sles_sdk_media = "http://" . $tftpserver->{tftpserver} . $media_dir . "/sdk1";
$inc =~ s/#SLES_SDK_MEDIA#/$sles_sdk_media/eg;
#Support hierarchical include
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
if ($inc =~ /#INCLUDE:[^#^\n]+#/) {
$inc =~ s/#INCLUDE:([^#^\n]+)#/includefile($1, 0, 0)/eg;
}
#ok, now do everything else..
$inc =~ s/#TABLE:([^:]+):([^:]+):([^#]+)#/tabdb($1,$2,$3)/eg;
$inc =~ s/#TABLEBLANKOKAY:([^:]+):([^:]+):([^#]+)#/tabdb($1,$2,$3,'1')/eg;
$inc =~ s/#INCLUDE_NOP:([^#^\n]+)#/includefile($1,1,0)/eg;
$inc =~ s/#INCLUDE_PKGLIST:([^#^\n]+)#/includefile($1,0,1)/eg;
$inc =~ s/#INCLUDE_PTRNLIST:([^#^\n]+)#/includefile($1,0,2)/eg;
$inc =~ s/#INCLUDE_RMPKGLIST:([^#^\n]+)#/includefile($1,0,3)/eg;
$inc =~ s/#INCLUDE:([^#^\n]+)#/includefile($1, 0, 0)/eg;
$inc =~ s/#XCATVAR:([^#]+)#/envvar($1)/eg;
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
$inc =~ s/#MACHINEPASSWORD#/machinepassword()/eg;
$inc =~ s/#CRYPT:([^:]+):([^:]+):([^#]+)#/crydb($1,$2,$3)/eg;
$inc =~ s/#COMMAND:([^#]+)#/command($1)/eg;
$inc =~ s/#KICKSTARTNET#/kickstartnetwork()/eg;
$inc =~ s/#ESXIPV6SETUP#/esxipv6setup()/eg;
$inc =~ s/#WINTIMEZONE#/xCAT::TZUtils::get_wintimezone()/eg;
$inc =~ s/#WINPRODKEY:([^#]+)#/get_win_prodkey($1)/eg;
$inc =~ s/#WINNETCFG#/windows_net_cfg()/eg;
$inc =~ s/#WINADJOIN#/windows_join_data()/eg;
$inc =~ s/#WINDNSCFG#/windows_dns_cfg()/eg;
$inc =~ s/#WINACCOUNTDATA#/windows_account_data()/eg;
$inc =~ s/#WINDISABLENULLADMIN#/windows_disable_null_admin()/eg;
$inc =~ s/#MANAGEDADDRESSMODE#/managed_address_mode()/eg;
$inc =~ s/#HOSTNAME#/$node/g;
my $nrtab = xCAT::Table->new("noderes");
my $tftpserver = $nrtab->getNodeAttribs($node, ['tftpserver']);
my $sles_sdk_media = "http://" . $tftpserver->{tftpserver} . $media_dir . "/sdk1";
$inc =~ s/#SLES_SDK_MEDIA#/$sles_sdk_media/eg;
#if user specify the partion file, replace the default partition strategy
if ($partitionfile){
#if the content of the partition file is definition replace the default is ok
my $partcontent = '';
my $scriptflag = 0;
if ($partitionfile =~ /^s:(.*)/){
$scriptflag = 1;
$partitionfile = $1;
}
if (-r $partitionfile){
open ($inh, "<", $partitionfile);
while (<$inh>){
$partcontent .= $_;
}
close ($inh);
#the content of the specified file is a script which can write partition definition into /tmp/partitionfile
if ($scriptflag){
#for redhat/sl/centos/kvm/fedora
if ($inc =~ /#XCAT_PARTITION_START#/) {
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 .= "chmod 755 /tmp/partscript\n";
$partcontent .= "/tmp/partscript\n";
#replace the #XCA_PARTITION_SCRIPT#
$inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;
}
#for sles/suse
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 .= "chmod 755 /tmp/partscript\n";
$partcontent .= "/tmp/partscript\n";
$inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;
}
}
else{
$partcontent =~ s/\s$//;
if ($inc =~ /#XCAT_PARTITION_START#/){
$inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$partcontent/;
}
elsif ($inc =~ /<!-- XCAT-PARTITION-START -->/){
$inc =~ s/<!-- XCAT-PARTITION-START -->[\s\S]*<!-- XCAT-PARTITION-END -->/$partcontent/;
}
}
}
if ($partitionfile && $doneincludes) {
#the content of the specified file is a script which can write partition definition into /tmp/partitionfile
# split the partition file out from the $inc
($inc, $partcontent) = split(/FFFFFFFFFFFFPARTITIONFILESTART/, $inc);
if ($scriptflag){
# since the whole partition file needs be packaged in %pre first and generate an executable file at running time,
# all the special chars like ',",%,\ need be kept, we have to use the base64 coding to code it and put it in
# %pre and decode it out during the running time.
use MIME::Base64;
$partcontent = encode_base64($partcontent);
$partcontent =~ s/\n//g;
#for redhat/sl/centos/kvm/fedora
if ($inc =~ /#XCAT_PARTITION_START#/) {
my $tempstr = "%include /tmp/partitionfile\n";
$inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$tempstr/;
# Put the base64 coded partitionfile into %pre part
$partcontent = "cat > /tmp/partscript.enc << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
# Put the code to decode the partitionfile
$partcontent .= "python -c 'import base64; print base64.b64decode(open(\"/tmp/partscript.enc\",\"rb\").read())' >/tmp/partscript\n";
$partcontent .= "chmod 755 /tmp/partscript\n";
$partcontent .= "/tmp/partscript\n";
#replace the #XCA_PARTITION_SCRIPT#
$inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;
}
#for sles/suse
elsif ($inc =~ /<!-- XCAT-PARTITION-START -->/){
my $tempstr = "<drive><device>XCATPARTITIONTEMP</device></drive>";
$inc =~ s/<!-- XCAT-PARTITION-START -->[\s\S]*<!-- XCAT-PARTITION-END -->/$tempstr/;
# Put the base64 coded partitionfile into %pre part
$partcontent = "cat > /tmp/partscript.enc << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
# Put the code to decode the partitionfile
$partcontent .= "perl -ne 'use MIME::Base64; print decode_base64(\$_)' </tmp/partscript.enc > /tmp/partscript\n";
$partcontent .= "chmod 755 /tmp/partscript\n";
$partcontent .= "/tmp/partscript\n";
$inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;
}
}
else{
$partcontent =~ s/\s$//;
if ($inc =~ /#XCAT_PARTITION_START#/){
$inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$partcontent/;
}
elsif ($inc =~ /<!-- XCAT-PARTITION-START -->/){
$inc =~ s/<!-- XCAT-PARTITION-START -->[\s\S]*<!-- XCAT-PARTITION-END -->/$partcontent/;
}
}
}
}
if ($tmplerr) {
close ($outh);
return $tmplerr;
}
close ($outh);
return $tmplerr;
}
print $outh $inc;
close($outh);
return 0;
@@ -607,6 +628,22 @@ sub get_win_prodkey {
sub managed_address_mode {
return $::XCATSITEVALS{managedaddressmode};
}
sub get_node_domain {
my $lcnode=shift;
if ( $lcnode eq 'THISNODE' ){
$lcnode=$node;
}
my $nd = xCAT::NetworkUtils->getNodeDomains([$lcnode]);
my %nodedomains = %$nd;
my $domain=$nodedomains{$lcnode};
return $domain;
}
sub esxipv6setup {
if (not $::XCATSITEVALS{managedaddressmode} or $::XCATSITEVALS{managedaddressmode} =~ /v4/) { return ""; } # blank line for ipv4 schemes
my $v6addr;
@@ -632,9 +669,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);
@@ -648,12 +688,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;
}
#there is no network option to set dns search domain in kickstart, it will be set in %post
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};
+7
View File
@@ -13,6 +13,13 @@ our %kmskeymap = (
"win8.professional_n" => "XCVCF-2NXM9-723PB-MHCB7-2RYQQ",
"win8.enterprise" => "32JNW-9KQ84-P47T8-D8GGY-CWCK7",
"win8.enterprise_n" => "JMNMF-RHW7P-DMY6X-RF3DR-X2BQT",
"win81.professional" => "GCRJD-8NW9H-F2CDX-CCM8D-9D6T9",
"win81.professional_n" => "HMCNV-VVBFX-7HMBH-CTY9B-B4FXY",
"win81.enterprise" => "MHF9N-XY6XB-WVXMC-BTDCT-MKKG7",
"win81.enterprise_n" => "TT4HM-HN7YT-62K67-RGRQJ-JFFXW",
"win2012r2.standard" => "D2N9P-3P6X9-2R39C-7RTCD-MDVJX",
"win2012r2.datacenter" => "W3GGN-FT8W3-Y4M27-J84CP-Q3VJ9",
"win2012r2.essentials" => "KNC87-3J2TX-XB4WP-VCPJV-M4FWM",
"win2012.standard" => "XC9B7-NBPP2-83J2H-RHMBY-92BT4", #note that core and non-core share KMS key
"win2012.datacenter" => "48HP8-DN98B-MYWDG-T2DCC-8W83P",
"win7.professional" => "FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4",
+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;
+4 -2
View File
@@ -66,12 +66,14 @@ sub start {
my $mychildren_cfg="/etc/nagios/objects/mychildren.cfg";
if ($isSN) { #start nagios daemon only when mychildren exists on the sn
if (-f $mychildren_cfg) {
my $rc=`service nagios restart 2>&1`;
#my $rc=`service nagios restart 2>&1`;
my $rc=xCAT::Utils->restartservice("nagios");
reportError("$localhostname: $rc", $callback);
}
}
else { #always start nagios daemon on mn
my $rc=`service nagios restart 2>&1`;
#my $rc=`service nagios restart 2>&1`;
my $rc=xCAT::Utils->restartservice("nagios");
reportError("$localhostname: $rc", $callback);
}
+4 -2
View File
@@ -122,7 +122,8 @@ sub start_RRD_server
print FILE "\tserver_args = - /var/rrd\n";
print FILE "}\n";
close FILE;
xCAT::Utils->runcmd("service xinetd restart", 0);
#xCAT::Utils->runcmd("service xinetd restart", 0);
xCAT::Utils->restartservice("xinetd");
}
return 0;
}
@@ -188,7 +189,8 @@ sub stop_RRD_server
} else {
xCAT::Utils->runcmd("rm -f /etc/xinetd.d/rrdsrv", 0);
}
xCAT::Utils->runcmd("service xinetd restart", 0);
#xCAT::Utils->runcmd("service xinetd restart", 0);
xCAT::Utils->restartservice("xinetd");
}
return 0;
}
+14 -1
View File
@@ -92,6 +92,7 @@ sub process_request {
my @commandslist;
my %argslist;
my $noupdate_flag = 0;
my %msghash = ( "makehosts" => "Updating hosts entries",
"makedns" => "Updating DNS entries",
"makedhcp" => "Update DHCP entries",
@@ -143,6 +144,10 @@ sub process_request {
if($macflag)
{
if ($chainarray[0]){
if($chainarray[0] =~ m/^osimage=/)
{
$noupdate_flag = 1;
}
push @commandslist, ['nodeset', $chainarray[0]];
}
}
@@ -161,6 +166,7 @@ sub process_request {
my $firstnode = (@$nodelist)[0];
if (exists $profilehash{$firstnode}{"ImageProfile"}){
my $osimage = 'osimage='.$profilehash{$firstnode}{"ImageProfile"};
$noupdate_flag = 1;
push @commandslist, ['nodeset', $osimage];
}
}
@@ -170,7 +176,14 @@ sub process_request {
my $current_cmd = $_->[0];
my $current_args = $_->[1];
setrsp_progress($msghash{$current_cmd});
my $retref = xCAT::Utils->runxcmd({command=>[$current_cmd], node=>$nodelist, arg=>[$current_args]}, $request_command, 0, 2);
if(($current_cmd eq "nodeset") && $noupdate_flag)
{
$retref = xCAT::Utils->runxcmd({command=>[$current_cmd], node=>$nodelist, arg=>[$current_args, "--noupdateinitrd"]}, $request_command, 0, 2);
}
else
{
$retref = xCAT::Utils->runxcmd({command=>[$current_cmd], node=>$nodelist, arg=>[$current_args]}, $request_command, 0, 2);
}
log_cmd_return($retref);
}
+112 -58
View File
@@ -509,8 +509,13 @@ sub setup_CONS
"conserver cannot be started because the file $ca_file2 cannot be found\n";
}
else
{
my $rc = xCAT::Utils->startService("conserver");
{
if (xCAT::Utils->isAIX()){
$rc=xCAT::Utils->startService("conserver");
}elsif(xCAT::Utils->isLinux()){
#my $rc = xCAT::Utils->startService("conserver");
$rc=xCAT::Utils->startservice("conserver");
}
if ($rc != 0)
{
return 1;
@@ -537,9 +542,11 @@ sub setup_DHCP
my $snonly = 0;
# if on the MN check to see if dhcpd is running, and start it if not.
if (xCAT::Utils->isMN()) { # on the MN
my @output = xCAT::Utils->runcmd("service dhcpd status", -1);
if ($::RUNCMD_RC != 0) { # not running
$rc = xCAT::Utils->startService("dhcpd");
#my @output = xCAT::Utils->runcmd("service dhcpd status", -1);
#if ($::RUNCMD_RC != 0) { # not running
my $retcode= xCAT::Utils->checkservicestatus("dhcpd");
if($retcode!=0){
$rc = xCAT::Utils->startservice("dhcpd");
if ($rc != 0)
{
return 1;
@@ -573,12 +580,18 @@ sub setup_DHCP
->($cmdref, \&xCAT::Client::handle_response);
my $distro = xCAT::Utils->osver();
my $serv = "dhcpd";
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
$serv = "isc-dhcp-server";
}
#my $serv = "dhcpd";
#if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
# $serv = "isc-dhcp-server";
#}
my $rc = xCAT::Utils->startService($serv);
#my $rc = xCAT::Utils->startService($serv);
my $rc=0;
if(xCAT::Utils->isAIX()){
$rc = xCAT::Utils->startService("dhcpd");
} elsif(xCAT::Utils->isLinux()){
$rc = xCAT::Utils->startservice("dhcp");
}
if ($rc != 0)
{
return 1;
@@ -672,7 +685,13 @@ sub setup_FTP
# start ftp
my $rc = xCAT::Utils->startService("vsftpd");
#my $rc = xCAT::Utils->startService("vsftpd");
my $rc = 0;
if(xCAT::Utils->isAIX()){
$rc = xCAT::Utils->startService("vsftpd");
}elsif(xCAT::Utils->isLinux()){
$rc = xCAT::Utils->startservice("vsftpd");
}
if ($rc != 0)
{
return 1;
@@ -723,12 +742,19 @@ sub setup_DNS
# turn DNS on
my $distro = xCAT::Utils->osver();
my $serv = "named";
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
$serv = "bind9";
#my $serv = "named";
#if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
# $serv = "bind9";
#}
#my $rc = xCAT::Utils->startService($serv);
my $rc = 0;
if(xCAT::Utils->isAIX()){
$rc = xCAT::Utils->startService("named");
}elsif(xCAT::Utils->isLinux()){
$rc=xCAT::Utils->startservice("named");
}
my $rc = xCAT::Utils->startService($serv);
if ($rc != 0)
{
return 1;
@@ -751,15 +777,17 @@ sub setup_DNS
else
{
#chkconfig
my $cmd = "/sbin/chkconfig $serv on";
my $outref = xCAT::Utils->runcmd("$cmd", 0);
if ($::RUNCMD_RC != 0)
#my $cmd = "/sbin/chkconfig $serv on";
#my $outref = xCAT::Utils->runcmd("$cmd", 0);
#if ($::RUNCMD_RC != 0)
my $retcode=xCAT::Utils->enableservice("named");
if($retcode!=0)
{
xCAT::MsgUtils->message("SE", " Error: Could not enable $serv.");
xCAT::MsgUtils->message("SE", " Error: Could not enable dns server.");
}
else
{
xCAT::MsgUtils->message("SI", " $serv has been enabled on boot.");
xCAT::MsgUtils->message("SI", " dns server has been enabled on boot.");
}
}
@@ -778,7 +806,14 @@ sub setup_DNS
sub setup_LDAP
{
my $rc = xCAT::Utils->startService("ldap");
#my $rc = xCAT::Utils->startService("ldap");
my $rc = 0;
if(xCAT::Utils->isAIX()){
$rc = xCAT::Utils->startService("ldap");
}elsif(xCAT::Utils->isLinux()){
$rc=xCAT::Utils->startservice("ldap");
}
if ($rc != 0)
{
return 1;
@@ -805,16 +840,17 @@ sub setup_NFS
my $rc = 0;
if (xCAT::Utils->isLinux())
{
my $os = xCAT::Utils->osver();
if ($os =~ /sles.*/)
{
$rc = xCAT::Utils->startService("nfs");
$rc = xCAT::Utils->startService("nfsserver");
}
else
{
$rc = xCAT::Utils->startService("nfs");
}
#my $os = xCAT::Utils->osver();
#if ($os =~ /sles.*/)
#{
# $rc = xCAT::Utils->startService("nfs");
# $rc = xCAT::Utils->startService("nfsserver");
#}
#else
#{
# $rc = xCAT::Utils->startService("nfs");
#}
$rc = xCAT::Utils->startservice("nfs");
}
else
{ #AIX
@@ -944,7 +980,14 @@ sub setup_NTPmn
sub start_NTP
{
my $rc = xCAT::Utils->startService("ntpd");
my $rc =0;
if (xCAT::Utils->isAIX()){
$rc=xCAT::Utils->startService("ntpd");
}elsif(xCAT::Utils->isLinux()){
#my $rc = xCAT::Utils->startService("conserver");
$rc=xCAT::Utils->startservice("ntpd");
}
if ($rc != 0)
{
return 1;
@@ -1271,15 +1314,16 @@ sub setup_HTTP
if (xCAT::Utils->isLinux())
{
my $os = xCAT::Utils->osver();
if ($os =~ /sles.*/)
{
$rc = xCAT::Utils->startService("apache2");
}
else
{
$rc = xCAT::Utils->startService("httpd");
}
#my $os = xCAT::Utils->osver();
#if ($os =~ /sles.*/)
#{
# $rc = xCAT::Utils->startService("apache2");
#}
#else
#{
# $rc = xCAT::Utils->startService("httpd");
#}
$rc=xCAT::Utils->startservice("http");
}
return $rc;
}
@@ -1385,24 +1429,33 @@ sub enable_TFTPhpa
}
print FILE @newcfgfile;
close (FILE);
my @output = xCAT::Utils->runcmd("service xinetd status", -1);
if ($::RUNCMD_RC == 0) {
if (grep(/running/, @output))
{
print ' '; # indent service output to separate it from the xcatd service output
system "service xinetd stop";
if ($? > 0)
{ # error
#my @output = xCAT::Utils->runcmd("service xinetd status", -1);
#if ($::RUNCMD_RC == 0) {}
my $retcode=xCAT::Utils->checkservicestatus("xinetd");
if($retcode==0){
my $retcode=xCAT::Utils->restartservice("xinetd");
if($retcode !=0 )
{
xCAT::MsgUtils->message("S",
"Error on command: service xinetd stop\n");
"Error on restart xinetd\n");
}
system "service xinetd start";
if ($? > 0)
{ # error
xCAT::MsgUtils->message("S",
"Error on command: service xinetd start\n");
}
}
#if (grep(/running/, @output))
#{
# print ' '; # indent service output to separate it from the xcatd service output
# system "service xinetd stop";
# if ($? > 0)
# { # error
# xCAT::MsgUtils->message("S",
# "Error on command: service xinetd stop\n");
# }
# system "service xinetd start";
# if ($? > 0)
# { # error
# xCAT::MsgUtils->message("S",
# "Error on command: service xinetd start\n");
# }
#}
}
}
}
@@ -1449,7 +1502,8 @@ sub enable_TFTPhpa
sleep 1;
my @checkproc=`ps axf|grep -v grep|grep in.tftpd`;
if (@checkproc){
system("service tftpd-hpa stop");
#system("service tftpd-hpa stop");
xCAT::Utils->stopservice("tftpd-hpa");
}
}
my @tftpprocs=`ps axf|grep -v grep|grep in.tftpd`;
+29 -13
View File
@@ -380,7 +380,7 @@ sub processArgs
{
my $gotattrs = 0;
if (defined(@{$::args})) {
if ( defined ($::args) && @{$::args} ) {
@ARGV = @{$::args};
} else {
if ($::command eq "lsdef") {
@@ -391,8 +391,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 +401,7 @@ sub processArgs
} else {
return 2;
}
}
}
if ($::command eq "lsdef") {
@@ -2466,15 +2468,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);
}
@@ -2482,8 +2490,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)
{
@@ -2631,6 +2644,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;
+20 -13
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};
}
@@ -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};
}
+129 -27
View File
@@ -662,7 +662,11 @@ sub mknetboot
$kcmdline = "NFSROOT=$nfssrv:$nfsdir STATEMNT=";
}
} else {
$kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg-statelite.gz STATEMNT=";
if (-r "$rootimgdir/rootimg-statelite.gz.metainfo") {
$kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg-statelite.gz.metainfo STATEMNT=";
} else {
$kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg-statelite.gz STATEMNT=";
}
}
# add support for subVars in the value of "statemnt"
@@ -724,8 +728,13 @@ sub mknetboot
$kcmdline .= "NODE=$node ";
}
else {
$kcmdline =
"imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg.$suffix ";
if (-r "$rootimgdir/rootimg.$suffix.metainfo") {
$kcmdline =
"imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg.$suffix.metainfo ";
} else {
$kcmdline =
"imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg.$suffix ";
}
$kcmdline .= "XCAT=$xcatmaster:$xcatdport ";
$kcmdline .= "NODE=$node ";
# add flow control setting
@@ -743,15 +752,19 @@ sub mknetboot
my $useifname=0;
#for rhels5.x-ppc64, if installnic="mac", BOOTIF=<mac> should be appended
my $usemac=0;
my $nicname="";
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and $reshash->{$node}->[0]->{installnic} ne "mac") {
$useifname=1;
$kcmdline .= "ifname=".$reshash->{$node}->[0]->{installnic} . ":";
#$kcmdline .= "ifname=".$reshash->{$node}->[0]->{installnic} . ":";
$nicname=$reshash->{$node}->[0]->{installnic};
} elsif ($nodebootif) {
$useifname=1;
$kcmdline .= "ifname=$nodebootif:";
#$kcmdline .= "ifname=$nodebootif:";
$nicname=$nodebootif;
} elsif ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") {
$useifname=1;
$kcmdline .= "ifname=".$reshash->{$node}->[0]->{primarynic}.":";
#$kcmdline .= "ifname=".$reshash->{$node}->[0]->{primarynic}.":";
$nicname=$reshash->{$node}->[0]->{primarynic};
}else{
if($arch=~ /ppc/)
{
@@ -781,24 +794,32 @@ sub mknetboot
# }
}
if ($useifname && $mac) {
$kcmdline .= "$mac ";
if( ($nicname ne "") and (not xCAT::NetworkUtils->isValidMAC($nicname) )){
if ($useifname && $mac) {
$kcmdline .= "ifname=$nicname:$mac ";
}
$kcmdline .= "netdev=$nicname ";
}else {
if($mac){
$kcmdline .= "BOOTIF=$mac ";
}
}
# add "netdev=<eth0>" or "BOOTIF=<mac>"
# which are used for other scenarios
my $netdev = "";
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and $reshash->{$node}->[0]->{installnic} ne "mac") {
$kcmdline .= "netdev=" . $reshash->{$node}->[0]->{installnic} . " ";
} elsif ($nodebootif) {
$kcmdline .= "netdev=" . $nodebootif . " ";
} elsif ( $reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") {
$kcmdline .= "netdev=" . $reshash->{$node}->[0]->{primarynic} . " ";
} else {
if ( ($usemac || $useifname) && $mac) {
$kcmdline .= "BOOTIF=" . $mac . " ";
}
}
#my $netdev = "";
#if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and $reshash->{$node}->[0]->{installnic} ne "mac") {
# $kcmdline .= "netdev=" . $reshash->{$node}->[0]->{installnic} . " ";
#} elsif ($nodebootif) {
# $kcmdline .= "netdev=" . $nodebootif . " ";
#} elsif ( $reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") {
# $kcmdline .= "netdev=" . $reshash->{$node}->[0]->{primarynic} . " ";
#} else {
# if ( ($usemac || $useifname) && $mac) {
# $kcmdline .= "BOOTIF=" . $mac . " ";
# }
#}
my %client_nethash = xCAT::DBobjUtils->getNetwkInfo( [$node] );
if ( $client_nethash{$node}{mgtifname} =~ /hf/ )
@@ -1377,12 +1398,19 @@ 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 =
"quiet repo=$httpmethod://$instserver:$httpport$httpprefix ks=$httpmethod://"
. $instserver . ":". $httpport
@@ -1437,6 +1465,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}))
@@ -1601,6 +1671,7 @@ sub mksysclone
copy("$installroot/postscripts/$script1","$pspath/15all.$script1");
copy("$installroot/postscripts/$script2","$pspath/16all.$script2");
copy("$installroot/postscripts/runxcatpost","$pspath/17all.runxcatpost");
copy("$installroot/postscripts/makeinitrd","$pspath/20all.makeinitrd");
unless (-r "$pspath/10all.fix_swap_uuids")
{
@@ -1920,20 +1991,51 @@ sub mksysclone
}
my $cmd =qq{echo "$node:compute:$imagename:" >> $clusterfile};
my $out = xCAT::Utils->runcmd($cmd, -1);
my $rc = xCAT::Utils->runcmd($cmd, -1);
my $imagedir;
my $osimagetab = xCAT::Table->new('linuximage');
my $osimageentry = $osimagetab->getAttribs({imagename => $imagename}, 'rootimgdir');
if($osimageentry){
$imagedir = $osimageentry->{rootimgdir};
$imagedir =~ s/^(\/.*)\/.+\/?$/$1/;
}else{
$imagedir = "$installroot/sysclone/images";
$cmd = "chdef -t osimage $imagename rootimgdir=$imagedir/$imagename";
$rc = `$cmd`;
}
my $cfgimagedir = `cat /etc/systemimager/rsync_stubs/40$imagename|grep path`;
chomp($cfgimagedir);
$cfgimagedir =~ s/^\s+path=(\/.*)\/.+$/$1/g;
if($imagedir ne $cfgimagedir){
my $oldstr = `cat /etc/systemimager/rsync_stubs/40$imagename|grep path`;
chomp($oldstr);
$oldstr =~ s/\//\\\\\//g;
unless (-r "$installroot/sysclone/images/$imagename/opt/xcat/xcatdsklspost")
my $targetstr="\tpath=".$imagedir."/".$imagename;
$targetstr =~ s/\//\\\\\//g;
$cmd= "sed -i \"s/$oldstr/$targetstr/\" /etc/systemimager/rsync_stubs/40$imagename";
$rc = `$cmd`;
}
$rc = `export PERL5LIB=/usr/lib/perl5/site_perl/;LANG=C si_mkrsyncd_conf`;
unless (-r "$imagedir/$imagename/opt/xcat/xcatdsklspost")
{
mkpath("$installroot/sysclone/images/$imagename/opt/xcat/");
copy("$installroot/postscripts/xcatdsklspost","$installroot/sysclone/images/$imagename/opt/xcat/");
mkpath("$imagedir/$imagename/opt/xcat/");
copy("$installroot/postscripts/xcatdsklspost","$imagedir/$imagename/opt/xcat/");
}
}
# check systemimager-server-rsyncd to make sure it's running.
my $out = xCAT::Utils->runcmd("service systemimager-server-rsyncd status", -1);
if ($::RUNCMD_RC != 0) { # not running
my $rc = xCAT::Utils->startService("systemimager-server-rsyncd");
#my $out = xCAT::Utils->runcmd("service systemimager-server-rsyncd status", -1);
# if ($::RUNCMD_RC != 0) { # not running
my $retcode=xCAT::Utils->checkservicestatus("systemimager-server-rsyncd");
if($retcode!=0){
my $rc = xCAT::Utils->startservice("systemimager-server-rsyncd");
if ($rc != 0) {
return 1;
}
@@ -7,6 +7,7 @@ use xCAT::Utils;
use xCAT::TableUtils;
use Getopt::Long;
use Sys::Hostname;
use xCAT::SvrUtils;
use strict;
use Data::Dumper;
+252 -227
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;
@@ -228,6 +228,9 @@ sub process_request {
return;
}
}
if ($::XCATSITEVALS{externaldns}) {
$external=1;
}
if ($help)
{
@@ -282,7 +285,6 @@ sub process_request {
xCAT::SvrUtils::sendmsg([0,"Warning:SELINUX is not disabled. The makedns command will not be able to generate a complete DNS setup. Disable SELINUX and run the command again."], $callback);
}
my @entries = xCAT::TableUtils->get_site_attribute("nameservers");
my $sitens = $entries[0];
unless ( defined($site_entry)) {
@@ -295,7 +297,6 @@ sub process_request {
unless ($networkstab) { xCAT::SvrUtils::sendmsg([1,'Unable to enumerate networks, try to run makenetworks'], $callback); }
my @networks = $networkstab->getAllAttribs('net','mask','ddnsdomain','domain','nameservers');
# exclude the net if it is using an external dns server.
foreach my $net (@networks)
{
@@ -324,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) {
@@ -406,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/) {
@@ -418,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)
{
@@ -507,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) {
@@ -527,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];
@@ -540,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,
@@ -555,50 +556,117 @@ 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;
}
if ($zapfiles || $slave) { #here, we unlink all the existing files to start fresh
if (xCAT::Utils->isAIX())
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())
{
system("/usr/bin/stopsrc -s $service");
}
else
{
#system("service $service stop"); #named may otherwise hold on to stale journal filehandles
xCAT::Utils->stopservice("named");
}
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)
{
system("/usr/bin/stopsrc -s $service");
update_zones($ctx);
}
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);
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 stop";
#my @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;
#}
#$cmd = "service $service start";
#@output=xCAT::Utils->runcmd($cmd, 0);
#$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;
#}
my $retcode=xCAT::Utils->restartservice("named");
if($retcode!=0){
my $rsp = {};
$rsp->{data}->[0] = "failed to start named.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
return;
}
}
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;
}
if (xCAT::Utils->isAIX())
# check if named is active before update dns records.
unless ($external) { # only start xCAT local dns when NOT using external dns
if (xCAT::Utils->isAIX())
{
my $cmd = "/usr/bin/lssrc -s $service |grep active";
my @output=xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{
#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);
@@ -610,91 +678,45 @@ sub process_request {
return;
}
}
else
}
else
{
#my $cmd = "service $service status|grep running";
#my @output=xCAT::Utils->runcmd($cmd, 0);
#if ($::RUNCMD_RC != 0)
#{
# $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;
# }
#}
my $retcode=xCAT::Utils->startservice("named");
if($retcode!=0)
{
my $cmd = "service $service stop";
my @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";
$rsp->{data}->[0] = "failed to start named.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
return;
}
$cmd = "service $service start";
@output=xCAT::Utils->runcmd($cmd, 0);
$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;
}
}
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)
{
$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)
{
$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;
}
}
}
#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']);
}
@@ -712,9 +734,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";
}
@@ -723,16 +745,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";
}
@@ -742,9 +764,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"
@@ -785,13 +807,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);
@@ -825,7 +847,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;
@@ -849,7 +871,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{
@@ -885,7 +907,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;
@@ -1001,11 +1023,12 @@ 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, "\tallow-recursion { any; };\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}}) {
@@ -1033,6 +1056,7 @@ sub update_namedconf {
}
push @newnamed,"};\n\n";
}
unless ($slave) {
unless ($gotkey) {
unless ($ctx->{privkey}) { #need to generate one
@@ -1123,7 +1147,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{
@@ -1151,9 +1175,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;
@@ -1163,8 +1187,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
@@ -1172,9 +1196,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;
@@ -1209,11 +1233,12 @@ 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 in /etc/hosts or DNS."], $callback);
xCAT::SvrUtils::sendmsg([1,"Please make sure $ctx->{nsmap}->{$zone} exist either in /etc/hosts or DNS."], $callback);
return 1;
}
my $resolver = Net::DNS::Resolver->new(nameservers=>[$ip]);
my $entry;
my $numreqs = 300; # limit to 300 updates in a payload, something broke at 644 on a certain sample, choosing 300 for now
@@ -1290,9 +1315,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";
@@ -1305,7 +1330,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');
@@ -1386,9 +1411,9 @@ sub get_dns_slave
foreach my $sn (@ents)
{
if ($sn->{'nameserver'} == 2)
{
{
push @sns, $sn->{'node'};
}
}
}
@slaves = xCAT::NodeRange::noderange(join(',',@sns));
+22 -3
View File
@@ -326,7 +326,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;
}
@@ -501,7 +503,8 @@ sub setdestiny {
}
}
}
if ($provmethod ne 'install') {
#don't clean up provmethod if osimage.provmethod is install or sysclone
if ($provmethod ne 'install' && $provmethod ne 'sysclone') {
push(@nodestoblank, $_);
}
}
@@ -569,6 +572,7 @@ sub nextdestiny {
}
my $node;
my $noupdate_flag = 0;
$chaintab = xCAT::Table->new('chain');
my $chainents = $chaintab->getNodesAttribs(\@nodes,[qw(currstate currchain chain)]);
foreach $node (@nodes) {
@@ -596,13 +600,28 @@ sub nextdestiny {
my %requ;
$requ{node}=[$node];
$requ{arg}=[$ref->{currstate}];
if($ref->{currstate} =~ /noupdateinitrd$/)
{
my @items = split /[:]/,$ref->{currstate};
$requ{arg}= \@items;
$noupdate_flag = 1;
}
setdestiny(\%requ, $flag+1);
}
if ($callnodeset) {
my $args;
if($noupdate_flag)
{
$args = ['enact', '--noupdateinitrd'];
}
else
{
$args = ['enact'];
}
$subreq->({command=>['nodeset'],
node=> \@nodes,
arg=>['enact']});
arg=>$args});
}
}
+37 -24
View File
@@ -881,13 +881,22 @@ 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
#my $DHCPSERVER="dhcpd";
#if( -e "/etc/init.d/isc-dhcp-server" ){
# $DHCPSERVER="isc-dhcp-server";
#}
#my @output = xCAT::Utils->runcmd("service $DHCPSERVER status", -1);
#if ($::RUNCMD_RC != 0) { # not running
my $ret=0;
$ret=xCAT::Utils->checkservicestatus("dhcp");
if($ret!=0)
{
my $rsp = {};
$rsp->{data}->[0] = "dhcpd is not running. Run service dhcpd start and rerun your command.";
$rsp->{data}->[0] = "dhcp server is not running. please start the dhcp server.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return 1;
}
@@ -1835,25 +1844,29 @@ sub process_request
{
restart_dhcpd_aix();
}
elsif ( $distro =~ /ubuntu.*/ || $distro =~ /debian.*/i)
{
if (-e '/etc/dhcp/dhcpd.conf') {
system("chmod a+r /etc/dhcp/dhcpd.conf");
system("/etc/init.d/isc-dhcp-server restart");
}
else {
#ubuntu config
system("chmod a+r /etc/dhcp3/dhcpd.conf");
system("/etc/init.d/dhcp3-server restart");
}
}
else
{
system("/etc/init.d/dhcpd restart");
# should not chkconfig dhcpd on every makedhcp invoation
# it is not appropriate and will cause problem for HAMN
# do it in xcatconfig instead
#system("chkconfig dhcpd on");
else {
if ( $distro =~ /ubuntu.*/ || $distro =~ /debian.*/i)
{
if (-e '/etc/dhcp/dhcpd.conf') {
system("chmod a+r /etc/dhcp/dhcpd.conf");
#system("/etc/init.d/isc-dhcp-server restart");
}
else {
#ubuntu config
system("chmod a+r /etc/dhcp3/dhcpd.conf");
#system("/etc/init.d/dhcp3-server restart");
}
}
#else
#{
# system("/etc/init.d/dhcpd restart");
# # should not chkconfig dhcpd on every makedhcp invoation
# # it is not appropriate and will cause problem for HAMN
# # do it in xcatconfig instead
# #system("chkconfig dhcpd on");
#}
xCAT::Utils->restartservice("dhcp");
print "xx";
}
}
flock($dhcplockfd,LOCK_UN);
+62 -3
View File
@@ -130,7 +130,7 @@ sub process_request {
my $shortname = xCAT::InstUtils->myxCATname();
my $rc;
$rc = sysclone_configserver($shortname, $callback, $doreq);
$rc = sysclone_configserver($shortname, $osimg, $callback, $doreq);
if($rc){
my $rsp = {};
$rsp->{data}->[0] = qq{Can not configure Imager Server on $shortname.};
@@ -467,7 +467,7 @@ sub getplatform {
}
sub sysclone_configserver{
my ($server, $callback, $subreq) = @_;
my ($server, $osimage, $callback, $subreq) = @_;
# check if systemimager is installed on the imager server
my $rsp = {};
@@ -514,9 +514,40 @@ sub sysclone_configserver{
{
mkpath($sysclone_overrides);
}
my $imagedir;
my $osimgtab = xCAT::Table->new('osimage');
my $entry = ($osimgtab->getAllAttribsWhere("imagename = '$osimage'", 'ALL' ))[0];
if(!$entry){
$imagedir = $sysclone_home . "/images/" . $osimage;
}else{
my $osimagetab = xCAT::Table->new('linuximage');
my $osimageentry = $osimagetab->getAttribs({imagename => $osimage}, 'rootimgdir');
if($osimageentry){
$imagedir = $osimageentry->{rootimgdir};
if (!(-e $imagedir)){
mkpath($imagedir);
}
}else{
$imagedir = $sysclone_home . "/images/" . $osimage;
$cmd = "chdef -t osimage $osimage rootimgdir=$imagedir";
$rc = `$cmd`;
}
}
$imagedir =~ s/^(\/.*)\/.+\/?$/$1/;
$imagedir =~ s/\//\\\\\//g;
$imagedir = "DEFAULT_IMAGE_DIR = ".$imagedir;
my $olddir = `more /etc/systemimager/systemimager.conf |grep DEFAULT_IMAGE_DIR`;
$olddir =~ s/\//\\\\\//g;
chomp($olddir);
$cmd= "sed -i \"s/$olddir/$imagedir/\" /etc/systemimager/systemimager.conf";
$rc = `$cmd`;
# update /etc/systemimager/rsync_stubs/10header to generate new /etc/systemimager/rsyncd.conf
my $rc = `sed -i "s/\\/var\\/lib\\/systemimager/\\/install\\/sysclone/g" /etc/systemimager/rsync_stubs/10header`;
$rc = `sed -i "s/\\/var\\/lib\\/systemimager/\\/install\\/sysclone/g" /etc/systemimager/rsync_stubs/10header`;
$rc = `export PERL5LIB=/usr/lib/perl5/site_perl/;LANG=C si_mkrsyncd_conf`;
return 0;
@@ -678,6 +709,22 @@ sub sysclone_createosimgdef{
$osimgdef{$osimage}{template} = "";
$osimgdef{$osimage}{otherpkglist} = "";
$osimgdef{$osimage}{pkglist} = "";
if(!($imagedef{$oldimg}{rootimgdir})){
$imagedef{$oldimg}{rootimgdir} = $sysclone_home . "/images/" . $osimage;
my $imagedir = $imagedef{$oldimg}{rootimgdir};
$imagedir =~ s/^(\/.*)\/.+\/?$/$1/;
$imagedir =~ s/\//\\\\\//g;
$imagedir = "DEFAULT_IMAGE_DIR = ".$imagedir;
my $olddir = `more /etc/systemimager/systemimager.conf |grep DEFAULT_IMAGE_DIR`;
$olddir =~ s/\//\\\\\//g;
chomp($olddir);
my $cmd= "sed -i \"s/$olddir/$imagedir/\" /etc/systemimager/systemimager.conf";
my $rc = `$cmd`;
}
}
} else {
$createnew = 1;
@@ -701,6 +748,18 @@ sub sysclone_createosimgdef{
$osimgdef{$osimage}{osname} = "Linux";
$osimgdef{$osimage}{osvers} = $osver;
$osimgdef{$osimage}{osdistroname} = "$osver-$arch";
$osimgdef{$osimage}{rootimgdir} = $sysclone_home . "/images/" . $osimage;
my $imagedir = $osimgdef{$osimage}{rootimgdir};
$imagedir =~ s/^(\/.*)\/.+\/?$/$1/;
$imagedir =~ s/\//\\\\\//g;
$imagedir = "DEFAULT_IMAGE_DIR = ".$imagedir;
my $olddir = `more /etc/systemimager/systemimager.conf |grep DEFAULT_IMAGE_DIR`;
$olddir =~ s/\//\\\\\//g;
chomp($olddir);
my $cmd= "sed -i \"s/$olddir/$imagedir/\" /etc/systemimager/systemimager.conf";
my $rc = `$cmd`;
#$osimgdef{$osimage}{pkgdir} = "/install/$osver/$arch";
#$osimgdef{$osimage}{otherpkgdir} = "/install/post/otherpkgs/$osver/$arch";
}
+2 -2
View File
@@ -1412,7 +1412,7 @@ sub create_symlink {
}
}
} else {
$callback->({error => ["osimage table or kitcomponent do not exist"],errorcode=>[1]});
$callback->({warning => ["osimage table or kitcomponent do not exist"],errorcode=>[1]});
return 1;
}
}
@@ -1802,7 +1802,7 @@ sub make_files {
}
if ( $hasplugin ) {
# Issue xcatd reload to load the new plugins
system("/etc/init.d/xcatd reload");
system("/etc/init.d/xcatd restart");
$hasplugin=0;
}
+29 -7
View File
@@ -1146,6 +1146,12 @@ sub getrvidparms_imm2 {
$response = $browser->request(GET $baseurl."designs/imm/viewer(".$sessdata->{ipmisession}->{bmc}.'@'.$httpport.'@'.$ip6mode.'@'.time().'@1@0@1@jnlp'.'@USERID@0@0@0@0'.')');
#arguments are host, then ipv6 or not, then timestamp, then whether to encrypte or not, singleusermode, finally 'notwin32'
$jnlp = $response->content;
if ($jnlp =~ /Failed to parse ip format for request/) {
$response = $browser->request(GET $baseurl."designs/imm/viewer(".$sessdata->{ipmisession}->{bmc}.'@'.$httpport.'@'.$ip6mode.'@'.time().'@1@0@1@jnlp'.'@USERID@0@0@0@0@0'.')');
#arguments are host, then ipv6 or not, then timestamp, then whether to encrypte or not, singleusermode, 'notwin32', and one more (unknown)
$jnlp = $response->content;
}
}
$response = $browser->request(GET $baseurl."data/logout");
my $currnode = $sessdata->{node};
@@ -1332,7 +1338,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%"});
@@ -1541,6 +1547,7 @@ sub power_with_context {
return;
} elsif ($subcommand eq "wake") {
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0x1d,data=>[0,0],callback=>\&power_response,callback_args=>$sessdata);
return;
} elsif (not $argmap{$subcommand}) {
xCAT::SvrUtils::sendmsg([1,"unsupported command power $subcommand"],$callback);
return;
@@ -1956,11 +1963,20 @@ sub got_bios_buildid {
my $sessdata = $res{sessdata};
if ($res{data}) {
$sessdata->{biosbuildid} = $res{data};
get_imm_property(property=>"/v2/bios/build_version",callback=>\&got_bios_version,sessdata=>$sessdata);
get_imm_property(property=>"/v2/bios/pending_build_version",callback=>\&got_bios_pending_buildid,sessdata=>$sessdata);
} else {
initfru_with_mprom($sessdata);
}
}
sub got_bios_pending_buildid {
my %res = @_;
my $sessdata = $res{sessdata};
$sessdata->{biosbuildpending} = 0;
if ($res{data} and $res{data} ne ' ') {
$sessdata->{biosbuildpending} = 1;
}
get_imm_property(property=>"/v2/bios/build_version",callback=>\&got_bios_version,sessdata=>$sessdata);
}
sub got_bios_version {
my %res = @_;
my $sessdata = $res{sessdata};
@@ -1979,7 +1995,12 @@ sub got_bios_date {
my $fru = FRU->new();
$fru->rec_type("bios,uefi,firmware");
$fru->desc("UEFI Version");
$fru->value($sessdata->{biosbuildversion}." (".$sessdata->{biosbuildid}." ".$sessdata->{biosbuilddate}.")");
my $pending = "";
if ($sessdata->{biosbuildpending}) {
$pending = " [PENDING]";
}
my $value = $sessdata->{biosbuildversion}." (".$sessdata->{biosbuildid}." ".$sessdata->{biosbuilddate}.")$pending";
$fru->value($value);
$sessdata->{fru_hash}->{uefi} = $fru;
get_imm_property(property=>"/v2/fpga/build_id",callback=>\&got_fpga_buildid,sessdata=>$sessdata);
} else {
@@ -2204,7 +2225,7 @@ sub initfru_zero {
$fru = FRU->new();
$fru->rec_type("misc");
$fru->desc("System Manufacturer");
if ($fruhash->{product}->{product}->{encoding}==3) {
if ($fruhash->{product}->{manufacturer}->{encoding}==3) {
$fru->value($fruhash->{product}->{manufacturer}->{value});
} else {
$fru->value(phex($fruhash->{product}->{manufacturer}->{value}));
@@ -2767,7 +2788,7 @@ sub readcurrfrudevice {
shift @data;
push @{$sessdata->{currfrudata}},@data;
if ($sessdata->{currfrudone}) {
if ($sessdata->{isite}) {
if ($sessdata->{isite} and $sessdata->{currfrusdr} and ($sessdata->{currfrusdr}->fru_oem & 0x80)) {
#IBM OEM command, d0,51,0 further qualifies the command name, we'll first take a stop at block 0, offset 2, one byte, to get VPD version number
#command structured as:
#d0,51,0 = command set identifier
@@ -2971,12 +2992,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;
}
}
}
+58 -18
View File
@@ -1411,7 +1411,7 @@ sub addkit
if ( $hasplugin ) {
# Issue xcatd reload to load the new plugins
system("/etc/init.d/xcatd reload");
system("/etc/init.d/xcatd restart");
}
}
}
@@ -1494,6 +1494,7 @@ sub rmkit
my %kitnames;
my $des = shift @ARGV;
my @kits = split ',', $des;
my $DBname = xCAT::Utils->get_DBName; # support for DB2
foreach my $kit (@kits) {
# Check if it is a kitname or basename
@@ -1508,7 +1509,12 @@ sub rmkit
}
$kitnames{$kit} = 1;
} else {
my @entries = $tabs{kit}->getAllAttribsWhere( "basename = '$kit'", 'kitname', 'isinternal');
my @entries;
if ($DBname =~ /^DB2/) {
@entries = $tabs{kit}->getAllAttribsWhere( "\"basename\" = '$kit'", 'kitname', 'isinternal');
} else {
@entries = $tabs{kit}->getAllAttribsWhere( "basename = '$kit'", 'kitname', 'isinternal');
}
unless (@entries) {
my %rsp;
push@{ $rsp{data} }, "Kit $kit could not be found in DB $t";
@@ -1545,8 +1551,12 @@ sub rmkit
# Find all the components in this kit.
my $kitcompnames;
my @kitcomphash = $tabs{kitcomponent}->getAllAttribsWhere( "kitname = '$kitname'", 'kitcompname', 'postbootscripts', 'genimage_postinstall');
my @kitcomphash;
if ($DBname =~ /^DB2/) {
@kitcomphash = $tabs{kitcomponent}->getAllAttribsWhere( "\"kitname\" = '$kitname'", 'kitcompname', 'postbootscripts', 'genimage_postinstall');
} else {
@kitcomphash = $tabs{kitcomponent}->getAllAttribsWhere( "kitname = '$kitname'", 'kitcompname', 'postbootscripts', 'genimage_postinstall');
}
if (@entries && (@entries > 0)) {
if($::VERBOSE and !$test){
@@ -1682,7 +1692,12 @@ sub rmkit
}
# Remove kitrepo
my @kitrepohash = $tabs{kitrepo}->getAllAttribsWhere( "kitname = '$kitname'", 'kitreponame');
my @kitrepohash;
if ($DBname =~ /^DB2/) {
@kitrepohash = $tabs{kitrepo}->getAllAttribsWhere( "\"kitname\" = '$kitname'", 'kitreponame');
} else {
@kitrepohash = $tabs{kitrepo}->getAllAttribsWhere( "kitname = '$kitname'", 'kitreponame');
}
foreach my $kitrepo ( @kitrepohash ) {
my $kitreponame = $kitrepo->{kitreponame};
$tabs{kitrepo}->delEntries({kitreponame => $kitreponame});
@@ -1716,7 +1731,7 @@ sub rmkit
if ( $hasplugin ) {
# Issue xcatd reload to load the new plugins
system("/etc/init.d/xcatd reload");
system("/etc/init.d/xcatd restart");
}
}
@@ -1878,7 +1893,7 @@ sub addkitcomp
return 1;
}
my $DBname = xCAT::Utils->get_DBName; # support for DB2
my %tabs = ();
my @tables = qw(kit kitrepo kitcomponent osimage osdistro linuximage);
foreach my $t ( @tables ) {
@@ -1911,7 +1926,12 @@ sub addkitcomp
$kitcomps{$kitcomponent}{name} = $kitcomponent;
$kitcomps{$kitcomponent}{basename} = $kitcomptable->{'basename'};
} else {
my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
my @entries;
if ($DBname =~ /^DB2/) {
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcomponent'", 'kitcompname' , 'version', 'release');
} else {
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
}
unless (@entries) {
my %rsp;
push@{ $rsp{data} }, "$kitcomponent kitcomponent does not exist";
@@ -2101,7 +2121,12 @@ sub addkitcomp
my @kitcompdeps = split ',', $kitcomptable->{'kitcompdeps'};
foreach my $kitcompdependency ( @kitcompdeps ) {
my ($kitcompdep, $vers) = split /<=|>=|=|<|>/, $kitcompdependency;
my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcompdep'", 'kitreponame', 'kitname', 'kitcompname' , 'serverroles', 'kitcompdeps', 'version', 'prerequisite', 'release');
my @entries;
if ($DBname =~ /^DB2/) {
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcompdep'", 'kitreponame', 'kitname', 'kitcompname' , 'serverroles', 'kitcompdeps', 'version', 'prerequisite', 'release');
} else {
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcompdep'", 'kitreponame', 'kitname', 'kitcompname' , 'serverroles', 'kitcompdeps', 'version', 'prerequisite', 'release');
}
unless (@entries) {
my %rsp;
push@{ $rsp{data} }, "Cannot find any matched kit component for kit component $kitcomp dependency $kitcompdep";
@@ -2413,7 +2438,7 @@ sub rmkitcomp
return 1;
}
my $DBname = xCAT::Utils->get_DBName; # support for DB2
my %tabs = ();
my @tables = qw(kit kitrepo kitcomponent osimage osdistro linuximage);
foreach my $t ( @tables ) {
@@ -2456,7 +2481,12 @@ sub rmkitcomp
$kitcomps{$kitcomponent}{driverpacks} = $kitcomptable->{driverpacks};
$kitcomps{$kitcomponent}{genimage_postinstall} = $kitcomptable->{genimage_postinstall};
} else {
my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
my @entries;
if ($DBname =~ /^DB2/) {
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcomponent'", 'kitcompname' , 'version', 'release');
} else {
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
}
unless (@entries) {
my %rsp;
push@{ $rsp{data} }, "$kitcomponent kitcomponent does not exist";
@@ -2530,7 +2560,12 @@ sub rmkitcomp
my ($kitcompdep, $vers) = split /<=|>=|=|<|>/, $kitcompdependency;
# Get the kit component full name from basename.
my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcompdep'", 'kitcompname' , 'version', 'release');
my @entries;
if ($DBname =~ /^DB2/) {
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcompdep'", 'kitcompname' , 'version', 'release');
} else {
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcompdep'", 'kitcompname' , 'version', 'release');
}
unless (@entries) {
my %rsp;
push@{ $rsp{data} }, "kitcomponent $kitcompdep basename does not exist";
@@ -3214,7 +3249,7 @@ sub chkkitcomp
create_version_response('chkkitcomp');
return 1; # no usage - just exit
}
my $DBname = xCAT::Utils->get_DBName; # support for DB2
my %tabs = ();
my @tables = qw(kit kitrepo kitcomponent osimage osdistro linuximage);
foreach my $t ( @tables ) {
@@ -3248,7 +3283,12 @@ sub chkkitcomp
$kitcomps{$kitcomponent}{serverroles} = $kitcomptable->{serverroles};
$kitcompbasename{$kitcomptable->{basename}} = 1;
} else {
my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
my @entries;
if ($DBname =~ /^DB2/) {
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcomponent'", 'kitcompname' , 'version', 'release');
} else {
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
}
unless (@entries) {
my %rsp;
push@{ $rsp{data} }, "$kitcomponent kitcomponent does not exist";
@@ -3563,8 +3603,7 @@ sub create_error_response {
#-----------------------------------------------------------------------------
sub lskit_processargs {
if ( defined( @{$::args} ) ) {
if ( defined ($::args) && @{$::args} ){
@ARGV = @{$::args};
}
@@ -3665,7 +3704,7 @@ sub lskit_processargs {
#-----------------------------------------------------------------------------
sub lskitcomp_processargs {
if ( defined( @{$::args} ) ) {
if ( defined ($::args) && @{$::args} ){
@ARGV = @{$::args};
}
@@ -3758,7 +3797,7 @@ sub lskitcomp_processargs {
#-----------------------------------------------------------------------------
sub lskitdeployparam_processargs {
if ( defined( @{$::args} ) ) {
if ( defined ($::args) && @{$::args} ){
@ARGV = @{$::args};
}
@@ -4661,6 +4700,7 @@ sub db_get_table_rows {
my $table = xCAT::Table->new($tablename);
my @table_rows = ();
# todo fix for DB2 support
if (defined($filter_stmt)) {
if (length($filter_stmt) > 0) {
@table_rows = $table->getAllAttribsWhere($filter_stmt, @{$attrs});

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