From e4c231b6170f9556509001d0a75940c590464d2a Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 4 Jul 2016 02:12:27 -0400 Subject: [PATCH 01/43] complete lsdef cases --- xCAT-test/autotest/testcase/lsdef/cases0 | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/xCAT-test/autotest/testcase/lsdef/cases0 b/xCAT-test/autotest/testcase/lsdef/cases0 index c002bdd06..dc466dd30 100644 --- a/xCAT-test/autotest/testcase/lsdef/cases0 +++ b/xCAT-test/autotest/testcase/lsdef/cases0 @@ -209,3 +209,43 @@ check:rc==0 cmd:lsdef testnode1 check:output=~Could not find end + +start:lsdef_template +os:linux +description:check xCAT supported template +cmd:lsdef --template +check:rc==0 +check:output=~hmc\-template \(node\) +check:output=~ppc64le\-template \(node\) +check:output=~ppc64lekvmguest\-template \(node\) +check:output=~switch\-template \(node\) +check:output=~x86_64\-template \(node\) +check:output=~x86_64kvmguest\-template \(node\) +end + +start:lsdef_template_switch_template +os:linux +description:check xCAT supported template for switch template +cmd:lsdef --template switch-template +check:rc==0 +check:output=~Object name\: switch-template +check:output=~groups=switch +check:output=~nodetype=switch +check:output=~postbootscripts\=otherpkgs +check:output=~postscripts\=syslog\,remoteshell\,syncfiles +check:output=~usercomment\=the switch definition template +check:output=~postscripts\=syslog\,remoteshell\,syncfiles +check:output=~ip\=OPTIONAL\:the ip address of the switch +check:output=~mac\=OPTIONAL\:the MAC address of the switch +check:output=~switchtype\=OPTIONAL\:The type of switch +end + +start:lsdef_template_with_invalid_name +os:linux +description:lsdef --template with invalid template name +cmd:lsdef --template | grep "test_with_invalid_name" +check:rc==1 +cmd:lsdef --template "test_with_invalid_name" +check:rc==1 +check:output=~Error: Could not find test_with_invalid_name in xCAT templates. +end From e1c5bb103321cb0373d0f130a1298d76386a0204 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 4 Jul 2016 04:58:16 -0400 Subject: [PATCH 02/43] complete mkdef test cases --- xCAT-test/autotest/testcase/mkdef/cases0 | 122 +++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/xCAT-test/autotest/testcase/mkdef/cases0 b/xCAT-test/autotest/testcase/mkdef/cases0 index 1419103f2..a0363af14 100644 --- a/xCAT-test/autotest/testcase/mkdef/cases0 +++ b/xCAT-test/autotest/testcase/mkdef/cases0 @@ -159,4 +159,126 @@ check:output=~not a valid end +start:mkdef_template_switch_template_without_attribute +os:linux +description:create a node with swtich template without any attributes +cmd:result=`lsdef | grep auto_test_node_1`; if [[ $result =~ "auto_test_node_1" ]]; then echo $result; noderm auto_test_node_1; fi +cmd:mkdef -t node -o auto_test_node_1 --template switch-template +check:rc==0 +check:output=~1 object definitions have been created or modified. +cmd:lsdef auto_test_node_1 +check:rc==0 +check:output=~Object name\: auto_test_node_1 +check:output=~groups=switch +check:output=~nodetype=switch +check:output=~postbootscripts\=otherpkgs +check:output=~postscripts\=syslog\,remoteshell\,syncfiles +check:output=~usercomment\=the switch definition template +check:output=~postscripts\=syslog\,remoteshell\,syncfiles +check:output!=ip\=OPTIONAL\:the ip address of the switch +check:output!=mac\=OPTIONAL\:the MAC address of the switch +check:output!=switchtype\= +cmd:noderm auto_test_node_1 +check:rc==0 +end +start:mkdef_template_cec_template_without_remainder +os:linux +description:create a node with cec template once +cmd:result=`lsdef | grep auto_test_cec_node_1`; if [[ $result =~ "auto_test_cec_node_1" ]]; then echo $result; noderm auto_test_cec_node_1; fi +cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test mtm=test hcp=test +check:rc==0 +check:output=~1 object definitions have been created or modified +cmd:lsdef auto_test_cec_node_1 +check:output=~Object name\: auto\_test\_cec\_node\_1 +check:output=~groups\=cec\,all +check:output=~hwtype\=cec +check:output=~mgt\=hmc +check:output=~nodetype\=ppc +check:output=~postbootscripts\=otherpkgs +check:output=~postscripts\=syslog\,remoteshell\,syncfiles +check:output=~usercomment\=the cec definition template +check:output=~hcp\=test +check:output=~mtm\=test +check:output=~serial\=test +cmd:noderm auto_test_cec_node_1 +check:rc==0 +end + +start:mkdef_template_invalid_template +os:linux +description:create a node with invalid template +cmd:result=`lsdef | grep auto_test_node`; if [[ $result =~ "auto_test_node" ]]; then echo $result; noderm auto_test_node; fi +cmd:result=`lsdef | grep auto_test_invalid_template`; if [[ $result =~ "auto_test_invalid_template" ]]; then echo $result; noderm auto_test_invalid_template; fi +cmd:lsdef --template auto_test_invalid_template +check:rc==1 +check:output=~Error\: Could not find auto\_test\_invalid\_template in xCAT templates +cmd:mkdef -t node -o auto_test_node --template auto_test_invalid_template +check:rc==1 +check:output=~Error\: Could not find the template object named \'auto\_test\_invalid\_template\' of type \'node\' +end + +start:mkdef_node_with_a_node_template +os:linux +description:create a node with a node template, using cec template to create node at beginning +cmd:result=`lsdef | grep auto_test_cec_node_1`; if [[ $result =~ "auto_test_cec_node_1" ]]; then echo $result; noderm auto_test_cec_node_1; fi +cmd:result=`lsdef | grep auto_test_cec_node_2`; if [[ $result =~ "auto_test_cec_node_2" ]]; then echo $result; noderm auto_test_cec_node_2; fi +cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test mtm=test hcp=test groups=test_template +check:rc==0 +check:output=~1 object definitions have been created or modified +check:chdef -t node auto_test_cec_node_1 -o groups=test_template +check:rc==0 +check:output=~created +cmd:mkdef -t node -o auto_test_cec_node_2 --template auto_test_cec_node_1 serial=test2 mtm=test2 hcp=test2 +check:rc==0 +check:output=~1 object definitions have been created or modified +cmd:lsdef auto_test_cec_node_2 +check:output=~Object name\: auto\_test\_cec\_node\_2 +check:output=~groups\=test\_template +check:output!=groups\=cec\,all +check:output=~hwtype\=cec +check:output=~mgt\=hmc +check:output=~nodetype\=ppc +check:output=~postbootscripts\=otherpkgs +check:output=~postscripts\=syslog\,remoteshell\,syncfiles +check:output=~usercomment\=the cec definition template +check:output=~hcp\=test2 +check:output=~mtm\=test2 +check:output=~serial\=test2 +cmd:noderm auto_test_cec_node_1 +check:rc==0 +cmd:noderm auto_test_cec_node_2 +check:rc==0 +end + +start:mkdef_template_cec_template_step_by_step +os:linux +description:create a node with cec template step by step +cmd:result=`lsdef | grep auto_test_cec_node_1`; if [[ $result =~ "auto_test_cec_node_1" ]]; then echo $result; noderm auto_test_cec_node_1; fi +cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template +check:rc==1 +check:output=~Error\: The attribute \"serial\" must be specified! +cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test +check:rc==1 +check:output=~Error\: The attribute \"mtm\" must be specified! +cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test mtm=test +check:rc==1 +check:output=~Error\: The attribute \"hcp\" must be specified! +cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test mtm=test hcp=test +check:rc==0 +check:output=~1 object definitions have been created or modified +cmd:lsdef auto_test_cec_node_1 +check:output=~Object name\: auto\_test\_cec\_node\_1 +check:output=~groups\=cec\,all +check:output=~hwtype\=cec +check:output=~mgt\=hmc +check:output=~nodetype\=ppc +check:output=~postbootscripts\=otherpkgs +check:output=~postscripts\=syslog\,remoteshell\,syncfiles +check:output=~usercomment\=the cec definition template +check:output=~hcp\=test +check:output=~mtm\=test +check:output=~serial\=test +cmd:noderm auto_test_cec_node_1 +check:rc==0 +end From 79ad627c441bb68df6188f915121954b0cb5ef59 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 4 Jul 2016 05:10:36 -0400 Subject: [PATCH 03/43] add mkdef new case --- xCAT-test/autotest/testcase/mkdef/cases0 | 33 ++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/mkdef/cases0 b/xCAT-test/autotest/testcase/mkdef/cases0 index a0363af14..99e272667 100644 --- a/xCAT-test/autotest/testcase/mkdef/cases0 +++ b/xCAT-test/autotest/testcase/mkdef/cases0 @@ -226,8 +226,6 @@ cmd:result=`lsdef | grep auto_test_cec_node_2`; if [[ $result =~ "auto_test_cec cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test mtm=test hcp=test groups=test_template check:rc==0 check:output=~1 object definitions have been created or modified -check:chdef -t node auto_test_cec_node_1 -o groups=test_template -check:rc==0 check:output=~created cmd:mkdef -t node -o auto_test_cec_node_2 --template auto_test_cec_node_1 serial=test2 mtm=test2 hcp=test2 check:rc==0 @@ -282,3 +280,34 @@ check:output=~serial\=test cmd:noderm auto_test_cec_node_1 check:rc==0 end + +start:check_mkdef_node_with_template_priority +os:linux +description:create node named cec-template with cec template at beginning, the node is priority high than tempalate to create a new node +cmd:result=`lsdef | grep cec-template`; if [[ $result =~ "cec-template" ]]; then echo $result; noderm cec-template; fi +cmd:result=`lsdef | grep auto_test_cec_node`; if [[ $result =~ "auto_test_cec_node" ]]; then echo $result; noderm auto_test_cec_node; fi +cmd:mkdef -t node -o cec-template --template cec-template serial=test mtm=test hcp=test groups=test_template_priority +check:rc==0 +check:output=~1 object definitions have been created or modified +cmd:mkdef -t node -o auto_test_cec_node --template cec-template serial=test2 mtm=test2 hcp=test2 +check:rc==0 +check:output=~1 object definitions have been created or modified +cmd:lsdef auto_test_cec_node +check:output=~Object name\: auto\_test\_cec\_node\_2 +check:output=~groups\=test\_template\_priority +check:output!=groups\=cec\,all +check:output=~hwtype\=cec +check:output=~mgt\=hmc +check:output=~nodetype\=ppc +check:output=~postbootscripts\=otherpkgs +check:output=~postscripts\=syslog\,remoteshell\,syncfiles +check:output=~usercomment\=the cec definition template +check:output=~hcp\=test2 +check:output=~mtm\=test2 +check:output=~serial\=test2 +cmd:noderm cec-template +check:rc==0 +cmd:noderm auto_test_cec_node +check:rc==0 +end + From acd85daaf3c3cde917093cbc6e2668aa007042f0 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 4 Jul 2016 05:31:07 -0400 Subject: [PATCH 04/43] update failed issues --- xCAT-test/autotest/testcase/mkdef/cases0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/mkdef/cases0 b/xCAT-test/autotest/testcase/mkdef/cases0 index 99e272667..83baef541 100644 --- a/xCAT-test/autotest/testcase/mkdef/cases0 +++ b/xCAT-test/autotest/testcase/mkdef/cases0 @@ -293,7 +293,7 @@ cmd:mkdef -t node -o auto_test_cec_node --template cec-template serial=test2 mtm check:rc==0 check:output=~1 object definitions have been created or modified cmd:lsdef auto_test_cec_node -check:output=~Object name\: auto\_test\_cec\_node\_2 +check:output=~Object name\: auto\_test\_cec\_node check:output=~groups\=test\_template\_priority check:output!=groups\=cec\,all check:output=~hwtype\=cec From f635ae9fccd9076d2dba3ba91e48eb27ff4561c2 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 4 Jul 2016 23:41:40 -0400 Subject: [PATCH 05/43] complete chdef mkdef cases --- xCAT-test/autotest/testcase/chdef/cases0 | 17 +++++++++++++++++ xCAT-test/autotest/testcase/rmdef/cases0 | 10 ++++++++++ 2 files changed, 27 insertions(+) diff --git a/xCAT-test/autotest/testcase/chdef/cases0 b/xCAT-test/autotest/testcase/chdef/cases0 index f3ad24b73..26db07053 100644 --- a/xCAT-test/autotest/testcase/chdef/cases0 +++ b/xCAT-test/autotest/testcase/chdef/cases0 @@ -222,3 +222,20 @@ cmd:chdef -t wrongtype -o testnode groups=all,aix check:rc!=0 check:output=~not a valid end + + +start:chdef_template +os:linux +description:try to change a template, a new node is created according to chdef. +cmd:result=`lsdef | grep switch-template`; if [[ $result =~ "switch-template" ]]; then echo $result; noderm switch-template; fi +cmd:chdef -t node -o switch-template groups=test +check:output=~1 object definitions have been created or modified +check:output=~New object definitions \'switch-template\' have been created +check:rc==0 +cmd:lsdef switch-template +check:output=~Object name\: switch\-template +check:output=~groups\=test +check:rc==0 +cmd:noderm switch-template +check:rc==0 +end diff --git a/xCAT-test/autotest/testcase/rmdef/cases0 b/xCAT-test/autotest/testcase/rmdef/cases0 index 8a6b9f51c..50bbe14e9 100644 --- a/xCAT-test/autotest/testcase/rmdef/cases0 +++ b/xCAT-test/autotest/testcase/rmdef/cases0 @@ -128,3 +128,13 @@ cmd:rmdef -t wrongtype -o testnode check:rc!=0 check:output=~not a valid end + +start:rmdef_template +os:linux +description:try to delete a template, then error messages appear +cmd:result=`lsdef | grep switch-template`; if [[ $result =~ "switch-template" ]]; then echo $result; noderm switch-template; fi +cmd:rmdef switch-template +check:rc==1 +check:output=~Error\: Could not find an object named \'switch-template\' of type \'node\' +check:output=~No objects have been removed from the xCAT database. +end From 701477eaafcfcbcc1d5e9ac43ec18463f1281eb6 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 17 Oct 2016 16:09:27 -0400 Subject: [PATCH 06/43] Add RHEV KVM documentation --- .../{powerKVM.rst => hypervisorKVM.rst} | 82 +++++++++++++++---- .../ppc64le/virtual_machines/index.rst | 2 +- 2 files changed, 69 insertions(+), 15 deletions(-) rename docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/{powerKVM.rst => hypervisorKVM.rst} (53%) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/powerKVM.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst similarity index 53% rename from docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/powerKVM.rst rename to docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst index 239b69b08..35b572fcc 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/powerKVM.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst @@ -1,20 +1,21 @@ -Setup PowerKVM Hypervisor -========================= +Setup Hypervisor +================ -Provision Hypervisor with PowerKVM ----------------------------------- +Provision Hypervisor +-------------------- -Please follow the :ref:`Diskful Installation ` to provision kvm hypervisor with PowerKVM, several customization steps should be taken into consideration. +Follow the :ref:`Diskful Installation ` to provision kvm hypervisor for PowerKVM or RHEV. -To demonstrate the brief steps on hypervisor provision, take **ibm-powerkvm-3.1.0.0-39.0-ppc64le-gold-201511041419.iso** for example here: -#. Obtain a PowerKVM iso and create PowerKVM osimages with it: :: +* **[PowerKVM]** + + Obtain a PowerKVM iso and create PowerKVM osimages with it: :: copycds ibm-powerkvm-3.1.0.0-39.0-ppc64le-gold-201511041419.iso - The following PowerKVM osimage will be created on success :: + The following PowerKVM osimage will be created :: # lsdef -t osimage -o pkvm3.1-ppc64le-install-compute Object name: pkvm3.1-ppc64le-install-compute @@ -29,9 +30,52 @@ To demonstrate the brief steps on hypervisor provision, take **ibm-powerkvm-3.1. provmethod=install template=/opt/xcat/share/xcat/install/pkvm/compute.pkvm3.ppc64le.tmpl +* **[RHEV]** + + At the time of this writing there is no ISO image availabe for RHEV. Individual RPM packages need to be downloaded. + + * Download *Management-Agent-Power-7* and *Power_Tools-7* RPMs from RedHat to the xCAT management node. Steps below assume all RPMs were downloaded to */install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA* directory. + + * Run ``createrepo .`` in the */install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA* directory. + + * Create new osimage definition based on an existing RH7 osimage definition :: + + mkdef -t osimage -o rhels7.3-ppc64le-RHEV4-install-compute --template rhels7.3-ppc64le-install-compute + * Modify ``otherpkgdir`` attribute to point to the package directory with downloaded RPMs :: + + chdef -t osimage rhels7.3-ppc64le-RHEV4-install-compute otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA + + * Create a new file */opt/xcat/share/xcat/install/rh/other.pkglist* to list required packages :: + + libvirt + qemu-kvm-rhev + qemu-kvm-tools-rhev + virt-manager-common + virt-install + + * Modify ``otherpkglist`` attribute to point to the file from the step above :: + + chdef -t osimage rhels7.3-snap3-ppc64le-RHEV4-install-compute otherpkglist=/opt/xcat/share/xcat/install/rh/other.pkglist + + * The RHEV osimage should look similar to: :: + + Object name: rhels7.3-ppc64le-RHEV4-install-compute + imagetype=linux + osarch=ppc64le + osdistroname=rhels7.3-ppc64le + osname=Linux + osvers=rhels7.3 + otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA + otherpkglist=/opt/xcat/share/xcat/install/rh/other.pkglist + pkgdir=/install/rhels7.3/ppc64le + pkglist=/install/custom/install/rh/compute.rhels7.ppc64le.pkglist + profile=compute + provmethod=install + template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl + #. Customize the hypervisor node definition to create network bridge - xCAT ships a postscript **xHRM** to create a network bridge on kvm host during installation/netbooting. Please specify the **xHRM** with appropriate parameters in **postscripts** attibute. Here is some examples on this: + xCAT ships a postscript **xHRM** to create a network bridge on kvm host during installation/netbooting. Specify the **xHRM** with appropriate parameters in **postscripts** attibute. Here is some examples on this: To create a bridge with default name 'default' against the installation network device which was specified by **installnic** attribute :: @@ -65,16 +109,16 @@ To demonstrate the brief steps on hypervisor provision, take **ibm-powerkvm-3.1. chmod 755 /install/postscripts/mountvms chdef kvmhost1 -p postscripts=mountvms -#. Provision the hypervisor node with the PowerKVM osimage :: +#. Provision the hypervisor node with the osimage :: - nodeset kvmhost1 osimage=pkvm3.1-ppc64le-install-compute + nodeset kvmhost1 osimage= rpower kvmhost1 boot Create network bridge on hypervisor ------------------------------------ -To launch VMs, a network bridge must be created on the PowerKVM hypervisors. +To launch VMs, a network bridge must be created on the KVM hypervisor. If the hypervisor is provisioned successfully according to the steps described above, a network bridge will be created and attached to a physical interface. This can be checked by running ``brctl show`` on the hypervisor to show the network bridge information, please make sure a network bridge has been created and configured according to the parameters passed to postscript "xHRM" :: @@ -83,10 +127,20 @@ If the hypervisor is provisioned successfully according to the steps described a br0 8000.000000000000 no eth0 -If the network bridge is not created or configured successfully, please run "xHRM" with **updatenode** on managememt node to create it manually::: +If the network bridge is not created or configured successfully, run "xHRM" with **updatenode** on managememt node to create it manually::: updatenode kvmhost1 -P "xHRM bridgeprereq eth0:br0" - + +Start libvirtd service +---------------------- + +Verify **libvirtd** service is running: :: + + systemctl status libvirtd + +If service is not running, it can be started with: :: + + systemctl start libvirtd .. [1] Every standard libvirt installation provides NAT based connectivity to virtual machines out of the box using the "virtual bridge" interfaces (virbr0, virbr1, etc) Those will be created by default. diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/index.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/index.rst index 0bd559648..d134a2464 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/index.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/index.rst @@ -32,6 +32,6 @@ This section introduces the steps of management node preparation, KVM hypervisor :maxdepth: 2 kvmMN.rst - powerKVM.rst + hypervisorKVM.rst manage_vms.rst FAQ.rst From 2a2d13054db2dcc6aa7faf641bf2429637b5cb72 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 18 Oct 2016 14:10:39 -0400 Subject: [PATCH 07/43] Review suggestions implemented --- .../virtual_machines/RHEVHypervisor.rst | 48 +++++++++++ .../virtual_machines/hypervisorKVM.rst | 83 +++---------------- .../ppc64le/virtual_machines/index.rst | 2 +- .../virtual_machines/pKVMHypervisor.rst | 20 +++++ 4 files changed, 80 insertions(+), 73 deletions(-) create mode 100644 docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst create mode 100644 docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/pKVMHypervisor.rst diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst new file mode 100644 index 000000000..9274d7018 --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst @@ -0,0 +1,48 @@ + + At the time of this writing there is no ISO image availabe for RHEV. Individual RPM packages need to be downloaded. + + * Download *Management-Agent-Power-7* and *Power_Tools-7* RPMs from RedHat to the xCAT management node. Steps below assume all RPMs were downloaded to ``/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA`` + + * Create a yum repository for the downloaded RPMs :: + + createrepo /install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA + + * Create new osimage definition based on an existing RHEL7 osimage definition :: + + mkdef -t osimage -o rhels7.3-ppc64le-RHEV4-install-compute \ + --template rhels7.3-ppc64le-install-compute + + * Modify ``otherpkgdir`` attribute to point to the package directory with downloaded RPMs :: + + chdef -t osimage rhels7.3-ppc64le-RHEV4-install-compute \ + otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA + + * Create a new file ``/opt/xcat/share/xcat/install/rh/other.pkglist`` to list required packages :: + + libvirt + qemu-kvm-rhev + qemu-kvm-tools-rhev + virt-manager-common + virt-install + + * Modify ``otherpkglist`` attribute to point to the file from the step above :: + + chdef -t osimage rhels7.3-snap3-ppc64le-RHEV4-install-compute \ + otherpkglist=/opt/xcat/share/xcat/install/rh/other.pkglist + + * The RHEV osimage should look similar to: :: + + Object name: rhels7.3-ppc64le-RHEV4-install-compute + imagetype=linux + osarch=ppc64le + osdistroname=rhels7.3-ppc64le + osname=Linux + osvers=rhels7.3 + otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA + otherpkglist=/opt/xcat/share/xcat/install/rh/other.pkglist + pkgdir=/install/rhels7.3/ppc64le + pkglist=/install/custom/install/rh/compute.rhels7.ppc64le.pkglist + profile=compute + provmethod=install + template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl + diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst index 35b572fcc..1f0873241 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst @@ -1,93 +1,32 @@ -Setup Hypervisor -================ - +Install and Configure Hypervisor +================================ Provision Hypervisor -------------------- - -Follow the :ref:`Diskful Installation ` to provision kvm hypervisor for PowerKVM or RHEV. - - * **[PowerKVM]** - Obtain a PowerKVM iso and create PowerKVM osimages with it: :: - - copycds ibm-powerkvm-3.1.0.0-39.0-ppc64le-gold-201511041419.iso - - The following PowerKVM osimage will be created :: - - # lsdef -t osimage -o pkvm3.1-ppc64le-install-compute - Object name: pkvm3.1-ppc64le-install-compute - imagetype=linux - osarch=ppc64le - osdistroname=pkvm3.1-ppc64le - osname=Linux - osvers=pkvm3.1 - otherpkgdir=/install/post/otherpkgs/pkvm3.1/ppc64le - pkgdir=/install/pkvm3.1/ppc64le - profile=compute - provmethod=install - template=/opt/xcat/share/xcat/install/pkvm/compute.pkvm3.ppc64le.tmpl + .. include:: pKVMHypervisor.rst * **[RHEV]** - At the time of this writing there is no ISO image availabe for RHEV. Individual RPM packages need to be downloaded. - - * Download *Management-Agent-Power-7* and *Power_Tools-7* RPMs from RedHat to the xCAT management node. Steps below assume all RPMs were downloaded to */install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA* directory. - - * Run ``createrepo .`` in the */install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA* directory. - - * Create new osimage definition based on an existing RH7 osimage definition :: - - mkdef -t osimage -o rhels7.3-ppc64le-RHEV4-install-compute --template rhels7.3-ppc64le-install-compute - * Modify ``otherpkgdir`` attribute to point to the package directory with downloaded RPMs :: - - chdef -t osimage rhels7.3-ppc64le-RHEV4-install-compute otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA - - * Create a new file */opt/xcat/share/xcat/install/rh/other.pkglist* to list required packages :: - - libvirt - qemu-kvm-rhev - qemu-kvm-tools-rhev - virt-manager-common - virt-install - - * Modify ``otherpkglist`` attribute to point to the file from the step above :: - - chdef -t osimage rhels7.3-snap3-ppc64le-RHEV4-install-compute otherpkglist=/opt/xcat/share/xcat/install/rh/other.pkglist - - * The RHEV osimage should look similar to: :: - - Object name: rhels7.3-ppc64le-RHEV4-install-compute - imagetype=linux - osarch=ppc64le - osdistroname=rhels7.3-ppc64le - osname=Linux - osvers=rhels7.3 - otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA - otherpkglist=/opt/xcat/share/xcat/install/rh/other.pkglist - pkgdir=/install/rhels7.3/ppc64le - pkglist=/install/custom/install/rh/compute.rhels7.ppc64le.pkglist - profile=compute - provmethod=install - template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl + .. include:: RHEVHypervisor.rst #. Customize the hypervisor node definition to create network bridge - xCAT ships a postscript **xHRM** to create a network bridge on kvm host during installation/netbooting. Specify the **xHRM** with appropriate parameters in **postscripts** attibute. Here is some examples on this: + xCAT ships a postscript **xHRM** to create a network bridge on kvm host during installation/netbooting. Specify the **xHRM** with appropriate parameters in **postscripts** attibute. For example: - To create a bridge with default name 'default' against the installation network device which was specified by **installnic** attribute :: + * To create a bridge with default name 'default' against the installation network device which was specified by **installnic** attribute :: - chdef kvmhost1 -p postscripts="xHRM bridgeprereq" + chdef kvmhost1 -p postscripts="xHRM bridgeprereq" - To create a bridge named 'br0' against the installation network device which was specified by **installnic** attribute(recommended) :: + * To create a bridge named 'br0' against the installation network device which was specified by **installnic** attribute(recommended) :: - chdef kvmhost1 -p postscripts="xHRM bridgeprereq br0" + chdef kvmhost1 -p postscripts="xHRM bridgeprereq br0" - To create a bridge named 'br0' against the network device 'eth0' :: + * To create a bridge named 'br0' against the network device 'eth0' :: - chdef kvmhost1 -p postscripts="xHRM bridgeprereq eth0:br0" + chdef kvmhost1 -p postscripts="xHRM bridgeprereq eth0:br0" **Note**: The network bridge name you use should not be the virtual bridges created by libvirt installation [1]_. diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/index.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/index.rst index d134a2464..a13f1e1c6 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/index.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/index.rst @@ -26,7 +26,7 @@ The xCAT based KVM solution offers users the ability to: * install copy on write instances of virtual machines * clone virtual machines -This section introduces the steps of management node preparation, KVM hypervisor setup and virtual machine management, and presents some typical problems and solutions on xCAT kvm support. +This section introduces the steps of management node preparation, hypervisor setup and virtual machine management, and presents some typical problems and solutions on xCAT kvm support. .. toctree:: :maxdepth: 2 diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/pKVMHypervisor.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/pKVMHypervisor.rst new file mode 100644 index 000000000..e75d9f5e3 --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/pKVMHypervisor.rst @@ -0,0 +1,20 @@ + + Obtain a PowerKVM ISO and create PowerKVM osimages with it: :: + + copycds ibm-powerkvm-3.1.0.0-39.0-ppc64le-gold-201511041419.iso + + The following PowerKVM osimage will be created :: + + # lsdef -t osimage -o pkvm3.1-ppc64le-install-compute + Object name: pkvm3.1-ppc64le-install-compute + imagetype=linux + osarch=ppc64le + osdistroname=pkvm3.1-ppc64le + osname=Linux + osvers=pkvm3.1 + otherpkgdir=/install/post/otherpkgs/pkvm3.1/ppc64le + pkgdir=/install/pkvm3.1/ppc64le + profile=compute + provmethod=install + template=/opt/xcat/share/xcat/install/pkvm/compute.pkvm3.ppc64le.tmpl + From 4648ef53db6c7ab22e3700c45aa57b34cf3b3c5e Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Wed, 19 Oct 2016 04:47:50 -0400 Subject: [PATCH 08/43] add new check rootimgdir warning message case --- xCAT-test/autotest/testcase/mkdef/cases0 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xCAT-test/autotest/testcase/mkdef/cases0 b/xCAT-test/autotest/testcase/mkdef/cases0 index 83baef541..9595e6e22 100644 --- a/xCAT-test/autotest/testcase/mkdef/cases0 +++ b/xCAT-test/autotest/testcase/mkdef/cases0 @@ -311,3 +311,16 @@ cmd:noderm auto_test_cec_node check:rc==0 end +start:mkdef_template_diskless_osimage_rootimgdir +os:linux +description:check rootimgdir warning message after make new osimage with mkdef --template +cmd:mkdef -t osimage -o test-osimage_with_template --template __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +output=~1 object definitions have been created or modified +cmd:xcatprobe osimagecheck +check:output=~Identical root image directory +check:output=~test-osimage +check:output=~__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +cmd:rmdef -t osimage -o test-osimage_with_template +check:rc==0 +end From 8745b0cd7ee744a981664c43bb6d37c701c54141 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Tue, 25 Oct 2016 15:43:20 +0800 Subject: [PATCH 09/43] update after Jun Xia's comments --- xCAT-test/autotest/testcase/lsdef/cases0 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/lsdef/cases0 b/xCAT-test/autotest/testcase/lsdef/cases0 index dc466dd30..55e846e11 100644 --- a/xCAT-test/autotest/testcase/lsdef/cases0 +++ b/xCAT-test/autotest/testcase/lsdef/cases0 @@ -243,8 +243,7 @@ end start:lsdef_template_with_invalid_name os:linux description:lsdef --template with invalid template name -cmd:lsdef --template | grep "test_with_invalid_name" -check:rc==1 +cmd:result=`lsdef | grep test_with_invalid_name`; if [[ $result =~ "test_with_invalid_name" ]]; then noderm test_with_invalid_name; fi cmd:lsdef --template "test_with_invalid_name" check:rc==1 check:output=~Error: Could not find test_with_invalid_name in xCAT templates. From cc9ac639de993b06af29debc74b3a9bcf355bb7c Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Tue, 25 Oct 2016 05:11:02 -0400 Subject: [PATCH 10/43] complete --- xCAT-test/autotest/testcase/updatenode/cases0 | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/xCAT-test/autotest/testcase/updatenode/cases0 b/xCAT-test/autotest/testcase/updatenode/cases0 index 91f783957..9d8f7b6bb 100644 --- a/xCAT-test/autotest/testcase/updatenode/cases0 +++ b/xCAT-test/autotest/testcase/updatenode/cases0 @@ -454,3 +454,23 @@ check:output=~postscripts has completed check:output=~Software Maintenance has completed end +start:updatenode_P_syslog_V_xcatdebugmode_is_one +description:xcatdebugmode value is one, there should be execution outputs. +cmd:chtab key=xcatdebugmode site.value=1 +check:rc==0 +cmd:updatenode $$CN -P syslog -V +check:output=~$$CN: ++ +cmd:chtab key=xcatdebugmode site.value=0 +check:rc==0 +end + +start:updatenode_P_syslog_V_xcatdebugmode_is_two +description:xcatdebugmode value is two, there should be execution outputs. +cmd:chtab key=xcatdebugmode site.value=2 +check:rc==0 +cmd:updatenode $$CN -P syslog -V +check:output=~$$CN: ++ +cmd:chtab key=xcatdebugmode site.value=0 +check:rc==0 +end + From e0fe3bf9d6cca475b2c66740f42fb87f1b197ed1 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Thu, 27 Oct 2016 05:27:06 -0400 Subject: [PATCH 11/43] completed_all --- xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle | 1 + xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle | 1 + xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle | 1 + xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle | 1 + xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle | 1 + xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle | 1 + xCAT-test/autotest/bundle/sles11.4_ppc64.bundle | 1 + xCAT-test/autotest/bundle/sles11.4_x86_64.bundle | 1 + xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/sles12.1_x86_64.bundle | 1 + xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle | 1 + xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle | 1 + 16 files changed, 16 insertions(+) diff --git a/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle b/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle index 2a5935deb..0528fa834 100644 --- a/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle @@ -297,6 +297,7 @@ xcatd_restart run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle b/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle index 67ccc3c22..15676669e 100644 --- a/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle @@ -203,6 +203,7 @@ nodeset_shell nodeset_cmdline nodeset_runimg nodeset_check_warninginfo +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle index 2a5935deb..0528fa834 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle @@ -297,6 +297,7 @@ xcatd_restart run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle index 3ab8926a8..bfbec794d 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle @@ -206,6 +206,7 @@ nodeset_cmdline nodeset_runimg redhat_migration1 redhat_migration2 +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_statelite_installation_flat SN_setup_case reg_linux_diskfull_installation_hierarchy diff --git a/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle index 7d731ecc9..e5ff83cf1 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle @@ -203,6 +203,7 @@ nodeset_check_warninginfo nodeset_shell nodeset_cmdline nodeset_runimg +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle b/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle index 2a5935deb..0528fa834 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle @@ -297,6 +297,7 @@ xcatd_restart run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle index 24f9bb87e..27578b5ea 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle @@ -204,6 +204,7 @@ switchdiscover_range_z_V nodeset_shell nodeset_cmdline nodeset_runimg +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_statelite_installation_flat SN_setup_case reg_linux_diskfull_installation_hierarchy diff --git a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle index 0b0b36ea0..f858555ad 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle @@ -209,6 +209,7 @@ nodeset_check_warninginfo nodeset_shell nodeset_cmdline nodeset_runimg +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_diskless_installation_flat reg_linux_statelite_installation_flat SN_setup_case diff --git a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle index d0dab7145..d0992c014 100644 --- a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle @@ -261,6 +261,7 @@ makentp_V makentp makentp_a nodeset_check_warninginfo +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle index c4548264d..c4dbf5754 100644 --- a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle @@ -213,6 +213,7 @@ xcatd_restart run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle index 8c1f9d50f..469a3527c 100644 --- a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle @@ -216,6 +216,7 @@ xcatd_restart_systemd run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd +xcatconfig_u_check_xcatsslversion_rhels_sles sles_migration1 sles_migration2 reg_linux_statelite_installation_flat diff --git a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle index 2ef6a799d..225f6cdad 100644 --- a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle @@ -213,6 +213,7 @@ xcatd_restart_systemd run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd +xcatconfig_u_check_xcatsslversion_rhels_sles sles_migration1 sles_migration2 reg_linux_diskless_installation_flat diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle index e4c01d5b3..00303edbc 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle @@ -252,3 +252,4 @@ xcatd_restart run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission +xcatconfig_u_check_xcatsslversion_ubuntu diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle index 0b405b1ae..5348d0ae6 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -269,3 +269,4 @@ rmdocker_command rmdocker_f_command lsdocker_h_command lsdocker_l_command +xcatconfig_u_check_xcatsslversion_ubuntu diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle index bc050eb58..02ba1c12f 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle @@ -252,3 +252,4 @@ xcatd_restart_systemd run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd +xcatconfig_u_check_xcatsslversion_ubuntu diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle index cb7c8a4ce..aa69d806c 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle @@ -261,3 +261,4 @@ run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd nodeset_check_warninginfo +xcatconfig_u_check_xcatsslversion_ubuntu From e3f1ad04c7db346dac6133d7ac139a4eb9af6bc7 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Thu, 27 Oct 2016 05:32:18 -0400 Subject: [PATCH 12/43] add ubuntu migration test cases --- xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle | 2 ++ xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle | 2 ++ xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle | 3 +++ xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle | 2 ++ 4 files changed, 9 insertions(+) diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle index 00303edbc..89789aa69 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle @@ -253,3 +253,5 @@ run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission xcatconfig_u_check_xcatsslversion_ubuntu +ubuntule_migration1_p8le +ubuntule_migration2_p8le diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle index 5348d0ae6..1f2ce26ba 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -270,3 +270,5 @@ rmdocker_f_command lsdocker_h_command lsdocker_l_command xcatconfig_u_check_xcatsslversion_ubuntu +ubuntux_migration1_vm +ubuntux_migration2_vm diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle index 02ba1c12f..17244fa12 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle @@ -253,3 +253,6 @@ run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd xcatconfig_u_check_xcatsslversion_ubuntu +ubuntule_migration1_p8le +ubuntule_migration2_p8le + diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle index aa69d806c..2b2b1d6e4 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle @@ -262,3 +262,5 @@ disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd nodeset_check_warninginfo xcatconfig_u_check_xcatsslversion_ubuntu +ubuntux_migration1_vm +ubuntux_migration2_vm From 97f6fc8083e21fd52facbb6abf2e7521d9b8b0a2 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 31 Oct 2016 04:45:18 -0400 Subject: [PATCH 13/43] update xcattest completed --- xCAT-test/xcattest | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index 7e35a5149..2155e04a6 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -17,7 +17,8 @@ use lib "$::XCATROOT/lib/perl"; my $rootdir = "$::XCATROOT/share/xcat/tools/autotest"; my $needhelp = 0; my $configinfo = undef; -my $configfile = "$rootdir/default.conf"; +#my $configfile = "$rootdir/default.conf"; +my $configfile = undef; my $casedir = "$rootdir/testcase"; my $bundledir = "$rootdir/bundle"; my $resultdir = "$rootdir/result"; @@ -768,7 +769,6 @@ sub loadcase if ($needshow) { if (@cases) { - log_this("Test cases:"); foreach my $case (@cases) { log_this("$case->{name}"); } @@ -1063,9 +1063,10 @@ sub usage log_this(" xcattest [-f configure file] [-t cases list]"); log_this(" xcattest [-f configure file] [-c cmds list]"); log_this("Show xcat test cases, bundle files, commands lists:"); - log_this(" xcattest [-f configure file] [-b case bundle files] [-l]"); - log_this(" xcattest [-f configure file] [-t cases list] [-l]"); - log_this(" xcattest [-f configure file] [-c cmds list] [-l]"); + log_this(" xcattest [-b case bundle files] [-l]"); + log_this(" xcattest [-t cases list] [-l]"); + log_this(" xcattest [-c cmds list] [-l]"); + log_this("Show all bundle files, all commands:"); log_this(" xcattest [-s command|bundle]"); log_this(""); return; @@ -1111,7 +1112,7 @@ sub listbundlefiles } close(FILE); if (!$skip){ - $bundlefilesinfo{$bundlefile} = "No description, add \"description: details\" in this bundle file"; + $bundlefilesinfo{$bundlefile} = "No description, add with \"description: details\" in bundle file"; } } &listformatbundleinfo(%bundlefilesinfo); @@ -1132,8 +1133,9 @@ sub listformatbundleinfo my $finallen = ($screenwidth > $desiredwidth ? $desiredwidth : $screenwidth); print "bundle files and descriptions:\n"; - - foreach my $filename (keys %bundlefilesinfo) { + + foreach my $filename (sort { $a cmp $b } keys %bundlefilesinfo ) { + # foreach my $filename (keys %bundlefilesinfo) { my @desc = split(" ", $bundlefilesinfo{$filename}); my $str = ""; my @formatdesc = (); @@ -1242,8 +1244,13 @@ sub checkoptions if (!defined($bundlelist) && !defined($caselist) && !defined($cmdlist) && !defined($showbundlesorcommands)) { log_this("Error: please define options correctly, see below usage information:"); return 1; + }elsif ((defined($bundlelist) || defined($caselist) || defined($cmdlist)) && (! $needshow) && !defined($configinfo)) { + #config file must be defined if the using -c,-b,-t to run test cases + log_this("Error: To run test cases, please define the config file with -f option"); + log_this(" To show test cases, please use the -l option"); + return 1; }elsif (defined($showbundlesorcommands) && (defined($bundlelist) || defined($caselist) || defined($cmdlist))) { - # -s can't be used together with -c,-b,-t + #-s can't be used together with -c,-b,-t log_this("Error: -b,-c or -t can't be used together with -s"); return 1; }elsif (defined($showbundlesorcommands) && $needshow) { @@ -1251,7 +1258,7 @@ sub checkoptions return 1; } - #check the L option, it only should be bundle or command + #check the -s option, the value should be bundle or command if (defined($showbundlesorcommands)) { if (($showbundlesorcommands ne "bundle") && ($showbundlesorcommands ne "command")) { log_this("Error: please use \"bundle\" or \"command\" as the \-s value"); @@ -1262,10 +1269,11 @@ sub checkoptions } $showcommandslist= 1; } + #get and check config file and System label #this System label means only the [System] variable will be loaded - if ($configinfo) { - if ($configinfo =~ /(.*):(.*)/) { + if (defined($configinfo)) { + if ($configinfo =~ /(.*):(.*)/) { $configfile = $1; $initallabel = $2; if ($initallabel ne $loadsysteminfo) { @@ -1275,11 +1283,10 @@ sub checkoptions }else { $configfile = $configinfo; } - } - - if (!(-e $configfile)) { - log_this("Error: Can't open config file: $configfile"); - return 1; + if (!(-e $configfile)) { + log_this("Error: Can't open config file: $configfile"); + return 1; + } } #check bundle files @@ -1288,12 +1295,12 @@ sub checkoptions foreach my $bundle (@bundles){ if ("$bundledir/$bundle" !~ /\.bundle$/) { log_this("Error: please input the .bundle file"); - log_this("Use 'xcattest -s bundle' to list out available bundles"); + log_this("Use 'xcattest -s bundle' to list all bundle files"); return 1; } if (!(-e "$bundledir/$bundle")) { log_this("Error: Can't open bundle file: $bundle"); - log_this("Use 'xcattest -b bundle' to list out available bundles"); + log_this("Use 'xcattest -s bundle' to list all bundle files"); return 1; } } From 58fa0e86123220acf9216f14d11d53fa7f6ae581 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 31 Oct 2016 20:52:23 -0400 Subject: [PATCH 14/43] - Added the :noboot option into the dhcpinterfaces keyword - cleaned up the text in the site table keyword and descriptions to prevent horizontal scrolling on RTD. --- perl-xCAT/xCAT/Schema.pm | 263 ++++++++++++++++++++------------------- 1 file changed, 132 insertions(+), 131 deletions(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 056437d7c..296ee634a 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -937,18 +937,18 @@ passed as argument rather than by table value', # Do not put description text past column 88, so it displays well in a 100 char wide window. # ----------------------------------------------------------------------------------|---------- - key => "Attribute Name: Description\n\n" . - " ------------\n" . - "AIX ATTRIBUTES\n" . - " ------------\n" . -" nimprime : The name of NIM server, if not set default is the AIX MN. - If Linux MN, then must be set for support of mixed cluster (TBD).\n\n" . + key => "Attribute Name: Description\n\n" . +" ------------\n" . +"AIX ATTRIBUTES\n" . +" ------------\n" . +" nimprime : The name of NIM server, if not set default is the AIX MN.\n" . +" If Linux MN, then must be set for support of mixed cluster (TBD).\n\n" . " useSSHonAIX: (yes/1 or no/0). Default is yes. The support for rsh/rcp is deprecated.\n" . " useNFSv4onAIX: (yes/1 or no/0). If yes, NFSv4 will be used with NIM. If no,\n" . - " NFSv3 will be used with NIM. Default is no.\n\n" . - " -----------------\n" . - "DATABASE ATTRIBUTES\n" . - " -----------------\n" . +" NFSv3 will be used with NIM. Default is no.\n\n" . +" -----------------\n" . +"DATABASE ATTRIBUTES\n" . +" -----------------\n" . " auditnosyslog: If set to 1, then commands will only be written to the auditlog table.\n" . " This attribute set to 1 and auditskipcmds=ALL means no logging of commands.\n" . " Default is to write to both the auditlog table and syslog.\n" . @@ -967,21 +967,26 @@ passed as argument rather than by table value', " excludenodes: A set of comma separated nodes and/or groups that would automatically\n" . " be subtracted from any noderange, it can be used for excluding some\n" . " failed nodes for any xCAT commands. See the 'noderange' manpage for\n" . - " details on supported formats.\n\n" . +" details on supported formats.\n\n" . " nodestatus: If set to 'n', the nodelist.status column will not be updated during\n" . -" the node deployment, node discovery and power operations. The default is to update.\n\n" . +" the node deployment, node discovery and power operations. The default\n" . +" is to update.\n\n" . " skiptables: Comma separated list of tables to be skipped by dumpxCATdb\n\n" . -" skipvalidatelog: If set to 1, then getcredentials and getpostscripts calls will not be logged in syslog.\n\n" . - " -------------\n" . - "DHCP ATTRIBUTES\n" . - " -------------\n" . -" dhcpinterfaces: The network interfaces DHCP should listen on. If it is the same\n" . -" for all nodes, use a simple comma-separated list of NICs. To\n" . -" specify different NICs for different nodes:\n" . - " xcatmn|eth1,eth2;service|bond0.\n" . -" In this example xcatmn is the name of the xCAT MN, and DHCP there\n" . -" should listen on eth1 and eth2. On all of the nodes in group\n" . -" 'service' DHCP should listen on the bond0 nic.\n\n" . +" skipvalidatelog: If set to 1, then getcredentials and getpostscripts calls will not \n" . +" be logged in syslog.\n\n" . +" -------------\n" . +"DHCP ATTRIBUTES\n" . +" -------------\n" . +" dhcpinterfaces: The network interfaces DHCP should listen on. If it is the same for all\n" . +" nodes, use a comma-separated list of the NICs. To specify different NICs\n" . +" for different nodes, use the format: \"xcatmn|eth1,eth2;service|bond0\", \n" . +" where xcatmn is the name of the management node, DHCP should listen on \n" . +" the eth1 and eth2 interfaces. All the nodes in group 'service' should \n" . +" listen on the 'bond0' interface.\n\n" . +" To disable the genesis kernel from being sent to specific interfaces, a\n" . +" ':noboot' option can be appended to the interface name. For example,\n" . +" if the management node has two interfaces, eth1 and eth2, disable\n" . +" genesis from being sent to eth1 using: \"eth1:noboot,eth2\".\n\n" . " dhcpsetup: If set to 'n', it will skip the dhcp setup process in the nodeset cmd.\n\n" . " dhcplease: The lease time for the dhcp client. The default value is 43200.\n\n" . " disjointdhcps: If set to '1', the .leases file on a service node only contains\n" . @@ -993,78 +998,77 @@ passed as argument rather than by table value', " If set to 'static', the network configuration will be configured \n" . " in static mode based on the node and network definition on MN.\n" . " If set to 'dhcp', the network will be configured with dhcp protocol.\n" . - " The default is 'dhcp'.\n\n" . - " ------------\n" . - "DNS ATTRIBUTES\n" . - " ------------\n" . -" dnshandler: Name of plugin that handles DNS setup for makedns.\n" . - " domain: The DNS domain name used for the cluster.\n\n" . -" forwarders: The DNS servers at your site that can provide names outside of the\n" . -" cluster. The makedns command will configure the DNS on the management\n" . -" node to forward requests it does not know to these servers.\n" . -" Note that the DNS servers on the service nodes will ignore this value\n" . -" and always be configured to forward requests to the management node.\n\n" . +" The default is 'dhcp'.\n\n" . +" ------------\n" . +"DNS ATTRIBUTES\n" . +" ------------\n" . +" dnshandler: Name of plugin that handles DNS setup for makedns.\n\n" . +" domain: The DNS domain name used for the cluster.\n\n" . +" forwarders: The DNS servers at your site that can provide names outside of the cluster.\n" . +" The makedns command will configure the DNS on the management node to foward\n" . +" requests it does not know to these servers. Note that the DNS servers on the\n" . +" service nodes will ignore this value and always be configured to forward \n" . +" to the management node.\n\n" . " master: The hostname of the xCAT management node, as known by the nodes.\n\n" . -" nameservers: A comma delimited list of DNS servers that each node in the cluster\n" . -" should use. This value will end up in the nameserver settings of the\n" . +" nameservers: A comma delimited list of DNS servers that each node in the cluster should\n" . +" use. This value will end up in the nameserver settings of the\n" . " /etc/resolv.conf on each node. It is common (but not required) to set\n" . " this attribute value to the IP addr of the xCAT management node, if\n" . " you have set up the DNS on the management node by running makedns.\n" . " In a hierarchical cluster, you can also set this attribute to\n" . " \"\" 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" . +" 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" . +" 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" . -" dnsinterfaces: The network interfaces DNS server should listen on. If it is the same\n" . -" for all nodes, use a simple comma-separated list of NICs. To\n" . -" specify different NICs for different nodes:\n" . - " xcatmn|eth1,eth2;service|bond0.\n" . -" In this example xcatmn is the name of the xCAT MN, and DNS there\n" . -" should listen on eth1 and eth2. On all of the nodes in group\n" . -" 'service' DNS should listen on the bond0 nic.\n" . -" NOTE: if using this attribute to block certain interfaces, make sure\n" . -" the ip maps to your hostname of xCAT MN is not blocked since xCAT needs to\n" . -" use this ip to communicate with the local NDS server on MN.\n\n" . - " -------------------------\n" . - "HARDWARE CONTROL ATTRIBUTES\n" . - " -------------------------\n" . +" the zone sections in named.conf.\n\n" . +" dnsinterfaces: The network interfaces DNS should listen on. If it is the same for all\n" . +" nodes, use a simple comma-separated list of NICs. To specify different \n" . +" NICs for different nodes, use the format: \"xcatmn|eth1,eth2;service|bond0\", \n" . +" where xcatmn is the name of the management node, and DNS should listen on\n" . +" the eth1 and eth2 interfaces. All the nods in group 'service' should \n" . +" listen on the 'bond0' interface.\n\n" . +" NOTE: If using this attribute to block certain interfaces, make sure\n" . +" the IP maps to your hostname of xCAT MN is not blocked since xCAT needs\n" . +" to use this IP to communicate with the local NDS server on MN.\n\n" . +" -------------------------\n" . +"HARDWARE CONTROL ATTRIBUTES\n" . +" -------------------------\n" . " blademaxp: The maximum number of concurrent processes for blade hardware control.\n\n" . " ea_primary_hmc: The hostname of the HMC that the Integrated Switch Network\n" . " Management Event Analysis should send hardware serviceable\n" . " events to for processing and potentially sending to IBM.\n\n" . " ea_backup_hmc: The hostname of the HMC that the Integrated Switch Network\n" . " Management Event Analysis should send hardware serviceable\n" . - " events to if the primary HMC is down.\n\n" . +" events to if the primary HMC is down.\n\n" . " enableASMI: (yes/1 or no/0). If yes, ASMI method will be used after fsp-api. If no,\n" . " when fsp-api is used, ASMI method will not be used. Default is no.\n\n" . " fsptimeout: The timeout, in milliseconds, to use when communicating with FSPs.\n\n" . " hwctrldispatch: Whether or not to send hw control operations to the service\n" . " node of the target nodes. Default is 'y'.(At present, this attribute\n" . - " is only used for IBM Flex System)\n\n" . +" is only used for IBM Flex System)\n\n" . " ipmidispatch: Whether or not to send ipmi hw control operations to the service\n" . " node of the target compute nodes. Default is 'y'.\n\n" . " ipmimaxp: The max # of processes for ipmi hw ctrl. The default is 64. Currently,\n" . - " this is only used for HP hw control.\n\n" . +" this is only used for HP hw control.\n\n" . " ipmiretries: The # of retries to use when communicating with BMCs. Default is 3.\n\n" . " ipmisdrcache: If set to 'no', then the xCAT IPMI support will not cache locally\n" . " the target node's SDR cache to improve performance.\n\n" . " ipmitimeout: The timeout to use when communicating with BMCs. Default is 2.\n" . - " This attribute is currently not used.\n\n" . +" This attribute is currently not used.\n\n" . " maxssh: The max # of SSH connections at any one time to the hw ctrl point for PPC\n" . " This parameter doesn't take effect on the rpower command.\n" . " It takes effects on other PPC hardware control command\n" . " getmacs/rnetboot/rbootseq and so on. Default is 8.\n\n" . -" syspowerinterval: For system p CECs, this is the number of seconds the rpower\n" . -" command will wait between performing the action for each CEC.\n" . -" For system x IPMI servers, this is the number of seconds the\n" . -" rpower command will wait between powering on \n" . -" nodes at a time. This value is used to control the power on speed\n" . - " in large clusters. Default is 0.\n\n" . +" syspowerinterval: For SystemP CECs, this is the number of seconds the rpower command\n" . +" will wait between performing the action for each CEC. For SystemX\n" . +" IPMI servers, this is the number of seconds the rpower command will\n" . +" wait between powering on nodes at a time. This\n" . +" value is used to control the power on speed in large clusters. \n" . +" Default is 0.\n\n" . " syspowermaxnodes: The number of servers to power on at one time before waiting\n" . " 'syspowerinterval' seconds to continue on to the next set of\n" . " nodes. If the noderange given to rpower includes nodes served\n" . @@ -1081,18 +1085,18 @@ passed as argument rather than by table value', " processes for PPC hardware control commands. Default is 64.\n\n" . " ppcretry: The max # of PPC hw connection attempts to HMC before failing.\n" . " It only takes effect on the hardware control commands through HMC. \n" . - " Default is 3.\n\n" . +" Default is 3.\n\n" . " ppctimeout: The timeout, in milliseconds, to use when communicating with PPC hw\n" . " through HMC. It only takes effect on the hardware control commands\n" . - " through HMC. Default is 0.\n\n" . +" through HMC. Default is 0.\n\n" . " snmpc: The snmp community string that xcat should use when communicating with the\n" . - " switches.\n\n" . - " ---------------------------\n" . - "INSTALL/DEPLOYMENT ATTRIBUTES\n" . - " ---------------------------\n" . +" switches.\n\n" . +" ---------------------------\n" . +"INSTALL/DEPLOYMENT ATTRIBUTES\n" . +" ---------------------------\n" . " cleanupxcatpost: (yes/1 or no/0). Set to 'yes' or '1' to clean up the /xcatpost\n" . " directory on the stateless and statelite nodes after the\n" . - " postscripts are run. Default is no.\n\n" . +" postscripts are run. Default is no.\n\n" . " db2installloc: The location which the service nodes should mount for\n" . " the db2 code to install. Format is hostname:/path. If hostname is\n" . " omitted, it defaults to the management node. Default is /mntdb2.\n\n" . @@ -1100,18 +1104,18 @@ passed as argument rather than by table value', " defserialport: The default serial port - currently only used by mknb.\n\n" . " defserialspeed: The default serial speed - currently only used by mknb.\n\n" . " genmacprefix: When generating mac addresses automatically, use this manufacturing\n" . - " prefix (e.g. 00:11:aa)\n\n" . +" prefix (e.g. 00:11:aa)\n\n" . " genpasswords: Automatically generate random passwords for BMCs when configuring\n" . - " them.\n\n" . +" them.\n\n" . " installdir: The local directory name used to hold the node deployment packages.\n\n" . " installloc: The location from which the service nodes should mount the \n" . " deployment packages in the format hostname:/path. If hostname is\n" . " omitted, it defaults to the management node. The path must\n" . - " match the path in the installdir attribute.\n\n" . +" match the path in the installdir attribute.\n\n" . " iscsidir: The path to put the iscsi disks in on the mgmt node.\n\n" . " mnroutenames: The name of the routes to be setup on the management node.\n" . " It is a comma separated list of route names that are defined in the\n" . - " routes table.\n\n" . +" routes table.\n\n" . " runbootscripts: If set to 'yes' the scripts listed in the postbootscripts\n" . " attribute in the osimage and postscripts tables will be run during\n" . " each reboot of stateful (diskful) nodes. This attribute has no\n" . @@ -1127,44 +1131,43 @@ passed as argument rather than by table value', " sharedtftp: Set to 0 or no, xCAT should not assume the directory\n" . " in tftpdir is mounted on all on Service Nodes. Default is 1/yes.\n" . " If value is set to a hostname, the directory in tftpdir\n" . - " will be mounted from that hostname on the SN\n\n" . -" sharedinstall: Indicates if a shared file system will be used for installation\n" . -" resources. Possible values are: 'no', 'sns', or 'all'. 'no' \n" . -" means a shared file system is not being used. 'sns' means a\n" . -" shared filesystem is being used across all service nodes.\n" . -" 'all' means that the management as well as the service nodes\n" . -" are all using a common shared filesystem. The default is 'no'.\n" . +" will be mounted from that hostname on the SN\n\n" . +" sharedinstall: Indicates if a shared file system will be used for installation\n" . +" resources. Possible values are: 'no', 'sns', or 'all'. 'no' \n" . +" means a shared file system is not being used. 'sns' means a\n" . +" shared filesystem is being used across all service nodes.\n" . +" 'all' means that the management as well as the service nodes\n" . +" are all using a common shared filesystem. The default is 'no'.\n\n" . " xcatconfdir: Where xCAT config data is (default /etc/xcat).\n\n" . " xcatdebugmode: the xCAT debug level. xCAT provides a batch of techniques\n" . " to help user debug problems while using xCAT, especially on OS provision,\n" . " such as collecting logs of the whole installation process and accessing\n" . " the installing system via ssh, etc. These techniques will be enabled\n" . " according to different xCAT debug levels specified by 'xcatdebugmode',\n" . - " currently supported values:\n" . - " '0': disable debug mode\n" . - " '1': enable basic debug mode\n" . - " '2': enable expert debug mode\n" . +" currently supported values:\n" . +" '0': disable debug mode\n" . +" '1': enable basic debug mode\n" . +" '2': enable expert debug mode\n" . " For the details on 'basic debug mode' and 'expert debug mode',\n" . - " refer to xCAT documentation.\n\n" . - " --------------------\n" . - "REMOTESHELL ATTRIBUTES\n" . - " --------------------\n" . -" nodesyncfiledir: The directory on the node, where xdcp will rsync the files\n" . +" refer to xCAT documentation.\n\n" . +" --------------------\n" . +"REMOTESHELL ATTRIBUTES\n" . +" --------------------\n" . +" nodesyncfiledir: The directory on the node, where xdcp will rsync the files\n\n" . " SNsyncfiledir: The directory on the Service Node, where xdcp will rsync the files\n" . " from the MN that will eventually be rsync'd to the compute nodes.\n\n" . -" sshbetweennodes: Comma separated list of groups of compute nodes to enable passwordless root \n" . -" ssh during install, or xdsh -K. Default is ALLGROUPS.\n" . -" Set to NOGROUPS,if you do not wish to enabled any group of compute nodes.\n" . -" Service Nodes are not affected by this attribute\n" . - " they are always setup with\n" . -" passwordless root access to nodes and other SN.\n" . +" sshbetweennodes: Comma separated list of groups of compute nodes to enable passwordless\n" . +" root ssh to the nodes during install or running 'xdsh -K'. The default\n" . +" is ALLGROUPS. Set to NOGROUPS to disable.\n\n" . +" Service Nodes are not affected by this attribute as they are always\n" . +" configured with passwordless root access.\n" . " If using the zone table, this attribute in not used.\n\n" . - " -----------------\n" . - "SERVICES ATTRIBUTES\n" . - " -----------------\n" . +" -----------------\n" . +"SERVICES ATTRIBUTES\n" . +" -----------------\n" . " consoleondemand: When set to 'yes', conserver connects and creates the console\n" . -" output only when the user opens the console. Default is no on\n" . - " Linux, yes on AIX.\n\n" . +" output only when the user opens the console. Default is 'no' on\n" . +" Linux, 'yes' on AIX.\n\n" . " httpport: The port number that the booting/installing nodes should contact the\n" . " http server on the MN/SN on. It is your responsibility to configure\n" . " the http server to listen on that port - xCAT will not do that.\n\n" . @@ -1174,7 +1177,7 @@ passed as argument rather than by table value', " For example, if the network response time is too slow, nmap may not\n" . " give stable output. You can increase the timeout value by specifying \n" . " '--min-rtt-timeout 1s'. xCAT will append the options defined here to \n" . - " the nmap command.\n\n" . +" the nmap command.\n\n" . " ntpservers: A comma delimited list of NTP servers for the service node and\n" . " the compute node to sync with. The keyword means that\n" . " the node's NTP server is the node that is managing it\n" . @@ -1182,45 +1185,43 @@ passed as argument rather than by table value', " extntpservers: A comma delimited list of external NTP servers for the xCAT\n" . " management node to sync with. If it is empty, the NTP server\n" . " will use the management node's own hardware clock to calculate\n" . - " the system date and time\n\n" . -" svloglocal: if set to 1, syslog on the service node will not get forwarded to the\n" . - " mgmt node.\n\n" . - " timezone: (e.g. America/New_York)\n\n" . - " tftpdir: tftp directory path. Default is /tftpboot\n\n" . +" the system date and time\n\n" . +" svloglocal: If set to 1, syslog on the service node will not get forwarded to the\n" . +" management node.\n\n" . +" timezone: (e.g. America/New_York)\n\n" . +" tftpdir: The tftp directory path. Default is /tftpboot\n\n" . " tftpflags: The flags that used to start tftpd. Default is \'-v -l -s /tftpboot \n" . " -m /etc/tftpmapfile4xcat.conf\' if tftplfags is not set\n\n" . " useNmapfromMN: When set to yes, nodestat command should obtain the node status\n" . " using nmap (if available) from the management node instead of the\n" . " service node. This will improve the performance in a flat network.\n\n" . -" vsftp: Default is 'n'. If set to 'y', the xcatd on the mn will automatically\n" . -" bring up vsftpd. (You must manually install vsftpd before this.\n" . -" This setting does not apply to the service node. For sn\n" . -" you need to set servicenode.ftpserver=1 if you want xcatd to\n" . - " bring up vsftpd.\n\n" . -"FQDNfirst: Fully Qualified Domain Name first. If set to 1/yes/enable, the /etc/hosts \n" . -" entries generated by 'makehosts' will put the FQDN before the PQDN(Partially \n" . -" Qualified Domain Name). Otherwise, the original behavior will be performed.\n\n" . -"hierarchicalattrs: Table attributes(e.g. postscripts, postbootscripts) that will be\n" . -" included hierarchically. Attribute values for all the node's groups\n" . -" will be applied to the node in the groups' order except the repeat one.\n\n" . - " -----------------------\n" . - "VIRTUALIZATION ATTRIBUTES\n" . - " -----------------------\n" . -" usexhrm: Have xCAT run its xHRM script when booting up KVM guests to set the\n" . - " virtual network bridge up correctly.\n" . +" vsftp: Default is 'n'. If set to 'y', xcatd on the management node will automatically\n" . +" start vsftpd. (vsftpd must be installed by the admin). This setting does not\n" . +" apply to service nodes. For service nodes, set servicenode.ftpserver=1.\n\n" . +" FQDNfirst: Fully Qualified Domain Name first. If set to 1/yes/enable, the /etc/hosts \n" . +" entries generated by 'makehosts' will put the FQDN before the PQDN(Partially \n" . +" Qualified Domain Name). Otherwise, the original behavior will be performed.\n\n" . +" hierarchicalattrs: Table attributes(e.g. postscripts, postbootscripts) that will be\n" . +" included hierarchically. Attribute values for all the node's groups\n" . +" will be applied to the node in the groups' order except the repeat one.\n\n" . +" -----------------------\n" . +"VIRTUALIZATION ATTRIBUTES\n" . +" -----------------------\n" . +" usexhrm: Have xCAT execute the xHRM script when booting up KVM guests to configure\n" . +" the virtual network bridge.\n\n" . " vcenterautojoin: When set to no, the VMWare plugin will not attempt to auto remove\n" . " and add hypervisors while trying to perform operations. If users\n" . " or tasks outside of xCAT perform the joining this assures xCAT\n" . - " will not interfere.\n\n" . +" 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" . +" enable.\n\n" . +" --------------------\n" . +"XCAT DAEMON ATTRIBUTES\n" . +" --------------------\n" . " useflowcontrol: (yes/1 or no/0). If yes, the postscript processing on each node\n" . " contacts xcatd on the MN/SN using a lightweight UDP packet to wait\n" . " until xcatd is ready to handle the requests associated with\n" . @@ -1228,9 +1229,9 @@ passed as argument rather than by table value', " locking out admin interactive use. This value works with the\n" . " xcatmaxconnections and xcatmaxbatch attributes. Is not supported on AIX.\n" . " If the value is no, nodes sleep for a random time before contacting\n" . - " xcatd, and retry. The default is no.\n" . - " See the following document for details:\n" . - " Hints_and_Tips_for_Large_Scale_Clusters\n\n" . +" xcatd, and retry. The default is no.\n" . +" See the following document for details:\n" . +" Hints_and_Tips_for_Large_Scale_Clusters\n\n" . " xcatmaxconnections: Number of concurrent xCAT protocol requests before requests\n" . " begin queueing. This applies to both client command requests\n" . " and node requests, e.g. to get postscripts. Default is 64.\n\n" . @@ -1240,7 +1241,7 @@ passed as argument rather than by table value', " xcatiport: The port used by xcatd to receive install status updates from nodes.\n\n" . " xcatlport: The port used by xcatd command log writer process to collect command output.\n\n" . " xcatsslversion: The ssl version by xcatd. Default is SSLv3.\n\n" . - " xcatsslciphers: The ssl cipher by xcatd. Default is 3DES.\n\n", +" xcatsslciphers: The ssl cipher by xcatd. Default is 3DES.\n\n", value => 'The value of the attribute specified in the "key" column.', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", From 9dc963578c5bca0830651d53b72e41a52244121c Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 31 Oct 2016 22:23:16 -0400 Subject: [PATCH 15/43] Add the autogenerated man pages --- .../references/man1/packimage.1.rst | 2 +- .../admin-guides/references/man5/site.5.rst | 142 +++++++++--------- 2 files changed, 74 insertions(+), 70 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/packimage.1.rst b/docs/source/guides/admin-guides/references/man1/packimage.1.rst index 5be66f428..f7f1ff332 100644 --- a/docs/source/guides/admin-guides/references/man1/packimage.1.rst +++ b/docs/source/guides/admin-guides/references/man1/packimage.1.rst @@ -33,7 +33,7 @@ DESCRIPTION Packs the stateless image from the chroot file system into a file to be sent to the node for a diskless boot. -Note: For an osimage that is deployed on a cluster, running packimage will overwrite the existing rootimage file and be unavailable to the compute nodes while the command executes. +Note: For an osimage that is deployed on a cluster, running packimage will overwrite the existing rootimage file and be unavailable to the compute nodes while packimage is running. ********** diff --git a/docs/source/guides/admin-guides/references/man5/site.5.rst b/docs/source/guides/admin-guides/references/man5/site.5.rst index 0b547c409..bfdd13269 100644 --- a/docs/source/guides/admin-guides/references/man5/site.5.rst +++ b/docs/source/guides/admin-guides/references/man5/site.5.rst @@ -82,22 +82,28 @@ site Attributes: details on supported formats. nodestatus: If set to 'n', the nodelist.status column will not be updated during - the node deployment, node discovery and power operations. The default is to update. + the node deployment, node discovery and power operations. The default + is to update. skiptables: Comma separated list of tables to be skipped by dumpxCATdb - skipvalidatelog: If set to 1, then getcredentials and getpostscripts calls will not be logged in syslog. + skipvalidatelog: If set to 1, then getcredentials and getpostscripts calls will not + be logged in syslog. ------------- DHCP ATTRIBUTES ------------- - dhcpinterfaces: The network interfaces DHCP should listen on. If it is the same - for all nodes, use a simple comma-separated list of NICs. To - specify different NICs for different nodes: - xcatmn|eth1,eth2;service|bond0. - In this example xcatmn is the name of the xCAT MN, and DHCP there - should listen on eth1 and eth2. On all of the nodes in group - 'service' DHCP should listen on the bond0 nic. + dhcpinterfaces: The network interfaces DHCP should listen on. If it is the same for all + nodes, use a comma-separated list of the NICs. To specify different NICs + for different nodes, use the format: "xcatmn|eth1,eth2;service|bond0", + where xcatmn is the name of the management node, DHCP should listen on + the eth1 and eth2 interfaces. All the nodes in group 'service' should + listen on the 'bond0' interface. + + To disable the genesis kernel from being sent to specific interfaces, a + ':noboot' option can be appended to the interface name. For example, + if the management node has two interfaces, eth1 and eth2, disable + genesis from being sent to eth1 using: "eth1:noboot,eth2". dhcpsetup: If set to 'n', it will skip the dhcp setup process in the nodeset cmd. @@ -120,18 +126,19 @@ site Attributes: DNS ATTRIBUTES ------------ dnshandler: Name of plugin that handles DNS setup for makedns. + domain: The DNS domain name used for the cluster. - forwarders: The DNS servers at your site that can provide names outside of the - cluster. The makedns command will configure the DNS on the management - node to forward requests it does not know to these servers. - Note that the DNS servers on the service nodes will ignore this value - and always be configured to forward requests to the management node. + forwarders: The DNS servers at your site that can provide names outside of the cluster. + The makedns command will configure the DNS on the management node to foward + requests it does not know to these servers. Note that the DNS servers on the + service nodes will ignore this value and always be configured to forward + to the management node. master: The hostname of the xCAT management node, as known by the nodes. - nameservers: A comma delimited list of DNS servers that each node in the cluster - should use. This value will end up in the nameserver settings of the + nameservers: A comma delimited list of DNS servers that each node in the cluster should + use. This value will end up in the nameserver settings of the /etc/resolv.conf on each node. It is common (but not required) to set this attribute value to the IP addr of the xCAT management node, if you have set up the DNS on the management node by running makedns. @@ -148,16 +155,16 @@ site Attributes: section. This is an interface for user to add configuration entries to the zone sections in named.conf. - dnsinterfaces: The network interfaces DNS server should listen on. If it is the same - for all nodes, use a simple comma-separated list of NICs. To - specify different NICs for different nodes: - xcatmn|eth1,eth2;service|bond0. - In this example xcatmn is the name of the xCAT MN, and DNS there - should listen on eth1 and eth2. On all of the nodes in group - 'service' DNS should listen on the bond0 nic. - NOTE: if using this attribute to block certain interfaces, make sure - the ip maps to your hostname of xCAT MN is not blocked since xCAT needs to - use this ip to communicate with the local NDS server on MN. + dnsinterfaces: The network interfaces DNS should listen on. If it is the same for all + nodes, use a simple comma-separated list of NICs. To specify different + NICs for different nodes, use the format: "xcatmn|eth1,eth2;service|bond0", + where xcatmn is the name of the management node, and DNS should listen on + the eth1 and eth2 interfaces. All the nods in group 'service' should + listen on the 'bond0' interface. + + NOTE: If using this attribute to block certain interfaces, make sure + the IP maps to your hostname of xCAT MN is not blocked since xCAT needs + to use this IP to communicate with the local NDS server on MN. ------------------------- HARDWARE CONTROL ATTRIBUTES @@ -200,12 +207,12 @@ site Attributes: It takes effects on other PPC hardware control command getmacs/rnetboot/rbootseq and so on. Default is 8. - syspowerinterval: For system p CECs, this is the number of seconds the rpower - command will wait between performing the action for each CEC. - For system x IPMI servers, this is the number of seconds the - rpower command will wait between powering on - nodes at a time. This value is used to control the power on speed - in large clusters. Default is 0. + syspowerinterval: For SystemP CECs, this is the number of seconds the rpower command + will wait between performing the action for each CEC. For SystemX + IPMI servers, this is the number of seconds the rpower command will + wait between powering on nodes at a time. This + value is used to control the power on speed in large clusters. + Default is 0. syspowermaxnodes: The number of servers to power on at one time before waiting 'syspowerinterval' seconds to continue on to the next set of @@ -291,12 +298,13 @@ site Attributes: If value is set to a hostname, the directory in tftpdir will be mounted from that hostname on the SN - sharedinstall: Indicates if a shared file system will be used for installation - resources. Possible values are: 'no', 'sns', or 'all'. 'no' - means a shared file system is not being used. 'sns' means a - shared filesystem is being used across all service nodes. - 'all' means that the management as well as the service nodes - are all using a common shared filesystem. The default is 'no'. + sharedinstall: Indicates if a shared file system will be used for installation + resources. Possible values are: 'no', 'sns', or 'all'. 'no' + means a shared file system is not being used. 'sns' means a + shared filesystem is being used across all service nodes. + 'all' means that the management as well as the service nodes + are all using a common shared filesystem. The default is 'no'. + xcatconfdir: Where xCAT config data is (default /etc/xcat). xcatdebugmode: the xCAT debug level. xCAT provides a batch of techniques @@ -315,23 +323,24 @@ site Attributes: REMOTESHELL ATTRIBUTES -------------------- nodesyncfiledir: The directory on the node, where xdcp will rsync the files + SNsyncfiledir: The directory on the Service Node, where xdcp will rsync the files from the MN that will eventually be rsync'd to the compute nodes. - sshbetweennodes: Comma separated list of groups of compute nodes to enable passwordless root - ssh during install, or xdsh -K. Default is ALLGROUPS. - Set to NOGROUPS,if you do not wish to enabled any group of compute nodes. - Service Nodes are not affected by this attribute - they are always setup with - passwordless root access to nodes and other SN. + sshbetweennodes: Comma separated list of groups of compute nodes to enable passwordless + root ssh to the nodes during install or running 'xdsh -K'. The default + is ALLGROUPS. Set to NOGROUPS to disable. + + Service Nodes are not affected by this attribute as they are always + configured with passwordless root access. If using the zone table, this attribute in not used. ----------------- SERVICES ATTRIBUTES ----------------- consoleondemand: When set to 'yes', conserver connects and creates the console - output only when the user opens the console. Default is no on - Linux, yes on AIX. + output only when the user opens the console. Default is 'no' on + Linux, 'yes' on AIX. httpport: The port number that the booting/installing nodes should contact the http server on the MN/SN on. It is your responsibility to configure @@ -355,12 +364,12 @@ site Attributes: will use the management node's own hardware clock to calculate the system date and time - svloglocal: if set to 1, syslog on the service node will not get forwarded to the - mgmt node. + svloglocal: If set to 1, syslog on the service node will not get forwarded to the + management node. timezone: (e.g. America/New_York) - tftpdir: tftp directory path. Default is /tftpboot + tftpdir: The tftp directory path. Default is /tftpboot tftpflags: The flags that used to start tftpd. Default is '-v -l -s /tftpboot -m /etc/tftpmapfile4xcat.conf' if tftplfags is not set @@ -369,29 +378,24 @@ site Attributes: using nmap (if available) from the management node instead of the service node. This will improve the performance in a flat network. - vsftp: Default is 'n'. If set to 'y', the xcatd on the mn will automatically - bring up vsftpd. (You must manually install vsftpd before this. - This setting does not apply to the service node. For sn - you need to set servicenode.ftpserver=1 if you want xcatd to - bring up vsftpd. - - - FQDNfirst: Fully Qualified Domain Name first. If set to 1/yes/enable, the /etc/hosts - entries generated by 'makehosts' will put the FQDN before the PQDN(Partially - Qualified Domain Name). Otherwise, the original behavior will be performed. - - hierarchicalattrs: Table attributes(e.g. postscripts, postbootscripts) that will be - included hierarchically. Attribute values for all the node's groups - will be applied to the node in the groups' order except the repeat one. - - - .. code-block:: perl - + vsftp: Default is 'n'. If set to 'y', xcatd on the management node will automatically + start vsftpd. (vsftpd must be installed by the admin). This setting does not + apply to service nodes. For service nodes, set servicenode.ftpserver=1. + + FQDNfirst: Fully Qualified Domain Name first. If set to 1/yes/enable, the /etc/hosts + entries generated by 'makehosts' will put the FQDN before the PQDN(Partially + Qualified Domain Name). Otherwise, the original behavior will be performed. + + hierarchicalattrs: Table attributes(e.g. postscripts, postbootscripts) that will be + included hierarchically. Attribute values for all the node's groups + will be applied to the node in the groups' order except the repeat one. + ----------------------- VIRTUALIZATION ATTRIBUTES ----------------------- - usexhrm: Have xCAT run its xHRM script when booting up KVM guests to set the - virtual network bridge up correctly. + usexhrm: Have xCAT execute the xHRM script when booting up KVM guests to configure + the virtual network bridge. + vcenterautojoin: When set to no, the VMWare plugin will not attempt to auto remove and add hypervisors while trying to perform operations. If users or tasks outside of xCAT perform the joining this assures xCAT From 5abb24af167654210c8d6973d4b859689862c1c6 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 31 Oct 2016 22:23:28 -0400 Subject: [PATCH 16/43] Add some text describing the noboot option to disable the genesis kernel from being sent over a interface --- .../ppc64le/configure/networks.rst | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst index 1c7f6b28d..c7124b018 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst @@ -12,15 +12,19 @@ Set attributes in the ``networks`` table #. To define additional networks, use one of the following options: - * Use ``mkdef`` to create/update an entry into ``networks`` table. (**Recommended**) + * (**Recommended**) Use ``mkdef`` to create/update an entry into ``networks`` table. To create a network entry for 192.168.X.X/16 with a gateway of 192.168.1.254: :: mkdef -t network -o net1 net=192.168.0.0 mask=255.255.0.0 gateway=192.168.1.254 - * Use the ``tabedit`` command to modify the networks table directly in an editor: ``tabedit networks`` + * Use the ``tabedit`` command to modify the networks table directly in an editor: :: - * Use the ``makenetworks`` command to automatically generate a entry in the ``networks`` table + tabedit networks + + * Use the ``makenetworks`` command to automatically generate a entry in the ``networks`` table: :: + + makenetworks #. Verify the network statements @@ -33,13 +37,23 @@ Initialize DHCP services #. Configure DHCP to listen on different network interfaces (**Optional**) - xCAT allows specifying different network intercaces thateDHCP can listen on for different nodes or node groups. If this is not needed, go to the next step. To set dhcpinterfaces :: + The ``dhcpinterfaces`` keyword allows users to specify or limit the DHCP to listen over certain network interfaces. - chdef -t site dhcpinterfaces='xcatmn|eth1,eth2;service|bond0' + If the management node has 4 interfaces, (eth0, eth1, eth2, and eth3), and you want DHCP to listen only on "eth1" and "eth3", set ``dhcpinterfaces`` with: :: + chdef -t site dhcpinterfaces="eth1,eth3" + + To set "eth1" and "eth3" on the management node, and "bond0" on all the nodes in the "service" nodegroup, set ``dhcpinterfaces`` with: :: + + chdef -t site dhcpinterfaces="xcatmn|eth1,eth3;service|bond0" + + [**noboot**]: For the IBM OpenPower S822LC for HPC ("Minsky") nodes, the BMC and "eth0" on the compute side shares the same physical ethernet port. However, it is recommended to allow the BMC to be dedicated and to use "eth1" for the compute node. When an open range is configured on the two networks, the xCAT Genesis Kernel will be sent to the BMC interface and will cause problems with discovery. In this scenario, if "eth1" is the BMC network and "eth3" is the compute network, disabled genesis by setting ``:noboot`` in ``dhcpinterfaces`` with: :: + + chdef -t site dhcpinterfaces="eth1:noboot,eth3" + + For more information, see ``dhcpinterfaces`` keyword in the :doc:`site ` table. - #. Create a new DHCP configuration file with the networks defined using the ``makedhcp`` command. :: makedhcp -n From c3dfe43b72a105e9078574143631a8e105995d26 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 31 Oct 2016 23:30:33 -0400 Subject: [PATCH 17/43] update docoment and man page --- .../references/man1/xcattest.1.rst | 30 +++++++++++----- xCAT-test/pods/man1/xcattest.1.pod | 34 +++++++++++++------ 2 files changed, 45 insertions(+), 19 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/xcattest.1.rst b/docs/source/guides/admin-guides/references/man1/xcattest.1.rst index e09fd2e9e..e3b56aff0 100644 --- a/docs/source/guides/admin-guides/references/man1/xcattest.1.rst +++ b/docs/source/guides/admin-guides/references/man1/xcattest.1.rst @@ -21,11 +21,21 @@ SYNOPSIS \ **xcattest**\ [\ **-?|-h**\ ] -\ **xcattest**\ [\ **-f**\ \ *configure file*\ ] [\ **-b**\ \ *case bundle list*\ ] [\ **-l**\ ] +\ **xcattest**\ [\ **-f**\ \ *configure file*\ ] [\ **-b**\ \ *case bundle list*\ ] \ **xcattest**\ [\ **-f**\ \ *configure file*\ ] [\ **-t**\ \ *case list*\ ] -\ **xcattest**\ [\ **-f**\ \ *configure file*\ ] [\ **-c**\ \ *cmd list*\ ] [\ **-l**\ ] +\ **xcattest**\ [\ **-f**\ \ *configure file*\ ] [\ **-c**\ \ *cmd list*\ ] + +\ **xcattest**\ [\ **-b**\ \ *case bundle list*\ ] [\ **-l**\ ] + +\ **xcattest**\ [\ **-t**\ \ *case list*\ ] [\ **-l**\ ] + +\ **xcattest**\ [\ **-c**\ \ *cmd list*\ ] [\ **-l**\ ] + +\ **xcattest**\ [\ **-s**\ \ *command*\ ] + +\ **xcattest**\ [\ **-s**\ \ *bundle*\ ] *********** @@ -52,7 +62,7 @@ OPTIONS \ **-f**\ \ *configure file*\ - Specifies the configuration file, if not specified, the default configure file is /opt/xcat/share/xcat/tools/autotest/default.conf. +Specifies the configuration file with full-path. xCAT supports an example config file: /opt/xcat/share/xcat/tools/autotest/linux.conf.template @@ -79,7 +89,9 @@ OPTIONS Display the test cases names specified by the flag -b, -t or -c. +\ **-s**\ + Display the bundle files and command with value: bundle or command. ************ RETURN VALUE @@ -136,33 +148,33 @@ EXAMPLES .. code-block:: perl - xcattest -c /tmp/config -c rpower + xcattest -f /tmp/config -c rpower 2. - To run customized bundle: + To run customized bundle with /tmp/config file: .. code-block:: perl - xcattest -l > /tmp/custom.bundle + xcattest -l > /opt/xcat/share/xcat/tools/autotest/bundle/custom.bundle Modify custom.bundle - xcattest -b custom.bundle + xcattest -f /tmp/config -b custom.bundle 3. - To run specified test cases. + To run specified test cases with /tmp/config: .. code-block:: perl - xcattest -t lsdef_t_o_l_z + xcattest -f /tmp/config -t lsdef_t_o_l_z diff --git a/xCAT-test/pods/man1/xcattest.1.pod b/xCAT-test/pods/man1/xcattest.1.pod index 773326908..5dba9d902 100644 --- a/xCAT-test/pods/man1/xcattest.1.pod +++ b/xCAT-test/pods/man1/xcattest.1.pod @@ -6,11 +6,21 @@ B - Run automated xCAT test cases. B [B<-?|-h>] -B [B<-f> I] [B<-b> I] [B<-l>] +B [B<-f> I] [B<-b> I] B [B<-f> I] [B<-t> I] -B [B<-f> I] [B<-c> I] [B<-l>] +B [B<-f> I] [B<-c> I] + +B [B<-b> I] [B<-l>] + +B [B<-t> I] [B<-l>] + +B [B<-c> I] [B<-l>] + +B [B<-s> B] + +B [B<-s> B] =head1 DESCRIPTION @@ -28,11 +38,11 @@ Display usage message. =item B<-f> I -Specifies the configuration file, if not specified, the default configure file is /opt/xcat/share/xcat/tools/autotest/default.conf. +Specifies the configuration file with full-path. xCAT supports an example config file: /opt/xcat/share/xcat/tools/autotest/linux.conf.template =item B<-b> I -Comma separated list of test cases bundle files, each test cases bundle can contain multiple lines and each line for one test case name. +Comma separated list of test cases bundle files, each test cases bundle can contain multiple lines and each line for one test case name. The bundle files should be listed in: /opt/xcat/share/xcat/tools/autotest/bundle. =item B<-t> I @@ -46,6 +56,10 @@ Comma separated list of commands which will be tested, i.e., all the test cases Display the test cases names specified by the flag -b, -t or -c. +=item B<-s> + +Display the bundle files and command with value: bundle or command. + =back =head1 RETURN VALUE @@ -86,21 +100,21 @@ B: Each test case can have more than one I sections and each I s To run all test cases related command rpower: - xcattest -c /tmp/config -c rpower + xcattest -f /tmp/config -c rpower =item 2. -To run customized bundle: +To run customized bundle with /tmp/config file: - xcattest -l > /tmp/custom.bundle + xcattest -c lsdef -l > /opt/xcat/share/xcat/tools/autotest/bundle/custom.bundle Modify custom.bundle - xcattest -b custom.bundle + xcattest -f /tmp/config -b custom.bundle =item 3. -To run specified test cases. +To run specified test cases with /tmp/config file: - xcattest -t lsdef_t_o_l_z + xcattest -f /tmp/config -t lsdef_t_o_l_z =item 4. From e72fb85ea7b01e0e5697cb15d067fad80376afb7 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 1 Nov 2016 09:47:51 -0400 Subject: [PATCH 18/43] Made some changes based on review comments - Reformatted the DHCP section - Created a section for noboot so that we can link this in our Release Notes --- .../ppc64le/configure/networks.rst | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst index c7124b018..b199866d2 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst @@ -12,7 +12,7 @@ Set attributes in the ``networks`` table #. To define additional networks, use one of the following options: - * (**Recommended**) Use ``mkdef`` to create/update an entry into ``networks`` table. + * [**Recommended**] Use ``mkdef`` to create/update an entry into ``networks`` table. To create a network entry for 192.168.X.X/16 with a gateway of 192.168.1.254: :: @@ -35,26 +35,33 @@ Set attributes in the ``networks`` table Initialize DHCP services ------------------------ -#. Configure DHCP to listen on different network interfaces (**Optional**) +Configure DHCP to listen on different network interfaces [**Optional**] - The ``dhcpinterfaces`` keyword allows users to specify or limit the DHCP to listen over certain network interfaces. + The default behavior of xCAT is to configure DHCP to listen on all interfaces defined in the ``networks`` table. - If the management node has 4 interfaces, (eth0, eth1, eth2, and eth3), and you want DHCP to listen only on "eth1" and "eth3", set ``dhcpinterfaces`` with: :: + The ``dhcpinterfaces`` keyword in the ``site`` table allows administrators to limit the interfaces that DHCP will listen over. If the management node has 4 interfaces, (eth0, eth1, eth2, and eth3), and you want DHCP to listen only on "eth1" and "eth3", set ``dhcpinterfaces`` using: :: chdef -t site dhcpinterfaces="eth1,eth3" - To set "eth1" and "eth3" on the management node, and "bond0" on all the nodes in the "service" nodegroup, set ``dhcpinterfaces`` with: :: + To set "eth1" and "eth3" on the management node and "bond0" on all nodes in the nodegroup="service", set ``dhcpinterfaces`` using: :: chdef -t site dhcpinterfaces="xcatmn|eth1,eth3;service|bond0" - [**noboot**]: For the IBM OpenPower S822LC for HPC ("Minsky") nodes, the BMC and "eth0" on the compute side shares the same physical ethernet port. However, it is recommended to allow the BMC to be dedicated and to use "eth1" for the compute node. When an open range is configured on the two networks, the xCAT Genesis Kernel will be sent to the BMC interface and will cause problems with discovery. In this scenario, if "eth1" is the BMC network and "eth3" is the compute network, disabled genesis by setting ``:noboot`` in ``dhcpinterfaces`` with: :: +**noboot** +`````````` + For the *IBM OpenPOWER S822LC for HPC ("Minsky")* nodes, the BMC and compute "eth0" share the left-size integrated ethernet port and compute "eth1" is the right-side integrated ethernet port. For these servers, it is recommended to use two physical cables allowing the BMC port to be dedicated and "eth1" used by the OS. When an open range is configured on the two networks, the xCAT Genesis kernel will be sent to the BMC interface and causes problems during hardware discovery. To support this scenario, on the xCAT management node, if "eth1" is connected to the BMC network and "eth3" is connected to the compute network, disable genesis boot for the BMC network by setting ``:noboot`` in ``dhcpinterfaces`` using: :: chdef -t site dhcpinterfaces="eth1:noboot,eth3" - - For more information, see ``dhcpinterfaces`` keyword in the :doc:`site ` table. + # run the mknb command to remove the genesis + # configuration file for the specified network + mknb ppc64 -#. Create a new DHCP configuration file with the networks defined using the ``makedhcp`` command. :: + +For more information, see ``dhcpinterfaces`` keyword in the :doc:`site ` table. + + +After making any DHCP changes, create a new DHCP configuration file with the networks defined using the ``makedhcp`` command. :: makedhcp -n From a49db1c4ffb92025169660028115f3899138d1c1 Mon Sep 17 00:00:00 2001 From: penguhyang Date: Wed, 2 Nov 2016 10:45:26 +0800 Subject: [PATCH 19/43] fix nodediscoverls output limits serial length (#2032) --- xCAT-server/lib/xcat/plugins/seqdiscovery.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm index fc668a0af..3bc482215 100755 --- a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm +++ b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm @@ -909,7 +909,7 @@ Usage: } else { $ent->{'node'} = 'undef' unless ($ent->{'node'}); $ent->{'method'} = 'undef' unless ($ent->{'method'}); - push @discoverednodes, sprintf(" %-40s%-20s%-15s%-10s%-13s", $ent->{'uuid'}, $ent->{'node'}, $ent->{'method'}, $ent->{'mtm'}, substr($ent->{'serial'}, 0, 12)); + push @discoverednodes, sprintf(" %-40s%-20s%-15s%-10s%-20s", $ent->{'uuid'}, $ent->{'node'}, $ent->{'method'}, $ent->{'mtm'}, substr($ent->{'serial'}, 0, 19)); } } From 15e2a17a8be4c761edd7c916ef0ea4194d5fe2bc Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 2 Nov 2016 01:03:07 -0400 Subject: [PATCH 20/43] move rsyslogd restart code from dhclient-script to doxcat --- xCAT-genesis-builder/dhclient-script | 20 -------------- xCAT-genesis-scripts/bin/doxcat | 40 +++++++++++++++------------- 2 files changed, 22 insertions(+), 38 deletions(-) diff --git a/xCAT-genesis-builder/dhclient-script b/xCAT-genesis-builder/dhclient-script index 25291afe7..fcf51c9ac 100755 --- a/xCAT-genesis-builder/dhclient-script +++ b/xCAT-genesis-builder/dhclient-script @@ -36,26 +36,6 @@ elif [ $reason = "BOUND" ]; then for gw in $new_routers; do ip route add default via $gw done - # Up to this point we were logging to the local /var/log/xcat.genesis - # file. But now we know the xCAT MN, so replace logging to the local - # file with logging to the xCAT MN - if [ ! -z "$new_log_servers" ]; then - head -n -1 /etc/rsyslog.conf > /etc/rsyslog.conf.new - cp /etc/rsyslog.conf.new /etc/rsyslog.conf - fi - for ls in $new_log_servers; do - echo "*.* @$ls" >> /etc/rsyslog.conf - done - kill `cat /var/run/syslogd.pid` - sleep 3 - RSYSLOGD_VERSION=`rsyslogd -v | grep "rsyslogd" | cut -d" " -f2 | cut -d"." -f1` - if [ $RSYSLOGD_VERSION -ge 8 ]; then - # Newer versions of rsyslogd do not support -c flag anymore - /sbin/rsyslogd - else - /sbin/rsyslogd -c4 - fi - if [ ! -z "$new_tcode" -a -r "/usr/share/zoneinfo/posix/$new_tcode" ]; then cp "/usr/share/zoneinfo/posix/$new_tcode" /etc/localtime diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 794e57534..9c052b313 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -169,6 +169,10 @@ export XCATMASTER logger -s -t $log_label -p local4.info "XCATMASTER is $XCATMASTER, XCATPORT is $XCATPORT" +head -n -1 /etc/rsyslog.conf > /etc/rsyslog.conf.new +cp /etc/rsyslog.conf.new /etc/rsyslog.conf +echo "*.* @$XCATMASTER" >> /etc/rsyslog.conf + if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then # doing static ip # the device was determined above from the bootif mac, and put in bootnic @@ -253,21 +257,6 @@ else fi fi -count_f=0 -while [ $count_f -le 8 ]; do - rsyslogd_ps=`ps -ef | grep 'rsyslogd' | grep -v 'grep'` - if [ "$rsyslogd_ps" ]; then - break - else - ((count_f++)) - sleep 0.5 - fi -done - -if [ $count_f -gt 8 ]; then - echo "rsyslogd maybe off" -fi - openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 & logger -s -t $log_label -p local4.info "Acquired IPv4 address on $bootnic" @@ -282,9 +271,19 @@ fi # rv 0 state does not work with the new ntp versions while [ "`ntpq -c 'rv 0 offset' | awk -F '=' '/offset=/ { print $2 }' | awk -F '.' '{ print $1 }' | sed s/-//`" -ge 1000 ]; do + echo `ntpq -c 'rv 0 offset` sleep 1 done +kill `cat /var/run/syslogd.pid` +sleep 3 +RSYSLOGD_VERSION=`rsyslogd -v | grep "rsyslogd" | cut -d" " -f2 | cut -d"." -f1` +if [ $RSYSLOGD_VERSION -ge 8 ]; then + /sbin/rsyslogd +else + /sbin/rsyslogd -c4 +fi + HOST_ARCH=`uname -m` if echo $HOST_ARCH | grep "ppc64"; then modprobe ipmi_powernv @@ -331,6 +330,7 @@ while :; do /bin/getcert $XCATMASTER:$XCATPORT destiny='' dest='' + touch /tmp/xcatgenesisdiscovery elif [ "$dest" = shell ]; then logger -s -t $log_label -p local4.info "Dropping to debug shell(exit to run next destiny)..." destiny='' @@ -391,16 +391,20 @@ while :; do destiny='' dest='' elif [ "$dest" = standby ]; then - destiny='' - dest='' delay=$((30+$RANDOM%270)) while [ $delay -gt 0 ]; do if [ $((delay%10)) == 0 ]; then - logger -s -t $log_label -p local4.info "Received request to retry in a bit, will call xCAT back in $delay seconds" + if [ -e "/tmp/xcatgenesisdiscovery" ]; then + logger -s -t $log_label -p local4.info "Received request=$dest, will call xCAT back in $delay seconds. Discovery is complete, run nodeset on this node to provision an Operating System" + else + logger -s -t $log_label -p local4.info "Received request to retry in a bit, will call xCAT back in $delay seconds" + fi fi delay=$((delay-1)) sleep 1 done + destiny='' + dest='' echo "Retrying "; elif [ "$dest" = shutdown ]; then logger -s -t $log_label -p local4.info "Poweroff..." From 15eeb3b2d50af3b9190890153e539baf04cefd3d Mon Sep 17 00:00:00 2001 From: chenglch Date: Wed, 2 Nov 2016 15:20:08 +0800 Subject: [PATCH 21/43] Skit auditlog and eventlog table as auto increment key is uesd (#2066) Close-issue: #2065 --- perl-xCAT/xCAT/Table.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index a97fbf7c0..67b1b2b8f 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -1724,12 +1724,15 @@ sub setAttribs my %newpairs; # NOTE(chenglch): Just work around, set the default value to '' due to # null value can not be allowed in composite primary keys in standard - # SQL rules. - my $descr = $xCAT::Schema::tabspec{ $self->{tabname} }; - my @pkeys = @{$descr->{keys}}; - for my $p (@pkeys) { - if(!defined($elems->{$p}) && !defined($pKeypairs->{$p})) { - $elems->{$p}= ''; + # SQL rules. As auto increment key is uesd by 'eventlog' and 'auditlog' + # table, just skip these tables. + if ($self->{tabname} ne "eventlog" && $self->{tabname} ne "auditlog") { + my $descr = $xCAT::Schema::tabspec{ $self->{tabname} }; + my @pkeys = @{$descr->{keys}}; + for my $p (@pkeys) { + if(!defined($elems->{$p}) && !defined($pKeypairs->{$p})) { + $elems->{$p}= ''; + } } } From 181c1a706c07531df5eec264158e254bd3f0e8c9 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 2 Nov 2016 04:18:51 -0400 Subject: [PATCH 22/43] New template of probe command dispatch in hierarchy environment --- xCAT-probe/lib/perl/hierarchy.pm | 267 +++++++++++++++++++++++ xCAT-probe/subcmds/code_template | 350 +++++++------------------------ 2 files changed, 346 insertions(+), 271 deletions(-) create mode 100644 xCAT-probe/lib/perl/hierarchy.pm diff --git a/xCAT-probe/lib/perl/hierarchy.pm b/xCAT-probe/lib/perl/hierarchy.pm new file mode 100644 index 000000000..94594d6d2 --- /dev/null +++ b/xCAT-probe/lib/perl/hierarchy.pm @@ -0,0 +1,267 @@ +package hierarchy; + +# IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html + +BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } +use lib "$::XCATROOT/probe/lib/perl"; +use probe_utils; +use xCAT::ServiceNodeUtils; + +use strict; +use Data::Dumper; +use IO::Select; +use File::Basename; +use POSIX ":sys_wait_h"; + +sub new { + my $self = {}; + my $class = shift; + + $self->{program_name} = basename("$0"); + + my %dispatchcmd; + $self->{dispatchcmd} = \%dispatchcmd; + + my @subjobpids = (); + my @subjobfds = (); + my %subjobstates; + my %fdnodemap; + $self->{subjobpids} = \@subjobpids; + $self->{subjobfds} = \@subjobfds; + $self->{subjobstates} = \%subjobstates; + $self->{allsubjobdone} = 0; + $self->{fdnodemap} = \%fdnodemap; + $self->{select} = new IO::Select; + + bless($self, ref($class) || $class); + return $self; +} + +sub calculate_dispatch_cmd { + my $self = shift; + my $noderange = shift; + my $argv_ref = shift; + my $error_ref = shift; + + @{$error_ref} = (); + + my @snlist = xCAT::ServiceNodeUtils->getAllSN(); + if ($noderange) { + my @nodes = probe_utils->parse_node_range($noderange); + + #if there is error in noderange + if ($?) { + my $error = join(" ", @nodes); + if ($error =~ /Error: Invalid nodes and\/or groups in noderange: (.+)/) { + push @{$error_ref}, "There are invaild nodes ($1) in command line attribute node range"; + } else { + push @{$error_ref}, "There is error in command line attribute node range, please using nodels to check"; + } + return 1; + } else { + + #calculate the mapping between SN and the nodes which belong to it. + chomp foreach (@nodes); + my $snnodemap = xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes, "xcat", "MN"); + + my %newsnnodemap; + my $rst = 0; + foreach my $sn (keys %$snnodemap) { + if (grep(/^$sn$/, @snlist)) { # the node just belong to one SN + push(@{ $newsnnodemap{$sn} }, @{ $snnodemap->{$sn} }); + } elsif ($sn =~ /(\w+),.+/) { # the node belong to more than one SN, count it into first SN + if (grep(/^$1$/, @snlist)) { + push(@{ $newsnnodemap{$1} }, @{ $snnodemap->{$sn} }); + } else { + push @{$error_ref}, "The value $1 of 'servicenode' isn't a service node"; + $rst = 1; + } + } else { # the nodes don't belong to any SN will be handled by MN + push(@{ $newsnnodemap{mn} }, @{ $snnodemap->{$sn} }); + } + } + + return 1 if ($rst); + + #print Dumper \%newsnnodemap; + #generate new command for each SN, replace noderange + foreach my $sn (keys %newsnnodemap) { + my $nodes = join(",", @{ $newsnnodemap{$sn} }); + for (my $i = 0 ; $i <= @$argv_ref ; $i++) { + if ($argv_ref->[$i] eq "-n") { + $argv_ref->[ $i + 1 ] = $nodes; + last; + } + } + my $args = join(" ", @$argv_ref); + $self->{dispatchcmd}->{$sn} = "$::XCATROOT/probe/subcmds/$self->{program_name} $args -H 2>&1"; + } + } + } else { + + #there isn't noderange input from STDIN, dispatch command to all SN if there are SN defined in MN + if (@snlist) { + my $args = join(" ", @$argv_ref); + my $sns = join(",", @snlist); + $self->{dispatchcmd}->{$sns} = "$::XCATROOT/probe/subcmds/$self->{program_name} $args -H 2>&1" if (!$?); + $self->{dispatchcmd}->{mn} = "$::XCATROOT/probe/subcmds/$self->{program_name} $args -H 2>&1"; + } + } + + return 0; +} + +sub dispatch_cmd { + my $self = shift; + my $noderange = shift; + my $argv_ref = shift; + my $error_ref = shift; + + @$error_ref = (); + my $rst = 0; + + $rst = $self->calculate_dispatch_cmd($noderange, $argv_ref, $error_ref); + return $rst if ($rst); + + foreach my $target_server (keys %{ $self->{dispatchcmd} }) { + my $subjobcmd = undef; + if ($target_server eq "mn") { + $subjobcmd = $self->{dispatchcmd}->{$target_server}; + } else { + $subjobcmd = "xdsh $target_server -s \"$self->{dispatchcmd}->{$target_server}\" 2>&1"; + } + + #print "$subjobcmd\n"; + + my $subjobfd; + my $subjobpid; + if (!($subjobpid = open($subjobfd, "$subjobcmd |"))) { + push @{$error_ref}, "Fork process to dispatch cmd $subjobcmd to $target_server failed: $!"; + $rst = 1; + last; + } + push(@{ $self->{subjobpids} }, $subjobpid); + push(@{ $self->{subjobfds} }, $subjobfd); + $self->{fdnodemap}->{$subjobfd} = $target_server; + } + + if (@{ $self->{subjobpids} }) + { + $self->{select}->add(\*$_) foreach (@{ $self->{subjobfds} }); + $| = 1; + + foreach (@{ $self->{subjobfds} }) { + $self->{subjobstates}->{$_} = 0; + } + } + + return $rst; +} + +sub read_reply { + my $self = shift; + my $reply_cache_ref = shift; + + %$reply_cache_ref = (); + + my @hdls; + while (!$self->{allsubjobdone} && !%$reply_cache_ref) { + if (@hdls = $self->{select}->can_read(0)) { + foreach my $hdl (@hdls) { + foreach my $fd (@{ $self->{subjobfds} }) { + if (!$self->{subjobstates}->{$_} && $hdl == \*$fd) { + if (eof($fd)) { + $self->{subjobstates}->{$fd} = 1; + } else { + my $line; + chomp($line = <$fd>); + + #print ">>>$line\n"; + $line = "mn:$line" if ($self->{fdnodemap}->{$fd} eq "mn"); + push @{ $reply_cache_ref->{ $self->{fdnodemap}->{$fd} } }, $line; + } + } + } + } + } + sleep 0.1; + + #check if all sub job have done + $self->{allsubjobdone} = 1; + $self->{allsubjobdone} &= $self->{subjobstates}->{$_} foreach (keys %{ $self->{subjobstates} }); + } + + if (%$reply_cache_ref) { + return 1; + } else { + return 0; + } +} + +sub destory { + my $self = shift; + my $error_ref = shift; + + my $rst = 0; + @$error_ref = (); + + close($_) foreach (@{ $self->{subjobfds} }); + + my %runningpid; + $runningpid{$_} = 1 foreach (@{ $self->{subjobpids} }); + my $existrunningpid = 0; + $existrunningpid = 1 if (%runningpid); + + my $try = 0; + while ($existrunningpid) { + + #send terminal signal to all running process at same time + #try INT 5 up to 5 times + if ($try < 5) { + foreach my $pid (keys %runningpid) { + kill 'INT', $pid if ($runningpid{$pid}); + } + + #try TERM 5 up to 5 times + } elsif ($try < 10) { + foreach my $pid (keys %runningpid) { + kill 'TERM', $pid if ($runningpid{$pid}); + } + + #try KILL 1 time + } else { + foreach my $pid (keys %runningpid) { + kill 'KILL', $pid if ($runningpid{$pid}); + } + } + ++$try; + + sleep 1; + + #To check how many process exit, set the flag of exited process to 0 + foreach my $pid (keys %runningpid) { + $runningpid{$pid} = 0 if (waitpid($pid, WNOHANG)); + } + + #To check if there are processes still running, if there are, try kill again in next loop + $existrunningpid = 0; + $existrunningpid |= $runningpid{$_} foreach (keys %runningpid); + + #just try 10 times, if still can't kill some process, give up + if ($try > 10) { + my $leftpid; + foreach my $pid (keys %runningpid) { + $leftpid .= "$pid " if ($runningpid{$pid}); + } + push @{$error_ref}, "Can't stop process $leftpid, please handle manually."; + $rst = 1; + last; + } + } + return $rst; +} + + + + +1; diff --git a/xCAT-probe/subcmds/code_template b/xCAT-probe/subcmds/code_template index a681e9649..91d7b7ff4 100755 --- a/xCAT-probe/subcmds/code_template +++ b/xCAT-probe/subcmds/code_template @@ -1,41 +1,21 @@ #!/usr/bin/perl # IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html -#-------------------------------------------------------- -#This is a template for developing a probe sub_command. -#This template mainly implement the sub_comamd dispatch in hierarchical structure -#Developer only need to focus on main probe job (by implement do_main_job function) and friendly output (by implement summary_all_jobs_output function) for user -#This template can also be used in flat structure. but if developer think it's too heavy in flat, it's fine to develop sub command directly. -#But in hierarchical structure, we strongly recommand using this template. -#The main dispatch policy are: -#1. if there isn't noderange input from commmand line. if there are service nodes defined in current MN, -# we dispatch exact same command input from STDIN to all SNs and current MN. if there isn't service nodes defined, -# just hanld command input from STDIN in current MN -#2. If there is noderange input from command line by opion "-n", we will dispatch the command input from STDIN to SN which can hanle these ndoes -# For example, if we got command from STDIN like "probecommand -n test[1-15] -V" and test[1-5] 's SN is SN1, test[6-10]'s SN is SN2 -# The dispatch result will be: -# For MN run: probecommand -n test[11-15] -V -# For SN1 run: probecommand -n test[1-5] -V -# For SN2 run: probecommand -n test[6-10] -V -#3. All the return message from SNs and MN will be saved in hash %summaryoutput, develper can use it while implement summary_all_jobs_output function -#-------------------------------------------------------- - - BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } use lib "$::XCATROOT/probe/lib/perl"; use probe_utils; -use xCAT::ServiceNodeUtils; +use hierarchy; use File::Basename; -use Getopt::Long qw(:config no_ignore_case); -use IO::Select; use Data::Dumper; +use Getopt::Long qw(:config no_ignore_case); -my $program_name = basename("$0"); #current sub_command name -my $help = 0; #command line attribute '-h', get usage information -my $test = 0; #command line attribute '-T' -my $verbose = 0; #command line attribute '-V' -my $noderange; #command line attribute '-n' + +my $help = 0; #command line attribute '-h', get usage information +my $test = 0; #command line attribute '-T' +my $hierarchy = 0; +my $verbose = 0; #command line attribute '-V' +my $noderange; #command line attribute '-n' my $output = "stdout"; #used by probe_utils->send_msg("$output", "o", "xxxxxxxxxx"); print output to STDOUT my $is_sn = 0; #flag current server is SN my $rst = 0; #the exit code of current command @@ -47,22 +27,19 @@ my $terminal = 0; #means get INT signal from STDIN # $summaryoutput{SN1} = @SN1_output_history my %summaryoutput; -#a map of SNs and command which will be dispatched to current SN -# one example: -# $dispatchcmd{SN1} = "probecommand -n test[1-5] -V" -# $dispatchcmd{SN2} = "probecommand -n test[6-10] -V" -my %dispatchcmd; +my $is_sn; +$is_sn = 1 if (-e "/etc/xCATSN"); -#save command line attributes from STDIN -my @tmpargv; - -#-------------------------------- +#------------------------------------- +# Usage +#------------------------------------- # below are some options rules used by default # -h : Get usage information of current sub command # -V : Output more information for debug # -T : To verify if $program_name can work, reserve option for probe framework, dosen't use by customer # -n : In xCAT probe, -n is uesd to specify node range uniformly -#-------------------------------- +#------------------------------------- +my $program_name = basename("$0"); #current sub_command name $::USAGE = "Usage: $program_name -h $program_name [-V] @@ -78,23 +55,19 @@ Options: #------------------------------------ # Please implement the main checking job of current command in do_main_job function -# If $outputtarget has input value, that means do_main_job is running on MN, so every message needed to print on STDOUT should be written into pipe $outputtarget. -# If $outputtarget has no value, that means do_main_job is running on SN, all message just need to print on STDOUT # Recommand to use probe_utils->send_msg() to handle message you plan to print out # A simple example has been written in funciton. #------------------------------------ sub do_main_job { - my $outputtarget = shift; - $outputtarget = "stdout" if (!$outputtarget); my $rst = 0; - probe_utils->send_msg($outputtarget, "o", "I reveive node range is $noderange"); + probe_utils->send_msg("$output", "o", "I reveive node range is $noderange"); #<#DO YOUR OWN CHECKING JOB1#> - probe_utils->send_msg($outputtarget, "o", "first checking point"); + probe_utils->send_msg("$output", "o", "first checking point"); #<#DO YOUR OWN CHECKING JOB2#> - probe_utils->send_msg($outputtarget, "f", "second checking point"); + probe_utils->send_msg("$output", "f", "second checking point"); return $rst; } @@ -112,94 +85,27 @@ sub summary_all_jobs_output { #DO SUMMARY DEPENDING ON YOUR SUB_COMMAND NEED probe_utils->send_msg("$output", "d", "======================do summary====================="); + + #print "summaryoutput:\n"; + #print Dumper \%summaryoutput; + foreach my $sn (keys %summaryoutput) { probe_utils->send_msg("$output", "d", "[$sn]"); foreach my $log (@{ $summaryoutput{$sn} }) { - probe_utils->send_msg("$output", "d", "$log"); + probe_utils->send_msg("$output", "d", "\t$log"); } } return $rst; } #------------------------------------- -# Each probe sub command is supposed to support hierarchical. -# This funtion is used to calclulate which SN should be dispatched which command +# main process #------------------------------------- -sub calculate_dispatch_cmd { - my @snlist = xCAT::ServiceNodeUtils->getAllSN(); - if ($noderange) { - my @nodes = `nodels $noderange 2>&1`; - - #if there is error in noderange - if ($?) { - my $error = join(" ", @nodes); - if ($error =~ /Error: Invalid nodes and\/or groups in noderange: (.+)/) { - probe_utils->send_msg("$output", "f", "There are invaild nodes ($1) in command line attribute node range"); - } else { - probe_utils->send_msg("$output", "f", "There is error in command line attribute node range, please using nodels to check"); - } - return 1; - } else { - - #calculate the mapping between SN and the nodes which belong to it. - chomp foreach (@nodes); - my $snnodemap = xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes, "xcat", "MN"); - - #print Dumper $snnodemap; - my %newsnnodemap; - foreach my $sn (keys %$snnodemap) { - if (grep(/^$sn$/, @snlist)) { # the node just belong to one SN - push(@{ $newsnnodemap{$sn} }, @{ $snnodemap->{$sn} }); - } elsif ($sn =~ /(\w+),.+/) { # the node belong to more than one SN, count it into first SN - if(grep(/^$1$/, @snlist)){ - push(@{ $newsnnodemap{$1} }, @{ $snnodemap->{$sn} }); - }else{ - probe_utils->send_msg("$output", "f", "The value $1 of 'servicenode' isn't a service node"); - } - } else { # the nodes don't belong to any SN will be handled by MN - push(@{ $newsnnodemap{mn} }, @{ $snnodemap->{$sn} }); - } - } - - #print Dumper \%newsnnodemap; - #generate new command for each SN, replace noderange - foreach my $sn (keys %newsnnodemap) { - my $nodes = join(",", @{ $newsnnodemap{$sn} }); - if ($sn eq "mn") { - $noderange = $nodes; - } else { - for (my $i = 0 ; $i <= $#tmpargv ; $i++) { - if ($tmpargv[$i] eq "-n") { - $tmpargv[ $i + 1 ] = $nodes; - last; - } - } - my $args = join(" ", @tmpargv); - $dispatchcmd{$sn} = "$::XCATROOT/probe/subcmds/$program_name $args 2>&1"; - } - } - } - } else { - - #there isn't noderange input from STDIN, dispatch command to all SN if there are SN defined in MN - if (@snlist) { - my $args = join(" ", @tmpargv); - my $sns = join(",", @snlist); - $dispatchcmd{$sns} = "$::XCATROOT/probe/subcmds/$program_name $args 2>&1" if (!$?); - } - } - return 0; -} - - - -#------------------------------------- -# main process start -#------------------------------------- -@tmpargv = @ARGV; +my @tmpargv = @ARGV; if ( !GetOptions("--help|h" => \$help, "T" => \$test, + "H" => \$hierarchy, "n=s" => \$noderange, "V" => \$verbose)) { @@ -227,177 +133,77 @@ $SIG{TERM} = $SIG{INT} = sub { $terminal = 1; }; -#-------------------------------------------- -# To confirm what current node is, MN or SN -#-------------------------------------------- -$is_sn = 1 if (-e "/etc/xCATSN"); - -#if this node is SN, just run job, not to do dispatch -if ($is_sn) { +#if it is called by hierarchy template, just run job, not to do dispatch +if ($hierarchy || $is_sn) { $rst = do_main_job(); exit $rst; } -#-------------------------------------------- -# calculate which command should be dispatched to which SN -#-------------------------------------------- -$rst = calculate_dispatch_cmd(); +my $hierarchy_instance = hierarchy->new(); -#print Dumper \%dispatchcmd; -#print "nodes left to mn : $noderange\n"; -#print "========================\n"; -exit $rst if ($rst); - -#-------------------------------------------- -# dispatch job to MN and SN -#-------------------------------------------- -my $mnjobpid = 0; -my @snsjobpids = (); -my @snsjobfds = (); -my $pipe_parent_read; -my $pipe_child_write; -pipe $pipe_parent_read, $pipe_child_write; -{ - #handle job in MN - $mnjobpid = fork(); - if (!defined($mnjobpid)) { - probe_utils->send_msg("$output", "f", "fork process to handle MN job failed: $!"); - $rst = 1; - last; - } elsif ($mnjobpid == 0) { - $SIG{TERM} = $SIG{INT} = sub { - exit 1; - }; - - close $pipe_parent_read; - $rst = do_main_job($pipe_child_write); - exit $rst; +#-------starting to dispatch_cmd-------- +my @error; +$rst = $hierarchy_instance->dispatch_cmd($noderange, \@tmpargv, \@error); +if ($rst) { + probe_utils->send_msg("$output", "f", "Calculate dispatch command failed"); + foreach (@error) { + probe_utils->send_msg("$output", "", "$_"); } - $SIG{CHLD} = sub { waitpid($mnjobpid, WNOHANG) }; - close $pipe_child_write; - - #handle job dispatch to SN - foreach my $sn (keys %dispatchcmd) { - my $snjobcmd = "xdsh $sn -s \"$dispatchcmd{$sn}\" 2>&1"; - - #print "$sn = $snjobcmd\n"; - my $snjobfd; - my $snjobpid; - if (!($snjobpid = open($snjobfd, "$snjobcmd |"))) { - probe_utils->send_msg("$output", "f", "fork process to dispatch cmd $snjobcmd to $sn failed: $!"); - next; - } - push(@snsjobpids, $snjobpid); - push(@snsjobfds, $snjobfd); + if ($hierarchy_instance->destory(\@error)) { + probe_utils->send_msg("$output", "", "$_") foreach (@error); } + exit $rst; +} - my $select = new IO::Select; - $select->add(\*$pipe_parent_read) if ($pipe_parent_read); - $select->add(\*$_) foreach (@snsjobfds); - $| = 1; +#----------start to read reply------- +my %reply_cache; +while ($hierarchy_instance->read_reply(\%reply_cache)) { + foreach my $servers (keys %reply_cache) { #Dispatch_cmd may use SN range to dispatch cms to SNs at one time + my @server_array = split(",", $servers); + foreach my $server (@server_array) { + foreach (@{ $reply_cache{$servers} }) { + my $msg = ""; + my $logmsg = ""; - my $line; - my %pipeisnonull; - $pipeisnonull{mn} = 1; - $pipeisnonull{$_} = 1 foreach (@snsjobfds); - my $onepipeisnonull = 1; - while ($onepipeisnonull) { - if (@hdls = $select->can_read(0)) { - foreach $hdl (@hdls) { - if ($pipeisnonull{mn} && $hdl == \*$pipe_parent_read) { - if (eof($pipe_parent_read)) { - $pipeisnonull{mn} = 0; - } else { - chomp($line = <$pipe_parent_read>); - print "$line\n"; - push @{ $summaryoutput{mn} }, $line; + #For cases like below: + #c910f02c04p04: [ok] :All xCAT deamons are running + if ($reply_cache{$servers}->[$_] =~ /^(\w+)\s*:\s*(\[\w+\]\s*):\s*(.*)/) { + if ("$1" eq "$server") { + $logmsg = "$2: $3"; + $msg = "$2:<$server>: $3"; } + + #For cases like below: + #c910f02c04p05: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! + } elsif ($reply_cache{$servers}->[$_] =~ /^(\w+)\s*:\s*(.*)/) { + if ("$1" eq "$server") { + $logmsg = "$2"; + $msg = "<$server>: $2"; + } + + #For cases like below: + #Unable to open socket connection to xcatd daemon on localhost:3001. } else { - foreach my $fd (@snsjobfds) { - if ($pipeisnonull{$fd} && $hdl == \*$fd) { - if (eof($fd)) { - $pipeisnonull{$fd} = 0; - } else { - chomp($line = <$fd>); - if ($line =~ /(Error:)\s+(\w+)\s+(.+)/i) { - push @{ $summaryoutput{$2} }, $line; - #if need to print to STDIN in real time, can make below line available - #print "[failed] :$2: $line\n"; - } elsif ($line =~ /^(\w+)\s*:\s(.*)/) { - push @{ $summaryoutput{$1} }, $2; - #if need to print to STDIN in real time, can make below lines available - #$line = "$2:$1: $3" if ($line =~ /^(\w+)\s*:\s*(\[\w+\]\s*):\s*(.*)/); - #print "$line\n"; - } - } - } + if (length($reply_cache{$servers}->[$_])) { + $logmsg = $reply_cache{$servers}->[$_]; + $msg = "[failed] :[$server]: $reply_cache{$servers}->[$_]"; } } + probe_utils->send_msg("$output", "", "$msg") if (length($msg)); + push @{ $summaryoutput{$server} }, $logmsg if (length($logmsg)); } - $onepipeisnonull = 0; - $onepipeisnonull |= $pipeisnonull{$_} foreach (keys %pipeisnonull); - } - last if ($terminal); - sleep 1; - } -} -close($pipe_child_write) if ($pipe_child_write); -close($pipe_parent_read) if ($pipe_parent_read); -close($_) foreach (@snsjobfds); - -#start to clear up all sub processes -my %runningpid; -$runningpid{$mnjobpid} = 1 if ($mnjobpid); -$runningpid{$_} = 1 foreach (@snsjobpids); -my $existrunningpid = 0; -$existrunningpid = 1 if (%runningpid); - -my $trytime = 0; -while ($existrunningpid) { - - #send terminal signal to all running process at same time - #try INT 5 up to 5 times - if ($try < 5) { - foreach my $pid (keys %runningpid) { - kill 'INT', $pid if ($runningpid{$pid}); - } - - #try TERM 5 up to 5 times - } elsif ($try < 10) { - foreach my $pid (keys %runningpid) { - kill 'TERM', $pid if ($runningpid{$pid}); - } - - #try KILL 1 time - } else { - foreach my $pid (keys %runningpid) { - kill 'KILL', $pid if ($runningpid{$pid}); } } - ++$try; - - sleep 1; - - #To check how many process exit, set the flag of exited process to 0 - foreach my $pid (keys %runningpid) { - $runningpid{$pid} = 0 if (waitpid($pid, WNOHANG)); - } - - #To check if there are processes still running, if there are, try kill again in next loop - $existrunningpid = 0; - $existrunningpid |= $runningpid{$_} foreach (keys %runningpid); - - #just try 10 times, if still can't kill some process, give up - if ($try > 10) { - my $leftpid; - foreach my $pid (keys %runningpid) { - $leftpid .= "$pid " if ($runningpid{$pid}); - } - print "Can't stop process $leftpid, please handle manually.\n"; + if ($terminal) { last; } } +#----------hierarchy_instance->destory----------- +if ($hierarchy_instance->destory(\@error)) { + probe_utils->send_msg("$output", "", "$_") foreach (@error); +} + #------------------------------------- # summary all jobs output to display #------------------------------------- @@ -408,3 +214,5 @@ exit $rst; + + From a819f670bcb31561316a87fc09f03e5b26852a74 Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 2 Nov 2016 04:46:53 -0400 Subject: [PATCH 23/43] add replay function for discovery --- xCAT-probe/subcmds/discovery | 66 +++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index 73876fd1f..a798bd8d0 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -78,7 +78,7 @@ if ( "m=s" => \$discovery_type, "n=s" => \$noderange, "t=s" => \$maxwaittime, -# "r=s" => \$rollforward_time_of_replay, + "r=s" => \$rollforward_time_of_replay, "i=s" => \$nics)) #option i is a reservation option, dosen't show up in usage now { probe_utils->send_msg("stdout", "f", "Invalid parameter for $program_name"); @@ -424,7 +424,7 @@ sub do_pre_check { probe_utils->send_msg("stdout", "d", "$_") foreach (@errors); } } else { - $msg = "Attribute 'master' in 'site' table is configured well"; + $msg = "Attribute 'master' in 'site' table is configured"; my $masteripinsite = `tabdump site | awk -F',' '/^"master",/ { gsub(/"/, "", \$2) ; print \$2 }'`; chomp($masteripinsite); if ($masteripinsite eq "") { @@ -694,7 +694,7 @@ sub check_genesis_file { sub dhcp_dynamic_range_check { my $nets = shift; my $rst = 0; - my $msg = "DHCP dynamic range is configured well"; + my $msg = "DHCP dynamic range is configured"; my $dhcpconfig; if (-e "/etc/dhcp/dhcpd.conf") { @@ -756,12 +756,18 @@ sub dhcp_dynamic_range_check { $tftpdir = "/tftpboot"; } + my @errors = (); my %node_ip; if ($noderange) { %node_ip = get_node_ip(); + foreach my $node (keys %node_ip) { + if ($node_ip{$node}{"error"}) { + push @errors, $node_ip{$node}{"error"}; + $rst = 1; + } + } } - my @errors = (); foreach my $net (@$nets) { if (!exists($subnet_hash{$net})) { push @errors, "The net $net is not matched."; @@ -772,11 +778,12 @@ sub dhcp_dynamic_range_check { if ($subnet_hash{$net} ne "unknown") { if (%node_ip) { foreach my $node (keys %node_ip) { + next if ($node_ip{$node}{"error"}); foreach my $dr (@{ $subnet_hash{$net} }) { my @dr_ip = split(/-/, $dr); - if (compare_ip_value($dr_ip[0], $node_ip{$node}) and compare_ip_value($node_ip{$node}, $dr_ip[1])) { - push @errors, "$node ip $node_ip{$node} is conflicting with dynamic range."; + if (compare_ip_value($dr_ip[0], $node_ip{$node}{"ip"}) and compare_ip_value($node_ip{$node}{"ip"}, $dr_ip[1])) { + push @errors, "$node ip $node_ip{$node}{\"ip\"} is conflicting with dynamic range."; $rst = 1; next; } @@ -817,33 +824,28 @@ sub dhcp_dynamic_range_check { sub get_node_ip { my $ip_net; my @node_info = `lsdef $noderange -i ip -c 2>&1`; - my %nodeip; - my %nodecheckrst; + my %nodeipcheck = (); foreach (@node_info) { chomp($_); $_ =~ s/^\s+|\s+$//g; - if ($_ =~ /^Error: Could not find an object named '(\w+)' .+/i) { - $nodecheckrst{$1}{"error"} = "Could not find node definition"; - $rst = 1; - } elsif ($_ =~ /^(\w+): ip=(.*)/i) { - $nodeip{$1} = $2; + if ($_ =~ /^Error: Could not find an object named '(.+)' of type .+/i) { + $nodeipcheck{$1}{"error"} = "Could not find node definition"; + } elsif ($_ =~ /^(.+): ip=(.*)/i) { + $nodeipcheck{$1}{"ip"} = $2; } } - foreach my $node (keys %nodeip) { + foreach my $node (keys %nodeipcheck) { $ip_net = xCAT::NetworkUtils->getipaddr($node); - if ($nodeip{$node} and ($nodeip{$node} ne $ip_net)) { - probe_utils->send_msg("stdout", "d", "IP $nodeip{$node} definition for $node is not correct") if ($verbose); + if ($nodeipcheck{$node}{"ip"} and $ip_net and ($nodeipcheck{$node}{"ip"} ne $ip_net)) { + $nodeipcheck{$node}{"error"} = "IP $nodeipcheck{$node}{\"ip\"} definition for $node is not correct"; + $nodeipcheck{$node}{"ip"} = $ip_net; } - $nodeip{$node} = $ip_net; + $nodeipcheck{$node}{"error"} = "IP for $node is not on any network this server attached, please run 'makehosts' and 'makedns -n'." unless (xCAT::NetworkUtils->nodeonmynet($node)); } - foreach my $node (keys %nodecheckrst) { - probe_utils->send_msg("stdout", "d", "$node : $nodecheckrst{$node}{error}") if (exists($nodecheckrst{$node}{error})); - } - - return %nodeip; + return %nodeipcheck; } sub compare_ip_value { @@ -1174,17 +1176,17 @@ sub handle_dhcp_msg { my $nic = $2; if ($3 =~ /no free leases/) { - probe_utils->send_msg("stdout", "d", "[$mac] Receive DHCPDISCOVER from $mac via $nic, no free leases") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$mac] Received DHCPDISCOVER from $mac via $nic, no free leases") if ($monitor); return 0; } - my $record = "Receive DHCPDISCOVER from $mac via $nic"; + my $record = "Received DHCPDISCOVER from $mac via $nic"; probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); } elsif ($log_ref->{msg} =~ /DHCPOFFER\s+on\s+(.+)\s+to\s+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w).+via\s+(.+)/i) { my $ip = $1; my $mac = $2; my $nic = $3; - my $record = "Send DHCPOFFER on $ip back to $mac via $nic"; + my $record = "Sent DHCPOFFER on $ip back to $mac via $nic"; probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); @@ -1192,7 +1194,7 @@ sub handle_dhcp_msg { my $ip = $1; my $mac = $2; my $nic = $3; - my $record = "Receive DHCPREQUEST from $mac for $ip via $nic"; + my $record = "Received DHCPREQUEST from $mac for $ip via $nic"; probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); @@ -1200,7 +1202,7 @@ sub handle_dhcp_msg { my $ip = $1; my $mac = $2; my $nic = $3; - my $record = "Send DHCPACK on $ip back to $mac via $nic"; + my $record = "Sent DHCPACK on $ip back to $mac via $nic"; probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); @@ -1211,17 +1213,17 @@ sub handle_dhcp_msg { my $mac = $1; my $nic = $2; if ($3 =~ /no dynamic leases/) { - probe_utils->send_msg("stdout", "d", "Receive DHCPDISCOVER from $mac via $nic, no free leases") if ($monitor); + probe_utils->send_msg("stdout", "d", "Received DHCPDISCOVER from $mac via $nic, no free leases") if ($monitor); return 0; } - my $record = "Receive BOOTREQUEST from $mac via $nic"; + my $record = "Received BOOTREQUEST from $mac via $nic"; probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); } elsif ($log_ref->{msg} =~ /BOOTREPLY\s+for\s+(.+)\s+to\s+.+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w).+via\s+(.+)/) { my $ip = $1; my $mac = $2; my $nic = $3; - my $record = "Send BOOTREPLY on $ip back to $mac via $nic"; + my $record = "Sent BOOTREPLY on $ip back to $mac via $nic"; probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); @@ -1520,7 +1522,7 @@ sub conclusion_report { } } elsif ($node_state_ref->{$identify}{type} eq "mac") { foreach (@{ $node_state_ref->{$identify}{statehistory} }) { - $stop_stage = $_ if ($stop_stage < $_); + $stop_stage = $_ if ($stop_stage < $_); } if ($stop_stage != $::STATE_DISCOVER_COMPLETED) { $failed_mac{$identify}{stop_point} = $stop_stage; @@ -1532,7 +1534,7 @@ sub conclusion_report { my $success_node_num = @success_node; my $failed_node_num = @failed_node; my $failed_nodes = join(",", @failed_node); - probe_utils->send_msg("stdout", "", "Discover $success_node_num node(s) successfully, $failed_node_num node(s) failed."); + probe_utils->send_msg("stdout", "", "Discovered $success_node_num node(s) successfully, $failed_node_num node(s) failed."); probe_utils->send_msg("stdout", "", "Unmatched node(s):"); probe_utils->send_msg("stdout", "", "$failed_nodes"); From 6e891d066d03b8420c243b035e1fbc6f90e25bac Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 2 Nov 2016 05:19:50 -0400 Subject: [PATCH 24/43] Refine probe tool 'xcatmn' --- xCAT-probe/subcmds/xcatmn | 1619 ++++++++++++++++++------------------- 1 file changed, 777 insertions(+), 842 deletions(-) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index 6890bfc8f..f09e111b9 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -5,45 +5,43 @@ BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/o use lib "$::XCATROOT/probe/lib/perl"; use probe_utils; +use hierarchy; use xCAT::ServiceNodeUtils; use xCAT::NetworkUtils; use File::Basename; -use Getopt::Long qw(:config no_ignore_case); -use IO::Select; use Data::Dumper; +use Getopt::Long qw(:config no_ignore_case); -my $program_name = basename("$0"); #current sub_command name my $help = 0; #command line attribute '-h', get usage information my $test = 0; #command line attribute '-T' +my $hierarchy = 0; my $verbose = 0; #command line attribute '-V' my $noderange; #command line attribute '-n' -my $installnic; my $output = "stdout"; #used by probe_utils->send_msg("$output", "o", "xxxxxxxxxx"); print output to STDOUT -my $is_sn = 0; #flag current server is SN my $rst = 0; #the exit code of current command my $terminal = 0; #means get INT signal from STDIN -my %summaryoutput; #save all output from commands running on SNs and MN +my $installnic; -#a map of SNs and command which will be dispatched to current SN -# $dispatchcmd{snname} = "command" -my %dispatchcmd; +#save all output from commands running on SNs and MN +# one example: +# $summaryoutput{mn} = @mn_output_history +# $summaryoutput{SN1} = @SN1_output_history +my %summaryoutput; -#save command line attributes from STDIN -my @tmpargv; +my $is_sn; +$is_sn = 1 if (-e "/etc/xCATSN"); -#-------------------------------- -# below are some options rules used by default -# -h : Get usage information of current sub command -# -V : Output more information for debug -# -T : To verify if $program_name can work, reserved option for probe framework, not for use by customer -# -n : In xCAT probe, -n is used to specify node range uniformly -#-------------------------------- + +#------------------------------------- +# Usage +#------------------------------------- +my $program_name = basename("$0"); #current sub_command name $::USAGE = "Usage: $program_name -h - $program_name [-i ] [-V] + $program_name -i [-V] Description: - After xcat installation, use this command to check if xcat has been installed correctly and is ready for use. + After xCAT installation, use this command to check if xCAT has been installed correctly and is ready for use. For hierarchical cluster, only the provision network on the same network as the management node is supported. If in the different network, ignore the results. Options: @@ -52,626 +50,142 @@ Options: -i : Required. Specify the network interface name of provision network on management node "; - -sub returncmdoutput { - my $rst = shift; - chomp($rst); - my $outputtarget = shift; - my @lines = split("[\n\r]", $rst); - foreach my $line (@lines) { - probe_utils->send_msg("$outputtarget", "d", "$line"); - } -} - -#------------------------------------- -# TWO FUNCTIONS MUST BE IMPLEMENTED BY EACH SUB COMMAND -# They are do_main_job and summary_all_jobs_output -#------------------------------------- - -#------------------------------------ -# Please implement the main checking job of current command in do_main_job function -# If $outputtarget has input value, that means do_main_job is running on MN, so every message needed to print on STDOUT should be written into pipe $outputtarget. -# If $outputtarget has no value, that means do_main_job is running on SN, all message just need to print on STDOUT -# Recommand to use probe_utils->send_msg() to handle message you plan to print out -#------------------------------------ sub do_main_job { - my $outputtarget = shift; - $outputtarget = "stdout" if (!$outputtarget); my $rst = 0; + my @error = (); + my $checkpoint; + my $rc = 0; + my $installnicip; - my $msg; - my $serverip; + #check if all xcat deamons are running + $checkpoint = "All xCAT deamons are running"; + $rst = check_all_xcat_deamons(\@error); + print_check_result($checkpoint, "f", $rst, \@error); + return $rst if($rst); - $msg = "Sub process 'xcatd: SSL listener' is running"; - my $xcatdproc = `ps aux|grep -v grep|grep xcatd`; - chomp($xcatdproc); - if ($xcatdproc =~ /xcatd: SSL listener/) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; + #check if xcatd can receive request + $checkpoint = "xcatd can receive command request"; + $rst = check_xcatd_receive_request(\@error); + print_check_result($checkpoint, "f", $rst, \@error); + return $rst if($rst); + + #check 'site' table configuratiions + my %sitetable; + $checkpoint = "'site' table is configured correctly"; + $rst = check_site_table(\%sitetable,\@error); + print_check_result($checkpoint, "f", $rst, \@error); + return $rst if($rst); + + #check network configuratiions + $checkpoint = "Provision network is configured correctly"; + $rst = check_network(\%sitetable,\$installnicip,\@error); + print_check_result($checkpoint, "f", $rst, \@error); + return $rst if($rst); + + #check 'passwd' table configuratiions + $checkpoint = "'passwd' table is configured correctly"; + $rst = check_passwd_table(\@error); + print_check_result($checkpoint, "f", $rst, \@error); + $rc |= $rst; + + #check important directory + $checkpoint = "Important directory is configured correctly"; + $rst = check_directory(\%sitetable,\@error); + print_check_result($checkpoint, "f", $rst, \@error); + $rc |= $rst; + + #check if SElinux is disabled + $checkpoint = "SELinux is disabled on current server"; + $rst = check_selinux(\@error); + print_check_result($checkpoint, "f", $rst, \@error); + $rc |= $rst; + + #check http service + $checkpoint = "HTTP service works well"; + $rst = check_http_service($installnicip, \@error); + print_check_result($checkpoint, "f", $rst, \@error); + $rc |= $rst; + + #check tftp service + $checkpoint = "TFTP service works well"; + $rst = check_tftp_service($installnicip,\@error); + print_check_result($checkpoint, "f", $rst, \@error); + $rc |= $rst; + + #check DNS service + $checkpoint = "DNS service works well"; + $rst = check_dns_service(\%sitetable, $installnicip,\@error); + print_check_result($checkpoint, "f", $rst, \@error); + $rc |= $rst; + + #check DHCP service + $checkpoint = "DHCP service works well"; + $rst = check_dhcp_service($installnicip, \@error); + print_check_result($checkpoint, "f", $rst, \@error); + $rc |= $rst; + + #Below are the 'warning` level check points + + #check if firewall is close + $checkpoint = "Firewall is closed on current server"; + $rst = check_firewall(\@error); + print_check_result($checkpoint, "w", $rst, \@error); + $rc |= $rst; + + #check disk space + $checkpoint = "The disk space is enough for xCAT to work"; + $rst = check_disk(\@error); + print_check_result($checkpoint, "w", $rst, \@error); + $rc |= $rst; + + + #some sepecific check points in MN + if(! $is_sn){ + #check if server ip is a static ip in MN + $checkpoint = "The IP of master is a static IP address"; + $rst = check_server_ip_static($installnicip,\@error); + print_check_result($checkpoint, "w", $rst, \@error); + $rc |= $rst; + + #check if dhcpd.leases is less than 100M + $checkpoint = "The dhcpd.leases file is less than 100M"; + $rst = check_dhcp_leases(\@error); + print_check_result($checkpoint, "w", $rst, \@error); + $rc |= $rst; } - $msg = "Sub process 'xcatd: DB Access' is running"; - if ($xcatdproc =~ /xcatd: DB Access/) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - - $msg = "Sub process 'xcatd: UDP listener' is running"; - if ($xcatdproc =~ /xcatd: UDP listener/) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - - $msg = "Sub process 'xcatd: install monitor' is running"; - if ($xcatdproc =~ /xcatd: install monitor/) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - - $msg = "Sub process 'xcatd: Discovery worker' is running"; - if ($xcatdproc =~ /xcatd: Discovery worker/) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - - $msg = "Sub process 'xcatd: Command log writer' is running"; - if ($xcatdproc =~ /xcatd: Command log writer/) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "w", "Sub process 'xcatd: Command log writer' isn't running"); - } - return 1 if ($rst); - - my $xcatdport = `lsdef -t site -i xcatdport -c | awk -F'=' '{print \$2}'`; - chomp($xcatdport); - probe_utils->send_msg($outputtarget, "d", "The port used by the xcatd daemon for client/server communication is $xcatdport") if ($verbose); - $msg = "xcatd is listening on port $xcatdport"; - my $cmdoutput = `netstat -ant|grep LISTEN|grep $xcatdport`; - if ($?) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - - my $xcatiport = `lsdef -t site -i xcatiport -c | awk -F'=' '{print \$2}'`; - chomp($xcatiport); - probe_utils->send_msg($outputtarget, "d", "The port used by xcatd to receive install status updates from nodes is $xcatiport") if ($verbose); - $msg = "xcatd is listening on port $xcatiport"; - $cmdoutput = `netstat -antp | grep -i xcatd|grep LISTEN|grep $xcatiport`; - if ($?) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - return 1 if ($rst); - - $msg = "'lsxcatd -a' works"; - $cmdoutput = `lsxcatd -a 2>&1`; - $rst = $?; - returncmdoutput($cmdoutput, $outputtarget) if ($verbose); - if ($rst) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - return $rst; - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - - my $masteripinsite = `lsdef -t site -i master -c | awk -F'=' '{print \$2}'`; - chomp($masteripinsite); - probe_utils->send_msg($outputtarget, "d", "The value of 'master' in 'site' table is $masteripinsite") if ($verbose); - probe_utils->send_msg($outputtarget, "f", "There isn't 'master' definition in 'site' table") if ($masteripinsite eq ""); - - $msg = "The value of 'master' in 'site' table is an IP address"; - if (probe_utils->is_ip_addr("$masteripinsite")) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - return 1; - } - - if (!$is_sn) { - - # on MN, check the validity of installnic and get ip address of the NIC - $msg = "NIC $installnic exists on current server"; - my $nics = `ip addr show $installnic >/dev/null 2>&1`; - if ($?) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - probe_utils->send_msg($outputtarget, "d", "Use 'ip addr show' to check if there is NIC named $installnic on current server"); - return 1; - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - - $msg = "Get IP address of NIC $installnic"; - $serverip = `ip addr show $installnic | awk -F" " '/inet / {print \$2}'|awk -F"/" '{print \$1}'`; - chomp($serverip); - if (!defined($serverip) || ($serverip eq "")) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - probe_utils->send_msg($outputtarget, "d", "Use 'ip addr show' to check if there is IP assigned to $installnic"); - return 1; - } else { - probe_utils->send_msg($outputtarget, "d", "The IP of NIC $installnic is $serverip") if ($verbose); - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - - if ($serverip) { - $msg = "The IP $serverip of $installnic equals the value of 'master' in 'site' table"; - if ($serverip eq $masteripinsite) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - } - - $msg = "IP $serverip of NIC $installnic is a static IP on current server"; - if (probe_utils->is_static_ip("$serverip", "$installnic")) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "w", "IP $serverip of $installnic is not a static IP on current server"); - } - } else { - - # on SN, get ip address by compare 'master' attribute in 'site' table - # choose the one in the same network with 'master' - my @ipoutput = `ip addr show | grep inet | grep -v inet6 2>&1`; - - foreach (@ipoutput) { - if ($_ =~ /inet\s+(.+)\/(.+)\s+brd\s+(.+)\s+scope global/i) { - if (xCAT::NetworkUtils::isInSameSubnet($masteripinsite, $1, $2, 1)) { - $serverip = $1; - } - } - } - - $msg = "Get IP address that on the same network as master $masteripinsite"; - if (!defined($serverip) || ($serverip eq "")) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - return 1; - } else { - probe_utils->send_msg($outputtarget, "d", "The IP is $serverip") if ($verbose); - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - } - - $msg = "$serverip belongs to one of networks defined in 'networks' table"; - my $networks = `tabdump networks|grep -v "^#"`; - $networks =~ s/\"//g; - my $netcnt = `echo "$networks"|wc -l`; - my $hit = 0; - for (my $i = 1 ; $i < $netcnt + 1 ; $i++) { - my $line = `echo "$networks" |sed -n ${i}p |awk -F"," '{print \$2,\$3,\$4}'`; - chomp($line); - if ($line =~ /(.+) (.+) (.+)/) { - if (!$is_sn) { - $hit = 1 if (probe_utils->is_ip_belong_to_net("$1", "$2", $serverip) && ("$3" eq "$installnic")); - } else { - $hit = 1 if (probe_utils->is_ip_belong_to_net("$1", "$2", $serverip)); - } - } - } - if ($hit) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - - $msg = "There is domain definition in 'site' table"; - my $domain = `lsdef -t site -i domain -c | awk -F'=' '{print \$2}'`; - chomp($domain); - if ($domain) { - probe_utils->send_msg($outputtarget, "d", "The value of 'domain' in 'site' table is $domain") if ($verbose); - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - - $msg = "There is a configuration in 'passwd' table for 'system' for node provisioning"; - my $passwd = `tabdump passwd |awk -F',' '/system/ { gsub(/"/, "", \$2); gsub(/"/, "", \$3); print \$2,\$3 }'`; - chomp($passwd); - my ($username, $pw) = split(" ", $passwd); - if ($username eq "" || $pw eq "") { - probe_utils->send_msg($outputtarget, "f", "$msg"); - probe_utils->send_msg($outputtarget, "d", "Define username and password for 'system' in 'passwd' table"); - $rst = 1; - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - - my $installdir = `lsdef -t site -i installdir -c | awk -F'=' '{print \$2}'`; - chomp($installdir); - probe_utils->send_msg($outputtarget, "d", "The 'install' directory is set to $installdir in 'site' table on current server") if ($verbose); - my $tftpdir = `lsdef -t site -i tftpdir -c | awk -F'=' '{print \$2}'`; - chomp($tftpdir); - probe_utils->send_msg($outputtarget, "d", "The 'tftp' directory is set to $tftpdir in 'site' table on current server") if ($verbose); - - $msg = "There is $installdir directory on current server"; - if (-e "$installdir/postscripts/") { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - - if ($is_sn) { - my $mountoutput = `mount | grep '$installdir'`; - chomp($mountoutput); - - my $mountip; - if ($mountoutput =~ /(.+):$installdir on $installdir /) { - my $mountsource = $1; - if (xCAT::NetworkUtils->isIpaddr($mountsource)) { - $mountip = $mountsource; - } else { - $mountip = xCAT::NetworkUtils->getipaddr($mountsource); - } - } - - $msg = "installdir $installdir is mounted from the management node"; - if ($mountip eq $masteripinsite) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - } - - $msg = "There is $tftpdir directory on current server"; - if (-e "$tftpdir") { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - - if ($is_sn) { - my $mountoutput = `mount | grep '$tftpdir'`; - chomp($mountoutput); - - my $mountip; - if ($mountoutput =~ /(.+):$tftpdir on $tftpdir /) { - my $mountsource = $1; - if (xCAT::NetworkUtils->isIpaddr($mountsource)) { - $mountip = $mountsource; - } else { - $mountip = xCAT::NetworkUtils->getipaddr($mountsource); - } - } - - $msg = "tftpdir $tftpdir is mounted from the management node"; - if ($mountip eq $masteripinsite) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - } - - #check the free space of specific directory - #if "/var" is mounted on standalone disk, more than 1G free space is expected - #if "/tmp" is mounted on standalone disk, more than 1G free space is expected - #if installdir is mounted on standalone disk, more than 10G free space is expected. - #if any one of above three directories hasn't standalone disk, "/" directory should cover its space requirement. - my @dir_expectedspace_list = (["/var", "1"], ["/tmp", "1"], ["$installdir", "10"], ["/" , "0"]); - foreach my $dir (@dir_expectedspace_list){ - next if($dir->[0] eq "/" && $dir->[1] == 0); - my $checkrst = probe_utils->is_dir_has_enough_space($dir->[0], $dir->[1]); - if($checkrst == 2){ - $dir_expectedspace_list[$#dir_expectedspace_list][1] += $dir->[1]; - }elsif($checkrst == 1){ - probe_utils->send_msg($outputtarget, "o", "The free space of '$dir->[0]' directory is more than $dir->[1] G"); - }elsif($checkrst == 0){ - probe_utils->send_msg($outputtarget, "w", "The free space of '$dir->[0]' is less than $dir->[1] G"); - } - - } - - $msg = "SELinux is disabled on current server"; - if (probe_utils->is_selinux_enable()) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - - $msg = "Firewall is closed on current server"; - if (probe_utils->is_firewall_open()) { - probe_utils->send_msg($outputtarget, "w", "Firewall is configured on current server"); - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - - `which wget > /dev/null 2>&1`; - if ($?) { - probe_utils->send_msg($outputtarget, "w", "'wget' tool isn't installed, skip checking HTTP service. Install 'wget' then try again"); - } else { - $msg = "HTTP service is ready on $serverip"; - if (probe_utils->is_http_ready("$serverip")) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - } - - my $nodename = `hostname -s`; - chomp($nodename); - - # For sn, 'setuptftp' attribute could be set to '0' or '1'. - # if '0', sn does not need to provie TFTP service, will not check it - my $checktftp = 1; - if ($is_sn) { - $checktftp = `lsdef $nodename -i setuptftp -c | awk -F'=' '{print \$2}'`; - chomp($checktftp); - unless ($checktftp) { - probe_utils->send_msg($outputtarget, "d", "SN $nodename is not set to provide TFTP service"); - } - } - if ($checktftp) { - `which tftp > /dev/null 2>&1`; - if ($?) { - probe_utils->send_msg($outputtarget, "w", "'tftp' tool isn't installed, skip checking tftp service. Install 'tftp' then try again"); - } else { - $msg = "TFTP service is ready on $serverip"; - if (probe_utils->is_tftp_ready("$serverip")) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - } - } - - # For sn, 'setupdns' attribute could be set to '0' or '1'. - # if '0', sn does not need to provie DNS service, will not check it - my $checkdns = 1; - if ($is_sn) { - $checkdns = `lsdef $nodename -i setupnameserver -c | awk -F'=' '{print \$2}'`; - chomp($checkdns); - unless ($checkdns) { - probe_utils->send_msg($outputtarget, "d", "SN $nodename is not set to provide DNS service"); - } - } - - if ($checkdns) { - `which nslookup > /dev/null 2>&1`; - if ($?) { - probe_utils->send_msg($outputtarget, "w", "'nslookup' tool isn't installed, skip checking DNS service. Install 'nslookup' then try again"); - } else { - $msg = "DNS server is ready on $serverip"; - probe_utils->send_msg($outputtarget, "d", "Domain used to check DNS is $domain") if ($verbose); - - my $rc = 0; - if (!$is_sn) { - - # if this is a hierarchical cluster, nslookup one of sn to check DNS service - my @snlist = xCAT::ServiceNodeUtils->getAllSN(); - my $sntmp = shift(@snlist); - if ($sntmp) { - my $sninfo = `cat /etc/hosts | grep $sntmp`; - if ($sninfo =~ /(\d+).(\d+).(\d+).(\d+)/) { - my $snip = "$1.$2.$3.$4"; - if (!probe_utils->is_dns_ready("$snip", "$serverip", "$sntmp", "$domain")) { - probe_utils->send_msg("$outputtarget", "d", "nslookup $sntmp $snip failed") if($verbose); - $rc = 1; - } - } - } else { - - # if there is no sn, nslookup mnip - my $nslkp = `nslookup $serverip $serverip 2>&1`; - chomp($nslkp); - my $tmp = grep {$_ =~ "Server:[\t\s]*$serverip"} split (/\n/, $nslkp); - if (!$tmp) { - probe_utils->send_msg($outputtarget, "d", "nslookup $serverip $serverip failed") if($verbose); - $rc = 1; - } - } - if ($rc) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - } else { - - # on sn, nslookup it's ip to check DNS service - if (!probe_utils->is_dns_ready("$serverip", "$masteripinsite", "$nodename", "$domain")) { - probe_utils->send_msg($outputtarget, "d", "nslookup $serverip failed"); - probe_utils->send_msg($outputtarget, "f", "$msg"); - } - else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - } - } - } - - # For sn, 'setupdhcp' attribute could be set to '0' or '1'. - # if '0', sn does not need to provie DHCP service, will not check it - my $checkdhcp = 1; - my $rc = 0; - if ($is_sn) { - $checkdhcp = `lsdef $nodename -i setupdhcp -c | awk -F'=' '{print \$2}'`; - chomp($checkdhcp); - if ($checkdhcp) { - - # on sn, just check dhcpd service whether running - $msg = "DHCP service is ready on $serverip"; - my $dhcpoutput = `ps aux | grep dhcpd |grep -v grep`; - if ($dhcpoutput) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - } - } else { - probe_utils->send_msg($outputtarget, "d", "SN $nodename is not set to provide DHCP service"); - } - } else { - my $leasefile = ""; - if (-e "/var/lib/dhcpd/dhcpd.leases") { - $leasefile = "/var/lib/dhcpd/dhcpd.leases"; - } elsif (-e "/var/lib/dhcp/db/dhcpd.leases") { - $leasefile = "/var/lib/dhcp/db/dhcpd.leases"; - } elsif (-e "/var/lib/dhcp/dhcpd.leases") { - $leasefile = "/var/lib/dhcp/dhcpd.leases"; - } - - $msg = "The size of $leasefile is less than 100M"; - my $filesizetmp = `du -sb $leasefile`; - if ($?) { - returncmdoutput($filesizetmp) if ($verbose); - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } else { - chomp($filesizetmp); - my ($size, $file) = split(" ", $filesizetmp); - probe_utils->send_msg($outputtarget, "d", "The size of $leasefile is $size byte") if ($verbose); - if ($size > 104857600) { - probe_utils->send_msg($outputtarget, "w", "The size of $leasefile is more than 100M"); - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - } - - my $rc = 0; - my $msg = "DHCP service is ready on $serverip"; - - { #very important brace to create a block - my @snlist = xCAT::ServiceNodeUtils->getAllSN(); - my $sntmp = shift(@snlist); - if ($sntmp) { - my $tmp = `makedhcp -q $sntmp`; - if ($?) { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "makedhcp -q $sntmp failed") if ($verbose); - $rc = 1; - last; - } - chomp($tmp); - my $snip = xCAT::NetworkUtils->getipaddr($sntmp); - my $snmac = `lsdef $sntmp -i mac -c | awk -F'=' '{print \$2}'`; - chomp ($snmac); - my $tmpmac; - if ($tmp =~ /$sntmp: ip-address = $snip, hardware-address = (.+)/) { - $tmpmac = $1; - if ($tmpmac !~ $snmac) { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "DHCP server reply is wrong") if ($verbose); - $rc = 1; - } - } else { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "DHCP server reply is wrong") if ($verbose); - $rc = 1; - } - } else { - - my $tmp = `chdef xcatmntest groups=all ip=$serverip mac=aa:aa:aa:aa:aa:aa`; - if ($?) { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "Node simulation by 'chdef' has failed") if ($verbose); - $rc = 1; - last; - } else { - probe_utils->send_msg($outputtarget, "d", "Simulate a node xcatmntest to do dhcp test") if ($verbose); - } - - `cp /etc/hosts /etc/hosts.bak.probe > /dev/null 2>&1`; - - open HOSTFILE, ">> /etc/hosts"; - print HOSTFILE "$serverip xcatmntest xcatmntest.$domain"; - close HOSTFILE; - - probe_utils->send_msg($outputtarget, "d", "To do 'makedhcp xcatmntest'") if ($verbose); - $tmp = `makedhcp xcatmntest 2>&1`; - if ($?) { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "makedhcp xcatmntest failed") if ($verbose); - $rc = 1; - `rmdef xcatmntest`; - last; - } - - probe_utils->send_msg($outputtarget, "d", "To do 'makedhcp -q xcatmntest'") if ($verbose); - $tmp = `makedhcp -q xcatmntest`; - if ($?) { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "makedhcp -q xcatmntest failed") if ($verbose); - $rc = 1; - `makedhcp -d xcatmntest && rmdef xcatmntest`; - last; - } - chomp($tmp); - if ($tmp !~ /xcatmntest: ip-address = $serverip, hardware-address = aa:aa:aa:aa:aa:aa/) { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "DHCP server reply is wrong") if ($verbose); - $rc = 1; - `makedhcp -d xcatmntest && rmdef xcatmntest`; - last; - } - - probe_utils->send_msg($outputtarget, "d", "Start clearing simulation information for dhcp test") if ($verbose); - $tmp = `makedhcp -d xcatmntest && rmdef xcatmntest`; - returncmdoutput($tmp, $outputtarget) if ($verbose); - - `rm /etc/hosts`; - `mv /etc/hosts.bak.probe /etc/hosts`; - } - } - if ($rc) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - probe_utils->send_msg($outputtarget, "d", "Run 'makedhcp -n' if it has not been ran before."); - $rst = 1; - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - } - - - return $rst; + return $rc; } -#------------------------------------- -# When this command return from all SNs and MN, you need to generate a summary -# All history outpout from SNs and MN are saved in globle hash %summaryoutput. -# $summaryoutput{mn} = @mnhistory -# $summaryoutput{snname1} = @snname1history; -# The entry in each histroy array isn't categorized, the message coming early is arranged before the one coming later. -# A simple example of how to dump %summaryoutput has been written in function -#------------------------------------- sub summary_all_jobs_output { + my $rst = 0; if ($terminal) { return 0; } - print "\n======================do summary=====================\n"; + + #DO SUMMARY DEPENDING ON YOUR SUB_COMMAND NEED + probe_utils->send_msg("$output", "d", "======================do summary====================="); + #print "summaryoutput:\n"; + #print Dumper \%summaryoutput; my @summary; push @summary, "[ok]:[MN]: Check on MN PASS."; + my $ok_section = 0; foreach my $line (@{ $summaryoutput{mn} }) { if ($line =~ /(\[failed\]\s*):\s*(.*)/) { - push @summary, "$1:\t$2"; + push @summary, "$1: $2"; $summary[0] = "[failed]:[MN]: Check on MN FAILED."; + $ok_section = 0; } elsif ($line =~ /(\[warning\]\s*):\s*(.*)/) { - push @summary, "$1:\t$2"; + push @summary, "$1: $2"; + $ok_section = 0; + } elsif($line =~ /(\[debug\]\s*):\s*(.*)/ && ! $ok_section) { + push @summary, "$1: $2"; + } elsif($line =~ /(\[ok\]\s*):\s*(.*)/) { + $ok_section=1; } + } my %summary_sn = (); @@ -679,17 +193,25 @@ sub summary_all_jobs_output { next if ($node eq "mn"); ${ $summary_sn{$node}{"rst"} } = 1; push @{ $summary_sn{$node}{"details"} }, "[ok]:[SN:$node]: Check on SN $node PASS."; + $ok_section = 0; foreach my $log (@{ $summaryoutput{$node} }) { if ($log =~ /(\[failed\]\s*):\s*(.*)/) { - push @{ $summary_sn{$node}{"details"} }, "$1:\t$2"; + push @{ $summary_sn{$node}{"details"} }, "$1: $2"; ${ $summary_sn{$node}{"rst"} } = 0; $summary_sn{$node}{"details"}[0] = "[failed]:[SN:$node]: Check on SN $node FAILED."; + $ok_section = 0; } elsif ($log =~ /(\[warning\]\s*):\s*(.*)/) { - push @{ $summary_sn{$node}{"details"} }, "$1:\t$2"; + push @{ $summary_sn{$node}{"details"} }, "$1: $2"; + $ok_section = 0; + } elsif ($log =~ /(\[debug\]\s*):\s*(.*)/ && ! $ok_section) { + push @{ $summary_sn{$node}{"details"} }, "$1: $2"; + } elsif ($log =~ /(\[ok\]\s*):\s*(.*)/){ + $ok_section = 1; } elsif ($log !~ /^(\[\w+\]\s*):\s*(.*)/) { - push @{ $summary_sn{$node}{"details"} }, "[failed]:\t$log"; + push @{ $summary_sn{$node}{"details"} }, "[failed]: $log"; ${ $summary_sn{$node}{"rst"} } = 0; $summary_sn{$node}{"details"}[0] = "[failed]:[SN:$node]: Check on SN $node FAILED."; + $ok_section = 0; } } } @@ -720,9 +242,587 @@ sub summary_all_jobs_output { } } } + + return $rst; +} + +sub print_check_result{ + my $msg = shift; + my $error_level = shift; + my $check_return_code = shift; + my $error_msg_ref = shift; + + if($check_return_code == 1){ + probe_utils->send_msg("$output", "$error_level", $msg); + probe_utils->send_msg("$output", "d", "$_") foreach (@$error_msg_ref); + }elsif($check_return_code ==2){ + return; + }else{ + probe_utils->send_msg("$output", "o", $msg); + } } +sub check_all_xcat_deamons{ + my $error_ref = shift; + + my $rst = 0; + @$error_ref = (); + my @deamon_list = ("SSL listener", + "DB Access", + "UDP listener", + "install monitor", + "Discovery worker", + "Command log writer"); + + my $output = `ps aux|grep -v grep|grep xcatd`; + foreach my $deamon (@deamon_list){ + if($output !~ /$deamon/){ + push @$error_ref, "Deamon '$deamon' isn't running"; + $rst = 1; + } + } + + return $rst; +} + +sub check_xcatd_receive_request{ + my $error_ref = shift; + my $rst = 0; + @$error_ref = (); + + #check important port + my @port_list = ("xcatdport", "xcatiport"); + foreach my $port_attr (@port_list){ + my $port = `lsdef -t site -i $port_attr -c| awk -F'=' '{print \$2}'`; + chomp($port); + if($port){ + my $cmdoutput = `netstat -ant|grep LISTEN|grep $port`; + if($?){ + push @$error_ref, "Attribute '$port_attr' in site table is set to $port, but xcatd isn't listening on $port"; + $rst=1; + } + }else{ + push @$error_ref, "Attribute '$port_attr' isn't set in 'site' table"; + $rst = 1; + } + } + return $rst if($rst); + + #send one command to test if xcatd can receive request + my $cmdoutput = `lsxcatd -a 2>&1`; + if($?){ + my @lines = split("[\n\r]", $cmdoutput); + push @$error_ref, $_ foreach (@lines); + $rst=1; + } + + return $rst; +} + +sub check_site_table{ + my $sitetable_ref=shift; + my $error_ref = shift; + + my $rst = 0; + @$error_ref = (); + my @attr_list = ("master", "domain", "installdir", "tftpdir"); + foreach my $attr (@attr_list){ + my $value; + $value = `lsdef -t site -i $attr -c | awk -F'=' '{print \$2}'`; + chomp($value); + if($value eq ""){ + push @$error_ref, "There isn't '$attr' definition in 'site' table"; + $rst=1; + }else{ + if (($attr eq "master") and (! probe_utils->is_ip_addr("$value"))) { + push @$error_ref, "The value of 'master' in 'site' table isn't an IP addres"; + $rst=1; + } + $sitetable_ref->{$attr} = $value; + } + } + + return $rst; +} + +sub check_passwd_table{ + my $error_ref = shift; + my $rst = 0; + @$error_ref = (); + + my $passwd = `tabdump passwd |awk -F',' '/system/ { gsub(/"/, "", \$2); gsub(/"/, "", \$3); print \$2,\$3 }'`; + chomp($passwd); + my ($username, $pw) = split(" ", $passwd); + if ($username eq "" || $pw eq "") { + push @$error_ref, "There isn't username or password for 'system' in 'passwd' table"; + $rst = 1; + } + + return $rst; +} + +sub check_network{ + my $sitetable_ref=shift; + my $serverip_ref = shift; #output arguments + my $error_ref = shift; #output arguments + + my $rst = 0; + @$error_ref = (); + + if($is_sn){ + # on SN, get ip address by compare 'master' attribute in 'site' table + # choose the one in the same network with 'master' + my @ipoutput = `ip addr show | grep inet | grep -v inet6 2>&1`; + foreach (@ipoutput) { + if ($_ =~ /inet\s+(.+)\/(.+)\s+brd\s+(.+)\s+scope global/i) { + if (xCAT::NetworkUtils::isInSameSubnet($sitetable_ref->{master}, $1, $2, 1)) { + $$serverip_ref = $1; + } + } + } + if (!defined($$serverip_ref) || ($$serverip_ref eq "")) { + push @$error_ref, "There isn't IP in current server has the same network as master '$sitetable_ref->{master}'"; + $rst = 1; + } + }else{ # on MN + my $nics = `ip addr show $installnic >/dev/null 2>&1`; + if ($?) { + push @$error_ref, "There isn't NIC '$installnic' in current server"; + $rst = 1; + } else { + $$serverip_ref = `ip addr show $installnic | awk -F" " '/inet / {print \$2}'|awk -F"/" '{print \$1}'`; + chomp($$serverip_ref); + if (!defined($$serverip_ref) || ($$serverip_ref eq "")) { + push @$error_ref, "There isn't IP address assigned to NIC $installnic"; + $rst =1; + }else{ + if ($$serverip_ref ne $sitetable_ref->{master}) { + push @$error_ref, "The IP $$serverip_ref of $installnic doesn't equal the value of 'master' in 'site' table"; + $rst = 1; + } + } + } + } + + my $networks = `tabdump networks|grep -v "^#"`; + $networks =~ s/\"//g; + my $netcnt = `echo "$networks"|wc -l`; + my $hit = 0; + for (my $i = 1 ; $i < $netcnt + 1 ; $i++) { + my $line = `echo "$networks" |sed -n ${i}p |awk -F"," '{print \$2,\$3,\$4}'`; + chomp($line); + if ($line =~ /(.+) (.+) (.+)/) { + if ($is_sn) { + $hit = 1 if (probe_utils->is_ip_belong_to_net("$1", "$2", $$serverip_ref)); + } else { + $hit = 1 if (probe_utils->is_ip_belong_to_net("$1", "$2", $$serverip_ref) && ("$3" eq "$installnic")); + } + } + } + if (! $hit) { + push @$error_ref, "IP $$serverip_ref of $installnic doesn't belong to any network defined in 'networks' table"; + $rst = 1; + } + return $rst; +} + +sub check_server_ip_static{ + my $serverip=shift; + my $error_ref = shift; + + my $rst = 0; + @$error_ref = (); + + if (! probe_utils->is_static_ip("$serverip", "$installnic")) { + push @$error_ref, "The value '$serverip' of 'master' in 'site' table isn't a static ip"; + $rst=1; + } + return $rst; +} + + +sub check_directory{ + my $sitetable_ref=shift; + my $error_ref = shift; + my $rst = 0; + @$error_ref = (); + + my @dir_list = ("installdir", "tftpdir"); + foreach my $dir (@dir_list){ + if($sitetable_ref->{$dir} eq ""){ + push @$error_ref, "There isn't '$dir' definition in 'site' table"; + $rst = 1; + }else{ + if (! -e "$sitetable_ref->{$dir}") { + push @$error_ref, "There isn't '$sitetable_ref->{$dir}' directory on current server"; + $rst = 1; + }else{ + if ($is_sn) { + my $mountoutput = `mount | grep '$sitetable_ref->{$dir}'`; + chomp($mountoutput); + + my $mountip; + if ($mountoutput =~ /(.+):$sitetable_ref->{$dir} on $sitetable_ref->{$dir} /) { + my $mountsource = $1; + if (xCAT::NetworkUtils->isIpaddr($mountsource)) { + $mountip = $mountsource; + } else { + $mountip = xCAT::NetworkUtils->getipaddr($mountsource); + } + } + + if ($mountip ne $sitetable_ref->{master}) { + push @$error_ref, "$dir '$sitetable_ref->{$dir}' isn't mounted from the management node"; + $rst = 1; + } + } + } + } + } + + return $rst; +} + + +sub check_disk{ + my $error_ref = shift; + + my $rst = 0; + @$error_ref = (); + + #check the free space of specific directory + #if "/var" is mounted on standalone disk, more than 1G free space is expected + #if "/tmp" is mounted on standalone disk, more than 1G free space is expected + #if installdir is mounted on standalone disk, more than 10G free space is expected. + #if any one of above three directories hasn't standalone disk, "/" directory should cover its space requirement. + my @dir_expectedspace_list = (["/var", "1"], ["/tmp", "1"], ["$installdir", "10"], ["/" , "0"]); + foreach my $dir (@dir_expectedspace_list){ + next if($dir->[0] eq "/" && $dir->[1] == 0); + my $checkrst = probe_utils->is_dir_has_enough_space($dir->[0], $dir->[1]); + if($checkrst == 2){ + $dir_expectedspace_list[$#dir_expectedspace_list][1] += $dir->[1]; +# }elsif($checkrst == 1){ +# probe_utils->send_msg($outputtarget, "o", "The free space of '$dir->[0]' directory is more than $dir->[1] G"); + }elsif($checkrst == 0){ +# probe_utils->send_msg($outputtarget, "w", "The free space of '$dir->[0]' is less than $dir->[1] G"); + push @$error_ref, "The free space of '$dir->[0]' is less than $dir->[1] G"; + $rst = 1; + } + + } + + return $rst; +} + +sub check_selinux{ + my $error_ref = shift; + my $rst = 0; + @$error_ref = (); + + if (probe_utils->is_selinux_enable()) { + push @$error_ref, "SELinux is enabled on current server"; + $rst = 1; + } + + return $rst; +} + +sub check_firewall { + my $error_ref = shift; + my $rst = 0; + @$error_ref = (); + + if (probe_utils->is_firewall_open()) { + push @$error_ref, "Firewall is configured on current server"; + $rst =1; + } + + return $rst; +} + +sub check_http_service{ + my $serverip=shift; + my $error_ref = shift; + my $rst = 0; + @$error_ref = (); + + `which wget > /dev/null 2>&1`; + if ($?) { + push @$error_ref, "HTTP check need 'wget' tool, please install 'wget' tool and try again"; + $rst = 1; + } else { + if (! probe_utils->is_http_ready("$serverip")) { + push @$error_ref, "HTTP service isn't ready on $serverip"; + $rst = 1; + } + } + + return $rst; +} + + +sub check_tftp_service{ + my $serverip = shift; + my $error_ref = shift; + my $rst = 0; + @$error_ref = (); + + my $nodename = `hostname -s`; + chomp($nodename); + + # For sn, 'setuptftp' attribute could be set to '0' or '1'. + # if '0', sn does not need to provie TFTP service, will not check it + my $checktftp = 1; + if ($is_sn) { + $checktftp = `lsdef $nodename -i setuptftp -c | awk -F'=' '{print \$2}' `; + chomp($checktftp); + } + if ($checktftp) { + `which tftp > /dev/null 2>&1`; + if ($?) { + push @$error_ref, "TFTP check need 'tftp' tool, please install 'tftp' tool and try again"; + $rst = 1; + } else { + $msg = "TFTP service is ready on $serverip"; + if (! probe_utils->is_tftp_ready("$serverip")) { + push @$error_ref, "TFTP service isn't ready on $serverip"; + $rst = 1; + } + } + }else{ + $rst = 2; + } + + return $rst; +} + +sub check_dns_service{ + my $sitetable_ref=shift; + my $serverip=shift; + my $error_ref = shift; + my $rst = 0; + @$error_ref = (); + + my $nodename = `hostname -s`; + chomp($nodename); + + # For sn, 'setupdns' attribute could be set to '0' or '1'. + # if '0', sn does not need to provie DNS service, will not check it + my $checkdns = 1; + if ($is_sn) { + $checkdns = `lsdef $nodename -i setupnameserver -c | awk -F'=' '{print \$2}'`; + chomp($checkdns); + } + + if ($checkdns) { + `which nslookup > /dev/null 2>&1`; + if ($?) { + push @$error_ref, "DNS check need 'nslookup' tool, please install 'nslookup' tool and try again"; + $rst = 1; + } else { + if ($is_sn) { + # on sn, nslookup it's ip to check DNS service + if (!probe_utils->is_dns_ready("$serverip", "$sitetable_ref->{master}", "$nodename", "$sitetable_ref->{domain}")) { + push @$error_ref, "DNS service isn't ready on $serverip"; + $rst = 1; + } + }else{ + my $rc=0; + # if this is a hierarchical cluster, nslookup one of sn to check DNS service + my @snlist = xCAT::ServiceNodeUtils->getAllSN(); + my $sntmp = shift(@snlist); + if ($sntmp) { + my $sninfo = `cat /etc/hosts | grep $sntmp`; + if ($sninfo =~ /(\d+).(\d+).(\d+).(\d+)/) { + my $snip = "$1.$2.$3.$4"; + if (!probe_utils->is_dns_ready("$snip", "$serverip", "$sntmp", "$sitetable_ref->{domain}")) { + $rc = 1; + } + } + } else { + + # if there is no sn, nslookup mnip + my $nslkp = `nslookup $serverip $serverip 2>&1`; + chomp($nslkp); + my $tmp = grep {$_ =~ "Server:[\t\s]*$serverip"} split (/\n/, $nslkp); + if (!$tmp) { + $rc = 1; + } + } + if ($rc) { + push @$error_ref, "DNS service isn't ready on $serverip"; + $rst = 1; + } + } + } + }esle{ + $rst =2; + } + + return $rst; +} + + +sub check_dhcp_service{ + my $serverip=shift; + my $error_ref = shift; + + my $rst = 0; + @$error_ref = (); + + + # For sn, 'setupdhcp' attribute could be set to '0' or '1'. + # if '0', sn does not need to provie DHCP service, will not check it + if ($is_sn) { + my $nodename = `hostname -s`; + chomp($nodename); + my $checkdhcp = `lsdef $nodename -i setupdhcp -c | awk -F'=' '{print \$2}'`; + chomp($checkdhcp); + if ($checkdhcp) { + # on sn, just check dhcpd service whether running + my $dhcpoutput = `ps aux | grep dhcpd |grep -v grep`; + if (! $dhcpoutput) { + push @$error_ref, "There isn't 'dhcpd' deamon in current server"; + $rst = 1; + } + } else { + $rst = 2; + } + } else { + my $rc = 0; + { #very important brace to create a block + my @snlist = xCAT::ServiceNodeUtils->getAllSN(); + my $sntmp = shift(@snlist); + if ($sntmp) { + my $tmp = `makedhcp -q $sntmp`; + if ($?) { + push @$error_ref, "makedhcp -q $sntmp failed"; + returncmdoutput($tmp, $error_ref) if ($verbose); + $rc = 1; + last; + } + chomp($tmp); + my $snip = xCAT::NetworkUtils->getipaddr($sntmp); + my $snmac = `lsdef $sntmp -i mac -c | awk -F'=' '{print \$2}'`; + chomp ($snmac); + my $tmpmac; + if ($tmp =~ /$sntmp: ip-address = $snip, hardware-address = (.+)/) { + $tmpmac = $1; + if ($tmpmac !~ $snmac) { + push @$error_ref, "DHCP server reply is wrong"; + returncmdoutput($tmp, $error_ref) if ($verbose); + $rc = 1; + } + } else { + push @$error_ref, "DHCP server reply is wrong"; + returncmdoutput($tmp, $error_ref) if ($verbose); + $rc = 1; + } + } else { + + my $tmp = `chdef xcatmntest groups=all ip=$serverip mac=aa:aa:aa:aa:aa:aa`; + if ($?) { + push @$error_ref, "Node simulation by 'chdef' has failed"; + returncmdoutput($tmp, $error_ref) if ($verbose); + $rc = 1; + last; + } else { + push @$error_ref, "Simulate a node xcatmntest to do dhcp test" if ($verbose); + } + + `cp /etc/hosts /etc/hosts.bak.probe > /dev/null 2>&1`; + + open HOSTFILE, ">> /etc/hosts"; + print HOSTFILE "$serverip xcatmntest xcatmntest.$domain"; + close HOSTFILE; + + probe_utils->send_msg($outputtarget, "d", "To do 'makedhcp xcatmntest'") if ($verbose); + $tmp = `makedhcp xcatmntest 2>&1`; + if ($?) { + push @$error_ref, "makedhcp xcatmntest failed"; + returncmdoutput($tmp, $error_ref) if ($verbose); + $rc = 1; + `rmdef xcatmntest`; + last; + } + + $tmp = `makedhcp -q xcatmntest`; + if ($?) { + push @$error_ref, "makedhcp -q xcatmntest failed"; + returncmdoutput($tmp, $error_ref) if ($verbose); + $rc = 1; + `makedhcp -d xcatmntest && rmdef xcatmntest`; + last; + } + chomp($tmp); + if ($tmp !~ /xcatmntest: ip-address = $serverip, hardware-address = aa:aa:aa:aa:aa:aa/) { + push @$error_ref, "DHCP server reply is wrong"; + returncmdoutput($tmp, $error_ref) if ($verbose); + $rc = 1; + `makedhcp -d xcatmntest && rmdef xcatmntest`; + last; + } + + push @$error_ref, "Start clearing simulation information for dhcp test" if ($verbose); + $tmp = `makedhcp -d xcatmntest && rmdef xcatmntest`; + returncmdoutput($tmp, $error_ref) if ($verbose); + + `rm /etc/hosts`; + `mv /etc/hosts.bak.probe /etc/hosts`; + } + } + if ($rc) { + push @$error_ref, "Run 'makedhcp -n' if it has not been ran before."; + $rst = 1; + } + } + + return $rst; +} + +sub check_dhcp_leases{ + my $error_ref = shift; + + my $rst = 0; + @$error_ref = (); + + my $leasefile = ""; + if (-e "/var/lib/dhcpd/dhcpd.leases") { + $leasefile = "/var/lib/dhcpd/dhcpd.leases"; + } elsif (-e "/var/lib/dhcp/db/dhcpd.leases") { + $leasefile = "/var/lib/dhcp/db/dhcpd.leases"; + } elsif (-e "/var/lib/dhcp/dhcpd.leases") { + $leasefile = "/var/lib/dhcp/dhcpd.leases"; + } + + my $filesizetmp = `du -sb $leasefile`; + if ($?) { + push @$error_ref, "Got the size of '$leasefile' failed"; + returncmdoutput($filesizetmp, $error_ref) if ($verbose); + $rst = 1; + } else { + chomp($filesizetmp); + my ($size, $file) = split(" ", $filesizetmp); + if ($size > 104857600) { + my $size_m = $size / 1048576; + push @$error_ref, "The size of $leasefile is $size_m M, more than 100M"; + $rst =1; + } + } + return $rst; +} + +sub returncmdoutput { + my $rst = shift; + my $error_ref = shift; + + chomp($rst); + my @lines = split("[\n\r]", $rst); + foreach my $line (@lines) { + push @$error_ref, $line; + } +} #------------------------------------- # Clean up test environment # ------------------------------------- @@ -736,90 +836,14 @@ sub cleanup { `mv /etc/hosts.bak.probe /etc/hosts > /dev/null 2>&1`; } } - #------------------------------------- -# Each probe sub command is supposed to support hierarchical. -# This funtion is used to caclulate which SN should be dispatched which command +# main process #------------------------------------- -sub caclulate_dispatch_cmd { - my @snlist = xCAT::ServiceNodeUtils->getAllSN(); - if ($noderange) { - my @nodes = `nodels $noderange 2>&1`; - if ($?) { - my $error = join(" ", @nodes); - if ($error =~ /Error: Invalid nodes and\/or groups in noderange: (.+)/) { - probe_utils->send_msg("$output", "f", "There are invaild nodes ($1) in command line attribute node range"); - } else { - probe_utils->send_msg("$output", "f", "There is an error in command line attribute node range, use 'nodels' to check"); - } - return 1; - } else { - chomp foreach (@nodes); - my $snnodemap = xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes, "xcat", "MN"); - my %newsnnodemap; - foreach my $sn (keys %$snnodemap) { - if (grep(/^$sn$/, @snlist)) { - push(@{ $newsnnodemap{$sn} }, @{ $snnodemap->{$sn} }); - } else { - push(@{ $newsnnodemap{mn} }, @{ $snnodemap->{$sn} }); - } - } - - foreach my $sn (keys %newsnnodemap) { - my $nodes = join(",", @{ $newsnnodemap{$sn} }); - if ($sn eq "mn") { - $noderange = $nodes; - } else { - for (my $i = 0 ; $i <= $#tmpargv ; $i++) { - if ($tmpargv[$i] eq "-n") { - $tmpargv[ $i + 1 ] = $nodes; - last; - } - } - my $args = join(" ", @tmpargv); - $dispatchcmd{$sn} = "$::XCATROOT/probe/subcmds/$program_name $args 2>&1"; - } - } - } - } else { - if (@snlist) { - my $args = join(" ", @tmpargv); - if ($args =~ /\-V/) { - $args = "-V"; - } else { - $args = " "; - } - my $sns = join(",", @snlist); - $dispatchcmd{$sns} = "$::XCATROOT/probe/subcmds/$program_name $args 2>&1" if (!$?); - } - } - return 0; -} - -#------------------------------------ -# print sn's msg after all msg received -#------------------------------------ -sub send_sn_msg { - foreach $node (keys %summaryoutput) { - next if ($node eq "mn"); - foreach my $line (@{ $summaryoutput{$node} }) { - if ($line =~ /^(\[\w+\]\s*):\s*(.*)/) { - print "$1:[SN:$node]: $2\n"; - } else { - print "[failed] :[SN:$node]: $line\n"; - } - } - } -} - -#------------------------------------- -# main process start -#------------------------------------- -@tmpargv = @ARGV; +my @tmpargv = @ARGV; if ( !GetOptions("--help|h" => \$help, "T" => \$test, - "n=s" => \$noderange, + "H" => \$hierarchy, "V" => \$verbose, "i=s" => \$installnic)) { @@ -842,166 +866,75 @@ if ($test) { exit 0; } +#Handle the interrupt signal from STDIN $SIG{TERM} = $SIG{INT} = sub { $terminal = 1; cleanup(); }; -#-------------------------------------------- -# To confirm what current node is, MN or SN -#-------------------------------------------- -$is_sn = 1 if (-e "/etc/xCATSN"); - -if ($is_sn) { +#if it is called by hierarchy template, just run job, not to do dispatch +if ($hierarchy || $is_sn) { $rst = do_main_job(); exit $rst; } -if (!defined($installnic)) { - probe_utils->send_msg("$output", "f", "Option -i is required"); - probe_utils->send_msg("$output", "d", "$::USAGE"); - exit 1; +my @error; +my $hierarchy_instance = hierarchy->new(); +$rst = $hierarchy_instance->dispatch_cmd($noderange, \@tmpargv, \@error); +if($rst){ + probe_utils->send_msg("$output", "f", "Calculate dispatch command failed"); + foreach (@error){ + probe_utils->send_msg("$output", "", "$_"); + } + if($hierarchy_instance->destory(\@error)){ + probe_utils->send_msg("$output", "", "$_") foreach(@error); + } + exit $rst; } -#-------------------------------------------- -# Each probe tool is supposed to support hierarchical. -#-------------------------------------------- -$rst = caclulate_dispatch_cmd(); - -#print Dumper \%dispatchcmd; -#print "node left to mn : $noderange\n"; -exit $rst if ($rst); - -#-------------------------------------------- -# dispatch job to MN and SN -#-------------------------------------------- -my $mnjobpid = 0; -my @snsjobpids = (); -my @snsjobfds = (); -my $pipe_parent_read; -my $pipe_child_write; -pipe $pipe_parent_read, $pipe_child_write; -{ - #handle job in MN - $mnjobpid = fork(); - if (!defined($mnjobpid)) { - probe_utils->send_msg("$output", "f", "fork process to handle MN job failed: $!"); - $rst = 1; - last; - } elsif ($mnjobpid == 0) { - $SIG{TERM} = $SIG{INT} = sub { - exit 1; - }; - - close $pipe_parent_read; - $rst = do_main_job($pipe_child_write); - exit $rst; - } - $SIG{CHLD} = sub { waitpid($mnjobpid, WNOHANG) }; - close $pipe_child_write; - - #handle job dispatch to SN - foreach my $sn (keys %dispatchcmd) { - my $snjobcmd = "xdsh $sn -s \"$dispatchcmd{$sn}\" 2>&1"; - my $snjobfd; - my $snjobpid; - if (!($snjobpid = open($snjobfd, "$snjobcmd |"))) { - probe_utils->send_msg("$output", "f", "fork process to dispatch cmd $snjobcmd to $sn failed: $!"); - next; - } - push(@snsjobpids, $snjobpid); - push(@snsjobfds, $snjobfd); - } - - my $select = new IO::Select; - $select->add(\*$pipe_parent_read) if ($pipe_parent_read); - $select->add(\*$_) foreach (@snsjobfds); - $| = 1; - - my $line; - my %pipeisnonull; - $pipeisnonull{mn} = 1; - $pipeisnonull{$_} = 1 foreach (@snsjobfds); - my $onepipeisnonull = 1; - while ($onepipeisnonull) { - if (@hdls = $select->can_read(0)) { - foreach $hdl (@hdls) { - if ($pipeisnonull{mn} && $hdl == \*$pipe_parent_read) { - if (eof($pipe_parent_read)) { - $pipeisnonull{mn} = 0; - } else { - chomp($line = <$pipe_parent_read>); - if ($line =~ /(\[\w+\]\s*):\s*(.*)/) { - print "$1:[MN]: $2\n"; - } - push @{ $summaryoutput{mn} }, $line; +my %reply_cache; +while($hierarchy_instance->read_reply(\%reply_cache)){ + foreach my $servers (keys %reply_cache){ #Dispatch_cmd may use SN range to dispatch cms to SNs at one time + my @server_array = split(",", $servers); + foreach my $server (@server_array){ + foreach (@{$reply_cache{$servers}}){ + my $msg = ""; + my $logmsg=""; + + #For cases like below: + #c910f02c04p04: [ok] :All xCAT deamons are running + if($reply_cache{$servers}->[$_] =~ /^(\w+)\s*:\s*(\[\w+\]\s*):\s*(.*)/){ + if("$1" eq "$server"){ + $logmsg = "$2: $3"; + $msg = "$2:<$server>: $3"; } - } else { - foreach my $fd (@snsjobfds) { - if ($pipeisnonull{$fd} && $hdl == \*$fd) { - if (eof($fd)) { - $pipeisnonull{$fd} = 0; - } else { - chomp($line = <$fd>); - if ($line =~ /(Error:)\s+(\w+)\s+(.+)/i) { - push @{ $summaryoutput{$2} }, $line; - } elsif ($line =~ /^(\w+)\s*:\s(.*)/) { - push @{ $summaryoutput{$1} }, $2; - $line = "$2:$1: $3" if ($line =~ /^(\w+)\s*:\s*(\[\w+\]\s*):\s*(.*)/); - } - } - } + #For cases like below: + #c910f02c04p05: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! + }elsif($reply_cache{$servers}->[$_] =~ /^(\w+)\s*:\s*(.*)/){ + if("$1" eq "$server"){ + $logmsg = "$2"; + $msg = "<$server>: $2"; + } + #For cases like below: + #Unable to open socket connection to xcatd daemon on localhost:3001. + }else{ + if(length($reply_cache{$servers}->[$_])){ + $logmsg = $reply_cache{$servers}->[$_]; + $msg = "[failed] :[$server]: $reply_cache{$servers}->[$_]"; } } + probe_utils->send_msg("$output", "", "$msg") if(length($msg)); + push @{$summaryoutput{$server}},$logmsg if(length($logmsg)); } - $onepipeisnonull = 0; - $onepipeisnonull |= $pipeisnonull{$_} foreach (keys %pipeisnonull); } - last if ($terminal); - sleep 1; } - send_sn_msg(); + if($terminal){ + last; + } } -close($pipe_child_write) if ($pipe_child_write); -close($pipe_parent_read) if ($pipe_parent_read); -close($_) foreach (@snsjobfds); -my %runningpid; -$runningpid{$mnjobpid} = 1 if ($mnjobpid); -$runningpid{$_} = 1 foreach (@snsjobpids); -my $existrunningpid = 0; -$existrunningpid = 1 if (%runningpid); - -my $trytime = 0; -while ($existrunningpid) { - - #try INT 5 up to 5 times - if ($try < 5) { - foreach my $pid (keys %runningpid) { - kill 'INT', $pid if ($runningpid{$pid}); - } - - #try TERM 5 up to 5 times - } elsif ($try < 10) { - foreach my $pid (keys %runningpid) { - kill 'TERM', $pid if ($runningpid{$pid}); - } - - #try KILL 1 time - } else { - foreach my $pid (keys %runningpid) { - kill 'KILL', $pid if ($runningpid{$pid}); - } - } - ++$try; - - sleep 1; - foreach my $pid (keys %runningpid) { - $runningpid{$pid} = 0 if (waitpid($pid, WNOHANG)); - } - $existrunningpid = 0; - $existrunningpid |= $runningpid{$_} foreach (keys %runningpid); - last if ($try > 10); +if($hierarchy_instance->destory(\@error)){ + probe_utils->send_msg("$output", "", "$_") foreach(@error); } #------------------------------------- @@ -1014,3 +947,5 @@ exit $rst; + + From 6fab40277e7c5428db54a111044dd0dbbea83598 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 2 Nov 2016 14:53:59 -0400 Subject: [PATCH 25/43] Suggested review changes --- .../virtual_machines/RHEVHypervisor.rst | 18 ++++++++++++++---- .../ppc64le/virtual_machines/hypervisorKVM.rst | 14 +++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst index 9274d7018..e8ae9fabf 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst @@ -17,7 +17,17 @@ chdef -t osimage rhels7.3-ppc64le-RHEV4-install-compute \ otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA - * Create a new file ``/opt/xcat/share/xcat/install/rh/other.pkglist`` to list required packages :: + * Create a new file ``/install/custom/rhels7.3/ppc64le/rhelv4.pkglist`` to include necessary packages provided from the OS. :: + + #INCLUDE:/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglis# + bridge-utils + + * Modify ``pkglist`` attribute to point to the file from the step above :: + + chdef -t osimage rhels7.3-snap3-ppc64le-RHEV4-install-compute \ + pkglist=/install/custom/rhels7.3/ppc64le/rhelv4.pkglist + + * Create a new file ``/install/custom/rhels7.3/ppc64le/rhev4.otherpkgs.pkglist`` to list required packages :: libvirt qemu-kvm-rhev @@ -28,7 +38,7 @@ * Modify ``otherpkglist`` attribute to point to the file from the step above :: chdef -t osimage rhels7.3-snap3-ppc64le-RHEV4-install-compute \ - otherpkglist=/opt/xcat/share/xcat/install/rh/other.pkglist + otherpkglist=/install/custom/rhels7.3/ppc64le/rhev4.otherpkgs.pkglist * The RHEV osimage should look similar to: :: @@ -39,9 +49,9 @@ osname=Linux osvers=rhels7.3 otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA - otherpkglist=/opt/xcat/share/xcat/install/rh/other.pkglist + otherpkglist=/install/custom/rhels7.3/ppc64le/rhev4.otherpkgs.pkglist pkgdir=/install/rhels7.3/ppc64le - pkglist=/install/custom/install/rh/compute.rhels7.ppc64le.pkglist + pkglist=/install/custom/rhels7.3/ppc64le/rhelv4.pkglist profile=compute provmethod=install template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst index 1f0873241..add5069d2 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst @@ -16,19 +16,19 @@ Provision Hypervisor xCAT ships a postscript **xHRM** to create a network bridge on kvm host during installation/netbooting. Specify the **xHRM** with appropriate parameters in **postscripts** attibute. For example: - * To create a bridge with default name 'default' against the installation network device which was specified by **installnic** attribute :: - - chdef kvmhost1 -p postscripts="xHRM bridgeprereq" - - * To create a bridge named 'br0' against the installation network device which was specified by **installnic** attribute(recommended) :: + * To create a bridge named 'br0' against the installation network device specified by **installnic**: :: chdef kvmhost1 -p postscripts="xHRM bridgeprereq br0" - * To create a bridge named 'br0' against the network device 'eth0' :: + * To create a bridge with default name 'default' against the installation network device specified by **installnic**: :: + + chdef kvmhost1 -p postscripts="xHRM bridgeprereq" + + * To create a bridge named 'br0' against the network device 'eth0': :: chdef kvmhost1 -p postscripts="xHRM bridgeprereq eth0:br0" - **Note**: The network bridge name you use should not be the virtual bridges created by libvirt installation [1]_. + **Note**: The network bridge name you use should not be the virtual bridges (vbrX) created by libvirt installation [1]_. #. Customize the hypervisor node definition to mount the shared kvm storage directory on management node **(optional)** From 990e611b28429476086c27039f34a38449bc023c Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 2 Nov 2016 15:33:46 -0400 Subject: [PATCH 26/43] Update networks.rst Fix spelling error on noboot section --- .../admin-guides/manage_clusters/ppc64le/configure/networks.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst index b199866d2..3bacd82b5 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst @@ -49,7 +49,7 @@ Configure DHCP to listen on different network interfaces [**Optional**] **noboot** `````````` - For the *IBM OpenPOWER S822LC for HPC ("Minsky")* nodes, the BMC and compute "eth0" share the left-size integrated ethernet port and compute "eth1" is the right-side integrated ethernet port. For these servers, it is recommended to use two physical cables allowing the BMC port to be dedicated and "eth1" used by the OS. When an open range is configured on the two networks, the xCAT Genesis kernel will be sent to the BMC interface and causes problems during hardware discovery. To support this scenario, on the xCAT management node, if "eth1" is connected to the BMC network and "eth3" is connected to the compute network, disable genesis boot for the BMC network by setting ``:noboot`` in ``dhcpinterfaces`` using: :: + For the *IBM OpenPOWER S822LC for HPC ("Minsky")* nodes, the BMC and compute "eth0" share the left-side integrated ethernet port and compute "eth1" is the right-side integrated ethernet port. For these servers, it is recommended to use two physical cables allowing the BMC port to be dedicated and "eth1" used by the OS. When an open range is configured on the two networks, the xCAT Genesis kernel will be sent to the BMC interface and causes problems during hardware discovery. To support this scenario, on the xCAT management node, if "eth1" is connected to the BMC network and "eth3" is connected to the compute network, disable genesis boot for the BMC network by setting ``:noboot`` in ``dhcpinterfaces`` using: :: chdef -t site dhcpinterfaces="eth1:noboot,eth3" From c619538333047b807326e5da274ae6d019fb15e2 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Wed, 2 Nov 2016 16:55:05 -0400 Subject: [PATCH 27/43] Handle invalid options for makentp command --- xCAT-server/lib/xcat/plugins/makentp.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/makentp.pm b/xCAT-server/lib/xcat/plugins/makentp.pm index d8801b431..f2e784751 100755 --- a/xCAT-server/lib/xcat/plugins/makentp.pm +++ b/xCAT-server/lib/xcat/plugins/makentp.pm @@ -110,6 +110,7 @@ sub parse_args { # Responds with usage statement local *usage = sub { my $usage_string = xCAT::Usage->getUsage($cmd); + send_msg($request, 0, " $usage_string"); return ([ $_[0], $usage_string ]); }; @@ -124,6 +125,7 @@ sub parse_args { @ARGV = @$args; $Getopt::Long::ignorecase = 0; Getopt::Long::Configure("bundling"); + Getopt::Long::Configure("no_pass_through"); # Process command-line flags if (!GetOptions(\%opt, @@ -288,7 +290,7 @@ sub process_request { } if ($verbose) { - send_msg(\%request, 0, " ...changing the ntpp configuration file /etc/ntp.conf.\n ntp servers are: $ntp_servers"); + send_msg(\%request, 0, " ...changing the ntp configuration file /etc/ntp.conf.\n ntp servers are: $ntp_servers"); } # create ntp server config file From 42ec75fd250a6718c17f31fe22782f6364d4b56b Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Thu, 3 Nov 2016 10:24:00 +0800 Subject: [PATCH 28/43] update xcattest after review --- xCAT-test/xcattest | 2 -- 1 file changed, 2 deletions(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index 2155e04a6..541fad827 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -17,7 +17,6 @@ use lib "$::XCATROOT/lib/perl"; my $rootdir = "$::XCATROOT/share/xcat/tools/autotest"; my $needhelp = 0; my $configinfo = undef; -#my $configfile = "$rootdir/default.conf"; my $configfile = undef; my $casedir = "$rootdir/testcase"; my $bundledir = "$rootdir/bundle"; @@ -1135,7 +1134,6 @@ sub listformatbundleinfo print "bundle files and descriptions:\n"; foreach my $filename (sort { $a cmp $b } keys %bundlefilesinfo ) { - # foreach my $filename (keys %bundlefilesinfo) { my @desc = split(" ", $bundlefilesinfo{$filename}); my $str = ""; my @formatdesc = (); From 31a68a5835a0bb10271711e8e66c158bcc8ccfe4 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 2 Nov 2016 22:59:07 -0400 Subject: [PATCH 29/43] Modified depending on comments and add comments --- xCAT-probe/lib/perl/hierarchy.pm | 7 ++++--- xCAT-probe/subcmds/code_template | 34 +++++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/xCAT-probe/lib/perl/hierarchy.pm b/xCAT-probe/lib/perl/hierarchy.pm index 94594d6d2..3c1add40d 100644 --- a/xCAT-probe/lib/perl/hierarchy.pm +++ b/xCAT-probe/lib/perl/hierarchy.pm @@ -100,11 +100,12 @@ sub calculate_dispatch_cmd { } else { #there isn't noderange input from STDIN, dispatch command to all SN if there are SN defined in MN + #if there isn't SN defined in MN, just dispatch command to MN itself + my $args = join(" ", @$argv_ref); + $self->{dispatchcmd}->{mn} = "$::XCATROOT/probe/subcmds/$self->{program_name} $args -H 2>&1"; if (@snlist) { - my $args = join(" ", @$argv_ref); my $sns = join(",", @snlist); - $self->{dispatchcmd}->{$sns} = "$::XCATROOT/probe/subcmds/$self->{program_name} $args -H 2>&1" if (!$?); - $self->{dispatchcmd}->{mn} = "$::XCATROOT/probe/subcmds/$self->{program_name} $args -H 2>&1"; + $self->{dispatchcmd}->{$sns} = "$::XCATROOT/probe/subcmds/$self->{program_name} $args -H 2>&1"; } } diff --git a/xCAT-probe/subcmds/code_template b/xCAT-probe/subcmds/code_template index 91d7b7ff4..ed9ffdd46 100755 --- a/xCAT-probe/subcmds/code_template +++ b/xCAT-probe/subcmds/code_template @@ -1,6 +1,26 @@ #!/usr/bin/perl # IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html +#-------------------------------------------------------- +#This is a template for developing a new probe sub_command. Especially in hierarchical environment. +#This template mainly implement the sub_comamd dispatch in hierarchical structure and basic framework of a new sub_comamd. +#Developer only need to focus on main probe job (by implement do_main_job function) and friendly output (by implement summary_all_jobs_output function) for user. +#This template can also be used in flat structure. but if developer think it's too heavy in flat, it's fine to develop sub command directly. +#But in hierarchical structure, we strongly recommand using this template. +# +#The main dispatch policy are: +#1. if there isn't noderange input from commmand line and there are service nodes defined in current MN, +# dispatch exact same command input from STDIN to all SNs and current MN. if there isn't service nodes defined, +# just hanld command input from STDIN in current MN +#2. If there is noderange input from command line by opion "-n", we will dispatch the command input from STDIN to SN which can hanle these ndoes +# For example, if we got command from STDIN like "probecommand -n test[1-15] -V" and test[1-5] 's SN is SN1, test[6-10]'s SN is SN2 +# The dispatch result will be: +# For MN run: probecommand -n test[11-15] -V +# For SN1 run: probecommand -n test[1-5] -V +# For SN2 run: probecommand -n test[6-10] -V +#3. All the return message from SNs and MN will be saved in hash %summaryoutput, develper can use it when implement summary_all_jobs_output function +#-------------------------------------------------------- + BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } use lib "$::XCATROOT/probe/lib/perl"; @@ -54,20 +74,20 @@ Options: "; #------------------------------------ -# Please implement the main checking job of current command in do_main_job function -# Recommand to use probe_utils->send_msg() to handle message you plan to print out +# Please implement the main job of current command in do_main_job function +# Recommand to use probe_utils->send_msg() to handle message you plan to print out to STDOUT # A simple example has been written in funciton. #------------------------------------ sub do_main_job { my $rst = 0; - probe_utils->send_msg("$output", "o", "I reveive node range is $noderange"); + probe_utils->send_msg("$output", "o", "Received node range: $noderange"); - #<#DO YOUR OWN CHECKING JOB1#> - probe_utils->send_msg("$output", "o", "first checking point"); + #<#DO YOUR OWN JOB1#> + probe_utils->send_msg("$output", "o", "Do the first job"); - #<#DO YOUR OWN CHECKING JOB2#> - probe_utils->send_msg("$output", "f", "second checking point"); + #<#DO YOUR OWN JOB2#> + probe_utils->send_msg("$output", "f", "Do the second job"); return $rst; } From 1ebdb5d96c3acb16a20821b694f551466913e986 Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 26 Oct 2016 20:54:39 +0800 Subject: [PATCH 30/43] add lock in rh/genimage to avoid multiple genimage processes on same rootimg directory;add guard code before umount/remove mount points under rootimg directory --- perl-xCAT/xCAT/Utils.pm | 50 ++++++++++++++++++++-- xCAT-server/lib/xcat/plugins/packimage.pm | 13 +++++- xCAT-server/lib/xcat/plugins/rmimage.pm | 43 ++++++++++++++----- xCAT-server/share/xcat/netboot/rh/genimage | 40 ++++++++++++++--- 4 files changed, 125 insertions(+), 21 deletions(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index d158858f2..d28ea58ae 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -32,6 +32,7 @@ else { use IPC::Open3; use IO::Select; use xCAT::GlobalDef; +use Digest::MD5 qw(md5_hex); eval { require xCAT::RemoteShellExp; }; @@ -2394,19 +2395,21 @@ sub acquire_lock { use Fcntl ":flock"; my $tlock; $tlock->{path} = "/var/lock/xcat/" . $lock_name; - open($tlock->{fd}, ">", $tlock->{path}) or return undef; + sysopen($tlock->{fd}, $tlock->{path}, POSIX::O_CREAT | POSIX::O_WRONLY) or return undef; unless ($tlock->{fd}) { return undef; } - if ($nonblock_mode) { flock($tlock->{fd}, LOCK_EX | LOCK_NB) or return undef; } else { flock($tlock->{fd}, LOCK_EX) or return undef; } - print { $tlock->{fd} } $$; + + truncate $tlock->{fd},0; + syswrite $tlock->{fd} ,$$; $tlock->{fd}->autoflush(1); return $tlock; } + #--------------------- =head3 release_lock @@ -4781,4 +4784,45 @@ sub get_nmapversion { return $nmap_version; } + +#-------------------------------------------------------------------------------- + +=head3 acquire_lock_imageop + acquire lock for the image related operations on specific rootimg dir + the image related operation includes genimage,packimage,rmimage... + Arguments: + $rootimg_dir: the full path of osimage rootimage dir + lock mode: 0-block, 1-non-block + Returns: + a list with format (, or ) + + the : 0 on success, 1 on fail + the : available on fail + the : available on success +=cut + +#-------------------------------------------------------------------------------- + +sub acquire_lock_imageop { + my $self=shift; + my $rootimg_dir=shift; + my $NON_BLOCK=shift; + + $NON_BLOCK=1 unless(defined $NON_BLOCK); + my $mylockfile=Cwd::realpath($rootimg_dir); + my $mymd5=md5_hex($mylockfile); + $mylockfile=~s/\//./g; + $mylockfile=$mylockfile.".".$mymd5; + + my $lock = xCAT::Utils->acquire_lock("$mylockfile", $NON_BLOCK); + unless ($lock){ + my $pidfd; + open($pidfd,"<","/var/run/lock/xcat/$mylockfile"); + my $pid=<$pidfd>; + close($pidfd); + return (1, "failed to acquire lock, seems there is another genimage/packimage/rmimage process $pid running on root image dir \"$rootimg_dir\""); + } + return (0,$lock); +} + 1; diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index d5ab79c76..929f2d578 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -37,6 +37,8 @@ use File::Path; use xCAT::Utils; use xCAT::TableUtils; use xCAT::SvrUtils; +use Digest::MD5 qw(md5_hex); + Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); @@ -97,7 +99,8 @@ sub process_request { my $provmethod; my $help; my $version; - + my $lock; + GetOptions( "profile|p=s" => \$profile, "arch|a=s" => \$arch, @@ -199,6 +202,14 @@ sub process_request { } $rootimg_dir = "$destdir/rootimg"; + + my $retcode; + ($retcode,$lock)=xCAT::Utils->acquire_lock_imageop($rootimg_dir); + if($retcode){ + $callback->({ error => ["$lock"], errorcode => [1]}); + return 1; + } + my $distname = $osver; until (-r "$::XCATROOT/share/xcat/netboot/$distname/" or not $distname) { chop($distname); diff --git a/xCAT-server/lib/xcat/plugins/rmimage.pm b/xCAT-server/lib/xcat/plugins/rmimage.pm index 586fa785c..ad35bd605 100644 --- a/xCAT-server/lib/xcat/plugins/rmimage.pm +++ b/xCAT-server/lib/xcat/plugins/rmimage.pm @@ -10,9 +10,11 @@ BEGIN use lib "$::XCATROOT/lib/perl"; use Getopt::Long; use File::Path; +use Cwd qw(realpath); use xCAT::Utils; use xCAT::TableUtils; use xCAT::DBobjUtils; +use Digest::MD5 qw(md5_hex); Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); @@ -41,7 +43,8 @@ sub process_request { my $xcatdef; my $imagename; my $imagedir; - + my $lock; + if (!xCAT::Utils->isLinux()) { $callback->({ error => ["The rmimage command is only supported on Linux."], errorcode => [1] }); return; @@ -175,8 +178,17 @@ sub process_request { $callback->({ error => ["Image directory $imagedir does not exist"], errorcode => [1] }); return; } + - # Doing this extra check now because we now have a method and arch from either the node or the image name. + my $retcode; + ($retcode,$lock)=xCAT::Utils->acquire_lock_imageop("$imagedir/rootimg"); + if($retcode){ + $callback->({ error => ["$lock"], errorcode => [1]}); + return 1; + } + + + # Doing this extra check now because we now have a method and arch from either the node or the image namee if (($method eq "sysclone") && ($arch ne "s390x")) { # Only supporting removing sysclone images for s390x at this time. @@ -184,17 +196,28 @@ sub process_request { return; } - my @filestoremove = ("$imagedir/rootimg.gz", "$imagedir/kernel", "$imagedir/initrd-stateless.gz", "$imagedir/initrd-statelite.gz"); + my @filestoremove = ("$imagedir/kernel", "$imagedir/initrd-stateless.gz", "$imagedir/initrd-statelite.gz"); + my @rootimgtars=glob "$imagedir/rootimg.{tar,cpio}.{xz,gz}"; + push @filestoremove,@rootimgtars; + #unmount all the mount points under rootimg directory + #to avoid removing the directory/files on management node by mistake + $realimagedir=realpath("$imagedir/rootimg"); + my @mntptlist; + my $FILEHD=undef; + open($FILEHD,"<","/proc/mounts"); + while(<$FILEHD>){ + my @arr=split / /; + push @mntptlist,$arr[1] if(substr($arr[1],0,length($realimagedir)) eq $realimagedir); + } + close($FILEHD); + foreach my $mntpt (@mntptlist){ + system("umount -l $mntpt >/dev/null 2>&1") + } - #some rpms like atftp mount the rootimg/proc to /proc, we need to make sure rootimg/proc is free of junk - `umount -l $imagedir/rootimg/proc 2>&1 1>/dev/null`; - - # also umount the rootimg/sys - `umount -l $imagedir/rootimg/sys 2>&1 1>/dev/null`; # umount the rootimg/dev - my $devmount = `cat /proc/mounts |grep "$imagedir/rootimg/dev"`; - if ($devmount) { + my $devmount = system("findmnt $imagedir/rootimg/dev/ >/dev/null 2>&1"); + if (!$devmount) { xCAT::Utils->runcmd("umount -l $imagedir/rootimg/dev"); if ($?) { $callback->({ error => ["$imagedir/rootimg/dev mount on /dev, and can't umount. remove $imagename will lead to unpredictable result, please umount manualy before try again"], errorcode => [1] }); diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index ea50b4a6c..72c45871a 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -19,6 +19,8 @@ use File::Temp qw/mkdtemp/; use FindBin; use lib "$FindBin::Bin/../imgutils"; use imgutils; +use xCAT::Utils; +use Digest::MD5 qw(md5_hex); #use strict; Getopt::Long::Configure("bundling"); @@ -66,6 +68,8 @@ my $tempfile; my $prompt; my $ignorekernelchk; my $noupdate; +my $lock; + sub xdie { @@ -112,17 +116,30 @@ sub mount_chroot { sub umount_chroot { my $rootimage_dir = shift; - if ($rootimage_dir eq "") { + + $rootimage_dir=realpath($rootimage_dir); + if ($rootimage_dir eq "/") { print "\n\n\n\nWARNING: /proc and /sys may still be mounted in the rootimgdir\n\n\n\n"; return 1; } - + + #unmount all the mount points under rootimg directory + #to avoid removing the direcoty/files on managemment node by mistake + my @mntptlist; + my $FILEHD=undef; + open($FILEHD,"<","/proc/mounts"); + while(<$FILEHD>){ + my @arr=split / /; + push @mntptlist,$arr[1] if(substr($arr[1],0,length($rootimage_dir)) eq $rootimage_dir); + } + close($FILEHD); + foreach my $mntpt (@mntptlist){ + system("umount -l $mntpt >/dev/null 2>&1") + } + if (majversion($osver) > 6) { - system("umount -l $rootimage_dir/proc"); - system("umount -l $rootimage_dir/sys"); - - #system("umount -l $rootimage_dir/dev"); - system("rm -rf $rootimage_dir/dev/*"); + #only remove the /dev in rootimg directory if it is not a mount point + system("findmnt $rootimage_dir/dev/ >/dev/null 2>&1 || rm -rf $rootimage_dir/dev/*"); } } @@ -194,6 +211,7 @@ $srcdir_otherpkgs = "$installroot/post/otherpkgs/$osver/$arch" unless ($srcdir_o $destdir = "$installroot/netboot/$osver/$arch/$profile" unless ($destdir); $updates{'rootimgdir'} = $destdir if ($tempfile); + $rootimg_dir = "$destdir/rootimg"; $kerneldir = "$installroot/kernels" unless ($kerneldir); # the default directory for 3rd-party kernel is "$installroot/kernels"; @@ -348,6 +366,14 @@ unless ($onlyinitrd) { exit 1; } + my $retcode; + ($retcode,$lock)=xCAT::Utils->acquire_lock_imageop($rootimg_dir); + if($retcode){ + print "$lock"; + exit 1; + } + + mount_chroot($rootimg_dir); my %pkg_hash = imgutils::get_package_names($pkglist); From 472f94bb2241e760854fabd9042ffc3a00afb5db Mon Sep 17 00:00:00 2001 From: neo954 Date: Thu, 3 Nov 2016 02:39:07 -0500 Subject: [PATCH 31/43] [go-xcat] Fix GitHub issue #1998 (#2059) * [go-xcat] Fix GitHub issue #1998, print out friendly error messages when no xcat paackages installed on updating * [go-xcat] GitHub pull request #2059, change error message base on the comment of @whowutwut --- xCAT-server/share/xcat/tools/go-xcat | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 6e82a6929..fc2449872 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -2,7 +2,7 @@ # # go-xcat - Install xCAT automatically. # -# Version 1.0.9 +# Version 1.0.10 # # Copyright (C) 2016 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) @@ -1188,6 +1188,9 @@ function update_xcat() [[ "${ver}" = "(not installed)" ]] && unset "install_list[${i}]" done < <(check_package_version "${install_list[@]}") + [[ "${#install_list[@]}" -gt "0" ]] + warn_if_bad "$?" "xCAT is not installed." + exit_if_bad "$?" "In order to install xCAT, please rerun with \`${0##*/} install'." install_packages "$@" "${install_list[@]}" } From 42814db0bcaf965d525b1b5aa75a190f15796e63 Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 3 Nov 2016 03:33:02 -0400 Subject: [PATCH 32/43] modified xcatprobe discovery usage --- xCAT-probe/subcmds/discovery | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index a798bd8d0..5a4a1cd82 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -39,12 +39,15 @@ my $program_name = basename("$0"); $::USAGE = "Usage: $program_name -h $program_name -n -m [-t ] [-V] [--noprecheck] + $program_name -n -m -r [-V] [--noprecheck] Description: - Probe the discovery process, including pre-check for required configuration and realtime monitor of discovery process. - If all pre-check items pass, $program_name will go to monitor directly, otherwise $program_name will exit. - In order to do realtime monitor, $program_name probe must be run along with the node discovery procedure. Trigger this command before triggering node discovery procedure. - Currently, this command does not support hierarchy. + Probe the discovery process, including pre-check for required configuration, 'Realtime monitor' and 'Replay history' of discovery process. + If all pre-check items failed, $program_name will exit. + Realtime monitor: This is a default. This tool with monitor discovery state of the node. Trigger 'Realtime monitor' before rebooting target node to do discovery. + Replay history: Used after discovery is finished to probe the previously completed discovery. + + [NOTE] Currently, hierarchial structure is not supported. Options: -h : Get usage information of $program_name. @@ -53,6 +56,9 @@ Options: -n : The range of predefined nodes, must be used with option -m. --noprecheck : skip pre-checking discovery to validate correct configuration. -t : The maximum time to wait when doing monitor, unit is minutes. default is 60. + -r : Trigger 'Replay history' mode. Follow the duration of rolling back. Units are 'h' (hour) or 'm' (minute) + Supported format examples: 3h30m (3 hours and 30 minutes ago), 2h (2 hours ago), 40m (40 minutes ago) and 3 (3 hours ago). + If unit is not specified, hour will be used by default. "; #---------------------------------------------- From 672f1e8bd58f096a8072986a89573e997c762807 Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 3 Nov 2016 04:21:57 -0400 Subject: [PATCH 33/43] modified depending on comments --- xCAT-genesis-scripts/bin/doxcat | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 9c052b313..fa78b4677 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -271,14 +271,19 @@ fi # rv 0 state does not work with the new ntp versions while [ "`ntpq -c 'rv 0 offset' | awk -F '=' '/offset=/ { print $2 }' | awk -F '.' '{ print $1 }' | sed s/-//`" -ge 1000 ]; do - echo `ntpq -c 'rv 0 offset` sleep 1 done -kill `cat /var/run/syslogd.pid` -sleep 3 -RSYSLOGD_VERSION=`rsyslogd -v | grep "rsyslogd" | cut -d" " -f2 | cut -d"." -f1` -if [ $RSYSLOGD_VERSION -ge 8 ]; then +read -r RSYSLOG_PID /dev/null +kill "$RSYSLOG_PID" 2>/dev/null +while kill -0 "$RSYSLOG_PID" 2>/dev/null +do + sleep 0.5 +done +unset RSYSLOG_PID + +RSYSLOGD_VERSION=`rsyslogd -v | awk '/rsyslogd/ { split($2, a, "."); print a[1]; }'` +if [ "$RSYSLOGD_VERSION" -ge 8 ]; then /sbin/rsyslogd else /sbin/rsyslogd -c4 @@ -330,7 +335,8 @@ while :; do /bin/getcert $XCATMASTER:$XCATPORT destiny='' dest='' - touch /tmp/xcatgenesisdiscovery + DISCOVERYDONE=1 + export DISCOVERYDONE elif [ "$dest" = shell ]; then logger -s -t $log_label -p local4.info "Dropping to debug shell(exit to run next destiny)..." destiny='' @@ -394,7 +400,7 @@ while :; do delay=$((30+$RANDOM%270)) while [ $delay -gt 0 ]; do if [ $((delay%10)) == 0 ]; then - if [ -e "/tmp/xcatgenesisdiscovery" ]; then + if [ $DISCOVERYDONE == 1 ]; then logger -s -t $log_label -p local4.info "Received request=$dest, will call xCAT back in $delay seconds. Discovery is complete, run nodeset on this node to provision an Operating System" else logger -s -t $log_label -p local4.info "Received request to retry in a bit, will call xCAT back in $delay seconds" From b34a916cafaeff39221a04ee83b68e28adc46860 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 3 Nov 2016 09:22:52 -0400 Subject: [PATCH 34/43] Review updates --- .../ppc64le/virtual_machines/RHEVHypervisor.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst index e8ae9fabf..5ad65df54 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst @@ -17,17 +17,17 @@ chdef -t osimage rhels7.3-ppc64le-RHEV4-install-compute \ otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA - * Create a new file ``/install/custom/rhels7.3/ppc64le/rhelv4.pkglist`` to include necessary packages provided from the OS. :: + * Create a new package list file ``/install/custom/rhels7.3/ppc64le/rhelv4.pkglist`` to include necessary packages provided from the OS. :: - #INCLUDE:/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglis# + #INCLUDE:/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist# bridge-utils - * Modify ``pkglist`` attribute to point to the file from the step above :: + * Modify ``pkglist`` attribute to point to the package list file from the step above :: chdef -t osimage rhels7.3-snap3-ppc64le-RHEV4-install-compute \ pkglist=/install/custom/rhels7.3/ppc64le/rhelv4.pkglist - * Create a new file ``/install/custom/rhels7.3/ppc64le/rhev4.otherpkgs.pkglist`` to list required packages :: + * Create a new package list file ``/install/custom/rhels7.3/ppc64le/rhev4.otherpkgs.pkglist`` to list required packages :: libvirt qemu-kvm-rhev @@ -35,7 +35,7 @@ virt-manager-common virt-install - * Modify ``otherpkglist`` attribute to point to the file from the step above :: + * Modify ``otherpkglist`` attribute to point to the package list file from the step above :: chdef -t osimage rhels7.3-snap3-ppc64le-RHEV4-install-compute \ otherpkglist=/install/custom/rhels7.3/ppc64le/rhev4.otherpkgs.pkglist From 21b77c86df0be6b5b55779ecc97e970e8117caba Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 3 Nov 2016 21:01:52 -0400 Subject: [PATCH 35/43] modified depending on comments --- xCAT-genesis-scripts/bin/doxcat | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index fa78b4677..e03df7a83 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -335,8 +335,8 @@ while :; do /bin/getcert $XCATMASTER:$XCATPORT destiny='' dest='' - DISCOVERYDONE=1 - export DISCOVERYDONE + XCAT_DISCOVERY_WAS_DONE=1 + export XCAT_DISCOVERY_WAS_DONE elif [ "$dest" = shell ]; then logger -s -t $log_label -p local4.info "Dropping to debug shell(exit to run next destiny)..." destiny='' @@ -400,7 +400,7 @@ while :; do delay=$((30+$RANDOM%270)) while [ $delay -gt 0 ]; do if [ $((delay%10)) == 0 ]; then - if [ $DISCOVERYDONE == 1 ]; then + if [ "$XCAT_DISCOVERY_WAS_DONE" == 1 ]; then logger -s -t $log_label -p local4.info "Received request=$dest, will call xCAT back in $delay seconds. Discovery is complete, run nodeset on this node to provision an Operating System" else logger -s -t $log_label -p local4.info "Received request to retry in a bit, will call xCAT back in $delay seconds" @@ -409,8 +409,8 @@ while :; do delay=$((delay-1)) sleep 1 done - destiny='' - dest='' + destiny='' + dest='' echo "Retrying "; elif [ "$dest" = shutdown ]; then logger -s -t $log_label -p local4.info "Poweroff..." From fc15887f848eab5bfbee1f3f0255b81689b73abf Mon Sep 17 00:00:00 2001 From: thiell Date: Thu, 3 Nov 2016 21:43:55 -0700 Subject: [PATCH 36/43] postscripts: add --showduplicates to yum list (#2056) "yum list" alone does NOT check the older packages available in the yum repo. If we want to install a specific package version, the --showduplicates option is required. As an example, with this patch, we can now add a specific kernel package to otherpkgs.pkglist that is older that the one available in the distro. --- xCAT/postscripts/otherpkgs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT/postscripts/otherpkgs b/xCAT/postscripts/otherpkgs index 27c934d8d..b54c5e23f 100755 --- a/xCAT/postscripts/otherpkgs +++ b/xCAT/postscripts/otherpkgs @@ -715,7 +715,7 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do fi if [ $hasyum -eq 1 ]; then #use yum - result=`yum list $fn 2>&1` + result=`yum --showduplicates list $fn 2>&1` if [ $? -eq 0 ]; then rc=0 array_set_element repo_path $index $path From ea5ffdc0bc7e9bc4175a9863d719ef59efbb3041 Mon Sep 17 00:00:00 2001 From: penguhyang Date: Fri, 4 Nov 2016 12:47:21 +0800 Subject: [PATCH 37/43] update dhcpd conf file when upgrade xcat (#2067) --- xCAT-server/sbin/xcatconfig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index e960e1640..840df68c5 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -1464,6 +1464,13 @@ sub initDB xCAT::MsgUtils->message('E', "Could not add default value for site.xcatsslversion."); } } + + # Set dhcpd.conf be updated when update xcat + my $cmds = "XCATBYPASS=Y $::XCATROOT/sbin/makedhcp -n 2>/dev/null"; + xCAT::Utils->runcmd("$cmds", -1); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message('E', "Could not create a new dhcp configuration file."); + } } # remove xcatserver,xcatclient From c51cb98c75e6d0027c7b6212e8cee10071b60ff6 Mon Sep 17 00:00:00 2001 From: penguhyang Date: Fri, 4 Nov 2016 13:22:52 +0800 Subject: [PATCH 38/43] quote date command in string (#2076) --- xCAT/postscripts/xcatinstallpost | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT/postscripts/xcatinstallpost b/xCAT/postscripts/xcatinstallpost index 32a51016e..21309a79d 100755 --- a/xCAT/postscripts/xcatinstallpost +++ b/xCAT/postscripts/xcatinstallpost @@ -43,7 +43,7 @@ while true; do if [ $RETRY -eq 90 ];then #timeout, complain and exit - msgutil_r "$MASTER_IP" "err" `date`" xcatinstallpost: Network not configured, please check..." "/var/log/xcat/xcat.log" + msgutil_r "$MASTER_IP" "err" "`date`: xcatinstallpost: Network not configured, please check..." "/var/log/xcat/xcat.log" exit 1 fi From 2751a075b6e2310b18294285438c6e2d02f56796 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 4 Nov 2016 02:32:48 -0400 Subject: [PATCH 39/43] fix bug#1528 and modify code depending on comments --- xCAT-probe/subcmds/xcatmn | 461 +++++++++++++++++++------------------- 1 file changed, 235 insertions(+), 226 deletions(-) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index f09e111b9..9fb7c68c4 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -9,14 +9,15 @@ use hierarchy; use xCAT::ServiceNodeUtils; use xCAT::NetworkUtils; use File::Basename; +use File::Copy; use Data::Dumper; use Getopt::Long qw(:config no_ignore_case); -my $help = 0; #command line attribute '-h', get usage information -my $test = 0; #command line attribute '-T' +my $help = 0; #command line attribute '-h', get usage information +my $test = 0; #command line attribute '-T' my $hierarchy = 0; -my $verbose = 0; #command line attribute '-V' -my $noderange; #command line attribute '-n' +my $verbose = 0; #command line attribute '-V' +my $noderange; #command line attribute '-n' my $output = "stdout"; #used by probe_utils->send_msg("$output", "o", "xxxxxxxxxx"); print output to STDOUT my $rst = 0; #the exit code of current command my $terminal = 0; #means get INT signal from STDIN @@ -33,7 +34,7 @@ $is_sn = 1 if (-e "/etc/xCATSN"); #------------------------------------- -# Usage +# Usage #------------------------------------- my $program_name = basename("$0"); #current sub_command name $::USAGE = "Usage: @@ -51,7 +52,7 @@ Options: "; sub do_main_job { - my $rst = 0; + my $rst = 0; my @error = (); my $checkpoint; my $rc = 0; @@ -59,97 +60,98 @@ sub do_main_job { #check if all xcat deamons are running $checkpoint = "All xCAT deamons are running"; - $rst = check_all_xcat_deamons(\@error); + $rst = check_all_xcat_deamons(\@error); print_check_result($checkpoint, "f", $rst, \@error); - return $rst if($rst); + return $rst if ($rst); - #check if xcatd can receive request + #check if xcatd can receive request $checkpoint = "xcatd can receive command request"; - $rst = check_xcatd_receive_request(\@error); + $rst = check_xcatd_receive_request(\@error); print_check_result($checkpoint, "f", $rst, \@error); - return $rst if($rst); + return $rst if ($rst); #check 'site' table configuratiions my %sitetable; $checkpoint = "'site' table is configured correctly"; - $rst = check_site_table(\%sitetable,\@error); + $rst = check_site_table(\%sitetable, \@error); print_check_result($checkpoint, "f", $rst, \@error); - return $rst if($rst); + return $rst if ($rst); #check network configuratiions $checkpoint = "Provision network is configured correctly"; - $rst = check_network(\%sitetable,\$installnicip,\@error); + $rst = check_network(\%sitetable, \$installnicip, \@error); print_check_result($checkpoint, "f", $rst, \@error); - return $rst if($rst); + return $rst if ($rst); #check 'passwd' table configuratiions $checkpoint = "'passwd' table is configured correctly"; - $rst = check_passwd_table(\@error); + $rst = check_passwd_table(\@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #check important directory $checkpoint = "Important directory is configured correctly"; - $rst = check_directory(\%sitetable,\@error); + $rst = check_directory(\%sitetable, \@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; - #check if SElinux is disabled + #check if SElinux is disabled $checkpoint = "SELinux is disabled on current server"; - $rst = check_selinux(\@error); + $rst = check_selinux(\@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #check http service $checkpoint = "HTTP service works well"; - $rst = check_http_service($installnicip, \@error); + $rst = check_http_service($installnicip, \@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #check tftp service $checkpoint = "TFTP service works well"; - $rst = check_tftp_service($installnicip,\@error); + $rst = check_tftp_service($installnicip, \@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #check DNS service $checkpoint = "DNS service works well"; - $rst = check_dns_service(\%sitetable, $installnicip,\@error); + $rst = check_dns_service(\%sitetable, $installnicip, \@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #check DHCP service $checkpoint = "DHCP service works well"; - $rst = check_dhcp_service($installnicip, \@error); + $rst = check_dhcp_service($installnicip, \@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #Below are the 'warning` level check points - #check if firewall is close + #check if firewall is close $checkpoint = "Firewall is closed on current server"; - $rst = check_firewall(\@error); + $rst = check_firewall(\@error); print_check_result($checkpoint, "w", $rst, \@error); $rc |= $rst; #check disk space - $checkpoint = "The disk space is enough for xCAT to work"; - $rst = check_disk(\@error); + $checkpoint = "The disk space is enough for xCAT to work"; + $rst = check_disk(\@error); print_check_result($checkpoint, "w", $rst, \@error); $rc |= $rst; - + #some sepecific check points in MN - if(! $is_sn){ + if (!$is_sn) { + #check if server ip is a static ip in MN $checkpoint = "The IP of master is a static IP address"; - $rst = check_server_ip_static($installnicip,\@error); + $rst = check_server_ip_static($installnicip, \@error); print_check_result($checkpoint, "w", $rst, \@error); $rc |= $rst; #check if dhcpd.leases is less than 100M $checkpoint = "The dhcpd.leases file is less than 100M"; - $rst = check_dhcp_leases(\@error); + $rst = check_dhcp_leases(\@error); print_check_result($checkpoint, "w", $rst, \@error); $rc |= $rst; } @@ -166,6 +168,7 @@ sub summary_all_jobs_output { #DO SUMMARY DEPENDING ON YOUR SUB_COMMAND NEED probe_utils->send_msg("$output", "d", "======================do summary====================="); + #print "summaryoutput:\n"; #print Dumper \%summaryoutput; @@ -180,12 +183,12 @@ sub summary_all_jobs_output { } elsif ($line =~ /(\[warning\]\s*):\s*(.*)/) { push @summary, "$1: $2"; $ok_section = 0; - } elsif($line =~ /(\[debug\]\s*):\s*(.*)/ && ! $ok_section) { + } elsif ($line =~ /(\[debug\]\s*):\s*(.*)/ && !$ok_section) { push @summary, "$1: $2"; - } elsif($line =~ /(\[ok\]\s*):\s*(.*)/) { - $ok_section=1; + } elsif ($line =~ /(\[ok\]\s*):\s*(.*)/) { + $ok_section = 1; } - + } my %summary_sn = (); @@ -203,9 +206,9 @@ sub summary_all_jobs_output { } elsif ($log =~ /(\[warning\]\s*):\s*(.*)/) { push @{ $summary_sn{$node}{"details"} }, "$1: $2"; $ok_section = 0; - } elsif ($log =~ /(\[debug\]\s*):\s*(.*)/ && ! $ok_section) { + } elsif ($log =~ /(\[debug\]\s*):\s*(.*)/ && !$ok_section) { push @{ $summary_sn{$node}{"details"} }, "$1: $2"; - } elsif ($log =~ /(\[ok\]\s*):\s*(.*)/){ + } elsif ($log =~ /(\[ok\]\s*):\s*(.*)/) { $ok_section = 1; } elsif ($log !~ /^(\[\w+\]\s*):\s*(.*)/) { push @{ $summary_sn{$node}{"details"} }, "[failed]: $log"; @@ -242,115 +245,115 @@ sub summary_all_jobs_output { } } } - + return $rst; } -sub print_check_result{ - my $msg = shift; - my $error_level = shift; +sub print_check_result { + my $msg = shift; + my $error_level = shift; my $check_return_code = shift; - my $error_msg_ref = shift; + my $error_msg_ref = shift; - if($check_return_code == 1){ + if ($check_return_code == 1) { probe_utils->send_msg("$output", "$error_level", $msg); probe_utils->send_msg("$output", "d", "$_") foreach (@$error_msg_ref); - }elsif($check_return_code ==2){ + } elsif ($check_return_code == 2) { return; - }else{ - probe_utils->send_msg("$output", "o", $msg); + } else { + probe_utils->send_msg("$output", "o", $msg); } } -sub check_all_xcat_deamons{ +sub check_all_xcat_deamons { my $error_ref = shift; my $rst = 0; @$error_ref = (); - my @deamon_list = ("SSL listener", - "DB Access", - "UDP listener", - "install monitor", - "Discovery worker", - "Command log writer"); + my @deamon_list = ("SSL listener", + "DB Access", + "UDP listener", + "install monitor", + "Discovery worker", + "Command log writer"); my $output = `ps aux|grep -v grep|grep xcatd`; - foreach my $deamon (@deamon_list){ - if($output !~ /$deamon/){ - push @$error_ref, "Deamon '$deamon' isn't running"; - $rst = 1; + foreach my $deamon (@deamon_list) { + if ($output !~ /$deamon/) { + push @$error_ref, "Deamon '$deamon' isn't running"; + $rst = 1; } } - + return $rst; } -sub check_xcatd_receive_request{ +sub check_xcatd_receive_request { my $error_ref = shift; - my $rst = 0; + my $rst = 0; @$error_ref = (); #check important port my @port_list = ("xcatdport", "xcatiport"); - foreach my $port_attr (@port_list){ + foreach my $port_attr (@port_list) { my $port = `lsdef -t site -i $port_attr -c| awk -F'=' '{print \$2}'`; - chomp($port); - if($port){ + chomp($port); + if ($port) { my $cmdoutput = `netstat -ant|grep LISTEN|grep $port`; - if($?){ + if ($?) { push @$error_ref, "Attribute '$port_attr' in site table is set to $port, but xcatd isn't listening on $port"; - $rst=1; + $rst = 1; } - }else{ + } else { push @$error_ref, "Attribute '$port_attr' isn't set in 'site' table"; $rst = 1; } } - return $rst if($rst); + return $rst if ($rst); #send one command to test if xcatd can receive request my $cmdoutput = `lsxcatd -a 2>&1`; - if($?){ - my @lines = split("[\n\r]", $cmdoutput); - push @$error_ref, $_ foreach (@lines); - $rst=1; + if ($?) { + my @lines = split("[\n\r]", $cmdoutput); + push @$error_ref, $_ foreach (@lines); + $rst = 1; } - + return $rst; } -sub check_site_table{ - my $sitetable_ref=shift; - my $error_ref = shift; +sub check_site_table { + my $sitetable_ref = shift; + my $error_ref = shift; my $rst = 0; @$error_ref = (); my @attr_list = ("master", "domain", "installdir", "tftpdir"); - foreach my $attr (@attr_list){ + foreach my $attr (@attr_list) { my $value; $value = `lsdef -t site -i $attr -c | awk -F'=' '{print \$2}'`; chomp($value); - if($value eq ""){ + if ($value eq "") { push @$error_ref, "There isn't '$attr' definition in 'site' table"; - $rst=1; - }else{ - if (($attr eq "master") and (! probe_utils->is_ip_addr("$value"))) { + $rst = 1; + } else { + if (($attr eq "master") and (!probe_utils->is_ip_addr("$value"))) { push @$error_ref, "The value of 'master' in 'site' table isn't an IP addres"; - $rst=1; + $rst = 1; } $sitetable_ref->{$attr} = $value; } } - + return $rst; } -sub check_passwd_table{ +sub check_passwd_table { my $error_ref = shift; - my $rst = 0; + my $rst = 0; @$error_ref = (); - + my $passwd = `tabdump passwd |awk -F',' '/system/ { gsub(/"/, "", \$2); gsub(/"/, "", \$3); print \$2,\$3 }'`; chomp($passwd); my ($username, $pw) = split(" ", $passwd); @@ -362,15 +365,16 @@ sub check_passwd_table{ return $rst; } -sub check_network{ - my $sitetable_ref=shift; - my $serverip_ref = shift; #output arguments - my $error_ref = shift; #output arguments +sub check_network { + my $sitetable_ref = shift; + my $serverip_ref = shift; #output arguments + my $error_ref = shift; #output arguments my $rst = 0; @$error_ref = (); - - if($is_sn){ + + if ($is_sn) { + # on SN, get ip address by compare 'master' attribute in 'site' table # choose the one in the same network with 'master' my @ipoutput = `ip addr show | grep inet | grep -v inet6 2>&1`; @@ -382,10 +386,10 @@ sub check_network{ } } if (!defined($$serverip_ref) || ($$serverip_ref eq "")) { - push @$error_ref, "There isn't IP in current server has the same network as master '$sitetable_ref->{master}'"; + push @$error_ref, "There isn't IP in current server has the same network as master '$sitetable_ref->{master}'"; $rst = 1; } - }else{ # on MN + } else { # on MN my $nics = `ip addr show $installnic >/dev/null 2>&1`; if ($?) { push @$error_ref, "There isn't NIC '$installnic' in current server"; @@ -395,8 +399,8 @@ sub check_network{ chomp($$serverip_ref); if (!defined($$serverip_ref) || ($$serverip_ref eq "")) { push @$error_ref, "There isn't IP address assigned to NIC $installnic"; - $rst =1; - }else{ + $rst = 1; + } else { if ($$serverip_ref ne $sitetable_ref->{master}) { push @$error_ref, "The IP $$serverip_ref of $installnic doesn't equal the value of 'master' in 'site' table"; $rst = 1; @@ -404,7 +408,7 @@ sub check_network{ } } } - + my $networks = `tabdump networks|grep -v "^#"`; $networks =~ s/\"//g; my $netcnt = `echo "$networks"|wc -l`; @@ -420,48 +424,48 @@ sub check_network{ } } } - if (! $hit) { + if (!$hit) { push @$error_ref, "IP $$serverip_ref of $installnic doesn't belong to any network defined in 'networks' table"; $rst = 1; } return $rst; } -sub check_server_ip_static{ - my $serverip=shift; +sub check_server_ip_static { + my $serverip = shift; my $error_ref = shift; my $rst = 0; @$error_ref = (); - if (! probe_utils->is_static_ip("$serverip", "$installnic")) { + if (!probe_utils->is_static_ip("$serverip", "$installnic")) { push @$error_ref, "The value '$serverip' of 'master' in 'site' table isn't a static ip"; - $rst=1; - } - return $rst; -} + $rst = 1; + } + return $rst; +} -sub check_directory{ - my $sitetable_ref=shift; - my $error_ref = shift; - my $rst = 0; +sub check_directory { + my $sitetable_ref = shift; + my $error_ref = shift; + my $rst = 0; @$error_ref = (); my @dir_list = ("installdir", "tftpdir"); - foreach my $dir (@dir_list){ - if($sitetable_ref->{$dir} eq ""){ - push @$error_ref, "There isn't '$dir' definition in 'site' table"; + foreach my $dir (@dir_list) { + if ($sitetable_ref->{$dir} eq "") { + push @$error_ref, "There isn't '$dir' definition in 'site' table"; $rst = 1; - }else{ - if (! -e "$sitetable_ref->{$dir}") { + } else { + if (!-e "$sitetable_ref->{$dir}") { push @$error_ref, "There isn't '$sitetable_ref->{$dir}' directory on current server"; $rst = 1; - }else{ + } else { if ($is_sn) { my $mountoutput = `mount | grep '$sitetable_ref->{$dir}'`; chomp($mountoutput); - + my $mountip; if ($mountoutput =~ /(.+):$sitetable_ref->{$dir} on $sitetable_ref->{$dir} /) { my $mountsource = $1; @@ -471,53 +475,58 @@ sub check_directory{ $mountip = xCAT::NetworkUtils->getipaddr($mountsource); } } - + if ($mountip ne $sitetable_ref->{master}) { push @$error_ref, "$dir '$sitetable_ref->{$dir}' isn't mounted from the management node"; $rst = 1; } } } - } + } } return $rst; } -sub check_disk{ +sub check_disk { my $error_ref = shift; my $rst = 0; @$error_ref = (); - #check the free space of specific directory - #if "/var" is mounted on standalone disk, more than 1G free space is expected - #if "/tmp" is mounted on standalone disk, more than 1G free space is expected - #if installdir is mounted on standalone disk, more than 10G free space is expected. - #if any one of above three directories hasn't standalone disk, "/" directory should cover its space requirement. - my @dir_expectedspace_list = (["/var", "1"], ["/tmp", "1"], ["$installdir", "10"], ["/" , "0"]); - foreach my $dir (@dir_expectedspace_list){ - next if($dir->[0] eq "/" && $dir->[1] == 0); - my $checkrst = probe_utils->is_dir_has_enough_space($dir->[0], $dir->[1]); - if($checkrst == 2){ - $dir_expectedspace_list[$#dir_expectedspace_list][1] += $dir->[1]; -# }elsif($checkrst == 1){ -# probe_utils->send_msg($outputtarget, "o", "The free space of '$dir->[0]' directory is more than $dir->[1] G"); - }elsif($checkrst == 0){ -# probe_utils->send_msg($outputtarget, "w", "The free space of '$dir->[0]' is less than $dir->[1] G"); - push @$error_ref, "The free space of '$dir->[0]' is less than $dir->[1] G"; - $rst = 1; - } + my %dir_expectedspace_list = ("/var" => 1, "/tmp" => 1, "/install" => 10); + my %mountpointinfo; + foreach my $dir (keys %dir_expectedspace_list) { + my $output = `df -k $dir|tail -n 1`; + chomp($output); + my @splitoutput = split(" ", $output); + $mountpointinfo{ $splitoutput[5] }{available} = $splitoutput[3]; + $mountpointinfo{ $splitoutput[5] }{need} += $dir_expectedspace_list{$dir} * 1048576; + push @{ $mountpointinfo{ $splitoutput[5] }{mount} }, $dir; + } + my $msg = ""; + foreach $mountpoint (keys %mountpointinfo) { + if ($mountpointinfo{$mountpoint}{need} > $mountpointinfo{$mountpoint}{available}) { + foreach (@{ $mountpointinfo{$mountpoint}{mount} }) { + $msg .= "'$_' needs $dir_expectedspace_list{$_} G, "; + } + my $size_g = $mountpointinfo{$mountpoint}{available} / 1048576; + $msg .= "These directories are mounted on '$mountpoint', the free space of '$mountpoint' is $size_g G, it isn't enough."; + $rst = 1; + } + } + if ($rst) { + push @$error_ref, "$msg"; } return $rst; } -sub check_selinux{ +sub check_selinux { my $error_ref = shift; - my $rst = 0; + my $rst = 0; @$error_ref = (); if (probe_utils->is_selinux_enable()) { @@ -530,21 +539,21 @@ sub check_selinux{ sub check_firewall { my $error_ref = shift; - my $rst = 0; + my $rst = 0; @$error_ref = (); if (probe_utils->is_firewall_open()) { push @$error_ref, "Firewall is configured on current server"; - $rst =1; + $rst = 1; } return $rst; } -sub check_http_service{ - my $serverip=shift; +sub check_http_service { + my $serverip = shift; my $error_ref = shift; - my $rst = 0; + my $rst = 0; @$error_ref = (); `which wget > /dev/null 2>&1`; @@ -552,8 +561,8 @@ sub check_http_service{ push @$error_ref, "HTTP check need 'wget' tool, please install 'wget' tool and try again"; $rst = 1; } else { - if (! probe_utils->is_http_ready("$serverip")) { - push @$error_ref, "HTTP service isn't ready on $serverip"; + if (!probe_utils->is_http_ready("$serverip")) { + push @$error_ref, "HTTP service isn't ready on $serverip"; $rst = 1; } } @@ -562,10 +571,10 @@ sub check_http_service{ } -sub check_tftp_service{ - my $serverip = shift; +sub check_tftp_service { + my $serverip = shift; my $error_ref = shift; - my $rst = 0; + my $rst = 0; @$error_ref = (); my $nodename = `hostname -s`; @@ -585,23 +594,23 @@ sub check_tftp_service{ $rst = 1; } else { $msg = "TFTP service is ready on $serverip"; - if (! probe_utils->is_tftp_ready("$serverip")) { + if (!probe_utils->is_tftp_ready("$serverip")) { push @$error_ref, "TFTP service isn't ready on $serverip"; $rst = 1; } } - }else{ + } else { $rst = 2; } return $rst; } -sub check_dns_service{ - my $sitetable_ref=shift; - my $serverip=shift; - my $error_ref = shift; - my $rst = 0; +sub check_dns_service { + my $sitetable_ref = shift; + my $serverip = shift; + my $error_ref = shift; + my $rst = 0; @$error_ref = (); my $nodename = `hostname -s`; @@ -614,7 +623,7 @@ sub check_dns_service{ $checkdns = `lsdef $nodename -i setupnameserver -c | awk -F'=' '{print \$2}'`; chomp($checkdns); } - + if ($checkdns) { `which nslookup > /dev/null 2>&1`; if ($?) { @@ -622,13 +631,15 @@ sub check_dns_service{ $rst = 1; } else { if ($is_sn) { + # on sn, nslookup it's ip to check DNS service if (!probe_utils->is_dns_ready("$serverip", "$sitetable_ref->{master}", "$nodename", "$sitetable_ref->{domain}")) { push @$error_ref, "DNS service isn't ready on $serverip"; $rst = 1; } - }else{ - my $rc=0; + } else { + my $rc = 0; + # if this is a hierarchical cluster, nslookup one of sn to check DNS service my @snlist = xCAT::ServiceNodeUtils->getAllSN(); my $sntmp = shift(@snlist); @@ -645,7 +656,7 @@ sub check_dns_service{ # if there is no sn, nslookup mnip my $nslkp = `nslookup $serverip $serverip 2>&1`; chomp($nslkp); - my $tmp = grep {$_ =~ "Server:[\t\s]*$serverip"} split (/\n/, $nslkp); + my $tmp = grep { $_ =~ "Server:[\t\s]*$serverip" } split(/\n/, $nslkp); if (!$tmp) { $rc = 1; } @@ -656,23 +667,23 @@ sub check_dns_service{ } } } - }esle{ - $rst =2; - } - + } esle { + $rst = 2; + } + return $rst; } -sub check_dhcp_service{ - my $serverip=shift; +sub check_dhcp_service { + my $serverip = shift; my $error_ref = shift; my $rst = 0; @$error_ref = (); - # For sn, 'setupdhcp' attribute could be set to '0' or '1'. + # For sn, 'setupdhcp' attribute could be set to '0' or '1'. # if '0', sn does not need to provie DHCP service, will not check it if ($is_sn) { my $nodename = `hostname -s`; @@ -680,18 +691,19 @@ sub check_dhcp_service{ my $checkdhcp = `lsdef $nodename -i setupdhcp -c | awk -F'=' '{print \$2}'`; chomp($checkdhcp); if ($checkdhcp) { + # on sn, just check dhcpd service whether running my $dhcpoutput = `ps aux | grep dhcpd |grep -v grep`; - if (! $dhcpoutput) { - push @$error_ref, "There isn't 'dhcpd' deamon in current server"; + if (!$dhcpoutput) { + push @$error_ref, "There isn't 'dhcpd' deamon in current server"; $rst = 1; } } else { $rst = 2; } } else { - my $rc = 0; - { #very important brace to create a block + my $rc = 0; + { #very important brace to create a block my @snlist = xCAT::ServiceNodeUtils->getAllSN(); my $sntmp = shift(@snlist); if ($sntmp) { @@ -705,7 +717,7 @@ sub check_dhcp_service{ chomp($tmp); my $snip = xCAT::NetworkUtils->getipaddr($sntmp); my $snmac = `lsdef $sntmp -i mac -c | awk -F'=' '{print \$2}'`; - chomp ($snmac); + chomp($snmac); my $tmpmac; if ($tmp =~ /$sntmp: ip-address = $snip, hardware-address = (.+)/) { $tmpmac = $1; @@ -749,7 +761,7 @@ sub check_dhcp_service{ $tmp = `makedhcp -q xcatmntest`; if ($?) { - push @$error_ref, "makedhcp -q xcatmntest failed"; + push @$error_ref, "makedhcp -q xcatmntest failed"; returncmdoutput($tmp, $error_ref) if ($verbose); $rc = 1; `makedhcp -d xcatmntest && rmdef xcatmntest`; @@ -768,12 +780,12 @@ sub check_dhcp_service{ $tmp = `makedhcp -d xcatmntest && rmdef xcatmntest`; returncmdoutput($tmp, $error_ref) if ($verbose); - `rm /etc/hosts`; - `mv /etc/hosts.bak.probe /etc/hosts`; + unlink "/etc/hosts"; + move("/etc/hosts.bak.probe", "/etc/hosts"); } } if ($rc) { - push @$error_ref, "Run 'makedhcp -n' if it has not been ran before."; + push @$error_ref, "Run 'makedhcp -n' if it has not been ran before."; $rst = 1; } } @@ -781,7 +793,7 @@ sub check_dhcp_service{ return $rst; } -sub check_dhcp_leases{ +sub check_dhcp_leases { my $error_ref = shift; my $rst = 0; @@ -796,25 +808,18 @@ sub check_dhcp_leases{ $leasefile = "/var/lib/dhcp/dhcpd.leases"; } - my $filesizetmp = `du -sb $leasefile`; - if ($?) { - push @$error_ref, "Got the size of '$leasefile' failed"; - returncmdoutput($filesizetmp, $error_ref) if ($verbose); + my @fileinfo = stat("$leasefile"); + if ($fileinfo[7] > 104857600) { + my $size_m = $fileinfo[7] / 1048576; + push @$error_ref, "The size of $leasefile is $size_m M, more than 100M"; $rst = 1; - } else { - chomp($filesizetmp); - my ($size, $file) = split(" ", $filesizetmp); - if ($size > 104857600) { - my $size_m = $size / 1048576; - push @$error_ref, "The size of $leasefile is $size_m M, more than 100M"; - $rst =1; - } } + return $rst; } sub returncmdoutput { - my $rst = shift; + my $rst = shift; my $error_ref = shift; chomp($rst); @@ -823,6 +828,7 @@ sub returncmdoutput { push @$error_ref, $line; } } + #------------------------------------- # Clean up test environment # ------------------------------------- @@ -832,10 +838,11 @@ sub cleanup { `makedhcp -d xcatmntest && rmdef xcatmntest > /dev/null 2>&1`; } if (-e "/etc/hosts.bak.probe") { - `rm /etc/hosts > /dev/null 2>&1`; - `mv /etc/hosts.bak.probe /etc/hosts > /dev/null 2>&1`; + unlink "/etc/hosts"; + move("/etc/hosts.bak.probe", "/etc/hosts"); } } + #------------------------------------- # main process #------------------------------------- @@ -881,60 +888,62 @@ if ($hierarchy || $is_sn) { my @error; my $hierarchy_instance = hierarchy->new(); $rst = $hierarchy_instance->dispatch_cmd($noderange, \@tmpargv, \@error); -if($rst){ - probe_utils->send_msg("$output", "f", "Calculate dispatch command failed"); - foreach (@error){ - probe_utils->send_msg("$output", "", "$_"); - } - if($hierarchy_instance->destory(\@error)){ - probe_utils->send_msg("$output", "", "$_") foreach(@error); - } - exit $rst; +if ($rst) { + probe_utils->send_msg("$output", "f", "Calculate dispatch command failed"); + foreach (@error) { + probe_utils->send_msg("$output", "", "$_"); + } + if ($hierarchy_instance->destory(\@error)) { + probe_utils->send_msg("$output", "", "$_") foreach (@error); + } + exit $rst; } my %reply_cache; -while($hierarchy_instance->read_reply(\%reply_cache)){ - foreach my $servers (keys %reply_cache){ #Dispatch_cmd may use SN range to dispatch cms to SNs at one time +while ($hierarchy_instance->read_reply(\%reply_cache)) { + foreach my $servers (keys %reply_cache) { #Dispatch_cmd may use SN range to dispatch cms to SNs at one time my @server_array = split(",", $servers); - foreach my $server (@server_array){ - foreach (@{$reply_cache{$servers}}){ - my $msg = ""; - my $logmsg=""; - - #For cases like below: + foreach my $server (@server_array) { + foreach (@{ $reply_cache{$servers} }) { + my $msg = ""; + my $logmsg = ""; + + #For cases like below: #c910f02c04p04: [ok] :All xCAT deamons are running - if($reply_cache{$servers}->[$_] =~ /^(\w+)\s*:\s*(\[\w+\]\s*):\s*(.*)/){ - if("$1" eq "$server"){ + if ($reply_cache{$servers}->[$_] =~ /^(\w+)\s*:\s*(\[\w+\]\s*):\s*(.*)/) { + if ("$1" eq "$server") { $logmsg = "$2: $3"; - $msg = "$2:<$server>: $3"; + $msg = "$2:<$server>: $3"; } - #For cases like below: - #c910f02c04p05: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! - }elsif($reply_cache{$servers}->[$_] =~ /^(\w+)\s*:\s*(.*)/){ - if("$1" eq "$server"){ + + #For cases like below: + #c910f02c04p05: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! + } elsif ($reply_cache{$servers}->[$_] =~ /^(\w+)\s*:\s*(.*)/) { + if ("$1" eq "$server") { $logmsg = "$2"; - $msg = "<$server>: $2"; + $msg = "<$server>: $2"; } - #For cases like below: - #Unable to open socket connection to xcatd daemon on localhost:3001. - }else{ - if(length($reply_cache{$servers}->[$_])){ + + #For cases like below: + #Unable to open socket connection to xcatd daemon on localhost:3001. + } else { + if (length($reply_cache{$servers}->[$_])) { $logmsg = $reply_cache{$servers}->[$_]; $msg = "[failed] :[$server]: $reply_cache{$servers}->[$_]"; } } - probe_utils->send_msg("$output", "", "$msg") if(length($msg)); - push @{$summaryoutput{$server}},$logmsg if(length($logmsg)); + probe_utils->send_msg("$output", "", "$msg") if (length($msg)); + push @{ $summaryoutput{$server} }, $logmsg if (length($logmsg)); } } } - if($terminal){ - last; + if ($terminal) { + last; } } -if($hierarchy_instance->destory(\@error)){ - probe_utils->send_msg("$output", "", "$_") foreach(@error); +if ($hierarchy_instance->destory(\@error)) { + probe_utils->send_msg("$output", "", "$_") foreach (@error); } #------------------------------------- From 0a0615139c60100c7ffc4e973f76ce66e59367f8 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 4 Nov 2016 03:19:38 -0400 Subject: [PATCH 40/43] modify depending on comments --- xCAT-probe/subcmds/xcatmn | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index 9fb7c68c4..e30f54650 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -498,11 +498,11 @@ sub check_disk { my %dir_expectedspace_list = ("/var" => 1, "/tmp" => 1, "/install" => 10); my %mountpointinfo; foreach my $dir (keys %dir_expectedspace_list) { - my $output = `df -k $dir|tail -n 1`; + my $output = `df --block-size=1G $dir|tail -n 1`; chomp($output); my @splitoutput = split(" ", $output); $mountpointinfo{ $splitoutput[5] }{available} = $splitoutput[3]; - $mountpointinfo{ $splitoutput[5] }{need} += $dir_expectedspace_list{$dir} * 1048576; + $mountpointinfo{ $splitoutput[5] }{need} += $dir_expectedspace_list{$dir}; push @{ $mountpointinfo{ $splitoutput[5] }{mount} }, $dir; } @@ -512,8 +512,7 @@ sub check_disk { foreach (@{ $mountpointinfo{$mountpoint}{mount} }) { $msg .= "'$_' needs $dir_expectedspace_list{$_} G, "; } - my $size_g = $mountpointinfo{$mountpoint}{available} / 1048576; - $msg .= "These directories are mounted on '$mountpoint', the free space of '$mountpoint' is $size_g G, it isn't enough."; + $msg .= "These directories are mounted on '$mountpoint', the free space of '$mountpoint' is $mountpointinfo{$mountpoint}{available} G, it isn't enough."; $rst = 1; } } From 66bc88169f1e2bcf0f3eb41067b704e6d7dc43cc Mon Sep 17 00:00:00 2001 From: XuWei Date: Fri, 4 Nov 2016 03:51:48 -0400 Subject: [PATCH 41/43] delete extra functions in probe_utils --- xCAT-probe/lib/perl/probe_utils.pm | 107 ----------------------------- 1 file changed, 107 deletions(-) diff --git a/xCAT-probe/lib/perl/probe_utils.pm b/xCAT-probe/lib/perl/probe_utils.pm index e99845562..db96fdc24 100644 --- a/xCAT-probe/lib/perl/probe_utils.pm +++ b/xCAT-probe/lib/perl/probe_utils.pm @@ -354,32 +354,6 @@ sub is_dns_ready { #------------------------------------------ -=head3 - Description: - Convert host name to ip address - Arguments: - hostname: The hostname need to convert - Returns: - ip: The ip address -=cut - -#------------------------------------------ -sub get_ip_from_hostname { - my $hostname = shift; - $hostname = shift if (($hostname) && ($hostname =~ /probe_utils/)); - my $ip = ""; - - my @output = `ping -c 1 $hostname 2>&1`; - if (!$?) { - if ($output[0] =~ /^PING.+\s+\((\d+\.\d+\.\d+\.\d+)\).+/) { - $ip = $1; - } - } - return $ip; -} - -#------------------------------------------ - =head3 Description: Calculate network address from ip and netmask @@ -409,45 +383,6 @@ sub get_network { #------------------------------------------ -=head3 - Description: - Convert ip to hostname - Arguments: - ip: The ip need to convert - Returns: - hostname: hostname or "" -=cut - -#------------------------------------------ -sub get_hostname_from_ip { - my $ip = shift; - $ip = shift if (($ip) && ($ip =~ /probe_utils/)); - my $dns_server = shift; - my $hostname = ""; - my $output = ""; - - `which nslookup > /dev/null 2>&1`; - if (!$?) { - $output = `nslookup $ip $dns_server 2>&1`; - if (!$?) { - chomp($output); - my $rc = $hostname = `echo "$output"|awk -F" " '/name =/ {print \$4}'|awk -F"." '{print \$1}'`; - chomp($hostname); - return $hostname if (!$rc); - } - } - if (($hostname eq "") && (-e "/etc/hosts")) { - $output = `cat /etc/hosts 2>&1 |grep $ip`; - if (!$?) { - my @splitoutput = split(" ", $output); - $hostname = $splitoutput[1]; - } - } - return $hostname; -} - -#------------------------------------------ - =head3 Description: Check if the free space of specific directory is more than expected value @@ -482,48 +417,6 @@ sub is_dir_has_enough_space{ return 2; } -#------------------------------------------ - -=head3 - Description: - Convert input time format to the number of non-leap seconds since whatever time the system considers to be the epoch - the format of input time are two kinds - one like "Aug 15 02:43:31", another likes "15/Aug/2016:01:10:24" - Arguments: - timestr: the time format need to be converted - yday: the year of current time. - Returns: - the number of non-leap seconds since whatever time the system considers to be the epoch -=cut - -#------------------------------------------ -sub convert_to_epoch_seconds { - my $timestr=shift; - $timestr = shift if (($timestr) && ($timestr =~ /probe_utils/)); - my $yday=shift; - my $ref_seconds=shift; - my $mday; - my $dday; - my $h; - my $m; - my $s; - my $epoch_seconds=-1; - my %monthsmap = ("Jan"=>0,"Feb"=>1,"Mar"=>2,"Apr"=>3,"May"=>4,"Jun"=>5,"Jul"=>6,"Aug"=>7,"Sep"=>8,"Oct"=>9,"Nov"=>10,"Dec"=>11); - - if($timestr =~/(\w+)\s+(\d+)\s+(\d+):(\d+):(\d+)/){ - ($mday,$dday,$h,$m,$s)=($1,$2,$3,$4,$5); - $epoch_seconds = timelocal($s,$m,$h,$dday,$monthsmap{$mday},$yday); - if($epoch_seconds>$ref_seconds){ - $yday-=1; - $epoch_seconds = timelocal($s,$m,$h,$dday,$monthsmap{$mday},$yday); - } - }elsif($timestr =~ /(\d+)\/(\w+)\/(\d+):(\d+):(\d+):(\d+)/){ - $epoch_seconds = timelocal($6,$5,$4,$1,$monthsmap{$2},($3-1900)); - } - return $epoch_seconds; -} - - #------------------------------------------ =head3 From 6450ef2ab6c290389f650f304b5951bd2659d2a6 Mon Sep 17 00:00:00 2001 From: tingtli Date: Sat, 5 Nov 2016 16:58:21 +0800 Subject: [PATCH 42/43] update to add more debug information before rmvm is executed (#2086) --- .../get_install_disk/fresh_install_disk | 1 + .../Diskless_installation_flat_p8_le | 2 ++ .../testcase/installation/SN_setup_case | 2 +- .../reg_linux_SN_installation_hierarchy | 2 ++ .../reg_linux_diskfull_installation_flat | 2 ++ .../ubuntu_diskless_installation_vm | 2 ++ .../ubuntu_full_installation_vm_docker | 2 ++ .../testcase/migration/.redhat_migration.swp | Bin 0 -> 16384 bytes .../testcase/migration/redhat_migration | 4 ++++ .../autotest/testcase/migration/sles_migration | 4 ++++ 10 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 xCAT-test/autotest/testcase/migration/.redhat_migration.swp diff --git a/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk b/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk index 888e8fece..b79bab100 100644 --- a/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk +++ b/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk @@ -4,6 +4,7 @@ description:check fresh install disk, usded for x86 multi disk only, and not che cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=100" cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=300 seek=60858" +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata |grep -i $$CN; fi cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi check:rc=0 cmd:makedns -n diff --git a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le index 07052ec7e..c298b2319 100644 --- a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le @@ -3,6 +3,8 @@ os:Linux cmd:copycds $$ISO check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi +check:rc==0 cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi check:rc==0 cmd:makedns -n diff --git a/xCAT-test/autotest/testcase/installation/SN_setup_case b/xCAT-test/autotest/testcase/installation/SN_setup_case index 2b32fc850..87db2d52d 100644 --- a/xCAT-test/autotest/testcase/installation/SN_setup_case +++ b/xCAT-test/autotest/testcase/installation/SN_setup_case @@ -9,7 +9,7 @@ cmd:chtab key=nameservers site.value="" check:rc==0 #cmd:if [ "__GETNODEATTR($$SN,arch)__" != "ppc64" -a "__GETNODEATTR($$SN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$SN,vmstorage)__" =~ "phy" ]]; then rmvm $$SN -f -p && mkvm $$SN; else rmvm $$SN -f -p && mkvm $$SN -s 20G; fi;fi #Add for debug rmvm issue -cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$SN kvm_nodedata |grep -i $$SN; fi +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$SN kvm_nodedata; fi check:rc==0 cmd:if [ "__GETNODEATTR($$SN,arch)__" != "ppc64" -a "__GETNODEATTR($$SN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$SN,vmstorage)__" =~ "phy" ]]; then rmvm $$SN -f -p && mkvm $$SN; else rmvm $$SN -f -p;mkvm $$SN;rmvm $$SN -f -p;mkvm $$SN -s 20G; fi;fi check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy index a5ec315bc..56f0d2c20 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy @@ -3,6 +3,8 @@ os:Linux cmd:chtab key=nameservers site.value="" check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$SN kvm_nodedata; fi +check:rc==0 cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "x86_64" ]];then rmvm $$SN -f -p && mkvm $$SN -s 40G; fi cmd:makedns -n diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index 242c77ea3..48b56899f 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -5,6 +5,8 @@ cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi +check:rc==0 cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi check:rc=0 cmd:makedns -n diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm index 7ae29b85a..5ada5a6ca 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm +++ b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm @@ -3,6 +3,8 @@ os:Linux cmd:copycds $$ISO check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi +check:rc=0 cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi check:rc=0 cmd:makedns -n diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker index cca833817..c1c077691 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker +++ b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker @@ -2,6 +2,8 @@ start:Full_installation_flat_docker os:Linux cmd:copycds $$ISO check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi +check:rc==0 cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi check:rc=0 cmd:makedns -n diff --git a/xCAT-test/autotest/testcase/migration/.redhat_migration.swp b/xCAT-test/autotest/testcase/migration/.redhat_migration.swp new file mode 100644 index 0000000000000000000000000000000000000000..89bebd163186eb8143ce40adb6f1d997edc02df0 GIT binary patch literal 16384 zcmeHNO>7)V6|Tf_He}<;5)c9j(90ysCf@Y)j1w8~FoBR*Sxbq7Z0`!O8#y)IH8YL- zPt`qkyo!JmLfk-t8=N@7fdfJauE4H99MG;Y;*`60$+6s4;8u#fYpRk^Z5+ z9G(a}@cNRcUKH9=xC5SUjtUMl$lNy!7zU;=FsI9!t%YlJzJB4{2VR&`#}pX`3GHFkl!k3>XFs1MgJ^;*`y>uZ((kJpa|rug7pzVE@fOdAXNg9bC)z|C5)W%dfvJ z?&tr_#V}wPFbo(53GHFkl!k3>XFs1BQVoz<|rOQo=U=m-+xeW&`&BXa5Ae z4fFs3e4Me`Pk|o*&jX)kZ0<+E*MY|XUh~gE+T0zW4b%agA~^FG;E%xXfG+~8zztvl zK%FzF^Yp&~)O-3W@DboC#!mkW_#W^rKmxGi^amMx->bmSf%gNmjGg*B@CN|0PeJ#o zOTbCSp86~B7VtXo6X4rG0`!5;0gJ#1#!mhN_!aOo;Hv=6Je*tt8jQ`tu36YM3;nau zKZ|1$vzHk=@lW8-z#G78!1n<>ML7ZaCmsMF2F@@x^EUt-&cKG5?*QKb)&bZ#gMQDP zX6*Qzz;A%>0^bBsejMe;z?bsLv0r2^Ir!Td2xn_aI-O3FIf1+M$V~=x@#3vjs_za1 za(ux<3Pj3Xp7ORTvUX`0#YT50E9c=lL!+j~@sF4gR%}BW< z>r0Qedo(g+zJbC<_mzdphU50DgD3AuG4!gomW+eMNG)nad{hW5w98=_dSSmR&=MiHJx7o_Ammb#@^qL?iUEZych+uh ztlVF1ZN9j?wvHcFGW{fzW^EUerjC>(8cJxkMe5kGjC!6g8m{)#VPUy9#<=en!^;a{ zz3-D6U6p!OY(~DTY#hbKlNny)X6WNt?`&|6bw|mWC+pUzmz8XkhWMBi5Ej2y1kIOb$@NS(uV5hx0gR(**Z_Jh5x&+cyV=d3btGic`YszG@isI61GJ0$r&ls z7vt(>_hol!^i?qwRKm}17j3)9>cZ9eKqmpR{A}iUjG-*zddYxU?=;&x0}LfPPY=fwJT8gPerKl84cislb~yC?hi!5rN_+u3TFv(5 z%lx_Lu3Tw*J$i{QaLW?+d7O#(*$WWxJ&ziEf@Do8Yj&_8a zBrtWWTdF$;-I!|hOH^g`p3x85q)C%W$p(T!ZR&Xw-kw5(p5m=3H}c+EdGzCqXMl;P z2)ezzo4H2!Gjl#N?lx8^g9x!W;S4q7z|4#l%rOD)i_R3?@7gFQigz71fufc5`x7K6 zQ+3e5(a6-vlGVbnIf_7X$ksAC4U8M4{@xkPW9-B#6w@6EUdzKdOwnQ!5oz zhCG0)Dya-%^nSKv;$WdZCA7i3T2os)MF>tG=c8PssLGQKJa%+ivz!oYXGxtbtoUN0 zOP7d(tx;h@3(Y&FJh2x`%G*b`>_L%)Qr>lk0b*-MuO&Mj#V$eNrW*Qs&!Rkgp_~{l zs08m!E=qO7+zqO2hl0Yx5PENw!d{X&Jo}sW(zyIzuR8;tq(bTn&XB{IorwB=)a5?KTq4+DE@64@g$O$@Bm`>D>w_|1uqau&tJdO7kL#t$gY+$y z?f>U~i2eN8(*FM(_WRh|p2gnw>|Nlq0QS^1?0aj!2YwCw7{H#j_B8-|;~Mtgwa)<8 z0PNFi&j65Fs~x;^HFpdHh5^HXVZbn87%&VN1`Gp+0mFb{;7Ktc!r}>B@rZbG8@lfy zPw92z5#P0_y*VCgtBZPvH2FZgDA!Lr#-x{CQx)dD%eP8Hq)$ literal 0 HcmV?d00001 diff --git a/xCAT-test/autotest/testcase/migration/redhat_migration b/xCAT-test/autotest/testcase/migration/redhat_migration index a0495ec39..30882049f 100644 --- a/xCAT-test/autotest/testcase/migration/redhat_migration +++ b/xCAT-test/autotest/testcase/migration/redhat_migration @@ -5,6 +5,8 @@ description:update xCAT from $$MIGRATION1_VERSION to $$LATEST_VERSION, these two #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN #check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi +check:rc==0 cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then rmvm $$CN -f -p && mkvm $$CN -s 20G; fi cmd:rscan __GETNODEATTR($$CN,hcp)__ -w check:rc==0 @@ -114,6 +116,8 @@ stop:yes #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN #check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi +check:rc==0 cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then rmvm $$CN -f -p && mkvm $$CN -s 20G; fi cmd:rscan __GETNODEATTR($$CN,hcp)__ -w check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/sles_migration b/xCAT-test/autotest/testcase/migration/sles_migration index a8cc0c51d..91fec010c 100644 --- a/xCAT-test/autotest/testcase/migration/sles_migration +++ b/xCAT-test/autotest/testcase/migration/sles_migration @@ -5,6 +5,8 @@ description:update xCAT from $$MIGRATION1_VERSION to $$LATEST_VERSION, these two #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN #check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi +check:rc==0 cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then rmvm $$CN -f -p && mkvm $$CN -s 20G; fi cmd:rscan __GETNODEATTR($$CN,hcp)__ -w check:rc==0 @@ -116,6 +118,8 @@ description:update xCAT from $$MIGRATION22VERSION to $$LATEST_VERSION, these two #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN #check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi +check:rc==0 cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then rmvm $$CN -f -p && mkvm $$CN -s 20G; fi cmd:rscan __GETNODEATTR($$CN,hcp)__ -w check:rc==0 From 1446ee33d749872d89def726f00d0d7690bc4264 Mon Sep 17 00:00:00 2001 From: penguhyang Date: Mon, 7 Nov 2016 15:53:40 +0800 Subject: [PATCH 43/43] fix utilities required for statelite missing from sles initrd (#2093) --- xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite | 2 +- xCAT-server/share/xcat/netboot/sles/genimage | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite b/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite index 1fc3f2222..49e2fb3f1 100755 --- a/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite +++ b/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite @@ -457,7 +457,7 @@ ProcessType () { # before mount, need to check whether it exists or not STRPATH="${TMPFS}${2}" STRLEN=${#STRPATH} - CHAREND=`echo ${STRPATH} | /bin/cut -c${STRLEN}` + CHAREND=`echo ${STRPATH} | /usr/bin/cut -c${STRLEN}` if [ "${CHAREND}" = "/" ]; then # it is one directory if [ ! -d ${STRPATH} ]; then diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 01884a946..c8edb667d 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -1791,7 +1791,7 @@ EOMS } } if ($mode eq "statelite") { - foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "bin/hostname", "usr/bin/egrep", "bin/ln", "bin/ls", "usr/bin/dirname", "usr/bin/expr", "usr/bin/chroot", "usr/bin/grep", "bin/cpio", "bin/sleep", "bin/mount", "bin/umount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "usr/bin/wc", "bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/xz", "usr/bin/gzip", "bin/tar") { + foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "usr/bin/cut", "usr/bin/rm", "bin/hostname", "usr/bin/egrep", "bin/ln", "bin/ls", "usr/bin/dirname", "usr/bin/expr", "usr/bin/chroot", "usr/bin/grep", "bin/cpio", "bin/sleep", "bin/mount", "bin/umount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "usr/bin/wc", "bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/xz", "usr/bin/gzip", "bin/tar") { getlibs($_); push @filestoadd, $_; }