Compare commits

..

239 Commits

Author SHA1 Message Date
arif cb2d15cf29 update work on mkvlan 2014-05-04 18:26:29 +01:00
arif 397e964364 add lsvlan, a few initial changes 2014-05-04 16:09:33 +01:00
arif e6315798fc start work on mkvlan support 2014-05-04 15:30:04 +01:00
lissav 3ecda8287a old unused xCAT1 code defect 4077 2014-05-02 06:31:00 -04:00
lissav 5221b6b413 old unused xCAT1 code defect 4077 2014-05-02 06:27:59 -04:00
lissav 8564fec9d0 add new xcatconfig using timezone utility defect 4077 2014-04-30 12:09:41 -04:00
immarvin 6bbca1da9c avoid running rpm command during package installation 2014-04-30 09:38:29 -07:00
Jarrod Johnson 4d60f2b270 Fix inifinite loop on well formed and malformed multirecrd areas
There were mistakes in the parsing of multirecord IPMI fru area.
Most critically, the index never advanced.  Additionally, ensure
that the index always increases and check against the length of the structure
so that a malformed area would not send our parser into an infinite loop.
2014-04-30 10:30:36 -04:00
Jarrod Johnson 84bf9dbf48 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core 2014-04-30 09:49:33 -04:00
immarvin e0d5594d67 #3987 partitionfile=s: issues when using variables 2014-04-30 07:23:07 -07:00
lissav 7f4e4a5283 add gettimezone common routine 2014-04-30 08:45:28 -04:00
zhaoertao 2426c38282 fix bug 4109 mkvm failed with non-int parameters 2014-04-30 02:29:21 -07:00
Jarrod Johnson 7983748b45 Fix UpdateExpress under genesis
Newer versions would experience a hard failure if the embedded CIM implementation
cannot start.  strace revealed that said process was failing because /var/tmp did not
exist
2014-04-30 02:45:10 -04:00
Jarrod Johnson ba5341a21d Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core 2014-04-29 15:00:48 -04:00
Jarrod Johnson 4790c45b4d Fix UpdateExpress under genesis
Newer versions would experience a hard failure if the embedded CIM implementation
cannot start.  strace revealed that said process was failing because /var/tmp did not
exist
2014-04-29 14:59:23 -04:00
lissav e43e18ba9b support MariaDB defect 4097 2014-04-29 10:20:50 -04:00
lissav 7b5aa8aed1 support MariaDB defect 4097 2014-04-29 10:10:45 -04:00
lissav 99ef971862 Defect 4061 2014-04-29 09:05:33 -04:00
immarvin 71ed00d1a4 fix defect #3997 node reinstall loop when site.nodestatus=0 Edit 2014-04-29 00:22:25 -07:00
zhaoertao 7112eaed3f fix bug 3934: mkdef/chdef -u needs better doc and 1 fix 2014-04-28 22:17:10 -07:00
ligc 9766383d68 add vlan support for configeth, could use the syntax eth1.2 to specify vlan tagging 2014-04-29 10:31:11 -05:00
zhaoertao 963deac240 fix bugs about partitioning 2014-04-28 06:21:51 -07:00
yinle 2ff5605034 Add new check item cmdcheck to run script to check auto-test result 2014-04-28 08:08:26 -07:00
daniceexi e68ce246df defect 4065: add the description for site.externaldns in makedns.8.pod 2014-04-28 09:57:00 -04:00
immarvin 8756aa4cd8 add a new ubuntu dependency libcrypt-cbc-perl 2014-04-28 00:23:45 -07:00
immarvin 694b3eac6c add dependency libcrypt-rijndael-perl for ubuntu 2014-04-27 20:42:39 -07:00
Bruce Potter 1bdbd9242e fix but in xCAT-SoftLayer spec file 2014-04-26 18:38:26 -04:00
Bruce Potter dbfd2a8909 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
sysclone working in softlayer
2014-04-26 18:29:37 -04:00
Bruce Potter 4cb37a0a7d sysclone working in softlayer 2014-04-26 18:29:01 -04:00
Jarrod Johnson e2a3db7844 Fix mistakes in bmcsetup 2014-04-25 13:18:39 -04:00
Jarrod Johnson 36a23efcfb Remove deprecated timezones 2014-04-24 14:15:40 -04:00
daniceexi 5c563748bc defect 4096: add the virtio driver for sles diskless so that sles kvm could boot with virtio driver 2014-04-24 04:12:25 -04:00
lissav 2e1aa300ec Redhat7 support defect 4092 2014-04-23 14:53:43 -04:00
lissav 72d312347d better examples for setAttribs XML interface 2014-04-23 09:06:25 -04:00
arif 065eb7b9dd defect #4061: fix DSHCLI.pm for append in hierarchy 2014-04-23 11:23:57 +01:00
litingt 70ee283f90 add suse support 2014-04-23 02:28:15 -07:00
daniceexi 14b8749111 add handling for the error happens in table resource operation 2014-04-23 06:12:07 -04:00
lissav 852e6d8bd0 remove getFacingIP. It is not used and does not support Redhat7 defect 4091 2014-04-22 11:06:29 -04:00
daniceexi 08d73347c8 split table src to multiple ones; replace xcatws.cgi with the content from restapi.pl 2014-04-22 14:22:19 -04:00
zhaoertao 1057bd5b91 modify DHCP parameters for pkvm 2014-04-22 03:11:09 -07:00
litingt 5ccbf223d6 add strict release check 2014-04-22 03:01:23 -07:00
zhaoertao 8ee1cb7457 Modify the dhcp config file use ip address of MN rather than a static IP address 2014-04-21 19:47:21 -07:00
lissav 8fecce3cd1 remove unused code 2014-04-21 12:54:08 -04:00
Bruce Potter 058d969467 changed table resource to tables in genrestapidoc.pm 2014-04-21 10:36:08 -04:00
Bruce Potter e57afa23c1 change table resource to tables in rest api 2014-04-21 10:18:51 -04:00
litingt acf8491a0a modify initialze in confing_mn 2014-04-21 05:13:34 -07:00
immarvin 4554c35541 fix defect #4044 xCAT spec file %post additons not checking for AIX Edit 2014-04-21 03:20:55 -07:00
zhaoertao 3b826ad2be fix bug 4088:xdsh to IBM RackSwitch does not work 2014-04-21 01:32:29 -07:00
litingt 7b4f28da60 add pro_result() declare 2014-04-21 01:45:22 -07:00
litingt 921b94a6e8 remove debug comments 2014-04-21 00:43:38 -07:00
yinle d4da5664b6 Modify the way of process mn arg 2014-04-21 02:21:06 -07:00
litingt eaaf75d74d add fork 2014-04-20 21:00:43 -07:00
Bruce Potter 5d13cf0d36 added table put and delete calls to rest api 2014-04-20 18:56:24 -04:00
Bruce Potter 89e71c874b Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
updates
2014-04-18 14:57:12 -04:00
Jarrod Johnson 566859fad4 Recognize mpt3sas class adapters 2014-04-18 10:50:58 -04:00
Bruce Potter 41483a0023 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
doxcat change for static ip
2014-04-18 04:28:32 -04:00
Lei Ai b0daa95209 Merge fix from branch 2.8: create non-blocking call for nodechprofile 2014-04-18 15:45:44 +08:00
ligc c79270ac4b a typo in the comment 2014-04-17 23:00:21 -05:00
ligc dc4a67cfe3 fix for bug 4084: AIX rpm spec does not allow %if inside %ifos 2014-04-17 22:57:41 -05:00
lissav 6bb5a53c37 4072 2014-04-17 10:17:21 -04:00
ligc 204737f826 fix for bug 4074: different ifconfig -a output on RHEL7 2014-04-17 21:23:27 -05:00
Bruce Potter bf3e88261b Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
change to doxcat
2014-04-17 08:22:55 -04:00
immarvin eb381a3b96 add description of managedaddressmode 2014-04-17 03:16:12 -07:00
immarvin 7235387417 enhance the dhcp unicast for some specific cases on nameservers and gateway value 2014-04-17 03:10:15 -07:00
zhaoertao a4fb366485 modify the manpage of rpower not to use internal node names 2014-04-17 01:49:47 -07:00
zhaoertao e571778118 fix bug 3893:rpower man page should note the need for the required ASU Power.S3Enable setting 2014-04-17 01:46:21 -07:00
Lei Ai 74ab5d1110 Merge fix for 2.8 branch about node status update for profiled nodes into mainline 2014-04-17 15:56:59 +08:00
litingt d5877d2db5 modify log file location 2014-04-17 00:15:21 -07:00
litingt 747d5cef6e minor changes 2014-04-16 23:51:21 -07:00
litingt 8e0ac00c37 packimage osimage 2014-04-16 21:44:34 -07:00
zhaoertao ca0101fec1 issue for pkvm host not use eth0 2014-04-16 20:34:58 -07:00
ligc e0bd432201 fix for bug 4084: AIX should not require grub2-xcat 2014-04-16 23:28:51 -04:00
zhaoertao a221d8698d for bug 4070 2014-04-16 19:54:00 -07:00
lissav f90cdb8a1b defect 4072 2014-04-16 15:10:16 -04:00
lissav 0274937478 defect 4072 2014-04-16 12:34:09 -04:00
lissav 2b4a12d785 defect 4072 2014-04-16 10:17:05 -04:00
lissav e93507ecbd defect 4071 2014-04-16 10:13:31 -04:00
daniceexi ae95af8dbb add the site attribute description for dnsupdaters and persistkvmguests 2014-04-16 08:56:23 -04:00
yinle 4ed50aeb3c Add debug mode. 2014-04-16 04:48:18 -07:00
zhaoertao c1bdc749b8 The HMC version 8 drop the prompt space when log on to it 2014-04-15 22:14:36 -07:00
daniceexi 87947d7fca Fixed that is external dns is used, don't try to start local dns; refine the ddns.pm that replace the tab with 4spaces. 2014-04-16 04:12:56 -04:00
lissav b0d5cd593f add more comments about externaldns 2014-04-15 13:26:00 -04:00
lissav 553aa59bb1 defect 4061 2014-04-15 11:39:28 -04:00
lissav e850c050ef defect 4064 2014-04-15 10:02:17 -04:00
Jarrod Johnson 0ee24e839a Revert "Have openssl req use better message digest"
This reverts commit 98bc658385.
2014-04-15 09:12:00 -04:00
Jarrod Johnson 3ea7bafb9a Revert "Use sha256 by default in openssl.cnf"
This reverts commit e02a913e86.
2014-04-15 09:11:47 -04:00
daniceexi 2e24d9a008 add the site description for externaldns attribute 2014-04-15 13:12:45 -04:00
daniceexi 758235d4dd restructure the xcatws-test.sh to make it can handle server certificate checking and token checking 2014-04-15 09:53:48 -04:00
yinle a2b241d6d3 Adjust formate, add fork progress, move code into sub-routines 2014-04-15 07:42:30 -07:00
zhaoertao f5c0758921 add powerkvm VM support for mkvm,chvm,rmvm,rpower 2014-04-15 01:23:08 -07:00
Bruce Potter abab2914af Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
modified doxcat to optionally use static ip
2014-04-14 15:56:56 -04:00
Bruce Potter 9d6318d70e update doxcat to optionally use static ip, but still one problem 2014-04-14 15:56:35 -04:00
Jarrod Johnson a8f675b80a Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core 2014-04-14 15:47:42 -04:00
Jarrod Johnson 5c4558c06c Implement auto-downgrade to operator in IPMI
In some circumstances, xCAT can only have Operator privilege in
an IPMI environment.  In such a scenario, auto-degrade to operator
and try again before giving up.
2014-04-14 15:46:44 -04:00
lissav 0635157d1a defect 4061 2014-04-14 13:07:08 -04:00
immarvin 78b2d75c94 enhance the getNodeNetworkCfg to return the gateway info 2014-04-14 02:21:17 -07:00
ligc 7b7a6ab894 fix for bug 4062: add autocommit=0 when opening the nodelist table 2014-04-14 16:09:08 -05:00
huweihua a9650d0df1 fix defect 4006 2014-04-14 01:16:10 -04:00
zhaoertao 8cd052a03e change the bug fix of 3993:DFM support Powerlinux,chvm doesn't update node attributes 2014-04-13 20:10:17 -07:00
Jarrod Johnson 6e7009e9e6 Backdate the CA certificate itself 2014-04-11 14:13:08 -04:00
Jarrod Johnson c1e873d37f Backdate SSL certificates by default for 'startDate' 2014-04-11 13:26:31 -04:00
Jarrod Johnson dd90516371 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core 2014-04-11 11:27:48 -04:00
Jarrod Johnson a05b6bbcb1 Undo the increase in efi volume and instead influence anaconda's perspective of the 'bios' drive 2014-04-11 11:27:13 -04:00
immarvin a3b85a2d42 support unicast dhcp during provisioning and 1st boot, including diskful for sles and rh 2014-04-11 07:46:15 -07:00
lissav dd1bb50118 fix vbox defect 4057 2014-04-11 05:45:37 -04:00
litingt c930087fd7 modify some minor error init and do_test 2014-04-11 02:06:40 -07:00
ligc 3d5bc652c1 fix for bug 4059: trim the / at the end of pkgdir 2014-04-11 15:44:02 -05:00
Bruce Potter a2dc620bc6 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
start sysclone support for softlayer and fix getslnodes bug
2014-04-10 15:07:14 -04:00
Bruce Potter d09b8faa6a start sysclone support for softlayer and fix getslnodes bug 2014-04-10 15:06:47 -04:00
lissav 357a53589c defect 4049 broadcast updatenode -g if sharedtftp=0 2014-04-10 12:45:56 -04:00
Jarrod Johnson 027f599527 Increase /boot/efi on RHEL installs
Sometimes, anaconda decides that 50MB is not enough.  Their doucmentation calls out '100 MB', so go with documentation minimun
2014-04-10 09:42:27 -04:00
zhaoertao cea9a4e427 fix bug 3993 DFM support Powerlinux, chvm doesn't update node attributes 2014-04-10 04:10:19 -07:00
daniceexi 207388d424 did some minor changes for the output of examples; adjusted the resource order in the auto generated doc 2014-04-10 10:15:28 -04:00
yinle 7845eef34d Modify policy and site; remove tab 2014-04-10 06:57:10 -07:00
lissav 656469da5c defect 4053 2014-04-09 11:14:43 -04:00
lissav f6aaf5eba0 defect 4052 2014-04-09 09:40:45 -04:00
junxiaw 9f160dfd1d wangjunxiaw update code for restapi 2014-04-09 02:42:30 -07:00
root 9c0ca92a63 wangjunxiaw update genrestapidoc code 2014-04-09 02:39:49 -07:00
zhaoertao 99f1eba251 add examples and usage for osiamge in RESTAPI 2014-04-09 02:12:14 -07:00
daniceexi 217dee1244 removed the unused require of table.pm; fix the issue to handle the servicedone key in the xcat xml output 2014-04-09 07:22:29 -04:00
ligc e721b46e6d add the rhelhpc6.5 support 2014-04-09 13:56:13 -05:00
ligc c358897336 add the discinfo for CentOS 5.10 2014-04-09 13:24:13 -05:00
mellor f196c720ef defect 4049 change Postage.pm to call my_if_facing if xcatmaster attr not set 2014-04-08 17:15:40 -04:00
lissav c358b14b03 do not build ipmi.pm for AIX 2014-04-08 15:01:19 -04:00
lissav a8a82224eb force a build 2014-04-08 14:35:15 -04:00
lissav 42a8457618 comment back ipmi.pm on AIX 2014-04-08 14:26:53 -04:00
lissav 53fb99d748 defect 4051 do not ship ipmi.pm on AIX 2014-04-08 12:34:05 -04:00
lissav 9f11ec4d2f defect 4050 2014-04-08 07:50:28 -04:00
zhaoertao 97b9c613cc fix bug 4032:$password not single quoted in /opt/xcat/share/xcat/cons/ipmi 2014-04-08 02:17:49 -07:00
ligc cbdbf16c39 fix syntax errors in xCATreg, blocks build process 2014-04-08 03:35:11 -04:00
ligc d13ee30dcd fix syntax errors in xCATreg, blocks build process 2014-04-08 03:34:21 -04:00
root 9ff7194b45 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core 2014-04-07 19:26:28 -07:00
root b1e6d991b3 wangjunxia update xcatreg code 2014-04-07 19:17:24 -07:00
lissav 679cab11a0 do not build softlayer on AIX defect 4048 2014-04-07 13:01:39 -04:00
lissav 8a7857f57f defect 4047 2014-04-07 10:54:06 -04:00
lissav 066be36003 defect 4047 perl warnings 2014-04-07 10:38:49 -04:00
arif 6a4db6c0ff defect #4045: fix gpfs_updates to use MASTER instead of SITEMASTER for hierarchical situations 2014-04-07 14:05:24 +01:00
arif 54f99d0849 defect 4033: fix device based routing in makeroutes 2014-04-07 13:20:16 +01:00
daniceexi 5fd991246a added the resource to POST token for an account 2014-04-07 08:11:23 -04:00
daniceexi 6bb22d2342 added the token authentication mechanism in the xcatd 2014-04-07 07:57:57 -04:00
Jarrod Johnson d5cb13be6d Fix windows install problem where tmplfile was masked out in scope 2014-04-04 23:27:36 -04:00
linggao 3c7870afbc removed the dependency on openrc file, fixed defect 4040 and 4041 2014-04-05 04:42:28 -04:00
zhaoertao b169de45ef Modify doc output for osimage/osimage_allattr 2014-04-04 03:47:02 -07:00
zhaoertao bc8d13c9c0 use ext4 for powerkvm VM 2014-04-04 02:00:41 -07:00
ligc 997a8e36d0 Temporary remove the grub2-xcat dependency for PCM, it blockes PCM test 2014-04-04 04:34:33 -04:00
litingt 51e53737a2 merge 2.8 case to 2.9 2014-04-04 01:32:56 -07:00
ligc 69598e32f7 Build a separate xCAT-server for PCM, because of the perl-JSON dependency caused by RESTAPI 2014-04-04 14:46:26 -05:00
zhaoertao ebbfe29f5c nodeset supporting ubuntu LE for pkvm VM 2014-04-03 20:20:54 -07:00
yinle 7848b733b3 Modify doc for policy and site. 2014-04-04 01:52:49 -07:00
yinle 69455327e6 Modify doc output of policy and site. 2014-04-04 01:46:33 -07:00
linggao 469126c759 added verbose output for opsaddimage and opsaddbmnode commands. 2014-04-04 06:32:07 -04:00
lissav af908aafdf add timeout option on usage 2014-04-03 07:24:09 -04:00
lissav c5172263b9 fix syntax in hellp 2014-04-03 07:08:40 -04:00
yinle 788b616458 Modify auto-test script, add new configuration file keys. 2014-04-03 07:50:59 -07:00
ligc d84f7d5e9e pull build-debs-all from 2.8 to master 2014-04-03 15:30:02 -05:00
litingt 0579db7baa re-org all the code in this script 2014-04-03 01:24:15 -07:00
ligc f252d167a1 fix for 4029: do not try to modify /, will cause rpm install failure on RHEL7 2014-04-03 15:06:02 -05:00
daniceexi a0bbb92921 refine the output/doc of nodeshell,nodecopy,sw,postscript; Added the support of slpnodes 2014-04-03 04:29:42 -04:00
ligc b572e045fb fix for bug 4038: do not override --installdir with xcatdsklspost 2014-04-03 09:44:29 -05:00
mellor af9b887d23 defect 4026 add service node to error msg 2014-04-02 13:05:07 -04:00
ligc 40319ab858 fix a problem in perl-xCAT.spec for git commit id 2014-04-02 05:30:14 -04:00
ligc f88f454e9a fix a problem in perl-xCAT.spec for git commit id 2014-04-02 05:23:53 -04:00
ligc 9a71aee476 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core 2014-04-02 05:15:34 -04:00
daniceexi a2e384931a add more comments 2014-04-02 10:23:08 -04:00
ligc 09df503e1e add the git commit id in xCAT version 2014-04-02 15:50:41 -05:00
ligc 3a65f12683 undo the last checkin for buildcore.sh, wrong local repo 2014-04-02 05:12:17 -04:00
GONG Jie e867ef90e9 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core 2014-04-02 15:32:57 +08:00
litingt 276554154f add CURDIR to specify directory 2014-04-01 20:58:53 -07:00
Chuck Brazie 1ece21a021 Comment out the horizontal whitespace escape char 2014-04-01 13:23:24 -04:00
daniceexi c6486a6228 Add more comments and remove not used subroutines 2014-04-01 12:41:51 -04:00
daniceexi c540c616ab make the output of nodeshell src is grouped with the nodename; support the xcoll flag to group the output with the output message instead of node 2014-04-01 10:16:02 -04:00
mellor a698e1757d defect 4020 - correctly handle results from gethostbyaddr in xcatd installmonitor 2014-03-31 17:50:05 -04:00
lissav 9e3dfa484b fix defect 4034 2014-03-31 14:26:29 -04:00
daniceexi 8887485857 support subnodes resource 2014-03-31 10:17:54 -04:00
daniceexi cf5fc84937 add the support of makedns/makedhcp, nodestat and bootstate=offline for node 2014-03-29 04:36:15 -04:00
GONG Jie da3d528caf Add mn_install 2014-03-28 22:48:12 +08:00
daniceexi 843a32e664 add the URI support for group and makedns/makedhcp 2014-03-28 10:09:17 -04:00
litingt 9ceb62cdaa checkin for Junxia 2014-03-28 00:16:49 -07:00
litingt e62178aee8 add repo file creation 2014-03-27 22:21:51 -07:00
daniceexi c418e9aeb9 More uri definition changes 2014-03-28 03:04:55 -04:00
lissav a487eeda81 fix spelling 2014-03-27 13:34:07 -04:00
daniceexi e0ff38a38a refine the output for node resources 2014-03-27 10:18:29 -04:00
mellor e75be5fe88 defect 3998 - change file vars to globals 2014-03-26 17:10:05 -04:00
lissav c822d4f560 defect 3953 2014-03-26 13:08:41 -04:00
ligc 4d262b0db4 doxcat: the ntp -c rv 0 offset may return negative number 2014-03-26 16:02:16 -05:00
ligc fe545184b5 gensis-scripts: doxcat - ntpq -c rv state does not work any more, use the ntpq -c rv offset instead 2014-03-26 14:23:28 -05:00
mellor 2709ec4d25 defect 3964 - clarify mknb man page for hierarchy with sharedtftp=0 2014-03-25 15:59:17 -04:00
lissav 4c88b1b469 defect 3941 2014-03-25 08:11:11 -04:00
ligc 95a3d8ef3c add the centos6.5 discid info, fix a problem in post.xcat 2014-03-25 17:17:00 -05:00
daniceexi 8be3e23145 Change the output format for several URI 2014-03-25 10:18:34 -04:00
litingt 435e989da4 build script for local automation test 2014-03-25 02:45:11 -07:00
immarvin 36c2404d1c add grub2-xcat as a dependency to enable provisioning rhel7 on an ubuntu MN 2014-03-25 01:17:24 -07:00
ligc 9f9768fd28 fix xCAT-genesis-builder/buildrpm for latest mcp version 2014-03-25 14:54:51 -05:00
yinle 194b864487 Merge subroutines to xcatreg 2014-03-25 02:00:50 -07:00
root eb3e5aaee0 wangjunxiaw check autotest script 2014-03-24 18:51:30 -07:00
lissav 0297069b71 remove autosetup of useflowcontorl see 4031 2014-03-24 09:26:46 -04:00
zhaoertao 054ef6d125 rcons support for powerkvm 2014-03-24 02:03:06 -07:00
huweihua ec8a2069cd fix defect 3875 2014-03-24 05:04:30 -04:00
root e60212cfb8 code frame step by step 2014-03-24 01:39:31 -07:00
lissav dba2219b18 update man 2014-03-21 14:52:17 -04:00
lissav 5694147a73 tabprune -a supports all tables 2014-03-21 14:45:56 -04:00
Jarrod Johnson d183a0bb9d 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:57:42 -04:00
lissav 021b4c69fb fix -L option 2014-03-21 09:57:22 -04:00
lissav 8fcfccb42f add pointer to Easy Regx documentation 2014-03-21 08:02:49 -04:00
immarvin 3fa9fd3e7b append some code logic and documentation for rhels7 support on grub2
Conflicts:

	xCAT-server/lib/xcat/plugins/grub2.pm
2014-03-21 04:53:07 -07:00
zhaoertao 17aa3f84ac support for powerkvm provisioning 2014-03-21 00:14:47 -07:00
huweihua 5a3847d3ea add testcase for xdsh 2014-03-21 02:10:01 -04:00
huweihua 737550e69b add testcase for xdcp 2014-03-21 02:09:21 -04:00
huweihua 25f7bb326e add testcase for sysclone 2014-03-21 02:08:44 -04:00
huweihua 398e63f180 add testcase for pscp 2014-03-21 02:08:10 -04:00
huweihua 0a45d0bcf9 add testcase for prsync 2014-03-21 02:07:38 -04:00
huweihua 1535113fb1 add testcase for ppping 2014-03-21 01:55:20 -04:00
huweihua 43fefadf30 add testcase for makeroutes 2014-03-21 01:53:27 -04:00
huweihua b186280ab8 add testcase for makedns 2014-03-21 01:37:04 -04:00
arif 373cc13aa0 fix bug #4027, replace chop with chomp 2014-03-20 23:10:31 +00:00
lissav 12f1819180 fix defect 3981 2014-03-20 14:22:47 -04:00
linggao b96b2d0ec9 more code for supporting other hardware in OpenStack baremetal driver. 2014-03-21 06:58:10 -04:00
Jia Zhao ff619264a4 fix autodiscovery problem as not run makehosts command 2014-03-20 18:34:41 +08:00
daniceexi 3bac60fac8 add more rest api implementation. refine the doc output 2014-03-20 11:26:50 -04:00
daniceexi 4aafb62e16 add comments for the procedure to handle a restapi request; add comments to describe the definition of URI 2014-03-20 02:13:27 -04:00
Bruce Potter eab4fced6a Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
updated table rest api description
2014-03-19 18:02:24 -04:00
Bruce Potter bd7a9096b2 updated table rest api description 2014-03-19 18:01:58 -04:00
immarvin 9c3ed358b4 fix defect #4030 [DEV]'makedhcp -n' failed to add subnet info to dhcpd.conf on rhels7.0 x86_64 mn 2014-03-19 08:15:58 -07:00
immarvin c2b6d4def1 add rhels7 stateless and statelite support for x86_64 2014-03-19 08:00:45 -07:00
daniceexi 221a6854b7 add more doc info 2014-03-19 10:19:43 -04:00
lissav 149f0fd277 fix defect 4028 2014-03-19 07:23:32 -04:00
litingt 81dc649a24 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core 2014-03-19 02:10:47 -04:00
litingt a0dc770139 xCAT daily regression tool script 2014-03-19 00:15:48 -04:00
Bruce Potter 7ad5cf800d Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
finished table get rest api calls
2014-03-18 18:47:14 -04:00
Bruce Potter 0bd4753702 finished table get rest api calls 2014-03-18 18:47:01 -04:00
mellor 9a2305dd3a clarify that genimage -i is optional 2014-03-18 14:55:32 -04:00
daniceexi a5ff9cfeec add the mechanism to auto make document for restapi 2014-03-18 10:22:17 -04:00
ligc 707f0c315b xCAT-SoftLayer package is noarch only on Linux, not on AIX 2014-03-18 16:20:19 -05:00
ligc 596aadcd3e xCAT-SoftLayer.spec: cp -a does not work on AIX, change to use -p -R instead 2014-03-18 14:16:55 -05:00
ligc 83732b7b5d makerpm: add copying xcat.conf.apach24 into /SOURCES 2014-03-18 13:56:45 -05:00
ligc 2a65930be9 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:40:49 -04:00
Bruce Potter 120312c5ea Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
got table rest api call to work for single or multiple node
2014-03-17 18:16:43 -04:00
linggao 5529a93267 fix defect #4023 syntax error 2014-03-18 09:16:25 -04:00
Bruce Potter 79d7b55208 got table rest api call to work for single or multiple node 2014-03-17 18:16:13 -04:00
139 changed files with 13876 additions and 8240 deletions
Executable
+88
View File
@@ -0,0 +1,88 @@
#!/bin/bash
###########
#
# This script call make<package>deb and create the deb packages
# for xCAT
#
# Author: Leonardo Tonetto <tonetto@linux.vnet.ibm.com>
# Revisor: Adalberto Medeiros <adalbas@linux.vnet.ibm.com>
# Revisor2: Arif Ali <aali@ocf.co.uk>
#
# Input:
#
# $1 is the build type/location
# $2 is the string added to the debian/changelog of each package
#
############
##############
# Get input
##############
PKG_LOCATION=$1 # local | snap | alpha
if [ -z $PKG_LOCATION ]; then
PKG_LOCATION="local"
fi
BUILD_STRING=$2
if [ -z $BUILD_STRING ]; then
BUILD_STRING="Personal Build"
fi
XCAT_VERSION=`cat Version`
TRUNK_REVISION=`svnversion | cut -d ":" -f1`
CUR_DATE=`date +%Y%m%d`
VERSION="${XCAT_VERSION}-${PKG_LOCATION}${CUR_DATE}"
function makedeb {
SRC_ROOT=$1
PKG_LOCATION=$2
BUILD_STRING=$3
VERSION=$4
#
# Make DEBs
#
# build perl-xCAT - deps are libsoap-lite-perl, libdigest-sha1-perl, libdbi-perl
#
find $SRC_ROOT -maxdepth 2 -name debian -type d | while read DEBIAN_DIR
do
DIR=`echo ${DEBIAN_DIR} | sed -e 's/[/]debian$//'`
cd ${DIR}
dch -v $VERSION -b -c debian/changelog "$BUILD_STRING"
dpkg-buildpackage
cd -
RC=$?
if [ ${RC} -gt 0 ]
then
echo "Warning: ${DEBIAN_DIR} failed exit code ${RC}"
fi
done
#
# Clean up
#
# Eliminate unnecessary directories and debian/files made by dpkg-buildpackage
find $SRC_ROOT -maxdepth 3 -type d -name "xcat-*" | grep debian | xargs rm -rf
find $SRC_ROOT -maxdepth 3 -type f -name "files" | grep debian | xargs rm -f
}
# build all debian packages
packages="xCAT-client xCAT-nbroot xCAT-nbroot2 perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-IBMhpc xCAT-rmc"
for file in `echo $packages`
do
makedeb $file $PKG_LOCATION "$BUILD_STRING" $VERSION
done
if [ -d debs ]; then
rm -rf debs
fi
mkdir debs
mv xcat* debs/
mv perl-xcat* debs/
echo $VERSION > latest_version
exit 0
+5 -2
View File
@@ -44,8 +44,10 @@ FRS=/home/frs/project/x/xc/xcat
ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-OpenStack xCAT-SoftLayer xCAT-OpenStack-baremetal"
ZVMBUILD="perl-xCAT xCAT-server xCAT-UI"
ZVMLINK="xCAT-client xCAT xCATsn"
PCMBUILD="xCAT"
PCMLINK="perl-xCAT xCAT-client xCAT-server xCAT-buildkit xCAT-genesis-scripts-x86_64"
# xCAT has PCM specific configuration - conserver-xcat, syslinux-xcat
# xCAT-server has PCM specific configuration - RESTAPI(perl-JSON)
PCMBUILD="xCAT xCAT-server"
PCMLINK="perl-xCAT xCAT-client xCAT-buildkit xCAT-genesis-scripts-x86_64"
# Note: for FSM, the FlexCAT rpm is built separately from gsa/git
FSMBUILD="perl-xCAT xCAT-client xCAT-server"
FSMLINK=""
@@ -241,6 +243,7 @@ for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xC
#if [ "$EMBED" = "zvm" -a "$rpmname" != "xCAT-server" -a "$rpmname" != "xCAT-UI" ]; then continue; fi # for zvm embedded env only need to build server and UI
if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi # do not build xCAT-buildkit on aix
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-SoftLayer" ]; then continue; fi # do not build xCAT-softlayer on aix
if $GREP $rpmname $GITUP || [ "$BUILDALL" == 1 ]; then
UPLOAD=1
maker $rpmname
Executable
+160
View File
@@ -0,0 +1,160 @@
#######################################################################
#build script for local usage
#used for Linux/AIX/Ubuntu
#
###########################################################################
OSNAME=$(uname)
NAMEALL=$(uname -a)
for i in $*; do
# upper case the variable name
varstring=`echo "$i"|cut -d '=' -f 1|tr '[a-z]' '[A-Z]'`=`echo "$i"|cut -d '=' -f 2`
export $varstring
done
if [ -z "$CURDIR" ]; then
echo "get current directory!"
CURDIR=$(pwd)
fi
echo "CURDIR is $CURDIR"
echo "OSNAME is $OSNAME!"
echo "NAMEALL is $NAMEALL"
grep -i 'SUSE' /etc/issue
if [ $? -eq 0 ]; then
echo "This is a SUSE system!"
OS="SUSE";
fi
ls $CURDIR/makerpm
if [ $? -gt 0 ]; then
echo "Error:no repo exist, exit 1."
exit 1
fi
# Get a lock, so can not do 2 builds at once
exec 8>/var/lock/xcatbld.lock
if ! flock -n 8; then
echo "Can't get lock /var/lock/xcatbld.lock. Someone else must be doing a build right now. Exiting...."
exit 1
fi
#delete old package if there is
rm -rf $CURDIR/build/
cd $CURDIR
echo "==============================================="
echo $NAMEALL | egrep "Ubuntu"
#Check if it is an Ubuntu system
if [ $? -eq 0 ]; then
echo "This is an Ubuntu system"
pkg_type="snap"
build_string="Snap_Build"
cur_date=`date +%Y%m%d`
short_ver=`cat Version|cut -d. -f 1,2`
pkg_version="${short_ver}-${pkg_type}${cur_date}"
mkdir -p $CURDIR/build
for rpmname in xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT xCATsn xCAT-test; do
rpmname_low=`echo $rpmname | tr '[A-Z]' '[a-z]'`
echo "============================================"
echo "$rpmname_low"
cd $rpmname
dch -v $pkg_version -b -c debian/changelog $build_string
dpkg-buildpackage -uc -us
rc=$?
if [ $rc -gt 0 ]; then
echo "Error: $rpmname build package failed exit code $rc"
fi
cd -
mv ${rpmname_low}* $CURDIR/build
done
#delete all files except .deb file
find $CURDIR/build/* ! -name *.deb | xargs rm -f
else
#This is not an Ubuntu system
echo "This is an $OSNAME system"
if [ "$OS" = "SUSE" ]; then
rm -rf /usr/src/packages/RPMS/noarch/*
rm -rf /usr/src/packages/RPMS/x86_64/*
rm -rf /usr/src/packages/RPMS/ppc64/*
else
rm -rf /root/rpmbuild/RPMS/noarch/*
rm -rf /root/rpmbuild/RPMS/x86_64/*
rm -rf /root/rpmbuild/RPMS/ppc64/*
fi
mkdir -p $CURDIR/build/
#always build perl-xCAT
$CURDIR/makerpm perl-xCAT
# Build the rest of the noarch rpms
for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-test xCAT-buildkit; do
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi
$CURDIR/makerpm $rpmname
done
#build xCAT-genesis-scripts if it is x86_64 platform
ARCH=$(uname -p)
if [ "$ARCH" = "x64_64" ]; then
$CURDIR/makerpm xCAT-genesis-scripts x86_64
fi
# Build the xCAT and xCATsn rpms for all platforms
for rpmname in xCAT xCATsn; do
if [ "$OSNAME" = "AIX" ]; then
$CURDIR/makerpm $rpmname
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname"; fi
else
for arch in x86_64 ppc64 s390x; do
$CURDIR/makerpm $rpmname $arch
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname-$arch"; fi
done
fi
done
if [ "$OS" = "SUSE" ]; then
cp /usr/src/packages/RPMS/noarch/* $CURDIR/build/
cp /usr/src/packages/RPMS/x86_64/* $CURDIR/build/
cp /usr/src/packages/RPMS/ppc64/* $CURDIR/build/
else
cp /root/rpmbuild/RPMS/noarch/* $CURDIR/build/
cp /root/rpmbuild/RPMS/x86_64/* $CURDIR/build/
cp /root/rpmbuild/RPMS/ppc64/* $CURDIR/build/
fi
#begin to create repo for redhat platform
grep -i 'Red' /etc/issue;
if [ "$OSNAME" != "AIX" -a $? -eq 0 ]; then
cat >$CURDIR/build/xCAT-core.repo << EOF
[xcat-2-core]
name=xCAT 2 Core packages
baseurl=file://$CURDIR/build
enabled=1
gpgcheck=0
EOF
cp $CURDIR/build/xCAT-core.repo /etc/yum.repos.d/
else
rm -f /etc/zypp/repos.d/xCAT-core.repo
zypper ar file://$CURDIR/build xCAT-core
fi
fi
+1
View File
@@ -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
+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
+4 -3
View File
@@ -1,20 +1,21 @@
#!/bin/sh
# Put the version, svn revision #, and build date into the Version function in Version.pm
if [ -z "$1" ]
if [ -z "$2" ]
then
echo "modifyUtils: Error: must specify the xCAT version as an argument" >&2
exit
fi
VER=$1
GITREF="git commit $2, "
BUILDDATE=`date`
#echo ". '(built $BUILDDATE)'"
if [ "$(uname)" = "AIX" ]
then
sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (built $BUILDDATE)'"/ xCAT/Version.pm >xCAT/Version.pm.new
sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${GITREF}built $BUILDDATE)'"/ xCAT/Version.pm >xCAT/Version.pm.new
mv xCAT/Version.pm.new xCAT/Version.pm
else
if [ -f "/etc/debian_version" ];then
@@ -22,5 +23,5 @@ else
else
FILENAME="xCAT/Version.pm"
fi
sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (built $BUILDDATE)'"/ $FILENAME
sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${GITREF}built $BUILDDATE)'"/ $FILENAME
fi
+3 -1
View File
@@ -23,6 +23,8 @@ Provides: perl-xCAT = %{epoch}:%{version}
Provides perl xCAT libraries for core functionality. Required for all xCAT installations.
Includes xCAT::Table, xCAT::NodeRange, among others.
%define gitinfo %(git log -n 1 | head -n 1 | cut -f 2 -d ' ')
%define zvm %(if [ "$zvm" = "1" ];then echo 1; else echo 0; fi)
%define fsm %(if [ "$fsm" = "1" ];then echo 1; else echo 0; fi)
@@ -36,7 +38,7 @@ Includes xCAT::Table, xCAT::NodeRange, among others.
%if %fsm
%else
# Modify the Version() function in xCAT/Utils.pm to automatically have the correct version
./modifyUtils %{version}
./modifyUtils %{version} %{gitinfo}
# Build the pod version of the man pages for each DB table. It puts them in the man5 and man7 subdirs.
# Then convert the pods to man pages and html pages.
+34 -24
View File
@@ -598,7 +598,7 @@ sub _execute_dsh
}
else
{
# LKV: This is where the output shows up
# HERE: This is where the output shows up
#print STDOUT @{$output_buffers{$user_target}};
#print STDERR @{$error_buffers{$user_target}};
chomp(@{$output_buffers{$user_target}});
@@ -3993,8 +3993,7 @@ sub parse_and_run_dsh
{
$options{'user'} = $ENV{'DSH_TO_USERID'};
}
if ((!(defined(@$nodes))) && (!(defined($options{'rootimg'}))))
if ((!(defined($nodes))) && (!(defined($options{'rootimg'}))))
{ # no nodes and not -i option, error
my $rsp = ();
$rsp->{error}->[0] = "Unless using -i option, noderange is required.";
@@ -4033,7 +4032,7 @@ sub parse_and_run_dsh
{ # from sinv, discard this name
undef @$nodes;
}
if (defined(@$nodes))
if (@$nodes)
{
my $rsp = {};
$rsp->{error}->[0] =
@@ -4405,7 +4404,7 @@ sub parse_and_run_dcp
return;
}
}
if ((!(defined(@$nodes))) && (!(defined($options{'rootimg'}))))
if ((!(defined($nodes))) && (!(defined($options{'rootimg'}))))
{ # no nodes and not -i option, error
my $rsp = {};
$rsp->{error}->[0] = "Unless using -i option, noderange is required.";
@@ -4502,7 +4501,7 @@ sub parse_and_run_dcp
#
# build list of nodes
my @nodelist;
if (defined(@$nodes))
if (@$nodes)
{ # there are nodes
@nodelist = @$nodes;
$options{'nodes'} = join(',', @nodelist);
@@ -4972,7 +4971,8 @@ sub parse_rsync_input_file_on_MN
$::process_line = 0;
my $destfileisdir;
my $clause=0;
my $addmergescript =0;
my $addappendscript =0;
open(INPUTFILE, "< $input_file") || die "File $input_file does not exist\n";
while (my $line = <INPUTFILE>)
{
@@ -5013,12 +5013,16 @@ sub parse_rsync_input_file_on_MN
# this triggers the running of the appendscript
$::appendscript ="/opt/xcat/share/xcat/scripts/xdcpappend.sh";
}
# add the append script to the sync
my $appscript ="/opt/xcat/share/xcat/scripts/xdcpappend.sh";
my $appendscriptline = "$appscript -> $appscript";
$syncappendscript=1; # syncing the xdcpappend.sh script
&build_append_rsync($appendscriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncappendscript);
}
if ($addappendscript == 0) { # only add once
my $appscript ="/opt/xcat/share/xcat/scripts/xdcpappend.sh";
my $appendscriptline = "$appscript -> $appscript";
$syncappendscript=1; # syncing the xdcpappend.sh script
&build_append_rsync($appendscriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncappendscript);
$addappendscript=1;
}
} # end APPEND clause
if ($clause =~ /MERGE:/) {
# location of the base merge script
# for MERGE we have to sync the mergescript and the
@@ -5030,12 +5034,16 @@ sub parse_rsync_input_file_on_MN
# this triggers the running of the mergescript
$::mergescript ="/opt/xcat/share/xcat/scripts/xdcpmerge.sh";
}
# add the merge script to the sync
my $mergescript ="/opt/xcat/share/xcat/scripts/xdcpmerge.sh";
my $mergescriptline = "$mergescript -> $mergescript";
$syncmergescript=1; # syncing the xdcpmerge.sh script
&build_merge_rsync($mergescriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncmergescript);
}
if ($addmergescript == 0) { # only add once
my $mergescript ="/opt/xcat/share/xcat/scripts/xdcpmerge.sh";
my $mergescriptline = "$mergescript -> $mergescript";
$syncmergescript=1; # syncing the xdcpmerge.sh script
&build_merge_rsync($mergescriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncmergescript);
$addmergescript=1;
}
} # end MERGE clause
}
} else { # not processing EXECUTE, EXECUTEALWAYS or APPEND
@@ -5199,6 +5207,7 @@ sub build_append_rsync
push @::appendlines,$line;
}
my $src_file = $1; # append file left of arror
my $orig_src_file = $1; # append file left of arror
# it will be sync'd to $nodesyncfiledir/$append_file
my $dest_file = $nodesyncfiledir;
$dest_file .= $src_file;
@@ -5227,7 +5236,7 @@ sub build_append_rsync
# to pick up files from /var/xcat/syncfiles...
if ($onServiceNode == 1) {
my $newsrcfile = $syncdir; # add SN syndir on front
$newsrcfile .= $src_file;
$newsrcfile .= $orig_src_file;
$src_file=$newsrcfile;
}
# destination file name
@@ -5310,7 +5319,8 @@ sub build_merge_rsync
if ($syncmergescript == 0) { # don't add the xdcpmerge.sh line
push @::mergelines,$line;
}
my $src_file = $1; # merge file left of arror
my $src_file = $1; # merge file left of arrow
my $orig_src_file = $1;
# it will be sync'd to $nodesyncfiledir/$merge_file
my $dest_file = $nodesyncfiledir;
$dest_file .= $src_file;
@@ -5339,7 +5349,7 @@ sub build_merge_rsync
# to pick up files from /var/xcat/syncfiles...
if ($onServiceNode == 1) {
my $newsrcfile = $syncdir; # add SN syndir on front
$newsrcfile .= $src_file;
$newsrcfile .= $orig_src_file;
$src_file=$newsrcfile;
}
# destination file name
@@ -6029,11 +6039,11 @@ sub run_always_rsync_postscripts
# if on the service node need to add the $syncdir directory
# to the path
if (xCAT::Utils->isServiceNode()) {
my $tmpp=$syncdir . $ps;
$ps=$tmpp;
my $tmps=$syncdir . $ps;
push @args, $tmps;
} else{
push @args, $ps;
}
push @args, $ps;
push (@nodes, @{$$dshparms{'postscripts'}{$ps}});
$out=xCAT::Utils->runxcmd( { command => ['xdsh'],
-58
View File
@@ -253,64 +253,6 @@ use strict;
#---------------------------------------------------------------------------
=head3
ifconfig_inet
Builds a list of all IP Addresses bound to the local host and
stores them in a global list
Arguments:
None
Returns:
None
Globals:
@local_inet
Error:
None
Example:
xCAT::DSHCore->ifconfig_inet;
Comments:
Internal routine only
=cut
#---------------------------------------------------------------------------
sub ifconfig_inet
{
my @local_inet = ();
if ($^O eq 'aix')
{
my @ip_address = ();
my @output = `/usr/sbin/ifconfig -a`;
foreach my $line (@output)
{
($line =~ /inet ((\d{1,3}?\.){3}(\d){1,3})\s/o)
&& (push @local_inet, $1);
}
}
elsif ($^O eq 'linux')
{
my @ip_address = ();
my @output = `/sbin/ifconfig -a`;
foreach my $line (@output)
{
($line =~ /inet addr:((\d{1,3}?\.){3}(\d){1,3})\s/o)
&& (push @local_inet, $1);
}
}
}
#---------------------------------------------------------------------------
+198 -30
View File
@@ -16,7 +16,7 @@ use xCAT::Usage;
use xCAT::NodeRange;
use xCAT::FSPUtils;
use xCAT::VMCommon;
#use Data::Dumper;
use Data::Dumper;
use xCAT::MsgUtils qw(verbose_message);
##############################################
# Globals
@@ -48,6 +48,15 @@ sub parse_args {
##########################################################################
# Parse the chvm command line for options and operands
##########################################################################
my @query_array = ();
my %param_list_map = (
'vmcpus' => 'part_get_lpar_processing',
'vmmemory' => 'part_get_lpar_memory',
'vmphyslots' => 'part_get_all_io_bus_info',
'vmnics' => 'part_get_all_vio_info',
'vmstorage' => 'part_get_all_vio_info',
'del_vadapter' => 'part_get_all_vio_info'
);
sub chvm_parse_extra_options {
my $args = shift;
@@ -57,6 +66,7 @@ sub chvm_parse_extra_options {
if (ref($args) ne 'ARRAY') {
return "$args";
}
my %tmp_hash = ();
foreach (@$args) {
my ($cmd, $value) = split (/\=/, $_);
if (!defined($value)) {
@@ -75,14 +85,24 @@ sub chvm_parse_extra_options {
# return "'$value' invalid";
# }
} elsif (grep(/^$cmd$/, @support_ops)) {
if (exists($param_list_map{$cmd})) {
$tmp_hash{$param_list_map{$cmd}} = 1;
}
if (exists($opt->{p775})) {
return "'$cmd' doesn't work for Power 775 machines.";
} elsif ($cmd eq "del_vadapter") {
if ($value !~ /^\d+$/) {
return "Invalid param '$value', only one slot id can be specified";
}
} elsif ($cmd eq "vmothersetting") {
if ($value =~ /hugepage:\s*(\d+)/i) {
$opt->{huge_page} = $1;
$tmp_hash{'get_huge_page'} = 1;
}
if ($value =~ /bsr:\s*(\d+)/i) {
$opt->{bsr} = $1;
$tmp_hash{'get_cec_bsr'} = 1;
}
next;
} elsif ($cmd eq "vmstorage") {
@@ -157,6 +177,7 @@ sub chvm_parse_extra_options {
}
$opt->{$cmd} = $value;
}
@query_array = keys(%tmp_hash);
return undef;
}
@@ -719,7 +740,7 @@ sub lsvm_parse_args {
$Getopt::Long::ignorecase = 0;
Getopt::Long::Configure( "bundling" );
if ( !GetOptions( \%opt, qw(V|verbose l|long p775) )) {
if ( !GetOptions( \%opt, qw(V|verbose l|long p775 updatedb) )) {
return( usage() );
}
if (exists($opt{l}) && !exists($opt{p775})) {
@@ -758,11 +779,12 @@ sub modify {
return op_extra_cmds ($request, $hash) if ($request->{opt}->{lparname} || $request->{opt}->{huge_page});
return ([["Error", "Miss argument\n".$usage_string, 1]]);
}
sub do_op_extra_cmds {
my $request = shift;
my $hash = shift;
my @values = ();
my %lpar_hash = ();
while (my ($mtms, $h) = each(%$hash)) {
my $memhash;
while (my($name, $d) = each(%$h)) {
@@ -827,17 +849,17 @@ sub do_op_extra_cmds {
if ($2 == "G" or $2 == '') {
$min = $min * 1024;
}
$min = $min/$memsize;
$min = int($min/$memsize);
my $cur = $3;
if ($4 == "G" or $4 == '') {
$cur = $cur * 1024;
}
$cur = $cur/$memsize;
$cur = int($cur/$memsize);
my $max = $5;
if ($6 == "G" or $6 == '') {
$max = $max * 1024;
}
$max = $max/$memsize;
$max = int($max/$memsize);
$request->{opt}->{$op} ="$min/$cur/$max";
$param = $request->{opt}->{$op};
} else {
@@ -870,8 +892,15 @@ sub do_op_extra_cmds {
push @values, [$name, "Success", '0'];
}
}
my $rethash = query_cec_info_actions($request, $name, $d, 1, \@query_array);
# need to add update db here
$lpar_hash{$name} = $rethash;
$lpar_hash{$name}->{parent} = @$d[3];
}
}
if (%lpar_hash) {
update_vm_db($request, \%lpar_hash);
}
return \@values;
}
sub check_node_info {
@@ -1652,6 +1681,7 @@ my @partition_query_actions = qw(part_get_partition_cap part_get_hyp_process_and
sub parse_part_get_info {
my $hash = shift;
my $data = shift;
my $lparid = shift;
my @array = split /\n/, $data;
foreach my $line (@array) {
chomp($line);
@@ -1672,9 +1702,12 @@ sub parse_part_get_info {
$hash->{bus}->{$3}->{cur_lparid} = $1;
$hash->{bus}->{$3}->{bus_slot} = $2;
$hash->{bus}->{$3}->{des} = $4;
if ($lparid and $lparid eq $1) {
push @{$hash->{lpar_phy_bus}}, $3;
}
} elsif ($line =~ /Phy drc_index:(\w+), Port group: (\w+), Phy port id: (\w+)/) {
$hash->{phy_drc_group_port}->{$1}->{$2}->{$3} = '1';
} elsif ($line =~ /adapter_id=(\w+),lpar_id=([\d|-]+).*port_group=(\d+),phys_port_id=(\d+).*drc_index=(\w+),.*/) {
#} elsif ($line =~ /adapter_id=(\w+),lpar_id=([\d|-]+).*port_group=(\d+),phys_port_id=(\d+).*drc_index=(\w+),.*/) {
if (($2 == -1) && ($4 == 255)) {
$hash->{logic_drc_phydrc}->{$3}->{$5} = $1;
#$hash->{logic_drc_phydrc}->{$5}->{$1} = [$2,$3,$4];
@@ -1687,12 +1720,49 @@ sub parse_part_get_info {
$hash->{lpar0_used_mem} = $2;
$hash->{phy_min_mem_req} = $3;
#print "===>lpar0_used_mem:$hash->{lpar0_used_mem}.\n";
} elsif ($line =~ /Curr Memory Req:[^\(]*\((\d+)\s*regions\)/) {
$hash->{lpar_used_regions} = $1;
} elsif ($line =~ /Curr Memory (Min|Req|Max):\s*([\d]*)[^\(]*\((\d+)\s*regions\)/) {
if ($1 eq 'Min') {
$hash->{lpar_mem_min} = $2
} elsif ($1 eq 'Max') {
$hash->{lpar_mem_max} = $2;
} else {
$hash->{lpar_mem_req} = $2;
$hash->{lpar_used_regions} = $3;
}
} elsif ($line =~ /Curr Processor (Min|Req|Max):\s*(\d+)/) {
if ($1 eq 'Min') {
$hash->{lpar_cpu_min} = $2;
} elsif ($1 eq 'Max') {
$hash->{lpar_cpu_max} = $2;
} else {
$hash->{lpar_cpu_req} = $2;
}
} elsif ($line =~ /\s*lpar_id=(\d+),type=vSCSI,slot=(\d+),attr=(\d+).*remote_lpar_id=0x(\w+),remote_slot_num=0x(\w+)/) {
if ($3 eq '0') {
my $lparid = hex($4);
my $slotid = hex($5);
push @{$hash->{lpar_vmstorage_client}}, "$lparid:$slotid";
} else {
if (exists($hash->{lpar_vmstorage_server})) {
$hash->{lpar_vmstorage_server}++;
} else {
$hash->{lpar_vmstorage_server} = 1;
}
}
} elsif ($line =~ /\s*lpar_id=(\d+),type=(vEth),slot=(\d+).*port_vlan_id=(\d+),mac_addr=(\w+)/) {
push @{$hash->{lpar_vmnics}}, "vlan$4";
} elsif ($line =~ /Available huge page memory\(in pages\):\s*(\d+)/) {
$hash->{huge_page_avail} = $1;
} elsif ($line =~ /Available BSR array:\s*(\d+)/) {
$hash->{cec_bsr_avail} = $1;
} elsif ($line =~ /^\d+\/(\d+)\/\d+$/) {
if ($1 ne 0) {
push @{$hash->{lpar_othersetting}}, "hugepage:$1";
}
} elsif ($line =~ /^(\d+)\.$/) {
if ($1 ne 0) {
push @{$hash->{lpar_othersetting}}, "bsr:$1";
}
}
}
}
@@ -1703,6 +1773,7 @@ sub query_cec_info_actions {
my $td = shift;
my $usage = shift;
my $action_array = shift;
my $lpar_hash = shift;
my $lparid = @$td[0];
my $data;
my @array = ();
@@ -1717,12 +1788,16 @@ sub query_cec_info_actions {
chomp(@$values[1]);
#if ($action eq "part_get_partition_cap" and (@$values[1] =~ /Error:/i or @$values[2] ne 0)) {
if (@$values[1] =~ /Error:/i or @$values[2] ne 0) {
return ([[@$values]]);
next; #return ([[@$values]]);
}
if (@$values[1] =~ /^$/) {
next;
}
if ($usage eq 0) {
if ($usage eq 1 or $usage eq 2) {
&parse_part_get_info(\%hash, @$values[1], $lparid);
}
if ($usage eq 0 or $usage eq 2) {
if ($lparid) {
if ($action eq "lpar_lhea_mac") {
my @output = split /\n/,@$values[1];
@@ -1777,18 +1852,72 @@ sub query_cec_info_actions {
}
#$data .= "@$values[1]\n\n";
push @array, [$name, @$values[1], @$values[2]];
} else {
&parse_part_get_info(\%hash, @$values[1]);
}
}
}
if ($usage eq 0) {
if ($usage eq 0 or $usage eq 2) {
#return $data;
if ($usage eq 2) {
%$lpar_hash = %hash;
}
return \@array;
} else {
return \%hash;
}
}
sub update_vm_db {
my $request = shift;
my $lpar_hash = shift;
my $vm_hd = xCAT::Table->new('vm');
my %name_id_map = ();
my $commit = 0;
foreach (keys (%$lpar_hash)) {
my %db_update = ();
my $node_hash = $lpar_hash->{$_};
if (exists($node_hash->{lpar_cpu_min})) {
$db_update{cpus} = "$node_hash->{lpar_cpu_min}/$node_hash->{lpar_cpu_req}/$node_hash->{lpar_cpu_max}";
}
if (exists($node_hash->{lpar_mem_min})) {
$db_update{memory} = "$node_hash->{lpar_mem_min}/$node_hash->{lpar_mem_req}/$node_hash->{lpar_mem_max}";
}
if (exists($node_hash->{lpar_vmstorage_server})) {
$db_update{storage} = $node_hash->{lpar_vmstorage_server};
} elsif (exists($node_hash->{lpar_vmstorage_client})) {
my @tmp_array = ();
foreach (@{$node_hash->{lpar_vmstorage_client}}) {
if (/(\d+):(\d+)/) {
if (exists($name_id_map{$1})) {
push @tmp_array, "$name_id_map{$1}:$2";
} else {
my $vios_name = &find_lpar_name($request, $node_hash->{parent}, $1);
if (defined($vios_name)) {
$name_id_map{$1} = $vios_name;
push @tmp_array, "$vios_name:$2";
}
}
}
}
$db_update{storage} = join(",",@tmp_array);
}
if (exists($node_hash->{lpar_vmnics})) {
$db_update{nics} = join(",",@{$node_hash->{lpar_vmnics}});
}
if (exists($node_hash->{lpar_phy_bus})) {
$db_update{physlots} = join(",",@{$node_hash->{lpar_phy_bus}});
}
if (exists($node_hash->{lpar_othersetting})) {
$db_update{othersettings} = join(",",@{$node_hash->{lpar_othersetting}});
}
if (%db_update) {
$vm_hd->setNodeAttribs($_,\%db_update);
$commit = 1;
}
}
if ($commit) {
$vm_hd->commit;
}
}
#my @partition_query_actions = qw(part_get_partition_cap part_get_num_of_lpar_slots part_get_hyp_config_process_and_mem part_get_hyp_avail_process_and_mem part_get_service_authority_lpar_id part_get_shared_processing_resource part_get_all_vio_info lpar_lhea_mac part_get_all_io_bus_info part_get_lpar_processing part_get_lpar_memory get_huge_page get_cec_bsr);
sub query_cec_info {
my $request = shift;
@@ -1796,25 +1925,36 @@ sub query_cec_info {
my $args = $request->{opt};
my @td = ();
my @result = ();
my $usage = 0;
my %lpar_hash = ();
#print Dumper($request);
#print Dumper($hash);
while (my ($mtms,$h) = each(%$hash) ) {
while (my ($name, $d) = each (%$h)) {
my %tmp_hash = ();
@td = @$d;
if (@$d[0] == 0 && @$d[4] !~ /lpar|vios/) {
last;
}
#my $rethash = query_cec_info_actions($request, $name, $d, 0, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_vio_info","lpar_lhea_mac","part_get_all_io_bus_info","get_huge_page","get_cec_bsr"]);
my $rethash = query_cec_info_actions($request, $name, $d, 0, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_io_bus_info","part_get_all_vio_info","get_huge_page","get_cec_bsr"]);
if ($args->{updatedb}) {
$usage = 2;
}
my $rethash = query_cec_info_actions($request, $name, $d, $usage, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_io_bus_info","part_get_all_vio_info","get_huge_page","get_cec_bsr"], \%tmp_hash);
#push @result, [$name, $rethash, 0];
push @result, @$rethash;
$lpar_hash{$name} = \%tmp_hash;
$lpar_hash{$name}->{parent} = @$d[3];
}
if (@td[0] == 0) {
my $rethash = query_cec_info_actions($request, @td[3],\@td, 0);
my $rethash = query_cec_info_actions($request, @td[3],\@td, $usage);
#push @result, [@td[3], $rethash, 0];
push @result, @$rethash;
}
}
if ($args->{updatedb} and %lpar_hash) {
update_vm_db($request, \%lpar_hash);
}
return \@result;
}
@@ -1931,6 +2071,19 @@ sub find_lpar_id {
return undef;
}
sub find_lpar_name {
my $request = shift;
my $parent = shift;
my $id = shift;
my %mapping = %{$request->{ppc}->{$parent}->{mapping}};
foreach (keys %mapping) {
if ($mapping{$_} eq $id) {
return $_;
}
}
return undef;
}
sub create_lpar {
my $request = shift;
my $name = shift;
@@ -2054,6 +2207,7 @@ sub mkspeclpar {
my $opt = $request->{opt};
my $values;
my @result = ();
my %lpar_hash = ();
my $vmtab = xCAT::Table->new( 'vm');
unless($vmtab) {
return([["Error","Cannot open vm table", 1]]);
@@ -2126,9 +2280,9 @@ sub mkspeclpar {
return([[$name, "Parameter for 'vmmemory' is invalid", 1]]);
}
my $memsize = $memhash->{mem_region_size};
$mmin = ($mmin + $memsize) / $memsize;
$mcur = ($mcur + $memsize) / $memsize;
$mmax = ($mmax + $memsize) / $memsize;
$mmin = int(($mmin + $memsize - 1) / $memsize);
$mcur = int(($mcur + $memsize - 1) / $memsize);
$mmax = int(($mmax + $memsize - 1) / $memsize);
$tmp_ent->{memory} = "$mmin/$mcur/$mmax";
$tmp_ent->{mem_region_size} = $memsize;
} else {
@@ -2178,21 +2332,27 @@ sub mkspeclpar {
$tmp_ent->{storage} = \@array;
}
} else {
if (exists($tmp_ent->{storage}) and $tmp_ent->{storage} !~ /^[\w_-]*:\d+$/) {
return ([[$name, "Parameter for 'vmstorage' is invalid", 1]]);
} elsif (exists($tmp_ent->{storage})) {
if ($tmp_ent->{storage} =~ /([\w_-]*):(\d+)/) {
my $vios = &find_lpar_id($request, @$d[3], $1);
my $r_slotid = $2;
if (!defined($vios)) {
return ([[$name, "Cannot find lparid for Server lpar:$1"]]);
if (exists($tmp_ent->{storage})) {
my @tmp_array = split ",",$tmp_ent->{storage};
my $storage_array = undef;
foreach (@tmp_array) {
if (/([\w_-]*):(\d+)/) {
my $vios = &find_lpar_id($request, @$d[3], $1);
my $r_slotid = $2;
if (defined($vios)) {
push @$storage_array, "0,$vios,$r_slotid";
} else {
return ([[$name, "Cannot find lparid for Server lpar:$1"]]);
}
} else {
return ([[$name, "Parameter for 'vmstorage' is invalid", 1]]);
}
$tmp_ent->{storage} = ["0,$vios,$r_slotid"];
}
$tmp_ent->{storage} = $storage_array;
}
}
$tmp_ent->{hyp_config_mem} = $memhash->{hyp_config_mem};
$tmp_ent->{hyp_avail_mem} = $memhash->{hyp_avail_mem};
if (exists($tmp_ent->{othersettings})) {
@@ -2213,10 +2373,18 @@ sub mkspeclpar {
$tmp_ent->{logic_drc_phydrc} = $memhash->{logic_drc_phydrc};
$values = &create_lpar($request, $name, $d, $tmp_ent);
push @result, $values;
#need to add update db here
my $rethash = query_cec_info_actions($request, $name, $d, 1, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_vio_info","part_get_all_io_bus_info","get_huge_page","get_cec_bsr"]);
$lpar_hash{$name} = $rethash;
$lpar_hash{$name}->{parent} = @$d[3];
$name = undef;
$d = undef;
}
}
if (%lpar_hash) {
update_vm_db($request, \%lpar_hash);
}
return \@result;
}
+1 -1
View File
@@ -1023,7 +1023,7 @@ sub dolitesetup
$nrange = join(',',@nodel);
}
my @flist = xCAT::Utils->runcmd("/opt/xcat/bin/litefile $nrange", -1);
@flist = xCAT::Utils->runcmd("/opt/xcat/bin/litefile $nrange", -1);
if (scalar(@flist) > 0) {
foreach my $l (@flist) {
my ($j1, $j2, $file) = split /\s+/, $l;
+128 -9
View File
@@ -19,6 +19,7 @@ use File::Path;
use Math::BigInt;
use Socket;
use xCAT::GlobalDef;
use Data::Dumper;
use strict;
use warnings "all";
my $socket6support = eval { require Socket6 };
@@ -696,19 +697,26 @@ sub get_nic_ip
# Base address:0x2600 Memory:fbfe0000-fc0000080
#
# eth1 ...
# Redhat7
#eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
# inet 10.1.0.178 netmask 255.255.0.0 broadcast 10.1.255.255
#
##############################################################
my @adapter= split /\n{2,}/, $result;
foreach ( @adapter ) {
if ( !($_ =~ /LOOPBACK / ) and
$_ =~ /UP / and
$_ =~ /$mode / ) {
if ( !($_ =~ /LOOPBACK/ ) and
$_ =~ /UP( |,|>)/ and
$_ =~ /$mode/ ) {
my @ip = split /\n/;
for my $ent ( @ip ) {
if ($ent =~ /^(eth\d|ib\d|hf\d)\s+/) {
$nic = $1;
}
if ( $ent =~ /^\s*inet addr:\s*(\d+\.\d+\.\d+\.\d+)/ ) {
}
if ($ent =~ /^(eth\d:|ib\d:|hf\d:)\s+/) {
$nic = $1;
}
$ent=~ s/addr://; # works for Redhat7 also
if ( $ent =~ /^\s*inet \s*(\d+\.\d+\.\d+\.\d+)/ ) {
$iphash{$nic} = $1;
next;
}
@@ -1620,8 +1628,10 @@ sub gethost_ips
else
{
my ($inet, $addr1, $Bcast, $Mask) = split(" ", $addr);
@ip = split(":", $addr1);
push @ipaddress, $ip[1];
#@ip = split(":", $addr1);
#push @ipaddress, $ip[1];
$addr1 =~ s/.*://;
push @ipaddress, $addr1;
}
}
else
@@ -1981,6 +1991,108 @@ sub isIpaddr
}
}
#-------------------------------------------------------------------------------
=head3 getSubnetGateway
Description:
Get gateway from the networks table of the specified net.
Arguments:
net: the net, ie. the "net" field of the networks table
Returns:
Return a string, of the gateway
undef - Failed to get the gateway
Globals:
none
Error:
none
Example:
my $gateway = xCAT::NetworkUtils::getSubnetGateway('192.168.1.0');
Comments:
none
=cut
#-------------------------------------------------------------------------------
sub getSubnetGateway
{
my $netname=shift;
if( $netname =~ /xCAT::NetworkUtils/)
{
$netname=shift;
}
my $gateway=undef;
my $nettab = xCAT::Table->new("networks");
unless($nettab) { die "No entry defined in networks"; }
my @nets = $nettab->getAllAttribs('net','gateway');
foreach(@nets)
{
if("$_->{net}" eq "$netname")
{
$gateway = $_->{gateway};
last;
}
}
return $gateway;
}
#-------------------------------------------------------------------------------
=head3 getNodeNameservers
Description:
Get nameservers of specified nodes.
The priority: noderes.nameservers > networks.nameservers > site.nameservers
Arguments:
node: node name list
Returns:
Return a hash ref, of the $nameservers{$node}
undef - Failed to get the nameservers
Globals:
none
Error:
none
Example:
my $nameservers = xCAT::NetworkUtils::getNodeNameservers(\@node);
Comments:
none
=cut
#-------------------------------------------------------------------------------
sub getNodeNameservers{
my $nodes=shift;
if( $nodes =~ /xCAT::NetworkUtils/)
{
$nodes=shift;
}
my @nodelist = @$nodes;
my %nodenameservers;
my $nrtab = xCAT::Table->new('noderes',-create=>0);
my %nrhash = %{$nrtab->getNodesAttribs(\@nodelist,['nameservers'])};
my $nettab = xCAT::Table->new("networks");
my %nethash = xCAT::DBobjUtils->getNetwkInfo( \@nodelist );
my @nameservers = xCAT::TableUtils->get_site_attribute("nameservers");
my $sitenameservers=$nameservers[0];
foreach my $node (@nodelist){
if ($nrhash{$node} and $nrhash{$node}->[0] and $nrhash{$node}->[0]->{nameservers})
{
$nodenameservers{$node}=$nrhash{$node}->[0]->{nameservers};
}elsif($nethash{$node}{nameservers})
{
$nodenameservers{$node}=$nethash{$node}{nameservers};
}elsif($sitenameservers)
{
$nodenameservers{$node}=$sitenameservers;
}
}
return \%nodenameservers;
}
#-------------------------------------------------------------------------------
=head3 getNodeNetworkCfg
@@ -2007,17 +2119,23 @@ sub isIpaddr
sub getNodeNetworkCfg
{
my $node = shift;
if( $node =~ /xCAT::NetworkUtils/)
{
$node =shift;
}
my $nets = xCAT::NetworkUtils::my_nets();
my $ip = xCAT::NetworkUtils->getipaddr($node);
my $mask = undef;
my $gateway = undef;
for my $net (keys %$nets)
{
my $netname;
($netname,$mask) = split /\//, $net;
$gateway=xCAT::NetworkUtils::getSubnetGateway($netname);
last if ( xCAT::NetworkUtils::isInSameSubnet( $netname, $ip, $mask, 1));
}
return ($ip, $node, undef, xCAT::NetworkUtils::formatNetmask($mask,1,0));
return ($ip, $node, $gateway, xCAT::NetworkUtils::formatNetmask($mask,1,0));
}
#-------------------------------------------------------------------------------
@@ -2195,6 +2313,7 @@ sub isValidHostname
return 0;
}
#-------------------------------------------------------------------------------
=head3 isValidFQDN
+1 -1
View File
@@ -156,7 +156,7 @@ sub connect {
# Shell prompt regexp based on HW Type
##################################################
my %prompt = (
hmc => "~> \$",
hmc => "~>\\s*\$",
ivm => "\\\$ \$"
);
##################################################
+28 -2
View File
@@ -604,7 +604,7 @@ noderes => {
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).',
@@ -921,6 +921,11 @@ site => {
" '0' value means include all the nodes in the subnet.\n\n".
" pruneservices: Whether to enable service pruning when noderm is run (i.e.\n".
" removing DHCP entries when noderm is executed)\n\n".
" managedaddressmode: The mode of networking configuration during node provision.\n".
" If set to 'static', the network configuration will be configured \n".
" in static mode based on the node and network definition on MN.\n".
" If set to 'dhcp', the network will be configured with dhcp protocol.\n".
" The default is 'dhcp'.\n\n".
" ------------\n".
"DNS ATTRIBUTES\n".
" ------------\n".
@@ -941,6 +946,12 @@ site => {
" \"<xcatmaster>\" to mean the DNS server for each node should be the\n".
" node that is managing it (either its service node or the management\n".
" node).\n\n".
" externaldns: To specify that external dns is used. If externaldns is set to any value\n".
" then, makedns command will not start the local nameserver on xCAT MN. \n".
" Default is to start the local nameserver.\n\n".
" dnsupdaters: The value are \',\' separated string which will be added to the zone config\n".
" section. This is an interface for user to add configuration entries to\n".
" the zone sections in named.conf.\n\n".
" -------------------------\n".
"HARDWARE CONTROL ATTRIBUTES\n".
" -------------------------\n".
@@ -1096,6 +1107,10 @@ site => {
" will not interfere.\n\n".
" vmwarereconfigonpower: When set to no, the VMWare plugin will make no effort to\n".
" push vm.cpus/vm.memory updates from xCAT to VMWare.\n\n".
" persistkvmguests: Keep the kvm definition on the kvm hypervisor when you power off\n".
" the kvm guest node. This is useful for you to manually change the \n".
" kvm xml definition file in virsh for debugging. Set anything means\n".
" enable.\n\n".
" --------------------\n".
"XCAT DAEMON ATTRIBUTES\n".
" --------------------\n".
@@ -1568,7 +1583,18 @@ hwinv => {
disable => "Set to 'yes' or '1' to comment out this row.",
},
},
token => {
cols => [qw(tokenid username expire comments disable)],
keys => [qw(tokenid)],
table_desc => 'The token of users for authentication.',
descriptions => {
tokenid => 'It is a UUID as an unified identify for the user.',
username => 'The user name.',
expire => 'The expire time for this token.',
comments => 'Any user-provided notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
},
},
); # end of tabspec definition
Regular → Executable
+4 -3
View File
@@ -429,7 +429,6 @@ rmdir \"/tmp/$to_userid\" \n";
# Need to check if nodes are in a zone.
my @zones;
my $tab = xCAT::Table->new("zone");
my @zones;
if ($tab)
{
# if we have zones, need to send the zone keys to each node in the zone
@@ -623,7 +622,7 @@ sub sendkeysTOzones
my ($class, $ref_nodes,$expecttimeout) = @_;
my @nodes=$ref_nodes;
my $n_str = $nodes[0];
my @nodes= split(",", $n_str);
@nodes= split(",", $n_str);
my $rsp = ();
my $cmd;
my $roothome = xCAT::Utils->getHomeDir("root");
@@ -1178,7 +1177,9 @@ sub getAppStatus
my ($class, $nodes_ref, $application) = @_;
my @nodes = @$nodes_ref;
my $nltab = xCAT::Table->new('nodelist');
# FIXME: why autocommit matters for a read-only subroutine getNodesAttribs?
# but could not get the appstatus without the autocommit=0
my $nltab = xCAT::Table->new('nodelist', -autocommit => 0);
my $nodeappstat = $nltab->getNodesAttribs(\@nodes,['appstatus']);
my $ret_nodeappstat;
+1 -1
View File
@@ -222,7 +222,7 @@ my %usage = (
lsvm <noderange> [-a|--all]
PPC (using Direct FSP Management) specific:
lsvm <noderange> [-l|--long] --p775
lsvm <noderange>
lsvm <noderange>
zVM specific:
lsvm noderange
lsvm noderange --getnetworknames
+56
View File
@@ -3487,4 +3487,60 @@ sub fullpathbin
return $fullpath;
}
#--------------------------------------------------------------------------------
=head3 gettimezone
returns the name of the timezone defined on the Linux distro.
This routine was written to replace the use of /etc/sysconfig/clock which in no
longer supported on future Linux releases such as RHEL7. It is suppose to be a routine
that can find the timezone on any Linux OS or AIX.
Arguments:
none
Returns:
Name of timezone, for example US/Eastern
Globals:
none
Error:
None
Example:
my $timezone = xCAT::Utils->gettimezone();
Comments:
none
=cut
#--------------------------------------------------------------------------------
sub gettimezone
{
my ($class) = @_;
my $tz;
if (xCAT::Utils->isAIX()) {
$tz= $ENV{'TZ'};
} else { # all linux
my $localtime = "/etc/localtime";
my $zoneinfo = "/usr/share/zoneinfo";
my $cmd = "find $zoneinfo -type f -exec cmp -s $localtime {} \\; -print | grep -v posix | grep -v SystemV";
my $zone_result = xCAT::Utils->runcmd("$cmd", 0);
if ($::RUNCMD_RC != 0)
{
$tz="Could not determine timezone checksum";
return $tz;
}
my @zones = split /\n/, $zone_result;
$zones[0] =~ s/$zoneinfo\///;
if (!$zones[0]) { # if we still did not get one, then default
$tz = `cat /etc/timezone`;
chomp $tz;
} else {
$tz=$zones[0];
}
}
return $tz;
}
1;
+7 -3
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",
@@ -69,6 +71,7 @@ require Exporter;
"1321545261.599847" => "rhelhpc6.2",#x86_64
"1339640148.070971" => "rhelhpc6.3",#x86_64
"1359576195.413831" => "rhelhpc6.4",#x86_64, RHEL ComputeNode
"1384196516.465862" => "rhelhpc6.5",#x86_64, RHEL ComputeNode
"1194015916.783841" => "fedora8",
"1194015385.299901" => "fedora8",
"1210112435.291709" => "fedora9",
@@ -89,6 +92,7 @@ require Exporter;
"1273608367.051780" => "SL5.5", #x86_64 DVD ISO
"1299104542.844706" => "SL6", #x86_64 DVD ISO
"1394111947.452332" => "pkvm2.1", # ppc64
);
my %numdiscs = (
"1156364963.862322" => 4,
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -2393,7 +2393,7 @@ sub getFreeRepoSpace {
if ($master eq $ip) {
# If the master IP and node IP match, then it is the management node
my $out = `$sudo /bin/df -h /install | sed 1d`;
$out =~ s/\h+/ /g;
# causing problems on other platforms $out =~ s/\h+/ /g;$out =~ s/\h+/ /g;
my @results = split(' ', $out);
return ($results[3]);
}
@@ -41,8 +41,8 @@ if [ $OS != "AIX" ]; then
mkdir -p /tmp/gpfs_updates
rm -f -R /tmp/gpfs_updates/*
cd /tmp/gpfs_updates
# wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=3 ftp://$SITEMASTER/$UPDATES_DIR/*.rpm 2> /tmp/wget.log
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=4 --reject "index.html*" --no-parent http://$SITEMASTER$INSTALL_DIR/$UPDATES_DIR/ 2> /tmp/wget.log
# wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=3 ftp://$MASTER/$UPDATES_DIR/*.rpm 2> /tmp/wget.log
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=4 --reject "index.html*" --no-parent http://$MASTER$INSTALL_DIR/$UPDATES_DIR/ 2> /tmp/wget.log
if [ -n "`ls *.rpm 2> /dev/null`" ] ; then
rpm -Uvh *.rpm
fi
@@ -67,11 +67,13 @@ sub opsaddbmnode {
my $help;
my $version;
my $verbose;
my $host;
if(!GetOptions(
'h|help' => \$help,
'v|version' => \$version,
'V|verbose' => \$verbose,
's=s' => \$host,
))
{
@@ -243,7 +245,18 @@ sub opsaddbmnode {
$disk = 1;
}
#print "$bmc, $bmc_user, $bmc_password, $mac, $cpu, $memory, $disk\n";
if ($verbose) {
my $rsp;
push @{$rsp->{data}}, "Attributes gathered from the xCAT database:";
push @{$rsp->{data}}, " bmc=$bmc";
push @{$rsp->{data}}, " bmc_user=$bmc_user";
push @{$rsp->{data}}, " bmc_password=$bmc_password";
push @{$rsp->{data}}, " mac=$mac";
push @{$rsp->{data}}, " cpu=$cpu";
push @{$rsp->{data}}, " memory=$memory";
push @{$rsp->{data}}, " disk=$disk";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
#call OpenStack command to add the node into the OpenStack as
#a baremetal node.
@@ -263,7 +276,14 @@ sub opsaddbmnode {
}
$cmd_tmp .= " $host $cpu $memory $disk $mac";
my $cmd = qq~source \~/openrc;$cmd_tmp~;
my $cmd = qq~$cmd_tmp~;
if ($verbose) {
my $rsp;
push @{$rsp->{data}}, "The command to run on $host:";
push @{$rsp->{data}}, " $cmd";
push @{$rsp->{data}}, " ";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
#print "cmd=$cmd\n";
my $output =
xCAT::InstUtils->xcmd($callback, $doreq, "xdsh", [$host], $cmd, 0);
@@ -271,8 +291,17 @@ sub opsaddbmnode {
my $rsp;
push @{$rsp->{data}}, "OpenStack creating baremetal node $node:";
push @{$rsp->{data}}, "$output";
push @{$rsp->{data}}, "The command was: $cmd";
xCAT::MsgUtils->message("E", $rsp, $callback);
} else {
if (($verbose) && ($output)) {
my $rsp;
push @{$rsp->{data}}, "$output";
push @{$rsp->{data}}, " ";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
}
@@ -296,6 +325,7 @@ sub opsaddimage {
my $help;
my $version;
my $verbose;
#my $cloud;
my $ops_img_names;
my $controller;
@@ -303,6 +333,7 @@ sub opsaddimage {
if(!GetOptions(
'h|help' => \$help,
'v|version' => \$version,
'V|verbose' => \$verbose,
'c=s' => \$controller,
'n=s' => \$ops_img_names,
))
@@ -391,16 +422,46 @@ sub opsaddimage {
}
my $cmd_tmp = "glance image-create --name $new_name --public --disk-format qcow2 --container-format bare --property xcat_image_name=\'$image\' < /tmp/$image.qcow2";
my $cmd = qq~touch /tmp/$image.qcow2;source \~/openrc;$cmd_tmp;rm /tmp/$image.qcow2~;
#print "cmd=$cmd\ncontroller=$controller\n";
my $cmd = qq~touch /tmp/$image.qcow2;$cmd_tmp~;
if ($verbose) {
my $rsp;
push @{$rsp->{data}}, "The command to run on $controller:";
push @{$rsp->{data}}, " $cmd";
push @{$rsp->{data}}, " ";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
my $output =
xCAT::InstUtils->xcmd($callback, $doreq, "xdsh", [$controller], $cmd, 0);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "OpenStack creating image $new_name:";
push @{$rsp->{data}}, "$output";
push @{$rsp->{data}}, "The command was: $cmd";
xCAT::MsgUtils->message("E", $rsp, $callback);
} else {
if (($verbose) && ($output)) {
my $rsp;
push @{$rsp->{data}}, "$output";
push @{$rsp->{data}}, " ";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
my $cmd1 = qq~rm /tmp/$image.qcow2~;
if ($verbose) {
my $rsp;
push @{$rsp->{data}}, "The command to run on $controller:";
push @{$rsp->{data}}, " $cmd1";
push @{$rsp->{data}}, " ";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
my $output1 =
xCAT::InstUtils->xcmd($callback, $doreq, "xdsh", [$controller], $cmd1, 0);
if (($verbose) && ($output1)) {
my $rsp;
push @{$rsp->{data}}, "$output1";
push @{$rsp->{data}}, " ";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
@@ -497,8 +558,40 @@ sub deploy_ops_bm_node {
return 1;
}
#set boot order, assuming it is ipmi nodes for now
# TODO: add support for system power hw.
#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"],
@@ -525,7 +618,62 @@ sub deploy_ops_bm_node {
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;
}
}
@@ -758,7 +906,7 @@ sub opsaddbmnode_usage {
$rsp->{data}->[0]= "Usage: opsaddbmnode -h";
$rsp->{data}->[1]= " opsaddbmnode -v";
$rsp->{data}->[2]= " opsaddbmnode <noderange> -s <service_host>";
$rsp->{data}->[2]= " opsaddbmnode <noderange> -s <service_host> [-V]";
$cb->($rsp);
}
@@ -776,7 +924,7 @@ sub opsaddimage_usage {
$rsp->{data}->[0]= "Usage: opsaddimage -h";
$rsp->{data}->[1]= " opsaddimage -v";
$rsp->{data}->[2]= " opsaddimage <image1,image2...> [-n <new_name1,new_name2...> -c <controller>";
$rsp->{data}->[2]= " opsaddimage <image1,image2...> [-n <new_name1,new_name2...> -c <controller> [-V]";
$cb->($rsp);
}
@@ -168,7 +168,7 @@ class xCATBareMetalDriver(bm_driver.BareMetalDriver):
"""
#import pdb
#pdb.set_trace()
context = nova_context.get_admin_context()
context = nova_context.get_admin_context()
try:
node = bm_driver._get_baremetal_node_by_instance_uuid(instance['uuid'])
@@ -4,7 +4,7 @@ B<opsaddbmnode> - It adds xCAT baremetal nodes to an OpenStack cloud.
=head1 SYNOPSIS
B<opsaddbmnode> I<noderange> B<-s> I<service_host>
B<opsaddbmnode> I<noderange> B<-s> I<service_host> [B<-V>|B<--verbose>]
B<opsaddbmnode> [B<-h>|B<--help>]
@@ -59,6 +59,8 @@ I<noderage> is a comma separated node or node group names.
=item B<-v|--version> The Command Version.
=item B<-V|--verbose> Verbose output.
=back
=head1 RETURN VALUE
@@ -4,7 +4,7 @@ B<opsaddimage> - It adds or removes nodes for the vlan.
=head1 SYNOPSIS
B<opsaddimage> I<image1,image2,...> B<-n> I<new_name1,new_name2,...> [B<-c> I<controller>]
B<opsaddimage> I<image1,image2,...> B<-n> I<new_name1,new_name2,...> [B<-c> I<controller>] [B<-V>|B<--verbose>]
B<opsaddimage> [B<-h>|B<--help>]
@@ -35,6 +35,8 @@ I<image1,image1...> a comma separated xCAT images names.
=item B<-v|--version> The Command Version.
=item B<-V|--verbose> Verbose output.
=back
=head1 RETURN VALUE
+2 -1
View File
@@ -21,7 +21,7 @@ my @pods = getPodList($poddir);
#foreach (@pods) { print "$_\n"; } exit;
# Build the cmd overview page.
writesummarypage("$poddir/man1/xcat.1.pod", @pods);
#writesummarypage("$poddir/man1/xcat.1.pod", @pods);
# Build the man page for each pod.
#mkdir($mandir) or die "Error: could not create $mandir.\n";
@@ -126,6 +126,7 @@ sub getPodList {
# 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
+13 -4
View File
@@ -38,8 +38,6 @@ if (scalar(@ARGV)>1) { $usage->(1); }
my $hnmatch = $ARGV[0]; # if they specified a hostname match, only show svrs that start with that
readconf("$ENV{HOME}/.slconfig"); # get the userid and api key from the config file
#my $api_username = 'SL276540';
#my $api_key = '799d5d9267a927a330ec016f00bfe17e6fc532d203cf68b3b0d997b2d27a3ce1';
my $slinstalled = eval { push @INC, $CONFIG{apidir}; require SoftLayer::API::SOAP; };
if (!$slinstalled) { die "Error: the SoftLayer::API::SOAP perl module is not installed. Download it using 'git clone https://github.com/softlayer/softlayer-api-perl-client' and put the directory in ~/.slconfig ."; }
@@ -64,12 +62,23 @@ foreach my $server (@$servers) {
print "\tbmc=".$server->{remoteManagementComponent}->{ipmiIpAddress}."\n";
print "\tbmcusername=".$server->{remoteManagementAccounts}->[0]->{username}."\n";
print "\tbmcpassword=".$server->{remoteManagementAccounts}->[0]->{password}."\n";
print "\tmac=".$server->{backendNetworkComponents}->[0]->{macAddress}."\n";
print "\tip=".$server->{privateIpAddress}."\n";
# find the 1st active private nic that is not the bmc
foreach my $nic (@{$server->{backendNetworkComponents}}) {
#print "nic:\n"; foreach my $key (keys(%$nic)) { print " $key = ", $nic->{$key}, "\n"; }
if ($nic->{status} eq 'ACTIVE' && $nic->{name} eq 'eth' && $nic->{macAddress} && $nic->{primaryIpAddress}) {
# found it
print "\tmac=".$nic->{macAddress}."\n";
print "\tip=".$nic->{primaryIpAddress}."\n";
}
}
#print "\tip=".$server->{privateIpAddress}."\n"; # getting this from the backendNetworkComponents instead
print "\tserial=".$server->{manufacturerSerialNumber}."\n";
print "\tnetboot=xnba\n";
print "\tarch=x86_64\n";
print "\tusercomment=hostname:".$server->{fullyQualifiedDomainName}.", user:".$server->{operatingSystem}->{passwords}->[0]->{username}.", pw:".$server->{operatingSystem}->{passwords}->[0]->{password}."\n";
verbose('SoftLayer API bare metal server entry: ' . Dumper($server));
#print Dumper($server->{remoteManagementAccounts});
#print "#Softlayer_account_info_for ".$server->{fullyQualifiedDomainName} . " Username: ";
#print $server->{operatingSystem}->{passwords}->[0]->{username} . " Password: ";
+57 -15
View File
@@ -13,11 +13,12 @@ use Socket;
my $HELP;
my $VERBOSE;
my $WAITTIME;
my $PROVMETHOD;
my $XCATNETBOOTTITLE = 'xCAT network boot kernel and initrd';
my $usage = sub {
my $exitcode = shift @_;
print "Usage: modifygrub [-?|-h|--help] [-v|--verbose] [-w <waittime>] <kernel-path> <initrd-path> <kernel-parms> <mn-ip>\n\n";
print "Usage: modifygrub [-?|-h|--help] [-v|--verbose] [-w <waittime>] [-p <provmethod] <kernel-path> <initrd-path> <kernel-parms> <mn-ip>\n\n";
if (!$exitcode) {
print "Modify the grub config file on the node to boot the specified kernel and initrd.\n";
}
@@ -30,7 +31,7 @@ if (-f '/etc/os-release') { die "This script doesn't support ubuntu yet.\n"; }
Getopt::Long::Configure("bundling");
#Getopt::Long::Configure("pass_through");
Getopt::Long::Configure("no_pass_through");
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'w|waittime=s' => \$WAITTIME)) { $usage->(1); }
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'w|waittime=s' => \$WAITTIME, 'p|provmethod=s' => \$PROVMETHOD)) { $usage->(1); }
if ($HELP) { $usage->(0); }
if (scalar(@ARGV) != 4) { $usage->(1); }
@@ -60,13 +61,29 @@ sub addKernelParms {
$args->{kernelparms} =~ s/<nodename>/$nodename/g;
# get node ip and add it to the kernel parms
my ($nic, $ip, $netmask, $gateway) = getNodeIpInfo($args);
my ($nic, $ip, $netmask, $network, $broadcast, $gateway, $mac) = getNodeIpInfo($args);
if (!$ip) { die "Error: could not find the NIC that would connect to the xCAT mgmt node's IP (".$args->{mnip}.").\n"; }
$args->{kernelparms} .= " hostip=$ip netmask=$netmask gateway=$gateway dns=$mnip hostname=$nodename netdevice=$nic netwait=$WAITTIME textmode=1";
# if we are booting genesis, need to add the BOOTIF parm
my $bootif;
if ($args->{kernelpath} =~ m/genesis\.kernel\.x86_64/) {
$bootif = $mac;
$bootif =~ s/:/-/g;
$bootif = "BOOTIF=01-$bootif";
}
if (defined($PROVMETHOD) && $PROVMETHOD eq 'sysclone') {
# add additional parms for sysclone
# DEVICE=eth0 IPADDR=10.0.0.99 NETMASK=255.255.255.0 NETWORK=10.0.0.0 BROADCAST=10.0.0.255 GATEWAY=10.0.0.1 GATEWAYDEV=eth0
#todo: should we also add ETHER_SLEEP=$WAITTIME textmode=1 dns=$mnip ?
$args->{kernelparms} .= " $bootif IPADDR=$ip NETMASK=$netmask NETWORK=$network BROADCAST=$broadcast GATEWAY=$gateway HOSTNAME=$nodename DEVICE=$nic GATEWAYDEV=$nic";
}
else { # scripted install or genesis shell
$args->{kernelparms} .= " $bootif hostip=$ip netmask=$netmask gateway=$gateway dns=$mnip hostname=$nodename netdevice=$nic netwait=$WAITTIME textmode=1";
}
}
# get this nodes nic, ip, netmask, and gateway. Returns them in a 4 element array.
# get this nodes nic, ip, netmask, gateway, and mac. Returns them in a 5 element array.
sub getNodeIpInfo {
my $args = shift @_;
my ($ipprefix) = $args->{mnip}=~m/^(\d+\.\d+)\./; #todo: this is a hack, just using the 1st 2 octets of the mn ip addr
@@ -74,13 +91,14 @@ sub getNodeIpInfo {
# parse ip addr show output, looking for ipprefix, to determine nic and ip
my @output = runcmd("ip addr show");
my ($nic, $ipandmask);
my ($nic, $mac, $ipandmask);
foreach my $line (@output) {
my ($nictmp, $iptmp);
my ($nictmp, $mactmp, $iptmp);
if (($nictmp) = $line=~m/^\d+:\s+(\S+): /) { $nic = $nictmp; } # new stanza, remember it
if (($mactmp) = $line=~m|^\s+link/ether\s+(\S+) |) { $mac = $mactmp; } # got mac, remember it
if (($iptmp) = $line=~m/^\s+inet\s+($ipprefix\S+) /) { $ipandmask = $iptmp; last; } # got ip, we are done
}
my ($ip, $netmask) = convertIpAndMask($ipandmask);
my ($ip, $netmask, $network, $broadcast) = convertIpAndMask($ipandmask);
# if the nic is a bonded nic (common on sl), then find the 1st real nic that is part of it
my $realnic = $nic;
@@ -88,6 +106,12 @@ sub getNodeIpInfo {
my @nics = grep(m/\s+master\s+$nic\s+/, @output);
if (!scalar(@nics)) { die "Error: can't find the NICs that are part of $nic.\n"; }
($realnic) = $nics[0]=~m/^\d+:\s+(\S+): /;
# go back thru the ip add show output and find the mac of this nic
foreach my $line (@output) {
my ($nictmp, $mactmp, $foundnic);
if (($nictmp) = $line=~m/^\d+:\s+(\S+): / && $nictmp eq $realnic) { $foundnic = 1; }
if (($mactmp) = $line=~m|^\s+link/ether\s+(\S+) | && $foundnic) { $mac = $mactmp; last; } # got mac, we are done
}
}
# finally, find the gateway
@@ -102,19 +126,37 @@ sub getNodeIpInfo {
verbose("using xCAT mgmt node IP as the fall back gateway.");
}
verbose("IP info: realnic=$realnic, ip=$ip, netmask=$netmask, gateway=$gateway");
return ($realnic, $ip, $netmask, $gateway);
verbose("IP info: realnic=$realnic, ip=$ip, netmask=$netmask, gateway=$gateway, mac=$mac");
return ($realnic, $ip, $netmask, $network, $broadcast, $gateway, $mac);
}
# Convert an ip/mask in slash notation (like 10.0.0.1/26) to separate ip and netmask like 10.0.0.1 and 255.255.255.192
# Convert an ip/mask in slash notation (like 10.1.1.1/26) to separate ip, netmask, network, and broadcast values,
# like: 10.1.1.1, 255.255.255.192, 10.1.1.0, 10.1.1.63
sub convertIpAndMask {
my $ipandmask = shift @_;
my ($ip, $masknum) = split('/', $ipandmask);
my $netbin = oct("0b" . '1' x $masknum . '0' x (32-$masknum)); # create a str like '1111100', then convert to binary
my @netarr=unpack('C4',pack('N',$netbin)); # separate into the 4 octets
my $netmask=join('.',@netarr); # put them together into the normal looking netmask
return ($ip, $netmask);
# build the netmask
my $nmbin = oct("0b" . '1' x $masknum . '0' x (32-$masknum)); # create a str like '1111100', then convert to binary
my @nmarr=unpack('C4',pack('N',$nmbin)); # separate into the 4 octets
my $netmask=join('.',@nmarr); # put them together into the normal looking netmask
# create binary form of ip
my @iparr=split(/\./,$ip);
my ( $ipbin ) = unpack('N', pack('C4',@iparr ) );
# Calculate network address by logical AND operation of ip & netmask and convert network address to IP address format
my $netbin = ( $ipbin & $nmbin );
my @netarr=unpack('C4', pack('N',$netbin ) );
my $network=join(".",@netarr);
# Calculate broadcast address by inverting the netmask and adding it to the network address
my $bcbin = ( $ipbin & $nmbin ) + ( ~ $nmbin );
my @bcarr=unpack('C4', pack('N',$bcbin ) ) ;
my $broadcast=join(".",@bcarr);
return ($ip, $netmask, $network, $broadcast);
}
+68 -12
View File
@@ -45,7 +45,9 @@ copyFilesToNodes($noderange, \%bootparms);
updateGrubOnNodes($noderange, \%bootparms);
if (!$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
if ($bootparms{osimageprovmethod} eq 'install' && !$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
if ($bootparms{osimageprovmethod} eq 'sysclone') { copySyscloneFiles(); }
exit(0);
@@ -54,23 +56,28 @@ exit(0);
sub getBootParms {
my $nr = shift @_;
my %bootparms;
my @output = runcmd("nodels $nr bootparams.kernel bootparams.initrd bootparams.kcmdline");
my @output = runcmd("nodels $nr bootparams.kernel bootparams.initrd bootparams.kcmdline nodetype.provmethod");
# the attributes can be displayed in a different order than requested, so need to grep for them
my @gresults;
foreach my $a (qw(kernel initrd kcmdline)) {
my $attr = "bootparams.$a";
@gresults = grep(/^\S+:\s+$attr:/, @output);
foreach my $attr (qw(bootparams.kernel bootparams.initrd bootparams.kcmdline nodetype.provmethod)) {
my ($a) = $attr =~ m/\.(.*)$/;
my @gresults = grep(/^\S+:\s+$attr:/, @output);
if (!scalar(@gresults)) { die "Error: attribute $attr not defined for the noderange. Did you run 'nodeset <noderange> osimage=<osimage>' ?\n"; }
# for now just pick the 1st one. They should all be the same, except for the node name in kcmdline
chomp($gresults[0]);
$gresults[0] =~ s/^\S+:\s+$attr:\s*//;
$bootparms{$a} = $gresults[0];
if ($a eq 'kcmdline') { $bootparms{$a} =~ s|/install/autoinst/\S+|/install/autoinst/<nodename>|; }
}
$bootparms{kcmdline} =~ s|/install/autoinst/\S+|/install/autoinst/<nodename>|;
# from the nodes provmethod, get the osimage provmethod, so we know the type of install
@output = runcmd("lsdef -t osimage $bootparms{provmethod} -ci provmethod");
chomp($output[0]);
my ($junk, $provmethod) = split(/=/, $output[0]);
$bootparms{osimageprovmethod} = $provmethod;
# get the mgmt node cluster-facing ip addr
@output = runcmd('lsdef -t site -i master -c');
@output = runcmd('lsdef -t site -ci master');
chomp($output[0]);
my ($junk, $ip) = split(/=/, $output[0]);
$bootparms{mnip} = $ip;
@@ -99,7 +106,7 @@ sub copyFilesToNodes {
# Form the remote file name, using the last 2 parts of the path, separated by "-"
sub remoteFilename {
my $f = shift @_;
$f =~ s|^.*/([^/]+)/([^/]+)$|$1-$2|;
$f =~ s|^.*?([^/]+)/([^/]+)$|$1-$2|;
return $f;
}
@@ -113,7 +120,7 @@ sub updateGrubOnNodes {
my @output = runcmd('which modifygrub');
my $modifygrub = $output[0];
chomp($modifygrub);
my $cmd = "xdsh $nr -e $modifygrub $vtxt -w $WAITTIME " . remoteFilename($bootparms->{kernel}) . ' ' . remoteFilename($bootparms->{initrd}) . ' ';
my $cmd = "xdsh $nr -e $modifygrub $vtxt -w $WAITTIME -p " . $bootparms->{osimageprovmethod} . ' ' . remoteFilename($bootparms->{kernel}) . ' ' . remoteFilename($bootparms->{initrd}) . ' ';
# we need to quote the kernel parms, both here when passing it to xdsh, and on the node
# when xdsh is passing it to modifygrub. The way to get single quotes inside single quotes
# is to quote each of the outer single quotes with double quotes.
@@ -138,15 +145,55 @@ sub modifyAutoinstFiles {
# Edit each file to have chroot.sles insert a wait at the end of /etc/init.d/network
# this finds the end of boot.sh script (which is chroot.sles)
my $search = '\n\]\]>\s*</source>\s*</script>\s*</chroot-scripts>';
# hack the /etc/init.d/network script to put a wait in it
my $file = '/mnt/etc/init.d/network'; # at this point in the installation, the permanent file system is just mounted
#my $waitstring = 'echo Sleeping for 55s;sleep 55';
# this is the string to insert in the nodes /etc/init.d/network script. It is a while loop pinging the mn, but some of the chars need to be escape for sed
my $waitstring = 'echo Waiting to reach xCAT mgmt node...;while \[ \$\(\(xcati+=1\)\) -le 60 \] \&\& ! ping -c2 -w3 ' . $bootparms->{mnip} .'; do echo i=\$xcati ; done; sleep 10';
# this is the string to insert in the nodes /etc/init.d/network script. It is a while loop pinging the mn, but some of the chars need to be escaped for sed
my $waitstring = 'echo -n Waiting to reach xCAT mgmt node ' . $bootparms->{mnip} . '.;xcatretries=60;while \[ \$\(\(xcati+=1\)\) -le \$xcatretries \] \&\& ! ping -c2 -w3 ' . $bootparms->{mnip} .' \>\/dev\/null 2\>\&1; do echo -n .; done; if \[ \$xcati -le \$xcatretries \]; then echo success; else echo failed; fi; sleep 3';
# this crazy sed string is from google. It gathers up the whole file into the hold buffer, and then the substitution is done on the whole file
my $sedstring = q|sed -n '1h;1!H;${;g;s/\(\t\treload_firewall\n\)\n/\1\t\t| . $waitstring . q(\n\n/g;p;}') . " $file > $file.new";
# finally create the perl replace string that will be used to modify the autoinst file
my $replace = "$sedstring\nchmod 755 $file.new; mv -f $file.new $file";
# Now instead we add a script that gets invoked by the OS after the nic is brought up
# these are specific to SLES
#my $netdir = '/etc/sysconfig/network';
#my $filename = '/etc/sysconfig/network/if-up.d/xcat-sl-wait';
#my $mnip = $bootparms->{mnip};
#todo: to support rhel, use these values instead
#my $netdir='/etc/sysconfig/network-scripts';
#my $filename='/sbin/ifup-local';
# this does not work, because midway thru the autoyast process, the if-up.d scripts do not seem to get invoked
# so autoyast fails to get he media
#my $replace = qq(
#FILENAME=$filename
#NETDIR=$netdir
#MNIP=$mnip
#);
# $replace .= q(
#cat >$FILENAME << EOF1
#MNIP=$MNIP
#NETDIR=$NETDIR
#EOF1
#
# this part of the file we do NOT want to expand the variables in the content
#cat >>$FILENAME << 'EOF2'
#NIC="$1"
# look in this ifcfg script to get the nics ip to see if this is the one we should be waiting on
#NICIP=`awk -F= '/^IPADDR/ {print $2}' $NETDIR/ifcfg-$NIC | tr -d \' `
#if [ "${NICIP%.*.*}" != "${MNIP%.*.*}" ]; then exit; fi # hack: compare the 1st 2 octets
#echo -n Waiting to reach xCAT mgmt node $MNIP.
#xcatretries=60
#while [ $((xcati+=1)) -le $xcatretries ] && ! ping -c2 -w3 $MNIP >/dev/null 2>&1; do echo -n .; done
#if [ $xcati -le $xcatretries ]; then echo " success"; else echo " failed"; fi
#sleep 3
#EOF2
#
#chmod +x $FILENAME
#);
# now actually update the file
print "Updating /install/autoinst files.\n";
foreach my $n (@nodes) {
@@ -157,6 +204,15 @@ sub modifyAutoinstFiles {
}
# Copy softlayer specific systemimager post-install scripts to the systemimager location.
# These cause si to use static ip and insert a wait into the bring up of the network.
sub copySyscloneFiles {
my $cmd = "cp -f /opt/xcat/share/xcat/sysclone/post-install/* /install/sysclone/scripts/post-install";
print "Copying SoftLayer-specific post scripts to the SystemImager post-install directory.\n";
runcmd($cmd);
}
# this is like multi-line sed replace function
# Args: filename, search-string, replace-string
sub sed {
+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash
# Add a script that will run when the network is brought up to wait until the
# xcat mn can be pinged.
. /tmp/post-install/variables.txt
if [ -d "/etc/sysconfig/network-scripts/" ];then
#redhat
NETDIR=/etc/sysconfig/network-scripts
filename=/sbin/ifup-local
elif [ -d "/etc/sysconfig/network/" ];then
#suse
NETDIR=/etc/sysconfig/network
filename=/etc/sysconfig/network/if-up.d/xcat-sl-wait
else
#ubuntu
echo "Does not support ubuntu."
exit 1
fi
# Create the wait script, overwriting a copy that may have come from the golden client
# (in case the mn/image server is different).
# this part of the file we want to expand the variables in the content
cat >$filename << EOF1
MNIP=$IMAGESERVER
NETDIR=$NETDIR
EOF1
# this part of the file we do NOT want to expand the variables in the content
cat >>$filename << 'EOF2'
NIC="$1"
# look in this ifcfg script to get the nics ip to see if this is the one we should be waiting on
NICIP=`awk -F= '/^IPADDR/ {print $2}' $NETDIR/ifcfg-$NIC | tr -d \' `
if [ "${NICIP%.*.*}" != "${MNIP%.*.*}" ]; then exit; fi # hack: compare the 1st 2 octets
echo -n Waiting to reach xCAT mgmt node $MNIP.
xcatretries=60
while [ $((xcati+=1)) -le $xcatretries ] && ! ping -c2 -w3 $MNIP >/dev/null 2>&1; do echo -n .; done
if [ $xcati -le $xcatretries ]; then echo " success"; else echo " failed"; fi
sleep 3
EOF2
chmod +x $filename
+101
View File
@@ -0,0 +1,101 @@
#!/bin/bash
# Configure network settings after SI has installed the OS
. /tmp/post-install/variables.txt
# determine if we should be using a static ip or dhcp
staticIP () {
# Eventually we should use the SI variable IP_ASSIGNMENT_METHOD below to determine this.
# But this requires a patch in both xcat/sysclone (to set si_getimage -ip-assignment method)
# and SI (to set IP_ASSIGNMENT_METHOD as a result of that). Until both of those patches
# are in the main releases, assume that if we have set the IPADDR kernel parm for the boot
# kernel to use static ip, that the final OS should use static ip too.
# Note: the IPADDR environment variable will be set by SI, even if it got it thru dhcp, so
# that is not a reliable way to decide.
str=`cat /proc/cmdline`
#str='netmask=255.255.255.192 IPADDR=10.54.51.11 GATEWAY=10.54.51.1 dns=10.54.51.2 hostname=sap64-4 DEVICE=eth0'
for parm in $str; do
key=`echo $parm|awk -F= '{print $1}'`
value=`echo $parm|awk -F= '{print $2}'`
if [[ $key == "IPADDR" || $key == "ipaddr" ]]; then
return 0 # yes, we should use static ip
fi
done
if [[ -n $IP_ASSIGNMENT_METHOD && ${IP_ASSIGNMENT_METHOD,,} == "static" ]]; then
return 0 # this means yes/true
fi
return 1
}
#delete the udev rule in the image
rule_file=`ls /etc/udev/rules.d/*net_persistent_names.rules 2>/dev/null`
if [ -n "$rule_file" ];then
rm -f $rule_file
fi
hostname $HOSTNAME
device_names=`ifconfig -a | grep -i hwaddr | grep -i 'Ethernet' | grep -v usb| awk '{print $1}'`
str_cfg_file=''
if [ -d "/etc/sysconfig/network-scripts/" ];then
#redhat
grep -i HOSTNAME /etc/sysconfig/network
if [ $? -eq 0 ];then
sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /etc/sysconfig/network
else
echo "HOSTNAME=$HOSTNAME" >> /etc/sysconfig/network
fi
if staticIP; then
# set static ip from variables in variables.txt
i="$DEVICE"
str_cfg_file="/etc/sysconfig/network-scripts/ifcfg-$i"
echo "DEVICE=$i" > $str_cfg_file
echo "BOOTPROTO=static" >> $str_cfg_file
echo "ONBOOT=yes" >> $str_cfg_file
echo "IPADDR=$IPADDR" >> $str_cfg_file
echo "NETMASK=$NETMASK" >> $str_cfg_file
echo "NETWORK=$NETWORK" >> $str_cfg_file
echo "BROADCAST=$BROADCAST" >> $str_cfg_file
#todo: add gateway config? Not sure, because the boot kernels gateway might not be the final OS gateway
else
# use dhcp for all nics
for i in $device_names;do
str_cfg_file="/etc/sysconfig/network-scripts/ifcfg-$i"
echo "DEVICE=$i" > $str_cfg_file
echo "BOOTPROTO=dhcp" >> $str_cfg_file
echo "NM_CONTROLLED=yes" >> $str_cfg_file
echo "ONBOOT=yes" >> $str_cfg_file
done
fi
elif [ -d "/etc/sysconfig/network/" ];then
#suse
echo "$HOSTNAME" > /etc/HOSTNAME
if staticIP; then
# set static ip from variables in variables.txt
i="$DEVICE"
str_cfg_file="/etc/sysconfig/network/ifcfg-$i"
echo "DEVICE=$i" > $str_cfg_file
echo "BOOTPROTO=static" >> $str_cfg_file
echo "STARTMODE=onboot" >> $str_cfg_file
echo "IPADDR=$IPADDR" >> $str_cfg_file
echo "NETMASK=$NETMASK" >> $str_cfg_file
echo "NETWORK=$NETWORK" >> $str_cfg_file
echo "BROADCAST=$BROADCAST" >> $str_cfg_file
#todo: add gateway config? Not sure, because the boot kernels gateway might not be the final OS gateway
else
# use dhcp for all nics
for i in $device_names;do
str_cfg_file="/etc/sysconfig/network/ifcfg-$i"
echo "DEVICE=$i" > $str_cfg_file
echo "BOOTPROTO=dhcp" >> $str_cfg_file
echo "STARTMODE=onboot" >> $str_cfg_file
echo "DHCLIENT_PRIMARY_DEVICE=yes" >> $str_cfg_file
done
fi
else
#ubuntu
echo "Does not support ubuntu."
exit 1
fi
+7 -2
View File
@@ -11,8 +11,9 @@ Vendor: IBM Corp.
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
Prefix: /opt/xcat
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
%ifos linux
BuildArch: noarch
%endif
Requires: xCAT-server
#Requires: xCAT-server >= %{epoch}:%(cat Version|cut -d. -f 1,2)
@@ -46,8 +47,9 @@ mkdir -p $RPM_BUILD_ROOT/install/postscripts
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/man/man1
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/man1
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install
cp -a share/xcat/install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/
cp -p -R share/xcat/install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/
cp -d bin/* $RPM_BUILD_ROOT/%{prefix}/bin
chmod 755 $RPM_BUILD_ROOT/%{prefix}/bin/*
@@ -55,6 +57,9 @@ chmod 755 $RPM_BUILD_ROOT/%{prefix}/bin/*
cp -d postscripts/* $RPM_BUILD_ROOT/install/postscripts
chmod 755 $RPM_BUILD_ROOT/install/postscripts/*
cp -d si-post-install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install/*
cp LICENSE.html $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer
chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer/*
+5 -7
View File
@@ -117,7 +117,7 @@ if ((!$imagename) && (!$profile) && (!$os) && (!$arch)) {
if ($? == 0) {
if (($tmpimgs) && ($tmpimgs !~ /^Could/)) { #Could is returned when the osimage table is empty
my @images=split('\n', $tmpimgs);
print "Do you want to re-genarate an existing image from the osimage table? ";
print "Do you want to re-generate an existing image from the osimage table? ";
print "[y/n] ";
my $conf = <stdin>;
chomp($conf);
@@ -128,7 +128,7 @@ if ((!$imagename) && (!$profile) && (!$os) && (!$arch)) {
foreach(sort @images){
print " $_\n";
}
# default is the first image cause in many cases
# default is the first image
print "Which image do you want to re-generate? [";
print $images[0];
print "] ";
@@ -294,13 +294,10 @@ if ($profile) { print " Profile: $profile\n"; }
# get the interface
if ((!$imagename) && (!$interface)){
while(1){
print "Which network interface do you want the image to boot from? [";
print "eth0";
print "] ";
print "OPTIONAL: Which specific network interface will the image boot from? [<blank>]";
$interface = <stdin>;
chomp($interface);
if($interface eq ""){
$interface = "eth0";
last;
}else{
print "You want your stateless machines to boot off of ";
@@ -317,8 +314,9 @@ if ((!$imagename) && (!$interface)){
}
}
}
if ($interface) { print " Interface: $interface\n"; }
else { print " No interface specified. The interface will be determined at network boot time.\n"; }
}
if ($interface) { print " Interface: $interface\n"; }
+61 -30
View File
@@ -8,10 +8,9 @@
This is script is called after the installation or upgrade of MySQL
on xCAT. It will automate the setup of the MySQL and xCAT to run
xCAT on the MySQL DB.
Note: if will setup an xcatdb,a xcatadmin, and a MySQL root password.
This script automates the setup of the MySQL/MariaDB server and creates the xCAT database to run
xCAT on MySQL/MariaDB.
Note: it will setup an xcat database (xcatdb),a xcatadmin id , and a MySQL root password.
It will interact for the
password to assign, unless the XCATMYSQLADMIN_PW and the XCATMYSQLROOT_PW
env variables are set to the admin and mysql root password, resp.
@@ -150,8 +149,8 @@ $::linuxos = xCAT::Utils->osver();
#
# check to see if mysql is installed
#
my $cmd = "rpm -qa | grep mysql";
#
my $cmd = "rpm -qa | grep -i perl-DBD-mysql";
if ( $::debianflag ){
$cmd = "dpkg -l | grep mysql-server";
}
@@ -159,10 +158,17 @@ xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{
my $message =
"\nMySQL is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before running this command.\n If on Linux, install from the OS CDs.";
"\nMySQL perl DBD is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before running this command.\n If on Linux, install from the OS CDs.";
xCAT::MsgUtils->message("E", " $cmd failed. $message");
exit(1);
}
# is this MariaDB or MySQL
$::MariaDB=0;
$cmd = "rpm -qa | grep -i mariadb"; # check this is MariaDB not MySQL
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC == 0) {
$::MariaDB=1;
}
# check to see if MySQL is running
$::mysqlrunning = 0;
@@ -205,10 +211,10 @@ if ($::osname eq 'AIX')
&setulimits;
}
# if not just odbc update and not already running mysql or mysqlsetup -u
# if not just odbc update and not already running mysql or mysqlsetup -u or -L
# Get root and admin passwords
#
if ((($odbconly == 0) && ( $::xcatrunningmysql == 0)) || $::UPDATE )
if ((($odbconly == 0) && ( $::xcatrunningmysql == 0)) || $::UPDATE || $::SETUPLL )
{ # not just updating the odbc
if ($ENV{'XCATMYSQLADMIN_PW'}) # input env sets the password
{
@@ -328,7 +334,6 @@ if (($::INIT) && ($::xcatrunningmysql == 0))
# MySQL not running, then initialize the database
if ($::mysqlrunning == 0)
{
# Add mysql user and group for AIX
# Correct directory permissions
#
@@ -436,7 +441,7 @@ sub usage
{
xCAT::MsgUtils->message(
'I',
"Usage:\nmysqlsetup - Performs the setup of MySQL for xCAT to use as its database. See man mysqlsetup for more information."
"Usage:\nmysqlsetup - Performs the setup of MySQL or MariaDB for xCAT to use as its database. See man mysqlsetup for more information."
);
my $msg =
"mysqlsetup <-h|--help>\n <-v|--version>\n <-i|--init> [-f|hostfile] [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-u|--update> <-f|hostfile> [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-o|--odbc> [-V|--verbose]\n <-L|--LL> [-V|--verbose]";
@@ -870,14 +875,20 @@ sub mysqlstart
}
else
{
if ($::linuxos =~ /rh.*/)
{
if ($::MariaDB==1) { # running MariaDB
$cmd = "service mariadb start";
} else { # it is mysql
if ($::linuxos =~ /rh.*/)
{
$cmd = "service mysqld start";
}
else
{ # sles
}
else
{ # sles
$cmd = "service mysql start";
}
}
}
}
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
@@ -973,16 +984,21 @@ sub mysqlreboot
}
else # linux
{
if ($::linuxos =~ /rh.*/)
{
$cmd = "chkconfig mysqld on";
}
else
{ # sles
$cmd = "chkconfig mysql on";
if ( $::debianflag ){
$cmd = "update-rc.d mysql defaults";
}
if ($::MariaDB==1 ) { # MariaDB not MySQL
$cmd = "chkconfig mariadb on";
} else { # mysql
if ($::linuxos =~ /rh.*/)
{
$cmd = "chkconfig mysqld on";
}
else
{ # sles
$cmd = "chkconfig mysql on";
if ( $::debianflag ){
$cmd = "update-rc.d mysql defaults";
}
}
}
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
@@ -1058,7 +1074,12 @@ sub setupxcatdb
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
my $pwd_sent = 0;
my $pwd_prompt = 'Enter password: ';
my $mysql_prompt = 'mysql> ';
my $mysql_prompt;
if ($::MariaDB == 1) { # setup MariaDB
$mysql_prompt = 'MariaDB \[\(none\)\]> ';
} else {
$mysql_prompt = 'mysql> ';
}
my $expect_log = undef;
my $debug = 0;
#if ($::VERBOSE)
@@ -1178,7 +1199,12 @@ sub setupLL
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
my $pwd_sent = 0;
my $pwd_prompt = 'Enter password: ';
my $mysql_prompt = 'mysql> ';
my $mysql_prompt;
if ($::MariaDB == 1) { # setup MariaDB
$mysql_prompt = 'MariaDB \[\(none\)\]> ';
} else {
$mysql_prompt = 'mysql> ';
}
my $expect_log = undef;
my $debug = 0;
#if ($::VERBOSE)
@@ -1308,7 +1334,12 @@ sub addhosts
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
my $pwd_sent = 0;
my $pwd_prompt = 'Enter password: ';
my $mysql_prompt = 'mysql> ';
my $mysql_prompt;
if ($::MariaDB == 1) { # setup MariaDB
$mysql_prompt = 'MariaDB \[\(none\)\]> ';
} else {
$mysql_prompt = 'mysql> ';
}
my $expect_log = undef;
foreach my $host (@hosts)
+1 -1
View File
@@ -65,7 +65,7 @@ else { # the normal case of the user running the cmd - expand the noderange us
SSL_cert_file=> xCAT::Utils->getHomeDir()."/.xcat/client-cred.pem",
SSL_ca_file => xCAT::Utils->getHomeDir()."/.xcat/ca.pem",
SSL_use_cert => 1,
#SSL_verify_mode => 1,
SSL_verify_mode => 1,
);
die "Connection failure: $!\n" unless ($client);
my %cmdref = (command => 'noderange', noderange => $noderange);
+1 -1
View File
@@ -31,7 +31,7 @@ if (!GetOptions(
"nonodecheck" => \$::NONODECHECK, #does not check the noderange, in this case, noderange need to be a list of nodes.
'h|help' => \$help,
) || $help || scalar(@ARGV)<2 ) {
print "Usage: psh [-i <interface>] [-l <user>] [-f <fanout>] [--nonodecheck] <noderange> <command>\n";
print "Usage: psh [-i <interface>] [-l <user>] [-f <fanout>] [--nonodecheck] [-t <timeout value in seconds>] <noderange> <command>\n";
exit;
}
my %nodehdl;
+47 -41
View File
@@ -6,10 +6,10 @@ B<genimage> - Generates a stateless image to be used for a diskless install.
B<genimage>
B<genimage> B<-o> I<osver> [B<-a> I<arch>] B<-p> I<profile> B<-i> I<nodebootif> B<-n> I<nodenetdrivers> [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>]
B<genimage> [B<-o> I<osver>] [B<-a> I<arch>] [B<-p> I<profile>] [B<-i> I<nodebootif>] [B<-n> I<nodenetdrivers>] [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>] [B<--ignorekernelchk>] I<imagename>
B<genimage> B<-o> I<osver> [B<-a> I<arch>] B<-p> I<profile> B<-i> I<nodebootif> B<-n> I<nodenetdrivers> [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>]
B<genimage> [B<-h> | B<--help> | B<-v> | B<--version>]
@@ -17,43 +17,43 @@ B<genimage> [B<-h> | B<--help> | B<-v> | B<--version>]
=head1 DESCRIPTION
Generates a stateless and a statelite image that can be used to boot xCAT nodes in a diskless mode.
If I<imagename> is not specified, the default packages included
(and excluded) in the image are specified by
The I<imagename> format of the command is recommended. When specified, genimage will use the osimage definition for information to generate this image. Additional options specified on the command line will override any corresponding previous osimage settings, and will be written back to the osimage definition.
If I<imagename> is not specified (old method):
- the default packages included (and excluded) in the image are specified by
/opt/xcat/share/xcat/netboot/<os>/<profile>[.<osver>][.<arch>].pkglist and
/opt/xcat/share/xcat/netboot/<os>/<profile>[.<osver>][.<arch>].exlist.
Additional packages that are not from the os distro can be specified in a
- Additional packages that are not from the os distro can be specified in a
/opt/xcat/share/xcat/netboot/<os>/<profile>[.<osver>][.<arch>].otherpkgs.pkglist file.
Customized package list files can be specified under /install/custom/netboot/<os> directory. The generated image will be put in /install/netboot/<osver>/<arch>/<profile> directory.
- Customized package list files will override these files and can be specified under /install/custom/netboot/<os> directory.
- The generated image will be put in /install/netboot/<osver>/<arch>/<profile> directory.
The newly generated image names will have the following format:
- osimage definitions will be created in the I<linuximage> and I<osimage> tables. The newly generated image names will have the following format:
for stateless: <osver>-<arch>-netboot-<profile>
for stateless: <osver>-<arch>-netboot-<profile>
for statelite: <osver>-<arch>-statelite-<profile>
for statelite: <osver>-<arch>-statelite-<profile>
B<genimage> command will create them into I<linuximage> and I<osimage> tables.
If I<imagename> is specified, the package list file names are read from the I<osimage> table and I<linuximage> tables.
If B<genimage> runs on the management node, both the I<osimage> table and I<linuximage> table will be updated with the given values from the options.
The B<genimage> command will generate two initial ramdisks for B<stateless> and B<statelite>, one is B<initrd-stateless.gz>, the other one is B<initrd-statelite.gz>.
After your image is created, you can chroot to the
After your image is generated, you can chroot to the
image, install any additional software you would like, or make modifications to files, and then run the following command to prepare the image for deployment.
for stateless: B<packimage>
for statelite: B<liteimg>
Becides prompting for the input for some paramters, the B<genimage> command takes default quesses for the parameters not specified or not defined in the I<osimage> and I<linuximage> tables. It also makes default answers for questions from yum/zypper command when installing rpms into the image. Please use --interactive flag if you want yum/zypper command to prompt you for the answers.
Besides prompting for some paramter values, the B<genimage> command takes default guesses for the parameters not specified or not defined in the I<osimage> and I<linuximage> tables. It also assumes default answers for questions from the yum/zypper command when installing rpms into the image. Please use --interactive flag if you want the yum/zypper command to prompt you for the answers.
If B<--onlyinitrd> is specified, only regenerates the initrd for a stateless image to be used for a diskless install.
If B<--onlyinitrd> is specified, genimage only regenerates the initrd for a stateless image to be used for a diskless install.
The B<genimage> command must be run on a system that is the same architecture and same distro with same major release version as the nodes it will be
used on. If the management node is not the same architecture or same distro level, copy the contents of
@@ -61,10 +61,9 @@ used on. If the management node is not the same architecture or same distro lev
the management node to that system. Then change directory to /opt/xcat/share/xcat/netboot/<os> and run ./genimage.
=head1 Parameters
I<imagename> specifies the name of a os image definition to be used. The specification for the image is storted in the I<osimage> table and I<linuximage> table.
I<imagename> specifies the name of an os image definition to be used. The specification for the image is stored in the I<osimage> table and I<linuximage> table.
=head1 OPTIONS
@@ -88,7 +87,7 @@ the nodes' nodetype.profile attribute must be set to this same value.
=item B<-i> I<nodebootif>
The network interface the diskless node will boot over (e.g. eth0).
This argument is now optional, and allows you to specify the network boot interface to be configured in the image (e.g. eth0). If not specified, the interface will be determined and configured during the network boot process.
=item B<-n> I<nodenetdrivers>
@@ -183,46 +182,53 @@ To prompt the user for inputs:
genimage
=item 2
To generate an image using information from an osimage definition:
To generate a fedora8 image for a compute node architecture
genimage myimagename
=item 3
To run genimage in test mode without actually generating an image:
genimage --dryrun myimagename
=item 4
To generate an image and have yum/zypper prompt for responses:
genimage myimagename --interactive
=item 5
To generate an image, replacing some values in the osimage definition:
genimage -i eth0 -n tg3 myimagename
=item 6
(old method) To generate a fedora8 image for a compute node architecture
x86_64 and place it in the
/install/netboot/fedora8/x86_64/compute/rootimg directory:
genimage -i eth0 -o fedora8 -p compute
=item 3
=item 7
(old method)
genimage -i eth0 -r eth1,eth2 -n tg3,bnx2 -o centos5.1 -p compute
=item 4
=item 8
(old method)
genimage -i eth0 -n tg3,bnx2 -o sles11 -p compute --interactive
=item 5
=item 9
(old method)
genimage -i eth0 -n igb,e1000e,e1000,bnx2,tg3 -o centos5.4 -p nfsroot --permission 777
=item 6
genimage -i eth0 -n tg3 myimagename
=item 7
genimage myimagename
=item 8
genimage myimagename --interactive
=item 9
To regenerate the initrd for a fedora8 image for a compute node architecture x86_64 and place it in the /install/netboot/fedora8/x86_64/compute/rootimg directory: change directory to /opt/xcat/share/xcat/netboot/fedora and run:
genimage --onlyinitrd -i eth0 -n tg3,bnx2 -o fedora8 -p compute
=item 10
(old method)
To regenerate the initrd for a fedora8 image for a compute node architecture x86_64 and place it in the /install/netboot/fedora8/x86_64/compute/rootimg directory:
genimage --dryrun myimagename
cd /opt/xcat/share/xcat/netboot/fedora
./genimage --onlyinitrd -i eth0 -n tg3,bnx2 -o fedora8 -p compute
=back
+74
View File
@@ -0,0 +1,74 @@
=head1 Name
B<mkvlan> - Create vlan on switches
=head1 B<Synopsis>
B<mkvlan> [B<-h>|B<--help>|B<?>|B<-v>|B<--version>]
B<mkvlan> {Ivlanid} -n I<noderange> {B-i <interface>|B-m <netmask> |B-t <subnet>}
=head1 B<Description>
B<mkvlan> creates tagged vlan on the switches corresponding to the attributes defined in the B<switch> table
=head1 B<Options>
=over 7
=item B<vlanid>
The vlan to tag on the switch.
=item B<interface>
List all buses for each I/O slot.
=item B<netmask>
Retrieves number of processors, speed, total memory, and DIMM
locations.
=item B<subnet>
Retrieves model number.
=item B<-h>|B<--help>|B<?>
Print help.
=item B<-v>|B<--version>
Print version.
=back
=back
=head1 B<Examples>
=over 4
=item *
To make a private vlan for stand-alone nodes for the management network, enter:
mkvlan -n node1,node2,node3
=item *
You can specify vlan id, subnet and netmask etc, enter:
mkvlan 3 -n node1,node2,node3 -t 10.3.2.0 -m 255.255.255.0
=item *
To create a tagged vlan on an interface, enter:
mkvlan -n node1,node2,node3 -i eth1
=back
=head1 SEE ALSO
L<noderange(3)|noderange.3>, L<lsvlan(1)|lsvlan.1>
+5 -4
View File
@@ -1,6 +1,6 @@
=head1 NAME
B<mysqlsetup> - Sets up the MySQL database for xCAT to use.
B<mysqlsetup> - Sets up the MySQL or MariaDB database for xCAT to use.
=head1 SYNOPSIS
@@ -19,9 +19,10 @@ B<mysqlsetup> {B<-L>|B<--LL>} [-V|--verbose]
=head1 DESCRIPTION
B<mysqlsetup> - Sets up the MySQL database for xCAT to use. The mysqlsetup script is run on the Management Node as root after the MySQL code has been installed. Before running the init option, the MySQL server should be stopped. The xCAT daemon, xcatd, must be running, do not stop it. No xCAT commands should be run during the init process, because we will be migrating the xCAT database to MySQL and restarting the xcatd daemon as well as the MySQL daemon. For full information on all the steps that will be done, read the "Configure MySQL and Migrate xCAT Data to MySQL" sections in
B<mysqlsetup> - Sets up the MySQL or MariaDB database (linux only for MariaDB) for xCAT to use. The mysqlsetup script is run on the Management Node as root after the MySQL code or MariaDB code has been installed. Before running the init option, the MySQL server should be stopped, if it is running. The xCAT daemon, xcatd, must be running, do not stop it. No xCAT commands should be run during the init process, because we will be migrating the xCAT database to MySQL or MariaDB and restarting the xcatd daemon as well as the MySQL daemon. For full information on all the steps that will be done, read the "Configure MySQL and Migrate xCAT Data to MySQL" sections in
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Setting_Up_MySQL_as_the_xCAT_DB
Two passwords must be supplied for the setup, a password for the xcatadmin id and a password for the root id in the MySQL database. These will be prompted for interactively, unless the environment variables XCATMYSQLADMIN_PW and XCATMYSQLROOT_PW are set to the passwords for the xcatadmin id and root id in the database,resp.
Note below we refer to MySQL but it works the same for MariaDB.
=head1 OPTIONS
@@ -41,8 +42,8 @@ Displays verbose messages.
=item B<-i|--init>
The init option is used to setup an installed MySQL database so that xCAT can use the database. This involves creating the xcatdb database, the xcatadmin id, allowing access to the xcatdb database by the Management Node. It customizes the my.cnf configuration file for xcat and starts the MySQL server. It also backs up the current xCAT database and restores it into the newly setup xcatdb MySQL database. It creates the /etc/xcat/cfgloc file to point the xcatd daemon to the MySQL database and restarts the xcatd daemon using the database.
On AIX, it additionally setup the mysql id and group and corrects the permissions in the MySQL install directories. For AIX, you should be using the MySQL rpms available from the xCAT website. For Linux, you should use the MySQL rpms shipped with the OS. You can chose the -f and/or the -o option, to run after the init.
The init option is used to setup a xCAT database on an installed MySQL or MariaDB server for xCAT to use. The mysqlsetup script will check for the installed MariaDB server rpm first and will use MariaDB if it is installed. This involves creating the xcatdb database, the xcatadmin id, allowing access to the xcatdb database by the Management Node. It customizes the my.cnf configuration file for xcat and starts the MySQL server. It also backs up the current xCAT database and restores it into the newly setup xcatdb MySQL database. It creates the /etc/xcat/cfgloc file to point the xcatd daemon to the MySQL database and restarts the xcatd daemon using the database.
On AIX, it additionally setup the mysql id and group and corrects the permissions in the MySQL install directories. For AIX, you should be using the MySQL rpms available from the xCAT website. For Linux, you should use the MySQL or MariaDB rpms shipped with the OS. You can chose the -f and/or the -o option, to run after the init.
=item B<-u|--update>
+22
View File
@@ -123,6 +123,28 @@ Wake up the target nodes which is in B<suspend> state.
Don't try to run B<wake> against the 'on' state node, it would cause the node gets to 'off' state.
For some of xCAT hardware such as NeXtScale, it may need to enable S3 before using B<wake>. The following steps can be used to enable S3. Please reference L<pasu(1)|pasu.1> for "pasu" usage.
[root@xcatmn home]# echo "set Power.S3Enable Enable" > power-setting
[root@xcatmn home]# pasu -b power-setting node01
node01: Batch mode start.
node01: [set Power.S3Enable Enable]
node01: Power.S3Enable=Enable
node01:
node01: Beginning intermediate batch update.
node01: Waiting for command completion status.
node01: Command completed successfully.
node01: Completed intermediate batch update.
node01: Batch mode completed successfully.
[root@xcatmn home]# pasu node01 show all|grep -i s3
node01: IMM.Community_HostIPAddress3.1=
node01: IMM.Community_HostIPAddress3.2=
node01: IMM.Community_HostIPAddress3.3=
node01: IMM.DNS_IP_Address3=0.0.0.0
node01: IMM.IPv6DNS_IP_Address3=::
node01: Power.S3Enable=Enable
=item B<stat>|B<state>
Print the current power state/status.
+3 -1
View File
@@ -28,7 +28,7 @@ A network B<domain> and B<nameservers> values must be provided either in the B<n
Only entries in /etc/hosts or the hosts specified by B<noderange> that have a corresponding xCAT network definition will be added to DNS.
By default, B<makedns> sets up the B<named> service and updates the DNS records on the local system (mamagement node). If the -e flag is specified, it will also update the DNS records on any external DNS server that is listed in the /etc/resolv.conf on the management node. (Assuming the external DNS server can recognize the xCAT key as authentication.)
By default, B<makedns> sets up the B<named> service and updates the DNS records on the local system (management node). If the -e flag is specified, it will also update the DNS records on any external DNS server that is listed in the /etc/resolv.conf on the management node. (Assuming the external DNS server can recognize the xCAT key as authentication.)
For more information on Cluster Name Resolution:
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Cluster_Name_Resolution
@@ -49,6 +49,8 @@ Remove the DNS records.
Update DNS records to the external DNS server listed in /etc/resolv.conf.
Enabling the site attribute I<externaldns> means use 'external' DNS by default. If setting I<externaldns> to 1, you need NOT use B<-e> flag in every makedns call.
=item B<noderange>
A set of comma delimited node names and/or group names. See the "noderange" man page for details on additional supported formats.
+6 -1
View File
@@ -12,7 +12,12 @@ B<mknb> I<arch>
The B<mknb> command is run by xCAT automatically, when xCAT is installed on the management node.
It creates a network boot root image (used for node discovery, BMC programming, and flashing)
for the same architecture that the management node is. So you normally do not need to run the B<mknb>
command yourself. Presently, only the arch x86_64 is supported.
command yourself.
If you do run B<mknb> to add custom utilities to your boot root image, and you have an xCAT Hierarchical Cluster with service nodes that each have a local /tftpboot directory (site sharedtftp=0), you will also need to copy the generated root image to each service node.
Presently, only the arch x86_64 is supported.
=head1 OPTIONS
+4 -2
View File
@@ -6,11 +6,13 @@ B<tabprune> - Deletes records from the eventlog,auditlog,isnm_perf,isnm_perf_sum
B<tabprune> B<eventlog | auditlog> [B<-V>] B<-i> I<recid> |B<-n> I<number of records> | B<-p> I<percentage> | B<-d> I<number of days> | B<-a>
B<tabprune> B<tablename> B<-a>
B<tabprune> [B<-h>|B<--help>] [B<-v>|B<--version>]
=head1 DESCRIPTION
The tabprune command is used to delete records from the auditlog,eventlog,isnm_perf,isnm_perf_sum tables. As an option, the table header and all the rows pruned from the specified table will be displayed in CSV (comma separated values) format.
The tabprune command is used to delete records from the auditlog,eventlog,isnm_perf,isnm_perf_sum tables. As an option, the table header and all the rows pruned from the specified table will be displayed in CSV (comma separated values) format. The all records options (-a) can be used on any xCAT table.
=head1 OPTIONS
@@ -27,7 +29,7 @@ you want to redirect them to a file to archive them.
=item B<-a>
Remove all records.
Remove all records from the input table name. This option can be used on any xCAT table.
=item B<-i> I<recid number>
+8
View File
@@ -25,6 +25,14 @@ if [ "$HOSTOS" = "mcp" ]; then
sed -i 's/ kexec//' $DRACUTMODDIR/install
sed -i 's/ klogd//' $DRACUTMODDIR/install
sed -i 's/ mdadm//' $DRACUTMODDIR/install
# These timezone files are not available in the latest mcp build
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh87//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh88//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh89//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh87//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh88//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh89//' $DRACUTMODDIR/install
fi
mkdir -p /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs
-6
View File
@@ -253,9 +253,6 @@ dracut_install /usr/share/zoneinfo/posix/America/Knox_IN
dracut_install /usr/share/zoneinfo/posix/America/Goose_Bay
dracut_install /usr/share/zoneinfo/posix/EET
dracut_install /usr/share/zoneinfo/posix/EST5EDT
dracut_install /usr/share/zoneinfo/posix/Mideast/Riyadh89
dracut_install /usr/share/zoneinfo/posix/Mideast/Riyadh88
dracut_install /usr/share/zoneinfo/posix/Mideast/Riyadh87
dracut_install /usr/share/zoneinfo/posix/MST
dracut_install /usr/share/zoneinfo/posix/Iceland
dracut_install /usr/share/zoneinfo/posix/Atlantic/Faeroe
@@ -396,7 +393,6 @@ dracut_install /usr/share/zoneinfo/posix/NZ-CHAT
dracut_install /usr/share/zoneinfo/posix/Asia/Istanbul
dracut_install /usr/share/zoneinfo/posix/Asia/Kuwait
dracut_install /usr/share/zoneinfo/posix/Asia/Saigon
dracut_install /usr/share/zoneinfo/posix/Asia/Riyadh89
dracut_install /usr/share/zoneinfo/posix/Asia/Urumqi
dracut_install /usr/share/zoneinfo/posix/Asia/Brunei
dracut_install /usr/share/zoneinfo/posix/Asia/Ujung_Pandang
@@ -438,7 +434,6 @@ dracut_install /usr/share/zoneinfo/posix/Asia/Tokyo
dracut_install /usr/share/zoneinfo/posix/Asia/Macao
dracut_install /usr/share/zoneinfo/posix/Asia/Riyadh
dracut_install /usr/share/zoneinfo/posix/Asia/Rangoon
dracut_install /usr/share/zoneinfo/posix/Asia/Riyadh88
dracut_install /usr/share/zoneinfo/posix/Asia/Jakarta
dracut_install /usr/share/zoneinfo/posix/Asia/Aden
dracut_install /usr/share/zoneinfo/posix/Asia/Calcutta
@@ -476,7 +471,6 @@ dracut_install /usr/share/zoneinfo/posix/Asia/Tel_Aviv
dracut_install /usr/share/zoneinfo/posix/Asia/Taipei
dracut_install /usr/share/zoneinfo/posix/Asia/Kabul
dracut_install /usr/share/zoneinfo/posix/Asia/Macau
dracut_install /usr/share/zoneinfo/posix/Asia/Riyadh87
dracut_install /usr/share/zoneinfo/posix/Asia/Choibalsan
dracut_install /usr/share/zoneinfo/posix/Asia/Vientiane
dracut_install /usr/share/zoneinfo/posix/Asia/Dacca
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/bash
instmods nfs sunrpc
instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb ixgbe qlge mptsas mpt2sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net vfat ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf
instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb ixgbe qlge mptsas mpt2sas mpt3sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net vfat ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf
instmods macvlan macvtap 8021q bridge bonding vmxnet3 cpufreq_ondemand acpi-cpufreq powernow-k8 cdc_ether
instmods mptctl #LSI firmware management requires this
instmods mlx4_ib ib_umad #make the mellanox ib available enough to examine /sys
+1 -1
View File
@@ -59,4 +59,4 @@ fi
%Files
%defattr(-,root,root)
/
/opt/xcat/share/xcat/netboot/genesis/%{tarch}
+1
View File
@@ -5,6 +5,7 @@ clear
echo PS1="'"'[xCAT Genesis running on \H \w]\$ '"'" > /.bashrc
echo PS1="'"'[xCAT Genesis running on \H \w]\$ '"'" > /.bash_profile
mkdir -p /etc/ssh
mkdir -p /var/tmp/
mkdir -p /var/empty/sshd
echo root:x:0:0::/:/bin/bash >> /etc/passwd
echo sshd:x:30:30:SSH User:/var/empty/sshd:/sbin/nologin >> /etc/passwd
+2 -2
View File
@@ -204,7 +204,7 @@ for bmcu in $BMCUS; do
if [ "$bmcu" = "" ]; then continue; fi
DISABLEUSERS="1 2 3 4"
if [ ! -z "$LOCKEDUSERS" ]; then
USERSLOT=`ipmitool -d $idev user list $LANCHAN |grep -v ^ID|awk '{print $1 " " $2}'|grep " $BMCUS"|awk '{print $1}'`
USERSLOT=`ipmitool -d $idev user list $LANCHAN |grep -v ^ID|awk '{print $1 " " $2}'|grep -w "$BMCUS"|awk '{print $1}'`
if [ -z "$USERSLOT" ]; then
USERSLOT=4
fi
@@ -239,7 +239,7 @@ done
TRIES=0
# Last param in ipmitool user priv is the channel to set it on.
# Penguin boxes are all channel 2
CURRPRIV=`ipmitool -d $idev user list 1|grep ^$USERSLOT|awk '{print $6}'`
CURRPRIV=`ipmitool -d $idev user list $LANCHAN|grep ^$USERSLOT|awk '{print $6}'`
if [ "$CURRPRIV" != "ADMINISTRATOR" ]; then
while ! ipmitool -d $idev user priv $USERSLOT 4 $LANCHAN; do
sleep 1
+92 -19
View File
@@ -4,11 +4,13 @@
# Bug reported by Jeff Lang <jrlang@uwyo.edu>. Thanks, Jeff!
#
modprobe acpi_cpufreq
modprobe acpi_cpufreq 2>/dev/null # on some machines this fails
modprobe cpufreq_ondemand
for gov in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
echo -n ondemand > $gov
done
if ls /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor &>/dev/null; then
for gov in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
echo -n ondemand > $gov
done
fi
if [ ! -z "$BOOTIF" ]; then
BOOTIF=`echo $BOOTIF|sed -e s/01-// -e s/-/:/g`
echo -n "Waiting for device with address $BOOTIF to appear.."
@@ -74,21 +76,90 @@ echo '};' >> /var/lib/lldpad/lldpad.conf
done
echo '};' >> /var/lib/lldpad/lldpad.conf
lldpad -d
dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$bootnic.pid $bootnic &
#we'll kick of IPv6 and IPv4 on all nics, but not wait for them to come up unless doing discovery, to reduce
#chances that we'll perform a partial discovery
#in other scenarios where downed non-bootnics cause issues, will rely on retries to fix things up
dhclient -6 -pf /var/run/dhclient6.$bootnic.pid $bootnic -lf /var/lib/dhclient/dhclient6.leases &
NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v $bootnic|grep -v usb|grep -v ,UP|awk -F: '{print $2}'`
export NICSTOBRINGUP
for nic in $NICSTOBRINGUP; do
(while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$nic.pid $nic ) &
(while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -6 -pf /var/run/dhclient6.$nic.pid -lf /var/lib/dhclient/dhclient6.leases $nic ) &
done
openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 &
# Caclulate the broadcast address of a given IP address and mask.
bcastcalc(){
read oct1 oct2 oct3 oct4 << HERE
$(echo "$1" | sed -e 's/\./ /g')
HERE
read msk1 msk2 msk3 msk4 << HERE
$(echo "$2" | sed -e 's/\./ /g')
HERE
ipa=$(($oct1+(255-($oct1 | $msk1))))
ipb=$(($oct2+(255-($oct2 | $msk2))))
ipc=$(($oct3+(255-($oct3 | $msk3))))
ipd=$(($oct4+(255-($oct4 | $msk4))))
echo "$ipa.$ipb.$ipc.$ipd"
}
# Calculates the number of bits in a netmask for converting something like 255.255.255.192 to 26 so
# you can use the notation 10.0.0.1/26
mask2prefix() {
nbits=0
old_ifs=$IFS
IFS=.
for dec in $1 ; do
case $dec in
255) let nbits+=8;;
254) let nbits+=7;;
252) let nbits+=6;;
248) let nbits+=5;;
240) let nbits+=4;;
224) let nbits+=3;;
192) let nbits+=2;;
128) let nbits+=1;;
0);;
*) echo "Error: $dec is not recognised"; exit 1
esac
done
IFS=$old_ifs
echo "$nbits"
}
# see if they specified static ip info, otherwise use dhcp
for parm in `cat /proc/cmdline`; do
key=`echo $parm|awk -F= '{print $1}'`
value=`echo $parm|awk -F= '{print $2}'`
if [[ ${key,,} == "hostip" || ${key,,} == "ipaddr" ]]; then
hostip=$value
elif [[ ${key,,} == "netmask" ]]; then
netmask=$value
elif [[ ${key,,} == "gateway" ]]; then
gateway=$value
elif [[ ${key,,} == "netdevice" || ${key,,} == "device" ]]; then
netdevice=$value
fi
done
if [[ -n $hostip && -n $netmask && -n $gateway && -n $netdevice ]]; then
# doing static ip
numbits=$(mask2prefix $netmask)
broadcast=$(bcastcalc $hostip $netmask)
echo "Setting static IP=$hostip/$numbits broadcast=$broadcast gateway=$gateway netdevice=$netdevice ..."
ip addr add $hostip/$numbits broadcast $broadcast dev $netdevice scope global label $netdevice
ip link set $netdevice up
ip route replace to default via $gateway dev $netdevice
# in softlayer it takes up to 60 seconds for the nic to actually be able to communicate
echo -n Waiting to reach xCAT mgmt node $gateway.
xcatretries=60
while [ $((xcati+=1)) -le $xcatretries ] && ! ping -c2 -w3 $gateway >/dev/null 2>&1; do echo -n .; done
if [ $xcati -le $xcatretries ]; then echo " success"; else echo " failed"; fi
sleep 3
else
echo "Setting IP via DHCP..."
dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$bootnic.pid $bootnic &
#we'll kick of IPv6 and IPv4 on all nics, but not wait for them to come up unless doing discovery, to reduce
#chances that we'll perform a partial discovery
#in other scenarios where downed non-bootnics cause issues, will rely on retries to fix things up
dhclient -6 -pf /var/run/dhclient6.$bootnic.pid $bootnic -lf /var/lib/dhclient/dhclient6.leases &
NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v $bootnic|grep -v usb|grep -v ,UP|awk -F: '{print $2}'`
export NICSTOBRINGUP
for nic in $NICSTOBRINGUP; do
(while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$nic.pid $nic ) &
(while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -6 -pf /var/run/dhclient6.$nic.pid -lf /var/lib/dhclient/dhclient6.leases $nic ) &
done
fi
openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 &
gripeiter=101
echo -n "Acquiring network addresses.."
@@ -103,7 +174,9 @@ done
echo -n "Acquired IPv4 address on $bootnic: "
ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet|awk '{print $2}'
ntpd -g -x
(while ! ntpq -c "rv 0 state"|grep 'state=4' > /dev/null; do sleep 1; done; hwclock --systohc) &
# rv 0 state does not work with the new ntp versions
#(while ! ntpq -c "rv 0 state"|grep 'state=4' > /dev/null; do sleep 1; done; hwclock --systohc) &
(while [ "`ntpq -c \"rv 0 offset\" | grep \"offset=\" | awk -F \"=\" '{print $2}' | awk -F \".\" '{print $1}' | sed s/-//`" -ge 1000 ]; do sleep 1; done; hwclock --systohc) &
if dmidecode|grep IPMI > /dev/null; then
modprobe ipmi_si
modprobe ipmi_devintf
+1 -1
View File
@@ -7,6 +7,6 @@ Standards-Version: 3.7.2
Package: xcat-server
Architecture: all
Depends: ${perl:Depends}, perl-xcat (>= 2.5.0-1), xcat-client (>= 2.5.0-1), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl
Depends: ${perl:Depends}, grub2-xcat, perl-xcat (>= 2.5.0-1), xcat-client (>= 2.5.0-1), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl,libcrypt-rijndael-perl,libcrypt-cbc-perl
Description: Server and configuration utilities of the xCAT management project
xCAT-server provides the core server and configuration management components of xCAT. This package should be installed on your management server
+13 -5
View File
@@ -122,6 +122,7 @@ sub new {
unless ($ipmi2support) {
$self->{ipmi15only} = 1;
}
$self->{privlevel} = 4;
unless ($args{'bmc'} and defined $args{'userid'} and defined $args{'password'}) {
$self->{error}="bmc, userid, and password must be specified";
return $self;
@@ -309,7 +310,7 @@ sub session_activated {
sub set_admin_level {
my $self= shift;
$self->subcmd(netfn=>0x6,command=>0x3b,data=>[4],callback=>\&admin_level_set,callback_args=>$self);
$self->subcmd(netfn=>0x6,command=>0x3b,data=>[$self->{privlevel}],callback=>\&admin_level_set,callback_args=>$self);
}
sub admin_level_set {
my $rsp = shift;
@@ -687,7 +688,7 @@ sub send_rakp3 {
$self->{rmcptag}+=1;
my @payload = ($self->{rmcptag},0,0,0,@{$self->{pendingsessionid}});
my @user = unpack("C*",$self->{userid});
push @payload,unpack("C*",hmac_sha1(pack("C*",@{$self->{remoterandomnumber}},@{$self->{sidm}},4,scalar @user,@user),$self->{password}));
push @payload,unpack("C*",hmac_sha1(pack("C*",@{$self->{remoterandomnumber}},@{$self->{sidm}},$self->{privlevel},scalar @user,@user),$self->{password}));
$self->sendpayload(payload=>\@payload,type=>$payload_types{'rakp3'});
}
@@ -701,7 +702,7 @@ sub send_rakp1 {
push @{$self->{randomnumber}},$randomnumber;
}
push @payload, @{$self->{randomnumber}};
push @payload,(4,0,0); # request admin
push @payload,($self->{privlevel},0,0); # request priv
my @user = unpack("C*",$self->{userid});
push @payload,scalar @user;
push @payload,@user;
@@ -817,6 +818,13 @@ sub got_rakp2 {
}
$byte = shift @data;
unless ($byte == 0x00) {
if ($byte == 0x9 and $self->{privlevel} == 4) {
# this is probably an environment that wants to give us only operator
# try to connect again at 3.
$self->{privlevel} = 3;
$self->relog();
return;
}
if ($byte == 0x02) { #invalid session id is almost certainly because a retry on rmcp+ open session response rendered our session id invalid, ignore this in the hope that we'll get an answer for our retry that invalidated us..
#$self->relog();
#TODO: probably should disable RAKP1 retry here... high likelihood that we'll just spew a bad RAKP1 and Open Session Request retry would be more appropriate to try to discern a valid session id
@@ -841,7 +849,7 @@ sub got_rakp2 {
#Data now represents authcode.. sha1 only..
my @user = unpack("C*",$self->{userid});
my $ulength = scalar @user;
my $hmacdata = pack("C*",(@{$self->{sidm}},@{$self->{pendingsessionid}},@{$self->{randomnumber}},@{$self->{remoterandomnumber}},@{$self->{remoteguid}},4,$ulength,@user));
my $hmacdata = pack("C*",(@{$self->{sidm}},@{$self->{pendingsessionid}},@{$self->{randomnumber}},@{$self->{remoterandomnumber}},@{$self->{remoteguid}},$self->{privlevel},$ulength,@user));
my @expectedhash = (unpack("C*",hmac_sha1($hmacdata,$self->{password})));
foreach (0..(scalar(@expectedhash)-1)) {
if ($expectedhash[$_] != $data[$_]) {
@@ -850,7 +858,7 @@ sub got_rakp2 {
return 9;
}
}
$self->{sik} = hmac_sha1(pack("C*",@{$self->{randomnumber}},@{$self->{remoterandomnumber}},4,$ulength,@user),$self->{password});
$self->{sik} = hmac_sha1(pack("C*",@{$self->{randomnumber}},@{$self->{remoterandomnumber}},$self->{privlevel},$ulength,@user),$self->{password});
$self->{k1} = hmac_sha1(pack("C*",1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),$self->{sik});
$self->{k2} = hmac_sha1(pack("C*",2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2),$self->{sik});
my @aeskey = unpack("C*",$self->{k2});
+41 -5
View File
@@ -39,11 +39,27 @@ sub getIPMIAuth {
if (defined($tmp)) {
$ipmiuser = $tmp->{username};
$ipmipass = $tmp->{password};
if ($ipmiuser or $ipmipass) {
unless($ipmiuser) {
$ipmiuser = '';
}
unless($ipmipass) {
$ipmipass = '';
}
}
}
($tmp)=$passtab->getAttribs({'key'=>'blade'},'username','password');
if (defined($tmp)) {
$bladeuser = $tmp->{username};
$bladepass = $tmp->{password};
if ($bladeuser or $bladepass) {
unless($bladeuser) {
$bladeuser = '';
}
unless($bladepass) {
$bladepass = '';
}
}
}
}
my $mpatab;
@@ -58,9 +74,19 @@ sub getIPMIAuth {
my $mpa = $mphash->{$node}->[0]->{mpa};
if (not $mpaauth{$mpa} and $mpatab) {
my $mpaent = $mpatab->getNodeAttribs($mpa,[qw/username password/],prefetchcache=>1); #TODO: this might make more sense to do as one retrieval, oh well
if (ref $mpaent and $mpaent->{username}) { $mpaauth{$mpa}->{username} = $mpaent->{username} }
if (ref $mpaent and $mpaent->{password}) { $mpaauth{$mpa}->{password} = $mpaent->{password} }
$mpaauth{$mpa}->{checked} = 1; #remember we already looked this up, to save lookup time even if search was fruitless
if (ref $mpaent and ($mpaent->{username} or $mpaent->{password})) {
if (!exists($mpaent->{username})) {
$mpaauth{$mpa}->{username} = '';
} else {
$mpaauth{$mpa}->{username} = $mpaent->{username};
}
if (!exists($mpaent->{password})) {
$mpaauth{$mpa}->{password} = '';
} else {
$mpaauth{$mpa}->{password} = $mpaent->{password};
}
}
$mpaauth{$mpa}->{checked} = 1; #remember we already looked this up, to save lookup time even if search was fruitless
}
if ($mpaauth{$mpa}->{username}) { $authmap{$node}->{username} = $mpaauth{$mpa}->{username}; $authmap{$node}->{cliusername}=$mpaauth{$mpa}->{username}; }
if ($mpaauth{$mpa}->{password}) { $authmap{$node}->{password} = $mpaauth{$mpa}->{password} ; $authmap{$node}->{clipassword}=$mpaauth{$mpa}->{password} }
@@ -68,8 +94,18 @@ sub getIPMIAuth {
unless (ref $ipmihash and ref $ipmihash->{$node}) {
next;
}
if ($ipmihash->{$node}->[0]->{username}) { $authmap{$node}->{username}=$ipmihash->{$node}->[0]->{username} }
if ($ipmihash->{$node}->[0]->{password}) { $authmap{$node}->{password}=$ipmihash->{$node}->[0]->{password} }
if ($ipmihash->{$node}->[0]->{username} or $ipmihash->{$node}->[0]->{password}) {
unless($ipmihash->{$node}->[0]->{username}) {
$authmap{$node}->{username} = '';
} else {
$authmap{$node}->{username}=$ipmihash->{$node}->[0]->{username};
}
unless($ipmihash->{$node}->[0]->{password}) {
$authmap{$node}->{password} = '';
} else {
$authmap{$node}->{password}=$ipmihash->{$node}->[0]->{password};
}
}
}
return \%authmap;
}
+3 -1
View File
@@ -1392,7 +1392,9 @@ sub collect_all_attribs_for_tables_in_template
$::GLOBAL_TAB_HASH{$tabname}{$node}{$attrib} = $ent->{$node}->[0]->{$attrib};
#for noderes.xcatmaster
if ($tabname =~ /^noderes$/ && $attrib =~ /^xcatmaster$/ && ! exists($::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster}))
if ($tabname =~ /^noderes$/ && $attrib =~ /^xcatmaster$/ &&
( ! exists($::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster}) ||
$::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster} == "" ) )
{
my $value;
$value = xCAT::NetworkUtils->my_ip_facing($node);
+1
View File
@@ -115,6 +115,7 @@ sub run_remote_shell_api {
my $rc=1;
if ($t) {
#Wait for command prompt
$t->print("\t");
my ($prematch, $match) = $t->waitfor(Match => '/login[: ]*$/i',
Match => '/username[: ]*$/i',
Match => '/password[: ]*$/i',
+266 -5
View File
@@ -14,6 +14,7 @@ use xCAT::ADUtils; #to allow setting of one-time machine passwords
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::NetworkUtils;
use XML::Simple;
BEGIN
{
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
@@ -103,6 +104,13 @@ sub subvars {
$ENV{NODESTATUS}=$tmp;
}
my @managedaddressmode = xCAT::TableUtils->get_site_attribute("managedaddressmode");
my $tmp=$managedaddressmode[0];
if( defined($tmp) ){
$ENV{MANAGEDADDRESSMODE}=$tmp;
}
#replace the env with the right value so that correct include files can be found
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
@@ -229,6 +237,7 @@ sub subvars {
$inc =~ s/#CRYPT:([^:]+):([^:]+):([^#]+)#/crydb($1,$2,$3)/eg;
$inc =~ s/#COMMAND:([^#]+)#/command($1)/eg;
$inc =~ s/#KICKSTARTNET#/kickstartnetwork()/eg;
$inc =~ s/#YAST2NET#/yast2network()/eg;
$inc =~ s/#ESXIPV6SETUP#/esxipv6setup()/eg;
$inc =~ s/#WINTIMEZONE#/xCAT::TZUtils::get_wintimezone()/eg;
$inc =~ s/#WINPRODKEY:([^#]+)#/get_win_prodkey($1)/eg;
@@ -272,7 +281,9 @@ sub subvars {
my $tempstr = "%include /tmp/partitionfile\n";
$inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$tempstr/;
#modify the content in the file, and write into %pre part
$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
#$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
$partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
$partcontent .= "chmod 755 /tmp/partscript\n";
$partcontent .= "/tmp/partscript\n";
#replace the #XCA_PARTITION_SCRIPT#
@@ -282,7 +293,8 @@ sub subvars {
elsif ($inc =~ /<!-- XCAT-PARTITION-START -->/){
my $tempstr = "<drive><device>XCATPARTITIONTEMP</device></drive>";
$inc =~ s/<!-- XCAT-PARTITION-START -->[\s\S]*<!-- XCAT-PARTITION-END -->/$tempstr/;
$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
#$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
$partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
$partcontent .= "chmod 755 /tmp/partscript\n";
$partcontent .= "/tmp/partscript\n";
$inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;
@@ -651,9 +663,12 @@ sub esxipv6setup {
return 'esxcfg-vmknic -i '.$v6addr.'/64 "Management Network"'." #ESXISTATICV6\n";
}
sub kickstartnetwork {
my $line = "network --onboot=yes --bootproto=";
my $hoststab;
my $line = "network --onboot=yes --bootproto=";
my $hoststab;
my $mactab = xCAT::Table->new('mac',-create=>0);
unless ($mactab) { die "mac table should always exist prior to template processing when doing autoula"; }
my $ent = $mactab->getNodeAttribs($node,['mac'],prefetchcache=>1);
@@ -667,12 +682,258 @@ sub kickstartnetwork {
$hoststab->setNodeAttribs($node,{ip=>$ulaaddr});
$line .= $ulaaddr;
} elsif ($::XCATSITEVALS{managedaddressmode} =~ /static/) {
return "#KSNET static unsupported";
my ($ipaddr,$hostname,$gateway,$netmask)=xCAT::NetworkUtils->getNodeNetworkCfg($node);
unless($ipaddr) { die "cannot resolve the network configuration of $node"; }
if($gateway eq '<xcatmaster>'){
$gateway = xCAT::NetworkUtils->my_ip_facing($ipaddr);
}
$line .="static --device=$suffix --ip=$ipaddr --netmask=$netmask --gateway=$gateway --hostname=$hostname ";
my %nameservers=%{xCAT::NetworkUtils->getNodeNameservers([$node])};
my @nameserverARR=split (",",$nameservers{$node});
my @nameserversIP;
foreach (@nameserverARR)
{
my $ip;
if($_ eq '<xcatmaster>'){
$ip = xCAT::NetworkUtils->my_ip_facing($gateway);
}else{
(undef,$ip) = xCAT::NetworkUtils->gethostnameandip($_);
}
push @nameserversIP, $ip;
}
if (scalar @nameserversIP) {
$line .=" --nameserver=". join(",",@nameserversIP);
}
#return "#KSNET static unsupported";
} else {
$line .= "dhcp --device=$suffix";
}
return $line;
}
sub yast2network {
my $line;
my $hoststab;
my $mactab = xCAT::Table->new('mac',-create=>0);
unless ($mactab) { die "mac table should always exist prior to template processing when doing autoula"; }
my $ent = $mactab->getNodeAttribs($node,['mac'],prefetchcache=>1);
unless ($ent and $ent->{mac}) { die "missing mac data for $node"; }
my $suffix = $ent->{mac};
$suffix = lc($suffix);
if ($::XCATSITEVALS{managedaddressmode} eq "autoula") {
#TODO
return "#YAST2NET autoula unsupported"
} elsif ($::XCATSITEVALS{managedaddressmode} =~ /static/) {
my ($ipaddr,$hostname,$gateway,$netmask)=xCAT::NetworkUtils->getNodeNetworkCfg($node);
unless($ipaddr) { die "cannot resolve the network configuration of $node"; }
if($gateway eq '<xcatmaster>'){
$gateway = xCAT::NetworkUtils->my_ip_facing($ipaddr);
}
my %nameservers=%{xCAT::NetworkUtils->getNodeNameservers([$node])};
my @nameserverARR=split (",",$nameservers{$node});
my @nameserversIP;
foreach (@nameserverARR)
{
my $ip;
if($_ eq '<xcatmaster>'){
$ip = xCAT::NetworkUtils->my_ip_facing($gateway);
}else{
(undef,$ip) = xCAT::NetworkUtils->gethostnameandip($_);
}
push @nameserversIP, $ip;
}
# get the domains for each node - one call for all nodes in hosts file
my $nd = xCAT::NetworkUtils->getNodeDomains([$node]);
my %nodedomains = %$nd;
my $domain=$nodedomains{$node};
my $networkhash={
'networking' => [
{
'dns' => [
{
'domain' => [
"$domain"
],
'dhcp_hostname' => [
{
'content' => 'false',
'config:type' => 'boolean'
}
],
'dhcp_resolv' => [
{
'content' => 'false',
'config:type' => 'boolean'
}
],
'nameservers' => [
{
'config:type' => 'list',
'nameserver' => [@nameserversIP]
}
],
'hostname' => [
$hostname
],
'searchlist' => [
{
'search' => [
$domain
],
'config:type' => 'list'
}
]
}
],
'interfaces' => [
{
'interface' => [
{
'bootproto' => [
'static'
],
'startmode' => [
'onboot'
],
'netmask' => [
$netmask
],
'device' => [
'eth0'
],
'ipaddr' => [
$ipaddr
]
}
],
'config:type' => 'list'
}
],
'routing' => [
{
'ip_forward' => [
{
'content' => 'false',
'config:type' => 'boolean'
}
],
'routes' => [
{
'route' => [
{
'destination' => [
'default'
],
'gateway' => [
$gateway
],
'netmask' => [
'-'
],
'device' => [
'-'
]
}
],
'config:type' => 'list'
}
]
}
]
}
]
};
my $xml = new XML::Simple(KeepRoot => 1);
$line=$xml->XMLout($networkhash);
#return "#KSNET static unsupported";
} else {
my $networkhash={
'networking' => [
{
'dns' => [
{
'domain' => [
'local'
],
'dhcp_hostname' => [
{
'content' => 'true',
'config:type' => 'boolean'
}
],
'hostname' => [
'linux'
],
'dhcp_resolv' => [
{
'content' => 'true',
'config:type' => 'boolean'
}
]
}
],
'interfaces' => [
{
'interface' => [
{
'startmode' => [
'onboot'
],
'bootproto' => [
'dhcp'
],
'device' => [
'eth0'
]
}
],
'config:type' => 'list'
}
],
'routing' => [
{
'ip_forward' => [
{
'content' => 'false',
'config:type' => 'boolean'
}
],
'routes' => [
{
'config:type' => 'list'
}
]
}
]
}
]
};
my $xml = new XML::Simple(KeepRoot => 1);
$line=$xml->XMLout($networkhash);
}
return $line;
}
sub autoulaaddress {
my $suffix = shift;
my $prefix = $::XCATSITEVALS{autoulaprefix};
+64
View File
@@ -10,6 +10,7 @@ use xCAT::Table;
use xCAT::MsgUtils;
use Data::Dumper;
use xCAT::NodeRange;
use xCAT::Utils;
#--------------------------------------------------------------------------------
=head1 xCAT::XCATD
@@ -270,4 +271,67 @@ sub validate {
xCAT::MsgUtils->message("S","Request matched no policy rule: peername=$peername, peerhost=$peerhost ".$request->{command}->[0]);
return 0;
}
my $tokentimeout = 86400; # one day
# this subroutine search the token table
# 1. find the existed token entry for the user and reset the expire time
# 1.1. if not find existed token, create a new one and add it to token table
# 2. clean up the expired token
#
# this subroutine is called after the account has been authorized
sub gettoken {
my $class=shift;
my $req = shift;
my $user = $req->{gettoken}->[0]->{username}->[0];
my $tokentb = xCAT::Table->new('token');
unless ($tokentb) {
return undef;
}
my $tokens = $tokentb->getAllEntries;
my $expiretime = time() + $tokentimeout;
foreach my $token (@{$tokens}) {
if ($token->{username} eq $user) {
#delete old token
$tokentb->delEntries({'tokenid'=>$token->{tokenid}});
} else {
#clean the expired token
if ($token->{expire} > $expiretime) {
$tokentb->delEntries({'tokenid'=>$token->{tokenid}});
}
}
}
# create a new token for this request
my $uuid = xCAT::Utils->genUUID();
$tokentb->setAttribs({tokenid=>$uuid, username => $user}, {expire => $expiretime});
$tokentb->close();
return ($uuid, $expiretime);
}
# verify the token has correct entry in token table and expire time is not exceeded.
sub verifytoken {
my $class=shift;
my $req = shift;
my $tokenid = $req->{tokens}->[0]->{tokenid}->[0];
my $tokentb = xCAT::Table->new('token');
unless ($tokentb) {
return undef;
}
my $token = $tokentb->getAttribs({'tokenid' => $tokenid}, ('username', 'expire'));
if (defined ($token) && defined ($token->{'username'}) && defined ($token->{'expire'})) {
my $expiretime = time() + $tokentimeout;
if ($token->{'expire'} < time()) {
$tokentb->delEntries({'tokenid'=>$token->{tokenid}});
return undef;
} else {
return $token->{'username'};
}
} else {
return undef;
}
}
1;
+3
View File
@@ -587,9 +587,11 @@ sub setup_DHCP
# setup DHCP
#
# clean up $::opt_n which set by last makedhcp context and conlicts with -a below.
undef $::opt_n;
my $modname = "dhcp";
if ($snonly != 1) { # setup dhcp for all nodes
$cmdref;
@@ -1213,6 +1215,7 @@ sub setup_TFTP
push @{$netmethods{$hmhash{$_}->[0]->{netboot}}}, $_;
}
}
$::DISABLENODESETWARNING=1; # stop the warnings about using install/netboot etc
$cmdref->{command}->[0] = "nodeset";
$cmdref->{inittime}->[0] = "1";
$cmdref->{arg}->[0] = "enact";
+29 -14
View File
@@ -379,8 +379,7 @@ sub parse_attr_for_osimage{
sub processArgs
{
my $gotattrs = 0;
if (defined(@{$::args})) {
if ( defined ($::args) && @{$::args} ) {
@ARGV = @{$::args};
} else {
if ($::command eq "lsdef") {
@@ -391,8 +390,9 @@ sub processArgs
return 2;
}
}
if ( scalar(@{$::args}) eq 1 and $::args->[0] eq '-S')
{
if ( defined ($::args) && @{$::args} ) {
if ( scalar(@{$::args}) eq 1 and $::args->[0] eq '-S')
{
if ($::command eq "lsdef") {
push @ARGV, "-t";
push @ARGV, "node";
@@ -400,6 +400,7 @@ sub processArgs
} else {
return 2;
}
}
}
if ($::command eq "lsdef") {
@@ -2463,15 +2464,21 @@ sub defch
# give results
my $rsp;
$rsp->{data}->[0] =
"The database was updated for the following objects:";
xCAT::MsgUtils->message("I", $rsp, $::callback);
my $nodenum = scalar(keys %::FINALATTRS);
if ($nodenum) {
$rsp->{data}->[0] =
"The database was updated for the following objects:";
xCAT::MsgUtils->message("I", $rsp, $::callback);
my $n = 1;
foreach my $o (sort(keys %::FINALATTRS))
{
$rsp->{data}->[$n] = "$o\n";
$n++;
my $n = 1;
foreach my $o (sort(keys %::FINALATTRS))
{
$rsp->{data}->[$n] = "$o\n";
$n++;
}
} else {
$rsp->{data}->[0] =
"No database was updated";
}
xCAT::MsgUtils->message("I", $rsp, $::callback);
}
@@ -2479,8 +2486,13 @@ sub defch
{
my $rsp;
my $nodenum = scalar(keys %::FINALATTRS);
$rsp->{data}->[0] =
"$nodenum object definitions have been created or modified.";
if ($nodenum) {
$rsp->{data}->[0] =
"$nodenum object definitions have been created or modified.";
} else {
$rsp->{data}->[0] =
"No object definitions have been created or modified.";
}
xCAT::MsgUtils->message("I", $rsp, $::callback);
if (scalar(keys %newobjects) > 0)
{
@@ -2628,6 +2640,9 @@ sub setFINALattrs
{
# special case for the nic* attributes
# merge nic*.eth0, nic*.eth1
unless(exists($::CLIATTRS{$objname})) {
next;
}
if ($::CLIATTRS{$objname}{objtype} eq 'node')
{
# Even if only the nicips.eth0 is specified with CLI,
+1 -2
View File
@@ -232,8 +232,7 @@ sub parse_args
my $args = $request->{arg};
my $gotattrs = 0;
my %opt =();
if (defined(@{$args})) {
if ( defined ($args) && @{$args}) {
@ARGV = @{$args};
} else {
return 2;
+21 -14
View File
@@ -154,6 +154,13 @@ sub preprocess_request
# - either the NIMprime attr of the site table or the management node
my $nimprime = xCAT::InstUtils->getnimprime();
chomp $nimprime;
if (!defined($nimprime))
{
my $rsp={};
$rsp->{error}->[0] = "Could not determine nimprime. Check if nimprime defined in site table or site table master is not resolvable to the MN name.";
xCAT::MsgUtils->message("E", $rsp, $cb,1);
return undef;
}
my $nimprimeip = xCAT::NetworkUtils->getipaddr($nimprime);
if ($nimprimeip =~ /:/) #IPv6
{
@@ -617,7 +624,7 @@ sub nimnodeset
my $Sname = xCAT::InstUtils->myxCATname();
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -1793,7 +1800,7 @@ sub chkosimage
my $image_name;
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -2260,7 +2267,7 @@ sub mknimimage
my $dump_name;
my $install_dir = xCAT::TableUtils->getInstallDir();
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -4233,7 +4240,7 @@ sub mk_spot
if ($::RUNCMD_RC != 0)
{
my $rsp;
push @{$rsp->{data}}, " The cpcosi command failed. \n$output\n";
push @{$rsp->{data}}, " The cpcosi command failed. \n$output\n";
push @{$rsp->{data}},
"Could not create a NIM definition for \'$spot_name\'.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
@@ -5698,7 +5705,7 @@ sub prermnimimage
my @servicenodes = (); # pass back list of service nodes
my %imagedef; # pass back image def hash
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -6208,7 +6215,7 @@ sub rmnimimage
%allsn = %{$nodehash};
}
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -7815,7 +7822,7 @@ sub prenimnodecust
@nodelist = @$nodes;
}
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -8053,7 +8060,7 @@ sub nimnodecust
@nodelist = @$nodes;
}
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -8210,7 +8217,7 @@ sub prenimnodeset
my $subreq = shift;
my $error = 0;
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -9937,7 +9944,7 @@ sub define_SN_resource
}
my %attrs;
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -10976,7 +10983,7 @@ sub mkdsklsnode
# - just set global for now
$::callback = $callback;
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -12986,7 +12993,7 @@ sub make_SN_resource
}
my %attrs;
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -13646,7 +13653,7 @@ sub prermdsklsnode
{
my $callback = shift;
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
@@ -13756,7 +13763,7 @@ sub rmdsklsnode
# - just set global for now
$::callback = $callback;
if (defined(@{$::args}))
if ( defined ($::args) && @{$::args} )
{
@ARGV = @{$::args};
}
+71 -8
View File
@@ -40,7 +40,7 @@ sub handled_commands
return {
copycd => "anaconda",
mknetboot => "nodetype:os=(^ol[0-9].*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)",
mkinstall => "nodetype:os=(esxi4.1)|(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)",
mkinstall => "nodetype:os=(pkvm.*)|(esxi4.1)|(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)",
mksysclone => "nodetype:os=(esxi4.1)|(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)",
mkstatelite => "nodetype:os=(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)",
@@ -257,6 +257,7 @@ sub mknetboot
my $site_ent = $ents[0];
if (!defined($site_ent) || ($site_ent =~ /no/i) || ($site_ent =~ /0/))
{
if (!defined($::DISABLENODESETWARNING)) { # set by AAsn.pm
$callback->(
{
warning => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated. They should continue to work in this release, but have not been tested as carefully, and some new functions are not available with these options. For full function and support, use \"nodeset <noderange> osimage=<osimage_name>\" instead."],
@@ -264,6 +265,7 @@ sub mknetboot
);
# Do not print this warning message multiple times
last;
}
}
}
}
@@ -930,10 +932,6 @@ sub mknetboot
);
}
#my $rc = xCAT::TableUtils->create_postscripts_tar();
#if ( $rc != 0 ) {
# xCAT::MsgUtils->message( "S", "Error creating postscripts tar file." );
#}
}
sub mkinstall
@@ -1001,6 +999,7 @@ sub mkinstall
my $site_ent = $ents[0];
if (!defined($site_ent) || ($site_ent =~ /no/i) || ($site_ent =~ /0/))
{
if (!defined($::DISABLENODESETWARNING)) { # set by AAsn.pm
$callback->(
{
warning => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated. They should continue to work in this release, but have not been tested as carefully, and some new functions are not available with these options. For full function and support, use \"nodeset <noderange> osimage=<osimage_name>\" instead."],
@@ -1008,6 +1007,7 @@ sub mkinstall
);
# Do not print this warning message multiple times
last;
}
}
}
}
@@ -1287,7 +1287,11 @@ sub mkinstall
my $kernpath;
my $initrdpath;
my $maxmem;
my $esxi = 0;
my $esxi = 0;
my $pkvm = 0;
if ($os =~ /^pkvm/) {
$pkvm = 1;
}
if (
(
@@ -1377,17 +1381,28 @@ sub mkinstall
$instserver=$ent->{nfsserver};
}
if ($::XCATSITEVALS{managedaddressmode} =~ /static/){
unless($instserver eq '!myipfn!'){
my($host,$ip)=xCAT::NetworkUtils->gethostnameandip($instserver);
$instserver=$ip;
}
}
my $httpprefix=$pkgdir;
if ($installroot =~ /\/$/) {
$httpprefix =~ s/^$installroot/\/install\//;
} else {
$httpprefix =~ s/^$installroot/\/install/;
}
my $kcmdline =
"quiet repo=$httpmethod://$instserver:$httpport$httpprefix ks=$httpmethod://"
my $kcmdline;
if ($pkvm) {
$kcmdline = "ksdevice=bootif kssendmac text selinux=0 rd.dm=0 rd.md=0 repo=$httpmethod://$instserver:$httpport$httpprefix/packages/ kvmp.inst.auto=$httpmethod://$instserver:$httpport/install/autoinst/$node root=live:$httpmethod://$instserver:$httpport$httpprefix/LiveOS/squashfs.img";
} else {
$kcmdline ="quiet repo=$httpmethod://$instserver:$httpport$httpprefix ks=$httpmethod://"
. $instserver . ":". $httpport
. "/install/autoinst/"
. $node;
}
if ($maxmem) {
$kcmdline.=" mem=$maxmem";
}
@@ -1437,6 +1452,48 @@ sub mkinstall
unless ($ksdev eq "bootif" and $os =~ /7/) {
$kcmdline .= " ksdevice=" . $ksdev;
}
#if site.managedaddressmode=static, specify the network configuration as kernel options
#to avoid multicast dhcp
if($::XCATSITEVALS{managedaddressmode} =~ /static/){
my ($ipaddr,$hostname,$gateway,$netmask)=xCAT::NetworkUtils->getNodeNetworkCfg($node);
unless($ipaddr) {
$callback->(
{
error => [
"cannot resolve the ip address of $node"
],
errorcode => [1]
}
);
}
if($gateway eq '<xcatmaster>'){
$gateway = xCAT::NetworkUtils->my_ip_facing($ipaddr);
}
$kcmdline .=" ip=$ipaddr netmask=$netmask gateway=$gateway hostname=$hostname ";
my %nameservers=%{xCAT::NetworkUtils->getNodeNameservers([$node])};
my @nameserverARR=split (",",$nameservers{$node});
my @nameserversIP;
foreach (@nameserverARR)
{
my $ip;
if($_ eq '<xcatmaster>'){
$ip = xCAT::NetworkUtils->my_ip_facing($gateway);
}else{
(undef,$ip) = xCAT::NetworkUtils->gethostnameandip($_);
}
push @nameserversIP, $ip;
}
if(scalar @nameserversIP){
$kcmdline .=" dns=".join(",",@nameserversIP);
}
}
#TODO: dd=<url> for driver disks
if (defined($sent->{serialport}))
@@ -1482,6 +1539,9 @@ sub mkinstall
foreach(@addfiles){
$kcmdline .= " --- $rtftppath/$_";
}
}elsif ($pkvm) {
$k = "$httpmethod://$instserver:$httpport$tftppath/vmlinuz";
$i = "$httpmethod://$instserver:$httpport$tftppath/initrd.img";
}else{
$k = "$rtftppath/vmlinuz";
$i = "$rtftppath/initrd.img";
@@ -1577,6 +1637,7 @@ sub mksysclone
my $site_ent = $ents[0];
if (!defined($site_ent) || ($site_ent =~ /no/i) || ($site_ent =~ /0/))
{
if (!defined($::DISABLENODESETWARNING)) { # set by AAsn.pm
$callback->(
{
warning => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated. They should continue to work in this release, but have not been tested as carefully, and some new functions are not available with these options. For full function and support, use \"nodeset <noderange> osimage=<osimage_name>\" instead."],
@@ -1584,6 +1645,7 @@ sub mksysclone
);
# Do not print this warning message multiple times
last;
}
}
}
}
@@ -1987,6 +2049,7 @@ sub copycd
and $distname !~ /^fedora/
and $distname !~ /^SL/
and $distname !~ /^ol/
and $distname !~ /^pkvm/
and $distname !~ /^rh/)
{
+6
View File
@@ -43,6 +43,7 @@ sub process_request {
my $path=undef;
my $noosimage=undef;
my $nonoverwrite=undef;
my $specific=undef;
$identified=0;
$::CDMOUNTPATH="/var/run/xcat/mountpoint";
@@ -58,6 +59,7 @@ sub process_request {
'i|inspection' => \$inspection,
'p|path=s' => \$path,
'o|noosimage' => \$noosimage,
's|specific' => \$specific,
'w|nonoverwrite' => \$nonoverwrite,
);
if ($help) {
@@ -143,6 +145,10 @@ sub process_request {
{
push @{$newreq->{arg}},("-p",$path);
}
if($specific)
{
push @{$newreq->{arg}},("-s");
}
if($inspection)
{
+187 -186
View File
@@ -51,7 +51,7 @@ sub getzonesfornet {
die "Not supporting having a mask like $mask on an ipv6 network like $net";
}
my $netnum= getipaddr($net,GetNumber=>1);
unless ($netnum) { return (); }
unless ($netnum) { return (); }
$netnum->brsft(128-$maskbits);
my $prefix=$netnum->as_hex();
my $nibbs=$maskbits/4;
@@ -229,7 +229,7 @@ sub process_request {
}
}
if ($::XCATSITEVALS{externaldns}) {
$external=1;
$external=1;
}
if ($help)
@@ -325,73 +325,73 @@ sub process_request {
if ($allnodes) {
#read all nodelist specified nodes
} else {
if (not $request->{node} and $deletemode) {
#when this was permitted, it really ruined peoples' days
xCAT::SvrUtils::sendmsg([1,"makedns -d without noderange or -a is not supported"],$callback);
umask($oldmask);
return;
}
my @contents;
my $domain;
if ($request->{node}) { #leverage makehosts code to flesh out the options
require xCAT_plugin::hosts;
my @content1;
my @content2;
xCAT_plugin::hosts::add_hosts_content(nodelist=>$request->{node},callback=>$callback,hostsref=>\@content1);
xCAT_plugin::hosts::donics(nodes=>$request->{node},callback=>$callback,hostsref=>\@content2);
if (not $request->{node} and $deletemode) {
#when this was permitted, it really ruined peoples' days
xCAT::SvrUtils::sendmsg([1,"makedns -d without noderange or -a is not supported"],$callback);
umask($oldmask);
return;
}
my @contents;
my $domain;
if ($request->{node}) { #leverage makehosts code to flesh out the options
require xCAT_plugin::hosts;
my @content1;
my @content2;
xCAT_plugin::hosts::add_hosts_content(nodelist=>$request->{node},callback=>$callback,hostsref=>\@content1);
xCAT_plugin::hosts::donics(nodes=>$request->{node},callback=>$callback,hostsref=>\@content2);
@contents = (@content1, @content2);
} else {
#legacy behavior, read from /etc/hosts
my $hostsfile;
open($hostsfile,"<","/etc/hosts");
flock($hostsfile,LOCK_SH);
@contents = <$hostsfile>;
flock($hostsfile,LOCK_UN);
close($hostsfile);
}
} else {
#legacy behavior, read from /etc/hosts
my $hostsfile;
open($hostsfile,"<","/etc/hosts");
flock($hostsfile,LOCK_SH);
@contents = <$hostsfile>;
flock($hostsfile,LOCK_UN);
close($hostsfile);
}
my $addr;
my $name;
my $canonical;
my $aliasstr;
my @aliases;
my $names;
my @hosts;
my %nodehash;
my @hosts;
my %nodehash;
foreach (@contents) {
chomp; #no newline
s/#.*//; #strip comments;
s/^[ \t\n]*//; #remove leading whitespace
next unless ($_); #skip empty lines
($addr,$names) = split /[ \t]+/,$_,2;
chomp; #no newline
s/#.*//; #strip comments;
s/^[ \t\n]*//; #remove leading whitespace
next unless ($_); #skip empty lines
($addr,$names) = split /[ \t]+/,$_,2;
if ($addr !~ /^\d+\.\d+\.\d+\.\d+$/ and $addr !~ /^[abcdef0123456789:]+$/) {
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, address seems malformed.", $callback);
next;
}
unless ($names =~ /^[a-z0-9\. \t\n-]+$/i) {
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, names $names contain invalid characters (valid characters include a through z, numbers and the '-', but not '_'", $callback);
next;
}
my ($host, $ip) = xCAT::NetworkUtils->gethostnameandip($addr);
push @hosts, $host;
$nodehash{$addr}{names}=$names;
$nodehash{$addr}{host}=$host;
}
if ($addr !~ /^\d+\.\d+\.\d+\.\d+$/ and $addr !~ /^[abcdef0123456789:]+$/) {
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, address seems malformed.", $callback);
next;
}
unless ($names =~ /^[a-z0-9\. \t\n-]+$/i) {
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, names $names contain invalid characters (valid characters include a through z, numbers and the '-', but not '_'", $callback);
next;
}
my ($host, $ip) = xCAT::NetworkUtils->gethostnameandip($addr);
push @hosts, $host;
$nodehash{$addr}{names}=$names;
$nodehash{$addr}{host}=$host;
}
# get the domains for each node - one call for all nodes in hosts file
my $nd = xCAT::NetworkUtils->getNodeDomains(\@hosts);
my %nodedomains = %$nd;
foreach my $n (keys %nodehash) {
$addr=$n;
$names=$nodehash{$n}{names};
# - need domain for this node
my $host = $nodehash{$n}{host};
$domain=$nodedomains{$host};
# remove the first . at domain name since it's not accepted by high dns parser
if ($domain =~ /^\./) { $domain =~ s/^\.//;; }
# get the domains for each node - one call for all nodes in hosts file
my $nd = xCAT::NetworkUtils->getNodeDomains(\@hosts);
my %nodedomains = %$nd;
foreach my $n (keys %nodehash) {
$addr=$n;
$names=$nodehash{$n}{names};
# - need domain for this node
my $host = $nodehash{$n}{host};
$domain=$nodedomains{$host};
# remove the first . at domain name since it's not accepted by high dns parser
if ($domain =~ /^\./) { $domain =~ s/^\.//;; }
($canonical,$aliasstr) = split /[ \t]+/,$names,2;
if ($aliasstr) {
@@ -407,7 +407,7 @@ sub process_request {
unless ($canonical =~ /$domain/) {
$canonical.=".".$domain;
}
# for only the sake of comparison, ensure consistant dot suffix
# for only the sake of comparison, ensure consistant dot suffix
unless ($canonical =~ /\.\z/) { $canonical .= '.' }
foreach my $alias (@aliases) {
unless ($alias =~ /$domain/) {
@@ -419,13 +419,13 @@ sub process_request {
if ($alias eq $canonical) {
next;
}
# remember alias for CNAM records later
# remember alias for CNAM records later
$ctx->{aliases}->{$node}->{$alias}=1;
}
# exclude the nodes not belong to any nets defined in networks table
# because only the nets defined in networks table will be add
# zones later.
# zones later.
my $found = 0;
foreach (@networks)
{
@@ -508,13 +508,13 @@ sub process_request {
$ctx->{domain} =~ s/^\.//; # remove . if it's the first char of domain name
$ctx->{zonestotouch}->{$ctx->{domain}}=1;
foreach (@networks) {
if ($_->{domain}) {
$_->{domain} =~ s/^\.//; # remove . if it's the first char of domain name
$ctx->{zonestotouch}->{$_->{domain}}=1;
}
}
foreach (@networks) {
if ($_->{domain}) {
$_->{domain} =~ s/^\.//; # remove . if it's the first char of domain name
$ctx->{zonestotouch}->{$_->{domain}}=1;
}
}
xCAT::SvrUtils::sendmsg("Getting reverse zones, this may take several minutes for a large cluster.", $callback);
foreach (@nodes) {
@@ -528,10 +528,10 @@ sub process_request {
xCAT::SvrUtils::sendmsg("Completed getting reverse zones.", $callback);
if (1) {
#TODO: function to detect and return 1 if the master server is
# DNS SOA for all the zones we care about here, we are examining
#TODO: function to detect and return 1 if the master server is
# DNS SOA for all the zones we care about here, we are examining
# files to assure that our key is in named.conf, the zones we
# care about are there, and that if active directory is in use,
# care about are there, and that if active directory is in use,
# allow the domain controllers to update specific zones
@entries = xCAT::TableUtils->get_site_attribute("directoryprovider");
$site_entry = $entries[0];
@@ -541,13 +541,13 @@ sub process_request {
if ( defined($site_entry)) {
my @dservers = split /[ ,]/,$site_entry;
$ctx->{adservers} = \@dservers;
############################
# - should this include all domains?
# - multi-domains not supported with activedirectory
# - TODO in future release
###################
############################
# - should this include all domains?
# - multi-domains not supported with activedirectory
# - TODO in future release
###################
$ctx->{adzones} = {
"_msdcs.". $ctx->{domain} => 1,
"_sites.". $ctx->{domain} => 1,
@@ -556,51 +556,51 @@ sub process_request {
};
}
}
@entries = xCAT::TableUtils->get_site_attribute("dnsupdaters");
$site_entry = $entries[0];
if ( defined($site_entry) ) {
my @nservers = split /[ ,]/,$site_entry;
$ctx->{dnsupdaters} = \@nservers;
my @nservers = split /[ ,]/,$site_entry;
$ctx->{dnsupdaters} = \@nservers;
}
unless ($external) {
if ($zapfiles || $slave) { #here, we unlink all the existing files to start fresh
if (xCAT::Utils->isAIX())
{
system("/usr/bin/stopsrc -s $service");
}
else
{
system("service $service stop"); #named may otherwise hold on to stale journal filehandles
}
my $conf = get_conf();
unlink $conf;
my $DBDir = get_dbdir();
foreach (<$DBDir/db.*>) {
unlink $_;
}
}
#We manipulate local namedconf
$ctx->{dbdir} = get_dbdir();
$ctx->{zonesdir} = get_zonesdir();
chmod 0775, $ctx->{dbdir}; # assure dynamic dns can actually execute against the directory
update_namedconf($ctx, $slave);
unless ($slave)
unless ($external) { # only generate the named.conf and zone files for xCAT dns when NOT using external dns
if ($zapfiles || $slave) { #here, we unlink all the existing files to start fresh
if (xCAT::Utils->isAIX())
{
update_zones($ctx);
system("/usr/bin/stopsrc -s $service");
}
else
{
system("service $service stop"); #named may otherwise hold on to stale journal filehandles
}
my $conf = get_conf();
unlink $conf;
my $DBDir = get_dbdir();
foreach (<$DBDir/db.*>) {
unlink $_;
}
}
#We manipulate local namedconf
$ctx->{dbdir} = get_dbdir();
$ctx->{zonesdir} = get_zonesdir();
chmod 0775, $ctx->{dbdir}; # assure dynamic dns can actually execute against the directory
update_namedconf($ctx, $slave);
unless ($slave)
{
update_zones($ctx);
}
if ($ctx->{restartneeded}) {
xCAT::SvrUtils::sendmsg("Restarting $service", $callback);
if ($ctx->{restartneeded}) {
xCAT::SvrUtils::sendmsg("Restarting $service", $callback);
if (xCAT::Utils->isAIX())
{
#try to stop named
my $cmd = "/usr/bin/stopsrc -s $service";
my @output=xCAT::Utils->runcmd($cmd, 0);
$cmd = "/usr/bin/startsrc -s $service";
@output=xCAT::Utils->runcmd($cmd, 0);
my $outp = join('', @output);
@@ -624,7 +624,7 @@ sub process_request {
xCAT::MsgUtils->message("E", $rsp, $callback);
return;
}
$cmd = "service $service start";
@output=xCAT::Utils->runcmd($cmd, 0);
$outp = join('', @output);
@@ -636,56 +636,57 @@ sub process_request {
return;
}
}
xCAT::SvrUtils::sendmsg("Restarting named complete", $callback);
}
}
xCAT::SvrUtils::sendmsg("Restarting named complete", $callback);
}
}
} else {
unless ($ctx->{privkey}) {
xCAT::SvrUtils::sendmsg([1,"Unable to update DNS due to lack of credentials in passwd to communicate with remote server"], $callback);
}
}
if ($slave)
{
return;
}
# check if named is active before update dns records.
if (xCAT::Utils->isAIX())
{
my $cmd = "/usr/bin/lssrc -s $service |grep active";
my @output=xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
unless ($external) { # only start xCAT local dns when NOT using external dns
if (xCAT::Utils->isAIX())
{
$cmd = "/usr/bin/startsrc -s $service";
@output=xCAT::Utils->runcmd($cmd, 0);
my $outp = join('', @output);
my $cmd = "/usr/bin/lssrc -s $service |grep active";
my @output=xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
return;
$cmd = "/usr/bin/startsrc -s $service";
@output=xCAT::Utils->runcmd($cmd, 0);
my $outp = join('', @output);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
return;
}
}
}
}
else
{
my $cmd = "service $service status|grep running";
my @output=xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
else
{
$cmd = "service $service start";
@output=xCAT::Utils->runcmd($cmd, 0);
my $outp = join('', @output);
my $cmd = "service $service status|grep running";
my @output=xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
return;
$cmd = "service $service start";
@output=xCAT::Utils->runcmd($cmd, 0);
my $outp = join('', @output);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
return;
}
}
}
}
@@ -693,12 +694,12 @@ sub process_request {
#now we stick to Net::DNS style updates, with TSIG if possible. TODO: kerberized (i.e. Windows) DNS server support, maybe needing to use nsupdate -g....
if ($external)
{
# based on /etc/resolv.conf
# based on /etc/resolv.conf
$ctx->{resolver} = Net::DNS::Resolver->new();
}
else
{
# default to localhost
# default to localhost
$ctx->{resolver} = Net::DNS::Resolver->new(nameservers=>['127.0.0.1']);
}
@@ -716,9 +717,9 @@ sub get_zonesdir {
my @entries = xCAT::TableUtils->get_site_attribute("bindzones");
my $site_entry = $entries[0];
if ( defined($site_entry) ) {
$ZonesDir= $site_entry;
}
if ( defined($site_entry) ) {
$ZonesDir= $site_entry;
}
return "$ZonesDir";
}
@@ -727,16 +728,16 @@ sub get_conf {
my $conf="/etc/named.conf";
# is this ubuntu ?
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
$conf="/etc/bind/named.conf";
}
my @entries = xCAT::TableUtils->get_site_attribute("bindconf");
my $site_entry = $entries[0];
if ( defined($site_entry) ) {
$conf= $site_entry;
}
if ( defined($site_entry) ) {
$conf= $site_entry;
}
return "$conf";
}
@@ -746,9 +747,9 @@ sub get_dbdir {
my @entries = xCAT::TableUtils->get_site_attribute("binddir");
my $site_entry = $entries[0];
if ( defined($site_entry) ) {
$DBDir = $site_entry;
}
if ( defined($site_entry) ) {
$DBDir = $site_entry;
}
if ( -d "$DBDir" ) {
return "$DBDir"
@@ -789,13 +790,13 @@ sub update_zones {
my $name = hostname;
my $node = $name;
# get the domain for the node - which is the local hostname
my ($host, $nip) = xCAT::NetworkUtils->gethostnameandip($node);
my @hosts;
push (@hosts, $host);
my $nd = xCAT::NetworkUtils->getNodeDomains(\@hosts);
my %nodedomains = %$nd;
my $domain = $nodedomains{$host};
# get the domain for the node - which is the local hostname
my ($host, $nip) = xCAT::NetworkUtils->gethostnameandip($node);
my @hosts;
push (@hosts, $host);
my $nd = xCAT::NetworkUtils->getNodeDomains(\@hosts);
my %nodedomains = %$nd;
my $domain = $nodedomains{$host};
xCAT::SvrUtils::sendmsg("Updating zones.", $callback);
@@ -829,7 +830,7 @@ sub update_zones {
my $serial = ($mday * 100) + (($mon + 1) * 10000) + (($year + 1900) * 1000000);
foreach $currzone (@neededzones) {
my $zonefilename = $currzone;
my $zonefilename = $currzone;
if ($currzone =~ /IN-ADDR\.ARPA/) {
$currzone =~ s/\.IN-ADDR\.ARPA.*//;
my @octets = split/\./,$currzone;
@@ -853,7 +854,7 @@ sub update_zones {
}
flock($zonehdl,LOCK_UN);
close($zonehdl);
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
chown(scalar(getpwnam('root')),scalar(getgrnam('bind')),$dbdir."/db.$zonefilename");
}
else{
@@ -889,7 +890,7 @@ sub update_namedconf {
$gotoptions=1;
my $skip=0;
do {
#push @newnamed,"\t\t//listen-on-v6 { any; };\n";
#push @newnamed,"\t\t//listen-on-v6 { any; };\n";
if ($ctx->{forwarders} and $line =~ /forwarders {/) {
push @newnamed,"\tforwarders \{\n";
$skip=1;
@@ -1005,11 +1006,11 @@ sub update_namedconf {
}
}
unless ($gotoptions) {
push @newnamed,"options {\n";
push @newnamed,"options {\n";
unless ($slave && xCAT::Utils->isLinux()) {
push @newnamed,"\tdirectory \"".$ctx->{zonesdir}."\";\n";
}
push @newnamed,"\t\t//listen-on-v6 { any; };\n";
push @newnamed,"\t\t//listen-on-v6 { any; };\n";
if ($ctx->{forwarders}) {
push @newnamed,"\tforwarders {\n";
foreach (@{$ctx->{forwarders}}) {
@@ -1128,7 +1129,7 @@ sub update_namedconf {
for my $l (@newnamed) { print $newnameconf $l; }
flock($newnameconf,LOCK_UN);
close($newnameconf);
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
chown (scalar(getpwnam('root')),scalar(getgrnam('bind')),$namedlocation);
}
else{
@@ -1156,9 +1157,9 @@ sub add_or_delete_records {
$ctx->{nsmap} = {}; #will store a map to known NS records to avoid needless redundant queries to sort nodes into domains
$ctx->{updatesbyzone}={}; #sort all updates into their respective zones for bulk update for fewer DNS transactions
# get node domains
my $nd = xCAT::NetworkUtils->getNodeDomains(\@{$ctx->{nodes}});
my %nodedomains = %{$nd};
# get node domains
my $nd = xCAT::NetworkUtils->getNodeDomains(\@{$ctx->{nodes}});
my %nodedomains = %{$nd};
foreach $node (@{$ctx->{nodes}}) {
my $name = $node;
@@ -1168,8 +1169,8 @@ sub add_or_delete_records {
next;
}
my $domain = $nodedomains{$node};
if ($domain =~ /^\./) { $domain =~ s/^\.//; } # remove . if it's the first char of domain name
my $domain = $nodedomains{$node};
if ($domain =~ /^\./) { $domain =~ s/^\.//; } # remove . if it's the first char of domain name
unless ($name =~ /$domain/) { $name .= ".".$domain } # $name needs to represent fqdn, but must preserve $node as a nodename for cfg lookup
@@ -1177,9 +1178,9 @@ sub add_or_delete_records {
@ips = ($ctx->{hoststab}->{$node}->[0]->{ip});
} else {
@ips = getipaddr($node,GetAllAddresses=>1);
if (not @ips and keys %{$ctx->{nodeips}->{$node}}) {
@ips = keys %{$ctx->{nodeips}->{$node}};
}
if (not @ips and keys %{$ctx->{nodeips}->{$node}}) {
@ips = keys %{$ctx->{nodeips}->{$node}};
}
if (!defined($ips[0])) {
xCAT::SvrUtils::sendmsg([1,"Unable to find an IP for $node in hosts table or via system lookup (i.e. /etc/hosts)"], $callback);
next;
@@ -1214,7 +1215,7 @@ sub add_or_delete_records {
}
my $zone;
foreach $zone (keys %{$ctx->{updatesbyzone}}) {
my $ip = xCAT::NetworkUtils->getipaddr($ctx->{nsmap}->{$zone});
my $ip = xCAT::NetworkUtils->getipaddr($ctx->{nsmap}->{$zone});
if( !defined $ip) {
xCAT::SvrUtils::sendmsg([1,"Please make sure $ctx->{nsmap}->{$zone} exist either in /etc/hosts or DNS."], $callback);
return 1;
@@ -1296,9 +1297,9 @@ sub find_nameserver_for_dns {
}
if (defined $ctx->{aliases}->{$node}) {
foreach (keys %{$ctx->{aliases}->{$node}}) {
push @rrcontent, "$_ IN CNAME $name";
}
foreach (keys %{$ctx->{aliases}->{$node}}) {
push @rrcontent, "$_ IN CNAME $name";
}
}
if ($ctx->{deletemode}) {
push @rrcontent,"$name TXT";
@@ -1311,7 +1312,7 @@ sub find_nameserver_for_dns {
unless (defined $ctx->{nsmap}->{$zone}) { #ok, we already thought about this zone and made a decision
if ($zone =~ /^\.*192.IN-ADDR.ARPA\.*/ or $zone =~ /^\.*172.IN-ADDR.ARPA\.*/ or $zone =~ /127.IN-ADDR.ARPA\.*/ or $zone =~ /^\.*IN-ADDR.ARPA\.*/ or $zone =~ /^\.*ARPA\.*/) {
$ctx->{nsmap}->{$zone} = 0; #ignore zones that are likely to appear, but probably not ours
} elsif ($::XCATSITEVALS{ddnsserver}) {
} elsif ($::XCATSITEVALS{ddnsserver}) {
$ctx->{nsmap}->{$zone} = $::XCATSITEVALS{ddnsserver};
} else {
my $reply = $ctx->{resolver}->query($zone,'NS');
@@ -1392,9 +1393,9 @@ sub get_dns_slave
foreach my $sn (@ents)
{
if ($sn->{'nameserver'} == 2)
{
{
push @sns, $sn->{'node'};
}
}
}
@slaves = xCAT::NodeRange::noderange(join(',',@sns));
+20 -1
View File
@@ -663,6 +663,11 @@ sub mkinstall
my $prescript = "$::XCATROOT/share/xcat/install/scripts/pre.$platform";
my $postscript = "$::XCATROOT/share/xcat/install/scripts/post.$platform";
# for powerkvm VM ubuntu LE#
if ($arch =~ /ppc64/i and $platform eq "ubuntu") {
$prescript = "$::XCATROOT/share/xcat/install/scripts/pre.$platform.ppc64";
}
if (-r "$prescript"){
$preerr =
@@ -687,6 +692,12 @@ sub mkinstall
$callback->({node =>[{name => [$node], error => [$errtmp], errorcode => [1]}]});
next;
}
if ($arch =~ /ppc64/i and !(-e "$pkgdir/install/netboot/initrd.gz")) {
$callback->({error => ["The netboot initrd not found in $pkgdir/install/netboot, pls download first"],
errorcode=>[1]});
next;
}
my $tftpdir = "/tftpboot";
# create the node-specific post scripts
@@ -697,7 +708,7 @@ sub mkinstall
if (
(
$arch =~ /x86/ and
($arch =~ /x86/ and
(
( -r "$pkgdir/install/netboot/ubuntu-installer/$darch/linux"
and $kernpath = "$pkgdir/install/netboot/ubuntu-installer/$darch/linux"
@@ -710,6 +721,14 @@ sub mkinstall
and $initrdpath = "$pkgdir/install/netboot/initrd.gz"
)
)
) or (
$arch =~ /ppc64/i and (
-r "$pkgdir/install/vmlinux"
and $kernpath = "$pkgdir/install/vmlinux"
and -r "$pkgdir/install/netboot/initrd.gz"
and $initrdpath = "$pkgdir/install/netboot/initrd.gz"
)
)
)
){
+19 -3
View File
@@ -284,8 +284,22 @@ sub setdestiny {
}
}
}
#if the postscripts directory exists then make sure it is
# world readable and executable by root; otherwise wget fails
my $installdir = xCAT::TableUtils->getInstallDir();
my $postscripts = "$installdir/postscripts";
if (-e $postscripts)
{
my $cmd = "chmod -R a+r $postscripts";
xCAT::Utils->runcmd($cmd, 0);
my $rsp = {};
if ($::RUNCMD_RC != 0)
{
$callback->({info=>"$cmd failed"});
}
}
#print Dumper($req);
# if precreatemypostscripts=1, create each mypostscript for each node
# otherwise, create it during installation /updatenode
@@ -309,7 +323,9 @@ sub setdestiny {
noupdateinitrd=>$noupdateinitrd,
ignorekernelchk=>$ignorekernelchk,}, \&relay_response);
if ($errored) {
$callback->({error=>"Some nodes failed to set up $state resources, aborting"});
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
$callback->({error=>"Some nodes failed to set up $state resources on server $myname, aborting"});
return;
}
+34 -2
View File
@@ -881,6 +881,37 @@ sub check_options
xCAT::MsgUtils->message("I", $rsp, $callback, 0);
return 0;
}
# if not help and not -n, dhcpd needs to be running
if (!($opt->{h})&& (!($opt->{n}))) {
if (xCAT::Utils->isLinux()) {
my @output = xCAT::Utils->runcmd("service dhcpd status", -1);
if ($::RUNCMD_RC != 0) { # not running
my $rsp = {};
$rsp->{data}->[0] = "dhcpd is not running. Run service dhcpd start and rerun your command.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return 1;
}
} else { # AIX
my @output = xCAT::Utils->runcmd("lssrc -s dhcpsd ", -1);
if ($::RUNCMD_RC != 0) { # not running
my $rsp = {};
$rsp->{data}->[0] = "dhcpsd is not running. Run startsrc -s dhcpsd and rerun your command.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return 1;
} else { # check the status
# the return output varies, sometime status is the third sometimes the 4th col
if (grep /inoperative/, @output)
{
my $rsp = {};
$rsp->{data}->[0] = "dhcpsd is not running. Run startsrc -s dhcpsd and rerun your command.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return 1;
}
}
}
}
# check to see if -q is listed with any other options which is not allowed
if ($opt->{q} and ($opt->{a} || $opt->{d} || $opt->{n} || $opt->{r} || $opt->{l} || $statements)) {
@@ -956,7 +987,7 @@ sub preprocess_request
if ( $rc ) {
return [];
}
my $snonly=0;
my @entries = xCAT::TableUtils->get_site_attribute("disjointdhcps");
my $t_entry = $entries[0];
@@ -1442,7 +1473,7 @@ sub process_request
next;
}
}
if ($ent[1] =~ m/(remote|ipoib|ib|vlan|bond|eth|myri|man|wlan|en\d+|em\d+)/)
if ($ent[1] =~ m/(remote|ipoib|ib|vlan|bond|eth|myri|man|wlan|en\S*\d+|em\S*\d+)/)
{ #Mask out many types of interfaces, like xCAT 1.x
$activenics{$ent[1]} = 1;
}
@@ -2616,6 +2647,7 @@ sub newconfig
push @dhcpconf, "#xCAT generated dhcp configuration\n";
push @dhcpconf, "\n";
push @dhcpconf, "authoritative;\n";
push @dhcpconf, "option conf-file code 209 = text;\n";
push @dhcpconf, "option space isan;\n";
push @dhcpconf, "option isan-encap-opts code 43 = encapsulate isan;\n";
push @dhcpconf, "option isan.iqn code 203 = string;\n";
+31 -1
View File
@@ -4333,10 +4333,12 @@ sub copycd {
}
#}
@ARGV = @{$request->{arg}};
my $includeupdate = 0;
GetOptions(
'n=s' => \$distname,
'a=s' => \$arch,
'm=s' => \$path
'm=s' => \$path,
's' => \$includeupdate
);
# run a few tests to see if the copycds should use this plugin
unless ($path){
@@ -4428,6 +4430,34 @@ sub copycd {
}
}
close(LINE);
} elsif (-r $path . "/upgrade/metadata.xml") {
open(LINE,$path."/upgrade/metadata.xml");
my $detectdistname;
while (<LINE>) {
if (/esxVersion>([^<]*)</) {
my $version = $1;
while ($version =~ /\.0$/) {
$version =~ s/\.0$//;
}
$darch="x86_64";
$arch="x86_64";
$detectdistname = 'esxi' . $version;
$found=1;
} elsif (/esxRelease>([^<]*)</) {
unless ($includeupdate) {
next;
}
my $release = $1;
while ($release =~ /\.0$/) {
$release =~ s/\.0$//;
}
unless ($release ne "0") {
next;
}
$detectdistname .= '_' . $release;
}
}
unless ($distname) { $distname=$detectdistname; }
} elsif (-r $path . "/vmware-esx-base-readme") {
open(LINE,$path."/vmware-esx-base-readme");
while (<LINE>) {
+630
View File
@@ -0,0 +1,630 @@
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
package xCAT_plugin::grub2;
use Data::Dumper;
use Sys::Syslog;
use xCAT::Scope;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
use xCAT::NetworkUtils;
use xCAT::MsgUtils;
use File::Path;
use Socket;
use Getopt::Long;
use xCAT::Table;
my $request;
my %breaknetbootnodes;
our %normalnodes;
my %tftpserverip;
my $callback;
my $sub_req;
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
my %usage = (
"nodeset" => "Usage: nodeset <noderange> [install|shell|boot|runcmd=bmcsetup|netboot|iscsiboot|osimage[=<imagename>]|offline]",
);
sub handled_commands {
return {
nodeset => "noderes:netboot"
}
}
sub check_dhcp {
return 1;
#TODO: omapi magic to do things right
my $node = shift;
my $dhcpfile;
open ($dhcpfile,$dhcpconf);
while (<$dhcpfile>) {
if (/host $node\b/) {
close $dhcpfile;
return 1;
}
}
close $dhcpfile;
return 0;
}
sub _slow_get_tftpdir { #make up for paths where tftpdir is not passed in
my $node=shift;
my $nrtab = xCAT::Table->new('noderes',-create=>0); #in order to detect per-node tftp directories
unless ($nrtab) { return $globaltftpdir; }
my $ent = $nrtab->getNodeAttribs($node,["tftpdir"]);
if ($ent and $ent->{tftpdir}) {
return $ent->{tftpdir};
} else {
return $globaltftpdir;
}
}
sub getstate {
my $node = shift;
my $tftpdir = shift;
unless ($tftpdir) { $tftpdir = _slow_get_tftpdir($node); }
if (check_dhcp($node)) {
if (-r $tftpdir . "/boot/grub2/".$node) {
my $fhand;
open ($fhand,$tftpdir . "/boot/grub2/".$node);
my $headline = <$fhand>;
close $fhand;
$headline =~ s/^#//;
chomp($headline);
return $headline;
} else {
return "boot";
}
} else {
return "discover";
}
}
sub setstate {
=pod
This function will manipulate the grub structure to match what the noderes/chain tables indicate the node should be booting.
=cut
my $node = shift;
my %bphash = %{shift()};
my %chainhash = %{shift()};
my %machash = %{shift()};
my $tftpdir = shift;
my %nrhash = %{shift()};
my $linuximghash = shift();
my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']);
if ($kern->{kcmdline} =~ /!myipfn!/) {
my $ipfn = xCAT::NetworkUtils->my_ip_facing($node);
unless ($ipfn) {
my $servicenodes = $nrhash{$node}->[0];
if ($servicenodes and $servicenodes->{servicenode}) {
my @sns = split /,/, $servicenodes->{servicenode};
foreach my $sn ( @sns ) {
# We are in the service node pools, print error if no facing ip.
if (xCAT::InstUtils->is_me($sn)) {
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
$::callback->(
{
error => [
"$myname: Unable to determine the image server for $node on service node $sn"
],
errorcode => [1]
}
);
return;
}
}
} else {
$::callback->(
{
error => [
"$myname: Unable to determine the image server for $node"
],
errorcode => [1]
}
);
return;
}
} else {
$kern->{kcmdline} =~ s/!myipfn!/$ipfn/g;
}
}
if ($kern->{addkcmdline}) {
$kern->{kcmdline} .= " ".$kern->{addkcmdline};
}
if($linuximghash and $linuximghash->{'addkcmdline'})
{
unless($linuximghash->{'boottarget'})
{
$kern->{kcmdline} .= " ".$linuximghash->{'addkcmdline'};
}
}
my $pcfg;
unless (-d "$tftpdir/boot/grub2") {
mkpath("$tftpdir/boot/grub2");
}
my $nodemac;
my %client_nethash = xCAT::DBobjUtils->getNetwkInfo( [$node] );
open($pcfg,'>',$tftpdir."/boot/grub2/".$node);
my $cref=$chainhash{$node}->[0]; #$chaintab->getNodeAttribs($node,['currstate']);
if ($cref->{currstate}) {
print $pcfg "#".$cref->{currstate}."\n";
}
print $pcfg "set timeout=5\n";
$normalnodes{$node}=1; #Assume a normal netboot (well, normal dhcp,
#which is normally with a valid 'filename' field,
#but the typical ppc case will be 'special' makedhcp
#to clear the filename field, so the logic is a little
#opposite
if ($cref and $cref->{currstate} eq "boot") {
$breaknetbootnodes{$node}=1;
delete $normalnodes{$node}; #Signify to omit this from one makedhcp command
close($pcfg);
} elsif ($kern and $kern->{kernel}) {
#It's time to set grub configuration for this node to boot the kernel..
#get tftpserver
my $tftpserver;
if (defined ($nrhash{$node}->[0]) && $nrhash{$node}->[0]->{'tftpserver'}) {
$tftpserver = $nrhash{$node}->[0]->{'tftpserver'};
} elsif (defined ($nrhash{$node}->[0]) && $nrhash{$node}->[0]->{'xcatmaster'}) {
$tftpserver = $nrhash{$node}->[0]->{'xcatmaster'};
} else {
my @master = xCAT::TableUtils->get_site_attribute("master");
$tftpserver = $master[0];
}
my $serverip;
if (defined ($tftpserverip{$tftpserver})) {
$serverip = $tftpserverip{$tftpserver};
} else {
$serverip = xCAT::NetworkUtils->getipaddr($tftpserver);
unless ($serverip) {
syslog("local1|err","xCAT unable to resolve $tftpserver");
return;
}
$tftpserverip{$tftpserver} = $serverip;
}
print $pcfg "set default=\"xCAT OS Deployment\"\n";
print $pcfg "menuentry \"xCAT OS Deployment\" {\n";
print $pcfg " insmod http\n";
print $pcfg " insmod tftp\n";
print $pcfg " set root=http,$serverip\n";
print $pcfg " echo Loading Install kernel ...\n";
if ($kern and $kern->{kcmdline}) {
print $pcfg " linux $tftpdir/$kern->{kernel} $kern->{kcmdline}\n";
} else {
print $pcfg " linux $tftpdir/$kern->{kernel}\n";
}
print $pcfg " echo Loading initial ramdisk ...\n";
if ($kern and $kern->{initrd}) {
print $pcfg " initrd $tftpdir/$kern->{initrd}\n";
}
print $pcfg "}";
close($pcfg);
my $inetn = xCAT::NetworkUtils->getipaddr($node);
unless ($inetn) {
syslog("local1|err","xCAT unable to resolve IP for $node in grub2 plugin");
return;
}
} else {
close($pcfg);
}
my $ip = xCAT::NetworkUtils->getipaddr($node);
unless ($ip) {
syslog("local1|err","xCAT unable to resolve IP in grub2 plugin");
return;
}
my $mactab = xCAT::Table->new('mac');
my %ipaddrs;
$ipaddrs{$ip} = 1;
if ($mactab) {
my $ment = $machash{$node}->[0]; #$mactab->getNodeAttribs($node,['mac']);
if ($ment and $ment->{mac}) {
my @macs = split(/\|/,$ment->{mac});
foreach (@macs) {
$nodemac = $_;
if (/!(.*)/) {
my $ipaddr = xCAT::NetworkUtils->getipaddr($1);
if ($ipaddr) {
$ipaddrs{$ipaddr} = 1;
}
}
}
}
}
# Do not use symbolic link, p5 does not support symbolic link in /tftpboot
# my $hassymlink = eval { symlink("",""); 1 };
foreach $ip (keys %ipaddrs) {
my @ipa=split(/\./,$ip);
my $pname = "grub.cfg-" . sprintf("%02x%02x%02x%02x",@ipa);
unlink($tftpdir."/boot/grub2/".$pname);
link($tftpdir."/boot/grub2/".$node,$tftpdir."/boot/grub2/".$pname);
}
if ($nodemac =~ /:/) {
my $tmp = $nodemac;
$tmp =~ s/(..):(..):(..):(..):(..):(..)/$1-$2-$3-$4-$5-$6/g;
my $pname = "grub.cfg-01-" . $tmp;
unlink($tftpdir."/boot/grub2/".$pname);
link($tftpdir."/boot/grub2/".$node,$tftpdir."/boot/grub2/".$pname);
}
return;
}
my $errored = 0;
sub pass_along {
my $resp = shift;
$callback->($resp);
if ($resp and ($resp->{errorcode} and $resp->{errorcode}->[0]) or ($resp->{error} and $resp->{error}->[0])) {
$errored=1;
}
foreach (@{$resp->{node}}) {
if ($_->{error} or $_->{errorcode}) {
$errored=1;
}
}
}
sub preprocess_request {
my $req = shift;
if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; }
my $callback1 = shift;
my $command = $req->{command}->[0];
my $sub_req = shift;
my @args=();
if (ref($req->{arg})) {
@args=@{$req->{arg}};
} else {
@args=($req->{arg});
}
@ARGV = @args;
my $nodes = $req->{node};
#use Getopt::Long;
Getopt::Long::Configure("bundling");
Getopt::Long::Configure("pass_through");
if (!GetOptions('h|?|help' => \$HELP, 'v|version' => \$VERSION) ) {
if($usage{$command}) {
my %rsp;
$rsp{data}->[0]=$usage{$command};
$callback1->(\%rsp);
}
return;
}
if ($HELP) {
if($usage{$command}) {
my %rsp;
$rsp{data}->[0]=$usage{$command};
$callback1->(\%rsp);
}
return;
}
if ($VERSION) {
my $ver = xCAT::Utils->Version();
my %rsp;
$rsp{data}->[0]="$ver";
$callback1->(\%rsp);
return;
}
if (@ARGV==0) {
if($usage{$command}) {
my %rsp;
$rsp{data}->[0]=$usage{$command};
$callback1->(\%rsp);
}
return;
}
#Assume shared tftp directory for boring people, but for cool people, help sync up tftpdirectory contents when
#if they specify no sharedtftp in site table
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $t_entry = $entries[0];
if ( defined($t_entry) and ($t_entry eq "0" or $t_entry eq "no" or $t_entry eq "NO")) {
# check for computenodes and servicenodes from the noderange, if so error out
my @SN;
my @CN;
xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN);
unless (($args[0] eq 'stat') or ($args[0] eq 'enact')) {
if ((@SN > 0) && (@CN >0 )) { # there are both SN and CN
my $rsp;
$rsp->{data}->[0] =
"Nodeset was run with a noderange containing both service nodes and compute nodes. This is not valid. You must submit with either compute nodes in the noderange or service nodes. \n";
xCAT::MsgUtils->message("E", $rsp, $callback1);
return;
}
}
$req->{'_disparatetftp'}=[1];
if ($req->{inittime}->[0]) {
return [$req];
}
if (@CN >0 ) { # if compute nodes broadcast to all servicenodes
return xCAT::Scope->get_broadcast_scope($req,@_);
}
}
return [$req];
}
sub process_request {
$request = shift;
$callback = shift;
$::callback=$callback;
$sub_req = shift;
my $command = $request->{command}->[0];
%breaknetbootnodes=();
%normalnodes=();
my @args;
my @nodes;
my @rnodes;
if (ref($request->{node})) {
@rnodes = @{$request->{node}};
} else {
if ($request->{node}) { @rnodes = ($request->{node}); }
}
unless (@rnodes) {
if ($usage{$request->{command}->[0]}) {
$callback->({data=>$usage{$request->{command}->[0]}});
}
return;
}
#if not shared tftpdir, then filter, otherwise, set up everything
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
@nodes = ();
foreach (@rnodes) {
if (xCAT::NetworkUtils->nodeonmynet($_)) {
push @nodes,$_;
} else {
xCAT::MsgUtils->message("S", "$_: grub2 netboot: stop configuration because of none sharedtftp and not on same network with its xcatmaster.");
}
}
} else {
@nodes = @rnodes;
}
# return directly if no nodes in the same network
unless (@nodes) {
xCAT::MsgUtils->message("S", "xCAT: grub2 netboot: no valid nodes. Stop the operation on this server.");
return;
}
if (ref($request->{arg})) {
@args=@{$request->{arg}};
} else {
@args=($request->{arg});
}
#now run the begin part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runbeginpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
} else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters
$sub_req->({command=>['runbeginpre'],
node=>\@rnodes,
arg=>[$args[0]]},\&pass_along);
}
if ($errored) {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running begin prescripts.\n";
$callback->($rsp);
return;
}
}
#back to normal business
my $inittime=0;
if (exists($request->{inittime})) { $inittime= $request->{inittime}->[0];}
if (!$inittime) { $inittime=0;}
$errored=0;
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$sub_req->({command=>['setdestiny'],
node=>\@nodes,
inittime=>[$inittime],
arg=>\@args},\&pass_along);
}
if ($errored) { return; }
my $bptab=xCAT::Table->new('bootparams',-create=>1);
my $bphash = $bptab->getNodesAttribs(\@nodes,['kernel','initrd','kcmdline','addkcmdline']);
my $chaintab=xCAT::Table->new('chain',-create=>1);
my $chainhash=$chaintab->getNodesAttribs(\@nodes,['currstate']);
my $noderestab=xCAT::Table->new('noderes',-create=>1);
my $nodereshash=$noderestab->getNodesAttribs(\@nodes,['tftpdir']);
my $mactab=xCAT::Table->new('mac',-create=>1);
my $machash=$mactab->getNodesAttribs(\@nodes,['mac']);
my $nrtab=xCAT::Table->new('noderes',-create=>1);
my $nrhash=$nrtab->getNodesAttribs(\@nodes,['servicenode','tftpserver','xcatmaster']);
my $typetab=xCAT::Table->new('nodetype',-create=>1);
my $typehash=$typetab->getNodesAttribs(\@nodes,['os','provmethod','arch','profile']);
my $linuximgtab=xCAT::Table->new('linuximage',-create=>1);
my $osimagetab=xCAT::Table->new('osimage',-create=>1);
my $rc;
my $errstr;
my $tftpdir;
foreach (@nodes) {
my %response;
if ($nodereshash->{$_} and $nodereshash->{$_}->[0] and $nodereshash->{$_}->[0]->{tftpdir}) {
$tftpdir = $nodereshash->{$_}->[0]->{tftpdir};
} else {
$tftpdir = $globaltftpdir;
}
$response{node}->[0]->{name}->[0]=$_;
if ($args[0] eq 'stat') {
$response{node}->[0]->{data}->[0]= getstate($_,$tftpdir);
$callback->(\%response);
} elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate
my $ent = $typehash->{$_}->[0];
my $osimgname = $ent->{'provmethod'};
my $linuximghash=undef;
unless($osimgname =~ /^(install|netboot|statelite)$/){
$linuximghash = $linuximgtab->getAttribs({imagename => $osimgname}, 'boottarget', 'addkcmdline');
}
($rc,$errstr) = setstate($_,$bphash,$chainhash,$machash,$tftpdir,$nrhash,$linuximghash);
if ($rc) {
$response{node}->[0]->{errorcode}->[0]= $rc;
$response{node}->[0]->{errorc}->[0]= $errstr;
$callback->(\%response);
}
}
}# end of foreach node
my @normalnodeset = keys %normalnodes;
my @breaknetboot=keys %breaknetbootnodes;
#print "grub2 :inittime=$inittime; normalnodeset=@normalnodeset; breaknetboot=@breaknetboot\n";
my %osimagenodehash;
for my $nn (@normalnodeset){
#record the os version for node
my $ent = $typehash->{$nn}->[0];
my $osimage=$ent->{'provmethod'};
if($osimage =~ /^(install|netboot|statelite)$/){
$osimage=($ent->{'os'}).'-'.($ent->{'arch'}).'-'.($ent->{'provmethod'}).'-'.($ent->{'profile'});
}
push @{$osimagenodehash{$osimage}}, $nn;
}
my $do_dhcpsetup=1;
my @entries = xCAT::TableUtils->get_site_attribute("dhcpsetup");
my $t_entry = $entries[0];
if (defined($t_entry) ) {
if ($t_entry =~ /0|n|N/) { $do_dhcpsetup=0; }
}
#Don't bother to try dhcp binding changes if sub_req not passed, i.e. service node build time
unless (($args[0] eq 'stat') || ($inittime) || ($args[0] eq 'offline')) {
foreach my $osimage (keys %osimagenodehash) {
#TOTO check the existence of grub2 executable files for corresponding arch
my $osimgent = $osimagetab->getAttribs({imagename => $osimage },'osarch');
my $validarch=undef;
if($osimgent and $osimgent->{'osarch'})
{
$validarch = $osimgent->{'osarch'};
}
if ($validarch =~ /ppc64/i)
{
$validarch="ppc"
}
my $grub2 = "/boot/grub2/grub2.".$validarch;
my $tftppath = $tftpdir . $grub2;
unless (-e "$tftppath") {
my $rsp;
push @{$rsp->{data}},
"stop configuration, missing $tftppath.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
return;
}
if ($do_dhcpsetup) {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],
node=>\@{$osimagenodehash{$osimage}},
arg=>['-l','-s','filename = \"'.$grub2.'\";']},$callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@{$osimagenodehash{$osimage}},
arg=>['-s','filename = \"'.$grub2.'\";']},$callback);
}
}
} #end of foreach osimagenodehash
if ($do_dhcpsetup) {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],
node=>\@breaknetboot,
arg=>['-l','-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@breaknetboot,
arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback);
}
}
}
#now run the end part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact')
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runendpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
} else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters
$sub_req->({command=>['runendpre'],
node=>\@rnodes,
arg=>[$args[0]]},\&pass_along);
}
if ($errored) {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running end prescripts\n";
$callback->($rsp);
return;
}
}
}
#----------------------------------------------------------------------------
=head3 getNodesetStates
returns the nodeset state for the given nodes. The possible nodeset
states are: netboot, install, boot and discover.
Arguments:
nodes --- a pointer to an array of nodes
states -- a pointer to a hash table. This hash will be filled by this
function.The key is the nodeset status and the value is a pointer
to an array of nodes.
Returns:
(return code, error message)
=cut
#-----------------------------------------------------------------------------
sub getNodesetStates {
my $noderef=shift;
if ($noderef =~ /xCAT_plugin::grub2/) {
$noderef=shift;
}
my @nodes=@$noderef;
my $hashref=shift;
my $noderestab = xCAT::Table->new('noderes'); #in order to detect per-node tftp directories
my %nrhash = %{$noderestab->getNodesAttribs(\@nodes,[qw(tftpdir)])};
if (@nodes>0) {
foreach my $node (@nodes) {
my $tftpdir;
if ($nrhash{$node}->[0] and $nrhash{$node}->[0]->{tftpdir}) {
$tftpdir = $nrhash{$node}->[0]->{tftpdir};
} else {
$tftpdir = $globaltftpdir;
}
my $tmp=getstate($node, $tftpdir);
my @a=split(' ', $tmp);
$stat = $a[0];
if (exists($hashref->{$stat})) {
my $pa=$hashref->{$stat};
push(@$pa, $node);
}
else {
$hashref->{$stat}=[$node];
}
}
}
return (0, "");
}
1;
+10 -5
View File
@@ -1332,7 +1332,7 @@ sub fpc_firmxfer_watch {
return;
}
my $percent = 0;
if ($rsp->{data} and (length(@{$rsp->{data}}) > 0)) {
if ($rsp->{data} and (scalar(@{$rsp->{data}}) > 0)) {
$percent = $rsp->{data}->[0];
}
#$callback->({sinfo=>"$percent%"});
@@ -2971,12 +2971,13 @@ sub parsefru {
my $currsize;
if ($bytes->[$curridx] <= 5) { #don't even try to parse unknown stuff
#some records don't comply to any SPEC
while (not $last) {
while (not $last and $curridx < (scalar @$bytes)) {
if ($bytes->[$curridx+1] & 128) {
$last=1;
}
$currsize=$bytes->[$curridx+2];
push @{$fruhash->{extra}},$bytes->[$curridx..$curridx+4+$currsize-1];
push @{$fruhash->{extra}},@{$bytes}[$curridx..$curridx+4+$currsize-1];
$curridx += 5 + $currsize;
}
}
}
@@ -6318,13 +6319,17 @@ sub preprocess_request {
if ($command eq "rpower") {
my $subcmd=$exargs[0];
if($subcmd eq ''){
$callback->({data=>["Please enter an action (eg: boot,off,on, etc)", $usage_string]});
#$callback->({data=>["Please enter an action (eg: boot,off,on, etc)", $usage_string]});
#Above statement will miss error code, so replaced by the below statement
$callback->({errorcode=>[1],data=>["Please enter an action (eg: boot,off,on, etc)", $usage_string]});
$request = {};
return 0;
}
if ( ($subcmd ne 'reseat') && ($subcmd ne 'stat') && ($subcmd ne 'state') && ($subcmd ne 'status') && ($subcmd ne 'on') && ($subcmd ne 'off') && ($subcmd ne 'softoff') && ($subcmd ne 'nmi')&& ($subcmd ne 'cycle') && ($subcmd ne 'reset') && ($subcmd ne 'boot') && ($subcmd ne 'wake') && ($subcmd ne 'suspend')) {
$callback->({data=>["Unsupported command: $command $subcmd", $usage_string]});
#$callback->({data=>["Unsupported command: $command $subcmd", $usage_string]});
#Above statement will miss error code, so replaced by the below statement
$callback->({errorcode=>[1],data=>["Unsupported command: $command $subcmd", $usage_string]});
$request = {};
return;
}
+3 -4
View File
@@ -3563,8 +3563,7 @@ sub create_error_response {
#-----------------------------------------------------------------------------
sub lskit_processargs {
if ( defined( @{$::args} ) ) {
if ( defined ($::args) && @{$::args} ){
@ARGV = @{$::args};
}
@@ -3665,7 +3664,7 @@ sub lskit_processargs {
#-----------------------------------------------------------------------------
sub lskitcomp_processargs {
if ( defined( @{$::args} ) ) {
if ( defined ($::args) && @{$::args} ){
@ARGV = @{$::args};
}
@@ -3758,7 +3757,7 @@ sub lskitcomp_processargs {
#-----------------------------------------------------------------------------
sub lskitdeployparam_processargs {
if ( defined( @{$::args} ) ) {
if ( defined ($::args) && @{$::args} ){
@ARGV = @{$::args};
}
+1 -1
View File
@@ -192,7 +192,7 @@ sub lskmodules_usage {
#-----------------------------------------------------------------------------
sub processArgs {
if ( defined( @{$::args} ) ) {
if ( defined ($::args) && @{$::args} ) {
@ARGV = @{$::args};
}
+52 -23
View File
@@ -470,26 +470,7 @@ sub build_diskstruct {
my $currdev;
my @suffixes=('a','b','d'..'zzz');
my $suffidx=0;
if ($cdloc) {
my $cdhash;
$cdhash->{device}='cdrom';
if ($cdloc =~ /^\/dev/) {
$cdhash->{type}='block';
} else {
$cdhash->{type}='file';
}
$cdhash->{source}->{file}=$cdloc;
$cdhash->{readonly};
$cdhash->{target}->{dev}='hdc';
push @returns,$cdhash;
} else { #give the VM an empty optical drive, to allow chvm live attach/remove
my $cdhash;
$cdhash->{device}='cdrom';
$cdhash->{type}='file';
$cdhash->{readonly};
$cdhash->{target}->{dev}='hdc';
push @returns,$cdhash;
}
my $storagemodel = $confdata->{vm}->{$node}->[0]->{storagemodel};
my $cachemethod = "none";
if ( $confdata->{vm}->{$node}->[0]->{storagecache}) {
$cachemethod = $confdata->{vm}->{$node}->[0]->{storagecache};
@@ -506,7 +487,7 @@ sub build_diskstruct {
my $model = $1;
unless ($model) {
#if not defined, model will stay undefined like above
$model = $confdata->{vm}->{$node}->[0]->{storagemodel};
$model = $storagemodel;
unless ($model) { $model = 'ide'; } #if still not defined, ide
}
my $prefix='hd';
@@ -574,6 +555,34 @@ sub build_diskstruct {
push @returns,$diskhash;
}
}
my $cdprefix='hd';
if ($storagemodel eq 'virtio') {
$cdprefix='vd';
} elsif ($storagemodel eq 'scsi') {
$cdprefix='sd';
}
$suffidx += 1;
if ($cdloc) {
my $cdhash;
$cdhash->{device}='cdrom';
if ($cdloc =~ /^\/dev/) {
$cdhash->{type}='block';
} else {
$cdhash->{type}='file';
}
$cdhash->{source}->{file}=$cdloc;
$cdhash->{readonly};
$cdhash->{target}->{dev}=$cdprefix.$suffixes[$suffidx];
push @returns,$cdhash;
} else { #give the VM an empty optical drive, to allow chvm live attach/remove
my $cdhash;
$cdhash->{device}='cdrom';
$cdhash->{type}='file';
$cdhash->{readonly};
$cdhash->{target}->{dev}=$cdprefix.$suffixes[$suffidx];
push @returns,$cdhash;
}
return \@returns;
}
sub getNodeUUID {
@@ -654,10 +663,16 @@ sub build_xmldesc {
my %args=@_;
my $cdloc=$args{cd};
my %xtree=();
my $hypcpumodel = $confdata->{$confdata->{vm}->{$node}->[0]->{host}}->{cpumodel};
$xtree{type}='kvm';
$xtree{name}->{content}=$node;
$xtree{uuid}->{content}=getNodeUUID($node);
$xtree{os} = build_oshash();
if (defined($hypcpumodel) and $hypcpumodel eq "ppc64") {
$xtree{os}->{type}->{arch} = "ppc64";
$xtree{os}->{type}->{machine} = "pseries";
delete $xtree{os}->{bios};
}
if ($args{memory}) {
$xtree{memory}->{content}=getUnits($args{memory},"M",1024);
if ($confdata->{vm}->{$node}->[0]->{memory}) {
@@ -723,8 +738,12 @@ sub build_xmldesc {
} else {
$xtree{devices}->{graphics}->{password}=genpassword(20);
}
$xtree{devices}->{sound}->{model}='ac97';
if (defined($hypcpumodel) and $hypcpumodel eq 'ppc64') {
$xtree{devices}->{emulator}->{content} = "/usr/bin/qemu-system-ppc64";
} else {
$xtree{devices}->{sound}->{model}='ac97';
}
$xtree{devices}->{console}->{type}='pty';
$xtree{devices}->{console}->{target}->{port}='1';
return XMLout(\%xtree,RootName=>"domain");
@@ -2988,7 +3007,17 @@ sub dohyp {
return 1,"General error establishing libvirt communication";
}
}
if (($command eq 'mkvm' or $command eq 'chvm') and $hypconn) {
my $nodeinfo = $hypconn->get_node_info();
if (exists($nodeinfo->{model})) {
$confdata->{$hyp}->{cpumodel} = $nodeinfo->{model};
}
}
foreach $node (sort (keys %{$hyphash{$hyp}->{nodes}})) {
if ($confdata->{$hyp}->{cpumodel} and $confdata->{$hyp}->{cpumodel} =~ /ppc64/i) {
$confdata->{vm}->{$node}->[0]->{storagemodel} = "scsi";
}
my ($rc,@output) = guestcmd($hyp,$node,$command,@$args);
foreach(@output) {
@@ -239,7 +239,7 @@ sub add_known_host
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return 1;
}
chop($output[0]);
chomp($output[0]);
my ($hostname,$ip_address) = xCAT::NetworkUtils->gethostnameandip($node);
if (!$hostname || !$ip_address)
{
+2 -3
View File
@@ -26,8 +26,7 @@ sub preprocess_request
my @requests = ({%$req}); #first element is local instance
$::args = $req->{arg};
if (defined(@{$::args})) {
if ( defined ($::args) && @{$::args} ) {
@ARGV = @{$::args};
}
@@ -88,7 +87,7 @@ sub process_request
$::args = $request->{arg};
if (defined(@{$::args})) {
if ( defined ($::args) && @{$::args} ) {
@ARGV = @{$::args};
}
+2 -2
View File
@@ -412,13 +412,13 @@ sub create_imgconf_file {
my $rootpw = undef;
my $passwdtab = xCAT::Table->new('passwd');
if ($passwdtab) {
my $et = $passwdtab->getAttribs({key => 'system', username => 'root'}, 'password');
my $et = $passwdtab->getAttribs({key => 'vios', username => 'padmin'}, 'password');
if ($et and defined ($et->{'password'})) {
$rootpw = $et->{'password'};
}
}
unless (defined($rootpw)) {
return "Unable to find requested password from passwd, with key=system,username=root";
return "Unable to find requested password from passwd, with key=vios,username=padmin";
}
unless (-e $bootimg_root."/viobootimg") {
return "Unable to find VIOS bootimg file";
+490
View File
@@ -0,0 +1,490 @@
# IBM(c) 2014 EPL license http://www.eclipse.org/legal/epl-v10.html
package xCAT_plugin::petitboot;
use File::Path;
use Getopt::Long;
use xCAT::Table;
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
my %usage = (
"nodeset" => "Usage: nodeset <noderange> osimage[=<imagename>]",
);
sub handled_commands {
return {
nodeset => "noderes:netboot"
}
}
sub check_dhcp {
return 1;
#TODO: omapi magic to do things right
my $node = shift;
my $dhcpfile;
open ($dhcpfile,$dhcpconf);
while (<$dhcpfile>) {
if (/host $node\b/) {
close $dhcpfile;
return 1;
}
}
close $dhcpfile;
return 0;
}
sub _slow_get_tftpdir { #make up for paths where tftpdir is not passed in
my $node=shift;
my $nrtab = xCAT::Table->new('noderes',-create=>0); #in order to detect per-node tftp directories
unless ($nrtab) { return $globaltftpdir; }
my $ent = $nrtab->getNodeAttribs($node,["tftpdir"]);
if ($ent and $ent->{tftpdir}) {
return $ent->{tftpdir};
} else {
return $globaltftpdir;
}
}
sub getstate {
my $node = shift;
my $tftpdir = shift;
unless ($tftpdir) { $tftpdir = _slow_get_tftpdir($node); }
if (check_dhcp($node)) {
if (-r $tftpdir . "/petitboot/".$node) {
my $fhand;
open ($fhand,$tftpdir . "/petitboot/".$node);
my $headline = <$fhand>;
close $fhand;
$headline =~ s/^#//;
chomp($headline);
return $headline;
} else {
return "boot";
}
} else {
return "discover";
}
}
sub setstate {
=pod
This function will manipulate the yaboot structure to match what the noderes/chain tables indicate the node should be booting.
=cut
my $node = shift;
my %bphash = %{shift()};
my %chainhash = %{shift()};
my %machash = %{shift()};
my $tftpdir = shift;
my %nrhash = %{shift()};
my $linuximghash = shift();
my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']);
if ($kern->{kcmdline} =~ /!myipfn!/) {
my $ipfn = xCAT::NetworkUtils->my_ip_facing($node);
unless ($ipfn) {
my $servicenodes = $nrhash{$node}->[0];
if ($servicenodes and $servicenodes->{servicenode}) {
my @sns = split /,/, $servicenodes->{servicenode};
foreach my $sn ( @sns ) {
# We are in the service node pools, print error if no facing ip.
if (xCAT::InstUtils->is_me($sn)) {
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
$::callback->(
{
error => [
"$myname: Unable to determine the image server for $node on service node $sn"
],
errorcode => [1]
}
);
return;
}
}
} else {
$::callback->(
{
error => [
"$myname: Unable to determine the image server for $node"
],
errorcode => [1]
}
);
return;
}
} else {
$kern->{kernel} =~ s/!myipfn!/$ipfn/g;
$kern->{initrd} =~ s/!myipfn!/$ipfn/g;
$kern->{kcmdline} =~ s/!myipfn!/$ipfn/g;
}
}
if ($kern->{addkcmdline}) {
$kern->{kcmdline} .= " ".$kern->{addkcmdline};
}
if($linuximghash and $linuximghash->{'addkcmdline'})
{
unless($linuximghash->{'boottarget'})
{
$kern->{kcmdline} .= " ".$linuximghash->{'addkcmdline'};
}
}
my $pcfg;
unless (-d "$tftpdir/petitboot") {
mkpath("$tftpdir/petitboot");
}
my $nodemac;
open($pcfg,'>',$tftpdir."/petitboot/".$node);
my $cref=$chainhash{$node}->[0]; #$chaintab->getNodeAttribs($node,['currstate']);
if ($cref->{currstate}) {
print $pcfg "#".$cref->{currstate}."\n";
}
$normalnodes{$node}=1; #Assume a normal netboot (well, normal dhcp,
#which is normally with a valid 'filename' field,
#but the typical ppc case will be 'special' makedhcp
#to clear the filename field, so the logic is a little
#opposite
# $sub_req->({command=>['makedhcp'], #This is currently batched elswhere
# node=>[$node]},$callback); #It hopefully will perform correctly
if ($cref and $cref->{currstate} eq "boot") {
$breaknetbootnodes{$node}=1;
delete $normalnodes{$node}; #Signify to omit this from one makedhcp command
#$sub_req->({command=>['makedhcp'], #batched elsewhere, this code is stale, hopefully
# node=>[$node],
# arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback);
#print $pcfg "bye\n";
close($pcfg);
} elsif ($kern and $kern->{kernel}) {
#It's time to set yaboot for this node to boot the kernel..
print $pcfg "default xCAT\n";
print $pcfg "label xCAT\n";
print $pcfg "\tkernel $kern->{kernel}\n";
if ($kern and $kern->{initrd}) {
print $pcfg "\tinitrd ".$kern->{initrd}."\n";
}
if ($kern and $kern->{kcmdline}) {
print $pcfg "\tappend \"".$kern->{kcmdline}."\"\n";
}
close($pcfg);
my $inetn = xCAT::NetworkUtils->getipaddr($node);
unless ($inetn) {
syslog("local1|err","xCAT unable to resolve IP for $node in petitboot plugin");
return;
}
} else { #TODO: actually, should possibly default to xCAT image?
#print $pcfg "bye\n";
close($pcfg);
}
my $ip = xCAT::NetworkUtils->getipaddr($node);
unless ($ip) {
syslog("local1|err","xCAT unable to resolve IP in petitboot plugin");
return;
}
my @ipa=split(/\./,$ip);
my $pname = sprintf("%02x%02x%02x%02x",@ipa);
$pname = uc($pname);
unlink($tftpdir."/".$pname);
link($tftpdir."/petitboot/".$node,$tftpdir."/".$pname);
return;
}
my $errored = 0;
sub pass_along {
my $resp = shift;
# print Dumper($resp);
$callback->($resp);
if ($resp and ($resp->{errorcode} and $resp->{errorcode}->[0]) or ($resp->{error} and $resp->{error}->[0])) {
$errored=1;
}
foreach (@{$resp->{node}}) {
if ($_->{error} or $_->{errorcode}) {
$errored=1;
}
}
}
sub preprocess_request {
my $req = shift;
if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; }
my $callback1 = shift;
my $command = $req->{command}->[0];
my $sub_req = shift;
my @args=();
if (ref($req->{arg})) {
@args=@{$req->{arg}};
} else {
@args=($req->{arg});
}
@ARGV = @args;
my $nodes = $req->{node};
#use Getopt::Long;
Getopt::Long::Configure("bundling");
Getopt::Long::Configure("pass_through");
if (!GetOptions('h|?|help' => \$HELP, 'v|version' => \$VERSION) ) {
if($usage{$command}) {
my %rsp;
$rsp{data}->[0]=$usage{$command};
$callback1->(\%rsp);
}
return;
}
if ($HELP) {
if($usage{$command}) {
my %rsp;
$rsp{data}->[0]=$usage{$command};
$callback1->(\%rsp);
}
return;
}
if ($VERSION) {
my $ver = xCAT::Utils->Version();
my %rsp;
$rsp{data}->[0]="$ver";
$callback1->(\%rsp);
return;
}
if (@ARGV==0) {
if($usage{$command}) {
my %rsp;
$rsp{data}->[0]=$usage{$command};
$callback1->(\%rsp);
}
return;
}
#Assume shared tftp directory for boring people, but for cool people, help sync up tftpdirectory contents when
#if they specify no sharedtftp in site table
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $t_entry = $entries[0];
if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) {
# check for computenodes and servicenodes from the noderange, if so error out
my @SN;
my @CN;
xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN);
if ((@SN > 0) && (@CN >0 )) { # there are both SN and CN
my $rsp;
$rsp->{data}->[0] =
"Nodeset was run with a noderange containing both service nodes and compute nodes. This is not valid. You must submit with either compute nodes in the noderange or service nodes. \n";
xCAT::MsgUtils->message("E", $rsp, $callback1);
return;
}
$req->{'_disparatetftp'}=[1];
if ($req->{inittime}->[0]) {
return [$req];
}
if (@CN >0 ) { # if compute nodes broadcast to all servicenodes
return xCAT::Scope->get_broadcast_scope($req,@_);
}
}
return [$req];
}
sub process_request {
$request = shift;
$callback = shift;
$::callback=$callback;
$sub_req = shift;
my $command = $request->{command}->[0];
%breaknetbootnodes=();
%normalnodes=();
my @args;
my @nodes;
my @rnodes;
if (ref($request->{node})) {
@rnodes = @{$request->{node}};
} else {
if ($request->{node}) { @rnodes = ($request->{node}); }
}
unless (@rnodes) {
if ($usage{$request->{command}->[0]}) {
$callback->({data=>$usage{$request->{command}->[0]}});
}
return;
}
#if not shared tftpdir, then filter, otherwise, set up everything
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
@nodes = ();
foreach (@rnodes) {
if (xCAT::NetworkUtils->nodeonmynet($_)) {
push @nodes,$_;
} else {
xCAT::MsgUtils->message("S", "$_: petitboot netboot: stop configuration because of none sharedtftp and not on same network with its xcatmaster.");
}
}
} else {
@nodes = @rnodes;
}
# return directly if no nodes in the same network
unless (@nodes) {
xCAT::MsgUtils->message("S", "xCAT: petitboot netboot: no valid nodes. Stop the operation on this server.");
return;
}
if (ref($request->{arg})) {
@args=@{$request->{arg}};
} else {
@args=($request->{arg});
}
#now run the begin part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runbeginpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
} else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters
$sub_req->({command=>['runbeginpre'],
node=>\@rnodes,
arg=>[$args[0]]},\&pass_along);
}
if ($errored) {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running begin prescripts.\n";
$callback->($rsp);
return;
}
}
#back to normal business
my $inittime=0;
if (exists($request->{inittime})) { $inittime= $request->{inittime}->[0];}
if (!$inittime) { $inittime=0;}
$errored=0;
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$sub_req->({command=>['setdestiny'],
node=>\@nodes,
inittime=>[$inittime],
arg=>\@args},\&pass_along);
}
if ($errored) { return; }
my $bptab=xCAT::Table->new('bootparams',-create=>1);
my $bphash = $bptab->getNodesAttribs(\@nodes,['kernel','initrd','kcmdline','addkcmdline']);
my $chaintab=xCAT::Table->new('chain',-create=>1);
my $chainhash=$chaintab->getNodesAttribs(\@nodes,['currstate']);
my $noderestab=xCAT::Table->new('noderes',-create=>1);
my $nodereshash=$noderestab->getNodesAttribs(\@nodes,['tftpdir']);
my $mactab=xCAT::Table->new('mac',-create=>1);
my $machash=$mactab->getNodesAttribs(\@nodes,['mac']);
my $nrtab=xCAT::Table->new('noderes',-create=>1);
my $nrhash=$nrtab->getNodesAttribs(\@nodes,['servicenode']);
my $typetab=xCAT::Table->new('nodetype',-create=>1);
my $typehash=$typetab->getNodesAttribs(\@nodes,['os','provmethod','arch','profile']);
my $linuximgtab=xCAT::Table->new('linuximage',-create=>1);
my $osimagetab=xCAT::Table->new('osimage',-create=>1);
my $rc;
my $errstr;
my $tftpdir;
foreach (@nodes) {
my %response;
if ($nodereshash->{$_} and $nodereshash->{$_}->[0] and $nodereshash->{$_}->[0]->{tftpdir}) {
$tftpdir = $nodereshash->{$_}->[0]->{tftpdir};
} else {
$tftpdir = $globaltftpdir;
}
$response{node}->[0]->{name}->[0]=$_;
if ($args[0] eq 'stat') {
$response{node}->[0]->{data}->[0]= getstate($_,$tftpdir);
$callback->(\%response);
} elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate
my $ent = $typehash->{$_}->[0];
my $osimgname = $ent->{'provmethod'};
my $linuximghash = $linuximghash = $linuximgtab->getAttribs({imagename => $osimgname}, 'boottarget', 'addkcmdline');
($rc,$errstr) = setstate($_,$bphash,$chainhash,$machash,$tftpdir,$nrhash,$linuximghash);
if ($rc) {
$response{node}->[0]->{errorcode}->[0]= $rc;
$response{node}->[0]->{errorc}->[0]= $errstr;
$callback->(\%response);
}
}
}# end of foreach node
my @normalnodeset = keys %normalnodes;
my @breaknetboot=keys %breaknetbootnodes;
#print "yaboot:inittime=$inittime; normalnodeset=@normalnodeset; breaknetboot=@breaknetboot\n";
my %osimagenodehash;
for my $nn (@normalnodeset){
#record the os version for node
my $ent = $typehash->{$nn}->[0];
my $osimage=$ent->{'provmethod'};
push @{$osimagenodehash{$osimage}}, $nn;
}
#Don't bother to try dhcp binding changes if sub_req not passed, i.e. service node build time
unless (($args[0] eq 'stat') || ($inittime) || ($args[0] eq 'offline')) {
#dhcp stuff
my $do_dhcpsetup=1;
my @entries = xCAT::TableUtils->get_site_attribute("dhcpsetup");
my $t_entry = $entries[0];
if (defined($t_entry) ) {
if ($t_entry =~ /0|n|N/) { $do_dhcpsetup=0; }
}
if ($do_dhcpsetup) {
foreach my $node (@normalnodeset) {
my $server = xCAT::TableUtils->GetMasterNodeName($node);
my $ipfn = xCAT::NetworkUtils->my_ip_facing($server);
if(($server != 1) and defined($ipfn)) {
my $fpath = "http://$ipfn/tftpboot/petitboot/$node";
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],
node=> [$node],
arg=>['-l','-s','option conf-file \"'.$fpath.'\";']},$callback);
} else {
$sub_req->({command=>['makedhcp'],
node=> [$node],
arg=>['-s','option conf-file \"'.$fpath.'\";']},$callback);
}
}
}
}
}
#now run the end part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact')
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runendpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
} else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters
$sub_req->({command=>['runendpre'],
node=>\@rnodes,
arg=>[$args[0]]},\&pass_along);
}
if ($errored) {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running end prescripts\n";
$callback->($rsp);
return;
}
}
}
1;
+67 -49
View File
@@ -54,6 +54,7 @@ my $command;
my $args;
# Put arguments in a hash.
my %args_dict;
my %general_arg;
#-------------------------------------------------------
@@ -100,6 +101,8 @@ sub process_request {
$command = $request->{command}->[0];
$args = $request->{arg};
my $gereral_arg = get_general_args();
# There is no need to acquire lock for command nodediscoverstatus, nodediscoverls and noderegenips.
if ($command eq "nodediscoverstatus"){
nodediscoverstatus();
@@ -112,7 +115,11 @@ sub process_request {
return;
}
my $lock = xCAT::Utils->acquire_lock("nodemgmt", 1);
my $non_block = 1;
if ( $general_arg{'blockmode'} == 1) {
$non_block = 0;
}
my $lock = xCAT::Utils->acquire_lock("nodemgmt", $non_block);
if (! $lock){
setrsp_errormsg("Cannot acquire lock, another process is already running.");
return;
@@ -131,7 +138,7 @@ sub process_request {
);
setrsp_errormsg("Cannot $errormsg_dict{$command} while node discovery is running.");
xCAT::Utils->release_lock($lock, 1);
xCAT::Utils->release_lock($lock, $non_block);
return;
}
}
@@ -156,7 +163,32 @@ sub process_request {
nodechmac();
}
xCAT::Utils->release_lock($lock, 1);
xCAT::Utils->release_lock($lock, $non_block);
}
sub get_general_args
{
my ($help, $ver, $blockmode);
%general_arg = ();
@ARGV = ();
if($args) {
@ARGV = @$args;
}
GetOptions(
'h|help' => \$help,
'v|version' => \$ver,
'b|block' => \$blockmode,
);
if($help){
$general_arg{'help'} = 1;
}
if($ver){
$general_arg{'version'} = 1;
}
if ($blockmode) {
$general_arg{'blockmode'} = 1;
}
}
#-------------------------------------------------------
@@ -202,37 +234,21 @@ sub validate_args{
my $enabledparamsref = shift;
my $mandatoryparamsref = shift;
# The -h -v are handled by seqdiscovery.pm
# -t -u -l only works for nodediscoverls, and them only handled by seqdiscovery.pm
my ($help, $ver, $type, $uuid, $long);
if ($general_arg{'help'} == 1){
my %process_help_commands = (
'nodediscoverstart' => 1,
'nodediscoverstop' => 1,
'nodediscoverls' => 1,
'nodediscoverstatus' => 1,
);
@ARGV = ();
if($args) {
@ARGV = @$args;
}
GetOptions(
'h|help' => \$help,
'v|version' => \$ver,
't=s' => \$type,
'u=s' => \$uuid,
'l' => \$long,
);
if($help){
# just return to make sequential discovery to handle it
return 0;
# do not process help message for these noddiscover* commands, cover them in seqdiscovery.pm
unless ($process_help_commands{$command} == 1) {
setrsp_infostr($helpmsg);
return 0;
}
}
if($ver){
# just return to make sequential discovery to handle it
return 0;
}
if ($type || $uuid || $long) {
# these args for general discovery, return directly
return 0;
}
my $parseret = parse_args();
if ($parseret){
setrsp_errormsg($parseret);
@@ -482,6 +498,8 @@ Usage:
$warnstr = "Warning: failed to import some nodes.";
setrsp_progress($warnstr);
}
# setup node provisioning status.
xCAT::Utils->runxcmd({command=>["updatenodestat"], node=>\@nodelist, arg=>['defined']}, $request_command, -1, 2);
setrsp_progress("Configuring nodes...");
my $retref = xCAT::Utils->runxcmd({command=>["kitnodeadd"], node=>\@nodelist, sequential=>[1], macflag=>[$mac_addr_mode]}, $request_command, 0, 2);
@@ -726,9 +744,6 @@ Usage:
# Update nodes' attributes
foreach (@$nodes) {
$updatenodeshash{$_}{'groups'} .= $profile_groups;
if ($profile_status){
$updatenodeshash{$_}{'status'} = $profile_status;
}
}
#update DataBase.
@@ -737,6 +752,11 @@ Usage:
$nodetab->setNodesAttribs(\%updatenodeshash);
$nodetab->close();
#update node's status:
if($profile_status eq "defined"){
xCAT::Utils->runxcmd({command=>["updatenodestat"], node=>$nodes, arg=>['defined']}, $request_command, -1, 2);
}
my $retref;
my $retstrref;
# Call update plugins first.
@@ -1154,17 +1174,7 @@ Usage:
# Update node's status.
setrsp_progress("Updating node status...");
my $nodelisttab = xCAT::Table->new('nodelist',-create=>1);
my (
$sec, $min, $hour, $mday, $mon,
$year, $wday, $yday, $isdst
) = localtime(time);
my $currtime = sprintf("%02d-%02d-%04d %02d:%02d:%02d",
$mon + 1, $mday, $year + 1900,
$hour, $min, $sec);
$nodelisttab->setNodeAttribs($hostname, {status=>'defined', statustime=>$currtime});
$nodelisttab->close();
xCAT::Utils->runxcmd({command=>["updatenodestat"], node=>[$hostname], arg=>['defined']}, $request_command, -1, 2);
setrsp_progress("Updated MAC address.");
}
@@ -1440,7 +1450,9 @@ Usage:
my $mactab = xCAT::Table->new("mac");
my $macsref = $mactab->getNodesAttribs(\@nodes, ['mac']);
my $nodelisttab = xCAT::Table->new("nodelist");
my $statusref = $nodelisttab->getNodesAttribs(\@nodes, ['status']);
# Get node current provisioning status.
my $provisionapp = "provision";
my $provision_status = xCAT::TableUtils->getAppStatus(\@nodes,$provisionapp);
my $rspentry;
my $i = 0;
@@ -1461,8 +1473,8 @@ Usage:
}
}
if ($statusref->{$_}->[0]){
$rspentry->{node}->[$i]->{"status"} = $statusref->{$_}->[0]->{status};
if ($provision_status->{$_}){
$rspentry->{node}->[$i]->{"status"} = $provision_status->{$_};
} else{
$rspentry->{node}->[$i]->{"status"} = "defined";
}
@@ -1626,13 +1638,19 @@ sub findme{
}
my @nodelist = keys %hostinfo_dict;
# setup node provisioning status.
xCAT::Utils->runxcmd({command=>["updatenodestat"], node=>\@nodelist, arg=>['defined']}, $request_command, -1, 2);
# call makehosts to get the IP by resolving the name
my $retref = xCAT::Utils->runxcmd({command=>["makehosts"], node=>\@nodelist, sequential=>[1]}, $request_command, 0, 2);
# call discover to notify client.
xCAT::MsgUtils->message('S', "Call discovered request.\n");
$request->{"command"} = ["discovered"];
$request->{"node"} = \@nodelist;
$request->{discoverymethod} = ['profile'];
my $retref = xCAT::Utils->runxcmd($request, $request_command, 0, 2);
$retref = "";
$retref = xCAT::Utils->runxcmd($request, $request_command, 0, 2);
my $retstrref = parse_runxcmd_ret($retref);
xCAT::MsgUtils->message('S', "Call nodemgmt plugins.\n");
+30 -33
View File
@@ -11,9 +11,6 @@ use Getopt::Long;
require xCAT::Utils;
require xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
my $addkcmdlinehandled;
my $request;
my $callback;
my $dhcpconf = "/etc/dhcpd.conf";
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
#my $dhcpver = 3;
@@ -93,7 +90,7 @@ sub setstate {
my $imgaddkcmdline=($linuximghash{'boottarget'})? undef:$linuximghash{'addkcmdline'};
my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']);
if (not $addkcmdlinehandled->{$node} and ($kern->{addkcmdline} or ($imgaddkcmdline))) {
if (not $::PXE_addkcmdlinehandled->{$node} and ($kern->{addkcmdline} or ($imgaddkcmdline))) {
#Implement the kcmdline append here for
#most generic, least code duplication
@@ -129,7 +126,7 @@ sub setstate {
$kcmdlinehack =~ s/#TABLE:([^:#]+):([^:#]+):([^:#]+)#/$naval/;
} else {
my $msg = "Table key of $2 not yet supported by boottarget mini-template";
$::callback->({
$::PXE_callback->({
error => ["$msg"],
errorcode => [1]
});
@@ -148,7 +145,7 @@ sub setstate {
unless ($ipfn) {
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
$::callback->(
$::PXE_callback->(
{
error => [
"$myname: Unable to determine or reasonably guess the image server for $node"
@@ -263,11 +260,11 @@ sub pass_along {
$errored=1;
}
if ($_->{_addkcmdlinehandled}) {
$addkcmdlinehandled->{$_->{name}->[0]}=1;
$::PXE_addkcmdlinehandled->{$_->{name}->[0]}=1;
return; #Don't send back to client this internal hint
}
}
$callback->($resp);
$::PXE_callback->($resp);
}
@@ -356,28 +353,28 @@ sub preprocess_request {
}
sub process_request {
$request = shift;
$callback = shift;
$::PXE_request = shift;
$::PXE_callback = shift;
my $sub_req = shift;
$::callback=$callback;
undef $::PXE_addkcmdlinehandled;
my @args;
my @nodes;
my @rnodes;
if (ref($request->{node})) {
@rnodes = @{$request->{node}};
if (ref($::PXE_request->{node})) {
@rnodes = @{$::PXE_request->{node}};
} else {
if ($request->{node}) { @rnodes = ($request->{node}); }
if ($::PXE_request->{node}) { @rnodes = ($::PXE_request->{node}); }
}
unless (@rnodes) {
if ($usage{$request->{command}->[0]}) {
$callback->({data=>$usage{$request->{command}->[0]}});
if ($usage{$::PXE_request->{command}->[0]}) {
$::PXE_callback->({data=>$usage{$::PXE_request->{command}->[0]}});
}
return;
}
#if not shared, then help sync up
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::PXE_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
@nodes = ();
foreach (@rnodes) {
if (xCAT::NetworkUtils->nodeonmynet($_)) {
@@ -396,16 +393,16 @@ sub process_request {
return;
}
if (ref($request->{arg})) {
@args=@{$request->{arg}};
if (ref($::PXE_request->{arg})) {
@args=@{$::PXE_request->{arg}};
} else {
@args=($request->{arg});
@args=($::PXE_request->{arg});
}
#now run the begin part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
if ($::PXE_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runbeginpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
@@ -418,7 +415,7 @@ sub process_request {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running begin prescripts\n";
$callback->($rsp);
$::PXE_callback->($rsp);
return;
}
}
@@ -426,7 +423,7 @@ sub process_request {
#end prescripts code
if (! -r "$tftpdir/pxelinux.0") {
unless (-r "/usr/lib/syslinux/pxelinux.0" or -r "/usr/share/syslinux/pxelinux.0") {
$callback->({error=>["Unable to find pxelinux.0 "],errorcode=>[1]});
$::PXE_callback->({error=>["Unable to find pxelinux.0 "],errorcode=>[1]});
return;
}
if (-r "/usr/lib/syslinux/pxelinux.0") {
@@ -437,14 +434,14 @@ sub process_request {
chmod(0644,"$tftpdir/pxelinux.0");
}
unless ( -r "$tftpdir/pxelinux.0" ) {
$callback->({errror=>["Unable to find pxelinux.0 from syslinux"],errorcode=>[1]});
$::PXE_callback->({errror=>["Unable to find pxelinux.0 from syslinux"],errorcode=>[1]});
return;
}
$errored=0;
my $inittime=0;
if (exists($request->{inittime})) { $inittime= $request->{inittime}->[0];}
if (exists($::PXE_request->{inittime})) { $inittime= $::PXE_request->{inittime}->[0];}
if (!$inittime) { $inittime=0;}
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$sub_req->({command=>['setdestiny'],
@@ -476,7 +473,7 @@ sub process_request {
$response{node}->[0]->{name}->[0]=$_;
if ($args[0] eq 'stat') {
$response{node}->[0]->{data}->[0]= getstate($_,$tftpdir);
$callback->(\%response);
$::PXE_callback->(\%response);
} elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate
my $ent = $nthash{$_}->[0];
my $osimgname = $ent->{'provmethod'};
@@ -488,13 +485,13 @@ sub process_request {
if ($rc) {
$response{node}->[0]->{errorcode}->[0]= $rc;
$response{node}->[0]->{errorc}->[0]= $errstr;
$callback->(\%response);
$::PXE_callback->(\%response);
}
}
}
my $inittime=0;
if (exists($request->{inittime})) { $inittime= $request->{inittime}->[0];}
if (exists($::PXE_request->{inittime})) { $inittime= $::PXE_request->{inittime}->[0];}
if (!$inittime) { $inittime=0;}
#dhcp stuff -- inittime is set when xcatd on sn is started
@@ -511,12 +508,12 @@ sub process_request {
#}
if ($do_dhcpsetup) {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::PXE_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],arg=>['-l'],
node=>\@nodes},$callback);
node=>\@nodes},$::PXE_callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@nodes},$callback);
node=>\@nodes},$::PXE_callback);
}
}
@@ -568,7 +565,7 @@ sub process_request {
#now run the end part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact')
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
if ($::PXE_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runendpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
@@ -581,7 +578,7 @@ sub process_request {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running end prescripts\n";
$callback->($rsp);
$::PXE_callback->($rsp);
return;
}
}
+1 -1
View File
@@ -250,7 +250,7 @@ sub runrollupdate_usage {
sub processArgs {
my $gotattrs = 0;
if ( defined( @{$::args} ) ) {
if ( defined ($::args) && @{$::args} ) {
@ARGV = @{$::args};
}
else {
+95 -28
View File
@@ -449,7 +449,7 @@ sub process_makeroutes {
delete_route($callback, $route_hash->{net}, $route_hash->{mask}, $gw_ip, $gw_name, $route_hash->{ifname});
}
else {
set_route($callback, $route_hash->{net}, $route_hash->{mask}, $gw_ip, $gw_name,$route_hash->{ifname});
set_route($callback, $route_hash->{net}, $route_hash->{mask}, $gw_ip, $gw_name, $route_hash->{ifname});
}
}
}
@@ -526,6 +526,7 @@ sub route_exists {
my $mask = shift;
my $gw_ip = shift;
my $gw=shift;
my $ifname = shift;
my $islinux=xCAT::Utils->isLinux();
@@ -557,7 +558,8 @@ sub route_exists {
my $net1=$a[0];
my $mask1=$a[2];
my $gw1=$a[1];
if (($net1 eq $net) && ($mask1 eq $mask) && (($gw1 eq $gw) || ($gw1 eq $gw_ip))) {
my $ifname1=$a[7];
if (($net1 eq $net) && ($mask1 eq $mask) && (($gw1 eq $gw) || ($gw1 eq $gw_ip) || ($ifname1 eq $ifname))) {
return 1;
}
}
@@ -602,19 +604,27 @@ sub set_route {
#print "set_route get called\n";
my $result;
if (!route_exists($net, $mask, $gw_ip, $gw)) {
if (!route_exists($net, $mask, $gw_ip, $gw, $ifname)) {
#set temporay route
my $cmd;
# ipv6 network
if ($net =~ /:/) {
if (xCAT::Utils->isLinux()) {
$cmd="ip -6 route add $net/$mask via $gw_ip";
if ( $gw_ip == "" || $gw_ip == "::" ) {
$cmd="ip -6 route add $net/$mask dev $ifname";
} else {
$cmd="ip -6 route add $net/$mask via $gw_ip";
}
} else {
# AIX TODO
}
} else {
if (xCAT::Utils->isLinux()) {
$cmd="route add -net $net netmask $mask gw $gw_ip";
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$cmd="route add -net $net netmask $mask dev $ifname";
} else {
$cmd="route add -net $net netmask $mask gw $gw_ip";
}
} else {
$cmd="route add -net $net -netmask $mask $gw_ip";
}
@@ -676,18 +686,26 @@ sub delete_route {
#print "delete_route get called\n";
my $result;
if (route_exists($net, $mask, $gw_ip, $gw)) {
if (route_exists($net, $mask, $gw_ip, $gw, $ifname)) {
#delete route temporarily
my $cmd;
if ($net =~ /:/) {
if (xCAT::Utils->isLinux()) {
$cmd = "ip -6 route delete $net/$mask via $gw_ip";
if ( $gw_ip == "" || $gw_ip == "::" ) {
$cmd = "ip -6 route delete $net/$mask dev $ifname";
} else {
$cmd = "ip -6 route delete $net/$mask via $gw_ip";
}
} else {
# AIX TODO
}
} else {
if (xCAT::Utils->isLinux()) {
$cmd="route delete -net $net netmask $mask gw $gw_ip";
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$cmd="route delete -net $net netmask $mask dev $ifname";
} else {
$cmd="route delete -net $net netmask $mask gw $gw_ip";
}
} else {
$cmd="route delete -net $net -netmask $mask $gw_ip";
}
@@ -827,14 +845,22 @@ sub addPersistentRoute_Sles {
#print "old output=" . join("\n", @output) . "\n";
my $hasConfiged=0;
if (@output && (@output > 0)) {
$hasConfiged=checkConfig_Sles($net, $mask, $gw_ip, $gw, \@output);
$hasConfiged=checkConfig_Sles($net, $mask, $gw_ip, $gw, $ifname, \@output);
}
#print "hasConfiged=$hasConfiged\n";
my $new_config;
if ($net =~ /:/) {
$new_config = "$net/$mask $gw_ip - -\n";
if ( $gw_ip == "" || $gw_ip == "::" ) {
$new_config = "$net/$mask :: - $ifname\n";
} else {
$new_config = "$net/$mask $gw_ip - -\n";
}
} else {
$new_config="$net $gw_ip $mask $ifname\n";
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$new_config="$net 0.0.0.0 $mask $ifname\n";
} else {
$new_config="$net $gw_ip $mask $ifname\n";
}
}
if (!$hasConfiged) {
push(@output, $new_config);
@@ -872,7 +898,7 @@ sub deletePersistentRoute_Sles {
my @new_output=();
my $bigfound=0;
foreach my $tmp_conf (@output) {
my $found = checkConfig_Sles($net, $mask, $gw_ip, $gw, [$tmp_conf]);
my $found = checkConfig_Sles($net, $mask, $gw_ip, $gw, $ifname, [$tmp_conf]);
if (!$found) {
push(@new_output, $tmp_conf);
} else {
@@ -909,13 +935,18 @@ sub checkConfig_Sles {
my $mask = shift;
my $gw_ip = shift;
my $gw=shift;
my $ifname=shift;
my $output=shift;
# Format:
# DESTINATION GATEWAY NETMASK INTERFACE
# DESTINATION/PREFIXLEN GATEWAY - INTERFACE
# ipv4 format: 192.168.0.0 207.68.156.51 255.255.0.0 eth1
# ipv6 format: fd59::/64 fd57:faaf:e1ab:336:21a:64ff:fe01:1 - -
foreach my $line (@$output) {
my @a=split(' ', $line);
my ($net1,$mask1,$gw1);
my ($net1,$mask1,$gw1,$ifname1);
if ($net =~ /:/) {
if (@a>0) {
my $ipv6net = $a[0];
@@ -925,6 +956,10 @@ sub checkConfig_Sles {
$gw1=$a[1];
if ($gw1 eq '-') { $gw1=$gw_ip; }
}
if (@a>3) {
$ifname1=$a[3];
if ($ifname1 eq '-') { $ifname1=$ifname;}
}
} else {
if (@a>0) {
@@ -939,10 +974,14 @@ sub checkConfig_Sles {
$mask1=$a[2];
if ($mask1 eq '-') { $mask1=$mask;}
}
if (@a>3) {
$ifname1=$a[3];
if ($ifname1 eq '-') { $ifname1=$ifname;}
}
}
#print "net=$net1,$net mask=$mask1,$mask gw=$gw1,$gw_ip\n";
if (($net1 && $net1 eq $net) && ($mask1 && $mask1 eq $mask) && (($gw1 && $gw1 eq $gw) || ($gw1 && $gw1 eq $gw_ip))) {
#print "net=$net1,$net mask=$mask1,$mask gw=$gw1,$gw_ip ifname=$ifname1\n";
if (($net1 && $net1 eq $net) && ($mask1 && $mask1 eq $mask) && (($gw1 && $gw1 eq $gw) || ($gw1 && $gw1 eq $gw_ip) || ($ifname1 && $ifname1 eq $ifname))) {
return 1;
}
}
@@ -972,7 +1011,7 @@ sub addPersistentRoute_RH {
#print "old output=" . join("\n", @output) . "\n";
my $hasConfiged=0;
if (@output && (@output > 0)) {
$hasConfiged=checkConfig_RH($net, $mask, $gw_ip, $gw, \@output);
$hasConfiged=checkConfig_RH($net, $mask, $gw_ip, $gw, $ifname, \@output);
}
#print "hasConfiged=$hasConfiged\n";
my $new_config;
@@ -987,7 +1026,11 @@ sub addPersistentRoute_RH {
$new_config="$ifname $net/$mask $gw_ip";
} else {
$new_config="any net $net netmask $mask gw $gw_ip $ifname\n";
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$new_config="any net $net netmask $mask dev $ifname\n";
} else {
$new_config="any net $net netmask $mask gw $gw_ip\n";
}
}
if (!$hasConfiged) {
push(@output, $new_config);
@@ -1031,7 +1074,7 @@ sub deletePersistentRoute_RH {
my @new_output=();
my $bigfound=0;
foreach my $tmp_conf (@output) {
my $found = checkConfig_RH($net, $mask, $gw_ip, $gw, [$tmp_conf]);
my $found = checkConfig_RH($net, $mask, $gw_ip, $gw, $ifname, [$tmp_conf]);
if (!$found) {
push(@new_output, $tmp_conf);
} else {
@@ -1065,14 +1108,16 @@ sub checkConfig_RH {
my $mask = shift;
my $gw_ip = shift;
my $gw=shift;
my $ifname=shift;
my $output=shift;
foreach my $line (@$output) {
my @a=split(' ', $line);
#The format is: any net 172.16.0.0 netmask 255.240.0.0 gw 192.168.0.1 eth0
# ipv6 format: eth1 fd60::/64 fd57::214:5eff:fe15:1
my ($net1,$mask1,$gw1);
my ($net1,$mask1,$gw1,$ifname1);
if ($net =~ /:/) {
$ifname1 = $a[0];
if (@a>1) {
my $ipv6net = $a[1];
($net1,$mask1) = split("/",$ipv6net);
@@ -1090,13 +1135,18 @@ sub checkConfig_RH {
if ($mask1 eq '-') { $mask1=$mask;}
}
if (@a>6) {
$gw1=$a[6];
if ($gw1 eq '-') { $gw1=$gw_ip; }
if ( $a[5] eq 'dev' ) {
$ifname1=$a[6];
if ($ifname1 eq '-') { $ifname1=$ifname;}
} else {
$gw1=$a[6];
if ($gw1 eq '-') { $gw1=$gw_ip; }
}
}
}
#print "net=$net1,$net mask=$mask1,$mask gw=$gw1,$gw_ip\n";
if (($net1 && $net1 eq $net) && ($mask1 && $mask1 eq $mask) && (($gw1 && $gw1 eq $gw) || ($gw1 && $gw1 eq $gw_ip))) {
#print "net=$net1,$net mask=$mask1,$mask gw=$gw1,$gw_ip ifname=$ifname1,ifname\n";
if (($net1 && $net1 eq $net) && ($mask1 && $mask1 eq $mask) && (($gw1 && $gw1 eq $gw) || ($gw1 && $gw1 eq $gw_ip) || ($ifname1 && $ifname1 eq $ifname))) {
return 1;
}
}
@@ -1120,12 +1170,21 @@ sub addPersistentRoute_Debian{
#ipv6
if ( $net =~ /:/){
$cmd = "grep \"$net/$mask gw $gw_ip\" $conf_file";
$route_conf = " up route -A inet6 add $net/$mask gw $gw_ip \n down route -A inet6 del $net/$mask gw $gw_ip \n";
if ( $gw_ip == "" || $gw_ip == "::" ) {
$cmd = "grep \"$net/$mask dev $ifname\" $conf_file";
$route_conf = " up route -A inet6 add $net/$mask dev $ifname \n down route -A inet6 del $net/$mask dev $ifname \n";
} else {
$cmd = "grep \"$net/$mask gw $gw_ip\" $conf_file";
$route_conf = " up route -A inet6 add $net/$mask gw $gw_ip \n down route -A inet6 del $net/$mask gw $gw_ip \n";
}
}
else { #ipv4
$cmd = "grep \"-net $net netmask $mask gw $gw_ip\" $conf_file";
$route_conf = " up route add -net $net netmask $mask gw $gw_ip \n down route del -net $net netmask $mask gw $gw_ip \n";
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$route_conf = " up route add -net $net netmask $mask dev $ifname \n down route del -net $net netmask $mask dev $ifname \n";
} else {
$route_conf = " up route add -net $net netmask $mask gw $gw_ip \n down route del -net $net netmask $mask gw $gw_ip\n";
}
}
#fine the corresponding config in the config file
@@ -1183,10 +1242,18 @@ sub deletePersistentRoute_Debian{
preParse_Debian();
#ipv6
if ( $net =~ /:/){
$match = "$net/$mask gw $gw_ip";
if ( $gw_ip == "" || $gw_ip == "::" ) {
$match = "$net/$mask dev $ifname";
} else {
$match = "$net/$mask gw $gw_ip";
}
}
else {
$match = "net $net netmask $mask gw $gw_ip";
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$match = "net $net netmask $mask dev $ifname";
} else {
$match = "net $net netmask $mask gw $gw_ip";
}
}
open(FH, "<", $conf_file);
+52
View File
@@ -956,6 +956,8 @@ sub mkinstall
my $tmppkgdir=$pkgdir;
my @srcdirs = split(",", $pkgdir);
$pkgdir = $srcdirs[0];
# trim the "/" in /install/sles11.3/x86_64/
$pkgdir =~ s/\/$//;
if( $pkgdir =~/^($installroot\/$os\/$arch)$/) {
$srcdirs[0]="$pkgdir/1";
$tmppkgdir=join(",", @srcdirs);
@@ -1072,6 +1074,14 @@ sub mkinstall
{
$netserver = $ent->{nfsserver};
}
if ($::XCATSITEVALS{managedaddressmode} =~ /static/){
unless($netserver eq '!myipfn!'){
my($host,$ip)=xCAT::NetworkUtils->gethostnameandip($netserver);
$netserver=$ip;
}
}
my $httpprefix = $pkgdir;
if ($installroot =~ /\/$/) { #must prepend /install/
$httpprefix =~ s/^$installroot/\/install\//;
@@ -1136,6 +1146,48 @@ sub mkinstall
$kcmdline .= " dud=file:/cus_driverdisk/$_";
}
#if site.managedaddressmode=static, specify the network configuration as kernel options
#to avoid multicast dhcp
if($::XCATSITEVALS{managedaddressmode} =~ /static/){
my ($ipaddr,$hostname,$gateway,$netmask)=xCAT::NetworkUtils->getNodeNetworkCfg($node);
unless($ipaddr) {
$callback->(
{
error => [
"cannot resolve the ip address of $node"
],
errorcode => [1]
}
);
}
if($gateway eq '<xcatmaster>'){
$gateway = xCAT::NetworkUtils->my_ip_facing($ipaddr);
}
$kcmdline .=" hostip=$ipaddr netmask=$netmask gateway=$gateway hostname=$hostname ";
my %nameservers=%{xCAT::NetworkUtils->getNodeNameservers([$node])};
my @nameserverARR=split (",",$nameservers{$node});
my @nameserversIP;
foreach (@nameserverARR)
{
my $ip;
if($_ eq '<xcatmaster>'){
$ip = xCAT::NetworkUtils->my_ip_facing($gateway);
}else{
(undef,$ip) = xCAT::NetworkUtils->gethostnameandip($_);
}
push @nameserversIP, $ip;
}
if(scalar @nameserversIP){
$kcmdline .=" dns=".join(",",@nameserversIP);
}
}
if (defined $sent->{serialport})
{
unless ($sent->{serialspeed})
+21 -6
View File
@@ -957,7 +957,7 @@ sub tabprune
push @{$rsp{data}}, " tabprune <tablename> [-V] -d <# of days>";
push @{$rsp{data}}, " tabprune [-h|--help]";
push @{$rsp{data}}, " tabprune [-v|--version]";
push @{$rsp{data}}, " tables supported:eventlog,auditlog";
push @{$rsp{data}}, " tables supported:eventlog,auditlog,unless -a which supports all tables";
push @{$rsp{data}}, " -d option only supported for eventlog,auditlog";
if ($exitcode) { $rsp{errorcode} = $exitcode; }
$cb->(\%rsp);
@@ -997,7 +997,7 @@ sub tabprune
}
$table=~ s/\s*//g; # remove blanks
if (($table ne "eventlog") && ($table ne "auditlog") && ($table ne "isnm_perf") && ($table ne "isnm_perf_sum") ) {
if (($table ne "eventlog") && ($table ne "auditlog") && ($table ne "isnm_perf") && ($table ne "isnm_perf_sum") && (! $ALL)) {
my %rsp;
$rsp{data}->[0] = "Table $table not supported, see tabprune -h for supported tables.";
$rsp{errorcode} = 1;
@@ -2654,7 +2654,7 @@ sub getTablesNodesAttribs
my %noderecs;
my $recs;
# build the table name record
@{$noderecs{table}->[0]->{tablename}} = $tablename;
#@{$noderecs{table}->[0]->{tablename}} = $tablename;
# if request for ALL attributes
if (grep (/ALL/,@attrs)) { # read the schema and build array of all attrs
@attrs=();
@@ -2681,6 +2681,7 @@ sub getTablesNodesAttribs
}
}
@{$noderecs{table}->[0]->{tablename}} = $tablename;
push @{$rsp{"table"}}, @{$noderecs{table}};
} # end of all table processing
# for checkin XML created
@@ -2752,9 +2753,9 @@ sub getTablesAllRowAttribs
my $attr = $tabhash->{attr};
my @attrs=@$attr;
my $tab=xCAT::Table->new($tablename);
my %noderecs;
my %tblrecs;
# build the table name record
@{$noderecs{table}->[0]->{tablename}} = $tablename;
@{$tblrecs{table}->[0]->{tablename}} = $tablename;
# if request for ALL attributes
if (grep (/ALL/,@attrs)) { # read the schema and build array of all attrs
@attrs=();
@@ -2767,7 +2768,6 @@ sub getTablesAllRowAttribs
}
# read all the attributes in this table
my @recs = $tab->getAllAttribs(@attrs);
my %tblrecs;
foreach my $rec (@recs) {
my %datseg=();
foreach my $key (keys %$rec) {
@@ -2975,6 +2975,21 @@ sub getAttribs
# <comments>This is a comment</comments>
#</xcatrequest>
#
#
#<xcatrequest>
#<clienttype>PCM</clienttype>
#<command>setAttribs</command>
#<table>networks</table>
#<keys>
# <net>10.0.1.0</net>
# <mask>255.255.255.0</mask>
#</keys>
#<attr>
# <netname>mynet</netname>
# <gateway>10.0.1.254</gateway>
#</attr>
#</xcatrequest>
sub setAttribs
{
my $request = shift;
+89 -32
View File
@@ -14,6 +14,7 @@ use xCAT::Schema;
use Data::Dumper;
use xCAT::Utils;
use xCAT::SvrUtils;
use xCAT::Scope;
use xCAT::Usage;
use Storable qw(dclone);
use xCAT::TableUtils;
@@ -188,6 +189,7 @@ sub preprocess_updatenode
my @requests = ();
my $installdir = xCAT::TableUtils->getInstallDir();
my $localhost = hostname();
# subroutine to display the usage
sub updatenode_usage
@@ -251,20 +253,40 @@ sub preprocess_updatenode
$callback->($rsp);
return;
}
# Just generate mypostscripts file and get out
# preprocess generate mypostscripts files (-g) for hierarchy
# if no sharedtftp then we need to broadcast this updatenode -g to all service nodes inorder
# to be able to support service node pools
#
if ($::GENMYPOST)
{
# precreatemypostscript has to be yes/1 or do nothing
my @entries = xCAT::TableUtils->get_site_attribute("precreatemypostscripts");
if ($entries[0] ) {
$entries[0] =~ tr/a-z/A-Z/;
if ($entries[0] =~ /^(1|YES)$/ ) {
my $notmpfiles=1;
my $nofiles=0;
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
my $rsp = {};
$rsp->{data}->[0] = "Generated new mypostscript files";
$callback->($rsp);
# now check if sharedtftp = 0, if it is we need to broadcast to all the servicenode
# if there are service nodes
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $t_entry = $entries[0];
if ( defined($t_entry) and ($t_entry eq "0" or $t_entry eq "no" or $t_entry eq "NO")) {
# see if there are any servicenodes. If so then run updatenode -g on all of them
my @SN;
my @CN;
my $nodes = $request->{node};
xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN);
if (@CN >0 ) { # if compute nodes broadcast to all servicenodes
return xCAT::Scope->get_broadcast_scope($request,@_);
}
} else { # sharedtftp=yes, just run on MN
my $notmpfiles=1;
my $nofiles=0;
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
my $rsp = {};
$rsp->{data}->[0] = "Generated new mypostscript files on $localhost";
$callback->($rsp);
return 0;
}
} else { # not valid unless precreatemypostscripts enabled
my $rsp = {};
$rsp->{error}->[0] =
@@ -273,7 +295,7 @@ sub preprocess_updatenode
$callback->($rsp);
return ;
}
} else { # not in the site table
} else { # precreatemypostscripts not in the site table
my $rsp = {};
$rsp->{error}->[0] =
"This option is only valid if site table precreatemypostscripts attribute is 1 or YES";
@@ -281,8 +303,9 @@ sub preprocess_updatenode
$callback->($rsp);
return ;
}
return 0;
}
} # end GENMYPOST
# -c must work with -S for AIX node
if ($::CMDLINE && !$::SWMAINTENANCE)
@@ -1010,27 +1033,6 @@ sub updatenode
}
#create each /tftpboot/mypostscript/mypostscript.<nodename> for each node
# This first removes the old one if precreatemypostscripts =0 or undefined
# call create files but no tmp files
my $notmpfiles=1;
my $nofiles=0;
#my $nofiles=1;
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
# convert the hashes back to the way they were passed in
my $flatreq = xCAT::InstUtils->restore_request($request, $callback);
my $imgdefs;
my $updates;
if ($flatreq->{imagedef})
{
$imgdefs = $flatreq->{imagedef};
}
if ($flatreq->{updateinfo})
{
$updates = $flatreq->{updateinfo};
}
# get the NIM primary server name
my $nimprime = xCAT::InstUtils->getnimprime();
chomp $nimprime;
@@ -1043,6 +1045,7 @@ sub updatenode
'A|updateallsw' => \$::ALLSW,
'c|cmdlineonly' => \$::CMDLINE,
'd=s' => \$::ALTSRC,
'g|genmypost' => \$::GENMYPOST,
'h|help' => \$::HELP,
'v|version' => \$::VERSION,
'V|verbose' => \$::VERBOSE,
@@ -1085,6 +1088,60 @@ sub updatenode
$::attrres{$attr} = $value;
}
}
# Just generate mypostscripts file and get out
if ($::GENMYPOST)
{
my @entries = xCAT::TableUtils->get_site_attribute("precreatemypostscripts");
if ($entries[0] ) {
$entries[0] =~ tr/a-z/A-Z/;
if ($entries[0] =~ /^(1|YES)$/ ) {
my $notmpfiles=1;
my $nofiles=0;
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
my $rsp = {};
$rsp->{data}->[0] = "Generated new mypostscript files on $localhostname";
$callback->($rsp);
} else { # not valid unless precreatemypostscripts enabled
my $rsp = {};
$rsp->{error}->[0] =
"This option is only valid if site table precreatemypostscripts attribute is 1 or YES";
$rsp->{errorcode}->[0] =1;
$callback->($rsp);
return ;
}
} else { # not in the site table
my $rsp = {};
$rsp->{error}->[0] =
"This option is only valid if site table precreatemypostscripts attribute is 1 or YES";
$rsp->{errorcode}->[0] =1;
$callback->($rsp);
return ;
}
return 0;
}
#create each /tftpboot/mypostscript/mypostscript.<nodename> for each node
# This first removes the old one if precreatemypostscripts =0 or undefined
# call create files but no tmp files
my $notmpfiles=1;
my $nofiles=0;
#my $nofiles=1;
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
# convert the hashes back to the way they were passed in
my $flatreq = xCAT::InstUtils->restore_request($request, $callback);
my $imgdefs;
my $updates;
if ($flatreq->{imagedef})
{
$imgdefs = $flatreq->{imagedef};
}
if ($flatreq->{updateinfo})
{
$updates = $flatreq->{updateinfo};
}
# if not just using the -k flag, then set all nodes to syncing in
# nodelist updatestatus for the other updatenode options
if (!($::SECURITY)) {
File diff suppressed because it is too large Load Diff
+183
View File
@@ -0,0 +1,183 @@
#!/usr/bin/perl
package xCAT_plugin::vlan;
BEGIN
{
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
}
use lib "$::XCATROOT/lib/perl";
use strict;
use warnings "all";
use xCAT::GlobalDef;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::SvrUtils;
use xCAT::Usage;
use xCAT::NodeRange;
sub handled_commands {
return {
mkvlan => 'switch:vlan,port,switch', # in progress
chvlan => 'switch:vlan,port,switch', # in progress
lsvlan => 'switch:vlan,port,switch', # in progress
rmvlan => 'switch:vlan,port,switch', # in progress
}
}
use POSIX "WNOHANG";
use IO::Handle;
use IO::Socket;
use IO::Select;
#local to module
my $callback;
my $timeout;
my $port;
my $debug;
my $ndebug = 0;
my $sock;
my $noclose;
my %sessiondata; #hold per session variables, in preparation for single-process strategy
my %pendingtransactions; #list of peers with callbacks, callback arguments, and timer expiry data
my $enable_cache="yes";
my $cache_dir = "/var/cache/xcat";
my $vlanid;
sub process_request
{
my $req = shift;
my $callback = shift;
my $reqcmd = shift;
if ($command eq 'mkvlan')
{
return mkvlan($req, $callback, $reqcmd);
}
elsif ($command eq 'chvlan')
{
return chvlan($req, $callback, $reqcmd);
}
elsif ($command eq 'lsvlan')
{
return lsvlan($req, $callback, $reqcmd);
}
elsif ($command eq 'rmvlan')
{
return rmvlan($req, $callback, $reqcmd);
}
}
sub mkvlan
{
my $request = shift;
my $callback = shift;
my $reqcmd = shift;
# Variables for this function
my $vlanid;
# A quick function for usage information for the command
my $mkvlan_usage = sub {
my $exitcode = shift @_;
my %rsp;
push @{$rsp{data}}, "Usage: mkvlan [vlanid] -n noderange [-t subnet | -m netmask | -i interface]";
push @{$rsp{data}}, " mkvlan [-?|-h|--help]";
if ($exitcode) { $rsp{errorcode} = $exitcode; }
$callback->(\%rsp);
};
# Go through the arguments, and get the relevant information
@ARGV = @{$req->{arg}};
#Detect if the first variable is a number or not, as it may be the vlanid
if ($ARGV[0] !~ /\D/) {$vlanid=$ARGV[0];}
GetOptions(
't=s' => \$subnet,
'm=s' => \$mask,
'n=s' => \$noderange,
'i=s' => \$interface,
'h|?|help' => \$help,
'v|version' => \$VERSION,
);
# Show usage info if help is defined
if ($help) { $mkvlan_usage->(0); return;}
# Node range must be defined
if (!defined($noderange)) { $mkvlan_usage->(1); return;}
# Display the version of the code
if ($VERSION) {
my %rsp;
my $version = xCAT::Utils->Version();
$rsp{data}->[0] = "$version";
$cb->(\%rsp);
return;
}
# put the nodes in an array
my @nodes = split(/,/,$noderange);
my $swtab = xCAT::Table->new('switch');
my $swhash = $swtab->getNodesAttribs(\@nodes,['switch','vlan','port','interface']);
foreach (@nodes)
{
my $node = $_;
foreach (@$swhash->{$node})
{
my $nswhash = $_;
my $switch = $nswhash->{'switch'};
my $vlan = $nswhash->{'vlan'};
my $port = $nswhash->{'port'};
my $swinterface = $nswhash->{'interface'};
if ($vlanid == "" || !defined($vlanid)) {$vlanid = $vlan;}
if ($interface == "" || !defined($interface)) { $interface = $swinterface;}
}
}
sub lsvlan
{
my $request = shift;
my $callback = shift;
my $reqcmd = shift;
my @args = @{$req->{arg}} if(exists($req->{arg}));
# A quick function for usage information for the command
my $lsvlan_usage = sub {
my $exitcode = shift @_;
my %rsp;
push @{$rsp{data}}, "Usage: mkvlan vlanid";
push @{$rsp{data}}, " mkvlan [-?|-h|--help]";
if ($exitcode) { $rsp{errorcode} = $exitcode; }
$callback->(\%rsp);
};
# Go through the arguments, and get the relevant information
@ARGV = @{$req->{arg}};
#Detect if the first variable is a number or not, as it may be the vlanid
if ($ARGV[0] !~ /\D/) {$vlanid=$ARGV[0];}
GetOptions(
'h|?|help' => \$help,
);
# Show usage info if help is defined
if ($help) { $lsvlan_usage->(0); return; }
# Show usage if we have less then 2 arguments, or the vlan option is not defined
if (scalar(@ARGV)<1 || !defined($vlanid)) { $lsvlan_usage->(1); return; }
}
1;
+30 -32
View File
@@ -11,9 +11,6 @@ use Getopt::Long;
use xCAT::MsgUtils;
use xCAT::ServiceNodeUtils;
use xCAT::TableUtils;
my $addkcmdlinehandled;
my $request;
my $callback;
my $dhcpconf = "/etc/dhcpd.conf";
my $tftpdir = "/tftpboot/vsmp";
#my $dhcpver = 3;
@@ -75,7 +72,7 @@ sub setstate {
my %chainhash = %{shift()};
my %machash = %{shift()};
my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']);
if (not $addkcmdlinehandled->{$node} and $kern->{addkcmdline}) { #Implement the kcmdline append here for
if (not $::VSMPPXE_addkcmdlinehandled->{$node} and $kern->{addkcmdline}) { #Implement the kcmdline append here for
#most generic, least code duplication
$kern->{kcmdline} .= " ".$kern->{addkcmdline};
}
@@ -84,7 +81,7 @@ sub setstate {
unless ($ipfn) {
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
$callback->(
$::VSMPPXE_callback->(
{
error => [
"$myname: Unable to determine or reasonably guess the image server for $node"
@@ -189,11 +186,11 @@ sub pass_along {
$errored=1;
}
if ($_->{_addkcmdlinehandled}) {
$addkcmdlinehandled->{$_->{name}->[0]}=1;
$::VSMPPXE_addkcmdlinehandled->{$_->{name}->[0]}=1;
return; #Don't send back to client this internal hint
}
}
$callback->($resp);
$::VSMPPXE_callback->($resp);
}
@@ -288,29 +285,30 @@ sub preprocess_request {
}
sub process_request {
$request = shift;
$callback = shift;
$::VSMPPXE_request = shift;
$::VSMPPXE_callback = shift;
my $sub_req = shift;
undef $::VSMPPXE_addkcmdlinehandled;
my @args;
my @nodes;
my @rnodes;
if (ref($request->{node})) {
@rnodes = @{$request->{node}};
if (ref($::VSMPPXE_request->{node})) {
@rnodes = @{$::VSMPPXE_request->{node}};
} else {
if ($request->{node}) {
@rnodes = ($request->{node});
if ($::VSMPPXE_request->{node}) {
@rnodes = ($::VSMPPXE_request->{node});
}
}
unless (@rnodes) {
if ($usage{$request->{command}->[0]}) {
$callback->({data=>$usage{$request->{command}->[0]}});
if ($usage{$::VSMPPXE_request->{command}->[0]}) {
$::VSMPPXE_callback->({data=>$usage{$::VSMPPXE_request->{command}->[0]}});
}
return;
}
#if not shared, then help sync up
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::VSMPPXE_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
@nodes = ();
foreach (@rnodes) {
if (xCAT::NetworkUtils->nodeonmynet($_)) {
@@ -329,17 +327,17 @@ sub process_request {
return;
}
if (ref($request->{arg})) {
@args=@{$request->{arg}};
if (ref($::VSMPPXE_request->{arg})) {
@args=@{$::VSMPPXE_request->{arg}};
} else {
@args=($request->{arg});
@args=($::VSMPPXE_request->{arg});
}
#now run the begin part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
if ($::VSMPPXE_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runbeginpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
@@ -352,7 +350,7 @@ sub process_request {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running begin prescripts\n";
$callback->($rsp);
$::VSMPPXE_callback->($rsp);
return;
}
}
@@ -375,7 +373,7 @@ sub process_request {
if (! -r "$tftpdir/pxelinux.0") {
unless (-r "/usr/lib/syslinux/pxelinux.0" or -r "/usr/share/syslinux/pxelinux.0") {
$callback->({error=>["Unable to find pxelinux.0 "],errorcode=>[1]});
$::VSMPPXE_callback->({error=>["Unable to find pxelinux.0 "],errorcode=>[1]});
return;
}
if (-r "/usr/lib/syslinux/pxelinux.0") {
@@ -386,14 +384,14 @@ sub process_request {
chmod(0644,"$tftpdir/pxelinux.0");
}
unless ( -r "$tftpdir/pxelinux.0" ) {
$callback->({errror=>["Unable to find pxelinux.0 from syslinux"],errorcode=>[1]});
$::VSMPPXE_callback->({errror=>["Unable to find pxelinux.0 from syslinux"],errorcode=>[1]});
return;
}
$errored=0;
my $inittime=0;
if (exists($request->{inittime})) { $inittime= $request->{inittime}->[0];}
if (exists($::VSMPPXE_request->{inittime})) { $inittime= $::VSMPPXE_request->{inittime}->[0];}
if (!$inittime) { $inittime=0;}
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$sub_req->({command=>['setdestiny'],
@@ -414,19 +412,19 @@ sub process_request {
$response{node}->[0]->{name}->[0]=$_;
if ($args[0] eq 'stat') {
$response{node}->[0]->{data}->[0]= getstate($_);
$callback->(\%response);
$::VSMPPXE_callback->(\%response);
} elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate
($rc,$errstr) = setstate($_,\%bphash,\%chainhash,\%machash);
if ($rc) {
$response{node}->[0]->{errorcode}->[0]= $rc;
$response{node}->[0]->{errorc}->[0]= $errstr;
$callback->(\%response);
$::VSMPPXE_callback->(\%response);
}
}
}
my $inittime=0;
if (exists($request->{inittime})) { $inittime= $request->{inittime}->[0];}
if (exists($::VSMPPXE_request->{inittime})) { $inittime= $::VSMPPXE_request->{inittime}->[0];}
if (!$inittime) { $inittime=0;}
#dhcp stuff -- inittime is set when xcatd on sn is started
@@ -443,12 +441,12 @@ sub process_request {
#}
if ($do_dhcpsetup) {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::VSMPPXE_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],arg=>['-l'],
node=>\@nodes},$callback);
node=>\@nodes},$::VSMPPXE_callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@nodes},$callback);
node=>\@nodes},$::VSMPPXE_callback);
}
}
@@ -456,7 +454,7 @@ sub process_request {
#now run the end part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact')
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
if ($::VSMPPXE_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runendpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
@@ -469,7 +467,7 @@ sub process_request {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running end prescripts\n";
$callback->($rsp);
$::VSMPPXE_callback->($rsp);
return;
}
}
+1 -1
View File
@@ -412,7 +412,7 @@ sub mkinstall
$custmplpath = "$installroot/custom/install/hyperv";
$tmplpath = "$::XCATROOT/share/xcat/install/hyperv";
}
my $tmplfile=xCAT::SvrUtils::get_tmpl_file_name($custmplpath, $profile, $os, $arch);
$tmplfile=xCAT::SvrUtils::get_tmpl_file_name($custmplpath, $profile, $os, $arch);
if (! $tmplfile) { $tmplfile=xCAT::SvrUtils::get_tmpl_file_name($tmplpath, $profile, $os, $arch); }
}
+2 -2
View File
@@ -199,7 +199,7 @@ sub prexcat2nim
my @nodelist=(); # pass back list of nodes - if applicable
my @servicenodes=(); # pass back list of service nodes - if applicable
if (defined(@{$::args})) {
if ( defined ($::args) && @{$::args} ) {
@ARGV = @{$::args};
} else {
&xcat2nim_usage($callback);
@@ -359,7 +359,7 @@ sub processArgs
my $gotattrs = 0;
if (defined(@{$::args})) {
if ( defined ($::args) && @{$::args} ) {
@ARGV = @{$::args};
} else {
return 3;
+29 -30
View File
@@ -11,9 +11,7 @@ use Getopt::Long;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
my $addkcmdlinehandled;
my $request;
my $callback;
my $dhcpconf = "/etc/dhcpd.conf";
#my $tftpdir = "/tftpboot";
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
@@ -102,7 +100,7 @@ sub setstate {
if (ref $linuximghashref) { %linuximghash = %{$linuximghashref}; }
my $imgaddkcmdline=($linuximghash{'boottarget'})? undef:$linuximghash{'addkcmdline'};
my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']);
unless ($addkcmdlinehandled->{$node}) { #Tag to let us know the plugin had a special syntax implemented for addkcmdline
unless ($::XNBA_addkcmdlinehandled->{$node}) { #Tag to let us know the plugin had a special syntax implemented for addkcmdline
if ($kern->{addkcmdline} or ($imgaddkcmdline)) {
#Implement the kcmdline append here for
@@ -138,7 +136,7 @@ sub setstate {
$kcmdlinehack =~ s/#TABLE:([^:#]+):([^:#]+):([^:#]+)#/$naval/;
} else {
my $msg = "Table key of $2 not yet supported by boottarget mini-template";
$callback->({
$::XNBA_callback->({
error => ["$msg"],
errorcode => [1]
});
@@ -279,11 +277,11 @@ sub pass_along {
$errored=1;
}
if ($_->{_addkcmdlinehandled}) {
$addkcmdlinehandled->{$_->{name}->[0]}=1;
$::XNBA_addkcmdlinehandled->{$_->{name}->[0]}=1;
return; #Don't send back to client this internal hint
}
}
$callback->($resp);
$::XNBA_callback->($resp);
}
@@ -376,27 +374,28 @@ sub preprocess_request {
}
sub process_request {
$request = shift;
$callback = shift;
$::XNBA_request = shift;
$::XNBA_callback = shift;
my $sub_req = shift;
undef $::XNBA_addkcmdlinehandled; # clear out any previous value
my @args;
my @nodes;
my @rnodes;
if (ref($request->{node})) {
@rnodes = @{$request->{node}};
if (ref($::XNBA_request->{node})) {
@rnodes = @{$::XNBA_request->{node}};
} else {
if ($request->{node}) { @rnodes = ($request->{node}); }
if ($::XNBA_request->{node}) { @rnodes = ($::XNBA_request->{node}); }
}
unless (@rnodes) {
if ($usage{$request->{command}->[0]}) {
$callback->({data=>$usage{$request->{command}->[0]}});
if ($usage{$::XNBA_request->{command}->[0]}) {
$::XNBA_callback->({data=>$usage{$::XNBA_request->{command}->[0]}});
}
return;
}
#if not shared, then help sync up
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::XNBA_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
@nodes = ();
foreach (@rnodes) {
if (xCAT::NetworkUtils->nodeonmynet($_)) {
@@ -415,16 +414,16 @@ sub process_request {
return;
}
if (ref($request->{arg})) {
@args=@{$request->{arg}};
if (ref($::XNBA_request->{arg})) {
@args=@{$::XNBA_request->{arg}};
} else {
@args=($request->{arg});
@args=($::XNBA_request->{arg});
}
#now run the begin part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
if ($::XNBA_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runbeginpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
@@ -437,7 +436,7 @@ sub process_request {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running begin prescripts.\n";
$callback->($rsp);
$::XNBA_callback->($rsp);
return;
}
}
@@ -445,21 +444,21 @@ sub process_request {
#back to normal business
if (! -r "$globaltftpdir/xcat/pxelinux.0") {
unless (-r $::XCATROOT."/share/xcat/netboot/syslinux/pxelinux.0") {
$callback->({error=>["Unable to find pxelinux.0 at ".$::XCATROOT."/share/xcat/netboot/syslinux/pxelinux.0"],errorcode=>[1]});
$::XNBA_callback->({error=>["Unable to find pxelinux.0 at ".$::XCATROOT."/share/xcat/netboot/syslinux/pxelinux.0"],errorcode=>[1]});
return;
}
copy($::XCATROOT."/share/xcat/netboot/syslinux/pxelinux.0","$globaltftpdir/xcat/pxelinux.0");
chmod(0644,"$globaltftpdir/xcat/pxelinux.0");
}
unless ( -r "$globaltftpdir/xcat/pxelinux.0" ) {
$callback->({error=>["Unable to find pxelinux.0 from syslinux"],errorcode=>[1]});
$::XNBA_callback->({error=>["Unable to find pxelinux.0 from syslinux"],errorcode=>[1]});
return;
}
my $inittime=0;
if (exists($request->{inittime})) { $inittime= $request->{inittime}->[0];}
if (exists($::XNBA_request->{inittime})) { $inittime= $::XNBA_request->{inittime}->[0];}
if (!$inittime) { $inittime=0;}
$errored=0;
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
@@ -499,7 +498,7 @@ sub process_request {
$response{node}->[0]->{name}->[0]=$_;
if ($args[0] eq 'stat') {
$response{node}->[0]->{data}->[0]= getstate($_,$tftpdir);
$callback->(\%response);
$::XNBA_callback->(\%response);
} elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate
my $rc;
my $errstr;
@@ -514,7 +513,7 @@ sub process_request {
#if ($rc) {
# $response{node}->[0]->{errorcode}->[0]= $rc;
# $response{node}->[0]->{errorc}->[0]= $errstr;
# $callback->(\%response);
# $::XNBA_callback->(\%response);
#}
if($args[0] eq 'offline') {
unlink($tftpdir."/xcat/xnba/nodes/".$_);
@@ -540,12 +539,12 @@ sub process_request {
#}
if ($do_dhcpsetup) {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::XNBA_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],arg=>['-l'],
node=>\@nodes},$callback);
node=>\@nodes},$::XNBA_callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@nodes},$callback);
node=>\@nodes},$::XNBA_callback);
}
}
}
@@ -553,7 +552,7 @@ sub process_request {
#now run the end part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact')
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
if ($::XNBA_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runendpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
@@ -566,7 +565,7 @@ sub process_request {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running end prescripts.\n";
$callback->($rsp);
$::XNBA_callback->($rsp);
return;
}
}
+52 -47
View File
@@ -13,11 +13,8 @@ use Socket;
use Getopt::Long;
use xCAT::Table;
my $request;
my %breaknetbootnodes;
our %normalnodes;
my $callback;
my $sub_req;
my $dhcpconf = "/etc/dhcpd.conf";
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
#my $dhcpver = 3;
@@ -104,7 +101,7 @@ sub setstate {
if (xCAT::InstUtils->is_me($sn)) {
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
$::callback->(
$::YABOOT_callback->(
{
error => [
"$myname: Unable to determine the image server for $node on service node $sn"
@@ -116,7 +113,7 @@ sub setstate {
}
}
} else {
$::callback->(
$::YABOOT_callback->(
{
error => [
"$myname: Unable to determine the image server for $node"
@@ -177,7 +174,7 @@ sub setstate {
delete $normalnodes{$node}; #Signify to omit this from one makedhcp command
#$sub_req->({command=>['makedhcp'], #batched elsewhere, this code is stale, hopefully
# node=>[$node],
# arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback);
# arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$::YABOOT_callback);
print $pcfg "bye\n";
close($pcfg);
} elsif ($kern and $kern->{kernel}) {
@@ -231,13 +228,13 @@ sub setstate {
#to clear the filename field, so the logic is a little
#opposite
# $sub_req->({command=>['makedhcp'], #This is currently batched elswhere
# node=>[$node]},$callback); #It hopefully will perform correctly
# node=>[$node]},$::YABOOT_callback); #It hopefully will perform correctly
if ($cref and $cref->{currstate} eq "boot") {
$breaknetbootnodes{$node}=1;
delete $normalnodes{$node}; #Signify to omit this from one makedhcp command
#$sub_req->({command=>['makedhcp'], #batched elsewhere, this code is stale, hopefully
# node=>[$node],
# arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback);
# arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$::YABOOT_callback);
print $pcfg "bye\n";
close($pcfg);
} elsif ($kern and $kern->{kernel}) {
@@ -309,7 +306,7 @@ sub pass_along {
# print Dumper($resp);
$callback->($resp);
$::YABOOT_callback->($resp);
if ($resp and ($resp->{errorcode} and $resp->{errorcode}->[0]) or ($resp->{error} and $resp->{error}->[0])) {
$errored=1;
}
@@ -409,31 +406,30 @@ sub preprocess_request {
sub process_request {
$request = shift;
$callback = shift;
$::callback=$callback;
$sub_req = shift;
my $command = $request->{command}->[0];
$::YABOOT_request = shift;
$::YABOOT_callback = shift;
my $sub_req = shift;
my $command = $::YABOOT_request->{command}->[0];
%breaknetbootnodes=();
%normalnodes=();
my @args;
my @nodes;
my @rnodes;
if (ref($request->{node})) {
@rnodes = @{$request->{node}};
if (ref($::YABOOT_request->{node})) {
@rnodes = @{$::YABOOT_request->{node}};
} else {
if ($request->{node}) { @rnodes = ($request->{node}); }
if ($::YABOOT_request->{node}) { @rnodes = ($::YABOOT_request->{node}); }
}
unless (@rnodes) {
if ($usage{$request->{command}->[0]}) {
$callback->({data=>$usage{$request->{command}->[0]}});
if ($usage{$::YABOOT_request->{command}->[0]}) {
$::YABOOT_callback->({data=>$usage{$::YABOOT_request->{command}->[0]}});
}
return;
}
#if not shared tftpdir, then filter, otherwise, set up everything
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
@nodes = ();
foreach (@rnodes) {
if (xCAT::NetworkUtils->nodeonmynet($_)) {
@@ -452,16 +448,16 @@ sub process_request {
return;
}
if (ref($request->{arg})) {
@args=@{$request->{arg}};
if (ref($::YABOOT_request->{arg})) {
@args=@{$::YABOOT_request->{arg}};
} else {
@args=($request->{arg});
@args=($::YABOOT_request->{arg});
}
#now run the begin part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runbeginpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
@@ -474,14 +470,14 @@ sub process_request {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running begin prescripts.\n";
$callback->($rsp);
$::YABOOT_callback->($rsp);
return;
}
}
#back to normal business
my $inittime=0;
if (exists($request->{inittime})) { $inittime= $request->{inittime}->[0];}
if (exists($::YABOOT_request->{inittime})) { $inittime= $::YABOOT_request->{inittime}->[0];}
if (!$inittime) { $inittime=0;}
$errored=0;
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
@@ -521,7 +517,7 @@ sub process_request {
$response{node}->[0]->{name}->[0]=$_;
if ($args[0] eq 'stat') {
$response{node}->[0]->{data}->[0]= getstate($_,$tftpdir);
$callback->(\%response);
$::YABOOT_callback->(\%response);
} elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate
my $ent = $typehash->{$_}->[0];
my $osimgname = $ent->{'provmethod'};
@@ -534,7 +530,7 @@ sub process_request {
if ($rc) {
$response{node}->[0]->{errorcode}->[0]= $rc;
$response{node}->[0]->{errorc}->[0]= $errstr;
$callback->(\%response);
$::YABOOT_callback->(\%response);
}
}
}# end of foreach node
@@ -571,7 +567,16 @@ sub process_request {
$osn = $2;
$osm = 0;
}
#Redhat recommend to use grub2 instead of yaboot for rhels7 provision
if ( $osv =~ /rh/ and int($osn) == 7 ){
my $rsp;
push @{$rsp->{data}},
"stop configuration because yaboot DOES NOT work for $os provision, please change noderes.netboot=grub2 instead.\n";
xCAT::MsgUtils->message("E", $rsp, $::YABOOT_callback);
return;
}
if (($osv =~ /rh/ and int($osn) < 6) or
($osv =~ /sles/ and int($osn) < 11)) {
# check if yaboot-xcat installed
@@ -580,7 +585,7 @@ sub process_request {
my $rsp;
push @{$rsp->{data}},
"stop configuration because yaboot-xcat need to be installed for $os.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
xCAT::MsgUtils->message("E", $rsp, $::YABOOT_callback);
return;
}
} elsif (($osv =~ /rh/ and int($osn) >= 6) or
@@ -591,7 +596,7 @@ sub process_request {
my $rsp;
push @{$rsp->{data}},
"stop configuration because rsync does not exist or is not executable.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
xCAT::MsgUtils->message("E", $rsp, $::YABOOT_callback);
return;
}
my $yabootpath = $tftpdir."/yb/".$os;
@@ -613,7 +618,7 @@ sub process_request {
my $rsp;
push @{$rsp->{data}},
"stop configuration because Unable to find the os shipped yaboot file.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
xCAT::MsgUtils->message("E", $rsp, $::YABOOT_callback);
return;
}
@@ -624,7 +629,7 @@ sub process_request {
my $rsp;
push @{$rsp->{data}},
"stop configuration because $synccmd failed.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
xCAT::MsgUtils->message("E", $rsp, $::YABOOT_callback);
return;
}
}
@@ -666,42 +671,42 @@ sub process_request {
if (($osv =~ /rh/ and int($osn) >= 6) or
($osv =~ /sles/ and int($osn) >= 11)) {
my $fpath = "/yb/". $osentry."/yaboot";
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],
node=>\@{$osimagenodehash{$osimage}},
arg=>['-l','-s','filename = \"'.$fpath.'\";']},$callback);
arg=>['-l','-s','filename = \"'.$fpath.'\";']},$::YABOOT_callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@{$osimagenodehash{$osimage}},
arg=>['-s','filename = \"'.$fpath.'\";']},$callback);
arg=>['-s','filename = \"'.$fpath.'\";']},$::YABOOT_callback);
}
} else {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command, only change local settings if already farmed
if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command, only change local settings if already farmed
$sub_req->({command=>['makedhcp'],arg=>['-l'],
node=>\@{$osimagenodehash{$osimage}}},$callback);
node=>\@{$osimagenodehash{$osimage}}},$::YABOOT_callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@{$osimagenodehash{$osimage}}},$callback);
node=>\@{$osimagenodehash{$osimage}}},$::YABOOT_callback);
}
}
}
} else {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command, only change local settings if already farmed
if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command, only change local settings if already farmed
$sub_req->({command=>['makedhcp'],arg=>['-l'],
node=>\@normalnodeset},$callback);
node=>\@normalnodeset},$::YABOOT_callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@normalnodeset},$callback);
node=>\@normalnodeset},$::YABOOT_callback);
}
}
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],
node=>\@breaknetboot,
arg=>['-l','-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback);
arg=>['-l','-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$::YABOOT_callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@breaknetboot,
arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback);
arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$::YABOOT_callback);
}
}
}
@@ -709,7 +714,7 @@ sub process_request {
#now run the end part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact')
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runendpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
@@ -722,7 +727,7 @@ sub process_request {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running end prescripts\n";
$callback->($rsp);
$::YABOOT_callback->($rsp);
return;
}
}
+38 -2
View File
@@ -131,6 +131,16 @@ sub process_request
&usage($callback,$command);
exit 1;
}
# if the ARGS still have data we have invalid input
if (@ARGV) {
my $args=join(',', @ARGV);
my $rsp = {};
$rsp->{error}->[0] =
"The input to the command: $command contained invalid arguments: $args.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
exit 1;
}
if ($options{'help'})
{
&usage($callback,$command);
@@ -170,6 +180,14 @@ sub process_request
}
}
}
# cannot enter -K and -k
if (($options{'sshkeypath'}) && ($options{'gensshkeys'})) {
my $rsp = {};
$rsp->{error}->[0] =
"The input of -k and -K is not valid on the command : $command.";
xCAT::MsgUtils->message("E", $rsp, $callback);
exit 1;
}
# check for site.sshbetweennodes attribute, put out a warning it will not be used as long
# as zones are defined in the zone table.
@@ -473,6 +491,18 @@ sub rmzone
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
# see if they input invalid flags
if (($$options{'sshkeypath'}) || ($$options{'gensshkeys'}) ||
( $$options{'addnoderange'}) || ( $$options{'rmnoderange'}) ||
( $$options{'defaultzone'}) ||
($$options{'sshbetweennodes'})) {
my $rsp = {};
$rsp->{error}->[0] =
"The following flags are not valid input for the rmzone command: -k,-K,-a,-r,-f,-s ";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
# check to see if the input zone already exists
# cannot remove it if it is not defined
my $zonename=$request->{zonename};
@@ -590,11 +620,11 @@ sub usage
my $usagemsg2="";
if ($command eq "mkzone") {
$usagemsg1 = " mkzone -h \n mkzone -v \n";
$usagemsg2 = " mkzone <zonename> [-V] [--defaultzone] [-k <full path to the ssh RSA private key] \n [-a <noderange>] [-g] [-f] [-s <yes/no>]";
$usagemsg2 = " mkzone <zonename> [-V] [--defaultzone] [-k <full path to the ssh RSA private key>] \n [-a <noderange>] [-g] [-f] [-s <yes/no>]";
} else {
if ($command eq "chzone") {
$usagemsg1 = " chzone -h \n chzone -v \n";
$usagemsg2 = " chzone <zonename> [-V] [--defaultzone] [-k <full path to the ssh RSA private key] \n [-K] [-a <noderange>] [-r <noderange>] [-g] [-s <yes/no>]";
$usagemsg2 = " chzone <zonename> [-V] [--defaultzone] [-k <full path to the ssh RSA private key>] \n [-K] [-a <noderange>] [-r <noderange>] [-g] [-s <yes/no>]";
} else {
if ($command eq "rmzone") {
$usagemsg1 = " rmzone -h \n rmzone -v \n";
@@ -705,6 +735,9 @@ sub addtozonetable
my $curdefaultzone = xCAT::Zone->getdefaultzone($callback);
if (!(defined ($curdefaultzone))) { # no default defined
$tb_cols{defaultzone} ="yes";
$tab->setAttribs({zonename => $zonename}, \%tb_cols);
$tab->commit();
$tab->close();
} else { # already a default
if ($$options{'force'}) { # force the default
$tb_cols{defaultzone} ="yes";
@@ -780,6 +813,9 @@ sub updatezonetable
my $curdefaultzone = xCAT::Zone->getdefaultzone($callback);
if (!(defined ($curdefaultzone))) { # no default defined
$tb_cols{defaultzone} ="yes";
$tab->setAttribs({zonename => $zonename}, \%tb_cols);
$tab->commit();
$tab->close();
} else { # already a default
if ($$options{'force'}) { # force the default
$tb_cols{defaultzone} ="yes";
+1
View File
@@ -12,6 +12,7 @@ use Getopt::Long;
use strict;
#This or something like this must always be available and not depend on server
#Otherwise, can't set things to let server run in the first place
#
sub usage {
print "Usage:\n";
+6 -94
View File
@@ -1020,44 +1020,6 @@ sub genSSHNodeHostKey
}
# is_lsb_ubuntu return value indicates whether system appears to be Ubuntu.
# Using required /etc/lsb-release file, instead of optional lsb_release command.
sub is_lsb_ubuntu
{
if (open(my $relfile, "<", "/etc/lsb-release")) {
my @text = <$relfile>;
close($relfile);
chomp(@text);
my $distrib_id = '';
foreach (@text) {
if ( $_ =~ /^\s*DISTRIB_ID=(.*)$/ ) {
$distrib_id = $1; # last DISTRIB_ID value in file used
}
}
if ( $distrib_id =~ /^(Ubuntu|"Ubuntu")\s*$/ ) {
return 1; # return "true"
}
}
return 0; # return "false"
}
sub is_debian
{
if ( -e "/etc/debian_version" && -e "/etc/issue"){
open(my $relfile, "<", "/etc/issue");
my $line = <$relfile>;
close($relfile);
if ( $line =~ /debian.*/i ){
return 1;
}
}
return 0;
}
sub is_redhat6sp4
{
if( -e "/etc/redhat-release" ){
@@ -1072,21 +1034,6 @@ sub is_redhat6sp4
}
# on Ubuntu need to painstakingly compare /etc/localtime with files under
# /usr/share/zoneinfo since /etc/localtime # isn't always a symbolic link
sub discover_timezone_ubuntu
{
my $localtime = "/etc/localtime";
my $zoneinfo = "/usr/share/zoneinfo";
my $zone_result = `find $zoneinfo -type f -exec cmp -s $localtime {} \\; -print | grep -v posix | grep -v SystemV`;
my @zones = split /\n/, $zone_result;
$zones[0] =~ s/$zoneinfo\///;
return $zones[0];
}
#-----------------------------------------------------------------------------
@@ -1158,6 +1105,7 @@ sub initDB
# set value based on OS
my ($domain, $timezone);
my $timezone = xCAT::Utils->gettimezone();
if ($::osname eq 'AIX')
{
my ($name, $rest) = split('\.', $hname);
@@ -1170,35 +1118,10 @@ sub initDB
$domain = "";
}
$timezone = $ENV{'TZ'};
}
else # linux
{
$domain = `hostname -d`;
my $tz;
if (-f "/etc/redhat-release")
{
# on Redhat look for "ZONE"
$tz =
`grep ^ZONE /etc/sysconfig/clock|cut -d= -f 2|sed -e 's/"//g'`;
}
elsif ( is_lsb_ubuntu() || is_debian() )
{
$tz = discover_timezone_ubuntu;
if (!$tz){
$tz = `cat /etc/timezone`;
chomp $tz;
}
}
else
{
# on SuSE look for "TIMEZONE"
$tz =
`grep ^TIMEZONE /etc/sysconfig/clock|cut -d= -f 2|sed -e 's/"//g'`;
}
$timezone = $tz;
}
chomp $timezone;
@@ -1264,7 +1187,7 @@ sub initDB
$chtabcmds .= "$::XCATROOT/sbin/chtab key=vsftp site.value=n;";
$chtabcmds .= "$::XCATROOT/sbin/chtab key=cleanupxcatpost site.value=no;";
$chtabcmds .= "$::XCATROOT/sbin/chtab key=dhcplease site.value=43200;";
$chtabcmds .= "$::XCATROOT/sbin/chtab key=useflowcontrol site.value=yes;";
#$chtabcmds .= "$::XCATROOT/sbin/chtab key=useflowcontrol site.value=yes;"; # need to fix 4031
if ($::osname eq 'AIX')
{
@@ -1973,6 +1896,7 @@ sub setuphttp
{
my $cmd;
my $distro = xCAT::Utils->osver();
# restart httpd
if (-e "/etc/init.d/apache2")
{ #for sles/ubuntu
@@ -2000,8 +1924,7 @@ sub setuphttp
# enable httpd
if (-e "/etc/init.d/apache2")
{
if (is_lsb_ubuntu() || is_debian() )
{ # for ubuntu
if ( $distro =~ /ubuntu.*/ || $distro =~ /debian.*/i) {
$cmd = "/usr/sbin/update-rc.d apache2 enable";
}
else
@@ -2009,18 +1932,6 @@ sub setuphttp
$cmd = "/sbin/chkconfig apache2 on";
}
}
# elsif (-e "/sbin/chkconfig")
# {
# $cmd = "/sbin/chkconfig httpd on";
# }
# elsif (-e "/usr/sbin/chkconfig")
# {
# $cmd = "/usr/sbin/chkconfig httpd on";
# }
# else
# {
# $cmd = "chkconfig httpd on";
# }
else
{
my $CHKCONFIG = xCAT::Utils->fullpathbin("chkconfig");
@@ -2253,6 +2164,7 @@ sub setupMNinDB
sub startnamedonboot
{
# start named on boot
my $distro = xCAT::Utils->osver();
if (xCAT::Utils->isAIX())
{
#/etc/inittab
@@ -2272,7 +2184,7 @@ sub startnamedonboot
#chkconfig
my $serv = "named";
my $cmd = "/sbin/chkconfig $serv on";
if ( is_lsb_ubuntu() || is_debian() ){
if ( $distro =~ /ubuntu.*/ || $distro =~ /debian.*/i) {
$serv = "bind9";
$cmd = "update-rc.d $serv enable";
}
+63 -22
View File
@@ -328,35 +328,42 @@ sleep 0.05; #up to 50 ms outage possible
my $conn;
next unless $conn = $socket->accept;
my @clients;
if ($inet6support) {
@clients = gethostbyaddr($conn->peeraddr,AF_INET6);
unless (@clients) { @clients = gethostbyaddr($conn->peeraddr,AF_INET); }
} else {
@clients = gethostbyaddr($conn->peeraddr,AF_INET);
}
my $client_name;
my $client_aliases;
my @clients;
if ($inet6support) {
($client_name,$client_aliases) = gethostbyaddr($conn->peeraddr,AF_INET6);
unless ($client_name) { ($client_name,$client_aliases) = gethostbyaddr($conn->peeraddr,AF_INET); }
} else {
($client_name,$client_aliases) = gethostbyaddr($conn->peeraddr,AF_INET);
}
$clients[0] = $client_name;
if ($client_aliases) {
push @clients, split(/\s+/,$client_aliases);
}
my $validclient=0;
my $node;
my $domain;
my $nd = xCAT::NetworkUtils->getNodeDomains(\@clients);
my %nodedomains = %{$nd};
foreach my $client (@clients) {
$domain = $nodedomains{$client};
my @ndn = ($client);
my $nd = xCAT::NetworkUtils->getNodeDomains(\@ndn);
my %nodedomains = %{$nd};
$domain = $nodedomains{$client};
$client =~ s/\..*//;
if ($domain) {
$client =~ s/\.$domain//;
} else {
$client =~ s/\..*//;
if ($domain) {
$client =~ s/\.$domain//;
} else {
$client =~ s/\..*//;
}
#ensure this is coming from a node IP at least
($node) = noderange($client);
if ($node) { #Means the source isn't valid
$validclient=1;
last;
}
}
#ensure this is coming from a node IP at least
($node) = noderange($client);
if ($node) { #Means the source isn't valid
$validclient=1;
last;
}
}
unless ($validclient) {
@@ -2089,6 +2096,40 @@ sub service_connection {
delete($req->{becomeuser}); #Remove it to keep it from view
}
# If the request is to aquire a token for a specific account
if (defined $req->{gettoken}) {
# authencitate the username:password
$peername=becomeuser($req->{gettoken}->[0]->{username}->[0],
$req->{gettoken}->[0]->{password}->[0]);
my $resp;
if ($peername) {
# for a valid account, get a token
my ($tokenid, $exptime) = xCAT::xcatd->gettoken($req);
my ($sec,$min,$hour,$mday,$mon,$year) = localtime($exptime);
$year += 1900;
my $htime = "$year-$mon-$mday $hour:$min:$sec";
$resp = {data=>[{token => [{id => $tokenid, expire => $htime}]}]};
} else {
$resp={error=>["Authentication failure"],errorcode=>[1]};
}
$resp->{serverdone}=[ undef ] ;
send_response($resp,$sock);
return;
}
# If user trying to use 'token' to authenticate
if (defined $req->{tokens}) {
# get the valid user name by the token id
$peername = xCAT::xcatd->verifytoken($req);
unless (defined $peername) {
my $resp={error=>["Authentication failure"],errorcode=>[1]};
$resp->{serverdone}=[ undef ] ;
send_response($resp,$sock);
return;
}
delete($req->{tokenid});
}
#we have a full request..
#printf $request."\n";
$request="";
+1 -2
View File
@@ -67,7 +67,7 @@ cert_opt = ca_default # Certificate field options
default_days = 7300 # how long to certify for
default_crl_days= 30 # how long before next CRL
default_md = sha256 # which md to use.
default_md = sha1 # which md to use.
preserve = no # keep passed DN ordering
# A few difference way of specifying how similar the request should look
@@ -98,7 +98,6 @@ emailAddress = optional
####################################################################
[ req ]
default_md = sha256
default_bits = 2048
default_keyfile = private/ca-key.pem
distinguished_name = req_distinguished_name
+19 -7
View File
@@ -60,7 +60,7 @@ my $cmdref={
noderange=>[$ARGV[0]]
};
xCAT::Client::submit_request($cmdref,\&getans);
until ($username and $password and $bmc) {
until (($username or $password) and $bmc) {
release_lock(); #Let other clients have a go
$sleepint=10+int(rand(20));
print "Console not ready, retrying in $sleepint seconds (Ctrl-e,c,o to skip delay) \n";
@@ -69,6 +69,18 @@ until ($username and $password and $bmc) {
xCAT::Client::submit_request($cmdref,\&getans);
}
release_lock();
my ($user,$pass);
if ($username) {
$user = "-U '$username'";
} else {
$user = '';
}
if ($password) {
$pass = "-P '$password'";
} else {
$pass = '';
}
#require xCAT::Table;
#require xCAT::Utils;
#my $dba;
@@ -98,10 +110,10 @@ my $ipmitool = "ipmitool";
if (-x "$XCATROOT/bin/ipmitool-xcat") {
$ipmitool = "$XCATROOT/bin/ipmitool-xcat";
}
my @mcinfo=`$ipmitool -I lan -U $username -P $password -H $bmc mc info`;#| grep 'Manufacturer ID : 343' > /dev/null 2>&1";
my @mcinfo=`$ipmitool -I lanplus $user $pass -H $bmc mc info`;#| grep 'Manufacturer ID : 343' > /dev/null 2>&1";
$rc = $?;
if ($rc) { #some shoddy vendors ignore the IPMI 2.0 requirement to support IPMI 1.5 formats for BMC capability determination, attempt IPMI 2.0 even without the ability to confirm IPMI 2.0 support. Though SOL was not baked in prior IPMI 2.0, this script supports pre-2.0 'ISOL' on older devices, hence why we are checking for 1.5/2.0 before proceeding normally
@mcinfo=`$ipmitool -I lanplus -U $username -P $password -H $bmc mc info`;
@mcinfo=`$ipmitool -I lan $user $pass -H $bmc mc info`;
$rc = $?;
}
while ($rc != 0) {
@@ -109,10 +121,10 @@ while ($rc != 0) {
print "Failure to reach IPMI device, retrying in $sleepint seconds (Hit Ctrl-E,c,o to skip)\n";
exec("sleep $sleepint");
#sleep $sleepint;
@mcinfo=`$ipmitool -I lan -U $username -P $password -H $bmc mc info`;#| grep 'Manufacturer ID : 343' > /dev/null 2>&1";
@mcinfo=`$ipmitool -I lanplus $user $pass -H $bmc mc info`;#| grep 'Manufacturer ID : 343' > /dev/null 2>&1";
$rc = $?;
if ($rc) { #repeat workaround for shoddy vendors
@mcinfo=`$ipmitool -I lanplus -U $username -P $password -H $bmc mc info`;
@mcinfo=`$ipmitool -I lan $user $pass -H $bmc mc info`;
$rc = $?;
}
}
@@ -130,9 +142,9 @@ if ($isintel) {
$inteloption=" -o intelplus";
}
if ($iface eq "lanplus") {
system "$ipmitool -I lanplus $inteloption -U $username -P $password -H $bmc $solcom deactivate"; #Stop any active session
system "$ipmitool -I lanplus $inteloption $user $pass -H $bmc $solcom deactivate"; #Stop any active session
}
exec "$ipmitool -I $iface $inteloption -U $username -P $password -H $bmc $solcom activate";
exec "$ipmitool -I $iface $inteloption $user $pass -H $bmc $solcom activate";
@@ -0,0 +1,42 @@
#
# Select a zone
# Add the --utc switch if your hardware clock is set to GMT
#
#timezone US/Hawaii
#timezone US/Pacific
#timezone US/Mountain
#timezone US/Central
#timezone US/Eastern
timezone --utc "#TABLE:site:key=timezone:value#"
#
# Don't do X
#
#skipx
#
# To generate an encrypted root password use:
#
# perl -e 'print crypt("blah","Xa") . "\n";'p
# openssl passwd -apr1 -salt xxxxxxxx password
#
# where "blah" is your root password.
#
rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password#
#partition / --ondisk=/dev/mapper/ibmpkvm_vg_root-ibmpkvm_lv_root
partition / --ondisk=/dev/sda
network --bootproto dhcp
%post
touch "/startpost"
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat#
touch "/inpost"
#sleep 1000000
%end
@@ -1,7 +1,8 @@
#
lang en_US
network --bootproto dhcp
#network --bootproto dhcp
#KICKSTARTNET#
#
# Where's the source?
@@ -1,6 +1,10 @@
#!/bin/sh
export MANAGEDADDRESSMODE="#XCATVAR:MANAGEDADDRESSMODE#"
cd /etc/sysconfig/network
if [ "$MANAGEDADDRESSMODE" != "static" ]
then
rm -f ifcfg-eth-id*
rm -f ifcfg-myri*
cat >ifcfg-eth0 <<EOF
@@ -8,7 +12,7 @@ DEVICE=eth0
BOOTPROTO=dhcp
STARTMODE=onboot
EOF
fi
. /tmp/prinicsetting
rm /tmp/prinicsetting
if [ "$PRINIC" != "eth0" ]
@@ -22,7 +26,12 @@ then
# echo "DHCLIENT_PRIMARY_DEVICE=yes" >> ifcfg-$PRINIC
fi
fi
if [ "$MANAGEDADDRESSMODE" != "static" ]
then
echo "DHCLIENT_PRIMARY_DEVICE=yes" >> ifcfg-$PRINIC
fi
perl -pi -e 's/^FIREWALL="yes"/FIREWALL="no"/' /etc/sysconfig/network/config
/etc/init.d/network restart

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