Compare commits

..

652 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
arif b8e22ef5b2 fix ipv6 0.0.0.0 to ::, the equivalent ip 2014-04-04 01:19:09 +01: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
arif 795295e1a3 add ifname to arguments for checkConfig_Sles 2014-04-02 09:59:22 +01:00
arif d730e82055 update routeop with device based routing 2014-04-02 09:43:15 +01:00
arif 71ad311a68 update route.pm, and start work on routeop 2014-04-01 22:20:37 +01: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
arif e34da389fb defect 4033: fix device based routing in makeroutes 2014-04-01 16:16:14 +01: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
lissav 45b11936cd fix spelling 2014-03-27 13:33:30 -04:00
mellor 165abd4f88 defect 3998 - change file vars to globals 2014-03-26 17:08:17 -04:00
lissav 8e110d51f1 defect 3953 2014-03-26 13:07:48 -04:00
ligc 045c42fce6 doxcat: the ntp -c rv 0 offset may return negative number 2014-03-26 16:00:12 -05:00
ligc 1407ef0288 gensis-scripts: doxcat - ntpq -c rv state does not work any more, use the ntpq -c rv offset instead 2014-03-26 14:26:35 -05:00
mellor 3aeb21025d defect 3964 - clarify mknb man page for hierarchy with sharedtftp=0 2014-03-25 15:57:21 -04:00
lissav 4c48026801 defect 3941 2014-03-25 08:09:50 -04:00
ligc e1fb6aae06 add the centos6.5 discid info, fix a problem in post.xcat 2014-03-25 17:14:50 -05:00
immarvin 49824ba195 add grub2-xcat as a dependency to enable provisioning rhel7 on an ubuntu MN 2014-03-25 01:59:18 -07:00
ligc b067d90a60 fix xCAT-genesis-builder/buildrpm for latest mcp version 2014-03-25 14:56:10 -05:00
lissav c747908e0f remove autosetup of useflowcontorl see 4031 2014-03-24 09:26:12 -04:00
huweihua c6ee255d70 fix defect 3875 2014-03-24 04:56:24 -04:00
lissav e52453be0f update man 2014-03-21 14:51:14 -04:00
lissav 5afd870cef tabprune -a supports all tables 2014-03-21 14:45:30 -04:00
Jarrod Johnson fe38638b4b Support 'specific' copycds mode.
ESXi releases updates without bumping version numbers.  For such cases,
the default behavior is for the new version to supersede the old.  This
makes sense for the vast majority of cases.  There are, however, corner
cases where being explicit about the release is indicated.
2014-03-21 10:56:20 -04:00
lissav d33000aef6 fix -L option 2014-03-21 09:56:47 -04:00
lissav 93ff514a2a add pointer to Easy Regx documentation 2014-03-21 08:02:10 -04:00
immarvin c6cb1c9977 append some code logic and documentation for rhels7 support on grub2 2014-03-21 04:40:25 -07:00
huweihua 1af1135646 add testcase for prsync 2014-03-21 02:12:45 -04:00
huweihua 8165f1acd0 add testcase for pscp 2014-03-21 02:12:33 -04:00
huweihua 25ca816477 add testcase for sysclone 2014-03-21 02:12:23 -04:00
huweihua ffa9f73d13 add testcase for xdcp 2014-03-21 02:12:10 -04:00
huweihua fe5b75eabf add testcase for xdsh 2014-03-21 02:11:52 -04:00
huweihua b685bfc8a7 add testcase for makeroutes 2014-03-21 02:01:03 -04:00
huweihua 781595f000 add testcase for ppping 2014-03-21 02:00:43 -04:00
huweihua 3d15b983a3 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-03-21 01:41:23 -04:00
huweihua 6a8371b7d4 add testcase for makedns 2014-03-21 01:41:03 -04:00
arif 2013e18c73 fix bug #4027, replace chop with chomp 2014-03-20 23:11:28 +00:00
lissav 72c76ab32b fix defect 3981 2014-03-20 14:13:27 -04:00
linggao 45af650bb9 more code for supporting other hardware in OpenStack baremetal driver. 2014-03-21 07:00:25 -04:00
Jia Zhao 7a980c9cea fix autodiscovery problem as not run makehosts command 2014-03-20 18:43:14 +08:00
immarvin 36690a8671 fix defect #4030 [DEV]'makedhcp -n' failed to add subnet info to dhcpd.conf on rhels7.0 x86_64 mn 2014-03-19 08:14:00 -07:00
immarvin 8984f6243b add rhels7 stateless and statelite support for x86_64 2014-03-19 07:59:02 -07:00
lissav dd64ec3740 fix defect 4028 2014-03-19 07:22:22 -04:00
mellor ddf56b2788 clarify that genimage -i is optional 2014-03-18 14:51:33 -04:00
ligc 554aea03cd xCAT-SoftLayer package is noarch only on Linux, not on AIX 2014-03-18 16:19:06 -05:00
ligc 6c355dbeb6 xCAT-SoftLayer.spec: cp -a does not work on AIX, change to use -p -R instead 2014-03-18 14:18:34 -05:00
ligc 1bb9999176 makerpm: add copying xcat.conf.apach24 into /SOURCES 2014-03-18 13:55:36 -05:00
ligc bdcc8ab613 update with xCAT-OpenStack-baremetal packaging: 1) update xpod2man to not create summary page 2) remove xcat.1.pod from xCAT-OpenStack-baremetal 2014-03-17 23:33:20 -04:00
linggao a6c7b582ef fix defect #4023 syntax error 2014-03-18 09:18:43 -04:00
Bruce Potter 67eecc44d4 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8
add xCAT-SoftLayer files to 2.8 branch
2014-03-17 06:53:15 -04:00
Bruce Potter f085548559 adding xCAT-SoftLayer files to 2.8 branch 2014-03-17 06:52:35 -04:00
lissav 4779749c1e defect 4022 and add podchecker, good debug tool 2014-03-17 06:44:28 -04:00
ligc 67b998eaf9 fix for bug 3935: support nic name with space, like Local Area Network on windows 2014-03-14 17:51:29 -05:00
ligc a9e5fa3bad fix for bug 3937: return 1 when lsdef <object> can not find the object 2014-03-14 17:01:05 -05:00
ligc 2ad92ce054 fix for bug 3976: check -i flag 2014-03-14 16:16:27 -05:00
lissav 46132889d8 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-03-13 10:37:58 -04:00
immarvin e41210c8d8 add xCAT-OpenStack-baremetal to build-ubunturepo package list, change debian/source/format to 1.0 2014-03-13 07:44:15 -07:00
lissav 4b87e5d765 additional checks 2014-03-13 10:37:14 -04:00
immarvin 5c6a57dee7 add ubuntu/debian package files for dpkg-buildpackage 2014-03-13 07:15:19 -07:00
lissav a663b2d88a change sync of keys so they are cleaned up when zones are removed 2014-03-13 09:49:23 -04:00
lissav 18d519bdcf chzone manpage 2014-03-13 08:44:07 -04:00
lissav 7be4bec3e6 add and improve zone manpages 2014-03-13 07:52:31 -04:00
lissav fe7b4c79bf add and improve zone manpages 2014-03-13 07:50:59 -04:00
lissav 68e5147e80 add man page for mkzone 2014-03-12 12:29:43 -04:00
lissav aaa740b4a9 fix parsing 2014-03-12 11:33:04 -04:00
lissav 906f61e9e5 rm id_rsa so we can switch between sshbetweennode yes and no 2014-03-12 10:46:11 -04:00
linggao 8ec9319c63 xCAT baremetal driver for OpenStack supprt nodes with all hw types that are supported by xCAT 2014-03-13 03:14:03 -04:00
linggao c4c741bf41 fix the description for table hwinv. 2014-03-13 03:05:55 -04:00
lissav 73868bdc66 chzone code 2014-03-11 14:19:11 -04:00
zhaoertao ea3eebe585 fix bug 4014: updatenodegroups routine always add all group to the node 2014-03-10 19:04:31 -07:00
lissav b1948ed1e9 a lot of chzone, needs more work 2014-03-10 14:43:00 -04:00
immarvin ef05a92cb2 rhels7 statelite/stateless support 2014-03-08 06:46:54 -08:00
immarvin 68b53380a3 fix defect #4015 2014-03-07 07:32:03 -08:00
lissav 894a1c680d rmzone 2014-03-07 09:55:07 -05:00
lissav 6c15e1409f Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-03-07 09:53:36 -05:00
lissav 734eccddeb rmzone support 2014-03-07 09:53:00 -05:00
immarvin 4be6530914 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-03-07 06:42:25 -08:00
immarvin af52462972 fix defect #3999 2014-03-07 06:01:30 -08:00
immarvin c2d2452719 fix defect #3999 and #4013 2014-03-07 05:54:56 -08:00
ligc 69a80e72ee fix for bug 4010: remove xcatws.cgi from PCM build 2014-03-06 15:47:15 -06:00
zhaoertao 36b8c67f80 fix bug 4007: DFM support Powerlinux, mkvm return error 2014-03-05 00:50:53 -08:00
lissav 62e366907e better hierarchical processing for zones 2014-03-04 10:22:21 -05:00
lissav 546307bc40 docuement DSH_REMOTE_PASSWORD env variable 2014-03-04 08:31:20 -05:00
lissav 4faf715d40 add OpenStack-baremetal rpm 2014-03-03 15:11:48 -05:00
lissav 6d500da7d7 fix spelling 2014-03-03 15:06:38 -05:00
lissav 89a526de4f add OpenStack-baremetal rpm 2014-03-03 15:01:37 -05:00
lissav 7b9c893055 support getting zone ssh keys 2014-03-03 13:29:02 -05:00
lissav d3cd61745d support zone root ssh keys 2014-03-03 13:18:19 -05:00
lissav 91ff649bea more zone functions 2014-03-03 13:15:06 -05:00
daniceexi 0be18a3c4a Code drop to support new netboot method - grub2 2014-02-28 07:52:13 -05:00
ligc a4f87fbb69 fix for bug 4002, configib replaces /etc/sysctl.conf 2014-02-28 14:10:24 -06:00
lissav 7da6bca6d4 updatenode customized mypostscript.tmpl with ZONENAME lines 2014-02-27 10:55:31 -05:00
lissav eb6d69a76b updatenode customized mypostscript.tmpl with ZONENAME lines 2014-02-27 10:12:53 -05:00
zhaoertao 3b02602dd2 fix bug 3873: DFM illegal action could work 2014-02-27 01:24:41 -08:00
linggao 4889456e12 Merge branch '2.8' of ssh://linggao@git.code.sf.net/p/xcat/xcat-core into 2.8 2014-02-27 11:01:43 -05:00
linggao 3389774e1b more for xCAT baremetal driver for OpenStack 2014-02-27 11:01:15 -05:00
lissav e77ef4eed3 initialize if no zones 2014-02-26 11:33:39 -05:00
lissav a35f118cd9 adding zonename 2014-02-26 10:37:05 -05:00
lissav 4483b709da adding routines for support 2014-02-26 10:35:26 -05:00
lissav f2f814016d adding routines for support 2014-02-26 10:34:25 -05:00
lissav de2bafc46d Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-02-26 08:13:59 -05:00
daniceexi d8dedfb3b1 defect 3961: make domain name keep without . at beginning 2014-02-26 13:26:01 -05:00
lissav 55a90fc1b9 fix ENABLESSHBETWEENNODES setting in mypostscript file when zones 2014-02-26 08:12:11 -05:00
linggao e6dc6f8a22 removed the debugger 2014-02-26 04:32:07 -05:00
lissav 84232a4b45 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-02-25 11:41:45 -05:00
lissav 04015bd64d defect 3994 2014-02-25 11:41:15 -05:00
lissav 2ec690f18f zone hierarchical support for xdsh -K 2014-02-25 09:59:43 -05:00
zhaoertao 7528e8f0f1 update manpage for mkvm and chvm about partitioning item 2014-02-24 23:55:09 -08:00
ligc 7b43034fab fix a typo in updatenode manpage 2014-02-25 13:44:19 -06:00
lissav 1a5d650be8 xdsh -K support (still need to do hierarchy) 2014-02-24 11:48:44 -05:00
lissav 18a8fd1476 xdsh -K support (still need to do hierarchy) 2014-02-24 11:42:19 -05:00
lissav c99c4d809b xdsh -K support (still need to do hierarchy) 2014-02-24 11:38:58 -05:00
ligc db8efd37b9 fix for bug 3991: if the node can not be resolved or ip address is not valid, print warning message and ignore the node 2014-02-21 12:41:37 -06:00
lissav 9749c8984c zone coce 2014-02-20 12:34:20 -05:00
lissav 329c65eec5 more code 2014-02-20 11:34:53 -05:00
lissav dabc94af12 more code 2014-02-20 11:33:24 -05:00
lissav dad84f2d1a fix for defect 3985 2014-02-20 07:09:50 -05:00
linggao accf4fe1e3 Merge branch '2.8' of ssh://linggao@git.code.sf.net/p/xcat/xcat-core into 2.8 2014-02-20 09:22:53 -05:00
linggao b6cb78e67d xCAT baremetal driver for OpenStack 2014-02-20 09:21:27 -05:00
lissav 9e826d1189 more zone code 2014-02-19 12:50:36 -05:00
lissav 82caea177c designchanges 2014-02-19 08:49:43 -05:00
lissav 00318b28d4 designchanges 2014-02-19 08:48:14 -05:00
lissav d80d7a974f add zone table sshbetweennodes attribute 2014-02-19 07:14:15 -05:00
lissav 59d675af7b add zone table sshbetweennodes attribute 2014-02-19 07:06:28 -05:00
lissav 8a015d24fd add missing -g flag 2014-02-19 05:22:52 -05:00
lissav 1107b62310 add missing -g flag 2014-02-19 05:21:02 -05:00
lissav 5500f73824 improvements 2014-02-18 11:08:22 -05:00
Lissa Valletta 8fd5c23330 zone updates 2014-02-18 10:44:13 -05:00
lissav 640ded52ec more improvements for zones 2014-02-18 10:14:49 -05:00
lissav d5e7c46622 more zone support 2014-02-18 09:06:11 -05:00
lissav ace58552c1 more zone support 2014-02-18 08:49:47 -05:00
lissav 62c1f4a6f6 fix man page 2014-02-18 06:20:28 -05:00
arif 6e1720038e change comment on path of where the gpfs_updates directory is placed 2014-02-17 12:23:32 +00:00
lissav 95486591e4 link in zone commands 2014-02-13 14:27:41 -05:00
Jarrod Johnson b1fddf8eca Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-02-13 09:53:54 -05:00
Jarrod Johnson d03dcbe5f3 Explicitly set SSL_VERIFY_MODE during start ssl in Client 2014-02-13 09:51:02 -05:00
lissav 2ee32a79c8 Multiple zone support 2014-02-13 07:54:10 -05:00
lissav 7fe699f561 Multiple zone support 2014-02-13 07:50:30 -05:00
lissav 445483f25a put in wrong directory 2014-02-13 07:48:02 -05:00
lissav aa32357398 Multiple zone support 2014-02-13 07:43:36 -05:00
zhaoertao 601dc2569c update manpage of mkdef/chdef for osimage 2014-02-13 00:59:42 -08:00
jjhua e0eea42b96 only use short node name in loadclouddata 2014-02-13 12:28:34 -05:00
immarvin 663e7d0132 take *.rhel*.pkglist as pkglist file if *.rhels*.pkglist do not exist 2014-02-12 00:52:35 -08:00
immarvin 3dce4de63a specify text installation mode, otherwise, anaconda will drop into choice dialog when fails to start X in graphic mode 2014-02-12 00:49:36 -08:00
zhaoertao a4a0ed5da3 fix bug 3983: copycds show error info 2014-02-11 22:06:48 -08:00
jjhua 2876b0f371 The template for keystone and swift(all in one) 2014-02-12 12:34:27 -05:00
yinle 3fd9ee8ad9 fix bug #3984 Ubuntu 13.10 diskless installation fails 2014-02-11 10:54:53 -08:00
jjhua 2d7b3f6c51 support for keystone+swift 2014-02-11 15:44:44 -05:00
Jarrod Johnson 73b9ef07ad Have openssl req use better message digest 2014-02-11 10:08:06 -05:00
daniceexi 784f89b916 roll back the last change in configmic file; And fix the issue that hostname cannot show the short hostname 2014-02-11 04:48:40 -05:00
Jarrod Johnson 8804d7180b RHEL7 support for diskful compute profile complete 2014-02-10 14:01:05 -05:00
Jarrod Johnson 89f3dccdbe Have RHEL7 proceed to get through install completion
Still need to get through the postscript phase
2014-02-10 14:00:52 -05:00
Jarrod Johnson 263ee3af3a Add signature detection for RHEL7 media to anaconda 2014-02-10 10:50:32 -05:00
daniceexi 5452efea2e fix the issue that hostname command cannot get short hort name 2014-02-10 08:24:41 -05:00
Jarrod Johnson 504dc16571 Fix xCAT init script status reporting
xCAT in some cases was reporting improper status for certain scenarios.
Risk being inaccure if no pid file exists so that it is accurate when it
does exist.
2014-02-07 17:39:32 -05:00
lissav 1d64d9ce82 new zone table and zonename attribute 2014-02-05 08:28:53 -05:00
Jarrod Johnson b808b12dcf Correct } mistake in previous commit to IPMI.pm 2014-02-04 10:26:57 -05:00
arif 7f42f33094 fix unordered cherry-pick 2014-01-30 20:42:02 +00:00
arif e889f59523 add nichostnameprefixes to @nodeattrs 2014-01-30 20:40:17 +00:00
arif afb15362f3 first commit for prefix hostname feature 2014-01-30 20:40:07 +00:00
arif b832cb5023 fix bug 3971, trim othernames variable 2014-01-30 19:54:07 +00:00
Jarrod Johnson 5e62fbced8 _clear_cache was removed long ago. _build_cache does all the needed work itself, so skip _build_cache. 2014-01-30 13:00:42 -05:00
ligc 5ac1ebaa63 fix for a typo in confignics, caused ib configuration problems 2014-01-29 10:03:17 -06:00
lissav 0ba8649e56 Add IBM_HPC_Stack_in_an_xCAT_Cluster 2014-01-28 15:35:47 -05:00
yinle 9cae05441d minor fix 2014-01-28 13:47:49 -08:00
yinle 5e686b1a45 Add range check and message to nmap 2014-01-28 13:38:39 -08:00
baiyuan b7ec6919e9 fix Undefined subroutine &JSON::decode_json called at /opt/xcat/ws/xcatws.cgi line 168 2014-01-27 23:31:39 -05:00
zhaoertao 6556f026d7 modify usage for 'chvm' and 'mkvm', remove debug msg 2014-01-26 22:53:39 -08:00
zhaoertao d662c5e8b5 The scripts used for configuring and provisioning VIOS partition 2014-01-26 22:02:50 -08:00
zhaoertao 23423a5cb1 create VIOS and logical partitions 2014-01-26 21:57:57 -08:00
qyin 4a2de6ddc2 windows solution 222013 xcat part 2014-01-27 13:12:27 +08:00
ligc 0a810645f2 fix for bug 3979: print a message with rnetboot/bootseq when gateway is empty 2014-01-27 09:58:48 -06:00
lissav 1e2fdb0529 improve man for sshbetweennodes 2014-01-23 12:59:11 -05:00
zhaoertao e62b5b43a8 3974 rinv failed for Fujitsu Blade Server 2014-01-22 23:19:19 -08:00
baiyuan caceaab306 upload testcase for ubuntu 2014-01-22 23:48:03 -05:00
Jarrod Johnson d08d6fb244 Add enic to nics in genesis 2014-01-22 16:57:43 -05:00
baiyuan 0a7963cc65 fix 3879,complete kit size is too big,just keep build_input in complete kit with buildkit.conf,other_files,plugins and scripts, remove other useless dir 2014-01-21 03:48:06 -05:00
yinle 07f95665be Add a new file xcat.conf.apach24 2014-01-20 13:51:04 -08:00
yinle 9b171c32af fix bug #3973 Ubuntu 13.10 diskful installation fails 2014-01-20 13:49:15 -08:00
yinle bc607bf74c fix bug #3973 Ubuntu 13.10 diskful installation fails 2014-01-20 13:21:03 -08:00
yinle c98217e5a1 fix bug #3973 Ubuntu 13.10 diskful installation fails 2014-01-20 13:16:57 -08:00
daniceexi 20865b8812 Change the man page of nodeset to make it supports the shutdown and shell operations 2014-01-20 11:09:09 -05:00
baiyuan 91a5abd7f3 fix 3879,remove build_input dir from complete kit xxx.tar.gz 2014-01-20 04:10:03 -05:00
baiyuan 7c8f671f9f kitconponent should be kitcomponent 2014-01-19 22:19:07 -05:00
baiyuan 95d332aa23 update imgexport/imgimport manpage to surpport kits 2014-01-19 21:54:04 -05:00
baiyuan ece1fd7d03 fixed 3357,add symlink,copy postscripts and plugin files for kit 2014-01-16 20:54:14 -05:00
yinle 0f93e7a135 Add a new file xcat.conf.apach24 2014-01-16 12:45:19 -08:00
yinle d97a9e4316 minor fix 2014-01-16 04:41:33 -08:00
yinle aa2c4978c5 update building of ubuntu repo to include the supported ubuntu disctros 2014-01-16 04:38:31 -08:00
yinle 65bd3afbb3 Merge branch '2.8' of ssh://git.code.sf.net/p//xcat/xcat-core into 2.8 2014-01-16 04:21:24 -08:00
yinle 3b418f8981 update building of ubuntu repo to include the supported ubuntu disctros 2014-01-16 03:56:55 -08:00
daniceexi d0e3c2354f defect 3968: fixed the issue that for statelite on aix, the .statelite dir was not copied to shared_root spot from default spot 2014-01-16 04:48:20 -05:00
Chuck Brazie 82715fac09 Comment out \ h escape character 2014-01-15 07:49:29 -05:00
lissav bcb98fcec9 fix mysqlsetup -u 2014-01-15 06:14:52 -05:00
immarvin 27f6761231 fix defect #3960 Genimage broken for CentOS 5.4 nodes 2014-01-14 01:00:33 -08:00
Jarrod Johnson 6777f86870 Make IPMI 2.0 crypto dependencies mandatory
Faced with an increasing population of IPMI 2 only devices, make the AES/CBC
requirements mandatory as it is a common source of systems failing to work
now.
2014-01-13 10:50:00 -05:00
daniceexi caaa130479 To make bmcsetup cmd to update node status to be [bmcready] in genesis; And make chain mechanism to support [shutdown] key word which is used to poweroff the node 2014-01-13 07:54:05 -05:00
daniceexi a3ade8608b fix the issue that proxydhcp configuration file cannot be updated 2014-01-10 09:15:50 -05:00
sjing 487c57d358 Fix for bug 3955. 2014-01-10 03:01:56 -05:00
sjing 9c35744fd7 Fix for bug 3815
Last fix results in "makedhcp -n" not working, so re-fix it.
2014-01-09 22:14:55 -05:00
lissav 4263c661c5 update description 2014-01-09 08:46:26 -05:00
Jarrod Johnson 3db9440ca9 Fix detection of debian for some ubuntu installations 2014-01-08 15:16:18 -05:00
lissav 1caaf17eb2 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2014-01-08 11:11:44 -05:00
lissav a7bb1d0a9a simplify messages for odbcsetup call 2014-01-08 11:11:17 -05:00
ligc 7f7907ae3e fix for bug 3951: remove the code to check xcat versions during xcatd restart/reload 2014-01-08 23:49:01 +08:00
lissav a37d0e3ec4 fix for defect 3839 2014-01-08 10:32:37 -05:00
ligc f35332a0d1 fix for bug 3947: add check for AIX and nmap existence 2014-01-08 23:29:30 +08:00
wanghuaz c1359797e8 handle kit staff in imgexport/imgimport 2014-01-08 20:14:47 +08:00
daniceexi 05a1624439 defect 3135: changed the mount process for the statelite directory (for persistent entries) that make a directory after the node name and remount to the nodename directory instead of nfs root dir for persistent 2014-01-08 04:59:33 -05:00
lissav 9470ac6d1a Add catagories to the site table 2014-01-07 15:40:58 -05:00
baiyuan 509b979ee8 fix:remoed should be removed 2014-01-07 03:06:30 -05:00
daniceexi a03b712e2f make confignics postscript to accept the site.setinstallnic to configure installnic to be static 2014-01-07 02:26:53 -05:00
lissav a46a8919a3 defect 3948 2014-01-06 14:56:58 -05:00
wanghuaz 8ca9e350e4 fixing the migration problem that rmkitcomp should remove the kitdeployment parameter file and its contents. 2014-01-06 15:22:11 +08:00
immarvin 3e31714aa3 fedora19/fedora20 diskful support 2014-01-02 23:50:47 -08:00
baiyuan 24b255fec5 update cases0 for buildkit 2014-01-02 02:50:08 -05:00
ligc 37be3cd9d7 do not use nodels --version in /etc/init.d/xcatd 2014-01-02 14:38:09 +08:00
sjing f11aa5cc6d Fix for bug 3952
Made makedhcp be able to handle the case where site.nameservers or
networks.nameservers is a comma delimited list with <xcatmaster>
keyword in it.
2014-01-02 01:17:44 -05:00
daniceexi 49cd33382c defect 3909: make xcatd loads xCAT::Enabletrace by require instead of use to save resource 2014-01-02 02:02:24 -05:00
daniceexi 6d76a44409 fix man page of mknb to indicate that mknb only supports x86_64 2014-01-02 01:12:19 -05:00
jjhua 0fe0d25c5f change the name os-object-storage-setup in os-object-storage-setup.rb 2014-01-01 22:09:20 -05:00
daniceexi 2facd1f0c4 Change the Windows deployment templates to support disk configuration, nics configuration and run postscripts 2013-12-31 09:01:28 -05:00
daniceexi 1039ba5490 Enhance genimage.cmd to accept second and third params for multiple winpe support 2013-12-31 08:02:54 -05:00
wanghuaz b4a450352c add an enhancement to skip not well-formed deployment parameters. 2013-12-31 17:02:22 +08:00
wanghuaz 341e847646 minor change in last check of passing parameters to postinstall and postbootscritps 2013-12-31 15:37:53 +08:00
daniceexi 740114c491 Add some comments and help message for genimage.bat 2013-12-30 23:02:52 -05:00
daniceexi 0d1e50c764 fixed the issue that missed the winpe-scripting.cab in last checkin 2013-12-30 07:01:40 -05:00
wanghuaz 9403878ade fixing bug 3815: don't use global variables which doest work well in hierarchy system. 2013-12-30 10:56:57 +08:00
wanghuaz 2e1d048dee passing kitcomponent deploy parameters to genimage package installation, postinstall script and postbootscripts. 2013-12-30 10:05:19 +08:00
wanghuaz c327c4a24b fixng bug 3945: give an example of how to write ospkgdeps and kitpkgdeps in different arch. 2013-12-27 17:05:28 +08:00
baiyuan c3132f5da9 kit release should be mandatory according to mini-design 2013-12-27 02:42:46 -05:00
wanghuaz b93a7b7ab1 fixing bug 3943: give accureate pattern to match output from console 2013-12-27 15:30:00 +08:00
baiyuan 2ad4b13f78 fix Use of uninitialized value within @a2 in pattern match (m//) at BuildKitUtils.pm line 273 2013-12-27 01:53:35 -05:00
sjing fc7d8ecee5 Support dns master/slave configuration 2013-12-26 22:57:24 -05:00
jjhua f2817eff86 update the cookbook and role for swift 2013-12-26 15:05:36 -05:00
wanghuaz c944543a1f fixing bug 3848, moving preuninstall script from prerequisite rpm to meta rpm to make sure it can be issued before componnet been uninstalled. 2013-12-26 15:23:56 +08:00
jjhua c4522d9f5c update node dependency cookbook statsd for swift 2013-12-26 14:14:17 -05:00
jjhua e0de4e6a26 support for swift 2013-12-26 13:06:40 -05:00
jjhua 60afd44afc if there are two roles for one chef-client, the script couldn't assign the
roles to the node. fixed it.
2013-12-26 12:39:02 -05:00
jjhua f3aae68777 support for swift 2013-12-24 15:16:11 -05:00
nott 1afea00f08 template cleanup 2013-12-23 15:23:33 -05:00
jjhua b55034f64c support for cinder 2013-12-23 15:37:45 -05:00
yinle 52098b8ad4 Add warning message on fsp wrong slp reply 2013-12-22 05:03:57 -08:00
immarvin 4920ba650d grep in busybox do not support long optipn string, use short instead 2013-12-19 19:13:10 -08:00
linggao a3b589af67 Changed the table name from capacity to hwinv. 2013-12-19 22:51:39 -05:00
immarvin 891f41b6ba add rhels5.10 discinfo 2013-12-19 04:55:45 -08:00
immarvin b767c8ae95 fix syntax error if is blank 2013-12-19 04:26:24 -08:00
immarvin 5b2c27eb75 grep in busybox do not support long optipn string, use short instead 2013-12-19 01:42:59 -08:00
daniceexi 29fa3ff010 add the second argument for genimage.bat to make it can generate winpe and BCD to a specific dir 2013-12-19 07:25:25 -05:00
immarvin ce58c3bc1c fix the problem that rhels5.10 initrd cannot resolve the mn hostname 2013-12-18 23:19:35 -08:00
yinle 9584f0f683 Remove useless file build-debianrepo 2013-12-19 04:18:25 -08:00
daniceexi a24cabf71c Rewirte the proxydhcp.c with proxydhcp-xcat in perl; Added site.installnic to control the nics setting for windows; Added servicenode.proxydhcp and noderes.proxydhcp to control the starting of proxydhcp-xcat daemon and makedhcp againsts node for windows deployment 2013-12-19 04:53:49 -05:00
yinle eaf168ed48 Modify the bug that causing mklocalrepo.sh wrong 2013-12-19 00:57:32 -08:00
linggao b68c12d07a fixed a syntax error 2013-12-19 08:34:10 -05:00
linggao 69bb732270 Added a capacity table to store the cpu, memory and disk sizes for nodes 2013-12-19 07:52:29 -05:00
Bruce Potter 70a8a07daa Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2013-12-18 15:44:03 -05:00
Bruce Potter 61f2851006 fixed Error: at the beginning of monshow usage (feature request 73) 2013-12-18 15:43:15 -05:00
lissav eebb88bbb1 defect 3916 2013-12-18 09:13:28 -05:00
sjing 8efb1c8f48 Support dns master/slave configuration 2013-12-18 01:35:15 -05:00
lissav 7b5055c77c defect 3916 2013-12-17 13:20:28 -05:00
daniceexi 0fe981ce6d make including winpostscript dir only for linux 2013-12-17 13:54:29 -05:00
jjhua f3bc8f145a correct the errors in the allinone template(using single flat network) 2013-12-17 20:53:30 -05:00
jjhua 413ec01107 add the role os-block-storage-volume for cinder 2013-12-17 20:50:58 -05:00
jjhua 83f82660ca enhanced the role for cinder 2013-12-17 15:12:10 -05:00
jjhua df0ec5b14b It will output some errors when using new chef/chef-server. The errors will not affect the
whole procedure. Update the cookbooks to revmoe the error mesages.
2013-12-17 14:50:17 -05:00
jjhua b9c3d71d6f if we set up the chef-server during os provision, there are some error messages
in the /var/log/messages on the management node.  Fixed them.
2013-12-17 14:10:53 -05:00
daniceexi 50686d34c7 Make xCAT rpm to install all files in /install/winpostscripts/* for Windows support 2013-12-17 02:23:38 -05:00
daniceexi 5021289a86 Enhanced postscript support in templates 2013-12-16 03:53:47 -05:00
daniceexi 32f8a37a22 code drop for windows postscript/postbootscript support. The postscript/postbootscript should be set in node/osimage.postscript/postbootscript and copy to /install/winpostscripts before running nodeset 2013-12-16 02:22:02 -05:00
yinle b958093474 Add lsslp unicast support 2013-12-13 01:26:52 -08:00
yinle 0922dc234c Add lsslp unicast support 2013-12-13 00:59:33 -08:00
yinle acce8ea798 Add lsslp unicast support 2013-12-13 00:50:14 -08:00
lissav d6b62f0eac fix defect 3942 2013-12-12 11:15:15 -05:00
immarvin 214852bcd7 liteimg use rc.statelite instead of rc.statelite.ppc.redhat for rhels6.5.ppc64 statelite 2013-12-12 02:13:02 -08:00
wanghuaz d5a02a43a8 prevent the running of postbootscripts 2013-12-12 17:48:17 +08:00
wanghuaz 8238177b7f prevent the running of postbootscripts 2013-12-12 17:43:57 +08:00
wanghuaz 0284522bf1 prevent the running of postbootscripts 2013-12-12 17:37:48 +08:00
daniceexi 0ac6f5d4e8 skip the bmc interface for nics configuration 2013-12-10 07:17:51 -05:00
baiyuan 75a1115638 add test cases for addkit 2013-12-10 02:19:18 -05:00
daniceexi 01d1bee405 Mutiple winpes support. nodeset (Windows.pm) will generate configuration file (path of winpe) in /var/lib/xcat/proxydhcp.cfg and send signal to proxydhcp daemon, proxydhcp daemon loads configuration file and offers 4011 service to windows compute nodes. 2013-12-10 05:34:09 -05:00
wanghuaz 96a81f9911 fixing bug 3340: add test option for rmkit to list kitcomponents in use 2013-12-09 21:37:28 -08:00
wanghuaz 044febc97d fixing bug 3340: add test option for rmkit to list kitcomponents in use 2013-12-09 21:27:28 -08:00
zhaoertao 389396a5f5 modify the vmstorage value format of local path 2013-12-09 18:58:53 -08:00
Bruce Potter fd9456c60c add valid values of kvm, esx, rhevm to nodehm.mgt and power attributes 2013-12-09 19:02:14 -05:00
Bruce Potter e0dc206356 update description of litefile and litetree image attribute to include reference to image groups 2013-12-09 14:39:45 -05:00
immarvin a60bb9d50c rhels6.5 support 2013-12-05 21:54:18 -08:00
ligc 7877dae894 fix for bug 3902: add bridge nics into dhcpd.conf, em\d+ for Fedora 2013-12-05 12:50:12 +08:00
ligc 6040b777d7 fix for bug 3922, use getNodesAttribs instead of getNodeAttribs 2013-12-05 09:47:39 +08:00
sjing 2ecf98530b Fix for bug 3912
update net-snmp rpm version
2013-12-04 04:01:39 -05:00
lissav cdab9ccc32 fix lots of info in man page 2013-12-03 07:20:38 -05:00
sjing 58505be501 Fixed bug 3927
AIX bundle file can not recognize '#' in the middle of line.
2013-12-02 22:58:25 -05:00
daniceexi 5bc7502d61 code drop for feature to support multiple disks/paritions and multiple nics configuration for Windows deployment. 2013-12-03 02:26:31 -05:00
lissav 7d6d4cc690 Defect 3926, rerun of mysqlsetup -i leaves xcatd stopped 2013-12-02 06:42:27 -05:00
jjhua 672f7548a3 two environment template files if develop_mode=false 2013-12-02 16:36:19 -05:00
baiyuan e037cd0b69 update linux.conf.template for autotest 2013-12-01 22:13:38 -05:00
jjhua 0da6df2117 at present, we will use "develop_mode=true", so I change the value
of develop_mode in the example to "true".
2013-11-29 16:16:57 -05:00
jjhua 1d39d95386 add two examples of the environment files 2013-11-29 14:55:27 -05:00
jjhua 25ef66f1d2 databags and related items in the openstack chef cookbooks.
These are some examples, they can work with the current cookbooks.
If there are some changes in the cookbooks, please update the
databags and related items
2013-11-29 14:44:34 -05:00
jjhua f3925b9cf0 To support databag in openstack chef cookbook.
--nodevmode is only used when running all the procedure, and will
generate the secret, create the databag, and load the databag item
2013-11-29 14:32:42 -05:00
baiyuan bcb80dc6c3 support multiple os version 2013-11-29 00:35:14 -05:00
baiyuan 5b5703e18b add test cases for buildkit 2013-11-28 21:53:31 -05:00
jjhua 59ca686eec To support developer_mode=false, we need to use databag. There was
a bug in rabbimq-server(could not change the guest's password). Fixed
it.
2013-11-28 13:50:07 -05:00
jjhua 54f2ee5abe add the role[os-network-dhcp-agent] into os-compute-single-controller.rb .
It could be used to allocate IP for the nova VMs when using role[allinone-compute]
2013-11-28 13:45:08 -05:00
Bruce Potter 3f6448b316 removed the nbroot rpms from the yum group file 2013-11-27 04:36:46 -05:00
Jarrod Johnson d814b94bde Have ipmi do wire format, to match ipmitool and microsoft behavior in spite of the spec (which no one follows, not even prior xCAT code) 2013-11-26 10:26:51 -05:00
baiyuan f83c398450 enhance os value in testcase,adding os:rhels,os:sles support in cases0 2013-11-24 20:53:58 -05:00
xq2005 47a010573d for bug 3919: version compare problem 2013-11-22 01:35:37 -08:00
xq2005 3b1f5fbbf2 update the ubuntu dep tarball 2013-11-21 20:26:30 -08:00
Bruce Potter 749909960a Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2013-11-21 07:22:25 -05:00
zhaoertao 1166185575 remove 'sequential' parameter for runxcmd calling in configfpc.pm 2013-11-21 01:04:30 -08:00
zhaoertao b5409af7ee fix bug 3889 xcatd not running preprocess for multiple plugins when mgt=ipmi 2013-11-21 00:51:00 -08:00
daniceexi 2ade33338a defect 3917: add support for running of postinstall script in mic genimage. The rootimage root is changed to overlay/rootimg from overlay/package 2013-11-21 05:17:23 -05:00
wanghuaz 6f25f60016 fixing the problem that configing bond0 flushed the default gateway. 2013-11-21 10:09:07 +08:00
Bruce Potter 9b4d72de32 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2013-11-19 07:19:31 -05:00
daniceexi 5161d143bc Change the man pages of nodeset,genimage and geninitrd commands for adding --ignorekernelchk option 2013-11-19 07:07:34 -05:00
ligc c3f73bc9b8 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2013-11-19 15:55:45 +08:00
daniceexi 2b61564684 Code drop for new requirement: Add a new flag --ignorekernelchk for nodeset, geninitrd and genimage commands to skip the kernel version checking when injecting drivers from osimage.driverupdatesrc 2013-11-19 06:27:11 -05:00
ligc 089ea2da87 fix for bug 3913: do not use autocommit=0 for table read 2013-11-19 15:49:26 +08:00
Jarrod Johnson 004d179474 Fix SLES driver update media injection that is not rpm based 2013-11-18 16:31:15 -05:00
lissav 9578417eae defect 3870 2013-11-18 13:42:28 -05:00
Bruce Potter fee08fb028 Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8 2013-11-18 07:52:56 -05:00
lissav 0804cf1ae6 Defect 3906 2013-11-18 06:50:18 -05:00
jjhua e432c238f9 fixed bug 3904, if the environements dir doesn't exsit, create it. 2013-11-18 16:26:03 -05:00
jjhua c8053583bd fixed bug 3898 2013-11-18 15:37:15 -05:00
immarvin 43bc2d1e8e fix #3877 [FVT]genimage return confusing error message when xCAT-IBMhpc is not installed 2013-11-17 19:07:05 -08:00
immarvin e2708df2b4 fix defect #3693 [DEV] rhels6.4-ppc64 statelite failed with (FATAL error: could not get the entries from litefile table...) when noderes.xcatmaster=<hostname of MN> 2013-11-17 18:48:00 -08:00
Bruce Potter d91767af84 change version of 2.8 branch to 2.8.4 2013-11-15 16:46:40 -05:00
439 changed files with 33056 additions and 11231 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.3
2.8.5
-241
View File
@@ -1,241 +0,0 @@
#!/bin/sh
# Update GSA Ubuntu Repositories or create a local repository
#
# Author: Leonardo Tonetto (tonetto@linux.vnet.ibm.com)
# Revisor: Arif Ali (aali@ocf.co.uk)
#
# After running this script, add the following line to
# /etc/apt/sources.list for local repository
# deb file://<core_repo_path>/xcat-core/ maverick main
# deb file://<dep_repo_path>/xcat-dep/ maverick main
#
# For the purpose of getting the distribution name
# Supported distributions
dists="squeeze"
a_flag= # automatic flag - only update if repo was updated
c_flag= # xcat-core (trunk-delvel) path
d_flag= # xcat-dep (trunk) path
local_flag= # build the repository localy
while getopts 'c:d:u:p:l:a' OPTION
do
case $OPTION in
c) c_flag=1
xcat_core_path="$OPTARG"
;;
d) d_flag=1
xcat_dep_path="$OPTARG"
;;
l) local_flag=1
local_repo_path="$OPTARG"
;;
a) a_flag=1
;;
?) printf "Usage: %s -c <core_trunk_path> [-d <dep_trunk_path>] -l <local-repo_path> [-a]\n" $(basename $0) >&2
echo "-a Automatic: update only if there's any update on repo"
exit 2
;;
esac
done
shift $(($OPTIND - 1))
if [ -z "$c_flag" -a -z "$d_flag" ]
then
printf "Usage: %s -c <core_trunk_path> [-d <dep_trunk_path>] { -l <local-repo_path> | [-u <gsa_id> -p <gsa_passwd>] } [-a]\n" $(basename $0) >&2
echo "-a Automatic: update only if there's any update on repo"
exit 2
fi
if [ ! -d $xcat_core_path ]
then
printf "%s: No such directory\n" "$xcat_core_path" >&2
exit 2
fi
if [ "$d_flag" ]
then
if [ ! -d $xcat_dep_path ]
then
printf "%s: No such directory\n" "$xcat_dep_path" >&2
exit 2
fi
fi
if [ "$local_flag" ]
then
repo_xcat_core_path=$local_repo_path"/xcat-core"
repo_xcat_dep_path=$local_repo_path"/xcat-dep"
else
printf "Usage: %s -c <core_trunk_path> [-d <dep_trunk_path>] -l <local-repo_path> [-a]\n" $(basename $0) >&2
echo "-a Automatic: update only if there's any update on repo"
exit 2
fi
if [ "$a_flag" ]
then
touch svcupdate.trace
SVCUP='svcupdate.trace'
svn update $xcat_core_path 1> $SVCUP 2>&1
if ! grep 'Tree is up to date' $SVCUP
then
update_core=1
else
update_core=
fi
rm -f $SVCUP
else
update_core=1
fi
if [ "$c_flag" -a "$update_core" ]
then
echo "###############################"
echo "# Building xcat-core packages #"
echo "###############################"
CMD_PATH=`pwd`
cd $xcat_core_path
./build-debs-all "snap" "Nightly_Builds"
echo "#################################"
echo "# Creating xcat-core repository #"
echo "#################################"
if [ -d $repo_xcat_core_path ]; then
rm -rf $repo_xcat_core_path
fi
mkdir -p $repo_xcat_core_path/conf
find . -iname '*.deb' -exec mv {} $repo_xcat_core_path \;
rm -rf debs/
cd $CMD_PATH
rm -rf $repo_xcat_core_path/conf/distributions
for dist in $dists; do
cat << __EOF__ >> $repo_xcat_core_path/conf/distributions
Origin: xCAT internal repository
Label: xcat-core bazaar repository
Codename: $dist
Architectures: amd64
Components: main
Description: Repository automatically genereted conf
__EOF__
done
cat << __EOF__ > $repo_xcat_core_path/conf/options
verbose
basedir .
__EOF__
for dist in $dists; do
for file in `ls $repo_xcat_core_path/*.deb`; do
reprepro -b $repo_xcat_core_path includedeb $dist $file;
done
done
mv $xcat_core_path/latest_version $repo_xcat_core_path/xcat-core_latest-build
cat << '__EOF__' > $repo_xcat_core_path/mklocalrepo.sh
codename=`lsb_release -a 2>null | grep Codename | awk '{print $2}'`
cd `dirname $0`
echo deb file://"`pwd`" $codename main > /etc/apt/sources.list.d/xcat-core.list
__EOF__
chmod 775 $repo_xcat_core_path/mklocalrepo.sh
rm -rf $repo_xcat_core_path/*.deb
if [ -z "$local_flag" ]
then
echo "###############################"
echo "# Updating GSA xcat-core repo #"
echo "###############################"
lftp -e "mirror -R --delete-first $repo_xcat_core_path /projects/i/ipl-xcat/ubuntu/; exit;" -u $gsa_id,$gsa_passwd -p 22 sftp://ausgsa.ibm.com
fi ### if [ -z "$local_flag" ]
fi ### if [ "$a_flag" ]
if [ "$a_flag" -a "$d_flag" ]
then
touch svcupdate.trace
SVCUP='svcupdate.trace'
svn update $xcat_dep_path 1> $SVCUP 2>&1
if ! grep 'Tree is up to date' $SVCUP
then
update_dep=1
else
update_dep=
fi
rm -f $SVCUP
else
update_dep=1
fi
if [ "$d_flag" -a "$update_dep" ]
then
echo "##############################"
echo "# Building xcat-dep packages #"
echo "##############################"
CMD_PATH=`pwd`
cd $xcat_dep_path
./build-debs-all "snap" "Nightly_Builds"
echo "################################"
echo "# Creating xcat-dep repository #"
echo "################################"
rm -rf $repo_xcat_dep_path
mkdir -p $repo_xcat_dep_path/conf
find $xcat_dep_path -iname '*.deb' -exec cp {} $repo_xcat_dep_path \;
rm -rf $repo_xcat_core_path/conf/distributions
for dist in $dists; do
cat << __EOF__ >> $repo_xcat_dep_path/conf/distributions
Origin: xCAT internal repository
Label: xcat-dep bazaar repository
Codename: $dist
Architectures: amd64
Components: main
Description: Repository automatically genereted conf
__EOF__
done
cat << __EOF__ > $repo_xcat_dep_path/conf/options
verbose
basedir .
__EOF__
for dist in $dists; do
for file in `ls $repo_xcat_dep_path/*.deb`; do
reprepro -b $repo_xcat_dep_path includedeb $dist $file;
done
done
cat << '__EOF__' > $repo_xcat_dep_path/mklocalrepo.sh
codename=`lsb_release -a 2>null | grep Codename | awk '{print $2}'`
cd `dirname $0`
echo deb file://"`pwd`" $codename main > /etc/apt/sources.list.d/xcat-dep.list
__EOF__
chmod 775 $repo_xcat_dep_path/mklocalrepo.sh
rm -rf $repo_xcat_dep_path/*.deb
if [ -z "$local_flag" ]
then
echo "##############################"
echo "# Updating GSA xcat-dep repo #"
echo "##############################"
lftp -e "mirror -R --delete-first $repo_xcat_dep_path /projects/i/ipl-xcat/ubuntu/; exit;" -u $gsa_id,$gsa_passwd -p 22 sftp://ausgsa.ibm.com
fi ### if [ -z "$local_flag" ]
fi ### if [ "$d_flag" -a "$a_flag"]
if [ -z "$local_flag" ] # delete the temp repo after upload is done
then
rm -rf ./gsa-repo_temp
fi
exit 0
+10 -6
View File
@@ -53,7 +53,7 @@ for i in $*; do
done
# Supported distributions
dists="maverick natty oneiric precise"
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`
@@ -194,7 +194,7 @@ then
if [ ! -d ../../$package_dir_name ];then
mkdir -p "../../$package_dir_name"
fi
packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack"
packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack xCAT-OpenStack-baremetal"
for file in `echo $packages`
do
@@ -276,10 +276,10 @@ __EOF__
done
#create the mklocalrepo script
cat << __EOF__ > mklocalrepo.sh
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
@@ -413,6 +413,10 @@ __EOF__
while [ $((i+=1)) -le 5 ] && ! rsync -urLv --delete xcat-dep ${uploader},xcat@web.sourceforge.net:${sf_dir}/ubuntu/
do : ; done
#upload the tarball
i=0
echo "Uploading $dep_tar_name to ${sf_dir}/xcat-dep/2.x_Ubuntu/ ..."
while [ $((i+=1)) -le 5 ] && ! rsync -v $dep_tar_name ${uploader},xcat@web.sourceforge.net:${sf_dir}/xcat-dep/2.x_Ubuntu/
do : ; done
cd $old_pwd
fi
exit 0
+11 -7
View File
@@ -41,11 +41,13 @@ UPLOADUSER=bp-sawyers
FRS=/home/frs/project/x/xc/xcat
# These are the rpms that should be built for each kind of xcat build
ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-OpenStack"
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=""
@@ -237,10 +239,11 @@ if [ "$OSNAME" = "AIX" ]; then
fi
# Build the rest of the noarch rpms
for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit; do
for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT-SoftLayer; do
#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
@@ -272,19 +275,19 @@ if [ "$OSNAME" != "AIX" ]; then
fi
# Build the xCAT and xCATsn rpms for all platforms
for rpmname in xCAT xCATsn xCAT-OpenStack; do
for rpmname in xCAT xCATsn xCAT-OpenStack xCAT-OpenStack-baremetal; do
#if [ "$EMBED" = "zvm" ]; then break; fi
if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi
if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then # used to be: if $GREP -E "^[UAD] +$rpmname/" $GITUP; then
UPLOAD=1
ORIGFAILEDRPMS="$FAILEDRPMS"
if [ "$OSNAME" = "AIX" ]; then
if [ "$rpmname" = "xCAT-OpenStack" ]; then continue; fi # do not bld openstack on aix
if [ "$rpmname" = "xCAT-OpenStack" ] || [ "$rpmname" = "xCAT-OpenStack-baremetal" ]; then continue; fi # do not bld openstack on aix
./makerpm $rpmname "$EMBED"
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname"; fi
else
for arch in x86_64 ppc64 s390x; do
if [ "$rpmname" = "xCAT-OpenStack" -a "$arch" != "x86_64" ]; then continue; fi # only bld openstack for x86_64 for now
if [ "$rpmname" = "xCAT-OpenStack" -a "$arch" != "x86_64" ] || [ "$rpmname" = "xCAT-OpenStack-baremetal" -a "$arch" != "x86_64" ] ; then continue; fi # only bld openstack for x86_64 for now
./makerpm $rpmname $arch "$EMBED"
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname-$arch"; fi
done
@@ -496,6 +499,7 @@ if [ "$OSNAME" != "AIX" -a "$REL" = "devel" -a "$PROMOTE" != 1 -a -z "$EMBED" ];
rpm2cpio ../$XCATCORE/xCAT-test-*.$NOARCH.rpm | cpio -id '*.html'
rpm2cpio ../$XCATCORE/xCAT-buildkit-*.$NOARCH.rpm | cpio -id '*.html'
rpm2cpio ../$XCATCORE/xCAT-OpenStack-*.x86_64.rpm | cpio -id '*.html'
rpm2cpio ../$XCATCORE/xCAT-SoftLayer-*.$NOARCH.rpm | cpio -id '*.html'
i=0
while [ $((i+=1)) -le 5 ] && ! rsync $verboseflag -r opt/xcat/share/doc/man1 opt/xcat/share/doc/man3 opt/xcat/share/doc/man5 opt/xcat/share/doc/man7 opt/xcat/share/doc/man8 $UPLOADUSER,xcat@web.sourceforge.net:htdocs/
do : ; done
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
-3
View File
@@ -10,9 +10,6 @@
<packagereq type="required">xCAT-server</packagereq>
<packagereq type="required">xCAT-client</packagereq>
<packagereq type="required">perl-xCAT</packagereq>
<packagereq type="required">xCAT-nbroot-core-x86_64</packagereq>
<packagereq type="required">xCAT-nbroot-core-x86</packagereq>
<packagereq type="optional">xCAT-nbroot-core-ppc64</packagereq>
</packagelist>
</group>
</comps>
+4
View File
@@ -53,6 +53,7 @@ function makexcat {
tar -X /tmp/xcat-excludes -cf $RPMROOT/SOURCES/templates.tar templates
gzip -f $RPMROOT/SOURCES/templates.tar
cp xcat.conf $RPMROOT/SOURCES
cp xcat.conf.apach24 $RPMROOT/SOURCES
cp xCATMN $RPMROOT/SOURCES
else # xCATsn
tar -X /tmp/xcat-excludes -cf $RPMROOT/SOURCES/license.tar LICENSE.html
@@ -75,13 +76,16 @@ function makexcat {
tar --exclude .svn --exclude upflag -czf $RPMROOT/SOURCES/postscripts.tar.gz postscripts LICENSE.html
tar --exclude .svn -czf $RPMROOT/SOURCES/prescripts.tar.gz prescripts
tar --exclude .svn -czf $RPMROOT/SOURCES/templates.tar.gz templates
tar --exclude .svn -czf $RPMROOT/SOURCES/winpostscripts.tar.gz winpostscripts
cp xcat.conf $RPMROOT/SOURCES
cp xcat.conf.apach24 $RPMROOT/SOURCES
cp xCATMN $RPMROOT/SOURCES
cd - >/dev/null
elif [ "$RPMNAME" = "xCATsn" ]; then
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
+6
View File
@@ -262,6 +262,12 @@ expression B<($1-1)%14+1> will evaluate to B<6>.
See http://www.perl.com/doc/manual/html/pod/perlre.html for information on perl regular expressions.
=head2 Easy Regular Expressions
As of xCAT 2.8.1, you can use a modified version of the regular expression support described in the previous section. You do not need to enter the node information (1st part of the expression), it will be derived from the input nodename. You only need to supply the 2nd part of the expression to determine the value to give the attribute. For examples, see
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Listing_and_Modifying_the_Database#Easy_Regular_expressions
=head1 OBJECT DEFINITIONS
Because it can get confusing what attributes need to go in what tables, the xCAT database can also
+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);
}
+2 -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;
}
@@ -223,6 +223,7 @@ if (ref($request) eq 'HASH') { # the request is an array, not pure XML
SSL_key_file => $keyfile,
SSL_cert_file => $certfile,
SSL_ca_file => $cafile,
SSL_verify_mode => SSL_VERIFY_PEER,
SSL_use_cert => 1,
Timeout => 0,
);
+2 -2
View File
@@ -618,7 +618,7 @@ sub getDBtable
{
# need to get info from DB
my $thistable = xCAT::Table->new($table, -create => 1, -autocommit => 0);
my $thistable = xCAT::Table->new($table, -create => 1);
if (!$thistable)
{
return undef;
@@ -2747,7 +2747,7 @@ sub collapsenicsattr()
# e.g nicips.eth0
# do not need to handle nic attributes without the postfix .ethx,
# it will be overwritten by the attributes with the postfix .ethx,
if ($nodeattr =~ /^(nic\w+)\.(\w+)$/)
if ($nodeattr =~ /^(nic\w+)\.(.*)$/)
{
if ($1 && $2)
{
+14 -11
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);
@@ -5320,8 +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 $orig_src_file = $1;
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;
@@ -5350,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 .= $orig_src_file;
$newsrcfile .= $orig_src_file;
$src_file=$newsrcfile;
}
# destination file name
-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 -1
View File
@@ -67,7 +67,7 @@ sub getHcpAttribs
}
}
my @ps = $tabs->{ppc}->getAllNodeAttribs(['node','parent','nodetype','hcp']);
my @ps = $tabs->{ppc}->getAllNodeAttribs(['node','parent','nodetype','hcp','id']);
for my $entry ( @ps ) {
my $tmp_parent = $entry->{parent};
my $tmp_node = $entry->{node};
@@ -79,6 +79,9 @@ sub getHcpAttribs
if (defined($tmp_node) && defined($tmp_type) && ($tmp_type eq "blade") && defined($entry->{hcp})) {
push @{$ppchash{$tmp_node}{children}}, $entry->{hcp};
}
if (defined($tmp_node) && defined($entry->{id}) && defined($tmp_parent) && defined($tmp_type) && ($tmp_type eq "lpar")) {
$ppchash{$tmp_parent}{mapping}{$tmp_node} = $entry->{id};
}
#if(exists($ppchash{$tmp_node})) {
# if( defined($tmp_type) ) {
+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;
}
+496 -51
View File
@@ -15,7 +15,8 @@ use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR);
use xCAT::Usage;
use xCAT::NodeRange;
use xCAT::FSPUtils;
#use Data::Dumper;
use xCAT::VMCommon;
use Data::Dumper;
use xCAT::MsgUtils qw(verbose_message);
##############################################
# Globals
@@ -47,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);
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)) {
@@ -74,16 +86,97 @@ 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") {
if (exists($opt->{vios})) {
if ($value !~ /\d+/) {
return "'$value' is invalid, must be numbers";
} else {
my @array = ();
for (1..$value) {
push @array, 0;
}
$value = \@array;
}
} else {
if ($value =~ /^([\w_-]*):(\d+)$/) {
$value = ["0,$1:$2"];
} else {
return "'$value' is invalid, must be in form of 'Server_name:slotnum'";
}
}
} elsif ($cmd eq "vmcpus") {
if ($value =~ /^(\d+)\/(\d+)\/(\d+)$/) {
unless ($1 <= $2 and $2 <= $3) {
return "'$value' is invalid, must be in order";
}
} else {
return "'$value' is invalid, must be integer";
}
} elsif ($cmd eq "vmmemory") {
if ($value =~ /^([\d|.]+)([G|M]?)\/([\d|.]+)([G|M]?)\/([\d|.]+)([G|M]?)$/i) {
my ($mmin, $mcur, $mmax);
if ($2 == "G" or $2 == '') {
$mmin = $1 * 1024;
}
if ($4 == "G" or $4 == '') {
$mcur = $3 * 1024;
}
if ($6 == "G" or $6 == '') {
$mmax = $5 * 1024;
}
unless ($mmin <= $mcur and $mcur <= $mmax) {
return "'$value' is invalid, must be in order";
}
} else {
return "'$value' is invalid";
}
} elsif ($cmd eq "vmphyslots") {
my @tmp_array = split ",",$value;
foreach (@tmp_array) {
unless (/(0x\w{8})/) {
return "'$_' is invalid";
}
}
} elsif ($cmd eq "vmothersetting") {
my @tmp_array = split ",", $value;
foreach (@tmp_array) {
unless (/^(bsr|hugepage):\d+$/) {
return "'$_' is invalid";
}
}
} elsif ($cmd eq "vmnics") {
my @tmp_array = split ",", $value;
foreach (@tmp_array) {
unless (/^vlan\d+$/i) {
return "'$_' is invalid";
}
}
}
} else {
@@ -91,6 +184,7 @@ sub chvm_parse_extra_options {
}
$opt->{$cmd} = $value;
}
@query_array = keys(%tmp_hash);
return undef;
}
@@ -124,7 +218,7 @@ sub chvm_parse_args {
$Getopt::Long::ignorecase = 0;
Getopt::Long::Configure( "bundling" );
if ( !GetOptions( \%opt, qw(V|verbose p=s i=s m=s r=s p775) )) {
if ( !GetOptions( \%opt, qw(V|verbose p=s i=s m=s r=s p775 vios) )) {
return( usage() );
}
####################################
@@ -398,7 +492,7 @@ sub mkvm_parse_args {
push @unsupport_ops, $tmpop;
}
}
my @support_ops = qw(vmcpus vmmemory vmphyslots vmothersetting);
my @support_ops = qw(vmcpus vmmemory vmphyslots vmothersetting vmnics vmstorage);
if (defined(@ARGV[0]) and defined($opt{full})) {
return(usage("Option 'full' shall be used alone."));
} elsif (defined(@ARGV[0])) {
@@ -653,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})) {
@@ -692,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)) {
@@ -709,8 +804,47 @@ 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";
} elsif ($op eq "vmnics") {
my @vlans = split /,/,$param;
foreach (@vlans) {
if (/vlan(\d+)/i) {
my $vlanid = $1;
my $mac = lc(xCAT::VMCommon::genMac($name));
if ($mac =~ /(..):(..):(..):(..):(..):(..)/) {
my $tail = hex($6)+$vlanid;
$mac = sprintf("$1$2$3$4$5%02x",$tail);
}
my $value = xCAT::FSPUtils::fsp_api_action($request,$name, $d, "part_set_veth_slot_config",0,"0,$vlanid,$mac");
if (@$value[1] && ((@$value[1] =~ /Error/i) && (@$value[2] ne '0'))) {
return ([[$name, @$value[1], '1']]) ;
} else {
push @values, [$name, "Success", '0'];
}
}
}
next;
} elsif ($op eq "vmstorage") {
foreach my $v_info (@$param) {
if ($v_info =~ /(\d+),([\w_-]*):(\d+)/) {
my $vios = &find_lpar_id($request, @$d[3], $2);
my $r_slotid = $3;
if (!defined($vios)) {
return ([[$name, "Cannot find lparid for Server lpar:$1", '1']]);
}
$v_info = "$1,$vios,$r_slotid";
}
my $value = xCAT::FSPUtils::fsp_api_action($request,$name, $d, "part_set_vscsi_slot_config",0,$v_info);
if (@$value[1] && ((@$value[1] =~ /Error/i) && (@$value[2] ne '0'))) {
return ([[$name, @$value[1], '1']]) ;
} else {
push @values, [$name, "Success", '0'];
}
}
next;
} elsif ($op eq "vmmemory") {
my @td = @$d;
@td[0] = 0;
@@ -722,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 {
@@ -750,20 +884,34 @@ sub do_op_extra_cmds {
$action = "part_set_lpar_pending_mem";
} elsif ($op eq "bsr") {
$action = "set_lpar_bsr";
} elsif ($op eq "vios") {
print __LINE__."=========>op=vios===\n";
next;
} else {
last;
}
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 {
@@ -1544,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);
@@ -1564,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];
@@ -1579,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";
}
}
}
}
@@ -1595,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 = ();
@@ -1609,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];
@@ -1638,21 +1832,103 @@ sub query_cec_info_actions {
#$data .= "\n";
next;
}
if ($action eq "part_get_all_vio_info") {
my @output = split /\n/, @$values[1];
my ($drc_index,$drc_name);
foreach my $line (@output) {
chomp($line);
if ($line =~ /Index:.*drc_index:([^,]*),\s*drc_name:(.*)$/) {
$drc_index = $1;
$drc_name = $2;
next;
} elsif ($line =~ /\s*lpar_id=(\d+),type=(vSCSI|vSerial),slot=(\d+),attr=(\d+).*remote_lpar_id=(0x\w+),remote_slot_num=(0x\w+)/) {
if ($4 eq '0') {
push @array, [$name, "$1,$3,$drc_name,$drc_index,$2 Client(Server_lparid=$5,Server_slotid=$6)", 0];
} else {
push @array, [$name, "$1,$3,$drc_name,$drc_index,$2 Server", 0];
}
} elsif ($line =~ /\s*lpar_id=(\d+),type=(vEth),slot=(\d+).*port_vlan_id=(\d+),mac_addr=(\w+)/) {
push @array, [$name, "$1,$3,$drc_name,$drc_index,$2 (port_vlanid=$4,mac_addr=$5)", 0];
#} elsif ($line =~ /\s*lpar_id=(\d+),type=(\w+),slot=(\d+)/) {
# push @array, [$name, "$1,$3,$drc_name,$drc_index,$2", 0];
#} else {
#print "=====>line:$line\n";
#push @array, [$name, $line, 0];
}
$drc_index = '';
$drc_name = '';
}
next;
}
}
#$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;
@@ -1660,23 +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] ne "lpar") {
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","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;
}
@@ -1766,9 +2055,10 @@ sub deal_with_avail_mem {
} else {
$cur_avail = $lparhash->{hyp_avail_mem} + $used_regions - $tmphash{lpar0_used_mem};
}
xCAT::MsgUtils->verbose_message($request, "====****====used:$used_regions,avail:$cur_avail,($min:$cur:$max).");
#xCAT::MsgUtils->verbose_message($request, "====****====used:$used_regions,avail:$cur_avail,($min:$cur:$max).");
if ($cur_avail < $min) {
return([$name, "Parse reserverd regions failed, no enough memory, available:$lparhash->{hyp_avail_mem}.", 1]);
my $cur_mem_in_G = $lparhash->{hyp_avail_mem} * $lparhash->{mem_region_size} * 1.0 / 1024;
return([$name, "Parse reserverd regions failed, no enough memory, available:$cur_mem_in_G GB.", 1]);
}
if ($cur > $cur_avail) {
my $new_cur = $cur_avail;
@@ -1781,6 +2071,30 @@ sub deal_with_avail_mem {
return 0;
}
sub find_lpar_id {
my $request = shift;
my $parent = shift;
my $name = shift;
my %mapping = %{$request->{ppc}->{$parent}->{mapping}};
if (exists($mapping{$name})) {
return $mapping{$name};
}
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;
@@ -1804,12 +2118,42 @@ sub create_lpar {
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_group_id");
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_avail_priority");
#print "======>physlots:$lparhash->{physlots}.\n";
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_io_slot_owner_uber", 0, $lparhash->{physlots});
#$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_io_slot_owner", 0, join(",",@phy_io_array));
if (@$values[2] ne 0) {
&set_lpar_undefined($request, $name, $d);
return ([$name, @$values[1], @$values[2]]);
if (exists($lparhash->{physlots})) {
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_io_slot_owner_uber", 0, $lparhash->{physlots});
#$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_io_slot_owner", 0, join(",",@phy_io_array));
if (@$values[2] ne 0) {
&set_lpar_undefined($request, $name, $d);
return ([$name, @$values[1], @$values[2]]);
}
}
if (exists($lparhash->{nics})) {
my @vlans = split /,/,$lparhash->{nics};
foreach (@vlans) {
if (/vlan(\d+)/i) {
my $vlanid = $1;
my $mac = lc(xCAT::VMCommon::genMac($name));
if ($mac =~ /(..):(..):(..):(..):(..):(..)/) {
my $tail = hex($6)+$vlanid;
$mac = sprintf("$1$2$3$4$5%02x",$tail);
}
$values = xCAT::FSPUtils::fsp_api_action($request,$name, $d, "part_set_veth_slot_config",0,"0,$vlanid,$mac");
if (@$values[2] ne 0) {
&set_lpar_undefined($request, $name, $d);
return ([$name, @$values[1], @$values[2]]);
}
}
}
}
if (exists($lparhash->{storage})) {
foreach my $v_info (@{$lparhash->{storage}}) {
$values = xCAT::FSPUtils::fsp_api_action($request,$name, $d, "part_set_vscsi_slot_config",0,$v_info);
if (@$values[2] ne 0) {
&set_lpar_undefined($request, $name, $d);
return ([$name, @$values[1], @$values[2]]);
}
}
}
# ====== ====== #
if (exists($lparhash->{phy_hea})) {
my $phy_hash = $lparhash->{phy_hea};
foreach my $phy_drc (keys %$phy_hash) {
@@ -1850,6 +2194,7 @@ sub create_lpar {
&set_lpar_undefined($request, $name, $d);
return ([$name, @$values[1], @$values[2]]);
}
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_comp_modes");
#print "======>memory:$lparhash->{huge_page}.\n";
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_huge_page", 0, $lparhash->{huge_page});
@@ -1873,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]]);
@@ -1880,7 +2226,7 @@ sub mkspeclpar {
while (my ($mtms, $h) = each (%$hash)) {
my $memhash;
my @nodes = keys(%$h);
my $ent = $vmtab->getNodesAttribs(\@nodes, ['cpus', 'memory','physlots', 'othersettings']);
my $ent = $vmtab->getNodesAttribs(\@nodes, ['cpus', 'memory','physlots', 'othersettings', 'storage', 'nics']);
while (my ($name, $d) = each (%$h)) {
if (@$d[4] ne 'lpar') {
push @result, [$name, "Node must be LPAR", 1];
@@ -1889,7 +2235,7 @@ sub mkspeclpar {
if (!exists($memhash->{run})) {
my @td = @$d;
@td[0] = 0;
$memhash = &query_cec_info_actions($request, $name, \@td, 1, ["part_get_hyp_process_and_mem","lpar_lhea_mac"]);
$memhash = &query_cec_info_actions($request, $name, \@td, 1, ["part_get_hyp_process_and_mem","lpar_lhea_mac","part_get_all_io_bus_info"]);
$memhash->{run} = 1;
}
my $tmp_ent = $ent->{$name}->[0];
@@ -1902,55 +2248,154 @@ sub mkspeclpar {
if (exists($opt->{vmphyslots})) {
$tmp_ent->{physlots} = $opt->{vmphyslots};
}
if (exists($opt->{vmothersetting})) {
$tmp_ent->{othersettings} = $opt->{vmothersetting};
}
if (exists($opt->{vmstorage})) {
$tmp_ent->{storage} = $opt->{vmstorage};
}
if (exists($opt->{vmnics})) {
$tmp_ent->{nics} = $opt->{vmnics};
}
if (!defined($tmp_ent) ) {
return ([[$name, "Not find params", 1]]);
} elsif (!exists($tmp_ent->{cpus}) || !exists($tmp_ent->{memory}) || !exists($tmp_ent->{physlots})) {
return ([[$name, "The attribute 'vmcpus', 'vmmemory' and 'vmphyslots' are all needed to be specified.", 1]]);
#} elsif (!exists($tmp_ent->{cpus}) || !exists($tmp_ent->{memory}) || !exists($tmp_ent->{physlots})) {
} elsif (!exists($tmp_ent->{cpus}) || !exists($tmp_ent->{memory})) {
return ([[$name, "The attribute 'vmcpus', 'vmmemory' are needed to be specified.", 1]]);
}
if ($tmp_ent->{memory} =~ /(\d+)([G|M]?)\/(\d+)([G|M]?)\/(\d+)([G|M]?)/i) {
my $memsize = $memhash->{mem_region_size};
my $min = $1;
# FIX bug 3873 [FVT]DFM illegal action could work
#
if ($tmp_ent->{cpus} =~ /^(\d+)\/(\d+)\/(\d+)$/) {
unless ($1 <= $2 and $2 <= $3) {
return([[$name, "Parameter for 'vmcpus' is invalid", 1]]);
}
} else {
return([[$name, "Parameter for 'vmcpus' is invalid", 1]]);
}
if ($tmp_ent->{memory} =~ /^([\d|.]+)([G|M]?)\/([\d|.]+)([G|M]?)\/([\d|.]+)([G|M]?)$/i) {
my ($mmin, $mcur, $mmax);
if ($2 == "G" or $2 == '') {
$min = $min * 1024;
}
$min = $min/$memsize;
my $cur = $3;
$mmin = $1 * 1024;
}
if ($4 == "G" or $4 == '') {
$cur = $cur * 1024;
$mcur = $3 * 1024;
}
$cur = $cur/$memsize;
my $max = $5;
if ($6 == "G" or $6 == '') {
$max = $max * 1024;
$mmax = $5 * 1024;
}
$max = $max/$memsize;
$tmp_ent->{memory} = "$min/$cur/$max";
unless ($mmin <= $mcur and $mcur <= $mmax) {
return([[$name, "Parameter for 'vmmemory' is invalid", 1]]);
}
my $memsize = $memhash->{mem_region_size};
$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 {
return([[$name, "Parameter for 'vmmemory' is invalid", 1]]);
}
if (exists($tmp_ent->{physlots})) {
my @tmp_array = split ",",$tmp_ent->{physlots};
foreach (@tmp_array) {
unless (/(0x\w{8})/i) {
return([[$name, "Parameter:$_ for 'vmphyslots' is invalid", 1]]);
}
}
}
if (exists($tmp_ent->{othersettings})) {
my @tmp_array = split ",",$tmp_ent->{othersettings};
foreach (@tmp_array) {
unless (/^(bsr|hugepage):\d+$/) {
return([[$name, "Parameter:$_ for 'vmothersetting' is invalid", 1]]);
}
}
}
if (exists($tmp_ent->{nics})) {
my @tmp_array = split ",",$tmp_ent->{nics};
foreach (@tmp_array) {
unless (/^vlan\d+$/i) {
return([[$name, "Parameter:$_ for 'vmnics' is invalid", 1]]);
}
}
}
if (exists($opt->{vios})) {
if (!exists($tmp_ent->{physlots})) {
my @phy_io_array = keys(%{$memhash->{bus}});
$tmp_ent->{physlots} = join(",", @phy_io_array);
}
if (exists($tmp_ent->{storage}) and $tmp_ent->{storage} !~ /^\d+$/) {
return ([[$name, "Parameter for 'vmstorage' is invalid", 1]]);
} elsif (exists($tmp_ent->{storage})) {
my $num = $tmp_ent->{storage};
my @array = ();
for (1..$num) {
push @array, '0';
}
$tmp_ent->{storage} = \@array;
}
} else {
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} = $storage_array;
}
}
$tmp_ent->{hyp_config_mem} = $memhash->{hyp_config_mem};
$tmp_ent->{hyp_avail_mem} = $memhash->{hyp_avail_mem};
$tmp_ent->{huge_page} = "0/0/0";
$tmp_ent->{bsr_num} = "0";
if (exists($tmp_ent->{othersettings})) {
my $setting = $tmp_ent->{othersettings};
if ($setting =~ /hugepage:(\d+)/) {
my $tmp = $1;
$tmp_ent->{huge_page} = "1/".$tmp."/".$tmp;
if ($tmp >= 1) {
$tmp_ent->{huge_page} = "1/".$tmp."/".$tmp;
}
}
if ($setting =~ /bsr:(\d+)/) {
$tmp_ent->{bsr_num} = $1;
if ($1 >= 1) {
$tmp_ent->{bsr_num} = $1;
}
}
}
$tmp_ent->{phy_hea} = $memhash->{phy_drc_group_port};
$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;
}
+2
View File
@@ -56,6 +56,7 @@ $::STATUS_SHELL="shell";
$::STATUS_DEFINED="defined";
$::STATUS_UNKNOWN="unknown";
$::STATUS_FAILED="failed";
$::STATUS_BMCREADY="bmcready";
%::VALID_STATUS_VALUES = (
$::STATUS_ACTIVE=>1,
$::STATUS_INACTIVE=>1,
@@ -72,6 +73,7 @@ $::STATUS_FAILED="failed";
$::STATUS_DEFINED=>1,
$::STATUS_UNKNOWN=>1,
$::STATUS_FAILED=>1,
$::STATUS_BMCREADY=>1,
$::STATUS_SYNCING=>1,
$::STATUS_OUT_OF_SYNC=>1,
+16 -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;
@@ -1353,6 +1351,16 @@ sub dolitesetup
return 1;
}
# also copy $instrootloc/.statelite contents
$ccmd = "/usr/bin/cp -p -r $instrootloc/.statelite $SRloc";
$out = xCAT::Utils->runcmd("$ccmd", -1);
if ($::RUNCMD_RC != 0)
{
my $rsp;
push @{$rsp->{data}}, "Could not copy $instrootloc/.statelite to $SRloc.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
}
}
+61 -13
View File
@@ -827,7 +827,7 @@ sub get_mac_addr {
$done[0] = 0;
$cmd[0] = "\" local-mac-address\" ". $phandle . " get-package-property\r";
$msg[0] = "Status: return code and mac-address now on stack\n";
$pattern[0] = "ok";#"\s*3 >";
$pattern[0] = "local-mac-address.*ok";#"\s*3 >";
$newstate[0] = 1;
# cmd(1) is a dot (.). This is a stack manipulation command that removes one
@@ -1231,8 +1231,8 @@ sub ping_server{
$done[2] = 0;
$cmd[2] = "dev /packages/net\r";
$msg[2] = "Status: selected the /packages/net node as the active package\n";
#$pattern[2] = ".*dev(.*)ok(.*)0 >(.*)";
$pattern[2] = "ok";
$pattern[2] = ".*dev.*packages.*net(.*)ok(.*)0 >(.*)";
#$pattern[2] = "ok";
$newstate[2]= 3;
# state 3, ping the server
@@ -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 >(.*)";
@@ -1266,6 +1272,7 @@ sub ping_server{
# state 5, all done
$done[5] = 1;
# for ping, only need to set speed and duplex for ethernet adapters
#
if ( $list_type eq "ent" ) {
@@ -1323,8 +1330,10 @@ sub ping_server{
$timeout = 300;
while ( $done[$state] eq 0 ) {
send_command($verbose, $rconsole, $cmd[$state]);
@result = $rconsole->expect(
$timeout,
[qr/$pattern[$state]/s=>
sub {
@@ -1362,7 +1371,9 @@ sub ping_server{
}
],
);
return 1 if ($rc eq 1);
return 1 if ($rc eq 1);
if ( $state eq 1 ) {
$adap_conn = $adap_conn_list[$j];
$cmd[1] = "\" ethernet,$adap_speed,$adap_conn,$adap_duplex\" encode-string \" chosen-network-type\" property\r";
@@ -2050,14 +2061,46 @@ sub multiple_open_dev {
; \r";
send_command($verbose, $rconsole, $command);
$command = "patch new-open-dev open-dev net-ping \r";
send_command($verbose, $rconsole, $command);
$timeout = 30;
$rconsole->expect(
$timeout,
#[qr/patch new-open-dev(.*)>/=>
[qr/>/=>
[qr/new-open-dev(.*)ok/=>
#[qr/>/=>
sub {
nc_msg($verbose, "Status: at End of multiple_open_dev \n");
$rconsole->clear_accum();
}
],
[qr/]/=>
sub {
nc_msg($verbose, "Unexpected prompt\n");
$rconsole->clear_accum();
$rc = 1;
}
],
[timeout =>
sub {
send_user(2, "Timeout\n");
$rconsole->clear_accum();
$rc = 1;
}
],
[eof =>
sub {
send_user(2, "Cannot connect to $node\n");
$rconsole->clear_accum();
$rc = 1;
}
],
);
$command = "patch new-open-dev open-dev net-ping \r";
send_command($verbose, $rconsole, $command);
$rconsole->expect(
$timeout,
[qr/patch new-open-dev(.*)ok/=>
#[qr/>/=>
sub {
nc_msg($verbose, "Status: at End of multiple_open_dev \n");
$rconsole->clear_accum();
@@ -2086,6 +2129,7 @@ sub multiple_open_dev {
}
],
);
return $rc;
}
###################################################################
@@ -2569,7 +2613,7 @@ sub lparnetbootexp
####################################
nc_msg($verbose, "Connecting to the $node.\n");
sleep 3;
$timeout = 2;
$timeout = 10;
$rconsole->expect(
$timeout,
[ qr/Enter.* for help.*/i =>
@@ -2778,6 +2822,8 @@ sub lparnetbootexp
$done = 0;
$retry_count = 0;
$timeout = 10;
while (!$done) {
my @result = $rconsole->expect(
$timeout,
@@ -2885,6 +2931,7 @@ sub lparnetbootexp
}
}
##############################
# Call multiple_open_dev to
# circumvent firmware OPEN-DEV
@@ -2919,6 +2966,7 @@ sub lparnetbootexp
$match_pat = ".*";
}
if($colon) {
nc_msg($verbose, "#Type:Location_Code:MAC_Address:Full_Path_Name:Ping_Result:Device_Type:Size_MB:OS:OS_Version:\n");
$outputarrayindex++; # start from 1, 0 is used to set as 0
@@ -2972,7 +3020,7 @@ sub lparnetbootexp
} else {
for( $i = 0; $i < $adapter_found; $i++) {
if ($adap_type[$i] =~ /$match_pat/) {
if ($adap_type[$i] eq "hfi-ent") {
if (!($adap_type[$i] eq "hfi-ent")) {
$mac_address = get_mac_addr($phandle_array[$i], $rconsole, $node, $verbose);
$loc_code = get_adaptr_loc($phandle_array[$i], $rconsole, $node, $verbose);
}
+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
+1 -1
View File
@@ -149,7 +149,7 @@ sub nodesbycriteria {
}
if ($neednewcache) {
if ($nodelist) {
$nodelist->_clear_cache();
#$nodelist->_clear_cache();
$nodelist->_build_cache(\@cachedcolumns);
}
}
+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;
}
#################################
+71 -1
View File
@@ -265,6 +265,7 @@ sub rackformat_to_numricformat{
values are attributes of a specific nic, like:
type : nic type
hostnamesuffix: hostname suffix
hostnameprefix: hostname prefix
customscript: custom script for this nic
network: network name for this nic
ip: ip address of this nic.
@@ -276,7 +277,7 @@ sub get_nodes_nic_attrs{
my $nodes = shift;
my $nicstab = xCAT::Table->new( 'nics');
my $entry = $nicstab->getNodesAttribs($nodes, ['nictypes', 'nichostnamesuffixes', 'niccustomscripts', 'nicnetworks', 'nicips']);
my $entry = $nicstab->getNodesAttribs($nodes, ['nictypes', 'nichostnamesuffixes', 'nichostnameprefixes', 'niccustomscripts', 'nicnetworks', 'nicips']);
my %nicsattrs;
my @nicattrslist;
@@ -308,6 +309,20 @@ sub get_nodes_nic_attrs{
}
}
if($entry->{$node}->[0]->{'nichostnameprefixes'}){
@nicattrslist = split(",", $entry->{$node}->[0]->{'nichostnameprefixes'});
foreach (@nicattrslist){
my @nicattrs;
if ($_ =~ /!/) {
@nicattrs = split("!", $_);
} else {
@nicattrs = split(":", $_);
}
$nicsattrs{$node}{$nicattrs[0]}{'hostnameprefix'} = $nicattrs[1];
}
}
if($entry->{$node}->[0]->{'niccustomscripts'}){
@nicattrslist = split(",", $entry->{$node}->[0]->{'niccustomscripts'});
foreach (@nicattrslist){
@@ -733,6 +748,27 @@ sub get_imageprofile_prov_method
#-------------------------------------------------------------------------------
=head3 get_imageprofile_prov_osvers
Description : Get A node's provisioning os version and profile from its imageprofile attribute.
Arguments : $imgprofilename - imageprofile name
Returns : node's osversion and profile
=cut
#-------------------------------------------------------------------------------
sub get_imageprofile_prov_osvers
{
my $class = shift;
my $imgprofilename = shift;
my $osimgtab = xCAT::Table->new('osimage');
my $osimgentry = ($osimgtab->getAllAttribsWhere("imagename = '$imgprofilename'", 'ALL' ))[0];
my $osversion = $osimgentry->{'osvers'};
my $profile = $osimgentry->{'profile'};
return ($osversion, $profile);
}
#-------------------------------------------------------------------------------
=head3 check_profile_consistent
Description : Check if three profile consistent
Arguments : $imageprofile - image profile name
@@ -1000,6 +1036,40 @@ sub parse_nodeinfo_file
return 1, "";
}
#-------------------------------------------------------
=head3 update the table prodkey, in order to support windows
per node license key
Returns: $retcode.
$retcode = 1. update failed, the value is undef
$retcode = 0. save into db is OK..
=cut
#-------------------------------------------------------
sub update_windows_prodkey
{
my $class = shift;
my $node = shift;
my $product = shift;
my $key = shift;
unless(defined($node) && defined($product) && defined($key))
{
return 1;
}
# please notice this db usage
my %keyhash;
my %updates;
$keyhash{'node'} = $node;
$updates{'product'} = $product;
$updates{'key'} = $key;
my $tab = xCAT::Table->new('prodkey', -create=>1, -autocommit=>0);
$tab->setAttribs( \%keyhash,\%updates );
$tab->commit;
$tab->close;
return 0;
}
#-------------------------------------------------------------------------------
=head3 check_nicips
Description: Check if the nicips defined in MAC file is correct
+24 -13
View File
@@ -35,7 +35,7 @@ package xCAT::RemoteShellExp;
node.
DSH_TO_USERID - The userid on the node where the ssh keys will be updated.
DSH_ENABLE_SSH - Node to node root passwordless ssh will be setup.
DSH_ZONE_SSHKEYS - directory containing the zones root .ssh keys
Usage: remoteshellexp
[-t node list] test ssh connection to the node
@@ -144,7 +144,7 @@ sub remoteshellexp
} else {
$from_userid="root";
}
# set User on the node where we will send the keys
# set User on the node where we will send the keys
# this id can be a local id as well as root
if ($ENV{'DSH_TO_USERID'}) {
$to_userid=$ENV{'DSH_TO_USERID'};
@@ -154,18 +154,19 @@ sub remoteshellexp
# set User home directory to find the ssh public key to send
# For non-root ids information may not be in /etc/passwd
# but elsewhere like LDAP
if ($ENV{'DSH_FROM_USERID_HOME'}) {
$home=$ENV{'DSH_FROM_USERID_HOME'};
$home=$ENV{'DSH_FROM_USERID_HOME'};
} else {
$home=xCAT::Utils->getHomeDir($from_userid);
$home=xCAT::Utils->getHomeDir($from_userid);
}
# This indicates we will generate new ssh keys for the user,
# if they are not already there
my $key="$home/.ssh/id_rsa";
my $key2="$home/.ssh/id_rsa.pub";
# Check to see if empty
if (-z $key) {
# unless using zones
my $key="$home/.ssh/id_rsa";
my $key2="$home/.ssh/id_rsa.pub";
# Check to see if empty
if (-z $key) {
my $rsp = {};
$rsp->{error}->[0] =
"The $key file is empty. Remove it and rerun the command.";
@@ -183,8 +184,7 @@ sub remoteshellexp
}
if (($flag eq "k") && (!(-e $key)))
{
# if the file size of the id_rsa key is 0, tell them to remove it
# and run the command again
# updating keys and the key file does not exist
$rc=xCAT::RemoteShellExp->gensshkeys($expecttimeout);
}
# send ssh keys to the nodes/devices, to setup passwordless ssh
@@ -200,6 +200,9 @@ sub remoteshellexp
if ($ssh_setup_cmd) { # setup ssh on devices
$rc=xCAT::RemoteShellExp->senddeviceskeys($remoteshell,$remotecopy,$to_userid,$to_user_password,$home,$ssh_setup_cmd,$nodes, $expecttimeout);
} else { #setup ssh on nodes
if ($ENV{'DSH_ZONE_SSHKEYS'}) { # if using zones the override the location of the keys
$home= $ENV{'DSH_ZONE_SSHKEYS'};
}
$rc=xCAT::RemoteShellExp->sendnodeskeys($remoteshell,$remotecopy,$to_userid,$to_user_password,$home,$nodes, $expecttimeout);
}
}
@@ -495,11 +498,15 @@ sub sendnodeskeys
# in $HOME/.ssh/tmp/authorized_keys
# copy to the node to the temp directory
# scp $HOME/.ssh/tmp/authorized_keys to_userid@<node>:/tmp/$to_userid/.ssh
# scp $HOME/.ssh/id_rsa.pub to_userid@<node>:/tmp/$to_userid/.ssh
# Note if using zones, the keys do not come from ~/.ssh but from the
# zone table, sshkeydir attribute. For zones the userid is always root
# If you are going to enable ssh to ssh between nodes, then
# scp $HOME/.ssh/id_rsa to that temp directory on the node
# copy the script $HOME/.ssh/copy.sh to the node, it will do the
# the work of setting up the user's ssh keys and clean up
# ssh (run) copy.sh on the node
my @nodelist=split(/,/,$nodes);
foreach my $node (@nodelist) {
$sendkeys = new Expect;
@@ -607,11 +614,11 @@ sub sendnodeskeys
my $spawncopyfiles;
if ($ENV{'DSH_ENABLE_SSH'}) { # we will enable node to node ssh
$spawncopyfiles=
"$remotecopy $home/.ssh/id_rsa $home/.ssh/copy.sh $home/.ssh/tmp/authorized_keys $to_userid\@$node:/tmp/$to_userid/.ssh ";
"$remotecopy $home/.ssh/id_rsa $home/.ssh/id_rsa.pub $home/.ssh/copy.sh $home/.ssh/tmp/authorized_keys $to_userid\@$node:/tmp/$to_userid/.ssh ";
} else { # no node to node ssh ( don't send private key)
$spawncopyfiles=
"$remotecopy $home/.ssh/copy.sh $home/.ssh/tmp/authorized_keys $to_userid\@$node:/tmp/$to_userid/.ssh ";
"$remotecopy $home/.ssh/id_rsa.pub $home/.ssh/copy.sh $home/.ssh/tmp/authorized_keys $to_userid\@$node:/tmp/$to_userid/.ssh ";
}
# send copy command
unless ($sendkeys->spawn($spawncopyfiles))
@@ -803,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) {
Regular → Executable
+589 -428
View File
File diff suppressed because it is too large Load Diff
Regular → Executable
+353 -117
View File
@@ -134,7 +134,7 @@ litetree => {
table_desc => 'Directory hierarchy to traverse to get the initial contents of node files. The files that are specified in the litefile table are searched for in the directories specified in this table.',
descriptions => {
priority => 'This number controls what order the directories are searched. Directories are searched from smallest priority number to largest.',
image => "The name of the image that will use this directory, as specified in the osimage table. If image is not supplied, the default is 'ALL'. 'ALL' means use it for all images.",
image => "The name of the image (as specified in the osimage table) that will use this directory. You can also specify an image group name that is listed in the osimage.groups attribute of some osimages. 'ALL' means use this row for all images.",
directory => 'The location (hostname:path) of a directory that contains files specified in the litefile table. Variables are allowed. E.g: $noderes.nfsserver://xcatmasternode/install/$node/#CMD=uname-r#/',
mntopts => "A comma-separated list of options to use when mounting the litetree directory. (Ex. 'soft') The default is to do a 'hard' mount.",
comments => 'Any user-written notes.',
@@ -148,7 +148,7 @@ litefile => {
required => [qw(image file)], # default type is rw nfsroot
table_desc => 'The litefile table specifies the directories and files on the statelite nodes that should be readwrite, persistent, or readonly overlay. All other files in the statelite nodes come from the readonly statelite image.',
descriptions => {
image => "The name of the image that will use these files, as specified in the osimage table. 'ALL' means use it for all images.",
image => "The name of the image (as specified in the osimage table) that will use these options on this dir/file. You can also specify an image group name that is listed in the osimage.groups attribute of some osimages. 'ALL' means use this row for all images.",
file => "The full pathname of the file. e.g: /etc/hosts. If the path is a directory, then it should be terminated with a '/'. ",
options => "Options for the file:\n\n".
qq{ tmpfs - It is the default option if you leave the options column blank. It provides a file or directory for the node to use when booting, its permission will be the same as the original version on the server. In most cases, it is read-write; however, on the next statelite boot, the original version of the file or directory on the server will be used, it means it is non-persistent. This option can be performed on files and directories..\n\n}.
@@ -200,7 +200,7 @@ vm => {
'mgr' => 'The function manager for the virtual machine',
'host' => 'The system that currently hosts the VM',
'migrationdest' => 'A noderange representing candidate destinations for migration (i.e. similar systems, same SAN, or other criteria that xCAT can use',
'storage' => 'A list of storage files or devices to be used. i.e. /cluster/vm/<nodename> or nfs://<server>/path/to/folder/',
'storage' => 'A list of storage files or devices to be used. i.e. dir:///cluster/vm/<nodename> or nfs://<server>/path/to/folder/',
'storagemodel' => 'Model of storage devices to provide to guest',
'cfgstore' => 'Optional location for persistant storage separate of emulated hard drives for virtualization solutions that require persistant store to place configuration data',
'memory' => 'Megabytes of memory the VM currently should be set to.',
@@ -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.',
@@ -538,8 +577,8 @@ nodehm => {
table_desc => "Settings that control how each node's hardware is managed. Typically, an additional table that is specific to the hardware type of the node contains additional info. E.g. the ipmi, mp, and ppc tables.",
descriptions => {
node => 'The node name or group name.',
power => 'The method to use to control the power of the node. If not set, the mgt attribute will be used. Valid values: ipmi, blade, hmc, ivm, fsp. If "ipmi", xCAT will search for this node in the ipmi table for more info. If "blade", xCAT will search for this node in the mp table. If "hmc", "ivm", or "fsp", xCAT will search for this node in the ppc table.',
mgt => 'The method to use to do general hardware management of the node. This attribute is used as the default if power or getmac is not set. Valid values: ipmi, blade, hmc, ivm, fsp, bpa. See the power attribute for more details.',
power => 'The method to use to control the power of the node. If not set, the mgt attribute will be used. Valid values: ipmi, blade, hmc, ivm, fsp, kvm, esx, rhevm. If "ipmi", xCAT will search for this node in the ipmi table for more info. If "blade", xCAT will search for this node in the mp table. If "hmc", "ivm", or "fsp", xCAT will search for this node in the ppc table.',
mgt => 'The method to use to do general hardware management of the node. This attribute is used as the default if power or getmac is not set. Valid values: ipmi, blade, hmc, ivm, fsp, bpa, kvm, esx, rhevm. See the power attribute for more details.',
cons => 'The console method. If nodehm.serialport is set, this will default to the nodehm.mgt setting, otherwise it defaults to unused. Valid values: cyclades, mrv, or the values valid for the mgt attribute.',
termserver => 'The hostname of the terminal server.',
termport => 'The port number on the terminal server that this node is connected to.',
@@ -554,7 +593,7 @@ nodehm => {
},
},
nodelist => {
cols => [qw(node groups status statustime appstatus appstatustime primarysn hidden updatestatus updatestatustime comments disable)],
cols => [qw(node groups status statustime appstatus appstatustime primarysn hidden updatestatus updatestatustime zonename comments disable)],
keys => [qw(node)],
tablespace =>'XCATTBS32K',
table_desc => "The list of all the nodes in the cluster, including each node's current status and what groups it is in.",
@@ -569,6 +608,7 @@ nodelist => {
hidden => "Used to hide fsp and bpa definitions, 1 means not show them when running lsdef and nodels",
updatestatus => "The current node update status. Valid states are synced out-of-sync,syncing,failed.",
updatestatustime => "The date and time when the updatestatus was updated.",
zonename => "The name of the zone to which the node is currently assigned. If undefined, then it is not assigned to any zone. ",
comments => 'Any user-written notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
},
@@ -591,14 +631,14 @@ nodepos => {
},
},
noderes => {
cols => [qw(node servicenode netboot tftpserver tftpdir nfsserver monserver nfsdir installnic primarynic discoverynics cmdinterface xcatmaster current_osimage next_osimage nimserver routenames nameservers comments disable)],
cols => [qw(node servicenode netboot tftpserver tftpdir nfsserver monserver nfsdir installnic primarynic discoverynics cmdinterface xcatmaster current_osimage next_osimage nimserver routenames nameservers proxydhcp comments disable)],
keys => [qw(node)],
tablespace =>'XCATTBS16K',
table_desc => 'Resources and settings to use when installing nodes.',
descriptions => {
node => 'The node name or group name.',
servicenode => 'A comma separated list of node names (as known by the management node) that provides most services for this node. The first service node on the list that is accessible will be used. The 2nd node on the list is generally considered to be the backup service node for this node when running commands like snmove.',
netboot => 'The type of network booting to use for this node. Valid values: pxe or xnba for x86* architecture, yaboot for POWER architecture.',
netboot => 'The type of network booting to use for this node. Valid values: pxe or xnba for x86* architecture, yaboot for POWER architecture, grub2 for RHEL7 on Power. Notice: yaboot is not supported from rhels7 on Power,use grub2 instead',
tftpserver => 'The TFTP server for this node (as known by this node). If not set, it defaults to networks.tftpserver.',
tftpdir => 'The directory that roots this nodes contents from a tftp and related perspective. Used for NAS offload by using different mountpoints.',
nfsserver => 'The NFS or HTTP server for this node (as known by this node).',
@@ -614,6 +654,7 @@ noderes => {
nimserver => 'Not used for now. The NIM server for this node (as known by this node).',
routenames => 'A comma separated list of route names that refer to rows in the routes table. These are the routes that should be defined on this node when it is deployed.',
nameservers => 'An optional node/group specific override for name server list. Most people want to stick to site or network defined nameserver configuration.',
proxydhcp => 'To specify whether the node supports proxydhcp protocol. Valid values: yes or 1, no or 0. Default value is yes.',
comments => 'Any user-written notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
},
@@ -706,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',
@@ -725,12 +766,27 @@ 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.",
},
},
winimage => {
cols => [qw(imagename template installto partitionfile winpepath comments disable)],
keys => [qw(imagename)],
tablespace =>'XCATTBS32K',
table_desc => 'Information about a Windows 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 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 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.",
}
},
passwd => {
cols => [qw(key username password cryptmethod authdomain comments disable)],
keys => [qw(key username)],
@@ -820,13 +876,13 @@ ppchcp => {
},
},
servicenode => {
cols => [qw(node nameserver dhcpserver tftpserver nfsserver conserver monserver ldapserver ntpserver ftpserver nimserver ipforward dhcpinterfaces comments disable)],
cols => [qw(node nameserver dhcpserver tftpserver nfsserver conserver monserver ldapserver ntpserver ftpserver nimserver ipforward dhcpinterfaces proxydhcp comments disable)],
keys => [qw(node)],
tablespace =>'XCATTBS16K',
table_desc => 'List of all Service Nodes and services that will be set up on the Service Node.',
descriptions => {
node => 'The hostname of the service node as known by the Management Node.',
nameserver => 'Do we set up DNS on this service node? Valid values:yes or 1, no or 0. If yes, creates named.conf file with forwarding to the management node and starts named. If no or 0, it does not change the current state of the service. ',
nameserver => 'Do we set up DNS on this service node? Valid values: 2, 1, no or 0. If 2, creates named.conf as dns slave, using the management node as dns master, and starts named. If 1, creates named.conf file with forwarding to the management node and starts named. If no or 0, it does not change the current state of the service. ',
dhcpserver => 'Do we set up DHCP on this service node? Not supported on AIX. Valid values:yes or 1, no or 0. If yes, runs makedhcp -n. If no or 0, it does not change the current state of the service. ',
tftpserver => 'Do we set up TFTP on this service node? Not supported on AIX. Valid values:yes or 1, no or 0. If yes, configures and starts atftp. If no or 0, it does not change the current state of the service. ',
nfsserver => 'Do we set up file services (HTTP,FTP,or NFS) on this service node? For AIX will only setup NFS, not HTTP or FTP. Valid values:yes or 1, no or 0.If no or 0, it does not change the current state of the service. ',
@@ -838,6 +894,7 @@ servicenode => {
nimserver => 'Not used. Do we set up a NIM server on this service node? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.',
ipforward => 'Do we set up ip forwarding on this service node? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.',
dhcpinterfaces => 'The network interfaces DHCP server should listen on for the target node. This attribute can be used for management node and service nodes. If defined, it will override the values defined in site.dhcpinterfaces. This is a comma separated list of device names. !remote! indicates a non-local network for relay DHCP. For example: !remote!,eth0,eth1',
proxydhcp => 'Do we set up proxydhcp service on this node? valid values: yes or 1, no or 0. If yes, the proxydhcp daemon will be enabled on this node.',
comments => 'Any user-written notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
@@ -846,35 +903,44 @@ servicenode => {
site => {
cols => [qw(key value comments disable)],
keys => [qw(key)],
table_desc => "Global settings for the whole cluster. This table is different from the \nother tables in that each attribute is just named in the key column, rather \nthan having a separate column for each attribute. The following is a list of \nthe attributes currently used by xCAT.\n",
table_desc => "Global settings for the whole cluster. This table is different from the \nother tables in that each attribute is just named in the key column, rather \nthan having a separate column for each attribute. The following is a list of \nattributes currently used by xCAT organized into categories.\n",
descriptions => {
# Do not put description text past column 88, so it displays well in a 100 char wide window.
# ----------------------------------------------------------------------------------|----------
key => "Attribute Name: Description\n\n".
" auditskipcmds: List of commands and/or client types that will not be written to the auditlog table.\n".
" ------------\n".
"AIX ATTRIBUTES\n".
" ------------\n".
" nimprime : The name of NIM server, if not set default is the AIX MN.
If Linux MN, then must be set for support of mixed cluster (TBD).\n\n".
" useSSHonAIX: (yes/1 or no/0). Default is yes. The support for rsh/rcp is deprecated.\n".
" useNFSv4onAIX: (yes/1 or no/0). If yes, NFSv4 will be used with NIM. If no,\n".
" NFSv3 will be used with NIM. Default is no.\n\n".
" -----------------\n".
"DATABASE ATTRIBUTES\n".
" -----------------\n".
" auditskipcmds: List of commands and/or client types that will not be\n".
" written to the auditlog table.\n".
" 'ALL' means all cmds will be skipped. If attribute is null, all\n".
" commands will be written.\n".
" clienttype:web would skip all commands from the web client\n".
" For example: tabdump,nodels,clienttype:web \n".
" will not log tabdump,nodels and any web client commands.\n\n".
" blademaxp: The maximum number of concurrent processes for blade hardware control.\n\n".
" cleanupxcatpost: (yes/1 or no/0). Set to 'yes' or '1' to clean up the /xcatpost\n".
" directory on the stateless and statelite nodes after the\n".
" postscripts are run. Default is no.\n\n".
" consoleondemand: When set to 'yes', conserver connects and creates the console\n".
" output only when the user opens the console. Default is no on\n".
" Linux, yes on AIX.\n\n".
" databaseloc: Directory where we create the db instance directory.\n".
" Default is /var/lib. Only DB2 is currently supported.\n".
" Do not use the directory in the site.installloc or\n".
" installdir attribute. This attribute must not be changed\n".
" once db2sqlsetup script has been run and DB2 has been setup.\n\n".
" db2installloc: The location which the service nodes should mount for\n".
" the db2 code to install. Format is hostname:/path. If hostname is\n".
" omitted, it defaults to the management node. Default is /mntdb2.\n\n".
" defserialflow: The default serial flow - currently only used by the mknb command.\n\n".
" defserialport: The default serial port - currently only used by mknb.\n\n".
" defserialspeed: The default serial speed - currently only used by mknb.\n\n".
" excludenodes: A set of comma separated nodes and/or groups that would automatically\n".
" be subtracted from any noderange, it can be used for excluding some\n".
" failed nodes for any xCAT commands. See the 'noderange' manpage for\n".
" details on supported formats.\n\n".
" nodestatus: If set to 'n', the nodelist.status column will not be updated during\n".
" the node deployment, node discovery and power operations. The default is to update.\n\n".
" skiptables: Comma separated list of tables to be skipped by dumpxCATdb\n\n".
" -------------\n".
"DHCP ATTRIBUTES\n".
" -------------\n".
" dhcpinterfaces: The network interfaces DHCP should listen on. If it is the same\n".
" for all nodes, use a simple comma-separated list of NICs. To\n".
" specify different NICs for different nodes:\n".
@@ -887,59 +953,24 @@ site => {
" disjointdhcps: If set to '1', the .leases file on a service node only contains\n".
" the nodes it manages. The default value is '0'.\n".
" '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".
" dnshandler: Name of plugin that handles DNS setup for makedns.\n".
" domain: The DNS domain name used for the cluster.\n\n".
" ea_primary_hmc: The hostname of the HMC that the Integrated Switch Network\n".
" Management Event Analysis should send hardware serviceable\n".
" events to for processing and potentially sending to IBM.\n\n".
" ea_backup_hmc: The hostname of the HMC that the Integrated Switch Network\n".
" Management Event Analysis should send hardware serviceable\n".
" events to if the primary HMC is down.\n\n".
" enableASMI: (yes/1 or no/0). If yes, ASMI method will be used after fsp-api. If no,\n".
" when fsp-api is used, ASMI method will not be used. Default is no.\n\n".
" excludenodes: A set of comma separated nodes and/or groups that would automatically\n".
" be subtracted from any noderange, it can be used for excluding some\n".
" failed nodes for any xCAT commands. See the 'noderange' manpage for\n".
" details on supported formats.\n\n".
" forwarders: The DNS servers at your site that can provide names outside of the\n".
" cluster. The makedns command will configure the DNS on the management\n".
" node to forward requests it does not know to these servers.\n".
" Note that the DNS servers on the service nodes will ignore this value\n".
" and always be configured to forward requests to the management node.\n\n".
" fsptimeout: The timeout, in milliseconds, to use when communicating with FSPs.\n\n".
" genmacprefix: When generating mac addresses automatically, use this manufacturing\n".
" prefix (e.g. 00:11:aa)\n\n".
" genpasswords: Automatically generate random passwords for BMCs when configuring\n".
" them.\n\n".
" httpport: The port number that the booting/installing nodes should contact the\n".
" http server on the MN/SN on. It is your responsibility to configure\n".
" the http server to listen on that port - xCAT will not do that.\n\n".
" installdir: The local directory name used to hold the node deployment packages.\n\n".
" installloc: The location from which the service nodes should mount the \n".
" deployment packages in the format hostname:/path. If hostname is\n".
" omitted, it defaults to the management node. The path must\n".
" match the path in the installdir attribute.\n\n".
" ipmidispatch: Whether or not to send ipmi hw control operations to the service\n".
" node of the target compute nodes. Default is 'y'.\n\n".
" hwctrldispatch: Whether or not to send hw control operations to the service\n".
" node of the target nodes. Default is 'y'.(At present, this attribute\n".
" is only used for IBM Flex System)\n\n".
" ipmimaxp: The max # of processes for ipmi hw ctrl. The default is 64. Currently,\n".
" this is only used for HP hw control.\n\n".
" ipmiretries: The # of retries to use when communicating with BMCs. Default is 3.\n\n".
" ipmisdrcache: If set to 'no', then the xCAT IPMI support will not cache locally\n".
" the target node's SDR cache to improve performance.\n\n".
" ipmitimeout: The timeout to use when communicating with BMCs. Default is 2.\n".
" This attribute is currently not used.\n\n".
" iscsidir: The path to put the iscsi disks in on the mgmt node.\n\n".
" master: The hostname of the xCAT management node, as known by the nodes.\n\n".
" maxssh: The max # of SSH connections at any one time to the hw ctrl point for PPC\n".
" This parameter doesn't take effect on the rpower command.\n".
" It takes effects on other PPC hardware control command\n".
" getmacs/rnetboot/rbootseq and so on. Default is 8.\n\n".
" mnroutenames: The name of the routes to be setup on the management node.\n".
" It is a comma separated list of route names that are defined in the\n".
" routes table.\n\n".
" nameservers: A comma delimited list of DNS servers that each node in the cluster\n".
" should use. This value will end up in the nameserver settings of the\n".
" /etc/resolv.conf on each node. It is common (but not required) to set\n".
@@ -949,18 +980,41 @@ 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".
" nimprime : The name of NIM server, if not set default is the AIX MN.
If Linux MN, then must be set for support of mixed cluster (TBD).\n\n".
" nodestatus: If set to 'n', the nodelist.status column will not be updated during\n".
" the node deployment, node discovery and power operations. The default is to update.\n\n".
" ntpservers: A comma delimited list of NTP servers for the cluster - often the\n".
" xCAT management node.\n\n".
" runbootscripts: If set to 'yes' the scripts listed in the postbootscripts\n".
" attribute in the osimage and postscripts tables will be run during\n".
" each reboot of stateful (diskful) nodes. This attribute has no\n".
" effect on stateless and statelite nodes. Please run the following\n" .
" command after you change the value of this attribute: \n".
" 'updatenode <nodes> -P setuppostbootscripts'\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".
" blademaxp: The maximum number of concurrent processes for blade hardware control.\n\n".
" ea_primary_hmc: The hostname of the HMC that the Integrated Switch Network\n".
" Management Event Analysis should send hardware serviceable\n".
" events to for processing and potentially sending to IBM.\n\n".
" ea_backup_hmc: The hostname of the HMC that the Integrated Switch Network\n".
" Management Event Analysis should send hardware serviceable\n".
" events to if the primary HMC is down.\n\n".
" enableASMI: (yes/1 or no/0). If yes, ASMI method will be used after fsp-api. If no,\n".
" when fsp-api is used, ASMI method will not be used. Default is no.\n\n".
" fsptimeout: The timeout, in milliseconds, to use when communicating with FSPs.\n\n".
" hwctrldispatch: Whether or not to send hw control operations to the service\n".
" node of the target nodes. Default is 'y'.(At present, this attribute\n".
" is only used for IBM Flex System)\n\n".
" ipmidispatch: Whether or not to send ipmi hw control operations to the service\n".
" node of the target compute nodes. Default is 'y'.\n\n".
" ipmimaxp: The max # of processes for ipmi hw ctrl. The default is 64. Currently,\n".
" this is only used for HP hw control.\n\n".
" ipmiretries: The # of retries to use when communicating with BMCs. Default is 3.\n\n".
" ipmisdrcache: If set to 'no', then the xCAT IPMI support will not cache locally\n".
" the target node's SDR cache to improve performance.\n\n".
" ipmitimeout: The timeout to use when communicating with BMCs. Default is 2.\n".
" This attribute is currently not used.\n\n".
" maxssh: The max # of SSH connections at any one time to the hw ctrl point for PPC\n".
" This parameter doesn't take effect on the rpower command.\n".
" It takes effects on other PPC hardware control command\n".
" getmacs/rnetboot/rbootseq and so on. Default is 8.\n\n".
" syspowerinterval: For system p CECs, this is the number of seconds the rpower\n".
" command will wait between performing the action for each CEC.\n".
" For system x IPMI servers, this is the number of seconds the\n".
@@ -987,15 +1041,45 @@ site => {
" ppctimeout: The timeout, in milliseconds, to use when communicating with PPC hw\n".
" through HMC. It only takes effect on the hardware control commands\n".
" through HMC. Default is 0.\n\n".
" snmpc: The snmp community string that xcat should use when communicating with the\n".
" switches.\n\n".
" ---------------------------\n".
"INSTALL/DEPLOYMENT ATTRIBUTES\n".
" ---------------------------\n".
" cleanupxcatpost: (yes/1 or no/0). Set to 'yes' or '1' to clean up the /xcatpost\n".
" directory on the stateless and statelite nodes after the\n".
" postscripts are run. Default is no.\n\n".
" db2installloc: The location which the service nodes should mount for\n".
" the db2 code to install. Format is hostname:/path. If hostname is\n".
" omitted, it defaults to the management node. Default is /mntdb2.\n\n".
" defserialflow: The default serial flow - currently only used by the mknb command.\n\n".
" defserialport: The default serial port - currently only used by mknb.\n\n".
" defserialspeed: The default serial speed - currently only used by mknb.\n\n".
" genmacprefix: When generating mac addresses automatically, use this manufacturing\n".
" prefix (e.g. 00:11:aa)\n\n".
" genpasswords: Automatically generate random passwords for BMCs when configuring\n".
" them.\n\n".
" installdir: The local directory name used to hold the node deployment packages.\n\n".
" installloc: The location from which the service nodes should mount the \n".
" deployment packages in the format hostname:/path. If hostname is\n".
" omitted, it defaults to the management node. The path must\n".
" match the path in the installdir attribute.\n\n".
" iscsidir: The path to put the iscsi disks in on the mgmt node.\n\n".
" mnroutenames: The name of the routes to be setup on the management node.\n".
" It is a comma separated list of route names that are defined in the\n".
" routes table.\n\n".
" runbootscripts: If set to 'yes' the scripts listed in the postbootscripts\n".
" attribute in the osimage and postscripts tables will be run during\n".
" each reboot of stateful (diskful) nodes. This attribute has no\n".
" effect on stateless and statelite nodes. Please run the following\n" .
" command after you change the value of this attribute: \n".
" 'updatenode <nodes> -P setuppostbootscripts'\n\n".
" precreatemypostscripts: (yes/1 or no/0). Default is no. If yes, it will \n".
" instruct xCAT at nodeset and updatenode time to query the db once for\n".
" all of the nodes passed into the cmd and create the mypostscript file\n".
" for each node, and put them in a directory of tftpdir(such as: /tftpboot)\n".
" If no, it will not generate the mypostscript file in the tftpdir.\n\n".
" pruneservices: Whether to enable service pruning when noderm is run (i.e.\n".
" removing DHCP entries when noderm is executed)\n\n".
" rsh: This is no longer used. path to remote shell command for xdsh.\n\n".
" rcp: This is no longer used. path to remote copy command for xdcp.\n\n".
" setinstallnic: Set the network configuration for installnic to be static.\n\n".
" sharedtftp: Set to 0 or no, xCAT should not assume the directory\n".
" in tftpdir is mounted on all on Service Nodes. Default is 1/yes.\n".
" If value is set to a hostname, the directory in tftpdir\n".
@@ -1006,18 +1090,31 @@ site => {
" shared filesystem is being used across all service nodes.\n".
" 'all' means that the management as well as the service nodes\n".
" are all using a common shared filesystem. The default is 'no'.\n".
" skiptables: Comma separated list of tables to be skipped by dumpxCATdb\n".
" xcatconfdir: Where xCAT config data is (default /etc/xcat).\n\n".
" --------------------\n".
"REMOTESHELL ATTRIBUTES\n".
" --------------------\n".
" nodesyncfiledir: The directory on the node, where xdcp will rsync the files\n".
" SNsyncfiledir: The directory on the Service Node, where xdcp will rsync the files\n".
" from the MN that will eventually be rsync'd to the compute nodes.\n\n".
" nodesyncfiledir: The directory on the node, where xdcp will rsync the files\n".
" snmpc: The snmp community string that xcat should use when communicating with the\n".
" switches.\n\n".
" sshbetweennodes: Comma separated list of groups to enable passwordless root \n".
" sshbetweennodes: Comma separated list of groups of compute nodes to enable passwordless root \n".
" ssh during install, or xdsh -K. Default is ALLGROUPS.\n".
" Set to NOGROUPS,if you do not wish to enabled any groups.\n".
" Set to NOGROUPS,if you do not wish to enabled any group of compute nodes.\n".
" Service Nodes are not affected by this attribute\n".
" they are always setup with\n".
" passwordless root access to nodes and other SN.\n\n".
" passwordless root access to nodes and other SN.\n".
" If using the zone table, this attribute in not used.\n\n".
" -----------------\n".
"SERVICES ATTRIBUTES\n".
" -----------------\n".
" consoleondemand: When set to 'yes', conserver connects and creates the console\n".
" output only when the user opens the console. Default is no on\n".
" Linux, yes on AIX.\n\n".
" httpport: The port number that the booting/installing nodes should contact the\n".
" http server on the MN/SN on. It is your responsibility to configure\n".
" the http server to listen on that port - xCAT will not do that.\n\n".
" ntpservers: A comma delimited list of NTP servers for the cluster - often the\n".
" xCAT management node.\n\n".
" svloglocal: if set to 1, syslog on the service node will not get forwarded to the\n".
" mgmt node.\n\n".
" timezone: (e.g. America/New_York)\n\n".
@@ -1027,11 +1124,30 @@ site => {
" useNmapfromMN: When set to yes, nodestat command should obtain the node status\n".
" using nmap (if available) from the management node instead of the\n".
" service node. This will improve the performance in a flat network.\n\n".
" useSSHonAIX: (yes/1 or no/0). If yes, ssh/scp will be setup and used. If no, rsh/rcp. The support for rsh/rcp is deprecated.\n".
" vsftp: Default is 'n'. If set to 'y', the xcatd on the mn will automatically\n".
" bring up vsftpd. (You must manually install vsftpd before this.\n".
" This setting does not apply to the service node. For sn\n".
" you need to set servicenode.ftpserver=1 if you want xcatd to\n".
" bring up vsftpd.\n\n".
" -----------------------\n".
"VIRTUALIZATION ATTRIBUTES\n".
" -----------------------\n".
" usexhrm: Have xCAT run its xHRM script when booting up KVM guests to set the\n".
" virtual network bridge up correctly. See\n".
" https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_Virtualization_with_KVM#Setting_up_a_network_bridge\n\n".
" rsh/rcp will be setup and used on AIX. Default is yes.\n\n".
" vcenterautojoin: When set to no, the VMWare plugin will not attempt to auto remove\n".
" and add hypervisors while trying to perform operations. If users\n".
" or tasks outside of xCAT perform the joining this assures xCAT\n".
" 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".
" useflowcontrol: (yes/1 or no/0). If yes, the postscript processing on each node\n".
" contacts xcatd on the MN/SN using a lightweight UDP packet to wait\n".
" until xcatd is ready to handle the requests associated with\n".
@@ -1042,28 +1158,14 @@ site => {
" xcatd, and retry. On a new install of xcat, this value will be set to yes.\n".
" See the following document for details:\n".
" https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Hints_and_Tips_for_Large_Scale_Clusters\n\n".
" useNFSv4onAIX: (yes/1 or no/0). If yes, NFSv4 will be used with NIM. If no,\n".
" NFSv3 will be used with NIM. Default is no.\n\n".
" vcenterautojoin: When set to no, the VMWare plugin will not attempt to auto remove\n".
" and add hypervisors while trying to perform operations. If users\n".
" or tasks outside of xCAT perform the joining this assures xCAT\n".
" 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".
" vsftp: Default is 'n'. If set to 'y', the xcatd on the mn will automatically\n".
" bring up vsftpd. (You must manually install vsftpd before this.\n".
" This setting does not apply to the service node. For sn\n".
" you need to set servicenode.ftpserver=1 if you want xcatd to\n".
" bring up vsftpd.\n\n".
" xcatconfdir: Where xCAT config data is (default /etc/xcat).\n\n".
" xcatmaxconnections: Number of concurrent xCAT protocol requests before requests\n".
" begin queueing. This applies to both client command requests\n".
" and node requests, e.g. to get postscripts. Default is 64.\n\n".
" xcatmaxbatchconnections: Number of concurrent xCAT connections allowed from the nodes.\n".
" Value must be less than xcatmaxconnections. Default is 50.\n\n".
" xcatdport: The port used by the xcatd daemon for client/server communication.\n\n".
" xcatiport: The port used by xcatd to receive install status updates from nodes.\n\n",
" xcatsslversion: The ssl version by xcatd. Default is SSLv3.\n\n",
" xcatiport: The port used by xcatd to receive install status updates from nodes.\n\n".
" xcatsslversion: The ssl version by xcatd. Default is SSLv3.\n\n".
" xcatsslciphers: The ssl cipher by xcatd. Default is 3DES.\n\n",
value => 'The value of the attribute specified in the "key" column.',
comments => 'Any user-written notes.',
@@ -1143,6 +1245,19 @@ performance => {
disable => "Set to 'yes' or '1' to comment out this row.",
},
},
zone => {
cols => [qw(zonename sshkeydir sshbetweennodes defaultzone comments disable)],
keys => [qw(zonename)],
table_desc => 'Defines a cluster zone for nodes that share root ssh key access to each other.',
descriptions => {
zonename => 'The name of the zone.',
sshkeydir => 'Directory containing the shared root ssh RSA keys.',
sshbetweennodes => 'Indicates whether passwordless ssh will be setup between the nodes of this zone. Values are yes/1 or no/0. Default is yes. ',
defaultzone => 'If nodes are not assigned to any other zone, they will default to this zone. If value is set to yes or 1.',
comments => 'Any user-provided notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
},
},
eventlog => {
cols => [qw(recid eventtime eventtype monitor monnode node application component id severity message rawdata comments disable)],
@@ -1279,7 +1394,7 @@ firmware => {
},
nics => {
cols => [qw(node nicips nichostnamesuffixes nictypes niccustomscripts nicnetworks nicaliases comments disable)],
cols => [qw(node nicips nichostnamesuffixes nichostnameprefixes nictypes niccustomscripts nicnetworks nicaliases comments disable)],
keys => [qw(node)],
tablespace =>'XCATTBS16K',
table_desc => 'Stores NIC details.',
@@ -1297,6 +1412,13 @@ nics => {
<nic1>!<ext1>|<ext2>,<nic2>!<ext1>|<ext2>,..., for example, eth0!-eth0|-eth0-ipv6,ib0!-ib0|-ib0-ipv6.
The xCAT object definition commands support to use nichostnamesuffixes.<nicname> as the sub attributes.
Note: According to DNS rules a hostname must be a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus sign (-),and period (.). When you are specifying "nichostnamesuffixes" or "nicaliases" make sure the resulting hostnames will conform to this naming convention',
nichostnameprefixes => 'Comma-separated list of hostname prefixes per NIC.
If only one ip address is associated with each NIC:
<nic1>!<ext1>,<nic2>!<ext2>,..., for example, eth0!eth0-,ib0!ib-
If multiple ip addresses are associcated with each NIC:
<nic1>!<ext1>|<ext2>,<nic2>!<ext1>|<ext2>,..., for example, eth0!eth0-|eth0-ipv6i-,ib0!ib-|ib-ipv6-.
The xCAT object definition commands support to use nichostnameprefixes.<nicname> as the sub attributes.
Note: According to DNS rules a hostname must be a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus sign (-),and period (.). When you are specifying "nichostnameprefixes" or "nicaliases" make sure the resulting hostnames will conform to this naming convention',
nictypes => 'Comma-separated list of NIC types per NIC. <nic1>!<type1>,<nic2>!<type2>, e.g. eth0!Ethernet,ib0!Infiniband. The xCAT object definition commands support to use nictypes.<nicname> as the sub attributes.',
niccustomscripts => 'Comma-separated list of custom scripts per NIC. <nic1>!<script1>,<nic2>!<script2>, e.g. eth0!configeth eth0, ib0!configib ib0. The xCAT object definition commands support to use niccustomscripts.<nicname> as the sub attribute
.',
@@ -1481,8 +1603,32 @@ mic => {
disable => "Do not use. tabprune will not work if set to yes or 1",
},
},
hwinv => {
cols => [qw(node cputype cpucount memory disksize comments disable)],
keys => [qw(node)],
table_desc => 'The hardware inventory for the node.',
descriptions => {
node => 'The node name or group name.',
cputype => 'The cpu model name for the node.',
cpucount => 'The number of cpus for the node.',
memory => 'The size of the memory for the node in MB.',
disksize => 'The size of the disks for the node in GB.',
comments => 'Any user-provided notes.',
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
@@ -1560,6 +1706,7 @@ foreach my $tabname (keys(%xCAT::ExtTab::ext_tabspec)) {
rack => { attrs => [], attrhash => {}, objkey => 'rackname' },
osdistro=> { attrs => [], attrhash => {}, objkey => 'osdistroname' },
osdistroupdate=> { attrs => [], attrhash => {}, objkey => 'osupdatename' },
zone=> { attrs => [], attrhash => {}, objkey => 'zonename' },
);
@@ -1628,6 +1775,11 @@ my @nodeattrs = (
tabentry => 'noderes.monserver',
access_tabentry => 'noderes.node=attr:node',
},
{attr_name => 'supportproxydhcp',
tabentry => 'noderes.proxydhcp',
access_tabentry => 'noderes.node=attr:node',
},
{attr_name => 'kernel',
tabentry => 'bootparams.kernel',
access_tabentry => 'bootparams.node=attr:node',
@@ -1696,6 +1848,10 @@ my @nodeattrs = (
{attr_name => 'setupipforward',
tabentry => 'servicenode.ipforward',
access_tabentry => 'servicenode.node=attr:node',
},
{attr_name => 'setupproxydhcp',
tabentry => 'servicenode.proxydhcp',
access_tabentry => 'servicenode.node=attr:node',
},
# - moserver not used yet
# {attr_name => 'setupmonserver',
@@ -2177,6 +2333,10 @@ my @nodeattrs = (
tabentry => 'nics.nichostnamesuffixes',
access_tabentry => 'nics.node=attr:node',
},
{attr_name => 'nichostnameprefixes',
tabentry => 'nics.nichostnameprefixes',
access_tabentry => 'nics.node=attr:node',
},
{attr_name => 'nictypes',
tabentry => 'nics.nictypes',
access_tabentry => 'nics.node=attr:node',
@@ -2452,6 +2612,25 @@ my @nodeattrs = (
tabentry => 'mic.powermgt',
access_tabentry => 'mic.node=attr:node',
},
#####################
## hwinv table #
#####################
{attr_name => 'cputype',
tabentry => 'hwinv.cputype',
access_tabentry => 'hwinv.node=attr:node',
},
{attr_name => 'cpucount',
tabentry => 'hwinv.cpucount',
access_tabentry => 'hwinv.node=attr:node',
},
{attr_name => 'memory',
tabentry => 'hwinv.memory',
access_tabentry => 'hwinv.node=attr:node',
},
{attr_name => 'disksize',
tabentry => 'hwinv.disksize',
access_tabentry => 'hwinv.node=attr:node',
},
); # end of @nodeattrs that applies to both nodes and groups
@@ -2502,6 +2681,10 @@ my @nodeattrs = (
{attr_name => 'updatestatustime',
tabentry => 'nodelist.updatestatustime',
access_tabentry => 'nodelist.node=attr:node',
},
{attr_name => 'zonename',
tabentry => 'nodelist.zonename',
access_tabentry => 'nodelist.node=attr:node',
},
{attr_name => 'usercomment',
tabentry => 'nodelist.comments',
@@ -2707,6 +2890,29 @@ push(@{$defspec{node}->{'attrs'}}, @nodeattrs);
access_tabentry => 'linuximage.imagename=attr:imagename',
},
####################
# winimage table#
####################
{attr_name => 'template',
only_if => 'imagetype=windows',
tabentry => 'winimage.template',
access_tabentry => 'winimage.imagename=attr:imagename',
},
{attr_name => 'installto',
only_if => 'imagetype=windows',
tabentry => 'winimage.installto',
access_tabentry => 'winimage.imagename=attr:imagename',
},
{attr_name => 'partitionfile',
only_if => 'imagetype=windows',
tabentry => 'winimage.partitionfile',
access_tabentry => 'winimage.imagename=attr:imagename',
},
{attr_name => 'winpepath',
only_if => 'imagetype=windows',
tabentry => 'winimage.winpepath',
access_tabentry => 'winimage.imagename=attr:imagename',
},
####################
# nimimage table#
####################
{attr_name => 'nimtype',
@@ -2933,6 +3139,36 @@ push(@{$defspec{node}->{'attrs'}}, @nodeattrs);
access_tabentry => 'rack.rackname=attr:rackname',
},
);
####################
# zone table #
####################
@{$defspec{zone}->{'attrs'}} = (
{attr_name => 'zonename',
tabentry => 'zone.zonename',
access_tabentry => 'zone.zonename=attr:zonename',
},
{attr_name => 'sshkeydir',
tabentry => 'zone.sshkeydir',
access_tabentry => 'zone.zonename=attr:zonename',
},
{attr_name => 'sshbetweennodes',
tabentry => 'zone.sshbetweennodes',
access_tabentry => 'zone.zonename=attr:zonename',
},
{attr_name => 'defaultzone',
tabentry => 'zone.defaultzone',
access_tabentry => 'zone.zonename=attr:zonename',
},
{attr_name => 'usercomment',
tabentry => 'zone.comments',
access_tabentry => 'zone.zonename=attr:zonename',
},
);
#########################
# route data object #
#########################
# routes table #
#########################
#########################
# route data object #
#########################
+2
View File
@@ -163,6 +163,8 @@ sub isServiceReq
if (($value eq "1") || ($value eq "YES"))
{
$servicehash->{$service} = "1";
} elsif ($value eq "2") {
$servicehash->{$service} = "2";
} else {
$servicehash->{$service} = "0";
}
Regular → Executable
+325 -44
View File
@@ -19,6 +19,7 @@ if ($^O =~ /^aix/i) {
use lib "$::XCATROOT/lib/perl";
use strict;
require xCAT::Table;
require xCAT::Zone;
use File::Path;
#-----------------------------------------------------------------------
@@ -271,7 +272,7 @@ sub bldnonrootSSHFiles
Error:
0=good, 1=error
Example:
xCAT::TableUtils->setupSSH(@target_nodes);
xCAT::TableUtils->setupSSH(@target_nodes,$expecttimeout);
Comments:
Does not setup known_hosts. Assumes automatically
setup by SSH ( ssh config option StrictHostKeyChecking no should
@@ -335,21 +336,21 @@ sub setupSSH
$::REMOTE_SHELL = "/usr/bin/ssh";
my $rsp = {};
# Get the home directory
my $home = xCAT::Utils->getHomeDir($from_userid);
$ENV{'DSH_FROM_USERID_HOME'} = $home;
if ($from_userid eq "root")
{
# make the directory to hold keys to transfer to the nodes
if (!-d $SSHdir)
{
mkpath("$SSHdir", { mode => 0755 });
}
# generates new keys for root, if they do not already exist
# generates new keys for root, if they do not already exist ~/.ssh
# nodes not used on this option but in there to preserve the interface
my $rc=
xCAT::RemoteShellExp->remoteshellexp("k",$::CALLBACK,$::REMOTE_SHELL,$n_str,$expecttimeout);
@@ -374,7 +375,10 @@ else
fi
mkdir -p \$dest_dir
cat /tmp/$to_userid/.ssh/authorized_keys >> \$home/.ssh/authorized_keys 2>&1
cat /tmp/$to_userid/.ssh/id_rsa.pub >> \$home/.ssh/authorized_keys 2>&1
rm -f \$home/.ssh/id_rsa 2>&1
cp /tmp/$to_userid/.ssh/id_rsa \$home/.ssh/id_rsa 2>&1
cp /tmp/$to_userid/.ssh/id_rsa.pub \$home/.ssh/id_rsa.pub 2>&1
chmod 0600 \$home/.ssh/id_* 2>&1
rm -f /tmp/$to_userid/.ssh/* 2>&1
rmdir \"/tmp/$to_userid/.ssh\"
@@ -386,6 +390,7 @@ rmdir \"/tmp/$to_userid\" \n";
my $auth_key2=0;
if ($from_userid eq "root")
{
# this will put the root/.ssh/id_rsa.pub key in the authorized keys file to put on the node
my $rc = xCAT::TableUtils->cpSSHFiles($SSHdir);
if ($rc != 0)
{ # error
@@ -418,50 +423,46 @@ rmdir \"/tmp/$to_userid\" \n";
xCAT::TableUtils->bldnonrootSSHFiles($from_userid);
}
# send the keys to the nodes for root or some other id
#
# This environment variable determines whether to setup
# node to node ssh
# The nodes must be checked against the site.sshbetweennodes attribute
# send the keys
# For root user and not to devices only to nodes
if (($from_userid eq "root") && (!($ENV{'DEVICETYPE'}))) {
my $enablenodes;
my $disablenodes;
my @nodelist= split(",", $n_str);
foreach my $n (@nodelist)
# Need to check if nodes are in a zone.
my @zones;
my $tab = xCAT::Table->new("zone");
if ($tab)
{
my $enablessh=xCAT::TableUtils->enablessh($n);
if ($enablessh == 1) {
$enablenodes .= $n;
$enablenodes .= ",";
} else {
$disablenodes .= $n;
$disablenodes .= ",";
# if we have zones, need to send the zone keys to each node in the zone
my @attribs = ("zonename");
@zones = $tab->getAllAttribs(@attribs);
$tab->close();
} else {
$rsp->{data}->[0] = "Could not open zone table.\n";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
return 1;
}
# check for zones, key send is different if zones defined or not
if (@zones) { # we have zones defined
my $rc = xCAT::TableUtils->sendkeysTOzones($ref_nodes,$expecttimeout);
if ($rc != 0)
{
$rsp->{data}->[0] = "Error sending ssh keys to the zones.\n";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
exit 1;
}
}
my $cmd;
if ($enablenodes) { # node on list to setup nodetonodessh
chop $enablenodes; # remove last comma
$ENV{'DSH_ENABLE_SSH'} = "YES";
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$enablenodes,$expecttimeout);
} else { # no zones
# if no zone table defined, do it the old way , keys are in ~/.ssh
my $rc = xCAT::TableUtils->sendkeysNOzones($ref_nodes,$expecttimeout);
if ($rc != 0)
{
$rsp->{data}->[0] = "remoteshellexp failed sending keys to enablenodes.";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
}
}
if ($disablenodes) { # node on list to setup nodetonodessh
chop $disablenodes; # remove last comma
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$disablenodes,$expecttimeout);
if ($rc != 0)
{
$rsp->{data}->[0] = "remoteshellexp failed sending keys to disablenodes.";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
{
$rsp->{data}->[0] = "Error sending ssh keys to the nodes.\n";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
}
}
} else { # from user is not root or it is a device , always send private key
$ENV{'DSH_ENABLE_SSH'} = "YES";
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$n_str,$expecttimeout);
@@ -503,6 +504,235 @@ rmdir \"/tmp/$to_userid\" \n";
#--------------------------------------------------------------------------------
=head3 sendkeysNOzones
Transfers the ssh keys
for the root id on the nodes no zones
key from ~/.ssh site.sshbetweennodes honored
Arguments:
Array of nodes
Timeout for expect call (optional)
Returns:
Env Variables: $DSH_FROM_USERID, $DSH_TO_USERID, $DSH_REMOTE_PASSWORD
the ssh keys are transferred from the $DSH_FROM_USERID to the $DSH_TO_USERID
on the node(s). The DSH_REMOTE_PASSWORD and the DSH_FROM_USERID
must be obtained by
the calling script or from the xdsh client
Globals:
$::XCATROOT , $::CALLBACK
Error:
0=good, 1=error
Example:
xCAT::TableUtils->sendkeysNOzones($ref_nodes,$expecttimeout);
Comments:
Does not setup known_hosts. Assumes automatically
setup by SSH ( ssh config option StrictHostKeyChecking no should
be set in the ssh config file).
=cut
#--------------------------------------------------------------------------------
sub sendkeysNOzones
{
my ($class, $ref_nodes,$expecttimeout) = @_;
my @nodes=$ref_nodes;
my $enablenodes;
my $disablenodes;
my $n_str = $nodes[0];
my @nodelist= split(",", $n_str);
my $rsp = ();
foreach my $n (@nodelist)
{
my $enablessh=xCAT::TableUtils->enablessh($n);
if ($enablessh == 1) {
$enablenodes .= $n;
$enablenodes .= ",";
} else {
$disablenodes .= $n;
$disablenodes .= ",";
}
}
if ($enablenodes) { # node on list to setup nodetonodessh
chop $enablenodes; # remove last comma
$ENV{'DSH_ENABLE_SSH'} = "YES";
# send the keys to the nodes
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$enablenodes,$expecttimeout);
if ($rc != 0)
{
$rsp->{data}->[0] = "remoteshellexp failed sending keys to enablenodes.";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
}
}
if ($disablenodes) { # node on list to disable nodetonodessh
chop $disablenodes; # remove last comma
# send the keys to the nodes
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$disablenodes,$expecttimeout);
if ($rc != 0)
{
$rsp->{data}->[0] = "remoteshellexp failed sending keys to disablenodes.";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
}
}
}
#--------------------------------------------------------------------------------
=head3 sendkeysTOzones
Transfers the ssh keys
for the root id on the nodes using the zone table.
If in a zone, then root ssh keys for the node will be taken from the zones ssh keys not ~/.ssh
zones are only supported on nodes that are not a service node.
Also for the call to RemoteShellExp, we must group the nodes that are in the same zone
Arguments:
Array of nodes
Timeout for expect call (optional)
Returns:
Env Variables: $DSH_FROM_USERID, $DSH_TO_USERID, $DSH_REMOTE_PASSWORD
the ssh keys are transferred from the $DSH_FROM_USERID to the $DSH_TO_USERID
on the node(s). The DSH_REMOTE_PASSWORD and the DSH_FROM_USERID
must be obtained by
the calling script or from the xdsh client
Globals:
$::XCATROOT , $::CALLBACK
Error:
0=good, 1=error
Example:
xCAT::TableUtils->sendkeysTOzones($ref_nodes,$expecttimeout);
Comments:
Does not setup known_hosts. Assumes automatically
setup by SSH ( ssh config option StrictHostKeyChecking no should
be set in the ssh config file).
=cut
#--------------------------------------------------------------------------------
sub sendkeysTOzones
{
my ($class, $ref_nodes,$expecttimeout) = @_;
my @nodes=$ref_nodes;
my $n_str = $nodes[0];
@nodes= split(",", $n_str);
my $rsp = ();
my $cmd;
my $roothome = xCAT::Utils->getHomeDir("root");
my $zonehash =xCAT::Zone->getzoneinfo($::CALLBACK,\@nodes);
foreach my $zonename (keys %$zonehash) {
# build list of nodes
my $zonenodelist="";
foreach my $node (@{$zonehash->{$zonename}->{nodes}}) {
$zonenodelist .= $node;
$zonenodelist .= ",";
}
$zonenodelist =~ s/,$//; # remove last comma
# if any nodes defined for the zone
if ($zonenodelist) {
# check to see if we enable passwordless ssh between the nodes
if (!(defined($zonehash->{$zonename}->{sshbetweennodes}))||
(($zonehash->{$zonename}->{sshbetweennodes} =~ /^yes$/i )
|| ($zonehash->{$zonename}->{sshbetweennodes} eq "1"))) {
$ENV{'DSH_ENABLE_SSH'} = "YES";
} else {
delete $ENV{'DSH_ENABLE_SSH'}; # do not enable passwordless ssh
}
# point to the ssh keys to send for this zone
my $keydir = $zonehash->{$zonename}->{sshkeydir} ;
# check to see if the id_rsa and id_rsa.pub key is in the directory
my $key="$keydir/id_rsa";
my $key2="$keydir/id_rsa.pub";
# Check to see if empty
if (!(-e $key)) {
my $rsp = {};
$rsp->{error}->[0] =
"The $key file does not exist for $zonename. Need to use chzone to regenerate the keys.";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
return 1;
}
if (!(-e $key2)) {
my $rsp = {};
$rsp->{error}->[0] =
"The $key2 file does not exist for $zonename. Need to use chzone to regenerate the keys.";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
return 1;
}
# now put copy.sh in the zone directory from ~/.ssh
my $rootkeydir="$roothome/.ssh";
if ($rootkeydir ne $keydir) { # the zone keydir is not the same as ~/.ssh.
$cmd="cp $rootkeydir/copy.sh $keydir";
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{error}->[0] =
"Could not copy copy.sh to the zone key dir";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
return 1;
}
}
# Also create $keydir/tmp and put root's id_rsa.pub (in authorized_keys) for the transfer
$cmd="mkdir -p $keydir/tmp";
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{error}->[0] =
"Could not mkdir the zone $keydir/tmp";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
return 1;
}
# create authorized_keys file
if (xCAT::Utils->isMN()) { # if on Management Node
$cmd = " cp $roothome/.ssh/id_rsa.pub $keydir/tmp/authorized_keys";
} else { # SN
$cmd = " cp $roothome/.ssh/authorized_keys $keydir/tmp/authorized_keys";
}
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{
$rsp->{data}->[0] = "$cmd failed.\n";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
return (1);
}
else
{
chmod 0600, "$keydir/.ssh/tmp/authorized_keys";
}
# strip off .ssh
my ($newkeydir,$ssh) = (split(/\.ssh/, $keydir));
$ENV{'DSH_ZONE_SSHKEYS'} =$newkeydir ;
# send the keys to the nodes
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",
$zonenodelist,$expecttimeout);
if ($rc != 0)
{
$rsp = {};
$rsp->{data}->[0] = "remoteshellexp failed sending keys to $zonename.";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
}
} # end nodes in the zone
} # end for each zone
return (0);
}
#--------------------------------------------------------------------------------
=head3 cpSSHFiles
Builds authorized_keyfiles for root
@@ -947,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;
@@ -1594,8 +1826,8 @@ sub enableSSH
} else {
# if not a service node we need to check, before enabling
if (defined($groups_hash)) {
if ($groups_hash->{ALLGROUPS} == 1)
if (keys %$groups_hash) { # not empty
if ($groups_hash->{ALLGROUPS} == 1)
{
$enablessh=1;
}
@@ -1769,7 +2001,7 @@ sub updatenodegroups {
}
}
my ($ent) = $tabhd->getNodeAttribs($node, ['groups']);
my @list = qw(all);
my @list = ();
if (defined($ent) and $ent->{groups}) {
push @list, split(/,/,$ent->{groups});
}
@@ -1783,5 +2015,54 @@ sub updatenodegroups {
@list = keys %saw;
$tabhd->setNodeAttribs($node, {groups=>join(",",@list)});
}
#-----------------------------------------------------------------------------
=head3 rmnodegroups
remove groups from the group attribute for the specified node
Arguments:
node
tabhd: the handler of 'nodelist' table,
groups: the groups that need to be removed.
Can be an array or string.
Globals:
none
Error:
Example:
xCAT::TableUtils->rmnodegroups($node, $tab, $groups);
=cut
#-----------------------------------------------------------------------------
sub rmnodegroups {
my ($class, $node, $tabhd, $groups) = @_;
my ($ent) = $tabhd->getNodeAttribs($node, ['groups']);
my @definedgroups;
my @removegroups;
my @newgroups;
if (defined($ent) and $ent->{groups}) {
push @definedgroups, split(/,/,$ent->{groups});
}
if (ref($groups) eq 'ARRAY') {
push @removegroups, @$groups;
} else {
push @removegroups, split(/,/,$groups);
}
# take out any groups that match the input list of groups to remove
foreach my $dgrp (@definedgroups){
if (grep(/^$dgrp$/, @removegroups)) { # is the group to be removed
next;
} else { # keep this group
push @newgroups,$dgrp;
}
}
my %saw;
@saw{@newgroups} = ();
@newgroups = keys %saw;
$tabhd->setNodeAttribs($node, {groups=>join(",",@newgroups)});
}
1;
+6 -2
View File
@@ -207,6 +207,7 @@ my %usage = (
mkvm noderange [--full]
mkvm 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]
For KVM
mkvm noderange -m|--master mastername -s|--size disksize -f|--force
For zVM
@@ -221,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
@@ -241,6 +242,9 @@ my %usage = (
chvm <noderange> [lparname=<*|name>]
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]
zVM specific:
@@ -277,7 +281,7 @@ my %usage = (
"lsslp" =>
"Usage: lsslp [-h|--help|-v|--version]
lsslp [<noderange>][-V|--verbose][-i ip[,ip..]][-w][-r|-x|-z][-n][-I][-s FRAME|CEC|MM|IVM|RSA|HMC|CMM|IMM2|FSP]
[-t tries][--vpdtable][-C counts][-T timeout]",
[-u] [--range IPranges][-t tries][--vpdtable][-C counts][-T timeout]",
"rflash" =>
"Usage:
rflash [ -h|--help|-v|--version]
+684 -16
View File
@@ -940,18 +940,15 @@ sub runcmd
my ($class, $cmd, $exitcode, $refoutput, $stream) = @_;
$::RUNCMD_RC = 0;
# redirect stderr to stdout
if (!($cmd =~ /2>&1$/)) { $cmd .= ' 2>&1'; }
my $hostname = `/bin/hostname`;
chomp $hostname;
if ($::VERBOSE)
{
# get this systems name as known by xCAT management node
my $Sname = xCAT::InstUtils->myxCATname();
my $msg;
if ($Sname) {
$msg = "Running command on $Sname: $cmd";
} else {
$msg="Running command: $cmd";
}
if ($::VERBOSE)
{
my $msg="Running command on $hostname: $cmd";
if ($::CALLBACK){
my $rsp = {};
@@ -960,7 +957,7 @@ sub runcmd
} else {
xCAT::MsgUtils->message("I", "$msg\n");
}
}
}
my $outref = [];
if (!defined($stream) || (length($stream) == 0)) { # do not stream
@@ -1342,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}))
{
@@ -1832,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
@@ -1853,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
@@ -3372,6 +3389,657 @@ sub filter_nostatusupdate{
}
}
}
}
sub version_cmp {
my $ver_a = shift;
if ($ver_a =~ /xCAT::Utils/)
{
$ver_a = shift;
}
my $ver_b = shift;
my @array_a = ($ver_a =~ /([-.]|\d+|[^-.\d]+)/g);
my @array_b = ($ver_b =~ /([-.]|\d+|[^-.\d]+)/g);
my ($a, $b);
my $len_a = @array_a;
my $len_b = @array_b;
my $len = $len_a;
if ( $len_b < $len_a ) {
$len = $len_b;
}
for ( my $i = 0; $i < $len; $i++ ) {
$a = $array_a[$i];
$b = $array_b[$i];
if ($a eq $b) {
next;
} elsif ( $a eq '-' ) {
return -1;
} elsif ( $b eq '-') {
return 1;
} elsif ( $a eq '.' ) {
return -1;
} elsif ( $b eq '.' ) {
return 1;
} elsif ($a =~ /^\d+$/ and $b =~ /^\d+$/) {
if ($a =~ /^0/ || $b =~ /^0/) {
return ($a cmp $b);
} else {
return ($a <=> $b);
}
} else {
$a = uc $a;
$b = uc $b;
return ($a cmp $b);
}
}
return ( $len_a <=> $len_b )
}
#--------------------------------------------------------------------------------
=head3 fullpathbin
returns the full path of a specified binary executable file
Arguments:
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:
none
Example:
my $CHKCONFIG = xCAT::Utils->fullpathbin("chkconfig");
Comments:
none
=cut
#--------------------------------------------------------------------------------
sub fullpathbin
{
my $bin=shift;
if( $bin =~ /xCAT::Utils/)
{
$bin=shift;
}
my @paths= ("/bin","/usr/bin","/sbin","/usr/sbin");
my $fullpath=$bin;
foreach my $path (@paths)
{
if (-x $path.'/'.$bin)
{
$fullpath= $path.'/'.$bin;
last;
}
}
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;
+452
View File
@@ -0,0 +1,452 @@
#!/usr/bin/env perl
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
package xCAT::Zone;
BEGIN
{
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
}
# if AIX - make sure we include perl 5.8.2 in INC path.
# Needed to find perl dependencies shipped in deps tarball.
if ($^O =~ /^aix/i) {
unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2));
}
use lib "$::XCATROOT/lib/perl";
# do not put a use or require for xCAT::Table here. Add to each new routine
# needing it to avoid reprocessing of user tables ( ExtTab.pm) for each command call
use POSIX qw(ceil);
use File::Path;
use Socket;
use strict;
use Symbol;
use warnings "all";
#--------------------------------------------------------------------------------
=head1 xCAT::Zone
=head2 Package Description
This program module file, is a set of Zone utilities used by xCAT *zone commands.
=cut
#--------------------------------------------------------------------------------
=head3 genSSHRootKeys
Arguments:
callback for error messages
directory in which to put the ssh RSA keys
zonename
rsa private key to use for generation ( optional)
Returns:
Error: 1 - key generation failure.
Example:
$rc =xCAT::Zone->genSSHRootKeys($callback,$keydir,$rsakey);
=cut
#--------------------------------------------------------------------------------
sub genSSHRootKeys
{
my ($class, $callback, $keydir,$zonename,$rsakey) = @_;
#
# create /keydir if needed
#
if (!-d $keydir)
{
my $cmd = "/bin/mkdir -m 700 -p $keydir";
my $output = xCAT::Utils->runcmd("$cmd", 0);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{error}->[0] =
"Could not create $keydir directory";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
#need to gen a new rsa key for root for the zone
my $pubfile = "$keydir/id_rsa.pub";
my $pvtfile = "$keydir/id_rsa";
# if exists, remove the old files
if (-r $pubfile)
{
my $cmd = "/bin/rm $keydir/id_rsa*";
my $output = xCAT::Utils->runcmd("$cmd", 0);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{error}->[0] = "Could not remove id_rsa files from $keydir directory.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
# gen new RSA keys
my $cmd;
my $output;
# if private key was input use it
if (defined ($rsakey)) {
$cmd="/usr/bin/ssh-keygen -y -f $rsakey > $pubfile";
$output = xCAT::Utils->runcmd("$cmd", 0);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{error}->[0] = "Could not generate $pubfile from $rsakey";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
# now copy the private key into the directory
$cmd="cp $rsakey $keydir";
$output = xCAT::Utils->runcmd("$cmd", 0);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{error}->[0] = "Could not run $cmd";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
} else { # generate all new keys
$cmd = "/usr/bin/ssh-keygen -t rsa -q -b 2048 -N '' -f $pvtfile";
$output = xCAT::Utils->runcmd("$cmd", 0);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{error}->[0] = "Could not generate $pubfile";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
#make sure permissions are correct
$cmd = "chmod 644 $pubfile;chown root $pubfile";
$output = xCAT::Utils->runcmd("$cmd", 0);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{error}->[0] = "Could set permission and owner on $pubfile";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
#--------------------------------------------------------------------------------
=head3 getdefaultzone
Arguments:
None
Returns:
Name of the current default zone from the zone table
Example:
my $defaultzone =xCAT::Zone->getdefaultzone($callback);
=cut
#--------------------------------------------------------------------------------
sub getdefaultzone
{
my ($class, $callback) = @_;
my $defaultzone;
# read all the zone table and find the defaultzone, if it exists
my $tab = xCAT::Table->new("zone");
if ($tab){
my @zones = $tab->getAllAttribs('zonename','defaultzone');
foreach my $zone (@zones) {
# Look for the defaultzone=yes/1 entry
if ((defined($zone->{defaultzone})) &&
(($zone->{defaultzone} =~ /^yes$/i )
|| ($zone->{defaultzone} eq "1"))) {
$defaultzone = $zone->{zonename};
}
$tab->close();
}
} else {
my $rsp = {};
$rsp->{error}->[0] =
"Error reading the zone table. ";
xCAT::MsgUtils->message("E", $rsp, $callback);
}
return $defaultzone;
}
#--------------------------------------------------------------------------------
=head3 iszonedefined
Arguments:
zonename
Returns:
1 if the zone is already in the zone table.
Example:
xCAT::Zone->iszonedefined($zonename);
=cut
#--------------------------------------------------------------------------------
sub iszonedefined
{
my ($class,$zonename) = @_;
# checks the zone table to see if input zonename already in the table
my $tab = xCAT::Table->new("zone");
$tab->close();
my $zonehash = $tab->getAttribs({zonename => $zonename},'sshkeydir');
if ( keys %$zonehash) {
return 1;
}else{
return 0;
}
}
#--------------------------------------------------------------------------------
=head3 getzonekeydir
Arguments:
zonename
Returns:
path to the root ssh keys for the zone /etc/xcat/sshkeys/<zonename>/.ssh
1 - zone not defined
Example:
xCAT::Zone->getzonekeydir($zonename);
=cut
#--------------------------------------------------------------------------------
sub getzonekeydir
{
my ($class,$zonename) = @_;
my $tab = xCAT::Table->new("zone");
$tab->close();
my $zonehash = $tab->getAttribs({zonename => $zonename},'sshkeydir');
if ( keys %$zonehash) {
my $zonesshkeydir=$zonehash->{sshkeydir};
return $zonesshkeydir;
}else{
return 1; # this is a bad error zone not defined
}
}
#--------------------------------------------------------------------------------
=head3 getmyzonename
Arguments:
$node -one nodename
Returns:
$zonename
Example:
my $zonename=xCAT::Zone->getmyzonename($node);
=cut
#--------------------------------------------------------------------------------
sub getmyzonename
{
my ($class,$node,$callback) = @_;
my @node;
push @node,$node;
my $zonename;
my $nodelisttab = xCAT::Table->new("nodelist");
my $nodehash = $nodelisttab->getNodesAttribs(\@node, ['zonename']);
$nodelisttab->close();
if ( defined ($nodehash->{$node}->[0]->{zonename})) { # it was defined in the nodelist table
$zonename=$nodehash->{$node}->[0]->{zonename};
} else { # get the default zone
$zonename =xCAT::Zone->getdefaultzone($callback);
}
return $zonename;
}
#--------------------------------------------------------------------------------
=head3 enableSSHbetweennodes
Arguments:
zonename
Returns:
1 if the sshbetweennodes attribute is yes/1 or undefined
0 if the sshbetweennodes attribute is no/0
Example:
xCAT::Zone->enableSSHbetweennodes($zonename);
=cut
#--------------------------------------------------------------------------------
sub enableSSHbetweennodes
{
my ($class,$node,$callback) = @_;
# finds the zone of the node
my $enablessh = 1; # default
my $zonename=xCAT::Zone->getmyzonename($node);
# reads the zone table
my $tab = xCAT::Table->new("zone");
$tab->close();
# read both keys, want to know zone is in the zone table. If sshkeydir is not there
# it is either missing or invalid anyway
my $zonehash = $tab->getAttribs({zonename => $zonename},'sshbetweennodes','sshkeydir');
if (! ( keys %$zonehash)) {
my $rsp = {};
$rsp->{error}->[0] =
"$node has a zonename: $zonename that is not define in the zone table. Remove the zonename from the node, or create the zone using mkzone. The generated mypostscript may not reflect the correct setting for ENABLESSHBETWEENNODES";
xCAT::MsgUtils->message("E", $rsp, $callback);
return $enablessh;
}
my $sshbetweennodes=$zonehash->{sshbetweennodes};
if (defined ($sshbetweennodes)) {
if (($sshbetweennodes =~ /^no$/i) || ($sshbetweennodes eq "0")) {
$enablessh = 0;
} else {
$enablessh = 1;
}
} else { # not defined default yes
$enablessh = 1 ; # default
}
return $enablessh;
}
#--------------------------------------------------------------------------------
=head3 usingzones
Arguments:
none
Returns:
1 if the zone table is not empty
0 if empty
Example:
xCAT::Zone->usingzones;
=cut
#--------------------------------------------------------------------------------
sub usingzones
{
my ($class) = @_;
# reads the zonetable
my $tab = xCAT::Table->new("zone");
my @zone = $tab->getAllAttribs('zonename');
$tab->close();
if (@zone) {
return 1;
}else{
return 0;
}
}
#--------------------------------------------------------------------------------
=head3 getzoneinfo
Arguments:
callback
An array of nodes
Returns:
Hash array by zonename point to the nodes in that zonename and sshkeydir
<zonename1> -> {nodelist} -> array of nodes in the zone
-> {sshkeydir} -> directory containing ssh RSA keys
-> {defaultzone} -> is it the default zone
Example:
my %zonehash =xCAT::Zone->getzoneinfo($callback,@nodearray);
Rules:
If the nodes nodelist.zonename attribute is a zonename, it is assigned to that zone
If the nodes nodelist.zonename attribute is undefined:
If there is a defaultzone in the zone table, the node is assigned to that zone
If there is no defaultzone in the zone table, the node is assigned to the ~.ssh keydir
$::GETZONEINFO_RC
0 = good return
1 = error occured
=cut
#--------------------------------------------------------------------------------
sub getzoneinfo
{
my ($class, $callback,$nodes) = @_;
$::GETZONEINFO_RC=0;
my $zonehash;
my $defaultzone;
# read all the zone table
my $zonetab = xCAT::Table->new("zone");
my @zones;
if ($zonetab){
@zones = $zonetab->getAllAttribs('zonename','sshkeydir','sshbetweennodes','defaultzone');
$zonetab->close();
if (@zones) {
foreach my $zone (@zones) {
my $zonename=$zone->{zonename};
$zonehash->{$zonename}->{sshkeydir}= $zone->{sshkeydir};
$zonehash->{$zonename}->{defaultzone}= $zone->{defaultzone};
$zonehash->{$zonename}->{sshbetweennodes}= $zone->{sshbetweennodes};
# find the defaultzone
if ((defined($zone->{defaultzone})) &&
(($zone->{defaultzone} =~ /^yes$/i )
|| ($zone->{defaultzone} eq "1"))) {
$defaultzone = $zone->{zonename};
}
}
}
} else {
my $rsp = {};
$rsp->{error}->[0] =
"Error reading the zone table. ";
xCAT::MsgUtils->message("E", $rsp, $callback);
$::GETZONEINFO_RC =1;
return;
}
my $nodelisttab = xCAT::Table->new("nodelist");
my $nodehash = $nodelisttab->getNodesAttribs(\@$nodes, ['zonename']);
# for each of the nodes, look up it's zone name and assign to the zonehash
# If the nodes nodelist.zonename attribute is a zonename, it is assigned to that zone
# If the nodes nodelist.zonename attribute is undefined:
# If there is a defaultzone in the zone table, the node is assigned to that zone
# If there is no defaultzone error out
foreach my $node (@$nodes) {
my $zonename;
$zonename=$nodehash->{$node}->[0]->{zonename};
if (defined($zonename)) { # zonename explicitly defined in nodelist.zonename
# check to see if defined in the zone table
unless ( xCAT::Zone->iszonedefined($zonename)) {
my $rsp = {};
$rsp->{error}->[0] =
"$node has a zonename: $zonename that is not define in the zone table. Remove the zonename from the node, or create the zone using mkzone.";
xCAT::MsgUtils->message("E", $rsp, $callback);
$::GETZONEINFO_RC =1;
return;
}
push @{$zonehash->{$zonename}->{nodes}},$node;
} else { # no explict zonename
if (defined ($defaultzone)) { # there is a default zone in the zone table, use it
push @{$zonehash->{$defaultzone}->{nodes}},$node;
} else { # if no default, this is an error
my $rsp = {};
$rsp->{error}->[0] =
"There is no default zone defined in the zone table. There must be exactly one default zone. ";
xCAT::MsgUtils->message("E", $rsp, $callback);
$::GETZONEINFO_RC =1;
return;
}
}
}
return $zonehash;
}
#--------------------------------------------------------------------------------
=head3 getnodesinzone
Arguments:
callback
zonename
Returns:
Array of nodes
Example:
my @nodes =xCAT::Zone->getnodesinzone($callback,$zonename);
=cut
#--------------------------------------------------------------------------------
sub getnodesinzone
{
my ($class, $callback,$zonename) = @_;
my @nodes;
my $nodelisttab = xCAT::Table->new("nodelist");
my @nodelist=$nodelisttab->getAllAttribs('node','zonename');
# build the array of nodes in this zone
foreach my $nodename (@nodelist) {
if ((defined($nodename->{'zonename'})) && ($nodename->{'zonename'} eq $zonename)) {
push @nodes,$nodename->{'node'};
}
}
return @nodes;
}
1;
+12 -4
View File
@@ -14,9 +14,10 @@ require Exporter;
%distnames = (
"1310229985.226287" => "centos6",
"1323560292.885204" => "centos6.2",
"1341569670.539525" => "centos6.3",#x86
"1362445555.957609" => "centos6.4",#x86_64
"1323560292.885204" => "centos6.2",
"1341569670.539525" => "centos6.3",#x86
"1362445555.957609" => "centos6.4",#x86_64
"1385726732.061157" => "centos6.5",#x86_64
"1176234647.982657" => "centos5",
"1156364963.862322" => "centos4.4",
"1178480581.024704" => "centos4.5",
@@ -28,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",
@@ -49,6 +51,8 @@ require Exporter;
"1328205744.315196" => "rhels5.8", #x86_64
"1354216429.587870" => "rhels5.9", #x86_64
"1354214009.518521" => "rhels5.9", #ppc64
"1378846702.129847" => "rhels5.10", #x86_64
"1378845049.643372" => "rhels5.10", #ppc64
"1285193176.460470" => "rhels6", #x86_64
"1285192093.430930" => "rhels6", #ppc64
"1305068199.328169" => "rhels6.1", #x86_64
@@ -60,11 +64,15 @@ require Exporter;
"1339638991.532890" => "rhels6.3", #i386
"1359576752.435900" => "rhels6.4", #x86_64
"1359576196.686790" => "rhels6.4", #ppc64
"1384196515.415715" => "rhels6.5", #x86_64
"1384198011.520581" => "rhels6.5", #ppc64
"1285193176.593806" => "rhelhpc6", #x86_64
"1305067719.718814" => "rhelhpc6.1",#x86_64
"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",
@@ -78,7 +86,7 @@ require Exporter;
"1305315870.828212" => "fedora15", #x86_64 DVD ISO
"1372355769.065812" => "fedora19", #x86_64 DVD ISO
"1372402928.663653" => "fedora19", #ppc64 DVD ISO
"1386856788.124593" => "fedora20", #x86_64 DVD ISO
"1194512200.047708" => "rhas4.6",
"1194512327.501046" => "rhas4.6",
"1241464993.830723" => "rhas4.8", #x86-64
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";
+269 -78
View File
@@ -6,84 +6,275 @@
#include <stdlib.h>
#include <errno.h>
#include <netinet/in.h>
int main() {
int serverfd,port;
int getpktinfo = 1;
struct addrinfo hint, *res;
char cmsg[CMSG_SPACE(sizeof(struct in_pktinfo))];
char clientpacket[1024];
struct sockaddr_in clientaddr;
struct msghdr msg;
struct cmsghdr *cmsgptr;
struct iovec iov[1];
unsigned int myip;
char *txtptr;
iov[0].iov_base = clientpacket;
iov[0].iov_len = 1024;
memset(&msg,0,sizeof(msg));
memset(&clientaddr,0,sizeof(clientaddr));
msg.msg_name=&clientaddr;
msg.msg_namelen = sizeof(clientaddr);
msg.msg_iov = iov;
msg.msg_iovlen = 1;
msg.msg_control=&cmsg;
msg.msg_controllen = sizeof(cmsg);
char bootpmagic[4] = {0x63,0x82,0x53,0x63};
int pktsize;
int doexit=0;
port = 4011;
memset(&hint,0,sizeof(hint));
hint.ai_family = PF_INET; /* Would've done UNSPEC, but it doesn't work right and this is heavily v4 specific anyway */
hint.ai_socktype = SOCK_DGRAM;
hint.ai_flags = AI_PASSIVE;
getaddrinfo(NULL,"4011",&hint,&res);
serverfd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (!serverfd) { fprintf(stderr,"That's odd...\n"); }
setsockopt(serverfd,IPPROTO_IP,IP_PKTINFO,&getpktinfo,sizeof(getpktinfo));
if (bind(serverfd,res->ai_addr ,res->ai_addrlen) < 0) {
fprintf(stderr,"Unable to bind 4011");
exit(1);
}
while (!doexit) {
pktsize = recvmsg(serverfd,&msg,0);
if (pktsize < 320) {
continue;
}
if (clientpacket[0] != 1 || memcmp(clientpacket+0xec,bootpmagic,4)) {
continue;
}
for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL; cmsgptr = CMSG_NXTHDR(&msg,cmsgptr)) {
if (cmsgptr->cmsg_level == IPPROTO_IP && cmsgptr->cmsg_type == IP_PKTINFO) {
myip = ((struct in_pktinfo*)(CMSG_DATA(cmsgptr)))->ipi_addr.s_addr;
}
}
clientpacket[0] = 2; //change to a reply
myip = htonl(myip); //endian neutral change
clientpacket[0x14] = (myip>>24)&0xff; //maybe don't need to do this, maybe assigning the whole int would be better
clientpacket[0x15] = (myip>>16)&0xff;
clientpacket[0x16] = (myip>>8)&0xff;
clientpacket[0x17] = (myip)&0xff;
txtptr = clientpacket+0x6c;
strncpy(txtptr,"Boot/bootmgfw.efi",128); // keeping 128 in there just in case someone changes the string
clientpacket[0xf0]=0x35; //DHCP MSG type
clientpacket[0xf1]=0x1; // LEN of 1
clientpacket[0xf2]=0x5; //DHCP ACK
clientpacket[0xf3]=0x36; //DHCP server identifier
clientpacket[0xf4]=0x4; //DHCP server identifier length
clientpacket[0xf5] = (myip>>24)&0xff; //maybe don't need to do this, maybe assigning the whole int would be better
clientpacket[0xf6] = (myip>>16)&0xff;
clientpacket[0xf7] = (myip>>8)&0xff;
clientpacket[0xf8] = (myip)&0xff;
clientpacket[0xf9] = 0xfc; // dhcp 252 'proxy', but coopeted by bootmgfw, it's actually suggesting the boot config file
clientpacket[0xfa] = 9; //length of 9
txtptr = clientpacket+0xfb;
strncpy(txtptr,"Boot/BCD",8);
clientpacket[0x103]=0;
clientpacket[0x104]=0xff;
sendto(serverfd,clientpacket,pktsize,0,(struct sockaddr*)&clientaddr,sizeof(clientaddr));
}
#include <signal.h>
#include <syslog.h>
// the chunk size for each alloc
int chunknum = 200;
int doreload = 0;
int verbose = 0;
char logmsg[50];
// the struct to store the winpe configuration for each node
struct nodecfg {
char node[50];
char data[150];
};
char *data = NULL; // the ptr to the array of all node config
int nodenum = 0;
// trigger the main program to reload configuration file
void reload(int sig) {
doreload = 1;
}
// the subroutine which is used to load configuration from
// /var/lib/xcat/proxydhcp.cfg to *data
void loadcfg () {
nodenum = 0;
free(data);
data = NULL;
doreload = 0;
char *dp = NULL;
FILE *fp;
fp = fopen("/var/lib/xcat/proxydhcp.cfg", "r");
if (fp) {
int num = chunknum;
int rtime = 1;
while (num == chunknum) {
// realloc the chunknum size of memory each to save memory usage
data = realloc(data, sizeof(struct nodecfg) * chunknum * rtime);
if (NULL == data) {
fprintf (stderr, "Cannot get enough memory.\n");
free (data);
return;
}
dp = data + sizeof(struct nodecfg) * chunknum * (rtime - 1);
memset(dp, 0, sizeof(struct nodecfg) * chunknum);
num = fread(dp, sizeof (struct nodecfg), chunknum, fp);
nodenum += num;
rtime++;
}
fclose(fp);
}
}
// get the path of winpe from configuration file which is stored in *data
char *getwinpepath(char *node) {
int i;
struct nodecfg *nc = (struct nodecfg *)data;
for (i=0; i<nodenum;i++) {
if (0 == strcmp(nc->node, node)) {
return nc->data;
}
nc++;
}
return NULL;
}
int main(int argc, char *argv[]) {
int i;
for(i = 0; i < argc; i++)
{
if (strcmp(argv[i], "-V") == 0) {
verbose = 1;
setlogmask(LOG_UPTO(LOG_DEBUG));
openlog("proxydhcp", LOG_NDELAY, LOG_LOCAL0);
}
}
// regist my pid to /var/run/xcat/proxydhcp.pid
int pid = getpid();
FILE *pidf = fopen ("/var/run/xcat/proxydhcp.pid", "w");
if (pidf) {
fprintf(pidf, "%d", pid);
fclose (pidf);
} else {
fprintf (stderr, "Cannot open /var/run/xcat/proxydhcp.pid\n");
return 1;
}
// load configuration at first start
loadcfg();
// regist signal SIGUSR1 for triggering reload configuration from outside
struct sigaction sigact;
sigact.sa_handler = &reload;
sigaction(SIGUSR1, &sigact, NULL);
int serverfd,port;
int getpktinfo = 1;
struct addrinfo hint, *res;
char cmsg[CMSG_SPACE(sizeof(struct in_pktinfo))];
char clientpacket[1024];
struct sockaddr_in clientaddr;
struct msghdr msg;
struct cmsghdr *cmsgptr;
struct iovec iov[1];
unsigned int myip, clientip;
char *txtptr;
iov[0].iov_base = clientpacket;
iov[0].iov_len = 1024;
memset(&msg,0,sizeof(msg));
memset(&clientaddr,0,sizeof(clientaddr));
msg.msg_name=&clientaddr;
msg.msg_namelen = sizeof(clientaddr);
msg.msg_iov = iov;
msg.msg_iovlen = 1;
msg.msg_control=&cmsg;
msg.msg_controllen = sizeof(cmsg);
char defaultwinpe[20] = "Boot/bootmgfw.efi";
char bootpmagic[4] = {0x63,0x82,0x53,0x63};
int pktsize;
int doexit=0;
port = 4011;
memset(&hint,0,sizeof(hint));
hint.ai_family = PF_INET; /* Would've done UNSPEC, but it doesn't work right and this is heavily v4 specific anyway */
hint.ai_socktype = SOCK_DGRAM;
hint.ai_flags = AI_PASSIVE;
getaddrinfo(NULL,"4011",&hint,&res);
serverfd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (!serverfd) { fprintf(stderr,"That's odd...\n"); }
setsockopt(serverfd,IPPROTO_IP,IP_PKTINFO,&getpktinfo,sizeof(getpktinfo));
if (bind(serverfd,res->ai_addr ,res->ai_addrlen) < 0) {
fprintf(stderr,"Unable to bind 4011");
exit(1);
}
while (!doexit) {
// use select to wait for the 4011 request packages coming
fd_set fds;
FD_ZERO(&fds);
FD_SET(serverfd, &fds);
struct timeval timeout;
timeout.tv_sec = 30;
timeout.tv_usec = 0;
int rc;
if ((rc = select(serverfd+1,&fds,0,0, &timeout)) <= 0) {
if (doreload) {
loadcfg();
fprintf(stderr, "load in select\n");
}
if (verbose) {syslog(LOG_DEBUG, "reload /var/lib/xcat/proxydhcp.cfg\n");}
continue;
}
if (doreload) {
loadcfg();
if (verbose) {syslog(LOG_DEBUG, "reload /var/lib/xcat/proxydhcp.cfg\n");}
}
pktsize = recvmsg(serverfd,&msg,0);
if (pktsize < 320) {
continue;
}
if (clientpacket[0] != 1 || memcmp(clientpacket+0xec,bootpmagic,4)) {
continue;
}
for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL; cmsgptr = CMSG_NXTHDR(&msg,cmsgptr)) {
if (cmsgptr->cmsg_level == IPPROTO_IP && cmsgptr->cmsg_type == IP_PKTINFO) {
myip = ((struct in_pktinfo*)(CMSG_DATA(cmsgptr)))->ipi_addr.s_addr;
}
}
// get the ip of dhcp client
clientip = 0;
int i;
for (i = 0; i< 4; i++) {
clientip = clientip << 8;
clientip += (unsigned char)clientpacket[15-i];
}
// get the winpe path
struct hostent *host = gethostbyaddr(&clientip, sizeof(clientip), AF_INET);
char *winpepath = defaultwinpe;
if (host) {
if (host->h_name) {
// remove the domain part from hostname
char *place = strstr(host->h_name, ".");
if (place) {
*place = '\0';
}
winpepath = getwinpepath(host->h_name);
if (winpepath == NULL) {
winpepath = defaultwinpe;
}
if (verbose) {
sprintf(logmsg, "Received proxydhcp request from %s\n", host->h_name);
syslog(LOG_DEBUG, logmsg);
}
}
} else {
winpepath = defaultwinpe;
}
// get the Vendor class identifier
char *arch = NULL;
unsigned char *p = clientpacket + 0xf0;
while (*p != 0xff && p < (unsigned char *)clientpacket + pktsize) {
if (*p == 60) {
arch = p + 0x11;
break;
} else {
p += *(p+1) + 2;
}
}
char winboot[50]; // the bootload of winpe
memset(winboot, 0, 50);
if (0 == memcmp(arch, "00000", 5)) { // bios boot mode
strcpy(winboot, winpepath);
strcat(winboot, "Boot/pxeboot.0");
} else if (0 == memcmp(arch, "00007", 5)) { // uefi boot mode
strcpy(winboot, winpepath);
strcat(winboot, "Boot/bootmgfw.efi");
}
clientpacket[0] = 2; //change to a reply
myip = htonl(myip); //endian neutral change
clientpacket[0x14] = (myip>>24)&0xff; //maybe don't need to do this, maybe assigning the whole int would be better
clientpacket[0x15] = (myip>>16)&0xff;
clientpacket[0x16] = (myip>>8)&0xff;
clientpacket[0x17] = (myip)&0xff;
txtptr = clientpacket+0x6c;
strncpy(txtptr, winboot ,128); // keeping 128 in there just in case someone changes the string
//strncpy(txtptr,"winboot/new/Boot/bootmgfw.efi",128); // keeping 128 in there just in case someone changes the string
//strncpy(txtptr,"Boot/pxeboot.0",128); // keeping 128 in there just in case someone changes the string
clientpacket[0xf0]=0x35; //DHCP MSG type
clientpacket[0xf1]=0x1; // LEN of 1
clientpacket[0xf2]=0x5; //DHCP ACK
clientpacket[0xf3]=0x36; //DHCP server identifier
clientpacket[0xf4]=0x4; //DHCP server identifier length
clientpacket[0xf5] = (myip>>24)&0xff; //maybe don't need to do this, maybe assigning the whole int would be better
clientpacket[0xf6] = (myip>>16)&0xff;
clientpacket[0xf7] = (myip>>8)&0xff;
clientpacket[0xf8] = (myip)&0xff;
char winBCD[50];
strcpy(winBCD, winpepath);
strcat(winBCD, "Boot/BCD");
clientpacket[0xf9] = 0xfc; // dhcp 252 'proxy', but coopeted by bootmgfw, it's actually suggesting the boot config file
clientpacket[0xfa] = strlen(winBCD) + 1; //length of 9
txtptr = clientpacket+0xfb;
strncpy(txtptr, winBCD, strlen(winBCD));
clientpacket[0xfa + strlen(winBCD) + 1] = 0;
clientpacket[0xfa + strlen(winBCD) + 2] = 0xff;
sendto(serverfd,clientpacket,pktsize,0,(struct sockaddr*)&clientaddr,sizeof(clientaddr));
if (verbose) {
sprintf(logmsg, "Path of bootloader:%s. Path of BCD:%s\n", winboot, winBCD);
syslog(LOG_DEBUG, logmsg);
}
}
if (verbose) { closelog();}
}
@@ -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
@@ -14,7 +14,7 @@
# postscript (stateful install) or with the otherpkgs processing of
# genimage (stateless/statelite install). This script will install any
# gpfs update rpms that exist on the xCAT management node in the
# /install/post/gpfs_updates directory.
# /install/post/otherpkgs/gpfs_updates directory.
# This is necessary because the GPFS updates can ONLY be installed
# after the base rpms have been installed, and the update rpms cannot
# exist in any rpm repositories used by xCAT otherpkgs processing
@@ -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
@@ -0,0 +1,6 @@
xcat-openstack-baremetal for Debian
-----------------------------------
<possible notes regarding this package - if none, delete this file>
-- root <root@unknown> Wed, 12 Mar 2014 01:47:54 -0700
@@ -0,0 +1,9 @@
xcat-openstack-baremetal for Debian
-----------------------------------
<this file describes information about the source package, see Debian policy
manual section 4.14. You WILL either need to modify or delete this file>
@@ -0,0 +1,5 @@
xcat-openstack-baremetal (2.8.4-1) unstable; urgency=low
* Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>
-- root <root@unknown> Wed, 12 Mar 2014 01:47:54 -0700
+1
View File
@@ -0,0 +1 @@
8
+14
View File
@@ -0,0 +1,14 @@
Source: xcat-openstack-baremetal
Section: admin
Priority: extra
Maintainer: xCAT <xcat-user@lists.sourceforge.net>
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 3.9.4
Homepage: http://xcat.sourceforge.net/
#Vcs-Git: git://git.debian.org/collab-maint/xcat-openstack-baremetal.git
#Vcs-Browser: http://git.debian.org/?p=collab-maint/xcat-openstack-baremetal.git;a=summary
Package: xcat-openstack-baremetal
Architecture: all
Depends: xCAT-client
Description: Executables and data of the xCAT baremetal driver for OpenStack
+38
View File
@@ -0,0 +1,38 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: xcat-openstack-baremetal
Source: <url://example.com>
Files: *
Copyright: <years> <put author's name and email here>
<years> <likewise for another author>
License: <special license>
<Put the license of the package here indented by 1 space>
<This follows the format of Description: lines in control file>
.
<Including paragraphs>
# If you want to use GPL v2 or later for the /debian/* files use
# the following clauses, or change it to suit. Delete these two lines
Files: debian/*
Copyright: 2014 root <root@unknown>
License: GPL-2+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
# Please avoid to pick license terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.
+7
View File
@@ -0,0 +1,7 @@
opt/xcat/bin
opt/xcat/sbin
opt/xcat/lib/perl/xCAT_plugin
opt/xcat/lib/python/xcat/openstack/baremetal
opt/xcat/share/xcat/openstack/postscripts
opt/xcat/share/man/man1
opt/xcat/share/doc/man1
+2
View File
@@ -0,0 +1,2 @@
xcat-openstack-baremetal_2.8.4-1_all.deb admin extra
xcat-openstack-baremetal_2.8.4-1_all.deb admin extra
+6
View File
@@ -0,0 +1,6 @@
lib/* opt/xcat/lib/
share/xcat/openstack/postscripts/* opt/xcat/share/xcat/openstack/postscripts/
share/man/man1/* opt/xcat/share/man/man1/
share/doc/man1/* opt/xcat/share/doc/man1/
+43
View File
@@ -0,0 +1,43 @@
#!/bin/sh
# postinst script for xcat-openstack-baremetal
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
#copy the postscripts under /installl/postscripts directory on MN only
if [ -f "/etc/xCATMN" ]; then
cp /opt/xcat/share/xcat/openstack/postscripts/* /install/postscripts/
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
+46
View File
@@ -0,0 +1,46 @@
#!/bin/sh
# prerm script for xcat-openstack-baremetal
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
remove|upgrade|deconfigure)
#remove postscripts under /installl/postscripts directory on MN only
if [ -f "/etc/xCATMN" ]; then
for fn in /opt/xcat/share/xcat/openstack/postscripts/*
do
bn=`basename $fn`
rm /install/postscripts/$bn
done
fi
;;
failed-upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
+44
View File
@@ -0,0 +1,44 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
build:
pwd
`pwd`/xpod2man
clean:
dh_testdir
dh_testroot
dh_clean -d
install:
pwd
dh_testdir
dh_testroot
dh_installdirs
dh_install -X".svn"
chmod 444 `pwd`/debian/xcat-openstack-baremetal/opt/xcat/share/man/man1/*
chmod 644 `pwd`/debian/xcat-openstack-baremetal/opt/xcat/share/doc/man1/*
dh_link
binary-indep: build install
pwd
export
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
binary-arch:
pwd
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
@@ -0,0 +1 @@
1.0
@@ -0,0 +1,201 @@
dh_installdirs
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
@@ -0,0 +1,4 @@
opt/xcat/bin/xcatclient opt/xcat/sbin/deploy_ops_bm_node
opt/xcat/bin/xcatclient opt/xcat/sbin/cleanup_ops_bm_node
opt/xcat/bin/xcatclient opt/xcat/bin/opsaddbmnode
opt/xcat/bin/xcatclientnnr opt/xcat/bin/opsaddimage
@@ -0,0 +1 @@
misc:Depends=
@@ -0,0 +1,965 @@
# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html
package xCAT_plugin::openstack;
BEGIN
{
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
}
use lib "$::XCATROOT/lib/perl";
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::SvrUtils;
use xCAT::NetworkUtils;
use xCAT::Table;
use Data::Dumper;
use File::Path;
use File::Copy;
use Getopt::Long;
Getopt::Long::Configure("bundling");
Getopt::Long::Configure("pass_through");
sub handled_commands {
return {
opsaddbmnode => "openstack", #external command
opsaddimage => "openstack", #external command
deploy_ops_bm_node => "openstack", #internal command called from the baremetal driver
cleanup_ops_bm_node => "openstack", #internal command called from the baremetal driver
}
}
sub process_request {
my $request = shift;
my $callback = shift;
my $doreq = shift;
my $command = $request->{command}->[0];
if ($command eq "opsaddbmnode") {
return opsaddbmnode($request, $callback, $doreq);
} elsif ($command eq "opsaddimage") {
return opsaddimage($request, $callback, $doreq);
} elsif ($command eq "deploy_ops_bm_node") {
return deploy_ops_bm_node($request, $callback, $doreq);
} elsif ($command eq "cleanup_ops_bm_node") {
return cleanup_ops_bm_node($request, $callback, $doreq);
} else {
$callback->({error=>["Unsupported command: $command."],errorcode=>[1]});
return 1;
}
}
#-------------------------------------------------------------------------------
=head3 opsaddbmnode
This function takes the xCAT nodes and register them
as the OpenStack baremetal nodes
=cut
#-------------------------------------------------------------------------------
sub opsaddbmnode {
my $request = shift;
my $callback = shift;
my $doreq = shift;
@ARGV = @{$request->{arg}};
Getopt::Long::Configure("bundling");
Getopt::Long::Configure("no_pass_through");
my $help;
my $version;
my $verbose;
my $host;
if(!GetOptions(
'h|help' => \$help,
'v|version' => \$version,
'V|verbose' => \$verbose,
's=s' => \$host,
))
{
&opsaddbmnode_usage($callback);
return 1;
}
# display the usage if -h or --help is specified
if ($help) {
&opsaddbmnode_usage($callback);
return 0;
}
# display the version statement if -v or --verison is specified
if ($version)
{
my $rsp={};
$rsp->{data}->[0]= xCAT::Utils->Version();
$callback->($rsp);
return 0;
}
if (!$request->{node}) {
$callback->({error=>["Please specify at least one node."],errorcode=>[1]});
return 1;
}
if (!$host) {
$callback->({error=>["Please specify the OpenStack compute host name with -s flag."],errorcode=>[1]});
return 1;
}
my $nodes = $request->{node};
#get node mgt
my $nodehmhash;
my $nodehmtab = xCAT::Table->new("nodehm");
if ($nodehmtab) {
$nodehmhash = $nodehmtab->getNodesAttribs($nodes,['power', 'mgt']);
}
#get bmc info for the nodes
my $ipmitab = xCAT::Table->new("ipmi", -create => 0);
my $tmp_ipmi;
if ($ipmitab) {
$tmp_ipmi = $ipmitab->getNodesAttribs($nodes, ['bmc','username', 'password'], prefetchcache=>1);
#print Dumper($tmp_ipmi);
} else {
$callback->({error=>["Cannot open the ipmi table."],errorcode=>[1]});
return 1;
}
#get mac for the nodes
my $mactab = xCAT::Table->new("mac", -create => 0);
my $tmp_mac;
if ($mactab) {
$tmp_mac = $mactab->getNodesAttribs($nodes, ['mac'], prefetchcache=>1);
#print Dumper($tmp_mac);
} else {
$callback->({error=>["Cannot open the mac table."],errorcode=>[1]});
return 1;
}
#get cpu, memory and disk info for the nodes
my $hwinvtab = xCAT::Table->new("hwinv", -create => 0);
my $tmp_hwinv;
if ($hwinvtab) {
$tmp_hwinv = $hwinvtab->getNodesAttribs($nodes, ['cpucount', 'memory', 'disksize'], prefetchcache=>1);
#print Dumper($tmp_hwinv);
} else {
$callback->({error=>["Cannot open the hwinv table."],errorcode=>[1]});
return 1;
}
#get default username and password for bmc
my $d_bmcuser;
my $d_bmcpasswd;
my $passtab = xCAT::Table->new('passwd');
if ($passtab) {
($tmp_passwd)=$passtab->getAttribs({'key'=>'ipmi'},'username','password');
if (defined($tmp_passwd)) {
$d_bmcuser = $tmp_passwd->{username};
$d_bmcpasswd = $tmp_passwd->{password};
}
}
#print "d_bmcuser=$d_bmcuser, d_bmcpasswd=$d_bmcpasswd \n";
foreach my $node (@$nodes) {
#collect the node infomation needed for each node, some info
my $mgt;
my $ref_nodehm = $nodehmhash->{$node}->[0];
if ($ref_nodehm) {
if ($ref_nodehm->{'power'}) {
$mgt = $ref_nodehm->{'power'};
} elsif ($ref_nodehm->{'mgt'}) {
$mgt = $ref_nodehm->{'mgt'};
}
}
my ($bmc, $bmc_user, $bmc_password, $mac, $cpu, $memory, $disk);
if (($mgt) && ($mgt eq 'ipmi')) {
my $ref_ipmi = $tmp_ipmi->{$node}->[0];
if ($ref_ipmi) {
if (exists($ref_ipmi->{bmc})) {
$bmc = $ref_ipmi->{bmc};
}
if (exists($ref_ipmi->{username})) {
$bmc_user = $ref_ipmi->{username};
if (exists($ref_ipmi->{password})) {
$bmc_password = $ref_ipmi->{password};
}
} else { #take the default if they cannot be found on ipmi table
if ($d_bmcuser) { $bmc_user = $d_bmcuser; }
if ($d_bmcpasswd) { $bmc_password = $d_bmcpasswd; }
}
}
} # else { # for hardware control point other than ipmi, just fake it in OpenStack.
#$bmc = "0.0.0.0";
#$bmc_user = "xCAT";
#$bmc_password = "xCAT";
#}
my $ref_mac = $tmp_mac->{$node}->[0];
if ($ref_mac) {
if (exists($ref_mac->{mac})) {
$mac = $ref_mac->{mac};
}
}
$ref_hwinv = $tmp_hwinv->{$node}->[0];
if ($ref_hwinv) {
if (exists($ref_hwinv->{cpucount})) {
$cpu = $ref_hwinv->{cpucount};
}
if (exists($ref_hwinv->{memory})) {
$memory = $ref_hwinv->{memory};
#TODO: what if the unit is not in MB? We need to convert it to MB
$memory =~ s/MB|mb//g;
}
if (exists($ref_hwinv->{disksize})) {
#The format of the the disk size is: sda:250GB,sdb:250GB or just 250GB
#We need to get the size of the first one
$disk = $ref_hwinv->{disksize};
my @a = split(',', $disk);
my @b = split(':', $a[0]);
if (@b > 1) {
$disk = $b[1];
} else {
$disk = $b[0];
}
#print "a=@a, b=@b\n";
#TODO: what if the unit is not in GB? We need to convert it to MB
$disk =~ s/GB|gb//g;
}
}
#some info are mendatory
if (!$mac) {
$callback->({error=>["Mac address is not defined in the mac table for node $node."],errorcode=>[1]});
next;
}
if (!$cpu) {
#default cpu count is 1
$cpu = 1;
}
if (!$memory) {
#default memory size is 1024MB=1GB
$memory = 1024;
}
if (!$disk) {
#default disk size is 1GB
$disk = 1;
}
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.
my $cmd_tmp = "nova baremetal-node-create";
if ($bmc) {
#make sure it is an ip address
if (($bmc !~ /\d+\.\d+\.\d+\.\d+/) && ($bmc !~ /:/)) {
$bmc = xCAT::NetworkUtils->getipaddr($bmc);
}
$cmd_tmp .= " --pm_address=$bmc";
}
if ($bmc_user) {
$cmd_tmp .= " --pm_user=$bmc_user";
}
if ($bmc_password) {
$cmd_tmp .= " --pm_password=$bmc_password";
}
$cmd_tmp .= " $host $cpu $memory $disk $mac";
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);
if ($::RUNCMD_RC != 0) {
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);
}
}
}
}
#-------------------------------------------------------------------------------
=head3 opsaddimage
This function takes the xCAT nodes and register them
as the OpenStack baremetal nodes
=cut
#-------------------------------------------------------------------------------
sub opsaddimage {
my $request = shift;
my $callback = shift;
my $doreq = shift;
@ARGV = @{$request->{arg}};
Getopt::Long::Configure("bundling");
Getopt::Long::Configure("no_pass_through");
my $help;
my $version;
my $verbose;
#my $cloud;
my $ops_img_names;
my $controller;
if(!GetOptions(
'h|help' => \$help,
'v|version' => \$version,
'V|verbose' => \$verbose,
'c=s' => \$controller,
'n=s' => \$ops_img_names,
))
{
&opsaddimage_usage($callback);
return 1;
}
# display the usage if -h or --help is specified
if ($help) {
&opsaddimage_usage($callback);
return 0;
}
# display the version statement if -v or --verison is specified
if ($version)
{
my $rsp={};
$rsp->{data}->[0]= xCAT::Utils->Version();
$callback->($rsp);
return 0;
}
if (@ARGV ==0) {
$callback->({error=>["Please specify an image name or a list of image names."],errorcode=>[1]});
return 1;
}
#make sure the input cloud name is valid.
#if (!$cloud) {
# $callback->({error=>["Please specify the name of the cloud with -c flag."],errorcode=>[1]});
# return 1;
#} else {
# my $cloudstab = xCAT::Table->new('clouds', -create => 0);
# my @et = $cloudstab->getAllAttribs('name', 'controller');
# if(@et) {
# foreach my $tmp_et (@et) {
# if ($tmp_et->{name} eq $cloud) {
# if ($tmp_et->{controller}) {
# $controller = $tmp_et->{controller};
# last;
# } else {
# $callback->({error=>["Please specify the controller in the clouds table for the cloud: $cloud."],errorcode=>[1]});
# return 1;
# }
# }
# }
# }
if (!$controller) {
$callback->({error=>["Please specify the OpenStack controller node name with -c."],errorcode=>[1]});
return 1;
}
#}
#make sure that the images from the command are valid image names
@images = split(',', $ARGV[0]);
@new_names = ();
if ($ops_img_names) {
@new_names = split(',', $ops_img_names);
}
#print "images=@images, new image names=@new_names, controller=$controller\n";
my $image_hash = {};
my $osimgtab = xCAT::Table->new('osimage', -create => 0);
my @et = $osimgtab->getAllAttribs('imagename');
if(@et) {
foreach my $tmp_et (@et) {
$image_hash->{$tmp_et->{imagename}}{'xCAT'} = 1;
}
}
my @bad_images;
foreach my $image (@images) {
if (!exists($image_hash->{$image})) {
push @bad_images, $image;
}
}
if (@bad_images > 0) {
$callback->({error=>["The following images cannot be found in xCAT osimage table:\n " . join("\n ", @bad_images) . "\n"],errorcode=>[1]});
return 1;
}
my $index=0;
foreach my $image (@images) {
my $new_name = shift(@new_names);
if (!$new_name) {
$new_name = $image; #the default new name is xCAT image name
}
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;$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);
}
}
}
#-------------------------------------------------------------------------------
=head3 deploy_ops_bm_node
This is a internel command called by OpenStack xCAT-baremetal driver.
It prepares the node by adding the config_ops_bm_node postbootscript
to the postscript table for the node, then call nodeset and then boot
the node up.
=cut
#-------------------------------------------------------------------------------
sub deploy_ops_bm_node {
my $request = shift;
my $callback = shift;
my $doreq = shift;
@ARGV = @{$request->{arg}};
Getopt::Long::Configure("bundling");
Getopt::Long::Configure("no_pass_through");
my $node = $request->{node}->[0];
my $help;
my $version;
my $img_name;
my $hostname;
my $fixed_ip;
my $netmask;
if(!GetOptions(
'h|help' => \$help,
'v|version' => \$version,
'image=s' => \$img_name,
'host=s' => \$hostname,
'ip=s' => \$fixed_ip,
'mask=s' => \$netmask,
))
{
&deploy_ops_bm_node_usage($callback);
return 1;
}
# display the usage if -h or --help is specified
if ($help) {
&deploy_ops_bm_node_usage($callback);
return 0;
}
# display the version statement if -v or --verison is specified
if ($version)
{
my $rsp={};
$rsp->{data}->[0]= xCAT::Utils->Version();
$callback->($rsp);
return 0;
}
#print "node=$node, image=$img_name, host=$hostname, ip=$fixed_ip, mask=$netmask\n";
#validate the image name
my $osimagetab = xCAT::Table->new('osimage', -create=>1);
my $ref = $osimagetab->getAttribs({imagename => $img_name}, 'imagename');
if (!$ref) {
$callback->({error=>["Invalid image name: $img_name."],errorcode=>[1]});
return 1;
}
#check if the fixed ip is within the xCAT management network.
#get the master ip address for the node then check if the master ip and
#the OpenStack fixed_ip are on the same subnet.
#my $same_nw = 0;
#my $master = xCAT::TableUtils->GetMasterNodeName($node);
#my $master_ip = xCAT::NetworkUtils->toIP($master);
#if (xCAT::NetworkUtils::isInSameSubnet($master_ip, $fixed_ip, $netmask, 0)) {
# $same_nw = 1;
#}
#add config_ops_bm_node to the node's postbootscript
my $script = "config_ops_bm_node $hostname $fixed_ip $netmask";
add_postscript($callback, $node, $script);
#run nodeset
my $cmd = qq~osimage=$img_name~;
my $output = xCAT::Utils->runxcmd(
{command => ["nodeset"],
node => [$node],
arg => [$cmd]},
$doreq, -1, 1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "nodeset:";
push @{$rsp->{data}}, "$output";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
#deploy the node now, supported nodehm.mgt values: ipmi, blade,fsp, hmc.
my $hmtab = xCAT::Table->new('nodehm');
my $hment = $hmtab->getNodeAttribs($node,['mgt']);
if ($hment && $hment->{'mgt'}) {
my $mgt = $hment->{'mgt'};
if ($mgt eq 'ipmi') {
deploy_bmc_node($callback, $doreq, $node);
} elsif (($mgt eq 'blade') || ($mgt eq 'fsp')) {
deploy_blade($callback, $doreq, $node);
} elsif ($mgt eq 'hmc') {
deploy_hmc_node($callback, $doreq, $node);
} else {
my $rsp;
push @{$rsp->{data}}, "Node $node: nodehm.mgt=$mgt is not supported in the OpenStack cloud.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
} else {
#nodehm.mgt must setup for node
my $rsp;
push @{$rsp->{data}}, "Node $node: nodehm.mgt cannot be empty in order to deploy.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
# Deploy a rack-mounted node
sub deploy_bmc_node {
my $callback = shift;
my $doreq = shift;
my $node = shift;
#set boot order
my $cmd = qq~net~;
my $output = xCAT::Utils->runxcmd(
{command => ["rsetboot"],
node => [$node],
arg => [$cmd]},
$doreq, -1, 1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "rsetboot:";
push @{$rsp->{data}}, "$output";
xCAT::MsgUtils->message("E", $rsp, $callback);
}
#reboot the node
my $cmd = qq~boot~;
my $output = xCAT::Utils->runxcmd(
{command => ["rpower"],
node => [$node],
arg => [$cmd]},
$doreq, -1, 1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "rpower:";
push @{$rsp->{data}}, "$output";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
# Deploy a blade or fsp controlled node
sub deploy_blade {
my $callback = shift;
my $doreq = shift;
my $node = shift;
#set boot order
my $cmd = qq~net~;
my $output = xCAT::Utils->runxcmd(
{command => ["rbootseq"],
node => [$node],
arg => [$cmd]},
$doreq, -1, 1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "rbootseq:";
push @{$rsp->{data}}, "$output";
xCAT::MsgUtils->message("E", $rsp, $callback);
}
#reboot the node
my $cmd = qq~boot~;
my $output = xCAT::Utils->runxcmd(
{command => ["rpower"],
node => [$node],
arg => [$cmd]},
$doreq, -1, 1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "rpower:";
push @{$rsp->{data}}, "$output";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
# Deploy a node controlled by HMC
sub deploy_hmc_node {
my $callback = shift;
my $doreq = shift;
my $node = shift;
my $output = xCAT::Utils->runxcmd(
{command => ["rnetboot"],
node => [$node]},
$doreq, -1, 1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "rnetboot:";
push @{$rsp->{data}}, "$output";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
#-------------------------------------------------------------------------------
=head3 cleanup_ops_bm_node
This is a internel command called by OpenStack xCAT-baremetal driver.
It undoes all the changes made by deploy_ops_bm_node command. It removes
the config_ops_bmn_ode postbootscript from the postscript table for the
node, removes the alias ip and then power off the node.
=cut
#-------------------------------------------------------------------------------
sub cleanup_ops_bm_node {
my $request = shift;
my $callback = shift;
my $doreq = shift;
@ARGV = @{$request->{arg}};
Getopt::Long::Configure("bundling");
Getopt::Long::Configure("no_pass_through");
my $node = $request->{node}->[0];
my $help;
my $version;
my $fixed_ip;
if(!GetOptions(
'h|help' => \$help,
'v|version' => \$version,
'ip=s' => \$fixed_ip,
))
{
&cleanup_ops_bm_node_usage($callback);
return 1;
}
# display the usage if -h or --help is specified
if ($help) {
&cleanup_ops_bm_node_usage($callback);
return 0;
}
# display the version statement if -v or --verison is specified
if ($version)
{
my $rsp={};
$rsp->{data}->[0]= xCAT::Utils->Version();
$callback->($rsp);
return 0;
}
#print "node=$node, ip=$fixed_ip\n";
#removes the config_ops_bm_node postbootscript from the postscripts table
remove_postscript($callback, $node, "config_ops_bm_node");
#run updatenode to remove the ip alias
my $cmd = qq~-P deconfig_ops_bm_node $fixed_ip~;
my $output = xCAT::Utils->runxcmd(
{command => ["updatenode"],
node => [$node],
arg => [$cmd]},
$doreq, -1, 1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "updatenode:";
push @{$rsp->{data}}, "$output";
xCAT::MsgUtils->message("E", $rsp, $callback);
}
#turn the node power off
$ssh_ok = 0;
my $cmd = qq~stat~;
my $output = xCAT::Utils->runxcmd(
{command => ["rpower"],
node => [$node],
arg => [$cmd]},
$doreq, -1, 1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "rpower:";
push @{$rsp->{data}}, "$output";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
} else {
if ($output !~ /: off/) {
#power off the node
my $cmd = qq~off~;
my $output = xCAT::Utils->runxcmd(
{command => ["rpower"],
node => [$node],
arg => [$cmd]},
$doreq, -1, 1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "rpower:";
push @{$rsp->{data}}, "$output";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
}
}
#-------------------------------------------------------
=head3 add_postscript
It adds the 'config_ops_bm_node' postbootscript to the
postscript table for the given node.
=cut
#-------------------------------------------------------
sub add_postscript {
my $callback=shift;
my $node=shift;
my $script=shift;
#print "script=$script\n";
my $posttab=xCAT::Table->new("postscripts", -create =>1);
my %setup_hash;
my $ref = $posttab->getNodeAttribs($node,[qw(postscripts postbootscripts)]);
my $found=0;
if ($ref) {
if (exists($ref->{postscripts})) {
my @a = split(/,/, $ref->{postscripts});
if (grep(/^config_ops_bm_node/, @a)) {
$found = 1;
if (!grep(/^$script$/, @a)) {
#not exact match, must replace it with the new script
for (@a) {
s/^config_ops_bm_node.*$/$script/;
}
my $new_post = join(',', @a);
$setup_hash{$node}={postscripts=>"$new_post"};
}
}
}
if (exists($ref->{postbootscripts})) {
my $post=$ref->{postbootscripts};
my @old_a=split(',', $post);
if (grep(/^config_ops_bm_node/, @old_a)) {
if (!grep(/^$script$/, @old_a)) {
#not exact match, will replace it with new script
for (@old_a) {
s/^config_ops_bm_node.*$/$script/;
}
my $new_postboot = join(',', @old_a);
$setup_hash{$node}={postbootscripts=>"$new_postboot"};
}
} else {
if (! $found) {
$setup_hash{$node}={postbootscripts=>"$post,$script"};
}
}
} else {
if (! $found) {
$setup_hash{$node}={postbootscripts=>"$script"};
}
}
} else {
$setup_hash{$node}={postbootscripts=>"$script"};
}
if (keys(%setup_hash) > 0) {
$posttab->setNodesAttribs(\%setup_hash);
}
return 0;
}
#-------------------------------------------------------
=head3 remove_postscript
It removes the 'config_ops_bm_node' postbootscript from
the postscript table for the given node.
=cut
#-------------------------------------------------------
sub remove_postscript {
my $callback=shift;
my $node=shift;
my $script=shift;
my $posttab=xCAT::Table->new("postscripts", -create =>1);
my %setup_hash;
my $ref = $posttab->getNodeAttribs($node,[qw(postscripts postbootscripts)]);
my $found=0;
if ($ref) {
if (exists($ref->{postscripts})) {
my @old_a = split(/,/, $ref->{postscripts});
my @new_a = grep(!/^$script/, @old_a);
if (scalar(@new_a) != scalar(@old_a)) {
my $new_post = join(',', @new_a);
$setup_hash{$node}={postscripts=>"$new_post"};
}
}
if (exists($ref->{postbootscripts})) {
my @old_b = split(/,/, $ref->{postbootscripts});
my @new_b = grep(!/^$script/, @old_b);
if (scalar(@new_b) != scalar(@old_b)) {
my $new_post = join(',', @new_b);
$setup_hash{$node}={postbootscripts=>"$new_post"};
}
}
}
if (keys(%setup_hash) > 0) {
$posttab->setNodesAttribs(\%setup_hash);
}
return 0;
}
#-------------------------------------------------------------------------------
=head3 opsaddbmnode_usage
The usage text for opsaddbmnode command.
=cut
#-------------------------------------------------------------------------------
sub opsaddbmnode_usage {
my $cb=shift;
my $rsp={};
$rsp->{data}->[0]= "Usage: opsaddbmnode -h";
$rsp->{data}->[1]= " opsaddbmnode -v";
$rsp->{data}->[2]= " opsaddbmnode <noderange> -s <service_host> [-V]";
$cb->($rsp);
}
#-------------------------------------------------------------------------------
=head3 opsaddimage_usage
The usage text for opsaddimage command.
=cut
#-------------------------------------------------------------------------------
sub opsaddimage_usage {
my $cb=shift;
my $rsp={};
$rsp->{data}->[0]= "Usage: opsaddimage -h";
$rsp->{data}->[1]= " opsaddimage -v";
$rsp->{data}->[2]= " opsaddimage <image1,image2...> [-n <new_name1,new_name2...> -c <controller> [-V]";
$cb->($rsp);
}
#-------------------------------------------------------------------------------
=head3 deploy_ops_bm_node_usage
The usage text for deploy_ops_bm_node command.
=cut
#-------------------------------------------------------------------------------
sub deploy_ops_bm_node_usage {
my $cb=shift;
my $rsp={};
$rsp->{data}->[0]= "Usage: deploy_ops_bm_node -h";
$rsp->{data}->[1]= " deploy_ops_bm_node -v";
$rsp->{data}->[2]= " deploy_ops_bm_node <node> --image <image_name> --host <ops_hostname> --ip <ops_fixed_ip> --mask <netmask>";
$cb->($rsp);
}
#-------------------------------------------------------------------------------
=head3 cleanup_ops_bm_node_usage
The usage text cleanup_ops_bm_node command.
=cut
#-------------------------------------------------------------------------------
sub cleanup_ops_bm_node_usage {
my $cb=shift;
my $rsp={};
$rsp->{data}->[0]= "Usage: cleanup_ops_bm_node -h";
$rsp->{data}->[1]= " cleanup_ops_bm_node -v";
$rsp->{data}->[2]= " cleanup_ops_bm_node <node> [--ip <ops_fixed_ip>]";
$cb->($rsp);
}
1;
@@ -0,0 +1,17 @@
# Copyright (c) 2012 NTT DOCOMO, INC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from xcat.openstack.baremetal import driver
BareMetalDriver = driver.xCATBareMetalDriver
@@ -0,0 +1,256 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# coding=utf-8
"""
A driver for Bare-metal platform.
"""
from oslo.config import cfg
from nova.compute import power_state
from nova import context as nova_context
from nova import exception
from nova.openstack.common import excutils
from nova.openstack.common.gettextutils import _
from nova.openstack.common import importutils
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.virt.baremetal import baremetal_states
from nova.virt.baremetal import db
from nova.virt.baremetal import driver as bm_driver
from nova.virt.baremetal import utils as bm_utils
from nova.virt import driver
from nova.virt import firewall
from nova.virt.libvirt import imagecache
from xcat.openstack.baremetal import xcat_driver
from xcat.openstack.baremetal import exception as xcat_exception
from xcat.openstack.baremetal import power_states
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
CONF.import_opt('use_ipv6', 'nova.netconf')
class xCATBareMetalDriver(bm_driver.BareMetalDriver):
"""BareMetal hypervisor driver."""
def __init__(self, virtapi, read_only=False):
super(xCATBareMetalDriver, self).__init__(virtapi)
self.xcat = xcat_driver.xCAT()
def _get_xCAT_image_name(self, image_meta):
prop = image_meta.get('properties')
xcat_image_name = prop.get('xcat_image_name')
if xcat_image_name:
return xcat_image_name
else:
raise xcat_exception.xCATInvalidImageError(image=image_meta.get('name'))
def spawn(self, context, instance, image_meta, injected_files,
admin_password, network_info=None, block_device_info=None):
"""
Create a new instance/VM/domain on the virtualization platform.
Once this successfully completes, the instance should be
running (power_state.RUNNING).
If this fails, any partial instance should be completely
cleaned up, and the virtualization platform should be in the state
that it was before this call began.
:param context: security context
:param instance: Instance object as returned by DB layer.
This function should use the data there to guide
the creation of the new instance.
:param image_meta: image object returned by nova.image.glance that
defines the image from which to boot this instance
:param injected_files: User files to inject into instance.
:param admin_password: Administrator password to set in instance.
:param network_info:
:py:meth:`~nova.network.manager.NetworkManager.get_instance_nw_info`
:param block_device_info: Information about block devices to be
attached to the instance.
"""
#import pdb
#pdb.set_trace()
node_uuid = self._require_node(instance)
node = db.bm_node_associate_and_update(context, node_uuid,
{'instance_uuid': instance['uuid'],
'instance_name': instance['hostname'],
'task_state': baremetal_states.BUILDING})
try:
self._plug_vifs(instance, network_info, context=context)
self._attach_block_devices(instance, block_device_info)
self._start_firewall(instance, network_info)
macs = self.macs_for_instance(instance)
nodename = self.xcat.get_xcat_node_name(macs)
imagename = self._get_xCAT_image_name(image_meta)
hostname = instance.get('hostname')
#get the network information for the new node
interfaces = bm_utils.map_network_interfaces(network_info, CONF.use_ipv6)
if CONF.use_ipv6:
fixed_ip = interfaces[0].get('address_v6')
netmask = interfaces[0].get('netmask_v6')
gateway = interfaces[0].get('gateway_v6')
else:
fixed_ip = interfaces[0].get('address')
netmask = interfaces[0].get('netmask')
gateway = interfaces[0].get('gateway')
#convert netmask from IPAddress to unicode string
if netmask:
netmask = unicode(netmask)
#let xCAT install it
bm_driver._update_state(context, node, instance, baremetal_states.DEPLOYING)
self.xcat.deploy_node(nodename, imagename, hostname, fixed_ip, netmask, gateway)
bm_driver._update_state(context, node, instance, baremetal_states.ACTIVE)
except Exception as e:
with excutils.save_and_reraise_exception():
LOG.error(_("Error occured while deploying instance %(instance)s "
"on baremetal node %(node)s: %(error)s") %
{'instance': instance['uuid'],
'node': node['uuid'],
'error':str(e)})
bm_driver._update_state(context, node, instance, baremetal_states.ERROR)
def reboot(self, context, instance, network_info, reboot_type,
block_device_info=None, bad_volumes_callback=None):
"""Reboot the specified instance.
After this is called successfully, the instance's state
goes back to power_state.RUNNING. The virtualization
platform should ensure that the reboot action has completed
successfully even in cases in which the underlying domain/vm
is paused or halted/stopped.
:param instance: Instance object as returned by DB layer.
:param network_info:
:py:meth:`~nova.network.manager.NetworkManager.get_instance_nw_info`
:param reboot_type: Either a HARD or SOFT reboot
:param block_device_info: Info pertaining to attached volumes
:param bad_volumes_callback: Function to handle any bad volumes
encountered
"""
try:
node = bm_driver._get_baremetal_node_by_instance_uuid(instance['uuid'])
macs = self.macs_for_instance(instance)
nodename = self.xcat.get_xcat_node_name(macs)
self.xcat.reboot_node(nodename)
bm_driver._update_state(context, node, instance, baremetal_states.RUNNING)
except xcat_exception.xCATCommandError as e:
with excutils.save_and_reraise_exception():
LOG.error(_("Error occured while rebooting instance %(instance)s "
"on baremetal node %(node)s: %(error)s") %
{'instance': instance['uuid'],
'node': node['uuid'],
'error':str(e)})
bm_driver._update_state(context, node, instance, baremetal_states.ERROR)
def destroy(self, instance, network_info, block_device_info=None,
context=None):
"""Destroy (shutdown and delete) the specified instance.
If the instance is not found (for example if networking failed), this
function should still succeed. It's probably a good idea to log a
warning in that case.
:param context: security context
:param instance: Instance object as returned by DB layer.
:param network_info:
:py:meth:`~nova.network.manager.NetworkManager.get_instance_nw_info`
:param block_device_info: Information about block devices that should
be detached from the instance.
:param destroy_disks: Indicates if disks should be destroyed
"""
#import pdb
#pdb.set_trace()
context = nova_context.get_admin_context()
try:
node = bm_driver._get_baremetal_node_by_instance_uuid(instance['uuid'])
except exception.InstanceNotFound:
LOG.warning(_("Destroy function called on a non-existing instance %s")
% instance['uuid'])
return
try:
macs = self.macs_for_instance(instance)
nodename = self.xcat.get_xcat_node_name(macs)
interfaces = bm_utils.map_network_interfaces(network_info, CONF.use_ipv6)
fixed_ip=None
if interfaces and interfaces[0]:
if CONF.use_ipv6:
fixed_ip = interfaces[0].get('address_v6')
else:
fixed_ip = interfaces[0].get('address')
if fixed_ip:
self.xcat.cleanup_node(nodename, fixed_ip)
else:
self.xcat.cleanup_node(nodename)
except Exception as e:
#just log it and move on
LOG.warning(_("Destroy called with xCAT error:" + str(e)))
try:
self._detach_block_devices(instance, block_device_info)
self._stop_firewall(instance, network_info)
self._unplug_vifs(instance, network_info)
bm_driver._update_state(context, node, None, baremetal_states.DELETED)
except Exception as e:
with excutils.save_and_reraise_exception():
LOG.error(_("Error occurred while destroying instance %s: %s")
% (instance['uuid'], str(e)))
bm_driver._update_state(context, node, instance,
baremetal_states.ERROR)
def power_off(self, instance, node=None):
"""Power off the specified instance."""
macs = self.macs_for_instance(instance)
nodename = self.xcat.get_xcat_node_name(macs)
self.xcat.power_off_node(nodename)
def power_on(self, context, instance, network_info, block_device_info=None,
node=None):
"""Power on the specified instance."""
macs = self.macs_for_instance(instance)
nodename = self.xcat.get_xcat_node_name(macs)
self.xcat.power_on_node(nodename)
def get_console_output(self, instance):
pass
def get_info(self, instance):
"""Get the current status of an instance, by name (not ID!)
Returns a dict containing:
:state: the running state, one of the power_state codes
:max_mem: (int) the maximum memory in KBytes allowed
:mem: (int) the memory in KBytes used by the domain
:num_cpu: (int) the number of virtual CPUs for the domain
:cpu_time: (int) the CPU time used in nanoseconds
"""
node = bm_driver._get_baremetal_node_by_instance_uuid(instance['uuid'])
macs = self.macs_for_instance(instance)
nodename = self.xcat.get_xcat_node_name(macs)
ps = self.xcat.get_node_power_state(nodename)
if ps == power_states.ON:
pstate = power_state.RUNNING
elif ps == power_states.OFF:
pstate = power_state.SHUTDOWN
else:
pstate = power_state.NOSTATE
return {'state': pstate,
'max_mem': node['memory_mb'],
'mem': node['memory_mb'],
'num_cpu': node['cpus'],
'cpu_time': 0}
@@ -0,0 +1,41 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
"""xCAT baremtal exceptions.
"""
import functools
import sys
from oslo.config import cfg
import webob.exc
from nova.openstack.common import excutils
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova import safe_utils
from nova import exception as nova_exception
LOG = logging.getLogger(__name__)
class xCATException(Exception):
errmsg = _("xCAT general exception")
def __init__(self, errmsg=None, **kwargs):
if not errmsg:
errmsg = self.errmsg
errmsg = errmsg % kwargs
super(xCATException, self).__init__(errmsg)
class xCATCommandError(xCATException):
errmsg = _("Error returned when calling xCAT command %(cmd)s"
" for node %(node)s:%(error)s")
class xCATInvalidImageError(xCATException):
errmsg = _("The image %(image)s is not an xCAT image")
class xCATDeploymentFailure(xCATException):
errmsg = _("xCAT node deployment failed for node %(node)s:%(error)s")
class xCATRebootFailure(xCATException):
errmsg = _("xCAT node rebooting failed for node %(node)s:%(error)s")
@@ -0,0 +1,9 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
"""
Possible xCAT node power states.
"""
OFF = 'off'
ON = 'on'
ERROR = 'error'
@@ -0,0 +1,260 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# coding=utf-8
"""
Baremetal xCAT power manager.
"""
import os
import sys
import stat
from oslo.config import cfg
import datetime
from nova import context as nova_context
from nova.virt.baremetal import baremetal_states
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.openstack.common import loopingcall
from nova.openstack.common import timeutils
from nova import paths
from nova import utils
from xcat.openstack.baremetal import exception
from xcat.openstack.baremetal import power_states
LOG = logging.getLogger(__name__)
# register configuration options
xcat_opts = [
cfg.IntOpt('deploy_timeout',
help='Timeout for node deployment. Default: 0 second (unlimited)',
default=0),
cfg.IntOpt('reboot_timeout',
help='Timeout for rebooting a node. Default: 0 second (unlimited)',
default=0),
cfg.IntOpt('deploy_checking_interval',
help='Checking interval for node deployment. Default: 10 seconds',
default=10),
cfg.IntOpt('reboot_checking_interval',
help='Checking interval for rebooting a node. Default: 5 seconds',
default=5),
]
xcat_group = cfg.OptGroup(name='xcat',
title='xCAT Options')
CONF = cfg.CONF
CONF.register_group(xcat_group)
CONF.register_opts(xcat_opts, xcat_group)
class xCAT(object):
"""A driver that calls xCAT funcions"""
def __init__(self):
#setup the path for xCAT commands
#xcatroot = os.getenv('XCATROOT', '/opt/xcat/')
#sys.path.append("%s/bin" % xcatroot)
#sys.path.append("%s/sbin" % xcatroot)
pass
def _exec_xcat_command(self, command):
"""Calls xCAT command."""
args = command.split(" ")
out, err = utils.execute(*args, run_as_root=True)
LOG.debug(_("xCAT command stdout: '%(out)s', stderr: '%(err)s'"),
{'out': out, 'err': err})
return out, err
def get_xcat_node_name(self, macs):
"""Get the xcat node name given mac addressed.
It uses the mac address to search for the node name in xCAT.
"""
for mac in macs:
out, err = self._exec_xcat_command("lsdef -w mac=%s" % mac)
if out:
return out.split(" ")[0]
errstr='No node found in xCAT with the following mac address: ' \
+ ','.join(macs)
LOG.warning(errstr)
raise exception.xCATCommandError(errstr)
def deploy_node(self, nodename, imagename, hostname, fixed_ip, netmask, gateway):
"""
Install the node.
It calls xCAT command deploy_ops_bmnode which prepares the node
by adding the config_ops_bm_node postbootscript to the postscript
table for the node, then call nodeset and then boot the node up.
"""
out, err = self._exec_xcat_command(
"deploy_ops_bm_node %(node)s --image %(image)s"
" --host %(host)s --ip %(ip)s --mask %(mask)s"
% {'node': nodename,
'image': imagename,
'host': hostname,
'ip': fixed_ip,
'mask': netmask,
})
if err:
errstr = _("Error returned when calling xCAT deploy_ops_bm_node"
" command for node %s:%s") % (nodename, err)
LOG.warning(errstr)
raise exception.xCATCommandError(errstr)
self._wait_for_node_deploy(nodename)
def cleanup_node(self, nodename, fixed_ip=None):
"""
Undo all the changes made to the node by deploy_node function.
It calls xCAT command cleanup_ops_bm_node which removes the
config_ops_bm_node postbootscript from the postscript table
for the node, removes the alias ip and then power the node off.
"""
cmd = "cleanup_ops_bm_node %s" % nodename
if fixed_ip:
cmd += " --ip %s" % fixed_ip
out, err = self._exec_xcat_command(cmd)
if err:
errstr = _("Error returned when calling xCAT cleanup_ops_bm_node"
" command for node %s:%s") % (nodename, err)
LOG.warning(errstr)
raise exception.xCATCommandError(errstr)
def power_on_node(self, nodename):
"""Power on the node."""
state = self.get_node_power_state(nodename)
if state == power_states.ON:
LOG.warning(_("Powring on node called, but the node %s "
"is already on") % nodename)
out, err = self._exec_xcat_command("rpower %s on" % nodename)
if err:
errstr = _("Error returned when calling xCAT rpower on"
" for node %s:%s") % (nodename, err)
LOG.warning(errstr)
raise exception.xCATCommandError(errstr)
else:
self._wait_for_node_reboot(nodename)
return power_states.ON
def power_off_node(self, nodename):
"""Power off the node."""
state = self.get_node_power_state(nodename)
if state == power_states.OFF:
LOG.warning(_("Powring off node called, but the node %s "
"is already off") % nodename)
out, err = self._exec_xcat_command("rpower %s off" % nodename)
if err:
errstr = _("Error returned when calling xCAT rpower off"
" for node %s:%s") % (nodename, err)
LOG.warning(errstr)
raise exception.xCATCommandError(errstr)
else:
return power_states.OFF
def reboot_node(self, nodename):
"""Reboot the node."""
out, err = self._exec_xcat_command("rpower %s boot" % nodename)
if err:
errstr = _("Error returned when calling xCAT rpower boot"
" for node %s:%s") % (nodename, err)
LOG.warning(errstr)
raise exception.xCATCommandError(errstr)
self._wait_for_node_reboot(nodename)
return power_states.ON
def get_node_power_state(self, nodename):
out, err = self._exec_xcat_command("rpower %s stat" % nodename)
if err:
errstr = _("Error returned when calling xCAT rpower stat"
" for node %s:%s") % (nodename, err)
LOG.warning(errstr)
raise exception.xCATCommandError(errstr)
else:
state = out.split(":")[1]
if state:
state = state.strip()
if state == 'on':
return power_states.ON
elif state == 'off':
return power_states.OFF
return power_states.ERROR
def _wait_for_node_deploy(self, nodename):
"""Wait for xCAT node deployment to complete."""
locals = {'errstr':''}
def _wait_for_deploy():
out,err = self._exec_xcat_command("nodels %s nodelist.status" % nodename)
if err:
locals['errstr'] = _("Error returned when quering node status"
" for node %s:%s") % (nodename, err)
LOG.warning(locals['errstr'])
raise loopingcall.LoopingCallDone()
if out:
node,status = out.split(": ")
status = status.strip()
if status == "booted":
LOG.info(_("Deployment for node %s completed.")
% nodename)
raise loopingcall.LoopingCallDone()
if (CONF.xcat.deploy_timeout and
timeutils.utcnow() > expiration):
locals['errstr'] = _("Timeout while waiting for"
" deployment of node %s.") % nodename
LOG.warning(locals['errstr'])
raise loopingcall.LoopingCallDone()
expiration = timeutils.utcnow() + datetime.timedelta(
seconds=CONF.xcat.deploy_timeout)
timer = loopingcall.FixedIntervalLoopingCall(_wait_for_deploy)
# default check every 10 seconds
timer.start(interval=CONF.xcat.deploy_checking_interval).wait()
if locals['errstr']:
raise exception.xCATDeploymentFailure(locals['errstr'])
def _wait_for_node_reboot(self, nodename):
"""Wait for xCAT node boot to complete."""
locals = {'errstr':''}
def _wait_for_reboot():
out,err = self._exec_xcat_command("nodestat %s" % nodename)
if err:
locals['errstr'] = _("Error returned when quering node status"
" for node %s:%s") % (nodename, err)
LOG.warning(locals['errstr'])
raise loopingcall.LoopingCallDone()
if out:
node,status = out.split(": ")
status = status.strip()
if status == "sshd":
LOG.info(_("Rebooting node %s completed.")
% nodename)
raise loopingcall.LoopingCallDone()
if (CONF.xcat.reboot_timeout and
timeutils.utcnow() > expiration):
locals['errstr'] = _("Timeout while waiting for"
" rebooting node %s.") % nodename
LOG.warning(locals['errstr'])
raise loopingcall.LoopingCallDone()
expiration = timeutils.utcnow() + datetime.timedelta(
seconds=CONF.xcat.reboot_timeout)
timer = loopingcall.FixedIntervalLoopingCall(_wait_for_reboot)
# default check every 5 seconds
timer.start(interval=CONF.xcat.reboot_checking_interval).wait()
if locals['errstr']:
raise exception.xCATRebootFailure(locals['errstr'])
@@ -0,0 +1,92 @@
=head1 NAME
B<opsaddbmnode> - It adds xCAT baremetal nodes to an OpenStack cloud.
=head1 SYNOPSIS
B<opsaddbmnode> I<noderange> B<-s> I<service_host> [B<-V>|B<--verbose>]
B<opsaddbmnode> [B<-h>|B<--help>]
B<opsaddbmnode> [B<-v>|B<--version>]
=head1 DESCRIPTION
The B<opsaddbmnode> command registers xCAT nodes to an OpenStack cloud. An OpenStack nova baremetal node registration command takes several node attributes:
=over
=item BMC ip addresss, user id and password
=item Name of nova compute host which will control this baremetal node
=item Number of CPUs in the node
=item Memory in the node (MB)
=item Local hard disk in the node (GB)
=item MAC address to provision the node
=back
The opsaddbmnode command pulls the above baremetal node information from xCAT tables and calls "nova baremetal-node-create" to register the baremetal node with the OpenStack cloud.
Please make sure the following xCAT tables are filled with correct information for the given nodes before calling this command.
=over
=item ipmi (for BMC ip addresss, user id and password)
=item mac (for MAC address)
=item hwinv (for CPU, memory and disk info.)
=back
=head1 Parameters
I<noderage> is a comma separated node or node group names.
=head1 OPTIONS
=over 10
=item B<-s> The node name of the OpenStack compute host that hosts the baremetal nodes.
=item B<-h|--help> Display usage message.
=item B<-v|--version> The Command Version.
=item B<-V|--verbose> Verbose output.
=back
=head1 RETURN VALUE
0 The command completed successfully.
1 An error has occurred.
=head1 EXAMPLES
=over 3
=item 1
To register node1, node2 and node3 to OpenStack, sv1 is the compute host.
opsassbmnode node1,node2,node3 -s sv1
=back
=head1 FILES
/opt/xcat/bin/opadddbmnode
=head1 SEE ALSO
L<opsaddimage(1)|opsaddimage.1>
@@ -0,0 +1,67 @@
=head1 NAME
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<-V>|B<--verbose>]
B<opsaddimage> [B<-h>|B<--help>]
B<opsaddimage> [B<-v>|B<--version>]
=head1 DESCRIPTION
The B<opsaddimage> command adds a list of xCAT images into the OpenStack cloud.
Under the cover, it creates a fake image and registers the fake image into OpenStack with command B<glance image-create>. It sets the property in the image to indicate that this is an xCAT image and also stores the original xCAT image name in the property for further reference.
The xCAT image names can be listed using B<lsdef -t osimage> command.
=head1 Parameters
I<image1,image1...> a comma separated xCAT images names.
=head1 OPTIONS
=over 10
=item B<-n> a comma separated new image names in the OpenStack. If omitted, the default is the original xCAT image nanme.
=item B<-c> the node name of the OpenStack controller. This node must be an xCAT managed node.
=item B<-h|--help> Display usage message.
=item B<-v|--version> The Command Version.
=item B<-V|--verbose> Verbose output.
=back
=head1 RETURN VALUE
0 The command completed successfully.
1 An error has occurred.
=head1 EXAMPLES
=over 3
=item 1.
To register xCAT image rhels6.3-x86_64-install-compute into OpenStack.
opsaddimage rhels6.3-x86_64-install-compute -c sv2
=back
=head1 FILES
/opt/xcat/bin/opsaddimage
=head1 SEE ALSO
L<opsaddbmnode(1)|opsaddbmnode.1>
@@ -0,0 +1,215 @@
#!/bin/sh
# IBM(c) 2014 EPL license http://www.eclipse.org/legal/epl-v10.html
# xCAT post script for configuring the openstack baremetal node.
# The format is:
# config_ops_bm_node ops_hostname ops_ip ops_netmask
get_os_type()
{
#get os type
str_os_type=`uname | tr 'A-Z' 'a-z'`
str_temp=''
if [ "$str_os_type" = "linux" ];then
str_temp=`echo $OSVER | grep -E '(sles|suse)'`
if [ -f "/etc/debian_version" ];then
str_os_type="debian"
elif [ -f "/etc/SuSE-release" -o -n "$str_temp" ];then
str_os_type="sles"
else
str_os_type="redhat"
fi
else
str_os_type="aix"
fi
echo "$str_os_type"
}
setup_ip()
{
str_os_type=$1
str_if_name=$2
str_v4ip=$3
str_v4mask=$4
ret=`ifconfig $str_if_name |grep "inet addr" 2>&1`
if [ $? -eq 0 ]; then
old_ip=`echo $ret|cut -d':' -f2 |cut -d' ' -f1`
old_mask=`echo $ret|cut -d':' -f4`
#echo "old ip = $old_ip, old mask=$old_mask"
if [ "$old_ip" == "$str_v4ip" -a "$old_mask" == "$str_v4mask" ]; then
#if nic is up and the address is the same, then donothing
#echo "do nothing"
exit 0
else
#bring down the nic and reconstruct it.
#echo "bring down the old nic"
ifconfig $str_if_name del $old_ip
fi
fi
if [ "$str_os_type" = "sles" ];then
str_conf_file="/etc/sysconfig/network/ifcfg-${str_if_name}"
if [ -f $str_conf_file ]; then
rm $str_conf_file
fi
echo "DEVICE=${str_if_name}" > $str_conf_file
echo "BOOTPROTO=static" >> $str_conf_file
echo "IPADDR=${str_v4ip}" >> $str_conf_file
echo "NETMASK=${str_v4mask}" >> $str_conf_file
echo "NETWORK=''" >> $str_conf_file
echo "STARTMODE=onboot" >> $str_conf_file
echo "USERCONTROL=no" >> $str_conf_file
ifup $str_if_name
#debian ubuntu
elif [ "$str_os_type" = "debian" ];then
str_conf_file="/etc/network/interfaces.d/${str_if_name}"
if [ -f $str_conf_file ]; then
rm $str_conf_file
fi
echo "auto ${str_if_name}" > $str_conf_file
echo "iface ${str_if_name} inet static" >> $str_conf_file
echo " address ${str_v4ip}" >> $str_conf_file
echo " netmask ${str_v4mask}" >> $str_conf_file
ifconfig $str_if_name up
else
# Write the info to the ifcfg file for redhat
str_conf_file="/etc/sysconfig/network-scripts/ifcfg-${str_if_name}"
if [ -f $str_conf_file ]; then
rm $str_conf_file
fi
echo "DEVICE=${str_if_name}" > $str_conf_file
echo "BOOTPROTO=static" >> $str_conf_file
echo "NM_CONTROLLED=no" >> $str_conf_file
echo "IPADDR=${str_v4ip}" >> $str_conf_file
echo "NETMASK=${str_v4mask}" >> $str_conf_file
echo "ONBOOT=yes" >> $str_conf_file
ifup $str_if_name
fi
}
#change hostname permanently
change_host_name()
{
str_os_type=$1
str_hostname=$2
hostname $str_hostname
if [ "$str_os_type" = "sles" ];then
echo "Persistently changing the hostname not implemented yet."
#debian ubuntu and rh7
elif [ -f "/etc/hostname" ];then
conf_file="/etc/hostname"
echo "$str_hostname" > $conf_file
else
conf_file="/etc/sysconfig/network"
if [ ! -f $conf_file ]; then
touch $conf_file
fi
grep 'HOSTNAME' $conf_file 2>&1 > /dev/null
if [ $? -eq 0 ]; then
sed -i "s/HOSTNAME=.*/HOSTNAME=$str_hostname/" $conf_file
else
echo "HOSTNAME=$str_hostname" >> $conf_file
fi
fi
}
str_os_type=$(get_os_type)
echo "os_type=$str_os_type"
if [ "$str_os_type" = "aix" ]; then
logger -t xcat "config_ops_bm_node dose not support AIX."
echo "config_ops_bm_node dose not support AIX."
exit 0
fi
#change the hostname
if [[ -n "$1" ]]; then
change_host_name $str_os_type $1
fi
#Add the openstack ip to the node
if [[ -n $2 ]]; then
ops_ip=$2
if [[ -z $3 ]]; then
logger -t xcat "config_ops_bm_node: Please specify the netmask."
echo "config_ops_bm_node: Please specify the netmask."
exit 1
else
ops_mask=$3
fi
#figure out the install nic
if [[ -n $MACADDRESS ]]; then
pos=0
#mac has the following format: 01:02:03:04:05:0E!node5|01:02:03:05:0F!node6-eth1
for x in `echo "$MACADDRESS" | tr "|" "\n"`
do
node=""
mac=""
pos=$((pos+1))
i=`expr index $x !`
if [[ $i -gt 0 ]]; then
node=`echo ${x##*!}`
mac_tmp=`echo ${x%%!*}`
else
mac_tmp=$x
fi
if [[ $pos -eq 1 ]]; then
mac1=$mac_tmp
fi
if [[ "$PRIMARYNIC" = "$mac_tmp" ]]; then
mac=$mac_tmp
break
fi
if [[ -z "$PRIMARYNIC" ]] || [[ "$PRIMARYNIC" = "mac" ]]; then
if [[ -z $node ]] || [[ "$node" = "$NODE" ]]; then
mac=$mac_tmp
break
fi
fi
done
if [[ -z $mac ]]; then
if [[ -z "$PRIMARYNIC" ]] || [[ "$PRIMARYNIC" = "mac" ]]; then
mac=$mac1 #if nothing mathes, take the first mac
else
nic=$PRIMARYNIC #or the primary nic itself is the nic
fi
fi
else
logger -t xcat "config_ops_bm_node: no mac addresses are defined in the mac table for the node $NODE"
echo "config_ops_bm_node: no mac addresses are defined in the mac table for the node $NODE"
index=$((index+1))
continue
fi
echo "mac=$mac"
#find the nic that has the mac
if [[ -z $nic ]]; then
#go to each nic to match the mac address
ret=`ifconfig |grep -i $mac 2>&1`;
if [ $? -eq 0 ]; then
nic=`echo $ret |head -n1|cut -d' ' -f 1`
else
logger -t xcat "config_ops_bm_node: The mac address for the network for $NODE is not defined."
echo "config_ops_bm_node: The mac address for the network for $NODE is not defined."
fi
fi
echo "nic=$nic"
#now setup the ip alias
setup_ip $str_os_type $nic:0 $ops_ip $ops_mask
fi
@@ -0,0 +1,94 @@
#!/bin/sh
# IBM(c) 2014 EPL license http://www.eclipse.org/legal/epl-v10.html
# xCAT post script for deconfiguring the openstack baremetal node.
# The format is:
# deconfig_ops_bm_node ops_ip
get_os_type()
{
#get os type
str_os_type=`uname | tr 'A-Z' 'a-z'`
str_temp=''
if [ "$str_os_type" = "linux" ];then
str_temp=`echo $OSVER | grep -E '(sles|suse)'`
if [ -f "/etc/debian_version" ];then
str_os_type="debian"
elif [ -f "/etc/SuSE-release" -o -n "$str_temp" ];then
str_os_type="sles"
else
str_os_type="redhat"
fi
else
str_os_type="aix"
fi
echo "$str_os_type"
}
#change hostname permanently
change_host_name()
{
str_os_type=$1
str_hostname=$2
hostname $str_hostname
if [ "$str_os_type" = "sles" ];then
echo "Persistently changing the hostname not implemented yet."
#debian ubuntu and rh7
elif [ -f "/etc/hostname" ];then
conf_file="/etc/hostname"
echo "$str_hostname" > $conf_file
else
conf_file="/etc/sysconfig/network"
if [ ! -f $conf_file ]; then
touch $conf_file
fi
grep 'HOSTNAME' $conf_file 2>&1 > /dev/null
if [ $? -eq 0 ]; then
sed -i "s/HOSTNAME=.*/HOSTNAME=$str_hostname/" $conf_file
else
echo "HOSTNAME=$str_hostname" >> $conf_file
fi
fi
}
str_os_type=$(get_os_type)
echo "os_type=$str_os_type"
if [ $str_os_type == "aix" ]; then
logger -t xcat "deconfig_ops_bm_node dose not support AIX."
echo "deconfig_ops_bm_node dose not support AIX."
exit 0
fi
#change the hostname
#hostname $NODE
change_host_name $str_os_type $NODE
#remove the openstack ip from the node
if [[ -n $1 ]]; then
ops_ip=$1
nic=$(ip addr | grep $ops_ip | awk '{print $NF}')
echo "nic=$nic, ops_ip=$ops_ip"
ifconfig $nic del $ops_ip
#delete the configuration file
if [ "$str_os_type" = "sles" ]; then
str_conf_file="/etc/sysconfig/network/ifcfg-$nic"
elif [ "$str_os_type" = "debian" ]; then #debian ubuntu
str_conf_file="/etc/network/interfaces.d/$nic"
else #redhat
str_conf_file="/etc/sysconfig/network-scripts/ifcfg-$nic"
fi
if [ -f $str_conf_file ]; then
rm $str_conf_file
fi
fi
@@ -0,0 +1,102 @@
Summary: Executables and data of the xCAT baremetal driver for OpenStack
Name: xCAT-OpenStack-baremetal
Version: %(cat Version)
Release: snap%(date +"%Y%m%d%H%M")
Epoch: 4
License: IBM
Group: Applications/System
Source: xCAT-OpenStack-baremetal-%{version}.tar.gz
Packager: IBM Corp.
Vendor: IBM Corp.
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
Prefix: /opt/xcat
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
%ifos linux
BuildArch: noarch
%endif
Provides: xCAT-OpenStack-baremetal = %{epoch}:%{version}
Requires: xCAT-client
%description
xCAT-OpenStack-baremetal provides the baremetal driver for OpenStack.
%prep
%setup -q -n xCAT-OpenStack-baremetal
%build
# Convert pods to man pages and html pages
./xpod2man
%install
# The install phase puts all of the files in the paths they should be in when the rpm is
# installed on a system. The RPM_BUILD_ROOT is a simulated root file system and usually
# has a value like: /var/tmp/xCAT-OpenStack-baremetal-2.0-snap200802270932-root
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{prefix}/bin
mkdir -p $RPM_BUILD_ROOT/%{prefix}/sbin
mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin
mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/python/xcat/openstack/baremetal
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/openstack/postscripts
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/man/man1
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/man1
set +x
cp -R lib/* $RPM_BUILD_ROOT/%{prefix}/lib
cp share/xcat/openstack/postscripts/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/openstack/postscripts
# These were built dynamically in the build phase
cp share/man/man1/* $RPM_BUILD_ROOT/%{prefix}/share/man/man1
chmod 444 $RPM_BUILD_ROOT/%{prefix}/share/man/man1/*
# These were built dynamically during the build phase
cp share/doc/man1/* $RPM_BUILD_ROOT/%{prefix}/share/doc/man1
chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/doc/man1/*
# These links get made in the RPM_BUILD_ROOT/prefix area
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/sbin/deploy_ops_bm_node
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/sbin/cleanup_ops_bm_node
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/opsaddbmnode
ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/opsaddimage
set -x
%clean
# This step does not happen until *after* the %files packaging below
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
#%doc LICENSE.html
# Just package everything that has been copied into RPM_BUILD_ROOT
%{prefix}
%changelog
%post
#copy the postscripts under /installl/postscripts directory on MN only
if [ -f "/etc/xCATMN" ]; then
cp $RPM_INSTALL_PREFIX0/share/xcat/openstack/postscripts/* /install/postscripts/
fi
%preun
#remove postscripts under /installl/postscripts directory on MN only
if [ -f "/etc/xCATMN" ]; then
for fn in $RPM_INSTALL_PREFIX0/share/xcat/openstack/postscripts/*
do
bn=`basename $fn`
rm /install/postscripts/$bn
done
fi
exit 0
+214
View File
@@ -0,0 +1,214 @@
#!/usr/bin/perl
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
# First builds the xCAT summary man page from Synopsis of each man page.
# Then converts all of the pod man pages into html (including links to each other)
# We assume that this script is run in the xCAT-vlan-2.0 dir, so everything is
# done relative to that.
use strict;
#use lib '.';
use Pod::Man;
use Pod::Html;
my $poddir = 'pods';
my $mandir = 'share/man';
my $htmldir = 'share/doc';
my $cachedir = '/tmp';
my @pods = getPodList($poddir);
#foreach (@pods) { print "$_\n"; } exit;
# Build the cmd overview page.
#writesummarypage("$poddir/man1/xcat.1.pod", @pods);
# Build the man page for each pod.
#mkdir($mandir) or die "Error: could not create $mandir.\n";
print "Converting PODs to man pages...\n";
foreach my $podfile (@pods) {
my $manfile = $podfile;
$manfile =~ s/^$poddir/$mandir/; # change the beginning of the path
$manfile =~ s/\.pod$//; # change the ending
my $mdir = $manfile;
$mdir =~ s|/[^/]*$||; # get rid of the basename part
if (system("mkdir -p $mdir")) { die "Error: could not create $mdir.\n"; }
my ($section) = $podfile =~ /\.(\d+)\.pod$/;
convertpod2man($podfile, $manfile, $section);
}
my @dummyPods = createDummyPods($poddir, \@pods);
# Build the html page for each pod.
#mkdir($htmldir) or die "Error: could not create $htmldir.\n";
print "Converting PODs to HTML pages...\n";
# have to clear the cache, because old entries can cause a problem
unlink("$cachedir/pod2htmd.tmp", "$cachedir/pod2htmi.tmp");
foreach my $podfile (@pods) {
my $htmlfile = $podfile;
$htmlfile =~ s/^$poddir/$htmldir/; # change the beginning of the path
$htmlfile =~ s/\.pod$/\.html/; # change the ending
my $hdir = $htmlfile;
$hdir =~ s|/[^/]*$||; # get rid of the basename part
if (system("mkdir -p $hdir")) { die "Error: could not create $hdir.\n"; }
#print "$podfile, $htmlfile, $poddir, $htmldir\n";
convertpod2html($podfile, $htmlfile, $poddir, $htmldir);
}
# Remove the dummy pods
unlink @dummyPods;
rmdir "$poddir/man7";
exit;
# To enable linking between the cmd man pages and the db man pages, need to:
# grep thru the cmd pods searching for references (L<>) to any section 5 man page
# if that pod does not exist, create an empty one that will satisfy pod2html
# keep track of all dummy pods created, so they can be removed later
sub createDummyPods {
my ($poddir, $pods) = @_;
my $cmd = "grep -r -E 'L<.+\\([57]\\)\\|.+\\.[57]>' " . $poddir;
#print "Running cmd: ", $cmd, "\n";
my @lines = `$cmd`;
if ($?) { print "Error running: $cmd\n"; print join('', @lines); }
#my @lines;
#system($cmd);
my @dummyPods;
foreach my $l (@lines) {
#print "$l\n";
my @matches = $l =~ /L<([^\(]+)\(([57])\)\|\1\.[57]>/g; # get all the matches in the line
# The above line should create the array with every other entry being the man page name
# and every other entry is the section # (5 or 7)
my $cmd;
while ($cmd=shift @matches) {
#foreach my $m (@matches) {
my $section = shift @matches;
my $filename = "$poddir/man$section/$cmd.$section.pod";
#print "$filename\n";
if (!(grep /^$filename$/, @$pods) && !(grep /^$filename$/, @dummyPods)) { push @dummyPods, $filename; }
}
}
# Create these empty files
print "Creating empty linked-to files: ", join(', ', @dummyPods), "\n";
mkdir "$poddir/man7";
foreach my $d (@dummyPods) {
if (!open(TMP, ">>$d")) { warn "Could not create dummy pod file $d ($!)\n"; }
else { close TMP; }
}
return @dummyPods;
}
# Recursively get the list of pod man page files.
sub getPodList {
my $poddir = shift;
my @files;
# 1st get toplevel dir listing
opendir(DIR, $poddir) or die "Error: could not read $poddir.\n";
my @topdir = grep !/^\./, readdir(DIR); # /
close(DIR);
# Now go thru each subdir (these are man1, man3, etc.)
foreach my $mandir (@topdir) {
opendir(DIR, "$poddir/$mandir") or die "Error: could not read $poddir/$mandir.\n";
my @dir = grep !/^\./, readdir(DIR); # /
close(DIR);
foreach my $file (@dir) {
push @files, "$poddir/$mandir/$file";
}
}
return sort @files;
}
# Create the xcat man page that gives a summary description of each xcat cmd.
# Not used.
sub writesummarypage {
my $file = shift; # relative path file name of the man page
# the rest of @_ contains the pod files that describe each cmd
open(FILE, ">$file") or die "Error: could not open $file for writing.\n";
print FILE <<'EOS1';
=head1 NAME
B<xcat> - extreme Cluster Administration Tool.
=head1 DESCRIPTION
Extreme Cluster Administration Toolkit (xCAT). xCAT is a scalable distributed computing management
and provisioning tool that provides a unified interface for hardware control, discovery, and
OS diskful/diskfree deployment.
=head1 XCAT DATABASE
All of the cluster configuration information is in the xCAT database. See L<xcatdb(5)|xcatdb.5> for
descriptions of every table in the database.
=head1 XCAT COMMANDS
What follows is a short description of each xCAT command. To get more information about a particular
command, see its man page. Note that the commands are listed in alphabetical order B<within each section>,
i.e. all the commands in section 1, then the commands in section 3, etc.
=over 12
EOS1
# extract the summary for each cmd from its man page
foreach my $manpage (@_) {
my ($sectionnum) = $manpage =~ /\.(\d+)\.pod$/;
# Suck in the whole file, then we will parse it.
open(MANPAGE, "$manpage") or die "Error: could not open $manpage for reading.\n";
my @contents = <MANPAGE>;
my $wholemanpage = join('', @contents);
close(MANPAGE);
# This regex matches: optional space, =head1, space, title, space, cmd, space, description, newline
my ($cmd, $description) = $wholemanpage =~ /^\s*=head1\s+\S+\s+(\S+)\s+(.+?)\n/si;
if (!defined($cmd)) { print "Warning: $manpage is not in a recognized structure. It will be ignored.\n"; next; }
if (!defined($description)) { print "Warning: $manpage does not have a description for $cmd. It will be ignored.\n"; next; }
$cmd =~ s/^.<(.+)>$/$1/; # if the cmd name has pod formatting around it, strip it off
$description =~ s/^-\s*//; # if the description has a leading hypen, strip it off
print FILE "\n=item L<$cmd($sectionnum)|$cmd.$sectionnum>\n\n".$description."\n";
}
# Artificially add the xcattest cmd, because the xCAT-test rpm will add this
print FILE "\n=item L<xcattest(1)|xcattest.1>\n\nRun automated xCAT test cases.\n";
print FILE <<"EOS3";
=back
EOS3
close FILE;
}
# Create the html page for one pod.
sub convertpod2html {
my ($podfile, $htmlfile, $poddir, $htmldir) = @_;
#TODO: use --css=<stylesheet> and --title=<pagetitle> to make the pages look better
pod2html($podfile,
"--outfile=$htmlfile",
"--podpath=man1",
"--podroot=$poddir",
"--htmldir=$htmldir",
"--recurse",
"--cachedir=$cachedir",
);
}
# Create the man page for one pod.
sub convertpod2man {
my ($podfile, $manfile, $section) = @_;
my $parser = Pod::Man->new(section => $section);
$parser->parse_from_file($podfile, $manfile);
}
@@ -91,7 +91,9 @@ template "/etc/quantum/policy.json" do
group node["openstack"]["network"]["platform"]["group"]
mode 00644
notifies :restart, "service[quantum-server]", :delayed
if node.run_list.expand(node.chef_environment).recipes.include?("openstack-network::server")
notifies :restart, "service[quantum-server]", :delayed
end
end
rabbit_server_role = node["openstack"]["network"]["rabbit_server_chef_role"]
@@ -143,12 +145,14 @@ end
# may just be running a subset of agents (like l3_agent)
# and not the api server components, so we ignore restart
# failures here as there may be no quantum-server process
service "quantum-server" do
service_name platform_options["quantum_server_service"]
supports :status => true, :restart => true
ignore_failure true
if node.run_list.expand(node.chef_environment).recipes.include?("openstack-network::server")
service "quantum-server" do
service_name platform_options["quantum_server_service"]
supports :status => true, :restart => true
ignore_failure true
action :nothing
action :nothing
end
end
template "/etc/quantum/quantum.conf" do
@@ -166,7 +170,9 @@ template "/etc/quantum/quantum.conf" do
:service_pass => service_pass
)
notifies :restart, "service[quantum-server]", :delayed
if node.run_list.expand(node.chef_environment).recipes.include?("openstack-network::server")
notifies :restart, "service[quantum-server]", :delayed
end
end
template "/etc/quantum/api-paste.ini" do
@@ -179,7 +185,9 @@ template "/etc/quantum/api-paste.ini" do
"service_pass" => service_pass
)
notifies :restart, "service[quantum-server]", :delayed
if node.run_list.expand(node.chef_environment).recipes.include?("openstack-network::server")
notifies :restart, "service[quantum-server]", :delayed
end
end
directory "/etc/quantum/plugins/#{main_plugin}" do
@@ -336,7 +344,9 @@ when "openvswitch"
:sql_connection => sql_connection,
:local_ip => local_ip
)
notifies :restart, "service[quantum-server]", :delayed
if node.run_list.expand(node.chef_environment).recipes.include?("openstack-network::server")
notifies :restart, "service[quantum-server]", :delayed
end
if node.run_list.expand(node.chef_environment).recipes.include?("openstack-network::openvswitch")
notifies :restart, "service[quantum-plugin-openvswitch-agent]", :delayed
end
@@ -9,31 +9,31 @@
"ref": "f759cd013c0a836f2acb219b3e006ff0a1308878"
},
"memcached": {
"locked_version": "1.4.0"
"locked_version": "1.6.2"
},
"runit": {
"locked_version": "1.1.6"
"locked_version": "1.3.0"
},
"build-essential": {
"locked_version": "1.4.0"
"locked_version": "1.4.2"
},
"yum": {
"locked_version": "2.3.0"
"locked_version": "2.4.0"
},
"sysctl": {
"locked_version": "0.3.3"
},
"apt": {
"locked_version": "2.1.0"
"locked_version": "2.3.0"
},
"git": {
"locked_version": "2.5.2"
"locked_version": "2.7.0"
},
"dmg": {
"locked_version": "1.1.0"
"locked_version": "2.0.4"
},
"windows": {
"locked_version": "1.10.0"
"locked_version": "1.11.0"
},
"chef_handler": {
"locked_version": "1.1.4"
@@ -0,0 +1,46 @@
# CHANGELOG for cookbook-openstack-object-storage
This file is used to list changes made in each version of cookbook-openstack-object-storage.
## 7.1.0:
* Update apt sources to grizzly to prepare for grizzly
and havana branches
## 7.0.11:
* Add missing swift-container-sync upstart service which is
not setup by default in ubuntu 12.04 packages
## 7.0.10:
* Do not role restrict super_admin_key in proxy config
* Case correct swauth_version attribute in proxy recipe
* Treat platform_options["swauth_packages"] as a list
## 7.0.9:
* Bugfix tempurl role restriction
## 7.0.8:
* Bugfix allow_override spacing in proxy server template
## 7.0.7:
* Add flexibility to middleware pipeline
## 7.0.6:
* Add choice of install python-swauth from git or package
## 7.0.5:
* Add support for container-sync
## 7.0.4:
* Allow roles used in searches to be defined by cookbook user
## 7.0.3:
* Bugfix the swift-ring-builder output scanner
## 7.0.2:
* Expand statsd support as well as capacity and recon supporting.
## 7.0.1:
* Support more then 24 disks (/dev/sdaa, /dev/vdab, etc)
## 7.0.0:
* Initial openstack object storage cookbook
@@ -63,6 +63,14 @@ Attributes
* ```default[:swift][:authmode]``` - "swauth" or "keystone" (default "swauth"). Right now, only swauth is supported (defaults to swauth)
* ```default[:swift][:tempurl]``` - "true" or "false". Adds tempurl to the pipeline and sets allow_overrides to true when using swauth
* ```default[:swift][:swauth_source]``` - "git" or "package"(default). Selects between installing python-swauth from git or system package
* ```default[:swift][:swauth_repository]``` - Specifies git repo. Default "https://github.com/gholt/swauth.git"
* ```default[:swift][:swauth_version]``` - Specifies git repo tagged branch. Default "1.0.8"
* ```default[:swift][:swift_secret_databag_name]``` - this cookbook supports an optional secret databag where we will retrieve the following attributes overriding any default attributes below. (defaults to nil)
```
@@ -249,7 +257,7 @@ License and Author
| | |
|:---------------------|:---------------------------------------------------|
| **Authors** | Alan Meadows (<alan.meadows@gmail.com>) |
| | Oisin Feely (<of3434@att.com>) |
| | Oisin Feeley (<of3434@att.com>) |
| | Ron Pedde (<ron.pedde@rackspace.com>) |
| | Will Kelly (<will.kelly@rackspace.com>) |
| | |
@@ -11,7 +11,7 @@ default["swift"]["git_builder_ip"] = "127.0.0.1"
# the release only has any effect on ubuntu, and must be
# a valid release on http://ubuntu-cloud.archive.canonical.com/ubuntu
default["swift"]["release"] = "folsom"
default["swift"]["release"] = "grizzly"
# we support an optional secret databag where we will retrieve the
# following attributes overriding any default attributes here
@@ -25,6 +25,17 @@ default["swift"]["release"] = "folsom"
# }
default["swift"]["swift_secret_databag_name"] = nil
#--------------------
# roles
#--------------------
default["swift"]["setup_chef_role"] = "swift-setup"
default["swift"]["management_server_chef_role"] = "swift-management-server"
default["swift"]["proxy_server_chef_role"] = "swift-proxy-server"
default["swift"]["object_server_chef_role"] = "swift-object-server"
default["swift"]["account_server_chef_role"] = "swift-account-server"
default["swift"]["container_server_chef_role"] = "swift-container-server"
#--------------------
# authentication
#--------------------
@@ -53,7 +64,40 @@ default["swift"]["ring"]["replicas"] = 3
#------------------
# statistics
#------------------
default["swift"]["enable_statistics"] = true
default["swift"]["statistics"]["enabled"] = true
default["swift"]["statistics"]["sample_rate"] = 1
# there are two ways to discover your graphite server ip for
# statsd to periodically publish to. You can directly set
# the ip below, or leave it set to nil and supply chef with
# the role name of your graphite server and the interface
# name to retrieve the appropriate internal ip address from
#
# if no servers with the role below can be found then
# 127.0.0.1 will be used
default["swift"]["statistics"]["graphing_ip"] = nil
default["swift"]["statistics"]["graphing_role"] = 'graphite-role'
default["swift"]["statistics"]["graphing_interface"] = 'eth0'
# how frequently to run chef instantiated /usr/local/bin/swift_statsd_publish.py
# which publishes dispersion and recon statistics (in minutes)
default["swift"]["statistics"]["report_frequency"] = 15
# enable or disable specific portions of generated report
default["swift"]["statistics"]["enable_dispersion_report"] = true
default["swift"]["statistics"]["enable_recon_report"] = true
default["swift"]["statistics"]["enable_disk_report"] = true
# settings for statsd which should be configured to use the local
# statsd daemon that chef will install if statistics are enabled
default["swift"]["statistics"]["statsd_host"] = "127.0.0.1"
default["swift"]["statistics"]["statsd_port"] = "8125"
default["swift"]["statistics"]["statsd_prefix"] = "openstack.swift"
# paths to the recon cache files
default["swift"]["statistics"]["recon_account_cache"] = "/var/cache/swift/account.recon"
default["swift"]["statistics"]["recon_container_cache"] = "/var/cache/swift/container.recon"
default["swift"]["statistics"]["recon_object_cache"] = "/var/cache/swift/object.recon"
#------------------
# network settings
@@ -109,11 +153,52 @@ default["swift"]["disk_test_filter"] = [ "candidate =~ /(sd|hd|xvd|vd)(?!a$)[a-z
"not system('/sbin/parted /dev/' + candidate + ' -s print | grep linux-swap')",
"not info.has_key?('removable') or info['removable'] == 0.to_s" ]
#-------------------
# template overrides
#-------------------
# proxy-server
# override in a wrapper to enable tempurl with swauth
default["swift"]["tempurl"]["enabled"] = false
# container-server
# Override this with an allowed list of your various swift clusters if you wish
# to enable container sync for your end-users between clusters. This should
# be an array of fqdn hostnames for the cluster end-points that your end-users
# would access in the format of ['host1', 'host2', 'host3']
default["swift"]["container-server"]["allowed_sync_hosts"] = []
# container-sync logging settings
default["swift"]["container-server"]["container-sync"]["log_name"] = 'container-sync'
default["swift"]["container-server"]["container-sync"]["log_facility"] = 'LOG_LOCAL0'
default["swift"]["container-server"]["container-sync"]["log_level"] = 'INFO'
# If you need to use an HTTP Proxy, set it here; defaults to no proxy.
default["swift"]["container-server"]["container-sync"]["sync_proxy"] = nil
# Will sync, at most, each container once per interval (in seconds)
default["swift"]["container-server"]["container-sync"]["interval"] = 300
# Maximum amount of time to spend syncing each container per pass (in seconds)
default["swift"]["container-server"]["container-sync"]["container_time"] = 60
#------------------
# swauth source
# -----------------
# Versions of swauth in Ubuntu Cloud Archive PPA can be outdated. This
# allows us to chose to install directly from a tagged branch of
# gholt's repository.
# values: package, git
default["swift"]["swauth_source"] = "package"
default["swift"]["swauth_repository"] = "https://github.com/gholt/swauth.git"
default["swift"]["swauth_version"] = "1.0.8"
#------------------
# packages
#------------------
# Leveling between distros
case platform
when "redhat"
@@ -132,7 +217,8 @@ when "redhat"
"git_dir" => "/var/lib/git",
"git_service" => "git",
"service_provider" => Chef::Provider::Service::Redhat,
"override_options" => ""
"override_options" => "",
"swift_statsd_publish" => "/usr/bin/swift-statsd-publish.py"
}
#
# python-iso8601 is a missing dependency for swift.
@@ -153,7 +239,8 @@ when "centos"
"git_dir" => "/var/lib/git",
"git_service" => "git",
"service_provider" => Chef::Provider::Service::Redhat,
"override_options" => ""
"override_options" => "",
"swift_statsd_publish" => "/usr/bin/swift-statsd-publish.py"
}
when "fedora"
default["swift"]["platform"] = {
@@ -171,7 +258,8 @@ when "fedora"
"git_dir" => "/var/lib/git",
"git_service" => "git",
"service_provider" => Chef::Provider::Service::Systemd,
"override_options" => ""
"override_options" => "",
"swift_statsd_publish" => "/usr/bin/swift-statsd-publish.py"
}
when "ubuntu"
default["swift"]["platform"] = {
@@ -189,6 +277,7 @@ when "ubuntu"
"git_dir" => "/var/cache/git",
"git_service" => "git-daemon",
"service_provider" => Chef::Provider::Service::Upstart,
"override_options" => "-o Dpkg::Options:='--force-confold' -o Dpkg::Option:='--force-confdef'"
"override_options" => "-o Dpkg::Options:='--force-confold' -o Dpkg::Option:='--force-confdef'",
"swift_statsd_publish" => "/usr/local/bin/swift-statsd-publish.py"
}
end
@@ -0,0 +1,19 @@
# swift-container-sync - SWIFT Container Sync
#
# The swift container sync.
description "SWIFT Container Sync"
author "Sergio Rubio <rubiojr@bvox.net>"
start on runlevel [2345]
stop on runlevel [016]
pre-start script
if [ -f "/etc/swift/container-server.conf" ]; then
exec /usr/bin/swift-init container-sync start
else
exit 1
fi
end script
post-stop exec /usr/bin/swift-init container-sync stop
@@ -3,7 +3,7 @@ maintainer "ATT, Inc."
license "Apache 2.0"
description "Installs and configures Openstack Swift"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.1.0"
version "7.1.0"
recipe "openstack-object-storage::setup", "Does initial setup of a swift cluster"
recipe "openstack-object-storage::account-server", "Installs the swift account server"
recipe "openstack-object-storage::object-server", "Installs the swift object server"
@@ -62,7 +62,8 @@ def generate_script
# figure out what's present in the cluster
disk_data[which] = {}
disk_state,_,_ = Chef::Search::Query.new.search(:node,"chef_environment:#{node.chef_environment} AND roles:swift-#{which}-server")
role = node["swift"]["#{which}_server_chef_role"]
disk_state,_,_ = Chef::Search::Query.new.search(:node,"chef_environment:#{node.chef_environment} AND roles:#{role}")
# for a running track of available disks
disk_data[:available] ||= {}
@@ -195,24 +196,24 @@ def parse_ring_output(ring_data)
next
elsif line =~ /^\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+\.\d+\.\d+\.\d+)\s+(\d+)\s+(\S+)\s+([0-9.]+)\s+(\d+)\s+([-0-9.]+)\s*$/
output[:hosts] ||= {}
output[:hosts][$3] ||= {}
output[:hosts][$4] ||= {}
output[:hosts][$3][$5] = {}
output[:hosts][$4][$6] ||= {}
output[:hosts][$3][$5][:id] = $1
output[:hosts][$3][$5][:region] = $2
output[:hosts][$3][$5][:zone] = $3
output[:hosts][$3][$5][:ip] = $4
output[:hosts][$3][$5][:port] = $5
output[:hosts][$3][$5][:device] = $6
output[:hosts][$3][$5][:weight] = $7
output[:hosts][$3][$5][:partitions] = $8
output[:hosts][$3][$5][:balance] = $9
output[:hosts][$4][$6][:id] = $1
output[:hosts][$4][$6][:region] = $2
output[:hosts][$4][$6][:zone] = $3
output[:hosts][$4][$6][:ip] = $4
output[:hosts][$4][$6][:port] = $5
output[:hosts][$4][$6][:device] = $6
output[:hosts][$4][$6][:weight] = $7
output[:hosts][$4][$6][:partitions] = $8
output[:hosts][$4][$6][:balance] = $9
elsif line =~ /^\s+(\d+)\s+(\d+)\s+(\d+\.\d+\.\d+\.\d+)\s+(\d+)\s+(\S+)\s+([0-9.]+)\s+(\d+)\s+([-0-9.]+)\s*$/
output[:hosts] ||= {}
output[:hosts][$3] ||= {}
output[:hosts][$3][$5] = {}
output[:hosts][$3][$5] ||= {}
output[:hosts][$3][$5][:id] = $1
output[:hosts][$3][$5][:zone] = $2
@@ -23,11 +23,39 @@ end
include_recipe 'sysctl::default'
#-------------
# stats
#-------------
# optionally statsd daemon for stats collection
if node["swift"]["enable_statistics"]
if node["swift"]["statistics"]["enabled"]
node.set['statsd']['relay_server'] = true
include_recipe 'statsd::server'
end
# find graphing server address
if Chef::Config[:solo] and not node['recipes'].include?("chef-solo-search")
Chef::Log.warn("This recipe uses search. Chef Solo does not support search.")
graphite_servers = []
else
graphite_servers = search(:node, "roles:#{node['swift']['statistics']['graphing_role']} AND chef_environment:#{node.chef_environment}")
end
graphite_host = "127.0.0.1"
unless graphite_servers.empty?
graphite_host = graphite_servers[0]['network']["ipaddress_#{node['swift']['statistics']['graphing_interface']}"]
end
if node['swift']['statistics']['graphing_ip'].nil?
node.set['statsd']['graphite_host'] = graphite_host
else
node.set['statsd']['graphite_host'] = node['swift']['statistics']['graphing_ip']
end
#--------------
# swift common
#--------------
platform_options = node["swift"]["platform"]
# update repository if requested with the ubuntu cloud
@@ -91,3 +91,31 @@ template "/etc/swift/container-server.conf" do
notifies :restart, "service[swift-container-updater]", :immediately
notifies :restart, "service[swift-container-auditor]", :immediately
end
# Ubuntu 12.04 packages are missing the swift-container-sync service scripts
# See https://bugs.launchpad.net/cloud-archive/+bug/1250171
if platform?("ubuntu")
cookbook_file "/etc/init/swift-container-sync.conf" do
owner "root"
group "root"
mode "0755"
source "swift-container-sync.conf.upstart"
action :create
not_if "[ -e /etc/init/swift-container-sync.conf ]"
end
link "/etc/init.d/swift-container-sync" do
to "/lib/init/upstart-job"
not_if "[ -e /etc/init.d/swift-container-sync ]"
end
end
service_name=platform_options["service_prefix"] + 'swift-container-sync' + platform_options["service_suffix"]
unless node["swift"]["container-server"]["allowed_sync_hosts"] == []
service "swift-container-sync" do
service_name service_name
provider platform_options["service_provider"]
supports :status => false, :restart => true
action [:enable, :start]
only_if "[ -e /etc/swift/container-server.conf ] && [ -e /etc/swift/container.ring.gz ]"
end
end
@@ -26,10 +26,29 @@ include_recipe "openstack-object-storage::ring-repo"
platform_options = node["swift"]["platform"]
if node["swift"]["authmode"] == "swauth"
platform_options["swauth_packages"].each.each do |pkg|
package pkg do
action :install
options platform_options["override_options"] # retain configs
case node["swift"]["swauth_source"]
when "package"
platform_options["swauth_packages"].each do |pkg|
package pkg do
action :install
options platform_options["override_options"]
end
end
when "git"
git "#{Chef::Config[:file_cache_path]}/swauth" do
repository node["swift"]["swauth_repository"]
revision node["swift"]["swauth_version"]
action :sync
end
bash "install_swauth" do
cwd "#{Chef::Config[:file_cache_path]}/swauth"
user "root"
group "root"
code <<-EOH
python setup.py install
EOH
environment 'PREFIX' => "/usr/local"
end
end
end
@@ -44,6 +63,19 @@ else
auth_key = swift_secrets['dispersion_auth_key']
end
if node['swift']['statistics']['enabled']
template platform_options["swift_statsd_publish"] do
source "swift-statsd-publish.py.erb"
owner "root"
group "root"
mode "0755"
end
cron "cron_swift_statsd_publish" do
command "#{platform_options['swift_statsd_publish']} > /dev/null 2>&1"
minute "*/#{node["swift"]["statistics"]["report_frequency"]}"
end
end
template "/etc/swift/dispersion.conf" do
source "dispersion.conf.erb"
owner "swift"
@@ -94,6 +94,17 @@ template "/etc/swift/object-server.conf" do
notifies :restart, "service[swift-object-auditor]", :immediately
end
%w[ /var/swift /var/swift/recon ].each do |path|
directory path do
# Create the swift recon cache directory and set its permissions.
owner "swift"
group "swift"
mode 00755
action :create
end
end
cron "swift-recon" do
minute "*/5"
command "swift-recon-cron /etc/swift/object-server.conf"
@@ -26,7 +26,8 @@ end
if node.run_list.expand(node.chef_environment).recipes.include?("openstack-object-storage::setup")
Chef::Log.info("I ran the openstack-object-storage::setup so I will use my own swift passwords")
else
setup = search(:node, "chef_environment:#{node.chef_environment} AND roles:swift-setup")
setup_role = node["swift"]["setup_chef_role"]
setup = search(:node, "chef_environment:#{node.chef_environment} AND roles:#{setup_role}")
if setup.length == 0
Chef::Application.fatal! "You must have run the openstack-object-storage::setup recipe (on this or another node) before running the swift::proxy recipe on this node"
elsif setup.length == 1
@@ -47,11 +48,35 @@ platform_options["proxy_packages"].each do |pkg|
end
end
package "python-swauth" do
action :install
only_if { node["swift"]["authmode"] == "swauth" }
if node["swift"]["authmode"] == "swauth"
case node["swift"]["swauth_source"]
when "package"
platform_options["swauth_packages"].each do |pkg|
package pkg do
action :install
options platform_options["override_options"]
end
end
when "git"
git "#{Chef::Config[:file_cache_path]}/swauth" do
repository node["swift"]["swauth_repository"]
revision node["swift"]["swauth_version"]
action :sync
end
bash "install_swauth" do
cwd "#{Chef::Config[:file_cache_path]}/swauth"
user "root"
group "root"
code <<-EOH
python setup.py install
EOH
environment 'PREFIX' => "/usr/local"
end
end
end
package "python-swift-informant" do
action :install
only_if { node["swift"]["use_informant"] }
@@ -84,7 +109,8 @@ if Chef::Config[:solo]
memcache_servers = [ "127.0.0.1:11211" ]
else
memcache_servers = []
proxy_nodes = search(:node, "chef_environment:#{node.chef_environment} AND roles:swift-proxy-server")
proxy_role = node["swift"]["proxy_server_chef_role"]
proxy_nodes = search(:node, "chef_environment:#{node.chef_environment} AND roles:#{proxy_role}")
proxy_nodes.each do |proxy|
proxy_ip = locate_ip_in_cidr(node["swift"]["network"]["proxy-cidr"], proxy)
next if not proxy_ip # skip nil ips so we dont break the config
@@ -101,6 +127,19 @@ else
authkey = swift_secrets['swift_authkey']
end
if node["swift"]["authmode"] == "keystone"
openstack_identity_bootstrap_token = secret "secrets", "openstack_identity_bootstrap_token"
%w[ /home/swift /home/swift/keystone-signing ].each do |path|
directory path do
owner "swift"
group "swift"
mode 00700
action :create
end
end
end
# create proxy config file
template "/etc/swift/proxy-server.conf" do
source "proxy-server.conf.erb"
@@ -108,6 +147,7 @@ template "/etc/swift/proxy-server.conf" do
group "swift"
mode "0600"
variables("authmode" => node["swift"]["authmode"],
"openstack_identity_bootstrap_token" => openstack_identity_bootstrap_token,
"bind_host" => node["swift"]["network"]["proxy-bind-ip"],
"bind_port" => node["swift"]["network"]["proxy-bind-port"],
"authkey" => authkey,
@@ -22,7 +22,8 @@ include_recipe "openstack-object-storage::common"
if Chef::Config[:solo]
Chef::Application.fatal! "This recipe uses search. Chef Solo does not support search."
else
setup_role_count = search(:node, "chef_environment:#{node.chef_environment} AND roles:swift-setup").length
setup_role = node["swift"]["setup_chef_role"]
setup_role_count = search(:node, "chef_environment:#{node.chef_environment} AND roles:#{setup_role}").length
if setup_role_count > 1
Chef::Application.fatal! "You can only have one node with the swift-setup role"
end
@@ -42,9 +43,32 @@ platform_options["proxy_packages"].each do |pkg|
end
end
package "python-swauth" do
action :upgrade
only_if { node["swift"]["authmode"] == "swauth" }
if node["swift"]["authmode"] == "swauth"
case node["swift"]["swauth_source"]
when "package"
platform_options["swauth_packages"].each do |pkg|
package pkg do
action :upgrade
options platform_options["override_options"]
end
end
when "git"
git "#{Chef::Config[:file_cache_path]}/swauth" do
repository node["swift"]["swauth_repository"]
revision node["swift"]["swauth_version"]
action :sync
end
bash "install_swauth" do
cwd "#{Chef::Config[:file_cache_path]}/swauth"
user "root"
group "root"
code <<-EOH
python setup.py install
EOH
environment 'PREFIX' => "/usr/local"
end
end
end
package "python-swift-informant" do
@@ -14,12 +14,12 @@ describe 'openstack-object-storage::common' do
@node = @chef_run.node
@node.set['platform_family'] = "debian"
@node.set['lsb']['codename'] = "precise"
@node.set['swift']['release'] = "folsom"
@node.set['swift']['release'] = "grizzly"
@node.set['swift']['authmode'] = 'swauth'
@node.set['swift']['git_builder_ip'] = '10.0.0.10'
# TODO: this does not work
# ::Chef::Log.should_receive(:info).with("chefspec: precise-updates/folsom")
# ::Chef::Log.should_receive(:info).with("chefspec: precise-updates/grizzly")
@chef_run.converge "openstack-object-storage::common"
end
@@ -16,6 +16,8 @@ describe 'openstack-object-storage::container-server' do
@node.set['swift']['authmode'] = 'swauth'
@node.set['swift']['network']['container-bind-ip'] = '10.0.0.1'
@node.set['swift']['network']['container-bind-port'] = '8080'
@node.set['swift']['container-server']['allowed_sync_hosts'] = ['host1', 'host2', 'host3']
@node.set['swift']['container-bind-port'] = '8080'
@node.set['swift']['disk_enum_expr'] = "[{ 'sda' => {}}]"
@node.set['swift']['disk_test_filter'] = [ "candidate =~ /sd[^a]/ or candidate =~ /hd[^a]/ or candidate =~ /vd[^a]/ or candidate =~ /xvd[^a]/",
"File.exist?('/dev/' + candidate)",
@@ -33,7 +35,7 @@ describe 'openstack-object-storage::container-server' do
end
it "starts swift container services on boot" do
%w{swift-container swift-container-auditor swift-container-replicator swift-container-updater}.each do |svc|
%w{swift-container swift-container-auditor swift-container-replicator swift-container-updater swift-container-sync}.each do |svc|
expect(@chef_run).to set_service_to_start_on_boot svc
end
end
@@ -52,12 +54,34 @@ describe 'openstack-object-storage::container-server' do
expect(sprintf("%o", @file.mode)).to eq "600"
end
it "template contents" do
pending "TODO: implement"
it "has allowed sync hosts" do
expect(@chef_run).to create_file_with_content @file.name,
"allowed_sync_hosts = host1,host2,host3"
end
end
end
it "should create container sync upstart conf for ubuntu" do
expect(@chef_run).to create_cookbook_file "/etc/init/swift-container-sync.conf"
end
it "should create container sync init script for ubuntu" do
expect(@chef_run).to create_link "/etc/init.d/swift-container-sync"
end
describe "/etc/swift/container-server.conf" do
before do
@node = @chef_run.node
@node.set["swift"]["container-server"]["allowed_sync_hosts"] = []
@chef_run.converge "openstack-object-storage::container-server"
@file = @chef_run.template "/etc/swift/container-server.conf"
end
it "has no allowed_sync_hosts on empty lists" do
expect(@chef_run).not_to create_file_with_content @file.name,
/^allowed_sync_hots =/
end
end
end
end
@@ -14,7 +14,7 @@ describe 'openstack-object-storage::disks' do
@node = @chef_run.node
@node.set['platform_family'] = "debian"
@node.set['lsb']['codename'] = "precise"
@node.set['swift']['release'] = "folsom"
@node.set['swift']['release'] = "grizzly"
@node.set['swift']['authmode'] = 'swauth'
@node.set['swift']['git_builder_ip'] = '10.0.0.10'
@node.set['swift']['disk_enum_expr'] = "[{ 'sda' => {}}]"
@@ -14,6 +14,9 @@ describe 'openstack-object-storage::management-server' do
@node = @chef_run.node
@node.set['lsb']['code'] = 'precise'
@node.set['swift']['authmode'] = 'swauth'
@node.set['swift']['statistics']['enabled'] = true
@node.set['swift']['swauth_source'] = 'package'
@node.set['swift']['platform']['swauth_packages'] = ['swauth']
@chef_run.converge "openstack-object-storage::management-server"
end
@@ -42,6 +45,27 @@ describe 'openstack-object-storage::management-server' do
end
describe "/usr/local/bin/swift-statsd-publish.py" do
before do
@file = @chef_run.template "/usr/local/bin/swift-statsd-publish.py"
end
it "has proper owner" do
expect(@file).to be_owned_by "root", "root"
end
it "has proper modes" do
expect(sprintf("%o", @file.mode)).to eq "755"
end
it "has expected statsd host" do
expect(@chef_run).to create_file_with_content @file.name,
"self.statsd_host = '127.0.0.1'"
end
end
end
end
@@ -14,6 +14,8 @@ describe 'openstack-object-storage::proxy-server' do
@node = @chef_run.node
@node.set['lsb']['code'] = 'precise'
@node.set['swift']['authmode'] = 'swauth'
@node.set['swift']['platform']['swauth_packages'] = ['swauth']
@node.set['swift']['swauth_source'] = 'package'
@node.set['swift']['network']['proxy-bind-ip'] = '10.0.0.1'
@node.set['swift']['network']['proxy-bind-port'] = '8080'
@chef_run.converge "openstack-object-storage::proxy-server"
@@ -28,7 +30,7 @@ describe 'openstack-object-storage::proxy-server' do
end
it "installs swauth package if swauth is selected" do
expect(@chef_run).to install_package "python-swauth"
expect(@chef_run).to install_package "swauth"
end
it "starts swift-proxy on boot" do
@@ -14,7 +14,7 @@ describe 'openstack-object-storage::ring-repo' do
@node = @chef_run.node
@node.set['platform_family'] = "debian"
@node.set['lsb']['codename'] = "precise"
@node.set['swift']['release'] = "folsom"
@node.set['swift']['release'] = "grizzly"
@node.set['swift']['authmode'] = 'swauth'
@node.set['swift']['git_builder_ip'] = '10.0.0.10'
@chef_run.converge "openstack-object-storage::ring-repo"
@@ -14,7 +14,7 @@ describe 'openstack-object-storage::rsync' do
@node = @chef_run.node
@node.set['platform_family'] = "debian"
@node.set['lsb']['codename'] = "precise"
@node.set['swift']['release'] = "folsom"
@node.set['swift']['release'] = "grizzly"
@node.set['swift']['authmode'] = 'swauth'
@node.set['swift']['git_builder_ip'] = '10.0.0.10'
@chef_run.converge "openstack-object-storage::rsync"
@@ -15,11 +15,11 @@
bind_ip = <%= @bind_ip %>
bind_port = <%= @bind_port %>
workers = 10
<% if node[:swift][:enable_statistics] -%>
<% if node[:swift][:statistics][:enabled] -%>
log_statsd_host = localhost
log_statsd_port = 8125
log_statsd_default_sample_rate = 1
log_statsd_metric_prefix = openstack.swift.<%= node[:hostname] %>
log_statsd_default_sample_rate = <%= node[:swift][:statistics][:sample_rate] %>
log_statsd_metric_prefix = <%= node[:swift][:statistics][:statsd_prefix] %>.<%= node[:hostname] %>
<% end %>
[pipeline:main]
@@ -18,12 +18,16 @@
bind_ip = <%= @bind_ip %>
bind_port = <%= @bind_port %>
workers = 10
<% if node[:swift][:enable_statistics] -%>
<% if node["swift"]["enable_statistics"] -%>
log_statsd_host = localhost
log_statsd_port = 8125
log_statsd_default_sample_rate = 1
log_statsd_metric_prefix = openstack.swift.<%= node[:hostname] %>
<% end %>
log_statsd_metric_prefix = openstack.swift.<%= node["hostname"] %>
<% end -%>
<% if node["swift"]["container-server"]["allowed_sync_hosts"] -%>
allowed_sync_hosts = <%= node["swift"]["container-server"]["allowed_sync_hosts"].join(",") %>
<% end -%>
[pipeline:main]
pipeline = container-server
@@ -77,12 +81,14 @@ use = egg:swift#container
[container-sync]
# You can override the default log routing for this app here (don't use set!):
# log_name = container-sync
# log_facility = LOG_LOCAL0
# log_level = INFO
log_name = <%= node["swift"]["container-server"]["container-sync"]["log_name"] %>
log_facility = <%= node["swift"]["container-server"]["container-sync"]["log_facility"] %>
log_level = <%= node["swift"]["container-server"]["container-sync"]["log_level"] %>
# If you need to use an HTTP Proxy, set it here; defaults to no proxy.
# sync_proxy = http://127.0.0.1:8888
<% if node["swift"]["container-server"]["container-sync"]["sync_proxy"] -%>
sync_proxy = <%= node["swift"]["container-server"]["container-sync"]["sync_proxy"] %>
<% end -%>
# Will sync, at most, each container once per interval
# interval = 300
interval = <%= node["swift"]["container-server"]["container-sync"]["interval"] %>
# Maximum amount of time to spend syncing each container per pass
# container_time = 60
container_time = <%= node["swift"]["container-server"]["container-sync"]["container_time"] %>
@@ -16,11 +16,11 @@
bind_ip = <%= @bind_ip %>
bind_port = <%= @bind_port %>
workers = 10
<% if node[:swift][:enable_statistics] -%>
<% if node[:swift][:statistics][:enabled] -%>
log_statsd_host = localhost
log_statsd_port = 8125
log_statsd_default_sample_rate = 1
log_statsd_metric_prefix = openstack.swift.<%= node[:hostname] %>
log_statsd_default_sample_rate = <%= node[:swift][:statistics][:sample_rate] %>
log_statsd_metric_prefix = <%= node[:swift][:statistics][:statsd_prefix] %>.<%= node[:hostname] %>
<% end %>
[pipeline:main]

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