mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-10-12 08:12:33 +00:00
Merge pull request #4210 from xcat2/master
Merge master to 2.13 branch for 2.13.8 release(1)
This commit is contained in:
+6
-1
@@ -8,7 +8,7 @@ Documentation
|
||||
|
||||
xCAT documentation is available at: http://xcat-docs.readthedocs.io/en/latest/
|
||||
|
||||
|docs_latest| |docs_2136| |docs_2135| |docs_2134| |docs_2133| |docs_2132| |docs_2131| |docs_2130| |docs_212|
|
||||
|docs_latest| |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_2137| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.7
|
||||
:alt: 2.13.7 documentation status
|
||||
:scale: 100%
|
||||
:target: http://xcat-docs.readthedocs.io/en/2.13.7/
|
||||
|
||||
.. |docs_2136| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.6
|
||||
:alt: 2.13.6 documentation status
|
||||
:scale: 100%
|
||||
|
||||
@@ -33,13 +33,13 @@ Configuration Requirements
|
||||
|
||||
#. Setting up HAMN can be done at any time during the life of the cluster, in this documentation we assume the HAMN setup is done from the very beginning of the xCAT cluster setup, there will be some minor differences if the HAMN setup is done from the middle of the xCAT cluster setup.
|
||||
|
||||
The example given in this document is for RHEL 6. The same approach can be applied to SLES, but the specific commands might be slightly different. The examples in this documentation are based on the following cluster environment:
|
||||
The example given in this document is for RHEL 6/7. The same approach can be applied to SLES, but the specific commands might be slightly different. The examples in this documentation are based on the following cluster environment:
|
||||
|
||||
Virtual IP Alias Address: 9.114.47.97
|
||||
Virtual IP Alias Address: 9.114.47.97, hostname is rhmn
|
||||
|
||||
Primary Management Node: rhmn1(9.114.47.103), netmask is 255.255.255.192, hostname is rhmn1, running RHEL 6.
|
||||
Primary Management Node: rhmn1(9.114.47.103), netmask is 255.255.255.192, hostname is rhmn1, running RHEL 7.
|
||||
|
||||
Standby Management Node: rhmn2(9.114.47.104), netmask is 255.255.255.192, hostname is rhmn2. Running RHEL 6.
|
||||
Standby Management Node: rhmn2(9.114.47.104), netmask is 255.255.255.192, hostname is rhmn2. Running RHEL 7.
|
||||
|
||||
You need to substitute the hostnames and ip address with your own values when setting up your HAMN environment.
|
||||
|
||||
@@ -53,7 +53,8 @@ The configuration procedure will be quite different based on the shared data mec
|
||||
/etc/xcat
|
||||
/install
|
||||
~/.xcat
|
||||
/<dbdirectory>
|
||||
/<dbdirectory>
|
||||
/tftpboot
|
||||
|
||||
|
||||
``Note``:For MySQL, the database directory is ``/var/lib/mysql``; for PostGreSQL, the database directory is ``/var/lib/pgsql``; for DB2, the database directory is specified with the site attribute databaseloc; for sqlite, the database directory is /etc/xcat, already listed above.
|
||||
@@ -64,6 +65,7 @@ Here is an example of how to make directories be shared data through NFS: ::
|
||||
mount -o rw <nfssvr>:/dir2 /install
|
||||
mount -o rw <nfssvr>:/dir3 ~/.xcat
|
||||
mount -o rw <nfssvr>:/dir4 /<dbdirectory>
|
||||
mount -o rw <nfssvr>:/dir5 /tftpboot
|
||||
|
||||
``Note``: if you need to setup high availability for some other applications, like the HPC software stack, between the two xCAT management nodes, the applications data should be on the shared data.
|
||||
|
||||
@@ -78,9 +80,9 @@ Setup xCAT on the Primary Management Node
|
||||
|
||||
The option ``firstalias`` will configure the Virtual IP ahead of the interface ip address, since ifconfig will not make the ip address configuration be persistent through reboots, so the Virtual IP address needs to be re-configured right after the management node is rebooted. This non-persistent Virtual IP address is designed to avoid ip address conflict when the crashed previous primary management is recovered with the Virtual IP address configured.
|
||||
|
||||
#. Add the alias ip address into the ``/etc/resolv.conf`` as the nameserver. Change the hostname resolution order to be using ``/etc/hosts`` before using name server, change to "hosts: files dns" in ``/etc/nsswitch.conf``.
|
||||
#. Add the alias ip address ``9.114.47.97`` into the ``/etc/resolv.conf`` as the nameserver. Change the hostname resolution order to be using ``/etc/hosts`` before using name server, change to "hosts: files dns" in ``/etc/nsswitch.conf``.
|
||||
|
||||
#. Change hostname to the hostname that resolves to the Virtual IP address. This is required for xCAT and database to be setup properly.
|
||||
#. Change hostname to the hostname that resolves to the Virtual IP address ``9.114.47.97``, add the alias ip address and its hostname ``9.114.47.97 rhmn`` into the ``/etc/hosts``. This is required for xCAT and database to be setup properly.
|
||||
|
||||
#. Install xCAT. The procedure described in :doc:`xCAT Install Guide <../../guides/install-guides/index>` could be used for the xCAT setup on the primary management node.
|
||||
|
||||
@@ -99,17 +101,29 @@ Setup xCAT on the Primary Management Node
|
||||
tabdump policy
|
||||
"1.2","rhmn1",,,,,,"trusted",,
|
||||
"1.3","rhmn2",,,,,,"trusted",,
|
||||
"1.4","rhmn",,,,,,"trusted",,
|
||||
|
||||
#. (Optional) DB2 only, change the databaseloc in site table: ::
|
||||
|
||||
chdef -t site databaseloc=/dbdirectory
|
||||
|
||||
#. Install and configure database. Refer to the doc [**doto:** choosing_the_Database] to configure the database on the xCAT management node.
|
||||
#. Install and configure database. Refer to the doc [**doto:** choosing_the_Database] to configure the database on the xCAT management node. For PostgreSql, add primary and standby IP addresses access to database, use ``pgsqlsetup -i -a 9.114.47.103 -a 9.114.47.104`` to migrate an existing xCAT database from SQLite to PostgreSQL.
|
||||
|
||||
Verify xcat is running on correct database by running: ::
|
||||
|
||||
lsxcatd -a
|
||||
|
||||
#. (Optional) PostgreSQL only, if want to change PostgreSql database location, new database directory should be shared data through NFS: ::
|
||||
|
||||
mkdir /<new_dbdirectory>
|
||||
mount -o rw <nfssvr>:/dir6 /<new_dbdirectory>
|
||||
|
||||
Then refer to :ref:`Modify PostgreSql database directory<modify_postgresql_database_diretory>`.
|
||||
|
||||
Remove the old <dbdirectory> share data through NFS: ::
|
||||
|
||||
umount /<dbdirectory>
|
||||
|
||||
#. Backup the xCAT database tables for the current configuration on standby management node, using command : ::
|
||||
|
||||
dumpxCATdb -p <your_backup_dir>.
|
||||
@@ -125,15 +139,15 @@ Setup xCAT on the Primary Management Node
|
||||
service dhcpd stop
|
||||
chkconfig --level 2345 dhcpd off
|
||||
|
||||
#. Stop Database and prevent the database from auto starting at boot time, use MySQL as an example: ::
|
||||
#. Stop Database and prevent the database from auto starting at boot time, use PostgreSQL as an example::
|
||||
|
||||
service mysqld stop
|
||||
chkconfig mysqld off
|
||||
service postgresql stop
|
||||
chkconfig postgresql off
|
||||
|
||||
#. (Optional) If DFM is being used for hardware control capabilities, install DFM package, setup xCAT to communicate directly to the System P server's service processor.::
|
||||
|
||||
xCAT-dfm RPM
|
||||
ISNM-hdwr_svr RPM
|
||||
xCAT-dfm RPM
|
||||
ISNM-hdwr_svr RPM
|
||||
|
||||
#. If there is any node that is already managed by the Management Node,change the noderes table tftpserver & xcatmaster & nfsserver attributes to the Virtual ip
|
||||
|
||||
@@ -144,11 +158,11 @@ Setup xCAT on the Primary Management Node
|
||||
Setup xCAT on the Standby Management Node
|
||||
=========================================
|
||||
|
||||
#. Make sure the standby management node is NOT using the shared data.
|
||||
#. Make sure the standby management node is NOT using the shared data.
|
||||
|
||||
#. Add the alias ip address into the ``/etc/resolv.conf`` as the nameserver. Change the hostname resolution order to be using ``/etc/hosts`` before using name server. Change "hosts: files dns" in /etc/nsswitch.conf.
|
||||
#. Add the alias ip address ``9.114.47.97`` into the ``/etc/resolv.conf`` as the nameserver. Change the hostname resolution order to be using ``/etc/hosts`` before using name server. Change "hosts: files dns" in /etc/nsswitch.conf.
|
||||
|
||||
#. Temporarily change the hostname to the hostname that resolves to the Virtual IP address. This is required for xCAT and database to be setup properly. This only needs to be done one time.
|
||||
#. Temporarily change the hostname to the hostname that resolves to the Virtual IP address ``9.114.47.97``, add the alias ip address and its hostname ``9.114.47.97 rhmn`` into the ``/etc/hosts``. This is required for xCAT and database to be setup properly. This only needs to be done one time.
|
||||
|
||||
Also configure the Virtual IP address during this setup. ::
|
||||
|
||||
@@ -180,10 +194,10 @@ Setup xCAT on the Standby Management Node
|
||||
service dhcpd stop
|
||||
chkconfig --level 2345 dhcpd off
|
||||
|
||||
#. Stop Database and prevent the database from auto starting at boot time. Use MySQL as an example: ::
|
||||
#. Stop Database and prevent the database from auto starting at boot time, use PostgreSQL as an example::
|
||||
|
||||
service mysqld stop
|
||||
chkconfig mysqld off
|
||||
service postgresql stop
|
||||
chkconfig postgresql off
|
||||
|
||||
#. Backup the xCAT database tables for the current configuration on standby management node, using command: ::
|
||||
|
||||
@@ -275,10 +289,25 @@ In a planned failover, you can do necessary cleanup work on the previous primary
|
||||
Take down the Current Primary Management Node
|
||||
---------------------------------------------
|
||||
|
||||
xCAT ships a sample script ``/opt/xcat/share/xcat/hamn/deactivate-mn`` to make the machine be a standby management node. Before using this script, you need to review the script carefully and make updates accordingly, here is an example of how to use this script: ::
|
||||
xCAT ships a sample script ``/opt/xcat/share/xcat/hamn/deactivate-mn`` to make the machine be a standby management node. Before using this script, you need to review the script carefully and make updates accordingly, correct the following variable values in this script: ::
|
||||
|
||||
SHAREDVG=sharedvg # For AIX, shared volumn group name
|
||||
DBDIR=/var/lib/pgsql # database directory
|
||||
SHAREDFS="/install /etc/xcat /root/.xcat /tftpboot" # Shared file systems
|
||||
USEDB2=no # if DB2 is being used
|
||||
USETEAL=no # if TEAL is being used
|
||||
USEDFM=no # if DFM is being used
|
||||
USEUNMOUNT=yes # umount share data directory
|
||||
POWER775=no # Power 775 cluster
|
||||
CHANGEHOSTNAME=no # change the hostname from virtual ip hostname to the original hostname
|
||||
xcatdb=postgresql # support postgrel,DB2,mysql
|
||||
|
||||
Here is an example of how to use this script: ::
|
||||
|
||||
/opt/xcat/share/xcat/hamn/deactivate-mn -i eth1:2 -v 9.114.47.97
|
||||
|
||||
**Notes**: This script will be over-written after xCAT is upgraded. If this script is customized, make sure backup it before upgrading xCAT.
|
||||
|
||||
On the current primary management node:
|
||||
|
||||
If the management node is still available and running the cluster, perform the following steps to shutdown.
|
||||
@@ -301,11 +330,9 @@ If the management node is still available and running the cluster, perform the f
|
||||
|
||||
exportfs -ua
|
||||
|
||||
#. Stop database
|
||||
#. Stop database, use PostgreSQL as an example: ::
|
||||
|
||||
Use MySQL as an example: ::
|
||||
|
||||
service mysqld stop
|
||||
service postgresql stop
|
||||
|
||||
#. Unmount shared data
|
||||
|
||||
@@ -314,7 +341,8 @@ If the management node is still available and running the cluster, perform the f
|
||||
umount /etc/xcat
|
||||
umount /install
|
||||
umount ~/.xcat
|
||||
umount /db2database
|
||||
umount /<dbdirectory>
|
||||
umount /tftpboot
|
||||
|
||||
When trying to umount the file systems, if there are some processes that are accessing the files and directories on the file systems, you will get "Device busy" error. Then stop or kill all the processes that are accessing the shared data file systems and retry the unmount.
|
||||
|
||||
@@ -326,11 +354,26 @@ If the management node is still available and running the cluster, perform the f
|
||||
|
||||
Bring up the New Primary Management Node
|
||||
----------------------------------------
|
||||
xCAT ships a sample script ``/opt/xcat/share/xcat/hamn/activate-mn`` to make the machine be a new primary management node. Before using this script, you need to review the script carefully and make updates accordingly, correct the following variable values in this script: ::
|
||||
|
||||
Execute script ``/opt/xcat/share/xcat/hamn/activate-mn`` to make the machine be a primary management node: ::
|
||||
SHAREDVG=sharedvg # For AIX, shared volumn group name
|
||||
DBDIR=/var/lib/pgsql # database directory
|
||||
SHAREDFS="/install /etc/xcat /root/.xcat" # Shared file systems
|
||||
USEDFM=no # if DFM is being used
|
||||
USENTP=no # if NTP is being used
|
||||
POWER775=no # Power 775 cluster
|
||||
USETEAL=no # if TEAL is being used
|
||||
USEMOUNT=yes # mounted filesystems in the file /etc/fstab
|
||||
CHANGEHOSTNAME=yes # set the hostname to the virtual ip address hostname
|
||||
RESTARTDNS=yes # if yes, will execute "makedns -n"
|
||||
xcatdb=postgresql # support postgrel,DB2,mysql
|
||||
|
||||
Here is an example of how to use this script to make the machine be a primary management node: ::
|
||||
|
||||
/opt/xcat/share/xcat/hamn/activate-mn -i eth1:2 -v 9.114.47.97 -m 255.255.255.0
|
||||
|
||||
**Notes**: This script will be over-written after xCAT is upgraded. If this script is customized, make sure backup it before upgrading xCAT.
|
||||
|
||||
On the new primary management node:
|
||||
|
||||
#. Configure Virtual IP: ::
|
||||
@@ -344,18 +387,25 @@ On the new primary management node:
|
||||
mount /etc/xcat
|
||||
mount /install
|
||||
mount /.xcat
|
||||
mount /db2database
|
||||
mount /<dbdirectory>
|
||||
mount /tftpboot
|
||||
|
||||
#. Start database, use MySQL as an example: ::
|
||||
#. Start database:
|
||||
|
||||
service mysql start
|
||||
* **[MySQL]** ::
|
||||
|
||||
service mysql start
|
||||
|
||||
* **[PostgreSQL]** ::
|
||||
|
||||
service postgresql start
|
||||
|
||||
#. Start the daemons: ::
|
||||
|
||||
service dhcpd start
|
||||
service xcatd start
|
||||
service hdwr_svr start
|
||||
service conserver start
|
||||
service hdwr_svr start # DFM only
|
||||
|
||||
#. (DFM only) Setup connection for CEC and Frame: ::
|
||||
|
||||
@@ -416,11 +466,12 @@ The operating system is installed on the internal disks.
|
||||
|
||||
Output will be similar to: ::
|
||||
|
||||
/dev/sdd /dev/sdc /dev/sdb /dev/sda
|
||||
/dev/sde /dev/sdd /dev/sdc /dev/sdb /dev/sda
|
||||
/dev/sg0 [=/dev/sda scsi0 ch=0 id=1 lun=0]
|
||||
/dev/sg1 [=/dev/sdb scsi0 ch=0 id=2 lun=0]
|
||||
/dev/sg2 [=/dev/sdc scsi0 ch=0 id=3 lun=0]
|
||||
/dev/sg3 [=/dev/sdd scsi0 ch=0 id=4 lun=0]
|
||||
/dev/sg4 [=/dev/sde scsi0 ch=0 id=5 lun=0]
|
||||
|
||||
Use the ``sginfo -s <device_name>`` to identify disks with the same serial number on both management nodes, for example:
|
||||
|
||||
@@ -454,6 +505,7 @@ The operating system is installed on the internal disks.
|
||||
mkfs.ext3 -v /dev/sdc2
|
||||
mkfs.ext3 -v /dev/sdc3
|
||||
mkfs.ext3 -v /dev/sdc4
|
||||
mkfs.ext3 -v /dev/sdc5
|
||||
|
||||
If you place entries for the disk in ``/etc/fstab``, which is not required, ensure that the entries do not have the system automatically mount the disk.
|
||||
|
||||
@@ -466,14 +518,16 @@ The operating system is installed on the internal disks.
|
||||
mount /dev/sdc1 /etc/xcat
|
||||
mount /dev/sdc2 /install
|
||||
mount /dev/sdc3 ~/.xcat
|
||||
mount /dev/sdc4 /db2database
|
||||
mount /dev/sdc4 /<dbdirectory>
|
||||
mount /dev/sdc5 /tftpboot
|
||||
|
||||
After that, umount the file system on the primary management node: ::
|
||||
|
||||
umount /etc/xcat
|
||||
umount /install
|
||||
umount ~/.xcat
|
||||
umount /db2database
|
||||
umount /<dbdirectory>
|
||||
umount /tftpboot
|
||||
|
||||
#. Verify the file systems on the standby management node.
|
||||
|
||||
@@ -482,7 +536,8 @@ The operating system is installed on the internal disks.
|
||||
mount /dev/sdc1 /etc/xcat
|
||||
mount /dev/sdc2 /install
|
||||
mount /dev/sdc3 ~/.xcat
|
||||
mount /dev/sdc4 /db2database
|
||||
mount /dev/sdc4 /<dbdirectory>
|
||||
mount /dev/sdc5/tftpboot
|
||||
|
||||
You may get errors "mount: you must specify the filesystem type" or "mount: special device /dev/sdb1 does not exist" when trying to mount the file systems on the standby management node, this is caused by the missing devices files on the standby management node, run ``fidsk /dev/sdx`` and simply select "w write table to disk and exit" in the fdisk menu, then retry the mount.
|
||||
|
||||
@@ -491,5 +546,6 @@ The operating system is installed on the internal disks.
|
||||
umount /etc/xcat
|
||||
umount /install
|
||||
umount ~/.xcat
|
||||
umount /db2database
|
||||
umount /<dbdirectory>
|
||||
umount /tftpboot
|
||||
|
||||
|
||||
@@ -34,3 +34,64 @@ Restart PostgreSQL after editing the file: ::
|
||||
|
||||
For more information about changing the ``pg_hab.conf`` file and ``postgresql.conf`` files, see the following documentation:
|
||||
`Setup the PostgreSQL Configuration Files <https://sourceforge.net/p/xcat/wiki/Setting_Up_PostgreSQL_as_the_xCAT_DB/#setup-the-postgresql-configuration-files>`_
|
||||
|
||||
.. _modify_postgresql_database_diretory:
|
||||
|
||||
Modify PostgreSQL database directory
|
||||
------------------------------------
|
||||
|
||||
#. Check the xcatdb have been switched to pgsql: ::
|
||||
|
||||
lsxcatd -a
|
||||
Version 2.13.6 (git commit f8c0d11ff2c7c97d6e62389c0aafcdfa06cee1f6, built Mon Aug 7 07:15:47 EDT 2017)
|
||||
This is a Management Node
|
||||
cfgloc=Pg:dbname=xcatdb;host=10.3.5.100|xcatadm
|
||||
dbengine=Pg
|
||||
dbname=xcatdb
|
||||
dbhost=10.3.5.100
|
||||
dbadmin=xcatadm
|
||||
|
||||
#. Check the current working directory: ::
|
||||
|
||||
sudo -u postgres psql
|
||||
could not change directory to "/root"
|
||||
psql (9.2.18)
|
||||
Type "help" for help.
|
||||
|
||||
postgres=# SHOW data_directory;
|
||||
data_directory
|
||||
---------------------
|
||||
/var/lib/pgsql/data
|
||||
(1 row)
|
||||
|
||||
postgres-# \q
|
||||
|
||||
#. Stop postgresql service and modify the configuration files: ::
|
||||
|
||||
systemctl stop postgresql
|
||||
mkdir /install/pgsql_db
|
||||
rsync -av /var/lib/pgsql/ /install/pgsql_db/
|
||||
|
||||
cat /usr/lib/systemd/system/postgresql.service | grep -i PGDATA=
|
||||
Environment=PGDATA=**/install/pgsql_db/data/**
|
||||
|
||||
cat /install/pgsql_db/data/postgresql.conf | grep data_directory
|
||||
#data_directory = 'ConfigDir' # use data in another directory
|
||||
**data_directory = '/install/pgsql_db/data/'**
|
||||
|
||||
#. Reload, start postgresql service and check the working directory: ::
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl start postgresql
|
||||
sudo -u postgres psql
|
||||
psql (9.2.18)
|
||||
Type "help" for help.
|
||||
|
||||
postgres=# SHOW data_directory;
|
||||
data_directory
|
||||
------------------------
|
||||
/install/pgsql_db/data
|
||||
(1 row)
|
||||
|
||||
postgres=#
|
||||
|
||||
|
||||
@@ -10,3 +10,4 @@ This documentation will focus on installing the Cumulus Network Operating System
|
||||
prepare.rst
|
||||
install.rst
|
||||
manage.rst
|
||||
upgrade.rst
|
||||
|
||||
@@ -78,6 +78,8 @@ Validate the ssh keys are correctly configured by running a ``xdsh`` command: ::
|
||||
xdsh frame01sw1 uptime
|
||||
|
||||
|
||||
.. _activate-the-license:
|
||||
|
||||
Activate the License
|
||||
--------------------
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
Switch Management
|
||||
=================
|
||||
|
||||
VLAN Configuration
|
||||
------------------
|
||||
Switch Port and VLAN Configuration
|
||||
----------------------------------
|
||||
|
||||
xCAT ships a simple configuration script that 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 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. ::
|
||||
|
||||
updatenode <switch> -P configinterface
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
Cumulus OS upgrade
|
||||
==================
|
||||
|
||||
The Cumulus OS on the ONIE switches can be upgraded in 2 ways:
|
||||
|
||||
* 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.
|
||||
|
||||
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 ::
|
||||
|
||||
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) ::
|
||||
|
||||
#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") ::
|
||||
|
||||
mkdir -p /install/onie/
|
||||
cp cumulus-linux-3.4.1.bin /install/onie/
|
||||
|
||||
2) invoke the upgrade on switches with ``xdsh`` ::
|
||||
|
||||
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.
|
||||
|
||||
4) Restore your data and configuration files on the switch.
|
||||
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ The steps to configure the certificate for https server: ::
|
||||
export sslcfgfile=/etc/apache2/sites-enabled/ssl.conf # ubuntu
|
||||
|
||||
sed -i 's/^\(\s*\)SSLCertificateFile.*$/\1SSLCertificateFile \/etc\/xcat\/cert\/server-cred.pem/' $sslcfgfile
|
||||
sed -i 's/^\(\s*\)SSLCertificateKeyFile.*$/\1SSLCertificateKeyFile \/etc\/xcat\/cert\/server-cred.pem/' $sslcfgfile
|
||||
sed -i 's/^\(\s*SSLCertificateKeyFile.*\)$/#\1/' $sslcfgfile
|
||||
|
||||
service httpd restart # rhel
|
||||
service apache2 restart # sles/ubuntu
|
||||
|
||||
@@ -95,6 +95,63 @@ Using easy regular expression support you would put this in the hosts table. ::
|
||||
In the easy regx example, the expression only has the 2nd part of the expression from the previous example. xCAT will evaluate the node name, matching the number part of the node name, and create the 1st part of the expression . The 2nd part supplied is what value to give the ip attribute. The resulting output is the same.
|
||||
|
||||
|
||||
Regular Expression Helper Functions
|
||||
-----------------------------------
|
||||
|
||||
xCAT provides several functions that can simplify regular expressions.
|
||||
|
||||
\ **a2idx** ASCII Character to Index\
|
||||
Usage: ``a2idx(character)``
|
||||
|
||||
Turns a single character into a 1-indexed index. ‘a’ maps to 1 and ‘z’ maps to 26.
|
||||
|
||||
\ **a2zidx** ASCII Character to 0-Index\
|
||||
Usage: ``a2zidx(character)``
|
||||
|
||||
Turns a single character into a 0-indexed index. ‘a’ maps to 0 and ‘z’ maps to 25.
|
||||
|
||||
\ **dim2idx** Dimensions to Index\
|
||||
Usage: ``dim2idx(value, [count, value...])``
|
||||
|
||||
Converts dimensions (such as row, column, chassis, etc) into an index. An example system consists of 8 racks, two rows with four columns each.
|
||||
|
||||
+-----------+-----------+-----------+-----------+
|
||||
| row1-col1 | row1-col2 | row1-col3 | row1-col4 |
|
||||
+-----------+-----------+-----------+-----------+
|
||||
| row2-col1 | row2-col2 | row2-col3 | row2-col4 |
|
||||
+-----------+-----------+-----------+-----------+
|
||||
To obtain the rack index, use ``|row(\d+)-col(\d+)|(dim2idx($1, 4, $2))|``. This maps the racks to:
|
||||
|
||||
+---+---+---+---+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
+---+---+---+---+
|
||||
| 5 | 6 | 7 | 8 |
|
||||
+---+---+---+---+
|
||||
Note that the size of the highest dimension (2 rows) is not needed, and all values are one-indexed.
|
||||
|
||||
If each rack contains 20 nodes, use ``|row(\d+)-col(\d+)-node(\d+)|(dim2idx($1, 4, $2, 20, $3)`` to determine a node index (useful for determining IP addresses).
|
||||
|
||||
\ **skip** Skip indices\
|
||||
Usage: ``skip(index, skiplist)``
|
||||
|
||||
Return an index with certain values skipped. The skip list uses the format ``start[:count][,start[:count]...]``. Using the example above, to skip racks 3 and 4, use:
|
||||
|
||||
``|row(\d+)-col(\d+)|(skip(dim2idx($1, 4, $2),'3:2')|``
|
||||
|
||||
The result would be:
|
||||
|
||||
+---+---+---+---+
|
||||
| 1 | 2 | | |
|
||||
+---+---+---+---+
|
||||
| 3 | 4 | 5 | 6 |
|
||||
+---+---+---+---+
|
||||
|
||||
\ **ipadd** Add to an IP address\
|
||||
Usage: ``ipadd(octet1, octet2, octet3, octet4, toadd, skipstart, skipend)``
|
||||
|
||||
This function is useful when you need to cross octets. Optionally skip addresses at the start and end of octets (like .0 or .255 - technically those are valid IP addresses, but sometimes software makes poor assumptions about which broadcast and gateway addresses).
|
||||
|
||||
|
||||
Verify your regular expression
|
||||
------------------------------
|
||||
|
||||
|
||||
@@ -25,24 +25,24 @@ Specify VM attributes
|
||||
|
||||
After the VM object is created, several key attributes need to be specified with ``chdef`` :
|
||||
|
||||
1. the number of virtual cpus in the VM: ::
|
||||
1. the hardware management module, "kvm" for PowerKVM: ::
|
||||
|
||||
chdef vm1 mgt=kvm
|
||||
|
||||
2. the number of virtual cpus in the VM: ::
|
||||
|
||||
chdef vm1 vmcpus=2
|
||||
|
||||
2. the kvm hypervisor of the VM: ::
|
||||
3. the kvm hypervisor of the VM: ::
|
||||
|
||||
chdef vm1 vmhost=kvmhost1
|
||||
|
||||
3. the virtual memory size, with the unit "Megabit". Specify 1GB memory to "vm1" here: ::
|
||||
4. the virtual memory size, with the unit "Megabit". Specify 1GB memory to "vm1" here: ::
|
||||
|
||||
chdef vm1 vmmemory=1024
|
||||
|
||||
**Note**: For diskless node, the **vmmemory** should be at least 2048 MB, otherwise the node cannot boot up.
|
||||
|
||||
4. the hardware management module, "kvm" for PowerKVM: ::
|
||||
|
||||
chdef vm1 mgt=kvm
|
||||
|
||||
5. Define the virtual network card, it should be set to the bridge "br0" which has been created in the hypervisor. If no bridge is specified, no network device will be created for the VM node "vm1": ::
|
||||
|
||||
chdef vm1 vmnics=br0
|
||||
|
||||
@@ -85,7 +85,7 @@ OPTIONS
|
||||
|
||||
\ **-a|-**\ **-access**\ \ *address*\
|
||||
|
||||
This option is used to specify additional IP addresses from which the service nodes will connect to the PostgreSQL database. Without it, only the management node will be configured for database access. This option can be specified multiple times.
|
||||
This option is used to specify additional IP addresses from which the additional nodes will connect to the PostgreSQL database, for example, service nodes IP addresses or MN HA primary/standby nodes physical IP addresses. Without it, only the management node will be configured for database access. This option can be specified multiple times.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ OpenBMC specific:
|
||||
=================
|
||||
|
||||
|
||||
\ **rspconfig**\ \ *noderange*\ {\ **ip | netmask | gateway | hostname | vlan | sshcfg**\ }
|
||||
\ **rspconfig**\ \ *noderange*\ {\ **ipsrc | ip | netmask | gateway | hostname | vlan | sshcfg**\ }
|
||||
|
||||
|
||||
MPA specific:
|
||||
@@ -406,9 +406,15 @@ OPTIONS
|
||||
|
||||
|
||||
|
||||
\ **ipsrc**\
|
||||
|
||||
Get the IP source for OpenBMC.
|
||||
|
||||
|
||||
|
||||
\ **ip**\
|
||||
|
||||
The ip address.
|
||||
The IP address.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ SYNOPSIS
|
||||
|
||||
\ **switchdiscover [-v| -**\ **-version]**\
|
||||
|
||||
\ **switchdiscover**\ [\ *noderange*\ | \ **-**\ **-range**\ \ *ip_ranges*\ ] \ **[-V] [-w][-r|-x|-z][-s**\ \ *scan_methods*\ \ **-**\ **-setup**\ ]
|
||||
\ **switchdiscover**\ [\ *noderange*\ | \ **-**\ **-range**\ \ *ip_ranges*\ ] \ **[-V] [-w][-r|-x|-z][-s**\ \ *scan_methods*\ ] [\ **-**\ **-setup**\ ] [\ **-c**\ \ *community*\ ]
|
||||
|
||||
|
||||
***********
|
||||
@@ -31,7 +31,7 @@ To view all the switches defined in the xCAT database use \ **lsdef -w "nodetype
|
||||
|
||||
For lldp method, make sure that lldpd package is installed and lldpd is running on the xCAT management node. lldpd comes from xcat-dep package or you can get it from http://vincentbernat.github.io/lldpd/installation.html.
|
||||
|
||||
For snmp method, make sure that snmpwalk command is installed and snmp is enabled for switches. To install snmpwalk, "yum install net-snmp-utils" for redhat and sles, "apt-get install snmp" for Ubuntu.
|
||||
For snmp method, make sure that snmpwalk command is installed and snmp is enabled for switches. To install snmpwalk, "yum install net-snmp-utils" for redhat and sles, "apt-get install snmp" for Ubuntu. The switchdiscover command only check the switches with default community string, if user already configured switch with other commmunity string, need to pass in with \ **-c**\ option for switchdiscover command to be able to discover.
|
||||
|
||||
|
||||
*******
|
||||
@@ -118,6 +118,12 @@ OPTIONS
|
||||
|
||||
|
||||
|
||||
\ **-c**\
|
||||
|
||||
User defined community string for snmp scan.
|
||||
|
||||
|
||||
|
||||
|
||||
************
|
||||
RETURN VALUE
|
||||
|
||||
@@ -157,27 +157,6 @@ Before you panic, let me explain each column:
|
||||
See http://www.perl.com/doc/manual/html/pod/perlre.html for information on perl regular expressions.
|
||||
|
||||
|
||||
Regular Expression Helper Functions
|
||||
============================
|
||||
|
||||
xCAT provides several functions that can simplify regular expressions.
|
||||
|
||||
\ **a2idx(character) **\
|
||||
Turns a single character into a 1-indexed index. ‘a’ maps to 1 and ‘z’ maps to 26.
|
||||
|
||||
\ **a2zidx(character) **\
|
||||
Turns a single character into a 0-indexed index. ‘a’ maps to 0 and ‘z’ maps to 25.
|
||||
|
||||
\ **dim2idx(value, [count, value...]) **\
|
||||
Converts dimensions (such as row, column, chassis, etc) into an index. If each rack has 18 nodes, use dim2idx(racknum, 18, nodenum). Additional dimensions should be added at the beginning. All values are 1-indexed.
|
||||
|
||||
\ **skip(index, skiplist) **\
|
||||
Return an index with certain values skipped. The skip list uses the format start[:count][,start[:count]...]
|
||||
|
||||
\ **ipadd(octet1, octet2, octet3, octet4, toadd, skipstart, skipend) **\
|
||||
Add to an IP address. Generally only necessary when you cross octets. Optionally skip addresses at the start and end of octets (like .0 or .255). Technically those are valid IP addresses, but sometimes software makes poor assumptions about which broadcast and gateway addresses.
|
||||
|
||||
|
||||
Easy Regular Expressions
|
||||
========================
|
||||
|
||||
@@ -187,6 +166,46 @@ As of xCAT 2.8.1, you can use a modified version of the regular expression suppo
|
||||
http://xcat-docs.readthedocs.org/en/latest/guides/admin-guides/basic_concepts/xcat_db/regexp_db.html#easy-regular-expressions
|
||||
|
||||
|
||||
Regular Expression Helper Functions
|
||||
===================================
|
||||
|
||||
|
||||
xCAT provides several functions that can simplify regular expressions.
|
||||
|
||||
|
||||
\ **a2idx**\
|
||||
|
||||
ASCII Character to Index
|
||||
|
||||
|
||||
|
||||
\ **a2zidx**\
|
||||
|
||||
ASCII Character to 0-Index
|
||||
|
||||
|
||||
|
||||
\ **dim2idx**\
|
||||
|
||||
Dimensions to Index
|
||||
|
||||
|
||||
|
||||
\ **skip**\
|
||||
|
||||
Skip indices
|
||||
|
||||
|
||||
|
||||
\ **ipadd**\
|
||||
|
||||
Add to an IP address
|
||||
|
||||
|
||||
|
||||
http://xcat-docs.readthedocs.org/en/latest/guides/admin-guides/basic_concepts/xcat_db/regexp_db.html#regular-expression-helper-functions
|
||||
|
||||
|
||||
|
||||
******************
|
||||
OBJECT DEFINITIONS
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
.. _ubuntu_install_guide:
|
||||
|
||||
Installation Guide for Ubuntu Server LTS
|
||||
========================================
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
.. _rhel_install_guide:
|
||||
|
||||
Installation Guide for Red Hat Enterprise Linux
|
||||
===============================================
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
.. _sles_install_guide:
|
||||
|
||||
Installation Guide for SUSE Linux Enterprise Server
|
||||
===================================================
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ Table of Contents
|
||||
guides/install-guides/index.rst
|
||||
guides/admin-guides/index.rst
|
||||
advanced/index.rst
|
||||
references/index.rst
|
||||
troubleshooting/index.rst
|
||||
developers/index.rst
|
||||
help.rst
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
Compute Nodes
|
||||
=============
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
discover.rst
|
||||
validation.rst
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Discover Switches
|
||||
=================
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Core Switches
|
||||
=============
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
pre.rst
|
||||
discover.rst
|
||||
vlan.rst
|
||||
known_issues.rst
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Known Issues
|
||||
============
|
||||
@@ -0,0 +1,4 @@
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
VLAN Configuration
|
||||
==================
|
||||
@@ -0,0 +1,3 @@
|
||||
Discover Switches
|
||||
=================
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
Edge Switches
|
||||
=============
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
pre.rst
|
||||
discover.rst
|
||||
vlan.rst
|
||||
known_issues.rst
|
||||
@@ -0,0 +1,2 @@
|
||||
Known Issues
|
||||
============
|
||||
@@ -0,0 +1,4 @@
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
VLAN Configuration
|
||||
==================
|
||||
@@ -0,0 +1,13 @@
|
||||
Discovery
|
||||
=========
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
core_sw/index.rst
|
||||
mgmt_sw/index.rst
|
||||
mid_sw/index.rst
|
||||
servicenode/index.rst
|
||||
edge_sw/index.rst
|
||||
compute/index.rst
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Discover Switches
|
||||
=================
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Management Switches
|
||||
===================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
pre.rst
|
||||
discover.rst
|
||||
vlan.rst
|
||||
known_issues.rst
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Known Issues
|
||||
============
|
||||
@@ -0,0 +1,4 @@
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
VLAN Configuration
|
||||
==================
|
||||
@@ -0,0 +1,3 @@
|
||||
Discover Switches
|
||||
=================
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Mid Switches
|
||||
============
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
pre.rst
|
||||
discover.rst
|
||||
vlan.rst
|
||||
known_issues.rst
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Known Issues
|
||||
============
|
||||
@@ -0,0 +1,4 @@
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
VLAN Configuration
|
||||
==================
|
||||
@@ -0,0 +1,9 @@
|
||||
Service Nodes
|
||||
=============
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
discover.rst
|
||||
validation.rst
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
CORAL
|
||||
=====
|
||||
|
||||
CORAL stands for Collaboration of Oak Ridge, Argonne, and Livermore and is solution that IBM is building for the Department of Energy to superseed its current cluster of Supercomputers.
|
||||
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
known_issues/index.rst
|
||||
.. mn/index.rst
|
||||
.. discovery/index.rst
|
||||
@@ -0,0 +1,22 @@
|
||||
xCAT Genesis Base
|
||||
=================
|
||||
|
||||
xCAT ships a ``xCAT-genesis-base`` package as part of xcat-deps. This is a light-weight diskless linux image based on Fedora (Fedora26, currently) that is used by xCAT to do hardware discovery.
|
||||
|
||||
To support the Power9 hardware, changes are made to the kernel in the Red Hat Enterprise distribution that are not yet available in the Fedora kernels. Without that support, running the scripts in xCAT discovery caused segmentation faults described in this issue: https://github.com/xcat2/xcat-core/issues/3870
|
||||
|
||||
Work-around
|
||||
-----------
|
||||
|
||||
xCAT cannot ship a kernel based on RHEL distribution, so the customer needs to build a version of the ``xCAT-genesis-base`` on-site using a server running Red Hat Enterprise Linux.
|
||||
|
||||
1. Download the latest timestamp version of the ``xCAT-genesis-builder`` RPM provided here: http://xcat.org/files/xcat/xcat-dep/2.x_Linux/beta/
|
||||
|
||||
2. Install the ``xCAT-genesis-builder`` RPM on a node that is installed with the RHEL version being deployed.
|
||||
|
||||
3. Build the ``xCAT-genesis-base`` RPM: ::
|
||||
|
||||
/opt/xcat/share/xcat/netboot/genesis/builder/buildrpm
|
||||
|
||||
4. Install this package on top of the xCAT install and execute: ``mknb ppc64``
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
Known Issues
|
||||
============
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
genesis_base.rst
|
||||
@@ -0,0 +1,5 @@
|
||||
Configure
|
||||
=========
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
@@ -0,0 +1,12 @@
|
||||
Management Node
|
||||
===============
|
||||
|
||||
The Management Node should be installed with a RHEL Operating System. The following guides describe the process of installation, configuration and validation of xCAT on the Management Node.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
install.rst
|
||||
configure/index.rst
|
||||
validate/index.rst
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
Install
|
||||
=======
|
||||
|
||||
|
||||
Prerequisite
|
||||
------------
|
||||
|
||||
Install the following RPMs Management Node. They are used by various tools xCAT provides to assist with debugging/validation: ::
|
||||
|
||||
yum -y install tcpdump pciutils bzip2 bind-utils
|
||||
|
||||
|
||||
Install xCAT
|
||||
------------
|
||||
|
||||
See :ref:`rhel_install_guide` for detailed xCAT installation instructions.
|
||||
@@ -0,0 +1,6 @@
|
||||
Validate
|
||||
========
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Reference Implementation
|
||||
========================
|
||||
|
||||
Reference documentation created for management of large clusters using xCAT.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
coral/index.rst
|
||||
percs/index.rst
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
PERCS
|
||||
=====
|
||||
|
||||
See documentation here: https://sourceforge.net/p/xcat/wiki/XCAT_Power_775_Hardware_Management/
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
2017-08-28 - OpenSSL Vulnerabilities
|
||||
====================================
|
||||
|
||||
*Aug 28, 2017*, OpenSSL announced the following security advisories: https://www.openssl.org/news/secadv/20170828.txt
|
||||
|
||||
|
||||
Advisory CVEs
|
||||
-------------
|
||||
|
||||
* CVE-2017-3735 - **Malformed X.509 IPAddressFamily could cause OOB read** (Severity: Low)
|
||||
|
||||
If an X.509 certificate has a malformed IPAddressFamily extension,
|
||||
OpenSSL could do a one-byte buffer overread. The most likely result
|
||||
would be an erroneous display of the certificate in text format.
|
||||
|
||||
As this is a low severity fix, no release is being made. The fix can be
|
||||
found in the source repository (1.0.2, 1.1.0, and master branches); see
|
||||
https://github.com/openssl/openssl/pull/4276. This bug has been present
|
||||
since 2006.
|
||||
|
||||
|
||||
Please see the security bulletin above for patch, upgrade, or suggested work around information.
|
||||
|
||||
Action
|
||||
------
|
||||
|
||||
xCAT uses OpenSSL for client-server communication but **does not** ship it.
|
||||
|
||||
It is highly recommended to keep your OpenSSL levels up-to-date with the indicated versions in the security bulletins to prevent any potential security threats. Obtain the updated software packages from your Operating system distribution channels.
|
||||
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
20170828_openssl.rst
|
||||
20170216_openssl.rst
|
||||
20170126_openssl.rst
|
||||
|
||||
@@ -3,7 +3,7 @@ Enabling Debug Port: Running commands in the installer from MN
|
||||
|
||||
**This mode is supported with debug level set to 1 or 2**
|
||||
|
||||
xCAT creates a server in the **installer**, listening on port ``3001``. It executes commands sent to it from the xCAT MN and returns the response output.
|
||||
xCAT creates a service inside the **installer**, listening on port ``3054``. It executes commands sent to it from the xCAT MN and returns the response output.
|
||||
|
||||
The command ``runcmdinstaller`` can be used to send request to installer:
|
||||
|
||||
|
||||
@@ -271,6 +271,36 @@ As of xCAT 2.8.1, you can use a modified version of the regular expression suppo
|
||||
|
||||
http://xcat-docs.readthedocs.org/en/latest/guides/admin-guides/basic_concepts/xcat_db/regexp_db.html#easy-regular-expressions
|
||||
|
||||
=head2 Regular Expression Helper Functions
|
||||
|
||||
xCAT provides several functions that can simplify regular expressions.
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<a2idx>
|
||||
|
||||
ASCII Character to Index
|
||||
|
||||
=item B<a2zidx>
|
||||
|
||||
ASCII Character to 0-Index
|
||||
|
||||
=item B<dim2idx>
|
||||
|
||||
Dimensions to Index
|
||||
|
||||
=item B<skip>
|
||||
|
||||
Skip indices
|
||||
|
||||
=item B<ipadd>
|
||||
|
||||
Add to an IP address
|
||||
|
||||
=back
|
||||
|
||||
http://xcat-docs.readthedocs.org/en/latest/guides/admin-guides/basic_concepts/xcat_db/regexp_db.html#regular-expression-helper-functions
|
||||
|
||||
=head1 OBJECT DEFINITIONS
|
||||
|
||||
Because it can get confusing what attributes need to go in what tables, the xCAT database can also
|
||||
|
||||
@@ -26,6 +26,7 @@ Includes xCAT::Table, xCAT::NodeRange, among others.
|
||||
%define zvm %(if [ "$zvm" = "1" ];then echo 1; else echo 0; fi)
|
||||
%define fsm %(if [ "$fsm" = "1" ];then echo 1; else echo 0; fi)
|
||||
|
||||
%define builddate %(date)
|
||||
%prep
|
||||
%setup -q -n perl-xCAT
|
||||
%build
|
||||
|
||||
@@ -902,6 +902,19 @@ sub setobjdefs
|
||||
}
|
||||
|
||||
my @attrprovided = ();
|
||||
#get group objects data
|
||||
my %DBgroupsattr;
|
||||
my %tmpghash;
|
||||
my @tmplgrplist;
|
||||
my %grpvalidattr;
|
||||
if (defined($objhash{$objname}{'groups'})){
|
||||
|
||||
@tmplgrplist = split(",", $objhash{$objname}{'groups'});
|
||||
foreach my $tmpgrp (@tmplgrplist) {
|
||||
$tmpghash{$tmpgrp} = "group";
|
||||
}
|
||||
%DBgroupsattr=xCAT::DBobjUtils->getobjdefs(\%tmpghash);
|
||||
}
|
||||
|
||||
# check FINALATTRS to see if all the attrs are valid
|
||||
foreach my $attr (keys %{ $objhash{$objname} }) {
|
||||
@@ -992,7 +1005,6 @@ sub setobjdefs
|
||||
}
|
||||
}
|
||||
}
|
||||
xCAT::MsgUtils->message("I", $rsp, $::callback);
|
||||
$checkedattrs{$attr_name} = 1;
|
||||
if ($invalidattr->{$attr_name}->{valid} != 1) {
|
||||
$invalidattr->{$attr_name}->{valid} = 0;
|
||||
@@ -1147,10 +1159,26 @@ sub setobjdefs
|
||||
|
||||
my $rsp;
|
||||
foreach my $att (keys %$invalidattr) {
|
||||
my $pickvalidattr=0;
|
||||
if ($invalidattr->{$att}->{valid} != 1) {
|
||||
my $tt = $invalidattr->{$att}->{valid};
|
||||
push @{ $rsp->{data} }, "Cannot set the attr=\'$att\' attribute unless $invalidattr->{$att}->{condition}.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::callback);
|
||||
#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;
|
||||
}
|
||||
}
|
||||
if ($pickvalidattr != 1) {
|
||||
push @{ $rsp->{data} }, "Cannot set the attr=\'$att\' attribute unless $invalidattr->{$att}->{condition}.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3855,10 +3855,10 @@ sub usage_dsh
|
||||
my $usagemsg1 = " xdsh -h \n xdsh -q \n xdsh -V \n";
|
||||
my $usagemsg1a = "xdsh <noderange> [-K] [-l logonuserid]\n";
|
||||
my $usagemsg2 = " [-B | --bypass ] [-c] [-e] [-E environment_file]
|
||||
[--devicetype type_of_device] [-f fanout]\n";
|
||||
[--devicetype type_of_device] [-f fanout] [--ip ip_addr]\n";
|
||||
my $usagemsg3 = " [-l user_ID] [-L] ";
|
||||
my $usagemsg4 = "[-m] [-o options][-q] [-Q] [-r remote_shell]
|
||||
[-i image] [-s] [-S ksh | csh] [-t timeout]\n";
|
||||
[-i image] [-s] [-S ksh | csh] [--show key|script] [-t timeout]\n";
|
||||
my $usagemsg5 = " [-T] [-X environment variables] [-v] [-z] [--sudo]\n";
|
||||
my $usagemsg6 = " <command_list>";
|
||||
my $usagemsg .= $usagemsg1 .= $usagemsg1a .= $usagemsg2 .= $usagemsg3 .=
|
||||
@@ -3962,8 +3962,10 @@ sub parse_and_run_dsh
|
||||
'c|cleanup' => \$options{'cleanup'},
|
||||
'E|environment=s' => \$options{'environment'},
|
||||
'I|ignore-sig|ignoresig=s' => \$options{'ignore-signal'},
|
||||
'ip=s' => \$options{'ip'},
|
||||
'K|keysetup' => \$options{'ssh-setup'},
|
||||
'L|no-locale' => \$options{'no-locale'},
|
||||
'show=s' => \$options{'show'},
|
||||
'Q|silent' => \$options{'silent'},
|
||||
'S|syntax=s' => \$options{'syntax'},
|
||||
'T|trace' => \$options{'trace'},
|
||||
@@ -4131,7 +4133,7 @@ sub parse_and_run_dsh
|
||||
# with error, if the Management Node is in the Database and in the
|
||||
# noderange
|
||||
my @mname = xCAT::Utils->noderangecontainsMn(@nodelist);
|
||||
if (@mname) { # MN in the nodelist
|
||||
if ( @mname and !$options{'ip'} ) { # MN in the nodelist and --ip not specified
|
||||
my $nodes = join(',', @mname);
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
@@ -4165,7 +4167,7 @@ sub parse_and_run_dsh
|
||||
# password for the key update. This was setup in xdsh client
|
||||
# frontend.
|
||||
|
||||
if (!($ENV{'DSH_REMOTE_PASSWORD'}))
|
||||
if (!($ENV{'DSH_REMOTE_PASSWORD'}) && !(defined $options{'show'}))
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
@@ -4239,7 +4241,22 @@ sub parse_and_run_dsh
|
||||
#
|
||||
# setup ssh keys on the nodes or ib switch
|
||||
#
|
||||
my $rc = xCAT::TableUtils->setupSSH($options{'nodes'}, $options{'timeout'});
|
||||
my $rc;
|
||||
|
||||
# If 'show' was specified then pass the value in an environment variable.
|
||||
if ( $options{'show'} ) {
|
||||
$ENV{'DSH_SHOW'} = $options{'show'};
|
||||
}
|
||||
|
||||
# Go perform the setup of the SSH keys.
|
||||
if ( $options{'ip'} ) {
|
||||
# If IPs were passed then use them as the target of the unlock.
|
||||
$rc = xCAT::TableUtils->setupSSH($options{'ip'} );
|
||||
} else {
|
||||
# Unlock the nodes
|
||||
$rc = xCAT::TableUtils->setupSSH($options{'nodes'}, $options{'timeout'});
|
||||
}
|
||||
|
||||
my @results = "return code = $rc";
|
||||
return (@results);
|
||||
}
|
||||
|
||||
+109
-40
@@ -543,11 +543,19 @@ sub refresh_table {
|
||||
pipe my $child, my $parent;
|
||||
$child->autoflush(1);
|
||||
$parent->autoflush(1);
|
||||
|
||||
$children++;
|
||||
my $cpid = xCAT::Utils->xfork;
|
||||
unless (defined $cpid) { die "Cannot fork" }
|
||||
unless (defined $cpid) {
|
||||
$children--;
|
||||
close($child);
|
||||
close($parent);
|
||||
xCAT::MsgUtils->message("S", "refresh_table: failed to fork refresh_switch process for $entry->{switch},skip...");
|
||||
next;
|
||||
}
|
||||
|
||||
if ($cpid == 0) {
|
||||
$SIG{CHLD} = 'DEFAULT';
|
||||
close($child);
|
||||
my $runstart = time;
|
||||
$self->refresh_switch($parent, $community, $entry->{switch});
|
||||
@@ -709,50 +717,55 @@ sub refresh_switch {
|
||||
my $output = shift;
|
||||
my $community = shift;
|
||||
my $switch = shift;
|
||||
my %index_to_vlan = ();
|
||||
my %index_to_mac = ();
|
||||
|
||||
unless($self->{collect_mac_info})
|
||||
{
|
||||
if($self->{switchparmhash}->{$switch}->{switchtype} eq 'onie'){
|
||||
#for cumulus switch, the MAC table can be retrieved with ssh
|
||||
#which is much faster than snmp
|
||||
my $mymac;
|
||||
my $myport;
|
||||
if($self->{switchparmhash}->{$switch}->{switchtype} eq 'onie'){
|
||||
#for cumulus switch, the MAC table can be retrieved with ssh
|
||||
#which is much faster than snmp
|
||||
my $mymac;
|
||||
my $myport;
|
||||
|
||||
my @res=xCAT::Utils->runcmd("ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no $switch 'bridge fdb show|grep -i -v permanent|tr A-Z a-z 2>/dev/null' 2>/dev/null",-1);
|
||||
unless (@res) {
|
||||
xCAT::MsgUtils->message("S", "Failed to get mac table with ssh to $switch, fall back to snmp! To obtain mac table with ssh, please make sure the passwordless root ssh to $switch is available");
|
||||
}else{
|
||||
foreach (@res){
|
||||
if($_ =~ m/^([0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}) dev swp([0-9]+) .*/){
|
||||
$mymac=$1;
|
||||
$myport=$2;
|
||||
$myport=sprintf("%d",$myport);
|
||||
|
||||
#try all the possible port number formats
|
||||
#e.g, "5","swp5","05","swp05"
|
||||
unless(exists $self->{switches}->{$switch}->{$myport}){
|
||||
if(exists $self->{switches}->{$switch}->{"swp".$myport}){
|
||||
$myport="swp".$myport;
|
||||
}else{
|
||||
$myport=sprintf("%02d",$myport);
|
||||
unless(exists $self->{switches}->{$switch}->{$myport}){
|
||||
if(exists $self->{switches}->{$switch}->{"swp".$myport}){
|
||||
$myport="swp".$myport;
|
||||
}else{
|
||||
$myport="";
|
||||
}
|
||||
my @res=xCAT::Utils->runcmd("ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no $switch 'bridge fdb show|grep -i -v permanent|tr A-Z a-z 2>/dev/null' 2>/dev/null",-1);
|
||||
if ($::RUNCMD_RC) {
|
||||
xCAT::MsgUtils->message("S", "Failed to get mac table with ssh to $switch, fall back to snmp! To obtain mac table with ssh, please make sure the passwordless root ssh to $switch is available");
|
||||
}else{
|
||||
foreach (@res){
|
||||
if($_ =~ m/^([0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}) dev swp([0-9]+) vlan ([0-9]+) .*/){
|
||||
$mymac=$1;
|
||||
$myport=$2;
|
||||
$myport=sprintf("%d",$myport);
|
||||
my $macport=$2;
|
||||
my $macvlan=$3;
|
||||
|
||||
#try all the possible port number formats
|
||||
#e.g, "5","swp5","05","swp05"
|
||||
unless(exists $self->{switches}->{$switch}->{$myport}){
|
||||
if(exists $self->{switches}->{$switch}->{"swp".$myport}){
|
||||
$myport="swp".$myport;
|
||||
}else{
|
||||
$myport=sprintf("%02d",$myport);
|
||||
unless(exists $self->{switches}->{$switch}->{$myport}){
|
||||
if(exists $self->{switches}->{$switch}->{"swp".$myport}){
|
||||
$myport="swp".$myport;
|
||||
}else{
|
||||
$myport="";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($myport){
|
||||
if($output){
|
||||
printf $output "$mymac|%s\n", $self->{switches}->{$switch}->{$myport};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($myport){
|
||||
if($output){
|
||||
printf $output "$mymac|%s\n", $self->{switches}->{$switch}->{$myport};
|
||||
}
|
||||
}
|
||||
push @{ $index_to_vlan{$macport} }, $macvlan;
|
||||
push @{ $index_to_mac{$macport} }, $mymac;
|
||||
}
|
||||
|
||||
}
|
||||
unless($self->{collect_mac_info}) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -797,12 +810,56 @@ sub refresh_switch {
|
||||
return;
|
||||
}
|
||||
|
||||
#check if it is Mellanox IB switch
|
||||
foreach (keys %{$namemap}) {
|
||||
my $ifname = $namemap->{$_};
|
||||
if ($self->{collect_mac_info}) {
|
||||
if ( ($ifname =~ /IB/) || ($ifname =~ /ib/) ) {
|
||||
$self->{macinfo}->{$switch}->{ErrorStr} = "This command does not support Mellanox IB Switch";
|
||||
return;
|
||||
}
|
||||
}
|
||||
last;
|
||||
}
|
||||
|
||||
# get mtu
|
||||
my $iftomtumap = walkoid($session, '.1.3.6.1.2.1.2.2.1.4', silentfail => 1, verbose => $self->{show_verbose_info}, switch => $switch, callback => $self->{callback});
|
||||
unless (defined($iftomtumap)) {
|
||||
xCAT::MsgUtils->message("I", "MTU information is not availabe for this switch $switch");
|
||||
}
|
||||
|
||||
my $iscisco = 0;
|
||||
if ($self->{switchparmhash}->{$switch}->{switchtype} eq 'onie'){
|
||||
my $bridgetoifmap = walkoid($session, '.1.3.6.1.2.1.17.1.4.1.2', ciscowarn => $iscisco, verbose => $self->{show_verbose_info}, switch => $switch, callback => $self->{callback}); # Good for all switches
|
||||
if (not ref $bridgetoifmap or !keys %{$bridgetoifmap}) {
|
||||
xCAT::MsgUtils->message("S", "Error communicating with " . $session->{DestHost} . ": failed to get a valid response to BRIDGE-MIB request");
|
||||
$self->{macinfo}->{$switch}->{ErrorStr} = "Failed to get a valid response to BRIDGE-MIB request";
|
||||
return;
|
||||
}
|
||||
foreach my $boid (keys %$bridgetoifmap) {
|
||||
my $port_index = $boid;
|
||||
my $port_name = $namemap->{ $bridgetoifmap->{$port_index} };
|
||||
my $mtu = $iftomtumap->{ $bridgetoifmap->{$port_index} };
|
||||
if (defined($index_to_mac{$port_index})) {
|
||||
push @{ $self->{macinfo}->{$switch}->{$port_name} }, @{ $index_to_mac{$port_index} };
|
||||
}
|
||||
else {
|
||||
$self->{macinfo}->{$switch}->{$port_name}->[0] = '';
|
||||
}
|
||||
|
||||
if (defined($index_to_vlan{$port_index})) {
|
||||
push @{ $self->{vlaninfo}->{$switch}->{$port_name} }, @{ $index_to_vlan{$port_index} };
|
||||
}
|
||||
else {
|
||||
$self->{vlaninfo}->{$switch}->{$port_name}->[0] = '';
|
||||
}
|
||||
push @{ $self->{mtuinfo}->{$switch}->{$port_name} } , $mtu;
|
||||
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
# get port state
|
||||
my $mactostate = walkoid($session, '.1.3.6.1.2.1.17.7.1.2.2.1.3', silentfail => 1, verbose => $self->{show_verbose_info}, switch => $switch, callback => $self->{callback});
|
||||
|
||||
@@ -844,7 +901,6 @@ sub refresh_switch {
|
||||
}
|
||||
|
||||
my $vlan;
|
||||
my $iscisco = 0;
|
||||
foreach $vlan (sort keys %vlans_to_check) { #Sort, because if numbers, we want 1 first, because that vlan should not get communiy string indexed query
|
||||
unless (not $vlan or $vlan eq 'NA' or $vlan eq '1') { #don't subject users to the context pain unless needed
|
||||
$iscisco = 1;
|
||||
@@ -878,9 +934,22 @@ sub refresh_switch {
|
||||
}
|
||||
return;
|
||||
}
|
||||
my $bridgeifvalid = 0;
|
||||
foreach (keys %$mactoindexmap) {
|
||||
my $index = $mactoindexmap->{$_};
|
||||
if (defined($bridgetoifmap->{$index})) {
|
||||
$bridgeifvalid = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
unless ($bridgeifvalid) {
|
||||
# create a dummy bridgetoifmap to cover switches that thing it should go straight to ifindex
|
||||
$bridgetoifmap = {};
|
||||
foreach (keys %$namemap) {
|
||||
$bridgetoifmap->{$_} = $_;
|
||||
}
|
||||
}
|
||||
if (defined($self->{collect_mac_info})) {
|
||||
my %index_to_mac = ();
|
||||
my %index_to_vlan = ();
|
||||
foreach (keys %$mactoindexmap) {
|
||||
my $index = $mactoindexmap->{$_};
|
||||
my @tmp = split /\./, $_;
|
||||
|
||||
@@ -884,5 +884,28 @@ sub perf_log_process
|
||||
}
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------
|
||||
|
||||
=head3 report_node_error
|
||||
Using the passing callback to report node level error
|
||||
Arguments:
|
||||
$cb (callback reference)
|
||||
$node (node name)
|
||||
$msg (error message)
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
sub report_node_error
|
||||
{
|
||||
shift;
|
||||
my ($cb, $node, $msg) = @_;
|
||||
|
||||
my $rsp;
|
||||
$rsp->{node}->[0]->{name}->[0] = $node;
|
||||
$rsp->{node}->[0]->{error}->[0] = $msg;
|
||||
$rsp->{node}->[0]->{errorcode}->[0] = 1;
|
||||
$cb->($rsp);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
@@ -466,7 +466,7 @@ sub testkeys
|
||||
return 0;
|
||||
} else {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = $msg;
|
||||
$rsp->{error}->[0] = "Testing the ssh connection to $nodes failed:".$msg;
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
return 1;
|
||||
}
|
||||
@@ -598,7 +598,7 @@ sub sendnodeskeys
|
||||
$rc = 0;
|
||||
} else {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "mkdir:$node has error,$msg";
|
||||
$rsp->{error}->[0] = "Failed to run \"/bin/mkdir -p /tmp/$to_userid/.ssh\" on $node: $msg";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
$rc = 1;
|
||||
}
|
||||
@@ -686,7 +686,7 @@ sub sendnodeskeys
|
||||
$rc = 0;
|
||||
} else {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "copykeys:$node has error,$msg";
|
||||
$rsp->{error}->[0] = "Failed to copy ssh credentials and helper script to $node: $msg";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
$rc = 1;
|
||||
}
|
||||
@@ -715,7 +715,7 @@ sub sendnodeskeys
|
||||
|
||||
# command to run copy.sh
|
||||
my $spawnruncopy =
|
||||
"$remoteshell $node -l $to_userid /tmp/$to_userid/.ssh/copy.sh";
|
||||
"$remoteshell $node -l $to_userid /tmp/$to_userid/.ssh/copy.sh $to_userid";
|
||||
|
||||
# send mkdir command
|
||||
unless ($sendkeys->spawn($spawnruncopy))
|
||||
@@ -771,7 +771,7 @@ sub sendnodeskeys
|
||||
$rc = 0;
|
||||
} else {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "copy.sh:$node has error,$msg";
|
||||
$rsp->{error}->[0] = "Failed to apply the ssh keys on $node:$msg";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
$rc = 1;
|
||||
}
|
||||
|
||||
+41
-15
@@ -276,7 +276,7 @@ qq{ link,ro - The file is readonly, and will be placed in tmpfs on the booted no
|
||||
table_descr => 'Node storage resources',
|
||||
descriptions => {
|
||||
node => 'The node name',
|
||||
controller => 'The management address to attach/detach new volumes.
|
||||
controller => 'The management address to attach/detach new volumes.
|
||||
In the scenario involving multiple controllers, this data must be
|
||||
passed as argument rather than by table value',
|
||||
osvolume => "Specification of what storage to place the node OS image onto. Examples include:
|
||||
@@ -664,13 +664,13 @@ passed as argument rather than by table value',
|
||||
servicenode => 'A comma separated list of node names (as known by the management node) that provides most services for this node. The first service node on the list that is accessible will be used. The 2nd node on the list is generally considered to be the backup service node for this node when running commands like snmove.',
|
||||
netboot => 'The type of network booting to use for this node. Valid values:
|
||||
|
||||
Arch OS valid netboot options
|
||||
x86, x86_64 ALL pxe, xnba
|
||||
Arch OS valid netboot options
|
||||
x86, x86_64 ALL pxe, xnba
|
||||
ppc64 <=rhel6, <=sles11.3 yaboot
|
||||
ppc64 >=rhels7, >=sles11.4 grub2,grub2-http,grub2-tftp
|
||||
ppc64le NonVirtualize ALL petitboot
|
||||
ppc64le PowerKVM Guest ALL grub2,grub2-http,grub2-tftp
|
||||
|
||||
|
||||
',
|
||||
tftpserver => 'The TFTP server for this node (as known by this node). If not set, it defaults to networks.tftpserver.',
|
||||
tftpdir => 'The directory that roots this nodes contents from a tftp and related perspective. Used for NAS offload by using different mountpoints.',
|
||||
@@ -807,16 +807,16 @@ passed as argument rather than by table value',
|
||||
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:
|
||||
|
||||
IMG_ARCH(The architecture of the osimage, such as "ppc64le","x86_64"),
|
||||
IMG_NAME(The name of the osimage, such as "rhels7.3-ppc64le-netboot-compute"),
|
||||
IMG_OSVER(The os release of the osimage, such as "rhels7.3","sles11.4"),
|
||||
IMG_ARCH(The architecture of the osimage, such as "ppc64le","x86_64"),
|
||||
IMG_NAME(The name of the osimage, such as "rhels7.3-ppc64le-netboot-compute"),
|
||||
IMG_OSVER(The os release of the osimage, such as "rhels7.3","sles11.4"),
|
||||
IMG_KERNELVERSION(the "kernelver" attribute of the osimage),
|
||||
IMG_PROFILE(the profile of the osimage, such as "service","compute"),
|
||||
IMG_PKGLIST(the "pkglist" attribute of the osimage),
|
||||
IMG_PKGDIR(the "pkgdir" attribute of the osimage),
|
||||
IMG_OTHERPKGLIST(the "otherpkglist" attribute of the osimage),
|
||||
IMG_OTHERPKGDIR(the "otherpkgdir" attribute of the osimage),
|
||||
IMG_ROOTIMGDIR(the "rootimgdir" attribute of the osimage)',
|
||||
IMG_PROFILE(the profile of the osimage, such as "service","compute"),
|
||||
IMG_PKGLIST(the "pkglist" attribute of the osimage),
|
||||
IMG_PKGDIR(the "pkgdir" attribute of the osimage),
|
||||
IMG_OTHERPKGLIST(the "otherpkglist" attribute of the osimage),
|
||||
IMG_OTHERPKGDIR(the "otherpkgdir" attribute of the osimage),
|
||||
IMG_ROOTIMGDIR(the "rootimgdir" attribute of the osimage)',
|
||||
rootimgdir => 'The directory name where the image is stored. It is generally used for diskless image. it also can be used in sysclone environment to specify where the image captured from golden client is stored. in sysclone environment, rootimgdir is generally assigned to some default value by xcat, but you can specify your own store directory. just one thing need to be noticed, wherever you save the image, the name of last level directory must be the name of image. for example, if your image name is testimage and you want to save this image under home directoy, rootimgdir should be assigned to value /home/testimage/',
|
||||
kerneldir => 'The directory name where the 3rd-party kernel is stored. It is used for diskless image only.',
|
||||
nodebootif => 'The network interface the stateless/statelite node will boot over (e.g. eth0)',
|
||||
@@ -1069,7 +1069,7 @@ passed as argument rather than by table value',
|
||||
" nodes, use a simple comma-separated list of NICs. To specify different \n" .
|
||||
" NICs for different nodes, use the format: \"xcatmn|eth1,eth2;service|bond0\", \n" .
|
||||
" where xcatmn is the name of the management node, and DNS should listen on\n" .
|
||||
" the eth1 and eth2 interfaces. All the nods in group 'service' should \n" .
|
||||
" the eth1 and eth2 interfaces. All the nods in group 'service' should \n" .
|
||||
" listen on the 'bond0' interface.\n\n" .
|
||||
" NOTE: If using this attribute to block certain interfaces, make sure\n" .
|
||||
" the IP maps to your hostname of xCAT MN is not blocked since xCAT needs\n" .
|
||||
@@ -1504,8 +1504,30 @@ passed as argument rather than by table value',
|
||||
},
|
||||
},
|
||||
|
||||
zvmivp => {
|
||||
cols => [qw(id ip schedule last_run type_of_run access_user orch_parms prep_parms main_ivp_parms comments disable)],
|
||||
keys => [qw(id)],
|
||||
table_desc => 'List of z/VM Installation Verification Procedures (IVPs) to be periodically run.',
|
||||
descriptions => {
|
||||
id => 'Unique identifier associated with the IVP run, e.g. 1.',
|
||||
ip => 'IP address of the target system, either the IP of the OpenStack compute node or the xCAT management node.',
|
||||
schedule => 'The hours (0-24) that the IVP should be run. Multiple hours are separated by a blank.',
|
||||
last_run => 'The last time the IVP was run specified as a set of 3 blank delimeted words: year, Julian date, and hour (in 24 hour format).',
|
||||
type_of_run => 'The type of run requested, \'fullivp\' or \'basicivp\'.',
|
||||
access_user => 'User on the OpenStack node that is used to: push the IVP preparation script to the OpenStack system, '.
|
||||
'drive the preparation script to validate the OpenStack configuration files, and return the created '.
|
||||
'driver script to the xCAT MN system for the next part of the IVP. This user should be '.
|
||||
'able to access the OpenStack configuration files that are scanned by the IVP.',
|
||||
orch_parms => 'Parameters to pass to the IVP orchestrator script, verifynode.',
|
||||
prep_parms => 'Parameters to pass to the phase 1 IVP preparation script.',
|
||||
main_ivp_parms => 'Parameters to pass to the main IVP script.',
|
||||
comments => 'Any user provided notes or description of the run.',
|
||||
disable => "Set to 'yes' or '1' to disable this IVP run.",
|
||||
},
|
||||
},
|
||||
|
||||
zvm => {
|
||||
cols => [qw(node hcp userid nodetype parent comments disable)],
|
||||
cols => [qw(node hcp userid nodetype parent comments disable discovered status)],
|
||||
keys => [qw(node)],
|
||||
table_desc => 'List of z/VM virtual servers.',
|
||||
descriptions => {
|
||||
@@ -1516,6 +1538,8 @@ passed as argument rather than by table value',
|
||||
parent => 'The parent node. For LPAR, this specifies the CEC. For z/VM, this specifies the LPAR. For VM, this specifies the z/VM host operating system.',
|
||||
comments => 'Any user provided notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
discovered => "Set to '1' to indicate this node was discovered.",
|
||||
status => "The processing status. Key value pairs (key=value) indicating status of the node. Multiple pairs are separated by semi-colons. Keys include: CLONING, CLONE_ONLY.",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1551,6 +1575,7 @@ passed as argument rather than by table value',
|
||||
If multiple ip addresses are associated with each NIC:
|
||||
<nic1>!<ext1>|<ext2>,<nic2>!<ext1>|<ext2>,..., for example, eth0!-eth0|-eth0-ipv6,ib0!-ib0|-ib0-ipv6.
|
||||
The xCAT object definition commands support to use nichostnamesuffixes.<nicname> as the sub attributes.
|
||||
|
||||
Note: According to DNS rules a hostname must be a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9) and minus sign (-). When you are specifying "nichostnamesuffixes" or "nicaliases" make sure the resulting hostnames will conform to this naming convention',
|
||||
nichostnameprefixes => 'Comma-separated list of hostname prefixes per NIC.
|
||||
If only one ip address is associated with each NIC:
|
||||
@@ -1869,6 +1894,7 @@ foreach my $tabname (keys(%xCAT::ExtTab::ext_tabspec)) {
|
||||
osdistro => { attrs => [], attrhash => {}, objkey => 'osdistroname' },
|
||||
osdistroupdate => { attrs => [], attrhash => {}, objkey => 'osupdatename' },
|
||||
zone => { attrs => [], attrhash => {}, objkey => 'zonename' },
|
||||
zvmivp => { attrs => [], attrhash => {}, objkey => 'id' },
|
||||
firmware => { attrs => [], attrhash => {}, objkey => 'cfgfile' },
|
||||
taskstate => { attrs => [], attrhash => {}, objkey => 'node' },
|
||||
pdu => { attrs => [], attrhash => {}, objkey => 'node' },
|
||||
|
||||
@@ -145,7 +145,7 @@ my %usage = (
|
||||
rspconfig <noderange> [garp=<number of 1/2 second>]
|
||||
rspconfig <noderange> [userid=<userid> username=<username> password=<password>]
|
||||
OpenBMC specific:
|
||||
rspconfig <noderange> [ip|netmask|gateway|hostname|vlan]
|
||||
rspconfig <noderange> [ipsrc|ip|netmask|gateway|hostname|vlan]
|
||||
iDataplex specific:
|
||||
rspconfig <noderange> [thermprofile]
|
||||
rspconfig <noderange> [thermprofile=<two digit number from chassis>]
|
||||
@@ -250,13 +250,16 @@ my %usage = (
|
||||
lsvm <noderange> [-a|--all]
|
||||
PPC (using Direct FSP Management) specific:
|
||||
lsvm <noderange> [-l|--long] --p775
|
||||
lsvm <noderange>
|
||||
lsvm <noderange>
|
||||
zVM specific:
|
||||
lsvm noderange
|
||||
lsvm noderange --getnetworknames
|
||||
lsvm noderange --getnetwork network_name
|
||||
lsvm noderange --diskpoolnames
|
||||
lsvm noderange --diskpool pool_name",
|
||||
lsvm noderange --diskpool pool_name
|
||||
lsvm noderange --queryalldisks
|
||||
lsvm noderange --querypagevolumes
|
||||
lsvm noderange --queryspoolvolumes",
|
||||
"chvm" =>
|
||||
"Usage:
|
||||
Common:
|
||||
@@ -270,7 +273,7 @@ my %usage = (
|
||||
chvm <noderange> [lparname=<*|name>]
|
||||
chvm <noderange> [vmcpus=min/req/max] [vmmemory=min/req/max]
|
||||
[vmothersetting=hugepage:N,bsr:N]
|
||||
[add_physlots=drc_index1,drc_index2...]
|
||||
[add_physlots=drc_index1,drc_index2...]
|
||||
[add_vmnics=vlan1,vlan2] [add_vmstorage=<N|viosnode:slotid>] [--vios]
|
||||
chvm <noderange> [del_physlots=drc_index1,drc_index2...]
|
||||
chvm <noderange> [del_vadapter=slotid]
|
||||
@@ -328,7 +331,7 @@ my %usage = (
|
||||
pdudiscover [<noderange>|--range ipranges] [-r|-x|-z] [-w] [-V|--verbose] [--setup]",
|
||||
"switchdiscover" =>
|
||||
"Usage: switchdiscover [-h|--help|-v|--version]
|
||||
switchdiscover [<noderange>|--range ipranges] [-s scan_methods] [-r|-x|-z] [-w] [-V|--verbose] [--setup]",
|
||||
switchdiscover [<noderange>|--range ipranges] [-s scan_methods] [-c community] [-r|-x|-z] [-w] [-V|--verbose] [--setup]",
|
||||
"switchprobe" =>
|
||||
"Usage: switchprobe [<noderange>] [-V|--verbose | -c|--check]",
|
||||
"makentp" =>
|
||||
@@ -448,7 +451,7 @@ Options:
|
||||
[-f|--snsync] Performs File Syncing to the service nodes that service
|
||||
the nodes in the noderange.
|
||||
|
||||
[-g|--genmypost] Will generate a new mypostscript file for the
|
||||
[-g|--genmypost] Will generate a new mypostscript file for the
|
||||
the nodes in the noderange, if site precreatemypostscripts is 1 or YES.
|
||||
|
||||
[-l|--user] User name to run the updatenode command. It overrides the
|
||||
|
||||
@@ -2294,11 +2294,19 @@ sub osver
|
||||
$os = $id_like;
|
||||
}
|
||||
|
||||
if (!$os ) {
|
||||
$os = "unknown";
|
||||
}
|
||||
|
||||
$verrel = $version;
|
||||
if (!$verrel and $version_id) {
|
||||
$verrel = $version_id;
|
||||
}
|
||||
|
||||
if (!$verrel ) {
|
||||
$verrel = "unknown";
|
||||
}
|
||||
|
||||
|
||||
if (!$name and $prettyname) {
|
||||
$name = $prettyname;
|
||||
|
||||
+604
-143
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+2689
-517
File diff suppressed because it is too large
Load Diff
+557
-559
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,336 @@
|
||||
/**
|
||||
* Load the files page
|
||||
*/
|
||||
function loadFilesPage() {
|
||||
var tabId = 'filesTab';
|
||||
$('#' + tabId).empty();
|
||||
|
||||
// Set padding for page
|
||||
$('#' + tabId).css('padding', '10px 30px');
|
||||
|
||||
// Create info bar
|
||||
var info = $('#' + tabId).find('.ui-state-highlight');
|
||||
// If there is no info bar
|
||||
if (!info.length) {
|
||||
var infoBar = createInfoBar('Below is a listing of the xCAT repository. ' +
|
||||
'Upload any file or package into the repository using the Upload button. ' +
|
||||
'Go into any subdirectories by specifying the directory path and clicking on Go.');
|
||||
|
||||
var directoryFS = $('<fieldset></fieldset>');
|
||||
var dirLegend = $('<legend>Directory</legend>');
|
||||
directoryFS.append(dirLegend);
|
||||
|
||||
// Division to hold directory actions
|
||||
var actions = $('<div></div>');
|
||||
directoryFS.append(actions);
|
||||
|
||||
// Create button to create a directory
|
||||
var folderBtn = createButton('New folder');
|
||||
folderBtn.click(function() {
|
||||
var deleteFolderBtn = $('<span class="ui-icon ui-icon-close" style="margin-left:10px; margin-right:10px;"></span>');
|
||||
var createFolderBtn = createButton('Create');
|
||||
|
||||
// Create a new directory
|
||||
var newFolder = $('<li><span class="ui-icon ui-icon-folder-collapsed" style="margin-right: 10px;"></span><input type="text" name="new_folder"/></li>');
|
||||
newFolder.prepend(deleteFolderBtn);
|
||||
newFolder.append(createFolderBtn);
|
||||
$('#repo_content ul').append(newFolder);
|
||||
|
||||
// Delete new folder on-click
|
||||
deleteFolderBtn.click(function() {
|
||||
$(this).parents('li').remove();
|
||||
});
|
||||
|
||||
// Create folder on-click
|
||||
createFolderBtn.click(function() {
|
||||
var directory = $('#' + tabId + ' input[name="repo_directory"]');
|
||||
var newFolderPath = $('#' + tabId + ' input[name="new_folder"]').val();
|
||||
if (newFolderPath) {
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'createfolder;' + directory.val() + '/' + newFolderPath,
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success:function(data) {
|
||||
data = decodeRsp(data);
|
||||
openDialog('info', data.rsp[0]);
|
||||
}
|
||||
});
|
||||
|
||||
$(this).parents('li').remove();
|
||||
} else {
|
||||
openDialog('warn', 'You must specify the folder name');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Create button to upload files
|
||||
var uploadBtn = createButton('Upload');
|
||||
uploadBtn.click(function() {
|
||||
var directory = $('#' + tabId + ' input[name="repo_directory"]');
|
||||
openUploadDialog(directory.val());
|
||||
});
|
||||
|
||||
// Create button to go into a directory path
|
||||
var dirPath = $('<input type="text" name="repo_directory" style="width:400px;"/>');
|
||||
var goBtn = createButton('Go');
|
||||
goBtn.click(function() {
|
||||
var directory = $('#' + tabId + ' input[name="repo_directory"]');
|
||||
loadPath(directory.val());
|
||||
});
|
||||
goBtn.attr('id', 'go_to_path');
|
||||
|
||||
var space = $('<div id="repo_space"></div>');
|
||||
var content = $('<div id="repo_content" class="form"></div>');
|
||||
actions.append(folderBtn, uploadBtn, dirPath, goBtn);
|
||||
directoryFS.append(space, content);
|
||||
|
||||
$('#' + tabId).append(infoBar, directoryFS);
|
||||
}
|
||||
|
||||
// Retrieve repository space
|
||||
getRepositorySpace();
|
||||
|
||||
// Retrieve files from /install
|
||||
loadPath('/install');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the repository space
|
||||
*/
|
||||
function getRepositorySpace() {
|
||||
// Grab repository space
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
async: false,
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'getrepospace',
|
||||
msg : ''
|
||||
},
|
||||
success: function(data) {
|
||||
data = decodeRsp(data);
|
||||
$('#repo_space').children().remove();
|
||||
|
||||
// Data returned is: size, used, available, used %, mount
|
||||
// Data could be in a different format in CMO, where it puts the directory on the line
|
||||
// "rsp":["\/data\/xcat\/install 28G 6.0G 20G 24% \/install"],"msg":null}
|
||||
var space = data.rsp[0].split(' ');
|
||||
if (space.length == 6) {
|
||||
space.splice(0,1);
|
||||
}
|
||||
var spaceLabel = $('<label style="margin:10px;width:300px;"><b>Total size: </b>' + space[0] +
|
||||
'<b> | Available: </b>' + space[2] +
|
||||
'</label>');
|
||||
$('#repo_space').append(spaceLabel);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a dialog to upload files into the repository
|
||||
*
|
||||
* @param destDirectory The destination directory
|
||||
*/
|
||||
function openUploadDialog(destDirectory) {
|
||||
// Create info bar
|
||||
var info = createInfoBar('Select a file to upload onto ' + destDirectory + '.');
|
||||
var dialog = $('<div id="upload_file_dg"></div>');
|
||||
dialog.append(info);
|
||||
|
||||
// Upload file
|
||||
var upload = $('<form id="upload_file" enctype="multipart/form-data"></form>');
|
||||
var label = $('<label style="margin-right: 10px;">Remote file:</label>');
|
||||
var file = $('<input type="file" name="file" id="file"/>');
|
||||
var subBtn = createButton('Upload');
|
||||
upload.append(label, file, subBtn);
|
||||
dialog.append(upload);
|
||||
|
||||
upload.submit(function() {
|
||||
// Create status bar, hide on load
|
||||
var statBarId = 'uploadStatusBar';
|
||||
var statBar = createStatusBar(statBarId);
|
||||
var loader = createLoader('');
|
||||
statBar.find('div').append('Do not close this dialog while the file is being uploaded ');
|
||||
statBar.find('div').append(loader);
|
||||
statBar.prependTo($('#upload_file_dg'));
|
||||
|
||||
var data = new FormData($('#upload_file')[0]);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url : 'lib/uploadfile.php?destination=' + destDirectory,
|
||||
data: data,
|
||||
success: function(data) {
|
||||
$('#uploadStatusBar').find('img').hide();
|
||||
$('#uploadStatusBar').find('div').empty();
|
||||
$('#uploadStatusBar').find('div').append(data);
|
||||
|
||||
// Refresh directory contents
|
||||
$('#go_to_path').click();
|
||||
getRepositorySpace();
|
||||
},
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// Create dialog
|
||||
dialog.dialog({
|
||||
modal: true,
|
||||
title: 'Upload',
|
||||
width: 500,
|
||||
close: function() {$(this).remove();}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the directory path structure
|
||||
*
|
||||
* @path The directory path
|
||||
*/
|
||||
function loadPath(path) {
|
||||
// Limit access to only /install
|
||||
if (path.substring(0, 9).indexOf("install") == -1) {
|
||||
openDialog('warn', 'You are not authorized to browse outside the repository');
|
||||
return;
|
||||
}
|
||||
|
||||
var tabId = 'filesTab';
|
||||
var directory = $('#' + tabId + ' input[name="repo_directory"]');
|
||||
directory.val(path);
|
||||
|
||||
// Un-ordered list containing directories and files
|
||||
var contentId = 'repo_content';
|
||||
$('#' + contentId).empty();
|
||||
var itemsList = $('<ul></ul>');
|
||||
$('#' + contentId).append(itemsList);
|
||||
|
||||
// Back button to go up a directory
|
||||
var item = $('<li><span class="ui-icon ui-icon-folder-collapsed" style="margin-right: 10px;"></span>..</li>');
|
||||
itemsList.append(item);
|
||||
item.dblclick(function() {
|
||||
if (path.lastIndexOf('/') > 1)
|
||||
path = path.substring(0, path.lastIndexOf('/'));
|
||||
loadPath(path);
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url : 'lib/getpath.php',
|
||||
dataType : 'json',
|
||||
data: {
|
||||
action: 'browse',
|
||||
path: path,
|
||||
time: new Date().getTime()
|
||||
},
|
||||
beforeSend: function() {
|
||||
// Show loading image
|
||||
},
|
||||
success: function(files) {
|
||||
$.each(files, function(index, file) {
|
||||
if (!file.path || file.path.indexOf("undefined"))
|
||||
file.path = "";
|
||||
|
||||
var fullPath = file.path + "/" + file.name;
|
||||
|
||||
// Create a list showing the directories and files
|
||||
var item;
|
||||
if (file.isFolder) {
|
||||
var deleteFolderBtn = $('<span class="ui-icon ui-icon-close" style="margin-left:10px; margin-right:10px;"></span>');
|
||||
|
||||
item = $('<li><span class="ui-icon ui-icon-folder-collapsed" style="margin-right: 10px;"></span>' + file.name + '</li>');
|
||||
item.prepend(deleteFolderBtn);
|
||||
itemsList.append(item);
|
||||
item.dblclick(function() {
|
||||
loadPath(directory.val() + fullPath);
|
||||
});
|
||||
|
||||
// Delete file on click
|
||||
deleteFolderBtn.click(function() {
|
||||
deleteFile($(this).parents('li'), directory.val() + fullPath);
|
||||
});
|
||||
} else {
|
||||
var icon = $('<span class="ui-icon ui-icon-document" style="margin-right: 10px;"></span>');
|
||||
var deleteFileBtn = $('<span class="ui-icon ui-icon-close" style="margin-left:10px; margin-right:10px;"></span>');
|
||||
|
||||
item = $('<li><a href="' + directory.val() + fullPath + '">' + file.name + '</a></li>');
|
||||
item.append(deleteFileBtn, icon);
|
||||
|
||||
// Delete file on click
|
||||
deleteFileBtn.click(function() {
|
||||
deleteFile($(this).parents('li'), directory.val() + fullPath);
|
||||
});
|
||||
|
||||
itemsList.append(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompt user to confirm deletion of file
|
||||
*
|
||||
* @param container The element container
|
||||
* @param file The file name to delete
|
||||
*/
|
||||
function deleteFile(container, file) {
|
||||
// Open dialog to confirm
|
||||
var confirmDialog = $('<div id="confirm_delete"></div>');
|
||||
var warn = createWarnBar('Are you sure you want to delete ' + file + '?');
|
||||
confirmDialog.append(warn);
|
||||
confirmDialog.dialog({
|
||||
title: "Confirm",
|
||||
modal: true,
|
||||
width: 400,
|
||||
close: function() {$(this).remove();},
|
||||
buttons: {
|
||||
"Ok": function() {
|
||||
var loader = createLoader('').css({'margin': '5px'});
|
||||
$(this).append(loader);
|
||||
|
||||
// Change dialog buttons
|
||||
$(this).dialog('option', 'buttons', {
|
||||
'Close':function() {
|
||||
$(this).dialog('destroy').remove();
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
async: false,
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'deletefile;' + file,
|
||||
msg : ''
|
||||
},
|
||||
success: function(data) {
|
||||
data = decodeRsp(data);
|
||||
$('#confirm_delete').children().remove();
|
||||
var info = createInfoBar(data.rsp[0]);
|
||||
$('#confirm_delete').append(info);
|
||||
getRepositorySpace();
|
||||
}
|
||||
});
|
||||
|
||||
// Delete folder from the list
|
||||
container.remove();
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog('destroy').remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
+1313
-1279
File diff suppressed because it is too large
Load Diff
+321
-309
@@ -1,310 +1,322 @@
|
||||
/**
|
||||
* Load update page
|
||||
*/
|
||||
function loadUpdatePage() {
|
||||
var repositoryDiv = $('<div id="repository"></div>');
|
||||
var rpmDiv = $('<div id="rpm"></div>');
|
||||
var statusDiv = createStatusBar("update");
|
||||
statusDiv.hide();
|
||||
|
||||
$('#updateTab').append(statusDiv);
|
||||
$('#updateTab').append(repositoryDiv);
|
||||
$('#updateTab').append(rpmDiv);
|
||||
|
||||
var infoBar = createInfoBar('Select the repository to use and the RPMs to update, then click Update.');
|
||||
repositoryDiv.append(infoBar);
|
||||
|
||||
repositoryDiv.append("<fieldset><legend>Repository</legend></fieldset>");
|
||||
$.ajax( {
|
||||
url : 'lib/systemcmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'ostype'
|
||||
},
|
||||
|
||||
success : showRepository
|
||||
});
|
||||
|
||||
rpmDiv.append("<fieldset></fieldset>");
|
||||
$.ajax( {
|
||||
url : 'lib/systemcmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rpm -q xCAT-client perl-xCAT xCAT-server xCAT xCAT-rmc xCAT-UI'
|
||||
},
|
||||
|
||||
success : showRpmInfo
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the RPM repository (it can use the user's last choice and input)
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function showRepository(data) {
|
||||
var develRepository = "";
|
||||
var stableRepository = "";
|
||||
var show = "";
|
||||
|
||||
// Get the corresponding repository by OS Type
|
||||
if (data.rsp == "aix") {
|
||||
// No repository exists for AIX on Sourceforge!
|
||||
develRepository = "http://xcat.sourceforge.net/aix/devel/xcat-core/";
|
||||
stableRepository = "http://xcat.sourceforge.net/aix/xcat-core/";
|
||||
} else {
|
||||
develRepository = "http://sourceforge.net/projects/xcat/files/yum/devel/xcat-core/";
|
||||
stableRepository = "http://sourceforge.net/projects/xcat/files/yum/stable/xcat-core/";
|
||||
}
|
||||
|
||||
var repoList = $('<ol></ol>');
|
||||
|
||||
// Display the Devel Repository, remember user's last selection
|
||||
show = show + "<li><input type='radio' ";
|
||||
if ($.cookie('xcat_repository') == 1) {
|
||||
show = show + "checked='true'";
|
||||
}
|
||||
show = show + "name='reporadio' value='" + develRepository + "'>";
|
||||
show = show + "<strong>Development</strong>: " + develRepository + "</li>";
|
||||
repoList.append(show);
|
||||
|
||||
// Display the Stable Repository, remember user's last selection
|
||||
show = "<li><input type='radio' ";
|
||||
if ($.cookie('xcat_repository') == 2) {
|
||||
show = show + "checked='true'";
|
||||
}
|
||||
show = show + "name='reporadio' value='" + stableRepository + "' checked='true'>";
|
||||
show = show + "<strong>Stable</strong>: " + stableRepository + "</li>";
|
||||
repoList.append(show);
|
||||
|
||||
// Display the Input Repository, remember user's last selection
|
||||
if (($.cookie('xcat_repository')) && ($.cookie('xcat_repository') != 1)
|
||||
&& ($.cookie('xcat_repository') != 2)) {
|
||||
show = "<li><input type='radio' checked='true' name='reporadio' value=''>Other: ";
|
||||
show += "<input style='width: 500px' id='repositoryaddr' value='"
|
||||
+ $.cookie('xcat_repository') + "'</li>";
|
||||
} else {
|
||||
show = "<li><input type='radio' name='reporadio' value=''>Other: ";
|
||||
show += "<input style='width: 500px' id='repositoryaddr' value=''</li>";
|
||||
}
|
||||
repoList.append(show);
|
||||
|
||||
$('#repository fieldset').append(repoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all xCAT RPMs
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function showRpmInfo(data) {
|
||||
var rpms = null;
|
||||
var show = "";
|
||||
var rpmNames = new Array("xCAT-client", "perl-xCAT", "xCAT-server", "xCAT", "xCAT-rmc",
|
||||
"xCAT-UI");
|
||||
var temp = 0;
|
||||
if (null == data.rsp) {
|
||||
$('#rpm fieldset').append("Error getting RPMs!");
|
||||
return;
|
||||
}
|
||||
|
||||
rpms = data.rsp.split(/\n/);
|
||||
|
||||
// No rpm installed, return
|
||||
if (1 > rpms.length) {
|
||||
$('#rpm fieldset').append("No RPMs installed!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear the old data
|
||||
$('#rpm fieldset').children().remove();
|
||||
$('#rpm fieldset').append("<legend>xCAT RPMs</legend>");
|
||||
show = "<table id=rpmtable >";
|
||||
show += "<thead class='ui-widget-header'><tr>";
|
||||
show += "<th><input type='checkbox' id='selectall' value='' onclick='updateSelectAll()'></th>";
|
||||
show += "<th><b>Package Name</b></th><th><b>Version</b></th>";
|
||||
show += "</tr></thead>";
|
||||
for (temp = 0; temp < rpms.length; temp++) {
|
||||
// Empty line continue
|
||||
if (!rpms[temp]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// The RPM is not installed, continue
|
||||
if (rpms[temp].indexOf("not") != -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Show the version in table
|
||||
show += "<tr>";
|
||||
show += "<td><input type='checkbox' value='" + rpmNames[temp] + "'></td>";
|
||||
show += "<td>" + rpmNames[temp] + "</td><td>"
|
||||
+ rpms[temp].substr(rpmNames[temp].length + 1) + "</td>";
|
||||
show += "</tr>";
|
||||
}
|
||||
show += "</table>";
|
||||
show += "<br\>";
|
||||
$('#rpm fieldset').append(show);
|
||||
|
||||
// Add the update button
|
||||
var updateButton = createButton('Update');
|
||||
$('#rpm fieldset').append(updateButton);
|
||||
updateButton.bind('click', function() {
|
||||
updateRpm();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Select all checkboxes
|
||||
*/
|
||||
function updateSelectAll() {
|
||||
var check_status = $('#selectall').attr('checked');
|
||||
$('input:checkbox').attr('checked', check_status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update selected xCAT RPMs
|
||||
*/
|
||||
function updateRpm() {
|
||||
// Remove any warning messages
|
||||
$('#updateTab').find('.ui-state-error').remove();
|
||||
|
||||
var rpmPath = $('input[type=radio]:checked').val();
|
||||
var rpmPathType = "0";
|
||||
var rpms = "";
|
||||
var temp = "";
|
||||
|
||||
if (undefined == rpmPath) {
|
||||
rpmPath = "";
|
||||
}
|
||||
|
||||
// Select other and we should use the value in the input
|
||||
if ("" == rpmPath) {
|
||||
// Store repo in a cookie
|
||||
rpmPath = $('#repositoryaddr').val();
|
||||
rpmPathType = rpmPath;
|
||||
} else {
|
||||
if (-1 == rpmPath.toLowerCase().indexOf("devel")) {
|
||||
rpmPathType = "2";
|
||||
} else {
|
||||
rpmPathType = "1";
|
||||
}
|
||||
}
|
||||
|
||||
$("input[type=checkbox]:checked").each(function() {
|
||||
temp = $(this).val();
|
||||
if ("" == temp) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var pattern = new RegExp("^" + temp + ",|," + temp + ",");
|
||||
if (pattern.test(rpms)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
rpms = rpms + temp + ",";
|
||||
});
|
||||
|
||||
if (0 < rpms.length) {
|
||||
rpms = rpms.slice(0, -1);
|
||||
}
|
||||
|
||||
// Check RPM and repository
|
||||
var errMsg = '';
|
||||
if (!rpms) {
|
||||
errMsg = "Please select an RPM!<br>";
|
||||
}
|
||||
|
||||
if (!rpmPath) {
|
||||
errMsg += "Please select or specify a repository!";
|
||||
}
|
||||
|
||||
if (!rpms || !rpmPath) {
|
||||
// Show warning message
|
||||
var warn = createWarnBar(errMsg);
|
||||
warn.prependTo($('#updateTab'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Remember users' choice and input
|
||||
$.cookie('xcat_repository', rpmPathType, {
|
||||
path : '/xcat',
|
||||
secure : true,
|
||||
expires : 10
|
||||
});
|
||||
|
||||
$('#update').show();
|
||||
$('#update div').empty();
|
||||
$('#update div').append("<p>Updating <b>" + rpms + "</b> from <b>" + rpmPath + "</b></p>");
|
||||
$('#update div').append("<img id='loadingpic' src='images/loader.gif'>");
|
||||
$('#rpm button').attr('disabled', 'true');
|
||||
|
||||
// Send the update command to server
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'update;' + rpms + ";" + rpmPath,
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : showUpdateResult
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the results of the RPM update
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function showUpdateResult(data) {
|
||||
var temp = 0;
|
||||
$('#loadingpic').remove();
|
||||
|
||||
var resArray = data.rsp[0].split(/\n/);
|
||||
if (0 < resArray.length) {
|
||||
// Show last lines
|
||||
if (('' == resArray[resArray.length - 1]) && (resArray.length > 1)) {
|
||||
$('#update div').append('<pre>' + resArray[resArray.length - 2] + '</pre>');
|
||||
} else {
|
||||
$('#update div').append('<pre>' + resArray[resArray.length - 1] + '</pre>');
|
||||
}
|
||||
|
||||
// Create link to show details
|
||||
$('#update div').append('<br/><a>Show details</a>');
|
||||
$('#update div a').css( {
|
||||
'color' : '#0000FF',
|
||||
'cursor' : 'pointer'
|
||||
}).bind('click', function() {
|
||||
// Toggle details and change text
|
||||
$('#resDetail').toggle();
|
||||
if ($('#update div a').text() == 'Show details') {
|
||||
$('#update div a').text('Hide details');
|
||||
} else {
|
||||
$('#update div a').text('Show details');
|
||||
}
|
||||
});
|
||||
|
||||
var resDetail = $('<pre id="resDetail"></pre>');
|
||||
resDetail.hide();
|
||||
$('#update div').append(resDetail);
|
||||
for (temp = 0; temp < resArray.length; temp++) {
|
||||
resDetail.append(resArray[temp] + '<br/>');
|
||||
}
|
||||
}
|
||||
|
||||
// Update the rpm info
|
||||
$.ajax( {
|
||||
url : 'lib/systemcmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rpm -q xCAT-client perl-xCAT xCAT-server xCAT xCAT-rmc xCAT-UI'
|
||||
},
|
||||
|
||||
success : showRpmInfo
|
||||
});
|
||||
|
||||
$('#rpm button').attr('disabled', '');
|
||||
/**
|
||||
* Load update page
|
||||
*/
|
||||
function loadUpdatePage() {
|
||||
var repositoryDiv = $('<div id="repository"></div>');
|
||||
var rpmDiv = $('<div id="rpm"></div>');
|
||||
var statusDiv = createStatusBar("update");
|
||||
statusDiv.hide();
|
||||
|
||||
$('#updateTab').append(statusDiv);
|
||||
$('#updateTab').append(repositoryDiv);
|
||||
$('#updateTab').append(rpmDiv);
|
||||
|
||||
var infoBar = createInfoBar('Select the repository to use and the RPMs to update, then click Update.');
|
||||
repositoryDiv.append(infoBar);
|
||||
|
||||
repositoryDiv.append("<fieldset><legend>Repository</legend></fieldset>");
|
||||
$.ajax( {
|
||||
url : 'lib/systemcmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'ostype'
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
data = decodeRsp(data);
|
||||
showRepository(data);
|
||||
}
|
||||
});
|
||||
|
||||
rpmDiv.append("<fieldset></fieldset>");
|
||||
$.ajax( {
|
||||
url : 'lib/systemcmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rpm -q xCAT-client perl-xCAT xCAT-server xCAT xCAT-rmc xCAT-UI'
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
data = decodeRsp(data);
|
||||
showRpmInfo(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the RPM repository (it can use the user's last choice and input)
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function showRepository(data) {
|
||||
var develRepository = "";
|
||||
var stableRepository = "";
|
||||
var show = "";
|
||||
|
||||
// Get the corresponding repository by OS Type
|
||||
if (data.rsp == "aix") {
|
||||
// No repository exists for AIX on Sourceforge!
|
||||
develRepository = "http://xcat.sourceforge.net/aix/devel/xcat-core/";
|
||||
stableRepository = "http://xcat.sourceforge.net/aix/xcat-core/";
|
||||
} else {
|
||||
develRepository = "http://sourceforge.net/projects/xcat/files/yum/devel/xcat-core/";
|
||||
stableRepository = "http://sourceforge.net/projects/xcat/files/yum/stable/xcat-core/";
|
||||
}
|
||||
|
||||
var repoList = $('<ol></ol>');
|
||||
|
||||
// Display the Devel Repository, remember user's last selection
|
||||
show = show + "<li><input type='radio' ";
|
||||
if ($.cookie('xcat_repository') == 1) {
|
||||
show = show + "checked='true'";
|
||||
}
|
||||
show = show + "name='reporadio' value='" + develRepository + "'>";
|
||||
show = show + "<strong>Development</strong>: " + develRepository + "</li>";
|
||||
repoList.append(show);
|
||||
|
||||
// Display the Stable Repository, remember user's last selection
|
||||
show = "<li><input type='radio' ";
|
||||
if ($.cookie('xcat_repository') == 2) {
|
||||
show = show + "checked='true'";
|
||||
}
|
||||
show = show + "name='reporadio' value='" + stableRepository + "' checked='true'>";
|
||||
show = show + "<strong>Stable</strong>: " + stableRepository + "</li>";
|
||||
repoList.append(show);
|
||||
|
||||
// Display the Input Repository, remember user's last selection
|
||||
if (($.cookie('xcat_repository')) && ($.cookie('xcat_repository') != 1)
|
||||
&& ($.cookie('xcat_repository') != 2)) {
|
||||
show = "<li><input type='radio' checked='true' name='reporadio' value=''>Other: ";
|
||||
show += "<input style='width: 500px' id='repositoryaddr' value='"
|
||||
+ $.cookie('xcat_repository') + "'</li>";
|
||||
} else {
|
||||
show = "<li><input type='radio' name='reporadio' value=''>Other: ";
|
||||
show += "<input style='width: 500px' id='repositoryaddr' value=''</li>";
|
||||
}
|
||||
repoList.append(show);
|
||||
|
||||
$('#repository fieldset').append(repoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all xCAT RPMs
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function showRpmInfo(data) {
|
||||
var rpms = null;
|
||||
var show = "";
|
||||
var rpmNames = new Array("xCAT-client", "perl-xCAT", "xCAT-server", "xCAT", "xCAT-rmc",
|
||||
"xCAT-UI");
|
||||
var temp = 0;
|
||||
if (null == data.rsp) {
|
||||
$('#rpm fieldset').append("Error getting RPMs!");
|
||||
return;
|
||||
}
|
||||
|
||||
rpms = data.rsp.split(/\n/);
|
||||
|
||||
// No rpm installed, return
|
||||
if (1 > rpms.length) {
|
||||
$('#rpm fieldset').append("No RPMs installed!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear the old data
|
||||
$('#rpm fieldset').children().remove();
|
||||
$('#rpm fieldset').append("<legend>xCAT RPMs</legend>");
|
||||
show = "<table id=rpmtable >";
|
||||
show += "<thead class='ui-widget-header'><tr>";
|
||||
show += "<th><input type='checkbox' id='selectall' value='' onclick='updateSelectAll()'></th>";
|
||||
show += "<th><b>Package Name</b></th><th><b>Version</b></th>";
|
||||
show += "</tr></thead>";
|
||||
for (temp = 0; temp < rpms.length; temp++) {
|
||||
// Empty line continue
|
||||
if (!rpms[temp]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// The RPM is not installed, continue
|
||||
if (rpms[temp].indexOf("not") != -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Show the version in table
|
||||
show += "<tr>";
|
||||
show += "<td><input type='checkbox' value='" + rpmNames[temp] + "'></td>";
|
||||
show += "<td>" + rpmNames[temp] + "</td><td>"
|
||||
+ rpms[temp].substr(rpmNames[temp].length + 1) + "</td>";
|
||||
show += "</tr>";
|
||||
}
|
||||
show += "</table>";
|
||||
show += "<br\>";
|
||||
$('#rpm fieldset').append(show);
|
||||
|
||||
// Add the update button
|
||||
var updateButton = createButton('Update');
|
||||
$('#rpm fieldset').append(updateButton);
|
||||
updateButton.bind('click', function() {
|
||||
updateRpm();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Select all checkboxes
|
||||
*/
|
||||
function updateSelectAll() {
|
||||
var check_status = $('#selectall').attr('checked');
|
||||
$('input:checkbox').attr('checked', check_status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update selected xCAT RPMs
|
||||
*/
|
||||
function updateRpm() {
|
||||
// Remove any warning messages
|
||||
$('#updateTab').find('.ui-state-error').remove();
|
||||
|
||||
var rpmPath = $('input[type=radio]:checked').val();
|
||||
var rpmPathType = "0";
|
||||
var rpms = "";
|
||||
var temp = "";
|
||||
|
||||
if (undefined == rpmPath) {
|
||||
rpmPath = "";
|
||||
}
|
||||
|
||||
// Select other and we should use the value in the input
|
||||
if ("" == rpmPath) {
|
||||
// Store repo in a cookie
|
||||
rpmPath = $('#repositoryaddr').val();
|
||||
rpmPathType = rpmPath;
|
||||
} else {
|
||||
if (-1 == rpmPath.toLowerCase().indexOf("devel")) {
|
||||
rpmPathType = "2";
|
||||
} else {
|
||||
rpmPathType = "1";
|
||||
}
|
||||
}
|
||||
|
||||
$("input[type=checkbox]:checked").each(function() {
|
||||
temp = $(this).val();
|
||||
if ("" == temp) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var pattern = new RegExp("^" + temp + ",|," + temp + ",");
|
||||
if (pattern.test(rpms)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
rpms = rpms + temp + ",";
|
||||
});
|
||||
|
||||
if (0 < rpms.length) {
|
||||
rpms = rpms.slice(0, -1);
|
||||
}
|
||||
|
||||
// Check RPM and repository
|
||||
var errMsg = '';
|
||||
if (!rpms) {
|
||||
errMsg = "Please select an RPM!<br>";
|
||||
}
|
||||
|
||||
if (!rpmPath) {
|
||||
errMsg += "Please select or specify a repository!";
|
||||
}
|
||||
|
||||
if (!rpms || !rpmPath) {
|
||||
// Show warning message
|
||||
var warn = createWarnBar(errMsg);
|
||||
warn.prependTo($('#updateTab'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Remember users' choice and input
|
||||
$.cookie('xcat_repository', rpmPathType, {
|
||||
path : '/xcat',
|
||||
secure : true,
|
||||
expires : 10
|
||||
});
|
||||
|
||||
$('#update').show();
|
||||
$('#update div').empty();
|
||||
$('#update div').append("<p>Updating <b>" + rpms + "</b> from <b>" + rpmPath + "</b></p>");
|
||||
$('#update div').append("<img id='loadingpic' src='images/loader.gif'>");
|
||||
$('#rpm button').attr('disabled', 'true');
|
||||
|
||||
// Send the update command to server
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'update;' + rpms + ";" + rpmPath,
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
data = decodeRsp(data);
|
||||
showUpdateResult(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the results of the RPM update
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function showUpdateResult(data) {
|
||||
var temp = 0;
|
||||
$('#loadingpic').remove();
|
||||
|
||||
var resArray = data.rsp[0].split(/\n/);
|
||||
if (0 < resArray.length) {
|
||||
// Show last lines
|
||||
if (('' == resArray[resArray.length - 1]) && (resArray.length > 1)) {
|
||||
$('#update div').append('<pre>' + resArray[resArray.length - 2] + '</pre>');
|
||||
} else {
|
||||
$('#update div').append('<pre>' + resArray[resArray.length - 1] + '</pre>');
|
||||
}
|
||||
|
||||
// Create link to show details
|
||||
$('#update div').append('<br/><a>Show details</a>');
|
||||
$('#update div a').css( {
|
||||
'color' : '#0000FF',
|
||||
'cursor' : 'pointer'
|
||||
}).bind('click', function() {
|
||||
// Toggle details and change text
|
||||
$('#resDetail').toggle();
|
||||
if ($('#update div a').text() == 'Show details') {
|
||||
$('#update div a').text('Hide details');
|
||||
} else {
|
||||
$('#update div a').text('Show details');
|
||||
}
|
||||
});
|
||||
|
||||
var resDetail = $('<pre id="resDetail"></pre>');
|
||||
resDetail.hide();
|
||||
$('#update div').append(resDetail);
|
||||
for (temp = 0; temp < resArray.length; temp++) {
|
||||
resDetail.append(resArray[temp] + '<br/>');
|
||||
}
|
||||
}
|
||||
|
||||
// Update the rpm info
|
||||
$.ajax( {
|
||||
url : 'lib/systemcmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rpm -q xCAT-client perl-xCAT xCAT-server xCAT xCAT-rmc xCAT-UI'
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
data = decodeRsp(data);
|
||||
showRpmInfo(data);
|
||||
}
|
||||
});
|
||||
|
||||
$('#rpm button').attr('disabled', '');
|
||||
}
|
||||
+548
-536
File diff suppressed because it is too large
Load Diff
+798
-794
File diff suppressed because it is too large
Load Diff
+2815
-2785
File diff suppressed because it is too large
Load Diff
+8345
-8140
File diff suppressed because it is too large
Load Diff
+927
-740
File diff suppressed because it is too large
Load Diff
+1057
-1045
File diff suppressed because it is too large
Load Diff
+280
-275
@@ -1,276 +1,281 @@
|
||||
/**
|
||||
* Global variables
|
||||
*/
|
||||
var monitorTabs; // Monitor tabs
|
||||
|
||||
/**
|
||||
* Set the monitor tab
|
||||
*
|
||||
* @param o
|
||||
* Tab object
|
||||
* @return Nothing
|
||||
*/
|
||||
function setMonitorTab(o) {
|
||||
monitorTabs = o;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the monitor tab
|
||||
*
|
||||
* @return Tab object
|
||||
*/
|
||||
function getMonitorTab() {
|
||||
return monitorTabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the monitor page
|
||||
*/
|
||||
function loadMonitorPage() {
|
||||
// If the page is already loaded
|
||||
if ($('#monitor_page').children().length) {
|
||||
// Do not reload the monitor page
|
||||
return;
|
||||
}
|
||||
|
||||
// Create monitor tab
|
||||
var tab = new Tab();
|
||||
setMonitorTab(tab);
|
||||
tab.init();
|
||||
$('#content').append(tab.object());
|
||||
|
||||
var monitorForm = $('<div class="form"></div>');
|
||||
monitorForm.append('Getting monitoring status ').append(createLoader());
|
||||
tab.add('monitorTab', 'Monitor', monitorForm, false);
|
||||
|
||||
// Get monitoring status of each tool
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'monls',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
/**
|
||||
* Load monitoring status
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
success : function(data){
|
||||
// Initialize status for each tool
|
||||
var statusHash = new Object();
|
||||
statusHash['xcatmon'] = 'Off';
|
||||
statusHash['rmcmon'] = 'Off';
|
||||
statusHash['rmcevent'] = 'Off';
|
||||
statusHash['gangliamon'] = 'Off';
|
||||
if (data.rsp[0]) {
|
||||
var tempArray = data.rsp[0].split(';');
|
||||
var position = 0;
|
||||
var name = '';
|
||||
var status = '';
|
||||
for ( var i in tempArray) {
|
||||
position = tempArray[i].indexOf(':');
|
||||
if (position == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
name = tempArray[i].substr(0, position);
|
||||
status = tempArray[i].substr(position + 1);
|
||||
statusHash[name] = status;
|
||||
}
|
||||
}
|
||||
|
||||
// Create a status buttonset for each monitoring tool
|
||||
var statusButtonHash = new Object();
|
||||
for ( var name in statusHash) {
|
||||
var statusButton = $('<div></div>').css({
|
||||
'width': '100px',
|
||||
'text-align': 'center'
|
||||
});
|
||||
statusButtonHash[name] = statusButton;
|
||||
|
||||
// Set button to correct status
|
||||
if (statusHash[name] == 'On') {
|
||||
statusButton.append($('<input type="radio" id="' + name + 'On" name="' + name + '" value="On" checked="checked"/><label for="' + name + 'On">On</label>'));
|
||||
statusButton.append($('<input type="radio" id="' + name + 'Off" name="' + name + '" value="Off"/><label for="' + name + 'Off">Off</label>'));
|
||||
} else {
|
||||
statusButton.append($('<input type="radio" id="' + name + 'On" name="' + name + '" value="On"/><label for="' + name + 'On">On</label>'));
|
||||
statusButton.append($('<input type="radio" id="' + name + 'Off" name="' + name + '" value="Off" checked="checked"/><label for="' + name + 'Off">Off</label>'));
|
||||
}
|
||||
|
||||
statusButton.find('label').css({
|
||||
'margin': '0px',
|
||||
'padding': '0px',
|
||||
'font-size': '10px',
|
||||
'width': 'auto'
|
||||
});
|
||||
statusButton.buttonset();
|
||||
|
||||
// Turn on or off monitoring tool when clicked
|
||||
statusButton.find('input["' + name + '"]:radio').change(toggleMonitor);
|
||||
}
|
||||
|
||||
var monTable = $('<table></table>');
|
||||
monTable.append($('<thead class="ui-widget-header"><tr><th><b>Tool</b></th><th><b>Status</b></th><th><b>Description</b></th></tr></thead>'));
|
||||
|
||||
var monTableBody = $('<tbody></tbody>');
|
||||
monTable.append(monTableBody);
|
||||
|
||||
var xcatMon = $('<tr></tr>');
|
||||
xcatMon.append($('<td><a href="#" name="xcatmon">xCAT</a></td>'));
|
||||
xcatMon.append($('<td></td>').append(statusButtonHash['xcatmon']));
|
||||
xcatMon.append($('<td>xCAT provides node status monitoring using fping on AIX and nmapon Linux. It also provides application status monitoring. The status and the appstatus columns of the nodelist table will be updated periodically with the latest status values for the nodes.</td>'));
|
||||
monTableBody.append(xcatMon);
|
||||
|
||||
var rmcMon = $('<tr></tr>');
|
||||
rmcMon.append($('<td><a href="#" name="rmcmon">RMC</a></td>'));
|
||||
rmcMon.append($('<td></td>').append(statusButtonHash['rmcmon']));
|
||||
rmcMon.append($('<td>Resource Monitoring and Control (RMC) is a generalized framework for managing, monitoring and manipulating resources, such as physical or logical system entities. RMC is utilized as a communication mechanism for reporting service events to the Hardware Management Console (HMC).</td>'));
|
||||
monTableBody.append(rmcMon);
|
||||
|
||||
var rmcEvent = $('<tr></tr>');
|
||||
rmcEvent.append($('<td><a href="#" name="rmcevent">RMC Event</a></td>'));
|
||||
rmcEvent.append($('<td></td>').append(statusButtonHash['rmcevent']));
|
||||
rmcEvent.append($('<td>Shows a list of events recorded by the RSCT Event Response resource manager in the audit log.</td>'));
|
||||
monTableBody.append(rmcEvent);
|
||||
|
||||
var gangliaMon = $('<tr></tr>');
|
||||
gangliaMon.append($('<td><a href="#" name="gangliamon">Ganglia</a></td>'));
|
||||
gangliaMon.append($('<td></td>').append(statusButtonHash['gangliamon']));
|
||||
gangliaMon.append($('<td>Ganglia is a scalable distributed monitoring system for high-performance computing systems such as clusters and Grids.</td>'));
|
||||
monTableBody.append(gangliaMon);
|
||||
|
||||
// Do not word wrap
|
||||
monTableBody.find('td:nth-child(1)').css('white-space', 'nowrap');
|
||||
monTableBody.find('td:nth-child(3)').css({
|
||||
'white-space': 'normal',
|
||||
'text-align': 'left'
|
||||
});
|
||||
|
||||
// Append info bar
|
||||
$('#monitorTab div').empty().append(createInfoBar('Select a monitoring tool to use'));
|
||||
$('#monitorTab .form').append(monTable);
|
||||
|
||||
// Open monitoring tool onclick
|
||||
$('#monitorTab .form a').bind('click', function() {
|
||||
loadMonitorTab($(this).attr('name'));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Load monitoring tool in a new tab
|
||||
*
|
||||
* @param name Name of monitoring tool
|
||||
*/
|
||||
function loadMonitorTab(name) {
|
||||
// If the tab exist, then we only need to select it
|
||||
var tab = getMonitorTab();
|
||||
if ($("#" + name).length) {
|
||||
tab.select(name);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (name) {
|
||||
case 'xcatmon':
|
||||
tab.add(name, 'xCAT', '', true);
|
||||
loadXcatMon();
|
||||
break;
|
||||
case 'rmcmon':
|
||||
tab.add(name, 'RMC Monitor', '', true);
|
||||
loadRmcMon();
|
||||
break;
|
||||
case 'gangliamon':
|
||||
tab.add(name, 'Ganglia', '', true);
|
||||
loadGangliaMon();
|
||||
break;
|
||||
case 'rmcevent':
|
||||
tab.add(name, 'RMC Event', '', true);
|
||||
loadRmcEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
tab.select(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load tab showing 'Under contruction'
|
||||
*
|
||||
* @param monitorName Name of monitoring tool
|
||||
* @param tab Tab area
|
||||
*/
|
||||
function loadUnfinish(monitorName, tab) {
|
||||
var unfinishPage = $('<div></div>');
|
||||
unfinishPage.append(createInfoBar('Not yet supported'));
|
||||
tab.add(monitorName, 'Unfinished', unfinishPage, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn on or off monitoring tool
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function toggleMonitor() {
|
||||
// Get the name of the monitoring tool
|
||||
var name = $(this).attr('name');
|
||||
// Get the status to toggle to, either on or off
|
||||
var status = $(this).val();
|
||||
|
||||
// Start or stop monitoring plugin
|
||||
var command = 'monstart';
|
||||
if (status == 'Off') {
|
||||
command = 'monstop' ;
|
||||
}
|
||||
|
||||
// Start or stop monitoring on xCAT
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : command,
|
||||
tgt : '',
|
||||
args : name + '',
|
||||
msg : ''
|
||||
},
|
||||
success : function(data) {
|
||||
// Start or stop monitoring on remote nodes
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : command,
|
||||
tgt : '',
|
||||
args : name + ';-r',
|
||||
msg : name + ' switched ' + status
|
||||
},
|
||||
success : updateMonStatus
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the monitoring status on Monitor tab
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function updateMonStatus(data) {
|
||||
var rsp = data.rsp[data.rsp.length-1];
|
||||
var msg = data.msg;
|
||||
|
||||
// Create appropriate info or warning bar
|
||||
var bar = '';
|
||||
if (rsp.indexOf('started') > -1 || rsp.indexOf('stopped') > -1) {
|
||||
bar = createInfoBar(msg);
|
||||
} else {
|
||||
bar = createWarnBar('Failed to ' + msg + '. ' + rsp);
|
||||
}
|
||||
|
||||
// Prepend info or warning bar to tab
|
||||
bar.prependTo($('#monitorTab .form'));
|
||||
bar.delay(4000).slideUp();
|
||||
/**
|
||||
* Global variables
|
||||
*/
|
||||
var monitorTabs; // Monitor tabs
|
||||
|
||||
/**
|
||||
* Set the monitor tab
|
||||
*
|
||||
* @param o
|
||||
* Tab object
|
||||
* @return Nothing
|
||||
*/
|
||||
function setMonitorTab(o) {
|
||||
monitorTabs = o;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the monitor tab
|
||||
*
|
||||
* @return Tab object
|
||||
*/
|
||||
function getMonitorTab() {
|
||||
return monitorTabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the monitor page
|
||||
*/
|
||||
function loadMonitorPage() {
|
||||
// If the page is already loaded
|
||||
if ($('#monitor_page').children().length) {
|
||||
// Do not reload the monitor page
|
||||
return;
|
||||
}
|
||||
|
||||
// Create monitor tab
|
||||
var tab = new Tab();
|
||||
setMonitorTab(tab);
|
||||
tab.init();
|
||||
$('#content').append(tab.object());
|
||||
|
||||
var monitorForm = $('<div class="form"></div>');
|
||||
monitorForm.append('Getting monitoring status ').append(createLoader());
|
||||
tab.add('monitorTab', 'Monitor', monitorForm, false);
|
||||
|
||||
// Get monitoring status of each tool
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'monls',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
/**
|
||||
* Load monitoring status
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
success : function(data){
|
||||
data = decodeRsp(data);
|
||||
// Initialize status for each tool
|
||||
var statusHash = new Object();
|
||||
statusHash['xcatmon'] = 'Off';
|
||||
statusHash['rmcmon'] = 'Off';
|
||||
statusHash['rmcevent'] = 'Off';
|
||||
statusHash['gangliamon'] = 'Off';
|
||||
if (data.rsp[0]) {
|
||||
var tempArray = data.rsp[0].split(';');
|
||||
var position = 0;
|
||||
var name = '';
|
||||
var status = '';
|
||||
for ( var i in tempArray) {
|
||||
position = tempArray[i].indexOf(':');
|
||||
if (position == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
name = tempArray[i].substr(0, position);
|
||||
status = tempArray[i].substr(position + 1);
|
||||
statusHash[name] = status;
|
||||
}
|
||||
}
|
||||
|
||||
// Create a status buttonset for each monitoring tool
|
||||
var statusButtonHash = new Object();
|
||||
for ( var name in statusHash) {
|
||||
var statusButton = $('<div></div>').css({
|
||||
'width': '100px',
|
||||
'text-align': 'center'
|
||||
});
|
||||
statusButtonHash[name] = statusButton;
|
||||
|
||||
// Set button to correct status
|
||||
if (statusHash[name] == 'On') {
|
||||
statusButton.append($('<input type="radio" id="' + name + 'On" name="' + name + '" value="On" checked="checked"/><label for="' + name + 'On">On</label>'));
|
||||
statusButton.append($('<input type="radio" id="' + name + 'Off" name="' + name + '" value="Off"/><label for="' + name + 'Off">Off</label>'));
|
||||
} else {
|
||||
statusButton.append($('<input type="radio" id="' + name + 'On" name="' + name + '" value="On"/><label for="' + name + 'On">On</label>'));
|
||||
statusButton.append($('<input type="radio" id="' + name + 'Off" name="' + name + '" value="Off" checked="checked"/><label for="' + name + 'Off">Off</label>'));
|
||||
}
|
||||
|
||||
statusButton.find('label').css({
|
||||
'margin': '0px',
|
||||
'padding': '0px',
|
||||
'font-size': '10px',
|
||||
'width': 'auto'
|
||||
});
|
||||
statusButton.buttonset();
|
||||
|
||||
// Turn on or off monitoring tool when clicked
|
||||
statusButton.find('input["' + name + '"]:radio').change(toggleMonitor);
|
||||
}
|
||||
|
||||
var monTable = $('<table></table>');
|
||||
monTable.append($('<thead class="ui-widget-header"><tr><th><b>Tool</b></th><th><b>Status</b></th><th><b>Description</b></th></tr></thead>'));
|
||||
|
||||
var monTableBody = $('<tbody></tbody>');
|
||||
monTable.append(monTableBody);
|
||||
|
||||
var xcatMon = $('<tr></tr>');
|
||||
xcatMon.append($('<td><a href="#" name="xcatmon">xCAT</a></td>'));
|
||||
xcatMon.append($('<td></td>').append(statusButtonHash['xcatmon']));
|
||||
xcatMon.append($('<td>xCAT provides node status monitoring using fping on AIX and nmapon Linux. It also provides application status monitoring. The status and the appstatus columns of the nodelist table will be updated periodically with the latest status values for the nodes.</td>'));
|
||||
monTableBody.append(xcatMon);
|
||||
|
||||
var rmcMon = $('<tr></tr>');
|
||||
rmcMon.append($('<td><a href="#" name="rmcmon">RMC</a></td>'));
|
||||
rmcMon.append($('<td></td>').append(statusButtonHash['rmcmon']));
|
||||
rmcMon.append($('<td>Resource Monitoring and Control (RMC) is a generalized framework for managing, monitoring and manipulating resources, such as physical or logical system entities. RMC is utilized as a communication mechanism for reporting service events to the Hardware Management Console (HMC).</td>'));
|
||||
monTableBody.append(rmcMon);
|
||||
|
||||
var rmcEvent = $('<tr></tr>');
|
||||
rmcEvent.append($('<td><a href="#" name="rmcevent">RMC Event</a></td>'));
|
||||
rmcEvent.append($('<td></td>').append(statusButtonHash['rmcevent']));
|
||||
rmcEvent.append($('<td>Shows a list of events recorded by the RSCT Event Response resource manager in the audit log.</td>'));
|
||||
monTableBody.append(rmcEvent);
|
||||
|
||||
var gangliaMon = $('<tr></tr>');
|
||||
gangliaMon.append($('<td><a href="#" name="gangliamon">Ganglia</a></td>'));
|
||||
gangliaMon.append($('<td></td>').append(statusButtonHash['gangliamon']));
|
||||
gangliaMon.append($('<td>Ganglia is a scalable distributed monitoring system for high-performance computing systems such as clusters and Grids.</td>'));
|
||||
monTableBody.append(gangliaMon);
|
||||
|
||||
// Do not word wrap
|
||||
monTableBody.find('td:nth-child(1)').css('white-space', 'nowrap');
|
||||
monTableBody.find('td:nth-child(3)').css({
|
||||
'white-space': 'normal',
|
||||
'text-align': 'left'
|
||||
});
|
||||
|
||||
// Append info bar
|
||||
$('#monitorTab div').empty().append(createInfoBar('Select a monitoring tool to use'));
|
||||
$('#monitorTab .form').append(monTable);
|
||||
|
||||
// Open monitoring tool onclick
|
||||
$('#monitorTab .form a').bind('click', function() {
|
||||
loadMonitorTab($(this).attr('name'));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Load monitoring tool in a new tab
|
||||
*
|
||||
* @param name Name of monitoring tool
|
||||
*/
|
||||
function loadMonitorTab(name) {
|
||||
// If the tab exist, then we only need to select it
|
||||
var tab = getMonitorTab();
|
||||
if ($("#" + name).length) {
|
||||
tab.select(name);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (name) {
|
||||
case 'xcatmon':
|
||||
tab.add(name, 'xCAT', '', true);
|
||||
loadXcatMon();
|
||||
break;
|
||||
case 'rmcmon':
|
||||
tab.add(name, 'RMC Monitor', '', true);
|
||||
loadRmcMon();
|
||||
break;
|
||||
case 'gangliamon':
|
||||
tab.add(name, 'Ganglia', '', true);
|
||||
loadGangliaMon();
|
||||
break;
|
||||
case 'rmcevent':
|
||||
tab.add(name, 'RMC Event', '', true);
|
||||
loadRmcEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
tab.select(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load tab showing 'Under contruction'
|
||||
*
|
||||
* @param monitorName Name of monitoring tool
|
||||
* @param tab Tab area
|
||||
*/
|
||||
function loadUnfinish(monitorName, tab) {
|
||||
var unfinishPage = $('<div></div>');
|
||||
unfinishPage.append(createInfoBar('Not yet supported'));
|
||||
tab.add(monitorName, 'Unfinished', unfinishPage, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn on or off monitoring tool
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function toggleMonitor() {
|
||||
// Get the name of the monitoring tool
|
||||
var name = $(this).attr('name');
|
||||
// Get the status to toggle to, either on or off
|
||||
var status = $(this).val();
|
||||
|
||||
// Start or stop monitoring plugin
|
||||
var command = 'monstart';
|
||||
if (status == 'Off') {
|
||||
command = 'monstop' ;
|
||||
}
|
||||
|
||||
// Start or stop monitoring on xCAT
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : command,
|
||||
tgt : '',
|
||||
args : name + '',
|
||||
msg : ''
|
||||
},
|
||||
success : function(data) {
|
||||
data = decodeRsp(data);
|
||||
// Start or stop monitoring on remote nodes
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : command,
|
||||
tgt : '',
|
||||
args : name + ';-r',
|
||||
msg : name + ' switched ' + status
|
||||
},
|
||||
success : function(data) {
|
||||
data = decodeRsp(data);
|
||||
updateMonStatus(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the monitoring status on Monitor tab
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function updateMonStatus(data) {
|
||||
var rsp = data.rsp[data.rsp.length-1];
|
||||
var msg = data.msg;
|
||||
|
||||
// Create appropriate info or warning bar
|
||||
var bar = '';
|
||||
if (rsp.indexOf('started') > -1 || rsp.indexOf('stopped') > -1) {
|
||||
bar = createInfoBar(msg);
|
||||
} else {
|
||||
bar = createWarnBar('Failed to ' + msg + '. ' + rsp);
|
||||
}
|
||||
|
||||
// Prepend info or warning bar to tab
|
||||
bar.prependTo($('#monitorTab .form'));
|
||||
bar.delay(4000).slideUp();
|
||||
}
|
||||
+1211
-1188
File diff suppressed because it is too large
Load Diff
+422
-418
@@ -1,419 +1,423 @@
|
||||
/**
|
||||
* Global variables
|
||||
*/
|
||||
var xcatMonTableId = "xcatMonSettingTable";
|
||||
|
||||
/**
|
||||
* Load xCAT monitoring
|
||||
*/
|
||||
function loadXcatMon() {
|
||||
// Find xCAT monitoring tab
|
||||
var xcatMonTab = $('#xcatmon');
|
||||
xcatMonTab.append("<div id= xcatmonTable></div>");
|
||||
|
||||
// Show content of monsetting table
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'monsetting',
|
||||
msg : ''
|
||||
},
|
||||
success : loadXcatMonSetting
|
||||
});
|
||||
}
|
||||
|
||||
function loadXcatMonSetting(data) {
|
||||
var apps = ""; // Contains the xcatmon config
|
||||
var rsp = data.rsp;
|
||||
if (!rsp.length)
|
||||
return;
|
||||
|
||||
var apps_flag = 0;
|
||||
var ping; // xcatmon ping interval
|
||||
var ping_flag = 0;
|
||||
|
||||
// Create an info bar
|
||||
var infoBar = createInfoBar('Click on a cell to edit. Click outside the table to write to the cell. Once you are finished configuring the xCAT monitor, click on Apply.');
|
||||
$('#xcatmonTable').append(infoBar);
|
||||
|
||||
// Create xcatmon table
|
||||
var xcatmonTable = new DataTable(xcatMonTableId);
|
||||
|
||||
// Create datatable
|
||||
var dTable;
|
||||
|
||||
// Create table header
|
||||
var header = rsp[0].split(",");
|
||||
header.splice(3, 2);
|
||||
header.splice(0, 1);
|
||||
header[0] = "App Name";
|
||||
header[1] = "Configure";
|
||||
header.push('<input type="checkbox" onclick="selectAllCheckbox(event,$(this))">');
|
||||
header.unshift('');
|
||||
xcatmonTable.init(header);
|
||||
|
||||
// Create container for original table contents
|
||||
var origCont = new Array();
|
||||
origCont[0] = header; // Table headers
|
||||
|
||||
// Create container for new contents to use later updating monsetting table
|
||||
var newCont = new Object();
|
||||
newCont[0] = rsp[0].split(","); // Table headers
|
||||
|
||||
// Create container for other monsetting lines
|
||||
var otherCont = new Array();
|
||||
|
||||
$('#xcatmonTable').append(xcatmonTable.object());
|
||||
var m = 1; // Count for origCont
|
||||
var n = 0;
|
||||
for ( var i = 1; i < rsp.length; i++) {
|
||||
var pos = rsp[i].indexOf("xcatmon"); // Only check xcatmon setting
|
||||
if (pos == 1) {
|
||||
if ((rsp[i].indexOf("apps") == -1) && (rsp[i].indexOf("ping") == -1)) {
|
||||
var cols = rsp[i].split(',');
|
||||
for ( var j = 0; j < cols.length; j++) {
|
||||
if (cols[j].count('"') % 2 == 1) {
|
||||
while (cols[j].count('"') % 2 == 1) {
|
||||
cols[j] = cols[j] + "," + cols[j + 1];
|
||||
cols.splice(j + 1, 1);
|
||||
}
|
||||
}
|
||||
cols[j] = cols[j].replace(new RegExp('"', 'g'), '');
|
||||
}
|
||||
|
||||
cols.splice(3, 2);
|
||||
cols.splice(0, 1);
|
||||
cols.push('<input type="checkbox" name="' + cols[0] + '" title="Checking this box will add/remove the app from the configured app value"/>');
|
||||
cols.unshift('<span class="ui-icon ui-icon-close" onclick="deleteXcatMonRow(this)"></span>');
|
||||
|
||||
// Add column to table
|
||||
xcatmonTable.add(cols);
|
||||
origCont[m++] = cols;
|
||||
} else {
|
||||
if (!apps_flag) { // Check the apps setting
|
||||
if (rsp[i].indexOf("apps") > -1) {
|
||||
apps = rsp[i].split(',');
|
||||
|
||||
for ( var j = 0; j < apps.length; j++) {
|
||||
if (apps[j].count('"') % 2 == 1) {
|
||||
while (apps[j].count('"') % 2 == 1) {
|
||||
apps[j] = apps[j] + "," + apps[j + 1];
|
||||
apps.splice(j + 1, 1);
|
||||
}
|
||||
}
|
||||
apps[j] = apps[j].replace(new RegExp('"', 'g'), '');
|
||||
}
|
||||
|
||||
apps_flag = 1; // Set the flag to 1 to avoid this subroute
|
||||
}
|
||||
}
|
||||
|
||||
// Get into the ping settings
|
||||
if (!ping_flag) {
|
||||
// Check the ping interval
|
||||
if (rsp[i].indexOf("ping-interval") > -1) {
|
||||
ping = rsp[i].split(',');
|
||||
for ( var j = 0; j < ping.length; j++) {
|
||||
if (ping[j].count('"') % 2 == 1) {
|
||||
while (ping[j].count('"') % 2 == 1) {
|
||||
ping[j] = ping[j] + "," + ping[j + 1];
|
||||
ping.splice(j + 1, 1);
|
||||
}
|
||||
}
|
||||
ping[j] = ping[j].replace((new RegExp('"', 'g')),
|
||||
'');
|
||||
}
|
||||
ping_flag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (pos != 1) {
|
||||
// The other monitor in the monsetting table
|
||||
var otherCols = rsp[i].split(',');
|
||||
for ( var k = 0; k < otherCols.length; k++) {
|
||||
if (otherCols[k].count('"') % 2 == 1) {
|
||||
while (otherCols[k].count('"') % 2 == 1) {
|
||||
otherCols[k] = otherCols[k] + "," + otherCols[k + 1];
|
||||
otherCols.splice(k + 1, 1);
|
||||
}
|
||||
}
|
||||
otherCols[k] = otherCols[k].replace(new RegExp('"', 'g'), '');
|
||||
}
|
||||
|
||||
otherCont[n++] = otherCols;
|
||||
|
||||
}
|
||||
}
|
||||
// If app is not in the monsetting table, then create default apps row
|
||||
if (!apps_flag) {
|
||||
apps = rsp[0].split(',');
|
||||
apps[0] = "xcatmon";
|
||||
apps[1] = "apps";
|
||||
apps[2] = "";
|
||||
apps[3] = "";
|
||||
apps[4] = "";
|
||||
}
|
||||
|
||||
// If the ping interval is not in the monsetting table, then create the
|
||||
// default ping-interval
|
||||
if (!ping_flag) {
|
||||
ping = rsp[0].split(',');
|
||||
ping[0] = "xcatmon";
|
||||
ping[1] = "ping-interval";
|
||||
|
||||
// Set default ping-interval setting to 5
|
||||
ping[2] = "5";
|
||||
ping[3] = "";
|
||||
ping[4] = "";
|
||||
}
|
||||
|
||||
// Set checkbox to be true
|
||||
var checked = apps[2].split(',');
|
||||
for ( var i = 0; i < checked.length; i++) {
|
||||
$("input:checkbox[name=" + checked[i] + "]").attr('checked', true);
|
||||
for ( var j = 0; j < origCont.length; j++) {
|
||||
if (origCont[j][1] == checked[i]) {
|
||||
origCont[j].splice(3, 1);
|
||||
origCont[j].push('<input type="checkbox" name="' + origCont[j][1] + '" title="Check this checkbox to add/remove the app from the configured app value." checked=true/>');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$(":checkbox").tooltip();
|
||||
|
||||
// Make the table editable
|
||||
$('#' + xcatMonTableId + ' td:not(td:nth-child(1),td:last-child)').editable(function(value, settings) {
|
||||
var colPos = this.cellIndex;
|
||||
var rowPos = dTable.fnGetPosition(this.parentNode);
|
||||
dTable.fnUpdate(value, rowPos, colPos);
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit',
|
||||
type : 'textarea',
|
||||
placeholder : ' ',
|
||||
height : '30px'
|
||||
});
|
||||
|
||||
// Save datatable
|
||||
dTable = $('#' + xcatMonTableId).dataTable({
|
||||
'iDisplayLength': 50,
|
||||
'bLengthChange': false,
|
||||
"bScrollCollapse": true,
|
||||
"sScrollY": "400px",
|
||||
"sScrollX": "110%",
|
||||
"bAutoWidth": true,
|
||||
"oLanguage": {
|
||||
"oPaginate": {
|
||||
"sNext": "",
|
||||
"sPrevious": ""
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Create action bar
|
||||
var actionBar = $('<div class="actionBar"></div>');
|
||||
var addRowLnk = $('<a>Add row</a>');
|
||||
addRowLnk.bind('click', function(event) {
|
||||
// Create container for new row
|
||||
var row = new Array();
|
||||
|
||||
// Add delete button to row
|
||||
row.push('<span class="ui-icon ui-icon-close" onclick="deleteXcatMonRow(this)"></span>');
|
||||
for ( var i = 0; i < header.length - 2; i++)
|
||||
row.push('');
|
||||
|
||||
// Add checkbox
|
||||
row.push('<input type="checkbox" name="' + row[2] + '" title="Checking this checkbox will add/remove the app from the configured apps value"/>');
|
||||
// Get the datatable of the table
|
||||
var dTable = $('#' + xcatMonTableId).dataTable();
|
||||
// Add the new row to the datatable
|
||||
dTable.fnAddData(row);
|
||||
|
||||
// make the datatable editable
|
||||
$(":checkbox[title]").tooltip();
|
||||
$('#' + xcatMonTableId + ' td:not(td:nth-child(1),td:last-child)').editable(function(value, settings) {
|
||||
var colPos = this.cellIndex;
|
||||
var rowPos = dTable
|
||||
.fnGetPosition(this.parentNode);
|
||||
dTable.fnUpdate(value, rowPos,
|
||||
colPos);
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit',
|
||||
type : 'textarea',
|
||||
placeholder : ' ',
|
||||
height : '30px'
|
||||
});
|
||||
});
|
||||
|
||||
// Create apply button to store the contents of the table to the monsetting table
|
||||
var applyLnk = $('<a>Apply</a>');
|
||||
applyLnk.bind('click', function(event) {
|
||||
// Get the datatable
|
||||
var dTable = $('#' + xcatMonTableId).dataTable();
|
||||
// Get datatable rows
|
||||
var dRows = dTable.fnGetNodes();
|
||||
var count = 0;
|
||||
|
||||
// Create a new container for the apps value
|
||||
var appValue = '';
|
||||
var tableName = 'monsetting';
|
||||
var closeBtn = createButton('close');
|
||||
|
||||
// Get the row contents
|
||||
for ( var i = 0; i < dRows.length; i++) {
|
||||
if (dRows[i]) {
|
||||
// Get the row columns
|
||||
var cols = dRows[i].childNodes;
|
||||
// Create a container for the new columns
|
||||
var vals = new Array();
|
||||
|
||||
for ( var j = 1; j < cols.length - 1; j++) {
|
||||
var val = cols.item(j).firstChild.nodeValue;
|
||||
if (val == ' ')
|
||||
vals[j - 1] = '';
|
||||
else
|
||||
vals[j - 1] = val;
|
||||
}
|
||||
|
||||
var vals_orig = new Array();
|
||||
// Copy data from vals to vals_orig
|
||||
for ( var p = 0; p < 2; p++) {
|
||||
var val = vals[p];
|
||||
vals_orig[p] = val;
|
||||
}
|
||||
|
||||
vals.push('');
|
||||
vals.push('');
|
||||
vals.unshift('xcatmon');
|
||||
|
||||
// Stored new column to newCont
|
||||
newCont[i + 1] = vals;
|
||||
|
||||
if (cols.item(cols.length - 1).firstChild.checked) {
|
||||
vals_orig.push('<input type="checkbox" name="' + vals_orig[0] + '" title="Checking this checkbox will add/remove the app from the configured apps value" checked=true/>');
|
||||
} else {
|
||||
vals_orig.push('<input type="checkbox" name="' + vals_orig[0] + '" title="Checking this checkbox will add/remove the app from the configured apps value"/>');
|
||||
}
|
||||
|
||||
// Add delete button to row
|
||||
vals_orig.unshift('<span class="ui-icon ui-icon-close" onclick="deleteXcatMonRow(this)"></span>');
|
||||
// Add row to origCont
|
||||
origCont[i + 1] = vals_orig;
|
||||
count = i + 1;
|
||||
|
||||
// Check checkbox for every row when merging the app name with the apps values
|
||||
if (cols.item(cols.length - 1).firstChild.checked)
|
||||
appValue = appValue.concat(cols.item(2).firstChild.nodeValue + ",");
|
||||
}
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
// Delete the last comma of the apps value
|
||||
appValue = appValue.substring(0, (appValue.length - 1));
|
||||
apps[2] = appValue;
|
||||
|
||||
newCont[count++] = apps;
|
||||
newCont[count++] = ping;
|
||||
|
||||
// Add to other monitor settings
|
||||
for ( var j = 0; j < otherCont.length; j++) {
|
||||
newCont[count++] = otherCont[j];
|
||||
}
|
||||
|
||||
// Create save dialog
|
||||
var dialogSave = $('<div id="saveDialog" align="center">Saving configuration</div>');
|
||||
dialogSave.append(createLoader());
|
||||
|
||||
$('#xcatmon').append(dialogSave);
|
||||
$("#saveDialog").dialog({
|
||||
modal : true
|
||||
});
|
||||
|
||||
$('.ui-dialog-titlebar-close').hide();
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'lib/tabRestore.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
table : tableName,
|
||||
cont : newCont
|
||||
},
|
||||
success : function(data) {
|
||||
// empty the dialog.add the close button
|
||||
$("#saveDialog").empty().append('<p>Configuration saved!</p>');
|
||||
$("#saveDialog").append(closeBtn);
|
||||
}
|
||||
});
|
||||
|
||||
// Close button
|
||||
closeBtn.bind('click', function(event) {
|
||||
$("#saveDialog").dialog("destroy");
|
||||
$("#saveDialog").remove();
|
||||
});
|
||||
|
||||
// Clear the newCont
|
||||
newCont = null;
|
||||
newCont = new Object();
|
||||
newCont[0] = rsp[0].split(",");
|
||||
});
|
||||
|
||||
var cancelLnk = $('<a>Cancel</a>');
|
||||
cancelLnk.bind('click', function(event) {
|
||||
// Get the datatable for the page
|
||||
var dTable = $('#' + xcatMonTableId).dataTable();
|
||||
|
||||
// Clear the datatable
|
||||
dTable.fnClearTable();
|
||||
|
||||
// Add the contents of origCont to the datatable
|
||||
for ( var i = 1; i < origCont.length; i++)
|
||||
dTable.fnAddData(origCont[i], true);
|
||||
|
||||
$(":checkbox[title]").tooltip();
|
||||
$('#' + xcatMonTableId + ' td:not(td:nth-child(1),td:last-child)').editable(function(value, settings) {
|
||||
var colPos = this.cellIndex;
|
||||
var rowPos = dTable.fnGetPosition(this.parentNode);
|
||||
dTable.fnUpdate(value, rowPos, colPos);
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit',
|
||||
type : 'textarea',
|
||||
placeholder : ' ',
|
||||
height : '30px'
|
||||
});
|
||||
});
|
||||
|
||||
// Create actions menu
|
||||
var actionsLnk = '<a>Actions</a>';
|
||||
var actsMenu = createMenu([ addRowLnk, applyLnk, cancelLnk ]);
|
||||
var actionsMenu = createMenu([ [ actionsLnk, actsMenu ] ]);
|
||||
actionsMenu.superfish();
|
||||
actionsMenu.css('display', 'inline-block');
|
||||
actionBar.append(actionsMenu);
|
||||
|
||||
// Create a division to hold actions menu
|
||||
var menuDiv = $('<div id="' + xcatMonTableId + '_menuDiv" class="menuDiv"></div>');
|
||||
$('#' + xcatMonTableId + '_wrapper').prepend(menuDiv);
|
||||
menuDiv.append(actionBar);
|
||||
$('#' + xcatMonTableId + '_filter').appendTo(menuDiv);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a row from the table
|
||||
*/
|
||||
function deleteXcatMonRow(obj) {
|
||||
var dTable = $('#' + xcatMonTableId).dataTable();
|
||||
var rows = dTable.fnGetNodes();
|
||||
var tgtRow = $(obj).parent().parent().get(0);
|
||||
for ( var i in rows) {
|
||||
if (rows[i] == tgtRow) {
|
||||
dTable.fnDeleteRow(i, null, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Global variables
|
||||
*/
|
||||
var xcatMonTableId = "xcatMonSettingTable";
|
||||
|
||||
/**
|
||||
* Load xCAT monitoring
|
||||
*/
|
||||
function loadXcatMon() {
|
||||
// Find xCAT monitoring tab
|
||||
var xcatMonTab = $('#xcatmon');
|
||||
xcatMonTab.append("<div id= xcatmonTable></div>");
|
||||
|
||||
// Show content of monsetting table
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'monsetting',
|
||||
msg : ''
|
||||
},
|
||||
success : function(data) {
|
||||
data = decodeRsp(data);
|
||||
loadXcatMonSetting(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadXcatMonSetting(data) {
|
||||
var apps = ""; // Contains the xcatmon config
|
||||
var rsp = data.rsp;
|
||||
if (!rsp.length)
|
||||
return;
|
||||
|
||||
var apps_flag = 0;
|
||||
var ping; // xcatmon ping interval
|
||||
var ping_flag = 0;
|
||||
|
||||
// Create an info bar
|
||||
var infoBar = createInfoBar('Click on a cell to edit. Click outside the table to write to the cell. Once you are finished configuring the xCAT monitor, click on Apply.');
|
||||
$('#xcatmonTable').append(infoBar);
|
||||
|
||||
// Create xcatmon table
|
||||
var xcatmonTable = new DataTable(xcatMonTableId);
|
||||
|
||||
// Create datatable
|
||||
var dTable;
|
||||
|
||||
// Create table header
|
||||
var header = rsp[0].split(",");
|
||||
header.splice(3, 2);
|
||||
header.splice(0, 1);
|
||||
header[0] = "App Name";
|
||||
header[1] = "Configure";
|
||||
header.push('<input type="checkbox" onclick="selectAllCheckbox(event,$(this))">');
|
||||
header.unshift('');
|
||||
xcatmonTable.init(header);
|
||||
|
||||
// Create container for original table contents
|
||||
var origCont = new Array();
|
||||
origCont[0] = header; // Table headers
|
||||
|
||||
// Create container for new contents to use later updating monsetting table
|
||||
var newCont = new Object();
|
||||
newCont[0] = rsp[0].split(","); // Table headers
|
||||
|
||||
// Create container for other monsetting lines
|
||||
var otherCont = new Array();
|
||||
|
||||
$('#xcatmonTable').append(xcatmonTable.object());
|
||||
var m = 1; // Count for origCont
|
||||
var n = 0;
|
||||
for ( var i = 1; i < rsp.length; i++) {
|
||||
var pos = rsp[i].indexOf("xcatmon"); // Only check xcatmon setting
|
||||
if (pos == 1) {
|
||||
if ((rsp[i].indexOf("apps") == -1) && (rsp[i].indexOf("ping") == -1)) {
|
||||
var cols = rsp[i].split(',');
|
||||
for ( var j = 0; j < cols.length; j++) {
|
||||
if (cols[j].count('"') % 2 == 1) {
|
||||
while (cols[j].count('"') % 2 == 1) {
|
||||
cols[j] = cols[j] + "," + cols[j + 1];
|
||||
cols.splice(j + 1, 1);
|
||||
}
|
||||
}
|
||||
cols[j] = cols[j].replace(new RegExp('"', 'g'), '');
|
||||
}
|
||||
|
||||
cols.splice(3, 2);
|
||||
cols.splice(0, 1);
|
||||
cols.push('<input type="checkbox" name="' + cols[0] + '" title="Checking this box will add/remove the app from the configured app value"/>');
|
||||
cols.unshift('<span class="ui-icon ui-icon-close" onclick="deleteXcatMonRow(this)"></span>');
|
||||
|
||||
// Add column to table
|
||||
xcatmonTable.add(cols);
|
||||
origCont[m++] = cols;
|
||||
} else {
|
||||
if (!apps_flag) { // Check the apps setting
|
||||
if (rsp[i].indexOf("apps") > -1) {
|
||||
apps = rsp[i].split(',');
|
||||
|
||||
for ( var j = 0; j < apps.length; j++) {
|
||||
if (apps[j].count('"') % 2 == 1) {
|
||||
while (apps[j].count('"') % 2 == 1) {
|
||||
apps[j] = apps[j] + "," + apps[j + 1];
|
||||
apps.splice(j + 1, 1);
|
||||
}
|
||||
}
|
||||
apps[j] = apps[j].replace(new RegExp('"', 'g'), '');
|
||||
}
|
||||
|
||||
apps_flag = 1; // Set the flag to 1 to avoid this subroute
|
||||
}
|
||||
}
|
||||
|
||||
// Get into the ping settings
|
||||
if (!ping_flag) {
|
||||
// Check the ping interval
|
||||
if (rsp[i].indexOf("ping-interval") > -1) {
|
||||
ping = rsp[i].split(',');
|
||||
for ( var j = 0; j < ping.length; j++) {
|
||||
if (ping[j].count('"') % 2 == 1) {
|
||||
while (ping[j].count('"') % 2 == 1) {
|
||||
ping[j] = ping[j] + "," + ping[j + 1];
|
||||
ping.splice(j + 1, 1);
|
||||
}
|
||||
}
|
||||
ping[j] = ping[j].replace((new RegExp('"', 'g')),
|
||||
'');
|
||||
}
|
||||
ping_flag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (pos != 1) {
|
||||
// The other monitor in the monsetting table
|
||||
var otherCols = rsp[i].split(',');
|
||||
for ( var k = 0; k < otherCols.length; k++) {
|
||||
if (otherCols[k].count('"') % 2 == 1) {
|
||||
while (otherCols[k].count('"') % 2 == 1) {
|
||||
otherCols[k] = otherCols[k] + "," + otherCols[k + 1];
|
||||
otherCols.splice(k + 1, 1);
|
||||
}
|
||||
}
|
||||
otherCols[k] = otherCols[k].replace(new RegExp('"', 'g'), '');
|
||||
}
|
||||
|
||||
otherCont[n++] = otherCols;
|
||||
|
||||
}
|
||||
}
|
||||
// If app is not in the monsetting table, then create default apps row
|
||||
if (!apps_flag) {
|
||||
apps = rsp[0].split(',');
|
||||
apps[0] = "xcatmon";
|
||||
apps[1] = "apps";
|
||||
apps[2] = "";
|
||||
apps[3] = "";
|
||||
apps[4] = "";
|
||||
}
|
||||
|
||||
// If the ping interval is not in the monsetting table, then create the
|
||||
// default ping-interval
|
||||
if (!ping_flag) {
|
||||
ping = rsp[0].split(',');
|
||||
ping[0] = "xcatmon";
|
||||
ping[1] = "ping-interval";
|
||||
|
||||
// Set default ping-interval setting to 5
|
||||
ping[2] = "5";
|
||||
ping[3] = "";
|
||||
ping[4] = "";
|
||||
}
|
||||
|
||||
// Set checkbox to be true
|
||||
var checked = apps[2].split(',');
|
||||
for ( var i = 0; i < checked.length; i++) {
|
||||
$("input:checkbox[name=" + checked[i] + "]").attr('checked', true);
|
||||
for ( var j = 0; j < origCont.length; j++) {
|
||||
if (origCont[j][1] == checked[i]) {
|
||||
origCont[j].splice(3, 1);
|
||||
origCont[j].push('<input type="checkbox" name="' + origCont[j][1] + '" title="Check this checkbox to add/remove the app from the configured app value." checked=true/>');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$(":checkbox").tooltip();
|
||||
|
||||
// Make the table editable
|
||||
$('#' + xcatMonTableId + ' td:not(td:nth-child(1),td:last-child)').editable(function(value, settings) {
|
||||
var colPos = this.cellIndex;
|
||||
var rowPos = dTable.fnGetPosition(this.parentNode);
|
||||
dTable.fnUpdate(value, rowPos, colPos);
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit',
|
||||
type : 'textarea',
|
||||
placeholder : ' ',
|
||||
height : '30px'
|
||||
});
|
||||
|
||||
// Save datatable
|
||||
dTable = $('#' + xcatMonTableId).dataTable({
|
||||
'iDisplayLength': 50,
|
||||
'bLengthChange': false,
|
||||
"bScrollCollapse": true,
|
||||
"sScrollY": "400px",
|
||||
"sScrollX": "110%",
|
||||
"bAutoWidth": true,
|
||||
"oLanguage": {
|
||||
"oPaginate": {
|
||||
"sNext": "",
|
||||
"sPrevious": ""
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Create action bar
|
||||
var actionBar = $('<div class="actionBar"></div>');
|
||||
var addRowLnk = $('<a>Add row</a>');
|
||||
addRowLnk.bind('click', function(event) {
|
||||
// Create container for new row
|
||||
var row = new Array();
|
||||
|
||||
// Add delete button to row
|
||||
row.push('<span class="ui-icon ui-icon-close" onclick="deleteXcatMonRow(this)"></span>');
|
||||
for ( var i = 0; i < header.length - 2; i++)
|
||||
row.push('');
|
||||
|
||||
// Add checkbox
|
||||
row.push('<input type="checkbox" name="' + row[2] + '" title="Checking this checkbox will add/remove the app from the configured apps value"/>');
|
||||
// Get the datatable of the table
|
||||
var dTable = $('#' + xcatMonTableId).dataTable();
|
||||
// Add the new row to the datatable
|
||||
dTable.fnAddData(row);
|
||||
|
||||
// make the datatable editable
|
||||
$(":checkbox[title]").tooltip();
|
||||
$('#' + xcatMonTableId + ' td:not(td:nth-child(1),td:last-child)').editable(function(value, settings) {
|
||||
var colPos = this.cellIndex;
|
||||
var rowPos = dTable
|
||||
.fnGetPosition(this.parentNode);
|
||||
dTable.fnUpdate(value, rowPos,
|
||||
colPos);
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit',
|
||||
type : 'textarea',
|
||||
placeholder : ' ',
|
||||
height : '30px'
|
||||
});
|
||||
});
|
||||
|
||||
// Create apply button to store the contents of the table to the monsetting table
|
||||
var applyLnk = $('<a>Apply</a>');
|
||||
applyLnk.bind('click', function(event) {
|
||||
// Get the datatable
|
||||
var dTable = $('#' + xcatMonTableId).dataTable();
|
||||
// Get datatable rows
|
||||
var dRows = dTable.fnGetNodes();
|
||||
var count = 0;
|
||||
|
||||
// Create a new container for the apps value
|
||||
var appValue = '';
|
||||
var tableName = 'monsetting';
|
||||
var closeBtn = createButton('close');
|
||||
|
||||
// Get the row contents
|
||||
for ( var i = 0; i < dRows.length; i++) {
|
||||
if (dRows[i]) {
|
||||
// Get the row columns
|
||||
var cols = dRows[i].childNodes;
|
||||
// Create a container for the new columns
|
||||
var vals = new Array();
|
||||
|
||||
for ( var j = 1; j < cols.length - 1; j++) {
|
||||
var val = cols.item(j).firstChild.nodeValue;
|
||||
if (val == ' ')
|
||||
vals[j - 1] = '';
|
||||
else
|
||||
vals[j - 1] = val;
|
||||
}
|
||||
|
||||
var vals_orig = new Array();
|
||||
// Copy data from vals to vals_orig
|
||||
for ( var p = 0; p < 2; p++) {
|
||||
var val = vals[p];
|
||||
vals_orig[p] = val;
|
||||
}
|
||||
|
||||
vals.push('');
|
||||
vals.push('');
|
||||
vals.unshift('xcatmon');
|
||||
|
||||
// Stored new column to newCont
|
||||
newCont[i + 1] = vals;
|
||||
|
||||
if (cols.item(cols.length - 1).firstChild.checked) {
|
||||
vals_orig.push('<input type="checkbox" name="' + vals_orig[0] + '" title="Checking this checkbox will add/remove the app from the configured apps value" checked=true/>');
|
||||
} else {
|
||||
vals_orig.push('<input type="checkbox" name="' + vals_orig[0] + '" title="Checking this checkbox will add/remove the app from the configured apps value"/>');
|
||||
}
|
||||
|
||||
// Add delete button to row
|
||||
vals_orig.unshift('<span class="ui-icon ui-icon-close" onclick="deleteXcatMonRow(this)"></span>');
|
||||
// Add row to origCont
|
||||
origCont[i + 1] = vals_orig;
|
||||
count = i + 1;
|
||||
|
||||
// Check checkbox for every row when merging the app name with the apps values
|
||||
if (cols.item(cols.length - 1).firstChild.checked)
|
||||
appValue = appValue.concat(cols.item(2).firstChild.nodeValue + ",");
|
||||
}
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
// Delete the last comma of the apps value
|
||||
appValue = appValue.substring(0, (appValue.length - 1));
|
||||
apps[2] = appValue;
|
||||
|
||||
newCont[count++] = apps;
|
||||
newCont[count++] = ping;
|
||||
|
||||
// Add to other monitor settings
|
||||
for ( var j = 0; j < otherCont.length; j++) {
|
||||
newCont[count++] = otherCont[j];
|
||||
}
|
||||
|
||||
// Create save dialog
|
||||
var dialogSave = $('<div id="saveDialog" align="center">Saving configuration</div>');
|
||||
dialogSave.append(createLoader());
|
||||
|
||||
$('#xcatmon').append(dialogSave);
|
||||
$("#saveDialog").dialog({
|
||||
modal : true
|
||||
});
|
||||
|
||||
$('.ui-dialog-titlebar-close').hide();
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'lib/tabRestore.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
table : tableName,
|
||||
cont : newCont
|
||||
},
|
||||
success : function(data) {
|
||||
// do not put in until tabRestore.php has been updated: data = decodeRsp(data);
|
||||
// empty the dialog.add the close button
|
||||
$("#saveDialog").empty().append('<p>Configuration saved!</p>');
|
||||
$("#saveDialog").append(closeBtn);
|
||||
}
|
||||
});
|
||||
|
||||
// Close button
|
||||
closeBtn.bind('click', function(event) {
|
||||
$("#saveDialog").dialog("destroy");
|
||||
$("#saveDialog").remove();
|
||||
});
|
||||
|
||||
// Clear the newCont
|
||||
newCont = null;
|
||||
newCont = new Object();
|
||||
newCont[0] = rsp[0].split(",");
|
||||
});
|
||||
|
||||
var cancelLnk = $('<a>Cancel</a>');
|
||||
cancelLnk.bind('click', function(event) {
|
||||
// Get the datatable for the page
|
||||
var dTable = $('#' + xcatMonTableId).dataTable();
|
||||
|
||||
// Clear the datatable
|
||||
dTable.fnClearTable();
|
||||
|
||||
// Add the contents of origCont to the datatable
|
||||
for ( var i = 1; i < origCont.length; i++)
|
||||
dTable.fnAddData(origCont[i], true);
|
||||
|
||||
$(":checkbox[title]").tooltip();
|
||||
$('#' + xcatMonTableId + ' td:not(td:nth-child(1),td:last-child)').editable(function(value, settings) {
|
||||
var colPos = this.cellIndex;
|
||||
var rowPos = dTable.fnGetPosition(this.parentNode);
|
||||
dTable.fnUpdate(value, rowPos, colPos);
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit',
|
||||
type : 'textarea',
|
||||
placeholder : ' ',
|
||||
height : '30px'
|
||||
});
|
||||
});
|
||||
|
||||
// Create actions menu
|
||||
var actionsLnk = '<a>Actions</a>';
|
||||
var actsMenu = createMenu([ addRowLnk, applyLnk, cancelLnk ]);
|
||||
var actionsMenu = createMenu([ [ actionsLnk, actsMenu ] ]);
|
||||
actionsMenu.superfish();
|
||||
actionsMenu.css('display', 'inline-block');
|
||||
actionBar.append(actionsMenu);
|
||||
|
||||
// Create a division to hold actions menu
|
||||
var menuDiv = $('<div id="' + xcatMonTableId + '_menuDiv" class="menuDiv"></div>');
|
||||
$('#' + xcatMonTableId + '_wrapper').prepend(menuDiv);
|
||||
menuDiv.append(actionBar);
|
||||
$('#' + xcatMonTableId + '_filter').appendTo(menuDiv);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a row from the table
|
||||
*/
|
||||
function deleteXcatMonRow(obj) {
|
||||
var dTable = $('#' + xcatMonTableId).dataTable();
|
||||
var rows = dTable.fnGetNodes();
|
||||
var tgtRow = $(obj).parent().parent().get(0);
|
||||
for ( var i in rows) {
|
||||
if (rows[i] == tgtRow) {
|
||||
dTable.fnDeleteRow(i, null, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
+4419
-4329
File diff suppressed because it is too large
Load Diff
+307
-295
@@ -1,296 +1,308 @@
|
||||
/**
|
||||
* Load nodeset page
|
||||
*
|
||||
* @param tgtNodes Targets to run nodeset against
|
||||
*/
|
||||
function loadNodesetPage(tgtNodes) {
|
||||
// Get OS images
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'osimage',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : setOSImageCookies
|
||||
});
|
||||
|
||||
// Get nodes tab
|
||||
var tab = getNodesTab();
|
||||
|
||||
// Generate new tab ID
|
||||
var inst = 0;
|
||||
var tabId = 'nodesetTab' + inst;
|
||||
while ($('#' + tabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
tabId = 'nodesetTab' + inst;
|
||||
}
|
||||
|
||||
// Create nodeset form
|
||||
var nodesetForm = $('<div class="form"></div>');
|
||||
|
||||
// Create status bar
|
||||
var statBarId = 'nodesetStatusBar' + inst;
|
||||
var statBar = createStatusBar(statBarId).hide();
|
||||
|
||||
// Create loader
|
||||
var loader = createLoader('nodesetLoader');
|
||||
statBar.find('div').append(loader);
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Set the boot state for a node range');
|
||||
nodesetForm.append(statBar, infoBar);
|
||||
|
||||
// Create VM fieldset
|
||||
var vmFS = $('<fieldset></fieldset>');
|
||||
var vmLegend = $('<legend>Virtual Machine</legend>');
|
||||
vmFS.append(vmLegend);
|
||||
nodesetForm.append(vmFS);
|
||||
|
||||
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
vmFS.append(vmAttr);
|
||||
|
||||
// Create options fieldset
|
||||
var imageFS = $('<fieldset></fieldset>');
|
||||
var imageLegend = $('<legend>Image</legend>');
|
||||
imageFS.append(imageLegend);
|
||||
nodesetForm.append(imageFS);
|
||||
|
||||
var imageAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
imageFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>'));
|
||||
imageFS.append(imageAttr);
|
||||
|
||||
// Create target node or group
|
||||
var tgt = $('<div><label>Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to set the boot state for"/></div>');
|
||||
vmAttr.append(tgt);
|
||||
|
||||
// Create boot type drop down
|
||||
var type = $('<div></div>');
|
||||
var typeLabel = $('<label>Boot type:</label>');
|
||||
var typeSelect = $('<select id="bootType" name="bootType" title="The type of network booting to use for this node"></select>');
|
||||
typeSelect.append('<option value="zvm">zvm</option>'
|
||||
+ '<option value="install">pxe</option>'
|
||||
+ '<option value="iscsiboot">yaboot</option>'
|
||||
);
|
||||
type.append(typeLabel);
|
||||
type.append(typeSelect);
|
||||
imageAttr.append(type);
|
||||
|
||||
// Create operating system image input
|
||||
var os = $('<div></div>');
|
||||
var osLabel = $('<label>Operating system image:</label>');
|
||||
var osSelect = $('<select name="os" title="The operating system image to be installed on this node"></select>');
|
||||
osSelect.append($('<option value=""></option>'));
|
||||
|
||||
var imageNames = $.cookie('xcat_imagenames').split(',');
|
||||
if (imageNames) {
|
||||
imageNames.sort();
|
||||
for (var i in imageNames) {
|
||||
osSelect.append($('<option value="' + imageNames[i] + '">' + imageNames[i] + '</option>'));
|
||||
}
|
||||
}
|
||||
os.append(osLabel);
|
||||
os.append(osSelect);
|
||||
imageAttr.append(os);
|
||||
|
||||
// Generate tooltips
|
||||
nodesetForm.find('div input[title],select').tooltip({
|
||||
position: "center right",
|
||||
offset: [-2, 10],
|
||||
effect: "fade",
|
||||
opacity: 0.7,
|
||||
predelay: 800,
|
||||
events : {
|
||||
def : "mouseover,mouseout",
|
||||
input : "mouseover,mouseout",
|
||||
widget : "focus mouseover,blur mouseout",
|
||||
tooltip : "mouseover,mouseout"
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.css({
|
||||
'width': '80px',
|
||||
'display': 'block'
|
||||
});
|
||||
okBtn.bind('click', function(event) {
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
|
||||
// Check state, OS, arch, and profile
|
||||
var ready = true;
|
||||
var inputs = $('#' + tabId + ' input');
|
||||
for ( var i = 0; i < inputs.length; i++) {
|
||||
if (!inputs.eq(i).val() && inputs.eq(i).attr('name') != 'diskPw') {
|
||||
inputs.eq(i).css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
inputs.eq(i).css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
}
|
||||
|
||||
if (ready) {
|
||||
// Get nodes
|
||||
var tgts = $('#' + tabId + ' input[name=target]').val();
|
||||
// Get boot type
|
||||
var type = $('#' + tabId + ' select[id=bootType]').val();
|
||||
// Get operating system image
|
||||
var os = $('#' + tabId + ' select[name=os]').val();
|
||||
|
||||
// Disable all inputs, selects, and Ok button
|
||||
inputs.attr('disabled', 'disabled');
|
||||
$('#' + tabId + ' select').attr('disabled', 'disabled');
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
/**
|
||||
* (1) Set the OS, arch, and profile
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeadd',
|
||||
tgt : '',
|
||||
args : tgts + ';noderes.netboot=' + type,
|
||||
msg : 'cmd=nodeadd;inst=' + inst
|
||||
},
|
||||
|
||||
success : updateNodesetStatus
|
||||
});
|
||||
|
||||
// Show status bar
|
||||
statBar.show();
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('You are missing some values!');
|
||||
warn.prependTo($(this).parents('.ui-tabs-panel'));
|
||||
}
|
||||
});
|
||||
nodesetForm.append(okBtn);
|
||||
|
||||
// Append to discover tab
|
||||
tab.add(tabId, 'Nodeset', nodesetForm, true);
|
||||
|
||||
// Select new tab
|
||||
tab.select(tabId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update nodeset status
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function updateNodesetStatus(data) {
|
||||
// Get ajax response
|
||||
var rsp = data.rsp;
|
||||
var args = data.msg.split(';');
|
||||
var cmd = args[0].replace('cmd=', '');
|
||||
|
||||
// Get nodeset instance
|
||||
var inst = args[1].replace('inst=', '');
|
||||
// Get status bar ID
|
||||
var statBarId = 'nodesetStatusBar' + inst;
|
||||
// Get tab ID
|
||||
var tabId = 'nodesetTab' + inst;
|
||||
|
||||
// Get nodes
|
||||
var tgts = $('#' + tabId + ' input[name=target]').val();
|
||||
// Get operating system image
|
||||
var os = $('#' + tabId + ' select[name=os]').val();
|
||||
|
||||
/**
|
||||
* (2) Update /etc/hosts
|
||||
*/
|
||||
if (cmd == 'nodeadd') {
|
||||
if (rsp.length) {
|
||||
$('#' + statBarId).find('img').hide();
|
||||
$('#' + statBarId).find('div').append('<pre>(Error) Failed to create node definition</pre>');
|
||||
} else {
|
||||
// Create target nodes string
|
||||
var tgtNodesStr = '';
|
||||
var nodes = tgts.split(',');
|
||||
|
||||
// Loop through each node
|
||||
for ( var i in nodes) {
|
||||
// If it is the 1st and only node
|
||||
if (i == 0 && i == nodes.length - 1) {
|
||||
tgtNodesStr += nodes[i];
|
||||
}
|
||||
// If it is the 1st node of many nodes
|
||||
else if (i == 0 && i != nodes.length - 1) {
|
||||
// Append a comma to the string
|
||||
tgtNodesStr += nodes[i] + ', ';
|
||||
} else {
|
||||
// If it is the last node
|
||||
if (i == nodes.length - 1) {
|
||||
// Append nothing to the string
|
||||
tgtNodesStr += nodes[i];
|
||||
} else {
|
||||
// Append a comma to the string
|
||||
tgtNodesStr += nodes[i] + ', ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('#' + statBarId).find('div').append('<pre>Node definition created for ' + tgtNodesStr + '</pre>');
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'makehosts',
|
||||
tgt : '',
|
||||
args : '',
|
||||
msg : 'cmd=makehosts;inst=' + inst
|
||||
},
|
||||
|
||||
success : updateNodesetStatus
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (4) Update DNS
|
||||
*/
|
||||
else if (cmd == 'makehosts') {
|
||||
// If no output, no errors occurred
|
||||
if (rsp.length) {
|
||||
$('#' + statBarId).find('div').append('<pre>(Error) Failed to update /etc/hosts</pre>');
|
||||
} else {
|
||||
$('#' + statBarId).find('div').append('<pre>/etc/hosts updated</pre>');
|
||||
}
|
||||
|
||||
// Go straight to prepare node for boot
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeset',
|
||||
tgt : tgts,
|
||||
args : 'osimage=' + os,
|
||||
msg : 'cmd=nodeset;inst=' + inst
|
||||
},
|
||||
|
||||
success : updateNodesetStatus
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* (5) Boot node from network
|
||||
*/
|
||||
else if (cmd == 'nodeset') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
|
||||
// Hide loader
|
||||
$('#' + statBarId).find('img').hide();
|
||||
}
|
||||
/**
|
||||
* Load nodeset page
|
||||
*
|
||||
* @param tgtNodes Targets to run nodeset against
|
||||
*/
|
||||
function loadNodesetPage(tgtNodes) {
|
||||
// Get OS images
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'osimage',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
data = decodeRsp(data);
|
||||
setOSImageCookies(data);
|
||||
}
|
||||
});
|
||||
|
||||
// Get nodes tab
|
||||
var tab = getNodesTab();
|
||||
|
||||
// Generate new tab ID
|
||||
var inst = 0;
|
||||
var tabId = 'nodesetTab' + inst;
|
||||
while ($('#' + tabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
tabId = 'nodesetTab' + inst;
|
||||
}
|
||||
|
||||
// Create nodeset form
|
||||
var nodesetForm = $('<div class="form"></div>');
|
||||
|
||||
// Create status bar
|
||||
var statBarId = 'nodesetStatusBar' + inst;
|
||||
var statBar = createStatusBar(statBarId).hide();
|
||||
|
||||
// Create loader
|
||||
var loader = createLoader('nodesetLoader');
|
||||
statBar.find('div').append(loader);
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Set the boot state for a node range');
|
||||
nodesetForm.append(statBar, infoBar);
|
||||
|
||||
// Create VM fieldset
|
||||
var vmFS = $('<fieldset></fieldset>');
|
||||
var vmLegend = $('<legend>Virtual Machine</legend>');
|
||||
vmFS.append(vmLegend);
|
||||
nodesetForm.append(vmFS);
|
||||
|
||||
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
vmFS.append(vmAttr);
|
||||
|
||||
// Create options fieldset
|
||||
var imageFS = $('<fieldset></fieldset>');
|
||||
var imageLegend = $('<legend>Image</legend>');
|
||||
imageFS.append(imageLegend);
|
||||
nodesetForm.append(imageFS);
|
||||
|
||||
var imageAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
imageFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>'));
|
||||
imageFS.append(imageAttr);
|
||||
|
||||
// Create target node or group
|
||||
var tgt = $('<div><label>Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to set the boot state for"/></div>');
|
||||
vmAttr.append(tgt);
|
||||
|
||||
// Create boot type drop down
|
||||
var type = $('<div></div>');
|
||||
var typeLabel = $('<label>Boot type:</label>');
|
||||
var typeSelect = $('<select id="bootType" name="bootType" title="The type of network booting to use for this node"></select>');
|
||||
typeSelect.append('<option value="zvm">zvm</option>'
|
||||
+ '<option value="install">pxe</option>'
|
||||
+ '<option value="iscsiboot">yaboot</option>'
|
||||
);
|
||||
type.append(typeLabel);
|
||||
type.append(typeSelect);
|
||||
imageAttr.append(type);
|
||||
|
||||
// Create operating system image input
|
||||
var os = $('<div></div>');
|
||||
var osLabel = $('<label>Operating system image:</label>');
|
||||
var osSelect = $('<select name="os" title="The operating system image to be installed on this node"></select>');
|
||||
osSelect.append($('<option value=""></option>'));
|
||||
|
||||
var imageNames = $.cookie('xcat_imagenames').split(',');
|
||||
if (imageNames) {
|
||||
imageNames.sort();
|
||||
for (var i in imageNames) {
|
||||
osSelect.append($('<option value="' + imageNames[i] + '">' + imageNames[i] + '</option>'));
|
||||
}
|
||||
}
|
||||
os.append(osLabel);
|
||||
os.append(osSelect);
|
||||
imageAttr.append(os);
|
||||
|
||||
// Generate tooltips
|
||||
nodesetForm.find('div input[title],select').tooltip({
|
||||
position: "center right",
|
||||
offset: [-2, 10],
|
||||
effect: "fade",
|
||||
opacity: 0.7,
|
||||
predelay: 800,
|
||||
events : {
|
||||
def : "mouseover,mouseout",
|
||||
input : "mouseover,mouseout",
|
||||
widget : "focus mouseover,blur mouseout",
|
||||
tooltip : "mouseover,mouseout"
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.css({
|
||||
'width': '80px',
|
||||
'display': 'block'
|
||||
});
|
||||
okBtn.bind('click', function(event) {
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
|
||||
// Check state, OS, arch, and profile
|
||||
var ready = true;
|
||||
var inputs = $('#' + tabId + ' input');
|
||||
for ( var i = 0; i < inputs.length; i++) {
|
||||
if (!inputs.eq(i).val() && inputs.eq(i).attr('name') != 'diskPw') {
|
||||
inputs.eq(i).css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
inputs.eq(i).css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
}
|
||||
|
||||
if (ready) {
|
||||
// Get nodes
|
||||
var tgts = $('#' + tabId + ' input[name=target]').val();
|
||||
// Get boot type
|
||||
var type = $('#' + tabId + ' select[id=bootType]').val();
|
||||
// Get operating system image
|
||||
var os = $('#' + tabId + ' select[name=os]').val();
|
||||
|
||||
// Disable all inputs, selects, and Ok button
|
||||
inputs.attr('disabled', 'disabled');
|
||||
$('#' + tabId + ' select').attr('disabled', 'disabled');
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
/**
|
||||
* (1) Set the OS, arch, and profile
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeadd',
|
||||
tgt : '',
|
||||
args : tgts + ';noderes.netboot=' + type,
|
||||
msg : 'cmd=nodeadd;inst=' + inst
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
data = decodeRsp(data);
|
||||
updateNodesetStatus(data);
|
||||
}
|
||||
});
|
||||
|
||||
// Show status bar
|
||||
statBar.show();
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('You are missing some values!');
|
||||
warn.prependTo($(this).parents('.ui-tabs-panel'));
|
||||
}
|
||||
});
|
||||
nodesetForm.append(okBtn);
|
||||
|
||||
// Append to discover tab
|
||||
tab.add(tabId, 'Nodeset', nodesetForm, true);
|
||||
|
||||
// Select new tab
|
||||
tab.select(tabId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update nodeset status
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function updateNodesetStatus(data) {
|
||||
// Get ajax response
|
||||
var rsp = data.rsp;
|
||||
var args = data.msg.split(';');
|
||||
var cmd = args[0].replace('cmd=', '');
|
||||
|
||||
// Get nodeset instance
|
||||
var inst = args[1].replace('inst=', '');
|
||||
// Get status bar ID
|
||||
var statBarId = 'nodesetStatusBar' + inst;
|
||||
// Get tab ID
|
||||
var tabId = 'nodesetTab' + inst;
|
||||
|
||||
// Get nodes
|
||||
var tgts = $('#' + tabId + ' input[name=target]').val();
|
||||
// Get operating system image
|
||||
var os = $('#' + tabId + ' select[name=os]').val();
|
||||
|
||||
/**
|
||||
* (2) Update /etc/hosts
|
||||
*/
|
||||
if (cmd == 'nodeadd') {
|
||||
if (rsp.length) {
|
||||
$('#' + statBarId).find('img').hide();
|
||||
$('#' + statBarId).find('div').append('<pre>(Error) Failed to create node definition</pre>');
|
||||
} else {
|
||||
// Create target nodes string
|
||||
var tgtNodesStr = '';
|
||||
var nodes = tgts.split(',');
|
||||
|
||||
// Loop through each node
|
||||
for ( var i in nodes) {
|
||||
// If it is the 1st and only node
|
||||
if (i == 0 && i == nodes.length - 1) {
|
||||
tgtNodesStr += nodes[i];
|
||||
}
|
||||
// If it is the 1st node of many nodes
|
||||
else if (i == 0 && i != nodes.length - 1) {
|
||||
// Append a comma to the string
|
||||
tgtNodesStr += nodes[i] + ', ';
|
||||
} else {
|
||||
// If it is the last node
|
||||
if (i == nodes.length - 1) {
|
||||
// Append nothing to the string
|
||||
tgtNodesStr += nodes[i];
|
||||
} else {
|
||||
// Append a comma to the string
|
||||
tgtNodesStr += nodes[i] + ', ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('#' + statBarId).find('div').append('<pre>Node definition created for ' + tgtNodesStr + '</pre>');
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'makehosts',
|
||||
tgt : '',
|
||||
args : '',
|
||||
msg : 'cmd=makehosts;inst=' + inst
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
data = decodeRsp(data);
|
||||
updateNodesetStatus(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (4) Update DNS
|
||||
*/
|
||||
else if (cmd == 'makehosts') {
|
||||
// If no output, no errors occurred
|
||||
if (rsp.length) {
|
||||
$('#' + statBarId).find('div').append('<pre>(Error) Failed to update /etc/hosts</pre>');
|
||||
} else {
|
||||
$('#' + statBarId).find('div').append('<pre>/etc/hosts updated</pre>');
|
||||
}
|
||||
|
||||
// Go straight to prepare node for boot
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeset',
|
||||
tgt : tgts,
|
||||
args : 'osimage=' + os,
|
||||
msg : 'cmd=nodeset;inst=' + inst
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
data = decodeRsp(data);
|
||||
updateNodesetStatus(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* (5) Boot node from network
|
||||
*/
|
||||
else if (cmd == 'nodeset') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
|
||||
// Hide loader
|
||||
$('#' + statBarId).find('img').hide();
|
||||
}
|
||||
}
|
||||
+934
-932
File diff suppressed because it is too large
Load Diff
+222
-219
@@ -1,220 +1,223 @@
|
||||
/**
|
||||
* Load netboot page
|
||||
*
|
||||
* @param tgtNodes Targets to run rnetboot against
|
||||
*/
|
||||
function loadNetbootPage(tgtNodes) {
|
||||
// Get node OS
|
||||
var osHash = new Object();
|
||||
var nodes = tgtNodes.split(',');
|
||||
for (var i in nodes) {
|
||||
var os = getNodeAttr(nodes[i], 'os');
|
||||
var osBase = os.match(/[a-zA-Z]+/);
|
||||
if (osBase) {
|
||||
nodes[osBase] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Get nodes tab
|
||||
var tab = getNodesTab();
|
||||
|
||||
// Generate new tab ID
|
||||
var inst = 0;
|
||||
var newTabId = 'netbootTab' + inst;
|
||||
while ($('#' + newTabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
newTabId = 'netbootTab' + inst;
|
||||
}
|
||||
|
||||
// Create netboot form
|
||||
var netbootForm = $('<div class="form"></div>');
|
||||
|
||||
// Create status bar
|
||||
var statBarId = 'netbootStatusBar' + inst;
|
||||
var statusBar = createStatusBar(statBarId).hide();
|
||||
|
||||
// Create loader
|
||||
var loader = createLoader('netbootLoader');
|
||||
statusBar.find('div').append(loader);
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Cause the range of nodes to boot to network');
|
||||
netbootForm.append(statusBar, infoBar);
|
||||
|
||||
// Create VM fieldset
|
||||
var vmFS = $('<fieldset></fieldset>');
|
||||
var vmLegend = $('<legend>Virtual Machine</legend>');
|
||||
vmFS.append(vmLegend);
|
||||
netbootForm.append(vmFS);
|
||||
|
||||
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
vmFS.append(vmAttr);
|
||||
|
||||
// Create options fieldset
|
||||
var optionsFS = $('<fieldset></fieldset>');
|
||||
var optionsLegend = $('<legend>Options</legend>');
|
||||
optionsFS.append(optionsLegend);
|
||||
netbootForm.append(optionsFS);
|
||||
|
||||
var optionsAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
optionsFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>'));
|
||||
optionsFS.append(optionsAttr);
|
||||
|
||||
// Create target node or group input
|
||||
var target = $('<div><label>Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to boot to network"/></div>');
|
||||
vmAttr.append(target);
|
||||
|
||||
// Create options
|
||||
var optsLabel = $('<label>Options:</label>');
|
||||
var optsList = $('<ul></ul>');
|
||||
optionsAttr.append(optsList);
|
||||
|
||||
// Create boot order checkbox
|
||||
var opt = $('<li></li>');
|
||||
var bootOrderChkBox = $('<input type="checkbox" id="s" name="s"/>');
|
||||
opt.append(bootOrderChkBox);
|
||||
opt.append('Set the boot device order');
|
||||
optsList.append(opt);
|
||||
// Create boot order input
|
||||
var bootOrder = $('<li><label>Boot order:</label><input type="text" name="bootOrder"/></li>');
|
||||
bootOrder.hide();
|
||||
optsList.append(bootOrder);
|
||||
|
||||
// Create force reboot checkbox
|
||||
optsList.append('<li><input type="checkbox" id="F" name="F"/>Force reboot</li>');
|
||||
// Create force shutdown checkbox
|
||||
optsList.append('<li><input type="checkbox" id="f" name="f"/>Force immediate shutdown of the partition</li>');
|
||||
if (osHash['AIX']) {
|
||||
// Create iscsi dump checkbox
|
||||
optsList.append('<li><input type="checkbox" id="I" name="I"/>Do a iscsi dump on AIX</li>');
|
||||
}
|
||||
|
||||
// Show boot order when checkbox is checked
|
||||
bootOrderChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
bootOrder.show();
|
||||
} else {
|
||||
bootOrder.hide();
|
||||
}
|
||||
});
|
||||
|
||||
// Determine plugin
|
||||
var tmp = tgtNodes.split(',');
|
||||
for ( var i = 0; i < tmp.length; i++) {
|
||||
var mgt = getNodeAttr(tmp[i], 'mgt');
|
||||
// If it is zvm
|
||||
if (mgt == 'zvm') {
|
||||
// Add IPL input
|
||||
optsList.append('<div><label style="width: 40px;">IPL:</label><input type="text" name="ipl" title="The virtual address to IPL"/></div>');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Generate tooltips
|
||||
netbootForm.find('div input[title]').tooltip({
|
||||
position: "center right",
|
||||
offset: [-2, 10],
|
||||
effect: "fade",
|
||||
opacity: 0.7,
|
||||
predelay: 800,
|
||||
events : {
|
||||
def : "mouseover,mouseout",
|
||||
input : "mouseover,mouseout",
|
||||
widget : "focus mouseover,blur mouseout",
|
||||
tooltip : "mouseover,mouseout"
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.css({
|
||||
'width': '80px',
|
||||
'display': 'block'
|
||||
});
|
||||
okBtn.bind('click', function(event) {
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
|
||||
// Check inputs
|
||||
var ready = true;
|
||||
var inputs = $("#" + newTabId + " input[type='text']:visible");
|
||||
for ( var i = 0; i < inputs.length; i++) {
|
||||
if (!inputs.eq(i).val()) {
|
||||
inputs.eq(i).css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
inputs.eq(i).css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
}
|
||||
|
||||
// Generate arguments
|
||||
var chkBoxes = $("#" + newTabId + " input[type='checkbox']:checked");
|
||||
var optStr = '';
|
||||
var opt;
|
||||
for ( var i = 0; i < chkBoxes.length; i++) {
|
||||
opt = chkBoxes.eq(i).attr('name');
|
||||
optStr += '-' + opt;
|
||||
|
||||
// If it is the boot order
|
||||
if (opt == 's') {
|
||||
// Get the boot order
|
||||
optStr += ';' + $('#' + newTabId + ' input[name=bootOrder]').val();
|
||||
}
|
||||
|
||||
// Append ; to end of string
|
||||
if (i < (chkBoxes.length - 1)) {
|
||||
optStr += ';';
|
||||
}
|
||||
}
|
||||
|
||||
// If no inputs are empty
|
||||
if (ready) {
|
||||
// Get nodes
|
||||
var tgts = $('#' + newTabId + ' input[name=target]').val();
|
||||
|
||||
// Get IPL address
|
||||
var ipl = $('#' + newTabId + ' input[name=ipl]');
|
||||
if (ipl) {
|
||||
optStr += 'ipl=' + ipl.val();
|
||||
}
|
||||
|
||||
// Disable all inputs and Ok button
|
||||
$('#' + newTabId + ' input').attr('disabled', 'disabled');
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
/**
|
||||
* (1) Boot to network
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rnetboot',
|
||||
tgt : tgts,
|
||||
args : optStr,
|
||||
msg : 'out=' + statBarId + ';cmd=rnetboot;tgt=' + tgts
|
||||
},
|
||||
|
||||
success : updateStatusBar
|
||||
});
|
||||
|
||||
// Show status bar
|
||||
statusBar.show();
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('Please provide a value for each missing field.');
|
||||
warn.prependTo($(this).parents('.ui-tabs-panel'));
|
||||
}
|
||||
});
|
||||
netbootForm.append(okBtn);
|
||||
|
||||
// Append to discover tab
|
||||
tab.add(newTabId, 'Boot', netbootForm, true);
|
||||
|
||||
// Select new tab
|
||||
tab.select(newTabId);
|
||||
/**
|
||||
* Load netboot page
|
||||
*
|
||||
* @param tgtNodes Targets to run rnetboot against
|
||||
*/
|
||||
function loadNetbootPage(tgtNodes) {
|
||||
// Get node OS
|
||||
var osHash = new Object();
|
||||
var nodes = tgtNodes.split(',');
|
||||
for (var i in nodes) {
|
||||
var os = getNodeAttr(nodes[i], 'os');
|
||||
var osBase = os.match(/[a-zA-Z]+/);
|
||||
if (osBase) {
|
||||
nodes[osBase] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Get nodes tab
|
||||
var tab = getNodesTab();
|
||||
|
||||
// Generate new tab ID
|
||||
var inst = 0;
|
||||
var newTabId = 'netbootTab' + inst;
|
||||
while ($('#' + newTabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
newTabId = 'netbootTab' + inst;
|
||||
}
|
||||
|
||||
// Create netboot form
|
||||
var netbootForm = $('<div class="form"></div>');
|
||||
|
||||
// Create status bar
|
||||
var statBarId = 'netbootStatusBar' + inst;
|
||||
var statusBar = createStatusBar(statBarId).hide();
|
||||
|
||||
// Create loader
|
||||
var loader = createLoader('netbootLoader');
|
||||
statusBar.find('div').append(loader);
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Cause the range of nodes to boot to network');
|
||||
netbootForm.append(statusBar, infoBar);
|
||||
|
||||
// Create VM fieldset
|
||||
var vmFS = $('<fieldset></fieldset>');
|
||||
var vmLegend = $('<legend>Virtual Machine</legend>');
|
||||
vmFS.append(vmLegend);
|
||||
netbootForm.append(vmFS);
|
||||
|
||||
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
vmFS.append(vmAttr);
|
||||
|
||||
// Create options fieldset
|
||||
var optionsFS = $('<fieldset></fieldset>');
|
||||
var optionsLegend = $('<legend>Options</legend>');
|
||||
optionsFS.append(optionsLegend);
|
||||
netbootForm.append(optionsFS);
|
||||
|
||||
var optionsAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
optionsFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>'));
|
||||
optionsFS.append(optionsAttr);
|
||||
|
||||
// Create target node or group input
|
||||
var target = $('<div><label>Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to boot to network"/></div>');
|
||||
vmAttr.append(target);
|
||||
|
||||
// Create options
|
||||
var optsLabel = $('<label>Options:</label>');
|
||||
var optsList = $('<ul></ul>');
|
||||
optionsAttr.append(optsList);
|
||||
|
||||
// Create boot order checkbox
|
||||
var opt = $('<li></li>');
|
||||
var bootOrderChkBox = $('<input type="checkbox" id="s" name="s"/>');
|
||||
opt.append(bootOrderChkBox);
|
||||
opt.append('Set the boot device order');
|
||||
optsList.append(opt);
|
||||
// Create boot order input
|
||||
var bootOrder = $('<li><label>Boot order:</label><input type="text" name="bootOrder"/></li>');
|
||||
bootOrder.hide();
|
||||
optsList.append(bootOrder);
|
||||
|
||||
// Create force reboot checkbox
|
||||
optsList.append('<li><input type="checkbox" id="F" name="F"/>Force reboot</li>');
|
||||
// Create force shutdown checkbox
|
||||
optsList.append('<li><input type="checkbox" id="f" name="f"/>Force immediate shutdown of the partition</li>');
|
||||
if (osHash['AIX']) {
|
||||
// Create iscsi dump checkbox
|
||||
optsList.append('<li><input type="checkbox" id="I" name="I"/>Do a iscsi dump on AIX</li>');
|
||||
}
|
||||
|
||||
// Show boot order when checkbox is checked
|
||||
bootOrderChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
bootOrder.show();
|
||||
} else {
|
||||
bootOrder.hide();
|
||||
}
|
||||
});
|
||||
|
||||
// Determine plugin
|
||||
var tmp = tgtNodes.split(',');
|
||||
for ( var i = 0; i < tmp.length; i++) {
|
||||
var mgt = getNodeAttr(tmp[i], 'mgt');
|
||||
// If it is zvm
|
||||
if (mgt == 'zvm') {
|
||||
// Add IPL input
|
||||
optsList.append('<div><label style="width: 40px;">IPL:</label><input type="text" name="ipl" title="The virtual address to IPL"/></div>');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Generate tooltips
|
||||
netbootForm.find('div input[title]').tooltip({
|
||||
position: "center right",
|
||||
offset: [-2, 10],
|
||||
effect: "fade",
|
||||
opacity: 0.7,
|
||||
predelay: 800,
|
||||
events : {
|
||||
def : "mouseover,mouseout",
|
||||
input : "mouseover,mouseout",
|
||||
widget : "focus mouseover,blur mouseout",
|
||||
tooltip : "mouseover,mouseout"
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.css({
|
||||
'width': '80px',
|
||||
'display': 'block'
|
||||
});
|
||||
okBtn.bind('click', function(event) {
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
|
||||
// Check inputs
|
||||
var ready = true;
|
||||
var inputs = $("#" + newTabId + " input[type='text']:visible");
|
||||
for ( var i = 0; i < inputs.length; i++) {
|
||||
if (!inputs.eq(i).val()) {
|
||||
inputs.eq(i).css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
inputs.eq(i).css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
}
|
||||
|
||||
// Generate arguments
|
||||
var chkBoxes = $("#" + newTabId + " input[type='checkbox']:checked");
|
||||
var optStr = '';
|
||||
var opt;
|
||||
for ( var i = 0; i < chkBoxes.length; i++) {
|
||||
opt = chkBoxes.eq(i).attr('name');
|
||||
optStr += '-' + opt;
|
||||
|
||||
// If it is the boot order
|
||||
if (opt == 's') {
|
||||
// Get the boot order
|
||||
optStr += ';' + $('#' + newTabId + ' input[name=bootOrder]').val();
|
||||
}
|
||||
|
||||
// Append ; to end of string
|
||||
if (i < (chkBoxes.length - 1)) {
|
||||
optStr += ';';
|
||||
}
|
||||
}
|
||||
|
||||
// If no inputs are empty
|
||||
if (ready) {
|
||||
// Get nodes
|
||||
var tgts = $('#' + newTabId + ' input[name=target]').val();
|
||||
|
||||
// Get IPL address
|
||||
var ipl = $('#' + newTabId + ' input[name=ipl]');
|
||||
if (ipl) {
|
||||
optStr += 'ipl=' + ipl.val();
|
||||
}
|
||||
|
||||
// Disable all inputs and Ok button
|
||||
$('#' + newTabId + ' input').attr('disabled', 'disabled');
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
/**
|
||||
* (1) Boot to network
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rnetboot',
|
||||
tgt : tgts,
|
||||
args : optStr,
|
||||
msg : 'out=' + statBarId + ';cmd=rnetboot;tgt=' + tgts
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
data = decodeRsp(data);
|
||||
updateStatusBar(data);
|
||||
}
|
||||
});
|
||||
|
||||
// Show status bar
|
||||
statusBar.show();
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('Please provide a value for each missing field.');
|
||||
warn.prependTo($(this).parents('.ui-tabs-panel'));
|
||||
}
|
||||
});
|
||||
netbootForm.append(okBtn);
|
||||
|
||||
// Append to discover tab
|
||||
tab.add(newTabId, 'Boot', netbootForm, true);
|
||||
|
||||
// Select new tab
|
||||
tab.select(newTabId);
|
||||
}
|
||||
+173
-170
@@ -1,171 +1,174 @@
|
||||
/**
|
||||
* Load rscan page
|
||||
*
|
||||
* @param tgtNodes Targets to run rscan against
|
||||
*/
|
||||
function loadRscanPage(tgtNodes) {
|
||||
// Get node OS
|
||||
var osHash = new Object();
|
||||
var nodes = tgtNodes.split(',');
|
||||
for (var i in nodes) {
|
||||
var os = getNodeAttr(nodes[i], 'os');
|
||||
var osBase = os.match(/[a-zA-Z]+/);
|
||||
if (osBase) {
|
||||
nodes[osBase] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Get nodes tab
|
||||
var tab = getNodesTab();
|
||||
|
||||
// Generate new tab ID
|
||||
var inst = 0;
|
||||
var newTabId = 'rscanTab' + inst;
|
||||
while ($('#' + newTabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
newTabId = 'rscanTab' + inst;
|
||||
}
|
||||
|
||||
// Create rscan form
|
||||
var rscanForm = $('<div class="form"></div>');
|
||||
|
||||
// Create status bar
|
||||
var statBarId = 'rscanStatusBar' + inst;
|
||||
var statBar = createStatusBar(statBarId).hide();
|
||||
|
||||
// Create loader
|
||||
var loader = createLoader('rscanLoader');
|
||||
statBar.find('div').append(loader);
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Collects node information from one or more hardware control points');
|
||||
rscanForm.append(statBar, infoBar);
|
||||
|
||||
// Create VM fieldset
|
||||
var vmFS = $('<fieldset></fieldset>');
|
||||
var vmLegend = $('<legend>Virtual Machine</legend>');
|
||||
vmFS.append(vmLegend);
|
||||
rscanForm.append(vmFS);
|
||||
|
||||
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
vmFS.append(vmAttr);
|
||||
|
||||
// Create options fieldset
|
||||
var optionsFS = $('<fieldset></fieldset>');
|
||||
var optionsLegend = $('<legend>Options</legend>');
|
||||
optionsFS.append(optionsLegend);
|
||||
rscanForm.append(optionsFS);
|
||||
|
||||
var optionsAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
optionsFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>'));
|
||||
optionsFS.append(optionsAttr);
|
||||
|
||||
// Create target node or group input
|
||||
var target = $('<div><label>Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to scan"/></div>');
|
||||
vmAttr.append(target);
|
||||
|
||||
// Create options
|
||||
var optsList = $('<ul></ul>');
|
||||
optionsAttr.append(optsList);
|
||||
|
||||
optsList.append('<li><input type="checkbox" name="u"/>Updates and then prints out node definitions in the xCAT database for CEC/BPA</li>');
|
||||
optsList.append('<li><input type="checkbox" name="w"/>Writes output to xCAT database</li>');
|
||||
optsList.append('<li><input type="checkbox" name="x"/>XML format</li>');
|
||||
optsList.append('<li><input type="checkbox" name="z"/>Stanza formated output</li>');
|
||||
|
||||
// Generate tooltips
|
||||
rscanForm.find('div input[title]').tooltip({
|
||||
position: "center right",
|
||||
offset: [-2, 10],
|
||||
effect: "fade",
|
||||
opacity: 0.7,
|
||||
predelay: 800,
|
||||
events : {
|
||||
def : "mouseover,mouseout",
|
||||
input : "mouseover,mouseout",
|
||||
widget : "focus mouseover,blur mouseout",
|
||||
tooltip : "mouseover,mouseout"
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.css({
|
||||
'width': '80px',
|
||||
'display': 'block'
|
||||
});
|
||||
okBtn.bind('click', function(event) {
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
|
||||
// Check inputs
|
||||
var ready = true;
|
||||
var inputs = $("#" + newTabId + " input[type='text']");
|
||||
for ( var i = 0; i < inputs.length; i++) {
|
||||
if (!inputs.eq(i).val()) {
|
||||
inputs.eq(i).css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
inputs.eq(i).css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
}
|
||||
|
||||
// Generate arguments
|
||||
var chkBoxes = $("#" + newTabId + " input[type='checkbox']:checked");
|
||||
var optStr = '';
|
||||
var opt;
|
||||
for ( var i = 0; i < chkBoxes.length; i++) {
|
||||
opt = chkBoxes.eq(i).attr('name');
|
||||
optStr += '-' + opt;
|
||||
|
||||
// Append ; to end of string
|
||||
if (i < (chkBoxes.length - 1)) {
|
||||
optStr += ';';
|
||||
}
|
||||
}
|
||||
|
||||
// If no inputs are empty
|
||||
if (ready) {
|
||||
// Get nodes
|
||||
var tgts = $('#' + newTabId + ' input[name=target]').val();
|
||||
|
||||
// Disable all inputs and Ok button
|
||||
$('#' + newTabId + ' input').attr('disabled', 'disabled');
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
/**
|
||||
* (1) Scan
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rscan',
|
||||
tgt : tgts,
|
||||
args : optStr,
|
||||
msg : 'out=' + statBarId + ';cmd=rscan;tgt=' + tgts
|
||||
},
|
||||
|
||||
success : updateStatusBar
|
||||
});
|
||||
|
||||
// Show status bar
|
||||
statBar.show();
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('Please provide a value for each missing field.');
|
||||
warn.prependTo($(this).parents('.ui-tabs-panel'));
|
||||
}
|
||||
});
|
||||
rscanForm.append(okBtn);
|
||||
|
||||
// Append to discover tab
|
||||
tab.add(newTabId, 'Scan', rscanForm, true);
|
||||
|
||||
// Select new tab
|
||||
tab.select(newTabId);
|
||||
/**
|
||||
* Load rscan page
|
||||
*
|
||||
* @param tgtNodes Targets to run rscan against
|
||||
*/
|
||||
function loadRscanPage(tgtNodes) {
|
||||
// Get node OS
|
||||
var osHash = new Object();
|
||||
var nodes = tgtNodes.split(',');
|
||||
for (var i in nodes) {
|
||||
var os = getNodeAttr(nodes[i], 'os');
|
||||
var osBase = os.match(/[a-zA-Z]+/);
|
||||
if (osBase) {
|
||||
nodes[osBase] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Get nodes tab
|
||||
var tab = getNodesTab();
|
||||
|
||||
// Generate new tab ID
|
||||
var inst = 0;
|
||||
var newTabId = 'rscanTab' + inst;
|
||||
while ($('#' + newTabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
newTabId = 'rscanTab' + inst;
|
||||
}
|
||||
|
||||
// Create rscan form
|
||||
var rscanForm = $('<div class="form"></div>');
|
||||
|
||||
// Create status bar
|
||||
var statBarId = 'rscanStatusBar' + inst;
|
||||
var statBar = createStatusBar(statBarId).hide();
|
||||
|
||||
// Create loader
|
||||
var loader = createLoader('rscanLoader');
|
||||
statBar.find('div').append(loader);
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Collects node information from one or more hardware control points');
|
||||
rscanForm.append(statBar, infoBar);
|
||||
|
||||
// Create VM fieldset
|
||||
var vmFS = $('<fieldset></fieldset>');
|
||||
var vmLegend = $('<legend>Virtual Machine</legend>');
|
||||
vmFS.append(vmLegend);
|
||||
rscanForm.append(vmFS);
|
||||
|
||||
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
vmFS.append(vmAttr);
|
||||
|
||||
// Create options fieldset
|
||||
var optionsFS = $('<fieldset></fieldset>');
|
||||
var optionsLegend = $('<legend>Options</legend>');
|
||||
optionsFS.append(optionsLegend);
|
||||
rscanForm.append(optionsFS);
|
||||
|
||||
var optionsAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
optionsFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>'));
|
||||
optionsFS.append(optionsAttr);
|
||||
|
||||
// Create target node or group input
|
||||
var target = $('<div><label>Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to scan"/></div>');
|
||||
vmAttr.append(target);
|
||||
|
||||
// Create options
|
||||
var optsList = $('<ul></ul>');
|
||||
optionsAttr.append(optsList);
|
||||
|
||||
optsList.append('<li><input type="checkbox" name="u"/>Updates and then prints out node definitions in the xCAT database for CEC/BPA</li>');
|
||||
optsList.append('<li><input type="checkbox" name="w"/>Writes output to xCAT database</li>');
|
||||
optsList.append('<li><input type="checkbox" name="x"/>XML format</li>');
|
||||
optsList.append('<li><input type="checkbox" name="z"/>Stanza formated output</li>');
|
||||
|
||||
// Generate tooltips
|
||||
rscanForm.find('div input[title]').tooltip({
|
||||
position: "center right",
|
||||
offset: [-2, 10],
|
||||
effect: "fade",
|
||||
opacity: 0.7,
|
||||
predelay: 800,
|
||||
events : {
|
||||
def : "mouseover,mouseout",
|
||||
input : "mouseover,mouseout",
|
||||
widget : "focus mouseover,blur mouseout",
|
||||
tooltip : "mouseover,mouseout"
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.css({
|
||||
'width': '80px',
|
||||
'display': 'block'
|
||||
});
|
||||
okBtn.bind('click', function(event) {
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
|
||||
// Check inputs
|
||||
var ready = true;
|
||||
var inputs = $("#" + newTabId + " input[type='text']");
|
||||
for ( var i = 0; i < inputs.length; i++) {
|
||||
if (!inputs.eq(i).val()) {
|
||||
inputs.eq(i).css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
inputs.eq(i).css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
}
|
||||
|
||||
// Generate arguments
|
||||
var chkBoxes = $("#" + newTabId + " input[type='checkbox']:checked");
|
||||
var optStr = '';
|
||||
var opt;
|
||||
for ( var i = 0; i < chkBoxes.length; i++) {
|
||||
opt = chkBoxes.eq(i).attr('name');
|
||||
optStr += '-' + opt;
|
||||
|
||||
// Append ; to end of string
|
||||
if (i < (chkBoxes.length - 1)) {
|
||||
optStr += ';';
|
||||
}
|
||||
}
|
||||
|
||||
// If no inputs are empty
|
||||
if (ready) {
|
||||
// Get nodes
|
||||
var tgts = $('#' + newTabId + ' input[name=target]').val();
|
||||
|
||||
// Disable all inputs and Ok button
|
||||
$('#' + newTabId + ' input').attr('disabled', 'disabled');
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
/**
|
||||
* (1) Scan
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rscan',
|
||||
tgt : tgts,
|
||||
args : optStr,
|
||||
msg : 'out=' + statBarId + ';cmd=rscan;tgt=' + tgts
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
data = decodeRsp(data);
|
||||
updateStatusBar(data);
|
||||
}
|
||||
});
|
||||
|
||||
// Show status bar
|
||||
statBar.show();
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('Please provide a value for each missing field.');
|
||||
warn.prependTo($(this).parents('.ui-tabs-panel'));
|
||||
}
|
||||
});
|
||||
rscanForm.append(okBtn);
|
||||
|
||||
// Append to discover tab
|
||||
tab.add(newTabId, 'Scan', rscanForm, true);
|
||||
|
||||
// Select new tab
|
||||
tab.select(newTabId);
|
||||
}
|
||||
+408
-402
@@ -1,403 +1,409 @@
|
||||
/**
|
||||
* Load updatenode page
|
||||
*
|
||||
* @param tgtNodes Targets to run updatenode against
|
||||
*/
|
||||
function loadUpdatenodePage(tgtNodes) {
|
||||
// Get OS images
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'osimage',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : setOSImageCookies
|
||||
});
|
||||
|
||||
// Get node OS
|
||||
var osHash = new Object();
|
||||
var nodes = tgtNodes.split(',');
|
||||
for (var i in nodes) {
|
||||
var os = getNodeAttr(nodes[i], 'os');
|
||||
var osBase = os.match(/[a-zA-Z]+/);
|
||||
if (osBase) {
|
||||
nodes[osBase] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Get nodes tab
|
||||
var tab = getNodesTab();
|
||||
|
||||
// Generate new tab ID
|
||||
var inst = 0;
|
||||
var newTabId = 'updatenodeTab' + inst;
|
||||
while ($('#' + newTabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
newTabId = 'updatenodeTab' + inst;
|
||||
}
|
||||
|
||||
// Create rscan form
|
||||
var updatenodeForm = $('<div class="form"></div>');
|
||||
|
||||
// Create status bar
|
||||
var statBarId = 'updatenodeStatusBar' + inst;
|
||||
var statusBar = createStatusBar(statBarId).hide();
|
||||
|
||||
// Create loader
|
||||
var loader = createLoader('updatenodeLoader');
|
||||
statusBar.find('div').append(loader);
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Update nodes in an xCAT environment');
|
||||
updatenodeForm.append(statusBar, infoBar);
|
||||
|
||||
// Create VM fieldset
|
||||
var vmFS = $('<fieldset></fieldset>');
|
||||
var vmLegend = $('<legend>Virtual Machine</legend>');
|
||||
vmFS.append(vmLegend);
|
||||
updatenodeForm.append(vmFS);
|
||||
|
||||
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
vmFS.append(vmAttr);
|
||||
|
||||
// Create options fieldset
|
||||
var optionsFS = $('<fieldset></fieldset>');
|
||||
var optionsLegend = $('<legend>Options</legend>');
|
||||
optionsFS.append(optionsLegend);
|
||||
updatenodeForm.append(optionsFS);
|
||||
|
||||
var optionsAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
optionsFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>'));
|
||||
optionsFS.append(optionsAttr);
|
||||
|
||||
// Create target node or group input
|
||||
var tgt = $('<div><label>Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to update"/></div>');
|
||||
vmAttr.append(tgt);
|
||||
|
||||
// Create options
|
||||
var optionsList = $('<ul></ul>');
|
||||
optionsAttr.append(optionsList);
|
||||
|
||||
// Create update all software checkbox (only AIX)
|
||||
if (osHash['AIX']) {
|
||||
var updateAllOption = $('<li></li>');
|
||||
var updateAllChkBox = $('<input type="checkbox" id="A" name="A"/>');
|
||||
updateAllOption.append(updateAllChkBox);
|
||||
optionsList.append(updateAllOption);
|
||||
updateAllOption.append('Install or update all software contained in the source directory');
|
||||
|
||||
// Create source directory input
|
||||
var allSwScrDirectory = $('<li><label style="vertical-align: middle">Source directory:</label><input type="text" id="allSwSrcDirectory" name="allSwSrcDirectory"/></li>');
|
||||
// Browse server directory and files
|
||||
var allSWSrcDirBrowse = createButton('Browse');
|
||||
allSWSrcDirBrowse.serverBrowser({
|
||||
onSelect : function(path) {
|
||||
$('#allSwSrcDirectory').val(path);
|
||||
},
|
||||
onLoad : function() {
|
||||
return $('#allSwSrcDirectory').val();
|
||||
},
|
||||
knownExt : [ 'exe', 'js', 'txt' ],
|
||||
knownPaths : [ {
|
||||
text : 'Install',
|
||||
image : 'desktop.png',
|
||||
path : '/install'
|
||||
} ],
|
||||
imageUrl : 'images/serverbrowser/',
|
||||
systemImageUrl : 'images/serverbrowser/',
|
||||
handlerUrl : 'lib/getpath.php',
|
||||
title : 'Browse',
|
||||
requestMethod : 'POST',
|
||||
width : '500',
|
||||
height : '300',
|
||||
basePath : '/install' // Limit user to only install directory
|
||||
});
|
||||
allSwScrDirectory.append(allSWSrcDirBrowse);
|
||||
allSwScrDirectory.hide();
|
||||
optionsList.append(allSwScrDirectory);
|
||||
|
||||
// Show source directory when checked
|
||||
updateAllChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
allSwScrDirectory.show();
|
||||
} else {
|
||||
allSwScrDirectory.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Create update software checkbox
|
||||
var updateOption = $('<li></li>');
|
||||
var updateChkBox = $('<input type="checkbox" id="S" name="S"/>');
|
||||
optionsList.append(updateOption);
|
||||
updateOption.append(updateChkBox);
|
||||
updateOption.append('Update existing software');
|
||||
|
||||
// Create source directory input
|
||||
var scrDirectory = $('<li><label style="vertical-align: middle">Source directory:</label><input type="text" id="srcDirectory" name="srcDirectory" title="You must give the source directory containing the updated software packages"/></li>');
|
||||
// Browse server directory and files
|
||||
var srcDirBrowse = createButton('Browse');
|
||||
srcDirBrowse.serverBrowser({
|
||||
onSelect : function(path) {
|
||||
$('#srcDirectory').val(path);
|
||||
},
|
||||
onLoad : function() {
|
||||
return $('#srcDirectory').val();
|
||||
},
|
||||
knownExt : [ 'exe', 'js', 'txt' ],
|
||||
knownPaths : [ {
|
||||
text : 'Install',
|
||||
image : 'desktop.png',
|
||||
path : '/install'
|
||||
} ],
|
||||
imageUrl : 'images/serverbrowser/',
|
||||
systemImageUrl : 'images/serverbrowser/',
|
||||
handlerUrl : 'lib/getpath.php',
|
||||
title : 'Browse',
|
||||
requestMethod : 'POST',
|
||||
width : '500',
|
||||
height : '300',
|
||||
basePath : '/install' // Limit user to only install directory
|
||||
});
|
||||
scrDirectory.append(srcDirBrowse);
|
||||
scrDirectory.hide();
|
||||
optionsList.append(scrDirectory);
|
||||
|
||||
// Create other packages input
|
||||
var otherPkgs = $('<li><label style="vertical-align: middle">otherpkgs:</label><input type="text" id="otherpkgs" name="otherpkgs"/></li>');
|
||||
otherPkgs.hide();
|
||||
optionsList.append(otherPkgs);
|
||||
|
||||
// Create RPM flags input (only AIX)
|
||||
var aixRpmFlags = $('<li><label>rpm_flags:</label><input type="text" name="rpm_flags"/></li>');
|
||||
aixRpmFlags.hide();
|
||||
optionsList.append(aixRpmFlags);
|
||||
|
||||
// Create installp flags input (only AIX)
|
||||
var aixInstallPFlags = $('<li><label>installp_flags:</label><input type="text" name="installp_flags"/></li>');
|
||||
aixInstallPFlags.hide();
|
||||
optionsList.append(aixInstallPFlags);
|
||||
|
||||
// Create emgr flags input (only AIX)
|
||||
var aixEmgrFlags = $('<li><label>emgr_flags:</label><input type="text" name="emgr_flags"/></li>');
|
||||
aixEmgrFlags.hide();
|
||||
optionsList.append(aixEmgrFlags);
|
||||
|
||||
// Show flags when checked
|
||||
updateChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
scrDirectory.show();
|
||||
otherPkgs.show();
|
||||
if (osHash['AIX']) {
|
||||
aixRpmFlags.show();
|
||||
aixInstallPFlags.show();
|
||||
aixEmgrFlags.show();
|
||||
}
|
||||
} else {
|
||||
scrDirectory.hide();
|
||||
otherPkgs.hide();
|
||||
if (osHash['AIX']) {
|
||||
aixRpmFlags.hide();
|
||||
aixInstallPFlags.hide();
|
||||
aixEmgrFlags.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Create postscripts input
|
||||
var postOption = $('<li></li>');
|
||||
var postChkBox = $('<input type="checkbox" id="P" name="P"/>');
|
||||
optionsList.append(postOption);
|
||||
postOption.append(postChkBox);
|
||||
postOption.append('Run postscripts');
|
||||
var postscripts = $('<li><label style="vertical-align: middle">Postscripts:</label><input type="text" id="postscripts" name="postscripts" title="You must give the postscript(s) to run"/></li>');
|
||||
postscripts.hide();
|
||||
optionsList.append(postscripts);
|
||||
|
||||
// Show alternate source directory when checked
|
||||
postChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
postscripts.show();
|
||||
} else {
|
||||
postscripts.hide();
|
||||
}
|
||||
});
|
||||
optionsList.append('<li><input type="checkbox" id="F" name="F"/>Distribute and synchronize files</li>');
|
||||
optionsList.append('<li><input type="checkbox" id="k" name="k"/>Update the ssh keys and host keys for the service nodes and compute nodes</li>');
|
||||
|
||||
// Create update OS checkbox
|
||||
if (!osHash['AIX']) {
|
||||
var osOption = $('<li></li>');
|
||||
var osChkBox = $('<input type="checkbox" id="o" name="o"/>');
|
||||
optionsList.append(osOption);
|
||||
osOption.append(osChkBox);
|
||||
osOption.append('Update the operating system');
|
||||
|
||||
var os = $('<li></li>').hide();
|
||||
var osLabel = $('<label>Operating system:</label>');
|
||||
var osInput = $('<input type="text" name="os" title="You must give the operating system to upgrade to, e.g. rhel5.5"/>');
|
||||
osInput.one('focus', function(){
|
||||
var tmp = $.cookie('xcat_osvers');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
os.append(osLabel);
|
||||
os.append(osInput);
|
||||
optionsList.append(os);
|
||||
|
||||
// Show alternate source directory when checked
|
||||
osChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
os.show();
|
||||
} else {
|
||||
os.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Generate tooltips
|
||||
updatenodeForm.find('div input[title]').tooltip({
|
||||
position: "center right",
|
||||
offset: [-2, 10],
|
||||
effect: "fade",
|
||||
opacity: 0.7,
|
||||
predelay: 800,
|
||||
events : {
|
||||
def : "mouseover,mouseout",
|
||||
input : "mouseover,mouseout",
|
||||
widget : "focus mouseover,blur mouseout",
|
||||
tooltip : "mouseover,mouseout"
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var updateBtn = createButton('Update');
|
||||
updateBtn.css({
|
||||
'width': '80px',
|
||||
'display': 'block'
|
||||
});
|
||||
updateBtn.bind('click', function(event) {
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
var ready = true;
|
||||
|
||||
// Generate arguments
|
||||
var chkBoxes = $("#" + newTabId + " input[type='checkbox']:checked");
|
||||
var optionsStr = '';
|
||||
var option;
|
||||
for ( var i = 0; i < chkBoxes.length; i++) {
|
||||
option = chkBoxes.eq(i).attr('name');
|
||||
optionsStr += '-' + option;
|
||||
|
||||
// If update all software is checked
|
||||
if (option == 'S') {
|
||||
var srcDir = $('#' + newTabId + ' input[name=allSwSrcDirectory]').val();
|
||||
if (srcDir) {
|
||||
optionsStr += ';-d ' + srcDir;
|
||||
}
|
||||
}
|
||||
|
||||
// If update software is checked
|
||||
if (option == 'S') {
|
||||
// Get source directory
|
||||
var srcDirectory = $('#' + newTabId + ' input[name=srcDirectory]').val();
|
||||
if (srcDirectory) {
|
||||
optionsStr += ';-d;' + srcDirectory;
|
||||
}
|
||||
|
||||
// Get otherpkgs
|
||||
var otherpkgs = $('#' + newTabId + ' input[name=otherpkgs]').val();
|
||||
if (otherpkgs) {
|
||||
optionsStr += ';otherpkgs=' + otherpkgs;
|
||||
}
|
||||
|
||||
// Get rpm_flags
|
||||
var rpm_flags = $('#' + newTabId + ' input[name=rpm_flags]').val();
|
||||
if (rpm_flags) {
|
||||
optionsStr += ';rpm_flags=' + rpm_flags;
|
||||
}
|
||||
|
||||
// Get installp_flags
|
||||
var installp_flags = $('#' + newTabId + ' input[name=installp_flags]').val();
|
||||
if (installp_flags) {
|
||||
optionsStr += ';installp_flags=' + installp_flags;
|
||||
}
|
||||
|
||||
// Get emgr_flags
|
||||
var emgr_flags = $('#' + newTabId + ' input[name=emgr_flags]').val();
|
||||
if (emgr_flags) {
|
||||
optionsStr += ';emgr_flags=' + emgr_flags;
|
||||
}
|
||||
}
|
||||
|
||||
// If postscripts is checked
|
||||
if (option == 'P') {
|
||||
// Get postscripts
|
||||
optionsStr += ';' + $('#' + newTabId + ' input[name=postscripts]').val();
|
||||
}
|
||||
|
||||
// If operating system is checked
|
||||
if (option == 'o') {
|
||||
// Get the OS
|
||||
optionsStr += ';' + $('#' + newTabId + ' input[name=os]').val();
|
||||
}
|
||||
|
||||
// Append ; to end of string
|
||||
if (i < (chkBoxes.length - 1)) {
|
||||
optionsStr += ';';
|
||||
}
|
||||
}
|
||||
|
||||
// If no inputs are empty
|
||||
if (ready) {
|
||||
// Get nodes
|
||||
var tgts = $('#' + newTabId + ' input[name=target]').val();
|
||||
|
||||
// Disable all inputs and Ok button
|
||||
$('#' + newTabId + ' input').attr('disabled', 'disabled');
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
/**
|
||||
* (1) Boot to network
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'updatenode',
|
||||
tgt : tgts,
|
||||
args : optionsStr,
|
||||
msg : 'out=' + statBarId + ';cmd=updatenode;tgt=' + tgts
|
||||
},
|
||||
|
||||
success : updateStatusBar
|
||||
});
|
||||
|
||||
// Show status bar
|
||||
statusBar.show();
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('You are missing some values');
|
||||
warn.prependTo($(this).parents('.ui-tabs-panel'));
|
||||
}
|
||||
});
|
||||
updatenodeForm.append(updateBtn);
|
||||
|
||||
// Append to discover tab
|
||||
tab.add(newTabId, 'Update', updatenodeForm, true);
|
||||
|
||||
// Select new tab
|
||||
tab.select(newTabId);
|
||||
/**
|
||||
* Load updatenode page
|
||||
*
|
||||
* @param tgtNodes Targets to run updatenode against
|
||||
*/
|
||||
function loadUpdatenodePage(tgtNodes) {
|
||||
// Get OS images
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'osimage',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
data = decodeRsp(data);
|
||||
setOSImageCookies(data);
|
||||
}
|
||||
});
|
||||
|
||||
// Get node OS
|
||||
var osHash = new Object();
|
||||
var nodes = tgtNodes.split(',');
|
||||
for (var i in nodes) {
|
||||
var os = getNodeAttr(nodes[i], 'os');
|
||||
var osBase = os.match(/[a-zA-Z]+/);
|
||||
if (osBase) {
|
||||
nodes[osBase] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Get nodes tab
|
||||
var tab = getNodesTab();
|
||||
|
||||
// Generate new tab ID
|
||||
var inst = 0;
|
||||
var newTabId = 'updatenodeTab' + inst;
|
||||
while ($('#' + newTabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
newTabId = 'updatenodeTab' + inst;
|
||||
}
|
||||
|
||||
// Create rscan form
|
||||
var updatenodeForm = $('<div class="form"></div>');
|
||||
|
||||
// Create status bar
|
||||
var statBarId = 'updatenodeStatusBar' + inst;
|
||||
var statusBar = createStatusBar(statBarId).hide();
|
||||
|
||||
// Create loader
|
||||
var loader = createLoader('updatenodeLoader');
|
||||
statusBar.find('div').append(loader);
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Update nodes in an xCAT environment');
|
||||
updatenodeForm.append(statusBar, infoBar);
|
||||
|
||||
// Create VM fieldset
|
||||
var vmFS = $('<fieldset></fieldset>');
|
||||
var vmLegend = $('<legend>Virtual Machine</legend>');
|
||||
vmFS.append(vmLegend);
|
||||
updatenodeForm.append(vmFS);
|
||||
|
||||
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
vmFS.append(vmAttr);
|
||||
|
||||
// Create options fieldset
|
||||
var optionsFS = $('<fieldset></fieldset>');
|
||||
var optionsLegend = $('<legend>Options</legend>');
|
||||
optionsFS.append(optionsLegend);
|
||||
updatenodeForm.append(optionsFS);
|
||||
|
||||
var optionsAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
optionsFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>'));
|
||||
optionsFS.append(optionsAttr);
|
||||
|
||||
// Create target node or group input
|
||||
var tgt = $('<div><label>Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to update"/></div>');
|
||||
vmAttr.append(tgt);
|
||||
|
||||
// Create options
|
||||
var optionsList = $('<ul></ul>');
|
||||
optionsAttr.append(optionsList);
|
||||
|
||||
// Create update all software checkbox (only AIX)
|
||||
if (osHash['AIX']) {
|
||||
var updateAllOption = $('<li></li>');
|
||||
var updateAllChkBox = $('<input type="checkbox" id="A" name="A"/>');
|
||||
updateAllOption.append(updateAllChkBox);
|
||||
optionsList.append(updateAllOption);
|
||||
updateAllOption.append('Install or update all software contained in the source directory');
|
||||
|
||||
// Create source directory input
|
||||
var allSwScrDirectory = $('<li><label style="vertical-align: middle">Source directory:</label><input type="text" id="allSwSrcDirectory" name="allSwSrcDirectory"/></li>');
|
||||
// Browse server directory and files
|
||||
var allSWSrcDirBrowse = createButton('Browse');
|
||||
allSWSrcDirBrowse.serverBrowser({
|
||||
onSelect : function(path) {
|
||||
$('#allSwSrcDirectory').val(path);
|
||||
},
|
||||
onLoad : function() {
|
||||
return $('#allSwSrcDirectory').val();
|
||||
},
|
||||
knownExt : [ 'exe', 'js', 'txt' ],
|
||||
knownPaths : [ {
|
||||
text : 'Install',
|
||||
image : 'desktop.png',
|
||||
path : '/install'
|
||||
} ],
|
||||
imageUrl : 'images/serverbrowser/',
|
||||
systemImageUrl : 'images/serverbrowser/',
|
||||
handlerUrl : 'lib/getpath.php',
|
||||
title : 'Browse',
|
||||
requestMethod : 'POST',
|
||||
width : '500',
|
||||
height : '300',
|
||||
basePath : '/install' // Limit user to only install directory
|
||||
});
|
||||
allSwScrDirectory.append(allSWSrcDirBrowse);
|
||||
allSwScrDirectory.hide();
|
||||
optionsList.append(allSwScrDirectory);
|
||||
|
||||
// Show source directory when checked
|
||||
updateAllChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
allSwScrDirectory.show();
|
||||
} else {
|
||||
allSwScrDirectory.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Create update software checkbox
|
||||
var updateOption = $('<li></li>');
|
||||
var updateChkBox = $('<input type="checkbox" id="S" name="S"/>');
|
||||
optionsList.append(updateOption);
|
||||
updateOption.append(updateChkBox);
|
||||
updateOption.append('Update existing software');
|
||||
|
||||
// Create source directory input
|
||||
var scrDirectory = $('<li><label style="vertical-align: middle">Source directory:</label><input type="text" id="srcDirectory" name="srcDirectory" title="You must give the source directory containing the updated software packages"/></li>');
|
||||
// Browse server directory and files
|
||||
var srcDirBrowse = createButton('Browse');
|
||||
srcDirBrowse.serverBrowser({
|
||||
onSelect : function(path) {
|
||||
$('#srcDirectory').val(path);
|
||||
},
|
||||
onLoad : function() {
|
||||
return $('#srcDirectory').val();
|
||||
},
|
||||
knownExt : [ 'exe', 'js', 'txt' ],
|
||||
knownPaths : [ {
|
||||
text : 'Install',
|
||||
image : 'desktop.png',
|
||||
path : '/install'
|
||||
} ],
|
||||
imageUrl : 'images/serverbrowser/',
|
||||
systemImageUrl : 'images/serverbrowser/',
|
||||
handlerUrl : 'lib/getpath.php',
|
||||
title : 'Browse',
|
||||
requestMethod : 'POST',
|
||||
width : '500',
|
||||
height : '300',
|
||||
basePath : '/install' // Limit user to only install directory
|
||||
});
|
||||
scrDirectory.append(srcDirBrowse);
|
||||
scrDirectory.hide();
|
||||
optionsList.append(scrDirectory);
|
||||
|
||||
// Create other packages input
|
||||
var otherPkgs = $('<li><label style="vertical-align: middle">otherpkgs:</label><input type="text" id="otherpkgs" name="otherpkgs"/></li>');
|
||||
otherPkgs.hide();
|
||||
optionsList.append(otherPkgs);
|
||||
|
||||
// Create RPM flags input (only AIX)
|
||||
var aixRpmFlags = $('<li><label>rpm_flags:</label><input type="text" name="rpm_flags"/></li>');
|
||||
aixRpmFlags.hide();
|
||||
optionsList.append(aixRpmFlags);
|
||||
|
||||
// Create installp flags input (only AIX)
|
||||
var aixInstallPFlags = $('<li><label>installp_flags:</label><input type="text" name="installp_flags"/></li>');
|
||||
aixInstallPFlags.hide();
|
||||
optionsList.append(aixInstallPFlags);
|
||||
|
||||
// Create emgr flags input (only AIX)
|
||||
var aixEmgrFlags = $('<li><label>emgr_flags:</label><input type="text" name="emgr_flags"/></li>');
|
||||
aixEmgrFlags.hide();
|
||||
optionsList.append(aixEmgrFlags);
|
||||
|
||||
// Show flags when checked
|
||||
updateChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
scrDirectory.show();
|
||||
otherPkgs.show();
|
||||
if (osHash['AIX']) {
|
||||
aixRpmFlags.show();
|
||||
aixInstallPFlags.show();
|
||||
aixEmgrFlags.show();
|
||||
}
|
||||
} else {
|
||||
scrDirectory.hide();
|
||||
otherPkgs.hide();
|
||||
if (osHash['AIX']) {
|
||||
aixRpmFlags.hide();
|
||||
aixInstallPFlags.hide();
|
||||
aixEmgrFlags.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Create postscripts input
|
||||
var postOption = $('<li></li>');
|
||||
var postChkBox = $('<input type="checkbox" id="P" name="P"/>');
|
||||
optionsList.append(postOption);
|
||||
postOption.append(postChkBox);
|
||||
postOption.append('Run postscripts');
|
||||
var postscripts = $('<li><label style="vertical-align: middle">Postscripts:</label><input type="text" id="postscripts" name="postscripts" title="You must give the postscript(s) to run"/></li>');
|
||||
postscripts.hide();
|
||||
optionsList.append(postscripts);
|
||||
|
||||
// Show alternate source directory when checked
|
||||
postChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
postscripts.show();
|
||||
} else {
|
||||
postscripts.hide();
|
||||
}
|
||||
});
|
||||
optionsList.append('<li><input type="checkbox" id="F" name="F"/>Distribute and synchronize files</li>');
|
||||
optionsList.append('<li><input type="checkbox" id="k" name="k"/>Update the ssh keys and host keys for the service nodes and compute nodes</li>');
|
||||
|
||||
// Create update OS checkbox
|
||||
if (!osHash['AIX']) {
|
||||
var osOption = $('<li></li>');
|
||||
var osChkBox = $('<input type="checkbox" id="o" name="o"/>');
|
||||
optionsList.append(osOption);
|
||||
osOption.append(osChkBox);
|
||||
osOption.append('Update the operating system');
|
||||
|
||||
var os = $('<li></li>').hide();
|
||||
var osLabel = $('<label>Operating system:</label>');
|
||||
var osInput = $('<input type="text" name="os" title="You must give the operating system to upgrade to, e.g. rhel5.5"/>');
|
||||
osInput.one('focus', function(){
|
||||
var tmp = $.cookie('xcat_osvers');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
os.append(osLabel);
|
||||
os.append(osInput);
|
||||
optionsList.append(os);
|
||||
|
||||
// Show alternate source directory when checked
|
||||
osChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
os.show();
|
||||
} else {
|
||||
os.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Generate tooltips
|
||||
updatenodeForm.find('div input[title]').tooltip({
|
||||
position: "center right",
|
||||
offset: [-2, 10],
|
||||
effect: "fade",
|
||||
opacity: 0.7,
|
||||
predelay: 800,
|
||||
events : {
|
||||
def : "mouseover,mouseout",
|
||||
input : "mouseover,mouseout",
|
||||
widget : "focus mouseover,blur mouseout",
|
||||
tooltip : "mouseover,mouseout"
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var updateBtn = createButton('Update');
|
||||
updateBtn.css({
|
||||
'width': '80px',
|
||||
'display': 'block'
|
||||
});
|
||||
updateBtn.bind('click', function(event) {
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
var ready = true;
|
||||
|
||||
// Generate arguments
|
||||
var chkBoxes = $("#" + newTabId + " input[type='checkbox']:checked");
|
||||
var optionsStr = '';
|
||||
var option;
|
||||
for ( var i = 0; i < chkBoxes.length; i++) {
|
||||
option = chkBoxes.eq(i).attr('name');
|
||||
optionsStr += '-' + option;
|
||||
|
||||
// If update all software is checked
|
||||
if (option == 'S') {
|
||||
var srcDir = $('#' + newTabId + ' input[name=allSwSrcDirectory]').val();
|
||||
if (srcDir) {
|
||||
optionsStr += ';-d ' + srcDir;
|
||||
}
|
||||
}
|
||||
|
||||
// If update software is checked
|
||||
if (option == 'S') {
|
||||
// Get source directory
|
||||
var srcDirectory = $('#' + newTabId + ' input[name=srcDirectory]').val();
|
||||
if (srcDirectory) {
|
||||
optionsStr += ';-d;' + srcDirectory;
|
||||
}
|
||||
|
||||
// Get otherpkgs
|
||||
var otherpkgs = $('#' + newTabId + ' input[name=otherpkgs]').val();
|
||||
if (otherpkgs) {
|
||||
optionsStr += ';otherpkgs=' + otherpkgs;
|
||||
}
|
||||
|
||||
// Get rpm_flags
|
||||
var rpm_flags = $('#' + newTabId + ' input[name=rpm_flags]').val();
|
||||
if (rpm_flags) {
|
||||
optionsStr += ';rpm_flags=' + rpm_flags;
|
||||
}
|
||||
|
||||
// Get installp_flags
|
||||
var installp_flags = $('#' + newTabId + ' input[name=installp_flags]').val();
|
||||
if (installp_flags) {
|
||||
optionsStr += ';installp_flags=' + installp_flags;
|
||||
}
|
||||
|
||||
// Get emgr_flags
|
||||
var emgr_flags = $('#' + newTabId + ' input[name=emgr_flags]').val();
|
||||
if (emgr_flags) {
|
||||
optionsStr += ';emgr_flags=' + emgr_flags;
|
||||
}
|
||||
}
|
||||
|
||||
// If postscripts is checked
|
||||
if (option == 'P') {
|
||||
// Get postscripts
|
||||
optionsStr += ';' + $('#' + newTabId + ' input[name=postscripts]').val();
|
||||
}
|
||||
|
||||
// If operating system is checked
|
||||
if (option == 'o') {
|
||||
// Get the OS
|
||||
optionsStr += ';' + $('#' + newTabId + ' input[name=os]').val();
|
||||
}
|
||||
|
||||
// Append ; to end of string
|
||||
if (i < (chkBoxes.length - 1)) {
|
||||
optionsStr += ';';
|
||||
}
|
||||
}
|
||||
|
||||
// If no inputs are empty
|
||||
if (ready) {
|
||||
// Get nodes
|
||||
var tgts = $('#' + newTabId + ' input[name=target]').val();
|
||||
|
||||
// Disable all inputs and Ok button
|
||||
$('#' + newTabId + ' input').attr('disabled', 'disabled');
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
/**
|
||||
* (1) Boot to network
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'updatenode',
|
||||
tgt : tgts,
|
||||
args : optionsStr,
|
||||
msg : 'out=' + statBarId + ';cmd=updatenode;tgt=' + tgts
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
data = decodeRsp(data);
|
||||
updateStatusBar(data);
|
||||
}
|
||||
});
|
||||
|
||||
// Show status bar
|
||||
statusBar.show();
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('You are missing some values');
|
||||
warn.prependTo($(this).parents('.ui-tabs-panel'));
|
||||
}
|
||||
});
|
||||
updatenodeForm.append(updateBtn);
|
||||
|
||||
// Append to discover tab
|
||||
tab.add(newTabId, 'Update', updatenodeForm, true);
|
||||
|
||||
// Select new tab
|
||||
tab.select(newTabId);
|
||||
}
|
||||
+1461
-1434
File diff suppressed because it is too large
Load Diff
+257
-251
@@ -1,252 +1,258 @@
|
||||
/**
|
||||
* Global variables
|
||||
*/
|
||||
var provisionTabs; // Provision tabs
|
||||
|
||||
/**
|
||||
* Set the provision tab
|
||||
*
|
||||
* @param obj Tab object
|
||||
*/
|
||||
function setProvisionTab(obj) {
|
||||
provisionTabs = obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the provision tab
|
||||
*
|
||||
* @param Nothing
|
||||
* @return Tab object
|
||||
*/
|
||||
function getProvisionTab() {
|
||||
return provisionTabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load provision page
|
||||
*/
|
||||
function loadProvisionPage() {
|
||||
// If the page is loaded
|
||||
if ($('#content').children().length) {
|
||||
// Do not load again
|
||||
return;
|
||||
}
|
||||
|
||||
// Get OS image names
|
||||
if (!$.cookie('xcat_imagenames')){
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'osimage',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : setOSImageCookies
|
||||
});
|
||||
}
|
||||
|
||||
// Get groups
|
||||
if (!$.cookie('xcat_groups')){
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'extnoderange',
|
||||
tgt : '/.*',
|
||||
args : 'subgroups',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : setGroupsCookies
|
||||
});
|
||||
}
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Select a platform to provision or re-provision a node on, then click Ok.');
|
||||
|
||||
// Create provision page
|
||||
var provPg = $('<div class="form"></div>');
|
||||
provPg.append(infoBar);
|
||||
|
||||
// Create provision tab
|
||||
var tab = new Tab('provisionPageTabs');
|
||||
setProvisionTab(tab);
|
||||
tab.init();
|
||||
$('#content').append(tab.object());
|
||||
|
||||
// Create radio buttons for platforms
|
||||
var hwList = $('<ol>Platforms available:</ol>');
|
||||
var esx = $('<li><input type="radio" name="hw" value="esx" disabled/>ESX</li>');
|
||||
var kvm = $('<li><input type="radio" name="hw" value="kvm" disabled/>KVM</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm" checked/>z\/VM</li>');
|
||||
var ipmi = $('<li><input type="radio" name="hw" value="ipmi" disabled/>iDataPlex</li>');
|
||||
var blade = $('<li><input type="radio" name="hw" value="blade" disabled/>BladeCenter</li>');
|
||||
var hmc = $('<li><input type="radio" name="hw" value="hmc" disabled/>System p</li>');
|
||||
|
||||
hwList.append(esx);
|
||||
hwList.append(kvm);
|
||||
hwList.append(zvm);
|
||||
hwList.append(blade);
|
||||
hwList.append(ipmi);
|
||||
hwList.append(hmc);
|
||||
provPg.append(hwList);
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.bind('click', function(event) {
|
||||
// Get hardware that was selected
|
||||
var hw = $(this).parent().find('input[name="hw"]:checked').val();
|
||||
|
||||
var inst = 0;
|
||||
var newTabId = hw + 'ProvisionTab' + inst;
|
||||
while ($('#' + newTabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
newTabId = hw + 'ProvisionTab' + inst;
|
||||
}
|
||||
|
||||
// Create an instance of the plugin
|
||||
var title = '';
|
||||
var plugin;
|
||||
switch (hw) {
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
title = 'KVM';
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
title = 'ESX';
|
||||
break;
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
title = 'BladeCenter';
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
title = 'System p';
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
title = 'iDataPlex';
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
title = 'z/VM';
|
||||
break;
|
||||
}
|
||||
|
||||
// Select tab
|
||||
tab.add(newTabId, title, '', true);
|
||||
tab.select(newTabId);
|
||||
plugin.loadProvisionPage(newTabId);
|
||||
});
|
||||
provPg.append(okBtn);
|
||||
|
||||
// Create resources tab
|
||||
var resrcPg = $('<div class="form"></div>');
|
||||
|
||||
// Create info bar
|
||||
var resrcInfoBar = createInfoBar('Select a platform to view its current resources.');
|
||||
resrcPg.append(resrcInfoBar);
|
||||
|
||||
// Create radio buttons for platforms
|
||||
var rsrcHwList = $('<ol>Platforms available:</ol>');
|
||||
esx = $('<li><input type="radio" name="rsrcHw" value="esx" disabled/>ESX</li>');
|
||||
kvm = $('<li><input type="radio" name="rsrcHw" value="kvm" disabled/>KVM</li>');
|
||||
zvm = $('<li><input type="radio" name="rsrcHw" value="zvm" checked/>z\/VM</li>');
|
||||
ipmi = $('<li><input type="radio" name="rsrcHw" value="ipmi" disabled/>iDataPlex</li>');
|
||||
blade = $('<li><input type="radio" name="rsrcHw" value="blade" disabled/>BladeCenter</li>');
|
||||
hmc = $('<li><input type="radio" name="rsrcHw" value="hmc" disabled/>System p</li>');
|
||||
|
||||
rsrcHwList.append(esx);
|
||||
rsrcHwList.append(kvm);
|
||||
rsrcHwList.append(zvm);
|
||||
rsrcHwList.append(blade);
|
||||
rsrcHwList.append(ipmi);
|
||||
rsrcHwList.append(hmc);
|
||||
|
||||
resrcPg.append(rsrcHwList);
|
||||
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.bind('click', function(event) {
|
||||
// Get hardware that was selected
|
||||
var hw = $(this).parent().find('input[name="rsrcHw"]:checked').val();
|
||||
|
||||
// Generate new tab ID
|
||||
var newTabId = hw + 'ResourceTab';
|
||||
if (!$('#' + newTabId).length) {
|
||||
// Create loader
|
||||
var loader = $('<center></center>').append(createLoader(hw + 'ResourceLoader'));
|
||||
|
||||
// Create an instance of the plugin
|
||||
var plugin = null;
|
||||
var displayName = "";
|
||||
switch (hw) {
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
displayName = "KVM";
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
displayName = "ESX";
|
||||
break;
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
displayName = "BladeCenter";
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
displayName = "System p";
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
displayName = "iDataPlex";
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
displayName = "z\/VM";
|
||||
break;
|
||||
}
|
||||
|
||||
// Add resource tab and load resources
|
||||
tab.add(newTabId, displayName, loader, true);
|
||||
plugin.loadResources();
|
||||
}
|
||||
|
||||
// Select tab
|
||||
tab.select(newTabId);
|
||||
});
|
||||
|
||||
resrcPg.append(okBtn);
|
||||
|
||||
// Add provision tab
|
||||
tab.add('provisionTab', 'Provision', provPg, false);
|
||||
// Add image tab
|
||||
tab.add('imagesTab', 'Images', '', false);
|
||||
// Add resource tab
|
||||
tab.add('resourceTab', 'Resources', resrcPg, false);
|
||||
|
||||
// Load tabs onselect
|
||||
$('#provisionPageTabs').bind('tabsselect', function(event, ui){
|
||||
// Load image page
|
||||
if (!$('#imagesTab').children().length && ui.index == 1) {
|
||||
$('#imagesTab').append($('<center></center>').append(createLoader('')));
|
||||
loadImagesPage();
|
||||
}
|
||||
});
|
||||
|
||||
// Open the quick provision tab
|
||||
if (window.location.search) {
|
||||
tab.add('quickProvisionTab', 'Quick Provision', '', true);
|
||||
tab.select('quickProvisionTab');
|
||||
|
||||
var provForm = $('<div class="form"></div>');
|
||||
$('#quickProvisionTab').append(provForm);
|
||||
appendProvisionSection('quick', provForm);
|
||||
}
|
||||
/**
|
||||
* Global variables
|
||||
*/
|
||||
var provisionTabs; // Provision tabs
|
||||
|
||||
/**
|
||||
* Set the provision tab
|
||||
*
|
||||
* @param obj Tab object
|
||||
*/
|
||||
function setProvisionTab(obj) {
|
||||
provisionTabs = obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the provision tab
|
||||
*
|
||||
* @param Nothing
|
||||
* @return Tab object
|
||||
*/
|
||||
function getProvisionTab() {
|
||||
return provisionTabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load provision page
|
||||
*/
|
||||
function loadProvisionPage() {
|
||||
// If the page is loaded
|
||||
if ($('#content').children().length) {
|
||||
// Do not load again
|
||||
return;
|
||||
}
|
||||
|
||||
// Get OS image names
|
||||
if (!$.cookie('xcat_imagenames')){
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'osimage',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
data = decodeRsp(data);
|
||||
setOSImageCookies(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Get groups
|
||||
if (!$.cookie('xcat_groups')){
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'extnoderange',
|
||||
tgt : '/.*',
|
||||
args : 'subgroups',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
data = decodeRsp(data);
|
||||
setGroupsCookies(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Select a platform to provision or re-provision a node on, then click Ok.');
|
||||
|
||||
// Create provision page
|
||||
var provPg = $('<div class="form"></div>');
|
||||
provPg.append(infoBar);
|
||||
|
||||
// Create provision tab
|
||||
var tab = new Tab('provisionPageTabs');
|
||||
setProvisionTab(tab);
|
||||
tab.init();
|
||||
$('#content').append(tab.object());
|
||||
|
||||
// Create radio buttons for platforms
|
||||
var hwList = $('<ol>Platforms available:</ol>');
|
||||
var esx = $('<li><input type="radio" name="hw" value="esx" disabled/>ESX</li>');
|
||||
var kvm = $('<li><input type="radio" name="hw" value="kvm" disabled/>KVM</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm" checked/>z\/VM</li>');
|
||||
var ipmi = $('<li><input type="radio" name="hw" value="ipmi" disabled/>iDataPlex</li>');
|
||||
var blade = $('<li><input type="radio" name="hw" value="blade" disabled/>BladeCenter</li>');
|
||||
var hmc = $('<li><input type="radio" name="hw" value="hmc" disabled/>System p</li>');
|
||||
|
||||
hwList.append(esx);
|
||||
hwList.append(kvm);
|
||||
hwList.append(zvm);
|
||||
hwList.append(blade);
|
||||
hwList.append(ipmi);
|
||||
hwList.append(hmc);
|
||||
provPg.append(hwList);
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.bind('click', function(event) {
|
||||
// Get hardware that was selected
|
||||
var hw = $(this).parent().find('input[name="hw"]:checked').val();
|
||||
|
||||
var inst = 0;
|
||||
var newTabId = hw + 'ProvisionTab' + inst;
|
||||
while ($('#' + newTabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
newTabId = hw + 'ProvisionTab' + inst;
|
||||
}
|
||||
|
||||
// Create an instance of the plugin
|
||||
var title = '';
|
||||
var plugin;
|
||||
switch (hw) {
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
title = 'KVM';
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
title = 'ESX';
|
||||
break;
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
title = 'BladeCenter';
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
title = 'System p';
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
title = 'iDataPlex';
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
title = 'z/VM';
|
||||
break;
|
||||
}
|
||||
|
||||
// Select tab
|
||||
tab.add(newTabId, title, '', true);
|
||||
tab.select(newTabId);
|
||||
plugin.loadProvisionPage(newTabId);
|
||||
});
|
||||
provPg.append(okBtn);
|
||||
|
||||
// Create resources tab
|
||||
var resrcPg = $('<div class="form"></div>');
|
||||
|
||||
// Create info bar
|
||||
var resrcInfoBar = createInfoBar('Select a platform to view its current resources.');
|
||||
resrcPg.append(resrcInfoBar);
|
||||
|
||||
// Create radio buttons for platforms
|
||||
var rsrcHwList = $('<ol>Platforms available:</ol>');
|
||||
esx = $('<li><input type="radio" name="rsrcHw" value="esx" disabled/>ESX</li>');
|
||||
kvm = $('<li><input type="radio" name="rsrcHw" value="kvm" disabled/>KVM</li>');
|
||||
zvm = $('<li><input type="radio" name="rsrcHw" value="zvm" checked/>z\/VM</li>');
|
||||
ipmi = $('<li><input type="radio" name="rsrcHw" value="ipmi" disabled/>iDataPlex</li>');
|
||||
blade = $('<li><input type="radio" name="rsrcHw" value="blade" disabled/>BladeCenter</li>');
|
||||
hmc = $('<li><input type="radio" name="rsrcHw" value="hmc" disabled/>System p</li>');
|
||||
|
||||
rsrcHwList.append(esx);
|
||||
rsrcHwList.append(kvm);
|
||||
rsrcHwList.append(zvm);
|
||||
rsrcHwList.append(blade);
|
||||
rsrcHwList.append(ipmi);
|
||||
rsrcHwList.append(hmc);
|
||||
|
||||
resrcPg.append(rsrcHwList);
|
||||
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.bind('click', function(event) {
|
||||
// Get hardware that was selected
|
||||
var hw = $(this).parent().find('input[name="rsrcHw"]:checked').val();
|
||||
|
||||
// Generate new tab ID
|
||||
var newTabId = hw + 'ResourceTab';
|
||||
if (!$('#' + newTabId).length) {
|
||||
// Create loader
|
||||
var loader = $('<center></center>').append(createLoader(hw + 'ResourceLoader'));
|
||||
|
||||
// Create an instance of the plugin
|
||||
var plugin = null;
|
||||
var displayName = "";
|
||||
switch (hw) {
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
displayName = "KVM";
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
displayName = "ESX";
|
||||
break;
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
displayName = "BladeCenter";
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
displayName = "System p";
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
displayName = "iDataPlex";
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
displayName = "z\/VM";
|
||||
break;
|
||||
}
|
||||
|
||||
// Add resource tab and load resources
|
||||
tab.add(newTabId, displayName, loader, true);
|
||||
plugin.loadResources();
|
||||
}
|
||||
|
||||
// Select tab
|
||||
tab.select(newTabId);
|
||||
});
|
||||
|
||||
resrcPg.append(okBtn);
|
||||
|
||||
// Add provision tab
|
||||
tab.add('provisionTab', 'Provision', provPg, false);
|
||||
// Add image tab
|
||||
tab.add('imagesTab', 'Images', '', false);
|
||||
// Add resource tab
|
||||
tab.add('resourceTab', 'Resources', resrcPg, false);
|
||||
|
||||
// Load tabs onselect
|
||||
$('#provisionPageTabs').bind('tabsselect', function(event, ui){
|
||||
// Load image page
|
||||
if (!$('#imagesTab').children().length && ui.index == 1) {
|
||||
$('#imagesTab').append($('<center></center>').append(createLoader('')));
|
||||
loadImagesPage();
|
||||
}
|
||||
});
|
||||
|
||||
// Open the quick provision tab
|
||||
if (window.location.search) {
|
||||
tab.add('quickProvisionTab', 'Quick Provision', '', true);
|
||||
tab.select('quickProvisionTab');
|
||||
|
||||
var provForm = $('<div class="form"></div>');
|
||||
$('#quickProvisionTab').append(provForm);
|
||||
appendProvisionSection('quick', provForm);
|
||||
}
|
||||
}
|
||||
+2191
-2152
File diff suppressed because it is too large
Load Diff
+1101
-1068
File diff suppressed because it is too large
Load Diff
+240
-224
@@ -1,225 +1,241 @@
|
||||
<?php
|
||||
/* Required libraries */
|
||||
$TOPDIR = '..';
|
||||
require_once "$TOPDIR/lib/functions.php";
|
||||
require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
|
||||
/**
|
||||
* Issue a xCAT command, e.g. rinv gpok123 all
|
||||
* This will handle most commands. If not, you can create your own .php.
|
||||
* Look at zCmd.php for an example.
|
||||
*
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @param $opts The xCAT command options, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
|
||||
// File contents in case of file write
|
||||
if (isset($_GET["cont"])) {
|
||||
$cont = $_GET["cont"];
|
||||
}
|
||||
|
||||
// Special messages put here
|
||||
// This gets sent back to the AJAX request as is.
|
||||
$msg = $_GET["msg"];
|
||||
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
|
||||
// If no $args are given, set $args_array to NULL
|
||||
// Separators used are: || or ;
|
||||
$args_array = array();
|
||||
if ($args) {
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($args, "||")) {
|
||||
// Split the arguments into an array
|
||||
$args_array = array();
|
||||
$args_array = explode("||", $args);
|
||||
} else if (strpos($args, ";")) {
|
||||
// Split the arguments into an array
|
||||
$args_array = array();
|
||||
$args_array = explode(";", $args);
|
||||
} else {
|
||||
$args_array = array($args);
|
||||
}
|
||||
}
|
||||
|
||||
// If no $opts are given, set $opts_array to NULL
|
||||
$opts_array = array();
|
||||
if (isset($_GET["opts"])) {
|
||||
$opts = $_GET["opts"];
|
||||
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($opts, "|")) {
|
||||
// Split the arguments into an array
|
||||
$opts_array = array();
|
||||
$opts_array = explode("|", $opts);
|
||||
} if (strpos($opts, ";")) {
|
||||
// Split the arguments into an array
|
||||
$opts_array = array();
|
||||
$opts_array = explode(";", $opts);
|
||||
} else {
|
||||
$opts_array = array($opts);
|
||||
}
|
||||
}
|
||||
|
||||
// Time needed to update /etc/hosts
|
||||
if (strncasecmp($cmd, "makehosts", 9) == 0) {
|
||||
sleep(5);
|
||||
}
|
||||
|
||||
// Submit request and get response
|
||||
$xml = docmd($cmd, $tgt, $args_array, $opts_array);
|
||||
// If the output is flushed, do not return output in JSON
|
||||
if (in_array("flush", $opts_array)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$rsp = array();
|
||||
|
||||
// webrun pping and gangliastatus output needs special handling
|
||||
if (strncasecmp($cmd, "webrun", 6) == 0 && (stristr($args, "pping") || stristr($args, "gangliastatus") || stristr($args, "chtab"))) {
|
||||
$rsp = extractWebrun($xml);
|
||||
}
|
||||
// nodels output needs special handling
|
||||
else if (strncasecmp($cmd, "nodels", 6) == 0) {
|
||||
// Handle the output the same way as webrun
|
||||
$rsp = extractNodels($xml);
|
||||
}
|
||||
// extnoderange output needs special handling
|
||||
// This command gets the nodes and groups
|
||||
else if (strncasecmp($cmd, "extnoderange", 12) == 0) {
|
||||
$rsp = extractExtnoderange($xml);
|
||||
}
|
||||
// Write contents to file
|
||||
else if (strncasecmp($cmd, "write", 4) == 0) {
|
||||
// Directory should be /var/opt/xcat/profiles
|
||||
// You can write anything to that directory
|
||||
$file = "$tgt";
|
||||
$handle = fopen($file, 'w') or die("Cannot open $file");
|
||||
fwrite($handle, $cont);
|
||||
fclose($handle);
|
||||
|
||||
$rsp = "Directory entry written to $file";
|
||||
}
|
||||
// Handle the typical output
|
||||
else {
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
|
||||
if ($data->data->contents) {
|
||||
$cont = $data->data->contents;
|
||||
} else {
|
||||
$cont = $data->data;
|
||||
}
|
||||
|
||||
if ($data->data->desc) {
|
||||
$cont = $data->data->desc . ": " . $cont;
|
||||
}
|
||||
|
||||
$cont = str_replace(":|:", "\n", $cont);
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if (strlen("$data") > 2) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the output for a webrun command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractWebrun($xml) {
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
|
||||
// Get the content
|
||||
$status = $node->data;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the output for a nodels command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractNodels($xml) {
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
// Get the content
|
||||
$status = $node->data->contents;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
|
||||
$description = $node->data->desc;
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status", "$description");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the output for a extnoderange command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return The nodes and groups
|
||||
*/
|
||||
function extractExtnoderange($xml) {
|
||||
$rsp = array();
|
||||
|
||||
// Extract data returned
|
||||
foreach ($xml->xcatresponse->intersectinggroups as $group) {
|
||||
array_push($rsp, "$group");
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
<?php
|
||||
/* Required libraries */
|
||||
$TOPDIR = '..';
|
||||
require_once "$TOPDIR/lib/functions.php";
|
||||
require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
|
||||
/**
|
||||
* Issue a xCAT command, e.g. rinv gpok123 all
|
||||
* This will handle most commands. If not, you can create your own .php.
|
||||
* Look at zCmd.php for an example.
|
||||
*
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @param $opts The xCAT command options, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
|
||||
// File contents in case of file write
|
||||
if (isset($_GET["cont"])) {
|
||||
$cont = $_GET["cont"];
|
||||
}
|
||||
|
||||
// Special messages put here
|
||||
// This gets sent back to the AJAX request as is.
|
||||
$msg = $_GET["msg"];
|
||||
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
|
||||
// If no $args are given, set $args_array to NULL
|
||||
// Separators used are: || or ;
|
||||
$args_array = array();
|
||||
if ($args) {
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($args, "||")) {
|
||||
// Split the arguments into an array
|
||||
$args_array = array();
|
||||
$args_array = explode("||", $args);
|
||||
} else if (strpos($args, ";")) {
|
||||
// Split the arguments into an array
|
||||
$args_array = array();
|
||||
$args_array = explode(";", $args);
|
||||
} else {
|
||||
$args_array = array($args);
|
||||
}
|
||||
}
|
||||
|
||||
// If no $opts are given, set $opts_array to NULL
|
||||
$opts_array = array();
|
||||
if (isset($_GET["opts"])) {
|
||||
$opts = $_GET["opts"];
|
||||
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($opts, "|")) {
|
||||
// Split the arguments into an array
|
||||
$opts_array = array();
|
||||
$opts_array = explode("|", $opts);
|
||||
} if (strpos($opts, ";")) {
|
||||
// Split the arguments into an array
|
||||
$opts_array = array();
|
||||
$opts_array = explode(";", $opts);
|
||||
} else {
|
||||
$opts_array = array($opts);
|
||||
}
|
||||
}
|
||||
|
||||
// Time needed to update /etc/hosts
|
||||
if (strncasecmp($cmd, "makehosts", 9) == 0) {
|
||||
sleep(5);
|
||||
}
|
||||
|
||||
// Submit request and get response
|
||||
$xml = docmd($cmd, $tgt, $args_array, $opts_array);
|
||||
// If the output is flushed, do not return output in JSON
|
||||
if (in_array("flush", $opts_array)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$rsp = array();
|
||||
|
||||
// webrun pping and gangliastatus output needs special handling
|
||||
if (strncasecmp($cmd, "webrun", 6) == 0 && (stristr($args, "pping") || stristr($args, "gangliastatus") || stristr($args, "chtab"))) {
|
||||
$rsp = extractWebrun($xml);
|
||||
}
|
||||
// nodels output needs special handling
|
||||
else if (strncasecmp($cmd, "nodels", 6) == 0) {
|
||||
// Handle the output the same way as webrun
|
||||
$rsp = extractNodels($xml);
|
||||
}
|
||||
// extnoderange output needs special handling
|
||||
// This command gets the nodes and groups
|
||||
else if (strncasecmp($cmd, "extnoderange", 12) == 0) {
|
||||
$rsp = extractExtnoderange($xml);
|
||||
}
|
||||
// Write contents to file
|
||||
else if (strncasecmp($cmd, "write", 4) == 0) {
|
||||
// Directory should be /var/opt/xcat/profiles
|
||||
// You can write anything to that directory
|
||||
$file = "$tgt";
|
||||
$handle = fopen($file, 'w') or die("Cannot open $file");
|
||||
fwrite($handle, $cont);
|
||||
fclose($handle);
|
||||
|
||||
$rsp = "Directory entry written to $file";
|
||||
}
|
||||
// Handle the typical output
|
||||
else {
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
|
||||
if ($data->data->contents) {
|
||||
$cont = $data->data->contents;
|
||||
} else {
|
||||
$cont = $data->data;
|
||||
}
|
||||
|
||||
if ($data->data->desc) {
|
||||
$cont = $data->data->desc . ": " . $cont;
|
||||
}
|
||||
|
||||
$cont = str_replace(":|:", "\n", $cont);
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if (strlen("$data") > 2) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Remove any HTML that could be used for XSS attacks
|
||||
foreach ($rsp as $key => &$value) {
|
||||
$whatami = gettype($value);
|
||||
if ("string" != $whatami) {
|
||||
//echo "found a non string in rsp array \n";
|
||||
foreach ($value as $key2 => $value2){
|
||||
//echo "Key2:$key2 Value2 type:",gettype($value2)," value2 data: $value2 \n";
|
||||
$value[$key2] = htmlentities($value2, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
}
|
||||
} else {
|
||||
//echo "Key:$key Value type:",gettype($value)," value data: $value \n";
|
||||
$rsp[$key] = htmlentities($value, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
//echo "New value: $rsp[$key] \n";
|
||||
}
|
||||
}
|
||||
$msg = htmlentities($msg, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the output for a webrun command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractWebrun($xml) {
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
|
||||
// Get the content
|
||||
$status = $node->data;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the output for a nodels command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractNodels($xml) {
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
// Get the content
|
||||
$status = $node->data->contents;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
|
||||
$description = $node->data->desc;
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status", "$description");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the output for a extnoderange command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return The nodes and groups
|
||||
*/
|
||||
function extractExtnoderange($xml) {
|
||||
$rsp = array();
|
||||
|
||||
// Extract data returned
|
||||
foreach ($xml->xcatresponse->intersectinggroups as $group) {
|
||||
array_push($rsp, "$group");
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
?>
|
||||
@@ -299,7 +299,7 @@ function isAuthenticated() {
|
||||
*/
|
||||
function isRootAcess() {
|
||||
if (is_logged() && $_SESSION["xcatpassvalid"]) {
|
||||
$testacc = docmd('tabdump', '', array('policy', '-w', "name==" . $_SESSION["username"]), array());
|
||||
$testacc = docmd('tabdump', '', array('-w', "name==" . $_SESSION["username"],'policy' ), array());
|
||||
if (isset($testacc->{'xcatresponse'}->{'data'}->{1})) {
|
||||
$result = $testacc->{'xcatresponse'}->{'data'}->{1};
|
||||
$result = str_replace('"', '', $result);
|
||||
|
||||
+205
-189
@@ -1,190 +1,206 @@
|
||||
<?php
|
||||
/* Required libraries */
|
||||
$TOPDIR = '..';
|
||||
require_once "$TOPDIR/lib/srv_functions.php";
|
||||
require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
|
||||
/**
|
||||
* Issue a xCAT command, e.g. rinv gpok123 all. This will handle most commands.
|
||||
* If not, you can create your own .php. Look at zCmd.php for an example.
|
||||
*
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @param $opts The xCAT command options, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
|
||||
// Special messages put here
|
||||
// This gets sent back to the AJAX request as is.
|
||||
$msg = $_GET["msg"];
|
||||
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
|
||||
// If no $args are given, set $args_array to NULL
|
||||
$args_array = array();
|
||||
if ($args) {
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($args,";")) {
|
||||
// Split the arguments into an array
|
||||
$args_array = array();
|
||||
$args_array = explode(";", $args);
|
||||
} else {
|
||||
$args_array = array($args);
|
||||
}
|
||||
}
|
||||
|
||||
// If no $opts are given, set $opts_array to NULL
|
||||
$opts_array = array();
|
||||
if (isset($_GET["opts"])) {
|
||||
$opts = $_GET["opts"];
|
||||
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($opts,";")) {
|
||||
// Split the arguments into an array
|
||||
$opts_array = array();
|
||||
$opts_array = explode(";", $opts);
|
||||
} else {
|
||||
$opts_array = array($opts);
|
||||
}
|
||||
}
|
||||
|
||||
// Submit request and get response
|
||||
$xml = docmd($cmd, $tgt, $args_array, $opts_array);
|
||||
// If the output is flushed, do not return output in JSON
|
||||
if (in_array("flush", $opts_array)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$rsp = array();
|
||||
|
||||
// webrun pping and gangliastatus output needs special handling
|
||||
if(strncasecmp($cmd, "webrun", 6) == 0 && (stristr($args, "pping") || stristr($args, "gangliastatus") || stristr($args, "chtab"))) {
|
||||
$rsp = extractWebrun($xml);
|
||||
}
|
||||
// nodels output needs special handling
|
||||
else if(strncasecmp($cmd, "nodels", 6) == 0) {
|
||||
// Handle the output the same way as webrun
|
||||
$rsp = extractNodels($xml);
|
||||
}
|
||||
// extnoderange output needs special handling
|
||||
// This command gets the nodes and groups
|
||||
else if(strncasecmp($cmd, "extnoderange", 12) == 0) {
|
||||
$rsp = extractExtnoderange($xml);
|
||||
}
|
||||
// Handle the typical output
|
||||
else {
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
|
||||
if($data->data->contents){
|
||||
$cont = $data->data->contents;
|
||||
} else {
|
||||
$cont = $data->data;
|
||||
}
|
||||
|
||||
$cont = str_replace(":|:", "\n", $cont);
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if (strlen("$data") > 2) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the output for a webrun command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractWebrun($xml) {
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
|
||||
// Get the content
|
||||
$status = $node->data;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the output for a nodels command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractNodels($xml) {
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
// Get the content
|
||||
$status = $node->data->contents;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
|
||||
$description = $node->data->desc;
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status", "$description");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the output for a extnoderange command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return The nodes and groups
|
||||
*/
|
||||
function extractExtnoderange($xml) {
|
||||
$rsp = array();
|
||||
|
||||
// Extract data returned
|
||||
foreach ($xml->xcatresponse->intersectinggroups as $group) {
|
||||
array_push($rsp, "$group");
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
<?php
|
||||
/* Required libraries */
|
||||
$TOPDIR = '..';
|
||||
require_once "$TOPDIR/lib/srv_functions.php";
|
||||
require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
|
||||
/**
|
||||
* Issue a xCAT command, e.g. rinv gpok123 all. This will handle most commands.
|
||||
* If not, you can create your own .php. Look at zCmd.php for an example.
|
||||
*
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @param $opts The xCAT command options, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
|
||||
// Special messages put here
|
||||
// This gets sent back to the AJAX request as is.
|
||||
$msg = $_GET["msg"];
|
||||
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
|
||||
// If no $args are given, set $args_array to NULL
|
||||
$args_array = array();
|
||||
if ($args) {
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($args,";")) {
|
||||
// Split the arguments into an array
|
||||
$args_array = array();
|
||||
$args_array = explode(";", $args);
|
||||
} else {
|
||||
$args_array = array($args);
|
||||
}
|
||||
}
|
||||
|
||||
// If no $opts are given, set $opts_array to NULL
|
||||
$opts_array = array();
|
||||
if (isset($_GET["opts"])) {
|
||||
$opts = $_GET["opts"];
|
||||
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($opts,";")) {
|
||||
// Split the arguments into an array
|
||||
$opts_array = array();
|
||||
$opts_array = explode(";", $opts);
|
||||
} else {
|
||||
$opts_array = array($opts);
|
||||
}
|
||||
}
|
||||
|
||||
// Submit request and get response
|
||||
$xml = docmd($cmd, $tgt, $args_array, $opts_array);
|
||||
// If the output is flushed, do not return output in JSON
|
||||
if (in_array("flush", $opts_array)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$rsp = array();
|
||||
|
||||
// webrun pping and gangliastatus output needs special handling
|
||||
if(strncasecmp($cmd, "webrun", 6) == 0 && (stristr($args, "pping") || stristr($args, "gangliastatus") || stristr($args, "chtab"))) {
|
||||
$rsp = extractWebrun($xml);
|
||||
}
|
||||
// nodels output needs special handling
|
||||
else if(strncasecmp($cmd, "nodels", 6) == 0) {
|
||||
// Handle the output the same way as webrun
|
||||
$rsp = extractNodels($xml);
|
||||
}
|
||||
// extnoderange output needs special handling
|
||||
// This command gets the nodes and groups
|
||||
else if(strncasecmp($cmd, "extnoderange", 12) == 0) {
|
||||
$rsp = extractExtnoderange($xml);
|
||||
}
|
||||
// Handle the typical output
|
||||
else {
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
|
||||
if($data->data->contents){
|
||||
$cont = $data->data->contents;
|
||||
} else {
|
||||
$cont = $data->data;
|
||||
}
|
||||
|
||||
$cont = str_replace(":|:", "\n", $cont);
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if (strlen("$data") > 2) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Remove any HTML that could be used for XSS attacks
|
||||
foreach ($rsp as $key => &$value) {
|
||||
$whatami = gettype($value);
|
||||
if ("string" != $whatami) {
|
||||
//echo "found a non string in rsp array \n";
|
||||
foreach ($value as $key2 => $value2){
|
||||
//echo "Key2:$key2 Value2 type:",gettype($value2)," value2 data: $value2 \n";
|
||||
$value[$key2] = htmlentities($value2, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
}
|
||||
} else {
|
||||
//echo "Key:$key Value type:",gettype($value)," value data: $value \n";
|
||||
$rsp[$key] = htmlentities($value, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
//echo "New value: $rsp[$key] \n";
|
||||
}
|
||||
}
|
||||
$msg = htmlentities($msg, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the output for a webrun command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractWebrun($xml) {
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
|
||||
// Get the content
|
||||
$status = $node->data;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the output for a nodels command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractNodels($xml) {
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
// Get the content
|
||||
$status = $node->data->contents;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
|
||||
$description = $node->data->desc;
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status", "$description");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the output for a extnoderange command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return The nodes and groups
|
||||
*/
|
||||
function extractExtnoderange($xml) {
|
||||
$rsp = array();
|
||||
|
||||
// Extract data returned
|
||||
foreach ($xml->xcatresponse->intersectinggroups as $group) {
|
||||
array_push($rsp, "$group");
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
?>
|
||||
+38
-35
@@ -1,36 +1,39 @@
|
||||
<?php
|
||||
/* Required libraries */
|
||||
$TOPDIR = '..';
|
||||
require_once "$TOPDIR/lib/functions.php";
|
||||
require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
|
||||
/**
|
||||
* This will handle system commands, e.g. rpm -qa xCAT
|
||||
*
|
||||
* @param $cmd The system command
|
||||
* @return The system response. Replies are in the form of JSON
|
||||
*/
|
||||
if (!isAuthenticated()) {
|
||||
echo ("<b>Please login before continuing!</b>");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$msg = NULL;
|
||||
$ret = "";
|
||||
|
||||
if (isset($_GET["msg"])) {
|
||||
$msg = $_GET["msg"];
|
||||
}
|
||||
|
||||
if ($cmd == "ostype") {
|
||||
$ret = strtolower(PHP_OS);
|
||||
} else {
|
||||
$ret = shell_exec($cmd);
|
||||
}
|
||||
|
||||
echo json_encode(array("rsp"=>$ret, "msg" => $msg));
|
||||
}
|
||||
<?php
|
||||
/* Required libraries */
|
||||
$TOPDIR = '..';
|
||||
require_once "$TOPDIR/lib/functions.php";
|
||||
require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
|
||||
/**
|
||||
* This will handle system commands, e.g. rpm -qa xCAT
|
||||
*
|
||||
* @param $cmd The system command
|
||||
* @return The system response. Replies are in the form of JSON
|
||||
*/
|
||||
if (!isAuthenticated()) {
|
||||
echo ("<b>Please login before continuing!</b>");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$msg = NULL;
|
||||
$ret = "";
|
||||
|
||||
if (isset($_GET["msg"])) {
|
||||
$msg = $_GET["msg"];
|
||||
}
|
||||
|
||||
if ($cmd == "ostype") {
|
||||
$ret = strtolower(PHP_OS);
|
||||
} else {
|
||||
$ret = shell_exec($cmd);
|
||||
}
|
||||
|
||||
// Remove any HTML that could be used for XSS attacks
|
||||
$ret = htmlentities($ret, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
$msg = htmlentities($msg, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
echo json_encode(array("rsp"=>$ret, "msg" => $msg));
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Upload a given file into /var/tmp
|
||||
*/
|
||||
$TOPDIR = '..';
|
||||
require_once "$TOPDIR/lib/functions.php";
|
||||
require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
|
||||
session_start();
|
||||
|
||||
if (!is_logged()) {
|
||||
echo "You are not logged in!";
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the file upload size limit (not sure if this actually works)
|
||||
ini_set('upload_max_filesize', '4096M');
|
||||
ini_set('post_max_size', '4096M');
|
||||
ini_set('max_input_time', -1);
|
||||
|
||||
// Set time limit on how long this can run
|
||||
set_time_limit(1200);
|
||||
|
||||
// Grab the target destination and file type
|
||||
$dest = $_GET["destination"];
|
||||
|
||||
// Only allow uploads onto /install
|
||||
if (strcmp(substr($dest, 0, 9), "/install/") != 0) {
|
||||
echo "You are only authorized to upload onto /install subdirectories";
|
||||
return;
|
||||
}
|
||||
|
||||
$file = $_FILES["file"]["name"];
|
||||
$path = $dest . "/" . $file;
|
||||
|
||||
if (move_uploaded_file($_FILES["file"]["tmp_name"], $path)) {
|
||||
echo "File successfully uploaded";
|
||||
chmod($path, 0755); // Change file to be executable
|
||||
} else {
|
||||
echo "Failed to upload file to $path. ";
|
||||
|
||||
// Obtain the reason for failure
|
||||
$reason = "";
|
||||
switch ($_FILES["file"]["error"]) {
|
||||
case 1:
|
||||
$reason = "The file is bigger than the PHP installation allows.";
|
||||
break;
|
||||
case 2:
|
||||
$reason = "The file is bigger than this form allows.";
|
||||
break;
|
||||
case 3:
|
||||
$reason = "Only part of the file was uploaded.";
|
||||
break;
|
||||
case 4:
|
||||
$reason = "No file was uploaded.";
|
||||
break;
|
||||
default:
|
||||
$reason = "Unknown error.";
|
||||
}
|
||||
|
||||
echo $reason;
|
||||
}
|
||||
?>
|
||||
+158
-141
@@ -1,142 +1,159 @@
|
||||
<?php
|
||||
/* Required libraries */
|
||||
$TOPDIR = '..';
|
||||
require_once "$TOPDIR/lib/functions.php";
|
||||
require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
|
||||
/**
|
||||
* Issue an xCAT command (only for z)
|
||||
*
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
|
||||
// Attachments are put here
|
||||
$att = $_GET["att"];
|
||||
|
||||
// Special messages put here
|
||||
$msg = $_GET["msg"];
|
||||
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
|
||||
// If no $args is given, set $args to NULL
|
||||
if (!$args) {
|
||||
$args = NULL;
|
||||
}
|
||||
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
|
||||
// If no $att is given, set $att to NULL
|
||||
if (!$att) {
|
||||
$att = NULL;
|
||||
}
|
||||
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
// Separators used are: || or ;
|
||||
if (strpos($args, "||")) {
|
||||
// Split the arguments into an array
|
||||
$arr = array();
|
||||
$arr = explode("||", $args);
|
||||
} else if (strpos($args, ";")) {
|
||||
// Split the arguments into an array
|
||||
$arr = array();
|
||||
$arr = explode(";", $args);
|
||||
} else {
|
||||
$arr = array($args);
|
||||
}
|
||||
|
||||
$rsp = array();
|
||||
|
||||
// Replace user entry
|
||||
if (strncasecmp($cmd, "chvm", 4) == 0 && strncasecmp($arr[0], "--replacevs", 11) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$userEntry = "/var/tmp/$tgt.txt";
|
||||
$handle = fopen($userEntry, 'w') or die("Cannot open $userEntry");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
|
||||
// CLI command: chvm gpok249 --replacevs /tmp/dirEntry.txt
|
||||
// Replace user entry
|
||||
array_push($arr, $userEntry);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create virtual server
|
||||
else if (strncasecmp($cmd, "mkvm", 4) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$userEntry = "/var/tmp/$tgt.txt";
|
||||
$handle = fopen($userEntry, 'w') or die("Cannot open $userEntry");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
|
||||
// CLI command: mkvm gpok3 /tmp/gpok3.txt
|
||||
// Create user entry
|
||||
array_unshift($arr, $userEntry);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Run shell script
|
||||
// This is a typical command used by all platforms. It is put here because
|
||||
// most of the code needed are already here
|
||||
else if (strncasecmp($cmd, "xdsh", 4) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$msgArgs = explode(";", $msg);
|
||||
$inst = str_replace("out=scriptStatusBar", "", $msgArgs[0]);
|
||||
$script = "/var/tmp/script$inst.sh";
|
||||
|
||||
// Write to file
|
||||
$handle = fopen($script, 'w') or die("Cannot open $script");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
|
||||
// Change it to executable
|
||||
chmod($script, 0777);
|
||||
|
||||
// CLI command: xdsh gpok3 -e /var/tmp/gpok3.sh
|
||||
// Create user entry
|
||||
array_push($arr, $script);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
|
||||
// Remove this file
|
||||
unlink($script);
|
||||
}
|
||||
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
}
|
||||
<?php
|
||||
/* Required libraries */
|
||||
$TOPDIR = '..';
|
||||
require_once "$TOPDIR/lib/functions.php";
|
||||
require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
|
||||
/**
|
||||
* Issue an xCAT command (only for z)
|
||||
*
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
|
||||
// Attachments are put here
|
||||
$att = $_GET["att"];
|
||||
|
||||
// Special messages put here
|
||||
$msg = $_GET["msg"];
|
||||
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
|
||||
// If no $args is given, set $args to NULL
|
||||
if (!$args) {
|
||||
$args = NULL;
|
||||
}
|
||||
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
|
||||
// If no $att is given, set $att to NULL
|
||||
if (!$att) {
|
||||
$att = NULL;
|
||||
}
|
||||
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
// Separators used are: || or ;
|
||||
if (strpos($args, "||")) {
|
||||
// Split the arguments into an array
|
||||
$arr = array();
|
||||
$arr = explode("||", $args);
|
||||
} else if (strpos($args, ";")) {
|
||||
// Split the arguments into an array
|
||||
$arr = array();
|
||||
$arr = explode(";", $args);
|
||||
} else {
|
||||
$arr = array($args);
|
||||
}
|
||||
|
||||
$rsp = array();
|
||||
|
||||
// Replace user entry
|
||||
if (strncasecmp($cmd, "chvm", 4) == 0 && strncasecmp($arr[0], "--replacevs", 11) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$userEntry = "/var/tmp/$tgt.txt";
|
||||
$handle = fopen($userEntry, 'w') or die("Cannot open $userEntry");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
|
||||
// CLI command: chvm gpok249 --replacevs /tmp/dirEntry.txt
|
||||
// Replace user entry
|
||||
array_push($arr, $userEntry);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create virtual server
|
||||
else if (strncasecmp($cmd, "mkvm", 4) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$userEntry = "/var/tmp/$tgt.txt";
|
||||
$handle = fopen($userEntry, 'w') or die("Cannot open $userEntry");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
|
||||
// CLI command: mkvm gpok3 /tmp/gpok3.txt
|
||||
// Create user entry
|
||||
array_unshift($arr, $userEntry);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Run shell script
|
||||
// This is a typical command used by all platforms. It is put here because
|
||||
// most of the code needed are already here
|
||||
else if (strncasecmp($cmd, "xdsh", 4) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$msgArgs = explode(";", $msg);
|
||||
$inst = str_replace("out=scriptStatusBar", "", $msgArgs[0]);
|
||||
$script = "/var/tmp/script$inst.sh";
|
||||
|
||||
// Write to file
|
||||
$handle = fopen($script, 'w') or die("Cannot open $script");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
|
||||
// Change it to executable
|
||||
chmod($script, 0777);
|
||||
|
||||
// CLI command: xdsh gpok3 -e /var/tmp/gpok3.sh
|
||||
// Create user entry
|
||||
array_push($arr, $script);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
|
||||
// Remove this file
|
||||
unlink($script);
|
||||
}
|
||||
|
||||
// Remove any HTML that could be used for XSS attacks
|
||||
foreach ($rsp as $key => &$value) {
|
||||
$whatami = gettype($value);
|
||||
if ("string" != $whatami) {
|
||||
//echo "found a non string in rsp array \n";
|
||||
foreach ($value as $key2 => $value2){
|
||||
//echo "Key2:$key2 Value2 type:",gettype($value2)," value2 data: $value2 \n";
|
||||
$value[$key2] = htmlentities($value2, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
}
|
||||
} else {
|
||||
//echo "Key:$key Value type:",gettype($value)," value data: $value \n";
|
||||
$rsp[$key] = htmlentities($value, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
//echo "New value: $rsp[$key] \n";
|
||||
}
|
||||
}
|
||||
$msg = htmlentities($msg, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
}
|
||||
?>
|
||||
@@ -83,7 +83,8 @@ sub process_request {
|
||||
'cecsetup' => \&web_cecsetup,
|
||||
'deletefile' => \&web_deletefile,
|
||||
'createfolder' => \&web_createfolder,
|
||||
'getrepospace' => \&web_getrepospace
|
||||
'getrepospace' => \&web_getrepospace,
|
||||
'verifynode' => \&web_verifynode,
|
||||
);
|
||||
|
||||
# Check whether the request is authorized or not
|
||||
@@ -1982,8 +1983,8 @@ sub web_summary {
|
||||
while (my ($key, $value) = each(%{$attrs})) {
|
||||
web_attrcount($value->[0]->{'os'}, \%oshash);
|
||||
web_attrcount($value->[0]->{'arch'}, \%archhash);
|
||||
web_attrcount($value->[0]->{'provmethod'}, \%provhash);
|
||||
web_attrcount($value->[0]->{'nodetype'}, \%typehash);
|
||||
web_attrcount($value->[0]->{'provmethod'},, \%provhash);
|
||||
web_attrcount($value->[0]->{'nodetype'},, \%typehash);
|
||||
}
|
||||
|
||||
$attrs = $nodelistTab->getNodesAttribs(\@nodes, ['status']);
|
||||
@@ -2716,4 +2717,27 @@ sub web_getrepospace() {
|
||||
$callback->({ info => $space });
|
||||
}
|
||||
|
||||
sub web_verifynode() {
|
||||
my ( $request, $callback, $sub_req ) = @_;
|
||||
my $cmdOpts = '';
|
||||
my $out;
|
||||
|
||||
# Loop to handle all options passed. We don't know how many they will pass
|
||||
# so we look for 'end' to signify the end. We set a loop variable to 500 which
|
||||
# we know is much larger than the expected number of arguments. This prevents
|
||||
# the loop from going on forever should there be an error on the javascript side
|
||||
# an the 'end' was not passed.
|
||||
for ( my $i = 0 ; $i < 500 ; $i++ ) {
|
||||
if ( $request->{arg}->[$i] ne 'end' ) {
|
||||
$cmdOpts = "$cmdOpts $request->{arg}->[$i]";
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
$out = `/opt/xcat/bin/verifynode $cmdOpts`;
|
||||
|
||||
$callback->( { info => $out });
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@@ -0,0 +1,286 @@
|
||||
#!/usr/bin/perl
|
||||
###############################################################################
|
||||
# IBM(c) 2015 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
###############################################################################
|
||||
# COMPONENT: mkdummyimage
|
||||
#
|
||||
# This script creates a dummy image.
|
||||
###############################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use File::Basename;
|
||||
use File::Path;
|
||||
use File::Spec;
|
||||
use File::Temp;
|
||||
use Getopt::Long;
|
||||
use MIME::Base64;
|
||||
use Sys::Hostname;
|
||||
use Socket;
|
||||
|
||||
my $version = "1.0";
|
||||
|
||||
my $defaultName = 'dummy.img'; # Default image file name
|
||||
my $dest = ''; # Target destination (filespec)
|
||||
my $displayHelp = 0; # Display help information
|
||||
my $eckdImage = 0; # ECKD image is wanted
|
||||
my $fbaImage = 0; # FBA image is wanted
|
||||
my $remoteHost = ''; # Remote host transfer information
|
||||
my $remoteUser = ''; # Remote user transfer information
|
||||
my $verbose = 0; # Verbose flag - 0: quiet, 1: verbose
|
||||
my $versionOpt = 0; # Show version information flag
|
||||
|
||||
# set the usage message
|
||||
my $usage_string = "Usage:\n
|
||||
$0 [ --eckd | --fba ] [ -V | --verbose ]
|
||||
[ -d | --destination <dest> ] [-R | --remotehost <host> ]\n
|
||||
or\n
|
||||
$0 -v | --version\n
|
||||
or\n
|
||||
$0 -h | --help\n
|
||||
The following options are supported:\n
|
||||
-d | --destination <dest>
|
||||
File specification of the image file to be created.
|
||||
Either the filename only or a fully qualified name.
|
||||
If the destination is within the xCAT MN then
|
||||
it must be within the directory specified by
|
||||
the installdir property in the xCAT site table.
|
||||
The default file name is $defaultName.\n
|
||||
--eckd Create an empty ECKD disk image. This is the
|
||||
default image type if neither --eckd or --fba
|
||||
is specifed.\n
|
||||
--fba Create an empty FBA disk image\n
|
||||
-h | --help Display help information\n
|
||||
-R | --remotehost <host>
|
||||
Indicates that the destination specified on the
|
||||
command invocation is the file specification on a
|
||||
host other than the management node.
|
||||
The 'host' operand is the IP address or DNS host
|
||||
name of the target server. A user may be specified
|
||||
in a similar way as it is specified with the SCP
|
||||
command using the format 'user\@host' where 'user'
|
||||
is the name of the user on the remote system and
|
||||
'host' operand is as previously stated. The image
|
||||
is created in the directory specified by the
|
||||
tmpdir property in the site table and then moved
|
||||
to the remote host using SCP. After moving the
|
||||
image off the xCAT MN, the image is removed
|
||||
from the xCAT MN. Prior to specifying the command,
|
||||
the keystore on the remote host must be set up with
|
||||
the public key of the xCAT MN.\n
|
||||
-v | --version Display the version of this script.\n
|
||||
-V | --verbose Display verbose processing messages.\n";
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 createImage
|
||||
|
||||
Description : Create the dummy image file.
|
||||
Arguments : None
|
||||
Returns : 0 - No error
|
||||
non-zero - Error detected.
|
||||
Example : $rc = createImage();
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub createImage{
|
||||
my $rc = 0;
|
||||
my $buildDir = '';
|
||||
my $header;
|
||||
|
||||
# Create a temporary directory in which to create the image.
|
||||
my $tmpDir = `/opt/xcat/sbin/tabdump site| grep '^"tmpdir",' | sed s/'^"tmpdir","'//g| sed s/'".*'//g`;
|
||||
chomp $tmpDir;
|
||||
if ( $tmpDir eq '' ) {
|
||||
print "Error: The 'tmpdir' value is missing from the site table.\n";
|
||||
$rc = 11;
|
||||
goto FINISH_createImage;
|
||||
}
|
||||
$buildDir = mkdtemp( "$tmpDir/image.$$.XXXXXX" );
|
||||
|
||||
# Create the image
|
||||
my $imageFile = $defaultName;
|
||||
open( my $fh, '>', "$buildDir/$imageFile" ) or die "Could not open file '$buildDir/$imageFile'";
|
||||
if ( $verbose ) {
|
||||
print "Creating the image in $buildDir as $imageFile.\n";
|
||||
}
|
||||
|
||||
if ( $eckdImage ) {
|
||||
$header = "xCAT CKD Disk Image:";
|
||||
$header = "$header 0 CYL";
|
||||
}
|
||||
elsif ( $fbaImage ) {
|
||||
$header = "xCAT FBA Disk Image:";
|
||||
$header = "$header 0 BLK";
|
||||
}
|
||||
$header = "$header HLen: 0055"; # Header size increased by x from 0055
|
||||
$header = "$header GZIP: 0";
|
||||
printf $fh "%-512s", "$header";
|
||||
close( $fh );
|
||||
|
||||
# Move the image to the target location.
|
||||
if ( $remoteHost ne '' ) {
|
||||
# Do a remote transfer
|
||||
my $remoteTarget = $remoteHost . ':' . $dest;
|
||||
if ( $remoteUser ne '' ) {
|
||||
$remoteTarget = "$remoteUser\@$remoteTarget";
|
||||
}
|
||||
my $scpVerbose = '';
|
||||
if ( $verbose ) {
|
||||
print "Moving the image $imageFile to the remote system $remoteHost as $dest.\n";
|
||||
$scpVerbose = '-v'
|
||||
}
|
||||
$rc = system( "/usr/bin/scp $scpVerbose -B $buildDir/$imageFile $remoteTarget" );
|
||||
if ( $rc ) {
|
||||
$rc = $rc >> 8;
|
||||
print "Error: Unable to copy the image $buildDir/$imageFile to the remote host: $remoteHost, rc: $rc\n";
|
||||
$rc = 30;
|
||||
goto FINISH_createImage;
|
||||
}
|
||||
} else {
|
||||
# Move the file to a local directory
|
||||
$rc = system( "cp $buildDir/$imageFile $dest" );
|
||||
if ( $rc ) {
|
||||
$rc = $rc >> 8;
|
||||
print "Error: Unable to copy the image $buildDir/$imageFile to the destination: $dest, rc: $rc\n";
|
||||
$rc = 40;
|
||||
goto FINISH_createImage;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $remoteHost ne '' ) {
|
||||
print "Image created on $remoteHost: $dest\n";
|
||||
} else {
|
||||
print "Image created: $dest\n";
|
||||
}
|
||||
|
||||
FINISH_createImage:
|
||||
if ( -d $buildDir ) {
|
||||
rmtree $buildDir;
|
||||
}
|
||||
return $rc;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 showHelp
|
||||
|
||||
Description : Show the help inforamtion.
|
||||
Arguments : None.
|
||||
Returns : None.
|
||||
Example : showHelp();
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub showHelp{
|
||||
print "$0 prepares a special image file that contains no disk\ncontents.\n\n";
|
||||
print $usage_string;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#*****************************************************************************
|
||||
# Main routine
|
||||
#*****************************************************************************
|
||||
my $rc = 0;
|
||||
my $out;
|
||||
|
||||
# Parse the arguments
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
if (!GetOptions(
|
||||
'eckd' => \$eckdImage,
|
||||
'd|destination=s' => \$dest,
|
||||
'fba' => \$fbaImage,
|
||||
'h|help' => \$displayHelp,
|
||||
'R|remotehost=s' => \$remoteHost,
|
||||
'v|version' => \$versionOpt,
|
||||
'V|verbose' => \$verbose )) {
|
||||
print $usage_string;
|
||||
goto FINISH_main;
|
||||
}
|
||||
|
||||
if ( $versionOpt ) {
|
||||
print "Version: $version\n";
|
||||
}
|
||||
|
||||
if ( $displayHelp ) {
|
||||
showHelp();
|
||||
}
|
||||
|
||||
if ( $displayHelp or $versionOpt ) {
|
||||
goto FINISH_main;
|
||||
}
|
||||
|
||||
if ( !$eckdImage and !$fbaImage ) {
|
||||
$eckdImage = 1;
|
||||
}
|
||||
|
||||
if ( $remoteHost ne '' ) {
|
||||
$remoteHost =~ s/^\s+|\s+$//g; # trim blanks from both ends of the value
|
||||
my $spaceCnt = scalar( () = $remoteHost =~ /\s+/g );
|
||||
if ( $spaceCnt != 0 ) {
|
||||
print "Error: Remote host value is not a single word.\n";
|
||||
$rc = 1;
|
||||
goto FINISH_main;
|
||||
}
|
||||
if ( $remoteHost =~ /@/ ) {
|
||||
my @parts = split( /@/, $remoteHost );
|
||||
if ( substr( $remoteHost, -1) eq '@' or
|
||||
@parts > 2 or
|
||||
!defined $parts[0] or $parts[0] eq '' or
|
||||
!defined $parts[1] or $parts[1] eq '' ) {
|
||||
print "Error: Remote host value is not valid.\n" .
|
||||
" It should be in the form of 'hostname' or 'user\@hostname'.\n";
|
||||
$rc = 2;
|
||||
goto FINISH_main;
|
||||
}
|
||||
$remoteUser = $parts[0];
|
||||
$remoteHost = $parts[1];
|
||||
} else {
|
||||
$remoteUser = 'root';
|
||||
}
|
||||
}
|
||||
|
||||
# Determine the destination and make certain it is valid.
|
||||
my $installDir = `/opt/xcat/sbin/tabdump site| grep '^"installdir",' | sed s/'^"installdir","'//g| sed s/'".*'//g`;
|
||||
chomp $installDir;
|
||||
if ( $installDir eq '' ) {
|
||||
print "Error: The 'installDir' value is missing from the site table.\n";
|
||||
$rc = 10;
|
||||
goto FINISH_main;
|
||||
}
|
||||
|
||||
if ( $dest eq '' ){
|
||||
# Set default destination for either a local or remote location.
|
||||
if ( $remoteHost eq '' ) {
|
||||
$dest = "$installDir/$defaultName";
|
||||
} else {
|
||||
$dest = "$defaultName";
|
||||
}
|
||||
} else {
|
||||
# Can only verify local destination here. SCP will verify the remote destination.
|
||||
if ( $remoteHost eq '' ) {
|
||||
if ( $dest !~ /\// ) {
|
||||
$dest = "$installDir/$dest";
|
||||
} else {
|
||||
if ( $dest !~ /^$installDir/ ) {
|
||||
print "Error: The destination is not within the install directory specified in the site table.\n";
|
||||
$rc = 20;
|
||||
goto FINISH_main;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Create the image file.
|
||||
createImage();
|
||||
|
||||
FINISH_main:
|
||||
exit $rc;
|
||||
|
||||
+27
-3
@@ -23,13 +23,24 @@ use Getopt::Long;
|
||||
use POSIX qw(:signal_h :errno_h :sys_wait_h);
|
||||
use Thread qw(yield);
|
||||
|
||||
|
||||
$::onecli = 0;
|
||||
if ($iam =~ /pasu/) {
|
||||
$::utilcmd = '/opt/lenovo/toolscenter/asu/asu64';
|
||||
$::utilcmd = '/opt/lenovo/onecli/asu';
|
||||
$::onecli = 1;
|
||||
if (!-x $::utilcmd) {
|
||||
$::onecli = 0;
|
||||
$::utilcmd = '/opt/lenovo/toolscenter/asu/asu64';
|
||||
}
|
||||
if (!-x $::utilcmd) {
|
||||
$::utilcmd = '/opt/ibm/toolscenter/asu/asu64';
|
||||
}
|
||||
} elsif ($iam =~ /piflash/) {
|
||||
$::utilcmd = '/opt/xcat/sbin/iflash64 --unattended';
|
||||
$::utilcmd = '/opt/lenovo/onecli/iflash64';
|
||||
if (!-x $::utilcmd) {
|
||||
$::utilcmd = '/opt/xcat/sbin/iflash64';
|
||||
}
|
||||
$::utilcmd .= ' --unattended'
|
||||
}
|
||||
my $interface;
|
||||
my $username;
|
||||
@@ -198,7 +209,17 @@ sub processoutput { #This way, one arbiter handles output, no interrupting
|
||||
$line !~ /Licensed Materials - Property of Lenovo/i &&
|
||||
$line !~ /\(C\) Copyright IBM Corp. \d+-\d+ All Rights Reserved/i &&
|
||||
$line !~ /\(C\) Copyright Lenovo Corp. \d+-\d+ All Rights Reserved/i &&
|
||||
$line !~ /Connected to IMM at IP address/i)) {
|
||||
$line !~ /Connected to IMM at IP address/i &&
|
||||
$line !~ /Lenovo ASU/i &&
|
||||
$line !~ /^\s*$/i &&
|
||||
$line !~ /Lenovo ToolsCenterSuite CLI/i &&
|
||||
$line !~ /Lenovo XClarity Essentials OneCLI/i &&
|
||||
$line !~ /Invoking SHOW command .../i &&
|
||||
$line !~ /Invoking SET command .../i &&
|
||||
$line !~ /Connected to BMC by IP address/i &&
|
||||
$line !~ /Succeeded running the command /i &&
|
||||
$line !~ /Based on module version /i &&
|
||||
$line !~ /Succeed running command /i)) {
|
||||
print $nodehdl{$readyh} . ": " . $line . "\n";
|
||||
}
|
||||
}
|
||||
@@ -225,6 +246,9 @@ sub utilnode {
|
||||
} else {
|
||||
foreach my $a (@_) { $args .= ' ' . xCAT::Utils->quote($a); }
|
||||
}
|
||||
if ($::onecli and $bmc =~ /:/) {
|
||||
$bmc = "[$bmc]";
|
||||
}
|
||||
my $cmd = "$::utilcmd $args --host '$bmc' --user '$username' --password '$passwd' 2>&1 |";
|
||||
if ($::VERBOSE) { print "forking $cmd\n"; }
|
||||
my $pid = open($$out, $cmd);
|
||||
|
||||
@@ -162,7 +162,7 @@ sub fping_pping {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!-x '/usr/bin/fping')
|
||||
if (!-x '/usr/bin/fping' and !-x '/usr/sbin/fping')
|
||||
{
|
||||
print "fping is not available, please install missing package fping.\n";
|
||||
exit 1;
|
||||
@@ -199,7 +199,7 @@ sub nmap_pping {
|
||||
@nmap_options = xCAT::TableUtils->get_site_attribute("nmapoptions");
|
||||
$more_options = $nmap_options[0];
|
||||
}
|
||||
open(FPING, "nmap -PE --system-dns --send-ip -sP $more_options " . join(' ', @$nodes) . " 2> /dev/null|") or die("Cannot open nmap pipe: $!");
|
||||
open(FPING, "nmap -PE --system-dns --unprivileged --send-ip -sP $more_options " . join(' ', @$nodes) . " 2> /dev/null|") or die("Cannot open nmap pipe: $!");
|
||||
my $node;
|
||||
while (<FPING>) {
|
||||
if (/Host (.*) \(.*\) appears to be up/) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user