diff --git a/.gitignore b/.gitignore index 893951706..4767b51c3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ docs/build # Ignore the temporary file for creating the Release version Release.save* +# ignore the old generated man pages and html pages +xCAT-client/share/man +xCAT-client/share/doc diff --git a/README.rst b/README.rst index 883a8aeb8..d7f1ae9f6 100644 --- a/README.rst +++ b/README.rst @@ -8,7 +8,7 @@ Documentation xCAT documentation is available at: http://xcat-docs.readthedocs.io/en/latest/ -|docs_latest| |docs_2131| |docs_2130| |docs_212| |docs_211| +|docs_latest| |docs_2132| |docs_2131| |docs_2130| |docs_212| |docs_211| Open Source License ------------------- @@ -22,6 +22,11 @@ Developers Developers and prospective contributors are encouraged to read the `Developers Guide `_ In particular the `GitHub `_ related subsection. +.. |docs_2132| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.2 + :alt: 2.13.2 documentation status + :scale: 100% + :target: http://xcat-docs.readthedocs.io/en/2.13.2/ + .. |docs_2131| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.1 :alt: 2.13.1 documentation status :scale: 100% diff --git a/Version b/Version index 0e83a9a9c..a1a4224dd 100644 --- a/Version +++ b/Version @@ -1 +1 @@ -2.13.2 +2.13.3 diff --git a/docs/source/advanced/cluster_maintenance/compute_node/index.rst b/docs/source/advanced/cluster_maintenance/compute_node/index.rst index 6199699e6..87bc1c733 100644 --- a/docs/source/advanced/cluster_maintenance/compute_node/index.rst +++ b/docs/source/advanced/cluster_maintenance/compute_node/index.rst @@ -5,3 +5,4 @@ Compute Node :maxdepth: 2 changing_hostname_ip.rst + replace/index.rst diff --git a/docs/source/advanced/cluster_maintenance/compute_node/replace/index.rst b/docs/source/advanced/cluster_maintenance/compute_node/replace/index.rst new file mode 100644 index 000000000..7346fb246 --- /dev/null +++ b/docs/source/advanced/cluster_maintenance/compute_node/replace/index.rst @@ -0,0 +1,7 @@ +Replacing Nodes +=============== + +.. toctree:: + :maxdepth: 2 + + openpower.rst diff --git a/docs/source/advanced/cluster_maintenance/compute_node/replace/openpower.rst b/docs/source/advanced/cluster_maintenance/compute_node/replace/openpower.rst new file mode 100644 index 000000000..6e17f9947 --- /dev/null +++ b/docs/source/advanced/cluster_maintenance/compute_node/replace/openpower.rst @@ -0,0 +1,38 @@ +OpenPower Nodes +=============== + + +When compute nodes are physically replaced in the frame, leverage xCAT to re-discover the compute nodes. The following guide can be used for: + + * IBM OpenPower S822LC for HPC + + +#. Identify the machine(s) to be replaced: ``frame10cn02``. + +#. [**Optional**] It's recommended to set the BMC IP address back to DHCP, if it was set to STATIC. :: + + rspconfig frame10cn02 ip=dhcp + +#. Set the outgoing machine to ``offline`` and remove attributes of the machine: :: + + nodeset frame10cn02 offline + chdef frame10cn02 mac="" + +#. If using **MTMS**-based discovery, fill in the Model-Type and Serial Number for the machine: :: + + chdef frame10cn02 mtm=8335-GTB serial= + +#. If using **SWITCH**-based discovery, go on to the next step. The ``switch`` and ``switch-port`` should already be set in the compute node definition. + + Node attributes will be replaced during the discovery process (mtm, serial, mac, etc.) + +#. Search for the new BMC in the open range: :: + + bmcdiscover --range -w -z + +#. When the BMC is found, start the discovery with the following commands: :: + + rsetboot /node-8335.* net + rpower /node-8335.* boot + + diff --git a/docs/source/advanced/hierarchy/define_service_nodes.rst b/docs/source/advanced/hierarchy/define_service_nodes.rst index aa9b64171..d35427e73 100644 --- a/docs/source/advanced/hierarchy/define_service_nodes.rst +++ b/docs/source/advanced/hierarchy/define_service_nodes.rst @@ -28,6 +28,11 @@ The following table illustrates the cluster being used in this example: | | r2n10 | +----------------------+----------------------+ + +#. Modify ``site`` table attribute to include **service** group's postscripts in compute node definition: :: + + chdef -t site hierarchicalattrs="postscripts" + #. Select the compute nodes that will become service nodes The first node in each rack, ``r1n01`` and ``r2n01``, is selected to become the xCAT service nodes and manage the compute nodes in that rack diff --git a/docs/source/advanced/hierarchy/provision/diskful_sn.rst b/docs/source/advanced/hierarchy/provision/diskful_sn.rst index 1574c2104..972a81712 100644 --- a/docs/source/advanced/hierarchy/provision/diskful_sn.rst +++ b/docs/source/advanced/hierarchy/provision/diskful_sn.rst @@ -9,7 +9,7 @@ Any cluster using statelite compute nodes must use a stateful (diskful) Service **Note:** All xCAT Service Nodes must be at the exact same xCAT version as the xCAT Management Node. Configure ``otherpkgdir`` and ``otherpkglist`` for service node osimage ----------------------------------------------------------------------- +----------------------------------------------------------------------- * Create a subdirectory ``xcat`` under a path specified by ``otherpkgdir`` attribute of the service node os image, selected during the :doc:`../define_service_nodes` step. diff --git a/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst b/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst index 5634eeaea..0f3ce1184 100644 --- a/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst +++ b/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst @@ -16,11 +16,12 @@ There may be occasions where a re-install of the OS is required. Assuming the * **[use xCAT]** ``xdsh`` can be used to invoke the reinstall of the OS: :: + # to clear out all the previous configuration, use the -k option (optional) + xdsh "/usr/cumulus/bin/onie-select -k + + # to invoke the reinstall of the OS xdsh "/usr/cumulus/bin/onie-select -i -f;reboot" - # to clear out all the previous configuration, use the -k option - xdsh "/usr/cumulus/bin/onie-select -k -f;reboot" - * **[manually]** Log into the Cumulus OS switch and run the following commands: :: sudo onie-select -i diff --git a/docs/source/advanced/pdu/pdu.rst b/docs/source/advanced/pdu/pdu.rst index 781a7dbc9..a8566b5f8 100644 --- a/docs/source/advanced/pdu/pdu.rst +++ b/docs/source/advanced/pdu/pdu.rst @@ -63,6 +63,12 @@ The following commands are supported against a compute node: cn01: f5pdu3 outlet 6 is on cn01: f5pdu3 outlet 7 is on + * Power cycling the PDU outlets on a compute node: :: + + # rpower cn01 pdureset + cn01: f5pdu3 outlet 6 is reset + cn01: f5pdu3 outlet 7 is reset + The following commands are supported against a PDU: * Check the status of the full PDU: :: @@ -98,7 +104,7 @@ The following commands are supported against a PDU: f5pdu3: outlet 12 is off * Power on the full PDU: :: - + # rpower f5pdu3 on f5pdu3: outlet 1 is on f5pdu3: outlet 2 is on @@ -112,6 +118,22 @@ The following commands are supported against a PDU: f5pdu3: outlet 10 is on f5pdu3: outlet 11 is on f5pdu3: outlet 12 is on + + * Power reset the full PDU: :: + + # rpower f5pdu3 reset + f5pdu3: outlet 1 is reset + f5pdu3: outlet 2 is reset + f5pdu3: outlet 3 is reset + f5pdu3: outlet 4 is reset + f5pdu3: outlet 5 is reset + f5pdu3: outlet 6 is reset + f5pdu3: outlet 7 is reset + f5pdu3: outlet 8 is reset + f5pdu3: outlet 9 is reset + f5pdu3: outlet 10 is reset + f5pdu3: outlet 11 is reset + f5pdu3: outlet 12 is reset **Note:** For BMC based compute nodes, turning the PDU outlet power on does not automatically power on the compute side. Users will need to issue ``rpower on`` to power on the compute node after the BMC boots. diff --git a/docs/source/advanced/security/certs.rst b/docs/source/advanced/security/certs.rst new file mode 100644 index 000000000..f23fe1a83 --- /dev/null +++ b/docs/source/advanced/security/certs.rst @@ -0,0 +1,63 @@ +The SSL Certificates in xCAT +---------------------------- + + +The xCAT daemon on the management node and service node listens on a SSL socket on port 3001, the communications on the SSL socket include: + + 1. the xCAT requests from xCAT Clients + 2. the xCAT requests forwarded from other xCAT daemons, for example, the requests forwarded between xCAT daemons on management node and service nodes + 3. some special xCAT requests from compute nodes, such as ``getcredentials``, ``getpostscript``, ``litefile``, etc. + +xCAT creates 1 CA certificate and 2 credentials (private key and certificate pairs): + + 1. xCAT CA certificate(ca.pem): + + * a self-signed certificate used as Certificate Authority in xcatd SSL communication; + * generated by ``/opt/xcat/share/xcat/scripts/setup-xcat-ca.sh`` script on xCAT installation; + * will be generated (or updated) on xCAT management node when: + * install or update xCAT when "/etc/xcat/ca" directory does not exist + * or run ``xcatconfig -f|--force`` + * or run ``xcatconfig -c|--credentials`` + * files on management node: + * ``/etc/xcat/ca/ca-cert.pem`` + * ``/etc/xcat/cert/ca.pem`` ,copied by ``/opt/xcat/share/xcat/scripts/setup-server-cert.sh`` + * ``/root/.xcat/ca.pem`` ,copied by ``/opt/xcat/share/xcat/scripts/setup-local-client.sh`` + * file on service node: ``/root/.xcat/ca.pem`` + * distribution path: + **/etc/xcat/cert/ca.pem (MN)** ===(run ``xcatconfig`` command)===> **/install/postscripts/_xcat/ca.pem (MN)** ===(node provision/updatenode)==> **/xcatpost/_xcat/ca.pem (SN and CN)** ==(run "servicenode" postscript)==> **/root/.xcat/ca.pem (SN)** + + 2. xCAT server credential(server-cred.pem): + + * a concatenation of server private key and certificate(signed with xCAT CA certificate) + * generated by ``/opt/xcat/share/xcat/scripts/setup-server-cert.sh`` on xCAT installation; + * will be generated (or updated) on xCAT management node when: + * install or update xCAT when ``/etc/xcat/cert`` directory does not exist + * or run ``xcatconfig -f|--force`` + * or run ``xcatconfig -c|--credentials`` + * file on management node: ``/etc/xcat/cert/server-cred.pem`` + * file on service node: ``/etc/xcat/cert/server-cred.pem`` + * distribution path: + **/etc/xcat/cert/server-cred.pem (MN)** ==(run ``xcatserver`` script called by ``servicenode`` postscript)===> **/etc/xcat/cert/server-cred.pem(SN)** + + 3. xCAT client credential(client-cred.pem): + + * a concatenation of client private key and certificate (signed with xCAT CA certificate) + * generated by ``/opt/xcat/share/xcat/scripts/setup-local-client.sh`` on xCAT installation + * will be generated (or updated) on xCAT management node when: + * install or update xCAT when ``/root/.xcat/client-key.pem`` does not exist; + * or run ``xcatconfig -f|--force`` + * or run ``xcatconfig -c|--credentials`` + * file on management node: ``/root/.xcat/client-cred.pem`` + * file on service node: ``/root/.xcat/client-cred.pem`` + * distribution path: + **/root/.xcat/client-cred.pem (MN)** ===(run ``xcatclient`` script called by ``servicenode`` postscript")===> **/root/.xcat/client-cred.pem(SN)** + +The usage of the credentials in the xCAT SSL communication is: + + .. image:: ./imgs/certs.png + :height: 500 px + :width: 600 px + :scale: 100 % + :alt: alternate text + :align: center + diff --git a/docs/source/advanced/security/imgs/certs.png b/docs/source/advanced/security/imgs/certs.png new file mode 100644 index 000000000..4f727c5d7 Binary files /dev/null and b/docs/source/advanced/security/imgs/certs.png differ diff --git a/docs/source/advanced/security/security.rst b/docs/source/advanced/security/security.rst index a0be534ed..32d9b9c4e 100644 --- a/docs/source/advanced/security/security.rst +++ b/docs/source/advanced/security/security.rst @@ -4,52 +4,40 @@ Transmission Channel The xCAT daemon uses SSL to only allow authorized users to run xCAT commands. All xCAT commands are initiated as an xCAT **client**, even when run commands from the xCAT management node. This **client** opens an SSL socket to the xCAT daemon, sends the command and receives responses through this one socket. xCAT has configured the certificate for root, if you nee to authorize other users, refer to the section below. -Create SSL Certificate So That User Can Be Authenticated By xCAT -```````````````````````````````````````````````````````````````` - -Running the following command on the Management node as root: :: - - /opt/xcat/share/xcat/scripts/setup-local-client.sh - -By running this command you'll see SSL certificates are creating, enter ``yes`` where prompted and take the defaults. - -This will create the following files in the 's ``$HOME/.xcat`` directory: :: - - ca.pem - client-cert.pem - client-cred.pem - client-key.pem - client-req.pem +.. toctree:: + :maxdepth: 2 + certs.rst Commands Access Control ----------------------- Except SSL channel, xCAT only authorize root on the management node to run **xCAT** commands by default. But xCAT can be configured to allow both **non-root users** and **remote users** to run limited xCAT commands. For remote users, we mean the users who triggers the xCAT commands from other nodes and not have to login to the management node. xCAT uses the **policy** table to control who has authority to run specific xCAT commands. For a full explanation of the **policy** table, refer to :doc:`policy ` man page. +.. _granting_xcat_privileges: Granting Users xCAT Privileges `````````````````````````````` -To give a non-root user all xCAT commands privileges, run ``tabedit policy`` and add a line: :: +To give a non-root user all xCAT command privileges, run ``tabedit policy`` and add a line: :: "6","",,,,,,"allow",, -Where is the name of the user that you are granting privileges to. In the above case, this user can now perform all xCAT commands, including changing the ``policy`` table to grant right to other users, so this should be used with caution. +Where is the name of the user that you are granting privileges to. This user can now perform all xCAT commands, including changing the ``policy`` table to grant rights to other users, so this should be used with caution. -You may only want to grant users limited access. One example is that one user may only be allowed to run ``nodels``. This can be done as follows: :: +To grant a user ability to run ``nodels`` command: :: "6","",,"nodels",,,,"allow",, -If you want to grant all users the ability to run nodels, add this line: :: +To grant all users the ability to run ``nodels``: :: "6.1","*",,"nodels",,,,"allow",, -You also can do this by running: :: +CLI can also be used: :: chdef -t policy -o 6.1 name=* commands=nodels rule=allow -**Note** Make sure the directories that contain the xCAT commands are in the user's ``$PATH``. If not, add them to ``$PATH`` as appropriate way in your system. :: +**Note** Make sure the directories that contain the xCAT commands are in the user's ``$PATH``. If not, add them to ``$PATH`` as appropriate in your system. :: echo $PATH | grep xcat /opt/xcat/bin:/opt/xcat/sbin: ....... @@ -57,18 +45,18 @@ You also can do this by running: :: Extra Setup for Remote Commands ``````````````````````````````` -To give a user the ability to run remote commands (xdsh, xdcp, psh, pcp) in some node, except above steps, also need to run below steps: :: +To give a user the ability to run remote commands (``xdsh``, ``xdcp``, ``psh``, ``pcp``) in some node, in addition to above steps, also need to run below steps: :: su - xdsh -K -This will setup the user and root ssh keys for the user under the ``$HOME/.ssh`` directory of the user on the nodes. The root ssh keys are needed for the user to run the xCAT commands under the xcatd daemon, where the user will be running as root. **Note**: the uid for the user should match the uid on the management node and a password for the user must have been set on the nodes. +This will setup the user and root ssh keys for the user under the ``$HOME/.ssh`` directory of the user on the nodes. The root ssh keys are needed for the user to run the xCAT commands under the xcatd daemon, where the user will be running as root. **Note**: the uid and the password for the user on the management node, should match the uid and password on the managed nodes. Set Up Login Node (Remote Client) ````````````````````````````````` -In some cases, you don't want your **non-root** user login to management node but still can run some xCAT commands. This time, you need setup a login node(i.e. remote client) for these users. +In some cases, you don't want your **non-root** user login to management node but still can run some xCAT commands. This time, you need setup a login node (i.e. remote client) for these users. Below are the steps of how to set up a login node. @@ -78,9 +66,9 @@ Below are the steps of how to set up a login node. * :doc:`Configure xCAT Software Repository in RHEL` - * `Configure the Base OS Repository in SUSE `_ + * :ref:`Configure the Base OS Repository in SUSE ` - * `Configure the Base OS Repository in Ubuntu `_ + * :ref:`Configure the Base OS Repository in Ubuntu ` Then install ``xCAT-client``. diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_network.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_network.rst index aa0e78f03..e11d21d67 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_network.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_network.rst @@ -1,121 +1,10 @@ -Advanced Networking Configuration -================================= - -The ``confignetwork`` postscript can be used to configure the network interfaces on the compute nodes to support VLAN, BONDs, and BRIDGES. In order to use the ``confignetwork`` postscript, the following attributes must be configured for the node in the ``nics`` table: - - * ``nicips`` - * ``nictypes`` - * ``nicnetworks`` - * ``nicdevices`` - resolves the relationship among the physical network intereface devices - -The following example set the xCAT properties for compute node ``cn1`` to achieve the following network configuration using the ``confignetwork`` postscript: - - * Compute node ``cn1`` has two physical NICs: eth2 and eth3 - * Bond eth2 and eth3 as ``bond0`` - * From ``bond0``, create 2 VLANs: ``bond0.1`` and ``bond0.2`` - * Make bridge ``br1`` using ``bond0.1`` with IP (10.0.0.1) - * Make bridge ``br2`` using ``bond0.2`` with IP (20.0.0.1) - -Define attributes in the ``nics`` table ---------------------------------------- - -#. Using the ``mkdef`` or ``chdef`` commands - - a. Compute node ``cn1`` has two physical NICs: ``eth2`` and ``eth3`` :: - - chdef cn1 nictypes.eth2=ethernet nictypes.eth3=ethernet - - b. Define ``bond0`` and bond ``eth2`` and ``eth3`` as ``bond0`` :: - - chdef cn1 nictypes.bond0=bond \ - nicdevices.bond0="eth2|eth3" - - c. Fom ``bond0``, create 2 VLANs: ``bond0.1`` and ``bond0.2`` :: - - chdef cn1 nictypes.bond0.1=vlan \ - nictypes.bond0.2=vlan \ - nicdevices.bond0.1=bond0 \ - nicdevices.bond0.2=bond0 - - d. Create bridge ``br1`` using ``bond0.1`` with IP (10.0.0.1) :: - - chdef cn1 nictypes.br1=bridge \ - nicdevices.br1=bond0.1 \ - nicips.br1=10.0.0.1 \ - nicnetworks.br1="net10" - - e. Create bridge ``br2`` using ``bond0.2`` with IP (20.0.0.1) :: - - chdef cn1 nictypes.br2=bridge \ - nicdevices.br2=bond0.2 \ - nicips.br2=20.0.0.1 \ - nicnetworks.br2="net20" - -#. Using an xCAT stanza file - - - Prepare a stanza file ``.stanza`` with content similiar to the following: :: - - # - cn1: - objtype=node - arch=x86_64 - groups=kvm,vm,all - nicdevices.br1=bond0.1 - nicdevices.br2=bond0.2 - nicdevices.bond0.1=bond0 - nicdevices.bond0.2=bond0 - nicdevices.bond0=eth2|eth3 - nictypes.eth2=ethernet - nictypes.eth3=ethernet - nictypes.bond0=bond - nictypes.bond0.1=vlan - nictypes.bond0.2=vlan - nictypes.br1=bridge - nictypes.br2=bridge - nicips.br1=10.0.0.1 - nicips.br2=20.0.0.1 - nicnetworks.br1=net10 - nicnetworks.br2=net20 - - - Using the ``mkdef -z`` option, define the stanza file to xCAT: :: - - cat .stanza | mkdef -z - -#. Using ``tabedit`` to edit the ``nics`` database table directly - - The ``tabedit`` command opens the specified xCAT database table in a ``vi`` like editor and allows the user to edit any text and write the changes back to the database table. - - After changing the content of the ``nics`` table, here is the result from ``tabdump nics`` :: - - # tabdump nics - #node,nicips,nichostnamesuffixes,nichostnameprefixes,nictypes,niccustomscripts,nicnetworks,nicaliases,nicextraparams,nicdevices,comments,disable - "cn1","br1!10.0.0.1,br2!20.0.0.1",,,"br1!bridge,eth2!ethernet,eth3!ethernet,bond0.2!vlan,bond0!bond,br2!bridge,bond0.1!vlan",,"br1!net10,br2!net20",,,"br1!bond0.1,bond0!eth2|eth3,bond0.2!bond0,bond0.1!bond0,br2!bond0.2",, - -Add network object into the networks table ------------------------------------------- - -The ``nicnetworks`` attribute only defines the nic that uses the IP address. -Other information about the network should be defined in the ``networks`` table. - -Use the ``chdef`` command to add/modify the networks in the ``networks`` table :: - - chdef -t network net10 net=10.0.0.0 mask=255.0.0.0 mgtifname=eth0 - chdef -t network net20 net=20.0.0.0 mask=255.0.0.0 mgtifname=eth1 - -Add ``confignetwork`` into the node's postscripts list ------------------------------------------------------- - -Using below command to add ``confignetwork`` into the node's postscripts list :: - - chdef cn1 -p postscripts=confignetwork - - -During OS deployment on compute node, ``confignetwork`` will be run in postscript. -If the compute node has OS, use ``updatenode`` command to run ``confignetwork`` :: - - updatenode cn1 -P confignetwork - - +Advanced Networking Configuration - confignetwork +================================================= +**Note:** ``confignetwork`` postscript is only supported on RHEL releases. +.. toctree:: + :maxdepth: 2 +.. include:: ../../../common/deployment/cfg_network_vlan.rst +.. include:: ../../../common/deployment/cfg_network_bond.rst diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_network_bond.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_network_bond.rst new file mode 100644 index 000000000..b4c31a981 --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_network_bond.rst @@ -0,0 +1,58 @@ +Configure Two Bonded Adapters +----------------------------- + +The following example set the xCAT properties for compute node ``cn1`` to create: + + * Compute node ``cn1`` has two physical NICs: eth2 and eth3 + * Bond eth2 and eth3 as ``bond0`` + * Assign ip ``40.0.0.1`` to the bonded interface ``bond0`` + +Define attributes in the ``nics`` table +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +#. Using the ``mkdef`` or ``chdef`` commands + + a. Compute node ``cn1`` has two physical NICs: ``eth2`` and ``eth3`` :: + + chdef cn1 nictypes.eth2=ethernet nictypes.eth3=ethernet + + b. Define ``bond0`` and bond ``eth2`` and ``eth3`` as ``bond0`` :: + + chdef cn1 nictypes.bond0=bond nicdevices.bond0="eth2|eth3" + chdef cn1 nicips.bond0=40.0.0.1 + +Add network object into the networks table +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Use the ``chdef`` command to add/modify the networks in the ``networks`` table :: + + chdef -t network net40 net=40.0.0.0 mask=255.0.0.0 + chdef cn1 nicnetworks.bond0=net40 + +Add ``confignetwork`` into the node's postscripts list +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Use command below to add ``confignetwork`` into the node's postscripts list :: + + chdef cn1 -p postscripts=confignetwork + + +During OS deployment on compute node, ``confignetwork`` postscript will be executed. +If the compute node is already running, use ``updatenode`` command to run ``confignetwork`` postscript without rebooting the node:: + + updatenode cn1 -P confignetwork + + +Verify bonding mode +~~~~~~~~~~~~~~~~~~~ + +Login to compute node cn1 and check bonding options in ``/etc/sysconfig/network-scripts/ifcfg-bond0`` file :: + + BONDING_OPTS="mode=802.3ad xmit_hash_policy=layer2+3" + + +* ``mode=802.3ad`` requires additional configuration on the switch. +* ``mode=2`` can be used for bonding without additional switch configuration. + +If changes are made to ``/etc/sysconfig/network-scripts/ifcfg-bond0`` file, restart network service. diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_network_vlan.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_network_vlan.rst new file mode 100644 index 000000000..3ddd9606f --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_network_vlan.rst @@ -0,0 +1,109 @@ +Configure BOND, VLAN and BRIDGES +-------------------------------- + +The ``confignetwork`` postscript can be used to configure the network interfaces on the compute nodes to support VLAN, BONDs, and BRIDGES. In order for the ``confignetwork`` postscript to run successfully, the following attributes must be configured for the node in the ``nics`` table: + + * ``nicips`` + * ``nictypes`` + * ``nicnetworks`` + * ``nicdevices`` - resolves the relationship among the physical network interface devices + +The following example set the xCAT properties for compute node ``cn1`` to achieve the following network configuration using the ``confignetwork`` postscript: + + * Compute node ``cn1`` has two physical NICs: ``eth2`` and ``eth3`` + * Bond ``eth2`` and ``eth3`` as ``bond0`` + * From ``bond0``, create 2 VLANs: ``bond0.1`` and ``bond0.2`` + * Make bridge ``br1`` using ``bond0.1`` with IP (10.0.0.1) + * Make bridge ``br2`` using ``bond0.2`` with IP (20.0.0.1) + +Define attributes in the ``nics`` table +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Chose one of two methods described below: + +#. Using the ``mkdef`` or ``chdef`` commands + + a. Compute node ``cn1`` has two physical NICs: ``eth2`` and ``eth3`` :: + + chdef cn1 nictypes.eth2=ethernet nictypes.eth3=ethernet + + b. Define ``bond0`` and bond ``eth2`` and ``eth3`` as ``bond0`` :: + + chdef cn1 nictypes.bond0=bond \ + nicdevices.bond0="eth2|eth3" + + c. From ``bond0``, create 2 VLANs: ``bond0.1`` and ``bond0.2`` :: + + chdef cn1 nictypes.bond0.1=vlan \ + nictypes.bond0.2=vlan \ + nicdevices.bond0.1=bond0 \ + nicdevices.bond0.2=bond0 + + d. Create bridge ``br1`` using ``bond0.1`` with IP (10.0.0.1) :: + + chdef cn1 nictypes.br1=bridge \ + nicdevices.br1=bond0.1 \ + nicips.br1=10.0.0.1 \ + nicnetworks.br1="net10" + + e. Create bridge ``br2`` using ``bond0.2`` with IP (20.0.0.1) :: + + chdef cn1 nictypes.br2=bridge \ + nicdevices.br2=bond0.2 \ + nicips.br2=20.0.0.1 \ + nicnetworks.br2="net20" + +#. Using an xCAT stanza file + + - Prepare a stanza file ``.stanza`` with content similiar to the following: :: + + # + cn1: + objtype=node + arch=x86_64 + groups=kvm,vm,all + nicdevices.br1=bond0.1 + nicdevices.br2=bond0.2 + nicdevices.bond0.1=bond0 + nicdevices.bond0.2=bond0 + nicdevices.bond0=eth2|eth3 + nictypes.eth2=ethernet + nictypes.eth3=ethernet + nictypes.bond0=bond + nictypes.bond0.1=vlan + nictypes.bond0.2=vlan + nictypes.br1=bridge + nictypes.br2=bridge + nicips.br1=10.0.0.1 + nicips.br2=20.0.0.1 + nicnetworks.br1=net10 + nicnetworks.br2=net20 + + - Using the ``mkdef -z`` option, define the stanza file to xCAT: :: + + cat .stanza | mkdef -z + +Define the additional networks to xCAT +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If this is a new network being created on the compute nodes, an entry needs to be created into the xCAT database. + +The ``nicnetworks`` attribute only defines the nic that uses the IP address. +Other information about the network should be defined in the ``networks`` table. + +Use the ``chdef`` command to add/modify the networks in the ``networks`` table :: + + chdef -t network net10 net=10.0.0.0 mask=255.0.0.0 + chdef -t network net20 net=20.0.0.0 mask=255.0.0.0 + +Add ``confignetwork`` into the node's postscripts list +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Use the following command to add ``confignetwork`` into postscript list to execute on reboot: :: + + chdef cn1 -p postscripts=confignetwork + +If the compute node is already running, use ``updatenode`` command to run ``confignetwork`` postscript without rebooting the node:: + + updatenode cn1 -P confignetwork + diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_second_adapter.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_second_adapter.rst index a6abdd3e9..492361fc5 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_second_adapter.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_second_adapter.rst @@ -1,5 +1,5 @@ -Configure Additional Network Interfaces -======================================= +Configure Additional Network Interfaces - confignics +==================================================== The **nics** table and the **confignics** postscript can be used to automatically configure additional network interfaces (mutltiple ethernets adapters, InfiniBand, etc) on the nodes as they are being deployed. @@ -47,7 +47,7 @@ There are 3 ways to complete this operation. The ``tabedit`` command opens the specified xCAT database table in a vi like editor and allows the user to edit any text and write the changes back to the database table. - *WARNING* Using the ``tabedit`` command is not the recommended method because it is tedious and error prone. + *WARNING:* Using the ``tabedit`` command is not the recommended method because it is tedious and error prone. After changing the content of the ``nics`` table, here is the result from ``tabdump nics`` :: @@ -70,7 +70,7 @@ After you have defined the configuration information in any of the ways above, r Add confignics into the node's postscripts list ----------------------------------------------- -Using below command to add confignics into the node's postscripts list :: +Use command below to add confignics into the node's postscripts list :: chdef cn1 -p postscripts=confignics @@ -78,7 +78,7 @@ By default, confignics does not configure the install nic. if need, using flag " chdef cn1 -p prostscripts="confignics -s" -Option "-s" write the install nic's information into configuration file for persistance. All install nic's data defined in nics table will be written also. +Option "-s" writes the install nic's information into configuration file for persistance. All install nic's data defined in nics table will be written also. Add network object into the networks table @@ -103,6 +103,7 @@ Option -r to remove the undefined NICS If the compute node's nics were configured by ``confignics`` and the nics configuration changed in the nics table, user the ``confignics -r`` to remove the undefined nic. For example, if on a compute node the ``eth0``, ``eth1``, and ``eth2`` nics were configured: :: + # ifconfig eth0 Link encap:Ethernet HWaddr 00:14:5e:d9:6c:e6 ... @@ -114,7 +115,7 @@ For example, if on a compute node the ``eth0``, ``eth1``, and ``eth2`` nics were Delete the eth2 definition in nics table using the ``chdef`` command. Then run the following to remove the undefined ``eth2`` nic on the compute node: :: - # updatenode -P "confignics -r" + updatenode -P "confignics -r" The result should have ``eth2`` disabled: :: diff --git a/docs/source/guides/admin-guides/manage_clusters/common/parallel_cmd.rst b/docs/source/guides/admin-guides/manage_clusters/common/parallel_cmd.rst index 3c9a59790..f1ad71ba3 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/parallel_cmd.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/parallel_cmd.rst @@ -25,11 +25,11 @@ Examples for xdsh xdsh node1 -K -- To run the ps -ef command on node targets node1 and node2, enter: :: +- To run the ``ps -ef`` command on node targets node1 and node2, enter: :: xdsh node1,node2 "ps -ef" -- To run the ps command on node targets node1 and run the remote command with the -v and -t flag, enter: :: +- To run the ``ps`` command on node targets node1 and run the remote command with the ``-v`` and ``-t`` flag, enter: :: xdsh node1,node2 -o"-v -t" ps =item * @@ -37,15 +37,15 @@ Examples for xdsh xdsh node1,node2 -f 1 -e myfile -- To run the ps command on node1 and ignore all the dsh environment variable except the DSH_NODE_OPTS, enter: :: +- To run the ``ps`` command on node1 and ignore all the dsh environment variable except the DSH_NODE_OPTS, enter: :: xdsh node1 -X `DSH_NODE_OPTS' ps -- To run on Linux, the xdsh command "dpkg | grep vim" on the node ubuntu diskless image, enter: :: +- To run on Linux, the ``xdsh`` command ``dpkg -l| grep vim`` on the node ubuntu diskless image, enter: :: xdsh -i /install/netboot/ubuntu14.04.2/ppc64el/compute/rootimg "dpkg -l|grep vim" -- To run xdsh with the non-root userid "user1" that has been setup as an xCAT userid and with sudo on node1 and node2 to run as root, do the following, see xCAT doc on Granting_Users_xCAT_privileges: :: +- To run ``xdsh`` with the non-root userid "user1" that has been setup as an xCAT userid and with sudo on node1 and node2 to run as root, do the following, see :ref:`Granting users xCAT privileges `: :: xdsh node1,node2 --sudo -l user1 "cat /etc/passwd" @@ -70,7 +70,7 @@ Examples for xdcp xdcp all /etc/hosts /etc/hosts -- To rsync the /etc/hosts file to your compute nodes: +- To ``rsync`` the /etc/hosts file to your compute nodes: Create a rsync file /tmp/myrsync, with this line: :: @@ -84,7 +84,7 @@ Examples for xdcp xdcp compute -F /tmp/myrsync -- To rsync the /etc/file1 and file2 to your compute nodes and rename to filex and filey: +- To ``rsync`` the /etc/file1 and file2 to your compute nodes and rename to filex and filey: Create a rsync file /tmp/myrsync, with these line: :: @@ -96,7 +96,7 @@ Examples for xdcp xdcp compute -F /tmp/myrsync to update the Compute Nodes -- To rsync files in the Linux image at /install/netboot/ubuntu14.04.2/ppc64el/compute/rootimg on the MN: +- To ``rsync`` files in the Linux image at /install/netboot/ubuntu14.04.2/ppc64el/compute/rootimg on the MN: Create a rsync file /tmp/myrsync, with this line: :: diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst index 9e8a9c312..ce44725f0 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst @@ -76,6 +76,7 @@ This is the minimal list of files needed, you can add additional files to the li "ALL","/etc/ntp.conf","tmpfs",, "ALL","/etc/ntp.conf.org","tmpfs",, "ALL","/etc/resolv.conf","tmpfs",, + "ALL","/etc/hostname","tmpfs",, "ALL","/etc/ssh/","tmpfs",, "ALL","/etc/sysconfig/","tmpfs",, "ALL","/etc/syslog-ng/","tmpfs",, @@ -89,6 +90,8 @@ This is the minimal list of files needed, you can add additional files to the li "ALL","/opt/xcat/","tmpfs",, "ALL","/xcatpost/","tmpfs",, "ALL","/root/.ssh/","tmpfs",, + "ALL","/etc/systemd/system/","tmpfs",, + "ALL","/etc/adjtime","tmpfs",, litetree table -------------- diff --git a/docs/source/guides/admin-guides/references/man1/getadapter.1.rst b/docs/source/guides/admin-guides/references/man1/getadapter.1.rst index d1046d6ca..7bd216c97 100644 --- a/docs/source/guides/admin-guides/references/man1/getadapter.1.rst +++ b/docs/source/guides/admin-guides/references/man1/getadapter.1.rst @@ -33,12 +33,11 @@ Traditionally, network interfaces in Linux are enumerated as eth[0123...], but t \ **getadapter**\ use genesis to collect network adapters information, so that mean it need to restart the target node. -\ **getadapter**\ follows below scheme: +\ **getadapter**\ For each node within the , follows below scheme: -If the target node is scaned for the first time, \ **getadapter**\ will trigger genesis to collect information then save the information at local. -If the target node has ever been scaned, i.e. this node has network device information in local, \ **getadapter**\ use the local information first. -If user doesn't want to use local information, can use \ **-f**\ option to force to trigger new round scan process. -if part nodes of \ *noderange*\ don't have network device information in local and the rest have, \ **getadapter**\ only trigger real scan process for these nodes which don't have local information, the nodes have network device information in local, \ **getadapter**\ still use the local information first. +If the target node is scaned for the first time, \ **getadapter**\ will trigger genesis to collect information then save the information at the \ **nicsadapter**\ column of nics table. +If the target node has ever been scaned, \ **getadapter**\ will use the information from nics table first. +If user hopes to scan the adapter information for the node but these information already exist, \ **-f**\ option can be used to start rescan process. \ **getadapter**\ tries to collect more information for the target network device, but doesn't guarantee collect same much information for every network device. diff --git a/docs/source/guides/admin-guides/references/man1/pping.1.rst b/docs/source/guides/admin-guides/references/man1/pping.1.rst index 3d0763566..92e680380 100644 --- a/docs/source/guides/admin-guides/references/man1/pping.1.rst +++ b/docs/source/guides/admin-guides/references/man1/pping.1.rst @@ -25,7 +25,7 @@ DESCRIPTION \ **pping**\ is a utility used to ping a list of nodes in parallel. \ **pping**\ will return an unsorted list of nodes with a ping or noping status. -\ **pping**\ front-ends nmap or fping if available. +\ **pping**\ front-ends \ **nmap**\ or \ **fping**\ if available. This command does not support the xcatd client/server communication. It must be run on the management node. @@ -48,7 +48,7 @@ OPTIONS \ **-f | -**\ **-use_fping**\ - Use fping instead of nmap + Use \ **fping**\ instead of \ **nmap**\ diff --git a/docs/source/guides/admin-guides/references/man1/rmdef.1.rst b/docs/source/guides/admin-guides/references/man1/rmdef.1.rst index 4b1d4cb5a..3655a78b5 100644 --- a/docs/source/guides/admin-guides/references/man1/rmdef.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rmdef.1.rst @@ -22,7 +22,7 @@ SYNOPSIS \ **rmdef**\ [\ **-h | -**\ **-help**\ ] [\ **-t**\ \ *object-types*\ ] \ **rmdef**\ [\ **-V | -**\ **-verbose**\ ] [\ **-a | -**\ **-all**\ ] [\ **-t**\ \ *object-types*\ ] [\ **-o**\ \ *object-names*\ ] -[\ **-f | -**\ **-force**\ ] [\ *noderange*\ ] +[\ **-f | -**\ **-force**\ ] [\ **-C | -**\ **-cleanup**\ ] [\ *noderange*\ ] *********** @@ -41,17 +41,26 @@ OPTIONS \ **-a|-**\ **-all**\ - Clear the whole xCAT database. A backup of the xCAT definitions should be saved before using this option. Once all the data is removed the xCAT daemon will no longer work. Most xCAT commands will fail. - In order to use xCAT commands again, you have two options. You can restore your database from your backup by switching to bypass mode, and running the restorexCATdb command. - You switch to bypass mode by setting the XCATBYPASS environmant variable. (ex. "export XCATBYPASS=yes") - A second option is to run xcatconfig -d. This will restore the initial setup of the database as when xCAT was initially installed. - You can then restart xcatd and run xCAT commands. + Clear the whole xCAT database. A backup of the xCAT definitions should be saved before using this option as the xCAT daemons will no longer work once cleared. + + To restore: + + + 1. \ **export XCATBYPASS=1**\ and run the \ **restorexCATdb**\ command. + + or + + + + 2. Run \ **xcatconfig -d**\ which initializes the database the same as when xCAT was installed. + + \ **-f|-**\ **-force**\ - Use this with the all option as an extra indicator that ALL definitions are to be removed. + Use this with the \ **-**\ **-all**\ option as an extra indicator that ALL definitions are to be removed. @@ -79,6 +88,12 @@ OPTIONS +\ **-C|-**\ **-cleanup**\ + + Perform additional cleanup by running \ **nodeset offline**\ on the objects specified in the \ *noderange*\ . + + + \ **-V|-**\ **-verbose**\ Verbose mode. diff --git a/docs/source/guides/admin-guides/references/man1/rpower.1.rst b/docs/source/guides/admin-guides/references/man1/rpower.1.rst index 9eda41449..b344f75d6 100644 --- a/docs/source/guides/admin-guides/references/man1/rpower.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rpower.1.rst @@ -29,7 +29,14 @@ BMC (using IPMI) specific: \ **rpower**\ \ *noderange*\ [\ **on | off | softoff | reset | boot | stat | state | status | wake | suspend**\ [\ **-w**\ \ *timeout*\ ] [\ **-o**\ ] [\ **-r**\ ]] -\ **rpower**\ \ *noderange*\ [\ **pduon | pduoff | pdustat**\ ] +\ **rpower**\ \ *noderange*\ [\ **pduon | pduoff | pdustat | pdureset**\ ] + + +OpenBMC specific: +================= + + +\ **rpower**\ \ *noderange*\ [\ **off | on | reset | boot | stat | state | status**\ ] PPC (with IVM or HMC) specific: @@ -108,7 +115,7 @@ pdu specific: ============= -\ **rpower**\ \ *noderange*\ [\ **stat | off | on**\ ] +\ **rpower**\ \ *noderange*\ [\ **stat | off | on | reset**\ ] diff --git a/docs/source/guides/admin-guides/references/man1/xdsh.1.rst b/docs/source/guides/admin-guides/references/man1/xdsh.1.rst index fb84e802b..6132f8048 100644 --- a/docs/source/guides/admin-guides/references/man1/xdsh.1.rst +++ b/docs/source/guides/admin-guides/references/man1/xdsh.1.rst @@ -264,7 +264,7 @@ running commands, are terminated (SIGTERM). xdsh will chroot (xcatchroot for AIX) to this path and run the xdsh command against the install image. No other xdsh flags, environment variables apply with this input. A noderange is not accepted. Only runs on the local host, - normally the Management Node. The command you run must not prompt for input, the prompt will not be returned to you, and it will appear that xdsh hangs. + normally the Management Node. The command you run must not prompt for input, the prompt will not be returned to you, and it will appear that \ **xdsh**\ hangs. @@ -381,8 +381,8 @@ running commands, are terminated (SIGTERM). displays an error and terminates execution for the remote targets that failed to respond. If \ *timeout*\ is not specified, \ **xdsh**\ waits indefinitely to continue processing output from - all remote targets. The exception is the -K flag which defaults - to 10 seconds. + all remote targets. The exception is the \ **-K**\ flag which defaults + to 10 seconds. @@ -512,23 +512,28 @@ running commands, are terminated (SIGTERM). If \ **DSH_REMOTE_PASSWORD**\ is set to the password of the userid (usually root) that will ssh to the node, then when - you use the -K flag, you will not be prompted for a password. + you use the \ **-K**\ flag, you will not be prompted for a password. \ **DSH_SYNTAX**\ Specifies the shell syntax to use on remote targets; \ **ksh**\ or - \ **csh**\ . If not specified, the \ **ksh**\ syntax is assumed. This + \ **csh**\ . If not specified, the \ **ksh**\ syntax is assumed. This variable is overridden by the \ **-S**\ flag. \ **DSH_TIMEOUT**\ - Specifies the time, in seconds, to wait for output from - each remote target. This variable is overridden by the \ **-t**\ - flag. + Specifies the time, in seconds, to wait for output from + each remote target. This variable is overridden by the \ **-t**\ flag. + + + +\ **DSH_VERIFY**\ + + Verifies each target before executing any remote commands on the target. If a target is not responding, execution of remote commands for the target is canceled. This variable is overridden by the \ **-v**\ flag. @@ -538,10 +543,10 @@ running commands, are terminated (SIGTERM). ********************************** -To provide backward compatibility for scripts written using dsh in +To provide backward compatibility for scripts written using \ **dsh**\ in AIX and CSM, a tool has been provided \ **groupfiles4dsh**\ , which will build node group files from the -xCAT database that can be used by dsh. See \ **man groupfiles4dsh**\ . +xCAT database that can be used by \ **dsh**\ . See \ **man groupfiles4dsh**\ . **************** @@ -567,7 +572,7 @@ userdefined. ******************* -The dsh command exit code is 0 if the command executed without errors and all remote shell commands finished with exit codes of 0. If internal dsh errors occur or the remote shell commands do not complete successfully, the dsh command exit value is greater than 0. The exit value is increased by 1 for each successive instance of an unsuccessful remote command execution. If the remotely issued command is run in the background, the exit code of the remotely issued command is 0. +The \ **xdsh**\ command exit code is 0 if the command executed without errors and all remote shell commands finished with exit codes of 0. If internal dsh errors occur or the remote shell commands do not complete successfully, the dsh command exit value is greater than 0. The exit value is increased by 1 for each successive instance of an unsuccessful remote command execution. If the remotely issued command is run in the background, the exit code of the remotely issued command is 0. **************** @@ -663,7 +668,7 @@ on the service node fedora9 diskless image, enter: To define the QLogic IB switch as a node and to set up the SSH keys for IB switch \ **qswitch**\ with device configuration file - \ **/var/opt/xcat/IBSwitch/Qlogic/config**\ and user name \ **username**\ , Enter + \ **/var/opt/xcat/IBSwitch/Qlogic/config**\ and user name \ **username**\ , enter .. code-block:: perl @@ -675,7 +680,7 @@ on the service node fedora9 diskless image, enter: -10. To define the Management Node in the database so you can use xdsh, Enter +10. To define the Management Node in the database so you can use \ **xdsh**\ , enter .. code-block:: perl @@ -686,7 +691,7 @@ on the service node fedora9 diskless image, enter: 11. To define the Mellanox switch as a node and run a command to show the ssh keys. -\ **mswitch**\ with and user name \ **username**\ , Enter +\ **mswitch**\ with and user name \ **username**\ , enter .. code-block:: perl @@ -724,7 +729,7 @@ on the service node fedora9 diskless image, enter: 13. - To run xdsh with the non-root userid "user1" that has been setup as an xCAT userid and with sudo on node1 and node2 to run as root, do the following, see xCAT doc on Granting_Users_xCAT_privileges: + To run \ **xdsh**\ with the non-root userid "user1" that has been setup as an xCAT userid and with sudo on node1 and node2 to run as root, do the following, see xCAT doc on Granting_Users_xCAT_privileges: .. code-block:: perl diff --git a/docs/source/guides/admin-guides/references/man5/nodehm.5.rst b/docs/source/guides/admin-guides/references/man5/nodehm.5.rst index e3978e25e..ef568e90f 100644 --- a/docs/source/guides/admin-guides/references/man5/nodehm.5.rst +++ b/docs/source/guides/admin-guides/references/man5/nodehm.5.rst @@ -50,7 +50,7 @@ nodehm Attributes: \ **mgt**\ - The method to use to do general hardware management of the node. This attribute is used as the default if power or getmac is not set. Valid values: ipmi, blade, hmc, ivm, fsp, bpa, kvm, esx, rhevm. See the power attribute for more details. + The method to use to do general hardware management of the node. This attribute is used as the default if power or getmac is not set. Valid values: openbmc, ipmi, blade, hmc, ivm, fsp, bpa, kvm, esx, rhevm. See the power attribute for more details. diff --git a/docs/source/guides/admin-guides/references/man5/openbmc.5.rst b/docs/source/guides/admin-guides/references/man5/openbmc.5.rst new file mode 100644 index 000000000..7e006120c --- /dev/null +++ b/docs/source/guides/admin-guides/references/man5/openbmc.5.rst @@ -0,0 +1,82 @@ + +######### +openbmc.5 +######### + +.. highlight:: perl + + +**** +NAME +**** + + +\ **openbmc**\ - a table in the xCAT database. + + +******** +SYNOPSIS +******** + + +\ **openbmc Attributes:**\ \ *node*\ , \ *bmc*\ , \ *username*\ , \ *password*\ , \ *comments*\ , \ *disable*\ + + +*********** +DESCRIPTION +*********** + + +Setting for nodes that are controlled by an on-board OpenBmc. + + +******************* +openbmc Attributes: +******************* + + + +\ **node**\ + + The node name or group name. + + + +\ **bmc**\ + + The hostname of the BMC adapter. + + + +\ **username**\ + + The BMC userid. + + + +\ **password**\ + + The BMC password. + + + +\ **comments**\ + + Any user-written notes. + + + +\ **disable**\ + + Set to 'yes' or '1' to comment out this row. + + + + +******** +SEE ALSO +******** + + +\ **nodels(1)**\ , \ **chtab(8)**\ , \ **tabdump(8)**\ , \ **tabedit(8)**\ + diff --git a/docs/source/guides/admin-guides/references/man5/passwd.5.rst b/docs/source/guides/admin-guides/references/man5/passwd.5.rst index 3438aa4b6..4123a9258 100644 --- a/docs/source/guides/admin-guides/references/man5/passwd.5.rst +++ b/docs/source/guides/admin-guides/references/man5/passwd.5.rst @@ -50,13 +50,13 @@ passwd Attributes: \ **password**\ - The default password for this type of component + The default password for this type of component. On Linux, a crypted form could be provided. Hashes starting with $1$, $5$ and $6$ (md5, sha256 and sha512 respectively) are supported. \ **cryptmethod**\ - Indicates the method that was used to encrypt the password attribute. On AIX systems, if a value is provided for this attribute it indicates that the password attribute is encrypted. If the cryptmethod value is not set it indicates the password is a simple string value. On Linux systems, the cryptmethod can be set to md5, sha256 or sha512. If not set, sha256 will be used as default. + Indicates the method to use to encrypt the password attribute. On AIX systems, if a value is provided for this attribute it indicates that the password attribute is encrypted. If the cryptmethod value is not set it indicates the password is a simple string value. On Linux systems, the cryptmethod can be set to md5, sha256 or sha512. If not set, sha256 will be used as default to encrypt plain-text passwords. diff --git a/docs/source/guides/admin-guides/references/man5/pdu.5.rst b/docs/source/guides/admin-guides/references/man5/pdu.5.rst index a77ea0b32..5d5076cfb 100644 --- a/docs/source/guides/admin-guides/references/man5/pdu.5.rst +++ b/docs/source/guides/admin-guides/references/man5/pdu.5.rst @@ -19,7 +19,7 @@ SYNOPSIS ******** -\ **pdu Attributes:**\ \ *pdu*\ , \ *machinetype*\ , \ *modelnum*\ , \ *serialnum*\ , \ *outletCount*\ , \ *comments*\ , \ *disable*\ +\ **pdu Attributes:**\ \ *node*\ , \ *nodetype*\ , \ *outlet*\ , \ *machinetype*\ , \ *modelnum*\ , \ *serialnum*\ , \ *comments*\ , \ *disable*\ *********** @@ -36,12 +36,24 @@ pdu Attributes: -\ **pdu**\ +\ **node**\ The hostname/address of the pdu to which the settings apply +\ **nodetype**\ + + The node type should be pdu + + + +\ **outlet**\ + + The pdu outlet count + + + \ **machinetype**\ The pdu machine type @@ -60,16 +72,16 @@ pdu Attributes: -\ **outletCount**\ - - - \ **comments**\ - + + Any user-written notes. + \ **disable**\ - + + Set to 'yes' or '1' to comment out this row. + diff --git a/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst b/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst index e95ece5c8..4100de4bb 100644 --- a/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst +++ b/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst @@ -288,6 +288,10 @@ osimage(7)|osimage.7 +pdu(7)|pdu.7 + + + policy(7)|policy.7 @@ -561,6 +565,12 @@ notification(5)|notification.5 +openbmc(5)|openbmc.5 + + Setting for nodes that are controlled by an on-board OpenBmc. + + + osdistro(5)|osdistro.5 Information about all the OS distros in the xCAT cluster diff --git a/docs/source/guides/admin-guides/references/man7/group.7.rst b/docs/source/guides/admin-guides/references/man7/group.7.rst index 4a9954df5..8894cc520 100644 --- a/docs/source/guides/admin-guides/references/man7/group.7.rst +++ b/docs/source/guides/admin-guides/references/man7/group.7.rst @@ -19,7 +19,7 @@ SYNOPSIS ******** -\ **group Attributes:**\ \ *addkcmdline*\ , \ *arch*\ , \ *authdomain*\ , \ *bmc*\ , \ *bmcpassword*\ , \ *bmcport*\ , \ *bmcusername*\ , \ *bmcvlantag*\ , \ *cfgmgr*\ , \ *cfgmgtroles*\ , \ *cfgserver*\ , \ *chain*\ , \ *chassis*\ , \ *cmdmapping*\ , \ *cons*\ , \ *conserver*\ , \ *consoleondemand*\ , \ *cpucount*\ , \ *cputype*\ , \ *currchain*\ , \ *currstate*\ , \ *dhcpinterfaces*\ , \ *disksize*\ , \ *displayname*\ , \ *dockercpus*\ , \ *dockerflag*\ , \ *dockerhost*\ , \ *dockermemory*\ , \ *dockernics*\ , \ *domainadminpassword*\ , \ *domainadminuser*\ , \ *domaintype*\ , \ *getmac*\ , \ *groupname*\ , \ *grouptype*\ , \ *hcp*\ , \ *height*\ , \ *hostcluster*\ , \ *hostinterface*\ , \ *hostmanager*\ , \ *hostnames*\ , \ *hosttype*\ , \ *hwtype*\ , \ *id*\ , \ *initrd*\ , \ *installnic*\ , \ *interface*\ , \ *ip*\ , \ *iscsipassword*\ , \ *iscsiserver*\ , \ *iscsitarget*\ , \ *iscsiuserid*\ , \ *kcmdline*\ , \ *kernel*\ , \ *linkports*\ , \ *mac*\ , \ *machinetype*\ , \ *membergroups*\ , \ *members*\ , \ *memory*\ , \ *mgt*\ , \ *micbridge*\ , \ *michost*\ , \ *micid*\ , \ *miconboot*\ , \ *micpowermgt*\ , \ *micvlog*\ , \ *migrationdest*\ , \ *modelnum*\ , \ *monserver*\ , \ *mpa*\ , \ *mtm*\ , \ *nameservers*\ , \ *netboot*\ , \ *nfsdir*\ , \ *nfsserver*\ , \ *nicaliases*\ , \ *niccustomscripts*\ , \ *nicdevices*\ , \ *nicextraparams*\ , \ *nichostnameprefixes*\ , \ *nichostnamesuffixes*\ , \ *nicips*\ , \ *nicnetworks*\ , \ *nicsadapter*\ , \ *nictypes*\ , \ *nimserver*\ , \ *nodetype*\ , \ *ondiscover*\ , \ *os*\ , \ *osvolume*\ , \ *otherinterfaces*\ , \ *ou*\ , \ *outletcount*\ , \ *parent*\ , \ *passwd.HMC*\ , \ *passwd.admin*\ , \ *passwd.celogin*\ , \ *passwd.general*\ , \ *passwd.hscroot*\ , \ *password*\ , \ *pdu*\ , \ *postbootscripts*\ , \ *postscripts*\ , \ *power*\ , \ *pprofile*\ , \ *prescripts-begin*\ , \ *prescripts-end*\ , \ *primarynic*\ , \ *productkey*\ , \ *profile*\ , \ *protocol*\ , \ *provmethod*\ , \ *rack*\ , \ *room*\ , \ *routenames*\ , \ *serial*\ , \ *serialflow*\ , \ *serialnum*\ , \ *serialport*\ , \ *serialspeed*\ , \ *servicenode*\ , \ *setupconserver*\ , \ *setupdhcp*\ , \ *setupftp*\ , \ *setupipforward*\ , \ *setupldap*\ , \ *setupnameserver*\ , \ *setupnfs*\ , \ *setupnim*\ , \ *setupntp*\ , \ *setupproxydhcp*\ , \ *setuptftp*\ , \ *sfp*\ , \ *side*\ , \ *slot*\ , \ *slotid*\ , \ *slots*\ , \ *snmpauth*\ , \ *snmppassword*\ , \ *snmpprivacy*\ , \ *snmpusername*\ , \ *snmpversion*\ , \ *storagcontroller*\ , \ *storagetype*\ , \ *supernode*\ , \ *supportedarchs*\ , \ *supportproxydhcp*\ , \ *switch*\ , \ *switchinterface*\ , \ *switchport*\ , \ *switchtype*\ , \ *switchvlan*\ , \ *syslog*\ , \ *termport*\ , \ *termserver*\ , \ *tftpdir*\ , \ *tftpserver*\ , \ *unit*\ , \ *urlpath*\ , \ *usercomment*\ , \ *userid*\ , \ *username*\ , \ *vmbeacon*\ , \ *vmbootorder*\ , \ *vmcfgstore*\ , \ *vmcluster*\ , \ *vmcpus*\ , \ *vmhost*\ , \ *vmmanager*\ , \ *vmmaster*\ , \ *vmmemory*\ , \ *vmnicnicmodel*\ , \ *vmnics*\ , \ *vmothersetting*\ , \ *vmphyslots*\ , \ *vmstorage*\ , \ *vmstoragecache*\ , \ *vmstorageformat*\ , \ *vmstoragemodel*\ , \ *vmtextconsole*\ , \ *vmvirtflags*\ , \ *vmvncport*\ , \ *webport*\ , \ *wherevals*\ , \ *xcatmaster*\ +\ **group Attributes:**\ \ *addkcmdline*\ , \ *arch*\ , \ *authdomain*\ , \ *bmc*\ , \ *bmcpassword*\ , \ *bmcport*\ , \ *bmcusername*\ , \ *bmcvlantag*\ , \ *cfgmgr*\ , \ *cfgmgtroles*\ , \ *cfgserver*\ , \ *chain*\ , \ *chassis*\ , \ *cmdmapping*\ , \ *cons*\ , \ *conserver*\ , \ *consoleondemand*\ , \ *cpucount*\ , \ *cputype*\ , \ *currchain*\ , \ *currstate*\ , \ *dhcpinterfaces*\ , \ *disksize*\ , \ *displayname*\ , \ *dockercpus*\ , \ *dockerflag*\ , \ *dockerhost*\ , \ *dockermemory*\ , \ *dockernics*\ , \ *domainadminpassword*\ , \ *domainadminuser*\ , \ *domaintype*\ , \ *getmac*\ , \ *groupname*\ , \ *grouptype*\ , \ *hcp*\ , \ *height*\ , \ *hostcluster*\ , \ *hostinterface*\ , \ *hostmanager*\ , \ *hostnames*\ , \ *hosttype*\ , \ *hwtype*\ , \ *id*\ , \ *initrd*\ , \ *installnic*\ , \ *interface*\ , \ *ip*\ , \ *iscsipassword*\ , \ *iscsiserver*\ , \ *iscsitarget*\ , \ *iscsiuserid*\ , \ *kcmdline*\ , \ *kernel*\ , \ *linkports*\ , \ *mac*\ , \ *machinetype*\ , \ *membergroups*\ , \ *members*\ , \ *memory*\ , \ *mgt*\ , \ *micbridge*\ , \ *michost*\ , \ *micid*\ , \ *miconboot*\ , \ *micpowermgt*\ , \ *micvlog*\ , \ *migrationdest*\ , \ *modelnum*\ , \ *monserver*\ , \ *mpa*\ , \ *mtm*\ , \ *nameservers*\ , \ *netboot*\ , \ *nfsdir*\ , \ *nfsserver*\ , \ *nicaliases*\ , \ *niccustomscripts*\ , \ *nicdevices*\ , \ *nicextraparams*\ , \ *nichostnameprefixes*\ , \ *nichostnamesuffixes*\ , \ *nicips*\ , \ *nicnetworks*\ , \ *nicsadapter*\ , \ *nictypes*\ , \ *nimserver*\ , \ *nodetype*\ , \ *ondiscover*\ , \ *os*\ , \ *osvolume*\ , \ *otherinterfaces*\ , \ *ou*\ , \ *outlet*\ , \ *parent*\ , \ *passwd.HMC*\ , \ *passwd.admin*\ , \ *passwd.celogin*\ , \ *passwd.general*\ , \ *passwd.hscroot*\ , \ *password*\ , \ *pdu*\ , \ *postbootscripts*\ , \ *postscripts*\ , \ *power*\ , \ *pprofile*\ , \ *prescripts-begin*\ , \ *prescripts-end*\ , \ *primarynic*\ , \ *productkey*\ , \ *profile*\ , \ *protocol*\ , \ *provmethod*\ , \ *rack*\ , \ *room*\ , \ *routenames*\ , \ *serial*\ , \ *serialflow*\ , \ *serialnum*\ , \ *serialport*\ , \ *serialspeed*\ , \ *servicenode*\ , \ *setupconserver*\ , \ *setupdhcp*\ , \ *setupftp*\ , \ *setupipforward*\ , \ *setupldap*\ , \ *setupnameserver*\ , \ *setupnfs*\ , \ *setupnim*\ , \ *setupntp*\ , \ *setupproxydhcp*\ , \ *setuptftp*\ , \ *sfp*\ , \ *side*\ , \ *slot*\ , \ *slotid*\ , \ *slots*\ , \ *snmpauth*\ , \ *snmppassword*\ , \ *snmpprivacy*\ , \ *snmpusername*\ , \ *snmpversion*\ , \ *storagcontroller*\ , \ *storagetype*\ , \ *supernode*\ , \ *supportedarchs*\ , \ *supportproxydhcp*\ , \ *switch*\ , \ *switchinterface*\ , \ *switchport*\ , \ *switchtype*\ , \ *switchvlan*\ , \ *syslog*\ , \ *termport*\ , \ *termserver*\ , \ *tftpdir*\ , \ *tftpserver*\ , \ *unit*\ , \ *urlpath*\ , \ *usercomment*\ , \ *userid*\ , \ *username*\ , \ *vmbeacon*\ , \ *vmbootorder*\ , \ *vmcfgstore*\ , \ *vmcluster*\ , \ *vmcpus*\ , \ *vmhost*\ , \ *vmmanager*\ , \ *vmmaster*\ , \ *vmmemory*\ , \ *vmnicnicmodel*\ , \ *vmnics*\ , \ *vmothersetting*\ , \ *vmphyslots*\ , \ *vmstorage*\ , \ *vmstoragecache*\ , \ *vmstorageformat*\ , \ *vmstoragemodel*\ , \ *vmtextconsole*\ , \ *vmvirtflags*\ , \ *vmvncport*\ , \ *webport*\ , \ *wherevals*\ , \ *xcatmaster*\ *********** @@ -57,16 +57,24 @@ group Attributes: -\ **bmc**\ (ipmi.bmc) +\ **bmc**\ (ipmi.bmc, openbmc.bmc) + + The hostname of the BMC adapter. + + or The hostname of the BMC adapter. -\ **bmcpassword**\ (ipmi.password) +\ **bmcpassword**\ (ipmi.password, openbmc.password) The BMC password. If not specified, the key=ipmi row in the passwd table is used as the default. + or + + The BMC password. + \ **bmcport**\ (ipmi.bmcport) @@ -115,10 +123,14 @@ group Attributes: -\ **bmcusername**\ (ipmi.username) +\ **bmcusername**\ (ipmi.username, openbmc.username) The BMC userid. If not specified, the key=ipmi row in the passwd table is used as the default. + or + + The BMC userid. + \ **bmcvlantag**\ (ipmi.taggedvlan) @@ -461,7 +473,7 @@ group Attributes: \ **mgt**\ (nodehm.mgt) - The method to use to do general hardware management of the node. This attribute is used as the default if power or getmac is not set. Valid values: ipmi, blade, hmc, ivm, fsp, bpa, kvm, esx, rhevm. See the power attribute for more details. + The method to use to do general hardware management of the node. This attribute is used as the default if power or getmac is not set. Valid values: openbmc, ipmi, blade, hmc, ivm, fsp, bpa, kvm, esx, rhevm. See the power attribute for more details. @@ -663,10 +675,14 @@ group Attributes: -\ **nodetype**\ (nodetype.nodetype) +\ **nodetype**\ (nodetype.nodetype, pdu.nodetype) A comma-delimited list of characteristics of this node. Valid values: ppc, blade, vm (virtual machine), osi (OS image), mm, mn, rsa, switch. + or + + The node type should be pdu + \ **ondiscover**\ (chain.ondiscover) @@ -707,7 +723,7 @@ group Attributes: -\ **outletcount**\ (pdu.outletcount) +\ **outlet**\ (pdu.outlet) The pdu outlet count diff --git a/docs/source/guides/admin-guides/references/man7/node.7.rst b/docs/source/guides/admin-guides/references/man7/node.7.rst index b06375b96..f375eaac0 100644 --- a/docs/source/guides/admin-guides/references/man7/node.7.rst +++ b/docs/source/guides/admin-guides/references/man7/node.7.rst @@ -19,7 +19,7 @@ SYNOPSIS ******** -\ **node Attributes:**\ \ *addkcmdline*\ , \ *appstatus*\ , \ *appstatustime*\ , \ *arch*\ , \ *authdomain*\ , \ *bmc*\ , \ *bmcpassword*\ , \ *bmcport*\ , \ *bmcusername*\ , \ *bmcvlantag*\ , \ *cfgmgr*\ , \ *cfgmgtroles*\ , \ *cfgserver*\ , \ *chain*\ , \ *chassis*\ , \ *cmdmapping*\ , \ *cons*\ , \ *conserver*\ , \ *consoleondemand*\ , \ *cpucount*\ , \ *cputype*\ , \ *currchain*\ , \ *currstate*\ , \ *dhcpinterfaces*\ , \ *disksize*\ , \ *displayname*\ , \ *dockercpus*\ , \ *dockerflag*\ , \ *dockerhost*\ , \ *dockermemory*\ , \ *dockernics*\ , \ *domainadminpassword*\ , \ *domainadminuser*\ , \ *domaintype*\ , \ *getmac*\ , \ *groups*\ , \ *hcp*\ , \ *height*\ , \ *hidden*\ , \ *hostcluster*\ , \ *hostinterface*\ , \ *hostmanager*\ , \ *hostnames*\ , \ *hosttype*\ , \ *hwtype*\ , \ *id*\ , \ *initrd*\ , \ *installnic*\ , \ *interface*\ , \ *ip*\ , \ *iscsipassword*\ , \ *iscsiserver*\ , \ *iscsitarget*\ , \ *iscsiuserid*\ , \ *kcmdline*\ , \ *kernel*\ , \ *linkports*\ , \ *mac*\ , \ *machinetype*\ , \ *memory*\ , \ *mgt*\ , \ *micbridge*\ , \ *michost*\ , \ *micid*\ , \ *miconboot*\ , \ *micpowermgt*\ , \ *micvlog*\ , \ *migrationdest*\ , \ *modelnum*\ , \ *monserver*\ , \ *mpa*\ , \ *mtm*\ , \ *nameservers*\ , \ *netboot*\ , \ *nfsdir*\ , \ *nfsserver*\ , \ *nicaliases*\ , \ *niccustomscripts*\ , \ *nicdevices*\ , \ *nicextraparams*\ , \ *nichostnameprefixes*\ , \ *nichostnamesuffixes*\ , \ *nicips*\ , \ *nicnetworks*\ , \ *nicsadapter*\ , \ *nictypes*\ , \ *nimserver*\ , \ *node*\ , \ *nodetype*\ , \ *ondiscover*\ , \ *os*\ , \ *osvolume*\ , \ *otherinterfaces*\ , \ *ou*\ , \ *outletcount*\ , \ *parent*\ , \ *passwd.HMC*\ , \ *passwd.admin*\ , \ *passwd.celogin*\ , \ *passwd.general*\ , \ *passwd.hscroot*\ , \ *password*\ , \ *pdu*\ , \ *postbootscripts*\ , \ *postscripts*\ , \ *power*\ , \ *pprofile*\ , \ *prescripts-begin*\ , \ *prescripts-end*\ , \ *primarynic*\ , \ *primarysn*\ , \ *productkey*\ , \ *profile*\ , \ *protocol*\ , \ *provmethod*\ , \ *rack*\ , \ *room*\ , \ *routenames*\ , \ *serial*\ , \ *serialflow*\ , \ *serialnum*\ , \ *serialport*\ , \ *serialspeed*\ , \ *servicenode*\ , \ *setupconserver*\ , \ *setupdhcp*\ , \ *setupftp*\ , \ *setupipforward*\ , \ *setupldap*\ , \ *setupnameserver*\ , \ *setupnfs*\ , \ *setupnim*\ , \ *setupntp*\ , \ *setupproxydhcp*\ , \ *setuptftp*\ , \ *sfp*\ , \ *side*\ , \ *slot*\ , \ *slotid*\ , \ *slots*\ , \ *snmpauth*\ , \ *snmppassword*\ , \ *snmpprivacy*\ , \ *snmpusername*\ , \ *snmpversion*\ , \ *status*\ , \ *statustime*\ , \ *storagcontroller*\ , \ *storagetype*\ , \ *supernode*\ , \ *supportedarchs*\ , \ *supportproxydhcp*\ , \ *switch*\ , \ *switchinterface*\ , \ *switchport*\ , \ *switchtype*\ , \ *switchvlan*\ , \ *syslog*\ , \ *termport*\ , \ *termserver*\ , \ *tftpdir*\ , \ *tftpserver*\ , \ *unit*\ , \ *updatestatus*\ , \ *updatestatustime*\ , \ *urlpath*\ , \ *usercomment*\ , \ *userid*\ , \ *username*\ , \ *vmbeacon*\ , \ *vmbootorder*\ , \ *vmcfgstore*\ , \ *vmcluster*\ , \ *vmcpus*\ , \ *vmhost*\ , \ *vmmanager*\ , \ *vmmaster*\ , \ *vmmemory*\ , \ *vmnicnicmodel*\ , \ *vmnics*\ , \ *vmothersetting*\ , \ *vmphyslots*\ , \ *vmstorage*\ , \ *vmstoragecache*\ , \ *vmstorageformat*\ , \ *vmstoragemodel*\ , \ *vmtextconsole*\ , \ *vmvirtflags*\ , \ *vmvncport*\ , \ *webport*\ , \ *xcatmaster*\ , \ *zonename*\ +\ **node Attributes:**\ \ *addkcmdline*\ , \ *appstatus*\ , \ *appstatustime*\ , \ *arch*\ , \ *authdomain*\ , \ *bmc*\ , \ *bmcpassword*\ , \ *bmcport*\ , \ *bmcusername*\ , \ *bmcvlantag*\ , \ *cfgmgr*\ , \ *cfgmgtroles*\ , \ *cfgserver*\ , \ *chain*\ , \ *chassis*\ , \ *cmdmapping*\ , \ *cons*\ , \ *conserver*\ , \ *consoleondemand*\ , \ *cpucount*\ , \ *cputype*\ , \ *currchain*\ , \ *currstate*\ , \ *dhcpinterfaces*\ , \ *disksize*\ , \ *displayname*\ , \ *dockercpus*\ , \ *dockerflag*\ , \ *dockerhost*\ , \ *dockermemory*\ , \ *dockernics*\ , \ *domainadminpassword*\ , \ *domainadminuser*\ , \ *domaintype*\ , \ *getmac*\ , \ *groups*\ , \ *hcp*\ , \ *height*\ , \ *hidden*\ , \ *hostcluster*\ , \ *hostinterface*\ , \ *hostmanager*\ , \ *hostnames*\ , \ *hosttype*\ , \ *hwtype*\ , \ *id*\ , \ *initrd*\ , \ *installnic*\ , \ *interface*\ , \ *ip*\ , \ *iscsipassword*\ , \ *iscsiserver*\ , \ *iscsitarget*\ , \ *iscsiuserid*\ , \ *kcmdline*\ , \ *kernel*\ , \ *linkports*\ , \ *mac*\ , \ *machinetype*\ , \ *memory*\ , \ *mgt*\ , \ *micbridge*\ , \ *michost*\ , \ *micid*\ , \ *miconboot*\ , \ *micpowermgt*\ , \ *micvlog*\ , \ *migrationdest*\ , \ *modelnum*\ , \ *monserver*\ , \ *mpa*\ , \ *mtm*\ , \ *nameservers*\ , \ *netboot*\ , \ *nfsdir*\ , \ *nfsserver*\ , \ *nicaliases*\ , \ *niccustomscripts*\ , \ *nicdevices*\ , \ *nicextraparams*\ , \ *nichostnameprefixes*\ , \ *nichostnamesuffixes*\ , \ *nicips*\ , \ *nicnetworks*\ , \ *nicsadapter*\ , \ *nictypes*\ , \ *nimserver*\ , \ *node*\ , \ *nodetype*\ , \ *ondiscover*\ , \ *os*\ , \ *osvolume*\ , \ *otherinterfaces*\ , \ *ou*\ , \ *outlet*\ , \ *parent*\ , \ *passwd.HMC*\ , \ *passwd.admin*\ , \ *passwd.celogin*\ , \ *passwd.general*\ , \ *passwd.hscroot*\ , \ *password*\ , \ *pdu*\ , \ *postbootscripts*\ , \ *postscripts*\ , \ *power*\ , \ *pprofile*\ , \ *prescripts-begin*\ , \ *prescripts-end*\ , \ *primarynic*\ , \ *primarysn*\ , \ *productkey*\ , \ *profile*\ , \ *protocol*\ , \ *provmethod*\ , \ *rack*\ , \ *room*\ , \ *routenames*\ , \ *serial*\ , \ *serialflow*\ , \ *serialnum*\ , \ *serialport*\ , \ *serialspeed*\ , \ *servicenode*\ , \ *setupconserver*\ , \ *setupdhcp*\ , \ *setupftp*\ , \ *setupipforward*\ , \ *setupldap*\ , \ *setupnameserver*\ , \ *setupnfs*\ , \ *setupnim*\ , \ *setupntp*\ , \ *setupproxydhcp*\ , \ *setuptftp*\ , \ *sfp*\ , \ *side*\ , \ *slot*\ , \ *slotid*\ , \ *slots*\ , \ *snmpauth*\ , \ *snmppassword*\ , \ *snmpprivacy*\ , \ *snmpusername*\ , \ *snmpversion*\ , \ *status*\ , \ *statustime*\ , \ *storagcontroller*\ , \ *storagetype*\ , \ *supernode*\ , \ *supportedarchs*\ , \ *supportproxydhcp*\ , \ *switch*\ , \ *switchinterface*\ , \ *switchport*\ , \ *switchtype*\ , \ *switchvlan*\ , \ *syslog*\ , \ *termport*\ , \ *termserver*\ , \ *tftpdir*\ , \ *tftpserver*\ , \ *unit*\ , \ *updatestatus*\ , \ *updatestatustime*\ , \ *urlpath*\ , \ *usercomment*\ , \ *userid*\ , \ *username*\ , \ *vmbeacon*\ , \ *vmbootorder*\ , \ *vmcfgstore*\ , \ *vmcluster*\ , \ *vmcpus*\ , \ *vmhost*\ , \ *vmmanager*\ , \ *vmmaster*\ , \ *vmmemory*\ , \ *vmnicnicmodel*\ , \ *vmnics*\ , \ *vmothersetting*\ , \ *vmphyslots*\ , \ *vmstorage*\ , \ *vmstoragecache*\ , \ *vmstorageformat*\ , \ *vmstoragemodel*\ , \ *vmtextconsole*\ , \ *vmvirtflags*\ , \ *vmvncport*\ , \ *webport*\ , \ *xcatmaster*\ , \ *zonename*\ *********** @@ -69,16 +69,24 @@ node Attributes: -\ **bmc**\ (ipmi.bmc) +\ **bmc**\ (ipmi.bmc, openbmc.bmc) + + The hostname of the BMC adapter. + + or The hostname of the BMC adapter. -\ **bmcpassword**\ (ipmi.password) +\ **bmcpassword**\ (ipmi.password, openbmc.password) The BMC password. If not specified, the key=ipmi row in the passwd table is used as the default. + or + + The BMC password. + \ **bmcport**\ (ipmi.bmcport) @@ -127,10 +135,14 @@ node Attributes: -\ **bmcusername**\ (ipmi.username) +\ **bmcusername**\ (ipmi.username, openbmc.username) The BMC userid. If not specified, the key=ipmi row in the passwd table is used as the default. + or + + The BMC userid. + \ **bmcvlantag**\ (ipmi.taggedvlan) @@ -461,7 +473,7 @@ node Attributes: \ **mgt**\ (nodehm.mgt) - The method to use to do general hardware management of the node. This attribute is used as the default if power or getmac is not set. Valid values: ipmi, blade, hmc, ivm, fsp, bpa, kvm, esx, rhevm. See the power attribute for more details. + The method to use to do general hardware management of the node. This attribute is used as the default if power or getmac is not set. Valid values: openbmc, ipmi, blade, hmc, ivm, fsp, bpa, kvm, esx, rhevm. See the power attribute for more details. @@ -669,10 +681,14 @@ node Attributes: -\ **nodetype**\ (nodetype.nodetype) +\ **nodetype**\ (nodetype.nodetype, pdu.nodetype) A comma-delimited list of characteristics of this node. Valid values: ppc, blade, vm (virtual machine), osi (OS image), mm, mn, rsa, switch. + or + + The node type should be pdu + \ **ondiscover**\ (chain.ondiscover) @@ -713,7 +729,7 @@ node Attributes: -\ **outletcount**\ (pdu.outletcount) +\ **outlet**\ (pdu.outlet) The pdu outlet count diff --git a/docs/source/guides/admin-guides/references/man7/pdu.7.rst b/docs/source/guides/admin-guides/references/man7/pdu.7.rst new file mode 100644 index 000000000..1e2397a42 --- /dev/null +++ b/docs/source/guides/admin-guides/references/man7/pdu.7.rst @@ -0,0 +1,85 @@ + +##### +pdu.7 +##### + +.. highlight:: perl + + +**** +NAME +**** + + +\ **pdu**\ - a logical object definition in the xCAT database. + + +******** +SYNOPSIS +******** + + +\ **pdu Attributes:**\ \ *machinetype*\ , \ *modelnum*\ , \ *node*\ , \ *nodetype*\ , \ *outlet*\ , \ *serialnum*\ + + +*********** +DESCRIPTION +*********** + + +Logical objects of this type are stored in the xCAT database in one or more tables. Use the following commands +to manipulate the objects: \ **mkdef**\ , \ **chdef**\ , \ **lsdef**\ , and \ **rmdef**\ . These commands will take care of +knowing which tables the object attributes should be stored in. The attribute list below shows, in +parentheses, what tables each attribute is stored in. + + +*************** +pdu Attributes: +*************** + + + +\ **machinetype**\ (pdu.machinetype) + + The pdu machine type + + + +\ **modelnum**\ (pdu.modelnum) + + The pdu model number + + + +\ **node**\ (pdu.node) + + The hostname/address of the pdu to which the settings apply + + + +\ **nodetype**\ (pdu.nodetype) + + The node type should be pdu + + + +\ **outlet**\ (pdu.outlet) + + The pdu outlet count + + + +\ **serialnum**\ (pdu.serialnum) + + The pdu serial number + + + + +******** +SEE ALSO +******** + + +\ **mkdef(1)**\ , \ **chdef(1)**\ , \ **lsdef(1)**\ , \ **rmdef(1)**\ + diff --git a/docs/source/guides/install-guides/apt/prepare_mgmt_node.rst b/docs/source/guides/install-guides/apt/prepare_mgmt_node.rst index f67fefc32..20d3f0672 100644 --- a/docs/source/guides/install-guides/apt/prepare_mgmt_node.rst +++ b/docs/source/guides/install-guides/apt/prepare_mgmt_node.rst @@ -10,6 +10,8 @@ Install an OS on the Management Node :start-after: BEGIN_install_os_mgmt_node :end-before: END_install_os_mgmt_node +.. _apt_configure_the_base_os_repository: + Configure the Base OS Repository -------------------------------- diff --git a/docs/source/guides/install-guides/zypper/prepare_mgmt_node.rst b/docs/source/guides/install-guides/zypper/prepare_mgmt_node.rst index fce8dc660..fd52e4387 100644 --- a/docs/source/guides/install-guides/zypper/prepare_mgmt_node.rst +++ b/docs/source/guides/install-guides/zypper/prepare_mgmt_node.rst @@ -10,6 +10,8 @@ Install an OS on the Management Node :start-after: BEGIN_install_os_mgmt_node :end-before: END_install_os_mgmt_node +.. _zypper_configure_the_base_os_repository: + Configure the Base OS Repository -------------------------------- diff --git a/docs/source/security/2017/20170216_openssl.rst b/docs/source/security/2017/20170216_openssl.rst new file mode 100644 index 000000000..9f430f713 --- /dev/null +++ b/docs/source/security/2017/20170216_openssl.rst @@ -0,0 +1,25 @@ +2017-02-16 - OpenSSL Vulnerabilities +==================================== + +*Feb 16, 2017*, OpenSSL announced the following security advisories: https://www.openssl.org/news/secadv/20170216.txt + + +Advisory CVEs +------------- + +* CVE-2017-3733 - **Encrypt-Then-Mac renegotiation crash** (Severity:High) + + OpenSSL 1.1.0 users should upgrade to 1.1.0e + + This issue does not affect OpenSSL version 1.0.2. + +Please see the security bulletin above for patch, upgrade, or suggested work around information. + +Action +------ + +xCAT uses OpenSSL for client-server communication but **does not** ship it. + +It is highly recommended to keep your OpenSSL levels up-to-date with the indicated versions in the security bulletins to prevent any potential security threats. Obtain the updated software packages from your Operating system distribution channels. + + diff --git a/docs/source/security/2017/index.rst b/docs/source/security/2017/index.rst index 7c5b764ff..588d8c30e 100644 --- a/docs/source/security/2017/index.rst +++ b/docs/source/security/2017/index.rst @@ -4,4 +4,5 @@ .. toctree:: :maxdepth: 1 + 20170216_openssl.rst 20170126_openssl.rst diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index 8121f475d..787bb64c7 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -50,7 +50,7 @@ our @dsh_valid_env = ( 'DSH_REMOTE_PASSWORD', 'DSH_TO_USERID', 'DSH_FROM_USERID', 'DEVICETYPE', 'RSYNCSN', 'DSH_RSYNC_FILE', - 'RSYNCSNONLY', + 'RSYNCSNONLY', 'DSH_VERIFY', ); select(STDERR); $| = 1; @@ -2492,6 +2492,12 @@ sub config_dsh $dsh_trace && xCAT::MsgUtils->message("I", $rsp, $::CALLBACK); + $$options{'verify'} = $$options{'verify'} || $ENV{'DSH_VERIFY'} || undef; + my $rsp = {}; + $rsp->{data}->[0] = "TRACE: Verify value is $$options{'verify'} "; + $dsh_trace + && xCAT::MsgUtils->message("I", $rsp, $::CALLBACK); + # Check if $$options{'pre-command'} has been overwritten # Mellanox uses pre-command = cli if (!$$options{'pre-command'}) @@ -4434,6 +4440,17 @@ sub parse_and_run_dcp return 0; } + unless ($options{'user'}) + { + # user was not specified with -l flag, check it user calling the command + # was saved in DSH_FROM_USERID environment variable + my $current_userid = $ENV{'DSH_FROM_USERID'}; + if (defined($current_userid)) { + # Set userid from value in DSH_FROM_USERID environment variable + $options{'user'} = $current_userid; + } + } + if (defined($options{'rootimg'})) { if (xCAT::Utils->isAIX()) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 8a0639ea4..a7c3f9f54 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -443,6 +443,19 @@ passed as argument rather than by table value', disable => "Set to 'yes' or '1' to comment out this row.", }, }, + openbmc => { + cols => [qw(node bmc username password comments disable)], + keys => [qw(node)], + table_desc => 'Setting for nodes that are controlled by an on-board OpenBmc.', + descriptions => { + node => 'The node name or group name.', + bmc => 'The hostname of the BMC adapter.', + username => 'The BMC userid.', + password => 'The BMC password.', + comments => 'Any user-written notes.', + disable => "Set to 'yes' or '1' to comment out this row.", + }, + }, iscsi => { cols => [qw(node server target lun iname file userid passwd kernel kcmdline initrd comments disable)], keys => [qw(node)], @@ -559,7 +572,7 @@ passed as argument rather than by table value', ddnsdomain => 'A domain to be combined with nodename to construct FQDN for DDNS updates induced by DHCP. This is not passed down to the client as "domain"', vlanid => 'The vlan ID if this network is within a vlan.', domain => 'The DNS domain name (ex. cluster.com).', - mtu => 'The default MTU for the network', + mtu => 'The default MTU for the network, If multiple networks are applied to the same nic on the SN and/or CN, the MTU shall be the same for those networks.', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", }, @@ -586,7 +599,7 @@ passed as argument rather than by table value', descriptions => { node => 'The node name or group name.', power => 'The method to use to control the power of the node. If not set, the mgt attribute will be used. Valid values: ipmi, blade, hmc, ivm, fsp, kvm, esx, rhevm. If "ipmi", xCAT will search for this node in the ipmi table for more info. If "blade", xCAT will search for this node in the mp table. If "hmc", "ivm", or "fsp", xCAT will search for this node in the ppc table.', - mgt => 'The method to use to do general hardware management of the node. This attribute is used as the default if power or getmac is not set. Valid values: ipmi, blade, hmc, ivm, fsp, bpa, kvm, esx, rhevm. See the power attribute for more details.', + mgt => 'The method to use to do general hardware management of the node. This attribute is used as the default if power or getmac is not set. Valid values: openbmc, ipmi, blade, hmc, ivm, fsp, bpa, kvm, esx, rhevm. See the power attribute for more details.', cons => 'The console method. If nodehm.serialport is set, this will default to the nodehm.mgt setting, otherwise it defaults to unused. Valid values: cyclades, mrv, or the values valid for the mgt attribute.', termserver => 'The hostname of the terminal server.', termport => 'The port number on the terminal server that this node is connected to.', @@ -679,17 +692,19 @@ passed as argument rather than by table value', }, }, pdu => { - cols => [qw(node nodetype machinetype modelnum serialnum outletCount comments disable)], + cols => [qw(node nodetype outlet machinetype modelnum serialnum comments disable)], keys => [qw(node)], nodecol => "node", table_desc => 'Parameters to use when interrogating pdus', descriptions => { node => 'The hostname/address of the pdu to which the settings apply', nodetype => 'The node type should be pdu ', + outlet => 'The pdu outlet count', machinetype => 'The pdu machine type', modelnum => 'The pdu model number', serialnum => 'The pdu serial number', - outletcount => 'The pdu outlet count', + comments => 'Any user-written notes.', + disable => "Set to 'yes' or '1' to comment out this row.", }, }, switches => { @@ -845,8 +860,8 @@ passed as argument rather than by table value', descriptions => { key => 'The type of component this user/pw is for. Valid values: blade (management module), ipmi (BMC), system (nodes), omapi (DHCP), hmc, ivm, cec, frame, switch.', username => 'The default userid for this type of component', - password => 'The default password for this type of component', - cryptmethod => 'Indicates the method that was used to encrypt the password attribute. On AIX systems, if a value is provided for this attribute it indicates that the password attribute is encrypted. If the cryptmethod value is not set it indicates the password is a simple string value. On Linux systems, the cryptmethod can be set to md5, sha256 or sha512. If not set, sha256 will be used as default.', + password => 'The default password for this type of component. On Linux, a crypted form could be provided. Hashes starting with $1$, $5$ and $6$ (md5, sha256 and sha512 respectively) are supported.', + cryptmethod => 'Indicates the method to use to encrypt the password attribute. On AIX systems, if a value is provided for this attribute it indicates that the password attribute is encrypted. If the cryptmethod value is not set it indicates the password is a simple string value. On Linux systems, the cryptmethod can be set to md5, sha256 or sha512. If not set, sha256 will be used as default to encrypt plain-text passwords.', authdomain => 'The domain in which this entry has meaning, e.g. specifying different domain administrators per active directory domain', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", @@ -2447,6 +2462,26 @@ my @nodeattrs = ( tabentry => 'mpa.urlpath', access_tabentry => 'mpa.mpa=attr:node', }, + +######################### + # openbmc table # +########################## + { attr_name => 'bmc', + only_if => 'mgt=openbmc', + tabentry => 'openbmc.bmc', + access_tabentry => 'openbmc.node=attr:node', + }, + { attr_name => 'bmcusername', + only_if => 'mgt=openbmc', + tabentry => 'openbmc.username', + access_tabentry => 'openbmc.node=attr:node', + }, + { attr_name => 'bmcpassword', + only_if => 'mgt=openbmc', + tabentry => 'openbmc.password', + access_tabentry => 'openbmc.node=attr:node', + }, + ###################### # nodepos table # ###################### @@ -2859,6 +2894,11 @@ my @nodeattrs = ( tabentry => 'pdu.nodetype', access_tabentry => 'pdu.node=attr:node', }, + { attr_name => 'outlet', + only_if => 'nodetype=pdu', + tabentry => 'pdu.outlet', + access_tabentry => 'pdu.node=attr:node', + }, { attr_name => 'machinetype', only_if => 'nodetype=pdu', tabentry => 'pdu.machinetype', @@ -2874,11 +2914,6 @@ my @nodeattrs = ( tabentry => 'pdu.serialnum', access_tabentry => 'pdu.node=attr:node', }, - { attr_name => 'outletcount', - only_if => 'nodetype=pdu', - tabentry => 'pdu.outletcount', - access_tabentry => 'pdu.node=attr:node', - }, ######################### ## switches table # @@ -4100,6 +4135,11 @@ push(@{ $defspec{group}->{'attrs'} }, @nodeattrs); tabentry => 'pdu.nodetype', access_tabentry => 'pdu.node=attr:node', }, + { attr_name => 'outlet', + only_if => 'nodetype=pdu', + tabentry => 'pdu.outlet', + access_tabentry => 'pdu.node=attr:node', + }, { attr_name => 'machinetype', only_if => 'nodetype=pdu', tabentry => 'pdu.machinetype', @@ -4115,11 +4155,6 @@ push(@{ $defspec{group}->{'attrs'} }, @nodeattrs); tabentry => 'pdu.serialnum', access_tabentry => 'pdu.node=attr:node', }, - { attr_name => 'outletcount', - only_if => 'nodetype=pdu', - tabentry => 'pdu.outletcount', - access_tabentry => 'pdu.node=attr:node', - }, ); diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index 5f1714f50..576598ef9 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -2358,6 +2358,10 @@ sub transRegexAttrs undef $@; #extract_bracketed would have set $@ if it didn't return, undef $@ $retval = $node; $retval =~ s/$parts[0]/$parts[1]/; + if ($retval =~ /^$/) { + return undef; + } + return $retval; } while ($curr) { diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 1b8e1d5c3..0cbba194a 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -26,6 +26,8 @@ my %usage = ( "rpower" => "Usage: rpower [--nodeps] [on|onstandby|off|suspend|reset|stat|state|boot] [-V|--verbose] [-m table.colum==expectedstatus][-m table.colum==expectedstatus...] [-r ] [-t ] rpower [-h|--help|-v|--version] + OpenBMC specific: + rpower noderange [on|off|reset|boot|stat|state|status] KVM Virtualization specific: rpower [boot] [ -c ] PPC (with IVM or HMC) specific: @@ -44,6 +46,8 @@ my %usage = ( rpower [on|onstandby|off|cycle|state|sms] Blade(using AMM) specific: rpower [cycle|softoff] [-V|--verbose] + Lenovo high-density server specific: + rpower [on|off|reset|boot|reseat] zVM specific: rpower noderange [on|off|reset|stat|softoff] MIC specific: @@ -51,8 +55,8 @@ my %usage = ( docker specific: rpower noderange [start|stop|restart|pause|unpause|state] pdu specific: - rpower noderange [off|on|stat] - rpower noderange [pduoff|pduon|pdustat] + rpower noderange [off|on|stat|status|reset] + rpower noderange [pduoff|pduon|pdustat|pdustatus|pdureset] ", "rbeacon" => "Usage: rbeacon [on|off|stat] [-V|--verbose] diff --git a/xCAT-client/bin/rcons b/xCAT-client/bin/rcons index 98cbc69fe..2fa148d6a 100755 --- a/xCAT-client/bin/rcons +++ b/xCAT-client/bin/rcons @@ -73,7 +73,7 @@ fi if [ $USE_CONFLUENT == "1" ] && ([ -x "/opt/confluent/bin/confetty" ] || [ -x "/usr/bin/confetty" ] || [ -x "/usr/local/bin/confetty" ]); then # use confluent, make sure conserver is not also running - CONSERVER_RC=`service conserver status >& /dev/null; echo $?` + CONSERVER_RC=`pidof conserver >> /dev/null; echo $?` if [[ ${CONSERVER_RC} == 0 ]]; then echo "Error: consoleservice is set to 'confluent' but conserver is running. Stop conserver, run makeconfluentcfg, and retry..." exit 1 diff --git a/xCAT-client/bin/wcons b/xCAT-client/bin/wcons index 321e87634..13dd44849 100755 --- a/xCAT-client/bin/wcons +++ b/xCAT-client/bin/wcons @@ -17,7 +17,7 @@ unless ($ENV{DISPLAY}) { my $mydir = dirname($0); my $sb; my $tilefact; -my $xrm = "-xrm xterm.mainMenu.*.font:fixed -xrm xterm.vtMenu.*.font:fixed -xrm xterm.fontMenu.*.font:fixed -xrm xterm -xrm xterm.vt100.font6:grvga.737"; +my $xrm = "-xrm xterm.mainMenu.*.font:fixed -xrm xterm.vtMenu.*.font:fixed -xrm xterm.fontMenu.*.font:fixed -xrm xterm -xrm xterm.vt100.font6:grvga.737 -xrm xterm.vt100.color0:#000000 -xrm xterm.vt100.color1:#AA0000 -xrm xterm.vt100.color2:#00AA00 -xrm xterm.vt100.color3:#AA5500 -xrm xterm.vt100.color4:#0000AA -xrm xterm.vt100.color5:#AA00AA -xrm xterm.vt100.color6:#00AAAA -xrm xterm.vt100.color7:#AAAAAA -xrm xterm.vt100.color8:#555555 -xrm xterm.vt100.color9:#FF5555 -xrm xterm.vt100.color10:#55FF55 -xrm xterm.vt100.color11:#FFFF55 -xrm xterm.vt100.color12:#5555FF -xrm xterm.vt100.color13:#FF55FF -xrm xterm.vt100.color14:#55FFFF -xrm xterm.vt100.color15:#FFFFFF"; my $font = "5x7"; my $sizegeometry; GetOptions( diff --git a/xCAT-client/bin/xdsh b/xCAT-client/bin/xdsh index 0797f4d93..89e4ff0a6 100644 --- a/xCAT-client/bin/xdsh +++ b/xCAT-client/bin/xdsh @@ -190,6 +190,11 @@ if ($ENV{'DSH_ENVIRONMENT'}) push(@{ $cmdref->{env} }, "DSH_ENVIRONMENT=$ENV{'DSH_ENVIRONMENT'}"); } +if ($ENV{'DSH_VERIFY'}) +{ + push(@{ $cmdref->{env} }, "DSH_VERIFY=$ENV{'DSH_VERIFY'}"); +} + xCAT::Client::submit_request($cmdref, \&xCAT::Client::handle_response); exit $xCAT::Client::EXITCODE; @@ -666,6 +671,24 @@ sub parse_args_xdcp $::NODE_RCP = 1; } + my $to_userid; + if ($options{'user'}) # if -l option + { + $to_userid = $options{'user'}; + } + else + { + # find out who is the current user running xdcp + my $current_userid = getpwuid($>); + + $ENV{DSH_FROM_USERID} = $current_userid; + + $to_userid = $current_userid; + } + # Save userid running this command in ENV variable. + # It will be later extraced by DSHCLI.pm + $ENV{DSH_TO_USERID} = $to_userid; + if ($options{'bypass'}) { $ENV{XCATBYPASS} = "yes"; # bypass xcatd diff --git a/xCAT-client/pods/man1/getadapter.1.pod b/xCAT-client/pods/man1/getadapter.1.pod index 2fca0dac1..0c10af7a1 100644 --- a/xCAT-client/pods/man1/getadapter.1.pod +++ b/xCAT-client/pods/man1/getadapter.1.pod @@ -14,12 +14,11 @@ Traditionally, network interfaces in Linux are enumerated as eth[0123...], but t B use genesis to collect network adapters information, so that mean it need to restart the target node. -B follows below scheme: +B For each node within the , follows below scheme: -If the target node is scaned for the first time, B will trigger genesis to collect information then save the information at local. -If the target node has ever been scaned, i.e. this node has network device information in local, B use the local information first. -If user doesn't want to use local information, can use B<-f> option to force to trigger new round scan process. -if part nodes of I don't have network device information in local and the rest have, B only trigger real scan process for these nodes which don't have local information, the nodes have network device information in local, B still use the local information first. +If the target node is scaned for the first time, B will trigger genesis to collect information then save the information at the B column of nics table. +If the target node has ever been scaned, B will use the information from nics table first. +If user hopes to scan the adapter information for the node but these information already exist, B<-f> option can be used to start rescan process. B tries to collect more information for the target network device, but doesn't guarantee collect same much information for every network device. diff --git a/xCAT-client/pods/man1/pping.1.pod b/xCAT-client/pods/man1/pping.1.pod index 8e563ed41..93eac03f4 100644 --- a/xCAT-client/pods/man1/pping.1.pod +++ b/xCAT-client/pods/man1/pping.1.pod @@ -16,7 +16,7 @@ B {B<-v>|B<--version>} B is a utility used to ping a list of nodes in parallel. B will return an unsorted list of nodes with a ping or noping status. -B front-ends nmap or fping if available. +B front-ends B or B if available. This command does not support the xcatd client/server communication. It must be run on the management node. @@ -34,7 +34,7 @@ If more than one interface is specified, each interface will be combined with th =item B<-f>|B<--use_fping> -Use fping instead of nmap +Use B instead of B =item B<-h>|B<--help> diff --git a/xCAT-client/pods/man1/rmdef.1.pod b/xCAT-client/pods/man1/rmdef.1.pod index e226fe80c..95b4358b1 100644 --- a/xCAT-client/pods/man1/rmdef.1.pod +++ b/xCAT-client/pods/man1/rmdef.1.pod @@ -8,7 +8,7 @@ B - Use this command to remove xCAT data object definitions. B [B<-h>|B<--help>] [B<-t> I] B [B<-V>|B<--verbose>] [B<-a>|B<--all>] [B<-t> I] [B<-o> I] -[B<-f>|B<--force>] [I] +[B<-f>|B<--force>] [B<-C>|B<--cleanup>] [I] =head1 DESCRIPTION @@ -22,15 +22,23 @@ This command is used to remove xCAT object definitions that are stored in the xC =item B<-a|--all> -Clear the whole xCAT database. A backup of the xCAT definitions should be saved before using this option. Once all the data is removed the xCAT daemon will no longer work. Most xCAT commands will fail. -In order to use xCAT commands again, you have two options. You can restore your database from your backup by switching to bypass mode, and running the restorexCATdb command. -You switch to bypass mode by setting the XCATBYPASS environmant variable. (ex. "export XCATBYPASS=yes") -A second option is to run xcatconfig -d. This will restore the initial setup of the database as when xCAT was initially installed. -You can then restart xcatd and run xCAT commands. +Clear the whole xCAT database. A backup of the xCAT definitions should be saved before using this option as the xCAT daemons will no longer work once cleared. + +To restore: + +=over 5 + +=item 1. B and run the B command. + +or + +=item 2. Run B which initializes the database the same as when xCAT was installed. + +=back =item B<-f|--force> -Use this with the all option as an extra indicator that ALL definitions are to be removed. +Use this with the B<--all> option as an extra indicator that ALL definitions are to be removed. =item B<-h|--help> @@ -48,6 +56,10 @@ A set of comma delimited object names. A set of comma delimited object types. +=item B<-C|--cleanup> + +Perform additional cleanup by running B on the objects specified in the I. + =item B<-V|--verbose> Verbose mode. diff --git a/xCAT-client/pods/man1/rpower.1.pod b/xCAT-client/pods/man1/rpower.1.pod index d9ca23bf4..2a8bd9d96 100644 --- a/xCAT-client/pods/man1/rpower.1.pod +++ b/xCAT-client/pods/man1/rpower.1.pod @@ -12,7 +12,11 @@ B [B<-h>|B<--help>|B<-v>|B<--version>] B I [B|B|B|B|B|B|B|B|B|B [B<-w> I] [B<-o>] [B<-r>]] -B I [B|B|B] +B I [B|B|B|B] + +=head2 OpenBMC specific: + +B I [B|B|B|B|B|B|B] =head2 PPC (with IVM or HMC) specific: @@ -46,7 +50,11 @@ B I [B|B|B|B|B|B] =head2 Blade specific: -B I [B|B] +B I [B|B] + +=head2 Lenovo High-Density Server specific: + +B I [B|B|B|B|B] =head2 zVM specific: @@ -58,7 +66,7 @@ B I [B|B|B|B|B|B =head2 pdu specific: -B I [B|B|B] +B I [B|B|B|B] =head1 DESCRIPTION @@ -169,6 +177,10 @@ This option is recommended over B. Power off, then on. +=item B + +For Lenovo high-density servers, simulates unplugging and replugging the node into the chassis. + =item B Boot the node to open firmware console mode. diff --git a/xCAT-client/pods/man1/xdsh.1.pod b/xCAT-client/pods/man1/xdsh.1.pod index 72d3ede24..38596e793 100644 --- a/xCAT-client/pods/man1/xdsh.1.pod +++ b/xCAT-client/pods/man1/xdsh.1.pod @@ -231,7 +231,7 @@ for valid names. xdsh will chroot (xcatchroot for AIX) to this path and run the xdsh command against the install image. No other xdsh flags, environment variables apply with this input. A noderange is not accepted. Only runs on the local host, -normally the Management Node. The command you run must not prompt for input, the prompt will not be returned to you, and it will appear that xdsh hangs. +normally the Management Node. The command you run must not prompt for input, the prompt will not be returned to you, and it will appear that B hangs. =item B<-K>|B<--ssh-setup> @@ -324,8 +324,8 @@ available from any target in the specified I, B displays an error and terminates execution for the remote targets that failed to respond. If I is not specified, B waits indefinitely to continue processing output from -all remote targets. The exception is the -K flag which defaults -to 10 seconds. +all remote targets. The exception is the B<-K> flag which defaults +to 10 seconds. =item B<-T>|B<--trace> @@ -430,29 +430,32 @@ remote I is used. If B is set to the password of the userid (usually root) that will ssh to the node, then when -you use the -K flag, you will not be prompted for a password. +you use the B<-K> flag, you will not be prompted for a password. =item B Specifies the shell syntax to use on remote targets; B or -B. If not specified, the B syntax is assumed. This +B. If not specified, the B syntax is assumed. This variable is overridden by the B<-S> flag. =item B -Specifies the time, in seconds, to wait for output from -each remote target. This variable is overridden by the B<-t> -flag. +Specifies the time, in seconds, to wait for output from +each remote target. This variable is overridden by the B<-t> flag. + +=item B + +Verifies each target before executing any remote commands on the target. If a target is not responding, execution of remote commands for the target is canceled. This variable is overridden by the B<-v> flag. =back =head1 B -To provide backward compatibility for scripts written using dsh in +To provide backward compatibility for scripts written using B in AIX and CSM, a tool has been provided B, which will build node group files from the -xCAT database that can be used by dsh. See B. +xCAT database that can be used by B. See B. =head1 B @@ -471,7 +474,7 @@ userdefined. =head1 B -The dsh command exit code is 0 if the command executed without errors and all remote shell commands finished with exit codes of 0. If internal dsh errors occur or the remote shell commands do not complete successfully, the dsh command exit value is greater than 0. The exit value is increased by 1 for each successive instance of an unsuccessful remote command execution. If the remotely issued command is run in the background, the exit code of the remotely issued command is 0. +The B command exit code is 0 if the command executed without errors and all remote shell commands finished with exit codes of 0. If internal dsh errors occur or the remote shell commands do not complete successfully, the dsh command exit value is greater than 0. The exit value is increased by 1 for each successive instance of an unsuccessful remote command execution. If the remotely issued command is run in the background, the exit code of the remotely issued command is 0. =head1 B @@ -525,20 +528,20 @@ To cleanup the servicenode directory that stages the copy of files to the nodes, To define the QLogic IB switch as a node and to set up the SSH keys for IB switch B with device configuration file -B and user name B, Enter +B and user name B, enter chdef -t node -o qswitch groups=all nodetype=switch xdsh qswitch -K -l username --devicetype IBSwitch::Qlogic =item 10. -To define the Management Node in the database so you can use xdsh, Enter +To define the Management Node in the database so you can use B, enter xcatconfig -m =item 11. To define the Mellanox switch as a node and run a command to show the ssh keys. -B with and user name B, Enter +B with and user name B, enter chdef -t node -o mswitch groups=all nodetype=switch @@ -560,7 +563,7 @@ If it is for Telnet, add I in front of the user name: I. =item 13. -To run xdsh with the non-root userid "user1" that has been setup as an xCAT userid and with sudo on node1 and node2 to run as root, do the following, see xCAT doc on Granting_Users_xCAT_privileges: +To run B with the non-root userid "user1" that has been setup as an xCAT userid and with sudo on node1 and node2 to run as root, do the following, see xCAT doc on Granting_Users_xCAT_privileges: xdsh node1,node2 --sudo -l user1 "cat /etc/passwd" diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index f1af844ff..f33ef9c3d 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -72,6 +72,17 @@ if [ -r /sys/devices/virtual/dmi/id/product_name ]; then #x86 MTM=VMware else MTM=`cat /sys/devices/virtual/dmi/id/product_name|awk -F'[' '{print $2}'|awk -F']' '{print $1}'` + if [ -z "$MTM" ]; then + FRU=`ipmitool fru print 0` + if [ $? -eq 0 ]; then + MTM=`echo "$FRU" | awk -F': ' '/Product Manufacturer/ {m=$2} /Product Name/ {n=$2} END {print m":"n}'` + else + logger -s -t $log_label -p local4.warning "Couldn't find MTM information in FRU, falling back to DMI (MTMS-based discovery may fail)" + m=`cat /sys/devices/virtual/dmi/id/sys_vendor` + n=`cat /sys/devices/virtual/dmi/id/product_name` + MTM="$m:$n" + fi + fi SERIAL=`cat /sys/devices/virtual/dmi/id/product_serial` fi CPUCOUNT=`cat /proc/cpuinfo |grep "model name"|wc -l` diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 0f39e1e89..88f86890d 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -266,8 +266,11 @@ ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6| logger -s -t $log_label -p local4.info "Starting ntpd..." ntpd -g -x -logger -s -t $log_label -p local4.info "Waiting for ntpd to synchronize..." -ntp-wait -n 1999 -s 1 -v +# ntp-wait defaults to 6 seconds between retries, wait for 1 minute +NTP_TRIES=10 +NTP_SLEEP=6 +logger -s -t $log_label -p local4.info "Waiting for $NTP_TRIES x $NTP_SLEEP seconds for ntpd to synchronize..." +ntp-wait -n $NTP_TRIES -s $NTP_SLEEP -v if [ $? -ne 0 ] then logger -s -t $log_label -p local4.info "... ntpd did not synchronize." @@ -422,7 +425,11 @@ while :; do logger -s -t $log_label -p local4.info "Poweroff..." poweroff -f else - logger -s -t $log_label -p local4.err "Unrecognized directive (dest=$dest)" + if [ "$dest" = error ]; then + logger -s -t $log_label -p local4.info "$destparameter" + else + logger -s -t $log_label -p local4.err "Unrecognized directive (dest=$dest)" + fi destiny='' dest='' delay=$((30+$RANDOM%270)) diff --git a/xCAT-genesis-scripts/bin/nextdestiny b/xCAT-genesis-scripts/bin/nextdestiny index 29b6c255f..086951c98 100755 --- a/xCAT-genesis-scripts/bin/nextdestiny +++ b/xCAT-genesis-scripts/bin/nextdestiny @@ -7,23 +7,30 @@ echo " 300 " > /tmp/destreq.xml if [ -f /tmp/destiny.xml ]; then rm /tmp/destiny.xml; fi -while [ ! -f /tmp/destiny.xml ] || grep error /tmp/destiny.xml; do - if [ -f /tmp/destiny.xml ]; then - timer=60 - while [ $timer -gt 0 ]; do - echo -en "Retrying in $timer seconds \r" >&2 - sleep 1 - timer=$(($timer-1)); - done - fi +timer=0 +while [ ! -f /tmp/destiny.xml ]; do + while [ $timer -gt 0 ]; do + echo -en "No destiny command received, retrying in $timer seconds \r" >&2 + sleep 1 + timer=$(($timer-1)); + done echo " " >&2; if [ -f /etc/xcat/cert.pem -a -f /etc/xcat/certkey.pem ]; then #use client cert if available cat /tmp/destreq.xml | openssl s_client -key /etc/xcat/certkey.pem -cert /etc/xcat/cert.pem -connect $XCATDEST -quiet 2> /dev/null > /tmp/destiny.xml else cat /tmp/destreq.xml | openssl s_client -connect $XCATDEST -quiet 2> /dev/null > /tmp/destiny.xml fi + timer=60 done rm /tmp/destreq.xml DESTINY=`grep '' /tmp/destiny.xml | awk -F'>' '{print $2}'|awk -F'<' '{print $1}'` +if [ -z "$DESTINY" ]; then + ERROR=`grep '' /tmp/destiny.xml | awk -F'>' '{print $2}'|awk -F'<' '{print $1}'` + if [ ! -z "$ERROR" ]; then + DESTINY="error=$ERROR" + else + DESTINY="error=No destiny command received" + fi +fi rm /tmp/destiny.xml echo $DESTINY diff --git a/xCAT-probe/subcmds/osdeploy b/xCAT-probe/subcmds/osdeploy index e6b4f1f51..1b23044cc 100755 --- a/xCAT-probe/subcmds/osdeploy +++ b/xCAT-probe/subcmds/osdeploy @@ -115,6 +115,19 @@ unless ($noderange) { exit 1; } +my @nodes = split (",", $noderange); +my @error_nodes; +foreach my $node (@nodes) { + if ($node =~ /^-/) { + push @error_nodes, $node; + } +} +if (@error_nodes) { + my $error = join (",", @error_nodes); + probe_utils->send_msg("stdout", "f", "[$error]: Wrong node definition."); + exit 1; +} + if ($rollforward_time_of_replay) { if (($rollforward_time_of_replay !~ /(\d+)h(\d+)m/i) && ($rollforward_time_of_replay !~ /^(\d+)h*$/i) && ($rollforward_time_of_replay !~ /^(\d+)m$/i)) { probe_utils->send_msg("stdout", "f", "Unsupported time format for option '-r'"); diff --git a/xCAT-server/lib/perl/xCAT/IPMI.pm b/xCAT-server/lib/perl/xCAT/IPMI.pm index bb332bb13..d7223dc6b 100644 --- a/xCAT-server/lib/perl/xCAT/IPMI.pm +++ b/xCAT-server/lib/perl/xCAT/IPMI.pm @@ -15,6 +15,7 @@ use lib "$::XCATROOT/lib/perl"; use strict; use warnings "all"; use Time::HiRes qw/time/; +use xCAT::SvrUtils; use IO::Socket::INET qw/!AF_INET6 !PF_INET6/; my $initialtimeout = 0.5; @@ -79,6 +80,63 @@ sub hexdump { print "\n"; } +my %command_info = ( + 6 => { + 56 => "Get Channel Authentication Capabilities", + 59 => "Set session privilege level", + 60 => "Close Session", + 58 => "activate session", + 57 => "Get Session Challenge", + 1 => "Get Device ID", + 2 => "Cold Reset", + 55 => "Get System GUID", + 64 => "Set Channel Access", + 76 => "Set User Payload Access", + 10 => "Get Command Support", + }, + 4 => { + 18 => "Set PEF Configuration Parameters", + 19 => "Get PEF Configuration Parameters", + 45 => "Get Sensor Reading", + }, + 0 => { + 8 => "Set System Boot Options", + 9 => "Get System Boot Options", + 4 => "Chassis Identify(beacon)", + 2 => "Chassis Control", + 1 => "Get Chassis Status", + }, + 12 => { + 1 => "Set LAN Configuration Parameters", + 2 => "Get LAN Configuration Parameters", + 33 => "Set SOL Configuration Parameters", + 34 => "Get SOL Configuration Parameters", + }, + 10 => { + 35 => "Get SDR", + 34 => "Reserve SDR Repository", + 71 => "Clear SEL", + 67 => "Get SEL Entry", + 66 => "Reserve SEL", + 72 => "Get SEL Time", + 64 => "Get SEL Info", + 17 => "Read FRU Data", + 16 => "Get FRU Inventory Area Info", + 32 => "Get SDR Repository Info", + }, +); + +my %netfn_types = ( + 0 => "Chassis", + 2 => "Bridge", + 4 => "Sensor/Event", + 6 => "App", + 8 => "Firmware", + 10 => "Storage", + 12 => "Transport", + # do we need to define anymore then these? +); + my %payload_types = ( #help readability in certain areas of code by specifying payload by name rather than number 'ipmi' => 0, 'sol' => 1, @@ -415,6 +473,12 @@ sub subcmd { my %args = @_; $self->{expectedcmd} = $args{command}; $self->{expectednetfn} = $args{netfn} + 1; + if ($self->{onlogon_args}->{xcatdebugmode}) { + my $command_string = $command_info{$args{netfn}}->{$args{command}}; + my $data_values = join ", ", @{$args{data}}; + my $msg = sprintf ("[ipmi_debug] $self->{onlogon_args}->{command}:$self->{onlogon_args}->{subcommand}(@{$self->{onlogon_args}->{extraargs}}), raw_cmd: netfn(0x%02x=>%s), cmd(0x%02x=>%s), data=[%s]", $args{netfn}, $netfn_types{$args{netfn}}, $args{command}, $command_string, $data_values); + xCAT::SvrUtils::sendmsg([0, $msg], $self->{onlogon_args}->{outfunc}); + } my $seqincrement = 7; while ($tabooseq{ $self->{expectednetfn} }->{ $self->{expectedcmd} }->{ $self->{seqlun} } and $seqincrement) { #avoid using a seqlun formerly marked 'taboo', but don't advance by more than 7, just in case $tabooseq{ $self->{expectednetfn} }->{ $self->{expectedcmd} }->{ $self->{seqlun} }--; #forgive a taboo lun over time... diff --git a/xCAT-server/lib/perl/xCAT/OPENBMC.pm b/xCAT-server/lib/perl/xCAT/OPENBMC.pm new file mode 100644 index 000000000..424f83c36 --- /dev/null +++ b/xCAT-server/lib/perl/xCAT/OPENBMC.pm @@ -0,0 +1,46 @@ +#!/usr/bin/perl +## IBM(c) 2107 EPL license http://www.eclipse.org/legal/epl-v10.html + +package xCAT::OPENBMC; + +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; +use strict; +use warnings "all"; + +use HTTP::Async; +use HTTP::Request; +use HTTP::Headers; +use HTTP::Cookies; +use Data::Dumper; + +my $header = HTTP::Headers->new('Content-Type' => 'application/json'); + +sub new { + my $async = shift; + $async = shift if (($async) && ($async =~ /OPENBMC/)); + my $url = shift; + my $content = shift; + my $method = 'POST'; + + my $id = send_request( $async, $method, $url, $content ); + + return $id; +} + +sub send_request { + my $async = shift; + $async = shift if (($async) && ($async =~ /OPENBMC/)); + my $method = shift; + my $url = shift; + my $content = shift; + + my $request = HTTP::Request->new( $method, $url, $header, $content ); + my $id = $async->add_with_opts($request, {}); + return $id; +} + +1; diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index cfb58162c..ab2e4f072 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -235,7 +235,7 @@ sub process_command { if ($command eq 'rpower') { $subcommand = $request->{op}; } #pdu commands will be handled in the pdu plugin - if(($subcommand eq 'pduoff') || ($subcommand eq 'pduon') || ($subcommand eq 'pdustat')){ + if(($subcommand eq 'pduoff') || ($subcommand eq 'pduon') || ($subcommand eq 'pdustat') || ($subcommand eq 'pdureset')){ return 0; } diff --git a/xCAT-server/lib/perl/xCAT/PasswordUtils.pm b/xCAT-server/lib/perl/xCAT/PasswordUtils.pm index d9647deec..e17ac14a5 100644 --- a/xCAT-server/lib/perl/xCAT/PasswordUtils.pm +++ b/xCAT-server/lib/perl/xCAT/PasswordUtils.pm @@ -149,16 +149,21 @@ sub crypt_system_password { "ERROR: Unable to get password from database table $table, key=$key"); return undef; } - $cryptmethod = $data->{'cryptmethod'}; - if (!$cryptmethod) { - # Use sha256 crypt method by default - $result = crypt($password, $CRYPT_METHOD{'sha256'} . xCAT::Utils::genpassword(8)); - } elsif( defined($CRYPT_METHOD{$cryptmethod})) { - $result = crypt($password, - $CRYPT_METHOD{$cryptmethod} . xCAT::Utils::genpassword(8)); + if (($password =~ /^\$1\$/) || ($password =~ /^\$5\$/) || ($password =~ /^\$6\$/)) { + # $password is already hashed + $result = $password; } else { - xCAT::MsgUtils->message("S", "Unsupported crypt method $cryptmethod"); - return undef; + $cryptmethod = $data->{'cryptmethod'}; + if (!$cryptmethod) { + # Use sha256 crypt method by default + $result = crypt($password, $CRYPT_METHOD{'sha256'} . xCAT::Utils::genpassword(8)); + } elsif( defined($CRYPT_METHOD{$cryptmethod})) { + $result = crypt($password, + $CRYPT_METHOD{$cryptmethod} . xCAT::Utils::genpassword(8)); + } else { + xCAT::MsgUtils->message("S", "Unsupported crypt method $cryptmethod"); + return undef; + } } return $result; } diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index 257a2625b..9952169d5 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -1582,7 +1582,13 @@ sub dump_all_attribs_in_tabs } else { $values .= "$attrib=$val||"; if ($attrib =~ /^disable$/) { - $values .= "comments=$t"; + # Updated on 2017-03-22 for issue 2634 Quotes in tables' comment field break mypostscript + # The original line is : $values .= "comments=$t"; + # In order to fix issue 2634, change this line to : $values .= "comments="; + # To keep the free-style of comments and avoid the issues caused by special characters in + # the comments, the value of comments will not be appending to network related environment + # variables in mypostscript + $values .= "comments="; } } } diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 2b72c6e39..06dc55b2b 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -16,6 +16,7 @@ use xCAT::Utils; use xCAT::TableUtils; use xCAT::NetworkUtils; use xCAT::PasswordUtils; +use xCAT::MsgUtils; use XML::Simple; BEGIN @@ -852,7 +853,10 @@ sub windows_join_data { } unless ($adminuser and $adminpass) { my $passtab = xCAT::Table->new('passwd', -create => 0); - unless ($passtab) { sendmsg([ 1, "Error authenticating to Active Directory" ], $node); return; } + unless ($passtab) { + xCAT::MsgUtils->message("SE", "[ERROR]$node: Error authenticating to Active Directory"); + return; + } my @adpents = $passtab->getAttribs({ key => 'activedirectory' }, [ 'username', 'password', 'authdomain' ]); my $adpent; foreach $adpent (@adpents) { @@ -1411,7 +1415,10 @@ sub machinepassword { $ENV{KRB5CCNAME} = "/tmp/xcat/krbcache.$realm.$$"; unless ($loggedrealms{$realm}) { my $passtab = xCAT::Table->new('passwd', -create => 0); - unless ($passtab) { sendmsg([ 1, "Error authenticating to Active Directory" ], $node); return; } + unless ($passtab) { + xCAT::MsgUtils->message("SE", "[ERROR]$node: Error authenticating to Active Directory"); + return; + } my @adpents = $passtab->getAttribs({ key => 'activedirectory' }, [ 'username', 'password', 'authdomain' ]); my $adpent; my $username; @@ -1452,7 +1459,7 @@ sub machinepassword { } } unless ($server) { - sendmsg([ 1, "Unable to determine a directory server to communicate with, try site.directoryserver" ]); + xCAT::MsgUtils->message("SE", "[ERROR]Unable to determine a directory server to communicate with, try site.directoryserver"); return; } } @@ -1589,7 +1596,7 @@ sub crydb $kp{$k} = $v if defined($k); } return \%kp if %kp; - sendmsg([ 1, "Unable to parse password parameters $key" ]); + xCAT::MsgUtils->message("SE", "[ERROR]Unable to parse password parameters $key"); return undef; }; $kp = $get_query_map->($key); diff --git a/xCAT-server/lib/xcat/dsh/Context/DSH.pm b/xCAT-server/lib/xcat/dsh/Context/DSH.pm index 14299915b..2d30f630d 100644 --- a/xCAT-server/lib/xcat/dsh/Context/DSH.pm +++ b/xCAT-server/lib/xcat/dsh/Context/DSH.pm @@ -132,6 +132,7 @@ sub context_properties { || $ENV{'DSH_REPORTS_DIRECTORY'}; $properties{'DSH_SYNTAX'} = $ENV{'DSH_SYNTAX'}; $properties{'DSH_TIMEOUT'} = $ENV{'DSH_TIMEOUT'}; + $properties{'DSH_VERIFY'} = $ENV{'DSH_VERIFY'}; $properties{'RSYNC_RSH'} = $ENV{'RSYNC_RSH'}; if ($ENV{'DSH_ON_HMC'}) { diff --git a/xCAT-server/lib/xcat/plugins/AAsn.pm b/xCAT-server/lib/xcat/plugins/AAsn.pm index 2bf735b03..40b90d15a 100755 --- a/xCAT-server/lib/xcat/plugins/AAsn.pm +++ b/xCAT-server/lib/xcat/plugins/AAsn.pm @@ -1279,7 +1279,7 @@ sub setup_HTTP #----------------------------------------------------------------------------- sub stop_TFTP { - my $distro; + my $distro=xCAT::Utils->osver(); # Check whether the tftp-hpa has been installed, the ubuntu tftpd-hpa configure file is under /etc/default unless (-x "/usr/sbin/in.tftpd" and (-e "/etc/xinetd.d/tftp" or -e "/etc/default/tftpd-hpa")) { xCAT::MsgUtils->message("S", "ERROR: The tftpd was not installed, enable the tftp failed."); diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index d91d51c3e..f263fdfe4 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -468,6 +468,7 @@ sub processArgs undef $::opt_nics; undef $::opt_setattr; undef $::opt_template; + undef $::opt_cleanup; # parse the options - include any option from all 4 cmds Getopt::Long::Configure("no_pass_through"); @@ -497,6 +498,7 @@ sub processArgs 'nics' => \$::opt_nics, 'u' => \$::opt_setattr, 'template:s' => \$::opt_template, + 'C|cleanup' => \$::opt_cleanup, ) ) { @@ -513,6 +515,13 @@ sub processArgs return 2; } + if (defined($::opt_cleanup) && ($::command ne "rmdef")) { + my $rsp; + $rsp->{data}->[0] = "Option \'-C\' can not be used with $::command."; + xCAT::MsgUtils->message("E", $rsp, $::callback); + return 2; + } + if (defined($::opt_setattr)) { if (!$::opt_t && !$::filedata) { $::opt_t = 'osimage'; @@ -4015,6 +4024,9 @@ sub defrm # process the command line my $rc = &processArgs; + # Issue info message if more than cleanup_msg_trigger nodes are being removed with --cleanup option + my $cleanup_msg_trigger = 100; + if ($rc != 0) { @@ -4258,24 +4270,33 @@ sub defrm } } - # Call nodeset offline on each node to cleanup its boot configuration files from /tftpboot directory - if ($doreq) { - # Go through each object and make sure it is a node type - my @allnodes; - foreach my $single_object (keys %objhash) { - if ($objhash{$single_object} eq "node") { - # build a list of nodes to offline - push @allnodes, $single_object; + if ($::opt_cleanup) { + # Call nodeset offline on each node to cleanup its boot configuration files from /tftpboot directory + if ($doreq) { + # Go through each object and make sure it is a node type + my @allnodes; + foreach my $single_object (keys %objhash) { + if ($objhash{$single_object} eq "node") { + # build a list of nodes to offline + push @allnodes, $single_object; + } } + # If cleaning up (issuing nodeset offline) for more than cleanup_msg_trigger node, + # issue info message + if (@allnodes > $cleanup_msg_trigger) { + my $rsp; + $rsp->{data}->[0] = "Performing configuration cleanup. This might take a some time."; + xCAT::MsgUtils->message("I", $rsp, $::callback); + } + # Run nodeset offline and capture output. + # But the output can be ignored since we do not want to prevent user from doing rmdef if + # nodeset returns some error. + my @output = xCAT::Utils->runxcmd({ + command => ['nodeset'], + node => [@allnodes], + arg => ['offline'], + }, $doreq, 0 ,1); } - # Run nodeset offline and capture output. - # But the output can be ignored since we do not want to prevent user from doing rmdef if - # nodeset returns some error. - my @output = xCAT::Utils->runxcmd({ - command => ['nodeset'], - node => [@allnodes], - arg => ['offline'], - }, $doreq, 0 ,1); } # remove the objects @@ -4488,7 +4509,7 @@ sub defrm_usage $rsp->{data}->[0] = "\nUsage: rmdef - Remove xCAT data object definitions.\n"; $rsp->{data}->[1] = " rmdef [-h | --help ] [-t object-types]\n"; $rsp->{data}->[2] = " rmdef [-V | --verbose] [-t object-types] [-a | --all] [-f | --force]"; - $rsp->{data}->[3] = " [-o object-names] [-w attr=val,[attr=val...] [noderange]\n"; + $rsp->{data}->[3] = " [-o object-names] [-C | --cleanup] [noderange]\n"; $rsp->{data}->[4] = "\nThe following data object types are supported by xCAT.\n"; my $n = 5; diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 0fc2da096..237a4e8b7 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -2218,7 +2218,8 @@ sub copycd unless ($distname) { - print "INFO - Could not find ID=$did in the discinfo database for OS=$desc ARCH=$darch NUM=$dno, attempt to auto-detect...\n"; + print "INFO - Could not find ID=$did in the discinfo database for OS=$desc ARCH=$darch NUM=$dno\n"; + print "INFO - Attempting to auto-detect...\n"; if ($desc =~ /IBM_PowerKVM/) { # check for PowerKVM support @@ -2232,7 +2233,15 @@ sub copycd # RHEL 7.3 description is: Red Hat Enterprise Linux 7.3 # my @rhel_version = split / /, $desc; - $distname = "rhels" . $rhel_version[4]; + # + # auto-detect pegas beta ISOs + # + if ( $rhel_version[4] =~ "Pegas") { + $distname = "rhels" . $rhel_version[5] . "-pegas"; + } + else { + $distname = "rhels" . $rhel_version[4]; + } open($dinfo, $mntpath . "/.treeinfo"); while (<$dinfo>) { chomp($_); @@ -2297,7 +2306,7 @@ sub copycd ); return; } - + print "INFO - detected distname=$distname, arch=$arch\n"; %{$request} = (); #clear request we've got it. my $disccopiedin = 0; diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index 5eaac006c..c202c331b 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -4401,7 +4401,7 @@ sub process_request { else { $moreinfo = build_more_info($noderange, $callback); } #pdu commands will be handled in the pdu plugin - if ($command eq "rpower" and grep(/^pduon|pduoff|pdustat$/, @exargs)) { + if ($command eq "rpower" and grep(/^pduon|pduoff|pdureset|pdustat$/, @exargs)) { return; } diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 18e3a09e2..d05a44ef5 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -896,6 +896,11 @@ sub bmcdiscovery_ipmi { my $output = xCAT::Utils->runcmd("$icmd", -1); if ($output =~ $bmcstr) { + if ($output =~ /RAKP 2 message indicates an error : (.+)\nError: (.+)/) { + xCAT::MsgUtils->message("E", { data => ["$2: $1 for $ip"] }, $::CALLBACK); + return 1; + } + # The output contains System Power indicated the username/password is correct, then try to get MTMS if ($output =~ /System Power\s*:\s*\S*/) { my $mtm = ''; @@ -921,6 +926,13 @@ sub bmcdiscovery_ipmi { $serial = $2; last; } + + if (($fru_output =~ /Product Manufacturer\s+:\s+(.*?)\s+P.*?roduct Name\s+:\s+(.*?)\s+P.*?roduct Serial\s+:\s+(\S+)/)) { + $mtm = $1.":".$2; + $serial = $3; + last; + } + } } @@ -939,6 +951,7 @@ sub bmcdiscovery_ipmi { if ($mtm and $serial) { $node = "node-$mtm-$serial"; $node =~ s/(.*)/\L$1/g; + $node =~ s/[\s:\._]/-/g; } } elsif ($output =~ /error : unauthorized name/) { xCAT::MsgUtils->message("E", { data => ["BMC username is incorrect for $ip"] }, $::CALLBACK); diff --git a/xCAT-server/lib/xcat/plugins/confluent.pm b/xCAT-server/lib/xcat/plugins/confluent.pm index 09fcaeb48..0b0602acc 100644 --- a/xCAT-server/lib/xcat/plugins/confluent.pm +++ b/xCAT-server/lib/xcat/plugins/confluent.pm @@ -226,6 +226,7 @@ sub makeconfluentcfg { # Get db info for the nodes related to console my $hmtab = xCAT::Table->new('nodehm'); my $nodepostab = xCAT::Table->new('nodepos'); + my $mptab = xCAT::Table->new('mp'); my @cfgents1; # = $hmtab->getAllNodeAttribs(['cons','serialport','mgt','conserver','termserver','termport']); my @cfgents2; my @cfgents3; @@ -234,7 +235,7 @@ sub makeconfluentcfg { $explicitnodes = 1; @cfgents1 = $hmtab->getNodesAttribs($nodes, [ 'node', 'cons', 'mgt', 'conserver', 'termserver', 'termport', 'consoleondemand' ]); @cfgents2 = $nodepostab->getNodesAttribs($nodes, [ 'node', 'rack', 'u', 'chassis', 'slot', 'room' ]); - @cfgents3 = $nodepostab->getNodesAttribs($nodes, [ 'node', 'mpa', 'id' ]); + @cfgents3 = $mptab->getNodesAttribs($nodes, [ 'node', 'mpa', 'id' ]); # Adjust the data structure to make the result consistent with the getAllNodeAttribs() call we make if a noderange was not specified my @tmpcfgents1; @@ -462,7 +463,7 @@ sub donodeent { } } if (defined($cfgent->{consoleondemand})) { - if ($cfgent->{consoleondemand}) { + if ($cfgent->{consoleondemand} == 'yes') { $parameters{'console.logging'} = 'none'; } else { @@ -471,6 +472,9 @@ sub donodeent { } elsif ($::XCATSITEVALS{'consoleondemand'} and $::XCATSITEVALS{'consoleondemand'} !~ m/^n/) { $parameters{'console.logging'} = 'none'; } + elsif ($::XCATSITEVALS{'consoleondemand'} and $::XCATSITEVALS{'consoleondemand'} == 'no') { + $parameters{'console.logging'} = 'full'; + } # ok, now for nodepos... if (defined $cfgent->{u}) { diff --git a/xCAT-server/lib/xcat/plugins/copycds.pm b/xCAT-server/lib/xcat/plugins/copycds.pm index 0a4ff32d5..90a20c151 100644 --- a/xCAT-server/lib/xcat/plugins/copycds.pm +++ b/xCAT-server/lib/xcat/plugins/copycds.pm @@ -145,8 +145,11 @@ sub process_request { if ($path) { - $path=Cwd::realpath($path); - unless(substr($path,0,length("/install")) eq "/install"){ + + if(-e $path) { + $path=Cwd::realpath($path); + } + unless((substr($path,0,length("/install/")) eq "/install/") or ($path eq "/install")){ $callback->({ warning => "copycds: the specified path \"$path\" is not a subdirectory under /install. Make sure this path is configured for httpd/apache, otherwise, the provisioning with this iso will fail!" }); } push @{ $newreq->{arg} }, ("-p", $path); diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 9291488b1..de6085e27 100755 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -622,7 +622,7 @@ sub process_request { } else { # this host string might be a xcat group, try to test each node in the group - foreach my $host (noderange($hosts)) { + foreach my $host (xCAT::NodeRange->noderange($hosts)) { unless (xCAT::NetworkUtils->thishostisnot($host)) { $listenonifs = $dnsif; last; diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index 54a7804c7..03d0b7843 100755 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -114,6 +114,17 @@ sub setdestiny { my $state = $ARGV[0]; my $reststates; + my $bptab = xCAT::Table->new('bootparams', -create => 1); + my %tempbh = %{ $bptab->getNodesAttribs(\@nodes, [qw(addkcmdline)]) }; + while(my ($key, $value) = each(%tempbh)) { + if ($value && $value->[0]->{"addkcmdline"}) { + my $addkcmdline = $value->[0]->{"addkcmdline"}; + # $key is node name + $bphash->{$key}->[0]->{"addkcmdline"} = $addkcmdline; + } + } + $bptab->close(); + # to support the case that the state could be runimage=xxx,runimage=yyy,osimage=xxx ($state, $reststates) = split(/,/, $state, 2); my %nstates; @@ -389,10 +400,7 @@ sub setdestiny { ignorekernelchk => $ignorekernelchk, bootparams => \$bphash}, \&relay_response); if ($errored) { - my @myself = xCAT::NetworkUtils->determinehostname(); - my $myname = $myself[ (scalar @myself) - 1 ]; - # The callback function point to xcatd::build_response, it use dclone to clone data, but it can only accept a reference. The error msg here is a simple string, and will cause dclone failed. Seems to be string array can be used by dclone. - $callback->({ errorcode => [1], error => ["Some nodes failed to set up $state resources on server $myname, aborting"] }); + # The error messeage for mkinstall/mknetboot/mkstatelite had been output within relay_response function above, don't need to output more return; } diff --git a/xCAT-server/lib/xcat/plugins/docker.pm b/xCAT-server/lib/xcat/plugins/docker.pm index 5b7e16796..3118da70c 100755 --- a/xCAT-server/lib/xcat/plugins/docker.pm +++ b/xCAT-server/lib/xcat/plugins/docker.pm @@ -12,6 +12,10 @@ package xCAT_plugin::docker; BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; + my $async_path = "/usr/local/share/perl5/"; + unless (grep { $_ eq $async_path } @INC) { + push @INC, $async_path; + } } use lib "$::XCATROOT/lib/perl"; diff --git a/xCAT-server/lib/xcat/plugins/esx.pm b/xCAT-server/lib/xcat/plugins/esx.pm index ece31bb02..fcdb09b0c 100644 --- a/xCAT-server/lib/xcat/plugins/esx.pm +++ b/xCAT-server/lib/xcat/plugins/esx.pm @@ -407,7 +407,7 @@ sub process_request { } #pdu commands will be handled in the pdu plugin - if ($command eq "rpower" and grep(/^pduon|pduoff|pdustat$/, @exargs)) { + if ($command eq "rpower" and grep(/^pduon|pduoff|pdureset|pdustat$/, @exargs)) { return; } #my $sitetab = xCAT::Table->new('site'); @@ -5131,14 +5131,10 @@ sub mkcommonboot { - $bptab->setNodeAttribs( - $node, - { - kernel => $kernel, - initrd => "", - kcmdline => $append - } - ); + my $bootparams = ${$req->{bootparams}}; + $bootparams->{$node}->[0]->{kernel} = $kernel; + $bootparams->{$node}->[0]->{kcmdline} = $append; + $bootparams->{$node}->[0]->{initrd} = ""; } # end of node loop } diff --git a/xCAT-server/lib/xcat/plugins/getadapter.pm b/xCAT-server/lib/xcat/plugins/getadapter.pm index ccacbad75..19edc1817 100644 --- a/xCAT-server/lib/xcat/plugins/getadapter.pm +++ b/xCAT-server/lib/xcat/plugins/getadapter.pm @@ -304,66 +304,16 @@ sub deploy_genesis { my ($node, $node_desc_ptr, $callback, $subreq) = @_; my $outref = xCAT::Utils->runxcmd( { - command => ['nodeset'], + command => ['rinstall'], node => ["$node"], arg => ['runcmd=getadapter'], }, $subreq, 0, 1); if ($::RUNCMD_RC != 0) { - $callback->({ error => "failed to run command: nodeset $node runcmd=getadapter", errorcode => 1 }); - return 1; - } - - # TODO: use rinstall to replace the following code when rinstall is ready. - if ($node_desc_ptr->{mgt} eq "ipmi") { - $outref = xCAT::Utils->runxcmd( - { - command => ["rsetboot"], - node => ["$node"], - arg => ['net'], - }, - $subreq, 0, 1); - if ($::RUNCMD_RC != 0) { - $callback->({ error => "failed to run command: rsetboot $node net", errorcode => 1 }); - return 1; + foreach my $out (@$outref) { + $callback->({data => "$out"}) } - $outref = xCAT::Utils->runxcmd( - { - command => ['rpower'], - node => ["$node"], - arg => ['reset'], - }, - $subreq, 0, 1); - if ($::RUNCMD_RC != 0) { - $callback->({ error => "failed to run command: rpower $node reset", errorcode => 1 }); - return 1; - } - } elsif ($node_desc_ptr->{mgt} eq "kvm") { - $outref = xCAT::Utils->runxcmd( - { - command => ['rpower'], - node => ["$node"], - arg => ['reset'], - }, - $subreq, 0, 1); - if ($::RUNCMD_RC != 0) { - $callback->({ error => "failed to run command: rpower $node reset", errorcode => 1 }); - return 1; - } - } elsif ($node_desc_ptr->{mgt} eq "hmc") { - $outref = xCAT::Utils->runxcmd( - { - command => ["rnetboot"], - node => ["$node"], - }, - $subreq, 0, 1); - if ($::RUNCMD_RC != 0) { - $callback->({ error => "failed to run command: rnetboot $node", errorcode => 1 }); - return 1; - } - } else { - $callback->({ error => "$node: The mgt configuration is not supported by getadapter.", - errorcode => 1 }); + $callback->({ error => "failed to run command: rinstall $node runcmd=getadapter", errorcode => 1 }); return 1; } $callback->({ data => "$node: Booting into genesis, this could take several minutes..." }); @@ -495,8 +445,8 @@ sub update_adapter_result { } $callback->({ data => "$output" }); if (!$has_nic) { - $callback->({ data => "$node: Couldn't find interface name information detected by udevadm," - . " the nics table will not be updated." }); + $callback->({ data => "$node: nics talbe will not be updated as not any ". + "useful information could be found with udevadm command." }); return 0; } my $nics_table = xCAT::Table->new('nics'); diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index 6cfb16694..bf0cd10ec 100755 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -44,7 +44,7 @@ sub delnode while ($idx <= $#hosts) { if (($ip and $hosts[$idx] =~ /^${ip}\s/) - or $hosts[$idx] =~ /^\d+\.\d+\.\d+\.\d+\s+${node}[\s\.r]/) + or $hosts[$idx] =~ /^\d+\.\d+\.\d+\.\d+\s+${node}[\s\.\r]/) { $hosts[$idx] = ""; } @@ -74,7 +74,7 @@ sub addnode { if ($hosts[$idx] =~ /^${ip}\s/ - or $hosts[$idx] =~ /^\d+\.\d+\.\d+\.\d+\s+${node}[\s\.r]/) + or $hosts[$idx] =~ /^\d+\.\d+\.\d+\.\d+\s+${node}[\s\.\r]/) { if ($foundone) { diff --git a/xCAT-server/lib/xcat/plugins/hpblade.pm b/xCAT-server/lib/xcat/plugins/hpblade.pm index 090bb6738..364627ba7 100755 --- a/xCAT-server/lib/xcat/plugins/hpblade.pm +++ b/xCAT-server/lib/xcat/plugins/hpblade.pm @@ -647,7 +647,7 @@ sub process_request { else { $moreinfo = build_more_info($noderange, $callback); } #pdu commands will be handled in the pdu plugin - if ($command eq "rpower" and grep(/^pduon|pduoff|pdustat$/, @exargs)) { + if ($command eq "rpower" and grep(/^pduon|pduoff|pdureset|pdustat$/, @exargs)) { return; } diff --git a/xCAT-server/lib/xcat/plugins/hpilo.pm b/xCAT-server/lib/xcat/plugins/hpilo.pm index 72855e11a..3a88db4e3 100755 --- a/xCAT-server/lib/xcat/plugins/hpilo.pm +++ b/xCAT-server/lib/xcat/plugins/hpilo.pm @@ -362,7 +362,7 @@ sub process_request { } #pdu commands will be handled in the pdu plugin - if (($extrargs->[0] eq 'pdustat') || ($extrargs->[0] eq 'pduon') || ($extrargs->[0] eq 'pduoff')) { + if (($extrargs->[0] eq 'pdustat') || ($extrargs->[0] eq 'pdureset') || ($extrargs->[0] eq 'pduon') || ($extrargs->[0] eq 'pduoff')) { return; } diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index ae76557c1..7b4223725 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -43,6 +43,7 @@ my %allerrornodes = (); my %newnodestatus = (); my $global_sessdata; my %child_pids; +my $xcatdebugmode = 0; my $IPMIXCAT = "/opt/xcat/bin/ipmitool-xcat"; my $NON_BLOCK = 1; @@ -1731,6 +1732,37 @@ sub do_firmware_update { $ret = get_ipmitool_version(\$ipmitool_ver); exit $ret if $ret < 0; + my $exit_with_error_func = sub { + my ($node, $callback, $message) = @_; + my $status = "failed to update firmware"; + my $nodelist_table = xCAT::Table->new('nodelist'); + if (!$nodelist_table) { + xCAT::MsgUtils->message("S", "Unable to open nodelist table, denying"); + } else { + $nodelist_table->setNodeAttribs($node, { status => $status }); + $nodelist_table->close(); + } + xCAT::MsgUtils->message("S", $node.": ".$message); + $callback->({ error => "$node: $message", errorcode => 1 }); + exit -1; + }; + + my $exit_with_success_func = sub { + my ($node, $callback, $message) = @_; + my $status = "success to update firmware"; + my $nodelist_table = xCAT::Table->new('nodelist'); + if (!$nodelist_table) { + xCAT::MsgUtils->message("S", "Unable to open nodelist table, denying"); + } else { + $nodelist_table->setNodeAttribs($node, { status => $status }); + $nodelist_table->close(); + } + xCAT::MsgUtils->message("S", $node.": ".$message); + $callback->({ data => "$node: $message" }); + exit 0; + }; + + # only 1.8.15 or above support hpm update for firestone machines. if (calc_ipmitool_version($ipmitool_ver) < calc_ipmitool_version("1.8.15")) { $callback->({ error => "IPMITool $ipmitool_ver do not support firmware update for " . @@ -1741,9 +1773,8 @@ sub do_firmware_update { if (($hpm_data_hash{deviceID} ne $sessdata->{device_id}) || ($hpm_data_hash{productID} ne $sessdata->{prod_id}) || ($hpm_data_hash{manufactureID} ne $sessdata->{mfg_id})) { - xCAT::SvrUtils::sendmsg([ 1, "The image file doesn't match this machine" ], - $callback, $sessdata->{node}, %allerrornodes); - exit -1; + $exit_with_error_func->($sessdata->{node}, $callback, + "The image file doesn't match this machine"); } my $output; @@ -1773,9 +1804,8 @@ sub do_firmware_update { my $cmd = $pre_cmd . " fru print 3"; $output = xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC != 0) { - xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed: $output" ], - $callback, $sessdata->{node}, %allerrornodes); - exit -1; + $exit_with_error_func->($sessdata->{node}, $callback, + "Running ipmitool command $cmd failed: $output"); } if ($output =~ /8335-GTB/) { $buffer_size = "15000"; @@ -1786,18 +1816,16 @@ sub do_firmware_update { $cmd = $pre_cmd . " fru print 47"; $output = xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC != 0) { - xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed: $output" ], - $callback, $sessdata->{node}, %allerrornodes); - exit -1; + $exit_with_error_func->($sessdata->{node}, $callback, + "Running ipmitool command $cmd failed: $output"); } my $grs_version = $output =~ /OP8_v(\d*\.\d*_\d*\.\d*)/; if ($grs_version =~ /\d\.(\d+)_(\d+\.\d+)/) { my $prim_grs_version = $1; my $sec_grs_version = $2; if ($prim_grs_version <= 7 && $sec_grs_version < 2.55) { - xCAT::SvrUtils::sendmsg([ 1, "Error: Current firmware level OP8v_$grs_version requires one-time manual update to at least version OP8v_1.7_2.55" ], - $callback, $sessdata->{node}, %allerrornodes); - exit -1; + $exit_with_error_func->($sessdata->{node}, $callback, + "Error: Current firmware level OP8v_$grs_version requires one-time manual update to at least version OP8v_1.7_2.55"); } } } @@ -1806,34 +1834,30 @@ sub do_firmware_update { $cmd = $pre_cmd . " chassis power off"; $output = xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC != 0) { - xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed: $output" ], - $callback, $sessdata->{node}, %allerrornodes); - exit -1; + $exit_with_error_func->($sessdata->{node}, $callback, + "Running ipmitool command $cmd failed: $output"); } # step 2 reset cold $cmd = $pre_cmd . " mc reset cold"; $output = xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC != 0) { - xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed: $output" ], - $callback, $sessdata->{node}, %allerrornodes); - exit -1; + $exit_with_error_func->($sessdata->{node}, $callback, + "Running ipmitool command $cmd failed: $output"); } # check reset status - unless (check_bmc_status_with_ipmitool($pre_cmd, 5, 24)) { - xCAT::SvrUtils::sendmsg([ 1, "Timeout to check the bmc status" ], - $callback, $sessdata->{node}, %allerrornodes); - exit -1; + unless (check_bmc_status_with_ipmitool($pre_cmd, 5, 60)) { + $exit_with_error_func->($sessdata->{node}, $callback, + "Timeout to check the bmc status"); } # step 3 protect network $cmd = $pre_cmd . " raw 0x32 0xba 0x18 0x00"; $output = xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC != 0) { - xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed: $output" ], - $callback, $sessdata->{node}, %allerrornodes); - exit -1; + $exit_with_error_func->($sessdata->{node}, $callback, + "Running ipmitool command $cmd failed: $output"); } # step 4 upgrade firmware @@ -1850,7 +1874,28 @@ sub do_firmware_update { xCAT::SvrUtils::sendmsg([ 0, "rflashing ... See the detail progress :\"tail -f $rflash_log_file\"" ], $callback, $sessdata->{node}); - exec($cmd); + + $output = xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) { + $exit_with_error_func->($sessdata->{node}, $callback, + "Running ipmitool command $cmd failed: $output"); + } + + # step 5 power on + # check reset status + unless (check_bmc_status_with_ipmitool($pre_cmd, 5, 60)) { + $exit_with_error_func->($sessdata->{node}, $callback, + "Timeout to check the bmc status"); + } + + $cmd = $pre_cmd . " chassis power on"; + $output = xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) { + $exit_with_error_func->($sessdata->{node}, $callback, + "Running ipmitool command $cmd failed: $output"); + } + $exit_with_success_func->($sessdata->{node}, $callback, + "Success to update firmware. FRU information will be populated in a few minutes."); } sub rflash { @@ -1996,29 +2041,8 @@ sub start_rflash_processes { # Wait for all processes to end while (keys %child_pids) { - my ($node_status, $rc, $cpid); + my $cpid; if (($cpid = wait()) > 0) { - $rc = $?; - if (!grep(/^(-c|--check)$/i, @exargs)) { - $node_status->{node} = $child_pids{$cpid}; - if ($rc == 0) { - $node_status->{status} = "success to update firmware"; - } else { - $node_status->{status} = "failed to update firmware"; - } - my $nodelist_table = xCAT::Table->new('nodelist'); - if (!$nodelist_table) { - xCAT::MsgUtils->message("S", "Unable to open nodelist table, denying"); - } else { - $nodelist_table->setNodeAttribs($node_status->{node}, - { status => $node_status->{status} }); - $nodelist_table->close(); - } - xCAT::MsgUtils->message("S", - $node_status->{node}.": ". $node_status->{status}); - xCAT::SvrUtils::sendmsg([ $rc, - $node_status->{status} ], $callback, $node_status->{node}); - } delete $child_pids{$cpid}; } } @@ -2666,16 +2690,18 @@ sub add_textual_frus { my $type = shift; my $sessdata = shift; unless ($type) { $type = 'hw'; } + if ($desc =~ /System Firmware/i and $category =~ /product/i) { $type = 'firmware,bmc'; } - if ($desc =~ /NODE \d+/ and $category =~ /chassis/) { + if ( ($desc =~ /NODE \d+/ or $desc =~ /Backplane/) and $category =~ /chassis/) { add_textual_fru($parsedfru, $desc . " " . $categorydesc . "Part Number", $category, "partnumber", 'model', $sessdata); add_textual_fru($parsedfru, $desc . " " . $categorydesc . "Serial Number", $category, "serialnumber", 'serial', $sessdata); } else { add_textual_fru($parsedfru, $desc . " " . $categorydesc . "Part Number", $category, "partnumber", $type, $sessdata); add_textual_fru($parsedfru, $desc . " " . $categorydesc . "Serial Number", $category, "serialnumber", $type, $sessdata); } + add_textual_fru($parsedfru, $desc . " " . $categorydesc . "Manufacturer", $category, "manufacturer", $type, $sessdata); add_textual_fru($parsedfru, $desc . " " . $categorydesc . "FRU Number", $category, "frunum", $type, $sessdata); add_textual_fru($parsedfru, $desc . " " . $categorydesc . "Version", $category, "version", $type, $sessdata); @@ -3035,6 +3061,7 @@ sub initfru_with_mprom { sub process_currfruid { my $rsp = shift; my $sessdata = shift; + if ($rsp->{code} == 0xcb) { $sessdata->{currfrudata} = "Not Present"; $sessdata->{currfrudone} = 1; @@ -3285,7 +3312,7 @@ sub initfru_zero { if ($_->{encoding} == 3) { $fru->value($_->{value}); } else { - next; + next; #print Dumper($_); #print $_->{encoding}; @@ -3298,8 +3325,9 @@ sub initfru_zero { if ($sessdata->{skipotherfru}) { #skip non-primary fru devices if ($sessdata->{skipotherfru} and isopenpower($sessdata)) { - # For openpower servers, fru 3 is used to get MTM/Serial information, fru 47 is used to get firmware information - @{$sessdata->{frus_for_openpower}} = qw(3 47); + # For openpower Big Data servers, fru 2 has MTM/Serial and fru 43 has firmware information + # For openpower HPC servers, fru 3 has MTM/Serial and fru 47 has firmware information + @{$sessdata->{frus_for_openpower}} = qw(2 3 43 47); my %fruids_hash = map {$_ => 1} @{$sessdata->{frus_for_openpower}}; foreach my $key (keys %{ $sessdata->{sdr_hash} }) { my $sdr = $sessdata->{sdr_hash}->{$key}; @@ -3586,7 +3614,7 @@ sub add_fruhash { $fru->rec_type("hw"); } $fru->value($sessdata->{currfrudata}); - if (exists($sessdata->{currfrusdr})) { + if ($sessdata->{currfrusdr}) { $fru->desc($sessdata->{currfrusdr}->id_string); } $sessdata->{fru_hash}->{ $sessdata->{frudex} } = $fru; @@ -3692,7 +3720,7 @@ sub readcurrfrudevice { if ($data[0] != $sessdata->{currfruchunk}) { # Fix FRU 43,48 and 49 for GRS server that they can not return as much data as shall return - if ($data[0] gt 0) { + if ($data[0] ge 0) { $sessdata->{currfrudone} = 1; } else { my $text = "Received incorrect data from BMC for FRU ID: " . $sessdata->{currfruid}; @@ -4104,7 +4132,7 @@ sub parseboard { my $macdata = $boardinf{extra}->[6]->{value}; my $macstring = "1"; my $macprefix; - while ($macstring !~ /00:00:00:00:00:00/ and not ref $global_sessdata->{currmacs}) { + while ($macdata and $macstring !~ /00:00:00:00:00:00/ and not ref $global_sessdata->{currmacs}) { my @currmac = splice @$macdata, 0, 6; unless ((scalar @currmac) == 6) { last; @@ -7682,7 +7710,7 @@ sub preprocess_request { } #pdu commands will be handled in the pdu plugin - if(($subcmd eq 'pduoff') || ($subcmd eq 'pduon') || ($subcmd eq 'pdustat')){ + if(($subcmd eq 'pduoff') || ($subcmd eq 'pduon') || ($subcmd eq 'pdustat') || ($subcmd eq 'pdureset')){ return 0; } @@ -8162,6 +8190,7 @@ sub process_request { if ($::XCATSITEVALS{ipmitimeout}) { $ipmitimeout = $::XCATSITEVALS{ipmitimeout} } if ($::XCATSITEVALS{ipmiretries}) { $ipmitrys = $::XCATSITEVALS{ipmitretries} } if ($::XCATSITEVALS{ipmisdrcache}) { $enable_cache = $::XCATSITEVALS{ipmisdrcache} } + if ($::XCATSITEVALS{xcatdebugmode}) { $xcatdebugmode = $::XCATSITEVALS{xcatdebugmode} } #my @threads; my @donargs = (); @@ -8375,6 +8404,8 @@ sub donode { command => $command, extraargs => \@exargs, subcommand => $exargs[0], + xcatdebugmode => $xcatdebugmode, + outfunc => $callback, }; if ($sessiondata{$node}->{ipmisession}->{error}) { xCAT::SvrUtils::sendmsg([ 1, $sessiondata{$node}->{ipmisession}->{error} ], $callback, $node, %allerrornodes); @@ -8459,7 +8490,4 @@ sub genhwtree } - - - 1; diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 7e83f850f..6e2434eea 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -1775,7 +1775,20 @@ sub rmvm { foreach $disk (@purgedisks) { my $disktype = $disk->parentNode()->getAttribute("device"); if ($disktype eq "cdrom") { next; } + + my @driver = $disk->parentNode()->findnodes("driver"); + unless ($driver[0]) { next; } + my $drivertype = $driver[0]->getAttribute("type"); + if (($drivertype eq "raw") || ($disktype eq "block")) { + #For raw or block devices, do not remove, even if purge was specified. Log info message. + xCAT::MsgUtils->trace(0, "i", "Not purging raw or block storage device: $disk"); + next; + } my $file = $disk->getAttribute("file"); + unless ($file) { + xCAT::MsgUtils->trace(0, "w", "Not able to find 'file' attribute value for: $disk"); + next; + } # try to check the existence first, if cannot find, do nothing. # we do retry because we found sometimes the delete might fail @@ -3662,7 +3675,7 @@ sub process_request { } #pdu commands will be handled in the pdu plugin - if ($command eq "rpower" and grep(/^pduon|pduoff|pdustat$/, @exargs)) { + if ($command eq "rpower" and grep(/^pduon|pduoff|pdureset|pdustat$/, @exargs)) { return; } diff --git a/xCAT-server/lib/xcat/plugins/nodestat.pm b/xCAT-server/lib/xcat/plugins/nodestat.pm index 14d33f507..94c2969f2 100644 --- a/xCAT-server/lib/xcat/plugins/nodestat.pm +++ b/xCAT-server/lib/xcat/plugins/nodestat.pm @@ -152,7 +152,7 @@ sub preprocess_request 'h|help' => \$::HELP, 'v|version' => \$::VERSION)) { - &usage($cb); + &usage($cb,1); return (1); } if ($::HELP) { @@ -169,7 +169,7 @@ sub preprocess_request my $nodes = $req->{node}; if (!$nodes) { - &usage($cb); + &usage($cb,1); return (1); } @@ -914,6 +914,7 @@ sub process_request { } + if ($command eq "nodestat_internal") { #if ( -x '/usr/bin/nmap' ) { @@ -1210,10 +1211,14 @@ sub process_request { sub usage { my $cb = shift; + my $retcode=shift; my $rsp = {}; $rsp->{data}->[0] = "Usage:"; $rsp->{data}->[1] = " nodestat [noderange] [-m|--usemon] [-p|powerstat] [-u|--updatedb]"; $rsp->{data}->[2] = " nodestat [-h|--help|-v|--version]"; + if($retcode){ + $rsp->{errorcode}->[0]=$retcode; + } xCAT::MsgUtils->message("I", $rsp, $cb); } diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm new file mode 100644 index 000000000..e72e412e4 --- /dev/null +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -0,0 +1,698 @@ +#!/usr/bin/perl +## IBM(c) 2017 EPL license http://www.eclipse.org/legal/epl-v10.html + +package xCAT_plugin::openbmc; + +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; + my $async_path = "/usr/local/share/perl5/"; + unless (grep { $_ eq $async_path } @INC) { + push @INC, $async_path; + } +} +use lib "$::XCATROOT/lib/perl"; +use strict; +use warnings "all"; + +use HTTP::Async; +use HTTP::Cookies; +use xCAT::OPENBMC; +use xCAT::Utils; +use xCAT::Table; +use xCAT::Usage; +use xCAT::SvrUtils; +use File::Basename; +use Data::Dumper; +use JSON; + +$::OPENBMC_DEVEL = $ENV{'OPENBMC_DEVEL'}; + + +sub unsupported { + my $callback = shift; + if (defined($::OPENBMC_DEVEL) && ($::OPENBMC_DEVEL eq "YES")) { + xCAT::SvrUtils::sendmsg("Warning: Currently running development code, use at your own risk. Unset OPENBMC_DEVEL and `restartxcatd` to disable.", $callback); + return; + } else { + return ([ 1, "This openbmc related function is unsupported and disabled. To bypass, run the following: \n\texport OPENBMC_DEVEL=YES\n\trestartxcatd" ]); + } +} + + +#------------------------------------------------------- + +=head3 handled_commands + + Return list of commands handled by this plugin + +=cut + +#------------------------------------------------------- +sub handled_commands { + return { + rpower => 'nodehm:mgt', + rinv => 'nodehm:mgt', + getopenbmccons => 'nodehm:cons', + rsetboot => 'nodehm:mgt', + rspconfig => 'nodehm:mgt', + rvitals => 'nodehm:mgt', + rflash => 'nodehm:mgt', + reventlog => 'nodehm:mgt', + rspreset => 'nodehm:mgt', + rbeacon => 'nodehm:mgt', + renergy => 'nodehm:mgt', + }; +} + +my $http_protocol="https"; +my $openbmc_url = "/org/openbmc"; +my $openbmc_project_url = "/xyz/openbmc_project"; +#------------------------------------------------------- + +# The hash table to store method and url for request, +# process function for response + +#------------------------------------------------------- +my %status_info = ( + LOGIN_REQUEST => { + method => "POST", + init_url => "/login", + }, + LOGIN_RESPONSE => { + process => \&login_response, + }, + + RPOWER_ON_REQUEST => { + method => "PUT", + init_url => "$openbmc_project_url/state/host0/attr/RequestedHostTransition", + data => "xyz.openbmc_project.State.Host.Transition.On", + }, + RPOWER_ON_RESPONSE => { + process => \&rpower_response, + }, + RPOWER_OFF_REQUEST => { + method => "PUT", + init_url => "$openbmc_project_url/state/host0/attr/RequestedHostTransition", + data => "xyz.openbmc_project.State.Host.Transition.Off", + }, + RPOWER_OFF_RESPONSE => { + process => \&rpower_response, + }, + RPOWER_RESET_REQUEST => { + method => "PUT", + init_url => "$openbmc_project_url/state/host0/attr/RequestedHostTransition", + data => "xyz.openbmc_project.State.Host.Transition.Reboot", + }, + RPOWER_RESET_RESPONSE => { + process => \&rpower_response, + }, + RPOWER_STATUS_REQUEST => { + method => "GET", + init_url => "$openbmc_project_url/state/host0", + }, + RPOWER_STATUS_RESPONSE => { + process => \&rpower_response, + }, + + RINV_REQUEST => { + method => "GET", + init_url => "$openbmc_url/inventory/enumerate", + }, + RINV_RESPONSE => { + process => \&rinv_response, + }, +); + + +#----------------------------- + +=head3 %node_info + + $node_info = ( + $node => { + bmc => "x.x.x.x", + username => "username", + password => "password", + cur_status => "LOGIN_REQUEST", + cur_url => "", + method => "", + back_urls => (), + }, + ); + + 'cur_url', 'method', 'back_urls' used for path has a trailing-slash + +=cut + +#----------------------------- +my %node_info = (); + +my %next_status = (); + +my %handle_id_node = (); + +my $wait_node_num; + +my $async; + +my $cookie_jar; + +my $callback; +my %allerrornodes = (); + +#------------------------------------------------------- + +=head3 preprocess_request + + preprocess the command + +=cut + +#------------------------------------------------------- +sub preprocess_request { + my $request = shift; + if (defined $request->{_xcatpreprocessed}->[0] and $request->{_xcatpreprocessed}->[0] == 1) { + return [$request]; + } + + $callback = shift; + + my $command = $request->{command}->[0]; + my $noderange = $request->{node}; + my $extrargs = $request->{arg}; + my @exargs = ($request->{arg}); + my @requests; + + if (ref($extrargs)) { + @exargs = @$extrargs; + } + my $usage_string = xCAT::Usage->parseCommand($command, @exargs); + if ($usage_string) { + $callback->({ data => [$usage_string] }); + $request = {}; + return; + } + + my $parse_result = parse_args($command, $extrargs); + if (ref($parse_result) eq 'ARRAY') { + $callback->({ errorcode => $parse_result->[0], data => $parse_result->[1] }); + $request = {}; + return; + } + + my $sn = xCAT::ServiceNodeUtils->get_ServiceNode($noderange, "xcat", "MN"); + foreach my $snkey (keys %$sn) { + my $reqcopy = {%$request}; + $reqcopy->{node} = $sn->{$snkey}; + $reqcopy->{'_xcatdest'} = $snkey; + $reqcopy->{_xcatpreprocessed}->[0] = 1; + push @requests, $reqcopy; + } + + return \@requests; +} + +#------------------------------------------------------- + +=head3 process_request + + Process the command + +=cut + +#------------------------------------------------------- +sub process_request { + my $request = shift; + my $command = $request->{command}->[0]; + my $noderange = $request->{node}; + + parse_node_info($noderange); + parse_command_status($command); + + $cookie_jar = HTTP::Cookies->new({}); + $async = HTTP::Async->new( + cookie_jar => $cookie_jar, + ssl_options => { + SSL_verify_mode => 0, + }, + ); + + my $bmcip; + my $login_url; + my $handle_id; + my $content; + $wait_node_num = keys %node_info; + my @donargs = (); + + foreach my $node (keys %node_info) { + $bmcip = $node_info{$node}{bmc}; + $login_url = "$http_protocol://$bmcip/login"; + $content = '{"data": [ "' . $node_info{$node}{username} .'", "' . $node_info{$node}{password} . '" ] }'; + $handle_id = xCAT::OPENBMC->new($async, $login_url, $content); + $handle_id_node{$handle_id} = $node; + $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; + print "$node: DEBUG POST $login_url -d $content\n"; + push @donargs, [ $node,$bmcip,$node_info{$node}{username}, $node_info{$node}{password}]; + } + + #process rcons + if ($request->{command}->[0] eq "getopenbmccons") { + foreach (@donargs) { + getopenbmccons($_, $callback); + } + return; + } + + + while (1) { + last unless ($wait_node_num); + while (my ($response, $handle_id) = $async->wait_for_next_response) { + deal_with_response($handle_id, $response); + } + } + + return; +} + +#------------------------------------------------------- + +=head3 parse_args + + Parse the command line options and operands + +=cut + +#------------------------------------------------------- +sub parse_args { + my $command = shift; + my $extrargs = shift; + my $check = undef; + + if (scalar(@ARGV) > 1) { + return ([ 1, "Only one option is supported at the same time" ]); + } + + my $subcommand = $ARGV[0]; + if ($command eq "rpower") { + # + # disable function until fully tested + # + $check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; } + + if (!defined($extrargs)) { + return ([ 1, "No option specified for rpower" ]); + } + unless ($subcommand =~ /^on$|^off$|^reset$|^boot$|^status$|^stat$|^state$/) { + return ([ 1, "Unsupported command: $command $subcommand" ]); + } + } elsif ($command eq "rinv") { + # + # disable function until fully tested + # + $check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; } + + + unless ($subcommand =~ /^cpu$|^dimm$|^bios$|^all$/) { + return ([ 1, "Unsupported command: $command $subcommand" ]); + } + } else { + return ([ 1, "Command is not supported." ]); + } + + return; +} + +#------------------------------------------------------- + +=head3 parse_command_status + + Parse the command to init status machine + +=cut + +#------------------------------------------------------- +sub parse_command_status { + my $command = shift; + + $next_status{LOGIN_REQUEST} = "LOGIN_RESPONSE"; + + if ($command eq "rpower") { + my $subcommand = $ARGV[0]; + + if ($subcommand eq "on") { + $next_status{LOGIN_RESPONSE} = "RPOWER_ON_REQUEST"; + $next_status{RPOWER_ON_REQUEST} = "RPOWER_ON_RESPONSE"; + } elsif ($subcommand eq "off") { + $next_status{LOGIN_RESPONSE} = "RPOWER_OFF_REQUEST"; + $next_status{RPOWER_OFF_REQUEST} = "RPOWER_OFF_RESPONSE"; + } elsif ($subcommand eq "reset") { + $next_status{LOGIN_RESPONSE} = "RPOWER_RESET_REQUEST"; + $next_status{RPOWER_RESET_REQUEST} = "RPOWER_RESET_RESPONSE"; + } elsif ($subcommand eq "status" or $subcommand eq "state" or $subcommand eq "stat") { + $next_status{LOGIN_RESPONSE} = "RPOWER_STATUS_REQUEST"; + $next_status{RPOWER_STATUS_REQUEST} = "RPOWER_STATUS_RESPONSE"; + } elsif ($subcommand eq "boot") { + $next_status{LOGIN_RESPONSE} = "RPOWER_STATUS_REQUEST"; + $next_status{RPOWER_STATUS_REQUEST} = "RPOWER_STATUS_RESPONSE"; + $next_status{RPOWER_STATUS_RESPONSE}{OFF} = "RPOWER_ON_REQUEST"; + $next_status{RPOWER_ON_REQUEST} = "RPOWER_ON_RESPONSE"; + $next_status{RPOWER_STATUS_RESPONSE}{ON} = "RPOWER_RESET_REQUEST"; + $next_status{RPOWER_RESET_REQUEST} = "RPOWER_RESET_RESPONSE"; + } + } + + if ($command eq "rinv") { + my $subcommand = $ARGV[0]; + + if ($subcommand eq "cpu" or $subcommand eq "dimm" or $subcommand eq "bios" or $subcommand eq "all") { + $next_status{LOGIN_RESPONSE} = "RINV_REQUEST"; + $next_status{RINV_REQUEST} = "RINV_RESPONSE"; + $status_info{RINV_RESPONSE}{argv} = "$subcommand"; + } + } + + print Dumper(\%next_status) . "\n"; +} + +#------------------------------------------------------- + +=head3 parse_node_info + + Parse the node information: bmc, username, password + +=cut + +#------------------------------------------------------- +sub parse_node_info { + my $noderange = shift; + + my $passwd_table = xCAT::Table->new('passwd'); + my $passwd_hash = $passwd_table->getAttribs({ 'key' => 'openbmc' }, qw(username password)); + + my $openbmc_table = xCAT::Table->new('openbmc'); + my $openbmc_hash = $openbmc_table->getNodesAttribs(\@$noderange, ['bmc', 'username', 'password']); + + foreach my $node (@$noderange) { + if (defined($openbmc_hash->{$node}->[0])) { + if ($openbmc_hash->{$node}->[0]->{'bmc'}) { + $node_info{$node}{bmc} = $openbmc_hash->{$node}->[0]->{'bmc'}; + } else { + xCAT::SvrUtils::sendmsg("Unable to get attribute bmc", $callback, $node); + next; + } + + if ($openbmc_hash->{$node}->[0]->{'username'}) { + $node_info{$node}{username} = $openbmc_hash->{$node}->[0]->{'username'}; + } elsif ($passwd_hash and $passwd_hash->{username}) { + $node_info{$node}{username} = $passwd_hash->{username}; + } else { + xCAT::SvrUtils::sendmsg("Unable to get attribute username", $callback, $node); + delete $node_info{$node}; + next; + } + + if ($openbmc_hash->{$node}->[0]->{'password'}) { + $node_info{$node}{password} = $openbmc_hash->{$node}->[0]->{'password'}; + } elsif ($passwd_hash and $passwd_hash->{password}) { + $node_info{$node}{password} = $passwd_hash->{password}; + } else { + xCAT::SvrUtils::sendmsg("Unable to get attribute password", $callback, $node); + delete $node_info{$node}; + next; + } + + $node_info{$node}{cur_status} = "LOGIN_REQUEST"; + } else { + xCAT::SvrUtils::sendmsg("Unable to get information from openbmc table", $callback, $node); + next; + } + } + + print Dumper(\%node_info) ."\n"; + + return; +} + +#------------------------------------------------------- + +=head3 gen_send_request + + Generate request's information + If the node has method itself, use it as request's method. + If not, use method %status_info defined. + If the node has cur_url, check whether also has sub_urls. + If has, request's url is join cur_url and one in sub_urls(use one at once to check which is needed). + If not, use method %status_info defined. + use xCAT::OPENBMC->send_request send request + store handle_id and mapping node + Input: + $node: nodename of current node + +=cut + +#------------------------------------------------------- +sub gen_send_request { + my $node = shift; + my $method; + my $request_url; + my $content; + + if ($node_info{$node}{method}) { + $method = $node_info{$node}{method}; + } else { + $method = $status_info{ $node_info{$node}{cur_status} }{method}; + } + + if ($status_info{ $node_info{$node}{cur_status} }{data}) { + $content = '{"data":"' . $status_info{ $node_info{$node}{cur_status} }{data} . '"}'; + } + + if ($node_info{$node}{cur_url}) { + $request_url = $node_info{$node}{cur_url}; + } else { + $request_url = $status_info{ $node_info{$node}{cur_status} }{init_url}; + } + $request_url = "$http_protocol://" . $node_info{$node}{bmc} . $request_url; + + my $handle_id = xCAT::OPENBMC->send_request($async, $method, $request_url, $content); + $handle_id_node{$handle_id} = $node; + $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; + + my $debug_info; + if ($method eq "GET") { + $debug_info = "$node: DEBUG $method $request_url"; + } else { + $debug_info = "$node: DEBUG $method $request_url -d $content"; + } + print "$debug_info\n"; + + return; +} + +#------------------------------------------------------- + +=head3 deal_with_response + + Check response's status_line and + Input: + $handle_id: Async return ID with response + $response: Async return response + +=cut + +#------------------------------------------------------- +sub deal_with_response { + my $handle_id = shift; + my $response = shift; + my $node = $handle_id_node{$handle_id}; + + delete $handle_id_node{$handle_id}; + + if ($response->status_line ne "200 OK") { + my $error; + if ($response->status_line eq "503 Service Unavailable") { + $error = "Service Unavailable"; + } else { + my $response_info = decode_json $response->content; + if ($response->status_line eq "500 Internal Server Error") { + $error = $response_info->{'data'}->{'exception'}; + } elsif ($response_info->{'data'}->{'description'} =~ /path or object not found: (.+)/) { + $error = "path or object not found $1"; + } else { + $error = $response_info->{'data'}->{'description'}; + } + } + xCAT::SvrUtils::sendmsg([1, $error], $callback, $node); + $wait_node_num--; + return; + } + + print "$node: DEBUG " . lc ($node_info{$node}{cur_status}) . " " . $response->status_line . "\n"; + + $status_info{ $node_info{$node}{cur_status} }->{process}->($node, $response); + + return; +} + +#------------------------------------------------------- + +=head3 login_response + + Deal with response of login + Input: + $node: nodename of current response + $response: Async return response + +=cut + +#------------------------------------------------------- +sub login_response { + my $node = shift; + my $response = shift; + + if ($next_status{ $node_info{$node}{cur_status} }) { + $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; + gen_send_request($node); + } + + return; +} + +#------------------------------------------------------- + +=head3 rpower_response + + Deal with response of rpower command + Input: + $node: nodename of current response + $response: Async return response + +=cut + +#------------------------------------------------------- +sub rpower_response { + my $node = shift; + my $response = shift; + + my $response_info = decode_json $response->content; + + if ($node_info{$node}{cur_status} eq "RPOWER_ON_RESPONSE") { + if ($response_info->{'message'} eq "200 OK") { + xCAT::SvrUtils::sendmsg("on", $callback, $node); + } + } + + if ($node_info{$node}{cur_status} eq "RPOWER_OFF_RESPONSE") { + if ($response_info->{'message'} eq "200 OK") { + xCAT::SvrUtils::sendmsg("off", $callback, $node); + } + } + + if ($node_info{$node}{cur_status} eq "RPOWER_RESET_RESPONSE") { + if ($response_info->{'message'} eq "200 OK") { + xCAT::SvrUtils::sendmsg("reset", $callback, $node); + } + } + + if ($node_info{$node}{cur_status} eq "RPOWER_STATUS_RESPONSE") { + xCAT::SvrUtils::sendmsg($response_info->{'data'}->{CurrentHostState}, $callback, $node); + } + + if ($next_status{ $node_info{$node}{cur_status} }) { + if ($node_info{$node}{cur_status} eq "RPOWER_STATUS_RESPONSE") { + if ($response_info->{'data'}->{CurrentHostState} =~ /Off$/) { + $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }{OFF}; + } else { + $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }{ON}; + } + } else { + $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; + } + gen_send_request($node); + } else { + $wait_node_num--; + } + + return; +} + +#------------------------------------------------------- + +=head3 rinv_response + + Deal with response of rinv command + Input: + $node: nodename of current response + $response: Async return response + +=cut + +#------------------------------------------------------- +sub rinv_response { + my $node = shift; + my $response = shift; + + my $response_info = decode_json $response->content; + + my $grep_string = $status_info{RINV_RESPONSE}{argv}; + my $src; + my $content_info; + + foreach my $key_url (keys %{$response_info->{data}}) { + if ($grep_string eq "all" or $key_url =~ /\/$grep_string/) { + if ($key_url =~ /\/(cpu\d*)\/(\w+)/) { + $src = "$1 $2"; + } else { + $src = basename $key_url; + } + + my %content = %{ ${ $response_info->{data} }{$key_url} }; + foreach my $key (keys %content) { + $content_info = uc ($src) . " " . $key . " : " . $content{$key}; + xCAT::SvrUtils::sendmsg("$content_info", $callback, $node); + } + } + } + + if ($next_status{ $node_info{$node}{cur_status} }) { + $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; + gen_send_request($node); + } else { + $wait_node_num--; + } + + return; +} + +#------------------------------------------------------- + +=head3 getopenbmccons + + Process getopenbmccons + +=cut + +#------------------------------------------------------- +sub getopenbmccons { + my $argr = shift; + + #$argr is [$node,$bmcip,$nodeuser,$nodepass]; + my $callback = shift; + + my $rsp; + my $node=$argr->[0]; + my $output = "openbmc, getopenbmccoms"; + xCAT::SvrUtils::sendmsg($output, $callback, $argr->[0], %allerrornodes); + + $rsp = { node => [ { name => [ $argr->[0] ] } ] }; + $rsp->{node}->[0]->{bmcip}->[0] = $argr->[1]; + $rsp->{node}->[0]->{username}->[0] = $argr->[2]; + $rsp->{node}->[0]->{passwd}->[0] = $argr->[3]; + $callback->($rsp); + return $rsp; +} + + + +1; diff --git a/xCAT-server/lib/xcat/plugins/pdu.pm b/xCAT-server/lib/xcat/plugins/pdu.pm index 7e107d529..9d54d92fc 100644 --- a/xCAT-server/lib/xcat/plugins/pdu.pm +++ b/xCAT-server/lib/xcat/plugins/pdu.pm @@ -40,6 +40,10 @@ use SNMP; my $VERBOSE = 0; my %allerrornodes = (); my $callback; +my $pdutab; +my @pduents; +my $pdunodes; + #------------------------------------------------------- @@ -126,14 +130,22 @@ sub process_request @exargs = @$extrargs; } + #fill in the total outlet count for each pdu + $pdutab = xCAT::Table->new('pdu'); + @pduents = $pdutab->getAllNodeAttribs(['node', 'outlet']); + fill_outletCount(\@pduents, $callback); + if( $command eq "rinv") { #for higher performance, handle node in batch return powerstat($noderange, $callback); }elsif ($command eq "rpower") { my $subcmd = $exargs[0]; - if(($subcmd eq 'on') || ($subcmd eq 'off') || ($subcmd eq 'stat')){ + if (($subcmd eq 'pduoff') || ($subcmd eq 'pduon') || ($subcmd eq 'pdustat')|| ($subcmd eq 'pdureset') ){ + #if one day, pdu node have pdu attribute, handle in this section too + return powerpduoutlet($noderange, $subcmd, $callback); + } else { #------------------------------------------- - #there are 2 cases will enter this black + #there are 2 cases will enter this block #one is if node's mgt is pdu #another is if node has pdu attribute but mgt isn't pdu #if the node has pdu attribute but mgt isn't pdu, @@ -147,16 +159,17 @@ sub process_request push @allpdunodes, $node; } } - return powerpdu(\@allpdunodes, $subcmd, $callback); - }elsif(($subcmd eq 'pduoff') || ($subcmd eq 'pduon') || ($subcmd eq 'pdustat')){ - #if one day, pdu node have pdu attribute, handle in this section too - return powerpduoutlet($noderange, $subcmd, $callback); - }else{ - $callback->({ errorcode => [1],error => "The input command $subcmd is not support for pdu"}); + if(@allpdunodes) { + if(($subcmd eq 'on') || ($subcmd eq 'off') || ($subcmd eq 'stat') || ($subcmd eq 'state') || ($subcmd eq 'reset') ){ + return powerpdu(\@allpdunodes, $subcmd, $callback); + } else { + my $pdunode = join (",", @allpdunodes); + $callback->({ errorcode => [1],error => "The option $subcmd is not support for pdu node(s) $pdunode."}); + } + } } }elsif($command eq "nodeset") { - $callback->({ errorcode => [1],error => "The input $command is not support for pdu"}); - + $callback->({ errorcode => [1],error => "The input $command is not support for pdu"}); }else{ #reserve for other new command in future } @@ -164,6 +177,31 @@ sub process_request return; } +sub fill_outletCount { + my $pduentries = shift; + my $callback = shift; + my $outletoid = ".1.3.6.1.4.1.2.6.223.8.2.1.0"; + my $pdutab = xCAT::Table->new('pdu'); + + foreach my $pdu (@$pduentries) { + my $cur_pdu = $pdu->{node}; + my $count = $pdu->{outlet}; + #get total outlet number for the pdu + if (!$count) { + my $session = connectTopdu($cur_pdu,$callback); + #will not log this error to output + if (!$session) { + next; + } + $count = $session->get("$outletoid"); + if ($count) { + $pdutab->setNodeAttribs($cur_pdu, {outlet => $count}); + } + } + $pdunodes->{$cur_pdu}->{outlet}=$count; + } +} + #------------------------------------------------------- =head3 powerpdu @@ -177,30 +215,36 @@ sub powerpdu { my $noderange = shift; my $subcmd = shift; my $callback = shift; - my $outletnum = ".1.3.6.1.4.1.2.6.223.8.2.1.0"; - if ($subcmd eq "stat") { + if (($subcmd eq "stat") || ($subcmd eq "state")){ return powerstat($noderange, $callback); } foreach my $node (@$noderange) { my $session = connectTopdu($node,$callback); - my $count = $session->get("$outletnum"); + if (!$session) { + $callback->({ errorcode => [1],error => "Couldn't connect to $node"}); + next; + } + my $count = $pdunodes->{$node}->{outlet}; my $value; my $statstr; if ($subcmd eq "off") { $value = 0; $statstr = "off"; - } else { + } elsif ( $subcmd eq "on") { $value = 1; $statstr = "on"; + } else { + $value = 2; + $statstr = "reset"; } for (my $outlet =1; $outlet <= $count; $outlet++) { outletpower($session, $outlet, $value); if ($session->{ErrorStr}) { - $callback->({ error => "$session->{ErrorStr}"}); + $callback->({ errorcode => [1],error => "Failed to get outlet status for $node"}); } else { my $output = " outlet $outlet is $statstr"; xCAT::SvrUtils::sendmsg($output, $callback, $node, %allerrornodes); @@ -244,6 +288,14 @@ sub powerpduoutlet { foreach my $pdu_outlet (@pdus) { my ($pdu, $outlet) = split /:/, $pdu_outlet; my $session = connectTopdu($pdu,$callback); + if (!$session) { + $callback->({ errorcode => [1],error => "Couldn't connect to $pdu"}); + next; + } + if ($outlet > $pdunodes->{$pdu}->{outlet} ) { + $callback->({ errorcode => [1],error => "outlet number $outlet is invalid for $pdu"}); + next; + } my $cmd; if ($subcmd eq "pdustat") { $statstr=outletstat($session, $outlet); @@ -255,12 +307,16 @@ sub powerpduoutlet { $value = 1; $statstr = "on"; outletpower($session, $outlet, $value); + } elsif ($subcmd eq "pdureset") { + $value = 2; + $statstr = "reset"; + outletpower($session, $outlet, $value); } else { $callback->({ error => "$subcmd is not support"}); } if ($session->{ErrorStr}) { - $callback->({ error => "$session->{ErrorStr}"}); + $callback->({ errorcode => [1],error => "$session->{ErrorStr} for $pdu outlet $outlet"}); } else { $output = "$pdu outlet $outlet is $statstr"; xCAT::SvrUtils::sendmsg($output, $callback, $node, %allerrornodes); @@ -304,10 +360,13 @@ sub powerstat { my $callback = shift; my $output; - my $outletnum = ".1.3.6.1.4.1.2.6.223.8.2.1.0"; foreach my $pdu (@$noderange) { my $session = connectTopdu($pdu,$callback); - my $count = $session->get("$outletnum"); + if (!$session) { + $callback->({ errorcode => [1],error => "Couldn't connect to $pdu"}); + next; + } + my $count = $pdunodes->{$pdu}->{outlet}; for (my $outlet =1; $outlet <= $count; $outlet++) { my $statstr = outletstat($session, $outlet); @@ -337,8 +396,10 @@ sub outletstat { $output = $session->get("$oid.$outlet"); if ($output eq 1) { $statstr = "on"; - } else { + } elsif ($output eq 0) { $statstr = "off"; + } else { + return; } return $statstr; } @@ -368,8 +429,6 @@ sub connectTopdu { UseSprintValue => 1, ); unless ($session) { - $msg = "Failed to connect to $pdu"; - xCAT::SvrUtils::sendmsg($msg, $callback, $pdu, %allerrornodes); return; } return $session; diff --git a/xCAT-server/lib/xcat/plugins/petitboot.pm b/xCAT-server/lib/xcat/plugins/petitboot.pm index cea7eeaea..d40e60694 100644 --- a/xCAT-server/lib/xcat/plugins/petitboot.pm +++ b/xCAT-server/lib/xcat/plugins/petitboot.pm @@ -5,6 +5,7 @@ use File::Path; use Getopt::Long; use xCAT::Table; use Sys::Syslog; +use xCAT::Scope; my $globaltftpdir = xCAT::TableUtils->getTftpDir(); diff --git a/xCAT-server/lib/xcat/plugins/rhevm.pm b/xCAT-server/lib/xcat/plugins/rhevm.pm index 5a45e7870..c2b833958 100644 --- a/xCAT-server/lib/xcat/plugins/rhevm.pm +++ b/xCAT-server/lib/xcat/plugins/rhevm.pm @@ -127,7 +127,7 @@ sub preprocess_request { } #pdu commands will be handled in the pdu plugin - if (($extraargs->[0] eq 'pdustat') || ($extraargs->[0] eq 'pduon') || ($extraargs->[0] eq 'pduoff')) { + if (($extraargs->[0] eq 'pdustat') || ($extraargs->[0] eq 'pdureset') || ($extraargs->[0] eq 'pduon') || ($extraargs->[0] eq 'pduoff')) { return; } diff --git a/xCAT-server/lib/xcat/plugins/rinstall.pm b/xCAT-server/lib/xcat/plugins/rinstall.pm index 666935592..b68bf8ac3 100644 --- a/xCAT-server/lib/xcat/plugins/rinstall.pm +++ b/xCAT-server/lib/xcat/plugins/rinstall.pm @@ -218,9 +218,9 @@ sub rinstall { } my $nodetypearch = $nodetypeattribs->{'arch'}; if ($nodetypearch ne $osimagearch) { - unless ((($nodetypearch =~ /ppc64le/) or ($nodetypearch =~ /ppc64el/)) and (($osimagearch =~ /ppc64le/) or ($osimagearch =~ /ppc64el/))) { + unless(($nodetypearch =~ /^ppc64(le|el)?$/i) and ($osimagearch =~ /^ppc64(le|el)?$/i)){ my $rsp = {}; - $rsp->{error}->[0] = "$node: The value of 'arch' attribute is not same as the 'osarch' attribute for osimage."; + $rsp->{error}->[0] = "$node: The value of 'arch' attribute of node does not match the 'osarch' attribute of osimage."; $rsp->{errorcode}->[0] = 1; xCAT::MsgUtils->message("E", $rsp, $callback); next; diff --git a/xCAT-server/lib/xcat/plugins/statelite.pm b/xCAT-server/lib/xcat/plugins/statelite.pm index 4b5667648..daed8b6e6 100644 --- a/xCAT-server/lib/xcat/plugins/statelite.pm +++ b/xCAT-server/lib/xcat/plugins/statelite.pm @@ -181,6 +181,8 @@ sub process_request { system("mkdir -p $rootimg_dir/xcatpost"); system("cp -r $installroot/postscripts/* $rootimg_dir/xcatpost/"); + # update rw to ro for sles + updateFstab($rootimg_dir,$profile,$arch); #get the root password for the node my $pass = xCAT::PasswordUtils::crypt_system_password(); @@ -258,7 +260,6 @@ sub process_request { return; } - # now get the files for the node my @synclist = xCAT::Utils->runcmd("ilitefile $imagename", 0, 1); unless (@synclist) { @@ -569,6 +570,8 @@ sub process_request { system("rm -f $xcat_packimg_tmpfile"); } chdir($oldpath); + + } sub liteMe { @@ -968,5 +971,33 @@ sub liteItem { } } +=head3 + updateFstab +=cut + +sub updateFstab { + + $rootimg_dir = shift; + $profile = shift; + $arch = shift; + + my $rootfs_name = $profile . "_" . $arch; + + my $tfstab; + open($tfstab, "<", "$rootimg_dir/etc/fstab"); + my @fsdents = <$tfstab>; + close($tfstab); + + open($tfstab, ">", "$rootimg_dir/etc/fstab"); + foreach my $line (@fsdents) { + if ( $line =~ /^$rootfs_name/ ) { + $line =~ s/\brw\b/ro/; + } + print $tfstab $line; + } + close($tfstab); + +} + 1; diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index 4966a24ff..ebc6cb61b 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -23,6 +23,7 @@ use Socket; use Expect; #global variables for this module +my $community; my %globalopt; my @filternodes; my @iprange; @@ -949,6 +950,13 @@ sub snmp_scan { send_msg($request, 0, "$result\n" ); } my @lines = split /\n/, $result; + + #set community string for switch + $community = "public"; + my @snmpcs = xCAT::TableUtils->get_site_attribute("snmpc"); + my $tmp = $snmpcs[0]; + if (defined($tmp)) { $community = $tmp } + foreach my $line (@lines) { my @array = split / /, $line; @@ -1008,8 +1016,8 @@ sub get_snmpvendorinfo { #Ubuntu only takes OID - #my $ccmd = "snmpwalk -Os -v1 -c public $ip sysDescr.0"; - my $ccmd = "snmpwalk -Os -v1 -c public $ip 1.3.6.1.2.1.1.1"; + #get sysDescr.0"; + my $ccmd = "snmpwalk -Os -v1 -c $community $ip 1.3.6.1.2.1.1.1"; if (exists($globalopt{verbose})) { send_msg($request, 0, "Process command: $ccmd\n"); } @@ -1047,8 +1055,8 @@ sub get_snmpmac { my $mac; #Ubuntu only takes OID - #my $ccmd = "snmpwalk -Os -v1 -c public $ip ipNetToMediaPhysAddress | grep $ip"; - my $ccmd = "snmpwalk -Os -v1 -c public $ip 1.3.6.1.2.1.4.22.1.2 | grep $ip"; + #get ipNetToMediaPhysAddress; + my $ccmd = "snmpwalk -Os -v1 -c $community $ip 1.3.6.1.2.1.4.22.1.2 | grep $ip"; if (exists($globalopt{verbose})) { send_msg($request, 0, "Process command: $ccmd\n"); @@ -1091,8 +1099,8 @@ sub get_snmphostname { my $hostname; #Ubuntu only takes OID - #my $ccmd = "snmpwalk -Os -v1 -c public $ip sysName"; - my $ccmd = "snmpwalk -Os -v1 -c public $ip 1.3.6.1.2.1.1.5"; + #get sysName info; + my $ccmd = "snmpwalk -Os -v1 -c $community $ip 1.3.6.1.2.1.1.5"; if (exists($globalopt{verbose})) { send_msg($request, 0, "Process command: $ccmd\n"); } @@ -1415,7 +1423,10 @@ sub matchPredefineSwitch { send_msg($request, 0, "Switch discovered and matched: $dswitch to $node" ); - xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"otherinterfaces=$ip",'status=Matched',"mac=$mac","switchtype=$stype","usercomment=$vendor"] }, $sub_req, 0, 1); + # only write to xcatdb if -w or --setup option specified + if ( (exists($globalopt{w})) || (exists($globalopt{setup})) ) { + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"otherinterfaces=$ip",'status=Matched',"mac=$mac","switchtype=$stype","usercomment=$vendor"] }, $sub_req, 0, 1); + } push (@{$configswitch->{$stype}}, $node); } diff --git a/xCAT-server/lib/xcat/plugins/windows.pm b/xCAT-server/lib/xcat/plugins/windows.pm index 5e0f61d51..141949332 100644 --- a/xCAT-server/lib/xcat/plugins/windows.pm +++ b/xCAT-server/lib/xcat/plugins/windows.pm @@ -175,15 +175,10 @@ sub winshell { } else { mkwinlinks($node, $oshash->{$node}->[0]); } - my $bptab = xCAT::Table->new('bootparams', -create => 1); - $bptab->setNodeAttribs( - $node, - { - kernel => "Boot/pxeboot.0", - initrd => "", - kcmdline => "" - } - ); + my $bootparams = ${$request->{bootparams}}; + $bootparams->{$node}->[0]->{kernel} = "Boot/pxeboot.0"; + $bootparams->{$node}->[0]->{kcmdline} = ""; + $bootparams->{$node}->[0]->{initrd} = ""; } } @@ -245,7 +240,7 @@ sub mkinstall my $node; my $ostab = xCAT::Table->new('nodetype'); my %doneimgs; - my $bptab = xCAT::Table->new('bootparams', -create => 1); + my $bootparams = ${$request->{bootparams}}; my $hmtab = xCAT::Table->new('nodehm'); my $vpdtab = xCAT::Table->new('vpd'); my $vpdhash = $vpdtab->getNodesAttribs(\@nodes, ['uuid']); @@ -365,16 +360,11 @@ sub mkinstall } else { mkwinlinks($node, $ent); } + $bootparams->{$node}->[0]->{kcmdline} = ""; + $bootparams->{$node}->[0]->{initrd} = ""; if ($arch =~ /x86_64/) { - $bptab->setNodeAttribs( - $node, - { - kernel => "Boot/pxeboot.0", - initrd => "", - kcmdline => "" - } - ); + $bootparams->{$node}->[0]->{kernel} = "Boot/pxeboot.0"; } elsif ($arch =~ /x86/) { unless (-r "$tftpdir/Boot/pxeboot32.0") { my $origpxe; @@ -402,14 +392,7 @@ sub mkinstall print $bootmgr $_; } } - $bptab->setNodeAttribs( - $node, - { - kernel => "Boot/pxeboot32.0", - initrd => "", - kcmdline => "" - } - ); + $bootparams->{$node}->[0]->{kernel} = "Boot/pxeboot32.0"; } next; } @@ -500,14 +483,9 @@ sub mkinstall } elsif (-r $installroot . "/$os/$arch/sources/install.wim") { if ($arch =~ /x86/) { - $bptab->setNodeAttribs( - $node, - { - kernel => "$winpepath" . "Boot/pxeboot.0", - initrd => "", - kcmdline => "" - } - ); + $bootparams->{$node}->[0]->{kcmdline} = ""; + $bootparams->{$node}->[0]->{initrd} = ""; + $bootparams->{$node}->[0]->{kernel} = "Boot/pxeboot.0"; } } else diff --git a/xCAT-server/lib/xcat/plugins/xen.pm b/xCAT-server/lib/xcat/plugins/xen.pm index 7a552e7aa..6629f9b9f 100644 --- a/xCAT-server/lib/xcat/plugins/xen.pm +++ b/xCAT-server/lib/xcat/plugins/xen.pm @@ -706,7 +706,7 @@ sub process_request { } #pdu commands will be handled in the pdu plugin - if ($command eq "rpower" and grep(/^pduon|pduoff|pdustat$/, @exargs)) { + if ($command eq "rpower" and grep(/^pduon|pduoff|pdureset|pdustat$/, @exargs)) { return; } diff --git a/xCAT-server/lib/xcat/plugins/zvm.pm b/xCAT-server/lib/xcat/plugins/zvm.pm index 911be973e..d04a98aae 100644 --- a/xCAT-server/lib/xcat/plugins/zvm.pm +++ b/xCAT-server/lib/xcat/plugins/zvm.pm @@ -2319,7 +2319,7 @@ sub powerVM { my $out; ##pdu commands will be handled in the pdu plugin - if ($args->[0] eq 'pduon' || $args->[0] eq 'pduoff' || $args->[0] eq 'pdustat') { + if ($args->[0] eq 'pduon' || $args->[0] eq 'pdureset' || $args->[0] eq 'pduoff' || $args->[0] eq 'pdustat') { return; } diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index fe6244c3b..4327ff09d 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -969,6 +969,10 @@ sub genSSHNodeHostKey # # generate new hostkeys # + + my ($rlogin,$rpass,$ruid,$rgid) = getpwnam("root"); + my ($sname, $spasswd,$sgid,$smembers)=getgrnam("ssh_keys"); + my @sshkeylist; xCAT::MsgUtils->message('I', "Generating new node hostkeys..."); xCAT::MsgUtils->message('I', "Generating SSH2 RSA Key..."); my $cmd = @@ -978,6 +982,10 @@ sub genSSHNodeHostKey { xCAT::MsgUtils->message('E', "Could not generate SSH2 RSA key."); } + else{ + push @sshkeylist,"/etc/xcat/hostkeys/ssh_host_rsa_key"; + } + xCAT::MsgUtils->message('I', "Generating SSH2 DSA Key..."); $cmd = @@ -987,6 +995,9 @@ sub genSSHNodeHostKey { xCAT::MsgUtils->message('E', "Could not generate SSH2 DSA key."); } + else{ + push @sshkeylist,"/etc/xcat/hostkeys/ssh_host_dsa_key"; + } # see if this system supports the ecdsa xCAT::Utils->runcmd('rm -rf /tmp/ecdsa_key >/dev/null 2>&1 ; /usr/bin/ssh-keygen -t ecdsa -f /tmp/ecdsa_key -P "" &>/dev/null', 0); @@ -999,8 +1010,17 @@ sub genSSHNodeHostKey { xCAT::MsgUtils->message('E', "Could not generate SSH2 ECDSA key."); } + else{ + push @sshkeylist,"/etc/xcat/hostkeys/ssh_host_ecdsa_key"; + } } + if(@sshkeylist){ + if(defined $ruid && defined $sgid){ + chown $ruid,$sgid,@sshkeylist; + } + chmod 0640,@sshkeylist; + } # copy the public keys to install directory $cmd = @@ -1542,7 +1562,7 @@ sub genCredentials my ($cmd, $outref, $rc); $rc = getgrnam($user); if (!$rc) { - $cmd = "groupadd $user"; + $cmd = "groupadd --system $user"; $outref = xCAT::Utils->runcmd("$cmd", 0); if ($::RUNCMD_RC != 0) { xCAT::MsgUtils->message('E', "$cmd failed"); @@ -1551,7 +1571,7 @@ sub genCredentials } $rc = getpwnam($user); if (!$rc) { - $cmd = "useradd -g $user -s /bin/bash -d /home/$user -m $user"; + $cmd = "useradd --system -g $user -s /bin/bash -d /home/$user -m $user"; $outref = xCAT::Utils->runcmd("$cmd", 0); if ($::RUNCMD_RC != 0) { xCAT::MsgUtils->message('E', "$cmd failed"); diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 4b21cd981..2bc097027 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -2843,6 +2843,7 @@ sub service_connection { } } else { my %resp = (error => "Permission denied for request"); + $resp{errorcode}=1; $resp{serverdone} = [undef]; if ($req->{transid}) { $resp{transid} = $req->{transid}->[0]; diff --git a/xCAT-server/share/xcat/cons/openbmc b/xCAT-server/share/xcat/cons/openbmc new file mode 100755 index 000000000..172bb272e --- /dev/null +++ b/xCAT-server/share/xcat/cons/openbmc @@ -0,0 +1,98 @@ +#!/usr/bin/env perl +# IBM(c) 2017 EPL license http://www.eclipse.org/legal/epl-v10.html +use Fcntl qw(:DEFAULT :flock); +use Time::HiRes qw(sleep); +use File::Path; +BEGIN { + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; +} +my $sleepint = int(rand(10)); #Stagger start to avoid overwhelming conserver/xCATd +my ($lockfd, $bmcip); +my $username = 'root'; +my $password = '0penBmc'; +my $node = $ARGV[0]; + +use constant CONSOLE_LOCK_FILE => "/tmp/xcat/consolelock"; +use constant CONSOLE_LOCK_DIR => "/tmp/xcat"; + +sub acquire_lock { + umask 0077; + mkpath(CONSOLE_LOCK_DIR); + print "Acquiring startup lock..."; + unless (sysopen($lockfd, CONSOLE_LOCK_FILE, O_WRONLY | O_CREAT)) { + print "Unable to open file ".CONSOLE_LOCK_FILE."\n"; + sleep(15); + exit 1; + } + unless (flock($lockfd, LOCK_EX)) { + print "Unable to lock file ".CONSOLE_LOCK_FILE."\n"; + close($lockfd); + sleep(15); + exit 1; + } + print "done\n"; + unless (syswrite($lockfd, $$, length($$))) { + print "Unable to write file ".CONSOLE_LOCK_FILE."\n"; + close($lockfd); + sleep(15); + exit 1; + } +} + +sub release_lock { + flock($lockfd, LOCK_UN); + close($lockfd); +} + + +use lib "$::XCATROOT/lib/perl"; +require xCAT::Client; + +sub getans { + my $rsp = shift; + if ($rsp->{node}) { + $bmcip = $rsp->{node}->[0]->{bmcip}->[0]; + $username = $rsp->{node}->[0]->{username}->[0]; + $password = $rsp->{node}->[0]->{passwd}->[0]; + if (exists $rsp->{node}->[0]->{error}) { + my $error = $rsp->{node}->[0]->{error}->[0]; + print "$error\n"; + } + print "$bmcip, $username, $password\n"; + } +} +my $cmdref = { + command => ["getopenbmccons"], + arg => ["text"], + noderange => [ $ARGV[0] ] +}; +acquire_lock(); +# avoid of congestion +sleep(0.1); +release_lock(); +xCAT::Client::submit_request($cmdref, \&getans); + +until (($username or $password) and $bmcip ) { + #Let other clients have a go + $sleepint = 10 + int(rand(20)); + print "Console not ready, retrying in $sleepint seconds (Ctrl-e,c,o to skip delay) \n"; + sleep ($sleepint); + acquire_lock(); + sleep(0.1); + release_lock(); + xCAT::Client::submit_request($cmdref, \&getans); +} + +my $isintel = 0; +my $sleepint; +my $rc; + +my $sshport = 2200; +if ($ENV{SSHCONSOLEPORT}) { + $sshport= $ENV{SSHCONSOLEPORT}; +} + +print "If the console cannot connect, please verify whether ssh keys has been configured on the bmc for $username user\n"; + +exec "ssh -p $sshport -l $username $bmcip"; + diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index 2d6cffec7..48024de9c 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -180,6 +180,7 @@ echo " # global value to store the running status of the postbootscripts,the value is non-zero if one postbootscript failed return_value=0 + # subroutine used to run postscripts # \$1 argument is the script type # rest argument is the script name and arguments @@ -202,7 +203,6 @@ run_ps () { fi if [ -f \$1 ]; then - echo \"\`date\` Running \$scriptype: \$1\" msgutil_r \"\$MASTER_IP\" \"info\" "\"\`date\` Running \$scriptype: \$1\"" \"\$logfile\" if [ \"\$XCATDEBUGMODE\" = \"1\" ] || [ \"\$XCATDEBUGMODE\" = \"2\" ]; then local compt=\$(file \$1) @@ -211,25 +211,24 @@ run_ps () { bash -x ./\$@ 2>&1 ret_local=\$? else - ./\$@ 2>&1 | tee -a \$logfile | logger -t xcat -p debug + ./\$@ 2>&1 | logger -t xcat -p debug ret_local=\${PIPESTATUS[0]} fi else - ./\$@ 2>&1 | tee -a \$logfile + ./\$@ 2>&1 ret_local=\${PIPESTATUS[0]} fi if [ \"\$ret_local\" -ne \"0\" ]; then return_value=\$ret_local fi - echo \"\$scriptype: \$1 exited with code \$ret_local\" msgutil_r \"\$MASTER_IP\" \"info\" "\"\`date\` \$scriptype \$1 return with \$ret_local\"" \"\$logfile\" else - echo \"\`date\` \$scriptype \$1 does NOT exist.\" msgutil_r \"\$MASTER_IP\" \"info\" "\"\`date\` \$scriptype \$1 does NOT exist.\"" \"\$logfile\" return_value=-1 fi + return 0 } # subroutine end @@ -392,6 +391,19 @@ fi #create the preboot script and run here TMP=`sed "/^#\s*postbootscripts-start-here/,/^#\s*postbootscripts-end-here/ d" /xcatpost/mypostscript` echo "$TMP" > /xcatpost/mypostscript + +echo " +#save bad return code to /opt/xcat/xcatinfo +if [ \"\$return_value\" -ne \"0\" ]; then + grep 'POSTSCRIPTS_RC' /opt/xcat/xcatinfo > /dev/null 2>&1 + if [ \$? -eq 0 ]; then + sed -i \"s/POSTSCRIPTS_RC=.*/POSTSCRIPTS_RC=1/\" /opt/xcat/xcatinfo + else + echo \"POSTSCRIPTS_RC=1\" >> /opt/xcat/xcatinfo + fi +fi +" >> /xcatpost/mypostscript + chmod 755 /xcatpost/mypostscript export ARCH=#TABLE:nodetype:THISNODE:arch# diff --git a/xCAT-server/share/xcat/netboot/debian/genimage b/xCAT-server/share/xcat/netboot/debian/genimage index aa9afbe46..537e7d221 100755 --- a/xCAT-server/share/xcat/netboot/debian/genimage +++ b/xCAT-server/share/xcat/netboot/debian/genimage @@ -386,7 +386,7 @@ while (scalar @checkdeps) { unless (grep { $_ eq $dep } @ndrivers) { #only add if not added unshift(@checkdeps, $dep); #recursively check dependencies unshift(@ndrivers, $dep); - print "Added $dep as an autodetected depedency\n"; + print "Added $dep as an autodetected dependency\n"; } } } diff --git a/xCAT-server/share/xcat/netboot/fedora12/genimage b/xCAT-server/share/xcat/netboot/fedora12/genimage index d108d0dcc..23f831ec4 100755 --- a/xCAT-server/share/xcat/netboot/fedora12/genimage +++ b/xCAT-server/share/xcat/netboot/fedora12/genimage @@ -384,7 +384,7 @@ while (scalar @checkdeps) { unless (grep { $_ eq $dep } @ndrivers) { #only add if not added unshift(@checkdeps, $dep); #recursively check dependencies unshift(@ndrivers, $dep); - print "Added $dep as an autodetected depedency\n"; + print "Added $dep as an autodetected dependency\n"; } } } diff --git a/xCAT-server/share/xcat/netboot/fedora12/geninitrd b/xCAT-server/share/xcat/netboot/fedora12/geninitrd index 6eaa3fa92..95480753b 100755 --- a/xCAT-server/share/xcat/netboot/fedora12/geninitrd +++ b/xCAT-server/share/xcat/netboot/fedora12/geninitrd @@ -393,7 +393,7 @@ while (scalar @checkdeps) { unless (grep { $_ eq $dep } @ndrivers) { #only add if not added unshift(@checkdeps, $dep); #recursively check dependencies unshift(@ndrivers, $dep); - print "Added $dep as an autodetected depedency\n"; + print "Added $dep as an autodetected dependency\n"; } } } diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/patch/syslog/parse-syslog-opts.sh b/xCAT-server/share/xcat/netboot/rh/dracut/patch/syslog/parse-syslog-opts.sh index 6c070fbd6..e58c8f5a7 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/patch/syslog/parse-syslog-opts.sh +++ b/xCAT-server/share/xcat/netboot/rh/dracut/patch/syslog/parse-syslog-opts.sh @@ -1,6 +1,5 @@ #!/bin/sh -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offs -et: 4; -*- +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # ex: ts=8 sw=4 sts=4 et filetype=sh # Parses the syslog commandline options diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 17e06fd19..9a7e5d9e5 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -686,7 +686,7 @@ while (scalar @checkdeps) { foreach $dep (@deps) { $dep =~ s/.*\///; unless (grep { $_ eq $dep } @ndrivers) { #only add if not added - print "Added $dep as an autodetected depedency\n"; + print "Added $dep as an autodetected dependency\n"; } unshift(@checkdeps, $dep); #recursively check dependencies unshift(@ndrivers, $dep); @@ -1140,7 +1140,7 @@ sub mkinitrd { unless (grep { $_ eq $dep } @ndrivers) { #only add if not added unshift(@checkdeps, $dep); #recursively check dependencies unshift(@ndrivers, $dep); - print "Added $dep as an autodetected depedency\n"; + print "Added $dep as an autodetected dependency\n"; } } } diff --git a/xCAT-server/share/xcat/netboot/rh/genimage.rh4 b/xCAT-server/share/xcat/netboot/rh/genimage.rh4 index 7eb1d05fa..89c130c16 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage.rh4 +++ b/xCAT-server/share/xcat/netboot/rh/genimage.rh4 @@ -402,7 +402,7 @@ while (scalar @checkdeps) { unless (grep { $_ eq $dep } @ndrivers) { #only add if not added unshift(@checkdeps, $dep); #recursively check dependencies unshift(@ndrivers, $dep); - print "Added $dep as an autodetected depedency\n"; + print "Added $dep as an autodetected dependency\n"; } } } diff --git a/xCAT-server/share/xcat/netboot/sles/dracut_033/xcat-prepivot.sh b/xCAT-server/share/xcat/netboot/sles/dracut_033/xcat-prepivot.sh index 5b5aaf109..b5114ef43 100755 --- a/xCAT-server/share/xcat/netboot/sles/dracut_033/xcat-prepivot.sh +++ b/xCAT-server/share/xcat/netboot/sles/dracut_033/xcat-prepivot.sh @@ -134,13 +134,16 @@ function getdevfrommac() { done } - for lf in /tmp/dhclient.*.lease; do netif=${lf#*.} netif=${netif%.*} cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases" done +if [ -f $NEWROOT/etc/hostname ]; then + echo `hostname -s` > $NEWROOT/etc/hostname +fi + if [ ! -z "$ifname" ]; then MACX=${ifname#*:} ETHX=${ifname%:$MACX*} diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 0092945e9..84897d2ed 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -925,7 +925,7 @@ while (scalar @checkdeps) { foreach $dep (@deps) { $dep =~ s/.*\///; unless (grep { $_ eq $dep } @ndrivers) { #only add if not added - print "Added $dep as an autodetected depedency\n"; + print "Added $dep as an autodetected dependency\n"; } unshift(@checkdeps, $dep); #recursively check dependencies unshift(@ndrivers, $dep); diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index 41ed2f46c..c8e6d139d 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -715,7 +715,7 @@ while (scalar @checkdeps) { unless (grep { $_ eq $dep } @ndrivers) { #only add if not added unshift(@checkdeps, $dep); #recursively check dependencies unshift(@ndrivers, $dep); - print "Added $dep as an autodetected depedency\n"; + print "Added $dep as an autodetected dependency\n"; } } } diff --git a/xCAT-server/share/xcat/scripts/configBNT b/xCAT-server/share/xcat/scripts/configBNT index 23e81e656..3b31b975b 100755 --- a/xCAT-server/share/xcat/scripts/configBNT +++ b/xCAT-server/share/xcat/scripts/configBNT @@ -67,17 +67,37 @@ if ($::HELP) exit(0); } +my $switchestab; +my $switchhash; +my $passwdtab; +my @passwd_ent; + if ($::SWITCH) { my @filternodes = xCAT::NodeRange::noderange( $::SWITCH ); if (nodesmissed) { my $nodenotdefined = join(',', nodesmissed); xCAT::MsgUtils->message("I","The following nodes are not defined in xCAT: $nodenotdefined"); } - # check switch type - my $switchestab = xCAT::Table->new('switches'); - my $switches_hash = $switchestab->getNodesAttribs(\@filternodes,['switchtype']); + # check switch attributes + $switchestab = xCAT::Table->new('switches'); + $switchhash = $switchestab->getNodesAttribs(\@filternodes,['switchtype','sshusername','sshpassword','protocol']); + + # get switch username and password from passwd + $passwdtab = xCAT::Table->new('passwd'); + @passwd_ent = $passwdtab->getAttribs({ key => "switch" }, [ 'username', 'password' ]); + foreach my $fsw (@filternodes) { - if (($switches_hash->{$fsw}->[0]->{switchtype}) =~ /BNT/) { + if (($switchhash->{$fsw}->[0]->{switchtype}) =~ /BNT/) { + # use switches table first + if ((!defined($switchhash->{$fsw}->[0]->{sshusername})) && + (!defined($switchhash->{$fsw}->[0]->{sshpassword})) ) { + if (defined($passwd_ent[0]->{username})) { + $switchhash->{$fsw}->[0]->{sshusername} = $passwd_ent[0]->{username}; + } + if (defined($passwd_ent[0]->{password})) { + $switchhash->{$fsw}->[0]->{sshpassword} = $passwd_ent[0]->{password}; + } + } push @nodes, $fsw; } else { xCAT::MsgUtils->message("E","The $fsw is not BNT switch, will not config"); @@ -97,6 +117,12 @@ if ($::SWITCH) { my $mactab = xCAT::Table->new("mac"); my $machash = $mactab->getNodesAttribs(\@nodes,['mac']); +#set community string for switch +my $community = "public"; +my @snmpcs = xCAT::TableUtils->get_site_attribute("snmpc"); +my $tmp = $snmpcs[0]; +if (defined($tmp)) { $community = $tmp } + my $switches = join(",",@nodes); my $cmd; my $vlan; @@ -177,7 +203,7 @@ sub config_ip { $ip_str =~ s/\./\-/g; $dswitch = "switch-$ip_str"; } - $cmd = "chdef -t node -o $dswitch groups=switch ip=$dip switchtype=BNT username=root password=admin protocol=telnet nodetype=switch"; + $cmd = "chdef -t node -o $dswitch groups=switch ip=$dip switchtype=BNT username=root password=admin nodetype=switch"; $rc= xCAT::Utils->runcmd($cmd, 0); $cmd = "makehosts $dswitch"; $rc= xCAT::Utils->runcmd($cmd, 0); @@ -275,7 +301,6 @@ sub config_hostname { } } - #setup secure SNMP v3 sub config_snmp { my $snmp_user; @@ -302,10 +327,32 @@ sub config_snmp { foreach my $switch (@nodes) { my $mysw; + my $username; + my $passwd; + my $protocol; + + my $login_cmd; + + $username = $switchhash->{$switch}->[0]->{sshusername}; + $passwd = $switchhash->{$switch}->[0]->{sshpassword}; + $protocol = $switchhash->{$switch}->[0]->{protocol}; + if ($protocol =~ /telnet/) { + $login_cmd = "telnet $switch\r"; + } else { + $login_cmd = "ssh $username\@$switch\r"; + } + + #get hostname on the switch in case hostname is different + my $ccmd = "snmpwalk -Os -v1 -c $community $switch 1.3.6.1.2.1.1.5"; + my $result = xCAT::Utils->runcmd($ccmd, 0); + my ($desc,$switchhost) = split /: /, $result; + if (!$switchhost) { + $switchhost=$switch; + } my $mac= $machash->{$switch}->[0]->{mac}; if ($mac =~ /6c\:ae\:8b/i){ - my $rc = config_G8264($switch,$snmp_user,$snmp_passwd,$snmp_group); + my $rc = config_G8264($switch,$login_cmd, $passwd, $snmp_user,$snmp_passwd,$snmp_group); if ($rc == 0){ push (@config_switches, $switch); } @@ -316,17 +363,17 @@ sub config_snmp { my $config_cmd="configure terminal\r"; my $exit_cmd="exit\r"; - my $pwd_prompt = "password: "; - my $sw_prompt = "$switch>"; - my $enable_prompt="$switch#"; + my $user_prompt = "username: "; + my $pwd_prompt = "assword: "; + my $sw_prompt = "$switchhost>"; + my $enable_prompt="$switchhost#"; my $config_prompt="^.*\\\(config\\\)\#"; $mysw = new Expect; my $timeout = 20; - my $login_cmd = "telnet $switch\r"; - my $passwd = "admin\r"; + #my $login_cmd = "telnet $switch\r"; - print "Setup SNMP server for $switch\n"; + print "Setup SNMP server for $switch, $username, $passwd\n"; #create a SNMP user my $cfg_user1="snmp-server user 5 name $snmp_user\r"; my $cfg_user2="snmp-server user 5 authentication-protocol sha authentication-password\r"; @@ -351,19 +398,20 @@ sub config_snmp { my @result = $mysw->expect( $timeout, [ - $pwd_prompt, + $user_prompt, sub { $mysw->clear_accum(); - $mysw->send("$passwd\r"); + $mysw->send("$username\r"); $mysw->clear_accum(); $mysw->exp_continue(); } ], [ - "-re", $sw_prompt, + $pwd_prompt, sub { $mysw->clear_accum(); - $mysw->send($enable_cmd); + $mysw->send("$passwd\r"); + $mysw->clear_accum(); $mysw->exp_continue(); } ], @@ -381,7 +429,7 @@ sub config_snmp { $mysw->clear_accum(); $mysw->send($cfg_user1); $mysw->send($cfg_user2); - $mysw->send($passwd); + $mysw->send("$passwd\r"); $mysw->send($snmp_passwd); $mysw->send($snmp_passwd); sleep 1; @@ -401,6 +449,14 @@ sub config_snmp { $mysw->send($exit_cmd); } ], + [ + "-re", $sw_prompt, + sub { + $mysw->clear_accum(); + $mysw->send($enable_cmd); + $mysw->exp_continue(); + } + ], ); ########################################## # Expect error - report and quit @@ -425,6 +481,8 @@ sub config_snmp { sub config_G8264 { my $switch = shift; + my $login_cmd = shift; + my $passwd = shift; my $snmp_user = shift; my $snmp_passwd = shift; my $snmp_group = shift; @@ -437,9 +495,7 @@ sub config_G8264 { #use expect to set password my $mysw = new Expect; my $timeout = 20; - my $login_cmd = "telnet $switch\r"; - my $passwd = "admin\r"; - my $pwd_prompt = "password: "; + my $pwd_prompt = "assword: "; my $main_prompt="Main#"; my $authpw_cmd = "/cfg/sys/ssnmp/snmpv3/usm 5/authpw\r"; @@ -467,7 +523,7 @@ sub config_G8264 { sub { $mysw->clear_accum(); $mysw->send($authpw_cmd); - $mysw->send($passwd); + $mysw->send("$passwd\r"); $mysw->send($snmp_passwd); $mysw->send($snmp_passwd); sleep 1; diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 5acda794c..b445b04a8 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.13 +# Version 1.0.15 # # Copyright (C) 2016 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) @@ -370,7 +370,9 @@ function check_linux_version() local ver="$(source /etc/os-release >/dev/null 2>&1 && echo "${VERSION_ID}")" [[ -z "${ver}" && -f /etc/redhat-release ]] && - ver="$(awk '{ print $(NF - 1) }' /etc/redhat-release)" + # Need gawk to do this trick + ver="$(awk '{ match($0, /([.0-9]+)/, a); print substr($0, a[1, "start"], a[1, "length"]); }' \ + /etc/redhat-release)" [[ -z "${ver}" && -f /etc/SuSE-release ]] && ver="$(awk '/VERSION/ { print $NF }' /etc/SuSE-release)" echo "${ver}" @@ -636,7 +638,29 @@ function download_file() type wget >/dev/null 2>&1 || return 255 local url="$1" local local_file="$2" - wget -U "${user_agent}" -q "${url}" -O "${local_file}" + local log_file="${TMP_DIR}/wget.log.${RANDOM}" + local -i rc=0 + wget -U "${user_agent}" -nv "${url}" -O "${local_file}" -o "${log_file}" + rc="$?" + if [[ "${rc}" -ne "0" ]] + then + while read -r ; do echo "${REPLY}" ; done <"${log_file}" + echo -n "${script}: \`wget' exited with an error: (exit code ${rc}, " + case "${rc}" in + 1) echo -n "generic error" ;; + 2) echo -n "parse error" ;; + 3) echo -n "file I/O error" ;; + 4) echo -n "network failure" ;; + 5) echo -n "SSL verification failure" ;; + 6) echo -n "username/password authentication failure" ;; + 7) echo -n "protocol errors" ;; + 8) echo -n "server issued an error response" ;; + *) echo -n "unknown error" ;; + esac + echo ")" + echo " ... while downloading \`${url}'" + fi >&2 + [[ "${rc}" -eq "0" ]] } # $1 repo file diff --git a/xCAT-test/autotest/bundle/rhels6.9_ppc64.bundle b/xCAT-test/autotest/bundle/rhels6.9_ppc64.bundle new file mode 100644 index 000000000..7b9705878 --- /dev/null +++ b/xCAT-test/autotest/bundle/rhels6.9_ppc64.bundle @@ -0,0 +1,320 @@ +reg_linux_diskfull_installation_flat +go_xcat_local_repo_case7 +go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 +updatenode_h +updatenode_v +updatenode_diskful_syncfiles +updatenode_diskful_syncfiles_rename +updatenode_diskful_syncfiles_dir +updatenode_diskful_syncfiles_multi_files +updatenode_syncfile_EXECUTE +updatenode_syncfile_EXECUTEALWAYS +updatenode_syncfile_APPEND +updatenode_syncfile_MERGE +updatenode_P_script1 +updatenode_P_script2 +updatenode_f_incompatible_flags +updatenode_k_incompatible_flags +updatenode_diskful_syncfiles_P_script1 +updatenode_script3 +updatenode_P_script1_script2 +updatenode_without_flag +chdef_null +chdef_t_node +chdef_t_network +chdef_p +chdef_m +chdef_z +chdef_group +chdef_group_p +chdef_dynamic_group +chdef_multiple_keys +chdef_n +chdef_t_o_error +chtab_null +chtab_d +chtab_modify_node +chtab_modify_key +chtab_h +chtab_v +copycds_iso +copycds_n +copycds_a +copycds_n_a +copycds_a_err +copycds_n_err +packimage_o_p_a_m +packimage_imagename +packimage_h +packimage_v +pping_h +pping_v +pping_node +getmacs_noderange +getmacs_d +getmacs_f_D +gettab_key_table +gettab_H +gettab_err +gettab_h +lsdef_null +lsdef_a +lsdef_t_o_l +lsdef_t_o_l_z +lsdef_t +lsdef_t_i_o +lsdef_t_w +lsdef_t_err +lslite_i +lslite_noderange +lslite_h +makeconservercf_null +makeconservercf_noderange +makeconservercf_d +makedhcp_n +makedhcp_a +makedhcp_a_d +makedhcp_d +mkdef_null +mkdef_z +mkdef_t_o_error +nodeadd_noderange +nodeadd_err_symbol +nodeadd_null +nodeadd_noderange_nodetype +nodeadd_v +nodeadd_h +nodegrpch_v +nodegrpch_h +nodegrpch_groups +nodegrpch_err +nodech_noderange_table +nodech_noderange_table_comma +nodech_noderange_table_arrow +nodech_noderanage_table_at +nodech_delete +nodech_error_node +nodech_error_table +nodech_h +nodech_v +nodech_noderange_table_include +nodech_noderange_table_uninclude +nodech_noderange_table_equal +nodech_noderange_table_unequal +nodech_noderange_shortname_groups +nodech_noderange_shortname_tags +nodech_noderange_shortname_mgt +nodels_null +nodels_H +nodels_noderange +nodels_err_symbol +nodels_err_noderange +nodels_noderange_shortname_groups +nodels_noderange_shortname_tags +nodels_noderange_shortname_mgt +nodels_table_include +nodels_noderange_table_uninclude +nodels_noderange_table_equal +nodels_noderange_table_unequal +nodels_b +nodels_S +nodels_noderange_table +nodels_tablevalue +nodels_tablevalue_tablecolumn +nodels_noderange_tablecolumn +nodels_h +nodels_v +xcatstanzafile_normal +xcatstanzafile_colon +xcatstanzafile_attribute +xcatstanzafile_objtype +xcatstanzafile_tab +xcatstanzafile_multattr +xcatstanzafile_defaultvalue +xcatstanzafile_specificvalue +noderm_noderange +noderm_h +noderm_null +noderm_err_node +nodeset_stat +nodeset_noderange +nodestat_err_node +rinv_bus +rinv_config +rinv_serial +rinv_model +rinv_firm +rinv_all +rinv_noderange_err +rmdef_null +rmdef_t_err +rpower_off +rpower_stat +rpower_boot +rpower_on +rpower_reset +rpower_noderange +rpower_noderange_nodeps +rpower_err_noderange +rscan_noderange +rscan_x +rscan_z +rscan_w +rscan_x_w +rscan_z_w +rvitals_lcds +rvitals_all +rvitals_noderange_err +tabdump_table +tabdump_d +tabdump_v +tabdump_h +tabdump_help +tabdump_w_match +tabdump_w_equal +tabdump_w_ne +tabdump_w_notmatch +tabdump_w_gt +tabdump_w_ge +tabdump_w_lt +tabdump_w_le +tabdump_f_d +tabdump_d_nodehm +tabprune_h +tabprune_v +tabprune_a_eventlog +tabprune_V_a_eventlog +tabprune_p_auditlog +tabprune_i_auditlog +tabprune_V_n_auditlog +tabgrep_node +tabgrep_null +tabgrep_h +tabgrep_err +tabrestore_table +tabrestore_null +tabrestore_h +tabrestore_err +dumpxCATdb_h +dumpxCATdb_v +dumpxCATdb_p_nullskiptables +dumpxCATdb_a_p_nullskiptables +dumpxCATdb_p_skiptables +dumpxCATdb_a_p_skiptables +dumpxCATdb_p_nullskiptables_V +dumpxCATdb_a_p_nullskiptables_V +dumpxCATdb_p_V +restorexCAT_h +restorexCATdb_v +restorexCATdb_p_V +restorexCATdb_a_p_V +restorexCATdb_wrongpath +regnotif_null +regnotif_o +regnotif_err +regnotif_h +regnotif_v +unregnotif_null +unregnotif_f +unregnotif_h +unregnotif_v +lsxcatd_null +lsxcatd_h +lsxcatd_d +lsxcatd_a +makehosts_h +makehosts_help +makehosts_null +makehosts_l +makehosts_d +makehosts_n +makehosts_n_noderange +makehost_n_r +xdcp_src_dst +makedns_h +makedns_d_node +makedns_n +makedns +noderange_individual_node +noderange_individual_grp +noderange_node01-node10 +noderange_group1-group3 +noderange_10-20 +noderange_XCAT_NODE_PREFIX +noderange_XCAT_NODE_SUFFIX +noderange_exclusion +noderange_group_intersection +confignics_config_one_port_single_value +confignics_config_multiple_ports_single_value +confignics_config_multiple_ports_multiple_value +confignics_config_multiple_port_withnichostnamesuffixes_multiple_value +confignics_config_multiple_port_withnicaliases_multiple_value +confignics_disable_set_to_yes +confignics_disable_set_to_1 +xdsh_h +xdsh_V +xdsh_regular_command +xdsh_Q_command +xdsh_c_cn +xdsh_e_filename +xdsh_E +xdsh_t +xdsh_q +xdsh_T +xdsh_o +psh_h +psh_v +psh_node_cmd_linux +psh_l +psh_i +prsync_h +prsync_v +prsync_dir_node +prsync_file_node +switchdiscover_range_default +switchdiscover_h +switchdiscover_range_s +switchdiscover_range_default_w +switchdiscover_range_r +switchdiscover_range_x +switchdiscover_range_z +switchdiscover_range_z_V +makentp_v +makentp_h +nodeset_check_warninginfo +runcmdinstaller_h +runcmdinstaller_command +get_xcat_postscripts_loginfo +updatenode_postscripts_loginfo +bmcdiscover_h +bmcdiscover_nmap_range +bmcdiscover_v +bmcdiscover_check_paswd +bmcdiscover_check_passwd_wrong +bmcdiscover_get_ipsource +bmcdiscover_range_w +bmcdiscover_range_z +xcatd_start +xcatd_stop +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 +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method +reg_linux_statelite_installation_flat +SN_setup_case +reg_linux_diskfull_installation_hierarchy +reg_linux_diskless_installation_hierarchy +reg_linux_statelite_installation_hierarchy_by_ramdisk +reg_linux_statelite_installation_hierarchy_by_nfs +clean_up_env diff --git a/xCAT-test/autotest/bundle/rhels6.9_x86_64.bundle b/xCAT-test/autotest/bundle/rhels6.9_x86_64.bundle new file mode 100644 index 000000000..9e922a688 --- /dev/null +++ b/xCAT-test/autotest/bundle/rhels6.9_x86_64.bundle @@ -0,0 +1,231 @@ +setup_vm +reg_linux_diskfull_installation_flat +go_xcat_local_repo_case7 +go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 +makehosts_h +makehosts_help +makehosts_n +makehosts_n_noderange +makehost_n_r +chdef_null +chdef_z +chdef_t_o_error +chtab_null +chtab_d +chtab_modify_node +chtab_modify_key +chtab_h +chtab_v +packimage_o_p_a_m +packimage_imagename +packimage_h +packimage_v +pping_h +pping_v +pping_node +gettab_key_table +gettab_H +gettab_err +gettab_h +lsdef_null +lsdef_a +lsdef_t_o_l +lsdef_t_o_l_z +lsdef_t +lsdef_t_i_o +lsdef_t_w +lsdef_t_err +lslite_i +lslite_noderange +lslite_h +makeconservercf_null +makeconservercf_noderange +makeconservercf_d +makedhcp_n +makedhcp_a +makedhcp_a_d +makedhcp_d +mkdef_null +mkdef_z +mkdef_t_o_error +nodeadd_noderange +nodeadd_err_symbol +nodeadd_null +nodeadd_noderange_nodetype +nodeadd_v +nodeadd_h +nodegrpch_v +nodegrpch_h +nodegrpch_groups +nodegrpch_err +nodech_noderange_table +nodech_noderange_table_comma +nodech_noderange_table_arrow +nodech_noderanage_table_at +nodech_delete +nodech_error_node +nodech_error_table +nodech_h +nodech_v +nodech_noderange_table_include +nodech_noderange_table_uninclude +nodech_noderange_table_equal +nodech_noderange_table_unequal +nodech_noderange_shortname_groups +nodech_noderange_shortname_tags +nodech_noderange_shortname_mgt +nodels_null +nodels_H +nodels_noderange +nodels_err_symbol +nodels_err_noderange +nodels_noderange_shortname_groups +nodels_noderange_shortname_tags +nodels_noderange_shortname_mgt +nodels_table_include +nodels_noderange_table_uninclude +nodels_noderange_table_equal +nodels_noderange_table_unequal +nodels_b +nodels_S +nodels_noderange_table +nodels_tablevalue +nodels_tablevalue_tablecolumn +nodels_noderange_tablecolumn +nodels_h +nodels_v +xcatstanzafile_normal +xcatstanzafile_colon +xcatstanzafile_attribute +xcatstanzafile_objtype +xcatstanzafile_tab +xcatstanzafile_multattr +xcatstanzafile_defaultvalue +xcatstanzafile_specificvalue +noderm_noderange +noderm_h +noderm_null +noderm_err_node +nodeset_stat +nodeset_noderange +nodestat_noderange +nodestat_err_node +rinv_noderange_err +rmdef_null +rmdef_t_err +rpower_err_noderange +rvitals_noderange_err +tabdump_table +tabdump_d +tabdump_v +tabdump_h +tabdump_help +tabdump_w_match +tabdump_w_equal +tabdump_w_ne +tabdump_w_notmatch +tabdump_w_gt +tabdump_w_ge +tabdump_w_lt +tabdump_w_le +tabdump_f_d +tabdump_d_nodehm +tabprune_h +tabprune_v +tabprune_a_eventlog +tabprune_V_a_eventlog +tabprune_i_auditlog +tabprune_V_n_auditlog +tabgrep_node +tabgrep_null +tabgrep_h +tabgrep_err +tabrestore_table +tabrestore_null +tabrestore_h +tabrestore_err +dumpxCATdb_h +dumpxCATdb_v +dumpxCATdb_p_nullskiptables +dumpxCATdb_a_p_nullskiptables +dumpxCATdb_p_skiptables +dumpxCATdb_a_p_skiptables +dumpxCATdb_p_nullskiptables_V +dumpxCATdb_a_p_nullskiptables_V +dumpxCATdb_p_V +restorexCAT_h +restorexCATdb_v +restorexCATdb_p_V +restorexCATdb_a_p_V +restorexCATdb_wrongpath +regnotif_null +regnotif_o +regnotif_err +regnotif_h +regnotif_v +unregnotif_null +unregnotif_f +unregnotif_h +unregnotif_v +lsxcatd_null +lsxcatd_h +lsxcatd_d +lsxcatd_a +makedns_d_node +makedns_n +makedns +copycds_iso +copycds_n +copycds_a +copycds_n_a +xdsh_h +xdsh_V +xdsh_regular_command +xdsh_Q_command +xdsh_c_cn +xdsh_e_filename +xdsh_E +xdsh_i_linux +xdsh_t +xdsh_q +xdsh_T +xdsh_o +psh_h +psh_v +psh_node_cmd_linux +psh_l +psh_i +prsync_h +prsync_v +prsync_dir_node +prsync_file_node +switchdiscover_range_default +switchdiscover_h +switchdiscover_range_s +switchdiscover_range_default_w +switchdiscover_range_r +switchdiscover_range_x +switchdiscover_range_z +switchdiscover_range_z_V +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 +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method +reg_linux_statelite_installation_flat +SN_setup_case +reg_linux_diskfull_installation_hierarchy +reg_linux_diskless_installation_hierarchy +reg_linux_statelite_installation_hierarchy_by_ramdisk +reg_linux_statelite_installation_hierarchy_by_nfs +clean_up_env diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle index 3d27a17b1..7246a2e12 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle @@ -261,6 +261,7 @@ xdsh_Q_command xdsh_c_cn xdsh_e_filename xdsh_E +xdsh_i_linux xdsh_t xdsh_q xdsh_T @@ -282,6 +283,9 @@ switchdiscover_range_r switchdiscover_range_x switchdiscover_range_z switchdiscover_range_z_V +nodeset_shell +nodeset_cmdline +nodeset_runimg makentp_v makentp_h nodeset_check_warninginfo diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle index 72e0bfe20..179d2109b 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle @@ -6,12 +6,35 @@ go_xcat_noinput go_xcat_with_x go_xcat_with_xcat-version-1 go_xcat_online_repo_case6 -makehosts_h -makehosts_help -makehosts_n -makehosts_n_noderange +updatenode_h +updatenode_v +updatenode_diskful_syncfiles +updatenode_diskful_syncfiles_rename +updatenode_diskful_syncfiles_dir +updatenode_diskful_syncfiles_multi_files +updatenode_syncfile_EXECUTE +updatenode_syncfile_EXECUTEALWAYS +updatenode_syncfile_APPEND +updatenode_syncfile_MERGE +updatenode_P_script1 +updatenode_P_script2 +updatenode_f_incompatible_flags +updatenode_k_incompatible_flags +updatenode_diskful_syncfiles_P_script1 +updatenode_script3 +updatenode_P_script1_script2 +updatenode_without_flag chdef_null +chdef_t_node +chdef_t_network +chdef_p +chdef_m chdef_z +chdef_group +chdef_group_p +chdef_dynamic_group +chdef_multiple_keys +chdef_n chdef_t_o_error chtab_null chtab_d @@ -19,16 +42,16 @@ chtab_modify_node chtab_modify_key chtab_h chtab_v +copycds_iso +copycds_n +copycds_a +copycds_n_a +copycds_a_err +copycds_n_err packimage_o_p_a_m packimage_imagename packimage_h packimage_v -packimage_m_cpio_c_gzip -packimage_m_cpio_c_xz -packimage_m_tar_c_gzip -packimage_m_tar_c_xz -packimage_m_invalid_archive_method -packimage_m_invalid_compress_method pping_h pping_v pping_node @@ -44,6 +67,9 @@ lsdef_t lsdef_t_i_o lsdef_t_w lsdef_t_err +lslite_i +lslite_noderange +lslite_h makeconservercf_null makeconservercf_noderange makeconservercf_d @@ -100,6 +126,7 @@ nodels_tablevalue_tablecolumn nodels_noderange_tablecolumn nodels_h nodels_v +xcatstanzafile_normal xcatstanzafile_colon xcatstanzafile_attribute xcatstanzafile_objtype @@ -117,7 +144,22 @@ nodestat_err_node rinv_noderange_err rmdef_null rmdef_t_err +rpower_off +rpower_stat +rpower_boot +rpower_on +rpower_reset +rpower_noderange +rpower_noderange_nodeps rpower_err_noderange +rscan_noderange +rscan_x +rscan_z +rscan_w +rscan_x_w +rscan_z_w +rvitals_lcds +rvitals_all rvitals_noderange_err tabdump_table tabdump_d @@ -138,6 +180,7 @@ tabprune_h tabprune_v tabprune_a_eventlog tabprune_V_a_eventlog +tabprune_p_auditlog tabprune_i_auditlog tabprune_V_n_auditlog tabgrep_node @@ -175,13 +218,35 @@ lsxcatd_null lsxcatd_h lsxcatd_d lsxcatd_a +makehosts_h +makehosts_help +makehosts_null +makehosts_l +makehosts_d +makehosts_n +makehosts_n_noderange +xdcp_src_dst +makedns_h makedns_d_node makedns_n makedns -copycds_iso -copycds_n -copycds_a -copycds_n_a +noderange_individual_node +noderange_individual_grp +noderange_node01-node10 +noderange_group1-group3 +noderange_10-20 +noderange_XCAT_NODE_PREFIX +noderange_XCAT_NODE_SUFFIX +noderange_exclusion +noderange_group_intersection +confignics_config_one_port_single_value +confignics_config_multiple_ports_single_value +confignics_config_multiple_ports_multiple_value +confignics_config_multiple_port_withnichostnamesuffixes_multiple_value +confignics_config_multiple_port_withnicaliases_multiple_value +confignics_disable_set_to_yes +confignics_disable_set_to_1 +confignics_s xdsh_h xdsh_V xdsh_regular_command @@ -214,13 +279,40 @@ switchdiscover_range_z_V nodeset_shell nodeset_cmdline nodeset_runimg -redhat_migration1 -redhat_migration2 +makentp_v +makentp_h +nodeset_check_warninginfo +runcmdinstaller_h +runcmdinstaller_command +get_xcat_postscripts_loginfo +updatenode_postscripts_loginfo +bmcdiscover_h +bmcdiscover_nmap_range +bmcdiscover_v +bmcdiscover_check_paswd +bmcdiscover_check_passwd_wrong +bmcdiscover_get_ipsource +bmcdiscover_range_w +bmcdiscover_range_z +xcatd_start +xcatd_stop +xcatd_restart +run_command_with_XCATBYPASS +disable_root_permission_in_policy_table +assign_certain_command_permission xcatconfig_u_check_xcatsslversion_rhels_sles +packimage_m_cpio_c_gzip +packimage_m_cpio_c_xz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method reg_linux_statelite_installation_flat SN_setup_case reg_linux_diskfull_installation_hierarchy reg_linux_diskless_installation_hierarchy reg_linux_statelite_installation_hierarchy_by_ramdisk reg_linux_statelite_installation_hierarchy_by_nfs +redhat_migration1 +redhat_migration2 clean_up_env diff --git a/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle b/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle index 3d27a17b1..94715c5b2 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle @@ -40,10 +40,7 @@ chtab_modify_node chtab_modify_key chtab_h chtab_v -copycds_iso copycds_n -copycds_a -copycds_n_a copycds_a_err copycds_n_err packimage_o_p_a_m @@ -225,13 +222,14 @@ lsxcatd_null lsxcatd_h lsxcatd_d lsxcatd_a -makehosts_h makehosts_help +makehosts_n_noderange +makehosts_h makehosts_null makehosts_l makehosts_d makehosts_n -makehosts_n_noderange +makehost_n_r xdcp_src_dst makedns_h makedns_d_node @@ -253,7 +251,9 @@ confignics_config_multiple_port_withnichostnamesuffixes_multiple_value confignics_config_multiple_port_withnicaliases_multiple_value confignics_disable_set_to_yes confignics_disable_set_to_1 -confignics_s +copycds_iso +copycds_a +copycds_n_a xdsh_h xdsh_V xdsh_regular_command @@ -261,6 +261,7 @@ xdsh_Q_command xdsh_c_cn xdsh_e_filename xdsh_E +xdsh_i_linux xdsh_t xdsh_q xdsh_T diff --git a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle index 1b3103b19..76a9799df 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle @@ -6,12 +6,35 @@ go_xcat_noinput go_xcat_with_x go_xcat_with_xcat-version-1 go_xcat_online_repo_case6 -makehosts_h -makehosts_help -makehosts_n -makehosts_n_noderange +updatenode_h +updatenode_v +updatenode_diskful_syncfiles +updatenode_diskful_syncfiles_rename +updatenode_diskful_syncfiles_dir +updatenode_diskful_syncfiles_multi_files +updatenode_syncfile_EXECUTE +updatenode_syncfile_EXECUTEALWAYS +updatenode_syncfile_APPEND +updatenode_syncfile_MERGE +updatenode_P_script1 +updatenode_P_script2 +updatenode_f_incompatible_flags +updatenode_k_incompatible_flags +updatenode_diskful_syncfiles_P_script1 +updatenode_script3 +updatenode_P_script1_script2 +updatenode_without_flag chdef_null +chdef_t_node +chdef_t_network +chdef_p +chdef_m chdef_z +chdef_group +chdef_group_p +chdef_dynamic_group +chdef_multiple_keys +chdef_n chdef_t_o_error chtab_null chtab_d @@ -19,16 +42,16 @@ chtab_modify_node chtab_modify_key chtab_h chtab_v +copycds_iso +copycds_n +copycds_a +copycds_n_a +copycds_a_err +copycds_n_err packimage_o_p_a_m packimage_imagename packimage_h packimage_v -packimage_m_cpio_c_gzip -packimage_m_cpio_c_xz -packimage_m_tar_c_gzip -packimage_m_tar_c_xz -packimage_m_invalid_archive_method -packimage_m_invalid_compress_method pping_h pping_v pping_node @@ -44,6 +67,9 @@ lsdef_t lsdef_t_i_o lsdef_t_w lsdef_t_err +lslite_i +lslite_noderange +lslite_h makeconservercf_null makeconservercf_noderange makeconservercf_d @@ -100,6 +126,7 @@ nodels_tablevalue_tablecolumn nodels_noderange_tablecolumn nodels_h nodels_v +xcatstanzafile_normal xcatstanzafile_colon xcatstanzafile_attribute xcatstanzafile_objtype @@ -117,6 +144,13 @@ nodestat_err_node rinv_noderange_err rmdef_null rmdef_t_err +rpower_off +rpower_stat +rpower_boot +rpower_on +rpower_reset +rpower_noderange +rpower_noderange_nodeps rpower_err_noderange rvitals_noderange_err tabdump_table @@ -138,6 +172,7 @@ tabprune_h tabprune_v tabprune_a_eventlog tabprune_V_a_eventlog +tabprune_p_auditlog tabprune_i_auditlog tabprune_V_n_auditlog tabgrep_node @@ -175,13 +210,35 @@ lsxcatd_null lsxcatd_h lsxcatd_d lsxcatd_a +makehosts_h +makehosts_help +makehosts_null +makehosts_l +makehosts_d +makehosts_n +makehosts_n_noderange +makehost_n_r +xdcp_src_dst +makedns_h makedns_d_node makedns_n makedns -copycds_iso -copycds_n -copycds_a -copycds_n_a +noderange_individual_node +noderange_individual_grp +noderange_node01-node10 +noderange_group1-group3 +noderange_10-20 +noderange_XCAT_NODE_PREFIX +noderange_XCAT_NODE_SUFFIX +noderange_exclusion +noderange_group_intersection +confignics_config_one_port_single_value +confignics_config_multiple_ports_single_value +confignics_config_multiple_ports_multiple_value +confignics_config_multiple_port_withnichostnamesuffixes_multiple_value +confignics_config_multiple_port_withnicaliases_multiple_value +confignics_disable_set_to_yes +confignics_disable_set_to_1 xdsh_h xdsh_V xdsh_regular_command @@ -214,7 +271,34 @@ switchdiscover_range_z_V nodeset_shell nodeset_cmdline nodeset_runimg +makentp_v +makentp_h +nodeset_check_warninginfo +runcmdinstaller_h +runcmdinstaller_command +get_xcat_postscripts_loginfo +updatenode_postscripts_loginfo +bmcdiscover_h +bmcdiscover_nmap_range +bmcdiscover_v +bmcdiscover_check_paswd +bmcdiscover_check_passwd_wrong +bmcdiscover_get_ipsource +bmcdiscover_range_w +bmcdiscover_range_z +xcatd_start +xcatd_stop +xcatd_restart +run_command_with_XCATBYPASS +disable_root_permission_in_policy_table +assign_certain_command_permission xcatconfig_u_check_xcatsslversion_rhels_sles +packimage_m_cpio_c_gzip +packimage_m_cpio_c_xz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method 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 497756717..53b49e38d 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle @@ -9,6 +9,7 @@ makehosts_h makehosts_help makehosts_n makehosts_n_noderange +makehost_n_r chdef_null chdef_z chdef_t_o_error diff --git a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle index 66b390c1d..a6a025161 100644 --- a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle @@ -214,6 +214,7 @@ makehosts_l makehosts_d makehosts_n makehosts_n_noderange +makehost_n_r xdcp_src_dst makedns_h makedns_d_node @@ -235,7 +236,6 @@ confignics_config_multiple_port_withnichostnamesuffixes_multiple_value confignics_config_multiple_port_withnicaliases_multiple_value confignics_disable_set_to_yes confignics_disable_set_to_1 -confignics_s xdsh_h xdsh_V xdsh_regular_command diff --git a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle index 620a1d9a4..1515dd3a5 100644 --- a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle @@ -9,6 +9,7 @@ makehosts_h makehosts_help makehosts_n makehosts_n_noderange +makehost_n_r chdef_null chdef_z chdef_t_o_error diff --git a/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle index 65ff91ea2..13d930b24 100644 --- a/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle @@ -10,6 +10,7 @@ makehosts_h makehosts_help makehosts_n makehosts_n_noderange +makehost_n_r chdef_null chdef_z chdef_t_o_error diff --git a/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle b/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle index 4003012a6..78877bdbd 100644 --- a/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle @@ -9,6 +9,7 @@ makehosts_h makehosts_help makehosts_n makehosts_n_noderange +makehost_n_r chdef_null chdef_z chdef_t_o_error diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle index be6932c9d..f258d566c 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle @@ -9,6 +9,7 @@ makehosts_h makehosts_help makehosts_n_noderange makehosts_n +makehost_n_r chdef_null chdef_z chdef_t_o_error 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 72d300f72..b45a72056 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -9,6 +9,7 @@ makehosts_h makehosts_help makehosts_n_noderange makehosts_n +makehost_n_r chdef_null chdef_z chdef_t_o_error diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle index 74df70cbe..212853add 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle @@ -9,6 +9,7 @@ makehosts_h makehosts_help makehosts_n_noderange makehosts_n +makehost_n_r chdef_null chdef_z chdef_t_o_error 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 51decc528..9b377bcca 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle @@ -9,6 +9,7 @@ makehosts_h makehosts_help makehosts_n_noderange makehosts_n +makehost_n_r chdef_null chdef_z chdef_t_o_error diff --git a/xCAT-test/autotest/linux.conf.template b/xCAT-test/autotest/linux.conf.template index ecb158ad5..e54bf8c9b 100644 --- a/xCAT-test/autotest/linux.conf.template +++ b/xCAT-test/autotest/linux.conf.template @@ -115,6 +115,11 @@ bmcusername=USERID bmcpasswd=PASSW0RD #For bmc case u need to set username and passwd first #End +#For pdu support +PDU=f5pdu3 +PDUIP=50.0.0.8 +PORT=6 +#End [Custom] #commands run before test diff --git a/xCAT-test/autotest/testcase/confignics/cases0 b/xCAT-test/autotest/testcase/confignics/cases0 index c63a8ad8f..4ff07aeba 100644 --- a/xCAT-test/autotest/testcase/confignics/cases0 +++ b/xCAT-test/autotest/testcase/confignics/cases0 @@ -1,6 +1,8 @@ start:confignics_config_one_port_single_value description:confignics -cmd:mkdef -t network -o 100_1_0_0-255_255_0_0 net=100.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi +check:rc==0 +cmd:mkdef -t network -o 100_1_0_0-255_255_0_0 net=100.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1501 check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=100.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=100_1_0_0-255_255_0_0 check:rc==0 @@ -8,16 +10,20 @@ cmd:updatenode $$CN -P confignics check:rc==0 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi check:output=~100.1.0.100 -check:output!~dhcp +check:output=~MTU=1501 cmd:rmdef -t network -o 100_1_0_0-255_255_0_0 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 end start:confignics_config_multiple_ports_single_value description:confignics -cmd:mkdef -t network -o 100_1_0_0-255_255_0_0 net=100.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 -cmd:mkdef -t network -o 200_1_0_0-255_255_0_0 net=200.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +cmd:mkdef -t network -o 100_1_0_0-255_255_0_0 net=100.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1501 +check:rc==0 +cmd:mkdef -t network -o 200_1_0_0-255_255_0_0 net=200.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC mtu=1502 check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=100.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=100_1_0_0-255_255_0_0 check:rc==0 @@ -28,24 +34,30 @@ check:rc==0 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi check:output=~100.1.0.100 check:output!~dhcp +check:output=~MTU=1501 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi check:output=~200.1.0.100 check:output!~dhcp +check:output=~MTU=1502 cmd:rmdef -t network -o 100_1_0_0-255_255_0_0 cmd:rmdef -t network -o 200_1_0_0-255_255_0_0 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 end start:confignics_config_multiple_ports_multiple_value description:confignics -cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 -cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1501 check:rc==0 -cmd:mkdef -t network -o 13_1_0_0-255_255_0_0 net=13.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1501 check:rc==0 -cmd:mkdef -t network -o 14_1_0_0-255_255_0_0 net=14.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +cmd:mkdef -t network -o 13_1_0_0-255_255_0_0 net=13.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC mtu=1503 +check:rc==0 +cmd:mkdef -t network -o 14_1_0_0-255_255_0_0 net=14.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC mtu=1503 check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC="11.1.0.100|12.1.0.100" nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC="11_1_0_0-255_255_0_0|12_1_0_0-255_255_0_0" check:rc==0 @@ -56,12 +68,14 @@ check:rc==0 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi check:output=~11.1.0.100 check:output!~dhcp +check:output=~MTU=1501 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC:1 ; elif [ "$$OS" = "rhels" ]; then xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1;else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi check:output=~12.1.0.100 check:output!~dhcp cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi check:output=~13.1.0.100 check:output!~dhcp +check:output=~MTU=1503 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC:1 ; elif [ "$$OS" = "rhels" ]; then xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC:1;else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi check:output=~14.1.0.100 check:output!~dhcp @@ -73,17 +87,21 @@ cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$ cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC:1; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC:1; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC:1; fi +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 end start:confignics_config_multiple_port_withnichostnamesuffixes_multiple_value description:confignics -cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 -cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1501 check:rc==0 -cmd:mkdef -t network -o 13_1_0_0-255_255_0_0 net=13.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1501 check:rc==0 -cmd:mkdef -t network -o 14_1_0_0-255_255_0_0 net=14.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +cmd:mkdef -t network -o 13_1_0_0-255_255_0_0 net=13.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC mtu=1503 +check:rc==0 +cmd:mkdef -t network -o 14_1_0_0-255_255_0_0 net=14.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC mtu=1503 check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC="11.1.0.100|12.1.0.100" nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC="11_1_0_0-255_255_0_0|12_1_0_0-255_255_0_0" nichostnamesuffixes.$$SECONDNIC="-$$SECONDNIC-1|-$$SECONDNIC-2" check:rc==0 @@ -103,12 +121,14 @@ check:rc==0 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi check:output=~11.1.0.100 check:output!~dhcp +output=~MTU=1501 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC:1 ; elif [ "$$OS" = "rhels" ]; then xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1;else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi check:output=~12.1.0.100 check:output!~dhcp cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi check:output=~13.1.0.100 check:output!~dhcp +output=~MTU=1503 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC:1 ; elif [ "$$OS" = "rhels" ]; then xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC:1;else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi check:output=~14.1.0.100 check:output!~dhcp @@ -121,17 +141,21 @@ cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$S cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC:1; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC:1; fi cmd:cp /etc/hosts.backup /etc/hosts +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 end start:confignics_config_multiple_port_withnicaliases_multiple_value description:confignics -cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 -cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1501 check:rc==0 -cmd:mkdef -t network -o 13_1_0_0-255_255_0_0 net=13.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1501 check:rc==0 -cmd:mkdef -t network -o 14_1_0_0-255_255_0_0 net=14.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +cmd:mkdef -t network -o 13_1_0_0-255_255_0_0 net=13.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC mtu=1503 +check:rc==0 +cmd:mkdef -t network -o 14_1_0_0-255_255_0_0 net=14.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC mtu=1503 check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC="11.1.0.100|12.1.0.100" nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC="11_1_0_0-255_255_0_0|12_1_0_0-255_255_0_0" nicaliases.$$SECONDNIC="aliases1-1|aliases1-2" check:rc==0 @@ -149,12 +173,14 @@ check:rc==0 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi check:output=~11.1.0.100 check:output!~dhcp +output=~MTU=1501 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC:1 ; elif [ "$$OS" = "rhels" ]; then xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1;else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi check:output=~12.1.0.100 check:output!~dhcp cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi check:output=~13.1.0.100 check:output!~dhcp +output=~MTU=1503 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC:1 ; elif [ "$$OS" = "rhels" ]; then xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC:1;else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi check:output=~14.1.0.100 check:output!~dhcp @@ -166,10 +192,14 @@ cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$S cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC:1; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC:1; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC:1; fi +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 end start:confignics_disable_set_to_yes description:confignics +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi +check:rc==0 cmd:xdsh $$CN ifdown $$SECONDNIC cmd:mkdef -t network -o 100_1_0_0-255_255_0_0 net=100.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 @@ -181,14 +211,19 @@ cmd:updatenode $$CN -P confignics check:rc==0 cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC; fi check:output!~100.1.0.100 +output=~MTU=1501 cmd:rmdef -t network -o 100_1_0_0-255_255_0_0 cmd:chtab node=$$CN nics.disable=0 +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 end start:confignics_disable_set_to_1 description:confignics +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi +check:rc==0 cmd:xdsh $$CN ifdown $$SECONDNIC -cmd:mkdef -t network -o 100_1_0_0-255_255_0_0 net=100.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +cmd:mkdef -t network -o 100_1_0_0-255_255_0_0 net=100.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1501 check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=100.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=100_1_0_0-255_255_0_0 check:rc==0 @@ -198,15 +233,34 @@ cmd:updatenode $$CN -P confignics check:rc==0 cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC; fi check:output!~100.1.0.100 +output=~MTU=1501 cmd:rmdef -t network -o 100_1_0_0-255_255_0_0 cmd:chtab node=$$CN nics.disable=0 +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 end + start:confignics_s description:confignics_s +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/confignics/mtu_set_clean S 1501 +check:rc==0 +cmd:tabdump networks > /opt/xcat/share/xcat/tools/autotest/testcase/confignics/networks.csv +check:rc==0 +cmd:cp -f /opt/xcat/share/xcat/tools/autotest/testcase/confignics/networks.csv /opt/xcat/share/xcat/tools/autotest/testcase/confignics/networks.csv.bak +check:rc==0 +cmd:echo "99_1_0_0-255_255_0_0,99.1.0.0,255.255.0.0,,,,,,,,,,,,,,,,test quotes ' in comments," >>/opt/xcat/share/xcat/tools/autotest/testcase/confignics/networks.csv +check:rc==0 +cmd:if [ -e /opt/xcat/share/xcat/tools/autotest/testcase/confignics/networks.csv ]; then tabrestore /opt/xcat/share/xcat/tools/autotest/testcase/confignics/networks.csv; fi +check:rc==0 cmd:updatenode $$CN "confignics -s" check:rc==0 check:output!~invalid -cmd:if cat /etc/*release |grep "Red Hat" >/dev/null;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-eth0 |grep IPADDR=$$NODEIP";elif cat /etc/*release |grep SUSE >/dev/null; then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-eth0 |grep IPADDR=$$NODEIP";fi -cmd:sleep 5 +cmd:if cat /etc/*release |grep "Red Hat" >/dev/null ;then if [[ `xdsh $$CN cat /etc/sysconfig/network-scripts/ifcfg-* ` =~ "IPADDR=$$NODEIP" ]] && [[ `xdsh $$CN cat /etc/sysconfig/network-scripts/ifcfg-* ` =~ "MTU=1501" ]] ; then exit 0 ;else exit 1 ; fi ;elif cat /etc/*release |grep SUSE >/dev/null ; then if [[ `xdsh $$CN cat /etc/sysconfig/network/ifcfg-* ` =~ "IPADDR=$$NODEIP" ]] && [[ `xdsh $$CN cat /etc/sysconfig/network/ifcfg-* ` =~ "MTU=1501" ]] ;then exit 0;else exit 1;fi;fi +check:rc==0 +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/confignics/mtu_set_clean C 1501 +check:rc==0 +cmd:cp -f /opt/xcat/share/xcat/tools/autotest/testcase/confignics/networks.csv.bak /opt/xcat/share/xcat/tools/autotest/testcase/confignics/networks.csv +check:rc==0 +cmd:if [ -e /opt/xcat/share/xcat/tools/autotest/testcase/confignics/networks.csv ]; then tabrestore /opt/xcat/share/xcat/tools/autotest/testcase/confignics/networks.csv; rm -f /opt/xcat/share/xcat/tools/autotest/testcase/confignics/networks.csv*; fi check:rc==0 end diff --git a/xCAT-test/autotest/testcase/confignics/mtu_set_clean b/xCAT-test/autotest/testcase/confignics/mtu_set_clean new file mode 100755 index 000000000..adbc8db69 --- /dev/null +++ b/xCAT-test/autotest/testcase/confignics/mtu_set_clean @@ -0,0 +1,59 @@ +#!/bin/bash +function test_ip() +{ + IP=$1 + VALID_CHECK=$(echo $IP|awk -F. '$1<=255&&$2<=255&&$3<=255&&$4<=255{print "yes"}') + if echo $IP|grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$">/dev/null; then + if [ ${VALID_CHECK:-no} == "yes" ]; then + echo $1; + else + return 1; + fi + else + return 1; + fi + +} +function get_master_ip() +{ + test_ip $1; + if [[ $? -eq 1 ]]; then + rc2=`ping $MASTERIP -c 10`; + if [[ $? -eq 0 ]]; then + MASTERIPN=` ping $MASTERIP -c 1 |grep "64 bytes from" |awk -F'(' '{print $2}'|awk -F')' '{print $1}'`; + echo $MASTERIPN; + else + echo "invalid master value"; + exit 1; + fi + fi + +} +MASTERIP="" +NETWORKNAME="" +MASTERIP=`lsdef -t site -i master -c 2>&1 | awk -F'=' '{print $2}'`; +MASTERIP=$(get_master_ip $MASTERIP); +if [[ `tabdump networks |grep $MASTERIP` = "" ]]; then + makenetworks +fi +NETWORKNAME=`tabdump networks |grep $MASTERIP|awk -F'"' '{print $2}'`; +echo $NETWORKNAME,$MASTERIP; +if [[ $NETWORKNAME = "" ]] || [[ $MASTERIP = "" ]];then + exit 2; +else + if [ $1 = "S" ] ;then + chdef -t network -o $NETWORKNAME mtu=$2 + if [[ $? -eq 0 ]];then + exit 0; + else + exit 1; + fi + else [ $1 = "C" ] + chdef -t network -o $NETWORKNAME mtu=" " + if [[ $? -eq 0 ]];then + exit 0; + else + exit 1; + fi + fi +fi diff --git a/xCAT-test/autotest/testcase/copycds/cases0 b/xCAT-test/autotest/testcase/copycds/cases0 index 77ce810e4..e9d30f81d 100644 --- a/xCAT-test/autotest/testcase/copycds/cases0 +++ b/xCAT-test/autotest/testcase/copycds/cases0 @@ -168,3 +168,29 @@ check:rc==0 check:output=~~Copying media to /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__ end + +start:copycds_p_newdir +os:Linux +cmd:if [ -e /install/newdir ];then mv /install/newdir /install/newdirbak; fi +cmd:copycds $$ISO -p /install/newdir +check:rc==0 +check:output=~Copying media to /install/newdir +check:output=~Media copy operation successful +cmd:ls -l /install/newdir/Packages +check:rc==0 +cmd:rm -rf /install/newdir +cmd:if [ -e /install/newdirbak ];then mv /install/newdirbak /install/newdir; fi +end + +start:copycds_p_noninstalldir +os:Linux +cmd:if [ -e /noninstalldir ];then mv /noninstalldir /noninstaldirbak; fi +cmd:copycds $$ISO -p /noninstalldir +check:rc==0 +check:output=~Warning: copycds: the specified path "/noninstalldir" is not a subdirectory under /install +check:output=~Copying media to /noninstalldir +cmd:ls -l /noninstalldir/Packages +check:rc==0 +cmd:rm -rf /noninstalldir +cmd:if [ -e /noninstalldirbak ];then mv /noninstalldirbak /noninstalldir; fi +end 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 532a4f0d8..95cfd0751 100644 --- a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le @@ -1,6 +1,5 @@ start:Diskless_installation_flat_p8_le os:Linux -stop:yes cmd:copycds $$ISO check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le index 9722176aa..c7d72b166 100644 --- a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le @@ -1,6 +1,5 @@ start:Full_installation_flat_p8_le os:Linux -stop:yes cmd:copycds $$ISO check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/SN_setup_case b/xCAT-test/autotest/testcase/installation/SN_setup_case index 1873a0efd..9ccde6576 100644 --- a/xCAT-test/autotest/testcase/installation/SN_setup_case +++ b/xCAT-test/autotest/testcase/installation/SN_setup_case @@ -1,8 +1,7 @@ start:SN_setup_case os:Linux -stop:yes -cmd:/opt/xcat/share/xcat/tools/autotest/testcase/installation/pre_deploy_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__ +cmd:XCAT_DATABASE=$$XCAT_DATABASE /opt/xcat/share/xcat/tools/autotest/testcase/installation/pre_deploy_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__ check:rc==0 cmd:chtab key=nameservers site.value="" @@ -71,6 +70,9 @@ check:output=~booted cmd:xdsh $$SN date check:rc==0 check:output=~\d\d:\d\d:\d\d +#after bug 2586 is fixed, following 2 lines should be removed. +cmd:if [[ "__GETNODEATTR($$SN,os)__" =~ "sles" ]];then xdsh $$SN service xcatd restart; fi +check:rc==0 cmd:xdsh $$SN "ps -ef |grep xcatd" check:rc==0 check:output=~xcatd: diff --git a/xCAT-test/autotest/testcase/installation/litefile_sles.csv b/xCAT-test/autotest/testcase/installation/litefile_sles.csv index e4a30153b..b3ade0407 100644 --- a/xCAT-test/autotest/testcase/installation/litefile_sles.csv +++ b/xCAT-test/autotest/testcase/installation/litefile_sles.csv @@ -16,3 +16,5 @@ "ALL","/root/.ssh/","tmpfs",, "ALL","/etc/init.d/rc3.d/","tmpfs",, "ALL","/etc/init.d/rc5.d/","tmpfs",, +"ALL","/etc/systemd/system/","tmpfs",, +"ALL","/etc/adjtime","tmpfs",, diff --git a/xCAT-test/autotest/testcase/installation/pre_deploy_sn b/xCAT-test/autotest/testcase/installation/pre_deploy_sn index 4ef510174..ea12ed759 100755 --- a/xCAT-test/autotest/testcase/installation/pre_deploy_sn +++ b/xCAT-test/autotest/testcase/installation/pre_deploy_sn @@ -16,11 +16,24 @@ sub runcmd { } } -$cmd = "XCATMYSQLADMIN_PW=12345 XCATMYSQLROOT_PW=12345 /opt/xcat/bin/mysqlsetup -i -V"; -runcmd("$cmd"); +if ($ENV{XCAT_DATABASE} eq "PostgreSQL") { + $cmd = "XCATPGPW=12345 /opt/xcat/bin/pgsqlsetup -i -V"; + runcmd("$cmd"); -$cmd = "echo \"GRANT ALL on xcatdb.* TO xcatadmin@\'%\' IDENTIFIED BY \'12345\'\;\" | mysql -u root -p12345"; -runcmd("$cmd"); + open(my $fh, '>>', '/var/lib/pgsql/data/pg_hba.conf') or die("failed open file /var/lib/pgsql/data/pg_bha.conf"); + print $fh "host all all 0.0.0.0/0 md5\n"; + print $fh "host all all ::0/0 md5\n"; + close $fh; + + $cmd = "service postgresql restart"; + runcmd("$cmd"); +} else { + $cmd = "XCATMYSQLADMIN_PW=12345 XCATMYSQLROOT_PW=12345 /opt/xcat/bin/mysqlsetup -i -V"; + runcmd("$cmd"); + + $cmd = "echo \"GRANT ALL on xcatdb.* TO xcatadmin@\'%\' IDENTIFIED BY \'12345\'\;\" | mysql -u root -p12345"; + runcmd("$cmd"); +} my $xcatballpath = "/install/post/otherpkgs/$os/$arch/xcat"; $cmd = "mkdir -p $xcatballpath/xcat-core && cp -r /xcat-core/* $xcatballpath/xcat-core && cp -r /xcat-dep $xcatballpath"; 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 89f9d73d8..e740bed52 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -1,8 +1,9 @@ start:reg_linux_diskfull_installation_flat os:Linux -stop:yes cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi +cmd:MINIISO=NUll;if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64le" ]];then mkdir /tmp/iso; mount -o loop $$MINIISO /tmp/iso ; mkdir -p /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot; cp /tmp/iso/install/initrd.gz /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot;umount /tmp/iso; rmdir /tmp/iso; fi +check:rc==0 cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 @@ -13,7 +14,7 @@ check:rc==0 cmd:cat /etc/conserver.cf | grep $$CN check:output=~$$CN cmd:sleep 20 -cmd:if [ "__GETNODEATTR($$CN,arch)__" = "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ]; then getmacs -D $$CN; fi +cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]] && [[ "__GETNODEATTR($$CN,mgt)__" != "ipmi" ]]; then getmacs -D $$CN; fi check:rc==0 cmd:chtab key=extntpservers site.value="" check:rc==0 @@ -30,7 +31,8 @@ cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? check:rc==0 cmd:copycds $$ISO check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,os)__" != "sles12.1" ];then chdef -t node -o $$CN postscripts=setupntp; fi +cmd:if ! ([[ "__GETNODEATTR($$CN,os)__" = "sles12.1" ]] || [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu" && "__GETNODEATTR($$CN,arch)__" = "x86_64" ]]) ; then chdef -t node -o $$CN postscripts=setupntp; fi +check:rc==0 cmd:lsdef -l $$CN check:rc==0 cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute @@ -53,9 +55,12 @@ cmd:xdsh $$CN mount check:rc==0 cmd:sleep 120 #comment for further discussion -#cmd:xdsh $$CN service ntpd status +#cmd:if ! ([[ "__GETNODEATTR($$CN,os)__" = "sles12.1" ]] || [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu" && "__GETNODEATTR($$CN,arch)__" = "x86_64" ]]) ;then xdsh $$CN service ntpd status;fi #check:rc==0 #check:output=~running +cmd:if ! ([[ "__GETNODEATTR($$CN,os)__" = "sles12.1" ]] || [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu" && "__GETNODEATTR($$CN,arch)__" = "x86_64" ]]) ;then chdef -t node -o $$CN -m postscripts="setupntp"; fi +check:rc==0 +cmd:lsdef -l $$CN cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy index 86ac6d80f..09f12aecc 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -1,6 +1,5 @@ start:reg_linux_diskfull_installation_hierarchy os:Linux -stop:yes cmd:chdef -t node -o $$CN servicenode=$$SN monserver=$$SN nfsserver=$$SN tftpserver=$$SN xcatmaster=$$SN check:rc==0 @@ -28,6 +27,8 @@ check:rc==0 cmd:copycds $$ISO check:rc==0 +cmd:updatenode $$CN -f +check:rc==0 cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 check:output=~Provision node\(s\)\: $$CN diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat index 227085f4a..e3864b0bf 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -1,6 +1,5 @@ start:reg_linux_diskless_installation_flat os:Linux -stop:yes cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 @@ -12,7 +11,7 @@ check:rc==0 cmd:cat /etc/conserver.cf | grep $$CN check:output=~$$CN cmd:sleep 20 -cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64" ]]; then getmacs -D $$CN; fi +cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]] && [[ "__GETNODEATTR($$CN,mgt)__" != "ipmi" ]]; then getmacs -D $$CN; fi check:rc==0 cmd:makedhcp -n check:rc==0 @@ -27,11 +26,11 @@ check:rc==0 cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then mv $rootimgdir $rootimgdir.regbak -f;fi check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then if [ ! -d /install/custom/netboot/sles ]; then mkdir -p /install/custom/netboot/sles; fi; elif cat /etc/*release |grep "Red Hat" >/dev/null;then if [ ! -d /install/custom/netboot/rh ]; then mkdir -p /install/custom/netboot/rh; fi;fi +cmd:if cat /etc/*release |grep SUSE >/dev/null;then if [ ! -d /install/custom/netboot/sles ]; then mkdir -p /install/custom/netboot/sles; fi; elif cat /etc/*release |grep "Red Hat" >/dev/null;then if [ ! -d /install/custom/netboot/rh ]; then mkdir -p /install/custom/netboot/rh; fi; elif cat /etc/*release |grep "Ubuntu" >/dev/null;then if [ ! -d /install/custom/netboot/ubuntu ]; then mkdir -p /install/custom/netboot/ubuntu; fi; fi check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then if [ ! -e /install/custom/netboot/sles/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/sles/compute.synclist; fi; elif cat /etc/*release |grep "Red Hat" >/dev/null;then if [ ! -e /install/custom/netboot/rh/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/rh/compute.synclist; fi;fi +cmd:if cat /etc/*release |grep SUSE >/dev/null;then if [ ! -e /install/custom/netboot/sles/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/sles/compute.synclist; fi; elif cat /etc/*release |grep "Red Hat" >/dev/null;then if [ ! -e /install/custom/netboot/rh/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/rh/compute.synclist; fi; elif cat /etc/*release |grep "Ubuntu" >/dev/null;then if [ ! -e /install/custom/netboot/ubuntu/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/ubuntu/compute.synclist;fi; fi check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/install/custom/netboot/sles/compute.synclist; elif cat /etc/*release |grep "Red Hat" >/dev/null;then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/install/custom/netboot/rh/compute.synclist;fi +cmd:if cat /etc/*release |grep SUSE >/dev/null;then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/install/custom/netboot/sles/compute.synclist; elif cat /etc/*release |grep "Red Hat" >/dev/null;then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/install/custom/netboot/rh/compute.synclist;elif cat /etc/*release |grep "Ubuntu" >/dev/null; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/install/custom/netboot/ubuntu/compute.synclist;fi check:rc==0 cmd:if [ ! -d /tmp/mountoutput ]; then mkdir -p /tmp/mountoutput; fi diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy index 83d12c37a..187640357 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -1,6 +1,5 @@ start:reg_linux_diskless_installation_hierarchy os:Linux -stop:yes cmd:chdef -t node -o $$CN servicenode=$$SN monserver=$$SN nfsserver=$$SN tftpserver=$$SN xcatmaster=$$SN check:rc==0 @@ -37,7 +36,8 @@ cmd:if cat /etc/*release |grep SUSE >/dev/null;then if [ ! -e /install/custom/ne check:rc==0 cmd:if cat /etc/*release |grep SUSE >/dev/null;then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/install/custom/netboot/sles/compute.synclist; elif cat /etc/*release |grep "Red Hat" >/dev/null;then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/install/custom/netboot/rh/compute.synclist;fi check:rc==0 - +cmd:updatenode $$CN -f +check:rc==0 cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat index e36a65826..fe31a9c33 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -1,6 +1,5 @@ start:reg_linux_statelite_installation_flat os:Linux -stop:yes cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 diff --git a/xCAT-test/autotest/testcase/makehosts/cases0 b/xCAT-test/autotest/testcase/makehosts/cases0 index 9ec2032ac..f2671d6bf 100644 --- a/xCAT-test/autotest/testcase/makehosts/cases0 +++ b/xCAT-test/autotest/testcase/makehosts/cases0 @@ -14,7 +14,7 @@ end start:makehosts_null description:makehosts -cmd:cp -f /etc/hosts /etc/hosts.xcatbak +cmd:cp -f /etc/hosts /etc/hosts.xcatbakautotest cmd:chtab node=compute hosts.ip="|node(\d+)|1.2.3.(\$1+0)|" hosts.hostnames="|(.*)|(\$1).cluster.net|" check:rc==0 cmd:mkdef -t node -o node01,node02 groups="compute" @@ -31,11 +31,11 @@ check:output=~node02 cmd:chtab -d node=compute hosts cmd:rmdef node01 cmd:rmdef node02 -cmd:mv -f /etc/hosts.xcatbak /etc/hosts +cmd:mv -f /etc/hosts.xcatbakautotest /etc/hosts end start:makehosts_l -cmd:cp -f /etc/hosts /etc/hosts.xcatbak +cmd:cp -f /etc/hosts /etc/hosts.xcatbakautotest cmd:chtab node=compute hosts.ip="|node(\d+)|1.2.3.(\$1+0)|" hosts.hostnames="|(.*)|(\$1).cluster.net|" check:rc==0 cmd:chdef -t node -o node01,node02 groups="compute" @@ -51,12 +51,12 @@ check:output=~node02.cluster.net cmd:chtab -d node=compute hosts cmd:rmdef node01 cmd:rmdef node02 -cmd:mv -f /etc/hosts.xcatbak /etc/hosts +cmd:mv -f /etc/hosts.xcatbakautotest /etc/hosts cmd:rm -rf /tmp/hosts end start:makehosts_d -cmd:cp -f /etc/hosts /etc/hosts.xcatbak +cmd:cp -f /etc/hosts /etc/hosts.xcatbakautotest cmd:chtab node=compute hosts.ip="|node(\d+)|1.2.3.(\$1+0)|" hosts.hostnames="|(.*)|(\$1).cluster.net|" check:rc==0 cmd:chdef -t node -o node01 groups="compute" @@ -73,12 +73,12 @@ cmd:diff /tmp/1 /tmp/2 check:output=~node01.cluster.net cmd:chtab -d node=compute hosts cmd:rmdef node01 -cmd:mv -f /etc/hosts.xcatbak /etc/hosts +cmd:mv -f /etc/hosts.xcatbakautotest /etc/hosts cmd:rm -f /tmp/1 /tmp/2 end start:makehosts_n -cmd:cp -f /etc/hosts /etc/hosts.xcatbak +cmd:cp -f /etc/hosts /etc/hosts.xcatbakautotest cmd:chtab node=compute hosts.ip="|node(\d+)|1.2.3.(\$1+0)|" hosts.hostnames="|(.*)|(\$1).cluster.net|" check:rc==0 cmd:chdef -t node -o node01 groups="compute" @@ -97,12 +97,12 @@ check:output=~node01.cluster.net cmd:chtab -d node=compute hosts cmd:rmdef node01 cmd:cp /etc/hosts /hosts -cmd:mv -f /etc/hosts.xcatbak /etc/hosts +cmd:mv -f /etc/hosts.xcatbakautotest /etc/hosts cmd:rm -rf /tmp/hosts end start:makehosts_n_noderange -cmd:cp -f /etc/hosts /etc/hosts.xcatbak +cmd:cp -f /etc/hosts /etc/hosts.xcatbakautotest cmd:chtab node=compute hosts.ip="|node(\d+)|1.2.3.(\$1+0)|" hosts.hostnames="|(.*)|(\$1).cluster.net|" check:rc==0 cmd:chdef -t node -o node01 groups="compute" @@ -119,10 +119,52 @@ cmd:cat /tmp/hosts check:output=~node01.cluster.net cmd:chtab -d node=compute hosts cmd:rmdef node01 -cmd:mv -f /etc/hosts.xcatbak /etc/hosts +cmd:mv -f /etc/hosts.xcatbakautotest /etc/hosts cmd:cat /etc/hosts| grep -v node01 > /tmp/1 cmd:mv -f /tmp/1 /etc/hosts cmd:rm -rf /tmp/hosts end +start:makehost_n_r +descriptions:modify makehosts testcases according to special node name eg:s01 and s01r* . for issue #2717 and #2683 +cmd:cp -f /etc/hosts /etc/hosts.xcatbakautotest +cmd:lsdef s01;if [ $? -eq 0 ]; then lsdef -l s01 -z >/tmp/s01.standa ;rmdef s01;fi +check:rc==0 +cmd:lsdef s01r1b01;if [ $? -eq 0 ]; then lsdef -l s01r1b01 -z >/tmp/s01r1b01.standa ;rmdef s01r1b01;fi +check:rc==0 +cmd:nodeadd s01 groups=service; chdef s01 ip=70.2.0.254;nodeadd s01r1b01 groups=compute; chdef s01r1b01 ip=80.2.0.254;makehosts +check:rc==0 +cmd:rc1=`cat /etc/hosts | grep "70.2.0.254" | grep s01`;rc2=`cat /etc/hosts | grep "80.2.0.254" | grep s01r1b01`;if [[ $rc1 =~ "70.2.0.254 s01" ]] && [[ $rc2 =~ "80.2.0.254 s01r1b01" ]];then exit 0;else exit 1;fi +check:rc==0 +cmd:makehosts s01 +check:rc==0 +cmd:rc1=`cat /etc/hosts | grep "70.2.0.254" | grep s01`;rc2=`cat /etc/hosts | grep "80.2.0.254" | grep s01r1b01`;if [[ $rc1 =~ "70.2.0.254 s01" ]] && [[ $rc2 =~ "80.2.0.254 s01r1b01" ]];then exit 0;else exit 1;fi +check:rc==0 +cmd:makehosts service +check:rc==0 +cmd:rc1=`cat /etc/hosts | grep "70.2.0.254" | grep s01`;rc2=`cat /etc/hosts | grep "80.2.0.254" | grep s01r1b01`;if [[ $rc1 =~ "70.2.0.254 s01" ]] && [[ $rc2 =~ "80.2.0.254 s01r1b01" ]];then exit 0;else exit 1;fi +check:rc==0 +cmd:makehosts -d s01 +check:rc==0 +cmd:rc1=`cat /etc/hosts | grep "70.2.0.254" | grep s01`;rc2=`cat /etc/hosts | grep "80.2.0.254" | grep s01r1b01`;if [[ $rc1 = "" ]] && [[ $rc2 =~ "80.2.0.254 s01r1b01" ]];then exit 0;else exit 1;fi +check:rc==0 +cmd:makehosts +check:rc==0 +cmd:makehosts -d service +check:rc==0 +cmd:rc1=`cat /etc/hosts | grep "70.2.0.254" | grep s01`;rc2=`cat /etc/hosts | grep "80.2.0.254" | grep s01r1b01`;if [[ $rc1 = "" ]] && [[ $rc2 =~ "80.2.0.254 s01r1b01" ]];then exit 0;else exit 1;fi +check:rc==0 +cmd:makehosts +check:rc==0 +cmd:makehosts -d s01r1b01 +check:rc==0 +cmd:rc1=`cat /etc/hosts | grep "70.2.0.254" | grep s01`;rc2=`cat /etc/hosts | grep "80.2.0.254" | grep s01r1b01`;if [[ $rc1 =~ "70.2.0.254 s01" ]] && [[ $rc2 = "" ]];then exit 0;else exit 1;fi +check:rc==0 +cmd:if [ -e /tmp/s01.standa ]; then rmdef s01; cat /tmp/s01.standa | mkdef -z; rm -rf /tmp/s01.standa; else rmdef s01;fi +check:rc==0 +cmd:if [ -e /tmp/s01r1b01.standa ]; then rmdef s01r1b01; cat /tmp/s01r1b01.standa | mkdef -z; rm -rf /tmp/s01r1b01.standa;else rmdef s01r1b01; fi +check:rc==0 +cmd:mv -f /etc/hosts.xcatbakautotest /etc/hosts +end + diff --git a/xCAT-test/autotest/testcase/mkdef/cases1 b/xCAT-test/autotest/testcase/mkdef/cases1 new file mode 100644 index 000000000..0d77e6e28 --- /dev/null +++ b/xCAT-test/autotest/testcase/mkdef/cases1 @@ -0,0 +1,11 @@ +start:mkdef_github_issue2582 +description:Verify github issue 2582 +cmd:mkdef -t group -o doubletrouble bmc='|\z|-imm|' mgt=ipmi +check:rc==0 +cmd:mkdef mgt02 groups=doubletrouble +check:rc==0 +cmd:lsdef mgt02 -i bmc | grep bmc=mgt02-imm$ +check:rc==0 +cmd:rmdef mgt02 +cmd:rmdef -t group doubletrouble +end diff --git a/xCAT-test/autotest/testcase/nodeset/cases0 b/xCAT-test/autotest/testcase/nodeset/cases0 index 49f2ec47d..3f81504ec 100644 --- a/xCAT-test/autotest/testcase/nodeset/cases0 +++ b/xCAT-test/autotest/testcase/nodeset/cases0 @@ -169,7 +169,7 @@ cmd:mkdef -t node -o testnode1 arch=ppc64el cons=ipmi groups=pbmc mgt=ipmi ip=10 check:rc==0 cmd:nodeset testnode1 osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 -check:output=~Warning: testnode1: petitboot might be invalid +check:output=~Warning: testnode1: petitboot might be invalid|testnode1 could not be resolved cmd:noderm testnode1 end diff --git a/xCAT-test/autotest/testcase/nodeset/cases1 b/xCAT-test/autotest/testcase/nodeset/cases1 new file mode 100644 index 000000000..816f4ee59 --- /dev/null +++ b/xCAT-test/autotest/testcase/nodeset/cases1 @@ -0,0 +1,9 @@ +start:nodeset_addkcmdline +cmd:chdef $$CN addkcmdline=debug +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:find -L /tftpboot -name '*$$CN*' -exec cat {} + | grep debug +check:rc==0 +cmd:chdef $$CN addkcmdline= +end diff --git a/xCAT-test/autotest/testcase/osdeploy/cases0 b/xCAT-test/autotest/testcase/osdeploy/cases0 index bb76c2f3b..e1b366cdc 100644 --- a/xCAT-test/autotest/testcase/osdeploy/cases0 +++ b/xCAT-test/autotest/testcase/osdeploy/cases0 @@ -53,6 +53,12 @@ cmd:cat /tmp/osdeploy.test |grep "Without provision process during rollback time check:rc==0 cmd:rm -rf /tmp/osdeploy.test check:rc==0 +cmd:xcatprobe osdeploy -n $$CN -r 2h5m>> /tmp/osdeploy.test +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep "All nodes provisioned successfully"|grep "OK" +check:rc==0 +cmd:rm -rf /tmp/osdeploy.test +check:rc==0 end start:osdeploy_n_t @@ -68,5 +74,260 @@ check:rc==0 cmd:rm -rf /tmp/osdeploy.test check:rc==0 end +start:osdeploy_n_invalidnode +description: osdeploy -n node invalid +cmd:test=`lsdef test_node`;if [ $test eq 0 ]; then lsdef -l test_node -z >/tmp/node.standa ;rmdef test_node;fi +check:rc==0 +cmd:xcatprobe osdeploy -n test_node +check:rc==1 +check:output~=without node definition +cmd:if [ -e /tmp/node.standa ]; then cat /tmp/node.standa | mkdef -z; rm -rf /tmp/node.standa; fi +check:rc==0 +end +start:osdeploy_n_p_invalid +description:osdeploy -n node -p invalid parameter +cmd:xcatprobe osdeploy -n $$CN -p dsdf +check:rc==1 +check:output~=Usage: +check:output~="'compact': Elapsed time of provision for each node." +check:output~="'phase' : Elapsed time for DHCP, INSTALL, POSTSCRIPTS and POSTBOOTSCRIPTS stages, and time for whole provis" +check:output~="'origin' : Show origin start time of each stage." +end + +start:osdeploy_n_r_invalid +description:osdeploy -n node -r invalid parameter +cmd:xcatprobe osdeploy -n $$CN -r dadf +check:rc==1 +check:output~=Usage: +check:output~="'compact': Elapsed time of provision for each node." +check:output~="'phase' : Elapsed time for DHCP, INSTALL, POSTSCRIPTS and POSTBOOTSCRIPTS stages, and time for whole provis" +check:output~="'origin' : Show origin start time of each stage." +end + +start:osdeploy_n_t_invalid +description:osdeploy -n node -t invalid parameter +cmd:xcatprobe osdeploy -n $$CN -t dadf +check:rc==1 +check:output~=Usage: +check:output~="'compact': Elapsed time of provision for each node." +check:output~="'phase' : Elapsed time for DHCP, INSTALL, POSTSCRIPTS and POSTBOOTSCRIPTS stages, and time for whole provis" +check:output~="'origin' : Show origin start time of each stage." +end + +start:osdeploy_n_p_origin +description: osdeploy -n -p origin node to probe osdeploy +cmd:if [ -e /tmp/osdeploy.test ];then rm -rf /tmp/osdeploy.test*;fi +check:rc==0 +cmd:xcatprobe osdeploy -n $$CN -p origin >> /tmp/osdeploy.test & +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:rpower $$CN boot +check:rc==0 +cmd:sleep 300 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 20;((a++));if [ $a -gt 300 ];then break;fi done +cmd:cat /tmp/osdeploy.test |grep "All nodes provisioned successfully"|grep OK +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep "Start Time for Stage" +check:rc==0 +cmd:cat /tmp/osdeploy.test | awk '{print $4}'|grep RPOWER && cat /tmp/osdeploy.test | awk '{print $6}'|grep DHCP && cat /tmp/osdeploy.test | awk '{print $8}'|grep BOOTLOADER && cat /tmp/osdeploy.test | awk '{print $10}'|grep KERNEL && cat /tmp/osdeploy.test | awk '{print $12}' |grep INITRD && cat /tmp/osdeploy.test | awk '{print $14}' |grep INSTALL && cat /tmp/osdeploy.test | awk '{print $16}' |grep POST && cat /tmp/osdeploy.test | awk '{print $18}' |grep POSTBOOT && cat /tmp/osdeploy.test | awk '{print $20}' |grep COMPLET +check:rc==0 +cmd:cat /tmp/osdeploy.t |grep $$CN |awk '{print $4}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |awk '{print $4}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |awk '{print $4}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |awk '{print $4}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |awk '{print $4}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |awk '{print $4}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |awk '{print $4}' |grep -v NULL +check:rc==0 +cmd:rm -rf /tmp/osdeploy.test +check:rc==0 +end +start:osdeploy_n_p_origin_r +description: osdeploy -n node -p origin -r to probe osdeploy +cmd:if [ -e /tmp/osdeploy.test ];then rm -rf /tmp/osdeploy.test*;fi +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:rpower $$CN boot +check:rc==0 +cmd:sleep 300 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 20;((a++));if [ $a -gt 300 ];then break;fi done +cmd:cat /tmp/osdeploy.test |grep "All nodes provisioned successfully"|grep OK +check:rc==0 +cmd:xcatprobe osdeploy -n $$CN -p origin -r 1h >> /tmp/osdeploy.test +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep "Start Time for Stage" +check:rc==0 +cmd:cat /tmp/osdeploy.test | awk '{print $4}'|grep RPOWER && cat /tmp/osdeploy.test | awk '{print $6}'|grep DHCP && cat /tmp/osdeploy.test | awk '{print $8}'|grep BOOTLOADER && cat /tmp/osdeploy.test | awk '{print $10}'|grep KERNEL && cat /tmp/osdeploy.test | awk '{print $12}' |grep INITRD && cat /tmp/osdeploy.test | awk '{print $14}' |grep INSTALL && cat /tmp/osdeploy.test | awk '{print $1 +6}' |grep POST && cat /tmp/osdeploy.test | awk '{print $18}' |grep POSTBOOT && cat /tmp/osdeploy.test | awk '{print $20}' |grep COMPLET +check:rc==0 +cmd:cat /tmp/osdeploy.t |grep $$CN |awk '{print $4}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |awk '{print $4}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |awk '{print $4}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |awk '{print $4}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |awk '{print $4}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |awk '{print $4}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |awk '{print $4}' |grep -v NULL +check:rc==0 +cmd:rm -rf /tmp/osdeploy.test +check:rc==0 +end +start:osdeploy_n_p_origin_r_error +description: osdeploy -n node -p origin -r 1m to probe osdeploy +cmd:if [ -e /tmp/osdeploy.test ];then rm -rf /tmp/osdeploy.test*;fi +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:rpower $$CN boot +check:rc==0 +cmd:sleep 300 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 20;((a++));if [ $a -gt 300 ];then break;fi done +cmd:cat /tmp/osdeploy.test |grep "Without provision process during rollback time window" +check:rc==0 +cmd:xcatprobe osdeploy -n $$CN -p origin -r 1m >> /tmp/osdeploy.test +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep "Without provision process during rollback time window" +check:rc==0 +cmd:cat /tmp/osdeploy.test | awk '{print $4}'|grep RPOWER && cat /tmp/osdeploy.test | awk '{print $6}'|grep DHCP && cat /tmp/osdeploy.test | awk '{print $8}'|grep BOOTLOADER && cat /tmp/osdeploy.test | awk '{print $10}'|grep KERNEL && cat /tmp/osdeploy.test | awk '{print $12}' |grep INITRD && cat /tmp/osdeploy.test | awk '{print $14}' |grep INSTALL && cat /tmp/osdeploy.test | awk '{print $1 +6}' |grep POST && cat /tmp/osdeploy.test | awk '{print $18}' |grep POSTBOOT && cat /tmp/osdeploy.test | awk '{print $20}' |grep COMPLET +check:rc==0 +cmd:cat /tmp/osdeploy.t |grep $$CN |grep -v FAIL |awk '{print $4}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |grep -v FAIL | awk '{print $6}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |grep -v FAIL |awk '{print $8}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN | grep -v FAIL|awk '{print $10}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |grep -v FAIL |awk '{print $12}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN|grep -v FAIL |awk '{print $14}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |grep -v FAIL|awk '{print $16}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |grep -v FAIL |awk '{print $18}' |grep -v NULL && cat /tmp/osdeploy.t |grep $$CN |awk '{print $20}' |grep -v NULL +check:rc==1 +cmd:rm -rf /tmp/osdeploy.test +check:rc==0 +end + +start:osdeploy_n_p_compact +description: osdeploy -n -p compact node to probe osdeploy +cmd:if [ -e /tmp/osdeploy.test ];then rm -rf /tmp/osdeploy.test*;fi +check:rc==0 +cmd:xcatprobe osdeploy -n $$CN -p compact >> /tmp/osdeploy.test & +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:rpower $$CN boot +check:rc==0 +cmd:sleep 300 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 20;((a++));if [ $a -gt 300 ];then break;fi done +cmd:cat /tmp/osdeploy.test |grep "All nodes provisioned successfully"|grep OK +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep "Provision Time" +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep NODE |awk '{print $4}' |grep ELAPSED +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep $$CN |awk '{print $4}' |grep -v NULL +check:rc==0 +cmd:rm -rf /tmp/osdeploy.test +check:rc==0 +end +start:osdeploy_n_p_compact_r +description: osdeploy -n -p compact -r node to probe osdeploy +cmd:if [ -e /tmp/osdeploy.test ];then rm -rf /tmp/osdeploy.test*;fi +check:rc==0 +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:rpower $$CN boot +check:rc==0 +cmd:sleep 300 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 20;((a++));if [ $a -gt 300 ];then break;fi done +cmd:xcatprobe osdeploy -n $$CN -p compact -r 30m >> /tmp/osdeploy.test +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep "All nodes provisioned successfully"|grep OK +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep "Provision Time" +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep NODE |awk '{print $4}' |grep ELAPSED +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep $$CN |awk '{print $4}' |grep -v NULL +check:rc==0 +cmd:rm -rf /tmp/osdeploy.test +check:rc==0 +end +start:osdeploy_n_p_compact_r_error +description: osdeploy -n -p compact -r node error to probe osdeploy +cmd:if [ -e /tmp/osdeploy.test ];then rm -rf /tmp/osdeploy.test*;fi +check:rc==0 +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:rpower $$CN boot +check:rc==0 +cmd:sleep 300 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 20;((a++));if [ $a -gt 300 ];then break;fi done +cmd:xcatprobe osdeploy -n $$CN -p compact -r 3m >> /tmp/osdeploy.test +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep "Without provision process during rollback time window" +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep "Provision Time" +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep NODE |awk '{print $4}' |grep ELAPSED +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep $$CN |grep -v FAIL |awk '{print $4}' |grep NULL +check:rc==0 +cmd:rm -rf /tmp/osdeploy.test +check:rc==0 +end + +start:osdeploy_n_p_phase +description: osdeploy -n -p phase node to probe osdeploy +cmd:if [ -e /tmp/osdeploy.test ];then rm -rf /tmp/osdeploy.test*;fi +check:rc==0 +cmd:xcatprobe osdeploy -n $$CN -p phase >> /tmp/osdeploy.test & +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:rpower $$CN boot +check:rc==0 +cmd:sleep 300 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 20;((a++));if [ $a -gt 300 ];then break;fi done +cmd:cat /tmp/osdeploy.test |grep "All nodes provisioned successfully"|grep OK +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep "Time for Phases" +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep NODE |awk '{print $4}'|grep SVRBOOT && cat /tmp/osdeploy.test |grep NODE |awk '{print $6}'|grep INSTALL && cat /tmp/osdeploy.test |grep NODE |awk '{print $8}'|grep POST && cat /tmp/osdeploy.test |grep NODE |awk '{print $10}'|grep POSTBOOT && cat /tmp/osdeploy.test |grep NODE |awk '{print $12}'|grep ELAPSED +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep $$CN |awk '{print $4}' |grep -v NULL && cat /tmp/osdeploy.test |grep $$CN |awk '{print $6}' |grep -v NULL && cat /tmp/osdeploy.test |grep $$CN |awk '{print $8}' |grep -v NULL && cat /tmp/osdeploy.test |grep $$CN |awk '{print $10}' |grep -v NULL && cat /tmp/osdeploy.test |grep $$CN |awk '{print $12}' |grep -v NULL +check:rc==0 +cmd:rm -rf /tmp/osdeploy.test +check:rc==0 +end +start:osdeploy_n_p_phase_r +description: osdeploy -n -p phase node -r to probe osdeploy +cmd:if [ -e /tmp/osdeploy.test ];then rm -rf /tmp/osdeploy.test*;fi +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:rpower $$CN boot +check:rc==0 +cmd:sleep 300 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 20;((a++));if [ $a -gt 300 ];then break;fi done +cmd:xcatprobe osdeploy -n $$CN -p phase -r 1h >> /tmp/osdeploy.test +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep "All nodes provisioned successfully"|grep OK +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep "Time for Phases" +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep NODE |awk '{print $4}'|grep SVRBOOT && cat /tmp/osdeploy.test |grep NODE |awk '{print $6}'|grep INSTALL && cat /tmp/osdeploy.test |grep NODE |awk '{print $8}'|grep POST && cat /tmp/osdeploy.test |grep NODE |awk '{print $10}'|grep POSTBOOT && cat /tmp/osdeploy.test |grep NODE |awk '{print $12}'|grep ELAPSED +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep $$CN |awk '{print $4}' |grep -v NULL && cat /tmp/osdeploy.test |grep $$CN |awk '{print $6}' |grep -v NULL && cat /tmp/osdeploy.test |grep $$CN |awk '{print $8}' +|grep -v NULL && cat /tmp/osdeploy.test |grep $$CN |awk '{print $10}' |grep -v NULL && cat /tmp/osdeploy.test |grep $$CN |awk '{print $12}' |grep -v NULL +check:rc==0 +cmd:rm -rf /tmp/osdeploy.test +check:rc==0 +end + +start:osdeploy_n_p_phase_r_error +description: osdeploy -n -p phase node -r error to probe osdeploy +cmd:if [ -e /tmp/osdeploy.test ];then rm -rf /tmp/osdeploy.test*;fi +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:rpower $$CN boot +check:rc==0 +cmd:sleep 300 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 20;((a++));if [ $a -gt 300 ];then break;fi done +cmd:xcatprobe osdeploy -n $$CN -p phase -r 3m >> /tmp/osdeploy.test +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep "Without provision process during rollback time window" +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep "Time for Phases" +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep NODE |awk '{print $4}'|grep SVRBOOT && cat /tmp/osdeploy.test |grep NODE |awk '{print $6}'|grep INSTALL && cat /tmp/osdeploy.test |grep NODE |awk '{print $8}'|grep POST && cat /tmp/osdeploy.test |grep NODE |awk '{print $10}'|grep POSTBOOT && cat /tmp/osdeploy.test |grep NODE |awk '{print $12}'|grep ELAPSED +check:rc==0 +cmd:cat /tmp/osdeploy.test |grep $$CN |grep -v FAIL |awk '{print $4}' |grep -v NULL && cat /tmp/osdeploy.test |grep $$CN |grep -v FAIl|awk '{print $6}' |grep -v NULL && cat /tmp/osdeploy.test |grep $$CN |grep -v FAIl |awk '{print $8}' |grep -v NULL && cat /tmp/osdeploy.test |grep $$CN |grep -v FAIL |awk '{print $10}' |grep -v NULL && cat /tmp/osdeploy.test |grep $$CN |grep -v FAIL |awk '{print $12}' |grep -v NULL +check:rc==1 +cmd:rm -rf /tmp/osdeploy.test +check:rc==0 +end diff --git a/xCAT-test/autotest/testcase/pdu/case0 b/xCAT-test/autotest/testcase/pdu/case0 new file mode 100644 index 000000000..6e4bb26c2 --- /dev/null +++ b/xCAT-test/autotest/testcase/pdu/case0 @@ -0,0 +1,187 @@ +start:lsdef_pdu_object +degscription:list pdu object and it's attribute +cmd:lsdef -h +check:output=~pdu +cmd:mkdef $$PDU mgt=pdu nodetype=pdu groups=pdu +check:rc==0 +cmd:lsdef -t pdu +check:rc==0 +check:output=~$$PDU +check:output=~pdu +cmd:tabdump pdu +check:rc==0 +check:output=~$$PDU +cmd:rmdef $$PDU +check:rc==0 +end + +start:mkdef_pdu_object +description:create a pdu object and list it's attribute +cmd:mkdef $$PDU groups=pdu ip=$$PDUIP mgt=pdu nodetype=pdu +check:rc==0 +cmd:lsdef -t pdu +check:rc==0 +check:output=~$$PDU +check:output=~pdu +cmd:rmdef $$PDU +check:rc==0 +cmd:lsdef $$PDU +check:rc!=0 +check:output=~Error: Could not find an object named '$$PDU' +cmd:mkdef $$PDU groups=pdu ip=$$PDUIP mgt=pdu nodetype=pdu +check:rc==0 +cmd:chdef $$PDU machinetype=1u +check:rc==0 +cmd:lsdef $$PDU +check:output=~1u +cmd:rmdef $$PDU +check:rc==0 +end + +start:noderm_pdu_object +description:create a pdu object and use noderm to remove it +cmd:mkdef $$PDU groups=pdu ip=$$PDUIP mgt=pdu nodetype=pdu +check:rc==0 +cmd:lsdef -t pdu +check:rc==0 +check:output=~$$PDU +check:output=~pdu +cmd:tabdump pdu +check:rc==0 +check:output=~$$PDU +cmd:noderm $$PDU +check:rc==0 +cmd:nodels +check:output!~$$PDU +cmd:tabdump pdu +check:output!~$$PDU +end + +start:pdu_communication +description:Verify a pdu snmp communication +cmd:mkdef $$PDU groups=pdu ip=$$PDUIP mgt=pdu nodetype=pdu +check:rc==0 +cmd:lsdef -t pdu +check:rc==0 +cmd:makehosts $$PDU +check:rc==0 +cmd:grep $$PDUIP /etc/hosts +check:rc==0 +cmd:snmpwalk -v1 -cpublic -mALL $$PDU .1.3.6.1.2.1.1 +check:rc==0 +check:output=~PDU +check:output=~$$PDU +cmd:rmdef $$PDU +check:rc==0 +end + +start:pdu_rinv +description:Verify rinv works for pdu object +cmd:mkdef $$PDU groups=pdu ip=$$PDUIP mgt=pdu nodetype=pdu +check:rc==0 +cmd:makehosts $$PDU +check:rc==0 +cmd:grep $$PDUIP /etc/hosts +check:rc==0 +cmd:snmpwalk -v1 -cpublic -mALL $$PDU .1.3.6.1.2.1.1 +check:rc==0 +cmd:rinv $$PDU +check:rc==0 +check:output=~$$PDU +cmd:rmdef $$PDU +check:rc==0 +end + +start:pdu_rpower +description:Verify rpower works for pdu object +cmd:mkdef $$PDU groups=pdu ip=$$PDUIP mgt=pdu nodetype=pdu +check:rc==0 +cmd:makehosts $$PDU +check:rc==0 +cmd:grep $$PDUIP /etc/hosts +check:rc==0 +cmd:snmpwalk -v1 -cpublic -mALL $$PDU .1.3.6.1.2.1.1 +check:rc==0 +cmd:rpower $$PDU off +check:rc==0 +check:output=~$$PDU +check:output=~off +check:output!~on +cmd:rpower $$PDU on +check:rc==0 +check:output=~$$PDU +check:output=~on +check:output!~off +cmd:rpower $$PDU stat +check:rc==0 +check:output=~$$PDU +check:output=~on +check:output!~off +cmd:rmdef $$PDU +check:rc==0 +end + +start:pdu_node_operation +description:Verify operate node's pdu attribute could operate pdu +cmd:mkdef $$PDU groups=pdu ip=$$PDUIP mgt=pdu nodetype=pdu +check:rc==0 +cmd:makehosts $$PDU +check:rc==0 +cmd:grep $$PDUIP /etc/hosts +check:rc==0 +cmd:snmpwalk -v1 -cpublic -mALL $$PDU .1.3.6.1.2.1.1 +check:rc==0 +cmd:lsdef $$CN |grep pdu|awk -F= '{print $2}' > /tmp/pduvalue +cmd:oldpdu=`lsdef $$CN |grep pdu|awk -F= '{print $2}'`;chdef $$CN pdu=$$PDU:$$PORT,$oldpdu +check:rc==0 +cmd:lsdef $$CN -i pdu +check:rc==0 +cmd:rpower $$CN stat |awk -F: '{print $2}' > /tmp/cnstat +check:rc==0 +cmd:rpower $$CN pdustat +check:rc==0 +check:output=~$$CN: $$PDU outlet $$PORT is +cmd:rpower $$CN pduoff +check:rc==0 +check:output=~$$CN: $$PDU outlet $$PORT is off +cmd:rpower $$CN pduon +check:rc==0 +check:output=~$$CN: $$PDU outlet $$PORT is on +cmd:oldpdu=`cat /tmp/pduvalue`;chdef $$CN pdu=$oldpdu +cmd:if grep on /tmp/cnstat; then rpower $$CN on;fi +check:rc==0 +cmd:rmdef $$PDU +check:rc==0 +cmd:rm -rf /tmp/pduvalue +cmd:rm -rf /tmp/cnstat +end + +start:pdu_bad_config +description:test bad config with pdu +cmd:mkdef $$PDU groups=pdu ip=$$PDUIP mgt=pdu nodetype=pdu +check:rc==0 +cmd:makehosts $$PDU +check:rc==0 +cmd:grep $$PDUIP /etc/hosts +check:rc==0 +cmd:snmpwalk -v1 -cpublic -mALL $$PDU .1.3.6.1.2.1.1 +check:rc==0 +cmd:lsdef $$CN |grep pdu|awk -F= '{print $2}' > /tmp/pduvalue +cmd:chdef $$CN pdu=$$PDU:1000 +check:rc==0 +cmd:lsdef $$CN -i pdu +cmd:rpower $$CN pdustat +check:rc!=0 +check:output=~Error +cmd:rpower $$CN pduon +check:rc!=0 +check:output=~Error +cmd:rpower $$CN pduoff +check:rc!=0 +check:output=~Error +cmd:oldpdu=`cat /tmp/pduvalue`;chdef $$CN pdu=$oldpdu +cmd:rpower $$CN pduof +check:rc!=0 +check:outpu=~Unsupported command +cmd:rmdef $$PDU +end diff --git a/xCAT-test/autotest/testcase/pkg/cases0 b/xCAT-test/autotest/testcase/pkg/cases0 index c959e7974..47f81c176 100644 --- a/xCAT-test/autotest/testcase/pkg/cases0 +++ b/xCAT-test/autotest/testcase/pkg/cases0 @@ -1,69 +1,133 @@ start:del_ospkg descreption:del ospkg -cmd:if cat /etc/*-release | grep SUSE >/dev/null; then ver=`echo "$$os" |awk -F "." '{print $1}'`; cp /opt/xcat/share/xcat/install/sles/compute.$ver.pkglist /opt/xcat/share/xcat/install/sles/compute.$ver.pkglist.bak; `cat /opt/xcat/share/xcat/install/sles/compute.$ver.pkglist |sed 's/ntp/-ntp/g' >> /opt/xcat/share/xcat/install/sles/compute.$ver.pkglist.1`;`yes | cp -f /opt/xcat/share/xcat/install/sles/compute.$ver.pkglist.1 /opt/xcat/share/xcat/install/sles/compute.$ver.pkglist` ;updatenode $$CN -S;elif cat /etc/*release |grep "Red Hat" >/dev/null;then ver=`echo "$$os" |awk -F "." '{print $1}'`;cp /opt/xcat/share/xcat/install/rh/compute.$ver.pkglist /opt/xcat/share/xcat/install/rh/compute.$ver.pkglist.bak;`cat /opt/xcat/share/xcat/install/rh/compute.$ver.pkglist |sed 's/ntp/-ntp/g' >>/opt/xcat/share/xcat/install/rh/compute.$ver.pkglist.1`;`yes |cp -f /opt/xcat/share/xcat/install/rh/compute.$ver.pkglist.1 /opt/xcat/share/xcat/install/rh/compute.$ver.pkglist` ;updatenode $$CN -S;fi +cmd:copycds $$ISO check:rc==0 -cmd:rm -rf /opt/xcat/share/xcat/install/rh/compute.*.pkglist.1 -cmd:xdsh $$CN rpm -qa |grep ntp-4.2 -check:rc!=0 -cmd:if cat /etc/*-release | grep SUSE >/dev/null; then ver=`echo "$$os" |awk -F "." '{print $1}'`; `yes| cp -f /opt/xcat/share/xcat/install/sles/compute.$ver.pkglist.bak /opt/xcat/share/xcat/install/sles/compute.$ver.pkglist`;elif cat /etc/*release |grep "Red Hat" >/dev/null;then ver=`echo "$$os" |awk -F "." '{print $1}'`;`yes |cp -f /opt/xcat/share/xcat/install/rh/compute.$ver.pkglist.bak /opt/xcat/share/xcat/install/rh/compute.$ver.pkglist`;fi -#cmd:rm -rf /opt/xcat/share/xcat/install/rh/compute.*.pkglist.1 -cmd:rm -rf /opt/xcat/share/xcat/install/rh/compute.*.pkglist.bak -end -start:add_ospkg -descreption:add ospkg -cmd:if cat /etc/*-release | grep SUSE >/dev/null; then ver=`echo "$$os" |awk -F "." '{print $1}'`; cp /opt/xcat/share/xcat/install/sles/compute.$ver.pkglist /opt/xcat/share/xcat/install/sles/compute.$ver.pkglist.bak; `cat /opt/xcat/share/xcat/install/sles/compute.$ver.pkglist |sed 's/ntp/-ntp/g' >> /opt/xcat/share/xcat/install/sles/compute.$ver.pkglist.1`;`yes | cp -f /opt/xcat/share/xcat/install/sles/compute.$ver.pkglist.1 /opt/xcat/share/xcat/install/sles/compute.$ver.pkglist` ;updatenode $$CN -S;elif cat /etc/*release |grep "Red Hat" >/dev/null;then ver=`echo "$$os" |awk -F "." '{print $1}'`;cp /opt/xcat/share/xcat/install/rh/compute.$ver.pkglist /opt/xcat/share/xcat/install/rh/compute.$ver.pkglist.bak;`cat /opt/xcat/share/xcat/install/rh/compute.$ver.pkglist |sed 's/ntp/-ntp/g' >>/opt/xcat/share/xcat/install/rh/compute.$ver.pkglist.1`;`yes |cp -f /opt/xcat/share/xcat/install/rh/compute.$ver.pkglist.1 /opt/xcat/share/xcat/install/rh/compute.$ver.pkglist` ;updatenode $$CN -S;fi -cmd:rm -rf /opt/xcat/share/xcat/install/rh/compute.*.pkglist.1 +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/pkg/pkgtest.pl -s -g $$osimage -t pkglist -v __GETNODEATTR($$CN,os)__ check:rc==0 -cmd:xdsh $$CN rpm -qa |grep ntp-4.2 -check:rc!=0 -cmd:if cat /etc/*-release | grep SUSE >/dev/null; then ver=`echo "$$os" |awk -F "." '{print $1}'`; `yes| cp -f /opt/xcat/share/xcat/install/sles/compute.$ver.pkglist.bak /opt/xcat/share/xcat/install/sles/compute.$ver.pkglist`;elif cat /etc/*release |grep "Red Hat" >/dev/null;then ver=`echo "$$os" |awk -F "." '{print $1}'`;`yes |cp -f /opt/xcat/share/xcat/install/rh/compute.$ver.pkglist.bak /opt/xcat/share/xcat/install/rh/compute.$ver.pkglist`;fi -#cmd:rm -rf /opt/xcat/share/xcat/install/rh/compute.*.pkglist.1 cmd:updatenode $$CN -S check:rc==0 -cmd:xdsh $$CN rpm -qa |grep ntp-4.2 -check:output=~ntp-4.2 -cmd:rm -rf /opt/xcat/share/xcat/install/rh/compute.*.pkglist.bak +cmd:if echo "__GETNODEATTR($$CN,os)__" | grep ubuntu >/dev/null; then xdsh $$CN dpkg -l |grep "ii rpm"|grep "package manager for RPM" ;else xdsh $$CN rpm -qa |grep xCAT-test; fi +check:rc==0 +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/pkg/pkgtest.pl -c -g $$osimage -t pkglist -v __GETNODEATTR($$CN,os)__ +check:rc==0 +cmd:copycds $$ISO +check:rc==0 +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/pkg/pkgtest.pl -r -g $$osimage -t pkglist -v __GETNODEATTR($$CN,os)__ +check:rc==0 +cmd:updatenode $$CN -S +check:rc==0 +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/pkg/pkgtest.pl -c -g $$osimage -t pkglist -v __GETNODEATTR($$CN,os)__ +cmd:rc==0 +cmd:if echo "__GETNODEATTR($$CN,os)__" | grep ubuntu >/dev/null; then xdsh $$CN dpkg -l |grep "ii rpm" |grep "package manager for RPM";else xdsh $$CN rpm -qa |grep xCAT-test; fi +check:rc!=0 +cmd:copycds $$ISO +check:rc==0 end + +start:add_ospkg_updatenode +descreption:add ospkg +cmd:copycds $$ISO +check:rc==0 +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/pkg/pkgtest.pl -s -g $$osimage -t pkglist -v __GETNODEATTR($$CN,os)__ +check:rc==0 +cmd:updatenode $$CN -S +check:rc==0 +cmd:if echo "__GETNODEATTR($$CN,os)__" | grep ubuntu >/dev/null; then xdsh $$CN dpkg -l |grep "ii rpm"|grep "package manager for RPM";else xdsh $$CN rpm -qa |grep xCAT-test; fi +check:rc==0 +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/pkg/pkgtest.pl -c -g $$osimage -t pkglist -v __GETNODEATTR($$CN,os)__ +check:rc==0 +cmd:if echo "__GETNODEATTR($$CN,os)__" | grep ubuntu >/dev/null; then xdsh $$CN dpkg -r rpm; else xdsh $$CN rpm -e xCAT-test; fi +check:rc==0 +cmd:if echo "__GETNODEATTR($$CN,os)__" | grep ubuntu >/dev/null; then xdsh $$CN dpkg -l |grep "ii rpm"|grep "package manager for RPM" ;else xdsh $$CN rpm -qa |grep xCAT-test; fi +check:rc!=0 +cmd:copycds $$ISO +check:rc==0 +end + +start:add_includeospkg_updatenode +descreption:add include ospkg list +cmd:copycds $$ISO +check:rc==0 +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/pkg/pkgtest.pl -i -g $$osimage -t pkglist -v __GETNODEATTR($$CN,os)__ +check:rc==0 +cmd:updatenode $$CN -S +check:rc==0 +cmd:if echo "__GETNODEATTR($$CN,os)__" | grep ubuntu >/dev/null; then xdsh $$CN dpkg -l |grep "ii rpm"|grep "package manager for RPM" ;else xdsh $$CN rpm -qa |grep xCAT-test; fi +check:rc==0 +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/pkg/pkgtest.pl -c -g $$osimage -t pkglist -v __GETNODEATTR($$CN,os)__ +check:rc==0 +cmd:if echo "__GETNODEATTR($$CN,os)__" | grep ubuntu >/dev/null; then xdsh $$CN dpkg -r rpm; else xdsh $$CN rpm -e xCAT-test; fi +check:rc==0 +cmd:if echo "__GETNODEATTR($$CN,os)__" | grep ubuntu >/dev/null; then xdsh $$CN dpkg -l |grep "ii rpm"|grep "package manager for RPM" ;else xdsh $$CN rpm -qa |grep xCAT-test; fi +check:rc!=0 +cmd:copycds $$ISO +check:rc==0 +end + start:add_other_pkg descreption:add other pkg -cmd:if echo "$$os" |grep "sles11"; then ver=`echo "$$os" |awk -F "." '{print $1}'`;`mkdir -p /install/post/otherpkgs/$$ver/__GETNODEATTR($$CN,arch)__/xcat/xcat-core`;cp -r /xcat-core/build/* /install/post/otherpkgs/$$ver/__GETNODEATTR($$CN,arch)__/xcat/xcat-core ;`cp -r /xcat-dep /install/post/otherpkgs/$$ver/__GETNODEATTR($$CN,arch)__/xcat ` ;`cd /install/post/otherpkgs/$$ver/__GETNODEATTR($$CN,arch)__/xcat && createrepo .`;`echo "xcat/xcat-core/xCAT" >> /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist`;`echo "xcat/xcat-dep/$ver/__GETNODEATTR($$CN,arch)__/conserver-xcat" >> /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist `;`echo "xcat/xcat-dep/$ver/__GETNODEATTR($$CN,arch)__/perl-Net-Telnet" >> /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist`;`echo "xcat/xcat-dep/sles/__GETNODEATTR($$CN,arch)__/perl-Expect" >> /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist` ;chdef -t osimage -o $ver-__GETNODEATTR($$CN,arch)__-install-compute otherpkglist=/opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist;elif echo "$$os" |grep "rhels7" >/dev/null;then ver=`echo "$$os" |awk -F "." '{print $1}'`;`mkdir -p /install/post/otherpkgs/$$ver/__GETNODEATTR($$CN,arch)__/xcat/xcat-core`;cp -r /xcat-core/build/* /install/post/otherpkgs/$$ver/__GETNODEATTR($$CN,arch)__/xcat/xcat-core ;`cp -r /xcat-dep /install/post/otherpkgs/$$ver/__GETNODEATTR($$CN,arch)__/xcat ` ;`cd /install/post/otherpkgs/$$ver/__GETNODEATTR($$CN,arch)__/xcat && createrepo .`;`echo "xcat/xcat-core/xCAT" >> /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist`;`echo "xcat/xcat-dep/rh7/ppc64/conserver-xcat" >> /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist `;`echo "xcat/xcat-dep/rh7/ppc64/perl-Net-Telnet" >> /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist`;`echo "xcat/xcat-dep/rh7/ppc64/perl-Expect" >> /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist`;chdef -t osimage -o $ver-__GETNODEATTR($$CN,arch)__-install-compute otherpkglist=opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist;elif echo "$$os" |grep "rhels6" >/dev/null;then ver=`echo "$$os" |awk -F "." '{print $1}'`;`mkdir -p /install/post/otherpkgs/$$ver/__GETNODEATTR($$CN,arch)__/xcat/xcat-core`;`cp -r /xcat-core/build/* /install/post/otherpkgs/$$ver/__GETNODEATTR($$CN,arch)__/xcat/xcat-core `;`cp -r /xcat-dep /install/post/otherpkgs/$$ver/__GETNODEATTR($$CN,arch)__/xcat ` ;`cd /install/post/otherpkgs/$$ver/__GETNODEATTR($$CN,arch)__/xcat && createrepo .`;`echo "xcat/xcat-core/xCAT" >> /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist`;`echo "xcat/xcat-dep/rh6/__GETNODEATTR($$CN,arch)__/conserver-xcat" >> /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist `;`echo "xcat/xcat-dep/rh6/__GETNODEATTR($$CN,arch)__/perl-Net-Telnet" >> /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist`;`echo "xcat/xcat-dep/rh6/__GETNODEATTR($$CN,arch)__/perl-Expect" >> /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist`;chdef -t osimage -o $ver-__GETNODEATTR($$CN,arch)__-install-compute otherpkglist=/opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist;fi +cmd:copycds $$ISO check:rc==0 +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/pkg/pkgtest.pl -s -o -g $$osimage -t otherpkgdir -v __GETNODEATTR($$CN,os)__ cmd:updatenode $$CN -S check:rc==0 -cmd:xdsh $$CN lsdef +cmd:if echo "__GETNODEATTR($$CN,os)__" | grep ubuntu >/dev/null; then xdsh $$CN dpkg -l |grep xcat ;else xdsh $$CN rpm -qa |grep xCAT-test; fi +check:rc==0 +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/pkg/pkgtest.pl -c -o -g $$osimage -t otherpkgdir -v __GETNODEATTR($$CN,os)__ +check:rc==0 +cmd:if echo "__GETNODEATTR($$CN,os)__" | grep ubuntu >/dev/null; then xdsh $$CN dpkg -r xcat-test; else xdsh $$CN rpm -e xCAT-test; fi +check:rc==0 +cmd:if echo "__GETNODEATTR($$CN,os)__" | grep ubuntu >/dev/null; then xdsh $$CN dpkg -l |grep xcat ;else xdsh $$CN rpm -qa |grep xCAT-test; fi +check:rc!=0 +cmd:copycds $$ISO check:rc==0 end + start:del_other_pkg descreption:del other pkg -cmd:if echo "$$os" |grep "sles11"; then ver=`echo "$$os" |awk -F "." '{print $1}'`;`cp /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist.bak`;elif echo "$$os" |grep "rhels"; then ver=`echo "$$os" |awk -F "." '{print $1}'`;`cp /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist.bak`;fi - -cmd:if echo "$$os" |grep "sles11"; then ver=`echo "$$os" |awk -F "." '{print $1}'`;`echo "xcat/xcat-core/xCAT-test" >> /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist`;elif echo "$$os" |grep "rhels";then ver=`echo "$$os" |awk -F "." '{print $1}'`;`echo "xcat/xcat-core/xCAT-test" >> /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist`;fi -cmd:cd /install/post/otherpkgs/rhels7/__GETNODEATTR($$CN,arch)__/xcat && createrepo . -cmd:updatenode $$CN -S +cmd:copycds $$ISO check:rc==0 -cmd:xdsh $$CN yum repolist all -cmd:xdsh $$CN rpm -qa |grep xCAT-test -cmd:if echo "$$os" |grep "sles11"; then ver=`echo "$$os" |awk -F "." '{print $1}'`;`yes |cp -f /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist.bak /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist`;elif echo "$$os" |grep "rhels"; then ver=`echo "$$os" |awk -F "." '{print $1}'`;`yes |cp -f /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist.bak /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist`;fi -cmd:if echo "$$os" |grep "sles11"; then ver=`echo "$$os" |awk -F "." '{print $1}'`;echo "-xCAT-test" >>/opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist.1;`yes | cp -f /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist.1 /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist`;elif echo "$$os" |grep "rhels"; then ver=`echo "$$os" |awk -F "." '{print $1}'`;echo "-xCAT-test" >>/opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist.1;`yes | cp -f /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist.1 /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist`;fi +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/pkg/pkgtest.pl -s -o -g $$osimage -t otherpkgdir -v __GETNODEATTR($$CN,os)__ check:rc==0 cmd:updatenode $$CN -S check:rc==0 -cmd:xdsh $$CN rpm -qa |grep xCAT-test +cmd:sleep 10 +check:rc==0 +cmd:if echo "__GETNODEATTR($$CN,os)__" | grep ubuntu >/dev/null; then xdsh $$CN dpkg -l |grep xcat ;else xdsh $$CN rpm -qa |grep xCAT-test; fi +check:rc==0 +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/pkg/pkgtest.pl -c -o -g $$osimage -t otherpkgdir -v __GETNODEATTR($$CN,os)__ +check:rc==0 +cmd:copycds $$ISO +check:rc==0 +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/pkg/pkgtest.pl -r -o -g $$osimage -t otherpkgdir -v __GETNODEATTR($$CN,os)__ +check:rc==0 +cmd:updatenode $$CN -S +check:rc==0 +cmd:if echo "__GETNODEATTR($$CN,os)__" | grep ubuntu >/dev/null; then xdsh $$CN dpkg -l |grep xcat ;else xdsh $$CN rpm -qa |grep xCAT-test; fi check:rc!=0 -cmd:if echo "$$os" |grep "sles11"; then ver=`echo "$$os" |awk -F "." '{print $1}'`;`yes |cp -f /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist.bak /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist`;rm -rf /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist.bak;rm -rf /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist.1;elif echo "$$os" |grep "rhels"; then ver=`echo "$$os" |awk -F "." '{print $1}'`;`yes |cp -f /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist.bak /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist`;rm -rf /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist.bak;rm -rf /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist.1;fi -end -start:add_other_pkg_afterinstall -descreption:add other pkg after install -cmd:if echo "$$os" |grep "sles11"; then ver=`echo "$$os" |awk -F "." '{print $1}'`;`echo "xcat/xcat-core/xCAT-test" >> /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist`;elif echo "$$os" |grep "rhels";then ver=`echo "$$os" |awk -F "." '{print $1}'`;`echo "xcat/xcat-core/xCAT-test" >> /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist`;fi -cmd:updatenode $$CN -S +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/pkg/pkgtest.pl -c -o -g $$osimage -t otherpkgdir -v __GETNODEATTR($$CN,os)__ check:rc==0 -cmd:if echo "$$os" |grep "sles11"; then ver=`echo "$$os" |awk -F "." '{print $1}'`;cat /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist |sed 's/xCAT-test/--xCAT-test/g' >>/opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist.1;`yes | cp -f /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist.1 /opt/xcat/share/xcat/install/sles/compute.$ver.otherpkg.pkglist`;elif echo "$$os" |grep "rhels"; then ver=`echo "$$os" |awk -F "." '{print $1}'`;cat /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist |sed 's/xCAT-test/--xCAT-test/g' >>/opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist.1;`yes | cp -f /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist.1 /opt/xcat/share/xcat/install/rh/compute.$ver.otherpkg.pkglist`;fi -check:rc==0 -cmd:updatenode $$CN -S -check:rc==0 -cmd:xdsh $$CN rpm -qa |grep xCAT-test -check:rc==0 -cmd:xdsh $$CN lsdef +cmd:copycds $$ISO +check:rc==0 +end + +start:add_other_pkg_include +descreption:add other pkg include other list +cmd:copycds $$ISO +check:rc==0 +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/pkg/pkgtest.pl -i -o -g $$osimage -t otherpkgdir -v __GETNODEATTR($$CN,os)__ +check:rc==0 +cmd:updatenode $$CN -S +check:rc==0 +cmd:if echo "__GETNODEATTR($$CN,os)__" | grep ubuntu >/dev/null; then xdsh $$CN dpkg -l |grep xcat ;else xdsh $$CN rpm -qa |grep xCAT-test; fi +check:rc==0 +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/pkg/pkgtest.pl -c -o -g $$osimage -t otherpkgdir -v __GETNODEATTR($$CN,os)__ +check:rc==0 +cmd:if echo "__GETNODEATTR($$CN,os)__" | grep ubuntu >/dev/null; then xdsh $$CN dpkg -r xcat-test; else xdsh $$CN rpm -e xCAT-test; fi +check:rc==0 +cmd:if echo "__GETNODEATTR($$CN,os)__" | grep ubuntu >/dev/null; then xdsh $$CN dpkg -l |grep xcat ;else xdsh $$CN rpm -qa |grep xCAT-test; fi +check:rc!=0 +cmd:copycds $$ISO check:rc==0 end diff --git a/xCAT-test/autotest/testcase/pkg/pkgtest.pl b/xCAT-test/autotest/testcase/pkg/pkgtest.pl new file mode 100755 index 000000000..b1f9ca2e4 --- /dev/null +++ b/xCAT-test/autotest/testcase/pkg/pkgtest.pl @@ -0,0 +1,203 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html + +use strict; +use warnings; +use Getopt::Long; +use Data::Dumper; +use Term::ANSIColor; +use Time::Local; +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; +} +use lib "$::XCATROOT/lib/perl"; +my $osver; +my $log="/tmp/pkg.log"; +my $needhelp = 0; +my $setupenv = 0; +my $clearenv = 0; +my $setupenvinclude = 0; +my $removerpm = 0; +my $ospkg = 0; +my $osimg; +my $attr; +my $int; +if ( + !GetOptions("h|?" => \$needhelp, + "s" => \$setupenv, + "c"=>\$clearenv, + "i"=>\$setupenvinclude, + "r"=>\$removerpm, + "o"=>\$ospkg, + "g=s"=>\$::OSIMG, + "t=s"=>\$::ATTR, + "v=s"=>\$::OSVERSION) + ) +{ + &usage; + exit 1; +} + +sub usage +{ + print "Usage:pkgtest.pl - Run xcat pkg test cases.\n"; + print " pkgtest.pl [-?|-h]\n"; + print " pkgtest.pl [-s] [-g osimage] [-t attribute] [-v os] set up package test environment \n"; + print " pkgtest.pl [-i] [-g osimage] [-t attribute] [-v os] set up package test environment using include package list\n"; + print " pkgtest.pl [-r] [-g osimage] [-t attribute] [-v os] remove package \n"; + print " pkgtest.pl [-c] [-g osimage] [-t attribute] [-v os] clear package test environment \n"; + print " pkgtest.pl [-o] [-g osimage] [-t attribute] [-v os] other package test \n"; + print "\n"; + return; +} + +sub getimgattr +{ + my @output = `lsdef -t osimage -o $osimg -i $attr`; + my $pkglistvalue; + print " output is @output \n"; + if($?){ + print "unkonw"; + return "Unknown"; + } + if($? == 0){ + foreach my $output1 (@output){ + if($output1 =~ /$attr=(.*)/){ + print "output1 is $output1 ,attrs is value is $1 \n"; + $pkglistvalue = $1 ; + } + } } + return $pkglistvalue; +} + +sub setupenv +{ + my $int = shift; + if ($ospkg){ + `mkdir -p $int`; + `cp -rf /xcat-core/* $int`; + }else{ + `cat "$int" >> /tmp/pkgtest.bak`; + } + if (($osver =~ /ubuntu/)&&($ospkg ==0)){ + `echo "rpm" >>/tmp/pkgtest.bak `; + }else{ + `echo "xCAT-test" >>/tmp/pkgtest.bak `; + } +} +sub clearenv +{ + my $int = shift; + if ($ospkg ==0){ + `rm -rf /tmp/pkgtest.* `; + `rm -rf /install/pkgtest`; + }else{ + `rm -rf /tmp/pkgtest.* `; + `rm -rf $int`; + } +} + +sub setupenvinclude +{ + my $int = shift; + if ($ospkg){ + `mkdir -p $int`; + `cp -rf /xcat-core/* $int`; + }else{ + ` cat $int >> /tmp/pkgtest.bak`; + } + if (($osver =~ /ubuntu/)&&($ospkg ==0)){ + `echo "rpm" >>/tmp/pkgtest.bak `; + }else{ + `echo "xCAT-test" >> /tmp/pkgtest.includelist `; + } + `echo "#INCLUDE:/tmp/pkgtest.includelist#">>/tmp/pkgtest.bak `; +} +sub removerpm +{ + my $int = shift; + if ($ospkg){ + `mkdir -p $int`; + `cp -rf /xcat-core/* $int`; + }else{ + `cat "$int" >> /tmp/pkgtest.bak`; + } + if (($osver =~ /ubuntu/)&&($ospkg ==0)){ + `echo "-rpm" >>/tmp/pkgtest.bak `; + }elsif(($osver =~ /ubuntu/)&&($ospkg !=0)){ + `echo "-xcat-test">>/tmp/pkgtest.bak`; + }else{ + `echo "-xCAT-test" >>/tmp/pkgtest.bak`; + } +} + +if ($needhelp) +{ + &usage; + exit 0; +} +if($::OSIMG) +{ + $osimg = $::OSIMG; +} +if($::ATTR) +{ + $attr = $::ATTR; +} +if($::OSVERSION) +{ + $osver = $::OSVERSION; +} +$int = getimgattr; +if ( ($setupenv) || ($setupenvinclude) ||($removerpm)) +{ + if (! -f "/tmp/int"){ + `echo $int >> /tmp/int`; + }else{ + print "please clear the pkg test environment first \n"; + exit 1; + } +} +if ($setupenv) +{ + &setupenv($int); +} +if ($setupenvinclude) +{ + &setupenvinclude($int); +} +if ($removerpm) +{ + &removerpm($int); +} +if ($clearenv) +{ + if (-f "/tmp/int"){ + my $int=`cat /tmp/int`; + &clearenv($int); + `rm -rf /tmp/int`; + exit 0; + }else{ + print "please set the pkg test environment first \n"; + exit 1; + } +} +if (($setupenv) || ($setupenvinclude) ||($removerpm)) +{ + `mkdir -p /install/pkgtest`; + `cp -rf /xcat-core/* /install/pkgtest`; + if (($osver !~ /ubuntu/)&&($ospkg ==0)){ + `chdef -t osimage -o $osimg pkgdir=/install/pkgtest pkglist=/tmp/pkgtest.bak `; + }elsif (($osver !~ /ubuntu/)&&($ospkg !=0)){ + `chdef -t osimage -o $osimg otherpkglist=/tmp/pkgtest.bak`; + }elsif(($osver =~ /ubuntu/)&&($ospkg !=0)){ + `chdef -t osimage -o $osimg otherpkglist="/tmp/pkgtest.bak" otherpkgdir="http://xcat.org/files/xcat/repos/apt/2.12/xcat-core trusty main"`; + }elsif(($osver =~ /ubuntu/)&&($ospkg ==0)){ + `chdef -t osimage -o $osimg pkglist=/tmp/pkgtest.bak`; + } +} +if ($?) +{ + return 0; +} diff --git a/xCAT-test/autotest/testcase/rinv/cases1 b/xCAT-test/autotest/testcase/rinv/cases1 new file mode 100644 index 000000000..292e9b915 --- /dev/null +++ b/xCAT-test/autotest/testcase/rinv/cases1 @@ -0,0 +1,70 @@ +start:rinv_serial +arch:ppc64le +hcp:ipmi +cmd:rinv $$CN serial +check:rc==0 +check:output=~NODE 1 Chassis Serial Number:\s*\w{7} +end + +start:rinv_model +arch:ppc64le +hcp:ipmi +cmd:rinv $$CN model +check:rc==0 +check:output=~NODE 1 Chassis Part Number\s*:\s*\w{4}-\w{3} +end + +start:rinv_firm +arch:ppc64le +hcp:ipmi +cmd:rinv $$CN firm +check:rc==0 +check:output=~BMC Firmware\s*:\s*\w+.\w+ +end + +start:rinv_deviceid +hcp:ipmi +arch:ppc64le +cmd:rinv $$CN deviceid +check:rc==0 +check:output=~Device ID:\s*\w+ +check:output=~Product ID:\s*\w+ +check:output=~Manufacturer ID:\s*\w+ +end + + +start:rinv_vpd +hcp:ipmi +arch:ppc64le +cmd:rinv $$CN vpd +check:rc==0 +check:output=~Manufacturer ID:\s*\w+ +check:output=~Device ID:\s*\w+ +check:output=~BMC Firmware:\s*\w+.\w+ +check:output=~NODE 1 Chassis Serial Number:\s*\w{7} +check:output=~NODE 1 Chassis Part Number\s*:\s*\w{4}-\w{3} +end + + +start:rinv_all +hcp:ipmi +arch:ppc64le +cmd:rinv $$CN all +check:rc==0 +check:output=~BMC Firmware:\s*\w+.\w+ +check:output=~BMCCARD Board Part Number:\s*\w{7} +check:output=~UUID/GUID:\s*\w+-\w+-\w+-\w+-\w+ +check:output=~Product ID:\s*\d+ +check:output=~Manufacturer ID:\s*\d+ +check:output=~Device ID:\s*\d+ +check:output=~BMCCARD Board Serial Number:\s*\w+ +end + +start:rinv_noderange_err +hcp:ipmi +arch:ppc64le +cmd:rinv testnode +check:rc!=0 +check:output=~Error +end + diff --git a/xCAT-test/autotest/testcase/rpower/cases0 b/xCAT-test/autotest/testcase/rpower/cases0 index c522406c2..6f47659f5 100644 --- a/xCAT-test/autotest/testcase/rpower/cases0 +++ b/xCAT-test/autotest/testcase/rpower/cases0 @@ -1,75 +1,79 @@ start:rpower_off -cmd:rpower $$CN stat -check:ouptut=~Running +cmd:rpower $$CN on +cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done +check:ouptut=~Running|on cmd:rpower $$CN off check:rc==0 -check:output=~Success -cmd:sleep 60 +cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done cmd:rpower $$CN stat -check:output=~Not Activated -cmd:rpower $$CN on -cmd:sleep 60 +check:output=~Not Activated|off end start:rpower_stat +cmd:rpower $$CN on +cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 5 ];then break;fi done cmd:rpower $$CN stat check:rc==0 -check:output=~Running +check:output=~Running|on cmd:rpower $$CN state check:rc==0 -check:output=~Running +check:output=~Running|on +cmd:rpower $$CN off +cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 5 ];then break;fi done +cmd:rpower $$CN stat +check:rc==0 +check:output=~Not Activated|off +cmd:rpower $$CN state +check:rc==0 +check:output=~Not Activated|off end start:rpower_boot cmd:rpower $$CN off -cmd:sleep 60 +cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done cmd:rpower $$CN stat -check:output=~Not Activated +check:output=~Not Activated|off cmd:rpower $$CN boot check:rc==0 -check:output=~Success -cmd:sleep 60 +cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done cmd:rpower $$CN stat -check:output=~Running -cmd:sleep 60 +check:output=~Running|on end start:rpower_on cmd:rpower $$CN off -cmd:sleep 60 +cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done cmd:rpower $$CN stat -check:output=~Not Activated +check:output=~Not Activated|off cmd:rpower $$CN on check:rc==0 -check:output=~Success -cmd:sleep 60 +cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done cmd:rpower $$CN stat -check:output=~Running -cmd:sleep 60 +check:output=~Running|on end start:rpower_reset +cmd:rpower $$CN on +cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done cmd:rpower $$CN stat -check:ouptut=~Running +check:ouptut=~Running|on cmd:rpower $$CN reset check:rc==0 -check:output=~Success -cmd:sleep 60 +cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done cmd:rpower $$CN stat -check:output=~Running -cmd:sleep 60 +check:output=~Running|on end start:rpower_noderange cmd:rpower $$CN check:rc!=0 -check:output=~Usage +check:output=~Unsupported|Usage end start:rpower_noderange_nodeps cmd:rpower $$CN --nodeps check:rc!=0 -check:output=~Usage +check:output=~Unsupported|Usage end start:rpower_err_noderange diff --git a/xCAT-test/autotest/testcase/rvitals/cases1 b/xCAT-test/autotest/testcase/rvitals/cases1 new file mode 100644 index 000000000..8a43aedb6 --- /dev/null +++ b/xCAT-test/autotest/testcase/rvitals/cases1 @@ -0,0 +1,61 @@ +start:rvitals_temp +arch:ppc64le +hcp:ipmi +cmd:rvitals $$CN temp +check:rc==0 +check:output=~Ambient Temp +end + +start:rvitals_disktemp +arch:ppc64le +hcp:ipmi +cmd:rvitals $$CN disktemp +check:rc==0 +check:output=~Ambient Temp +end + +start:rvitals_cputemp +arch:ppc64le +hcp:ipmi +cmd:rvitals $$CN cputemp +check:rc==0 +check:output=~Ambient Temp +end + +start:rvitals_fanspeed +arch:ppc64le +hcp:ipmi +cmd:rvitals $$CN fanspeed +check:rc==0 +check:output=~Fan\s*\d:\s*\w+\s*RPM +end + +start:rvitals_voltage +arch:ppc64le +hcp:ipmi +cmd:rvitals $$CN voltage +check:rc==0 +check:output=~CPU VDD Volt +end + +start:rvitals_all +arch:ppc64le +hcp:ipmi +cmd:rvitals $$CN all +check:rc==0 +check:output=~Power Status +check:output=~Power Overload +check:output=~Power Interlock +check:output=~Power Fault +check:output=~Power Control Fault +check:output=~Power Restore Policy +check:output=~Ambient Temp +end + +start:rvitals_noderange_err +arch:ppc64le +hcp:ipmi +cmd:rvitals testnode +check:rc!=0 +check:output=~Error +end diff --git a/xCAT-test/autotest/testcase/updatenode/cases2 b/xCAT-test/autotest/testcase/updatenode/cases2 new file mode 100644 index 000000000..9ba8c73e5 --- /dev/null +++ b/xCAT-test/autotest/testcase/updatenode/cases2 @@ -0,0 +1,21 @@ +start:updatenode_S +cmd:updatenode $$CN -S >/tmp/updatenode.S.out +cmd:grep 'Running of Software Maintenance has completed' /tmp/updatenode.S.out +check:rc==0 +end + +start:updatenode_S_gcc +cmd:lsdef $$CN -i provmethod | tail -n 1 | cut -d= -f2 | xargs lsdef -t osimage -i pkglist | tail -n 1 | cut -d= -f2 >/tmp/pkglist.filename +cmd:mv `cat /tmp/pkglist.filename` `cat /tmp/pkglist.filename`.save +cmd:cp `cat /tmp/pkglist.filename`.save `cat /tmp/pkglist.filename` +cmd:echo gcc >>`cat /tmp/pkglist.filename` +cmd:updatenode $$CN -S >/tmp/updatenode.S.out +cmd:grep 'postscript: ospkgs exited with code 0' /tmp/updatenode.S.out +check:rc==0 +cmd:grep 'Running of Software Maintenance has completed' /tmp/updatenode.S.out +check:rc==0 +cmd:mv `cat /tmp/pkglist.filename`.save `cat /tmp/pkglist.filename` +cmd:rm -f /tmp/pkglist.filename +cmd:xdsh $$CN '(rpm -qa || dpkg -l) | grep gcc' | grep gcc +check:rc==0 +end diff --git a/xCAT-test/autotest/testcase/xdcp/cases0 b/xCAT-test/autotest/testcase/xdcp/cases0 index efaa943df..b23b1c647 100644 --- a/xCAT-test/autotest/testcase/xdcp/cases0 +++ b/xCAT-test/autotest/testcase/xdcp/cases0 @@ -10,7 +10,6 @@ check:output=~Version end start:xdcp_src_dst -stop:yes cmd:xdsh $$CN rm -f /tmp/hosts cmd:xdcp $$CN /etc/hosts /tmp/hosts check:rc==0 diff --git a/xCAT/postscripts/configbond b/xCAT/postscripts/configbond index f80aee336..f2567193a 100755 --- a/xCAT/postscripts/configbond +++ b/xCAT/postscripts/configbond @@ -242,7 +242,7 @@ fi # add bonding driver alias for echo "alias $str_bond_name bonding" > /etc/modprobe.d/$str_bond_name.conf -# Bring down the salve devices first +# Bring down the slave devices first for slave in ${str_bond_name} ${array_bond_slaves[*]}; do $(ifdown $slave &>/dev/null) done diff --git a/xCAT/postscripts/configefi b/xCAT/postscripts/configefi index 2ab49bdfa..2473d9c0b 100644 --- a/xCAT/postscripts/configefi +++ b/xCAT/postscripts/configefi @@ -21,7 +21,7 @@ if [ "$arch" = "x86_64" ]; then elif [ -f "/boot/efi/EFI/redhat/grubx64.efi" ];then efibootmgr -c -l \\EFI\\redhat\\grubx64.efi -L syscloneLinux - boot_root=`df /boot | awk '{print $1}' | tail -n 1` + boot_root=`mount | grep -E ' on\s+/ type ' | awk '{print $1}'` sed -i 's| root=\S*| root='$boot_root' net.ifnames=0|' /boot/efi/EFI/redhat/grub.cfg blkid -c /dev/null |grep UUID|while read str_line @@ -52,10 +52,10 @@ if [ "$arch" = "x86_64" ]; then boot_device='' if [ -f "/etc/systemconfig/systemconfig.conf" ];then #boot_root=`cat /etc/systemconfig/systemconfig.conf | grep ROOTDEV | awk '{print $3}'` - boot_root=`df /boot | awk '{print $1}' | tail -n 1` + boot_root=`mount | grep -E ' on\s+/ type ' | awk '{print $1}'` boot_device=`cat /etc/systemconfig/systemconfig.conf | grep BOOTDEV | awk '{print $3}'` else - boot_root=`df /boot | awk '{print $1}' | tail -n 1` + boot_root=`mount | grep -E ' on\s+/ type ' | awk '{print $1}'` boot_device=`echo $boot_root | sed -e 's/[0-9]*$//'` #str_temp=`mount | awk '{print $1","$3}'` diff --git a/xCAT/postscripts/configeth b/xCAT/postscripts/configeth index 94b3fea5e..51631a977 100755 --- a/xCAT/postscripts/configeth +++ b/xCAT/postscripts/configeth @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash # IBM(c) 2014 EPL license http://www.eclipse.org/legal/epl-v10.html # Internal script used by confignics only. # It configs the Ethernet adpaters on the node @@ -15,11 +15,12 @@ function configipv4(){ str_v4mask=$4 num_v4num=$5 str_extra_params=$6 + str_nic_mtu=$7 #parse the extra parameters if [ "$str_extra_params" != "$str_default_token" ]; then parse_nic_extra_params "$str_extra_params" - fi + fi if [ "$str_os_type" = "sles" ];then str_conf_file="/etc/sysconfig/network/ifcfg-${str_if_name}" @@ -32,7 +33,9 @@ function configipv4(){ echo "STARTMODE=onboot" >> $str_conf_file echo "USERCONTROL=no" >> $str_conf_file echo "_nm_name=static-0" >> $str_conf_file - + if [ "$str_nic_mtu" != "$str_default_token" ]; then + echo "MTU=${str_nic_mtu}" >> $str_conf_file + fi #add extra params i=0 while [ $i -lt ${#array_extra_param_names[@]} ] @@ -48,7 +51,9 @@ function configipv4(){ echo "NETMASK_${num_v4num}=${str_v4mask}" >> $str_conf_file echo "NETWORK_${num_v4num}=${str_v4net}" >> $str_conf_file echo "LABEL_${num_v4num}=${num_v4num}" >> $str_conf_file - + if [ "$str_nic_mtu" != "$str_default_token" ]; then + echo "MTU_${num_v4num}=${str_nic_mtu}" >> $str_conf_file + fi #add extra params i=0 while [ $i -lt ${#array_extra_param_names[@]} ] @@ -77,7 +82,9 @@ function configipv4(){ echo " address ${str_v4ip}" >> $str_conf_file echo " netmask ${str_v4mask}" >> $str_conf_file echo " network ${str_v4net}" >> $str_conf_file - + if [ "$str_nic_mtu" != "$str_default_token" ]; then + echo " mtu ${str_nic_mtu}" >> $str_conf_file + fi #add extra params i=0 while [ $i -lt ${#array_extra_param_names[@]} ] @@ -109,6 +116,10 @@ function configipv4(){ echo "IPADDR=${str_v4ip}" >> $str_conf_file echo "NETMASK=${str_v4mask}" >> $str_conf_file echo "ONBOOT=yes" >> $str_conf_file + if [ "$str_nic_mtu" != "$str_default_token" ]; then + echo "MTU=${str_nic_mtu}" >> $str_conf_file + fi + if [[ ${str_if_name} == [a-zA-Z0-9]*.[0-9]* ]]; then echo "VLAN=yes" >> $str_conf_file fi @@ -408,6 +419,7 @@ elif [ "$1" = "-s" ];then str_inst_ip='' str_inst_mask='' str_inst_gateway='' + str_inst_mtu='' if [ "$str_os_type" = "aix" ];then logger -t xcat -p local4.err "configeth: aix does not support -s flag" @@ -494,7 +506,20 @@ elif [ "$1" = "-s" ];then exit 0 fi - #get extra configration parameters for each nic + str_inst_net=$(v4calcnet $str_inst_ip $str_inst_mask) + num_index=1 + while [ $num_index -le $NETWORKS_LINES ];do + eval str_tmp=\$NETWORKS_LINE$num_index + str_tmp_name=`echo $str_tmp | awk -F'net=' '{print $2}' | awk -F'|' '{print $1}'` + if [ "$str_tmp_name" = "$str_inst_net" ];then + str_inst_mtu=`echo $str_tmp | awk -F'mtu=' '{print $2}' | awk -F'|' '{print $1}'` + break + fi + num_index=$((num_index+1)) + done + + + #get extra configration parameters for each nic #echo "str_inst_nic=$str_inst_nic, str_inst_ip=$str_inst_ip" get_nic_extra_params $str_inst_nic "$NICEXTRAPARAMS" if [ ${#array_nic_params[@]} -gt 0 ]; then @@ -512,6 +537,9 @@ elif [ "$1" = "-s" ];then echo " address ${str_inst_ip}" >> $str_conf_file echo " netmask ${str_inst_mask}" >> $str_conf_file echo " hwaddress ether ${str_inst_mac}" >> $str_conf_file + if [ -n "${str_inst_mtu}" ];then + echo " mtu ${str_inst_mtu}" >> $str_conf_file + fi if [ -n "$str_inst_gateway" ];then echo " gateway $str_inst_gateway" >> $str_conf_file fi @@ -535,6 +563,9 @@ elif [ "$1" = "-s" ];then echo "IPADDR=${str_inst_ip}" >> $str_conf_file echo "NETMASK=${str_inst_mask}" >> $str_conf_file echo "HWADDR=${str_inst_mac}" >> $str_conf_file + if [ -n "${str_inst_mtu}" ];then + echo "MTU=${str_inst_mtu}" >> $str_conf_file + fi echo "STARTMODE=onboot" >> $str_conf_file if [ -n "$str_inst_gateway" ];then grep -i "default" /etc/sysconfig/network/routes @@ -567,6 +598,9 @@ elif [ "$1" = "-s" ];then echo "BOOTPROTO=static" >> $str_conf_file echo "ONBOOT=yes" >> $str_conf_file echo "HWADDR=${str_inst_mac}" >> $str_conf_file + if [ -n "${str_inst_mtu}" ];then + echo "MTU=${str_inst_mtu}" >> $str_conf_file + fi if [ -n "$str_inst_gateway" ];then grep -i "GATEWAY" /etc/sysconfig/network if [ $? -eq 0 ];then @@ -599,7 +633,9 @@ elif [ "$1" = "-s" ];then fi fi fi + ifup $str_inst_nic + exit 0 fi @@ -639,6 +675,7 @@ declare -a array_nic_network_config declare -a array_nic_subnet declare -a array_nic_netmask declare -a array_nic_gateway +declare -a array_nic_mtu #get extra configration parameters for each nic get_nic_extra_params $str_nic_name "$NICEXTRAPARAMS" @@ -696,7 +733,8 @@ while [ $num_index -lt ${#array_nic_ips[*]} ];do str_subnet=`echo $str_line | awk -F'net=' '{print $2}' | awk -F'|' '{print $1}'` str_netmask=`echo $str_line | awk -F'mask=' '{print $2}' | awk -F'|' '{print $1}' | sed 's:^/::'` str_gateway=`echo $str_line | awk -F'gateway=' '{print $2}' | awk -F'|' '{print $1}'` - + str_mtu=`echo $str_line | awk -F'mtu=' '{print $2}' | awk -F'|' '{print $1}'` + if [ ! $str_subnet -o ! $str_netmask ];then logger -t xcat -p local4.err "configeth: subnet or netmask is not defined in network object $str_netname." echo "configeth on $NODE: subnet or netmask is not defined in network object $str_netname." @@ -707,6 +745,7 @@ while [ $num_index -lt ${#array_nic_ips[*]} ];do array_nic_subnet[$num_index]=$str_subnet array_nic_netmask[$num_index]=$str_netmask array_nic_gateway[$num_index]=$str_gateway + array_nic_mtu[$num_index]=$str_mtu echo "$str_gateway" | grep ':' if [ $? -eq 0 ];then str_ipv6_gateway=$str_gateway @@ -945,6 +984,7 @@ else str_subnet=${array_nic_subnet[$num_index]} str_netmask=${array_nic_netmask[$num_index]} str_gateway=${array_nic_gateway[$num_index]} + str_mtu=${array_nic_mtu[$num_index]} if [ $num_index -lt ${#array_nic_params[@]} ]; then str_extra_params=${array_nic_params[$num_index]} else @@ -955,7 +995,11 @@ else if [[ -z "$str_gateway" ]]; then str_gateway=$str_default_token fi - + + if [[ -z "$str_mtu" ]]; then + str_mtu=$str_default_token + fi + if [ ! $str_subnet -o ! $str_netmask ];then num_index=$((num_index+1)) continue @@ -963,7 +1007,7 @@ else if [ `echo $str_ip | grep -E '^([0-9]{1,3}\.){3}[0-9]{1,3}$'` ];then - configipv4 $str_nic_name $str_ip $str_subnet $str_netmask $num_ipv4_index "$str_extra_params" + configipv4 $str_nic_name $str_ip $str_subnet $str_netmask $num_ipv4_index "$str_extra_params" $str_mtu num_ipv4_index=$((num_ipv4_index+1)) elif [ `echo $str_ip | grep -E ":"` ];then configipv6 $str_nic_name $str_ip $str_subnet $str_netmask $num_ipv6_index $num_ipv4_index $str_gateway "$str_extra_params" diff --git a/xCAT/postscripts/confignics b/xCAT/postscripts/confignics index c651ecc1c..41f15db31 100755 --- a/xCAT/postscripts/confignics +++ b/xCAT/postscripts/confignics @@ -202,7 +202,7 @@ if [ "$str_temp" = "mac" ];then else str_inst_nic=`ip -o link | grep -i "$MACADDRESS" | awk '{print $2;}' | sed s/://` fi -elif [ `echo $str_temp | grep -E "e(n|th)[0-9a-z]+"` ];then +elif [ `echo $str_temp | grep -E "e(n|th|m)[0-9a-zA-Z]+"` ];then str_inst_nic=$str_temp fi @@ -236,9 +236,9 @@ fi #do not configure the loopback nic if [ $bool_remove -eq 1 ];then if [ "$str_os_type" = "aix" ];then - str_temp=`ifconfig -a | grep flags | grep -vi loopback | grep -v SALVE | grep -v MASTER | awk -F: {'print $1'}` + str_temp=`ifconfig -a | grep flags | grep -vi loopback | grep -v SLAVE | grep -v MASTER | awk -F: {'print $1'}` else - str_temp=`ip link show | grep -v link | grep -vi loopback | grep -v SALVE | grep -v MASTER | awk {'print $2'} | sed s/://` + str_temp=`ip link show | grep -v link | grep -vi loopback | grep -v SLAVE | grep -v MASTER | awk {'print $2'} | sed s/://` fi old_ifs=$IFS IFS=$'\n' @@ -247,7 +247,7 @@ if [ $bool_remove -eq 1 ];then for str_temp_nic in ${array_nics_temp[@]} do #the nic type should be ethernet - echo $str_temp_nic | grep -E "e(n|th)[0-9a-z]+" + echo $str_temp_nic | grep -E "e(n|th|m)[0-9a-zA-Z]+" if [ $? -ne 0 ];then continue fi diff --git a/xCAT/postscripts/hardeths b/xCAT/postscripts/hardeths index a7c8d01b2..0d51de150 100755 --- a/xCAT/postscripts/hardeths +++ b/xCAT/postscripts/hardeths @@ -46,7 +46,7 @@ network_ipv4calc () echo $NETWORK } -if (cat /etc/os-release |grep -i '^NAME=[ "]*Cumulus Linux[ "]*$' >/dev/null 2>&1); then +if [ -f /etc/os-release ] && (cat /etc/os-release |grep -i '^NAME=[ "]*Cumulus Linux[ "]*$' >/dev/null 2>&1); then osver="cumulus" fi @@ -106,7 +106,21 @@ for nic in `ip link |grep "BROADCAST" |awk '{print $2}' | sed s/://`; do gateway_line="" fi # add info to interfaces file on ubuntu, TBD does unbuntu change to systemd, this will not exist - cat >>/etc/network/interfaces <>/etc/network/interfaces <>/etc/network/interfaces </dev/null 2>&1 ; then +if [ -f /etc/os-release ] && cat /etc/os-release |grep -i -e "^NAME=[ \"']*Cumulus Linux[ \"']*$" >/dev/null 2>&1 ; then #TODO echo "Cumulus OS is not supported yet, nothing to do..." logger -t xcat -p local4.info "Cumulus OS is not supported yet, nothing to do..." diff --git a/xCAT/postscripts/remoteshell b/xCAT/postscripts/remoteshell index c2023426a..5e5805b52 100755 --- a/xCAT/postscripts/remoteshell +++ b/xCAT/postscripts/remoteshell @@ -11,8 +11,8 @@ # id.rsa # # if on the Management Node, exit - -if cat /etc/os-release |grep -i -e "^NAME=[ \"']*Cumulus Linux[ \"']*$" >/dev/null 2>&1 ; then +umask 0077 +if [ -f /etc/os-release ] && cat /etc/os-release |grep -i -e "^NAME=[ \"']*Cumulus Linux[ \"']*$" >/dev/null 2>&1 ; then #TODO echo "Cumulus OS is not supported yet, nothing to do..." logger -t xcat -p local4.info "Cumulus OS is not supported yet, nothing to do..." @@ -149,7 +149,7 @@ if [ $? -ne 0 ]; then getcredentials.awk ssh_dsa_hostkey | grep -v '<'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /etc/ssh/ssh_host_dsa_key MYCONT=`cat /etc/ssh/ssh_host_dsa_key` done - chmod 600 /etc/ssh/ssh_host_dsa_key + egrep -i "^ssh_keys:" /etc/group >/dev/null 2>&1 && chown root:ssh_keys /etc/ssh/ssh_host_dsa_key 2>/dev/null && chmod 640 /etc/ssh/ssh_host_dsa_key if ! grep "PRIVATE KEY" /etc/ssh/ssh_host_dsa_key > /dev/null 2>&1 ; then rm /etc/ssh/ssh_host_dsa_key else @@ -215,13 +215,13 @@ if [ $? -ne 0 ]; then getcredentials.awk ssh_rsa_hostkey | grep -v '<'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /etc/ssh/ssh_host_rsa_key MYCONT=`cat /etc/ssh/ssh_host_rsa_key` done - chmod 600 /etc/ssh/ssh_host_rsa_key + egrep -i "^ssh_keys:" /etc/group >/dev/null 2>&1 && chown root:ssh_keys /etc/ssh/ssh_host_rsa_key 2>/dev/null && chmod 640 /etc/ssh/ssh_host_rsa_key if ! grep "PRIVATE KEY" /etc/ssh/ssh_host_rsa_key > /dev/null 2>&1 ; then rm /etc/ssh/ssh_host_rsa_key else ssh-keygen -y -f /etc/ssh/ssh_host_rsa_key > /etc/ssh/ssh_host_rsa_key.pub - chmod 644 /etc/ssh/ssh_host_rsa_key.pub - chown root /etc/ssh/ssh_host_rsa_key.pub + chmod 644 /etc/ssh/ssh_host_rsa_key.pub + chown root /etc/ssh/ssh_host_rsa_key.pub fi else #This is an error message @@ -286,7 +286,7 @@ if ssh-keygen -t ecdsa -f /tmp/ecdsa_key -P "" &>/dev/null ; then getcredentials.awk ssh_ecdsa_hostkey | grep -v '<'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /etc/ssh/ssh_host_ecdsa_key MYCONT=`cat /etc/ssh/ssh_host_ecdsa_key` done - chmod 600 /etc/ssh/ssh_host_ecdsa_key + egrep -i "^ssh_keys:" /etc/group >/dev/null 2>&1 && chown root:ssh_keys /etc/ssh/ssh_host_ecdsa_key 2>/dev/null && chmod 640 /etc/ssh/ssh_host_ecdsa_key if ! grep "PRIVATE KEY" /etc/ssh/ssh_host_ecdsa_key > /dev/null 2>&1 ; then rm /etc/ssh/ssh_host_ecdsa_key else @@ -315,7 +315,7 @@ if [[ $NTYPE = service ]]; then cp /etc/ssh/ssh* /etc/xcat/hostkeys/. fi -umask 0077 + # This is where we start getting root ssh keys # This tells credentials.pm where to get the root .ssh keys. If no zone then old path of ~.ssh #rootsshpvtkey=ssh_root_key:$zonename diff --git a/xCAT/postscripts/syncfiles b/xCAT/postscripts/syncfiles old mode 100644 new mode 100755 index 0875a5388..1074fe389 --- a/xCAT/postscripts/syncfiles +++ b/xCAT/postscripts/syncfiles @@ -7,7 +7,14 @@ # ##################################################### -if cat /etc/os-release |grep -i -e "^NAME=[ \"']*Cumulus Linux[ \"']*$" >/dev/null 2>&1 ; then +#statelite does not support syncfiles +if [ -d /.statelite ]; then + echo "Statelite does not support syncfiles, nothing to do..." + logger -t xcat -p local4.info "Statelite does not support syncfiles, nothing to do..." + exit 0 +fi + +if [ -f /etc/os-release ] && cat /etc/os-release |grep -i -e "^NAME=[ \"']*Cumulus Linux[ \"']*$" >/dev/null 2>&1 ; then #TODO echo "Cumulus OS is not supported yet, nothing to do..." logger -t xcat -p local4.info "Cumulus OS is not supported yet, nothing to do..." @@ -38,6 +45,7 @@ xcatpostdir="/xcatpost" logger -t xcat -p local4.info "$0: the OS name = $osname" quit="no" count=5 +returncode=0 while [ $quit = "no" ]; do if [ $osname = "Linux" ] then @@ -66,5 +74,4 @@ else logger -t xcat -p local4.err "$0: Perform Syncing File action encountered error" fi -exit 0 - +[ $returncode -eq 0 ] diff --git a/xCAT/postscripts/syslog b/xCAT/postscripts/syslog index d55364e00..8705aa168 100755 --- a/xCAT/postscripts/syslog +++ b/xCAT/postscripts/syslog @@ -149,7 +149,9 @@ config_rsyslog_V8() remoteconf="/etc/rsyslog.d/remote.conf" #for Cumulus OS inside ONIE switches - cat /etc/os-release |grep -i -e "^NAME=[ \"']*Cumulus Linux[ \"']*$" >/dev/null 2>&1 && remoteconf="/etc/rsyslog.d/99-syslog.conf" + if [ -f /etc/os-release ]; then + cat /etc/os-release |grep -i -e "^NAME=[ \"']*Cumulus Linux[ \"']*$" >/dev/null 2>&1 && remoteconf="/etc/rsyslog.d/99-syslog.conf" + fi # If this is a Management Node or Service Node, then it will be receiving syslog entries from the # compute nodes. Management Node is receiving from Service Nodes and possibly compute nodes. diff --git a/xCAT/postscripts/xcatinstallpost b/xCAT/postscripts/xcatinstallpost index 598cb93d4..de68037f0 100755 --- a/xCAT/postscripts/xcatinstallpost +++ b/xCAT/postscripts/xcatinstallpost @@ -84,6 +84,9 @@ if [ -z "$CNS" ] || [[ "$CNS" =~ ^(1|yes|y)$ ]]; then echo " +[ -f /opt/xcat/xcatinfo ] && grep 'POSTSCRIPTS_RC=1' /opt/xcat/xcatinfo >/dev/null 2>&1 && return_value=1 + + if [ \"\$return_value\" -eq \"0\" ]; then if [ \"\$XCATDEBUGMODE\" = \"1\" ] || [ \"\$XCATDEBUGMODE\" = \"2\" ]; then msgutil_r \"\$MASTER_IP\" \"info\" \"node booted, reporting status...\" \"/var/log/xcat/xcat.log\" @@ -99,6 +102,7 @@ fi " >> /xcatpost/mypostscript.post fi + chmod +x /xcatpost/mypostscript.post if [ -x /xcatpost/mypostscript.post ];then msgutil_r "$MASTER_IP" "info" "running /xcatpost/mypostscript.post" "/var/log/xcat/xcat.log"