2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-05-09 02:00:10 +00:00

Merge tag '2.14.2' into lenovobuild2.14

xCAT 2.14.2 release
This commit is contained in:
Jarrod Johnson
2018-08-08 17:56:37 -04:00
227 changed files with 3089 additions and 3135 deletions
+2
View File
@@ -8,6 +8,8 @@ Documentation
Latest xCAT documentation is available at: http://xcat-docs.readthedocs.io/en/latest/
`document for xCAT 2.14.1 <http://xcat-docs.readthedocs.io/en/2.14.1/>`_
`document for xCAT 2.14 <http://xcat-docs.readthedocs.io/en/2.14.0/>`_
`document for xCAT 2.13.11 <http://xcat-docs.readthedocs.io/en/2.13.11/>`_
+1 -1
View File
@@ -1 +1 @@
2.14.1
2.14.2
+3 -3
View File
@@ -69,7 +69,7 @@ for i in $*; do
done
# Supported distributions
dists="saucy trusty utopic xenial"
dists="saucy trusty utopic xenial bionic"
c_flag= # xcat-core (trunk-delvel) path
d_flag= # xcat-dep (trunk) path
@@ -335,7 +335,7 @@ __EOF__
echo "GPGSIGN=$GPGSIGN specified, the repo will not be signed"
echo "" >> conf/distributions
else
echo "SignWith: yes" >> conf/distributions
echo "SignWith: 5619700D" >> conf/distributions
echo "" >> conf/distributions
fi
done
@@ -462,7 +462,7 @@ __EOF__
echo "GPGSIGN=$GPGSIGN specified, the repo will not be signed"
echo "" >> conf/distributions
else
echo "SignWith: yes" >> conf/distributions
echo "SignWith: 5619700D" >> conf/distributions
echo "" >> conf/distributions
fi
@@ -14,15 +14,15 @@ It's recommenteed to create a non root user to use to connect to confetty
#. Create a non-root user on the management node: ::
useradd -m vhu
useradd -m xcat
#. As root, create a non-root user in confetty: ::
/opt/confluent/bin/confetty create users/vhu
/opt/confluent/bin/confetty create users/xcat
#. Set the password for the non-root user: ::
/opt/confluent/bin/confetty set users/vhu password="mynewpassword"
/opt/confluent/bin/confetty set users/xcat password="mynewpassword"
password="********"
@@ -40,13 +40,19 @@ If you want to use the xCAT Keys, you can simple copy them into ``/etc/confluent
cp /etc/xcat/cert/server-key.pem /etc/confluent/privkey.pem
cp /etc/xcat/cert/server-cert.pem /etc/confluent/srvcert.pem
The user and password may alternatively be provided via environment variables: ::
CONFLUENT_USER=xcat
CONFLUENT_PASSPHRASE="mynewpassword"
export CONFLUENT_USER CONFLUENT_PASSPHRASE
Start confetty, specify the server IP address: ::
confetty -s 127.0.0.1
confetty -s <remote_ip>
If you want to run a confluent command against another host, could set the CONFLUENT_HOST variable: ::
TODO: Add text for exporting user/pass into environment
CONFLUENT_HOST=<remote_ip>
export CONFLUENT_HOST
@@ -2,33 +2,11 @@
Getting Started
===============
For xCAT 2.9.1 and later, confluent is intended to be used in conjunction with xCAT.
Confluent is intended to be used in conjunction with xCAT.
The following documentation assumes that xCAT is already installed and configured on the management node.
Download
========
confluent
---------
rpms
~~~~
The latest confluent rpms are built and provided for your convenience: `confluent rpms <http://xcat.org/files/confluent/confluent/rpms/>`_. However, the rpms are not built on a regular release schedule. To use the latest code base, consider building the rpms from :ref:`label_confluent_source`.
The following example downloads the confluent tar package and creates a local repository on your management node::
mkdir ~/confluent
cd ~/confluent
wget https://path-to-confluent/confluent-X.X-repo.tbz2
tar jxvf confluent-X.X-repo.tbz2
cd confluent-X.X
./mklocalrepo.sh
.. _label_confluent_source:
source
~~~~~~
Download confluent
==================
To build from source, ensure your machine has the correct development packages to build rpms, then execute the following:
@@ -42,33 +20,26 @@ To build from source, ensure your machine has the correct development packages t
cd confluent/confluent_client ; ./buildrpm ; cd -
confluent-dep
-------------
The latest confluent dependency packages are provided for your convenience: `confluent-deps <http://xcat.org/files/confluent/confluent-dep/>`_
The following example describes the steps for **rhels7.1** on **ppc64le**::
mkdkir ~/confluent
cd ~/confluent
wget https://path/to/confluent-dep/rh7/ppc64le/confluent-dep-rh7-ppc64le.tar.bz2
tar -jxvf confluent-dep-rh7-ppc64le.tar.bz2
cd confluent-dep-rh7-ppc64le/
./mklocalrepo.sh
.. note:: If the OS/architecture you are looking for is not provided under confluent-dep, send an email to the xcat-user mailing list: xcat-user@lists.sourceforge.net
Install
=======
*confluent and confluent-deps must be downloaded to the management node before installing*
dependency
----------
xCAT 2.9.1 began shipping a new rpm ``xCAT-confluent``.
The following example describes the steps for **rhels7.5** on **ppc64le**::
Installing ``xCAT-confluent`` via yum will pull in the confluent dependencies::
yum install libffi-devel.ppc64le
yum install openssl-devel
pip install crypto pyasn1 pycrypto eventlet pyparsing netifaces scrapy pysnmp paramiko pyghmi pyte
yum install xCAT-confluent
confluent
---------
Installing ``xCAT-confluent`` via rpm::
rpm -ivh /root/rpmbuild/RPMS/noarch/confluent_server-*.noarch.rpm --nodeps
rpm -ivh /root/rpmbuild/RPMS/noarch/confluent_client-*.noarch.rpm --nodeps
You may find it helpful to add the confluent paths into your system path::
@@ -76,6 +47,7 @@ You may find it helpful to add the confluent paths into your system path::
export PATH=$CONFLUENTROOT/bin:$PATH
export MANPATH=$CONFLUENTROOT/share/man:$MANPATH
Configuration
=============
@@ -92,7 +64,8 @@ To stop confluent::
If you want confluent daemon to start automatically at bootup, add confluent service to ``chkconfig``::
chkconfig --add confluent
chkconfig confluent on
Replacing conserver with confluent
----------------------------------
@@ -111,11 +84,6 @@ Use ``rcons`` as before to start the console session.::
rcons <singlenode>
# If using confluent, a timestamp will be shown on the
# console title next to the node name
<singlenode> [15:05]
Web Browser access
==================
@@ -124,31 +92,29 @@ Confluent-api and confluent-consoles are able to be accessed from the browser.
It is **highly** recommended that you create a non-root user to access the sessions::
Create the non-root user on the management node
# useradd -m vhu
# useradd -m xcat
Create a non-root user in confetty
# /opt/confluent/bin/confetty create users/vhu
# /opt/confluent/bin/confetty create users/xcat
Set the password for the non-root user
# /opt/confluent/bin/confetty set users/vhu password="mynewpassword"
# /opt/confluent/bin/confetty set users/xcat password="mynewpassword"
password="********"
Rest Explorer
=============
TODO: some intro text
Configure the httpd configuration for confluent-api by creating a ``confluent.conf`` file under ``/etc/httpd/conf.d/`` directory::
The example uses server ip: 10.2.5.3 and port 4005
cat /etc/httpd/conf.d/confluent.conf
# cat /etc/httpd/conf.d/confluent.conf
LoadModule proxy_http_module modules/mod_proxy_http.so
<Location /confluent-api>
ProxyPass http://10.2.5.3:4005
</Location>
#restart httpd
# restart httpd
service httpd restart
Now point your browser to: ``http://<server ip>:<port>`` and log in with the non-root user and password created above.
@@ -136,6 +136,15 @@ Here is an example about how to store a MD5 encrypted password for root in ``pas
tabch key=system passwd.username=root passwd.password=`openSSL passwd -1 <password>`
During the provisioning, the root password will be set on the compute nodes. By default, xCAT stores the encrypted hash of password into installation files directly for better performance.
For example, ``/etc/shadow`` in stateless image for stateless nodes or installation files ( ``/install/autoinst/<node>`` ) for stateful nodes.
You can enable **secureroot** feature for more secure consideration. ::
chdef -t site secureroot=1
Then, after the new ``packimage`` or ``nodeset`` command, the root password hash can only be acquired on-the-fly with strict security control.
Nodes Inter-Access in The Cluster
+1 -1
View File
@@ -59,7 +59,7 @@ author = u'IBM Corporation'
# The short X.Y version.
version = '2'
# The full version, including alpha/beta/rc tags.
release = '2.14.1'
release = '2.14.2'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -3,7 +3,7 @@ Select or Create an osimage Definition
Before creating an image on xCAT, the distro media should be prepared ahead. That can be ISOs or DVDs.
XCAT use 'copycds' command to create an image which will be available to install nodes. "copycds" will copy all contents of Distribution DVDs/ISOs or Service Pack DVDs/ISOs to a destination directory, and create several relevant osimage definitions by default.
XCAT use 'copycds' command to create an image which will be available to install nodes. ``copycds`` will copy all contents of Distribution DVDs/ISOs or Service Pack DVDs/ISOs to a destination directory, and create several relevant osimage definitions by default.
If using an ISO, copy it to (or NFS mount it on) the management node, and then run: ::
@@ -81,15 +81,16 @@ In this way, if you need to install some additional RPMs into your MN later, you
**[Tips 2]**
You can create/modify an osimage definition easily based on the default osimage definition. The general steps are:
You can create/modify an osimage definition easily with any existing osimage definition, the command is ::
mkdef -t osimage -o <new osimage> --template <existing osimage> [<attribute>=<value>, ...]
* lsdef -t osimage -z <os>-<arch>-install-compute > <filename>.stanza
* modify <filename>.stanza according to your requirements
* cat <filename>.stanza| mkdef -z
Except the specified attributes *<attribute>*, the attributes of *<new osimage>* will inherit the values of template osimage *<existing osimage>*.
For example, if you need to change the osimage name to your favorite name, this command may be helpful: ::
As an example, the following command creates a new osimage "myosimage.rh7.compute.netboot" based on the existing osimage "rhels7.4-ppc64le-netboot-compute" with some customized attributes ::
mkdef -t osimage -o myosimage.rh7.compute.netboot --template rhels7.4-ppc64le-netboot-compute synclists=/tmp/synclist otherpkgdir=/install/custom/osimage/myosimage.rh7.compute.netboot/3rdpkgs/ otherpkglist=/install/custom/osimage/myosimage.rh7.compute.netboot/3rd.pkglist
chdef -t osimage rhels6.2-x86_64-install-compute -n rhels6.2_myimage
@@ -29,3 +29,32 @@ The manually defined node will be like this::
postbootscripts=otherpkgs
postscripts=syslog,remoteshell,syncfiles
primarynic=mac
``mkdef --template`` can be used to create node definitions easily from the typical node definition templates or existing node definitions, some examples:
* creating node definition "cn2" with an existing node definition "cn1" ::
# mkdef -t node -o cn2 --template cn1 mac=66:55:44:33:22:11 ip=172.12.139.2 bmc=172.11.139.2
1 object definitions have been created or modified.
except the attributes specified(``mac``, ``ip`` and ``bmc`` attribute here), other attibutes of the newly created node "cn2" inherit the values of template node "cn1"
* creating a node definition "cn2" with the template "ppc64le-openbmc-template"(openbmc controlled ppc64le node) shipped by xCAT ::
# mkdef -t node -o cn2 --template ppc64le-openbmc-template mac=66:55:44:33:22:11 ip=172.12.139.2 bmc=172.11.139.2 bmcpassword=USERID bmcusername=PASSW0RD
1 object definitions have been created or modified.
the unspecified attributes of newly created node "cn2" will be assigned with the default values in the template
to list all the node definition templates available in xCAT, run ::
# lsdef -t node --template
to display the full definition of template "ppc64le-openbmc-template", run ::
# lsdef -t node --template ppc64le-openbmc-template
the mandatory attributes, which must be specified while creating definitions with templates, are denoted with the value ``MANDATORY:<attribute description>`` in template definition.
the optional attributes, which can be specified optionally, are denoted with the value ``OPTIONAL:<attribute description>`` in template definition
@@ -19,7 +19,7 @@ Name
****************
\ **nodestat**\ [\ *noderange*\ ] [\ **-m | -**\ **-usemon**\ ] [\ **-p | -**\ **-powerstat**\ ] [\ **-f**\ ] [\ **-u | -**\ **-updatedb**\ ]
\ **nodestat**\ [\ *noderange*\ ] [\ **-m | -**\ **-usemon**\ ] [\ **-p | -**\ **-powerstat**\ ] [\ **-f | -**\ **-usefping**\ ] [\ **-u | -**\ **-updatedb**\ ]
\ **nodestat**\ [\ **-h | -**\ **-help | -v | -**\ **-version**\ ]
@@ -86,7 +86,7 @@ For the command specified by 'dcmd', no input is needed, the output can be a str
\ **-f**\
\ **-f | -**\ **-usefping**\
Uses fping instead of nmap even if nmap is available. If you seem to be having a problem with false negatives, fping can be more forgiving, but slower.
@@ -35,7 +35,7 @@ multiple read-only instances of the console, plus console logging.
If \ *conserver-host*\ is specified, the conserver daemon on that host will be contacted, instead of on the local host.
To exit the console session, enter: <ctrl>e c .
To exit the console session, enter: 'ctrl-e c .' (3 characters: ctrl-e, 'c' and '.').
***************
@@ -295,6 +295,9 @@ site Attributes:
for each node, and put them in a directory of tftpdir(such as: /tftpboot)
If no, it will not generate the mypostscript file in the tftpdir.
secureroot: If set to 1, xCAT will use secure mode to transfer root password hash
during the installation. Default is 0.
setinstallnic: Set the network configuration for installnic to be static.
sharedtftp: Set to 0 or no, xCAT should not assume the directory
+6
View File
@@ -14,6 +14,12 @@ xCAT 2.14.x
|xCAT |New OS |New |New Feature |
|Version | |Hardware | |
+=================================+===============+=============+==================================+
|| xCAT 2.14.2 2018/7/13 |- ubuntu18.04 | | |
|| | | | |
| `2.14.2 Release Notes <https:// | | | |
| github.com/xcat2/xcat-core/wiki | | | |
| /XCAT_2.14.2_Release_Notes>`_ | | | |
+---------------------------------+---------------+-------------+----------------------------------+
|| xCAT 2.14.1 |- RHV4.2 + | |- OpenBMC in python enhance: |
|| 2018/6/1 | RHEL7.5 + p8 | | |
|| | | | rinv enhance,issue #5176 |
@@ -8,5 +8,4 @@ A new RPM is created that contains the Python code: ``xCAT-openbmc-py``. The Py
:maxdepth: 2
rpm.rst
pip.rst
disable.rst
@@ -1,22 +0,0 @@
Using pip
=========
A alternative method for installing the Python dependencies is using ``pip``.
#. Download ``pip`` using one of the following methods:
#. ``pip`` is provided in the EPEL repo as: ``python2-pip``
#. Follow the instructions to install from here: https://pip.pypa.io/en/stable/installing/
#. Use ``pip`` to install the following Python libraries: ::
pip install gevent docopt requests paramiko scp
#. Install ``xCAT-openbmc-py`` using ``rpm`` with ``--nodeps``: ::
cd xcat-core
rpm -ihv xCAT-openbmc-py*.rpm --nodeps
@@ -0,0 +1,206 @@
.. _ha_mgmt_node_with_shared_data:
HA Solution Overview
====================
While a xCAT management node ``xcatmn1`` is running as a primary management node, another node - ``xcatmn2`` can be configured to act as primary management node in case ``xcatmn1`` becomes unavailable. The process is manual and requires disabling primary ``xcatmn1`` and activating backup ``xcatmn2``. Both nodes require access to shared storage described below. Use of Virtual IP is also requred.
An interactive sample script `xcatha.py <https://github.com/xcat2/xcat-extensions/blob/master/HA/xcatha.py>`_ is availabe to guide through the steps of disabling and activation of xCAT management nodes. ``Dryrun`` option in that scrip allows viewing the actions without executing them.
Configure and Activate Primary xCAT Management Node
===================================================
Disable And Stop All Related Services on Primary xCAT Management Node
`````````````````````````````````````````````````````````````````````
Before configuring Virtual IP and shared data, make sure to stop related services. Since primary management node may become unavailable at any time, all related services should be configured to not auto start at boot time.
Use ``xcatha.py -d`` to disable and stop all related services: ::
./xcatha.py -d
2018-06-22 03:43:51,600 - INFO - [xCAT] Shutting down services:
... goconserver
... conserver
... ntpd
... dhcpd
... named
... xcatd
... postgresql
Continue? [[Y]es/[N]o/[D]ryrun]:
Y
... ...
[xCAT] Disabling services from starting on reboot:
... goconserver
... conserver
... ntpd
... dhcpd
... named
... xcatd
... postgresql
Continue? [[Y]es/[N]o/[D]ryrun]:
Y
Configure Virtual IP
````````````````````
Existing xCAT management node IP should be configured as Virtual IP address, the Virtual IP address should be non-persistent, it needs to be re-configured right after the management node is rebooted. This non-persistent Virtual IP address is designed to avoid ip address conflict when the original primary management node is recovered with this Virtual IP address configured. Since the Virtual IP is non-persistent, the network interface should have a persistent IP address.
#. Configure another IP on primary management node for network interface as static IP, for example, ``10.5.106.70``:
#. Configure ``10.5.106.70`` as static IP::
ip addr add 10.5.106.70/8 dev eth0
#. Edit ``ifcfg-eth0`` file as::
DEVICE="eth0"
BOOTPROTO="static"
NETMASK="255.0.0.0"
IPADDR="10.5.106.70"
ONBOOT="yes"
#. If want to take new static ip effect immediately, login ``xcatmn1`` using ``10.5.106.70``, and restart network service, then add original static IP on primary management node ``10.5.106.7`` as Virtual IP ::
ssh 10.5.106.70 -l root
service network restart
ip addr add 10.5.106.7/8 brd + dev eth0 label eth0:0
#. Add ``10.5.106.70`` into ``postgresql`` configuration file on primary management node
#. Add ``10.5.106.70`` into ``/var/lib/pgsql/data/pg_hba.conf``::
host all all 10.5.106.7/32 md5
#. Add ``10.5.106.70`` into ``listen_addresses`` variable in ``/var/lib/pgsql/data/postgresql.conf``::
listen_addresses = 'localhost,10.5.106.7,10.5.106.70'
#. Modify provision network entry ``mgtifname`` as ``eth0:0`` on primary management node::
tabedit networks
"10_0_0_0-255_0_0_0","10.0.0.0","255.0.0.0","eth0:0","10.0.0.103",,"<xcatmaster>",,,,,,,,,,,"1500",,
Configure Shared Data
`````````````````````
The following xCAT directory structure should be accessible from primary xCAT management node::
/etc/xcat
/install
~/.xcat
/var/lib/pgsql
/tftpboot
Synchronize ``/etc/hosts``
``````````````````````````
Since the ``/etc/hosts`` is used by xCAT commands, the ``/etc/hosts`` should be synchronized between the primary management node and bakup management node.
Synchronize Clock
`````````````````
It is recommended that the clocks are synchrinized between the primary management node and bakup management node.
Activate Primary xCAT Management Node
`````````````````````````````````````
Use ``xcatha.py`` interactive activate ``xcatmn1``::
./xcatha.py -a
[Admin] Verify VIP 10.5.106.7 is configured on this node
Continue? [[Y]es/[N]o]:
Y
[Admin] Verify that the following is configured to be saved in shared storage and accessible from this node:
... /install
... /etc/xcat
... /root/.xcat
... /var/lib/pgsql
... /tftpboot
Continue? [[Y]es/[N]o]:
Y
[xCAT] Starting up services:
... postgresql
... xcatd
... named
... dhcpd
... ntpd
... conserver
... goconserver
Continue? [[Y]es/[N]o/[D]ryrun]:
Y
2018-06-24 22:13:09,428 - INFO - ===> Start all services stage <===
2018-06-24 22:13:10,559 - DEBUG - systemctl start postgresql [Passed]
2018-06-24 22:13:13,298 - DEBUG - systemctl start xcatd [Passed]
domain=cluster.com
2018-06-24 22:13:13,715 - DEBUG - lsdef -t site -i domain|grep domain [Passed]
Handling bybc0607 in /etc/hosts.
Handling localhost in /etc/hosts.
Handling bybc0609 in /etc/hosts.
Handling localhost in /etc/hosts.
Getting reverse zones, this may take several minutes for a large cluster.
Completed getting reverse zones.
Updating zones.
Completed updating zones.
Restarting named
Restarting named complete
Updating DNS records, this may take several minutes for a large cluster.
Completed updating DNS records.
DNS setup is completed
2018-06-24 22:13:17,320 - DEBUG - makedns -n [Passed]
Renamed existing dhcp configuration file to /etc/dhcp/dhcpd.conf.xcatbak
Warning: No dynamic range specified for 10.0.0.0. If hardware discovery is being used, a dynamic range is required.
2018-06-24 22:13:17,811 - DEBUG - makedhcp -n [Passed]
2018-06-24 22:13:18,746 - DEBUG - makedhcp -a [Passed]
2018-06-24 22:13:18,800 - DEBUG - systemctl start ntpd [Passed]
2018-06-24 22:13:19,353 - DEBUG - makeconservercf [Passed]
2018-06-24 22:13:19,449 - DEBUG - systemctl start conserver [Passed]
Activate Backup xCAT Management Node to be Primary Management Node
==================================================================
#. Install xCAT on backup xCAT management node ``xcatmn2`` with local disk
#. Switch to ``PostgreSQL`` database
#. Disable and deactivate services using ``xcatha.py -d`` on both ``xcatmn2`` and ``xcatmn1``
#. Remove Virtual IP from primary xCAT Management Node ``xcatmn1``::
ip addr del 10.5.106.7/8 dev eth0:0
#. Configure Virtual IP on ``xcatmn2``
#. Add Virtual IP into ``/etc/hosts`` file ::
10.5.106.7 xcatmn1 xcatmn1.cluster.com
#. Connect the following xCAT directories to shared data on ``xcatmn2``::
/etc/xcat
/install
~/.xcat
/var/lib/pgsql
/tftpboot
#. Add static management node network interface IP ``10.5.106.5`` into ``PostgreSQL`` configuration file
#. Add ``10.5.106.5`` into ``/var/lib/pgsql/data/pg_hba.conf``::
host all all 10.5.106.5/32 md5
#. Add ``10.5.106.5`` into ``listen_addresses`` variable in ``/var/lib/pgsql/data/postgresql.conf``::
listen_addresses = 'localhost,10.5.106.7,10.5.106.70,10.5.105.5'
#. Use ``xcatha.py -a`` to start all related services on ``xcatmn2``
#. Modify provision network entry ``mgtifname`` as ``eth0:0``::
tabedit networks
"10_0_0_0-255_0_0_0","10.0.0.0","255.0.0.0","eth0:0","10.0.0.103",,"<xcatmaster>",,,,,,,,,,,"1500",,
Unplanned failover: primary xCAT management node is not accessible
``````````````````````````````````````````````````````````````````
If primary xCAT management node becomes not accessible before being deactivated and backup xCAT management node is activated, it is recommended that the primary node is disconnected from the network before being rebooted. This will ensure that when services are started on reboot, they do not interfere with the same services running on the backup xCAT management node.
@@ -0,0 +1,7 @@
HA
==
.. toctree::
:maxdepth: 2
ha_mgmt_node_with_shared_data.rst
+2 -1
View File
@@ -8,6 +8,7 @@ CORAL stands for Collaboration of Oak Ridge, Argonne, and Livermore and is solut
:maxdepth: 2
cluster_mgmt/index.rst
known_issues/index.rst
known_issues/index.rst
ha/index.rst
.. mn/index.rst
.. discovery/index.rst
@@ -0,0 +1,21 @@
2018-06-12 - OpenSSL Vulnerabilities
====================================
*Jun 12, 2018*, OpenSSL announced the following security advisories: https://www.openssl.org/news/secadv/20180612.txt
Advisory CVEs
-------------
* CVE-2018-0732 - **Client DoS due to large DH parameter** (Severity: Low)
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.
+7
View File
@@ -0,0 +1,7 @@
2018 Notices
============
.. toctree::
:maxdepth: 1
20180612_openssl.rst
+1
View File
@@ -4,6 +4,7 @@ Security Notices
.. toctree::
:maxdepth: 2
2018/index.rst
2017/index.rst
2016/index.rst
2015/index.rst
-1
View File
@@ -13,7 +13,6 @@ function xcat_probe_copy {
# xCAT-probe uses some functions shipped with xCAT, copying for the following reasons:
# 1. make xCAT-probe code be self-contained
# 2. do not maintain two files for each script
# 3. symbolic link can't work during packaging
RPMNAME=${1}
if [ $RPMNAME = "xCAT-probe" ]; then
mkdir -p ${RPMNAME}/lib/perl/xCAT/
+31 -16
View File
@@ -1132,14 +1132,18 @@ sub handle_response {
}
my $msgsource = "";
$msgsource = $rsp->{xcatdsource}->[0] if ($rsp->{xcatdsource});
# To determine if the INFO msg need to be added with source server name. For ERROR/WARN, it always is shown.
my $showsource = 0;
if ($rsp->{host}) {
$showsource = 1;
}
if ($ENV{'XCATSHOWSVR'}) {
unless ($rsp->{NoSvrPrefix}) { # some plugins could disable the prefix forcely by seting the flag in response.
$msgsource = $rsp->{xcatdsource}->[0] if ($rsp->{xcatdsource});
$showsource = 1;
}
}
if ($rsp->{host}) {
$msgsource = $rsp->{xcatdsource}->[0] if ($rsp->{xcatdsource});
}
#print "in handle_response\n";
# Handle errors
@@ -1160,14 +1164,14 @@ sub handle_response {
if (ref($rsp->{error}) eq 'ARRAY') {
foreach my $text (@{ $rsp->{error} }) {
my $desc = "$text";
$desc = "[$msgsource]: $desc" if ($msgsource && $desc);
$desc = "[$msgsource]: $desc" if ($desc && $msgsource);
$desc = "Error: $desc" unless ($rsp->{NoErrorPrefix});
print STDERR "$desc\n";
}
}
else {
my $desc = $rsp->{error};
$desc = "[$msgsource]: $desc" if ($msgsource && $desc);
$desc = "[$msgsource]: $desc" if ($desc && $msgsource);
$desc = "Error: $desc" unless ($rsp->{NoErrorPrefix});
print STDERR "$desc\n";
}
@@ -1178,14 +1182,14 @@ sub handle_response {
if (ref($rsp->{warning}) eq 'ARRAY') {
foreach my $text (@{ $rsp->{warning} }) {
my $desc = "$text";
$desc = "[$msgsource]: $desc" if ($msgsource && $desc);
$desc = "[$msgsource]: $desc" if ($desc && $msgsource);
$desc = "Warning: $desc" unless ($rsp->{NoWarnPrefix});
print STDERR "$desc\n";
}
}
else {
my $desc = $rsp->{warning};
$desc = "[$msgsource]: $desc" if ($msgsource && $desc);
$desc = "[$msgsource]: $desc" if ($desc && $msgsource);
$desc = "Warning: $desc" unless ($rsp->{NoWarnPrefix});
print STDERR "$desc\n";
}
@@ -1195,13 +1199,13 @@ sub handle_response {
if (ref($rsp->{info}) eq 'ARRAY') {
foreach my $text (@{ $rsp->{info} }) {
my $desc = "$text";
$desc = "[$msgsource]: $desc" if ($msgsource && $desc);
$desc = "[$msgsource]: $desc" if ($showsource && $desc && $msgsource);
print "$desc\n";
}
}
else {
my $desc = $rsp->{info};
$desc = "[$msgsource]: $desc" if ($msgsource && $desc);
$desc = "[$msgsource]: $desc" if ($showsource && $desc && $msgsource);
print "$desc\n";
}
}
@@ -1236,11 +1240,7 @@ sub handle_response {
} else {
$desc = $node->{name};
}
if ($desc) {
$desc = "$desc: [$msgsource]" if ($msgsource);
} else {
$desc = "[$msgsource]" if ($msgsource);
}
if ($node->{errorcode}) {
if (ref($node->{errorcode}) eq 'ARRAY') {
foreach my $ecode (@{ $node->{errorcode} }) {
@@ -1252,14 +1252,29 @@ sub handle_response {
} # assume it is a non-reference scalar
}
if ($node->{error}) {
if ($desc) {
$desc = "$desc: [$msgsource]" if ($msgsource);
} else {
$desc = "[$msgsource]" if ($msgsource);
}
$desc .= ": Error: " . $node->{error}->[0];
$errflg = 1;
}
if ($node->{warning}) {
if ($desc) {
$desc = "$desc: [$msgsource]" if ($msgsource);
} else {
$desc = "[$msgsource]" if ($msgsource);
}
$desc .= ": Warning: " . $node->{warning}->[0];
$errflg = 1;
}
if ($node->{data}) {
if ($desc) {
$desc = "$desc: [$msgsource]" if ($showsource && $msgsource);
} else {
$desc = "[$msgsource]" if ($showsource && $msgsource);
}
if (ref(\($node->{data})) eq 'SCALAR') {
$desc = $desc . ": " . $node->{data};
} elsif (ref($node->{data}) eq 'HASH') {
@@ -1324,7 +1339,7 @@ sub handle_response {
}
}
if ($desc) {
$desc = "[$msgsource]: $desc" if ($msgsource);
$desc = "[$msgsource]: $desc" if ($showsource && $msgsource);
print "$desc\n";
}
}
+74
View File
@@ -804,6 +804,46 @@ sub fork_fanout_dcp
my @dcp_command;
my $rsyncfile;
my %envardict;
foreach my $varstr (split(',',$$target_properties{'envar'})){
if($varstr =~ m/(.*)=(.*)/){
my ($myvar,$myvalue)=($1,$2);
$envardict{$myvar}=$myvalue;
}
}
if(%envardict){
my $dest_srcdict=$$options{'destDir_srcFile'}{$user_target};
for my $dest (keys %{$dest_srcdict}){
my $newdest=$dest;
$newdest=xCAT::Utils->varsubinline($newdest,\%envardict);
for my $label(keys %{$$dest_srcdict{$dest}}){
my $myref;
if('ARRAY' eq ref($$dest_srcdict{$dest}{$label})){
for my $path(@{$$dest_srcdict{$dest}{$label}}){
$path=xCAT::Utils->varsubinline($path,\%envardict);
}
}elsif('HASH' eq ref($$dest_srcdict{$dest}{$label})){
for my $path(keys(%{$$dest_srcdict{$dest}{$label}})){
my $newpath=$path;
$newpath=xCAT::Utils->varsubinline($newpath,\%envardict);
if($newpath ne $path){
$$dest_srcdict{$dest}{$label}{$newpath}=$$dest_srcdict{$dest}{$label}{$path};
delete $$dest_srcdict{$dest}{$label}{$path};
}
}
}
}
if($newdest ne $dest){
$$dest_srcdict{$newdest}=$$dest_srcdict{$dest};
delete $$dest_srcdict{$dest};
}
}
}
if (!$$target_properties{'localhost'}) # this is to a remote host
{
my $target_type = $$target_properties{'type'};
@@ -3293,6 +3333,13 @@ sub bld_resolve_nodes_hash
$rsp->{info}->[0] = "Command: $cmd failed. Continuing...";
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
}
my $ostab = xCAT::Table->new('nodetype');
my %oents = %{ $ostab->getNodesAttribs(\@target_list, [qw(provmethod)]) };
foreach my $target (@target_list)
{
@@ -3306,12 +3353,27 @@ sub bld_resolve_nodes_hash
if (($mname eq $target) || ($localhostname eq $target)) {
$localhost = $target;
}
my $envar=undef;
my $ent = $oents{$target}->[0];
if ($ent and $ent->{provmethod} and \
($ent->{provmethod} ne 'install') and ($ent->{provmethod} ne 'netboot') and ($ent->{provmethod} ne 'statelite')) {
my $imagename = $ent->{provmethod};
my $osimagetab = xCAT::Table->new('osimage', -create => 1);
(my $ref) = $osimagetab->getAttribs({ imagename => $imagename }, 'environvar');
if($ref){
$envar=$ref->{'environvar'};
}
}
my %properties = (
'hostname' => $hostname,
'ip-address' => $ip_address,
'localhost' => $localhost,
'user' => $user,
'context' => $context,
'envar' => $envar,
'unresolved' => $target
);
@@ -4405,6 +4467,7 @@ sub parse_and_run_dcp
$::XCATROOT = "/opt/xcat";
}
# parse the arguments
Getopt::Long::Configure("posix_default");
Getopt::Long::Configure("no_gnu_compat");
@@ -4914,6 +4977,15 @@ sub rsync_to_image
my ($input_file, $image) = @_;
my $rc = 0;
my %osimgenv;
if($ENV{'XCAT_OSIMAGE_ENV'}){
foreach my $myenv(split(',',$ENV{'XCAT_OSIMAGE_ENV'})){
if($myenv =~ /\s*(\S+)\s*=\s*(\S+)\s*/) {
$osimgenv{$1}=$2;
}
}
}
open(INPUTFILE, "< $input_file") || die "File $input_file does not exist\n";
while (my $line = <INPUTFILE>)
{
@@ -4923,6 +4995,8 @@ sub rsync_to_image
next;
}
$line=xCAT::Utils->varsubinline($line,\%osimgenv);
# process no more lines, do not exec
# do not execute postscripts when syncing images
if (($line =~ /EXECUTE:/) || ($line =~ /EXECUTEALWAYS:/)
+15 -33
View File
@@ -897,42 +897,24 @@ sub trace() {
if (($level eq "I") || ($level eq "i")) { $prefix = "INFO"; }
if (($level eq "D") || ($level eq "d")) { $prefix = "DEBUG"; }
if (($level eq "E")
|| ($level eq "e")
|| ($level eq "I")
|| ($level eq "i")
|| ($level eq "W")
|| ($level eq "w")) {
my $msg = $prefix . " " . $logcontent;
eval {
openlog("xcat", "nofatal,pid", "local4");
syslog("$prefix", $msg);
closelog();
};
if ($@) {
print "Error: Unable to log to syslog: $@\n";
print "$msg\n";
}
return;
return unless ($prefix); #unknown level, do nothing.
if (($verbose == 0) && ($prefix eq "DEBUG")) {
my @tmp = xCAT::TableUtils->get_site_attribute("xcatdebugmode");
my $xcatdebugmode = $tmp[0];
return unless (($xcatdebugmode == 1) || ($xcatdebugmode == 2));
}
my @tmp = xCAT::TableUtils->get_site_attribute("xcatdebugmode");
my $xcatdebugmode = $tmp[0];
if (($level eq "D")
|| ($level eq "d")) {
if (($verbose == 1) || ($xcatdebugmode eq "1") || ($xcatdebugmode eq "2")) {
my $msg = $prefix . " " . $logcontent;
eval {
openlog("xcat", "nofatal,pid", "local4");
syslog("$prefix", $msg);
closelog();
};
if ($@) {
print "Error: Unable to log to syslog: $@\n";
print "$msg\n";
}
}
eval {
openlog("xcat", "nofatal,pid", "local4");
syslog("$prefix", $logcontent);
closelog();
};
if ($@) {
print "Error: Unable to log to syslog: $@\n";
print "$prefix . $logcontent\n";
}
}
#------------------------------------------------------------------
+1 -1
View File
@@ -2156,7 +2156,7 @@ sub isIpaddr
return 0;
}
if ($1 > 255 || $1 == 0 || $2 > 255 || $3 > 255 || $4 > 255)
if ($1 > 255 || $1 =~ /^0/ || $2 > 255 || $2 =~ /^0\d/ || $3 > 255 || $3 =~ /^0\d/ || $4 > 255 || $4 =~ /^0\d/)
{
return 0;
}
+8 -1
View File
@@ -768,7 +768,7 @@ passed as argument rather than by table value',
},
},
osimage => {
cols => [qw(imagename groups profile imagetype description provmethod rootfstype osdistroname osupdatename cfmdir osname osvers osarch synclists postscripts postbootscripts serverrole isdeletable kitcomponents comments disable)],
cols => [qw(imagename groups profile imagetype description provmethod rootfstype osdistroname osupdatename cfmdir osname osvers osarch synclists postscripts postbootscripts serverrole isdeletable kitcomponents environvar comments disable)],
keys => [qw(imagename)],
tablespace => 'XCATTBS32K',
table_desc => 'Basic information about an operating system image that can be used to deploy cluster nodes.',
@@ -795,6 +795,7 @@ passed as argument rather than by table value',
serverrole => 'The role of the server created by this osimage. Default roles: mgtnode, servicenode, compute, login, storage, utility.',
isdeletable => 'A flag to indicate whether this image profile can be deleted. This attribute is only used by PCM.',
kitcomponents => 'List of Kit Component IDs assigned to this OS Image definition.',
environvar => 'Comma delimited environment variables for the osimage',
comments => 'Any user-written notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
},
@@ -1178,6 +1179,8 @@ passed as argument rather than by table value',
" all of the nodes passed into the cmd and create the mypostscript file\n" .
" for each node, and put them in a directory of tftpdir(such as: /tftpboot)\n" .
" If no, it will not generate the mypostscript file in the tftpdir.\n\n" .
" secureroot: If set to 1, xCAT will use secure mode to transfer root password hash\n" .
" during the installation. Default is 0.\n\n" .
" setinstallnic: Set the network configuration for installnic to be static.\n\n" .
" sharedtftp: Set to 0 or no, xCAT should not assume the directory\n" .
" in tftpdir is mounted on all on Service Nodes. Default is 1/yes.\n" .
@@ -3476,6 +3479,10 @@ push(@{ $defspec{node}->{'attrs'} }, @nodeattrs);
tabentry => 'nimimage.comments',
access_tabentry => 'nimimage.imagename=attr:imagename',
},
{ attr_name => 'environvar',
tabentry => 'osimage.environvar',
access_tabentry => 'osimage.imagename=attr:imagename',
},
);
#########################
+1 -1
View File
@@ -495,7 +495,7 @@ my %usage = (
renergy noderange [-V] { cappingstatus={on | enable | off | disable} | {cappingwatt|cappingvalue}=watt }
OpenPOWER server specific :
renergy noderange [ powerusage | temperature]
renergy noderange { powerusage | temperature }
",
"updatenode" =>
"Usage:
+29 -1
View File
@@ -5004,4 +5004,32 @@ sub console_sleep {
sleep($time);
}
1;
# replace the variables in $line with the values in dict ref $refvardict
# return the substitued $line
sub varsubinline{
my $class=shift;
my $line=shift;
my $refvardict=shift;
my @varsinline= $line =~ /\$\{?(\w+)\}?/g;
my @unresolvedvars;
foreach my $var(@varsinline){
if(exists $refvardict->{$var}){
$line=~ s/\$\{$var\}/$refvardict->{$var}/g;
$line=~ s/\$$var/$refvardict->{$var}/g;
}else{
push @unresolvedvars,$var;
}
}
return $line;
}
#remove the left and right white spaces from string
sub strim{
my $class=shift;
my $str=shift;
$str =~ s/^\s+|\s+$//g;
return $str;
}
+1 -1
View File
@@ -272,7 +272,7 @@ sub send_back_comment{
sub build_xcat_core{
my @output;
my @cmds = ("gpg --list-keys",
"sed -i '/SignWith: yes/d' $ENV{'PWD'}/build-ubunturepo");
"sed -i '/SignWith: /d' $ENV{'PWD'}/build-ubunturepo");
foreach my $cmd (@cmds){
print "[build_xcat_core] running $cmd\n";
@output = runcmd("$cmd");
+8 -1
View File
@@ -338,6 +338,7 @@ if ((($odbconly == 0) && ($::xcatrunningmysql == 0)) || $::UPDATE || $::SETUPLL)
}
# initial setup request, if not already running mysql
my $hostfile_configured=0;
if (($::INIT) && ($::xcatrunningmysql == 0))
{
# MySQL not running, then initialize the database
@@ -443,6 +444,12 @@ if (($::INIT) && ($::xcatrunningmysql == 0))
#
&createcfgloc;
if ($::HOSTFILE)
{
&addhosts;
$hostfile_configured=1
}
#
# Restore backed up database into MySQL
#
@@ -481,7 +488,7 @@ if ($::SETUPLL)
# if input a list of hosts to add to the database, to give access to MySQL
if ($::HOSTFILE)
if (($::HOSTFILE) && ($hostfile_configured == 0))
{
&addhosts;
+6 -1
View File
@@ -13,7 +13,7 @@ use File::Basename;
use Cwd;
use Socket;
#use Data::Dumper;
use Data::Dumper;
use Getopt::Long;
require xCAT::MsgUtils;
require xCAT::DSHCLI;
@@ -195,6 +195,11 @@ if ($ENV{'DSH_VERIFY'})
push(@{ $cmdref->{env} }, "DSH_VERIFY=$ENV{'DSH_VERIFY'}");
}
if ($ENV{'XCAT_OSIMAGE_ENV'})
{
push(@{ $cmdref->{env} }, "XCAT_OSIMAGE_ENV=$ENV{'XCAT_OSIMAGE_ENV'}");
}
xCAT::Client::submit_request($cmdref, \&xCAT::Client::handle_response);
exit $xCAT::Client::EXITCODE;
+2 -2
View File
@@ -4,7 +4,7 @@ B<nodestat> - display the running status of each node in a noderange
=head1 B<Synopsis>
B<nodestat> [I<noderange>] [B<-m>|B<--usemon>] [B<-p>|B<--powerstat>] [B<-f>] [B<-u>|B<--updatedb>]
B<nodestat> [I<noderange>] [B<-m>|B<--usemon>] [B<-p>|B<--powerstat>] [B<-f>|B<--usefping>] [B<-u>|B<--updatedb>]
B<nodestat> [B<-h>|B<--help>|B<-v>|B<--version>]
@@ -57,7 +57,7 @@ For the command specified by 'dcmd', no input is needed, the output can be a str
=over 10
=item B<-f>
=item B<-f>|B<--usefping>
Uses fping instead of nmap even if nmap is available. If you seem to be having a problem with false negatives, fping can be more forgiving, but slower.
+1 -1
View File
@@ -16,7 +16,7 @@ multiple read-only instances of the console, plus console logging.
If I<conserver-host> is specified, the conserver daemon on that host will be contacted, instead of on the local host.
To exit the console session, enter: <ctrl>e c .
To exit the console session, enter: 'ctrl-e c .' (3 characters: ctrl-e, 'c' and '.').
For confluent backed consoles, an extended outage of connectivity to the endpoint will result in an automated retry
of a randomized interval between 2 to 4 minutes. You can either close and reopen the console to force a quicker
+18
View File
@@ -179,6 +179,24 @@ sub is_static_ip {
my $os = get_os();
my $rst = 0;
`which nmcli > /dev/null 2>&1`;
unless ($?) {
my $device_connection = `nmcli device show $nic 2>&1 | grep GENERAL.CONNECTION`;
my $net_name;
if ($device_connection =~ /GENERAL.CONNECTION:\s*(.+)/) {
$net_name = $1;
}
if ($net_name) {
my $ipv4_method = `nmcli con show "$net_name" 2>&1 | grep -E 'ipv4.method'`;
unless ($?) {
if ($ipv4_method =~ /manual/) {
$rst = 1;
}
return $rst;
}
}
}
if ($os =~ /redhat/) {
my $output1 = `cat /etc/sysconfig/network-scripts/ifcfg-$nic 2>&1 |grep -i IPADDR`;
my $output2 = `cat /etc/sysconfig/network-scripts/ifcfg-$nic 2>&1 |grep -i BOOTPROTO`;
-7
View File
@@ -53,13 +53,6 @@ if ($help) {
exit 0;
}
if (!-d "$currdir/bin") {
mkpath("$currdir/bin/");
}
if (!-e "$currdir/bin/switchprobe") {
link("$::XCATROOT/bin/xcatclient", "$currdir/bin/switchprobe");
}
if ($test) {
`$currdir/bin/switchprobe -h`;
if ($?) {
+39 -32
View File
@@ -13,20 +13,20 @@ use File::Copy;
use Data::Dumper;
use Getopt::Long qw(:config no_ignore_case);
my $help = 0; #command line attribute '-h', get usage information
my $test = 0; #command line attribute '-T'
my $hierarchy = 0;
my $verbose = 0; #command line attribute '-V'
my $noderange; #command line attribute '-n'
my $output = "stdout"; #used by probe_utils->send_msg("$output", "o", "xxxxxxxxxx"); print output to STDOUT
my $rst = 0; #the exit code of current command
my $terminal = 0; #means get INT signal from STDIN
my $help = 0; #command line attribute '-h', get usage information
my $test = 0; #command line attribute '-T'
my $hierarchy = 0;
my $verbose = 0; #command line attribute '-V'
my $noderange; #command line attribute '-n'
my $output = "stdout"; #used by probe_utils->send_msg("$output", "o", "xxxxxxxxxx"); print output to STDOUT
my $rst = 0; #the exit code of current command
my $terminal = 0; #means get INT signal from STDIN
my $installnic;
#save all output from commands running on SNs and MN
# one example:
# $summaryoutput{mn} = @mn_output_history
# $summaryoutput{SN1} = @SN1_output_history
# Save all output from commands running on SNs and MN
# Example:
# $summaryoutput{mn} = @mn_output_history
# $summaryoutput{SN1} = @SN1_output_history
my %summaryoutput;
my $is_sn;
@@ -1134,12 +1134,26 @@ sub check_network_parameter {
return ($rst, $rst_type);
}
sub get_attribute_value {
my $table = shift;
my $attr = shift;
my $cmd_value = "";
my $command_info = `lsdef -t $table -i $attr -c 2>&1`;
if ($command_info =~ /$attr=(\d+)/) {
$cmd_value = $1
}
print_check_result("Checking $table table attribute... $attr=$cmd_value", 0, 0, \@error);
return $cmd_value
}
sub check_daemon_attributes {
my $checkpoint_ref = shift;
my $error_ref = shift;
my $rst = 0;
$rst_type = "w";
my $node_limit = 500;
$$checkpoint_ref = "Checking xCAT daemon attributes configuration...";
@$error_ref = ();
@@ -1147,27 +1161,20 @@ sub check_daemon_attributes {
chomp($node_num);
my $xcatmaxconnections = 64;
my $xcatmaxbatchconnections = 50;
my @site_max_info = `lsdef -t site -i xcatmaxconnections,xcatmaxbatchconnections -c 2>&1`;
foreach my $site_max (@site_max_info) {
if ($site_max =~ /xcatmaxconnections=(\d+)/) {
$xcatmaxconnections_site = $1;
}
if ($site_max =~ /xcatmaxbatchconnections=(\d+)/) {
$xcatmaxbatchconnections_site = $1;
my $xcatmaxconnections_site = get_attribute_value("site","xcatmaxconnections");
my $xcatmaxbatchconnections_site = get_attribute_value("site","xcatmaxbatchconnections");
if ($xcatmaxconnections_site != "" and $xcatmaxbatchconnections_site != "") {
if ($xcatmaxbatchconnections_site > $xcatmaxconnections_site) {
push @$error_ref, "Error: xcatmaxbatchconnections > xcatmaxconnections";
$rst = 1;
$rst_type = "f";
} elsif ($xcatmaxconnections_site < $xcatmaxconnections or
$xcatmaxbatchconnections_site < $xcatmaxbatchconnections and
$node_num >= $node_limit) {
push @$error_ref, "Detected >= $node_limnit nodes, refer to xCAT documentation for xCAT daemon tuning recommendations.";
$rst = 1;
}
}
if ($xcatmaxconnections_site <= $xcatmaxbatchconnections_site) {
push @$error_ref, "Attribute xcatmaxbatchconnections must be less than xcatmaxconnections.";
$rst = 1;
$rst_type = "f";
} elsif ($xcatmaxconnections_site < $xcatmaxconnections or
$xcatmaxbatchconnections_site < $xcatmaxbatchconnections and
$node_num >= 500) {
push @$error_ref, "Management nodes are more than 500, please tuning xCAT daemon attributes as document";
$rst = 1;
}
return ($rst, $rst_type);
}
+13
View File
@@ -61,5 +61,18 @@ rm -rf $RPM_BUILD_ROOT
- "Create xCAT probe package"
%post
if [ -e %{prefix}/probe/subcmds/bin/switchprobe ]; then
rm -rf %{prefix}/probe/subcmds/bin/switchprobe
else
mkdir -p %{prefix}/probe/subcmds/bin/
fi
cd %{prefix}/probe/subcmds/bin/
if [ -e %{prefix}/bin/xcatclient ]; then
ln -s %{prefix}/bin/xcatclient switchprobe
fi
%preun
#remove the bin directory if not on upgrade
if [ "$1" != "1" ]; then
rm -rf %{prefix}/probe/subcmds/bin/
fi
+198
View File
@@ -0,0 +1,198 @@
#!/usr/bin/perl
## IBM(c) 2018 EPL license http://www.eclipse.org/legal/epl-v10.html
package xCAT::AGENT;
BEGIN
{
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
}
use lib "$::XCATROOT/lib/perl";
use strict;
use warnings "all";
use JSON;
use Time::HiRes qw(sleep time);
use File::Path;
use Fcntl ":flock";
use IO::Socket::UNIX qw( SOCK_STREAM );
use xCAT_monitoring::monitorctrl;
use xCAT::TableUtils;
my $LOCK_DIR = "/var/lock/xcat/";
my $LOCK_PATH = "/var/lock/xcat/agent.lock";
my $AGENT_SOCK_PATH = "/var/run/xcat/agent.sock";
my $PYTHON_LOG_PATH = "/var/log/xcat/agent.log";
my $PYTHON_AGENT_FILE = "/opt/xcat/lib/python/agent/agent.py";
my $MSG_TYPE = "message";
my $DB_TYPE = "db";
my $lock_fd;
my %module_type = (
"openbmc" => "OpenBMC",
"redfish" => "Redfish",
);
sub acquire_lock {
my $ppid = shift;
$ppid = shift if (($ppid) && ($ppid =~ /AGENT/));
mkpath($LOCK_DIR);
# always create a new lock file
if ($ppid) {
$LOCK_PATH = "$LOCK_PATH.$ppid";
$AGENT_SOCK_PATH = "$AGENT_SOCK_PATH.$ppid";
}
unlink($LOCK_PATH);
open($lock_fd, ">>", $LOCK_PATH) or return undef;
flock($lock_fd, LOCK_EX) or return undef;
return $lock_fd;
}
sub exists_python_agent {
if ( -e $PYTHON_AGENT_FILE) {
return 1;
}
return 0;
}
sub python_agent_reaper {
unlink($LOCK_PATH);
unlink($AGENT_SOCK_PATH);
}
sub start_python_agent {
my $ppid = shift;
$ppid = shift if (($ppid) && ($ppid =~ /AGENT/));
if (!defined(acquire_lock($ppid))) {
xCAT::MsgUtils->message("S", "start_python_agent() Error: Failed to acquire lock");
return undef;
}
my $fd;
my $pid = fork;
if (!defined $pid) {
xCAT::MsgUtils->message("S", "start_python_agent() Error: Unable to fork process");
return undef;
} elsif ($pid){
open($fd, '>', $AGENT_SOCK_PATH) && close($fd);
$SIG{INT} = $SIG{TERM} = \&python_agent_reaper;
return $pid;
}
$SIG{CHLD} = 'DEFAULT';
if (!$pid) {
# child
open($fd, ">>", $PYTHON_LOG_PATH) && close($fd);
open(STDOUT, '>>', $PYTHON_LOG_PATH) or die("open: $!");
open(STDERR, '>>&', \*STDOUT) or die("open: $!");
my @args = ( "$PYTHON_AGENT_FILE --sock $AGENT_SOCK_PATH --lockfile $LOCK_PATH" );
my $ret = exec @args;
if (!defined($ret)) {
xCAT::MsgUtils->message("S", "start_python_agent() Error: Failed to start the xCAT Python agent.");
exit(1);
}
}
}
sub handle_message {
my ($data, $callback) = @_;
if($data->{type} eq $MSG_TYPE) {
my $msg = $data->{msg};
if ($msg->{type} eq 'info') {
xCAT::MsgUtils->message("I", { data => [$msg->{data}] }, $callback);
} elsif ($msg->{type} eq 'warning') {
xCAT::MsgUtils->message("W", { data => [$msg->{data}] }, $callback);
} elsif ($msg->{type} eq 'error'){
xCAT::SvrUtils::sendmsg([ 1, $msg->{data} ], $callback, $msg->{node});
} elsif ($msg->{type} eq 'syslog'){
xCAT::MsgUtils->message("S", $msg->{data});
}
} elsif ($data->{type} eq $DB_TYPE) {
my $attribute = $data->{attribute};
if ($attribute->{name} eq 'status' and $attribute->{method} eq 'set' and $attribute->{type} eq 'node') {
my %new_status = ($attribute->{value} => [$attribute->{node}]);
xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%new_status, 1)
}
}
}
sub submit_agent_request {
my ($pid, $req, $module, $nodeinfo, $callback) = @_;
my $sock;
my $retry = 0;
while($retry < 30) {
$sock = IO::Socket::UNIX->new(Peer => $AGENT_SOCK_PATH, Type => SOCK_STREAM, Timeout => 10, Blocking => 1);
if (!defined($sock)) {
sleep(0.1);
} else {
last;
}
$retry++;
}
if (!defined($sock)) {
xCAT::MsgUtils->message("E", { data => ["$module_type{$module} management is using a Python framework. An error has occurred when trying to create socket $AGENT_SOCK_PATH."] }, $callback);
kill('TERM', $pid);
return;
}
my $xcatdebugmode = 0;
if ($::XCATSITEVALS{xcatdebugmode}) { $xcatdebugmode = $::XCATSITEVALS{xcatdebugmode} }
my %env_hash = ();
$env_hash{debugmode} = $xcatdebugmode;
my ($data, $sz, $ret, $buf);
$data->{module} = $module;
$data->{command} = $req->{command}->[0];
$data->{args} = $req->{arg};
$data->{cwd} = $req->{cwd};
$data->{nodes} = $req->{node};
$data->{nodeinfo} = $nodeinfo;
$data->{envs} = \%env_hash;
$buf = encode_json($data);
$sz = pack('i', length($buf));
# send length of data first
$ret = $sock->send($sz);
if (!$ret) {
xCAT::MsgUtils->message("E", { data => ["Failed to send message to the agent"] }, $callback);
$sock->close();
kill('TERM', $pid);
return;
}
# send data
$ret = $sock->send($buf);
if (!$ret) {
xCAT::MsgUtils->message("E", { data => ["Failed to send message to the agent"] }, $callback);
$sock->close();
kill('TERM', $pid);
return;
}
while(1) {
$ret = $sock->recv($buf, 4);
if (!$ret) {
last;
}
# receive the length of data
$sz = unpack('i', $buf);
# read data with length is $sz
$ret = $sock->recv($buf, $sz);
if (!$ret) {
xCAT::MsgUtils->message("E", { data => ["receive data from python agent unexpectedly"] }, $callback);
last;
}
$data = decode_json($buf);
handle_message($data, $callback);
}
# no message received, the socket on the agent side should be closed.
$sock->close();
}
sub wait_agent {
my ($pid, $callback) = @_;
waitpid($pid, 0);
if ($? >> 8 != 0) {
xCAT::MsgUtils->message("E", { data => ["Agent exited unexpectedly. See $PYTHON_LOG_PATH for details."] }, $callback);
}
python_agent_reaper();
}
1;
-175
View File
@@ -19,19 +19,10 @@ use Data::Dumper;
use Time::HiRes qw(sleep time);
use JSON;
use File::Path;
use Fcntl ":flock";
use IO::Socket::UNIX qw( SOCK_STREAM );
use xCAT_monitoring::monitorctrl;
use xCAT::TableUtils;
my $LOCK_DIR = "/var/lock/xcat/";
my $LOCK_PATH = "/var/lock/xcat/agent.lock";
my $AGENT_SOCK_PATH = "/var/run/xcat/agent.sock";
my $PYTHON_LOG_PATH = "/var/log/xcat/agent.log";
my $PYTHON_AGENT_FILE = "/opt/xcat/lib/python/agent/agent.py";
my $MSG_TYPE = "message";
my $DB_TYPE = "db";
my $lock_fd;
my $header = HTTP::Headers->new('Content-Type' => 'application/json');
@@ -59,172 +50,6 @@ sub send_request {
return $id;
}
# if lock is released unexpectedly, python side would aware of the error after
# getting this lock
sub acquire_lock {
my $ppid = shift;
$ppid = shift if (($ppid) && ($ppid =~ /OPENBMC/));
mkpath($LOCK_DIR);
# always create a new lock file
if ($ppid) {
$LOCK_PATH = "$LOCK_PATH.$ppid";
$AGENT_SOCK_PATH = "$AGENT_SOCK_PATH.$ppid";
}
unlink($LOCK_PATH);
open($lock_fd, ">>", $LOCK_PATH) or return undef;
flock($lock_fd, LOCK_EX) or return undef;
return $lock_fd;
}
sub exists_python_agent {
if ( -e $PYTHON_AGENT_FILE) {
return 1;
}
return 0;
}
sub python_agent_reaper {
unlink($LOCK_PATH);
unlink($AGENT_SOCK_PATH);
}
sub start_python_agent {
my $ppid = shift;
$ppid = shift if (($ppid) && ($ppid =~ /OPENBMC/));
if (!defined(acquire_lock($ppid))) {
xCAT::MsgUtils->message("S", "start_python_agent() Error: Failed to acquire lock");
return undef;
}
my $fd;
my $pid = fork;
if (!defined $pid) {
xCAT::MsgUtils->message("S", "start_python_agent() Error: Unable to fork process");
return undef;
} elsif ($pid){
open($fd, '>', $AGENT_SOCK_PATH) && close($fd);
$SIG{INT} = $SIG{TERM} = \&python_agent_reaper;
return $pid;
}
$SIG{CHLD} = 'DEFAULT';
if (!$pid) {
# child
open($fd, ">>", $PYTHON_LOG_PATH) && close($fd);
open(STDOUT, '>>', $PYTHON_LOG_PATH) or die("open: $!");
open(STDERR, '>>&', \*STDOUT) or die("open: $!");
my @args = ( "$PYTHON_AGENT_FILE --sock $AGENT_SOCK_PATH --lockfile $LOCK_PATH" );
my $ret = exec @args;
if (!defined($ret)) {
xCAT::MsgUtils->message("S", "start_python_agent() Error: Failed to start the xCAT Python agent.");
exit(1);
}
}
}
sub handle_message {
my ($data, $callback) = @_;
if($data->{type} eq $MSG_TYPE) {
my $msg = $data->{msg};
if ($msg->{type} eq 'info') {
xCAT::MsgUtils->message("I", { data => [$msg->{data}] }, $callback);
} elsif ($msg->{type} eq 'warning') {
xCAT::MsgUtils->message("W", { data => [$msg->{data}] }, $callback);
} elsif ($msg->{type} eq 'error'){
xCAT::SvrUtils::sendmsg([ 1, $msg->{data} ], $callback, $msg->{node});
} elsif ($msg->{type} eq 'syslog'){
xCAT::MsgUtils->message("S", $msg->{data});
}
} elsif ($data->{type} eq $DB_TYPE) {
my $attribute = $data->{attribute};
if ($attribute->{name} eq 'status' and $attribute->{method} eq 'set' and $attribute->{type} eq 'node') {
my %new_status = ($attribute->{value} => [$attribute->{node}]);
xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%new_status, 1)
}
}
}
sub submit_agent_request {
my ($pid, $req, $nodeinfo, $callback) = @_;
my $sock;
my $retry = 0;
while($retry < 30) {
$sock = IO::Socket::UNIX->new(Peer => $AGENT_SOCK_PATH, Type => SOCK_STREAM, Timeout => 10, Blocking => 1);
if (!defined($sock)) {
sleep(0.1);
} else {
last;
}
$retry++;
}
if (!defined($sock)) {
xCAT::MsgUtils->message("E", { data => ["OpenBMC management is using a Python framework. An error has occurred when trying to create socket $AGENT_SOCK_PATH."] }, $callback);
kill('TERM', $pid);
return;
}
my $xcatdebugmode = 0;
if ($::XCATSITEVALS{xcatdebugmode}) { $xcatdebugmode = $::XCATSITEVALS{xcatdebugmode} }
my %env_hash = ();
$env_hash{debugmode} = $xcatdebugmode;
my ($data, $sz, $ret, $buf);
$data->{module} = 'openbmc';
$data->{command} = $req->{command}->[0];
$data->{args} = $req->{arg};
$data->{cwd} = $req->{cwd};
$data->{nodes} = $req->{node};
$data->{nodeinfo} = $nodeinfo;
$data->{envs} = \%env_hash;
$buf = encode_json($data);
$sz = pack('i', length($buf));
# send length of data first
$ret = $sock->send($sz);
if (!$ret) {
xCAT::MsgUtils->message("E", { data => ["Failed to send message to the agent"] }, $callback);
$sock->close();
kill('TERM', $pid);
return;
}
# send data
$ret = $sock->send($buf);
if (!$ret) {
xCAT::MsgUtils->message("E", { data => ["Failed to send message to the agent"] }, $callback);
$sock->close();
kill('TERM', $pid);
return;
}
while(1) {
$ret = $sock->recv($buf, 4);
if (!$ret) {
last;
}
# receive the length of data
$sz = unpack('i', $buf);
# read data with length is $sz
$ret = $sock->recv($buf, $sz);
if (!$ret) {
xCAT::MsgUtils->message("E", { data => ["receive data from python agent unexpectedly"] }, $callback);
last;
}
$data = decode_json($buf);
handle_message($data, $callback);
}
# no message received, the socket on the agent side should be closed.
$sock->close();
}
sub wait_agent {
my ($pid, $callback) = @_;
waitpid($pid, 0);
if ($? >> 8 != 0) {
xCAT::MsgUtils->message("E", { data => ["Agent exited unexpectedly. See $PYTHON_LOG_PATH for details."] }, $callback);
xCAT::MsgUtils->message("I", { data => ["To revert to Perl framework: chdef -t site clustersite openbmcperl=ALL"] }, $callback);
}
python_agent_reaper();
}
#--------------------------------------------------------------------------------
=head3 run_cmd_in_perl
+23 -3
View File
@@ -18,6 +18,7 @@ use xCAT::Template;
use xCAT::SvrUtils;
use xCAT::Zone;
use Data::Dumper;
use File::Basename;
use Socket;
use strict;
@@ -319,7 +320,7 @@ sub makescript {
#%image_hash is used to store the attributes in linuximage and nimimage tabs
my %image_hash;
getImage(\%image_hash);
getImage(\%image_hash);
# get postscript and postscript from postscripts and osimage tabs
my $script_hash = xCAT::Postage::getScripts($nodes, \%image_hash);
@@ -512,6 +513,16 @@ sub makescript {
$osimgname = $provmethod;
}
if($image_hash{$osimgname}{'environvar'}){
my $myenvstr=$image_hash{$osimgname}{'environvar'};
foreach my $myenv(split(',',$myenvstr)){
if($myenv =~ /\s*(\S+)\s*=\s*(\S+)\s*/) {
$ENV{$1}=$2;
}
}
}
my $osimage_vars;
$osimage_vars = getImageitems_for_node($node, \%image_hash, $nodesetstate);
@@ -1114,7 +1125,7 @@ sub getImage
if ($^O =~ /^linux/i) {
my $linuximagetab = xCAT::Table->new('linuximage', -create => 1);
my @et2 = $linuximagetab->getAllAttribs('imagename', 'pkglist', 'pkgdir', 'otherpkglist', 'otherpkgdir');
my @et2 = $linuximagetab->getAllAttribs('imagename', 'pkglist', 'pkgdir', 'otherpkglist', 'otherpkgdir','environvar');
if (@et2) {
foreach my $tmp_et2 (@et2) {
my $imagename = $tmp_et2->{imagename};
@@ -1122,6 +1133,7 @@ sub getImage
$image_hash->{$imagename}->{pkgdir} = $tmp_et2->{pkgdir};
$image_hash->{$imagename}->{otherpkglist} = $tmp_et2->{otherpkglist};
$image_hash->{$imagename}->{otherpkgdir} = $tmp_et2->{otherpkgdir};
$image_hash->{$imagename}->{environvar} = $tmp_et2->{environvar};
}
}
}
@@ -1190,6 +1202,11 @@ sub getImageitems_for_node
$result .= "export OTHERPKGDIR\n";
}
}
if ($ref1->{'environvar'}){
foreach my $myenvar(split(',',$ref1->{'environvar'})){
$result .='export '.$myenvar."\n";
}
}
}
}
else
@@ -1813,6 +1830,8 @@ sub includefile
my $file = shift;
my $idir = shift;
my @text = ();
$file=xCAT::Utils->varsubinline($file,\%ENV);
unless ($file =~ /^\//)
{
$file = $idir . "/" . $file;
@@ -1948,7 +1967,7 @@ sub getScripts
$script_hash{default_postboot} = $et->{'postbootscripts'};
my @et2 = $ostab->getAllAttribs('imagename', 'postscripts', 'postbootscripts', 'osvers', 'osarch', 'profile', 'provmethod', 'synclists', 'kitcomponents');
my @et2 = $ostab->getAllAttribs('imagename', 'postscripts', 'postbootscripts', 'osvers', 'osarch', 'profile', 'provmethod', 'synclists', 'kitcomponents','environvar');
if (@et2) {
foreach my $tmp_et2 (@et2) {
my $imagename = $tmp_et2->{imagename};
@@ -1959,6 +1978,7 @@ sub getScripts
$image_hash->{$imagename}->{profile} = $tmp_et2->{profile};
$image_hash->{$imagename}->{provmethod} = $tmp_et2->{provmethod};
$image_hash->{$imagename}->{synclists} = $tmp_et2->{synclists};
$image_hash->{$imagename}->{environvar} = $tmp_et2->{environvar};
$image_hash->{$imagename}->{kitcomponents} = $tmp_et2->{kitcomponents} if ($tmp_et2->{kitcomponents});
}
}
+85 -28
View File
@@ -452,37 +452,59 @@ sub get_file_name {
#usally there're only 4 arguments passed for this function
#the $genos is only used for the Redhat family
my $dotpos = rindex($os, ".");
my $osbase = substr($os, 0, $dotpos);
#handle the following ostypes: sles10.2, sles11.1, rhels5.3, rhels5.4, etc
if (-r "$searchpath/$profile.$os.$arch.$extension") {
return "$searchpath/$profile.$os.$arch.$extension";
}
elsif (-r "$searchpath/$profile.$os.$extension") {
if (-r "$searchpath/$profile.$os.$extension") {
return "$searchpath/$profile.$os.$extension";
}
elsif (($genos) && (-r "$searchpath/$profile.$genos.$arch.$extension")) {
if (($genos) && (-r "$searchpath/$profile.$genos.$arch.$extension")) {
return "$searchpath/$profile.$genos.$arch.$extension";
}
elsif (($genos) && (-r "$searchpath/$profile.$genos.$extension")) {
if (($genos) && (-r "$searchpath/$profile.$genos.$extension")) {
return "$searchpath/$profile.$genos.$extension";
}
my $dotpos = rindex($os, ".");
my $osbase = substr($os, 0, $dotpos);
# If the osimge name was specified with -n, the name might contain multiple "."
# Chop them off one at a time until filename match is found
else {
while ($dotpos > 0) {
while ($dotpos > 0) {
if (-r "$searchpath/$profile.$osbase.$arch.$extension") {
return "$searchpath/$profile.$osbase.$arch.$extension";
}
if (-r "$searchpath/$profile.$osbase.$extension") {
return "$searchpath/$profile.$osbase.$extension";
}
# Chop off "." from the end and try again
$dotpos = rindex($osbase, ".");
$osbase = substr($osbase, 0, $dotpos);
}
if (-r "$searchpath/$profile.$osbase.$arch.$extension") {
return "$searchpath/$profile.$osbase.$arch.$extension";
}
elsif (-r "$searchpath/$profile.$osbase.$extension") {
return "$searchpath/$profile.$osbase.$extension";
}
# Chop off "." from the end and try again
$dotpos = rindex($osbase, ".");
$osbase = substr($osbase, 0, $dotpos);
#if there are no '.', pick the two numbers follow by leading string, like sles11
#then pick one number follow by leading string, like centos7, rhels7
if ($os =~ m/([a-zA-Z]+\d\d)/)
{
$osbase=$1;
if (-r "$searchpath/$profile.$osbase.$arch.$extension") {
return "$searchpath/$profile.$osbase.$arch.$extension";
}
if (-r "$searchpath/$profile.$osbase.$extension") {
return "$searchpath/$profile.$osbase.$extension";
}
}
if ($os =~ m/([a-zA-Z]+\d)/)
{
$osbase = $1;
if (-r "$searchpath/$profile.$osbase.$arch.$extension") {
return "$searchpath/$profile.$osbase.$arch.$extension";
}
if (-r "$searchpath/$profile.$osbase.$extension") {
return "$searchpath/$profile.$osbase.$extension";
}
}
@@ -490,12 +512,11 @@ sub get_file_name {
if (-r "$searchpath/$profile.$arch.$extension") {
return "$searchpath/$profile.$arch.$extension";
}
elsif (-r "$searchpath/$profile.$extension") {
if (-r "$searchpath/$profile.$extension") {
return "$searchpath/$profile.$extension";
}
else {
return undef;
}
return undef;
}
sub get_tmpl_file_name {
@@ -541,24 +562,60 @@ sub get_postinstall_file_name {
if (-x "$searchpath/$profile.$os.$arch.$extension") {
return "$searchpath/$profile.$os.$arch.$extension";
}
elsif (-x "$searchpath/$profile.$osbase.$arch.$extension") {
if (-x "$searchpath/$profile.$osbase.$arch.$extension") {
return "$searchpath/$profile.$osbase.$arch.$extension";
}
elsif (-x "$searchpath/$profile.$os.$extension") {
if (-x "$searchpath/$profile.$os.$extension") {
return "$searchpath/$profile.$os.$extension";
}
elsif (-x "$searchpath/$profile.$osbase.$extension") {
if (-x "$searchpath/$profile.$osbase.$extension") {
return "$searchpath/$profile.$osbase.$extension";
}
elsif (-x "$searchpath/$profile.$arch.$extension") {
# If the osimge name was specified with -n, the name might contain multiple "."
# Chop them off one at a time until filename match is found
while ($dotpos > 0) {
if (-x "$searchpath/$profile.$osbase.$arch.$extension") {
return "$searchpath/$profile.$osbase.$arch.$extension";
}
if (-x "$searchpath/$profile.$osbase.$extension") {
return "$searchpath/$profile.$osbase.$extension";
}
# Chop off "." from the end and try again
$dotpos = rindex($osbase, ".");
$osbase = substr($osbase, 0, $dotpos);
}
#if there are no '.', pick the two numbers follow by leading string, like sles11
#then pick one number follow by leading string, like centos7, rhels7
if ($os =~ m/([a-zA-Z]+\d\d)/)
{
$osbase=$1;
if (-x "$searchpath/$profile.$osbase.$arch.$extension") {
return "$searchpath/$profile.$osbase.$arch.$extension";
}
if (-x "$searchpath/$profile.$osbase.$extension") {
return "$searchpath/$profile.$osbase.$extension";
}
}
if ($os =~ m/([a-zA-Z]+\d)/)
{
$osbase = $1;
if (-x "$searchpath/$profile.$osbase.$arch.$extension") {
return "$searchpath/$profile.$osbase.$arch.$extension";
}
if (-x "$searchpath/$profile.$osbase.$extension") {
return "$searchpath/$profile.$osbase.$extension";
}
}
if (-x "$searchpath/$profile.$arch.$extension") {
return "$searchpath/$profile.$arch.$extension";
}
elsif (-x "$searchpath/$profile.$extension") {
if (-x "$searchpath/$profile.$extension") {
return "$searchpath/$profile.$extension";
}
else {
return undef;
}
return undef;
}
+2
View File
@@ -1491,6 +1491,7 @@ sub includefile
#2 means pattern list, pattern list starts with @,
#3 means remove package list, packages to be removed start with -.
my $text = "";
$file=xCAT::Utils->varsubinline($file,\%ENV);
unless ($file =~ /^\//) {
$file = $idir . "/" . $file;
}
@@ -1600,6 +1601,7 @@ sub crydb
};
$kp = $get_query_map->($key);
return undef if (!defined($kp));
return '*' if ($::XCATSITEVALS{secureroot} eq "1");
return xCAT::PasswordUtils::crypt_system_password($table, $kp, \@fields);
}
+11 -2
View File
@@ -18,7 +18,6 @@ use xCAT::MsgUtils;
use xCAT::SvrUtils;
use xCAT::Yum;
#use Data::Dumper;
use Getopt::Long;
Getopt::Long::Configure("bundling");
Getopt::Long::Configure("pass_through");
@@ -959,12 +958,13 @@ sub mkinstall
if (!$osimagetab) {
$osimagetab = xCAT::Table->new('osimage', -create => 1);
}
(my $ref) = $osimagetab->getAttribs({ imagename => $imagename }, 'osvers', 'osarch', 'profile', 'provmethod', 'osupdatename');
(my $ref) = $osimagetab->getAttribs({ imagename => $imagename }, 'osvers', 'osarch', 'profile', 'provmethod', 'osupdatename','environvar');
if ($ref) {
$img_hash{$imagename}->{osver} = $ref->{'osvers'};
$img_hash{$imagename}->{osarch} = $ref->{'osarch'};
$img_hash{$imagename}->{profile} = $ref->{'profile'};
$img_hash{$imagename}->{provmethod} = $ref->{'provmethod'};
$img_hash{$imagename}->{environvar} = $ref->{'environvar'};
if (!$linuximagetab) {
$linuximagetab = xCAT::Table->new('linuximage', -create => 1);
}
@@ -1177,6 +1177,15 @@ sub mkinstall
} else {
$tmperr = "Unable to find template in /install/custom/install/$platform or $::XCATROOT/share/xcat/install/$platform (for $profile/$os/$arch combination)";
}
if($img_hash{$imagename}->{environvar}){
foreach my $myenv(split(',',$img_hash{$imagename}->{'environvar'})){
if($myenv =~ /\s*(\S+)\s*=\s*(\S+)\s*/) {
$ENV{$1}=$2;
}
}
}
if (-r "$tmplfile")
{
$tmperr =
@@ -33,6 +33,7 @@ use IO::Socket::INET;
use Time::HiRes qw(sleep);
use xCAT::Utils;
use xCAT::PasswordUtils;
use xCAT::MsgUtils;
use Getopt::Long;
@@ -316,6 +317,16 @@ sub process_request
}
$tfilename = "/etc/xcatdockerca/cert/dockerhost-cert.pem";
} elsif ($parm =~ /xcat_secure_pw:/) {
xCAT::MsgUtils->trace(0, 'I', "credentials: sending $parm to $client");
my @users=split(/:/,$parm);
if (defined($users[1]) and $users[1] eq 'root') {
my $pass = xCAT::PasswordUtils::crypt_system_password();
if ($pass) {
push @{$rsp->{'data'}}, { content => [ $pass ], desc => [ $parm ] };
}
}
next;
} else {
xCAT::MsgUtils->trace(0, 'W', "credentials: Not supported type: $parm");
next;
+4
View File
@@ -437,6 +437,10 @@ sub process_request {
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, address seems malformed.", $callback);
next;
}
if ($addr =~ /(?:^|\.)0+(?=\d)/ and $addr !~ /^[abcdef0123456789:]+$/) {
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, ip address octets can not contain leading zeroes.", $callback);
next;
}
unless ($names =~ /^[a-z0-9\. \t\n-]+$/i) {
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, names $names contain invalid characters (valid characters include a through z, numbers and the '-', but not '_'", $callback);
next;
+12 -5
View File
@@ -768,7 +768,8 @@ sub mkinstall {
next;
}
if ($arch =~ /ppc64/i and !(-e "$pkgdir/install/netboot/initrd.gz")) {
if ($arch =~ /ppc64/i and !(-e "$pkgdir/install/netboot/initrd.gz") and
!(-e "$pkgdir/install/netboot/ubuntu-installer/$darch/initrd.gz")) {
xCAT::MsgUtils->report_node_error($callback, $node,
"The network boot initrd.gz is not found in $pkgdir/install/netboot. This is provided by Ubuntu, please download and retry."
);
@@ -804,10 +805,16 @@ sub mkinstall {
)
) or (
$arch =~ /ppc64/i and (
-r "$pkgdir/install/vmlinux"
and $kernpath = "$pkgdir/install/vmlinux"
and -r "$pkgdir/install/netboot/initrd.gz"
and $initrdpath = "$pkgdir/install/netboot/initrd.gz"
(-r "$pkgdir/install/netboot/ubuntu-installer/$darch/vmlinux"
and $kernpath = "$pkgdir/install/netboot/ubuntu-installer/$darch/vmlinux"
and -r "$pkgdir/install/netboot/ubuntu-installer/$darch/initrd.gz"
and $initrdpath = "$pkgdir/install/netboot/ubuntu-installer/$darch/initrd.gz"
) or
(-r "$pkgdir/install/vmlinux"
and $kernpath = "$pkgdir/install/vmlinux"
and -r "$pkgdir/install/netboot/initrd.gz"
and $initrdpath = "$pkgdir/install/netboot/initrd.gz"
)
)
)
)
+4 -2
View File
@@ -73,6 +73,7 @@ sub process_request {
my $dryrun;
my $ignorekernelchk;
my $noupdate;
my $envar;
GetOptions(
'a=s' => \$arch,
@@ -138,7 +139,7 @@ sub process_request {
return 1;
}
(my $ref_osimage_tab) = $osimagetab->getAttribs({ imagename => $imagename }, 'osvers', 'osarch', 'profile', 'provmethod');
(my $ref_osimage_tab) = $osimagetab->getAttribs({ imagename => $imagename }, 'osvers', 'osarch', 'profile', 'provmethod','environvar');
unless ($ref_osimage_tab) {
$callback->({ error => ["Cannot find image \'$imagename\' from the osimage table."], errorcode => [1] });
return 1;
@@ -153,6 +154,7 @@ sub process_request {
$osver = $ref_osimage_tab->{'osvers'};
$arch = $ref_osimage_tab->{'osarch'};
$profile = $ref_osimage_tab->{'profile'};
$envar = $ref_osimage_tab->{'environvar'};
my $provmethod = $ref_osimage_tab->{'provmethod'}; # TODO: not necessary, and need to update both statelite and stateless modes
unless ($osver and $arch and $profile and $provmethod) {
@@ -318,7 +320,7 @@ sub process_request {
if ($kerneldir) { $cmd .= " --kerneldir $kerneldir"; }
if ($interactive) { $cmd .= " --interactive" }
if ($onlyinitrd) { $cmd .= " --onlyinitrd" }
if ($envar) { $cmd .= " --env $envar"; }
if ($srcdir) { $cmd .= " --srcdir \"$srcdir\""; }
if ($pkglist) { $cmd .= " --pkglist $pkglist"; }
if ($srcdir_otherpkgs) { $cmd .= " --otherpkgdir \"$srcdir_otherpkgs\""; }
+23 -6
View File
@@ -50,6 +50,7 @@ my $xcatdebugmode = 0;
my $IPMIXCAT = "/opt/xcat/bin/ipmitool-xcat";
my $NON_BLOCK = 1;
my $BIG_DATA_MACHINE_MODELS = "8001-22C|9006-22C|5104-22C|8001-12C|9006-12C";
use constant RFLASH_LOG_DIR => "/var/log/xcat/rflash";
if (-d RFLASH_LOG_DIR) {
chmod 0700, RFLASH_LOG_DIR;
@@ -1983,7 +1984,7 @@ sub do_firmware_update {
# P9 Boston (9006-22C, 9006-12C, 5104-22C) or P8 Briggs (8001-22C)
# firmware update is done using pUpdate utility expected to be in the
# specified data directory along with the update files .bin for BMC or .pnor for Host
if ($output =~ /8001-22C|9006-22C|5104-22C|9006-12C/) {
if ($output =~ /$BIG_DATA_MACHINE_MODELS/) {
# Verify valid data directory was specified
if (defined $directory_name) {
unless (File::Spec->file_name_is_absolute($directory_name)) {
@@ -2045,6 +2046,7 @@ sub do_firmware_update {
$exit_with_error_func->($sessdata->{node}, $callback,
"At least one update file (.bin or .pnor) needs to be in data directory $pUpdate_directory.");
}
# All checks are done, run pUpdate utility on each of the update files found in
# the specified data directory
xCAT::SvrUtils::sendmsg("rflash started, Please wait...", $callback, $sessdata->{node});
@@ -2110,13 +2112,28 @@ sub do_firmware_update {
}
$exit_with_success_func->($sessdata->{node}, $callback, "Firmware updated, powering chassis on to populate FRU information...");
} else {
# The target machine is *NOT* IBM Power S822LC for Big Data (Supermicro)
# Only .hpm files is supported for such machine, no directory option is supported
if (defined $directory_name and $output =~ /Chassis Part Number\s*:\s*(\S*)/) {
my $model = $1;
$exit_with_error_func->($sessdata->{node}, $callback, "Flashing of $model is not supported with pUpdate, supported Model Types: $BIG_DATA_MACHINE_MODELS");
}
}
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})) {
$exit_with_error_func->($sessdata->{node}, $callback,
"The image file doesn't match this machine");
# If we fall through here, it is *NOT* IBM Power S822LC for Big Data (Supermicro) and we expact some data in hpm_data_hash.
# Verify hpm_data_hash has some values
if (!exists($hpm_data_hash{deviceID})
|| !exists($hpm_data_hash{manufactureID})
|| !exists($hpm_data_hash{productID})) {
$exit_with_error_func->($sessdata->{node}, $callback, "Extract data from .hpm update file failed, no deviceID, productID or manufactureID got");
} elsif (($hpm_data_hash{deviceID} ne $sessdata->{device_id}) ||
($hpm_data_hash{productID} ne $sessdata->{prod_id}) ||
($hpm_data_hash{manufactureID} ne $sessdata->{mfg_id})) {
$exit_with_error_func->($sessdata->{node}, $callback, "The image file doesn't match target machine: \n$output");
}
# check for 8335-GTB Firmware above 1610A release. If below, exit
+20 -5
View File
@@ -456,9 +456,25 @@ sub process_request {
$callback->({ error => ["The node [$node] should have a correct IP address which belongs to the management network."], errorcode => ["1"] });
return;
}
my $bmc_node = undef;
if (defined($request->{bmc_node}) and defined($request->{bmc_node}->[0])) {
$bmc_node = $request->{bmc_node}->[0];
}
if (-x "/usr/bin/goconserver") {
xCAT::MsgUtils->message("S", "xcat.discovery.nodediscover: remove gocons session for $bmc_node");
require xCAT::Goconserver;
if (xCAT::Goconserver::is_goconserver_running()) {
my $api_url = "https://localhost:". xCAT::Goconserver::get_api_port();
xCAT::Goconserver::delete_nodes($api_url, {"$bmc_node" => 1}, 1, $callback);
}
} else {
xCAT::MsgUtils->message("S", "xcat.discovery.nodediscover: After discovery done, please use 'makeconservercf -C' to clean up undefined nodes from conserver");
}
if (defined($request->{bmcinband})) {
if (defined($request->{bmc_node}) and defined($request->{bmc_node}->[0])) {
my $bmc_node = $request->{bmc_node}->[0];
if (defined($bmc_node)) {
xCAT::MsgUtils->message("S", "xcat.discovery.nodediscover: Removing discovered BMC nodes definition: $bmc_node...");
my $rmcmd = "rmdef $bmc_node";
xCAT::Utils->runcmd($rmcmd, 0);
@@ -470,8 +486,7 @@ sub process_request {
}
}
} else {
if (defined($request->{bmc_node}) and defined($request->{bmc_node}->[0])) {
my $bmc_node = $request->{bmc_node}->[0];
if (defined($bmc_node)) {
if ($bmc_node =~ /\,/) {
xCAT::MsgUtils->message("W", "Multiple BMC nodes matched with no bmcinband specified, please remove manually");
} else {
@@ -481,7 +496,7 @@ sub process_request {
}
}
}
my $restartstring = "restart";
if (scalar @forcenics > 0) {
+2 -2
View File
@@ -920,7 +920,7 @@ sub process_request {
if (ref $request->{arg}) {
@ARGV = @{ $request->{arg} };
GetOptions(
'f' => \$usefping
'f|useping' => \$usefping
);
}
@@ -1225,7 +1225,7 @@ sub usage
my $retcode=shift;
my $rsp = {};
$rsp->{data}->[0] = "Usage:";
$rsp->{data}->[1] = " nodestat [noderange] [-m|--usemon] [-p|powerstat] [-u|--updatedb] [-f|--usefping]";
$rsp->{data}->[1] = " nodestat [noderange] [-m|--usemon] [-p|powerstat] [-f|--usefping] [-u|--updatedb]";
$rsp->{data}->[2] = " nodestat [-h|--help|-v|--version]";
if($retcode){
$rsp->{errorcode}->[0]=$retcode;
+5 -4
View File
@@ -16,6 +16,7 @@ use Getopt::Long;
use xCAT::Usage;
use xCAT::SvrUtils;
use xCAT::OPENBMC;
use xCAT::AGENT;
#-------------------------------------------------------
@@ -134,7 +135,7 @@ sub process_request {
my $request = shift;
$callback = shift;
if (!xCAT::OPENBMC::exists_python_agent()) {
if (!xCAT::AGENT::exists_python_agent()) {
xCAT::MsgUtils->message("E", { data => ["The xCAT Python agent does not exist. Check if xCAT-openbmc-py package is installed on management node and service nodes."] }, $callback);
return;
}
@@ -149,14 +150,14 @@ sub process_request {
return unless(%node_info);
# If we can't start the python agent, exit immediately
my $pid = xCAT::OPENBMC::start_python_agent($$);
my $pid = xCAT::AGENT::start_python_agent($$);
if (!defined($pid)) {
xCAT::MsgUtils->message("E", { data => ["Failed to start the xCAT Python agent. Check /var/log/xcat/cluster.log for more information."] }, $callback);
return;
}
xCAT::OPENBMC::submit_agent_request($pid, $request, \%node_info, $callback);
xCAT::OPENBMC::wait_agent($pid, $callback);
xCAT::AGENT::submit_agent_request($pid, $request, "openbmc", \%node_info, $callback);
xCAT::AGENT::wait_agent($pid, $callback);
}
my @rsp_common_options = qw/autoreboot bootmode powersupplyredundancy powerrestorepolicy timesyncmethod
+13 -3
View File
@@ -99,6 +99,7 @@ sub process_request {
my $imagename;
my $dotorrent;
my $provmethod;
my $envars;
my $help;
my $version;
my $lock;
@@ -158,7 +159,7 @@ sub process_request {
$callback->({ error => ["The linuximage table cannot be opened."], errorcode => [1] });
return 1;
}
(my $ref) = $osimagetab->getAttribs({ imagename => $imagename }, 'osvers', 'osarch', 'profile', 'provmethod', 'synclists');
(my $ref) = $osimagetab->getAttribs({ imagename => $imagename }, 'osvers', 'osarch', 'profile', 'provmethod', 'synclists','environvar');
unless ($ref) {
$callback->({ error => ["Cannot find image \'$imagename\' from the osimage table."], errorcode => [1] });
return 1;
@@ -174,6 +175,7 @@ sub process_request {
$profile = $ref->{'profile'};
$syncfile = $ref->{'synclists'};
$provmethod = $ref->{'provmethod'};
$envars = $ref->{'environvar'};
unless ($osver and $arch and $profile and $provmethod) {
$callback->({ error => ["osimage.osvers, osimage.osarch, osimage.profile and osimage.provmethod must be specified for the image $imagename in the database."], errorcode => [1] });
@@ -399,11 +401,15 @@ sub process_request {
system("umount $rootimg_dir/proc");
copybootscript($installroot, $rootimg_dir, $osver, $arch, $profile, $callback);
my $pass = xCAT::PasswordUtils::crypt_system_password();
if (!defined($pass)) {
$pass = 'cluster';
}
my @secure_root = xCAT::TableUtils->get_site_attribute("secureroot");
if ($secure_root[0] == 1) {
$pass = '*';
}
my $oldmask = umask(0077);
my $shadow;
open($shadow, "<", "$rootimg_dir/etc/shadow");
@@ -423,8 +429,12 @@ sub process_request {
# sync fils configured in the synclist to the rootimage
$syncfile = xCAT::SvrUtils->getsynclistfile(undef, $osver, $arch, $profile, "netboot", $imagename);
if ( defined($syncfile) && -f $syncfile && -d $rootimg_dir) {
my $myenv='';
if($envars){
$myenv.=" XCAT_OSIMAGE_ENV=$envars";
}
print "Syncing files from $syncfile to root image dir: $rootimg_dir\n";
system("$::XCATROOT/bin/xdcp -i $rootimg_dir -F $syncfile");
system("$myenv $::XCATROOT/bin/xdcp -i $rootimg_dir -F $syncfile");
}
} else {
print "Bypass of syncfiles requested, will not sync files to root image directory.\n";
+1 -1
View File
@@ -469,7 +469,7 @@ sub process_request {
$verbose && $callback->({ info => ["put the statelite rc file to $rootimg_dir/etc/init.d/"] });
# rh5,rh6.1 to rh6.4 use rc.statelite.ppc.redhat, otherwise use rc.statelite
if (($osver =~ m/^rh[a-zA-Z]*5/) or ($osver =~ m/^rh[a-zA-Z]*6(\.)?[1-4]/) and $arch eq "ppc64") { # special case for redhat5/6.x on PPC64
if (($osver =~ m/^rh[a-zA-Z]*5/) or ($osver =~ m/^rh[a-zA-Z]*6(\.)?[1-4]$/) and $arch eq "ppc64") { # special case for redhat5/6.x on PPC64
system("cp -a $::XCATROOT/share/xcat/netboot/add-on/statelite/rc.statelite.ppc.redhat $rootimg_dir/etc/init.d/statelite");
} else {
system("cp -a $::XCATROOT/share/xcat/netboot/add-on/statelite/rc.statelite $rootimg_dir/etc/init.d/statelite");
@@ -981,8 +981,14 @@ sub get_snmpvendorinfo {
push @comm_list, 'public';
foreach $comms(@comm_list) {
#get sysDescr.0";
my $ccmd = "snmpwalk -Os -v1 -c $comms $ip 1.3.6.1.2.1.1.1";
#for pdu: get vendor info from sysDescr
#for switches: get vendor info from entPhysicalDescr
my $ccmd;
if (exists($globalopt{pdu})) {
$ccmd = "snmpwalk -Os -v1 -c $comms $ip 1.3.6.1.2.1.1.1";
} else {
$ccmd = "snmpwalk -Os -v1 -c $comms $ip 1.3.6.1.2.1.47.1.1.1.1.2.1";
}
if (exists($globalopt{verbose})) {
send_msg($request, 0, "Process command: $ccmd\n");
}
@@ -0,0 +1,77 @@
#!/usr/bin/perl
# IBM(c) 2018 EPL license http://www.eclipse.org/legal/epl-v10.html
package xCAT_plugin::updatehwinv;
BEGIN
{
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
}
use lib "$::XCATROOT/lib/perl";
use strict;
use warnings "all";
use xCAT::Table;
use xCAT::Utils;
use xCAT::NodeRange;
#-------------------------------------------------------
=head3 handled_commands
Return list of commands handled by this plugin
=cut
#-------------------------------------------------------
sub handled_commands {
return {
updatehwinv => 'updatehwinv',
};
}
sub process_request {
my $req = shift;
my $callback = shift;
if ($req->{command}->[0] eq "updatehwinv") {
update_hw_inv($req);
}
}
sub update_hw_inv {
my $request = shift;
my $tmp_node = $request->{'_xcat_clienthost'}->[0];
my @valid_node = xCAT::NodeRange::noderange($tmp_node);
unless (@valid_node) {
xCAT::MsgUtils->message("S", "xcat.hwinv: Received invalid node $tmp_node hwinv info, ignore...");
return;
}
my $node = $valid_node[0];
my @nodefs;
my $basicdata;
my @hwinv_info = ("cpucount", "cputype", "memory", "disksize");
foreach my $hwinv_type (@hwinv_info) {
if (defined($request->{$hwinv_type}) and $request->{$hwinv_type}->[0]) {
$basicdata->{$hwinv_type} = $request->{$hwinv_type}->[0];
} else {
push @nodefs, $hwinv_type;
}
}
if ($basicdata) {
my $hwinv_tab = xCAT::Table->new("hwinv", -create => 1);
xCAT::MsgUtils->message("S", "xcat.hwinv: Update hwinv for $node");
$hwinv_tab->setNodeAttribs($node, $basicdata);
}
if (@nodefs) {
my $nodef = join(",", @nodefs);
xCAT::MsgUtils->message("E", "xcat.hwinv: No valid hwinv info $nodef received from $node");
}
}
1;
+24 -3
View File
@@ -105,11 +105,20 @@ sub setstate {
my %machash = %{ shift() };
my %iscsihash = %{ shift() };
my $tftpdir = shift;
my %linuximghash = ();
my $linuximghashref = shift;
if (ref $linuximghashref) { %linuximghash = %{$linuximghashref}; }
my $imgaddkcmdline = ($linuximghash{'boottarget'}) ? undef : $linuximghash{'addkcmdline'};
my $kern = $bphash{$node}->[0];
my $imgaddkcmdline = $linuximghashref->{'addkcmdline'};
my $imgboottarget = $linuximghashref->{'boottarget'};
# get kernel and initrd from boottarget table
my $bttab;
my $btentry;
if ($imgboottarget) {
$bttab = xCAT::Table->new('boottarget');
$btentry = $bttab->getAttribs({ 'bprofile' => $imgboottarget }, 'kernel', 'initrd', 'kcmdline');
}
unless ($::XNBA_addkcmdlinehandled->{$node}) { #Tag to let us know the plugin had a special syntax implemented for addkcmdline
if ($kern->{addkcmdline} or ($imgaddkcmdline)) {
@@ -171,6 +180,18 @@ sub setstate {
}
}
#fill in kernel, intrd and kcmdline from boottarget table if not available
unless ($kern->{kernel}) {
$kern->{kernel} = $btentry->{kernel};
}
unless ($kern->{initrd}) {
$kern->{initrd} = $btentry->{initrd};
}
unless ($kern->{kcmdline}) {
$kern->{kcmdline} = $btentry->{kcmdline};
}
my $elilokcmdline = $kern->{kcmdline}; #track it separate, since vars differ
my $pxelinuxkcmdline = $kern->{kcmdline}; #track it separate, since vars differ
if ($kern->{kcmdline} =~ /!myipfn!/) {
+6
View File
@@ -63,6 +63,12 @@ unless ($target) {
exit(1);
}
my $current_userid = getpwuid($>);
if ($current_userid ne "root")
{
print "WARNING: chtab bypasses xcatd and does not enforce xCAT policy tables. Consider using tabch instead.\n";
}
my %keyhash = ();
my @keypairs = split(/,/, $target);
if ($keypairs[0] !~ /([^\.\=]+)\.([^\.\=]+)\=(.+)/) {
+8 -8
View File
@@ -844,14 +844,14 @@ sub do_udp_service { # This function opens up a UDP port
#notify the client that its request is been processing
my $ret=xCAT::NetworkUtils->send_tcp_msg($clientip,3001,"processing");
if($ret){
xCAT::MsgUtils->message("S", "INFO xcatd: fail to notify $clientip that its 'findme' request is been processing");
xCAT::MsgUtils->message("S", "xcatd: fail to notify $clientip that its 'findme' request is been processing");
}
} elsif ($data =~ /^<xcat/) { # xml format
store_fd({ data => $data, sockaddr => $clientip, sport => $sport }, $discoctl);
#notify the client that its request is been processing
my $ret=xCAT::NetworkUtils->send_tcp_msg($clientip,3001,"processing");
if($ret){
xCAT::MsgUtils->message("S", "INFO xcatd: fail to notify $clientip that its 'findme' request is been processing");
xCAT::MsgUtils->message("S", "xcatd: fail to notify $clientip that its 'findme' request is been processing");
}
} else { # for *now*, we'll do a tiny YAML subset
@@ -1212,7 +1212,7 @@ unless ($cmdlog_svrpid) {
if ($clientsock) { close($clientsock); }
if (-e $cmdlogservicefile) { unlink("$cmdlogservicefile"); }
if ($cmdlogsvrlistener) { close($cmdlogsvrlistener); }
xCAT::MsgUtils->message("S", "INFO xcatd: 'Command log writer' process $$ is terminated by USR2 signal");
xCAT::MsgUtils->message("S", "xcatd: 'Command log writer' process $$ is terminated by USR2 signal");
exit(0);
};
@@ -1222,7 +1222,7 @@ unless ($cmdlog_svrpid) {
if ($clientsock) { close($clientsock); }
if (-e $cmdlogservicefile) { unlink("$cmdlogservicefile"); }
if ($cmdlogsvrlistener) { close($cmdlogsvrlistener); }
xCAT::MsgUtils->message("S", "INFO xcatd: 'Command log writer' process $$ is terminated by TERM or INT signal");
xCAT::MsgUtils->message("S", "xcatd: 'Command log writer' process $$ is terminated by TERM or INT signal");
exit(0);
};
@@ -1246,10 +1246,10 @@ unless ($cmdlog_svrpid) {
$cmdlogfileswitch = 1;
}
if (!$trytime) {
xCAT::MsgUtils->message("S", "INFO xcatd: 'Command log writer' process $$ get HUP signal, reopen commands.log file failed, send TERM signal to kill itself");
xCAT::MsgUtils->message("S", "xcatd: 'Command log writer' process $$ get HUP signal, reopen commands.log file failed, send TERM signal to kill itself");
kill 'INT', $$;
} else {
xCAT::MsgUtils->message("S", "INFO xcatd: 'Command log writer' process $$ get HUP signal, reopen commands.log file");
xCAT::MsgUtils->message("S", "xcatd: 'Command log writer' process $$ get HUP signal, reopen commands.log file");
}
};
@@ -1260,7 +1260,7 @@ unless ($cmdlog_svrpid) {
Listen => 8192);
if (not $cmdlogsvrlistener and open($cmdlogpidfile, "<", "$cmdlogservicefile")) {
xCAT::MsgUtils->message("S", "INFO xcatd: 'Command log writer' process $$ is trying to get port $cmdlog_port");
xCAT::MsgUtils->message("S", "xcatd: 'Command log writer' process $$ is trying to get port $cmdlog_port");
my $pid = <$cmdlogpidfile>;
if ($pid) {
kill 'USR2', $pid;
@@ -1319,7 +1319,7 @@ unless ($cmdlog_svrpid) {
if ($cmdlogfile) { close($cmdlogfile); }
if ($cmdlogsvrlistener) { close($cmdlogsvrlistener); }
xCAT::MsgUtils->message("S", "INFO xcatd: 'Command log writer' process $$ stop");
xCAT::MsgUtils->message("S", "xcatd: 'Command log writer' process $$ stop");
}
# ----used for command log end---------
@@ -9,39 +9,32 @@ echo "post scripts" >/root/post.log
[ $MASTER_IP ] || export MASTER_IP="#ENV:MASTER_IP#"
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/scriptlib#
export PRINIC=#TABLEBLANKOKAY:noderes:THISNODE:primarynic#
if [ "$PRINIC" == "mac" ]
export PRINIC="#TABLEBLANKOKAY:noderes:THISNODE:primarynic#"
if [ "$PRINIC" == "mac" ] || [ -z "$PRINIC" ]
then
export PRINIC='#GETPRINICMAC:THISNODE#'
fi
if [ -z "$PRINIC" ]
if [ -n "$PRINIC" ] && [[ "$(echo "$PRINIC" | grep -sqE ^[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+$ ;echo $?)" == "0" ]]
then
export PRINIC=eth0
elif [[ `echo "$PRINIC" | grep -sqE ^[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+$ ;echo $?` == "0" ]]; then
#export PRINIC=`ifconfig -a | grep -i "HWaddr $PRINIC" | awk '{print $1}'`
export PRINIC=`ip -o link|grep -i "$PRINIC" |awk '{print $2}'|sed s/://`
export PRINIC="$(ip -o link | grep -i "$PRINIC" | awk '{print $2}' | sed 's/://')"
fi
#IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}')
IP=$(ip -4 -o a sh dev $PRINIC | awk '/inet/{print $4}' | head -n 1 | awk -F '/' '{print $1}')
if [ -z $IP ]
IP="$(ip -4 -o a sh dev "$PRINIC" | awk '/inet/{print $4}' | head -n 1 | awk -F '/' '{print $1}')"
if [ -z "$IP" ]
then
dhclient $PRINIC
#IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}')
IP=$(ip -4 -o a sh dev $PRINIC | awk '/inet/{print $4}' | head -n 1 | awk -F '/' '{print $1}')
dhclient "$PRINIC"
IP=$(ip -4 -o a sh dev "$PRINIC" | awk '/inet/{print $4}' | head -n 1 | awk -F '/' '{print $1}')
fi
if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then
msgutil_r "$MASTER_IP" "debug" "PRINIC=$PRINIC,IP=$IP" "/var/log/xcat/xcat.log"
fi
if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then
msgutil_r "$MASTER_IP" "debug" "generating /etc/resolv.conf" "/var/log/xcat/xcat.log"
fi
echo "search #TABLE:site:key=domain:value#" >/etc/resolv.conf
for i in $(echo #TABLE:site:key=nameservers:value# | tr ',' ' ')
for i in $(echo "#TABLE:site:key=nameservers:value#" | tr ',' ' ')
do
echo "nameserver $i"
done >>/etc/resolv.conf
@@ -0,0 +1,14 @@
bash
ifupdown
nfs-common
openssl
isc-dhcp-client
libc-bin
openssh-server
openssh-client
wget
vim
rsync
busybox-static
gawk
dnsutils
@@ -0,0 +1 @@
compute.ubuntu18.04.ppc64el.pkglist
@@ -0,0 +1,14 @@
bash
ifupdown
nfs-common
openssl
isc-dhcp-client
libc-bin
openssh-server
openssh-client
wget
vim
rsync
busybox-static
gawk
dnsutils
@@ -68,9 +68,9 @@ xCATCmd () {
# $2 is the command
ARCH=`uname -m`
if [ x$ARCH = x"ppc64" -a x$OS = x"rh" ]; then
echo "<xcatrequest>\n<command>${2}</command>\n</xcatrequest>" | /usr/sbin/chroot ${MNTDIR} /usr/bin/openssl s_client -quiet -no_ssl3 -no_ssl2 -connect ${1} -rand /bin/nice 2>/dev/null
echo "<xcatrequest>\n<command>${2}</command>\n</xcatrequest>" | /usr/sbin/chroot ${MNTDIR} /usr/bin/openssl s_client -quiet -no_ssl3 $(/usr/sbin/chroot ${MNTDIR} /usr/bin/openssl s_client -help 2>&1 | grep -m 1 -o -- -no_ssl2) -connect ${1} -rand /bin/nice 2>/dev/null
else
echo "<xcatrequest>\n<command>${2}</command>\n</xcatrequest>" | LD_LIBRARY_PATH=${MNTDIR}/lib64:${MNTDIR}/usr/lib64 ${MNTDIR}/usr/bin/openssl s_client -quiet -no_ssl3 -no_ssl2 -connect ${1} -rand /bin/nice 2>/dev/null
echo "<xcatrequest>\n<command>${2}</command>\n</xcatrequest>" | LD_LIBRARY_PATH=${MNTDIR}/lib64:${MNTDIR}/usr/lib64 ${MNTDIR}/usr/bin/openssl s_client -quiet -no_ssl3 $(LD_LIBRARY_PATH=${MNTDIR}/lib64:${MNTDIR}/usr/lib64 ${MNTDIR}/usr/bin/openssl s_client -help 2>&1 | grep -m 1 -o -- -no_ssl2) -connect ${1} -rand /bin/nice 2>/dev/null
fi
}
@@ -128,7 +128,7 @@ GetSyncInfo () {
xCATCmd () {
# $1 is the xCAT server
# $2 is the command
echo "<xcatrequest>\n<command>${2}</command>\n</xcatrequest>" | LD_LIBRARY_PATH=${MNTDIR}/lib64:${MNTDIR}/usr/lib64 ${MNTDIR}/usr/bin/openssl s_client -quiet -no_ssl3 -no_ssl2 -connect ${1} -rand /bin/nice 2>/dev/null
echo "<xcatrequest>\n<command>${2}</command>\n</xcatrequest>" | LD_LIBRARY_PATH=${MNTDIR}/lib64:${MNTDIR}/usr/lib64 ${MNTDIR}/usr/bin/openssl s_client -quiet -no_ssl3 $(LD_LIBRARY_PATH=${MNTDIR}/lib64:${MNTDIR}/usr/lib64 ${MNTDIR}/usr/bin/openssl s_client -help 2>&1 | grep -m 1 -o -- -no_ssl2) -connect ${1} -rand /bin/nice 2>/dev/null
}
@@ -128,7 +128,7 @@ GetSyncInfo () {
xCATCmd () {
# $1 is the xCAT server
# $2 is the command
echo "<xcatrequest>\n<command>${2}</command>\n</xcatrequest>" | /usr/sbin/chroot ${MNTDIR} /usr/bin/openssl s_client -quiet -no_ssl3 -no_ssl2 -connect ${1} -rand /bin/nice 2>/dev/null
echo "<xcatrequest>\n<command>${2}</command>\n</xcatrequest>" | /usr/sbin/chroot ${MNTDIR} /usr/bin/openssl s_client -quiet -no_ssl3 $(/usr/sbin/chroot ${MNTDIR} /usr/bin/openssl s_client -help 2>&1 | grep -m 1 -o -- -no_ssl2) -connect ${1} -rand /bin/nice 2>/dev/null
}
@@ -10,6 +10,24 @@ use File::Basename;
use File::Path;
use Cwd qw(realpath);
sub varsubinline{
my $line=shift;
my $refvardict=shift;
my @varsinline= $line =~ /\$\{?(\w+)\}?/g;
my @unresolvedvars;
foreach my $var(@varsinline){
if(exists $refvardict->{$var}){
$line=~ s/\$\{$var\}/$refvardict->{$var}/g;
$line=~ s/\$$var/$refvardict->{$var}/g;
}else{
push @unresolvedvars,$var;
}
}
return $line;
}
sub get_profile_def_filename {
my $osver = shift;
my $profile = shift;
@@ -54,6 +72,8 @@ sub include_file
my $file = shift;
my $idir = shift;
my @text = ();
$file=varsubinline($file,\%ENV);
unless ($file =~ /^\//) {
$file = $idir . "/" . $file;
}
@@ -117,7 +137,6 @@ sub get_package_names {
$pkgtext =~ s/#INCLUDE:([^#^\n]+)#/include_file($1,$idir)/eg;
}
}
#print "\n\npkgtext=$pkgtext\n\n";
my @tmp = split(',', $pkgtext);
my $pass = 1;
@@ -169,7 +188,6 @@ sub get_package_names {
}
}
}
return %pkgnames;
}
@@ -10,7 +10,7 @@ XCATMASTER=$XCAT
STATEMNT="$(getarg STATEMNT=)"
rootlimit="$(getarg rootlimit=)"
xcatdebugmode="$(getarg xcatdebugmode=)"
rflags="$(getarg rootflags=)"
getarg nonodestatus
NODESTATUS=$?
@@ -77,10 +77,14 @@ if [ -r /rootimg.sfs ]; then
elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then
logger $SYSLOGHOST -t $log_label -p local4.info "Setting up RAM-root tmpfs on downloaded rootimg.cpio.[gz/xz]..."
echo Setting up RAM-root tmpfs.
if [ -z $rootlimit ];then
mount -t tmpfs -o mode=755 rootfs $NEWROOT
rootopts="mode=755"
if [ -n "$rflags" ]; then
rootopts="$rootopts","$rflags"
fi
if [ -z "$rootlimit" ];then
mount -t tmpfs -o $rootopts rootfs $NEWROOT
else
mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT
mount -t tmpfs -o "$rootopts",size=$rootlimit rootfs $NEWROOT
fi
cd $NEWROOT
+8 -2
View File
@@ -69,7 +69,7 @@ my $prompt;
my $ignorekernelchk;
my $noupdate;
my $lock;
my $envar;
sub xdie {
@@ -186,6 +186,7 @@ GetOptions(
'onlyinitrd' => \$onlyinitrd,
'ignorekernelchk' => \$ignorekernelchk,
'noupdate' => \$noupdate,
'env=s' => \$envar,
);
if (@ARGV > 0) {
@@ -376,6 +377,11 @@ unless ($onlyinitrd) {
exit 1;
}
my @envarlist=split(',',$envar);
foreach my $entry (@envarlist){
my ($key,$value)=split('=',$entry);
$ENV{xCAT::Utils->strim($key)}=xCAT::Utils->strim($value);
}
mount_chroot($rootimg_dir);
my %pkg_hash = imgutils::get_package_names($pkglist);
@@ -784,6 +790,7 @@ if ($postinstall_filename) {
$ENV{IMG_OTHERPKGLIST}=$otherpkglist if("" ne $otherpkglist);
$ENV{IMG_OTHERPKGDIR}=$srcdir_otherpkgs if("" ne $srcdir_otherpkgs);
$ENV{IMG_ROOTIMGDIR}=$rootimg_dir if("" ne $rootimg_dir);
foreach my $postinstall (split /,/, $postinstall_filename) {
if (!-x $postinstall) {
@@ -1944,7 +1951,6 @@ sub generic_post { #This function is meant to leave the image in a state approxi
print $cfgfile "tmpfs /dev/shm tmpfs defaults 0 0\n";
print $cfgfile "proc /proc proc defaults 0 0\n";
print $cfgfile "sysfs /sys sysfs defaults 0 0\n";
if (!&using_systemd($osver)) {
if ($tmplimit) {
print $cfgfile "tmpfs /tmp tmpfs defaults,size=$tmplimit 0 2\n";
@@ -0,0 +1,18 @@
bash
ifupdown
nfs-common
openssl
isc-dhcp-client
libc-bin
linux-image-generic
openssh-server
openssh-client
wget
vim
rsync
busybox-static
gawk
dnsutils
tar
gzip
xz-utils
@@ -0,0 +1 @@
compute.ubuntu18.04.ppc64el.pkglist
@@ -0,0 +1,18 @@
bash
ifupdown
nfs-common
openssl
isc-dhcp-client
libc-bin
linux-image-generic
openssh-server
openssh-client
wget
vim
rsync
busybox-static
gawk
dnsutils
tar
gzip
xz-utils
+7 -2
View File
@@ -2,7 +2,7 @@
#
# go-xcat - Install xCAT automatically.
#
# Version 1.0.27
# Version 1.0.28
#
# Copyright (C) 2016, 2017, 2018 International Business Machines
# Eclipse Public License, Version 1.0 (EPL-1.0)
@@ -438,7 +438,12 @@ function check_package_version_deb()
do
if [[ "$1" = "${name[i]}" ]]
then
echo "${ver[i]}"
if [[ -n "${ver[i]}" ]]
then
echo "${ver[i]}"
else
echo "(not installed)"
fi
unset "name[${i}]" "ver[${i}]"
shift && continue 2
fi
@@ -215,12 +215,12 @@ switchdiscover_range_z_V
nodeset_shell
nodeset_cmdline
nodeset_runimg
xcatd_start_systemd
xcatd_stop_systemd
xcatd_restart_systemd
run_command_with_XCATBYPASS_systemd
disable_root_permission_in_policy_table_systemd
assign_certain_command_permission_systemd
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
sles_migration1
sles_migration2
@@ -212,12 +212,12 @@ nodeset_shell
nodeset_cmdline
nodeset_runimg
nodeset_check_warninginfo
xcatd_start_systemd
xcatd_stop_systemd
xcatd_restart_systemd
run_command_with_XCATBYPASS_systemd
disable_root_permission_in_policy_table_systemd
assign_certain_command_permission_systemd
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
sles_migration1
sles_migration2
@@ -227,12 +227,12 @@ switchdiscover_range_r
switchdiscover_range_x
switchdiscover_range_z
switchdiscover_range_z_V
xcatd_start_systemd
xcatd_stop_systemd
xcatd_restart_systemd
run_command_with_XCATBYPASS_systemd
disable_root_permission_in_policy_table_systemd
assign_certain_command_permission_systemd
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
xcatconfig_c
bmcdiscover_help
@@ -225,12 +225,12 @@ switchdiscover_range_x
switchdiscover_range_z
switchdiscover_range_z_V
nodeset_check_warninginfo
xcatd_start_systemd
xcatd_stop_systemd
xcatd_restart_systemd
run_command_with_XCATBYPASS_systemd
disable_root_permission_in_policy_table_systemd
assign_certain_command_permission_systemd
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
xcatconfig_c
bmcdiscover_help
@@ -198,12 +198,12 @@ switchdiscover_range_z_V
nodeset_shell
nodeset_cmdline
nodeset_runimg
xcatd_start_systemd
xcatd_stop_systemd
xcatd_restart_systemd
run_command_with_XCATBYPASS_systemd
disable_root_permission_in_policy_table_systemd
assign_certain_command_permission_systemd
xcatd_start
xcatd_stop
xcatd_restart
run_command_with_XCATBYPASS
disable_root_permission_in_policy_table
assign_certain_command_permission
sles_migration1
sles_migration2
reg_linux_statelite_installation_flat
@@ -203,12 +203,12 @@ nodeset_shell
nodeset_cmdline
nodeset_runimg
nodeset_check_warninginfo
xcatd_start_systemd
xcatd_stop_systemd
xcatd_restart_systemd
run_command_with_XCATBYPASS_systemd
disable_root_permission_in_policy_table_systemd
assign_certain_command_permission_systemd
xcatd_start
xcatd_stop
xcatd_restart
run_command_with_XCATBYPASS
disable_root_permission_in_policy_table
assign_certain_command_permission
reg_linux_diskless_installation_flat
reg_linux_statelite_installation_flat
SN_setup_case
@@ -258,12 +258,12 @@ switchdiscover_range_r
switchdiscover_range_x
switchdiscover_range_z
switchdiscover_range_z_V
xcatd_start_systemd
xcatd_stop_systemd
xcatd_restart_systemd
run_command_with_XCATBYPASS_systemd
disable_root_permission_in_policy_table_systemd
assign_certain_command_permission_systemd
xcatd_start
xcatd_stop
xcatd_restart
run_command_with_XCATBYPASS
disable_root_permission_in_policy_table
assign_certain_command_permission
xcatconfig_u_check_xcatsslversion_ubuntu
xcatconfig_c
bmcdiscover_help
@@ -262,12 +262,12 @@ switchdiscover_range_r
switchdiscover_range_x
switchdiscover_range_z
switchdiscover_range_z_V
xcatd_start_systemd
xcatd_stop_systemd
xcatd_restart_systemd
run_command_with_XCATBYPASS_systemd
disable_root_permission_in_policy_table_systemd
assign_certain_command_permission_systemd
xcatd_start
xcatd_stop
xcatd_restart
run_command_with_XCATBYPASS
disable_root_permission_in_policy_table
assign_certain_command_permission
nodeset_check_warninginfo
xcatconfig_u_check_xcatsslversion_ubuntu
xcatconfig_c
@@ -233,12 +233,12 @@ switchdiscover_range_r
switchdiscover_range_x
switchdiscover_range_z
switchdiscover_range_z_V
xcatd_start_systemd
xcatd_stop_systemd
xcatd_restart_systemd
run_command_with_XCATBYPASS_systemd
disable_root_permission_in_policy_table_systemd
assign_certain_command_permission_systemd
xcatd_start
xcatd_stop
xcatd_restart
run_command_with_XCATBYPASS
disable_root_permission_in_policy_table
assign_certain_command_permission
nodeset_shell
nodeset_cmdline
nodeset_runimg
@@ -243,10 +243,10 @@ switchdiscover_range_z_V
nodeset_shell
nodeset_cmdline
nodeset_runimg
xcatd_start_systemd
xcatd_stop_systemd
xcatd_restart_systemd
run_command_with_XCATBYPASS_systemd
disable_root_permission_in_policy_table_systemd
assign_certain_command_permission_systemd
xcatd_start
xcatd_stop
xcatd_restart
run_command_with_XCATBYPASS
disable_root_permission_in_policy_table
assign_certain_command_permission
nodeset_check_warninginfo
@@ -2,6 +2,7 @@ start:reventlog_resolved_parse_error1
description: Do not pass in any logs to clear
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd:reventlog $$CN resolved
check:rc==1
check:output=~Error: (\[.*?\]: )?Usage error. Provide a comma separated
@@ -11,6 +12,7 @@ start:reventlog_resolved_parse_error2
description: Do not pass in any logs to clear, include = sign
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd:reventlog $$CN resolved=
check:rc==1
check:output=~Error: (\[.*?\]: )?Usage error. Provide a comma separated
@@ -20,6 +22,7 @@ start:reventlog_resolved_parse_error3
description: forgot the = sign
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd:reventlog $$CN resolved 1,2,3
check:rc==1
check:output=~Error: (\[.*?\]: )?Usage error. Provide a comma separated
@@ -29,6 +32,7 @@ start:reventlog_resolved_parse_error4
description: Pass in a negative number
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd:reventlog $$CN resolved=-1
check:rc==1
check:output=~Error: (\[.*?\]: )?Invalid ID=
@@ -38,6 +42,7 @@ start:reventlog_resolved_parse_error5
description: Pass in a string
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd:reventlog $$CN resolved=abc
check:rc==1
check:output=~Error: (\[.*?\]: )?Invalid ID=
@@ -47,6 +52,7 @@ start:reventlog_resolved_list
description: Pass in a list of ids
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd:reventlog $$CN resolved=100,101
check:rc==0
check:output=~Attempting to resolve the following log entries: 100,101...
@@ -56,6 +62,7 @@ start:reventlog_resolved_LED
description: Pass in a LED keyword
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd:reventlog $$CN resolved=Led
check:rc==0
check:output=~Attempting to resolve the following log entries: Led...
@@ -2,6 +2,7 @@ start:rflash_check
description: Make sure the --check option works
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd:rflash $$CN --check
check:rc==0
check:output=~$$CN: BMC Firmware Product
@@ -12,6 +13,7 @@ start:rflash_invalid_activate
description: Provide an invalid option for activte, file does not end in .tar
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd: rflash $$CN -a /tmp/abc123.tz
check:rc==1
check:output=~Error: (\[.*?\]: )?Invalid firmware specified with -a
@@ -21,6 +23,7 @@ start:rflash_invalid_activate_and_delete
description: Cannot specify -a and --delete at the same time
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd: rflash $$CN -a 123 --delete 123
check:rc==1
check:output=~Error: (\[.*?\]: )?Multiple options are not supported
@@ -30,6 +33,7 @@ start:rflash_invalid_id
description: Passing an invalid ID to activate
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd: rflash $$CN -a 123
check:rc==1
check:output=~Error: (\[.*?\]: )?Invalid ID provided to activate
@@ -39,6 +43,7 @@ start:rflash_invalid_multiple_id_3
description: Code does not currently support multiple IDs to activate
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd: rflash $$CN -a 123 abc asdbas
check:rc==1
check:output=~Error: (\[.*?\]: )?More than one firmware specified is not supported
@@ -48,6 +53,7 @@ start:rflash_invalid_multiple_id_2
description: Code does not currently support multiple IDs to activate
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd: rflash $$CN -a asdbas 123
check:rc==1
check:output=~Error: (\[.*?\]: )?More than one firmware specified is not supported
@@ -57,6 +63,7 @@ start:rflash_invalid_node
description: Activate a valid ID hash but forget to put in a node range
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd: rflash -a 221d9020
check:rc==1
check:output=~Error: (\[.*?\]: )?Invalid nodes and/or groups in noderange: 221d9020
@@ -66,6 +73,7 @@ start:rflash_invalid_delete_2
description: Attempt to delete more than 1 ID from the FW
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd: rflash $$CN --delete 221d9020 221d9020
check:rc==1
check:output=~Error: (\[.*?\]: )?More than one firmware specified is not supported
@@ -75,6 +83,7 @@ start:rflash_delete_active_bmc
description: Attempt to delete the active BMC firmware
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd: rflash $$CN -l | grep \* | grep BMC | awk '{print $2}' | xargs -i{} rflash $$CN --delete {}
check:rc==1
check:output=~$$CN: (\[.*?\]: )?Error: Deleting currently active BMC firmware is not supported
@@ -1,6 +1,7 @@
start:rinv_record_firmware_level
description: Record the firmware level for the start of each testcase
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd: rinv $$CN firm
check:rc==0
end
@@ -8,6 +9,7 @@ end
start:rinv_check_active_fw_count
description: Ensure that there is only 2 active firmware, one for bmc and one for pnor
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd: rinv $$CN firm | tee /tmp/xcattest.rinv_check_active_fw_count.output
check:rc==0
cmd: grep -i ibm /tmp/xcattest.rinv_check_active_fw_count.output | grep -i 'HOST Firmware Product' | grep -i 'Active)\*' | wc -l
@@ -23,6 +25,7 @@ end
start:rinv_check_active_fw_count_verbose
description: Ensure that there is only 2 active firmware, one for bmc and one for pnor (in verbose mode) (Issue #4236)
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd: rinv $$CN firm -V | tee /tmp/xcattest.rinv_check_active_fw_count_verbose.output
check:rc==0
cmd: grep -i ibm /tmp/xcattest.rinv_check_active_fw_count_verbose.output| grep -i 'HOST Firmware Product' | grep -i 'Active)\*' | wc -l
@@ -1,6 +1,7 @@
start:rspconfig_record_firmware_level
description: Record the firmware level for the start of each testcase
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd: rinv $$CN firm
check:rc==0
end
@@ -9,6 +10,7 @@ start:rspconfig_get_all
description: Check that we can get all the attributes from the BMC
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd:rspconfig $$CN ip netmask gateway hostname vlan
check:rc==0
check:output=~$$CN: BMC IP:
@@ -21,6 +23,7 @@ end
start:rspconfig_get_all_error
description: Check the parsing code for rspconfig (error cases)
hcp: openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd: rspconfig $$CN ip,netmask,gateway,hostname,vlan
check:rc==1
check:output=~Error: (\[.*?\]: )?Unsupported command
@@ -29,6 +32,7 @@ end
start:rspconfig_get_set_error
description: Check the parsing code for rspconfig (error cases) - Cannot get/set in same line
hcp: openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd: rspconfig $$CN ip netmask=255.0.0.0
check:rc==1
check:output=~Error: (\[.*?\]: )?Can not set and query OpenBMC information at the same time
@@ -38,6 +42,7 @@ start:rspconfig_get_and_set_hostname
description: Test setting and getting hostname on the BMC
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
# Save the hostname to a file....
cmd:rspconfig $$CN hostname | tee /tmp/xcattest.rspconfig.hostname
check:rc==0
@@ -2,6 +2,7 @@ start:supported_cmds_rpower
description: Make sure the rpower command works ...
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd:rpower $$CN state
check:rc==0
check:output=~$$CN:
@@ -14,6 +15,7 @@ start:supported_cmds_rinv
description: Make sure that the rinv command works...
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd: rinv $$CN
check:rc==0
check:output=~$$CN:
@@ -39,6 +41,7 @@ start:supported_cmds_rvitals
description: Make sure that the rvitals command works...
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd: rvitals $$CN
check:rc==0
check:output=~$$CN:
@@ -71,6 +74,7 @@ start:supported_cmds_rbeacon
description: Make sure the rbeacon command works ...
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd:rbeacon $$CN on
check:rc==0
check:output=~$$CN: on
@@ -83,6 +87,7 @@ start:supported_cmds_reventlog
description: Make sure the reventlog command works ...
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd:reventlog $$CN
check:rc==0
check:output=~$$CN:
@@ -98,6 +103,7 @@ start:supported_cmds_rflash
description: Make sure the rflash command works ...
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd:rflash $$CN -c
check:rc==0
check:output=~$$CN: BMC Firmware Product:
@@ -111,6 +117,7 @@ start:supported_cmds_rsetboot
description: Make sure the rsetboot command works ...
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd:rsetboot $$CN stat
check:rc==0
check:output=~$$CN:
@@ -120,6 +127,7 @@ start:supported_cmds_rspconfig
description: Make sure the rspconfig command works ...
os:Linux
hcp:openbmc
label:cn_bmc_ready,hctrl_openbmc
cmd:rspconfig $$CN ipsrc
check:rc==0
check:output=~$$CN: BMC IP Source:
@@ -1,6 +1,6 @@
start:check_mn_cluster_log_file
os:Linux
description:check known error message in /var/log/xcat/cluster.log file. Only for redhat and sles.
label:mn_only
cmd:cat /var/log/xcat/cluster.log | grep "xcatd: Error happened when receiving data from DB access"
check:output!~xcatd: Error happened when receiving data from DB access
cmd:cat /var/log/xcat/cluster.log | grep "Undefined subroutine &main"
+15 -1
View File
@@ -1,11 +1,13 @@
start:chdef_null
description:chdef without any flag
label:mn_only,db
cmd:chdef
check:output=~Usage
end
start:chdef_t_node
description:chdef -t node
label:mn_only,db
cmd:mkdef -t node -o testnode groups=all
check:rc==0
cmd:chdef -t node -o testnode groups=aix
@@ -34,6 +36,7 @@ end
start:chdef_t_network
description:chdef -t network
label:mn_only,db
cmd:chdef -t network -o testnetwork net=111.222.33.0 mask=255.255.255.254
check:rc==0
cmd:lsdef -t network -l testnetwork
@@ -52,6 +55,7 @@ end
start:chdef_p
description:chdef -p -t node
label:mn_only,db
cmd:mkdef -t node -o testnode groups=all
check:rc==0
cmd:chdef -p -t node -o testnode groups=aix
@@ -63,6 +67,7 @@ end
start:chdef_m
description:chdef -m -t node
label:mn_only,db
cmd:mkdef -t node -o testnode groups=all,testgroup
check:rc==0
cmd:chdef -m -t node -o testnode groups=testgroup
@@ -74,6 +79,7 @@ end
start:chdef_z
description:chdef -z
label:mn_only,db
cmd:mkdef -t node -o testnode groups=all
check:rc==0
cmd:lsdef testnode -z > /tmp/testnode.stanza
@@ -91,6 +97,7 @@ end
start:chdef_group
description:chdef with node group
label:mn_only,db
cmd:mkdef -t node -o testnode1-testnode2 mgt=hmc cons=hmc groups=all,systemp
check:rc==0
cmd:mkdef -t node -o testnode3-testnode4 mgt=ipmi cons=ipmi groups=all,systemx
@@ -127,6 +134,7 @@ end
start:chdef_group_p
label:mn_only,db
cmd:chdef abcnode1 -p groups=abc
check:rc==0
cmd:chdef abcnode2 -p groups=abcabc
@@ -144,6 +152,7 @@ end
start:chdef_dynamic_group
description:chdef with dynamic node group
label:mn_only,db
cmd:mkdef -t node -o testnode1-testnode2 mgt=hmc cons=hmc groups=all,systemp
check:rc==0
cmd:mkdef -t node -o testnode3-testnode4 mgt=hmc cons=ipmi groups=all,systemx
@@ -190,6 +199,7 @@ end
start:chdef_multiple_keys
description:mkdef support for multiple keys in a table, such as ppcdirect
label:mn_only,db
cmd: mkdef -t node -o testfsp mgt=fsp cons=fsp groups=all,fsp nodetype=fsp passwd.HMC=abc123 passwd.general=abc123 passwd.admin=abc123
check:rc==0
cmd:lsdef testfsp
@@ -210,6 +220,7 @@ end
start:chdef_n
description:chdef -n
label:mn_only,db
cmd:mkdef -t node -o testnode1 mgt=hmc cons=hmc groups=all,systemp
check:rc==0
cmd:chdef testnode1 -n testnode2
@@ -228,6 +239,7 @@ end
start:chdef_t_o_error
description:chdef -t wrongtype
label:mn_only,db
cmd:chdef -t wrongtype -o testnode groups=all,aix
check:rc!=0
check:output=~not a valid
@@ -235,8 +247,8 @@ end
start:chdef_template
os:linux
description:try to change a template, a new node is created according to chdef.
label:mn_only,db
cmd:result=`lsdef | grep switch-template`; if [[ $result =~ "switch-template" ]]; then echo $result; noderm switch-template; fi
cmd:chdef -t node -o switch-template groups=test
check:output=~1 object definitions have been created or modified
@@ -249,8 +261,10 @@ check:rc==0
cmd:noderm switch-template
check:rc==0
end
start:chdef_site_check
description:This case is use to check site table could be changed successfully
label:mn_only,db
cmd:var=`lsdef -t site clustersite -i dhcplease|grep 'dhcplease=' |awk -F= '{print $2}'`;echo $var>/tmp/sitevalue;chdef -t site clustersite dhcplease=300
check:rc==0
check:output=~1 object definitions have been created or modified.
@@ -1,44 +0,0 @@
start:chkosimage_h
description:chkosimage -h and --help
os:AIX
cmd:chkosimage -h
check:output=~usage|Usage
cmd:chkosimage --help
check:output=~usage|Usage
end
start:chkosimage_imagename
description: chkosimage autotest
os:AIX
cmd:mknimimage -V -s $$SOURCE autotest
check:rc==0
cmd:lsnim | grep autotest
check:rc==0
check:output=~lpp_source
check:output=~spot
check:output=~bosinst_data
cmd:nim -o update -a packages=all -a source=$$SSHPKG autotest_lpp_source
check:rc==0
cmd:mkdir -p /install/nim/installp_bundle
cmd:cp $$SSHPKG/xCATaixCN71.bnd /install/nim/installp_bundle/
check:rc==0
cmd:nim -o define -t installp_bundle -a server=master -a location=/install/nim/installp_bundle/xCATaixCN71.bnd xCATaixCN71
cmd:chdef -t osimage -o autotest installp_bundle="xCATaixCN71"
check:rc==0
cmd:chkosimage autotest
check:rc==0
end
start:chkosimage_V_c_imagename
description:chkosimage -V -c autotest
os:AIX
cmd:lsnim | grep autotest
check:rc==0
check:output=~lpp_source
check:output=~spot
check:output=~bosinst_data
cmd:chkosimage -V -c autotest
check:rc==0
end
+8
View File
@@ -1,5 +1,6 @@
start:chtab_null
description:Check chtab with no attr
label:mn_only,db
cmd:chtab
check:rc!=0
check:output=~Usage
@@ -8,6 +9,7 @@ end
start:chtab_d
description:check chtab -d
label:mn_only,db
cmd:chtab key=rsh_test site.value=/opt/xcat/bin/rcp site.comments="the rcp command" site.disable=no
check:rc==0
cmd:tabdump site | grep rsh_test
@@ -21,6 +23,7 @@ end
start:chtab_modify_node
description:test chtab with node=XXX
label:mn_only,db
cmd:chdef -t node -o testnode groups=rhels5.5
check:rc==0
cmd:chtab node=testnode nodelist.groups=all
@@ -33,6 +36,7 @@ end
start:chtab_modify_key
description:check chtab with key=xxx
label:mn_only,db
cmd:chtab key=rsh_test site.value=/opt/xcat/bin/rcp site.comments="the rcp command"
check:rc==0
cmd:tabdump site | grep rsh_test
@@ -52,6 +56,7 @@ end
start:chtab_err_symble
description: check chtab with error attr
label:mn_only,db
cmd:chtab -t
check:output=~Usage
end
@@ -59,6 +64,7 @@ end
start:chtab_err_table
description:chtab with error table
label:mn_only,db
cmd:chtab error=error site.comment=error
check:rc!=0
check:output=~no such column|column \"error\" does not exist
@@ -67,6 +73,7 @@ end
start:chtab_h
description:chtab -h and --help
label:mn_only,db
cmd:chtab -h
check:output=~Usage
cmd:chtab --help
@@ -76,6 +83,7 @@ end
start:chtab_v
description:chtab -v and -version
label:mn_only,db
cmd:chtab -v
check:output=~Version
cmd:chtab -version
+8
View File
@@ -4,8 +4,10 @@
#check:rc!=0
#check:output=~Usage
#end
start:chvm_p
hcp:hmc
label:others,virtualization
cmd:mkdef -t node -o testnode mgt=hmc groups=all
cmd:mkvm testnode -i $$MaxLparID -l $$CN
check:rc==0
@@ -26,8 +28,10 @@ check:output=~__GETNODEATTR($$CN, pprofile)__
cmd:rmvm testnode
cmd:rm -f /tmp/autotest.profile
end
start:chvm_attr
hcp:hmc
label:others,virtualization
cmd:mkdef -t node -o testnode mgt=hmc groups=all
cmd:mkvm testnode -i $$MaxLparID -l $$CN
check:rc==0
@@ -38,12 +42,16 @@ cmd:lsvm testnode
check:output=~min_mem=1024
cmd:rmvm testnode
end
start:chvm_node
label:mn_only,virtualization
cmd:chvm $$CN
check:rc!=0
check:output=~Usage
end
start:chvm_err_node
label:mn_only,virtualization
cmd:dir="/tmp/chvm_err_node";echo ${dir}".old";if [ -d "${dir}" ];then mv ${dir} ${dir}".old"; fi; mkdir -p $dir
check:rc==0
cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/chvm_err_node/bogusnode.stanza ;rmdef bogusnode;fi
@@ -1,5 +1,6 @@
start:dumpxCATdb_h
description:dumpxCATdb -h
label:mn_only,db
cmd:dumpxCATdb -h
check:rc==0
check:output=~dumpxCATdb
@@ -7,6 +8,7 @@ end
start:dumpxCATdb_v
description:Command Version
label:mn_only,db
cmd:dumpxCATdb -v
check:rc==0
check:output=~Version
@@ -14,6 +16,7 @@ end
start:dumpxCATdb_p_nullskiptables
description:dumpxCATdb -p path,not skiptables
label:mn_only,db
cmd:chtab key=skiptables site.value=""
check:rc==0
cmd:dumpxCATdb -p /tmp/db
@@ -29,6 +32,7 @@ end
start:dumpxCATdb_a_p_nullskiptables
description:dump all,without this flag the eventlog and auditlog will be skipped
label:mn_only,db
cmd:chtab key=skiptables site.value=""
check:rc==0
cmd:dumpxCATdb -a -p /tmp/db.all
@@ -43,6 +47,7 @@ end
start:dumpxCATdb_p_skiptables
description:To have dumpxCATdb not backup the hosts or passwd table
label:mn_only,db
cmd:chtab key=skiptables site.value="hosts,passwd"
check:rc==0
cmd:dumpxCATdb -p /tmp/db.skiptables
@@ -56,6 +61,7 @@ end
start:dumpxCATdb_a_p_skiptables
description:To have dumpxCATdb all but not backup the hosts or passwd table
label:mn_only,db
cmd:chtab key=skiptables site.value="hosts,passwd"
check:rc==0
cmd:dumpxCATdb -a -p /tmp/db.skiptables
@@ -70,6 +76,7 @@ end
start:dumpxCATdb_p_nullskiptables_V
description:test verbose and -p
label:mn_only,db
cmd:chtab key=skiptables site.value=""
check:rc==0
cmd:dumpxCATdb -p /tmp/db -V
@@ -83,6 +90,7 @@ end
start:dumpxCATdb_a_p_nullskiptables_V
description:test -V and -a
label:mn_only,db
cmd:chtab key=skiptables site.value=""
check:rc==0
cmd:dumpxCATdb -a -p /tmp/db -V
@@ -95,6 +103,7 @@ end
start:dumpxCATdb_p_V
description:test -p -V
label:mn_only,db
cmd:chtab key=skiptables site.value="passwd"
check:rc==0
cmd:dumpxCATdb -p /tmp/db -V
@@ -1,4 +1,5 @@
start:gettab_key_table
label:mn_only,db
cmd:gettab key=xcatdport site.value
check:rc==0
check:output==3001
@@ -7,6 +8,7 @@ end
start:gettab_H
description:gettab -H and --with-fieldname
label:mn_only,db
cmd:gettab -H key=master site.value
check:rc==0
check:output=~site.value:
@@ -17,6 +19,7 @@ end
start:gettab_err
description:gettab with error symble ,error key ,error attr.
label:mn_only,db
cmd:gettab -c
check:rc!=0
check:output=~Usage
@@ -30,6 +33,7 @@ end
start:gettab_h
description:gettab -h and -? and --help
label:mn_only,db
cmd:gettab -h
check:output=~Usage
cmd:gettab -?
@@ -0,0 +1,3 @@
deb http://ports.ubuntu.com/ubuntu-ports bionic main restricted universe
deb http://ports.ubuntu.com/ubuntu-ports bionic-updates main restricted universe
deb http://ports.ubuntu.com/ubuntu-ports bionic-security main restricted universe
@@ -0,0 +1,3 @@
deb http://archive.ubuntu.com/ubuntu bionic main restricted universe
deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe
deb http://archive.ubuntu.com/ubuntu bionic-security main restricted universe
@@ -1,60 +0,0 @@
start:Diskless_installation_flat_p8_le
os:Linux
cmd:copycds $$ISO
check:rc==0
cmd:makedns -n
check:rc==0
cmd:makedhcp -n
check:rc==0
cmd:makedhcp -a
check:rc==0
cmd:makeconservercf $$CN
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; 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; 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;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
cmd:mount |sort > /tmp/mountoutput/file.org
cmd:cat /tmp/mountoutput/file.org
cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
check:rc==0
cmd:mount |sort > /tmp/mountoutput/file.new
cmd:cat /tmp/mountoutput/file.new
cmd:diff /tmp/mountoutput/file.org /tmp/mountoutput/file.new
check:rc==0
cmd:rm -rf /tmp/mountoutput
cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
check:rc==0
cmd:chdef $$CN status=
check:rc==0
cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
check:rc==0
check:output=~Provision node\(s\)\: $$CN
cmd:sleep 200
cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 100 ];then break;fi done
cmd:lsdef -l $$CN | grep status
check:output=~booted
cmd:xdsh $$CN date
check:rc==0
check:output=~\d\d:\d\d:\d\d
cmd:xdsh $$CN "cat /var/log/xcat/xcat.log"
cmd:rinstall $$CN osimage
check:rc==0
cmd:sleep 200
cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 100 ];then break;fi done
cmd:lsdef -l $$CN | grep status
check:output=~booted
cmd:xdsh $$CN date
check:rc==0
check:output=~\d\d:\d\d:\d\d
cmd:xdsh $$CN "cat /var/log/xcat/xcat.log"
cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi
check:rc==0
end
@@ -1,46 +0,0 @@
start:Full_installation_flat_p8_le
os:Linux
cmd:copycds $$ISO
check:rc==0
cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu" ]];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:chtab key=extntpservers site.value=""
check:rc==0
cmd:chtab key=ntpservers site.value="<xcatmaster>"
check:rc==0
cmd:makentp
check:rc==0
cmd:makedhcp -n
check:rc==0
cmd:makedhcp -a
check:rc==0
cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done
check:rc==0
cmd:makedns -n
check:rc==0
cmd:makeconservercf $$CN
check:rc==0
cmd:cat /etc/conserver.cf | grep $$CN
check:output=~$$CN
cmd:if [ "__GETNODEATTR($$CN,os)__" != "sles12.1" ];then chdef -t node -o $$CN postscripts=setupntp; fi
cmd:lsdef -l $$CN
check:rc==0
cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute
check:rc==0
check:output=~Provision node\(s\)\: $$CN
cmd:sleep 600
cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 60;((a++));if [ $a -gt 50 ];then break;fi done
cmd:ping $$CN -c 3
check:output=~64 bytes from $$CN
cmd:lsdef -l $$CN | grep status
check:output=~booted
cmd:xdsh $$CN date
check:rc==0
check:output=~\d\d:\d\d:\d\d
#comment for futher discussion.
#cmd:xdsh $$CN service ntpd status
#check:rc==0
#check:output=~running
cmd:xdsh $$CN "cat /var/log/xcat/xcat.log"
end
@@ -1,6 +1,7 @@
start:SN_diskless_setup_case
description:this case is used to test diskless service node installation
os:Linux
label:sn_diskless,provision
#stop:yes
cmd:fdisk -l
cmd:df -T

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