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

merge from master to 2.13 branch for 2.13.9 release. (1) (#4525)

* fix issueNode range not specified, see man page for syntax. return with no output when site.master is not set #4299

* Fix issue 4246, record rflash process in log file

* dodiscovery: better disksize - ordered by major,minor and no `\n` (#4219)

* better disksize: ordered by major,minor and no `\n`

* nodediscover:`disksize` sent correctly: no need to `split`,`join`

* general sort with explicit key columns, fix search pattern

* dodiscovery: Fix bugs

* dodiscovery: Fix ShellCheck SC2007,SC2004

* dodiscovery: simpler kcmdline parsing, disksize as IEC binary prefix

* Add test case - switch_to_dns_forward_mode

* Modify timeout of login by curl command for OpenBMC

* Add makegocons command

This patch enable goconserver service and manage the node sessions
with a new `makegocons` command.

Implement: #4215

* Refine the Cumulus Linux Section of the Doc (#4249)

* No content in the switches subdirectory in docs, remove

* Change the Network topic to Networking

* Refine and reformat the Cumulus Linux documentation

* Modify the script to build xCAT-genesis-base package (#4292)

* Verify hash ID

* change log messages

* Timeout the ntpd process if ntpd service is not running on ntpserver (#4321)

* enhance nodediscovery process: don't write "NOIP" if the node can not be resloved to an IP (#3995)

* enhance nodediscovery process, if only 1 mac and have \*NOIP\* append, don't write mac table and don't generate dhcp lease entry

* Enhance PR 3995: enhance nodediscovery process: don't write "NOIP" if the node can not be resloved to an IP

* modified depending on comments

* natural_sort_cmp: recursion to iterative implementation (#4314)

* natural_sort_cmp: recursion to iterative implementation

* natural_sort_cmp: correct prototype with parameters, as per `man perlfunc`

* Task 3339, rspconfig ip/netmask/gateway/vlan support

*   * Minor enhance on xcatperftest to put all logs into one file
  * Fix a bug in simulatorctl.sh, and it cause the script cannot be found

* modified depending on comments

* QA list for makehosts (#4284)

* QA list for makehosts

* Fix some bus in makegocons

* Revise test case - switch_to_dns_forward_mode

* Enhancements after the review

* Use IO::Socket to check BMC console port

* Revise test case - switch_to_dns_forward_mode

* modified depending on comments

* Add messages to inform the user of the general action started via xCAT for flashing firmware

* Fix bug, anything in the functional array is the one that's really active, priority will not be 0 if there is pending firmware

* Fix 4338, remove all of  in child process

* fix issue #4354 :The XCATTEST_CN in xcattest can not detect HCP as config file (#4355)

* Fix #4330, close the socket

* Add image name to /opt/xcat/xcatinfo on compute node (#4359)

* Integrate congo console from goconserver with rcons

Enhance the original implement of rcons to support goconserver.
`rcons` will help the user choose from one of the console backend
service based on the console server status of management node.

Implement #4216

* Fix 4363 - discovery broken (#4364)

* do not set exit_code to 1 when the clock is not synced before the timeout (#4362)

* Fix check for MTM values with spaces

* modified depending on comments

* rspconfig admin_password for OpenBMC

* Fix merging in xdcpmerge.sh (#4328)

* Fixes in xdcpmerge.sh

Two fixes:
1. The grep pattern when finding duplicate usernames is missing ":" at the end. So, for example user "test" would also match "test2, etc.". Adding the ":" delimiter fixes the issue.
2. Another issue happens when the file to be merged is a superset of the files on the nodes. For example, if a new user is added and entire passwd file (that is otherwise identical) is sent to be merged. In this case, the $filebackup.nodups file, i.e. the original file with duplicates removed, becomes empty and the condition "if [ -s "$filebackup.nodups" ]" does not execute. Then the merged file ends up being original file with the merge file fully appended, clearly not what was intended.

This is solved by changing the condition to check for file existence "-a" rather then for size. Additionally, I also turn the logic around so that the duplicates are removed from the merge file and then added to the original file. I think this makes logic a bit cleaner and also ensures that existing entries are not reordered or changed in any way.

* Streamlining previous commit

Adjustment to previous commit, streamlining and simplifying logic. Once $mergefile.nodups is created, just concatenate it the original file.

* Update to xdcpmerge

No need to copy $filebackup to $curfile, they are the same.

* Modify for debug conveniently

* add new cases and delete outdated test cases

* Modify genesis build script for centos x86_64

* Add space between at and the time

* Add a print out of the firmware levels for the various UT cases

* Add unit test cases for rspconfig

* rspconfig fix for set hostname

* Enhance the testing case for rspconfig setting hostname

* modified depending on comments

* modified depending on comments

* Add %pretrans script in <lua>. Handle directory to symlink change properly. See comment #3 of https://bugs.launchpad.net/rpm/+bug/633636

* Make xCAT-genesis-base confliects with early version of xCAT-genesis-scripts

* rspconfig dump to allow admins capture logs

* Adding comment

* Improve the error message when BMC does not return a dump ID

* Improve some messages and add timestamp for downloaded dump file

* Improve the message to help Admin figure out where the file is missing

* Leave a log file there when xCAT upgrade in case to debug issue while upgrading (#4389)

* Listen on 0.0.0.0 instead of the hostname

This patch modify the configuration of `makegocons` and `rcons`
for goconserver.

`cat /etc/goconserver/server.conf`
```
global:
  host: 0.0.0.0
  ssl_key_file: /etc/xcat/cert/server-key.pem
  ssl_cert_file: /etc/xcat/cert/server-cert.pem
  ssl_ca_cert_file: /etc/xcat/cert/ca.pem
  logfile: /var/log/goconserver/server.log
api:
  port: 12429
console:
  port: 12430
```

* Support hostname=* for openbmc

* Relay action and snmp configuration support for Coral PDU

* ddns.pm: specify the "directory" option for DNS slaves too (cf. bug #4392)

* Fix issue 4361, modify some sendmsg to message

* 1. add "makeconserver -d" to "rmdef -C", 2. add "makeconserver -C|--cleanup" to remove entries for removed nodes

* When there is a problem with the login, do not hide the message on debug mode. BMCReady does not make sense if the admin does not know how to find that state

* Change function from login_logout_request to login_request, not doing any logout here

* Check that RC is 200 to prevent unknown issues, handle the response generically

* OpenBMC rspconfig dump timeout fixes

* Fix issue 4408, modify error for rspconfig dump

* Clear all BMC Dump logs when BMC firmware flash

* modified depending on comments

* More modifications for pr 4386, to deal with the conflicts

* To handle one case which have 2 implementations, which one is for specific platform, on is for all platforms

* return when current status is RSPCONFIG_DUMP_DOWNLOAD_REQUEST

* fix issue 4417, delete 'clear next_status'

* fix issue 4353: rspconfig needs to support multiple IPs on the BMC and ignore ZeroConfigIPs

* Wait 15 seconds after OpenBMC interface with vlan tag to be activated

* Fix issue #4397: rspconfig <> hostname=xxx show error message when there is multiple network in bmc

* Some sentence modify for makeconservercf -C|--cleanup

* OpenBMC rspconfig dump better dump file name formatting

* Removed the --check and --ipsource option with PR 4258, update the man page

* Improve the message on the HTTP response

* modified depending on comments

* Only handle 404 and 504 in the login request code, defer the rest to deal_with_response()

* rflash stream support

* 1. configure ip/netmask/gateway only on the NIC whose IP match node BMC attribute, 2. add some information for LinkLocal address

* Fix confignetwork bond nic_type detection with multiple bonds

* Modified configonie --ntp command (#4436)

* Add man page for makegocons

This is the guide about how to make goconserver as
a replacement for conserver to help slove the issues reported
for conserver, like: #4043, #3543. For openbmc, the solution of
goconserver is much light-weighted than the conserver which could
help save the system resource. In addition, sshpass is not needed
for openbmc with goconserver.

Implement: #4337

* Add another key for node_info in order not to after the content of $node_info{$node}{bmc}

* enhance rflash stream

* makedhcp does not work well when all service nodes not running dhcp but disjointdhcps=1 (#4426) (#4440)

- if all service nodes not running dhcp, to treat it as disjointdhcps=0
- nodeset will send request to MN by default even if disjointdhcps=1
- Move out of the dhcp service checking from opts pre-check, and do it just before real makedhcp handling.

* rspconfig configure bmc vlan will hung because of PR 4383

* OpenBMC rspconfig dump enhancements

* Changes due to review comments

* Print debug message before login attempt

* Add warning when xCAT throttles SSL connections

* Display first [openbmc_debug] when entering openbmc.pm

* modified error msg

* Make sure credential files have a trailing newline (#4442)

* modified depending on comments

* Fix the typo in the man page of makegocons

* Update the print out based on the review comment, should not use  since the regular expression is removed

* Modify the nodeset disjoint test case accordingly for #4426

* Use short hostname in rcons for goconserver

As the certificate of xcat is signed with short hostname, this
commit force to use the short hostname in  the environment variable for
`congo console`.

* Fix issue 3497, make sense for reventlog msg

* Give summary after flash active when no debugmode

* Fix the issue that the IP configuration will fail if bmc attribute is a hostname

* enhance genimage for sles12sp2 (#4450)

* Add dhcp-client-identifier to lease block (#4429)

Machines that use Infiniband for PXE booting need to have the
dhcp-client-identifier set in the lease block.
Without it, they will not get the lease from the server.

* Support multiple bonds on bring-up

* modified depending on comments

* fix the check for rc to 1 on error cases

* modify response for bmcdiscover when error

* Ignore syslog error in monitorctrl when setNodeStatusAttributes (#4459)

* fix issue https://github.com/xcat2/xcat-core/issues/4411 (#4462)

* fix issue Compute nodes fail to get provisioned #4411: covert imgsrv and xcatmaster to their ip addresses in case the hostname cannot be resolved inside initrd for diskless

* More strict check to tell if it is a chroot env to avoid modify DB (#4463)

when genimage for SN image (#4365)

* issues for install license file on accton switches (#4460)

* Add test cases for rflash regular usage against openbmc

* modify depending on xuwei's comment

* add 2 more cases for option d

* enhance rflash upload message

* Do not display message for clearing dumps when only PNOR

* Display hostname even if multiple IP addresses

* modified depending on comments

* polished message

* Modify the default consoleondemand based on the global setting

This commit fix the bug that consoleondemand works incorrectly.

* modify depending on comments

* modified depending on comments

* enhance rflash error messages

* Modify documenation for servicenode attributes

* build rst file from Schema.pm by db2man

* change status back to starts

* modified depending on comments

* rm openbmcevents

* Usage and man page update for rspconfig dump

* let rflash error message flexible

* Add support for the "file -> (noderange) file" syntax in synclist with ServiceNodes (#4445)

* Add support for "file -  (noderange) file" in synclist when using
hierarchical mode. Fixes #4425

  This patch ensures that:
  1. the synclist is correctly parsed when running on a Service Node
  2. all files are synchronized to SNs in hierarchical mode

* Better test condition for #4425, addresses issue in
https://github.com/xcat2/xcat-core/pull/4445#issuecomment-349472901

* Fix issue 4477, if has node-<mac> will not create node-<mtms> for the same node

* fix issue updatenode -f loses directories when copying files to SN #4456 (#4494)

* comment from ErTao

* Crude attempt at including external configuration files in named.conf

* Fixes after the review

* Fix issue 4490, record any error when rflash active process

* add -d usage and manpage

* updatenode -F not work in hierachy env as the user name is FQDN of MN (#4484)

* updatenode -F not work in hierachy env (#4455)
 - add trace when -V is enabled
 - get the DSH_FROM_USERID from updatenode client

*  - when 'updatenode -F' need to push SN first, using root as non-root does not have permission write to 'SNsyncfiledir'
 - move the set DSH_FROM_USERID code out of the loop, and also cover remote client case.

* fix issue for command rspconfig hostname=*

* enhance rflash

* Adjust the server used for kernel/initrd and imgurl for petitboot (#4416)
 - URL for kernel/initrd, get the value from below value tftpserver -> xcatmaster -> myipfn
 - URL for image, get the value from below value nfsserver -> tftpserver -> xcatmaster -> myipfn

* NODE attribute didn't populate in /opt/xcat/xcatinfo after reboot (#4428)

* NODE attribute didn't populate in /opt/xcat/xcatinfo after reboot

* Get NODE from mypostscripts

* Improve the output message for reventlog, use a global variable to set PolicyFile Path

* If debug_msg is not provided, use an empty string

* Check for LinkLocal as well as 169.254 IP address

* Fix issue 4507, add parameter check for rspconfig admin_passwd

* record more information when rflash upload error

* Fix the error when using array ref in updatenode with old version perl, it is introduced by PR#4484 (#4518)

* Do not restart conserver if goconserver was started

If goconserver was enabled, do not start conserver when restart
xcatd on service node.

* remove the /etc/localtime before copy timezone file

* Use CONGO_CLIENT_TYPE to tell goconserver the source of client (#4501)

goconserver could send back message based on the client type
this commit set CONGO_CLIENT_TYPE to xcat to make the message
from goconserver more friendly.

* add rflash -d doc

* only ignore 169.254.x.x for OpenBMC

* Fix issue 4513, print out better error msg for reventlog -s

* Modify or add openbmc test cases or bundle

* add test cases for updatenode -f/F in hierarchy environment, covers issues #4456,#4455 and PR #4425 (#4500)
This commit is contained in:
Bin Xu
2017-12-14 19:03:34 +08:00
committed by yangsong
parent e4f452a44d
commit eea661e405
143 changed files with 7039 additions and 1137 deletions
+6 -1
View File
@@ -8,7 +8,7 @@ Documentation
xCAT documentation is available at: http://xcat-docs.readthedocs.io/en/latest/
|docs_latest| |docs_2137| |docs_2136| |docs_2135| |docs_2134| |docs_2133| |docs_2132| |docs_2131| |docs_2130| |docs_212|
|docs_latest| |docs_2138| |docs_2137| |docs_2136| |docs_2135| |docs_2134| |docs_2133| |docs_2132| |docs_2131| |docs_2130| |docs_212|
Open Source License
-------------------
@@ -22,6 +22,11 @@ Developers
Developers and prospective contributors are encouraged to read the `Developers Guide <http://xcat-docs.readthedocs.io/en/latest/developers/>`_
In particular the `GitHub <http://xcat-docs.readthedocs.io/en/latest/developers/github/>`_ related subsection.
.. |docs_2138| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.8
:alt: 2.13.8 documentation status
:scale: 100%
:target: http://xcat-docs.readthedocs.io/en/2.13.8/
.. |docs_2137| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.7
:alt: 2.13.7 documentation status
:scale: 100%
+1 -1
View File
@@ -1 +1 @@
2.13.8
2.13.9
+7
View File
@@ -0,0 +1,7 @@
Q/A list
========
.. toctree::
:maxdepth: 2
makehosts_qa.rst
+132
View File
@@ -0,0 +1,132 @@
DNS,hostname and alias Q/A list
-------------------------------
Q: When there are multiple NICs, how to generate ``/etc/hosts`` records?
````````````````````````````````````````````````````````````````````````
When there are multiple NICs, and you want to use ``confignetwork`` to configure these NICs, suggest to use ``hosts`` table to configure installnic and use ``nics`` table to configure secondary NICs. You can refer to the following best practice example to generate ``/etc/hosts`` records.
**Best practice example**:
* There are 2 networks in different domains: ``mgtnetwork`` and ``pubnetwork``
* ``mgtnetwork`` is xCAT management network
* There are 2 adapters in system node1: ``eth0`` and ``eth1``
* Add installnic ``eth0`` ``10.5.106.101`` record in ``/etc/hosts``, its alias is ``mgtnic``
* hostnames ``node1-pub`` and ``node1.public.com`` are for nic ``eth1``, ip is ``192.168.30.101``
**Steps**:
#. Add networks entry in ``networks`` table: ::
chdef -t network mgtnetwork net=10.0.0.0 mask=255.0.0.0 domain=cluster.com
chdef -t network pubnetwork net=192.168.30.0 mask=255.255.255.0 domain=public.com
#. Create ``node1`` with installnic ip ``10.5.106.101``, its alias is ``mgtnic``: ::
chdef node1 ip=10.5.106.101 hostnames=mgtnic groups=all
#. Configure ``eth1`` in ``nics`` table: ::
chdef node1 nicips.eth1=192.168.30.101 nichostnamesuffixes.eth1=-pub nicaliases.eth1=node1.public.com nictypes.eth1=Ethernet nicnetworks.eth1=pubnetwork
#. Check ``node1`` definition: ::
lsdef node1
Object name: node1
groups=all
ip=10.5.106.101
hostnames=mgtnic
nicaliases.eth1=node1.public.com
nichostnamesuffixes.eth1=-pub
nicips.eth1=192.168.30.101
nicnetworks.eth1=pubnetwork
nictypes.eth1=Ethernet
postbootscripts=otherpkgs
postscripts=syslog,remoteshell,syncfiles
#. Execute ``makehosts -n`` to generate ``/etc/hosts`` records: ::
makehosts -n
#. Check results in ``/etc/hosts``: ::
10.5.106.101 node1 node1.cluster.com mgtnic
192.168.30.101 node1-pub node1.public.com
#. Edit ``/etc/resolv.conf``, xCAT management node ip like ``10.5.106.2`` is nameserver: ::
search cluster.com public.com
nameserver 10.5.106.2
#. Execute ``makedns -n`` to configure DNS
Q: How to configure aliases?
````````````````````````````
There are 3 methods to configure aliases:
#. Use ``hostnames`` in ``hosts`` table to configure aliases for the installnic.
#. If you want to use script ``confignetwork`` to configure secondary NICs, suggest to use ``aliases`` in ``nics`` table to configure aliases, you can refer to :doc:`Configure Aliases <../guides/admin-guides/manage_clusters/common/deployment/network/cfg_network_aliases>`
#. If you want to generate aliases records in ``/etc/hosts`` for secondary NICs, and don't want to use script ``confignetwork`` to configure these NICs, suggest to use ``otherinterfaces`` in ``hosts`` table to configure aliases. You can refer to following example:
* If you want to add ``node1-hd`` ``20.1.1.1`` in ``hosts`` table, and don't use ``confignetwork`` to configure it, you can add ``otherinterfaces`` like this: ::
chdef node1 otherinterfaces="node1-hd:20.1.1.1"
* After executing ``makehosts -n``, you can get records in ``/etc/hosts`` like following: ::
20.1.1.1 node1-hd
**Note**: If suffixes or aliases for the same IP are configured in both ``hosts`` table and ``nics`` table, will cause conflicts. ``makehosts`` will use values from ``nics`` table. The values from ``nics`` table will over-write that from ``hosts`` table to create ``/etc/hosts`` records.
Q: How to handle the same short hostname in different domains?
``````````````````````````````````````````````````````````````
You can follow the best practice example.
**Best practice example**:
* There are 2 networks in different domains: ``mgtnetwork`` and ``pubnetwork``
* ``mgtnetwork`` is xCAT management network
* Generate 2 records with the same hostname in ``/etc/hosts``, like: ::
10.5.106.101 node1.cluster.com
192.168.20.101 node1.public.com
* Nameserver is xCAT management node IP
**Steps**:
#. Add networks entry in ``networks`` table: ::
chdef -t network mgtnetwork net=10.0.0.0 mask=255.0.0.0 domain=cluster.com
chdef -t network pubnetwork net=192.168.30.0 mask=255.255.255.0 domain=public.com
#. Create ``node1`` with ``ip=10.5.106.101``, xCAT can manage and install this node: ::
chdef node1 ip=10.5.106.101 groups=all
#. Create ``node1-pub`` with ``ip=192.168.30.101``, this node is only used to generate ``/etc/hosts`` records for public network, can use ``_unmanaged`` group name to label it: ::
chdef node1-pub ip=192.168.30.101 hostnames=node1.public.com groups=_unmanaged
#. Execute ``makehosts -n`` to generate ``/etc/hosts`` records: ::
makehosts -n
#. Check results in ``/etc/hosts``: ::
10.5.106.101 node1 node1.cluster.com
192.168.30.101 node1-pub node1.public.com
#. Edit ``/etc/resolv.conf``, for example, xCAT management node IP is 10.5.106.2 : ::
search cluster.com public.com
nameserver 10.5.106.2
#. Execute ``makedns -n`` to configure DNS
Q: When to use ``hosts`` table and ``nics`` table?
``````````````````````````````````````````````````
``hosts`` table is used to store IP addresses and hostnames of nodes. ``makehosts`` use these data to create ``/etc/hosts`` records. ``nics`` table is used to stores secondary NICs details. Some scripts like ``confignetwork`` use data from ``nics`` table to configure secondary NICs. ``makehosts`` also use these data to create ``/etc/hosts`` records for each NIC.
-1
View File
@@ -23,6 +23,5 @@ Advanced Topics
restapi/index.rst
security/index.rst
softlayer/index.rst
switches/index.rst
sysclone/index.rst
zones/index.rst
+2 -2
View File
@@ -1,5 +1,5 @@
Networks
========
Networking
==========
.. toctree::
:maxdepth: 2
@@ -12,12 +12,16 @@ xCAT provides support for detecting and installing the Cumulus Linux OS into ONI
The mac address of the switch management port is required for xCAT to configure the DHCP information and send over the OS to install on the switch.
**[small clusters]** If you know the mac address of the management port on the switch, create the pre-defined switch definition providing the mac address. ::
**Small Clusters**
If you know the mac address of the management port on the switch, create the pre-defined switch definition providing the mac address. ::
mkdef frame01sw1 --template onieswitch arch=armv71 \
ip=192.168.1.1 mac="aa:bb:cc:dd:ee:ff"
**[large clusters]** xCAT's :doc:`switchdiscover </guides/admin-guides/references/man1/switchdiscover.1>` command can be used to discover the mac address and fill in the predefined switch definitions based on the switch/switchport mapping.
**Large Clusters**
xCAT's :doc:`switchdiscover </guides/admin-guides/references/man1/switchdiscover.1>` command can be used to discover the mac address and fill in the predefined switch definitions based on the switch/switchport mapping.
#. Define all the switch objects providing the switch/switchport mapping: ::
@@ -4,7 +4,19 @@ Switch Management
Switch Port and VLAN Configuration
----------------------------------
xCAT expects the configuration for the front-panel ports to be located at ``/etc/network/interfaces.d/xCAT.intf`` on the switch. The ``configinterface`` postscript can download an interface configuration file from the management node. Place the configuration file in the directory ``/install/custom/sw_os/cumulus/interface/`` on the management node. It will first look for a file named the same as the switch's hostname, followed by the name of each group, followed by the word 'default'. If the postscript cannot find a configuration file on the management node, it will set all the ports on the switch to be part of VLAN 1. See the Cumulus Networks documentation for more information regarding advanced networking configuration. ::
xCAT places the front-panel port configuration in ``/etc/network/interfaces.d/xCAT.intf``.
The ``configinterface`` postscript can be used to pull switch interface configuration from the xCAT Management Node (MN) to the switch. Place the switch specific confguration files in the following directory on the MN: ``/install/custom/sw_os/cumulus/interface/``.
xCAT will look for files in the above directory in the following order:
1. file name that matches the switch hostname
2. file name that matches the switch group name
3. file name that has the word 'default'
Note: If the postscript cannot find a configuration file on the MN, it will set all ports on the switch to be part of VLAN 1.
Execute the script using the following command: ::
updatenode <switch> -P configinterface
@@ -12,9 +24,11 @@ xCAT expects the configuration for the front-panel ports to be located at ``/etc
Re-install OS
-------------
There may be occasions where a re-install of the OS is required. Assuming the files are available on the xCAT management node, the following commands will invoke the install process:
There may be occasions where a re-install of the Cumulus Linux OS is required. The following commands can be used to invoke the install:
* **[use xCAT]** ``xdsh`` can be used to invoke the reinstall of the OS: ::
**Note:** Assumption that the Cumulus Linux files are on the xCAT MN in the correct place.
* **Using xCAT**, ``xdsh`` can invoke the reinstall of the OS: ::
# to clear out all the previous configuration, use the -k option (optional)
xdsh <switch> "/usr/cumulus/bin/onie-select -k
@@ -22,7 +36,7 @@ There may be occasions where a re-install of the OS is required. Assuming the
# to invoke the reinstall of the OS
xdsh <switch> "/usr/cumulus/bin/onie-select -i -f;reboot"
* **[manually]** Log into the Cumulus OS switch and run the following commands: ::
* **Manually**, log into the switch and run the following commands: ::
sudo onie-select -i
sudo reboot
@@ -1,62 +1,79 @@
Cumulus OS upgrade
Cumulus OS Upgrade
==================
The Cumulus OS on the ONIE switches can be upgraded in 2 ways:
The Cumulus OS on the ONIE switches can be upgraded using one of the following methods:
* Upgrade only the changed packages, using ``apt-get update`` and ``apt-get upgrade``. If the ONIE switches has internet access, this is the preferred method, otherwise, you need to build up a local cumulus mirror in the cluster.
Full Install
------------
Since in a typical cluster setup, the switches usually do not have internet access, you can create a local mirror on the server which has internet access and can be reached from the switches, the steps are ::
Perform a full install from the ``.bin`` file of the new Cumulus Linux OS version, using ONIE.
**Note:** Make sure you back up all your data and configuration files as the binary install will erase all previous configuration.
mkdir -p /install/mirror/cumulus
cd /install/mirror/cumulus
#the wget might take a long time, it will be better if you can set up
#a cron job to sync the local mirror with upstream
wget -m --no-parent http://repo3.cumulusnetworks.com/repo/
then compose a ``sources.list`` file on MN like this(take 172.21.253.37 as ip address of the local mirror server) ::
#. Place the binary image under ``/install`` on the xCAT MN node.
#cat /tmp/sources.list
deb http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3 cumulus upstream
deb-src http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3 cumulus upstream
deb http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3-security-updates cumulus upstream
deb-src http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3-security-updates cumulus upstream
deb http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3-updates cumulus upstream
deb-src http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3-updates cumulus upstream
distribute the ``sources.list`` file to the switches to upgrade with ``xdcp``, take "switch1" as an example here ::
xdcp switch1 /tmp/sources.list /etc/apt/sources.list
then invoke ``apt-get update`` and ``apt-get install`` on the switches to start package upgrade, a reboot might be needed after upgrading ::
xdsh switch1 'apt-get update && apt-get upgrade && reboot'
check the `/etc/os-release` file to make sure the Cumulus OS has been upgraded ::
cat /etc/os-release
* Performe a binary (full image) install of the new version, using ONIE. If you expect to upgrade between major versions or if you have the binary image to upgrade to, this way is the recommended one. Make sure to backup your data and configuration files because binary install will erase all the configuration and data on the switch.
The steps to perform a binary (full image) install of the new version are:
1) place the binary image "cumulus-linux-3.4.1.bin" under ``/install`` directory on MN("172.21.253.37") ::
In this example, IP=172.21.253.37 is the IP on the Management Node. ::
mkdir -p /install/onie/
cp cumulus-linux-3.4.1.bin /install/onie/
2) invoke the upgrade on switches with ``xdsh`` ::
#. Invoke the upgrade on the switches using :doc:`xdsh </guides/admin-guides/references/man1/xdsh.1>`: ::
xdsh switch1 "/usr/cumulus/bin/onie-install -a -f -i http://172.21.253.37/install/onie/cumulus-linux-3.4.1.bin && reboot"
xdsh switch1 "/usr/cumulus/bin/onie-install -a -f -i \
http://172.21.253.37/install/onie/cumulus-linux-3.4.1.bin && reboot"
The full upgrade process might cost 30 min, you can ping the switch with ``ping switch1`` to check whether it finishes upgrade.
3) After upgrading, the license should be installed, see :ref:`Activate the License <activate-the-license>` for detailed steps.
**Note:** The full upgrade process may run 30 minutes or longer.
#. After upgrading, the license should be installed, see :ref:`Activate the License <activate-the-license>` for details.
#. Restore your data and configuration files on the switch.
Update Changed Packages
-----------------------
This is the preferred method for upgrading the switch OS for incremental OS updates.
Create Local Mirror
```````````````````
If the switches do not have access to the public Internet, you can create a local mirror of the Cumulus Linux repo.
#. Create a local mirror on the Management Node: ::
4) Restore your data and configuration files on the switch.
mkdir -p /install/mirror/cumulus
cd /install/mirror/cumulus
wget -m --no-parent http://repo3.cumulusnetworks.com/repo/
#. Create a ``sources.list`` file to point to the local repo on the Management node. In this example, IP=172.21.253.37 is the IP on the Management Node. ::
# cat /tmp/sources.list
deb http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3 cumulus upstream
deb-src http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3 cumulus upstream
deb http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3-security-updates cumulus upstream
deb-src http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3-security-updates cumulus upstream
deb http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3-updates cumulus upstream
deb-src http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3-updates cumulus upstream
#. Distribute the ``sources.list`` file to your switches using :doc:`xdcp </guides/admin-guides/references/man1/xdcp.1>`. ::
xdcp switch1 /tmp/sources.list /etc/apt/sources.list
Invoke the Update
`````````````````
#. Use xCAT :doc:`xdsh </guides/admin-guides/references/man1/xdsh.1>` to invoke the update: ::
#
# A reboot may be needed after the upgrade
#
xdsh switch1 'apt-get update && apt-get upgrade && reboot'
#. Check in ``/etc/os-release`` file to verify that the OS has been upgraded.
+2 -1
View File
@@ -6,4 +6,5 @@ The security of a system covers a wide range of elements, from the security of s
.. toctree::
:maxdepth: 2
security
ssl_config.rst
security.rst
@@ -0,0 +1,56 @@
OpenSSL Configuration
=====================
xCAT does not ship OpenSSL RPMS nor does it statically link to any OpenSSL libraries. Communication between the xCAT client and daemon utilizes OpenSSL and the administrator can configure SSL_version and SSL_cipher that should be used by xCAT daemons.
The configuration is stored in the xCAT site table using the ``site.xcatsslversion`` and ``site.xcatsslciphers`` variables.
Configuration
-------------
By default, xCAT ships with ``TLSv1`` configured. The current highest SSL version that can be supported is ``TLSv1.2``.
* For rhels7.x and sles12.x and higher: ::
chtab key=xcatsslversion site.value=TLSv12
* For ubuntu 14.x and higher: ::
chtab key=xcatsslversion site.value=TLSv1_2
* For AIX 7.1.3.x: ::
chtab key=xcatsslversion site.value=TLSv1_2
If running > ``TLSv1``, it is possible to disable insecure ciphers. Here's an example of one possible configuration: ::
"xcatsslciphers","kDH:kEDH:kRSA:!SSLv3:!SSLv2:!aNULL:!eNULL:!MEDIUM:!LOW:!MD5:!EXPORT:!CAMELLIA:!ECDH",,
After making any changes to these configuration values, ``xcatd`` must be restarted: ::
service restart xcatd
If any mistakes have been made and communiation is lost to xCAT, use ``XCATBYPASS`` to fix/remove the bad configuration: ::
XCATBYPASS=1 tabedit site
Validation
----------
Use the ``openssl`` command to validate the SSL configuration is valid and expected.
* To check whether TLSv1 is supported by xcatd: ::
openssl s_client -connect 127.0.0.1:3001 -tls1
* To check if SSLv3 is disabled on ``xcatd``: ::
openssl s_client -connect localhost:3001 -ssl3
You should get a reponse similar to: ::
70367087597568:error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure:s3_pkt.c:1259:SSL alert number 40
70367087597568:error:1409E0E5:SSL routines:SSL3_WRITE_BYTES:ssl handshake failure:s3_pkt.c:598:
@@ -1,2 +0,0 @@
Ethernet Switches
=================
-7
View File
@@ -1,7 +0,0 @@
Switch Management
=================
.. toctree::
:maxdepth: 2
ethernet_switches.rst
@@ -25,10 +25,6 @@ SYNOPSIS
\ **bmcdiscover**\ [\ **-**\ **-sn**\ \ *SN_nodename*\ ] [\ **-s**\ \ *scan_method*\ ] [\ **-u**\ \ *bmc_user*\ ] [\ **-p**\ \ *bmc_passwd*\ ] [\ **-z**\ ] [\ **-w**\ ] \ **-**\ **-range**\ \ *ip_ranges*\
\ **bmcdiscover**\ \ **-u**\ \ *bmc_user*\ \ **-p**\ \ *bmc_passwd*\ \ **-i**\ \ *bmc_ip*\ \ **-**\ **-check**\
\ **bmcdiscover**\ [\ **-u**\ \ *bmc_user*\ ] [\ **-p**\ \ *bmc_passwd*\ ] \ **-i**\ \ *bmc_ip*\ \ **-**\ **-ipsource**\
***********
DESCRIPTION
@@ -98,18 +94,6 @@ OPTIONS
\ **-**\ **-check**\
Check BMC administrator User/Password.
\ **-**\ **-ipsource**\
Display the BMC IP configuration.
\ **-h|-**\ **-help**\
Display usage message
@@ -187,22 +171,6 @@ Output is similar to:
bmcdiscover -s nmap --range "10.4.22-23.100-254" -w -z
5. To check if the username or password is correct against the BMC:
.. code-block:: perl
bmcdiscover -i 10.4.23.254 -u USERID -p PASSW0RD --check
6. Get BMC IP Address source, DHCP Address or static Address
.. code-block:: perl
bmcdiscover -i 10.4.23.254 -u USERID -p PASSW0RD --ipsource
********
SEE ALSO
@@ -63,7 +63,9 @@ OpenPOWER OpenBMC specific :
\ **rflash**\ \ *noderange*\ \ *tar_file_path*\ {[\ **-c | -**\ **-check**\ ] | [\ **-a | -**\ **-activate**\ ] | [\ **-u | -**\ **-upload**\ ]}
\ **rflash**\ \ *noderange*\ \ *image_id*\ {[\ **-a | -**\ **-activate**\ ] | [\ **-d | -**\ **-delete**\ ]}
\ **rflash**\ \ *noderange*\ \ *tar_file_directory*\ [\ **-d**\] [\ **--no-host-reboot**\]
\ **rflash**\ \ *noderange*\ \ *image_id*\ {[\ **-a | -**\ **-activate**\ ] | [\ **-**\ **-delete**\ ]}
@@ -135,18 +137,65 @@ OpenPOWER specific (using IPMI):
================================
The command will update firmware for OpenPOWER BMC when given an OpenPOWER node and either the hpm formatted file path or path to a data directory.
The command will update firmware for OpenPOWER BMC when given an OpenPOWER node with \ *mgt=ipmi*\ and either the hpm formatted file path or path to a data directory.
\ **Note:**\ When using \ **rflash**\ in hierarchical environment, the hpm file or data directory must be accessible from Service Nodes.
OpenPOWER OpenBMC specific:
===========================
OpenPOWER specific (using OpenBMC):
===================================
The command will update firmware for OpenPOWER OpenBMC when given an OpenPOWER node and either an update .tar file or an uploaded image id.
The command will update firmware for OpenPOWER BMC when given an OpenPOWER node with \ *mgt=openbmc*\ and either an update .tar file or an uploaded image id.
\ **-l|-**\ **-list**\ :
.. code-block:: perl
The list option will list out available firmware on the BMC. It provides an interface to display the ID of the various firmware levels.
The (*) symbol indicates the active running firmware on the server.
The (+) symbol indicates the firmware that is pending and a reboot is required to set it to be the active running firmware level.
\ **-u|-**\ **-upload**\ :
.. code-block:: perl
The upload option expects a .tar file as the input and will upload the file to the BMC. Use the list option to view the result.
\ **-a|-**\ **-activate**\ :
.. code-block:: perl
The activate option expects either a .tar file or an ID as the input. If a .tar file is provided, it will upload and activate the firmware in a single step
To apply the firmware level, a reboot is required to BMC and HOST.
\ **Note:**\ When using \ **rflash**\ in hierarchical environment, the .tar file must be accessible from Service Nodes.
\ **-d**\ :
.. code-block:: perl
This option steamlines the update, activate, reboot BMC and reboot HOST procedure. It expects a directory containing both BMC and PNOR .tar files. When BMC and PNOR tar files are provided, the command will upload and activate firmware. After BMC becomes activate, it will reboot BMC. If BMC state is Ready, the command will reboot the HOST. If BMC state is NotReady, the command will exit.
\ **Note:**\ When using \ **--no-host-reboot**\, it will not reboot the host after BMC is reboot.
\ **-**\ **-delete**\ :
.. code-block:: perl
The delete option will delete update image from BMC. It expects an ID as the input.
***************
\ **Options**\
@@ -232,7 +281,7 @@ The command will update firmware for OpenPOWER OpenBMC when given an OpenPOWER n
\ **-d|-**\ **-delete**\
\ **-**\ **-delete**\
Delete update image from BMC
@@ -325,7 +374,7 @@ The command will update firmware for OpenPOWER OpenBMC when given an OpenPOWER n
6. To update the firmware on IBM Power S822LC for Big Data machine specify the node name and the file path of the data directory containing pUpdate utility and BMC and/or PNOR update files:
6. To update the firmware on IBM Power S822LC for Big Data machine specify the node name and the file path of the data directory containing pUpdate utility, both BMC and PNOR update files:
.. code-block:: perl
@@ -90,7 +90,7 @@ OPTIONS
\ **-C|-**\ **-cleanup**\
Perform additional cleanup by running \ **nodeset offline**\ on the objects specified in the \ *noderange*\ .
Perform additional cleanup by running \ **nodeset offline**\ and \ **makeconservercf -d**\ on the objects specified in the \ *noderange*\ .
@@ -49,6 +49,8 @@ OpenBMC specific:
\ **rspconfig**\ \ *noderange*\ {\ **ipsrc | ip | netmask | gateway | hostname | vlan | sshcfg**\ }
\ **rspconfig**\ \ *noderange*\ \ **dump**\ [\ **-l | -**\ **-list**\ ] [\ **-g | -**\ **-generate**\ ] [\ **-c | -**\ **-clear**\ {\ *id*\ |\ **all**\ }] [\ **-d | -**\ **-download**\ \ *id*\ ]
MPA specific:
=============
@@ -430,6 +432,29 @@ OPTIONS
\ **dump**\
Manage OpenBMC system dumps. If no sub-option is provided, will generate, wait, and download the dump.
\ **-c**\ will clear a single specified dump, or use 'all' to clear all dumps on the BMC.
\ **-l**\ will list all the generated dumps on the BMC.
\ **-g**\ will generate a new dump on the BMC. Dump generation can take a few minutes.
\ **-d**\ will download a single dump from the BMC to /var/log/xcat/dump on management or service node.
\ **network**\ ={[\ *ip*\ ],[\ *host*\ ],[\ *gateway*\ ],[\ *netmask*\ ]|\*}
For MPA: get or set the MPA network parameters. If '\*' is specified, all parameters are read from the xCAT database.
@@ -1230,6 +1255,48 @@ EXAMPLES
31. To list BMC dumps available for download:
.. code-block:: perl
rspconfig p9euh02 dump -l
Output is similar to:
.. code-block:: perl
p9euh02: [1] Generated: 09/06/2017 14:31:49, Size: 4528
p9euh02: [2] Generated: 09/06/2017 14:31:55, Size: 4516
p9euh02: [3] Generated: 09/06/2017 14:32:01, Size: 4236
p9euh02: [4] Generated: 09/06/2017 14:32:07, Size: 4248
p9euh02: [5] Generated: 09/06/2017 14:32:11, Size: 4268
32. To generate and download BMC dump:
.. code-block:: perl
rspconfig p9euh02 dump
Output is similar to:
.. code-block:: perl
Capturing BMC Diagnostic information, this will take some time...
p9euh02: Dump requested. Target ID is 6, waiting for BMC to generate...
p9euh02: Dump 6 generated. Downloading to /var/log/xcat/dump/20171211-0951_p9euh02_dump_6.tar.xz
********
SEE ALSO
@@ -80,7 +80,7 @@ linuximage Attributes:
\ **otherpkgdir**\
The base directory where the non-distro packages are stored. Only 1 local directory supported at present.
The base directory and urls of internet repos from which the non-distro packages are retrived. Only 1 local directory is supported at present. The entries should be delimited with comma ",". Currently, the internet repos are only supported on Ubuntu and Redhat.
@@ -44,67 +44,67 @@ servicenode Attributes:
\ **nameserver**\
Do we set up DNS on this service node? Valid values: 2, 1, no or 0. If 2, creates named.conf as dns slave, using the management node as dns master, and starts named. If 1, creates named.conf file with forwarding to the management node and starts named. If no or 0, it does not change the current state of the service.
Do we set up DNS on this service node? Valid values: 2, 1, or 0. If 2, creates named.conf as dns slave, using the management node as dns master, and starts named. If 1, creates named.conf file with forwarding to the management node and starts named. If 0, it does not change the current state of the service.
\ **dhcpserver**\
Do we set up DHCP on this service node? Not supported on AIX. Valid values:yes or 1, no or 0. If yes, runs makedhcp -n. If no or 0, it does not change the current state of the service.
Do we set up DHCP on this service node? Not supported on AIX. Valid values:1 or 0. If 1, runs makedhcp -n. If 0, it does not change the current state of the service.
\ **tftpserver**\
Do we set up TFTP on this service node? Not supported on AIX. Valid values:yes or 1, no or 0. If yes, configures and starts atftp. If no or 0, it does not change the current state of the service.
Do we set up TFTP on this service node? Not supported on AIX. Valid values:1 or 0. If 1, configures and starts atftp. If 0, it does not change the current state of the service.
\ **nfsserver**\
Do we set up file services (HTTP,FTP,or NFS) on this service node? For AIX will only setup NFS, not HTTP or FTP. Valid values:yes or 1, no or 0.If no or 0, it does not change the current state of the service.
Do we set up file services (HTTP,FTP,or NFS) on this service node? For AIX will only setup NFS, not HTTP or FTP. Valid values:1 or 0.If 0, it does not change the current state of the service.
\ **conserver**\
Do we set up Conserver on this service node? Valid values:yes or 1, no or 0. If yes, configures and starts conserver daemon. If no or 0, it does not change the current state of the service.
Do we set up Conserver on this service node? Valid values:1 or 0. If 1, configures and starts conserver daemon. If 0, it does not change the current state of the service.
\ **monserver**\
Is this a monitoring event collection point? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.
Is this a monitoring event collection point? Valid values: 1 or 0. If 0, it does not change the current state of the service.
\ **ldapserver**\
Do we set up ldap caching proxy on this service node? Not supported on AIX. Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.
Do we set up ldap caching proxy on this service node? Not supported on AIX. Valid values:1 or 0. If 0, it does not change the current state of the service.
\ **ntpserver**\
Not used. Use setupntp postscript to setup a ntp server on this service node? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.
Not used. Use setupntp postscript to setup a ntp server on this service node? Valid values:1 or 0. If 0, it does not change the current state of the service.
\ **ftpserver**\
Do we set up a ftp server on this service node? Not supported on AIX Valid values:yes or 1, no or 0. If yes, configure and start vsftpd. (You must manually install vsftpd on the service nodes before this.) If no or 0, it does not change the current state of the service. xCAT is not using ftp for compute nodes provisioning or any other xCAT features, so this attribute can be set to 0 if the ftp service will not be used for other purposes
Do we set up a ftp server on this service node? Not supported on AIX Valid values:1 or 0. If 1, configure and start vsftpd. (You must manually install vsftpd on the service nodes before this.) If 0, it does not change the current state of the service. xCAT is not using ftp for compute nodes provisioning or any other xCAT features, so this attribute can be set to 0 if the ftp service will not be used for other purposes
\ **nimserver**\
Not used. Do we set up a NIM server on this service node? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.
Not used. Do we set up a NIM server on this service node? Valid values:1 or 0. If 0, it does not change the current state of the service.
\ **ipforward**\
Do we set up ip forwarding on this service node? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.
Do we set up ip forwarding on this service node? Valid values:1 or 0. If 0, it does not change the current state of the service.
@@ -116,7 +116,7 @@ servicenode Attributes:
\ **proxydhcp**\
Do we set up proxydhcp service on this node? valid values: yes or 1, no or 0. If yes, the proxydhcp daemon will be enabled on this node.
Do we set up proxydhcp service on this node? valid values: 1 or 0. If 1, the proxydhcp daemon will be enabled on this node.
@@ -947,67 +947,67 @@ group Attributes:
\ **setupconserver**\ (servicenode.conserver)
Do we set up Conserver on this service node? Valid values:yes or 1, no or 0. If yes, configures and starts conserver daemon. If no or 0, it does not change the current state of the service.
Do we set up Conserver on this service node? Valid values:1 or 0. If 1, configures and starts conserver daemon. If 0, it does not change the current state of the service.
\ **setupdhcp**\ (servicenode.dhcpserver)
Do we set up DHCP on this service node? Not supported on AIX. Valid values:yes or 1, no or 0. If yes, runs makedhcp -n. If no or 0, it does not change the current state of the service.
Do we set up DHCP on this service node? Not supported on AIX. Valid values:1 or 0. If 1, runs makedhcp -n. If 0, it does not change the current state of the service.
\ **setupftp**\ (servicenode.ftpserver)
Do we set up a ftp server on this service node? Not supported on AIX Valid values:yes or 1, no or 0. If yes, configure and start vsftpd. (You must manually install vsftpd on the service nodes before this.) If no or 0, it does not change the current state of the service. xCAT is not using ftp for compute nodes provisioning or any other xCAT features, so this attribute can be set to 0 if the ftp service will not be used for other purposes
Do we set up a ftp server on this service node? Not supported on AIX Valid values:1 or 0. If 1, configure and start vsftpd. (You must manually install vsftpd on the service nodes before this.) If 0, it does not change the current state of the service. xCAT is not using ftp for compute nodes provisioning or any other xCAT features, so this attribute can be set to 0 if the ftp service will not be used for other purposes
\ **setupipforward**\ (servicenode.ipforward)
Do we set up ip forwarding on this service node? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.
Do we set up ip forwarding on this service node? Valid values:1 or 0. If 0, it does not change the current state of the service.
\ **setupldap**\ (servicenode.ldapserver)
Do we set up ldap caching proxy on this service node? Not supported on AIX. Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.
Do we set up ldap caching proxy on this service node? Not supported on AIX. Valid values:1 or 0. If 0, it does not change the current state of the service.
\ **setupnameserver**\ (servicenode.nameserver)
Do we set up DNS on this service node? Valid values: 2, 1, no or 0. If 2, creates named.conf as dns slave, using the management node as dns master, and starts named. If 1, creates named.conf file with forwarding to the management node and starts named. If no or 0, it does not change the current state of the service.
Do we set up DNS on this service node? Valid values: 2, 1, or 0. If 2, creates named.conf as dns slave, using the management node as dns master, and starts named. If 1, creates named.conf file with forwarding to the management node and starts named. If 0, it does not change the current state of the service.
\ **setupnfs**\ (servicenode.nfsserver)
Do we set up file services (HTTP,FTP,or NFS) on this service node? For AIX will only setup NFS, not HTTP or FTP. Valid values:yes or 1, no or 0.If no or 0, it does not change the current state of the service.
Do we set up file services (HTTP,FTP,or NFS) on this service node? For AIX will only setup NFS, not HTTP or FTP. Valid values:1 or 0.If 0, it does not change the current state of the service.
\ **setupnim**\ (servicenode.nimserver)
Not used. Do we set up a NIM server on this service node? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.
Not used. Do we set up a NIM server on this service node? Valid values:1 or 0. If 0, it does not change the current state of the service.
\ **setupntp**\ (servicenode.ntpserver)
Not used. Use setupntp postscript to setup a ntp server on this service node? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.
Not used. Use setupntp postscript to setup a ntp server on this service node? Valid values:1 or 0. If 0, it does not change the current state of the service.
\ **setupproxydhcp**\ (servicenode.proxydhcp)
Do we set up proxydhcp service on this node? valid values: yes or 1, no or 0. If yes, the proxydhcp daemon will be enabled on this node.
Do we set up proxydhcp service on this node? valid values: 1 or 0. If 1, the proxydhcp daemon will be enabled on this node.
\ **setuptftp**\ (servicenode.tftpserver)
Do we set up TFTP on this service node? Not supported on AIX. Valid values:yes or 1, no or 0. If yes, configures and starts atftp. If no or 0, it does not change the current state of the service.
Do we set up TFTP on this service node? Not supported on AIX. Valid values:1 or 0. If 1, configures and starts atftp. If 0, it does not change the current state of the service.
@@ -959,67 +959,67 @@ node Attributes:
\ **setupconserver**\ (servicenode.conserver)
Do we set up Conserver on this service node? Valid values:yes or 1, no or 0. If yes, configures and starts conserver daemon. If no or 0, it does not change the current state of the service.
Do we set up Conserver on this service node? Valid values:1 or 0. If 1, configures and starts conserver daemon. If 0, it does not change the current state of the service.
\ **setupdhcp**\ (servicenode.dhcpserver)
Do we set up DHCP on this service node? Not supported on AIX. Valid values:yes or 1, no or 0. If yes, runs makedhcp -n. If no or 0, it does not change the current state of the service.
Do we set up DHCP on this service node? Not supported on AIX. Valid values:1 or 0. If 1, runs makedhcp -n. If 0, it does not change the current state of the service.
\ **setupftp**\ (servicenode.ftpserver)
Do we set up a ftp server on this service node? Not supported on AIX Valid values:yes or 1, no or 0. If yes, configure and start vsftpd. (You must manually install vsftpd on the service nodes before this.) If no or 0, it does not change the current state of the service. xCAT is not using ftp for compute nodes provisioning or any other xCAT features, so this attribute can be set to 0 if the ftp service will not be used for other purposes
Do we set up a ftp server on this service node? Not supported on AIX Valid values:1 or 0. If 1, configure and start vsftpd. (You must manually install vsftpd on the service nodes before this.) If 0, it does not change the current state of the service. xCAT is not using ftp for compute nodes provisioning or any other xCAT features, so this attribute can be set to 0 if the ftp service will not be used for other purposes
\ **setupipforward**\ (servicenode.ipforward)
Do we set up ip forwarding on this service node? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.
Do we set up ip forwarding on this service node? Valid values:1 or 0. If 0, it does not change the current state of the service.
\ **setupldap**\ (servicenode.ldapserver)
Do we set up ldap caching proxy on this service node? Not supported on AIX. Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.
Do we set up ldap caching proxy on this service node? Not supported on AIX. Valid values:1 or 0. If 0, it does not change the current state of the service.
\ **setupnameserver**\ (servicenode.nameserver)
Do we set up DNS on this service node? Valid values: 2, 1, no or 0. If 2, creates named.conf as dns slave, using the management node as dns master, and starts named. If 1, creates named.conf file with forwarding to the management node and starts named. If no or 0, it does not change the current state of the service.
Do we set up DNS on this service node? Valid values: 2, 1, or 0. If 2, creates named.conf as dns slave, using the management node as dns master, and starts named. If 1, creates named.conf file with forwarding to the management node and starts named. If 0, it does not change the current state of the service.
\ **setupnfs**\ (servicenode.nfsserver)
Do we set up file services (HTTP,FTP,or NFS) on this service node? For AIX will only setup NFS, not HTTP or FTP. Valid values:yes or 1, no or 0.If no or 0, it does not change the current state of the service.
Do we set up file services (HTTP,FTP,or NFS) on this service node? For AIX will only setup NFS, not HTTP or FTP. Valid values:1 or 0.If 0, it does not change the current state of the service.
\ **setupnim**\ (servicenode.nimserver)
Not used. Do we set up a NIM server on this service node? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.
Not used. Do we set up a NIM server on this service node? Valid values:1 or 0. If 0, it does not change the current state of the service.
\ **setupntp**\ (servicenode.ntpserver)
Not used. Use setupntp postscript to setup a ntp server on this service node? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.
Not used. Use setupntp postscript to setup a ntp server on this service node? Valid values:1 or 0. If 0, it does not change the current state of the service.
\ **setupproxydhcp**\ (servicenode.proxydhcp)
Do we set up proxydhcp service on this node? valid values: yes or 1, no or 0. If yes, the proxydhcp daemon will be enabled on this node.
Do we set up proxydhcp service on this node? valid values: 1 or 0. If 1, the proxydhcp daemon will be enabled on this node.
\ **setuptftp**\ (servicenode.tftpserver)
Do we set up TFTP on this service node? Not supported on AIX. Valid values:yes or 1, no or 0. If yes, configures and starts atftp. If no or 0, it does not change the current state of the service.
Do we set up TFTP on this service node? Not supported on AIX. Valid values:1 or 0. If 1, configures and starts atftp. If 0, it does not change the current state of the service.
@@ -255,7 +255,7 @@ osimage Attributes:
\ **otherpkgdir**\ (linuximage.otherpkgdir)
The base directory where the non-distro packages are stored. Only 1 local directory supported at present.
The base directory and urls of internet repos from which the non-distro packages are retrived. Only 1 local directory is supported at present. The entries should be delimited with comma ",". Currently, the internet repos are only supported on Ubuntu and Redhat.
@@ -21,6 +21,8 @@ SYNOPSIS
\ **makeconservercf**\ [\ **-V|-**\ **-verbose**\ ] [\ **-d|-**\ **-delete**\ ] [\ *noderange*\ ]
\ **makeconservercf**\ [\ **-V|-**\ **-verbose**\ ] [\ **-C|-**\ **-cleanup**\ ]
\ **makeconservercf**\ [\ **-V|-**\ **-verbose**\ ] [\ **-l|-**\ **-local**\ ] [\ *noderange*\ ]
\ **makeconservercf**\ [\ **-V|-**\ **-verbose**\ ] [\ **-c|-**\ **-conserver**\ ] [\ *noderange*\ ]
@@ -42,6 +44,8 @@ does not have nodehm.cons set, it will not be written to the file.
If \ **-d**\ is specified, \ **makeconservercf**\ will remove specified nodes from /etc/conserver.cf file. If \ *noderange*\ is not specified, all xCAT nodes will be removed from /etc/conserver.cf file.
If \ **-C|-**\ **-cleanup**\ is specified, \ **makeconservercf**\ will remove console configuration entries from /etc/conserver.cf for the nodes whose definitions have been removed from xCATdb. \ **Don't**\ specify any noderange.
In the case of a hierarchical cluster (i.e. one with service nodes) \ **makeconservercf**\ will determine
which nodes will have their consoles accessed from the management node and which from a service node
(based on the nodehm.conserver attribute). The /etc/conserver.cf file will be created accordingly on
@@ -60,6 +64,12 @@ OPTIONS
\ **-C|-**\ **-cleanup**\
Remove the entries for the nodes whose definitions have been removed from xCAT db.
\ **-c|-**\ **-conserver**\
Only set up the conserver on the conserver host. If no conserver host
@@ -0,0 +1,151 @@
############
makegocons.8
############
.. highlight:: perl
****
NAME
****
\ **makegocons**\ - Register or unregister the node in the goconserver service
********
SYNOPSIS
********
\ **makegocons**\ [\ **-V|-**\ **-verbose**\ ] [\ **-d|-**\ **-delete**\ ] [\ *noderange*\ ]
\ **makeconservercf**\ [\ **-h|-**\ **-help|-v|-**\ **-version**\ ]
***********
DESCRIPTION
***********
The \ **makegocons**\ command will start the goconserver service if it is not started, then
send the REST request to create or delete the session resource in the goconserver service. The session
information including the session command or ssh connection parameters (for openbmc) is generated by xcat
based on the records in the related tables (e.g. nodehm, ipmi, ppc, openbmc).
By default \ **makegocons**\ will register the session for all of the nodes in xcat.
If a \ *noderange*\ is specified, only the session in the specified scope will be affected, goconserver
service will not be restarted and the other session will not be disconnected. This is the advantage
of goconserver over the conserver service with \ **makeconservercf**\ .
If \ **-d**\ is specified, \ **makegocons**\ will remove the session in the goconserver service.
In the case of a hierarchical cluster (i.e. one with service nodes) \ **makegocons**\ will determine
which nodes will have their consoles accessed from the management node and which from a service node
(based on the nodehm.conserver attribute).
For openbmc which uses ssh as the terminal session connection method, goconserver can help save the system
resources as goconserver could handle the ssh connection within goroutine which is more light-weighted than the command process.
\ **Note:**\ goconserver is an experimental feature, it will not be installed with xcat and will only support the systemd based systems.
Download and setup the rpm or deb package manually. Release link:
.. code-block:: perl
https://github.com/chenglch/goconserver/releases
*******
OPTIONS
*******
\ **-d|-**\ **-delete**\
Delete rather than add or refresh the nodes specified as a noderange.
\ **-v|-**\ **-version**\
Display version.
\ **-V|-**\ **-verbose**\
Verbose mode.
\ **-h|-**\ **-help**\
Display usage message.
************
RETURN VALUE
************
0. The command completed successfully.
1. An error has occurred.
********
EXAMPLES
********
1. To create goconserver configuration for all the nodes.
.. code-block:: perl
makegocons
2. To create goconserver configuration for nodes node01-node10.
.. code-block:: perl
makegocons node01-node10
3. To remove goconserver configuration for node01.
.. code-block:: perl
makegocons -d node01
********
SEE ALSO
********
rcons(1)|rcons.1
+1
View File
@@ -32,6 +32,7 @@ Table of Contents
guides/install-guides/index.rst
guides/admin-guides/index.rst
advanced/index.rst
QA/index.rst
references/index.rst
troubleshooting/index.rst
developers/index.rst
@@ -0,0 +1,8 @@
Power9 Firmware Update
======================
.. toctree::
:maxdepth: 2
ipmi.rst
openbmc.rst
@@ -0,0 +1,40 @@
IPMI Firmware Update
====================
The process for updating firmware on the IBM Power9 Server (Boston) is documented below.
Collect the required files
--------------------------
Collect the following files and put them into a directory on the Management Node.
* pUpdate
* pnor
* bmc
If running ``rflash`` in Hierarchy, the firmware files/directory must be accessible on the Service Nodes.
Flash Firmware
--------------
Using xCAT ``rflash`` command, specify the directory containing the files with the ``-d`` option. ::
rflash <noderange> -d /path-to-directory/
The ``pUpdate`` utility is leveraged in doing the firmware update against the target node and will do the following:
* power off the host
* flash bmc and reboot
* flash pnor
* power on the host
Monitor the progress for the nodes by looking at the files under ``/var/log/xcat/rflash/``.
Validatation
------------
Use the ``rinv`` command to validate firmware level: ::
rinv <noderange> firm | xcoll
@@ -0,0 +1,79 @@
OpenBMC Firmware Update
=======================
The process of updating firmware on the OpenBMC managed servers is documented below.
The sequence of events that must happen is the following:
* Power off the Host
* Update and Activate PNOR
* Update and Activate BMC
* Reboot the BMC (applies BMC)
* Power on the Host (applies PNOR)
**Note:** xCAT is working on streamlining this process to reduce the flexibility of the above steps at the convenience of the Administrator to handle the necessary reboots. See `Issue #4245 <https://github.com/xcat2/xcat-core/issues/4245>`_
Power off Host
--------------
Use the rpower command to power off the host: ::
rpower <noderange> off
Update and Activate PNOR Firmware
---------------------------------
Use the rflash command to upload and activate the PNOR firmware: ::
rflash <noderange> -a /path/to/witherspoon.pnor.squashfs.tar
If running ``rflash`` in Hierarchy, the firmware files must be accessible on the Service Nodes.
**Note:** The ``-a`` option does an upload and activate in one step, after firmware is activated, use the ``rflash <noderange> -l`` to view. The ``rflash`` command shows ``(*)`` as the active firmware and ``(+)`` on the firmware that requires reboot to become effective.
Update and Activate BMC Firmware
--------------------------------
Use the rflash command to upload and activate the PNOR firmware: ::
rflash <noderange> -a /path/to/obmc-phosphor-image-witherspoon.ubi.mtd.tar
If running ``rflash`` in Hierarchy, the firmware files must be accessible on the Service Nodes.
**Note:** The ``-a`` option does an upload and activate in one step, after firmware is activated, use the ``rflash <noderange> -l`` to view. The ``rflash`` command shows ``(*)`` as the active firmware and ``(+)`` on the firmware that requires reboot to become effective.
Reboot the BMC
--------------
Use the ``rpower`` command to reboot the BMC: ::
rpower <noderange> bmcreboot
The BMC will take 2-5 minutes to reboot, check the status using: ``rpower <noderange> bmcstate`` and wait for ``BMCReady`` to be returned.
**Known Issue:** On reboot, the first call to the BMC after reboot, xCAT will return ``Error: BMC did not respond within 10 seconds, retry the command.``. Please retry.
Power on Host
-------------
User the ``rpower`` command to power on the Host: ::
rpower <noderange> on
Validation
----------
Use one of the following commands to validate firmware levels are in sync:
* Use the ``rinv`` command to validate firmware level: ::
rinv <noderange> firm -V | grep -i ibm | grep "\*" | xcoll
* Use the ``rflash`` command to validate the firmware level: ::
rflash <noderange> -l | grep "\*" | xcoll
@@ -0,0 +1,7 @@
Cluster Management
==================
.. toctree::
:maxdepth: 2
firmware/index.rst
+1
View File
@@ -7,6 +7,7 @@ CORAL stands for Collaboration of Oak Ridge, Argonne, and Livermore and is solut
.. toctree::
:maxdepth: 2
cluster_mgmt/index.rst
known_issues/index.rst
.. mn/index.rst
.. discovery/index.rst
@@ -5,3 +5,4 @@ Known Issues
:maxdepth: 2
genesis_base.rst
openbmc/index.rst
@@ -0,0 +1,7 @@
#4264 - rpower command intermittently reports 503: Service Unavailable Error
============================================================================
Issue `#4264 <https://github.com/xcat2/xcat-core/issues/4264>`_
In attempt to improve the performance of the REST calls to OpenBMC and reduce the time spent in a timeout, we fail too soon here before the BMC has a chance to respond.
@@ -0,0 +1,17 @@
SW402273 - Unable to tell the firmware level that is actually running on the node via REST
==========================================================================================
* **Issue:** `SW402273 <https://w3.rchland.ibm.com/projects/bestquest/?defect=SW402273>`_
* **Reported:** 1738B (ibm-v1.99.10-0-r7)
* **Fixed:** 1740B (ibm-v1.99.10-0-r13)
**Issue:**
Until 1740B firmware (> ibm-v1.99.10-0-r13), there's no method provided by OpenBMC to indicate the active running firmware on the node. Until the BMC is rebooted or the HOST is rebooted, the Active firmware may or may not really be running.
If you are running a version that prints the following message from ``rflash``: ::
cn01: WARNING, The current firmware is unable to detect running firmware version.
Please update the BMC to a version higher than ibm-v1.99.10-0-r13.
@@ -0,0 +1,26 @@
SW404161 - Firmware do not self extract tar, causing rflash cannot find ID to activate
======================================================================================
* **Issue:** `SW404161 <https://w3.rchland.ibm.com/projects/bestquest/?defect=SW404161>`_
* **Reported:** 1738A (ibm-v1.99.10-0-r7)
* **Fixed:** 1742D (ibm-v1.99.10-0-113-r10)
**Issue:**
Firmware is not extracted and could not be found by rflash to activate ::
[root@c650mnp03 ~]# rflash c650f07p27 obmc-phosphor-image-witherspoon.ubi.mtd.tar -a
c650f07p27: Uploading /root/obmc-phosphor-image-witherspoon.ubi.mtd.tar ...
c650f07p27: Firmware upload successful. Attempting to activate firmware: ibm-v1.99.10-113-g65edf7d-r8-0-g713d86d
c650f07p27: Could not find ID for firmware ibm-v1.99.10-113-g65edf7d-r8-0-g713d86d to activate, waiting 10 seconds and retry...
c650f07p27: Could not find ID for firmware ibm-v1.99.10-113-g65edf7d-r8-0-g713d86d to activate, waiting 10 seconds and retry...
c650f07p27: Could not find ID for firmware ibm-v1.99.10-113-g65edf7d-r8-0-g713d86d to activate, waiting 10 seconds and retry...
c650f07p27: Could not find ID for firmware ibm-v1.99.10-113-g65edf7d-r8-0-g713d86d to activate, waiting 10 seconds and retry...
c650f07p27: Could not find ID for firmware ibm-v1.99.10-113-g65edf7d-r8-0-g713d86d to activate, waiting 10 seconds and retry...
c650f07p27: Could not find ID for firmware ibm-v1.99.10-113-g65edf7d-r8-0-g713d86d to activate, waiting 10 seconds and retry...
c650f07p27: Error: Could not find firmware ibm-v1.99.10-113-g65edf7d-r8-0-g713d86d after waiting 60 seconds.
**Work-around:** Use one of the following methods:
* Reboot the BMC before flashing firmware: ``rpower <> bmcreboot``
* ssh into bmc and run: ``systemctl restart xyz.openbmc_project.Software.Version.service``
@@ -0,0 +1,84 @@
SW406771 - Duplicate FW ID or 2 BMC firmware active at the same time
====================================================================
* **Issue:** `SW407037 <https://w3.rchland.ibm.com/projects/bestquest/?defect=SW407037>`_
* **Reported:** 1740A (ibm-v1.99.10-0-r11-0-g9c65260)
* **Fixed:** 1742 or higher
**Issue:**
At some point after 1740A firmware, ``ibm-v1.99.10-0-r11-0-g9c65260``, the hashing algorithm to create the ID on the BMC was chagned by the Firmware team. This allows for the same firmware to potentially have two different IDs resulting in two active running BMC firmware.
**Work-around**
Upgrade from 1740A
------------------
If you are running 1740A, you will need to get two BMC firmware levels from your IBM representative.
This example will cover flashing from 1740A to 1742D, using 1742C as the recovery flash level.
#. Identify the issue where the IDs are not using the correct hash ::
mid05tor12cn13: ID Purpose State Version
mid05tor12cn13: -------------------------------------------------------
mid05tor12cn13: 9e55358e BMC Active(*) ibm-v1.99.10-0-r11-0-g9c65260
mid05tor12cn13: 6e71e1af BMC Ready ibm-v1.99.10-113-g65edf7d-r10-0-gcdf7635 <--- bad hash for 1742D
mid05tor12cn16: ID Purpose State Version
mid05tor12cn16: -------------------------------------------------------
mid05tor12cn16: efc8a851 BMC Ready ibm-v1.99.10-113-g65edf7d-r10-0-gcdf7635 <--- correct hash for 1742D
mid05tor12cn16: b48d27e1 BMC Active(*) ibm-v1.99.10-113-g65edf7d-r3-0-g9e4f715
#. Flash up to 1742D, activate and reboot: ::
mid05tor12cn13: ID Purpose State Version
mid05tor12cn13: -------------------------------------------------------
mid05tor12cn13: 9e55358e BMC Active ibm-v1.99.10-0-r11-0-g9c65260
mid05tor12cn13: 221d9020 Host Active(*) IBM-witherspoon-redbud-ibm-OP9_v1.19_1.33
mid05tor12cn13: 6e71e1af BMC Active(*) ibm-v1.99.10-113-g65edf7d-r10-0-gcdf7635 <--- bad hash, active
mid05tor12cn13:
#. Flash down to 1742C, activate and reboot: ::
mid05tor12cn13: ID Purpose State Version
mid05tor12cn13: -------------------------------------------------------
mid05tor12cn13: 9e55358e BMC Active ibm-v1.99.10-0-r11-0-g9c65260
mid05tor12cn13: 221d9020 Host Active(*) IBM-witherspoon-redbud-ibm-OP9_v1.19_1.33
mid05tor12cn13: 6e71e1af BMC Active(*) ibm-v1.99.10-113-g65edf7d-r10-0-gcdf7635
mid05tor12cn13: f6590ce0 BMC Active(+) ibm-v1.99.10-113-g65edf7d-r8-0-g713d86d <--- 1742C
mid05tor12cn13:
#. Delete the bad hash firmware: ``rflash <node> -d 6e71e1af``
**Note:** This is optional because the BMC only allows 2 firmware max, so it would get pushed out.
#. Flash back up to 1742D (with correct hash), activate and reboot: ::
mid05tor12cn13: ID Purpose State Version
mid05tor12cn13: -------------------------------------------------------
mid05tor12cn13: 221d9020 Host Active(*) IBM-witherspoon-redbud-ibm-OP9_v1.19_1.33
mid05tor12cn13: efc8a851 BMC Active(*) ibm-v1.99.10-113-g65edf7d-r10-0-gcdf7635 <--- good hash
mid05tor12cn13: f6590ce0 BMC Active ibm-v1.99.10-113-g65edf7d-r8-0-g713d86d
mid05tor12cn13:
Two active BMCs
---------------
If you have two active BMCs::
[root@mgt03 ~]# rflash f7n02 -l
f7n02: ID Purpose State Version
f7n02: -------------------------------------------------------
f7n02: b5273d71 BMC Active(*) ibm-v1.99.10-113-g65edf7d-r8-0-g713d86d
f7n02: 30ee1c48 Host Active(*) IBM-witherspoon-ibm-OP9_v1.19_1.112
f7n02: 4f33e0f4 Host Failed(+) IBM-witherspoon-ibm-OP9_v1.19_1.109
f7n02: f6590ce0 BMC Active(*) ibm-v1.99.10-113-g65edf7d-r8-0-g713d86d
f7n02:
There's no way to de-activate one manually, recover by doing the following:
#. Flash the BMC to the previous level of the firmware and reboot BMC
#. Delete the duplicate firmware using ``rflash <node> -d <ID>``
#. Re-flash the BMC to the target level and reboot the BMC.
@@ -0,0 +1,38 @@
SW407037 - bmcsetup does not successfully configure the IP (Sev1)
=================================================================
* **Issue:** `SW407037 <https://w3.rchland.ibm.com/projects/bestquest/?defect=SW407037>`_
* **Reported:** 1742C (ibm-v1.99.10-113-g65edf7d-r8-0-g713d86d)
* **Fixed:** Fixed in xCAT after 11/07/17 `#4242 <https://github.com/xcat2/xcat-core/issues/4242>`_
**Issue:**
OpenBMC firmware has problems with ipmi inband support of the ``access on`` comamnd and the work around is to use the ``raw 0x06 0x40`` instead. In early Sept, we switched to using ``access on`` because the implementation looked like it was working, since then we have found some issues with it and recommendation is to revert back to the raw command.
See related issues describing potential problems:
* https://github.com/openbmc/openbmc/issues/2493
* https://github.com/openbmc/openbmc/issues/2492
This problem is very severe because if the network is not configured correctly, the access to the BMC is lost.
**Work-around**
Use one of the following work arounds:
#. Install a version of xCAT built after November, 07, 2017 which includes the fix. (**Recommended**)
#. Manually patch bmcsetup using changes in PR: https://github.com/xcat2/xcat-core/pull/4247, then run ``mknb ppc64``
#. Patch the system with provided patch:
#. Download patch file: https://github.com/xcat2/xcat-core/files/1451181/bmcsetup.4242.patch.txt
#. If file name is ``/tmp/bmcsetup.4242.patch.txt``
#. ``cd /opt/xcat/share/xcat/netboot/genesis/ppc64/fs/usr/bin``
#. ``patch -p0 < /tmp/bmcsetup.4242.patch.txt``
#. ``mknb ppc64``
@@ -0,0 +1,47 @@
OpenBMC Management Issues
=========================
xCAT
----
2.13.8
``````
Please see the `2.13.8 Release Notes <https://github.com/xcat2/xcat-core/wiki/XCAT_2.13.8_Release_Notes>`_ for the full list of known issues.
.. toctree::
:maxdepth: 2
2_13_8.rst
Firmware
--------
The following versions indicate the level of firmware the issue was reported.
1742C - ibm-v1.99.10-113-g65edf7d-r8-0-g713d86d
```````````````````````````````````````````````
.. toctree::
:maxdepth: 1
SW407037.rst
1740A - ibm-v1.99.10-0-r11
``````````````````````````
.. toctree::
:maxdepth: 1
SW406771.rst
1738A - ibm-v1.99.10-0-r7
``````````````````````````
.. toctree::
:maxdepth: 1
SW404161.rst
SW402273.rst
+24 -15
View File
@@ -949,6 +949,7 @@ sub setobjdefs
my @setattrlist = ();
my %checkedattrs;
my $invalidattr;
my $conditionlist;
foreach my $this_attr (@{ $datatype->{'attrs'} }) {
my %keyhash;
@@ -1008,7 +1009,12 @@ sub setobjdefs
$checkedattrs{$attr_name} = 1;
if ($invalidattr->{$attr_name}->{valid} != 1) {
$invalidattr->{$attr_name}->{valid} = 0;
$invalidattr->{$attr_name}->{condition} = "\'$check_attr=$check_value\'";
$invalidattr->{$attr_name}->{condition}=$check_attr;
if (defined($conditionlist->{$check_attr})) {
$conditionlist->{$check_attr}=$conditionlist->{$check_attr}.",".$check_value;
} else {
$conditionlist->{$check_attr}=$check_value;
}
}
next;
@@ -1017,8 +1023,12 @@ sub setobjdefs
if (!($objhash{$objname}{$check_attr} =~ /\b$check_value\b/) && !($DBattrvals{$objname}{$check_attr} =~ /\b$check_value\b/)) {
if ($invalidattr->{$attr_name}->{valid} != 1) {
$invalidattr->{$attr_name}->{valid} = 0;
$invalidattr->{$attr_name}->{condition} = "\'$check_attr=$check_value\'";
$invalidattr->{$attr_name}->{condition}=$check_attr;
if (defined($conditionlist->{$check_attr})) {
$conditionlist->{$check_attr}=$conditionlist->{$check_attr}.",".$check_value;
} else {
$conditionlist->{$check_attr}=$check_value;
}
}
next;
@@ -1163,20 +1173,19 @@ sub setobjdefs
if ($invalidattr->{$att}->{valid} != 1) {
my $tt = $invalidattr->{$att}->{valid};
#if attribute is set invalid, check if its pre-check attribute exists in group objects, pick the attribute into valid.
# ex. if I want to set hdwctrlpoint I will have
# to match the right value for mgtmethod, but mgtmethod does exist in node object in chdef command
# if mgtmethod exists in group objects, set hdwctrlpoint valid
my $conditionkv=$invalidattr->{$att}->{condition};
$conditionkv=~s/(^'|'$)//g;
my ($attk, $attv)=split("=", $conditionkv);
foreach my $tmpgrp (@tmplgrplist) {
if ($DBgroupsattr{$tmpgrp}{$attk} eq $attv) {
$pickvalidattr=1;
last;
}
# ex. like if I want to set hdwctrlpoint I will have
# to match the right value for mgtmethod
# if mgtmethod exists in group objects and its value match the one of only_if value, set hdwctrlpoint valid
my $conditionkey=$invalidattr->{$att}->{condition};
foreach my $tmpgrp (@tmplgrplist) {
if (($DBgroupsattr{$tmpgrp}{$conditionkey}) && ($conditionlist->{$conditionkey} =~ $DBgroupsattr{$tmpgrp}{$conditionkey})) {
$pickvalidattr=1;
last;
}
}
if ($pickvalidattr != 1) {
push @{ $rsp->{data} }, "Cannot set the attr=\'$att\' attribute unless $invalidattr->{$att}->{condition}.";
$conditionlist->{$conditionkey}=~s/,/ or /g;
push @{ $rsp->{data} }, "Cannot set the attr=\'$att\' attribute unless $invalidattr->{$att}->{condition} value is $conditionlist->{$conditionkey}.";
xCAT::MsgUtils->message("E", $rsp, $::callback);
}
}
+40 -7
View File
@@ -835,7 +835,7 @@ sub fork_fanout_dcp
my @target_file = split '/', $$options{'source'};
$rcp_config{'dest-file'} =
"$$options{'target'}/$target_file[$#target_file]._$$target_properties{'hostname'}";
"$$options{'target'}/$target_file[$#target_file]._$$target_properties{'hostname'}";
}
@@ -850,6 +850,8 @@ sub fork_fanout_dcp
$$options{'destDir_srcFile'}{$user_target};
}
$dsh_trace
&& ($rcp_config{'trace'} = 1);
#eval "require RemoteShell::$rsh_extension";
eval "require xCAT::$rsh_extension";
my $remoteshell = "xCAT::$rsh_extension";
@@ -5198,8 +5200,10 @@ sub parse_rsync_input_file_on_MN
foreach my $target_node (@dest_host)
{
# skip the node if it's NOT in the permitted list
if ($dest_node && !grep /^$target_node$/, @dest_nodes) {
# skip the node if it's NOT in the permitted list and if
# it's not a SN doing a hierarchical mode transfer
if ($dest_node && !(grep /^$target_node$/, @dest_nodes)
&& ($rsyncSN != 1) ) {
next;
}
$$options{'destDir_srcFile'}{$target_node} ||= {};
@@ -5214,7 +5218,13 @@ sub parse_rsync_input_file_on_MN
if ($rsyncSN == 1)
{ # syncing the SN
$dest_dir = $syncdir; # the SN sync dir
$dest_dir .= dirname($srcfile);
if($srcfile =~ /\/$/){
#the srcfile is a directory
$dest_dir .= $srcfile;
}else{
#the srcfile is a file
$dest_dir .= dirname($srcfile);
}
$dest_dir =~ s/\s*//g; #remove blanks
}
$$options{'destDir_srcFile'}{$target_node}{$dest_dir} ||=
@@ -5655,11 +5665,30 @@ sub parse_rsync_input_file_on_SN
} else { # not processing EXECUTE, EXECUTEALWAYS or APPEND
# otherwise it is just the synclist
if ($line =~ /(.+) -> (.+)/)
# xCAT supports the syncfile format:
# file -> file
# file -> (noderange for permitted nodes) file
if ($line =~ /(.+) -> (.+)/ || $line =~ /(.+) -> +\((.+)\) +(.+)/)
{
$process_line = 1;
my $src_file = $1;
my $dest_file = $2;
my $src_file;
my $dest_file;
my $dest_node;
my @dest_nodes;
if ($line =~ /(.+) -> +\((.+)\) +(.+)/) {
$src_file = $1;
$dest_node = $2;
$dest_file = $3;
} elsif ($line =~ /(.+) -> (.+)/) {
$src_file = $1;
$dest_file = $2;
}
# get all the permitted nodes for the line
$dest_node =~ s/\s//g;
if ($dest_node) {
@dest_nodes = noderange($dest_node);
}
$dest_file =~ s/[\s;]//g; # remove blanks
# see if destination is a directory
@@ -5688,6 +5717,10 @@ sub parse_rsync_input_file_on_SN
foreach my $target_node (@dest_host)
{
# skip the node if it's NOT in the permitted list
if ($dest_node && ! grep /^$target_node$/, @dest_nodes) {
next;
}
$$options{'destDir_srcFile'}{$target_node} ||= {};
# for each file on the line
+5 -1
View File
@@ -156,7 +156,11 @@ sub remote_copy_command
$dest_user_host =
"$$config{'dest-user'}@" . "$$config{'dest-host'}";
}
print RSCYCCMDFILE "#!/bin/sh\n";
if ($$config{'trace'}) {
print RSCYCCMDFILE "#!/bin/sh -x\n";
} else {
print RSCYCCMDFILE "#!/bin/sh\n";
}
if ($localhost == 1) { # running to the MN from the MN
print RSCYCCMDFILE
"/bin/mkdir -p $dest_dir_list\n";
+71 -23
View File
@@ -694,17 +694,25 @@ passed as argument rather than by table value',
},
},
pdu => {
cols => [qw(node nodetype outlet machinetype modelnum serialnum comments disable)],
cols => [qw(node nodetype pdutype outlet username password snmpversion community snmpuser authtype authkey privtype privkey seclevel comments disable)],
keys => [qw(node)],
nodecol => "node",
table_desc => 'Parameters to use when interrogating pdus',
descriptions => {
node => 'The hostname/address of the pdu to which the settings apply',
nodetype => 'The node type should be pdu ',
pdutype => 'The type of pdu ',
outlet => 'The pdu outlet count',
machinetype => 'The pdu machine type',
modelnum => 'The pdu model number',
serialnum => 'The pdu serial number',
username => 'The remote login user name',
password => 'The remote login password',
snmpversion => 'The version to use to communicate with switch. SNMPv1 is assumed by default.',
community => 'The community string to use for SNMPv1/v2',
snmpuser => 'The username to use for SNMPv3 communication, ignored for SNMPv1',
authtype => 'The authentication protocol(MD5|SHA) to use for SNMPv3.',
authkey => 'The authentication passphrase for SNMPv3 ',
privtype => 'The privacy protocol(AES|DES) to use for SNMPv3.',
privkey => 'The privacy passphrase to use for SNMPv3.',
seclevel => 'The Security Level(noAuthNoPriv|authNoPriv|authPriv) to use for SNMPv3.',
comments => 'Any user-written notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
},
@@ -803,7 +811,7 @@ passed as argument rather than by table value',
pkglist => 'The fully qualified name of the file that stores the distro packages list that will be included in the image. Make sure that if the pkgs in the pkglist have dependency pkgs, the dependency pkgs should be found in one of the pkgdir',
pkgdir => 'The name of the directory where the distro packages are stored. It could be set to multiple paths. The multiple paths must be separated by ",". The first path in the value of osimage.pkgdir must be the OS base pkg dir path, such as pkgdir=/install/rhels6.2/x86_64,/install/updates . In the os base pkg path, there are default repository data. And in the other pkg path(s), the users should make sure there are repository data. If not, use "createrepo" command to create them. For ubuntu, multiple mirrors can be specified in the pkgdir attribute, the mirrors must be prefixed by the protocol(http/ssh) and delimited with "," between each other.',
otherpkglist => 'The fully qualified name of the file that stores non-distro package lists that will be included in the image. It could be set to multiple paths. The multiple paths must be separated by ",".',
otherpkgdir => 'The base directory where the non-distro packages are stored. Only 1 local directory supported at present.',
otherpkgdir => 'The base directory and urls of internet repos from which the non-distro packages are retrived. Only 1 local directory is supported at present. The entries should be delimited with comma ",". Currently, the internet repos are only supported on Ubuntu and Redhat.',
exlist => 'The fully qualified name of the file that stores the file names and directory names that will be excluded from the image during packimage command. It is used for diskless image only.',
postinstall => 'Supported in diskless image only. The fully qualified name of the scripts running in non-chroot mode after the package installation but before initrd generation during genimage. If multiple scripts are specified, they should be seperated with comma ",". A set of osimage attributes are exported as the environment variables to be used in the postinstall scripts:
@@ -950,19 +958,19 @@ passed as argument rather than by table value',
table_desc => 'List of all Service Nodes and services that will be set up on the Service Node.',
descriptions => {
node => 'The hostname of the service node as known by the Management Node.',
nameserver => 'Do we set up DNS on this service node? Valid values: 2, 1, no or 0. If 2, creates named.conf as dns slave, using the management node as dns master, and starts named. If 1, creates named.conf file with forwarding to the management node and starts named. If no or 0, it does not change the current state of the service. ',
dhcpserver => 'Do we set up DHCP on this service node? Not supported on AIX. Valid values:yes or 1, no or 0. If yes, runs makedhcp -n. If no or 0, it does not change the current state of the service. ',
tftpserver => 'Do we set up TFTP on this service node? Not supported on AIX. Valid values:yes or 1, no or 0. If yes, configures and starts atftp. If no or 0, it does not change the current state of the service. ',
nfsserver => 'Do we set up file services (HTTP,FTP,or NFS) on this service node? For AIX will only setup NFS, not HTTP or FTP. Valid values:yes or 1, no or 0.If no or 0, it does not change the current state of the service. ',
conserver => 'Do we set up Conserver on this service node? Valid values:yes or 1, no or 0. If yes, configures and starts conserver daemon. If no or 0, it does not change the current state of the service.',
monserver => 'Is this a monitoring event collection point? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.',
ldapserver => 'Do we set up ldap caching proxy on this service node? Not supported on AIX. Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.',
ntpserver => 'Not used. Use setupntp postscript to setup a ntp server on this service node? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.',
ftpserver => 'Do we set up a ftp server on this service node? Not supported on AIX Valid values:yes or 1, no or 0. If yes, configure and start vsftpd. (You must manually install vsftpd on the service nodes before this.) If no or 0, it does not change the current state of the service. xCAT is not using ftp for compute nodes provisioning or any other xCAT features, so this attribute can be set to 0 if the ftp service will not be used for other purposes',
nimserver => 'Not used. Do we set up a NIM server on this service node? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.',
ipforward => 'Do we set up ip forwarding on this service node? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.',
nameserver => 'Do we set up DNS on this service node? Valid values: 2, 1, or 0. If 2, creates named.conf as dns slave, using the management node as dns master, and starts named. If 1, creates named.conf file with forwarding to the management node and starts named. If 0, it does not change the current state of the service. ',
dhcpserver => 'Do we set up DHCP on this service node? Not supported on AIX. Valid values:1 or 0. If 1, runs makedhcp -n. If 0, it does not change the current state of the service. ',
tftpserver => 'Do we set up TFTP on this service node? Not supported on AIX. Valid values:1 or 0. If 1, configures and starts atftp. If 0, it does not change the current state of the service. ',
nfsserver => 'Do we set up file services (HTTP,FTP,or NFS) on this service node? For AIX will only setup NFS, not HTTP or FTP. Valid values:1 or 0.If 0, it does not change the current state of the service. ',
conserver => 'Do we set up Conserver on this service node? Valid values:1 or 0. If 1, configures and starts conserver daemon. If 0, it does not change the current state of the service.',
monserver => 'Is this a monitoring event collection point? Valid values: 1 or 0. If 0, it does not change the current state of the service.',
ldapserver => 'Do we set up ldap caching proxy on this service node? Not supported on AIX. Valid values:1 or 0. If 0, it does not change the current state of the service.',
ntpserver => 'Not used. Use setupntp postscript to setup a ntp server on this service node? Valid values:1 or 0. If 0, it does not change the current state of the service.',
ftpserver => 'Do we set up a ftp server on this service node? Not supported on AIX Valid values:1 or 0. If 1, configure and start vsftpd. (You must manually install vsftpd on the service nodes before this.) If 0, it does not change the current state of the service. xCAT is not using ftp for compute nodes provisioning or any other xCAT features, so this attribute can be set to 0 if the ftp service will not be used for other purposes',
nimserver => 'Not used. Do we set up a NIM server on this service node? Valid values:1 or 0. If 0, it does not change the current state of the service.',
ipforward => 'Do we set up ip forwarding on this service node? Valid values:1 or 0. If 0, it does not change the current state of the service.',
dhcpinterfaces => 'The network interfaces DHCP server should listen on for the target node. This attribute can be used for management node and service nodes. If defined, it will override the values defined in site.dhcpinterfaces. This is a comma separated list of device names. !remote! indicates a non-local network for relay DHCP. For example: !remote!,eth0,eth1',
proxydhcp => 'Do we set up proxydhcp service on this node? valid values: yes or 1, no or 0. If yes, the proxydhcp daemon will be enabled on this node.',
proxydhcp => 'Do we set up proxydhcp service on this node? valid values: 1 or 0. If 1, the proxydhcp daemon will be enabled on this node.',
comments => 'Any user-written notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
@@ -2950,24 +2958,64 @@ my @nodeattrs = (
tabentry => 'pdu.nodetype',
access_tabentry => 'pdu.node=attr:node',
},
{ attr_name => 'pdutype',
only_if => 'nodetype=pdu',
tabentry => 'pdu.pdutype',
access_tabentry => 'pdu.node=attr:node',
},
{ attr_name => 'outlet',
only_if => 'nodetype=pdu',
tabentry => 'pdu.outlet',
access_tabentry => 'pdu.node=attr:node',
},
{ attr_name => 'machinetype',
{ attr_name => 'username',
only_if => 'nodetype=pdu',
tabentry => 'pdu.machinetype',
tabentry => 'pdu.username',
access_tabentry => 'pdu.node=attr:node',
},
{ attr_name => 'modelnum',
{ attr_name => 'password',
only_if => 'nodetype=pdu',
tabentry => 'pdu.modelnum',
tabentry => 'pdu.password',
access_tabentry => 'pdu.node=attr:node',
},
{ attr_name => 'serialnum',
{ attr_name => 'snmpversion',
only_if => 'nodetype=pdu',
tabentry => 'pdu.serialnum',
tabentry => 'pdu.snmpversion',
access_tabentry => 'pdu.node=attr:node',
},
{ attr_name => 'community',
only_if => 'nodetype=pdu',
tabentry => 'pdu.community',
access_tabentry => 'pdu.node=attr:node',
},
{ attr_name => 'snmpuser',
only_if => 'nodetype=pdu',
tabentry => 'pdu.snmpuser',
access_tabentry => 'pdu.node=attr:node',
},
{ attr_name => 'authtype',
only_if => 'nodetype=pdu',
tabentry => 'pdu.authtype',
access_tabentry => 'pdu.node=attr:node',
},
{ attr_name => 'authkey',
only_if => 'nodetype=pdu',
tabentry => 'pdu.authkey',
access_tabentry => 'pdu.node=attr:node',
},
{ attr_name => 'privtype',
only_if => 'nodetype=pdu',
tabentry => 'pdu.privtype',
access_tabentry => 'pdu.node=attr:node',
},
{ attr_name => 'privkey',
only_if => 'nodetype=pdu',
tabentry => 'pdu.privkey',
access_tabentry => 'pdu.node=attr:node',
},
{ attr_name => 'seclevel',
only_if => 'nodetype=pdu',
tabentry => 'pdu.seclevel',
access_tabentry => 'pdu.node=attr:node',
},
+4
View File
@@ -219,6 +219,10 @@ sub get_broadcast_disjoint_scope_with_parallel {
my $reqs = get_parallel_scope($req);
my $handled4me = 0; # indicate myself is already handled.
if (xCAT::Utils->isMN()) { # For MN, add itself always.
push @requests, @$reqs;
$handled4me = 1;
}
my %prehandledhash = ();# the servers which is already handled.
foreach (@$extras) {
my $xcatdest = $_;
+8 -5
View File
@@ -509,8 +509,11 @@ sub get_ServiceNode
# get site.master this will be the default
my $master = xCAT::TableUtils->get_site_Master();
$noderestab = xCAT::Table->new('noderes');
unless($master){
xCAT::MsgUtils->message('SW',"site.master is not set!\n");
}
$noderestab = xCAT::Table->new('noderes');
unless ($noderestab) # no noderes table, use default site.master
{
xCAT::MsgUtils->message('I',
@@ -548,7 +551,7 @@ sub get_ServiceNode
my $key = $rec->{$snattribute};
push @{ $snhash{$key} }, $node;
}
else # use site.master
elsif($master) # use site.master
{
push @{ $snhash{$master} }, $node;
}
@@ -595,7 +598,7 @@ sub get_ServiceNode
my $key = $rec->{$snattribute};
push @{ $snhash{$key} }, $node;
}
else
elsif($master)
{ # use site.master
push @{ $snhash{$master} }, $node;
}
@@ -631,7 +634,7 @@ sub get_ServiceNode
my $key = $rec->{$snattribute};
push @{ $snhash{$key} }, $node;
}
else
elsif($master)
{ # use site.master
push @{ $snhash{$master} }, $node;
}
@@ -675,7 +678,7 @@ sub get_ServiceNode
my $key = $sn->{$snattribute};
push @{ $snhash{$key} }, $node;
}
else
elsif($master)
{ # no service node use master
push @{ $snhash{$master} }, $node;
}
+3 -1
View File
@@ -146,6 +146,7 @@ my %usage = (
rspconfig <noderange> [userid=<userid> username=<username> password=<password>]
OpenBMC specific:
rspconfig <noderange> [ipsrc|ip|netmask|gateway|hostname|vlan]
rspconfig <noderange> dump [-l|--list] [-g|--generate] [-c|--clear {<id>|all}] [-d|--download <id>]
iDataplex specific:
rspconfig <noderange> [thermprofile]
rspconfig <noderange> [thermprofile=<two digit number from chassis>]
@@ -353,7 +354,8 @@ my %usage = (
OpenPOWER OpenBMC specific:
rflash <noderange> {[-c|--check] | [-l|--list]}
rflash <noderange> <tar_file_path> {[-c|--check] | [-a|--activate] | [-u|--upload]}
rflash <noderange> <image_id> {[-a|--activate] | [-d|--delete]}",
rflash <noderange> <tar_file_diretory> [-d] [--no-host-reboot]
rflash <noderange> <image_id> {[-a|--activate] | [--delete]}",
"mkhwconn" =>
"Usage:
mkhwconn [-h|--help]
+31 -1
View File
@@ -48,7 +48,7 @@ require xCAT::Version;
require DBI;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(genpassword runcmd3);
our @EXPORT_OK = qw(genpassword runcmd3 natural_sort_cmp);
# The functions that has been moved to TableUtils.pm
@@ -4918,5 +4918,35 @@ sub acquire_lock_imageop {
return (0,$lock);
}
#--------------------------------------------------------------------------------
=head3 natural_sort_cmp
compare $left and $right by natural ordering.
=cut
#--------------------------------------------------------------------------------
sub natural_sort_cmp($$) {
my $left = shift;
my $right = shift;
while() {
if( !($left =~ /\d+(\.\d+)?/) ) {
return $left cmp $right;
}
my $before = $`;
my $match = $&;
my $after = $';
if( !($right =~ /\d+(\.\d+)?/) ) {
return $left cmp $right;
}
if( $before ne $` ) {
return $left cmp $right;
} elsif( $match != $& ) {
return $match <=> $&;
} else {
$left = $after;
$right = $';
}
}
}
1;
+4 -2
View File
@@ -21,7 +21,8 @@ our %global_mac_identity = (
"8c:ea:1b" => "Edgecore Networks Switch",
"a8:2b:b5" => "Edgecore Networks Switch",
"3c:2c:99" => "Edgecore Networks Switch",
"70:72:cf" => "Edgecore Networks Switch"
"70:72:cf" => "Edgecore Networks Switch",
"6c:64:1a" => "Penguin Computing switch"
);
#the hash to lookup switch type with vendor
@@ -40,7 +41,8 @@ our %global_switch_type = (
MELLAN => "Mellanox",
Cumulus => "onie",
cumulus => "onie",
Edgecore => "onie"
Edgecore => "onie",
coral => "crpdu"
);
+69
View File
@@ -62,6 +62,9 @@ done
# confluent if this keyword is defined in the site table. This allows for confluent to
# be installed on the xCAT management node and switch between conserver & confluent
USE_CONFLUENT=0
# If conluent is not enable, check the service status of goconserver.
# If goconserver is strated, use rcons through goconserver, otherwise through conserver.
USE_GOCONSERVER=0
CONSOLE_SERVICE_KEYWORD=`tabdump site | grep consoleservice | cut -d, -f1 | tr -d '"'`
CONSOLE_SERVICE_VALUE=`tabdump site | grep consoleservice | cut -d, -f2 | tr -d '"'`
@@ -71,6 +74,20 @@ if [ "$CONSOLE_SERVICE_KEYWORD" == "consoleservice" ]; then
fi
fi
if [ $USE_CONFLUENT != "1" ] && [ -f "/usr/bin/congo" ] && [ -f "/usr/bin/goconserver" ]; then
GOCONSERVER_RC=`service goconserver status >& /dev/null; echo $?`
if [[ ${GOCONSERVER_RC} == 0 ]]; then
USE_GOCONSERVER=1
fi
if [[ ${USE_GOCONSERVER} == 1 ]]; then
CONSERVER_RC=`pidof conserver >> /dev/null; echo $?`
if [[ ${CONSERVER_RC} == 0 ]]; then
echo "Error: Both goconserver and conserver are running, please stop one of them, and retry..."
exit 1
fi
fi
fi
if [ $USE_CONFLUENT == "1" ] && ([ -x "/opt/confluent/bin/confetty" ] || [ -x "/usr/bin/confetty" ] || [ -x "/usr/local/bin/confetty" ]); then
# use confluent, make sure conserver is not also running
CONSERVER_RC=`pidof conserver >> /dev/null; echo $?`
@@ -78,6 +95,11 @@ if [ $USE_CONFLUENT == "1" ] && ([ -x "/opt/confluent/bin/confetty" ] || [ -x "/
echo "Error: consoleservice is set to 'confluent' but conserver is running. Stop conserver, run makeconfluentcfg, and retry..."
exit 1
fi
GOCONSERVER_RC=`service goconserver status >& /dev/null; echo $?`
if [[ ${GOCONSERVER_RC} == 0 ]]; then
echo "Error: consoleservice is set to 'confluent' but goconserver is running. Stop goconserver, run makeconfluentcfg, and retry..."
exit 1
fi
CONFETTY="confetty"
if [ -x "/opt/confluent/bin/confetty" ]; then
CONFETTY="/opt/confluent/bin/confetty"
@@ -103,6 +125,53 @@ if [ $USE_CONFLUENT == "1" ] && ([ -x "/opt/confluent/bin/confetty" ] || [ -x "/
CONSERVER="-s $CONSERVER"
fi
$CONFETTY $CONSCONTROLPATH $CONSERVER $1
elif [ $USE_GOCONSERVER == "1" ]; then
# use goconserver
# make sure confluent is not also running, only if confluent is installed
if [[ -f "/etc/init.d/confluent" ]]; then
CONFLUENT_RC=`service confluent status >& /dev/null; echo $?`
if [[ ${CONFLUENT_RC} == 0 ]]; then
echo "Error: confluent is running. Stop confluent, run makegocons, and retry..."
exit 1
fi
fi
if [ -z "$CONSERVER" ]; then
CONSERVER=`nodels $1 nodehm.conserver 2>/dev/null | awk -F: '{print $2}' | tr -d ' '`
fi
if [ -z "$CONSERVER" ]; then
CONSERVER=$XCATHOST
fi
if [ -z "$CONSERVER" ]; then
CONSERVER=`hostname`
fi
CONGO_ENV="CONGO_SSL_KEY=$HOME/.xcat/client-cred.pem \
CONGO_SSL_CERT=$HOME/.xcat/client-cred.pem \
CONGO_SSL_CA_CERT=$HOME/.xcat/ca.pem \
CONGO_PORT=12430 \
CONGO_CLIENT_TYPE=xcat"
if [ "$CONSERVER" == `hostname` ]; then
host=`hostname -s`
if [ $? -ne 0 ]; then
echo "Error: could not get the short hostname for $CONSERVER."
exit 1
fi
CONGO_ENV="$CONGO_ENV \
CONGO_SERVER_HOST=$host \
CONGO_URL=https://$host:12429"
exec env $CONGO_ENV /usr/bin/congo console $1
else
host=`ssh $CONSERVER hostname -s`
if [ $? -ne 0 ]; then
echo "Error: could not get the short hostname for $CONSERVER."
exit 1
fi
CONGO_ENV="$CONGO_ENV \
CONGO_SERVER_HOST=$host \
CONGO_URL=https://$host:12429"
exec ssh -t $CONSERVER "$CONGO_ENV /usr/bin/congo console $1"
fi
elif [ -f "/usr/bin/console" ] || [ -f "/bin/console" ]; then
# use conserver
# make sure confluent is not also running, only if confluent is installed
+1
View File
@@ -6,6 +6,7 @@ opt/xcat/bin/xcatclient opt/xcat/sbin/makeknownhosts
opt/xcat/bin/xcatclient opt/xcat/sbin/nodeset
opt/xcat/bin/xcatclient opt/xcat/sbin/setupiscsidev
opt/xcat/bin/xcatclient opt/xcat/sbin/makeconservercf
opt/xcat/bin/xcatclient opt/xcat/sbin/makegocons
opt/xcat/bin/xcatclient opt/xcat/bin/rbeacon
opt/xcat/bin/xcatclient opt/xcat/bin/rvitals
opt/xcat/bin/xcatclient opt/xcat/bin/nodestat
-20
View File
@@ -10,10 +10,6 @@ B<bmcdiscover> [B<-v>|B<--version>]
B<bmcdiscover> [B<--sn> I<SN_nodename>] [B<-s> I<scan_method>] [B<-u> I<bmc_user>] [B<-p> I<bmc_passwd>] [B<-z>] [B<-w>] B<--range> I<ip_ranges>
B<bmcdiscover> B<-u> I<bmc_user> B<-p> I<bmc_passwd> B<-i> I<bmc_ip> B<--check>
B<bmcdiscover> [B<-u> I<bmc_user>] [B<-p> I<bmc_passwd>] B<-i> I<bmc_ip> B<--ipsource>
=head1 DESCRIPTION
@@ -61,14 +57,6 @@ BMC user name.
BMC user password.
=item B<--check>
Check BMC administrator User/Password.
=item B<--ipsource>
Display the BMC IP configuration.
=item B<-h|--help>
Display usage message
@@ -117,14 +105,6 @@ Output is similar to:
bmcdiscover -s nmap --range "10.4.22-23.100-254" -w -z
5. To check if the username or password is correct against the BMC:
bmcdiscover -i 10.4.23.254 -u USERID -p PASSW0RD --check
6. Get BMC IP Address source, DHCP Address or static Address
bmcdiscover -i 10.4.23.254 -u USERID -p PASSW0RD --ipsource
=head1 SEE ALSO
L<lsslp(1)|lsslp.1>
+39 -7
View File
@@ -34,7 +34,9 @@ B<rflash> I<noderange> {[B<-c>|B<--check>] | [B<-l>|B<--list>]}
B<rflash> I<noderange> I<tar_file_path> {[B<-c>|B<--check>] | [B<-a>|B<--activate>] | [B<-u>|B<--upload>]}
B<rflash> I<noderange> I<image_id> {[B<-a>|B<--activate>] | [B<-d>|B<--delete>]}
B<rflash> I<noderange> I<tar_file_directory> [B<-d>] [B<--no-host-reboot>]
B<rflash> I<noderange> I<image_id> {[B<-a>|B<--activate>] | [B<--delete>]}
=head1 B<Description>
@@ -91,14 +93,44 @@ The command will update firmware for NeXtScale FPC when given an FPC node and th
=head2 OpenPOWER specific (using IPMI):
The command will update firmware for OpenPOWER BMC when given an OpenPOWER node and either the hpm formatted file path or path to a data directory.
The command will update firmware for OpenPOWER BMC when given an OpenPOWER node with I<mgt=ipmi> and either the hpm formatted file path or path to a data directory.
B<Note:> When using B<rflash> in hierarchical environment, the hpm file or data directory must be accessible from Service Nodes.
=head2 OpenPOWER OpenBMC specific:
=head2 OpenPOWER specific (using OpenBMC):
The command will update firmware for OpenPOWER BMC when given an OpenPOWER node with I<mgt=openbmc> and either an update .tar file or an uploaded image id.
B<-l|--list>:
The list option will list out available firmware on the BMC. It provides an interface to display the ID of the various firmware levels.
The (*) symbol indicates the active running firmware on the server.
The (+) symbol indicates the firmware that is pending and a reboot is required to set it to be the active running firmware level.
B<-u|--upload>:
The upload option expects a .tar file as the input and will upload the file to the BMC. Use the list option to view the result.
B<-a|--activate>:
The activate option expects either a .tar file or an ID as the input. If a .tar file is provided, it will upload and activate the firmware in a single step
To apply the firmware level, a reboot is required to BMC and HOST.
The command will update firmware for OpenPOWER OpenBMC when given an OpenPOWER node and either an update .tar file or an uploaded image id.
B<Note:> When using B<rflash> in hierarchical environment, the .tar file must be accessible from Service Nodes.
B<-d>:
This option steamlines the update, activate, reboot BMC and reboot HOST procedure. It expects a directory containing both BMC and PNOR .tar files. When BMC and PNOR tar files are provided, the command will upload and activate firmware. After BMC becomes activate, it will reboot BMC. If BMC state is Ready, the command will reboot the HOST. If BMC state is NotReady, the command will exit.
B<Note:> When using B<--no-host-reboot>, it will not reboot the host after BMC is reboot.
B<--delete>:
This delete option will delete update image from BMC. It expects an ID as the input.
=head1 B<Options>
=over 7
@@ -159,7 +191,7 @@ List currently uploaded update images. "(*)" indicates currently active image.
Upload update image. Specified file must be in .tar format.
=item B<-d|--delete>
=item B<--delete>
Delete update image from BMC
@@ -213,14 +245,14 @@ Print verbose message to rflash log file (/var/log/xcat/rflash/fs3.log) when upd
rflash fs3 /firmware/8335_810.1543.20151021b_update.hpm -V
=item 6.
To update the firmware on IBM Power S822LC for Big Data machine specify the node name and the file path of the data directory containing pUpdate utility and BMC and/or PNOR update files:
To update the firmware on IBM Power S822LC for Big Data machine specify the node name and the file path of the data directory containing pUpdate utility, both BMC and PNOR update files:
rflash briggs01 -d /root/supermicro/OP825
=item 7.
To update the firmware on the OpenBMC machine, specify the firmare update file to upload and activate:
rflash p9euh02 -a /tmp/witherspoon.pnor.squashfs.tar
rflash p9euh02 -a /tmp/witherspoon.pnor.squashfs.tar
=back
+1 -1
View File
@@ -58,7 +58,7 @@ A set of comma delimited object types.
=item B<-C|--cleanup>
Perform additional cleanup by running B<nodeset offline> on the objects specified in the I<noderange>.
Perform additional cleanup by running B<nodeset offline> and B<makeconservercf -d> on the objects specified in the I<noderange>.
=item B<-V|--verbose>
+46
View File
@@ -26,6 +26,8 @@ B<rspconfig> I<noderange> B<garp>=I<time>
B<rspconfig> I<noderange> {B<ipsrc>|B<ip>|B<netmask>|B<gateway>|B<hostname>|B<vlan>|B<sshcfg>}
B<rspconfig> I<noderange> B<dump> [B<-l>|B<--list>] [B<-g>|B<--generate>] [B<-c>|B<--clear> {I<id>|B<all>}] [B<-d>|B<--download> I<id>]
=head2 MPA specific:
B<rspconfig> I<noderange> {B<sshcfg>|B<snmpcfg>|B<pd1>|B<pd2>|B<network>|B<swnet>|B<ntp>|B<textid>|B<frame>}
@@ -324,6 +326,26 @@ Select whether each memory bank should be enabled or disabled. State changes tak
The subnet mask.
=item B<dump>
Manage OpenBMC system dumps. If no sub-option is provided, will generate, wait, and download the dump.
=over 4
=item
B<-c> will clear a single specified dump, or use 'all' to clear all dumps on the BMC.
=item
B<-l> will list all the generated dumps on the BMC.
=item
B<-g> will generate a new dump on the BMC. Dump generation can take a few minutes.
=item
B<-d> will download a single dump from the BMC to /var/log/xcat/dump on management or service node.
=back
=item B<network>={[I<ip>],[I<host>],[I<gateway>],[I<netmask>]|*}
For MPA: get or set the MPA network parameters. If '*' is specified, all parameters are read from the xCAT database.
@@ -813,6 +835,30 @@ Output is similar to:
fsp: Success
=item 31.
To list BMC dumps available for download:
rspconfig p9euh02 dump -l
Output is similar to:
p9euh02: [1] Generated: 09/06/2017 14:31:49, Size: 4528
p9euh02: [2] Generated: 09/06/2017 14:31:55, Size: 4516
p9euh02: [3] Generated: 09/06/2017 14:32:01, Size: 4236
p9euh02: [4] Generated: 09/06/2017 14:32:07, Size: 4248
p9euh02: [5] Generated: 09/06/2017 14:32:11, Size: 4268
=item 32.
To generate and download BMC dump:
rspconfig p9euh02 dump
Output is similar to:
Capturing BMC Diagnostic information, this will take some time...
p9euh02: Dump requested. Target ID is 6, waiting for BMC to generate...
p9euh02: Dump 6 generated. Downloading to /var/log/xcat/dump/20171211-0951_p9euh02_dump_6.tar.xz
=back
=head1 SEE ALSO
@@ -6,6 +6,8 @@ B<makeconservercf> - creates the conserver configuration file from info in the x
B<makeconservercf> [B<-V|--verbose>] [B<-d|--delete>] [I<noderange>]
B<makeconservercf> [B<-V|--verbose>] [B<-C|--cleanup>]
B<makeconservercf> [B<-V|--verbose>] [B<-l|--local>] [I<noderange>]
B<makeconservercf> [B<-V|--verbose>] [B<-c|--conserver>] [I<noderange>]
@@ -24,6 +26,8 @@ does not have nodehm.cons set, it will not be written to the file.
If B<-d> is specified, B<makeconservercf> will remove specified nodes from /etc/conserver.cf file. If I<noderange> is not specified, all xCAT nodes will be removed from /etc/conserver.cf file.
If B<-C|--cleanup> is specified, B<makeconservercf> will remove console configuration entries from /etc/conserver.cf for the nodes whose definitions have been removed from xCATdb. B<Don't> specify any noderange.
In the case of a hierarchical cluster (i.e. one with service nodes) B<makeconservercf> will determine
which nodes will have their consoles accessed from the management node and which from a service node
(based on the nodehm.conserver attribute). The /etc/conserver.cf file will be created accordingly on
@@ -38,6 +42,10 @@ all relevant management/service nodes. If B<-l> is specified, it will only crea
Delete rather than add or refresh the nodes specified as a noderange.
=item B<-C|--cleanup>
Remove the entries for the nodes whose definitions have been removed from xCAT db.
=item B<-c|--conserver>
Only set up the conserver on the conserver host. If no conserver host
+98
View File
@@ -0,0 +1,98 @@
=head1 NAME
B<makegocons> - Register or unregister the node in the goconserver service
=head1 SYNOPSIS
B<makegocons> [B<-V|--verbose>] [B<-d|--delete>] [I<noderange>]
B<makeconservercf> [B<-h|--help|-v|--version>]
=head1 DESCRIPTION
The B<makegocons> command will start the goconserver service if it is not started, then
send the REST request to create or delete the session resource in the goconserver service. The session
information including the session command or ssh connection parameters (for openbmc) is generated by xcat
based on the records in the related tables (e.g. nodehm, ipmi, ppc, openbmc).
By default B<makegocons> will register the session for all of the nodes in xcat.
If a I<noderange> is specified, only the session in the specified scope will be affected, goconserver
service will not be restarted and the other session will not be disconnected. This is the advantage
of goconserver over the conserver service with B<makeconservercf>.
If B<-d> is specified, B<makegocons> will remove the session in the goconserver service.
In the case of a hierarchical cluster (i.e. one with service nodes) B<makegocons> will determine
which nodes will have their consoles accessed from the management node and which from a service node
(based on the nodehm.conserver attribute).
For openbmc which uses ssh as the terminal session connection method, goconserver can help save the system
resources as goconserver could handle the ssh connection within goroutine which is more light-weighted than the command process.
B<Note:> goconserver is an experimental feature, it will not be installed with xcat and will only support the systemd based systems.
Download and setup the rpm or deb package manually. Release link:
https://github.com/chenglch/goconserver/releases
=head1 OPTIONS
=over 10
=item B<-d|--delete>
Delete rather than add or refresh the nodes specified as a noderange.
=item B<-v|--version>
Display version.
=item B<-V|--verbose>
Verbose mode.
=item B<-h|--help>
Display usage message.
=back
=head1 RETURN VALUE
=over 2
=item 0.
The command completed successfully.
=item 1.
An error has occurred.
=back
=head1 EXAMPLES
=over 2
=item 1.
To create goconserver configuration for all the nodes.
makegocons
=item 2.
To create goconserver configuration for nodes node01-node10.
makegocons node01-node10
=item 3.
To remove goconserver configuration for node01.
makegocons -d node01
=back
=head1 SEE ALSO
L<rcons(1)|rcons.1>
+1
View File
@@ -150,6 +150,7 @@ ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/sbin/makeknownhosts
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/sbin/nodeset
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/sbin/setupiscsidev
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/sbin/makeconservercf
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/sbin/makegocons
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/rbeacon
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/rvitals
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/nodestat
+32 -9
View File
@@ -20,8 +20,11 @@ if [ -z $1 ]; then
if [ $BUILDARCH = "ppc64le" ]; then
HOSTOS="Pegas1.0"
BUILDARCH="ppc64"
else
elif [ $BUILDARCH = "ppc64" ]; then
HOSTOS="fedora26"
elif [ $BUILDARCH = "x86_64" ]; then
yum install efibootmgr bc -y
HOSTOS="centos7"
fi
fi
@@ -35,9 +38,22 @@ else
DRACUTMODDIR=/usr/lib/dracut/modules.d/97xcat
fi
# get all modules in the kernel
cd $DIR
KERVER=`uname -r`
if [ ! -e "./default_module_list" ]; then
mv ./installkernel ./default_module_list
fi
echo "#!/bin/bash" > ./installkernel
for line in `cat /lib/modules/$KERVER/modules.dep | awk -F: '{print \$1}'`; do
basename $line >> ./installkernel;
done
sed -i 's/\(.*\)\.ko.*/instmods \1/g' ./installkernel
chmod +x ./installkernel
cd -
mkdir -p $DRACUTMODDIR
cp $DIR/* $DRACUTMODDIR
# Remove the ipr(IBM Power RAID) stuff when building on x86_64
if [ $BUILDARCH = "x86_64" ]; then
sed -i 's/dracut_install \/lib64\/libform.so.5//' $DRACUTMODDIR/install
@@ -48,6 +64,11 @@ if [ $BUILDARCH = "x86_64" ]; then
sed -i '/\/usr\/sbin\/iprconfig/ d' $DRACUTMODDIR/install
sed -i '/hwdb.bin/ d' $DRACUTMODDIR/install
sed -i 's/instmods ipr//' $DRACUTMODDIR/installkernel
sed -i 's/ mkreiserfs//' $DRACUTMODDIR/install
sed -i 's/ reiserfstune//' $DRACUTMODDIR/install
sed -i 's/ vconfig//' $DRACUTMODDIR/install
sed -i 's/\/lib\/terminfo\/l\/linux/\/usr\/share\/terminfo\/l\/linux/g' $DRACUTMODDIR/install
sed -i 's/\/lib\/terminfo\/v\/vt100/\/usr\/share\/terminfo\/v\/vt100/g' $DRACUTMODDIR/install
fi
if [ "$HOSTOS" = "mcp" ]; then
#Special handlings for MCP PPC64 platform building.
@@ -130,12 +151,11 @@ if [ "$HOSTOS" = "mcp" ]; then
else
echo Creating the initramfs in /tmp/xcatgenesis.$$.rfs using dracut ...
fi
# On Fedora 20 ppc64, dracut uses host-only mode by default
if [ $BUILDARCH = "ppc64" ]; then
dracut -m "xcat base" -N -f /tmp/xcatgenesis.$$.rfs $KERNELVERSION
else
dracut -m "xcat base" -f /tmp/xcatgenesis.$$.rfs $KERNELVERSION
dracut -m "xcat base" --no-early-microcode -N -f /tmp/xcatgenesis.$$.rfs $KERNELVERSION
fi
if [ $? -ne 0 ]; then
@@ -145,6 +165,7 @@ fi
echo Expanding the initramfs into /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/fs ...
cd /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/fs
zcat /tmp/xcatgenesis.$$.rfs|cpio -dumi
# add the perl library
@@ -159,13 +180,15 @@ for d in `echo $PERL_LIB_DIR`; do
fi
done
# create the predictable naming for nics
LIB_UDEV_RULES="/lib/udev/rules.d/"
cp $DRACUTMODDIR/80-net-name-slot.rules /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/fs/lib/udev/rules.d/
if [ $? -ne 0 ]; then
echo "ERROR - expanding the initramfs, please correct the issues and try again"
exit 1
if [ ! -e "$LIB_UDEV_RULES/80-net-name-slot.rules" ]; then
cp $DRACUTMODDIR/80-net-name-slot.rules /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/fs/lib/udev/rules.d/
if [ $? -ne 0 ]; then
echo "ERROR - expanding the initramfs, please correct the issues and try again"
exit 1
fi
fi
# add the kernel
+74
View File
@@ -29,6 +29,7 @@ Vendor: IBM Corp.
Summary: xCAT Genesis netboot image
URL: https://xcat.org/
Source1: xCAT-genesis-base-%{tarch}.tar.bz2
Conflicts: xCAT-genesis-scripts-%{tarch} < 1:2.13.9
Buildroot: %{_localstatedir}/tmp/xCAT-genesis
BuildRequires: /usr/sbin/ntp-wait
@@ -51,6 +52,79 @@ tar jxf %{SOURCE1}
cd -
%pretrans -p <lua>
-- Lua block of code for removing a directory recursively
-- The Lua function remove_directory_deep should be called
-- with a directory name or, in a spec file, also with
-- a rpm macro defined to a directory name. This function
-- is a possible lua equivalent of the shell command "rm -rf"
-- using the lua posix extension embedded in rpm
local leaf_indent = '| '
local tail_leaf_indent = ' '
local leaf_prefix = '|-- '
local tail_leaf_prefix = '`-- '
local link_prefix = ' -> '
local function printf(...)
io.write(string.format(unpack(arg)))
end
local function remove_directory(directory, level, prefix)
local num_dirs = 0
local num_files = 0
if posix.access(directory,"rw") then
local files = posix.dir(directory)
local last_file_index = table.getn(files)
table.sort(files)
for i, name in ipairs(files) do
if name ~= '.' and name ~= '..' then
local full_name = string.format('%s/%s', directory, name)
local info = assert(posix.stat(full_name))
local is_tail = (i==last_file_index)
local prefix2 = is_tail and tail_leaf_prefix or leaf_prefix
local link = ''
if info.type == 'link' then
linked_name = assert(posix.readlink(full_name))
link = string.format('%s%s', link_prefix, linked_name)
posix.unlink(full_name)
end
-- printf('%s%s%s%s\n', prefix, prefix2, name, link)
if info.type == 'directory' then
local indent = is_tail and tail_leaf_indent or leaf_indent
sub_dirs, sub_files = remove_directory(full_name, level+1,
prefix .. indent)
num_dirs = num_dirs + sub_dirs + 1
num_files = num_files + sub_files
posix.rmdir(full_name)
else
posix.unlink(full_name)
num_files = num_files + 1
end
end
end
end -- if access
return num_dirs, num_files
end
local function remove_directory_deep(directory)
-- print(directory)
num_dirs, num_files = remove_directory(directory, 0, '')
-- printf('\ndropped %d directories, %d files\n', num_dirs, num_files)
posix.rmdir(directory)
end
remove_directory_deep("/opt/xcat/share/xcat/netboot/genesis/%{tarch}/fs/bin")
remove_directory_deep("/opt/xcat/share/xcat/netboot/genesis/%{tarch}/fs/sbin")
remove_directory_deep("/opt/xcat/share/xcat/netboot/genesis/%{tarch}/fs/lib")
remove_directory_deep("/opt/xcat/share/xcat/netboot/genesis/%{tarch}/fs/lib64")
remove_directory_deep("/opt/xcat/share/xcat/netboot/genesis/%{tarch}/fs/var/run")
%post
if [ "$1" == "2" ]; then #only on upgrade, as on install it's probably not going to work...
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
+5 -1
View File
@@ -396,7 +396,11 @@ fi
# update the node status to 'bmcready' for openbmc, no more configuration is needed.
if [ ! -z "$ISOPENBMC" ]; then
# To enable network configuration for openbmc
ipmitool -d 0 lan set $LANCHAN access on
#
# For OpenBMC, FW team still suggest running the raw command instead of access on, use raw for now
#
# ipmitool -d 0 lan set $LANCHAN access on
ipmitool -d 0 raw 0x06 0x40 $LANCHAN 0x42 0x44
# update the node status to 'bmcready'
if [ ! -z "$XCATMASTER" ]; then
# Wait for some time for the new network setting is ready
+13 -18
View File
@@ -50,17 +50,12 @@ if [ $timewaiting != 700 -a $timewaiting -gt 450 ]; then
logger -s -t $log_label -p local4.warning "Obtained an IP address $NICSGETTINGADDR but it took $timewaiting cycles, you may want to check the spanning tree configuration in the switch."
fi
logger -s -t $log_label -p local4.info "Network configuration complete, commencing transmit of discovery packets"
XCATPORT=3001
read XCATMASTER XCATPORT < <(grep xcatd= /proc/cmdline| sed 's/.*xcatd=\([^ ]*\).*/\1/' |tr ':' ' ')
if [[ -z $XCATPORT ]]; then
XCATPORT=3001
fi
export XCATPORT
for parm in `cat /proc/cmdline`; do
key=`echo $parm|awk -F= '{print $1}'`
if [ "$key" = "xcatd" ]; then
XCATMASTER=`echo $parm|awk -F= '{print $2}'|awk -F: '{print $1}'`
XCATPORT=`echo $parm|awk -F= '{print $2}'|awk -F: '{print $2}'`
fi
done
#time to make our packet...
while [ ! -r /restart ]; do
@@ -69,7 +64,7 @@ while [ ! -r /restart ]; do
#the existence of "/processing" indicates that my findme request is under processing
if [ -f "/processing" ]; then
if [ $curtime -gt $[ $reqtime + $maxresptime ] ]; then
if [ $curtime -gt $((reqtime+maxresptime)) ]; then
#I think my findme request processing is timeout, I will resend the findme request
logger -s -t $log_label -p local4.info "seems the processing of my findme request cost more than $maxresptime, send new findme request"
rm -rf /processing
@@ -134,8 +129,8 @@ fi
# The MEMORY will look like this: 32868920
MEMORY=`cat /proc/meminfo |grep MemTotal|awk '{printf "%.0fMB\n", $2/1024}'`
# The DISKSIZE will look like this: sdb:250GB,sda:250GB
DISKSIZE=`cat /proc/partitions |grep -e "sd.\>" |awk -F' ' '{printf "%s:%.0fGB\n", $4, $3*0.000001024}' |sed 'N;s/\n/,/'`
# The DISKSIZE will look like this: sda:960GB,sdb:960GB,sdc:480GB,sdd:480GB (sorted by major,minor)
DISKSIZE="$(grep -v name /proc/partitions |sort -g -k 1,2 |awk 'BEGIN{sep=""} /[^0-9]$/{printf("%s%s:%.0fGB", sep, $4, $3/1024^2) ; sep=","}')"
logger -s -t $log_label -p local4.info "Beginning echo information to discovery packet file..."
echo '<xcatrequest>' > /tmp/discopacket
@@ -153,12 +148,12 @@ if [ "$UUID" != "unknown" ]; then
echo "<uuid>$UUID</uuid>" >> /tmp/discopacket
fi
flag_mtm=`echo '$MTM' | sed 's/0//g'`
if [ $flag_mtm ] && [ "$MTM" != "unknown" ]; then
flag_mtm=`echo "$MTM" | sed 's/0//g'`
if [ "$flag_mtm" ] && [ "$MTM" != "unknown" ]; then
MTM=`echo $MTM | sed 's/\.//g'`
echo "<mtm>$MTM</mtm>" >> /tmp/discopacket
fi
flag_serial=`echo '$SERIAL' | sed 's/0//g'`
flag_serial=`echo "$SERIAL" | sed 's/0//g'`
if [ $flag_serial ] && [ "$SERIAL" != "unknown" ]; then
SERIAL=`echo $SERIAL | sed 's/\.//g'`
echo "<serial>$SERIAL</serial>" >> /tmp/discopacket
@@ -192,7 +187,7 @@ fi
if [ -f "/usr/sbin/dmidecode" ]; then
for onboard in `dmidecode -t 41|egrep '(Type:|Bus Address)'|grep -A1 Ethernet|grep -v Ethernet|sed -e 's/.*Address: //'`; do
obdevs=("${obdevs[@]}" $onboard)
if [ ${onboard#*.}=0 ]; then
if [ ${onboard#*.} = 0 ]; then
truncslot=${onboard%.*}
for obslot in `grep $truncslot /sys/class/net/*/device/uevent|sed -e s/.*=//`; do
if ! dmidecode -t 41|grep $obslot > /dev/null; then
@@ -218,7 +213,7 @@ for dev in `ip link|grep -B1 ether|grep UP|awk '{print $2}'|sed -e s/://|grep -v
SLOTNAME=`dmidecode -t 9|egrep '(Designation|Address)'|grep -B1 $PCI_SLOT|grep Designation|sed -e 's/.*Designation:[ ]*//'`
if [ -z "$SLOTNAME" ]; then #check for on board device
index=1
for s in ${obdevs[@]}; do
for s in "${obdevs[@]}"; do
if [ "$s" = "$PCI_SLOT" ]; then
ONBOARDINDEX=$index
break
+6 -3
View File
@@ -154,7 +154,10 @@ if ($debug) {
}
#if failed to pass pre-check, exit directly
exit $rst if ($rst);
if ($rst){
probe_utils->send_msg("stdout", "f", "Provison pre-check");
exit $rst;
}
# record every status's start time and end time for each node
# $node_status_time{$node}{$status}{start_time} = $start_time;
@@ -203,7 +206,7 @@ sub do_pre_check {
my @error = ();
my $sub_func_rst = obtain_install_nic(\$installnic, \@error);
if ($sub_func_rst) {
probe_utils->send_msg("stdout", "f", "Failed to obtain install NIC in current server");
probe_utils->send_msg("stdout", "f", "Obtain install NIC in current server");
probe_utils->send_msg("stdout", "d", "$_") foreach (@error);
} else {
probe_utils->send_msg("stdout", "i", "The install NIC in current server is $installnic");
@@ -248,7 +251,7 @@ sub obtain_install_nic {
return 1;
}
$$installnic_ref = `ip addr |grep -B2 $master_ip_in_site|awk -F" " '/mtu/{gsub(/:/,"",\$2); print \$2}'`;
$$installnic_ref = `ip -4 -o a|awk -F"\\\\" '/$master_ip_in_site/ {print \$1}' |awk -F" " '{print \$NF}'`;
chomp($$installnic_ref);
if (!$$installnic_ref) {
push @$return_error_ref, "The value of 'master' in 'site' table is $master_ip_in_site, can't get corresponding network interface in current server";
+108
View File
@@ -0,0 +1,108 @@
#!/usr/bin/perl
## IBM(c) 2107 EPL license http://www.eclipse.org/legal/epl-v10.html
package xCAT::Goconserver;
BEGIN
{
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
}
use lib "$::XCATROOT/lib/perl";
use strict;
use warnings "all";
use HTTP::Request;
use HTTP::Headers;
use LWP;
use JSON;
use IO::Socket::SSL qw( SSL_VERIFY_PEER );
sub http_request {
my ($method, $url, $data) = @_;
my @user = getpwuid($>);
my $homedir = $user[7];
my $rsp;
my $brower = LWP::UserAgent->new( ssl_opts => {
SSL_key_file => xCAT::Utils->getHomeDir() . "/.xcat/client-cred.pem",
SSL_cert_file => xCAT::Utils->getHomeDir() . "/.xcat/client-cred.pem",
SSL_ca_file => xCAT::Utils->getHomeDir() . "/.xcat/ca.pem",
SSL_use_cert => 1,
SSL_verify_mode => SSL_VERIFY_PEER, }, );
my $header = HTTP::Headers->new('Content-Type' => 'application/json');
# $data = encode_json $data if defined($data);
$data = JSON->new->encode($data) if defined($data);
my $request = HTTP::Request->new( $method, $url, $header, $data );
my $response = $brower->request($request);
if (!$response->is_success()) {
xCAT::MsgUtils->message("S", "Failed to send request to $url, rc=".$response->status_line());
return undef;
}
my $content = $response->content();
if ($content) {
return decode_json $content;
}
return "";
}
sub delete_nodes {
my ($api_url, $node_map, $delmode, $callback) = @_;
my $url = "$api_url/bulk/nodes";
my @a = ();
my ($data, $rsp, $ret);
$data->{nodes} = \@a;
foreach my $node (keys %{$node_map}) {
my $temp;
$temp->{name} = $node;
push @a, $temp;
}
$ret = 0;
my $response = http_request("DELETE", $url, $data);
if (!defined($response)) {
$rsp->{data}->[0] = "Failed to send delete request.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
} elsif ($delmode) {
while (my ($k, $v) = each %{$response}) {
if ($v ne "Deleted") {
$rsp->{data}->[0] = "$k: Failed to delete entry in goconserver: $v";
xCAT::MsgUtils->message("E", $rsp, $callback);
$ret = 1;
} else {
$rsp->{data}->[0] = "$k: $v";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
return $ret;
}
sub create_nodes {
my ($api_url, $node_map, $callback) = @_;
my $url = "$api_url/bulk/nodes";
my ($data, $rsp, @a, $ret);
$data->{nodes} = \@a;
while (my ($k, $v) = each %{$node_map}) {
push @a, $v;
}
$ret = 0;
my $response = http_request("POST", $url, $data);
if (!defined($response)) {
$rsp->{data}->[0] = "Failed to send create request.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
} elsif ($response) {
while (my ($k, $v) = each %{$response}) {
if ($v ne "Created") {
$rsp->{data}->[0] = "$k: Failed to create console entry in goconserver: $v";
xCAT::MsgUtils->message("E", $rsp, $::callback);
$ret = 1;
} else {
$rsp->{data}->[0] = "$k: $v";
xCAT::MsgUtils->message("I", $rsp, $::callback);
}
}
}
return $ret;
}
1;
+37 -4
View File
@@ -413,8 +413,29 @@ sub makescript {
$noderesent = $::GLOBAL_TAB_HASH{noderes}{$node};
}
unless ($master) {
#the ip address of the mn facing the compute node
my @ipfnd = xCAT::NetworkUtils->my_ip_facing($node);
my $ipfndscalar = @ipfnd;
unless ($ipfnd[0]) {
$master = $ipfnd[1];
if ($ipfndscalar > 2) {
foreach my $ipinfnd (@ipfnd) {
if ($::XCATSITEVALS{master} and $ipinfnd eq $::XCATSITEVALS{master}) {
$master = $ipinfnd;
last;
}
}
}
if ($master) {
$::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster} = $master;
}
}
}
if (!defined($master)) {
$::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster} = $::XCATSITEVALS{master};
$master = $::XCATSITEVALS{master};
}
#get the node type, service node or compute node
@@ -1535,10 +1556,22 @@ sub collect_all_attribs_for_tables_in_template
$::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster} eq ""))
{
my $value = undef;
my @valued = xCAT::NetworkUtils->my_ip_facing($node);
unless ($valued[0]) { $value = $valued[1]; }
$::GLOBAL_TAB_HASH{$tabname}{$node}{$attrib} = $value;
my @ipfnd = xCAT::NetworkUtils->my_ip_facing($node);
my $ipfndscalar = @ipfnd;
unless ($ipfnd[0]) {
$value = $ipfnd[1];
if ($ipfndscalar > 2) {
foreach my $ipinfnd (@ipfnd) {
if ($::XCATSITEVALS{master} and $ipinfnd eq $::XCATSITEVALS{master}) {
$value = $ipinfnd;
last;
}
}
}
}
if ($value) {
$::GLOBAL_TAB_HASH{$tabname}{$node}{$attrib} = $value;
}
}
# for nodetype.os and nodetype.arch
+1 -1
View File
@@ -192,7 +192,7 @@ sub validate {
$status = "Denied";
$rc = 0;
}
if (($request->{command}->[0] ne "getdestiny") && ($request->{command}->[0] ne "getbladecons") && ($request->{command}->[0] ne "getipmicons")) {
if (($request->{command}->[0] ne "getdestiny") && ($request->{command}->[0] ne "getbladecons") && ($request->{command}->[0] ne "getipmicons") && ($request->{command}->[0] ne "getopenbmccons")) {
# set username authenticated to run command
# if from Trusted host, use input username, else set from creds
@@ -704,9 +704,7 @@ sub setNodeStatusAttributes {
$updates{'status'} = $_;
$updates{'statustime'} = $currtime;
my $nodestate = "@$nodes status: $updates{'status'} statustime: $updates{'statustime'}";
openlog('xcat', 'ndelay', 'local4');
syslog('local4|info', '%s', $nodestate);
closelog();
xCAT::MsgUtils->message('S', "$nodestate");
my $where_clause;
my $dbname = xCAT::Utils->get_DBName();
+8 -2
View File
@@ -488,8 +488,14 @@ sub setup_CONS
{
my ($nodename) = @_;
my $rc = 0;
my $cmd;
if (-x "/usr/bin/goconserver") {
my $cmd = "ps axf | grep -v grep | grep \/usr\/bin\/goconserver";
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC == 0) {
xCAT::MsgUtils->message("S", "INFO: goconserver was started, do nothing for conserver.");
return 0;
}
}
my $cmdref;
$cmdref->{command}->[0] = "makeconservercf";
$cmdref->{arg}->[0] = "-l";
@@ -4417,6 +4417,12 @@ sub defrm
node => [@allnodes],
arg => ['offline'],
}, $doreq, 0 ,1);
# Run makeconservercf -d <node>
@output = xCAT::Utils->runxcmd({
command => ['makeconservercf'],
node => [@allnodes],
arg => ['-d'],}, $doreq, 0, 1);
}
}
+34 -43
View File
@@ -549,17 +549,39 @@ sub mknetboot
$xcatmaster = '!myipfn!'; #allow service nodes to dynamically nominate themselves as a good contact point, this is of limited use in the event that xcat is not the dhcp/tftp server
}
if ($ient and $ient->{tftpserver} and $ient->{tftpserver} ne '<xcatmaster>') {
if ($ient and $ient->{nfsserver} and $ient->{nfsserver} ne '<xcatmaster>') {
$imgsrv = $ient->{nfsserver};
}elsif ($ient and $ient->{tftpserver} and $ient->{tftpserver} ne '<xcatmaster>') {
$imgsrv = $ient->{tftpserver};
} else {
$ient = $reshash->{$node}->[0];
$imgsrv = $xcatmaster;
}
unless ($imgsrv) {
xCAT::MsgUtils->report_node_error($callback, $node, "Unable to determine or reasonably guess the image server for $node");
next;
}
my $imgsrvip;
unless($imgsrv eq '!myipfn!' or xCAT::NetworkUtils->validate_ip($imgsrv)==0){
# if imgsrv is hostname, convert it to ip address
# the host name might not be resolved inside initrd
$imgsrvip = xCAT::NetworkUtils->getipaddr($imgsrv);
}
unless($imgsrvip){
$imgsrvip=$imgsrv;
}
my $xcatmasterip;
if (xCAT::NetworkUtils->validate_ip($xcatmaster)) {
# if xcatmaster is hostname, convert it to ip address
# the host name might not be resolved inside initrd
$xcatmasterip = xCAT::NetworkUtils->getipaddr($xcatmaster);
}
unless($xcatmasterip){
$xcatmasterip=$xcatmaster
}
# Start to build kcmdline
my $kcmdline;
@@ -570,11 +592,8 @@ sub mknetboot
# get entry for nfs root if it exists:
# have to get nfssvr and nfsdir from noderes table
my $nfssrv = $imgsrv;
my $nfssrv = $imgsrvip;
my $nfsdir = $rootimgdir;
if ($ient->{nfsserver}) {
$nfssrv = $ient->{nfsserver};
}
if ($ient->{nfsdir} ne '') {
$nfsdir = $ient->{nfsdir} . "/netboot/$osver/$arch/$profile";
@@ -597,9 +616,9 @@ sub mknetboot
}
} else {
if (-r "$rootimgdir/rootimg-statelite.gz.metainfo") {
$kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg-statelite.gz.metainfo STATEMNT=";
$kcmdline = "imgurl=$httpmethod://$imgsrvip:$httpport/$rootimgdir/rootimg-statelite.gz.metainfo STATEMNT=";
} else {
$kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg-statelite.gz STATEMNT=";
$kcmdline = "imgurl=$httpmethod://$imgsrvip:$httpport/$rootimgdir/rootimg-statelite.gz STATEMNT=";
}
}
@@ -626,21 +645,6 @@ sub mknetboot
}
}
$kcmdline .= $statemnt . " ";
my $xcatmasterip;
# if xcatmaster is hostname, convert it to ip address
if (xCAT::NetworkUtils->validate_ip($xcatmaster)) {
# Using XCAT=<hostname> will cause problems rc.statelite.ppc.redhat
# when trying to run chroot command
$xcatmasterip = xCAT::NetworkUtils->getipaddr($xcatmaster);
if (!$xcatmasterip)
{
$xcatmasterip = $xcatmaster;
}
} else {
$xcatmasterip = $xcatmaster;
}
$kcmdline .= "XCAT=$xcatmasterip:$xcatdport ";
@@ -669,11 +673,11 @@ sub mknetboot
}
else {
if (-r "$rootimgdir/$compressedrootimg.metainfo") {
$kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/$compressedrootimg.metainfo ";
$kcmdline = "imgurl=$httpmethod://$imgsrvip:$httpport/$rootimgdir/$compressedrootimg.metainfo ";
} else {
$kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/$compressedrootimg ";
$kcmdline = "imgurl=$httpmethod://$imgsrvip:$httpport/$rootimgdir/$compressedrootimg ";
}
$kcmdline .= "XCAT=$xcatmaster:$xcatdport ";
$kcmdline .= "XCAT=$xcatmasterip:$xcatdport ";
$kcmdline .= "NODE=$node ";
# add flow control setting
@@ -686,23 +690,10 @@ sub mknetboot
}
if (($::XCATSITEVALS{xcatdebugmode} eq "1") or ($::XCATSITEVALS{xcatdebugmode} eq "2")) {
my ($host, $ipaddr) = xCAT::NetworkUtils->gethostnameandip($xcatmaster);
if ($ipaddr) {
#for use in postscript and postbootscript in xcatdsklspost in the rootimg
$kcmdline .= " LOGSERVER=$ipaddr ";
#for use in syslog dracut module in the initrd
$kcmdline .= " syslog.server=$ipaddr syslog.type=rsyslogd syslog.filter=*.* ";
}
else {
#for use in postscript and postbootscript in xcatdsklspost in the rootimg
$kcmdline .= " LOGSERVER=$xcatmaster ";
#for use in syslog dracut module in the initrd
$kcmdline .= " syslog.server=$xcatmaster syslog.type=rsyslogd syslog.filter=*.* ";
}
#for use in postscript and postbootscript in xcatdsklspost in the rootimg
$kcmdline .= " LOGSERVER=$xcatmasterip ";
#for use in syslog dracut module in the initrd
$kcmdline .= " syslog.server=$xcatmasterip syslog.type=rsyslogd syslog.filter=*.* ";
$kcmdline .= " xcatdebugmode=$::XCATSITEVALS{xcatdebugmode} ";
}
+4
View File
@@ -4579,6 +4579,10 @@ sub process_request {
$req->{noderange} = [$node];
$req->{discoverymethod} = ['blade'];
$doreq->($req);
if (defined($req->{error})) {
$request->{error}->[0] = '1';
$request->{error_msg}->[0] = $req->{error_msg}->[0];
}
%{$req} = (); #Clear request. it is done
return 0;
}
+50 -25
View File
@@ -50,6 +50,8 @@ my $openbmc_pass;
$::P9_WITHERSPOON_MFG_ID = "42817";
$::P9_WITHERSPOON_PRODUCT_ID = "16975";
my %node_in_list = ();
#-------------------------------------------------------
=head3 handled_commands
@@ -106,6 +108,14 @@ sub preprocess_request {
push @requests, $reqcopy;
}
return \@requests;
} elsif (grep /--check/, @ARGV) {
$callback->({ error => ["The option '--check' is not supported"], errorcode=>[1]});
$request = ();
return;
} elsif (grep /--ipsource/, @ARGV) {
$callback->({ error => ["The option '--ipsource' is not supported"], errorcode=>[1]});
$request = ();
return;
} else {
return [$request];
}
@@ -186,12 +196,6 @@ sub bmcdiscovery_usage {
push @{ $rsp->{data} }, "\tbmcdiscover [-v|--version]";
push @{ $rsp->{data} }, "\tbmcdiscover [--sn <SN_nodename>] [-s scan_method] [-u bmc_user] [-p bmc_passwd] [-z] [-w] --range ip_range\n";
push @{ $rsp->{data} }, "\tCheck BMC administrator User/Password:\n";
push @{ $rsp->{data} }, "\t\tbmcdiscover -u bmc_user -p bmc_password -i bmc_ip --check\n";
push @{ $rsp->{data} }, "\tDisplay the BMC IP configuration:\n";
push @{ $rsp->{data} }, "\t\tbmcdiscover [-u bmc_user] [-p bmc_passwd] -i bmc_ip --ipsource";
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
return 0;
}
@@ -619,6 +623,17 @@ sub scan_process {
$ipmac{$_} = $new_mac;
}
my $nodelisttab;
if ($nodelisttab = xCAT::Table->new("nodelist")) {
my @nodes_in_list = $nodelisttab->getAllAttribs("node");
foreach my $node (@nodes_in_list) {
$node_in_list{$node->{node}} = 1;
}
} else {
xCAT::MsgUtils->message("E", " Could not read the nodelist table\n");
return 1;
}
###############################
# Set the signal handler for ^c
###############################
@@ -677,17 +692,14 @@ sub scan_process {
my @mc_cmds = ("/opt/xcat/bin/ipmitool-xcat -I lanplus -H ${$live_ip}[$i] -P $openbmc_pass mc info -N 1 -R 1",
"/opt/xcat/bin/ipmitool-xcat -I lanplus -H ${$live_ip}[$i] $bmcusername $bmcpassword mc info -N 1 -R 1");
my $mc_info;
my $flag;
foreach my $mc_cmd (@mc_cmds) {
$mc_info = xCAT::Utils->runcmd($mc_cmd, -1);
if ($mc_info =~ /Manufacturer ID\s*:\s*(\d+)\s*Manufacturer Name.+\s*Product ID\s*:\s*(\d+)/) {
if ($1 eq $::P9_WITHERSPOON_MFG_ID and $2 eq $::P9_WITHERSPOON_PRODUCT_ID) {
bmcdiscovery_openbmc(${$live_ip}[$i], $opz, $opw, $request_command);
$flag = 1;
last;
} else {
bmcdiscovery_ipmi(${$live_ip}[$i], $opz, $opw, $request_command);
$flag = 1;
last;
}
}
@@ -1009,7 +1021,6 @@ sub bmcdiscovery_ipmi {
my $opz = shift;
my $opw = shift;
my $request_command = shift;
my $node = sprintf("node-%08x", unpack("N*", inet_aton($ip)));
my $bmcstr = "BMC Session ID";
my $bmcusername = '';
my $bmcpassword = '';
@@ -1020,6 +1031,9 @@ sub bmcdiscovery_ipmi {
$bmcpassword = "-P $bmc_pass";
}
my $mtms_node = "";
my $mac_node = "";
my $node_data = $ip;
my $icmd = "/opt/xcat/bin/ipmitool-xcat -vv -I lanplus $bmcusername $bmcpassword -H $ip chassis status ";
my $output = xCAT::Utils->runcmd("$icmd", -1);
@@ -1086,11 +1100,12 @@ sub bmcdiscovery_ipmi {
}
$node_data .= ",mp,bmc,$::opt_SN,$::opt_SN";
if ($mtm and $serial) {
$node = "node-$mtm-$serial";
$node =~ s/(.*)/\L$1/g;
$node =~ s/[\s:\._]/-/g;
} else {
$node = "node-$ipmac{$ip}";
$mtms_node = "node-$mtm-$serial";
$mtms_node =~ s/(.*)/\L$1/g;
$mtms_node =~ s/[\s:\._]/-/g;
}
if ($ipmac{$ip}) {
$mac_node = "node-$ipmac{$ip}";
}
} elsif ($output =~ /error : unauthorized name/) {
xCAT::MsgUtils->message("W", { data => ["BMC username is incorrect for $ip"] }, $::CALLBACK);
@@ -1100,7 +1115,7 @@ sub bmcdiscovery_ipmi {
return;
}
display_output($opz,$opw,$node,$node_data,"ipmi",$request_command);
display_output($opz,$opw,$mtms_node,$mac_node,$node_data,"ipmi",$request_command);
}
}
@@ -1121,7 +1136,8 @@ sub bmcdiscovery_openbmc{
my $opz = shift;
my $opw = shift;
my $request_command = shift;
my $node = sprintf("node-%08x", unpack("N*", inet_aton($ip)));
my $mtms_node = "";
my $mac_node = "";
print "$ip: Detected openbmc, attempting to obtain system information...\n";
my $http_protocol="https";
@@ -1197,21 +1213,22 @@ sub bmcdiscovery_openbmc{
}
$node_data .= ",mp,bmc,$::opt_SN,$::opt_SN";
if ($mtm and $serial) {
$node = "node-$mtm-$serial";
$node =~ s/(.*)/\L$1/g;
$node =~ s/[\s:\._]/-/g;
} else {
$node = "node-$ipmac{$ip}";
$mtms_node = "node-$mtm-$serial";
$mtms_node =~ s/(.*)/\L$1/g;
$mtms_node =~ s/[\s:\._]/-/g;
}
if ($ipmac{$ip}) {
$mac_node = "node-$ipmac{$ip}";
}
} else {
if ($login_response->status_line =~ /401 Unauthorized/) {
xCAT::MsgUtils->message("W", { data => ["Invalid username or password for $ip"] }, $::CALLBACK);
} else {
xCAT::MsgUtils->message("W", { data => ["$login_response->status_line for $ip"] }, $::CALLBACK);
xCAT::MsgUtils->message("W", { data => ["Received response " . $login_response->status_line . " for $ip"] }, $::CALLBACK);
}
return;
}
display_output($opz,$opw,$node,$node_data,"openbmc",$request_command);
display_output($opz,$opw,$mtms_node,$mac_node,$node_data,"openbmc",$request_command);
}
@@ -1227,11 +1244,19 @@ sub bmcdiscovery_openbmc{
sub display_output {
my $opz = shift;
my $opw = shift;
my $node = shift;
my $mtms_node = shift;
my $mac_node = shift;
my $node_data = shift;
my $mgttype = shift;
my $request_command = shift;
my $node;
if (($node_in_list{$mac_node} and !$node_in_list{$mtms_node}) or (!$node_in_list{$mac_node} and !$mtms_node)) {
$node = $mac_node;
} else {
$node = $mtms_node;
}
if (defined($opw)) {
my $rsp = {};
push @{ $rsp->{data} }, "Writing $node ($node_data) to database...";
+80 -3
View File
@@ -8,6 +8,7 @@ use xCAT::TableUtils;
use Getopt::Long;
use Sys::Hostname;
use xCAT::SvrUtils;
use xCAT::Scope;
use strict;
use Data::Dumper;
@@ -28,6 +29,7 @@ my $usage_string =
The default goes down to all the conservers on
the server nodes and set them up
-d|--delete Conserver has the relevant entries for the given noderange removed immediately from configuration
-C|--cleanup To remove the entries for the nodes that do not exist in xCAT db
-t|--trust Add additional trusted hosts.
-h|--help Display this usage statement.
-V|--verbose Verbose mode.
@@ -71,6 +73,7 @@ sub preprocess_request {
'l|local' => \$::LOCAL,
'h|help' => \$::HELP,
'D|debug' => \$::DEBUG,
'C|cleanup' => \$::CLEANUP,
'v|version' => \$::VERSION,
'V|verbose' => \$::VERBOSE)) {
$request = {};
@@ -98,8 +101,25 @@ sub preprocess_request {
$request = {};
return;
}
if ($::CLEANUP && ($::CONSERVER or $::LOCAL)) {
$callback->({ data => "Can not specify -l|--local or -c|--conserver together with -C|--cleanup." });
$request = {};
return;
}
# The cleanup shall run on both MN and all SNs
if ($::CLEANUP) {
if ($noderange && @$noderange > 0) {
$callback->({ data => "Can not specify noderange together with -C|--cleanup." });
$request = {};
return;
}
my @sns = xCAT::ServiceNodeUtils->getSNList();
unless ( @sns > 0 ) {
return xCAT::Scope->get_parallel_scope($request);
}
return xCAT::Scope->get_broadcast_scope_with_parallel($request, \@sns);
}
# get site master
my $master = xCAT::TableUtils->get_site_Master();
if (!$master) { $master = hostname(); }
@@ -182,6 +202,15 @@ sub process_request {
my $req = shift;
my $cb = shift;
if ($req->{command}->[0] eq "makeconservercf") {
if (-x "/usr/bin/goconserver") {
my $cmd = "ps axf | grep -v grep | grep \/usr\/bin\/goconserver";
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC == 0) {
my $rsp->{data}->[0] = "goconserver is started, please stop it at first.";
xCAT::MsgUtils->message("E", $rsp, $cb);
return;
}
}
makeconservercf($req, $cb);
}
}
@@ -326,7 +355,8 @@ sub makeconservercf {
#$Getopt::Long::pass_through=1;
my $delmode;
GetOptions('d|delete' => \$delmode,
't|trust=s' => \$::TRUSTED_HOST
't|trust=s' => \$::TRUSTED_HOST,
'C|cleanup' => \$::CLEANUP,
);
my $nodes = $req->{node};
my $svboot = 0;
@@ -400,6 +430,18 @@ sub makeconservercf {
#$cb->({node=>[{name=>$node,error=>"Bad configuration, check attributes under the nodehm category",errorcode=>1}]});
xCAT::SvrUtils::sendmsg([ 1, "Bad configuration, check attributes under the nodehm category" ], $cb, $node);
}
} elsif ($::CLEANUP) {
my $nodelstab = xCAT::Table->new('nodelist');
my @allnodeset = $nodelstab->getAllAttribs('node');
my %allnodehash = map { $_->{node} => 1 } @allnodeset;
my $rmnodes = delete_undefined_nodes_entry(\@filecontent, \%allnodehash);
my $rsp;
if (!defined($rmnodes)) {
$rsp->{data}->[0] = "Nothing removed";
} else{
$rsp->{data}->[0] = "Remove console entry for the nodes:".join(',', @$rmnodes);
}
xCAT::MsgUtils->message("I", $rsp, $cb);
} else { #no nodes specified, do em all up
zapcfg(\@filecontent); # strip all xCAT configured nodes from config
@@ -599,6 +641,41 @@ sub donodeent {
}
return 0;
}
# Remove cons entries for the undefined nodes
sub delete_undefined_nodes_entry {
my $content = shift;
my $allnodeshash = shift;
my $idx = 0;
my $toidx = -1;
my $skip = 0;
my $skipnext = 0;
my @rmnodes = ();
while ($idx <= $#$content) {
if ($content->[$idx] =~ /^#xCAT BEGIN (\S+) CONS/) {
$toidx = $idx;
my $node = $1;
unless (exists($allnodeshash->{$node})) {
$skip = 1;
$skipnext = 1;
push @rmnodes, $node;
print __LINE__."===== push node: $node==\n";
}
} elsif ($content->[$idx] =~ /^#xCAT END/) {
$skipnext = 0;
}
if ($skip) {
splice(@$content, $idx, 1);
} else {
$idx++;
}
$skip = $skipnext;
}
if (scalar(@rmnodes) > 0) {
return \@rmnodes;
} else {
return undef;
}
}
# Delete any xcat added node entries from the file
sub zapcfg {
@@ -321,6 +321,7 @@ sub process_request
open($tmpfile, $tfilename);
@filecontent = <$tmpfile>;
close($tmpfile);
$filecontent[$#filecontent] =~ s/\n?$/\n/;
$retdata = "\n" . join('', @filecontent);
push @{ $rsp->{'data'} }, { content => [$retdata], desc => [$parm] };
$retdata = "";
+14 -1
View File
@@ -1223,8 +1223,8 @@ sub update_namedconf {
}
unless ($gotoptions) {
push @newnamed, "options {\n";
push @newnamed, "\tdirectory \"" . $ctx->{zonesdir} . "\";\n";
unless ($slave && xCAT::Utils->isLinux()) {
push @newnamed, "\tdirectory \"" . $ctx->{zonesdir} . "\";\n";
push @newnamed, "\tallow-recursion { any; };\n";
}
@@ -1274,6 +1274,19 @@ sub update_namedconf {
push @newnamed, "};\n\n";
}
# include external configuration file(s) if present in site.namedincludes
my @entries = xCAT::TableUtils->get_site_attribute("namedincludes");
my $site_entry = $entries[0];
if (defined($site_entry)) {
my @includes = split /[ ,]/, $site_entry;
foreach (@includes) {
if (defined($_)) {
push @newnamed, "include \"$_\";\n";
}
}
push @newnamed, "\n";
}
unless ($slave) {
unless ($gotkey) {
unless ($ctx->{privkey}) { #need to generate one
+6 -29
View File
@@ -1267,44 +1267,24 @@ sub mknetboot
my $xcatmaster;
$ient = $reshash->{$node}->[0]; #$restab->getNodeAttribs($node, ['tftpserver']);
if ($ient and $ient->{xcatmaster})
{
if ($ient and $ient->{xcatmaster}) {
$xcatmaster = $ient->{xcatmaster};
} else {
$xcatmaster = '!myipfn!'; #allow service nodes to dynamically nominate themselves as a good contact point, this is of limited use in the event that xcat is not the dhcp/tftp server
}
if ($ient and $ient->{tftpserver})
{
if ($ient and $ient->{nfsserver} and $ient->{nfsserver} ne '<xcatmaster>') {
$imgsrv = $ient->{nfsserver};
}elsif ($ient and $ient->{tftpserver} and $ient->{tftpserver} ne '<xcatmaster>') {
$imgsrv = $ient->{tftpserver};
}
else
{
$ient = $reshash->{$node}->[0]; #$restab->getNodeAttribs($node, ['xcatmaster']);
#if ($ient and $ient->{xcatmaster})
#{
# $imgsrv = $ient->{xcatmaster};
#}
#else
#{
# master not correct for service node pools
#$ient = $sitetab->getAttribs({key => master}, value);
#if ($ient and $ient->{value})
#{
# $imgsrv = $ient->{value};
#}
#else
#{
# $imgsrv = '!myipfn!';
#}
#}
} else {
$imgsrv = $xcatmaster;
}
unless ($imgsrv) {
xCAT::MsgUtils->report_node_error($callback, $node, "Unable to determine or reasonably guess the image server for $node");
next;
}
my $kcmdline;
if ($statelite) {
if (rootfstype ne "ramdisk") {
@@ -1313,9 +1293,6 @@ sub mknetboot
# have to get nfssvr and nfsdir from noderes table
my $nfssrv = $imgsrv;
my $nfsdir = $rootimgdir;
if ($ient->{nfsserver}) {
$nfssrv = $ient->{nfsserver};
}
if ($ient->{nfsdir} ne '') {
$nfsdir = $ient->{nfsdir} . "/netboot/$osver/$arch/$profile";
+55 -54
View File
@@ -747,6 +747,7 @@ sub addnode
print $omshell "new host\n";
print $omshell "set name = \"$hostname\"\n";
print $omshell "set hardware-address = " . $mac . "\n";
print $omshell "set dhcp-client-identifier = " . $mac . "\n";
print $omshell "set hardware-type = $hardwaretype\n";
if ($ip eq "DENIED")
@@ -978,48 +979,6 @@ sub check_options
return 0;
}
# if not help and not -n, dhcpd needs to be running
if (!($opt->{h}) && (!($opt->{n}))) {
if (xCAT::Utils->isLinux()) {
#my $DHCPSERVER="dhcpd";
#if( -e "/etc/init.d/isc-dhcp-server" ){
# $DHCPSERVER="isc-dhcp-server";
#}
#my @output = xCAT::Utils->runcmd("service $DHCPSERVER status", -1);
#if ($::RUNCMD_RC != 0) { # not running
my $ret = 0;
$ret = xCAT::Utils->checkservicestatus("dhcp");
if ($ret != 0)
{
my $rsp = {};
$rsp->{data}->[0] = "dhcp server is not running. please start the dhcp server.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return 1;
}
} else { # AIX
my @output = xCAT::Utils->runcmd("lssrc -s dhcpsd ", -1);
if ($::RUNCMD_RC != 0) { # not running
my $rsp = {};
$rsp->{data}->[0] = "dhcpsd is not running. Run startsrc -s dhcpsd and rerun your command.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return 1;
} else { # check the status
# the return output varies, sometime status is the third sometimes the 4th col
if (grep /inoperative/, @output)
{
my $rsp = {};
$rsp->{data}->[0] = "dhcpsd is not running. Run startsrc -s dhcpsd and rerun your command.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return 1;
}
}
}
}
# check to see if -q is listed with any other options which is not allowed
if ($opt->{q} and ($opt->{a} || $opt->{d} || $opt->{n} || $opt->{r} || $opt->{l} || $statements)) {
my $rsp = {};
@@ -1132,9 +1091,11 @@ sub preprocess_request
xCAT::MsgUtils->trace($verbose_on_off, "d", "dhcp: dhcp server on $_->{net}: $_->{dhcpserver}");
}
}
} elsif ($snonly == 1) {
$snonly = 0;
xCAT::MsgUtils->trace($verbose_on_off, "d", "dhcp: disjointdhcps mode is disabled as no service nodes are running dhcp service.");
}
my @nodes = ();
# if the new option is not specified
@@ -1381,17 +1342,6 @@ sub process_request
return [];
}
# if option is query then call listnode for each node and return
if ($opt{q})
{
# call listnode for each node requested
foreach my $node (@{ $req->{node} }) {
listnode($node, $callback);
}
return;
}
# if current node is a servicenode, make sure that it is also a dhcpserver
my $isok = 1;
if (xCAT::Utils->isServiceNode()) {
@@ -1413,6 +1363,57 @@ sub process_request
return;
}
# if not -n, dhcpd needs to be running
if (!($opt{n})) {
if (xCAT::Utils->isLinux()) {
#my $DHCPSERVER="dhcpd";
#if( -e "/etc/init.d/isc-dhcp-server" ){
# $DHCPSERVER="isc-dhcp-server";
#}
#my @output = xCAT::Utils->runcmd("service $DHCPSERVER status", -1);
#if ($::RUNCMD_RC != 0) { # not running
my $ret = 0;
$ret = xCAT::Utils->checkservicestatus("dhcp");
if ($ret != 0)
{
my $rsp = {};
$rsp->{data}->[0] = "dhcp server is not running. please start the dhcp server.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return;
}
} else { # AIX
my @output = xCAT::Utils->runcmd("lssrc -s dhcpsd ", -1);
if ($::RUNCMD_RC != 0) { # not running
my $rsp = {};
$rsp->{data}->[0] = "dhcpsd is not running. Run startsrc -s dhcpsd and rerun your command.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return;
} else { # check the status
# the return output varies, sometime status is the third sometimes the 4th col
if (grep /inoperative/, @output)
{
my $rsp = {};
$rsp->{data}->[0] = "dhcpsd is not running. Run startsrc -s dhcpsd and rerun your command.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return;
}
}
}
}
# if option is query then call listnode for each node and return
if ($opt{q})
{
# call listnode for each node requested
foreach my $node (@{ $req->{node} }) {
listnode($node, $callback);
}
return;
}
my $servicenodetab = xCAT::Table->new('servicenode');
my @nodeinfo = xCAT::NetworkUtils->determinehostname;
my $nodename = pop @nodeinfo; # get hostname
+422
View File
@@ -0,0 +1,422 @@
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
#TODO: delete entries not being refreshed if no noderange
package xCAT_plugin::goconserver;
BEGIN {
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
}
use lib "$::XCATROOT/lib/perl";
use strict;
use xCAT::Table;
use xCAT::Utils;
use xCAT::TableUtils;
use Getopt::Long;
use Sys::Hostname;
use xCAT::SvrUtils;
use xCAT::Goconserver;
use Data::Dumper;
my $isSN;
my $host;
my $go_api_port = 12429;
my $go_cons_port = 12430;
my $bmc_cons_port = "2200";
my $usage_string =" makegocons [-V|--verbose] [-d|--delete] noderange
-h|--help Display this usage statement.
-v|--version Display the version number.";
my $version_string = xCAT::Utils->Version();
sub handled_commands {
return {
makegocons => "goconserver"
}
}
sub preprocess_request {
my $request = shift;
if ($request->{_xcatpreprocessed}->[0] == 1) { return [$request]; }
$::callback = shift;
my @requests;
my $noderange = $request->{node}; #Should be arrayref
#display usage statement if -h
my $extrargs = $request->{arg};
my @exargs = ($request->{arg});
if (ref($extrargs)) {
@exargs = @$extrargs;
}
@ARGV = @exargs;
$isSN = xCAT::Utils->isServiceNode();
my @hostinfo = xCAT::NetworkUtils->determinehostname();
my %iphash = ();
foreach (@hostinfo) { $iphash{$_} = 1; }
$Getopt::Long::ignorecase = 0;
#$Getopt::Long::pass_through=1;
if (!GetOptions(
'c|conserver' => \$::CONSERVER,
'l|local' => \$::LOCAL,
'h|help' => \$::HELP,
'D|debug' => \$::DEBUG,
'v|version' => \$::VERSION,
'V|verbose' => \$::VERBOSE)) {
$request = {};
return;
}
if ($::HELP) {
$::callback->({ data => $usage_string });
$request = {};
return;
}
if ($::VERSION) {
$::callback->({ data => $version_string });
$request = {};
return;
}
if ($::LOCAL) {
if ($noderange && @$noderange > 0) {
$::callback->({ data => "Invalid option -l or --local when there are nodes specified." });
$request = {};
return;
}
}
if ($::CONSERVER && $::LOCAL) {
$::callback->({ data => "Can not specify -l or --local together with -c or --conserver." });
$request = {};
return;
}
# get site master
my $master = xCAT::TableUtils->get_site_Master();
if (!$master) { $master = hostname(); }
# get conserver for each node
my %cons_hash = ();
my $hmtab = xCAT::Table->new('nodehm');
my @items;
my $allnodes = 1;
if ($noderange && @$noderange > 0) {
$allnodes = 0;
my $hmcache = $hmtab->getNodesAttribs($noderange, [ 'node', 'serialport', 'cons', 'conserver' ]);
foreach my $node (@$noderange) {
my $ent = $hmcache->{$node}->[0]; #$hmtab->getNodeAttribs($node,['node', 'serialport','cons', 'conserver']);
push @items, $ent;
}
} else {
$allnodes = 1;
@items = $hmtab->getAllNodeAttribs([ 'node', 'serialport', 'cons', 'conserver' ]);
}
my @nodes = ();
foreach (@items) {
if (((!defined($_->{cons})) || ($_->{cons} eq "")) and !defined($_->{serialport})) {
my $rsp->{data}->[0] = $_->{node} .": ignore, cons attribute or serialport attribute is not specified.";
xCAT::MsgUtils->message("I", $rsp, $::callback);
next;
}
if (defined($_->{conserver})) { push @{ $cons_hash{ $_->{conserver} }{nodes} }, $_->{node}; }
else { push @{ $cons_hash{$master}{nodes} }, $_->{node}; }
push @nodes, $_->{node};
}
#send all nodes to the MN
if (!$isSN && !$::CONSERVER) { #If -c flag is set, do not add the all nodes to the management node
if ($::VERBOSE) {
my $rsp;
$rsp->{data}->[0] = "Setting the nodes into goconserver on the management node";
xCAT::MsgUtils->message("I", $rsp, $::callback);
}
my $reqcopy = {%$request};
$reqcopy->{'_xcatdest'} = $master;
$reqcopy->{_xcatpreprocessed}->[0] = 1;
$reqcopy->{'_allnodes'} = $allnodes; # the original command comes with nodes or not
if ($allnodes == 1) { @nodes = (); }
$reqcopy->{node} = \@nodes;
push @requests, $reqcopy;
if ($::LOCAL) { return \@requests; }
}
# send to conserver hosts
foreach my $cons (keys %cons_hash) {
#print "cons=$cons\n";
my $doit = 0;
if ($isSN) {
if (exists($iphash{$cons})) { $doit = 1; }
} else {
if (!exists($iphash{$cons}) || $::CONSERVER) { $doit = 1; }
}
if ($doit) {
my $reqcopy = {%$request};
$reqcopy->{'_xcatdest'} = $cons;
$reqcopy->{_xcatpreprocessed}->[0] = 1;
$reqcopy->{'_allnodes'} = [$allnodes]; # the original command comes with nodes or not
$reqcopy->{node} = $cons_hash{$cons}{nodes};
push @requests, $reqcopy;
} #end if
} #end foreach
if ($::DEBUG) {
my $rsp;
$rsp->{data}->[0] = "In preprocess_request, request is " . Dumper(@requests);
xCAT::MsgUtils->message("I", $rsp, $::callback);
}
return \@requests;
}
sub process_request {
my $req = shift;
$::callback = shift;
my @hostinfo = xCAT::NetworkUtils->determinehostname();
$host = $hostinfo[-1];
$isSN = xCAT::Utils->isServiceNode();
if ($req->{command}->[0] eq "makegocons") {
makegocons($req, \@hostinfo);
}
}
sub get_cons_map {
my ($req, $iphashref) = @_;
my %cons_map;
my %iphash = %{$iphashref};
my $hmtab = xCAT::Table->new('nodehm');
my @cons_nodes;
if (($req->{node} and @{$req->{node}} > 0) or $req->{noderange}->[0]) {
# Note: do not consider terminal server currently
@cons_nodes = $hmtab->getNodesAttribs($req->{node}, [ 'node', 'cons', 'serialport', 'mgt', 'conserver', 'consoleondemand' ]);
# Adjust the data structure to make the result consistent with the getAllNodeAttribs() call we make if a noderange was not specified
my @tmpcons_nodes;
foreach my $ent (@cons_nodes)
{
foreach my $nodeent (keys %$ent)
{
push @tmpcons_nodes, $ent->{$nodeent}->[0];
}
}
@cons_nodes = @tmpcons_nodes
} else {
@cons_nodes = $hmtab->getAllNodeAttribs([ 'cons', 'serialport', 'mgt', 'conserver', 'consoleondemand' ]);
}
$hmtab->close();
my $rsp;
foreach (@cons_nodes) {
if ($_->{cons} or defined($_->{'serialport'})) {
unless ($_->{cons}) { $_->{cons} = $_->{mgt}; } #populate with fallback
if ($isSN && $_->{conserver} && exists($iphash{ $_->{conserver} }) || !$isSN) {
$cons_map{ $_->{node} } = $_; # also put the ref to the entry in a hash for quick look up
} else {
$rsp->{data}->[0] = $_->{node} .": ignore, the host for conserver could not be determined.";
xCAT::MsgUtils->message("I", $rsp, $::callback);
}
} else {
$rsp->{data}->[0] = $_->{node} .": ignore, cons attribute or serialport attribute is not specified.";
xCAT::MsgUtils->message("I", $rsp, $::callback);
}
}
return %cons_map;
}
sub gen_request_data {
my ($cons_map, $siteondemand) = @_;
my (@openbmc_nodes, $data);
while (my ($k, $v) = each %{$cons_map}) {
my $ondemand;
if ($siteondemand) {
$ondemand = \1;
} else {
$ondemand = \0;
}
my $cmd;
my $cmeth = $v->{cons};
if ($cmeth eq "openbmc") {
push @openbmc_nodes, $k;
} else {
$cmd = $::XCATROOT . "/share/xcat/cons/$cmeth"." ".$k;
if (!(!$isSN && $v->{conserver} && xCAT::NetworkUtils->thishostisnot($v->{conserver}))) {
my $env;
my $locerror = $isSN ? "PERL_BADLANG=0 " : '';
if (defined($ENV{'XCATSSLVER'})) {
$env = "XCATSSLVER=$ENV{'XCATSSLVER'} ";
}
$cmd = $locerror.$env.$cmd;
}
$data->{$k}->{driver} = "cmd";
$data->{$k}->{params}->{cmd} = $cmd;
$data->{$k}->{name} = $k;
}
if (defined($v->{consoleondemand})) {
# consoleondemand attribute for node can be "1", "yes", "0" and "no"
if (($v->{consoleondemand} eq "1") || lc($v->{consoleondemand}) eq "yes") {
$ondemand = \1;
}
elsif (($v->{consoleondemand} eq "0") || lc($v->{consoleondemand}) eq "no") {
$ondemand = \0;
}
}
$data->{$k}->{ondemand} = $ondemand;
}
if (@openbmc_nodes) {
my $passwd_table = xCAT::Table->new('passwd');
my $passwd_hash = $passwd_table->getAttribs({ 'key' => 'openbmc' }, qw(username password));
$passwd_table->close();
my $openbmc_table = xCAT::Table->new('openbmc');
my $openbmc_hash = $openbmc_table->getNodesAttribs(\@openbmc_nodes, ['bmc','consport', 'username', 'password']);
$openbmc_table->close();
foreach my $node (@openbmc_nodes) {
if (defined($openbmc_hash->{$node}->[0])) {
if (!$openbmc_hash->{$node}->[0]->{'bmc'}) {
xCAT::SvrUtils::sendmsg("Error: Unable to get attribute bmc", $::callback, $node);
delete $data->{$node};
next;
}
$data->{$node}->{params}->{host} = $openbmc_hash->{$node}->[0]->{'bmc'};
if ($openbmc_hash->{$node}->[0]->{'username'}) {
$data->{$node}->{params}->{user} = $openbmc_hash->{$node}->[0]->{'username'};
} elsif ($passwd_hash and $passwd_hash->{username}) {
$data->{$node}->{params}->{user} = $passwd_hash->{username};
} else {
xCAT::SvrUtils::sendmsg("Error: Unable to get attribute username", $::callback, $node);
delete $data->{$node};
next;
}
if ($openbmc_hash->{$node}->[0]->{'password'}) {
$data->{$node}->{params}->{password} = $openbmc_hash->{$node}->[0]->{'password'};
} elsif ($passwd_hash and $passwd_hash->{password}) {
$data->{$node}->{params}->{password} = $passwd_hash->{password};
} else {
xCAT::SvrUtils::sendmsg("Error: Unable to get attribute password", $::callback, $node);
delete $data->{$node};
next;
}
if ($openbmc_hash->{$node}->[0]->{'consport'}) {
$data->{$node}->{params}->{consport} = $openbmc_hash->{$node}->[0]->{'consport'};
} else {
$data->{$node}->{params}->{port} = $bmc_cons_port;
}
$data->{$node}->{name} = $node;
$data->{$node}->{driver} = "ssh";
}
}
}
return $data;
}
sub start_goconserver {
my $rsp;
unless (-x "/usr/bin/goconserver") {
$rsp->{data}->[0] = "goconserver is not installed.";
xCAT::MsgUtils->message("E", $rsp, $::callback);
return 1;
}
# As conserver is always installed, we check the existence of goconserver at first.
# if goconserver is installed, check the status of conserver service.
my $cmd = "ps axf | grep -v grep | grep \/usr\/sbin\/conserver";
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC == 0) {
$rsp->{data}->[0] = "conserver is started, please stop it at first.";
xCAT::MsgUtils->message("E", $rsp, $::callback);
return 1;
}
$cmd = "ps axf | grep -v grep | grep \/usr\/bin\/goconserver";
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0) {
my $config= "global:\n".
" host: 0.0.0.0\n".
" ssl_key_file: /etc/xcat/cert/server-key.pem\n".
" ssl_cert_file: /etc/xcat/cert/server-cert.pem\n".
" ssl_ca_cert_file: /etc/xcat/cert/ca.pem\n".
" logfile: /var/log/goconserver/server.log\n".
"api:\n".
" port: $go_api_port\n".
"console:\n".
" port: $go_cons_port\n";
my $file;
my $ret = open ($file, '>', '/etc/goconserver/server.conf');
if ($ret == 0) {
$rsp->{data}->[0] = "Could not open file /etc/goconserver/server.conf.";
xCAT::MsgUtils->message("E", $rsp, $::callback);
return 1;
}
print $file $config;
close $file;
my $cmd = "service goconserver start";
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0) {
$rsp->{data}->[0] = "Could not start goconserver service.";
xCAT::MsgUtils->message("E", $rsp, $::callback);
return 1;
}
sleep(3);
}
return 0;
}
sub makegocons {
my $req = shift;
my $hostinfo = shift;
my $extrargs = $req->{arg};
my @exargs = ($req->{arg});
if (ref($extrargs)) {
@exargs = @$extrargs;
}
@ARGV = @exargs;
$Getopt::Long::ignorecase = 0;
my $delmode;
GetOptions('d|delete' => \$delmode,
);
my $svboot = 0;
if (exists($req->{svboot})) {
$svboot = 1;
}
my %iphash = ();
foreach (@$hostinfo) { $iphash{$_} = 1; }
my %cons_map = get_cons_map($req, \%iphash);
if (! %cons_map) {
xCAT::SvrUtils::sendmsg([ 1, "Could not get any console request entry" ], $::callback);
return 1;
}
my $ret = start_goconserver();
if ($ret != 0) {
return 1;
}
my @entries = xCAT::TableUtils->get_site_attribute("consoleondemand");
my $site_entry = $entries[0];
my $siteondemand = 0;
if (defined($site_entry)) {
if (lc($site_entry) eq "yes") {
$siteondemand = 1;
}
elsif (lc($site_entry) ne "no") {
# consoleondemand attribute is set, but it is not "yes" or "no"
xCAT::SvrUtils::sendmsg([ 1, "Unexpected value $site_entry for consoleondemand attribute in site table" ], $::callback);
}
}
my (@nodes);
my $data = gen_request_data(\%cons_map, $siteondemand);
if (! $data) {
xCAT::SvrUtils::sendmsg([ 1, "Could not generate the request data" ], $::callback);
return 1;
}
my $api_url = "https://$host:$go_api_port";
$ret = xCAT::Goconserver::delete_nodes($api_url, $data, $delmode, $::callback);
if ($delmode) {
return $ret;
}
$ret = xCAT::Goconserver::create_nodes($api_url, $data, $::callback);
if ($ret != 0) {
xCAT::SvrUtils::sendmsg([ 1, "Failed to create console entry in goconserver. "], $::callback);
return $ret;
}
return 0;
}
1;
+4
View File
@@ -771,6 +771,10 @@ sub process_request {
my $req = {%$request};
$req->{command} = ['discovered'];
$req->{noderange} = [ $macmap{$mac} ];
if (defined($req->{error})) {
$request->{error}->[0] = '1';
$request->{error_msg}->[0] = $req->{error_msg}->[0];
}
$doreq->($req);
%{$req} = (); #Clear request. it is done
#undef $mactab;
+7 -2
View File
@@ -527,7 +527,7 @@ sub on_bmc_connect {
return;
}
if ($command eq "rpower") {
unless (defined $sessdata->{device_id}) { #need get device id data initted for S3 support
unless ($sessdata->{subcommand} eq "reseat" or defined $sessdata->{device_id}) { #need get device id data initted for S3 support
$sessdata->{ipmisession}->subcmd(netfn => 6, command => 1, data => [], callback => \&gotdevid, callback_args => $sessdata);
return;
}
@@ -8993,13 +8993,18 @@ sub donode {
$sessiondata{$node} = {
node => $node, #this seems redundant, but some code will not be privy to what the key was
bmcnum => $bmcnum,
ipmisession => xCAT::IPMI->new(bmc => $bmcip, userid => $user, password => $pass),
#ipmisession => xCAT::IPMI->new(bmc => $bmcip, userid => $user, password => $pass),
command => $command,
extraargs => \@exargs,
subcommand => $exargs[0],
xcatdebugmode => $xcatdebugmode,
outfunc => $callback,
};
if ($command eq "rpower" and $exargs[0] eq "reseat") {
on_bmc_connect(0, $sessiondata{$node});
return 0;
}
$sessiondata{$node}->{ipmisession} = xCAT::IPMI->new(bmc => $bmcip, userid => $user, password => $pass);
if ($sessiondata{$node}->{ipmisession}->{error}) {
xCAT::SvrUtils::sendmsg([ 1, $sessiondata{$node}->{ipmisession}->{error} ], $callback, $node, %allerrornodes);
} else {
+1 -1
View File
@@ -140,7 +140,7 @@ sub process_request {
my $rc;
my $invisibletouch = 0;
if (-e "$::XCATROOT/share/xcat/netboot/genesis/$arch") {
$rc = system("cp -a $::XCATROOT/share/xcat/netboot/genesis/$arch/fs/* $tempdir");
$rc = system("shopt -s dotglob; GLOBIGNORE=\".:..\" cp -a $::XCATROOT/share/xcat/netboot/genesis/$arch/fs/* $tempdir");
$rc = system("cp -a $::XCATROOT/share/xcat/netboot/genesis/$arch/kernel $tftpdir/xcat/genesis.kernel.$arch");
$invisibletouch = 1;
} else {
+14 -6
View File
@@ -182,9 +182,7 @@ sub process_request {
$basicdata->{memory} = $request->{memory}->[0];
}
if ($request->{disksize}->[0]) {
my @disks = split /\n/, $request->{disksize}->[0];
my $disk_info = join(",", @disks);
$basicdata->{disksize} = $disk_info;
$basicdata->{disksize} = $request->{disksize}->[0];
}
if ($request->{cpucount}->[0]) {
$basicdata->{cpucount} = $request->{cpucount}->[0];
@@ -267,6 +265,12 @@ sub process_request {
my $macstring = "";
if (defined($request->{mac})) {
if (!inet_aton($node)) {
xCAT::MsgUtils->message("S", "xcat.discovery.nodediscover: Can not resolve IP for the matching node:$node. Make sure \"makehosts\" and \"makedns\" have been run for $node.");
$request->{error} = [0];
$request->{error_msg} = ["Can not resolve IP for the matching node:$node."];
return;
}
my $mactab = xCAT::Table->new("mac", -create => 1);
my @ifinfo;
my %usednames;
@@ -274,6 +278,7 @@ sub process_request {
my @hostnames_to_update = ();
my %bydriverindex;
my $forcenic = 0; #-1 is force skip, 0 is use default behavior, 1 is force to be declared even if hosttag is skipped to do so
my $localnic = 0;
foreach (@{ $request->{mac} }) {
@ifinfo = split /\|/;
@@ -320,9 +325,6 @@ sub process_request {
$hosttag = "$node-$ifinfo[1]";
push @hostnames_to_update, $hosttag;
}
elsif (!inet_aton($node)) {
xCAT::MsgUtils->message("S", "xcat.discovery.nodediscover: Can not resolve IP for the matching node:$node. Make sure \"makehosts\" and \"makedns\" have been run for $node.");
}
}
#print Dumper($hosttag) . "\n";
if ($hosttag) {
@@ -332,6 +334,7 @@ sub process_request {
}
if ($hosttag eq $node) {
$macstring .= $currmac . "|";
$localnic = 1;
} else {
$macstring .= $currmac . "!" . $hosttag . "|";
}
@@ -349,6 +352,11 @@ sub process_request {
if ($forcenic == 1) { $macstring .= $currmac . "|"; }
}
}
unless ($localnic) {
$request->{error} = [1];
$request->{error_msg} = ["No nic found in deploy network for $node"];
return;
}
$macstring =~ s/\|\z//;
$mactab->setNodeAttribs($node, { mac => $macstring });
if (scalar @hostnames_to_update) {
File diff suppressed because it is too large Load Diff
@@ -629,6 +629,7 @@ sub copybootscript {
copy("$installroot/postscripts/xcatdsklspost", "$rootimg_dir/opt/xcat/xcatdsklspost");
if ($timezone[0]) {
unlink("$rootimg_dir/etc/localtime");
copy("$rootimg_dir/usr/share/zoneinfo/$timezone[0]", "$rootimg_dir/etc/localtime");
}
+449 -34
View File
@@ -71,6 +71,41 @@ sub handled_commands
};
}
sub pdu_usage
{
my ($callback, $command) = @_;
my $usagemsg =
"Usage:
pdudiscover [<noderange>|--range ipranges] [-r|-x|-z] [-w] [-V|--verbose] [--setup]
rpower pdunodes [off|on|stat|reset]
The following command supports IR PDU with pdutype=irpdu :
rpower CN [pduoff|pduon|pdustat|pdustatus|pdureset]
The following commands support CR PDU with pdutype=crpdu :
rpower pdunodes relay=[1|2|3] [on|off]
rinv pdunodes
rvitals pdunodes
rspconfig pdunodes sshcfg
rspconfig pdunodes snmpcfg
rspconfig pdunode [hostname=<NAME>|ip=<IP>|mask=<MASK>]
\n";
if ($callback)
{
my $rsp = {};
$rsp->{data}->[0] = $usagemsg;
xCAT::MsgUtils->message("I", $rsp, $callback);
}
else
{
xCAT::MsgUtils->message("I", $usagemsg);
}
return;
}
#--------------------------------------------------------------------------------
=head3 preprocess_request
@@ -94,15 +129,12 @@ sub preprocess_request {
my $usage_string=xCAT::Usage->parseCommand($command, @exargs);
if ($usage_string) {
$callback->({data=>[$usage_string]});
$req = {};
return;
&pdu_usage($callback, $command);
return 1;
}
if ((!$noderange) && ($command ne "pdudiscover") ){
$usage_string = xCAT::Usage->getUsage($command);
$callback->({ data => $usage_string });
$req = {};
&pdu_usage($callback, $command);
return;
}
@@ -137,11 +169,6 @@ sub process_request
@exargs = @$extrargs;
}
#fill in the total outlet count for each pdu
$pdutab = xCAT::Table->new('pdu');
@pduents = $pdutab->getAllNodeAttribs(['node', 'outlet']);
#fill_outletCount(\@pduents, $callback);
if( $command eq "rinv") {
#for higher performance, handle node in batch
return showMFR($noderange, $callback);
@@ -149,6 +176,7 @@ sub process_request
return showMonitorData($noderange, $callback);
}elsif ($command eq "rpower") {
my $subcmd = $exargs[0];
my $subcmd2 = $exargs[1];
if (($subcmd eq 'pduoff') || ($subcmd eq 'pduon') || ($subcmd eq 'pdustat')|| ($subcmd eq 'pdureset') ){
#if one day, pdu node have pdu attribute, handle in this section too
return powerpduoutlet($noderange, $subcmd, $callback);
@@ -169,11 +197,14 @@ sub process_request
}
}
if(@allpdunodes) {
if(($subcmd eq 'on') || ($subcmd eq 'off') || ($subcmd eq 'stat') || ($subcmd eq 'state') || ($subcmd eq 'reset') ){
if ( ($subcmd =~ /relay/) || ($subcmd2 =~ /relay/) ) {
process_powerrelay($request,$subreq,\@allpdunodes,$callback);
} elsif(($subcmd eq 'on') || ($subcmd eq 'off') || ($subcmd eq 'stat') || ($subcmd eq 'state') || ($subcmd eq 'reset') ){
return powerpdu(\@allpdunodes, $subcmd, $callback);
} else {
my $pdunode = join (",", @allpdunodes);
$callback->({ errorcode => [1],error => "The option $subcmd is not support for pdu node(s) $pdunode."});
&pdu_usage($callback, $command);
}
}
}
@@ -181,15 +212,19 @@ sub process_request
my $subcmd = $exargs[0];
if ($subcmd eq 'sshcfg') {
process_sshcfg($noderange, $subcmd, $callback);
}elsif ($subcmd eq 'snmpcfg') {
process_snmpcfg($noderange, $subcmd, $callback);
}elsif ($subcmd =~ /ip|netmask|hostname/) {
process_netcfg($request, $subreq, $subcmd, $callback);
} else {
$callback->({ errorcode => [1],error => "The input $command $subcmd is not support for pdu"});
&pdu_usage($callback, $command);
}
}elsif($command eq "pdudiscover") {
process_pdudiscover($request, $subreq, $callback);
}elsif($command eq "nodeset") {
$callback->({ errorcode => [1],error => "The input $command is not support for pdu"});
&pdu_usage($callback, $command);
}else{
#reserve for other new command in future
}
@@ -197,29 +232,30 @@ sub process_request
return;
}
#-------------------------------------------------------
=head3 fill_outletcount
Get outlet count for IR PDU.
=cut
#-------------------------------------------------------
sub fill_outletCount {
my $pduentries = shift;
my $session = shift;
my $pdu = shift;
my $callback = shift;
my $outletoid = ".1.3.6.1.4.1.2.6.223.8.2.1.0";
my $pdutab = xCAT::Table->new('pdu');
foreach my $pdu (@$pduentries) {
my $cur_pdu = $pdu->{node};
my $count = $pdu->{outlet};
#get total outlet number for the pdu
if (!$count) {
my $session = connectTopdu($cur_pdu,$callback);
#will not log this error to output
if (!$session) {
next;
}
$count = $session->get("$outletoid");
if ($count) {
$pdutab->setNodeAttribs($cur_pdu, {outlet => $count});
}
}
$pdunodes->{$cur_pdu}->{outlet}=$count;
my $count = $session->get("$outletoid");
if ($count) {
$pdutab->setNodeAttribs($pdu, {outlet => $count});
}
return $count;
}
#-------------------------------------------------------
@@ -240,13 +276,25 @@ sub powerpdu {
return powerstat($noderange, $callback);
}
my $pdutab = xCAT::Table->new('pdu');
my $pduhash = $pdutab->getNodesAttribs($noderange, ['pdutype','outlet']);
foreach my $node (@$noderange) {
if ($pduhash->{$node}->[0]->{pdutype} eq 'crpdu') {
process_relay($node,$subcmd,$callback,1,3);
next;
}
my $session = connectTopdu($node,$callback);
if (!$session) {
$callback->({ errorcode => [1],error => "Couldn't connect to $node"});
next;
}
my $count = $pdunodes->{$node}->{outlet};
my $count = $pduhash->{$node}->[0]->{outlet};
unless ($count) {
$count = fill_outletCount($session, $node, $callback);
}
my $value;
my $statstr;
if ($subcmd eq "off") {
@@ -295,6 +343,9 @@ sub powerpduoutlet {
my $nodetab = xCAT::Table->new('pduoutlet');
my $nodepdu = $nodetab->getNodesAttribs($noderange,['pdu']);
my $pdutab = xCAT::Table->new('pdu');
my $pduhash = $pdutab->getNodesAttribs($noderange, ['pdutype','outlet']);
foreach my $node (@$noderange) {
# the pdu attribute needs to be set
if(! $nodepdu->{$node}->[0]->{pdu}){
@@ -305,12 +356,20 @@ sub powerpduoutlet {
my @pdus = split /,/, $nodepdu->{$node}->[0]->{pdu};
foreach my $pdu_outlet (@pdus) {
my ($pdu, $outlet) = split /:/, $pdu_outlet;
if ($pduhash->{$pdu}->[0]->{pdutype} eq 'crpdu') {
$callback->({ error => "$node: This command doesn't supports CONSTELLATION PDU with pdutype=crpdu for $pdu"});
next;
}
my $session = connectTopdu($pdu,$callback);
if (!$session) {
$callback->({ errorcode => [1],error => "$node: Couldn't connect to $pdu"});
next;
}
if ($outlet > $pdunodes->{$pdu}->{outlet} ) {
my $count = $pduhash->{$pdu}->[0]->{outlet};
unless ($count) {
$count = fill_outletCount($session, $pdu, $callback);
}
if ($outlet > $count ) {
$callback->({ error => "$node: $pdu outlet number $outlet is invalid"});
next;
}
@@ -382,13 +441,60 @@ sub powerstat {
my $callback = shift;
my $output;
my $pdutab = xCAT::Table->new('pdu');
my $pduhash = $pdutab->getNodesAttribs($noderange, ['pdutype','outlet','snmpversion','snmpuser','authtype','authkey','privtype','privkey','seclevel']);
foreach my $pdu (@$noderange) {
if ($pduhash->{$pdu}->[0]->{pdutype} eq 'crpdu') {
my $snmpversion = $pduhash->{$pdu}->[0]->{snmpversion};
if ($snmpversion =~ /3/) {
my $snmpuser = $pduhash->{$pdu}->[0]->{snmpuser};
my $seclevel = $pduhash->{$pdu}->[0]->{seclevel};
if ((defined $snmpuser) && (defined $seclevel)) {
my $authtype = $pduhash->{$pdu}->[0]->{authtype};
if (!defined $authtype) {
$authtype="MD5";
}
my $authkey = $pduhash->{$pdu}->[0]->{authkey};
my $privtype = $pduhash->{$pdu}->[0]->{privtype};
if (!defined $privtype) {
$privtype="DES";
}
my $privkey = $pduhash->{$pdu}->[0]->{privkey};
if (!defined $privkey) {
if (defined $authkey) {
$privkey=$authkey;
}
}
my $snmpcmd;
if ($seclevel eq "authNoPriv") {
$snmpcmd = "snmpwalk -v3 -u $snmpuser -a $authtype -A $authkey -l $seclevel";
} elsif ($seclevel eq "authPriv") {
$snmpcmd = "snmpwalk -v3 -u $snmpuser -a $authtype -A $authkey -l $seclevel -x $privtype -X $privkey";
} else { #default to notAuthNoPriv
$snmpcmd = "snmpwalk -v3 -u $snmpuser -l $seclevel";
}
for (my $relay = 1; $relay <= 3; $relay++) {
relaystat($pdu, $relay, $snmpcmd, $callback);
}
next;
}
}
xCAT::SvrUtils::sendmsg("please config snmpv3 to be able to query pdu relay status", $callback,$pdu);
xCAT::SvrUtils::sendmsg(" use chdef command to add pdu snmpv3 attributes to pdu table", $callback);
xCAT::SvrUtils::sendmsg(" then run 'rspconfig $pdu snmpcfg' command ", $callback);
next;
}
my $session = connectTopdu($pdu,$callback);
if (!$session) {
$callback->({ errorcode => [1],error => "Couldn't connect to $pdu"});
next;
}
my $count = $pdunodes->{$pdu}->{outlet};
my $count = $pduhash->{$pdu}->[0]->{outlet};
unless ($count) {
$count = fill_outletCount($session, $pdu, $callback);
}
for (my $outlet =1; $outlet <= $count; $outlet++)
{
my $statstr = outletstat($session, $outlet);
@@ -518,6 +624,13 @@ sub process_netcfg {
my $pdu = @$nodes[0];
my $rsp = {};
my $pdutab = xCAT::Table->new('pdu');
my $pduhash = $pdutab->getNodesAttribs($nodes, ['pdutype']);
unless ($pduhash->{$pdu}->[0]->{pdutype} eq "crpdu") {
xCAT::SvrUtils::sendmsg("This command only supports CONSTELLATION PDU with pdutype=crpdu", $callback,$pdu);
return;
}
my $nodetab = xCAT::Table->new('hosts');
my $nodehash = $nodetab->getNodesAttribs($nodes,['ip','otherinterfaces']);
@@ -526,7 +639,7 @@ sub process_netcfg {
my $discover_ip = $nodehash->{$pdu}->[0]->{otherinterfaces};
($exp, $errstr) = session_connect($static_ip, $discover_ip);
if (defined $errstr) {
xCAT::SvrUtils::sendmsg("Failed to connect", $callback);
xCAT::SvrUtils::sendmsg("Failed to connect", $callback,$pdu);
return;
}
@@ -603,8 +716,16 @@ sub process_sshcfg {
my $nodetab = xCAT::Table->new('hosts');
my $nodehash = $nodetab->getNodesAttribs($noderange,['ip','otherinterfaces']);
my $pdutab = xCAT::Table->new('pdu');
my $pduhash = $pdutab->getNodesAttribs($noderange, ['pdutype']);
foreach my $pdu (@$noderange) {
unless ($pduhash->{$pdu}->[0]->{pdutype} eq "crpdu") {
xCAT::SvrUtils::sendmsg("This command only supports CONSTELLATION PDU with pdutype=crpdu", $callback,$pdu);
next;
}
my $msg = " process_sshcfg";
xCAT::SvrUtils::sendmsg($msg, $callback, $pdu, %allerrornodes);
@@ -635,6 +756,15 @@ sub process_sshcfg {
return;
}
#-------------------------------------------------------
=head3 session_connect
open a expect session and connect to CR PDU.
=cut
#-------------------------------------------------------
sub session_connect {
my $static_ip = shift;
my $discover_ip = shift;
@@ -682,7 +812,15 @@ sub session_connect {
return ($ssh);
}
#-------------------------------------------------------
=head3 session_exec
execute command to CR PDU.
=cut
#-------------------------------------------------------
sub session_exec {
my $exp = shift;
my $cmd = shift;
@@ -765,11 +903,20 @@ sub process_pdudiscover {
sub showMFR {
my $noderange = shift;
my $callback = shift;
my $output;
my $nodetab = xCAT::Table->new('hosts');
my $nodehash = $nodetab->getNodesAttribs($noderange,['ip','otherinterfaces']);
my $pdutab = xCAT::Table->new('pdu');
my $pduhash = $pdutab->getNodesAttribs($noderange, ['pdutype']);
foreach my $pdu (@$noderange) {
unless ($pduhash->{$pdu}->[0]->{pdutype} eq "crpdu") {
xCAT::SvrUtils::sendmsg("This command only supports CONSTELLATION PDU with pdutype=crpdu", $callback,$pdu);
next;
}
# connect to PDU
my $static_ip = $nodehash->{$pdu}->[0]->{ip};
my $discover_ip = $nodehash->{$pdu}->[0]->{otherinterfaces};
@@ -814,11 +961,20 @@ sub showMFR {
sub showMonitorData {
my $noderange = shift;
my $callback = shift;
my $output;
my $nodetab = xCAT::Table->new('hosts');
my $nodehash = $nodetab->getNodesAttribs($noderange,['ip','otherinterfaces']);
my $pdutab = xCAT::Table->new('pdu');
my $pduhash = $pdutab->getNodesAttribs($noderange, ['pdutype']);
foreach my $pdu (@$noderange) {
unless ($pduhash->{$pdu}->[0]->{pdutype} eq "crpdu") {
xCAT::SvrUtils::sendmsg("This command only supports CONSTELLATION PDU with pdutype=crpdu", $callback,$pdu);
next;
}
# connect to PDU
my $static_ip = $nodehash->{$pdu}->[0]->{ip};
my $discover_ip = $nodehash->{$pdu}->[0]->{otherinterfaces};
@@ -844,5 +1000,264 @@ sub showMonitorData {
}
}
#-------------------------------------------------------
=head3 relaystat
process individual relay stat for CR PDU.
The OID for 3 relay:
1.3.6.1.4.1.2.6.262.15.2.13
1.3.6.1.4.1.2.6.262.15.2.14
1.3.6.1.4.1.2.6.262.15.2.15
=cut
#-------------------------------------------------------
sub relaystat {
my $pdu = shift;
my $relay = shift;
my $snmpcmd = shift;
my $callback = shift;
my $relayoid = $relay + 12;
#default pdu snmpv3, won't show up for snmpv1
my $cmd = "$snmpcmd $pdu 1.3.6.1.4.1.2.6.262.15.2.$relayoid";
my $result = xCAT::Utils->runcmd($cmd, 0);
my ($msg,$stat) = split /: /, $result;
if ($stat eq "1" ) {
xCAT::SvrUtils::sendmsg(" relay $relay is on", $callback, $pdu, %allerrornodes);
} elsif ( $stat eq "0" ) {
xCAT::SvrUtils::sendmsg(" relay $relay is off", $callback, $pdu, %allerrornodes);
} else {
xCAT::SvrUtils::sendmsg(" relay $relay is unknown", $callback, $pdu, %allerrornodes);
}
return;
}
#-------------------------------------------------------
=head3 process_powerrelay
process relay action for CR PDU.
=cut
#-------------------------------------------------------
sub process_powerrelay {
my $request = shift;
my $subreq = shift;
my $subcmd = shift;
my $callback = shift;
my $relay;
my $action;
my $extrargs = $request->{arg};
my @exargs = ($request->{arg});
if (ref($extrargs)) {
@exargs = @$extrargs;
}
my $nodes = $request->{node};
foreach my $cmd (@exargs) {
if ($cmd =~ /=/ ) {
my ($key, $value) = split(/=/, $cmd);
$relay = $value;
} else {
$action = $cmd;
}
}
if ( (defined $relay) && (defined $action) ) {
my $relay_count = 1;
foreach my $pdu (@$nodes) {
process_relay($pdu, $action, $callback, $relay, $relay_count);
}
} else {
xCAT::SvrUtils::sendmsg(" This command is not support, please define relay number and action", $callback);
}
}
#-------------------------------------------------------
=head3 process_relay
process relay action for CR PDU.
=cut
#-------------------------------------------------------
sub process_relay {
my $pdu = shift;
my $subcmd = shift;
my $callback = shift;
my $relay_num = shift;
my $relay_count = shift;
if ( !defined $relay_count ) {
$relay_num = 1;
$relay_count = 3;
}
my $nodetab = xCAT::Table->new('hosts');
my $nodehash = $nodetab->getNodeAttribs($pdu,['ip','otherinterfaces']);
# connect to PDU
my $static_ip = $nodehash->{$pdu}->[0]->{ip};
my $discover_ip = $nodehash->{$pdu}->[0]->{otherinterfaces};
my ($session, $errstr) = session_connect($static_ip, $discover_ip);
my $ret;
my $err;
my $statestr;
for (my $i = 0; $i < $relay_count; $i++) {
my $relay = $relay_num;
xCAT::SvrUtils::sendmsg(" power $subcmd for relay $relay_num", $callback,$pdu);
if ($subcmd eq "off") {
relay_action($session, $pdu, $relay, "OFF", $callback);
} elsif ( $subcmd eq "on") {
relay_action($session, $pdu, $relay, "ON", $callback);
} elsif ( $subcmd eq "reset") {
relay_action($session, $pdu, $relay, "OFF", $callback);
relay_action($session, $pdu, $relay, "ON", $callback);
} else {
xCAT::SvrUtils::sendmsg(" subcmd $subcmd is not support", $callback,$pdu);
}
$relay_num++;
}
$session->hard_close();
}
#-------------------------------------------------------
=head3 realy_action
process individual relay action for CR PDU.
=cut
#-------------------------------------------------------
sub relay_action {
my $session = shift;
my $pdu = shift;
my $relay = shift;
my $action = shift;
my $callback = shift;
my ($ret, $err) = session_exec($session, "/dev/shm/bin/PduManager -r $relay -v $action");
if (defined $err) {
xCAT::SvrUtils::sendmsg("Failed to process relay action: $err", $callback);
}
if (defined $ret) {
xCAT::SvrUtils::sendmsg("$ret", $callback,$pdu);
}
}
#-------------------------------------------------------
=head3 process_snmpcfg
config snmp and snmpv3 for CR PDU.
=cut
#-------------------------------------------------------
sub process_snmpcfg {
my $noderange = shift;
my $subcmd = shift;
my $callback = shift;
my $snmp_conf="/etc/snmp/snmpd.conf";
my $xCATSettingsSTART="xCAT settings START";
my $xCATSettingsEND="xCAT settings END";
my $xCATSettingsInfo="Entries between the START and END lines will be replaced each time by xCAT command";
my $nodetab = xCAT::Table->new('hosts');
my $nodehash = $nodetab->getNodesAttribs($noderange,['ip','otherinterfaces']);
my $pdutab = xCAT::Table->new('pdu');
my $pduhash = $pdutab->getNodesAttribs($noderange, ['pdutype','community','snmpversion','snmpuser','authtype','authkey','privtype','privkey','seclevel']);
foreach my $pdu (@$noderange) {
unless ($pduhash->{$pdu}->[0]->{pdutype} eq "crpdu") {
xCAT::SvrUtils::sendmsg("This command only supports CONSTELLATION PDU with pdutype=crpdu", $callback,$pdu);
next;
}
my $community = $pduhash->{$pdu}->[0]->{community};
my $snmpversion = $pduhash->{$pdu}->[0]->{snmpversion};
my $snmpuser = $pduhash->{$pdu}->[0]->{snmpuser};
my $authtype = $pduhash->{$pdu}->[0]->{authtype};
if (!defined $authtype) {
$authtype="MD5";
}
my $authkey = $pduhash->{$pdu}->[0]->{authkey};
my $privtype = $pduhash->{$pdu}->[0]->{privtype};
if (!defined $privtype) {
$privtype="DES";
}
my $privkey = $pduhash->{$pdu}->[0]->{privkey};
if (!defined $privkey) {
if (defined $authkey) {
$privkey=$authkey;
}
}
my $seclevel = $pduhash->{$pdu}->[0]->{seclevel};
# connect to PDU
my $static_ip = $nodehash->{$pdu}->[0]->{ip};
my $discover_ip = $nodehash->{$pdu}->[0]->{otherinterfaces};
my ($exp, $errstr) = session_connect($static_ip, $discover_ip);
my $ret;
my $err;
($ret, $err) = session_exec($exp, "sed -i '/$xCATSettingsSTART/,/$xCATSettingsEND/ d' $snmp_conf");
($ret, $err) = session_exec($exp, "echo '# $xCATSettingsSTART' >> $snmp_conf");
($ret, $err) = session_exec($exp, "echo '# $xCATSettingsInfo' >> $snmp_conf");
if (defined $community) {
($ret, $err) = session_exec($exp, "echo 'com2sec readwrite default $community' >> $snmp_conf");
}
#set snmpv3 configuration
if ($snmpversion =~ /3/) {
if ((defined $snmpuser) && (defined $seclevel)) {
my $msg1;
if ($seclevel eq "authNoPriv") {
$msg1 = "createUser $snmpuser $authtype $authkey";
} elsif ($seclevel eq "authPriv") {
$msg1 = "createUser $snmpuser $authtype $authkey $privtype $privkey";
} else { #default to notAuthNoPriv
$msg1 = "createUser $snmpuser";
}
my $msg2 = "rwuser $snmpuser $seclevel .1.3.6.1.4.1.2.6.262";
($ret, $err) = session_exec($exp, "sed -i '/\"$snmpuser\"/ d' /var/lib/net-snmp/snmpd.conf");
($ret, $err) = session_exec($exp, "echo $msg1 >> $snmp_conf");
($ret, $err) = session_exec($exp, "echo $msg2 >> $snmp_conf");
} else {
xCAT::SvrUtils::sendmsg("Need to define user name and security level for snmpv3 configuration", $callback);
}
}
($ret, $err) = session_exec($exp, "echo '# $xCATSettingsEND' >> $snmp_conf");
#need to restart snmpd after config file changes
($ret, $err) = session_exec($exp, "ps | grep snmpd | grep -v grep | awk '{ print $1}' | xargs kill -9");
($ret, $err) = session_exec($exp, "/usr/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd");
if (defined $err) {
xCAT::SvrUtils::sendmsg("Failed to configure snmp : $err", $callback);
}
$exp->hard_close();
}
}
1;
+3 -3
View File
@@ -94,8 +94,8 @@ sub setstate {
if ($kern->{kernel} !~ /^$tftpdir/) {
my $nodereshash = $nrhash{$node}->[0];
my $installsrv;
if ($nodereshash and $nodereshash->{nfsserver}) {
$installsrv = $nodereshash->{nfsserver};
if ($nodereshash and $nodereshash->{tftpserver}) {
$installsrv = $nodereshash->{tftpserver};
} elsif ($nodereshash->{xcatmaster}) {
$installsrv = $nodereshash->{xcatmaster};
} else {
@@ -574,7 +574,7 @@ sub process_request {
my $chaintab = xCAT::Table->new('chain', -create => 1);
my $chainhash = $chaintab->getNodesAttribs(\@nodes, ['currstate']);
my $noderestab = xCAT::Table->new('noderes', -create => 1);
my $nodereshash = $noderestab->getNodesAttribs(\@nodes, [ 'tftpdir', 'xcatmaster', 'nfsserver', 'servicenode' ]);
my $nodereshash = $noderestab->getNodesAttribs(\@nodes, [ 'tftpdir', 'xcatmaster', 'tftpserver', 'servicenode' ]);
my $typetab = xCAT::Table->new('nodetype', -create => 1);
my $typehash = $typetab->getNodesAttribs(\@nodes, [ 'os', 'provmethod', 'arch', 'profile' ]);
my $linuximgtab = xCAT::Table->new('linuximage', -create => 1);
+6 -1
View File
@@ -398,10 +398,15 @@ sub findme {
my $req = {%$request};
$req->{command} = ['discovered'];
$req->{noderange} = [$node];
$request->{bmc_node} = [$bmc_node];
$req->{bmc_node} = [$bmc_node];
$req->{updateswitch} = ['yes'];
$subreq->($req);
if (defined($req->{error})) {
$request->{error}->[0] = '1';
$request->{error_msg}->[0] = $req->{error_msg}->[0];
}
%{$req} = (); #Clear req structure, it's done..
undef $mactab;
} else {
+9 -35
View File
@@ -411,41 +411,21 @@ sub mknetboot
my $ient;
my $xcatmaster;
$ient = $restab->getNodeAttribs($node, ['xcatmaster']);
if ($ient and $ient->{xcatmaster})
{
$ient = $reshash->{$node}->[0]; #$restab->getNodeAttribs($node, ['tftpserver']);
if ($ient and $ient->{xcatmaster}) {
$xcatmaster = $ient->{xcatmaster};
} else {
$xcatmaster = '!myipfn!'; #allow service nodes to dynamically nominate themselves as a good contact point, this is of limited use in the event that xcat is not the dhcp/tftp server
}
$ient = $restab->getNodeAttribs($node, ['tftpserver']);
if ($ient and $ient->{tftpserver})
{
if ($ient and $ient->{nfsserver} and $ient->{nfsserver} ne '<xcatmaster>') {
$imgsrv = $ient->{nfsserver};
}elsif ($ient and $ient->{tftpserver} and $ient->{tftpserver} ne '<xcatmaster>') {
$imgsrv = $ient->{tftpserver};
}
else
{
# $ient = $restab->getNodeAttribs($node, ['xcatmaster']);
# if ($ient and $ient->{xcatmaster})
# {
# $imgsrv = $ient->{xcatmaster};
# }
# else
# {
# # master removed, does not work for servicenode pools
# #$ient = $sitetab->getAttribs({key => master}, value);
# #if ($ient and $ient->{value})
# #{
# # $imgsrv = $ient->{value};
# #}
# #else
# #{
# $imgsrv = '!myipfn!';
# #}
# }
} else {
$imgsrv = $xcatmaster;
}
unless ($imgsrv)
{
xCAT::MsgUtils->report_node_error($callback, $node, "Unable to determine or reasonably guess the image server for $node");
@@ -463,14 +443,8 @@ sub mknetboot
my $nfssrv = $imgsrv;
my $nfsdir = $rootimgdir;
if ($restab) {
my $resHash = $restab->getNodeAttribs($node, [ 'nfsserver', 'nfsdir' ]);
if ($resHash and $resHash->{nfsserver}) {
$nfssrv = $resHash->{nfsserver};
}
if ($resHash and $resHash->{nfsdir} ne '') {
$nfsdir = $resHash->{nfsdir} . "/netboot/$osver/$arch/$profile";
}
if ($ient->{nfsdir} ne '') {
$nfsdir = $ient->{nfsdir} . "/netboot/$osver/$arch/$profile";
}
if (&using_dracut($rootimgdir)) {
$kcmdline = "root=nfs:$nfssrv:$nfsdir/rootimg:ro STATEMNT=";
+4
View File
@@ -373,6 +373,10 @@ sub process_request {
$request->{noderange} = [$node];
$request->{bmc_node} = [$bmc_node];
$doreq->($request);
if (defined($request->{error})) {
$req->{error}->[0] = '1';
$req->{error_msg}->[0] = $request->{error_msg}->[0];
}
%{$request} = (); #Clear req structure, it's done..
undef $mactab;
} else {
@@ -1150,6 +1150,9 @@ sub get_switchtype {
$key = $1;
return $xCAT::data::switchinfo::global_switch_type{$key};
} else {
if (exists($globalopt{pdu})) {
return "irpdu";
}
return $key;
}
}
@@ -1190,7 +1193,7 @@ sub xCATdB {
# it's attribute
##################################################
if (exists($globalopt{pdu})) {
$ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$host,"groups=$device","ip=$ip","mac=$mac","nodetype=$device","mgt=$device","usercomment=$vendor"] }, $sub_req, 0, 1);
$ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$host,"groups=$device","ip=$ip","mac=$mac","nodetype=$device","mgt=$device","usercomment=$vendor","pdutype=$stype"] }, $sub_req, 0, 1);
} else {
$ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$host,"groups=$device","ip=$ip","mac=$mac","nodetype=$device","mgt=$device","usercomment=$vendor","switchtype=$stype"] }, $sub_req, 0, 1);
}
@@ -1286,6 +1289,8 @@ sub format_stanza {
$result .= "\tnodetype=$device\n";
if (!exists($globalopt{pdu})) {
$result .= "\tswitchtype=$stype\n";
} else {
$result .= "\tpdutype=$stype\n";
}
}
return ($result);
@@ -1328,6 +1333,8 @@ sub format_xml {
$result .= "nodetype=$device\n";
if (!exists($globalopt{pdu})) {
$result .= "switchtype=$stype\n";
} else {
$result .= "\tpdutype=$stype\n";
}
my $href = {
@@ -1399,7 +1406,7 @@ sub matchPredefineSwitch {
# only write to xcatdb if -w or --setup option specified
if ( (exists($globalopt{w})) || (exists($globalopt{setup})) ) {
if (exists($globalopt{pdu})) {
xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"otherinterfaces=$ip",'status=Matched',"mac=$mac","usercomment=$vendor"] }, $sub_req, 0, 1);
xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"otherinterfaces=$ip",'status=Matched',"mac=$mac","usercomment=$vendor","pdutype=$stype"] }, $sub_req, 0, 1);
} else {
xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"otherinterfaces=$ip",'status=Matched',"mac=$mac","switchtype=$stype","usercomment=$vendor"] }, $sub_req, 0, 1);
}
+4
View File
@@ -61,6 +61,10 @@ sub findme {
$req->{bmc_node} = [$bmc_node];
$req->{updateswitch} = ['yes'];
$subreq->($req);
if (defined($req->{error})) {
$request->{error}->[0] = '1';
$request->{error_msg}->[0] = $req->{error_msg}->[0];
}
%{$req} = ();
}
}
+23 -1
View File
@@ -686,7 +686,6 @@ sub preprocess_updatenode
}
# Get the MN names
my @MNip = xCAT::NetworkUtils->determinehostname;
my @MNnodeinfo = xCAT::NetworkUtils->determinehostname;
my $MNnodename = pop @MNnodeinfo; # hostname
my @MNnodeipaddr = @MNnodeinfo; # ipaddresses
@@ -1695,6 +1694,24 @@ sub updatenodesyncfiles
}
}
my $dsh_from_user_env;
# get the Environment Variables and set DSH_FROM_USERID if possible (From updatenode client)
if (defined($request->{environment})) {
foreach my $envar (@{ $request->{environment} })
{
if ($envar =~ /^DSH_FROM_USERID=/) {
$dsh_from_user_env = $envar;
last;
}
}
}
unless ($dsh_from_user_env) {
# $request->{username} is gotten from CN in client certificate
if (($request->{username}) && defined($request->{username}->[0])) {
$dsh_from_user_env = 'DSH_FROM_USERID=' . $request->{username}->[0];
}
}
my $node_syncfile = xCAT::SvrUtils->getsynclistfile($nodes);
foreach my $node (@$nodes)
{
@@ -1745,6 +1762,10 @@ sub updatenodesyncfiles
} else { # else this is updatenode -F
$env = ["DSH_RSYNC_FILE=$synclist"];
}
if ($dsh_from_user_env) {
push @$env, $dsh_from_user_env;
}
push @$args, "--nodestatus";
if (defined($::fanout)) { # fanout
push @$args, "-f";
@@ -1765,6 +1786,7 @@ sub updatenodesyncfiles
if ($::VERBOSE)
{
push @$args, "-T";
my $rsp = {};
$rsp->{data}->[0] =
" $localhostname: Internal call command: xdcp $nodestring " . join(' ', @$args);
+4
View File
@@ -639,6 +639,7 @@ sub process_servicenodes_xdcp
$addreq->{'_xcatdest'} = $::mnname;
$addreq->{node} = \@sn;
$addreq->{noderange} = \@sn;
$addreq->{forceroot}->[0] = 1;
# check input request for --nodestatus
my $args = $req->{arg}; # argument
@@ -1215,6 +1216,9 @@ sub process_request
$ENV{DSH_FROM_USERID} = $request->{username}->[0];
}
}
if ($request->{forceroot}) {
$ENV{DSH_FROM_USERID} = 'root';
}
if ($command eq "xdsh")
{
xdsh($nodes, $args, $callback, $command, $request->{noderange}->[0]);
+7 -3
View File
@@ -22,11 +22,15 @@ sub process_request {
my $doreq = shift;
if ($req->{command}->[0] eq 'findme') {
if (!defined($req->{discoverymethod}) or !defined($req->{discoverymethod}->[0]) or ($req->{discoverymethod}->[0] eq 'undef')) {
if (!defined($req->{discoverymethod}) or !defined($req->{discoverymethod}->[0]) or ($req->{discoverymethod}->[0] eq 'undef') or defined($req->{error})) {
my $error_msg = ".";
if (defined($req->{error_msg}) and defined($req->{error_msg}->[0])) {
$error_msg = ": ". $req->{error_msg}->[0];
}
my $rsp = {};
$rsp->{error}->[0] = "The discovery request can not be processed";
$rsp->{error}->[0] = "The discovery request can not be processed".$error_msg;
$cb->($rsp);
xCAT::MsgUtils->message("S", "xcat.discovery.zzzdiscovery: ($req->{_xcat_clientmac}->[0]) Failed to discover the node.");
xCAT::MsgUtils->message("S", "xcat.discovery.zzzdiscovery: ($req->{_xcat_clientmac}->[0]) Failed for node discovery".$error_msg);
#now, notify the node that its findme request has been processed
my $client_ip = $req->{'_xcat_clientip'};
+14 -7
View File
@@ -58,13 +58,14 @@ unless (($^O =~ /^aix/i) || ($os =~ /^sle[sc]10/) || (($os =~ /^rh.*5$/) && ($ar
}
use File::Basename;
use File::Path;
use Time::HiRes qw(sleep);
use Time::HiRes qw(sleep time);
use Thread qw(yield);
use Fcntl qw/:DEFAULT :flock/;
use xCAT::Client qw(submit_request);
my $clientselect = new IO::Select;
my $sslclients = 0; # THROTTLE
my $maxsslclients = 64; # default
my $maxsslclientswarntime = 0;
my $batchclients = 50;
my @deferredmsgargs; # hold argumentlist for MsgUtils call until after fork
# parallelizing logging overhead with real work
@@ -594,7 +595,7 @@ sub grant_tcrequests {
my $availableslots = $batchclients;
if (not keys %{$requestors}) { return; } # skip the interaction with SSL if
# no requests are actually pending
my $oldtime = time() - 180; # drop requests older than three minutes if still around
my $oldtime = int(time()) - 180; # drop requests older than three minutes if still around
my $msg;
eval { store_fd({ 'req' => 'get_client_count' }, $sslctl); $msg = fd_retrieve($sslctl); };
@@ -813,7 +814,7 @@ sub do_udp_service { # This function opens up a UDP port
} else { # for *now*, we'll do a tiny YAML subset
if ($data =~ /^resourcerequest: xcatd$/) {
$socket->send("ackresourcerequest\n", 0, $packets{$pkey}->[0]);
$tcclients->{$pkey} = { sockaddr => $packets{$pkey}->[0], timestamp => time() }
$tcclients->{$pkey} = { sockaddr => $packets{$pkey}->[0], timestamp => int(time()) }
}
} # JSON maybe one day if important
if ($quit) { last; }
@@ -1432,6 +1433,11 @@ until ($quit) {
}
unless (scalar @pendingconnections) { next; } # if for some reason we landed here without any accepted connections, carry on..
if ($sslclients > $maxsslclients) { # we have enough children, wait for some to exit before spawning more
my $curtime = time();
if ($curtime > ($maxsslclientswarntime + 30)) {
xCAT::MsgUtils->message("S", "xcatd: Connections are being throttled. Current client count (" . ($sslclients + scalar @pendingconnections) . ") is greater than allowed ($maxsslclients)");
$maxsslclientswarntime=$curtime;
}
$bothwatcher->can_read(0.1); # when next connection tries to come in or a tenth of a second, whichever comes first
next; # just keep pulling things off listen queue onto our own
}
@@ -2046,8 +2052,9 @@ sub plugin_command {
my $nextxmittime = time() + 1;
while (($plugin_numchildren > 0) and ($check_fds->count > 0)) { # this tracks end of useful data from children much more closely
relay_fds($check_fds, $xcatresponses{xcatresponse});
if (time() > $nextxmittime) {
$nextxmittime = time() + 1;
my $currenttime = time();
if ($currenttime > $nextxmittime) {
$nextxmittime = $currenttime + 1;
send_response(\%xcatresponses, $sock);
$xcatresponses{xcatresponse} = [];
}
@@ -2930,7 +2937,7 @@ sub service_connection {
}
# ----used for command log start-------
my $reqhandletime = time()-$cmdlog_starttime;
my $reqhandletime = sprintf("%.3f", time()-$cmdlog_starttime);
$cmdlog_alllog .= "[ElapsedTime] $reqhandletime s\n";
cmdlog_submitlog();
@@ -3002,7 +3009,7 @@ sub relay_fds { # Relays file descriptors from pipes to children to the SSL sock
# ----used for command log start-------
$cmdlog_alllog .= "Client abort requested\n";
my $reqhandletime = time()-$cmdlog_starttime;
my $reqhandletime = sprintf("%.3f", time()-$cmdlog_starttime);
$cmdlog_alllog .= "[ElapsedTime] $reqhandletime s\n";
cmdlog_submitlog();
+26 -1
View File
@@ -3,6 +3,7 @@
use Fcntl qw(:DEFAULT :flock);
use Time::HiRes qw(sleep);
use File::Path;
use IO::Socket;
BEGIN {
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr';
}
@@ -91,9 +92,33 @@ if ($ENV{SSHCONSOLEPORT}) {
$sshport= $ENV{SSHCONSOLEPORT};
}
#check if sshport is up
my $sock = IO::Socket::INET->new(
PeerAddr => $bmcip,
PeerPort => $sshport,
Proto => "tcp",
Timeout => 10
);
while (!defined($sock)) {
$sleepint = 10 + int(rand(20));
print "No BMC active at IP $bmcip, retrying in $sleepint seconds (Hit Ctrl-E,c,o to skip)\n";
sleep ($sleepint);
acquire_lock();
sleep(0.1);
release_lock();
$sock = IO::Socket::INET->new(
PeerAddr => $bmcip,
PeerPort => $sshport,
Proto => "tcp",
Timeout => 10
);
}
$sock->close();
# To automatically connect to the console without the need to send over the ssh keys,
# ensure sshpass is installed on the Management and/or Service Nodes.
print "If unable to open the console, ensure sshpass is installed or ssh keys have been configured on the BMC.\n";
print "Unable to open console. If BMC pings, ensure sshpass is installed or ssh keys have been configured on the BMC.\n";
if (-x '/usr/bin/sshpass') {
exec "/usr/bin/sshpass -p $password ssh -p $sshport -l $username -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $bmcip";
} else {
+30 -5
View File
@@ -455,7 +455,30 @@ unless ($onlyinitrd) {
}
my %extrapkgnames;
my %repohash;
if (keys(%extra_hash) > 0) {
my @otherpkgdir_url;
my @otherpkgdir_local;
foreach my $tmpdir (split ',', $srcdir_otherpkgs){
if($tmpdir =~ /^http:.*/){
push @otherpkgdir_url, $tmpdir;
}else{
push @otherpkgdir_local,$tmpdir;
}
}
if(scalar @otherpkgdir_local >1){
print "genimage: at most only 1 local dir in otherpkgdir is supported.\n";
exit 1;
}
my $srcdir_otherpkgs_local;
if(scalar @otherpkgdir_local == 1){
$srcdir_otherpkgs_local=$otherpkgdir_local[0];
}
open($yumconfig, ">>", "/tmp/genimage.$$.yum.conf");
my $index = 1;
foreach $pass (sort { $a <=> $b } (keys(%extra_hash))) {
@@ -468,7 +491,13 @@ unless ($onlyinitrd) {
}
if (($_ eq "PRE_REMOVE") || ($_ eq "POST_REMOVE") || ($_ eq "ENVLIST")) { next; }
print $yumconfig "[otherpkgs$index]\nname=otherpkgs$index\nbaseurl=file://$srcdir_otherpkgs/$_\ngpgpcheck=0\n\n";
foreach(@otherpkgdir_url){
print $yumconfig "[otherpkgs$index]\nname=otherpkgs$index\nbaseurl=$_\ngpgpcheck=0\n\n";
$repohash{$pass}{$index} = 1;
$index++;
}
print $yumconfig "[otherpkgs$index]\nname=otherpkgs$index\nbaseurl=file://$srcdir_otherpkgs_local/$_\ngpgpcheck=0\n\n";
$repohash{$pass}{$index} = 1;
$index++;
my $pa = $extra_hash{$pass}{$_};
@@ -488,10 +517,6 @@ unless ($onlyinitrd) {
$yumcmd_base .= "--enablerepo=$osver-$arch-$_ ";
}
# for (1..$index) {
# $yumcmd .= "--enablerepo=otherpkgs$_ ";
# }
# Hack uname when deal otherpkgs
use_hackuname($arch, $kernelver);
use_devnull();
+1 -1
View File
@@ -615,7 +615,7 @@ if ((-d "$rootimg_dir/usr/share/dracut") or (-d "$rootimg_dir/usr/lib/dracut"))
$dracutmode = 1;
# get dracut version
$dracutver = `chroot $rootimg_dir rpm -qi dracut | awk '/Version/{print \$3}' `;
$dracutver = `chroot $rootimg_dir rpm -qi dracut | awk '/Version/{print \$3}' | awk -F. '{print \$1}'`;
chomp($dracutver);
if ($dracutver =~ /^\d\d\d$/) {
if ($dracutver >= "033") {
+54 -7
View File
@@ -153,6 +153,7 @@ sub config_ssh {
print "$switch is not reachable\n";
next;
}
my ($exp, $errstr) = cumulus_connect($ssh_ip, $userid, $password, $timeout);
if (!defined $exp) {
@@ -290,6 +291,9 @@ sub install_license {
xCAT::MsgUtils->message("E","Failed to $cmd to $switch");
next;
}
#restart switchd and reload interface
$cmd = "xdsh $switch 'systemctl enable switchd;systemctl restart switchd;ifreload -a' ";
xCAT::Utils->runcmd($cmd, 0);
push (@config_switches, $switch);
}
if (@config_switches) {
@@ -350,8 +354,35 @@ sub config_snmp {
sub config_ntp {
my @config_switches;
my $cmd;
my $master;
my $ntpservers;
my $timezone;
#get ntpserver, master and timezone from site table
my @entries = xCAT::TableUtils->get_site_attribute("master");
my $master = $entries[0];
@entries = xCAT::TableUtils->get_site_attribute("timezone");
$timezone = $entries[0];
@entries = xCAT::TableUtils->get_site_attribute("ntpservers");
my $t_entry = $entries[0];
if (defined($t_entry)) {
$ntpservers = $t_entry;
} else {
$ntpservers = $master;
}
my @servers = split(',', $ntpservers);
#use ntpserver from network table if available
my $nettab = xCAT::Table->new("networks");
my @nets;
if ($nettab) {
@nets = $nettab->getAllAttribs('net','mask','ntpservers');
}
my $master = `hostname -i`;
my $file = "temp.txt";
open(FILE , ">$file")
@@ -360,7 +391,6 @@ sub config_ntp {
print FILE "driftfile /var/lib/ntp/drift\n";
print FILE "disable auth\n";
print FILE "restrict 127.0.0.1\n";
print FILE "server $master iburst\n";
print FILE "interface listen eth0\n";
foreach my $switch (@nodes) {
@@ -371,15 +401,31 @@ sub config_ntp {
xCAT::MsgUtils->message("E","xdsh command to $switch failed");
next;
}
my $cmd_line = "echo 'US/Eastern'>/etc/timezone;dpkg-reconfigure --frontend noninteractive tzdata";
print "$cmd_line\n";
$cmd = "xdsh $switch $cmd_line";
$cmd = "xdsh $switch 'echo $timezone >/etc/timezone;dpkg-reconfigure --frontend noninteractive tzdata' ";
$rc= xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0) {
print "Failed to update ntp timezone\n";
xCAT::MsgUtils->message("E","Failed to update ntp timezone for $switch");
next;
}
print "$cmd\n";
#use ntpserver from network table if available
my $ntpserver;
foreach my $net (@nets) {
if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $switch, $net->{'mask'}, 0)) {
$ntpserver=$net->{'ntpservers'};
if (defined $ntpserver) {
if ($ntpserver =~ /xcatmaster/) {
@servers = $master;
} else {
@servers = split(',', $ntpserver);
}
}
last;
}
}
foreach my $server (@servers) {
`echo "server $server iburst" >> $file`;
}
$cmd = "xdcp $switch $file";
$rc= xCAT::Utils->runcmd($cmd, 0);
$cmd = "xdsh $switch 'cp /etc/ntp.conf /etc/ntp.conf.orig;cp $file /etc/ntp.conf;rm -fr $file;systemctl restart ntp;systemctl enable ntp' ";
@@ -398,6 +444,7 @@ sub config_ntp {
my $csw = join(",",@config_switches);
$cmd = "chdef $csw status=ntp_configured";
$rc= xCAT::Utils->runcmd($cmd, 0);
print "$csw: ntp configured\n";
}
+99 -120
View File
@@ -1,6 +1,6 @@
#!/bin/bash
if [ "$(uname -s|tr 'A-Z' 'a-z')" = "linux" ];then
str_dir_name=`dirname $0`
#!/bin/bash
if [ "$(uname -s|tr '[:upper:]' '[:lower:]')" = "linux" ];then
str_dir_name=$(dirname $0)
. $str_dir_name/xcatlib.sh
fi
#written in bash for fewest prerequisites
@@ -9,35 +9,35 @@ function get_def_interface {
#are in bash, the best alternative is to use ping to get at it
#don't want to grep in /etc/hosts or presume DNS
#we are, however, presuming ipv4 for the moment
retval=$(ping -c 1 `hostname`|head -n 1|cut -d\( -f 2|cut -d\) -f 1)
retval=$(ping -c 1 "$(hostname)"|head -n 1|cut -d\( -f 2|cut -d\) -f 1)
if [ -z "$retval" -o "127.0.0.1" = "$retval" ]; then #ok, that didn't pan out, now we grab the first address that looks sane
#retval=`ifconfig|grep inet" " |grep -v addr:127.0.0.1|grep -v 'addr:169.254'|head -n 1|cut -d: -f 2|cut -d' ' -f 1`
retval=`ip -4 -oneline addr show|grep -v "127.0.0.1"|grep -v '169.254'|head -n 1|awk -F 'inet ' '{print $2}'|awk -F '/' '{print $1}'`
retval=$(ip -4 -oneline addr show|grep -v "127.0.0.1"|grep -v '169.254'|head -n 1|awk -F 'inet ' '{print $2}'|awk -F '/' '{print $1}')
fi
if [ -z "$retval" ]; then
echo "ERROR: Unable to reasonably guess the 'default' interface" >&2
exit 1
fi
#iface=`ifconfig|grep -v inet6|egrep '(Link|inet)'|grep -B1 'addr:'$retval |head -n 1|awk '{print $1}'`
iface=`ip -4 -oneline addr show|grep -i $retval|awk -F ':' '{print $2}'|awk -F ' ' '{print $1}'|grep -o "[^ ]\+\( \+[^ ]\+\)*"`
iface=$(ip -4 -oneline addr show|grep -i $retval|awk -F ':' '{print $2}'|awk -F ' ' '{print $1}'|grep -o "[^ ]\+\( \+[^ ]\+\)*")
if [ -z "$iface" ]; then
echo "ERROR: Unable to reasonably guess the default interface" >&2
exit 1
fi
if brctl show | grep ^$iface >& /dev/null; then #
if brctl show | grep ^$iface &> /dev/null; then #
OIFS=$IFS
IFS=$'\n'
INMATCH=0
for brline in $(brctl show); do
IFS=$OIFS
if [ $(expr match "$brline" $iface) == $(expr length $iface) ]; then
if [ "$(expr match "$brline" $iface)" == ${#iface} ]; then
INMATCH=1
elif [ $(expr match "$brline" " ") != 1 ]; then
elif [ "$(expr match "$brline" " ")" != 1 ]; then
INMATCH=0
fi
if [ "$INMATCH" == 1 ]; then
if ! ethtool -i `echo $brline|awk '{print $NF}'`|grep "driver: tun" >& /dev/null; then
iface=`echo $brline|awk '{print $NF}'`
if ! ethtool -i "$(echo $brline|awk '{print $NF}')"|grep "driver: tun" >& /dev/null; then
iface=$(echo $brline|awk '{print $NF}')
echo "$iface"
IFS=$OFIS
return
@@ -60,7 +60,7 @@ function debianpreconf(){
mkdir -p "/etc/network/interfaces.d"
fi
#search xcat flag
XCATFLAG=`grep "#XCAT_CONFIG" /etc/network/interfaces`
XCATFLAG=$(grep "#XCAT_CONFIG" /etc/network/interfaces)
if [ -n "$XCATFLAG" ];then
return
fi
@@ -77,8 +77,7 @@ function debianpreconf(){
CONFFILE=''
#read the backfile
cat /etc/network/interfaces.bak | while read LINE
do
while read LINE; do
if [ ! "$LINE" ];then
continue
fi
@@ -87,7 +86,7 @@ function debianpreconf(){
continue
fi
CONFTYPE=`echo $LINE | cut -d" " -f1`
CONFTYPE=$(echo $LINE | cut -d" " -f1)
if [ $CONFTYPE = 'auto' -o $CONFTYPE = 'allow-hotplug' ];then
LINE=${LINE#$CONFTYPE}
for NICNAME in $LINE; do
@@ -95,7 +94,7 @@ function debianpreconf(){
done
elif [ $CONFTYPE = 'iface' -o $CONFTYPE = 'mapping' ];then
#find out the nic name, should think about the eth0:1
NICNAME=`echo $LINE | cut -d" " -f 2 | cut -d":" -f 1`
NICNAME=$(echo $LINE | cut -d" " -f 2 | cut -d":" -f 1)
CONFFILE="/etc/network/interfaces.d/$NICNAME"
if [ ! -e $CONFFILE ];then
echo "auto $NICNAME" > $CONFFILE
@@ -107,13 +106,13 @@ function debianpreconf(){
echo $LINE >> $CONFFILE
fi
done
done </etc/network/interfaces.bak
}
if [ "storageprereq" = "$1" ]; then
MOUNTURI="$2"
DIRNAME=`echo $MOUNTURI|sed -e 's!nfs://!nfs_!'`
MOUNTPATH=`echo $DIRNAME|sed -e 's!nfs_!!'|sed -e 's!/!:/!'`
DIRNAME=$(echo $MOUNTURI|sed -e 's!nfs://!nfs_!')
MOUNTPATH=$(echo $DIRNAME|sed -e 's!nfs_!!'|sed -e 's!/!:/!')
if mount|grep $MOUNTPATH > /dev/null; then
exit 0;
fi
@@ -124,64 +123,54 @@ elif [ "bridgeprereq" = "$1" ]; then
modprobe bridge
NETDESC="$2"
# get the port for installation
if [ -n "$INSTALLNIC" ]; then
INSPORT=$INSTALLNIC
elif [ -n "$PRIMARYNIC" ]; then
INSPORT=$PRIMARYNIC
fi
if [ -z "$INSPORT" ] || [[ "$INSPORT" =~ ^(mac|MAC)$ ]]; then
if [ -n "$MACADDRESS" ] ; then
INSPORT=$MACADDRESS;
else
echo "should configure mac in $NODE definition."
exit 1
fi
fi
if [[ "$INSPORT" =~ ^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$ ]] ; then
INSPORT=`ip -oneline link show|grep -i ether|grep -i $INSPORT |awk -F ':' '{print $2}'|grep -o "[^ ]\+\( \+[^ ]\+\)*"`
fi
if [ -z "$NETDESC" ]; then
if [ -n "$INSPORT" ]; then
NETDESC=$INSPORT:default
else
echo "Incorrect usage"
exit 1
fi
fi
if echo "$NETDESC"|grep ':'> /dev/null; then
PORTS=`echo "$NETDESC"|cut -d: -f 1`
BNAME=`echo "$NETDESC"|cut -d: -f 2`
PORTS=$(echo "$NETDESC"|cut -d: -f 1)
BNAME=$(echo "$NETDESC"|cut -d: -f 2)
else
if [ -n "$INSTALLNIC" ]; then
PORTS=$INSPORT
if [ -n "$NETDESC" ]; then
BNAME=$NETDESC
else
BNAME=default
fi
BNAME=$NETDESC
# get the port for installation
if [ -n "$INSTALLNIC" ]; then
PORTS=$INSTALLNIC
elif [ -n "$PRIMARYNIC" ]; then
PORTS=$PRIMARYNIC
else
PORTS=$(get_def_interface)
fi
if [ -z "$PORTS" ] || [[ "$PORTS" =~ ^(mac|MAC)$ ]]; then
if [ -n "$MACADDRESS" ] ; then
PORTS=$(ip -oneline link show|grep -i ether|grep -i $MACADDRESS |awk -F ':' '{print $2}'|grep -o "[^ ]\+\( \+[^ ]\+\)*")
else
echo "should configure mac in $NODE definition."
exit 1
fi
fi
fi
# To check whether the brctl have been installed
if ! which brctl > /dev/null; then
if ! which brctl &> /dev/null; then
echo "No bridge-utils installed, pls install it first"
exit 1
fi
if brctl showstp "$BNAME" > /dev/null; then
echo "$BNAME"
if brctl showstp "$BNAME" &> /dev/null; then
echo "$BNAME already exists"
exit 0
fi
#Still here, that means we must build a bridge
if [ -z "$PORTS" ]; then #No ports specified, default to whatever looks up
PORTS=$(get_def_interface)
fi
if [ -z "$PORTS" ]; then #This has been checked many times before in theory, check again just in case
exit 1
fi
#TO check whether the NIC had been attached to another bridge
bridgename=`brctl show |grep $PORTS`
bridgename=$(brctl show |grep $PORTS)
if [ ! -z "$bridgename" ]; then
echo "Device $PORTS is already a member of another bridge"
exit 1
@@ -195,15 +184,15 @@ elif [ "bridgeprereq" = "$1" ]; then
if echo "$PORTS"|grep '&'; then #we have bonding... fun to be had
#To be slack, going to just support one bond for now..
modprobe bonding miimon=100 mode=4
PORTS=`echo $PORTS |sed -e 's/&/ /'`
PORTS="${PORTS//&/ }"
ip link set bond0 up
for p in $PORTS; do
#TODO: we are only going to manage the default
#route for now
saveroutes=`ip route | grep default| grep "dev $p"|grep via|sed -e 's/dev .*//'`
saveroutes=$(ip route | grep default| grep "dev $p"|grep via|sed -e 's/dev .*//')
OIFS=$IFS
IFS=$'\n'
saveip=`ip addr show dev $p scope global|grep inet|grep -v dynamic|sed -e 's/inet.//'|sed -e 's/[^ ]*$//'`
saveip=$(ip addr show dev $p scope global|grep inet|grep -v dynamic|sed -e 's/inet.//'|sed -e 's/[^ ]*$//')
if [ ! -z "$saveip" ]; then
for line in $saveip; do
ip addr add dev bond0 $line
@@ -235,16 +224,12 @@ elif [ "bridgeprereq" = "$1" ]; then
brctl addbr $BNAME
brctl setfd $BNAME 0 #fast forwarding
ip link set $BNAME up
saveroutes=`ip route | grep default| grep "dev $PORTS"|grep via|sed -e 's/dev .*//'`
OIFS=$IFS
IFS=$'\n'
saveip=`ip addr show dev $PORTS scope global|grep inet|sed -e 's/inet.//'|sed -e 's/[^ ]*$//'`
saveroutes="$(ip route | grep default| grep "dev $PORTS"|grep via|sed -e 's/dev .*//')"
saveip="$(ip -4 -o addr show dev $PORTS scope global | sed 's/.*inet //'| sed 's/\( global \).*/\1/')"
if [ ! -z "$saveip" ]; then
for line in $saveip; do
IFS=$OIFS
newline=`echo $line|sed 's/dynamic//g'`
ip addr add dev $BNAME $newline
done
while read line; do
ip addr add dev $BNAME ${line//dynamic}
done <<<"$saveip"
else
if [ ! -z "$3" ]; then
ip addr add dev $BNAME $3
@@ -252,16 +237,10 @@ elif [ "bridgeprereq" = "$1" ]; then
fi
brctl addif $BNAME $PORTS
if [ ! -z "$saveip" ]; then
OIFS=$IFS
IFS=$'\n'
for line in $saveip; do
IFS=$OIFS
newline=`echo $line|sed 's/dynamic//g'`
ip addr del dev $PORTS $newline
done
IFS=$OIFS
while read line; do
ip addr del dev $PORTS ${line//dynamic}
done <<<"$saveip"
fi
IFS=$OIFS
if [ ! -z "$saveroutes" ]; then
ip route add $saveroutes
fi
@@ -284,19 +263,19 @@ elif [ "bridgeprereq" = "$1" ]; then
#write into the network configuration file
if [[ $isSLES -eq 1 ]]; then
cat >$nwdir/ifcfg-$PORTS <<EOF
{ cat <<EOF
DEVICE='$PORTS'
ONBOOT='yes'
BRIDGE='$BNAME'
EOF
mac=`ip addr show dev $PORTS scope global|grep link|sed -e 's/link\/ether//'|sed -e 's/brd.*$//'|sed -e 's/[ ]*//'`
mac=$(ip addr show dev $PORTS scope global|grep link|sed -e 's/link\/ether//'|sed -e 's/brd.*$//'|sed -e 's/[ ]*//')
if [ ! -z "$mac" ]; then
echo "HWADDR='$mac'" >> $nwdir/ifcfg-$PORTS
echo "HWADDR='$mac'"
fi
if [ ! -z "$vlan" ]; then
echo "VLAN='yes'" >> $nwdir/ifcfg-$PORTS
fi
cat >$nwdir/ifcfg-$BNAME <<EOF
echo "VLAN='yes'"
fi; } >"$nwdir/ifcfg-$PORTS"
{ cat <<EOF
DEVICE='$BNAME'
TYPE='Bridge'
ONBOOT='yes'
@@ -304,13 +283,13 @@ PEERDNS='yes'
DELAY='0'
EOF
if [ ! -z "$3" ]; then
echo "IPADDR='$3'" >> $nwdir/ifcfg-$BNAME
echo "IPADDR='$3'"
if [ ! -z "$4" ]; then
echo "NETMASK='$4'" >> $nwdir/ifcfg-$BNAME
echo "NETMASK='$4'"
fi
else
echo "BOOTPROTO=dhcp" >> $nwdir/ifcfg-$BNAME
fi
echo "BOOTPROTO=dhcp"
fi; } >$nwdir/ifcfg-$BNAME
elif [ $isDebian ];then
#ubuntu/debian
echo "auto $PORTS" >$nwdir/$PORTS
@@ -320,46 +299,48 @@ EOF
echo " vlan-raw-device $PORTORG"
fi
echo "auto $BNAME" > $nwdir/$BNAME
{ echo "auto $BNAME"
if [ ! -z "$3" ];then
echo "iface $BNAME inet static" >> $nwdir/$BNAME
echo " address $3" >> $nwdir/$BNAME
echo "iface $BNAME inet static"
echo " address $3"
if [ ! -z "$4" ];then
echo " netmask $4" >> $nwdir/$BNAME
echo " netmask $4"
else
echo " netmask 255.255.255.0" >> $nwdir/$BNAME
echo " netmask 255.255.255.0"
fi
else
my_subnet=`ip addr show dev $BNAME scope global|grep inet|grep -v dynamic|sed -e 's/inet.//'| awk '{print $1}'`
my_subnet=$(ip -4 -o addr show dev "$BNAME" scope global | awk '!/dynamic/{print $4}' )
if [ ! -z "$my_subnet" ]; then
bridge_ip=`echo "$my_subnet"|cut -d\/ -f 1`
bridge_mask=`echo "$my_subnet"|cut -d\/ -f 2`
bridge_mask=`v4prefix2mask $bridge_mask`
echo "iface $BNAME inet static" >> $nwdir/$BNAME
echo " address $bridge_ip" >> $nwdir/$BNAME
echo " netmask $bridge_mask" >> $nwdir/$BNAME
bridge_ip="${my_subnet//\/*}"
bridge_mask="${my_subnet##*\/}"
bridge_mask=$(v4prefix2mask "$bridge_mask")
echo "iface $BNAME inet static"
echo " address $bridge_ip"
echo " netmask $bridge_mask";
else
echo "iface $BNAME inet dhcp" >> $nwdir/$BNAME
echo "iface $BNAME inet dhcp"
fi
fi
echo " bridge_ports $PORTS" >> $nwdir/$BNAME
echo " bridge_stp off" >> $nwdir/$BNAME
echo " bridge_fd 0" >> $nwdir/$BNAME
echo " bridge_maxwait 0" >> $nwdir/$BNAME
echo " bridge_ports $PORTS"
echo " bridge_stp off"
echo " bridge_fd 0"
echo " bridge_maxwait 0"; } > "$nwdir/$BNAME"
else
cat >$nwdir/ifcfg-$PORTS <<EOF
# Migrate some PORTS configuration to Bridge:
ATTRS="$(egrep '^BOOTPROTO|^IPADDR|^NETMASK|^NETWORK|^GATEWAY' $nwdir/ifcfg-$PORTS)"
{ cat <<EOF
DEVICE=$PORTS
ONBOOT=yes
BRIDGE=$BNAME
EOF
mac=`ip addr show dev $PORTS scope global|grep link|sed -e 's/link\/ether//'|sed -e 's/brd.*$//'|sed -e 's/[ ]*//'`
mac=$(ip -0 -o addr show dev "$PORTS" scope global|awk '{print $(NF-2)}')
if [ ! -z "$mac" ]; then
echo "HWADDR=$mac" >> $nwdir/ifcfg-$PORTS
echo "HWADDR=$mac"
fi
if [ ! -z "$vlan" ]; then
echo "VLAN=yes" >> $nwdir/ifcfg-$PORTS
fi
cat >$nwdir/ifcfg-$BNAME <<EOF
echo "VLAN=yes"
fi; } >"$nwdir/ifcfg-$PORTS"
{ cat <<EOF
DEVICE=$BNAME
TYPE=Bridge
ONBOOT=yes
@@ -367,16 +348,14 @@ PEERDNS=yes
DELAY=0
EOF
if [ ! -z "$3" ]; then
echo "IPADDR=$3" >> $nwdir/ifcfg-$BNAME
echo "IPADDR=$3"
if [ ! -z "$4" ]; then
echo "NETMASK=$4" >> $nwdir/ifcfg-$BNAME
echo "NETMASK=$4"
fi
else
echo "BOOTPROTO=dhcp" >> $nwdir/ifcfg-$BNAME
fi
echo "$ATTRS"
fi ; } > "$nwdir/ifcfg-$BNAME"
fi
ifdown $BNAME;ifup $BNAME
ifdown "$BNAME"; ifup "$BNAME"
fi #END bridge config.
+9 -11
View File
@@ -82,24 +82,22 @@ for i in $*; do
done
# remove the last delimiter
userlisttmp="${userlist%?}"
listend=")'"
listend="):'"
userlist=$userlisttmp$listend
grepcmd=$grepcmd$userlist
#set -x
grepcmd="$grepcmd $filebackup > $filebackup.nodups"
grepcmd="$grepcmd $mergefile > $mergefile.nodups"
#echo "grepcmd=$grepcmd"
# now run it
eval $grepcmd
# if no dups file created
if [ -s "$filebackup.nodups" ]; then
cp -p $filebackup.nodups $filebackup
#echo "cp -p $filebackup.nodups $filebackup"
rm $filebackup.nodups
fi
fi
# Now update the currentfile
cat $filebackup $mergefile > $curfile
#echo "cat $filebackup $mergefile > $curfile"
# add new entries from mergefile, if any
if [ -a "$mergefile.nodups" ]; then
cat $mergefile.nodups >> $curfile
rm $mergefile.nodups
fi
# now cleanup
rm $filebackup.userlist
# echo "rm $filebackup.userlist"
@@ -1,14 +1,13 @@
description:the cases in this bundle is to used to verify xCAT hardware control funtions on openpower servers which are mananged using openbmc.
#INCLUDE:hdctrl_general.bundle#
rinv_uuid
rinv_vpd
rinv_cpu
rinv_dimm
rinv_check_active_fw_count
rinv_check_active_fw_count_verbose
rinv_wrongbmcpasswd
rvitals_wattage
rvitals_fanspeed
rvitals_power
rvitals_leds
rvitals_altitude
rsetboot_net_statcheck
rsetboot_cd_statcheck
@@ -38,4 +37,41 @@ rspconfig_set_all
rspconfig_set_all_invalid
rspconfig_set_vlan
rspconfig_set_vlan_invalid
rflash_option_c_without_specify_noderange
rflash_option_l_without_specify_noderange
rflash_option_a_without_specify_noderange
rflash_option_u_without_specify_noderange
rflash_option_d_without_specify_noderange
rflash_without_option
rflash_unsupport_multiple_option_a_u
rflash_unsupport_multiple_option_a_c
rflash_unsupport_multiple_option_a_l
rflash_unsupport_multiple_option_a_d
rflash_unsupport_multiple_option_c_l
rflash_unsupport_multiple_option_c_u
rflash_unsupport_multiple_option_c_d
rflash_unsupport_multiple_option_l_d
rflash_unsupport_multiple_option_l_u
rflash_unsupport_multiple_option_u_d
rflash_option_c_file_not_exist
rflash_option_c_with_multiple_values
rflash_option_c_against_node
rflash_option_check_with_V_against_node
rflash_option_l_with_value
rflash_option_l
rflash_option_u_file_not_exist
rflash_option_u_with_multiple_values
rflash_option_a_file_not_exist
rflash_option_a_with_multiple_values
rflash_option_a_with_non_existent_id
rflash_option_delete_with_multiple_values
rflash_option_delete_with_non_existent_id
rflash_option_d_with_multiple_values
rflash_option_d_with_non_existent_dir
rflash_usage
reventlog_s_openbmc
rpower_softoff
rpower_suspend_OpenpowerBmc
rpower_wake_OpenpowerBmc
rpower_errorcommand_OpenpowerBmc
rpower_wrongpasswd
@@ -270,9 +270,6 @@ updatenode_postscripts_loginfo
bmcdiscover_h
bmcdiscover_nmap_range
bmcdiscover_v
bmcdiscover_check_paswd
bmcdiscover_check_passwd_wrong
bmcdiscover_get_ipsource
bmcdiscover_range_w
bmcdiscover_range_z
xcatd_start

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