2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-06-18 01:20:46 +00:00

Merge branch 'master' of github.com:xcat2/xcat-core

This commit is contained in:
caomengmeng
2016-09-05 05:28:25 -04:00
189 changed files with 6536 additions and 4257 deletions
+1 -1
View File
@@ -1 +1 @@
2.12.2
2.12.3
+5 -4
View File
@@ -203,7 +203,7 @@ then
pkg_type="snap"
build_string="Snap_Build"
cur_date=`date +%Y%m%d%H%M`
pkg_version="${short_ver}-${pkg_type}${cur_date}"
pkg_version="${ver}-${pkg_type}${cur_date}"
if [ ! -d ../../$package_dir_name ];then
mkdir -p "../../$package_dir_name"
@@ -233,9 +233,10 @@ then
#3 symbolic link can't work during package
if [ $file_low = "xcat-probe" ]; then
CURDIR=$(pwd)
mkdir -p ${CURDIR}/xCAT-probe/lib/perl/xCAT/
cp -f ${CURDIR}/perl-xCAT/xCAT/NetworkUtils.pm ${CURDIR}/xCAT-probe/lib/perl/xCAT/
cp -f ${CURDIR}/perl-xCAT/xCAT/GlobalDef.pm ${CURDIR}/xCAT-probe/lib/perl/xCAT/
mkdir -p ${CURDIR}/lib/perl/xCAT/
cp -f ${CURDIR}/../perl-xCAT/xCAT/NetworkUtils.pm ${CURDIR}/lib/perl/xCAT/
cp -f ${CURDIR}/../perl-xCAT/xCAT/GlobalDef.pm ${CURDIR}/lib/perl/xCAT/
cp -f ${CURDIR}/../perl-xCAT/xCAT/ServiceNodeUtils.pm ${CURDIR}/lib/perl/xCAT/
fi
dpkg-buildpackage -uc -us
else
@@ -53,6 +53,8 @@ For ubuntu ppc64le, the initrd.gz shipped with the ISO does not support network
[ubuntu 16.04]: http://xcat.org/files/netboot/ubuntu16.04/ppc64el/mini.iso
[ubuntu 16.04.1]: http://xcat.org/files/netboot/ubuntu16.04.1/ppc64el/mini.iso
* Mount mini.iso ::
mkdir /tmp/iso
@@ -61,7 +63,7 @@ For ubuntu ppc64le, the initrd.gz shipped with the ISO does not support network
* Copy the netboot initrd.gz to osimage ::
mkdir -p /install/<ubuntu-version>/ppc64el/install/netboot
cp /tmp/iso/install/initrd.gz /install/<ubuntu-version>/ppc64el/installe/netboot
cp /tmp/iso/install/initrd.gz /install/<ubuntu-version>/ppc64el/install/netboot
**[Below tips maybe helpful for you]**
@@ -62,7 +62,7 @@ VMware/KVM specific:
====================
\ **chvm**\ \ *noderange*\ [\ **-a**\ \ *size*\ ] [\ **-d**\ \ *disk*\ ] [\ **-p**\ \ *disk*\ ] [\ **-**\ **-resize**\ \ **disk**\ =\ *size*\ ] [\ **-**\ **-cpus**\ \ *count*\ ] [\ **-**\ **-mem**\ \ *memory*\ ]
\ **chvm**\ \ *noderange*\ [\ **-a**\ \ *size*\ ] [\ **-d**\ \ *disk*\ ] [\ **-p**\ \ *disk*\ ] [\ **-**\ **-resize**\ \ *disk*\ =\ *size*\ ] [\ **-**\ **-cpus**\ \ *count*\ ] [\ **-**\ **-mem**\ \ *memory*\ ]
zVM specific:
@@ -318,7 +318,7 @@ VMware/KVM specific:
\ **-d**\ \ *disk*\
Deregister the Hard disk but leave the backing files. Multiple can be done with comma separated values. The disks are specified by SCSI id. Size defaults to GB.
Deregister the Hard disk but leave the backing files. Multiple can be done with comma separated values. The disks are specified by SCSI id.
@@ -330,13 +330,13 @@ VMware/KVM specific:
\ **-p**\ \ *disk*\
Purge the Hard disk. Deregisters and deletes the files. Multiple can be done with comma separated values. The disks are specified by SCSI id. Size defaults to GB.
Purge the Hard disk. Deregisters and deletes the files. Multiple can be done with comma separated values. The disks are specified by SCSI id.
\ **-**\ **-resize**\ \ **disk**\ =\ *size*\
\ **-**\ **-resize**\ \ *disk*\ =\ *size*\
Change the size of the Hard disk. The disk can never be set to less than it's current size. Multiple disks can be resized to \ *size*\ by using comma separated values on the left side of \ **=**\ . The disks are specified by SCSI id. Size defaults to GB.
Change the size of the Hard disk. The disk in \ *qcow2*\ format can not be set to less than it's current size. The disk in \ *raw*\ format can be resized smaller, please use caution. Multiple disks can be resized by using comma separated \ *disk*\ \ **=**\ \ *size*\ pairs. The disks are specified by SCSI id. Size defaults to GB.
@@ -976,6 +976,14 @@ Output is similar to:
gpok3: Replacing user entry of LNX3... Done
8. To resize virtual machine's disk sdb to 10G and sdc to 15G:
.. code-block:: perl
chvm gpok3 --resize sdb=10G,sdc=15G
*****
@@ -23,7 +23,7 @@ SYNOPSIS
\ **packimage [-v| -**\ **-version]**\
\ **packimage**\ \ *imagename*\
\ **packimage**\ [\ **-m | -**\ **-method**\ \ *cpio|tar*\ ] [\ **-c | -**\ **-compress**\ \ *gzip|pigz|xz*\ ] \ *imagename*\
***********
@@ -56,13 +56,9 @@ OPTIONS
\ **-v**\ Command Version.
\ **-o**\ Operating system (fedora8, rhel5, sles10,etc)
\ **-m| -**\ **-method**\ Archive Method (cpio,tar,squashfs, default is cpio)
\ **-p**\ Profile (compute,service)
\ **-a**\ Architecture (ppc64,x86_64,etc)
\ **-m**\ Archive Method (cpio,tar,squashfs, default is cpio)
\ **-c| -**\ **-compress**\ Compress Method (pigz,gzip,xz, default is pigz/gzip)
************
@@ -88,6 +84,14 @@ EXAMPLES
packimage rhels7.1-x86_64-netboot-compute
2. To pack the osimage rhels7.1-x86_64-netboot-compute with "tar" to archive and "pigz" to compress:
.. code-block:: perl
packimage -m tar -c pigz rhels7.1-x86_64-netboot-compute
*****
FILES
@@ -80,16 +80,12 @@ FSP/CEC specific:
=================
\ **rspconfig**\ \ *noderange*\ {\ **autopower | iocap | dev | celogin1 | decfg | memdecfg | procdecfg | time | date | spdump | sysdump | network**\ }
\ **rspconfig**\ \ *noderange*\ {\ **autopower | iocap | decfg | memdecfg | procdecfg | time | date | spdump | sysdump | network**\ }
\ **rspconfig**\ \ *noderange*\ \ **autopower**\ ={\ **enable | disable**\ }
\ **rspconfig**\ \ *noderange*\ \ **iocap**\ ={\ **enable | disable**\ }
\ **rspconfig**\ \ *noderange*\ \ **dev**\ ={\ **enable | disable**\ }
\ **rspconfig**\ \ *noderange*\ \ **celogin1**\ ={\ **enable | disable**\ }
\ **rspconfig**\ \ *noderange*\ \ **time**\ =\ *hh:mm:ss*\
\ **rspconfig**\ \ *noderange*\ \ **date**\ =\ *mm:dd:yyyy*\
@@ -142,7 +138,7 @@ BPA/Frame Specific:
===================
\ **rspconfig**\ \ *noderange*\ {\ **network | dev | celogin1**\ }
\ **rspconfig**\ \ *noderange*\ {\ **network**\ }
\ **rspconfig**\ \ *noderange*\ \ **network**\ ={\ **nic,**\ \*}
@@ -150,10 +146,6 @@ BPA/Frame Specific:
\ **rspconfig**\ \ *noderange*\ \ **network**\ ={\ **nic,0.0.0.0**\ }
\ **rspconfig**\ \ *noderange*\ \ **dev**\ ={\ **enable | disable**\ }
\ **rspconfig**\ \ *noderange*\ \ **celogin1**\ ={\ **enable | disable**\ }
\ **rspconfig**\ \ *noderange*\ \ **HMC_passwd**\ ={\ *currentpasswd,newpasswd*\ }
\ **rspconfig**\ \ *noderange*\ \ **admin_passwd**\ ={\ *currentpasswd,newpasswd*\ }
@@ -255,7 +247,7 @@ DESCRIPTION
\ **rspconfig**\ configures various settings in the nodes' service processors. If only a keyword is
specified, without the \ **=**\ , it displays the current value.
For options \ **autopower | iocap | dev | celogin1 | decfg | memdecfg | procdecfg | time | date | spdump | sysdump | network**\ , user need to use \ *chdef -t site enableASMI=yes*\ to enable ASMI first. For options \ **dev | celogin1**\ , user also need to contact IBM service to get the dynamic password for 'celogin' and put it in passwd table. After completed the command, user should use \ *chdef -t site enableASMI=no*\ to disable ASMI.
For options \ **autopower | iocap | decfg | memdecfg | procdecfg | time | date | spdump | sysdump | network**\ , user need to use \ *chdef -t site enableASMI=yes*\ to enable ASMI first.
*******
@@ -396,18 +388,6 @@ OPTIONS
\ **dev**\ ={\ **enable**\ | \ **disable**\ }
Enable or disable the CEC|Frame 'dev' account or display account status if no value specified.
\ **celogin1**\ ={\ **enable**\ | \ **disable**\ }
Enable or disable the CEC|Frame 'celogin1' account or display account status if no value specified.
\ **ip**\
The ip address.
@@ -12,14 +12,20 @@ From the xCAT download page, find the build you want to install and add to ``/et
To configure the xCAT development build, add the following line to ``/etc/apt/sources.list``: ::
deb http://xcat.org/files/xcat/repos/apt/devel/core-snap trusty main
[For x86_64 servers]
deb [arch=amd64] http://xcat.org/files/xcat/repos/apt/devel/core-snap trusty main
[For ppc64el servers]
deb [arch=ppc64el] http://xcat.org/files/xcat/repos/apt/devel/core-snap trusty main
**[xcat-dep]**
To configure the xCAT deps online repository, add the following line to ``/etc/apt/sources.list``: ::
deb http://xcat.org/files/xcat/repos/apt/xcat-dep trusty main
[For x86_64 servers]
deb [arch=amd64] http://xcat.org/files/xcat/repos/apt/xcat-dep trusty main
[For ppc64el servers]
deb [arch=ppc64el] http://xcat.org/files/xcat/repos/apt/xcat-dep trusty main
If using internet repositories, continue to the next step to install xCAT.
+1
View File
@@ -51,6 +51,7 @@ Features
* Parallel ping
#. Integrate xCAT in Cloud
* Openstack
* SoftLayer
+8
View File
@@ -14,6 +14,14 @@ xCAT 2.12.x
|xCAT |New OS |New |New Feature |
|Version | |Hardware | |
+=================================+===============+=============+==================================+
|| xCAT 2.12.2 |- UBT 16.04.1 | |- nodeset <noderange> offline |
|| 2016/08/19 | | |- Enhance: node status update |
|| | | |- Support Bond for install nics |
| `2.12.2 Release Notes <https:// | | |- xcatprobe osdeploy -r (BETA) |
| github.com/xcat2/xcat-core/wiki | | |- New opt: packimage -m -c |
| /XCAT_2.12.2_Release_Notes>`_ | | | |
| | | | |
+---------------------------------+---------------+-------------+----------------------------------+
|| xCAT 2.12.1 | | |- New xCAT install tool: go-xcat |
|| 2016/07/08 | | |- New opt: mkdef/lsdef --template |
|| | | |- Support rinstall for all OS/ARCH|
@@ -0,0 +1,20 @@
2015-03-12 - OpenSSL Vulnerabilities (FREAK)
=============================================
OpenSSL announced security fixes on 01/08/15 in the following bulletin: https://www-origin.openssl.org/news/secadv/20150108.txt
Advisory CVEs
-------------
* CVE-2015-0204 **RSA silently downgrades to EXPORT_RSA [Client]** (Severity: Low)
FREAK vulnerability CVE-2015-0204 is involved when 'RSA_EXPORT' ssl cipher suit is used in ssl server/client.
Action
------
xCAT does not use RSA_EXPORT ciphers for ssl communication by default. However, xCAT does allow user to choose the ciphers from the site.xcatsslciphers attribute.
Please make sure you do not put RSA_EXPORT related ciphers in this attribute.
It is recommended that you upgrade openssl to 1.0.1L and upper version for the fix of this problem. Please go to the os distribution to get the latest openssl package.
@@ -0,0 +1,12 @@
2015-03-24 - OpenSSL Vulnerabilities
====================================
OpenSSL 1.0.2 introduced the "multiblock" performance improvement. This feature only applies on 64 bit x86 architecture platforms that support AES NI instructions. A defect in the implementation of "multiblock" can cause a segmentation fault within OpenSSL, thus enabling a potential DoS attack.
This issue affects OpenSSL version: 1.0.2
Action
------
xCAT uses OpenSSL for client-server communication but **does not** ship it. Please upgrade OpenSSL to 1.0.2a or higher.
@@ -0,0 +1,14 @@
2015-04-03 - OpenSSL Vulnerabilities (BAR MITZVAH)
==================================================
The RC4 Bar mitzvah attack is an attack on the SSL/TLS protocols when both the client and server have RC4 enabled.
* http://www.darkreading.com/attacks-breaches/ssl-tls-suffers-bar-mitzvah-attack-/d/d-id/1319633
* http://www.imperva.com/docs/HII_Attacking_SSL_when_using_RC4.pdf.
Action
------
xCAT uses OpenSSL shipped with OS distribution for client-server communication. It does not use RC4 ciphers explicitly. However, it allows user to specify xcatsslciphers on the site table for ssl communication. It is recommended that the user not specify RC4 ciphers to avoid the Bar mitzvah attack.
It is also recommended that the user go to the OS distribution to get latest OpenSSL package for the fix of this problem.
@@ -0,0 +1,27 @@
2015-05-19 - OpenSSL Vulnerabilities (VENOM)
============================================
Advisory CVEs
-------------
* CVE-2015-3456 - **(aka VENOM) is a security flaw in the QEMU's Floppy Disk Controller (FDC) emulation.**
VENOM vulnerability could expose virtual machines on unpatched host systems
A new vulnerability known as VENOM has been discovered, which could allow an attacker to escape a guest virtual machine (VM) and access the host system along with other VMs running on this system. The VENOM bug could potentially allow an attacker to steal sensitive data on any of the virtual machines on this system and gain elevated access to the host''''s local network and its systems.
The VENOM bug (CVE-2015-3456) exists in the virtual Floppy Disk Controller for the open-source hypervisor QEMU, which is installed by default in a number of virtualization infrastructures such as Xen hypervisors, the QEMU client, and Kernel-based Virtual Machine (KVM). VENOM does not affect VMware, Microsoft Hyper-V, and Bochs hypervisors.
* QEMU: http://git.qemu.org/?p=qemu.git;a=commitdiff;h=e907746266721f305d67bc0718795fedee2e824c
* Xen Project: http://xenbits.xen.org/xsa/advisory-133.html
* Red Hat: https://access.redhat.com/articles/1444903
* SUSE: https://www.suse.com/support/kb/doc.php?id=7016497
* Ubuntu: http://www.ubuntu.com/usn/usn-2608-1/
Action
------
xCAT does not ship any rpms that have QEMU component directly. However xCAT does make system calls to QEMU when doing KVM/Xen visualization. If you are using xCAT to manage KVM or Xen hosts and quests, please get the latest rpms that have QEMU component from the os distro and do a upgrade on both xCAT management node and the KVM/Xen hosts.
@@ -0,0 +1,20 @@
2015-05-20 - OpenSSL Vulnerabilities (LOGJAM)
=============================================
A Logjam vulnerability attacks openssl and web services on weak (512-bit) Diffie-Hellman key groups. Please refer to the following documents for details.
Main site: https://weakdh.org/
Server test: https://weakdh.org/sysadmin.html
Please refer to the following openssl link for more details regarding the fix: https://www.openssl.org/blog/blog/2015/05/20/logjam-freak-upcoming-changes/
OpenSSL 1.0.2 users should upgrade to 1.0.2b
OpenSSL 1.0.1 users should upgrade to 1.0.1n
Action
------
xCAT uses OpenSSL for client-server communication but **does not** ship it. It uses the default ciphers from openssl. It also allows the user to customize it through site.xcatsslversion and site.xcatsslciphers. Please make sure you do not enable DH or DHE ciphers.
Please get the latest openssl package from the os distros and upgrade it on all the xCAT management nodes, the service nodes and xCAT client nodes.
@@ -0,0 +1,42 @@
2015-12-03 - OpenSSL Vulnerabilities
====================================
OpenSSL announced security fixes on 12/03/15 in the following bulletin: http://openssl.org/news/secadv/20151203.txt
Advisory CVEs
-------------
* CVE-2015-3193 - **BN_mod_exp may produce incorrect results on x86_64** (Severity:Moderate)
OpenSSL 1.0.2 users should upgrade to 1.0.2e
* CVE-2015-3194 - **Certificate verify crash with missing PSS parameter** (Severity:Moderate)
OpenSSL 1.0.2 users should upgrade to 1.0.2e
OpenSSL 1.0.1 users should upgrade to 1.0.1q
* CVE-2015-3195 - **X509_ATTRIBUTE memory leak** (Severity:Moderate)
OpenSSL 1.0.2 users should upgrade to 1.0.2e
OpenSSL 1.0.1 users should upgrade to 1.0.1q
OpenSSL 1.0.0 users should upgrade to 1.0.0t
OpenSSL 0.9.8 users should upgrade to 0.9.8zh
* CVE-2015-3196 - **Race condition handling PSK identify hint** (Severity:Low)
OpenSSL 1.0.2 users should upgrade to 1.0.2d
OpenSSL 1.0.1 users should upgrade to 1.0.1p
OpenSSL 1.0.0 users should upgrade to 1.0.0t
* CVE-2015-1794 - **Anon DH ServerKeyExchange with 0 p parameter** (Severity:Low)
OpenSSL 1.0.2 users should upgrade to 1.0.2e
Action
------
xCAT uses OpenSSL for client-server communication but **does not** ship it.
It is recommended to keep your OpenSSL levels up-to-date with the indicated versions in the security bulletins to prevent any potential security threats.
+12
View File
@@ -0,0 +1,12 @@
2015 Notices
============
.. toctree::
:maxdepth: 1
20151203_openssl.rst
20150520_openssl.rst
20150519_openssl.rst
20150403_openssl.rst
20150324_openssl.rst
20150312_openssl.rst
@@ -0,0 +1,18 @@
2016-08-16 - OpenSSL Vulnerabilities
====================================
This vulnerability has no fix available at this time (other then mentioned patches below)
Issue: https://bugzilla.redhat.com/show_bug.cgi?id=1359615
Patch: https://github.com/openssl/openssl/commit/0ed26acce328ec16a3aa635f1ca37365e8c7403a
Advisory CVEs
-------------
`CVE-2016-2180 <https://exchange.xforce.ibmcloud.com/vulnerabilities/115829>`_ - OpenSSL is vulnerable to a denial of service, caused by an out-of-bounds read in the TS_OBJ_print_bio function.
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 to prevent any potential security threats.
@@ -0,0 +1,31 @@
2016-08-24 - OpenSSL Vulnerabilities (Sweet32)
==============================================
**SWEET32: Birthday attacks against TLS ciphers with 64bit block size**
**CVE-2016-2183**
Description: OpenSSL could allow a remote attacker to obtain sensitive information, caused by an error in the in the Triple-DES on 64-bit block cipher, used as a part of the SSL/TLS protocol. By capturing large amounts of encrypted traffic between the SSL/TLS server and the client, a remote attacker able to conduct a man-in-the-middle attack could exploit this vulnerability to recover the plaintext data and obtain sensitive information.
**CVE-2016-6329**
Description: OpenVPN could allow a remote attacker to obtain sensitive information, caused by an error in the in the Triple-DES on 64-bit block cipher, used as a part of the SSL/TLS protocol. By capturing large amounts of encrypted traffic between the SSL/TLS server and the client, a remote attacker able to conduct a man-in-the-middle attack could exploit this vulnerability to recover the plaintext data and obtain sensitive information.
A detailed description of this issue can be seen in the following blog posting: https://www.openssl.org/blog/blog/2016/08/24/sweet32/
Advisory CVEs
-------------
* CVE-2016-2183
* CVE-2016-6329
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.
+2
View File
@@ -4,6 +4,8 @@
.. toctree::
:maxdepth: 1
20160824_openssl.rst
20160815_openssl.rst
20160503_openssl.rst
20160301_openssl.rst
20160128_openssl.rst
+1
View File
@@ -5,3 +5,4 @@ Security Notices
:maxdepth: 2
2016/index.rst
2015/index.rst
+1
View File
@@ -50,6 +50,7 @@ function makenoarch {
mkdir -p ${CURDIR}/xCAT-probe/lib/perl/xCAT/
cp -f ${CURDIR}/perl-xCAT/xCAT/NetworkUtils.pm ${CURDIR}/xCAT-probe/lib/perl/xCAT/
cp -f ${CURDIR}/perl-xCAT/xCAT/GlobalDef.pm ${CURDIR}/xCAT-probe/lib/perl/xCAT/
cp -f ${CURDIR}/perl-xCAT/xCAT/ServiceNodeUtils.pm ${CURDIR}/xCAT-probe/lib/perl/xCAT/
fi
tar --exclude .svn -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME
+2 -43
View File
@@ -50,9 +50,7 @@ sub parse_args {
"general_passwd",
"*_passwd",
"hostname",
"resetnet",
"dev",
"celogin1"
"resetnet"
);
my @bpa = (
"frame",
@@ -63,9 +61,7 @@ sub parse_args {
"general_passwd",
"*_passwd",
"hostname",
"resetnet",
"dev",
"celogin1"
"resetnet"
);
my @ppc = (
"sshcfg"
@@ -169,16 +165,6 @@ sub parse_args {
return (usage("No argument specified for '$_'"));
}
}
{
if ($request->{dev} eq '1' && $request->{other} eq '1') {
return (usage("Invalid command arrays"));
}
# my $result = parse_dev_option( $request, \%cmds);
# if ($result) {
# return ( usage($result));
# }
}
####################################
# Return method to invoke
####################################
@@ -216,25 +202,6 @@ sub parse_args {
return (\%opt);
}
sub parse_dev_option {
my $req = shift;
my $cmds = shift;
foreach my $cmd (keys %$cmds) {
if ($cmd =~ /^(dev|celogin1)$/) {
if ($cmds->{$cmd} and ($cmds->{$cmd} !~ /^(enable|disable)$/i)) {
return ("Invalid argument " . $cmds->{$cmd} . " for " . $cmd);
}
$req->{dev} = 1;
} else {
$req->{other} = 1;
}
}
if ($req->{dev} eq '1' && $req->{other} eq '1') {
return ("Invalid command arrays");
}
return undef;
}
##########################################################################
# Parse the command line optional arguments
##########################################################################
@@ -324,14 +291,6 @@ sub parse_option {
}
}
if ($command eq 'dev' or $command eq 'celogin1') {
if ($value !~ /^(enable|disable)$/i) {
return ("Invalid argument '$value'");
}
$request->{dev} = 1;
} else {
$request->{other} = 1;
}
return undef;
}
+1 -101
View File
@@ -38,9 +38,7 @@ my %cmds = (
autopower => [ "Auto Power Restart", \&autopower ],
sysdump => [ "System Dump", \&sysdump ],
spdump => [ "Service Processor Dump", \&spdump ],
network => [ "Network Configuration", \&netcfg ],
dev => [ "Service Processor Command Line", \&devenable ],
celogin1 => [ "Service Processor Command Line", \&ce1enable ] },
network => [ "Network Configuration", \&netcfg ]},
);
@@ -216,55 +214,6 @@ sub connect {
}
sub ce1enable {
return &loginenable($_[0], $_[1], $_[2], "celogin1");
}
sub devenable {
return &loginenable($_[0], $_[1], $_[2], "dev");
}
my %cmdline_for_log = (
dev => {
enable => "registry -Hw nets/DevEnabled 1",
disable => "registry -Hw nets/DevEnabled 0",
check_pwd => "registry -l DevPwdFile",
create_pwd => "netsDynPwdTool --create dev FipSdev",
password => "FipSdev"
},
celogin1 => {
enable => "registry -Hw nets/CE1Enabled 1",
disable => "registry -Hw nets/CE1Enabled 0",
check_pwd => "registry -l Ce1PwdFile",
create_pwd => "netsDynPwdTool --create celogin1 FipSce1",
password => "FipSce1"
},
);
sub send_command {
my $ua = shift;
my $server = shift;
my $id = shift;
my $log_name = shift;
my $cmd = shift;
my $cmd_line = $cmdline_for_log{$log_name}{$cmd};
if (!defined($cmd_line)) {
return undef;
}
my $res = $ua->post("https://$server/cgi-bin/cgi",
[ form => $id,
cmd => $cmd_line,
submit => "Execute" ]
);
if (!$res->is_success()) {
return undef;
}
if ($res->content =~ /(not allowed.*\.|Invalid entry)/) {
return undef;
}
return $res->content;
}
sub loginstate {
my $ua = shift;
my $server = shift;
@@ -282,55 +231,6 @@ sub loginstate {
}
}
sub loginenable {
my $exp = shift;
my $request = shift;
my $id = shift;
my $log_name = shift;
my $ua = @$exp[0];
my $server = @$exp[1];
my $value = $request->{method}{$log_name};
if (!defined($value)) {
return &loginstate($ua, $server, $log_name);
}
my $url = "https://$server/cgi-bin/cgi?form=$id";
my $res = $ua->get($url);
if (!$res->is_success()) {
return ([ RC_ERROR, $res->status_line ]);
}
$res = &send_command($ua, $server, $id, $log_name, $value);
if (!defined($res)) {
return ([ RC_ERROR, "Send command Failed" ]);
}
if ($value =~ m/^disable$/) {
my $out = sprintf("%9s: Disabled", $log_name);
return ([ SUCCESS, $out ]);
}
#check password#
$res = &send_command($ua, $server, $id, $log_name, "check_pwd");
if (!defined($res)) {
return ([ RC_ERROR, "Send command Failed" ]);
}
my $password = undef;
if ($res =~ m/\[\d+([a-zA-Z]+)\d+\]/) {
$password = $1;
} else {
# create password #
$res = &send_command($ua, $server, $id, $log_name, "create_pwd");
if (!defined($res)) {
return ([ RC_ERROR, "Send command Failed" ]);
}
$password = $cmdline_for_log{$log_name}{password};
print "create password for $log_name is '$cmdline_for_log{$log_name}{password}'\n";
}
my $out = sprintf("%9s: Enabled, password: $password", $log_name);
return ([ SUCCESS, $out ]);
}
sub disconnect {
my $exp = shift;
-4
View File
@@ -187,10 +187,6 @@ my %usage = (
HMC specific:
rspconfig <noderange> [sshcfg]
rspconfig <noderange> [sshcfg=<enable|disable>]
CEC|Frame(using ASM)Specific:
rspconfig <noderange> [dev|celogin1]
rspconfig <noderange> [dev=<enable|disable>]|
rspconfig <noderange> [celogin1=<enable|disable>]
",
"getmacs" =>
"Usage:
+7 -1
View File
@@ -916,7 +916,13 @@ sub initmysqldb
}
else
{
$cmd = "/usr/bin/mysql_install_db --user=mysql";
my $sqlcmd = "/usr/bin/mysql_install_db";
if (!(-x ($sqlcmd))) {
xCAT::MsgUtils->message("E", "$sqlcmd is not available, please install required mysql/mariadb packages");
exit(1);
}
$cmd = "$sqlcmd --user=mysql";
}
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
f=1
p=0
for i in `nodels $1`; do
for i in `nodels "$1"`; do
if [ "$f" = 1 ]; then
f=0
qdate=$((`date +%s`+5))
+9 -5
View File
@@ -38,7 +38,7 @@ B<chvm> I<noderange> [B<--devdetach> I<pcidevice>...]
=head2 VMware/KVM specific:
B<chvm> I<noderange> [B<-a> I<size>] [B<-d> I<disk>] [B<-p> I<disk>] [B<--resize> B<disk>=I<size>] [B<--cpus> I<count>] [B<--mem> I<memory>]
B<chvm> I<noderange> [B<-a> I<size>] [B<-d> I<disk>] [B<-p> I<disk>] [B<--resize> I<disk>=I<size>] [B<--cpus> I<count>] [B<--mem> I<memory>]
=head2 zVM specific:
@@ -236,7 +236,7 @@ Set the number of CPUs.
=item B<-d> I<disk>
Deregister the Hard disk but leave the backing files. Multiple can be done with comma separated values. The disks are specified by SCSI id. Size defaults to GB.
Deregister the Hard disk but leave the backing files. Multiple can be done with comma separated values. The disks are specified by SCSI id.
=item B<--mem> I<memory>
@@ -244,11 +244,11 @@ Set the memory, defaults to MB.
=item B<-p> I<disk>
Purge the Hard disk. Deregisters and deletes the files. Multiple can be done with comma separated values. The disks are specified by SCSI id. Size defaults to GB.
Purge the Hard disk. Deregisters and deletes the files. Multiple can be done with comma separated values. The disks are specified by SCSI id.
=item B<--resize> B<disk>=I<size>
=item B<--resize> I<disk>=I<size>
Change the size of the Hard disk. The disk can never be set to less than it's current size. Multiple disks can be resized to I<size> by using comma separated values on the left side of B<=>. The disks are specified by SCSI id. Size defaults to GB.
Change the size of the Hard disk. The disk in I<qcow2> format can not be set to less than it's current size. The disk in I<raw> format can be resized smaller, please use caution. Multiple disks can be resized by using comma separated I<disk>B<=>I<size> pairs. The disks are specified by SCSI id. Size defaults to GB.
=back
@@ -640,6 +640,10 @@ Output is similar to:
gpok3: Replacing user entry of LNX3... Done
8. To resize virtual machine's disk sdb to 10G and sdc to 15G:
chvm gpok3 --resize sdb=10G,sdc=15G
=head1 FILES
/opt/xcat/bin/chvm
+6 -7
View File
@@ -8,7 +8,7 @@ B<packimage [-h| --help]>
B<packimage [-v| --version]>
B<packimage> I<imagename>
B<packimage> [B<-m>|B<--method> I<cpio|tar>] [B<-c>|B<--compress> I<gzip|pigz|xz>] I<imagename>
=head1 DESCRIPTION
@@ -30,13 +30,9 @@ B<-h> Display usage message.
B<-v> Command Version.
B<-o> Operating system (fedora8, rhel5, sles10,etc)
B<-m| --method> Archive Method (cpio,tar,squashfs, default is cpio)
B<-p> Profile (compute,service)
B<-a> Architecture (ppc64,x86_64,etc)
B<-m> Archive Method (cpio,tar,squashfs, default is cpio)
B<-c| --compress> Compress Method (pigz,gzip,xz, default is pigz/gzip)
=head1 RETURN VALUE
@@ -51,6 +47,9 @@ B<-m> Archive Method (cpio,tar,squashfs, default is cpio)
packimage rhels7.1-x86_64-netboot-compute
2. To pack the osimage rhels7.1-x86_64-netboot-compute with "tar" to archive and "pigz" to compress:
packimage -m tar -c pigz rhels7.1-x86_64-netboot-compute
=head1 FILES
+3 -19
View File
@@ -54,16 +54,12 @@ B<rspconfig> I<noderange> B<ntp>={[B<ntpenable>],[B<ntpserver>],[B<frequency>],[
=head2 FSP/CEC specific:
B<rspconfig> I<noderange> {B<autopower>|B<iocap>|B<dev>|B<celogin1>|B<decfg>|B<memdecfg>|B<procdecfg>|B<time>|B<date>|B<spdump>|B<sysdump>|B<network>}
B<rspconfig> I<noderange> {B<autopower>|B<iocap>|B<decfg>|B<memdecfg>|B<procdecfg>|B<time>|B<date>|B<spdump>|B<sysdump>|B<network>}
B<rspconfig> I<noderange> B<autopower>={B<enable>|B<disable>}
B<rspconfig> I<noderange> B<iocap>={B<enable>|B<disable>}
B<rspconfig> I<noderange> B<dev>={B<enable>|B<disable>}
B<rspconfig> I<noderange> B<celogin1>={B<enable>|B<disable>}
B<rspconfig> I<noderange> B<time>=I<hh:mm:ss>
B<rspconfig> I<noderange> B<date>=I<mm:dd:yyyy>
@@ -111,7 +107,7 @@ B<rspconfig> I<noderange> B<cec_off_policy>={B<poweroff>|B<stayon>}
=head2 BPA/Frame Specific:
B<rspconfig> I<noderange> {B<network>|B<dev>|B<celogin1>}
B<rspconfig> I<noderange> {B<network>}
B<rspconfig> I<noderange> B<network>={B<nic,>*}
@@ -119,10 +115,6 @@ B<rspconfig> I<noderange> B<network>={B<nic,[IP,][hostname,][gateway,][netmask]>
B<rspconfig> I<noderange> B<network>={B<nic,0.0.0.0>}
B<rspconfig> I<noderange> B<dev>={B<enable>|B<disable>}
B<rspconfig> I<noderange> B<celogin1>={B<enable>|B<disable>}
B<rspconfig> I<noderange> B<HMC_passwd>={I<currentpasswd,newpasswd>}
B<rspconfig> I<noderange> B<admin_passwd>={I<currentpasswd,newpasswd>}
@@ -211,7 +203,7 @@ B<rspconfig> I<noderange> B<--resetnet>
B<rspconfig> configures various settings in the nodes' service processors. If only a keyword is
specified, without the B<=>, it displays the current value.
For options B<autopower>|B<iocap>|B<dev>|B<celogin1>|B<decfg>|B<memdecfg>|B<procdecfg>|B<time>|B<date>|B<spdump>|B<sysdump>|B<network>, user need to use I<chdef -t site enableASMI=yes> to enable ASMI first. For options B<dev>|B<celogin1>, user also need to contact IBM service to get the dynamic password for 'celogin' and put it in passwd table. After completed the command, user should use I<chdef -t site enableASMI=no> to disable ASMI.
For options B<autopower>|B<iocap>|B<decfg>|B<memdecfg>|B<procdecfg>|B<time>|B<date>|B<spdump>|B<sysdump>|B<network>, user need to use I<chdef -t site enableASMI=yes> to enable ASMI first.
=head1 OPTIONS
@@ -305,14 +297,6 @@ Set CEC/BPA system names to the names in xCAT DB or the input name.
Select the policy for I/O Adapter Enlarged Capacity. This option controls the size of PCI memory space allocated to each PCI slot.
=item B<dev>={B<enable> | B<disable>}
Enable or disable the CEC|Frame 'dev' account or display account status if no value specified.
=item B<celogin1>={B<enable> | B<disable>}
Enable or disable the CEC|Frame 'celogin1' account or display account status if no value specified.
=item B<ip>
The ip address.
+1
View File
@@ -12,3 +12,4 @@ instmods dm-mod #support LVM for sysclone
instmods sg # Lenovo thinkserver firmware update support
instmods ipr # IBM Power RAID
instmods i40e # Intel 40GbE
instmods rtc-opal # For hardware clock
+7 -4
View File
@@ -274,14 +274,17 @@ logger -s -t $log_label -p local4.info "Acquired IPv4 address on $bootnic"
ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet|awk '{print $2}'
ntpd -g -x
if [ -e "/dev/rtc" ]; then
( sleep 8 ; hwclock --systohc ) </dev/null >/dev/null 2>&1 &
disown
fi
# rv 0 state does not work with the new ntp versions
while [ "`ntpq -c \"rv 0 offset\" | grep \"offset=\" | awk -F \"=\" '{print $2}' | awk -F \".\" '{print $1}' | sed s/-//`" -ge 1000 ]; do
while [ "`ntpq -c 'rv 0 offset' | awk -F '=' '/offset=/ { print $2 }' | awk -F '.' '{ print $1 }' | sed s/-//`" -ge 1000 ]; do
sleep 1
done
if [ -e "/dev/rtc" ]; then
hwclock --systohc
fi
HOST_ARCH=`uname -m`
if echo $HOST_ARCH | grep "ppc64"; then
modprobe ipmi_powernv
+4 -4
View File
@@ -5,11 +5,11 @@ Maintainer: xCAT <xcat-user@lists.sourceforge.net>
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 3.9.2
Package: xcat-genesis-scripts-x86-64
Package: xcat-genesis-scripts-amd64
Architecture: all
Depends: xcat-genesis-base-x86-64
Conflicts: xcat-genesis-scripts,xcat-genesis-scripts-amd64
Replaces: xcat-genesis-scripts,xcat-genesis-scripts-amd64
Depends: xcat-genesis-base-amd64
Conflicts: xcat-genesis-scripts,xcat-genesis-scripts-x86-64
Replaces: xcat-genesis-scripts,xcat-genesis-scripts-x86-64
Description: xCAT genesis
(Genesis Enhanced Netboot Environment for System Information and Servicing) is a small, embedded-like environment for xCAT's use in discovery and management actions when interaction with an OS is infeasible. This package reperesents the EPL content that is more tightly bound to specific xcat-core versions
+1 -13
View File
@@ -99,21 +99,9 @@ touch /etc/xcat/genesis-scripts-updated
%{rpminstallroot}/bin/update_flash
%{rpminstallroot}/bin/update_flash_nv
%{rpminstallroot}/bin/restart
%{rpminstallroot}/debian/changelog
%{rpminstallroot}/debian/compat
%{rpminstallroot}/debian/control-amd64
%{rpminstallroot}/debian/control-ppc64el
%{rpminstallroot}/debian/copyright
#%{rpminstallroot}/debian/dirs
%{rpminstallroot}/debian/docs
#%{rpminstallroot}/debian/install
%{rpminstallroot}/debian/postinst
%{rpminstallroot}/debian/postrm
%{rpminstallroot}/debian/preinst
%{rpminstallroot}/debian/prerm
%{rpminstallroot}/debian/rules
%{rpminstallroot}/etc/init.d/functions
%{rpminstallroot}/etc/udev/rules.d/99-imm.rules
%{rpminstallroot}/etc/udev/rules.d/98-mlx.rules
%{rpminstallroot}/sbin/setupimmnic
%{rpminstallroot}/sbin/loadmlxeth
%exclude %{rpminstallroot}/debian/*
+86 -6
View File
@@ -5,6 +5,7 @@ package probe_utils;
use strict;
use File::Path;
use File::Copy;
use Time::Local;
use Socket;
#-----------------------------------------
@@ -50,6 +51,8 @@ sub send_msg {
if ($output eq "stdout") {
print "$flag$msg\n";
} elsif($output) {
syswrite $output, "$flag$msg\n";
} else {
if (!open(LOGFILE, ">> $output")) {
return 1;
@@ -324,20 +327,21 @@ sub is_tftp_ready {
sub is_dns_ready {
my $mnip = shift;
$mnip = shift if (($mnip) && ($mnip =~ /probe_utils/));
my $serverip = shift;
my $hostname = shift;
my $domain = shift;
my $output = `nslookup $mnip $mnip 2>&1`;
my $output = `nslookup $mnip $serverip 2>&1`;
if ($?) {
return 0;
} else {
chomp($output);
my $tmp = `echo "$output" |grep "Server:[\t\s]*$mnip" >/dev/null 2>&1`;
print "$tmp";
return 0 if ($?);
$tmp = `echo "$output"|grep "name ="|grep "$hostname\.$domain" >/dev/null 2>&1`;
return 0 if ($?);
my $tmp = grep {$_ =~ "Server:[\t\s]*$serverip"} split(/\n/, $output);
return 0 if ($tmp == 0);
$tmp = grep {$_ =~ "name = $hostname\.$domain"} split(/\n/, $output);
return 0 if ($tmp == 0);
return 1;
}
}
@@ -436,4 +440,80 @@ sub get_hostname_from_ip {
return $hostname;
}
#------------------------------------------
=head3
Description:
Check if the free space of specific directory is more than expected value
Arguments:
targetdir: The directory needed to be checked
expect_free_space: the expected free space for above directory
Returns:
0: the free space of specific directory is less than expected value
1: the free space of specific directory is more than expected value
2: the specific directory isn't mounted on standalone disk. it is a part of "/"
=cut
#------------------------------------------
sub is_dir_has_enough_space{
my $targetdir=shift;
$targetdir = shift if (($targetdir) && ($targetdir =~ /probe_utils/));
my $expect_free_space = shift;
my @output = `df -k`;
foreach my $line (@output){
chomp($line);
my @line_array = split(/\s+/, $line);
if($line_array[5] =~ /^$targetdir$/){
my $left_space = $line_array[3]/1048576;
if($left_space >= $expect_free_space){
return 1;
}else{
return 0;
}
}
}
return 2;
}
#------------------------------------------
=head3
Description:
Convert input time format to the number of non-leap seconds since whatever time the system considers to be the epoch
the format of input time are two kinds
one like "Aug 15 02:43:31", another likes "15/Aug/2016:01:10:24"
Arguments:
timestr: the time format need to be converted
yday: the year of current time.
Returns:
the number of non-leap seconds since whatever time the system considers to be the epoch
=cut
#------------------------------------------
sub convert_to_epoch_seconds {
my $timestr=shift;
$timestr = shift if (($timestr) && ($timestr =~ /probe_utils/));
my $yday=shift;
my $ref_seconds=shift;
my $mday;
my $dday;
my $h;
my $m;
my $s;
my $epoch_seconds=-1;
my %monthsmap = ("Jan"=>0,"Feb"=>1,"Mar"=>2,"Apr"=>3,"May"=>4,"Jun"=>5,"Jul"=>6,"Aug"=>7,"Sep"=>8,"Oct"=>9,"Nov"=>10,"Dec"=>11);
if($timestr =~/(\w+)\s+(\d+)\s+(\d+):(\d+):(\d+)/){
($mday,$dday,$h,$m,$s)=($1,$2,$3,$4,$5);
$epoch_seconds = timelocal($s,$m,$h,$dday,$monthsmap{$mday},$yday);
if($epoch_seconds>$ref_seconds){
$yday-=1;
$epoch_seconds = timelocal($s,$m,$h,$dday,$monthsmap{$mday},$yday);
}
}elsif($timestr =~ /(\d+)\/(\w+)\/(\d+):(\d+):(\d+):(\d+)/){
$epoch_seconds = timelocal($6,$5,$4,$1,$monthsmap{$2},($3-1900));
}
return $epoch_seconds;
}
1;
-103
View File
@@ -1,103 +0,0 @@
#!/usr/bin/env perl
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
package xCAT::GlobalDef;
#--------------------------------------------------------------------------------
=head1 xCAT::GlobalDef
=head2 Package Description
This module contains all the global info for xCAT.
=cut
#--------------------------------------------------------------------------------
# valid values for nodelist.hwtype column
$::NODETYPE_LPAR = "lpar";
$::NODETYPE_BPA = "bpa";
$::NODETYPE_FSP = "fsp";
$::NODETYPE_HMC = "hmc";
$::NODETYPE_IVM = "ivm";
$::NODETYPE_FRAME = "frame";
$::NODETYPE_CEC = "cec";
$::NODETYPE_BLADE = "blade";
$::NODETYPE_CMM = "cmm";
# valid values for nodelist.nodetype column
$::NODETYPE_OSI = "osi";
$::NODETYPE_PPC = "ppc";
$::NODETYPE_ZVM = "zvm";
$::NODETYPE_MP = "mp";
#valid values for nodelist.updatestatus
$::STATUS_SYNCING = "syncing";
$::STATUS_OUT_OF_SYNC = "out-of-sync";
$::STATUS_SYNCED = "synced";
$::STATUS_FAILED = "failed";
# valid values for nodelist.status columns or other status
$::STATUS_ACTIVE = "alive";
$::STATUS_INACTIVE = "unreachable";
$::STATUS_INSTALLING = "installing";
$::STATUS_INSTALLED = "installed";
$::STATUS_BOOTING = "booting";
$::STATUS_NETBOOTING = "netbooting";
$::STATUS_BOOTED = "booted";
$::STATUS_POWERING_ON = "powering-on";
$::STATUS_POWERING_OFF = "powering-off";
$::STATUS_DISCOVERING = "discovering";
$::STATUS_CONFIGURING = "configuring";
$::STATUS_STANDING_BY = "standingby";
$::STATUS_SHELL = "shell";
$::STATUS_DEFINED = "defined";
$::STATUS_UNKNOWN = "unknown";
$::STATUS_FAILED = "failed";
$::STATUS_BMCREADY = "bmcready";
%::VALID_STATUS_VALUES = (
$::STATUS_ACTIVE => 1,
$::STATUS_INACTIVE => 1,
$::STATUS_INSTALLING => 1,
$::STATUS_INSTALLED => 1,
$::STATUS_BOOTING => 1,
$::STATUS_NETBOOTING => 1,
$::STATUS_BOOTED => 1,
$::STATUS_POWERING_ON => 1,
$::STATUS_POWERING_OFF => 1,
$::STATUS_DISCOVERING => 1,
$::STATUS_CONFIGURING => 1,
$::STATUS_STANDING_BY => 1,
$::STATUS_SHELL => 1,
$::STATUS_DEFINED => 1,
$::STATUS_UNKNOWN => 1,
$::STATUS_FAILED => 1,
$::STATUS_BMCREADY => 1,
$::STATUS_SYNCING => 1,
$::STATUS_OUT_OF_SYNC => 1,
$::STATUS_SYNCED => 1,
);
#defined->[discovering]->[configuring]->[standingby]->installing->[installed]->booting->alive, defined->[discovering]->[configuring]-[standingby]->netbooting->booted->alive, alive/unreachable->booting->alive, powering-off->unreachable, alive->unreachable
%::NEXT_NODESTAT_VAL = (
$::STATUS_DEFINED => { $::STATUS_DISCOVERING => 1, $::STATUS_INSTALLING => 1, $::STATUS_NETBOOTING => 1, $::STATUS_POWERING_OFF => 1, $::STATUS_POWERING_ON => 1, $::STATUS_BOOTING => 1, $::STATUS_CONFIGURING => 1 },
$::STATUS_DISCOVERING => { $::STATUS_INSTALLING => 1, $::STATUS_NETBOOTING => 1, $::STATUS_CONFIGURING => 1, $::STATUS_BOOTING => 1 },
$::STATUS_CONFIGURING => { $::STATUS_INSTALLING => 1, $::STATUS_NETBOOTING => 1, $::STATUS_STANDING_BY => 1 },
$::STATUS_INSTALLING => { $::STATUS_INSTALLED => 1, $::STATUS_BOOTING => 1 },
$::STATUS_INSTALLED => { $::STATUS_BOOTING => 1 },
$::STATUS_BOOTING => { $::STATUS_BOOTED => 1, $::STATUS_ACTIVE => 1, $::STATUS_INACTIVE => 1 },
$::STATUS_NETBOOTING => { $::STATUS_BOOTED => 1 },
$::STATUS_BOOTED => { $::STATUS_ACTIVE => 1, $::STATUS_INACTIVE => 1 },
$::STATUS_ACTIVE => { $::STATUS_INACTIVE => 1, $::STATUS_DISCOVERING => 1, $::STATUS_CONFIGURING => 1, $::STATUS_INSTALLING => 1, $::STATUS_NETBOOTING => 1, $::STATUS_POWERING_OFF => 1, $::STATUS_POWERING_ON => 1 },
$::STATUS_INACTIVE => { $::STATUS_ACTIVE => 1, $::STATUS_DISCOVERING => 1, $::STATUS_CONFIGURING => 1, $::STATUS_INSTALLING => 1, $::STATUS_NETBOOTING => 1, $::STATUS_POWERING_OFF => 1, $::STATUS_POWERING_ON => 1 },
$::STATUS_POWERING_OFF => { $::STATUS_INACTIVE => 1 },
$::STATUS_POWERING_ON => { $::STATUS_BOOTED => 1 }
);
1;
File diff suppressed because it is too large Load Diff
+16 -16
View File
@@ -26,10 +26,10 @@ Description:
This command can be used to detect the dhcp server in a network for a specific mac address.
Options:
-i interface: Required. The interface which facing the target network.
-m macaddress: The mac that will be used to detect dhcp server. Recommend to use the real mac of the node that will be netboot. If no specified, the mac of interface which specified by -i will be used.
-i interface: Required. The interface facing the target network.
-m macaddress: The mac that will be used to detect dhcp server. Use the real mac of the node that will be netboot. If not specified, the mac specified by -i will be used.
-d duration: The time to wait to detect the dhcp messages. The default value is 10s.
-V verbose: To print additional debug information.
-V verbose: Print additional debug information.
";
#---------------------------
@@ -59,7 +59,7 @@ if ($::HELP) {
}
if ($::TEST) {
probe_utils->send_msg("$output", "o", "$program_name can be used to detect the dhcp server in a network for a specific mac address. Before using this command, please install tcpdump command ahead. The operating system supported are redhat, sles, ubuntu and debian.");
probe_utils->send_msg("$output", "o", "$program_name can be used to detect the dhcp server in a network for a specific mac address. Before using this command, install 'tcpdump' command. The operating system supported are RedHat, SLES and Ubuntu.");
exit 0;
}
@@ -72,12 +72,12 @@ unless (-x "/usr/sbin/tcpdump") {
if ($::IF) {
$nic = $::IF;
} else {
probe_utils->send_msg("$output", "f", "Option '-i' needs to be assigned value for $program_name");
probe_utils->send_msg("$output", "f", "Option '-i' needs to be assigned a value for $program_name");
probe_utils->send_msg("$output", "d", "$::USAGE");
exit 1;
}
my $msg = "Find right IP/MAC to do dhcp discover";
my $msg = "Find correct IP/MAC to do dhcp discover";
my $IP = `ip addr show dev $nic | awk -F" " '/inet / {print \$2}' | head -n 1 |awk -F"/" '{print \$1}'`;
chomp($IP);
my $MAC;
@@ -88,7 +88,7 @@ if ($::MACADD) {
}
chomp($MAC);
probe_utils->send_msg("$output", "d", "Send out dhcp discover from: NIC = $nic, IP = $IP, MAC = $MAC") if ($::VERBOSE);
probe_utils->send_msg("$output", "d", "Send dhcp discover from: NIC = $nic, IP = $IP, MAC = $MAC") if ($::VERBOSE);
if (!$IP || !$MAC) {
probe_utils->send_msg("$output", "f", $msg);
@@ -104,11 +104,11 @@ if (-f "/etc/redhat-release") {
$os = "sles";
} elsif (-f "/etc/lsb-release") {
$os = "ubuntu";
} elsif (-f "/etc/debian_version") {
$os = "debian";
#} elsif (-f "/etc/debian_version") {
# $os = "debian";
} else {
probe_utils->send_msg("$output", "f", $msg);
probe_utils->send_msg("$output", "d", "Only support the redhat, sles, ubuntu and debian OS");
probe_utils->send_msg("$output", "d", "Only support the RedHat, SLES and Ubuntu.");
exit 1;
}
probe_utils->send_msg("$output", "d", "Current operating system is $os") if ($::VERBOSE);
@@ -118,7 +118,7 @@ if ($::DURATION) {
$duration = $::DURATION;
}
probe_utils->send_msg("$output", "d", "The duration of capturing DHCP package is $duration second") if ($::VERBOSE);
probe_utils->send_msg("$output", "d", "The duration of capturing DHCP package is $duration second(s)") if ($::VERBOSE);
# send out the package
$msg = "Build the socket to send out DHCP request";
@@ -204,7 +204,7 @@ while (<FILE>) {
if ($line =~ /^\d\d:\d\d:\d\d/) {
# A new packet was captured. Parse the last one.
probe_utils->send_msg("$output", "d", "The server I found: mac = $chaddr, clientip = $ciaddr, serverip = $siaddr, offer = $offer") if ($::VERBOSE);
probe_utils->send_msg("$output", "d", "The server found: mac = $chaddr, clientip = $ciaddr, serverip = $siaddr, offer = $offer") if ($::VERBOSE);
if ($os eq "sles") { $offer = 1; }
if ($chaddr =~ /$MAC/i && $offer && $ciaddr && $siaddr && $rsiaddr) {
$output{$rsiaddr}{'client'} = $ciaddr;
@@ -245,15 +245,15 @@ close(FILE);
my $sn = scalar(keys %output);
probe_utils->send_msg("$output", "i", "++++++++++++++++++++++++++++++++++");
probe_utils->send_msg("$output", "i", "There are $sn servers reply the dhcp discover.");
probe_utils->send_msg("$output", "i", "There are $sn servers replied to dhcp discover.");
foreach my $server (keys %output) {
probe_utils->send_msg("$output", "i", " Server:$server assign IP [$output{$server}{'client'}] to you. The next server is [$output{$server}{'nextsv'}]!");
probe_utils->send_msg("$output", "i", " Server:$server assign IP [$output{$server}{'client'}]. The next server is [$output{$server}{'nextsv'}]!");
}
probe_utils->send_msg("$output", "i", "++++++++++++++++++++++++++++++++++");
if (scalar(@snack)) {
probe_utils->send_msg("$output", "i", "===================================");
probe_utils->send_msg("$output", "i", "The dhcp servers which sending out NACK in present network:");
probe_utils->send_msg("$output", "i", "The dhcp servers sending out NACK in present network:");
foreach my $nack (@snack) {
probe_utils->send_msg("$output", "i", " $nack");
}
@@ -379,5 +379,5 @@ sub kill_child {
foreach my $cpid (@pidoftcpdump) {
kill 15, $cpid;
}
probe_utils->send_msg("$output", "d", "Kill process $pid which is used to capture the packet by tcpdump") if ($::VERBOSE);
probe_utils->send_msg("$output", "d", "Kill process $pid used to capture the packet by 'tcpdump'") if ($::VERBOSE);
}
+33 -33
View File
@@ -35,16 +35,16 @@ $::USAGE = "Usage:
$program_name [-V] [-m <discovery_type> -n <node_range>] [--noprecheck]
Description:
Do probe for discovery process, including pre-check for required configuration and realtime monitor of discovery process.
If all pre-check items pass, $program_name will go to monitor directly, otherwise $program_name exit for error.
In order to do realtime monitor, $program_name probe program must be run along with the node discovery procedure. Plese trigger this command before trigger node discovery procedure.
Probe the discovery process, including pre-check for required configuration and realtime monitor of discovery process.
If all pre-check items pass, $program_name will go to monitor directly, otherwise $program_name will exit.
In order to do realtime monitor, $program_name probe must be run along with the node discovery procedure. Trigger this command before triggering node discovery procedure.
Currently, this command does not support hierarchy.
Options:
-h : Get usage information of $program_name.
-V : Output more information for debug.
-m : The method of discovery, the valid values are $valid_discovery_type_str.
-n : The range of predefined node, must used with option -m.
-n : The range of predefined nodes, must be used with option -m.
--noprecheck : skip pre-checking discovery to validate correct configuration.
";
@@ -64,12 +64,12 @@ Options:
sub check_genesis_file {
my $arch = shift;
if (($arch ne "ppc64") and ($arch ne "x86_64")) {
probe_utils->send_msg("$output", "d", "Please input correct arch type") if ($verbose);
probe_utils->send_msg("$output", "d", "Specify correct arch type") if ($verbose);
return 1;
}
my $rst_f = 0;
probe_utils->send_msg("$output", "d", "Start to check genesis files for $arch...") if ($verbose);
probe_utils->send_msg("$output", "d", "Starting to check genesis files for $arch...") if ($verbose);
my $os = probe_utils->get_os();
my $genesis_base;
@@ -92,11 +92,11 @@ sub check_genesis_file {
$genesis_scripts = `rpm -qa | grep -i "xcat-genesis-scripts" | grep -i "$arch"`;
}
unless ($genesis_base and $genesis_scripts) {
probe_utils->send_msg("$output", "d", "xCAT-genesis for $arch did not be installed.") if ($verbose);
probe_utils->send_msg("$output", "d", "xCAT-genesis for $arch is not installed.") if ($verbose);
return 1;
}
probe_utils->send_msg("$output", "d", "xCAT-genesis for $arch installed, start to check files...") if ($verbose);
probe_utils->send_msg("$output", "d", "xCAT-genesis for $arch is installed, starting to check files...") if ($verbose);
my $tftpdir = `tabdump site | awk -F',' '/^"tftpdir",/ { gsub(/"/, "", \$2) ; print \$2 }'`;
chomp($tftpdir);
@@ -109,7 +109,7 @@ sub check_genesis_file {
if ($arch eq "ppc64") {
$genesis_folder = "$tftpdir/pxelinux.cfg/p";
unless (-d "$genesis_folder") {
probe_utils->send_msg("$output", "d", "There is no genesis file for $arch. Please run 'mknb ppc64' if you use ppc64/ppc64le machine.") if ($verbose);
probe_utils->send_msg("$output", "d", "There is no genesis file for $arch. Run 'mknb ppc64' if using ppc64/ppc64le machine.") if ($verbose);
return 1;
}
@@ -131,7 +131,7 @@ sub check_genesis_file {
$initrd_path = $initrd_info[1];
$wget_rst = system("wget -q --spider $initrd_path -T 0.5 -t 3");
if ($wget_rst) {
probe_utils->send_msg("$output", "d", "initrd cannot be downloaded from $initrd_path.") if ($verbose);
probe_utils->send_msg("$output", "d", "'initrd' cannot be downloaded from $initrd_path.") if ($verbose);
$rst_f = 1;
} else {
probe_utils->send_msg("$output", "d", "Check initrd file: $initrd_path PASS.") if ($verbose);
@@ -154,7 +154,7 @@ sub check_genesis_file {
} else {
$genesis_folder = "$tftpdir/xcat/xnba/nets";
unless (-d "$genesis_folder") {
probe_utils->send_msg("$output", "d", "There is no genesis file for $arch. Please run 'mknb x86_64' if you use x86_64 machine.") if ($verbose);
probe_utils->send_msg("$output", "d", "There is no genesis file for $arch. Run 'mknb x86_64' if using x86_64 machine.") if ($verbose);
return 1;
}
@@ -185,13 +185,13 @@ sub check_genesis_file {
}
unless ($host_ip) {
probe_utils->send_msg("$output", "d", "There is no ip for range $ip_range") if ($verbose);
probe_utils->send_msg("$output", "d", "There is no IP for range $ip_range") if ($verbose);
$rst_f = 1;
next;
}
unless (open(FILE, $_)) {
probe_utils->send_msg("$output", "d", "Can not open file $_.");
probe_utils->send_msg("$output", "d", "Cannot open file $_.");
$rst_f = 1;
next;
}
@@ -204,7 +204,7 @@ sub check_genesis_file {
my @file_path = split(' ', $genesis_line);
my $elilo_efi = $file_path[1];
my $elilo_path = $file_path[3];
$elilo_efi =~ s/\${next-server}/$host_ip/i;
$elilo_efi =~ s/\$\{next-server\}/$host_ip/i;
$wget_rst = system("wget -q --spider $elilo_efi -T 0.5 -t 3");
if ($wget_rst) {
@@ -222,7 +222,7 @@ sub check_genesis_file {
} else {
probe_utils->send_msg("$output", "d", "Check elilo file: $elilo_http PASS.") if ($verbose);
unless (open(FILE_ELILO, $elilo_path)) {
probe_utils->send_msg("$output", "d", "Can not open file $_.") if ($verbose);
probe_utils->send_msg("$output", "d", "Cannot open file $_.") if ($verbose);
$rst_f = 1;
next;
}
@@ -250,7 +250,7 @@ sub check_genesis_file {
$wget_rst = system("wget -q --spider $initrd_http -T 0.5 -t 3");
if ($wget_rst) {
probe_utils->send_msg("$output", "d", "initrd cannot be downloaded from $initrd_http.") if ($verbose);
probe_utils->send_msg("$output", "d", "'initrd' cannot be downloaded from $initrd_http.") if ($verbose);
$rst_f = 1;
} else {
probe_utils->send_msg("$output", "d", "Check initrd file: $initrd_http PASS.") if ($verbose);
@@ -286,7 +286,7 @@ sub get_node_ip {
foreach my $node (keys %nodeip) {
$ip_net = xCAT::NetworkUtils->getipaddr($node);
if ($nodeip{$node} and ($nodeip{$node} ne $ip_net)) {
probe_utils->send_msg("$output", "d", "IP $nodeip{$node} of definition for $node is not correct") if ($verbose);
probe_utils->send_msg("$output", "d", "IP $nodeip{$node} definition for $node is not correct") if ($verbose);
}
$nodeip{$node} = $ip_net;
}
@@ -424,7 +424,7 @@ sub dhcp_dynamic_range_check {
}
}
} else {
probe_utils->send_msg("$output", "d", "Dynamic range for net $net did not be configured.") if ($verbose);
probe_utils->send_msg("$output", "d", "Dynamic range for net $net is not configured.") if ($verbose);
$rst = 1;
next;
}
@@ -631,7 +631,7 @@ sub handle_compute_msg {
my $node = `lsdef -i mac -c 2>&1 | awk -F: '/$ipmacmap{$ip}/ {print \$1}'`;
chomp($node);
$monitor_nodes{$node} = 1 if (defined($monitor_nodes{$node}));
probe_utils->send_msg("$output", "o", "Node $node has finished it's discovery process");
probe_utils->send_msg("$output", "o", "Node $node has finished its discovery process");
my $output = `lsdef $node 2>&1`;
print "-------------------\n$output-------------------\n";
}
@@ -757,7 +757,7 @@ sub check_pre_defined_node {
if (!exists($nodecheckrst{$node}{error})) {
if ($discovery_type eq "mtms") {
if (!(exists($nodecheckrst{$node}{"mtm"}) && exists($nodecheckrst{$node}{"serial"}))) {
$nodecheckrst{$node}{"error"} = "node definition is wrong for '$discovery_type' type discovery";
$nodecheckrst{$node}{"error"} = "Node definition is wrong for '$discovery_type' type discovery";
$rst = 1;
}
} elsif ($discovery_type eq "switch") {
@@ -770,23 +770,23 @@ sub check_pre_defined_node {
my $tmpoutput = `lsdef $nodecheckrst{$node}{"switch"} 2>&1`;
if ($?) {
$nodecheckrst{$node}{"error"} = "Miss definition for related switch $nodeswitch";
$nodecheckrst{$node}{"error"} = "Missing definition for related switch $nodeswitch";
$rst = 1;
last;
}
if ($tmpoutput !~ /snmpversion=/) {
$nodecheckrst{$node}{"error"} = "Miss attribute 'snmpversion' definition for related switch $nodeswitch";
$nodecheckrst{$node}{"error"} = "Missing attribute 'snmpversion' definition for related switch $nodeswitch";
$rst = 1;
last;
}
if ($tmpoutput !~ /username=/) {
$nodecheckrst{$node}{"error"} = "Miss attribute 'username' definition for related switch $nodeswitch";
$nodecheckrst{$node}{"error"} = "Missing attribute 'username' definition for related switch $nodeswitch";
$rst = 1;
last;
}
if ($tmpoutput !~ /password=/) {
$nodecheckrst{$node}{"error"} = "Miss attribute 'password' definition for related switch $nodeswitch";
$nodecheckrst{$node}{"error"} = "Missing attribute 'password' definition for related switch $nodeswitch";
$rst = 1;
last;
}
@@ -852,7 +852,7 @@ sub do_pre_check {
exit 1;
}
$msg = "The input network interfaces $nics exist and are configured well on current server";
$msg = "The input network interfaces $nics exist and are configured correctly on current server";
my $miss = 0;
my @nic_array = split(",", $nics);
foreach my $nic (@nic_array) {
@@ -884,13 +884,13 @@ sub do_pre_check {
my $masteripinsite = `tabdump site | awk -F',' '/^"master",/ { gsub(/"/, "", \$2) ; print \$2 }'`;
chomp($masteripinsite);
if ($masteripinsite eq "") {
probe_utils->send_msg("$output", "d", "There isn't 'master' definition in 'site' talbe") if ($verbose);
probe_utils->send_msg("$output", "d", "There isn't 'master' definition in 'site' table") if ($verbose);
probe_utils->send_msg("$output", "f", $msg);
exit 1;
}
if (!xCAT::NetworkUtils->isIpaddr("$masteripinsite")) {
probe_utils->send_msg("$output", "d", "The value of 'master' in 'site' table isn't a IP address") if ($verbose);
probe_utils->send_msg("$output", "d", "The value of 'master' in 'site' table isn't an IP address") if ($verbose);
probe_utils->send_msg("$output", "f", $msg);
exit 1;
}
@@ -921,7 +921,7 @@ sub do_pre_check {
probe_utils->send_msg("$output", "o", $msg);
if (check_genesis_file("x86_64")) {
probe_utils->send_msg("$output", "w", "Genesis files for x86 are not available");
probe_utils->send_msg("$output", "i", "If don't plan to manage a x86 server, please ignore above warning");
probe_utils->send_msg("$output", "i", "Ignore above warning if not planning on managing x86 server");
} else {
probe_utils->send_msg("$output", "o", "Genesis files for x86 are available");
}
@@ -934,7 +934,7 @@ sub do_pre_check {
probe_utils->send_msg("$output", "o", $msg);
if (check_genesis_file("ppc64")) {
probe_utils->send_msg("$output", "w", "Genesis files for ppc64/ppc64le are not available");
probe_utils->send_msg("$output", "i", "If don't plan to manage a ppc64/ppc64le server, please ignore above warning");
probe_utils->send_msg("$output", "i", "ignore above warning if not planning on managing ppc64/ppc64le server");
} else {
probe_utils->send_msg("$output", "o", "Genesis files for ppc64/ppc64le are available");
}
@@ -978,7 +978,7 @@ sub do_monitor {
$nics = `ip addr |grep -B2 $masteripinsite|awk -F" " '/mtu/{gsub(/:/,"",\$2); print \$2}'`;
chomp($nics);
if (!$nics) {
probe_utils->send_msg("$output", "f", "The value of master in site table is $masteripinsite, can't get corresponding network interface");
probe_utils->send_msg("$output", "f", "The value of 'master' in 'site' table is $masteripinsite, can't get corresponding network interface");
return 1;
}
}
@@ -993,7 +993,7 @@ sub do_monitor {
/_/\\_\\\\____/_/ \\_\\_| .+|______|__.-||__)`-'(((/ (((/
-------------------------------------------------------------
";
print "$startline\nStart to capture every message during discovery process......\n";
print "$startline\nStart capturing every message during discovery process......\n";
my $varlogmsg = "/var/log/messages";
my $clusterlog = "/var/log/xcat/cluster.log";
@@ -1088,7 +1088,7 @@ sub do_monitor {
if ($terminal) {
probe_utils->send_msg("$output", "d", "Got <Ctrl+c> from STDIN");
} else {
probe_utils->send_msg("$output", "o", "All nodes need to monitor have finished discovery process");
probe_utils->send_msg("$output", "o", "All nodes specified to monitor have finished discovery process");
}
last;
}
@@ -1136,7 +1136,7 @@ if ($help) {
}
if ($test) {
probe_utils->send_msg("$output", "o", "Do probe for discovery process, including pre-check for required configuration and realtime monitor of discovery process.Before using this command, please install nslookup command ahead. Currently, this command does not support hierarchy.");
probe_utils->send_msg("$output", "o", "Probe the discovery process, including pre-check for required configuration and realtime monitor of discovery process. Before using this command, please install 'nslookup' command. Currently, this command does not support hierarchy.");
exit 0;
}
+12
View File
@@ -214,9 +214,21 @@ probe_utils->send_msg("$output", "d", "---- Gathering information from all diskl
my $pingable_hostname_list = join ",", @pingable_nodes;
my $all_xdsh_output = `xdsh $pingable_hostname_list "cat /opt/xcat/xcatinfo"`;
my $xcatinfo_image_UUID = ` echo "$all_xdsh_output" | awk -F"=" '/IMAGEUUID/ {gsub(/IMAGEUUID/,"",\$1); gsub(/'"'"'/,"",\$2);; print \$1 \$2}'`;
# Check to verify xdsh worked and returned some usefull information
if (length($xcatinfo_image_UUID) <= 1) {
probe_utils->send_msg("$output", "w", "Unable to extract image UUID information from compute nodes using xdsh command. No image consistency verification will be performed.");
exit 1;
}
my @xdsh_UUID_lines = split("[\n\r]", $xcatinfo_image_UUID);
my $xcatinfo_image_name = ` echo "$all_xdsh_output" | awk -F"=" '/IMAGENAME/ {gsub(/IMAGENAME/,"",\$1); gsub(/'"'"'/,"",\$2); print \$1 \$2}'`;
# Check to verify xdsh worked and returned some usefull information
if (length($xcatinfo_image_name) <= 1) {
probe_utils->send_msg("$output", "w", "Unable to extract image name information from compute nodes using xdsh command. No image consistency verification will be performed.");
exit 1;
}
my @xdsh_name_lines = split("[\n\r]", $xcatinfo_image_name);
my %node_running_image_uuid_hash;
+585 -160
View File
@@ -9,35 +9,157 @@ use probe_utils;
use xCAT::NetworkUtils;
use File::Basename;
use IO::Select;
use Time::Local;
use Data::Dumper;
use Getopt::Long qw(:config no_ignore_case);
my $program_name = basename("$0");
my $help;
my $test;
my $output = "stdout";
my $verbose = 0;
my $rst = 0;
my $maxwaittime = 60; #unit is minute
my $output = "stdout";
my $verbose = 0;
my $rst = 0;
my $noderange;
my %rawdata;
my %ipnodemap;
my %macmap;
my $terminal = 0;
my $installnic;
my $monitor = 0;
my $replaylog; ##used by feature replay deploymen log
my %rawdata;
#-%rawdata structure-------
# $rawdata{nodename}{"history"} #array, the log history of current node
# $rawdata{nodename}{"state"} #the latest status of current node, used for State Machine
# $rawdata{nodename}{"statehistory"} #array, the history status of current node, used for State Machine
#--------------------------
my %macmap;
#-%macmap structure-------
# $macmap{mac_addr}{"ip"}="x.x.x.x"
# $macmap{mac_addr}{"node"}="nodename"
#-------------------------
my %ipnodemap;
#-%ipnodemap structure-------
# $ipnodemap{ip_addr}="nodename"
#---------------------------
my %monitor_nodes;
#- %monitor_nodes structure-------
# $monitor_nodes{nodename}{"status"} #useless now
# $monitor_nodes{nodename}{"rst"}
#---------------------------------
# provision state machine
my %state_set = (
"unknown" => 0,
"server_reboot" => 1,
"loaded_kernel_and_initrd" => 2,
"kernel_and_initrd_got_ip" => 3,
"install_os_packages" => 4,
"run_postscript" => 5,
"run_postbootscript" => 6,
"done" => 7,
);
my %state_set_reverse = (
"0" => "unknown",
"1" => "server_reboot",
"2" => "loaded_kernel_and_initrd",
"3" => "kernel_and_initrd_got_ip",
"4" => "install_os_packages",
"5" => "run_postscript",
"6" => "run_postbootscript",
"7" => "done",
);
my %valid_process;
$valid_process{1}{process} = [ $state_set{unknown}, $state_set{done} ];
$valid_process{1}{type} = "reboot";
$valid_process{2}{process} = [ $state_set{unknown}, $state_set{server_reboot}, $state_set{done} ];
$valid_process{2}{type} = "reboot";
$valid_process{3}{process} = [ $state_set{unknown}, $state_set{server_reboot}, $state_set{run_postbootscript}, $state_set{done} ];
$valid_process{3}{type} = "reboot";
$valid_process{4}{process} = [ $state_set{unknown}, $state_set{server_reboot}, $state_set{loaded_kernel_and_initrd}, $state_set{kernel_and_initrd_got_ip}, $state_set{install_os_packages}, $state_set{run_postscript}, $state_set{server_reboot}, $state_set{run_postbootscript}, $state_set{done} ];
$valid_process{4}{type} = "deploy";
$valid_process{5}{process} = [ $state_set{unknown}, $state_set{loaded_kernel_and_initrd}, $state_set{kernel_and_initrd_got_ip}, $state_set{install_os_packages}, $state_set{run_postscript}, $state_set{server_reboot}, $state_set{run_postbootscript}, $state_set{done} ];
$valid_process{5}{type} = "deploy";
sub reset_state {
my $state_ref = shift;
my $condition = shift;
my $reset_flag = 1;
if ($$state_ref == $state_set{unknown} && $condition eq "dhcp") {
$$state_ref = $state_set{server_reboot};
} elsif ($$state_ref == $state_set{unknown} && $condition eq "booted") {
$$state_ref = $state_set{done};
} elsif (($$state_ref == $state_set{unknown} && $condition eq "tftp") || ($$state_ref == $state_set{unknown} && $condition eq "http")) {
$$state_ref = $state_set{loaded_kernel_and_initrd};
} elsif ($$state_ref == $state_set{server_reboot} && $condition eq "booted") {
$$state_ref = $state_set{done};
} elsif ($$state_ref == $state_set{server_reboot} && $condition eq "postscript") {
$$state_ref = $state_set{run_postbootscript};
} elsif (($$state_ref == $state_set{server_reboot} && $condition eq "tftp") || ($$state_ref == $state_set{server_reboot} && $condition eq "http")) {
$$state_ref = $state_set{loaded_kernel_and_initrd};
} elsif ($$state_ref == $state_set{loaded_kernel_and_initrd} && $condition eq "dhcp") {
$$state_ref = $state_set{kernel_and_initrd_got_ip};
} elsif ($$state_ref == $state_set{kernel_and_initrd_got_ip} && $condition eq "http") {
$$state_ref = $state_set{install_os_packages};
} elsif ($$state_ref == $state_set{install_os_packages} && $condition eq "postscript") {
$$state_ref = $state_set{run_postscript};
} elsif ($$state_ref == $state_set{run_postscript} && $condition eq "dhcp") {
$$state_ref = $state_set{server_reboot};
} elsif ($$state_ref == $state_set{run_postbootscript} && $condition eq "booted") {
$$state_ref = $state_set{done};
} elsif ($$state_ref == $state_set{done} && $condition eq "dhcp") {
$$state_ref = $state_set{server_reboot};
} elsif ($$state_ref == $state_set{done} && $condition eq "poweron") {
$$state_ref = $state_set{server_reboot};
} else {
$reset_flag = 0;
}
return $reset_flag;
}
my @candidate_svr_hostname_inlog;
my $svr_hostname_short = `hostname -s`;
chomp($svr_hostname_short);
my $svr_hostname_domain = `hostname -d`;
chomp($svr_hostname_domain);
push(@candidate_svr_hostname_inlog, $svr_hostname_short);
push(@candidate_svr_hostname_inlog, "$svr_hostname_short.$svr_hostname_domain");
$::USAGE = "Usage:
$program_name -h
$program_name -T
$program_name -n <node_range> [-V]
$program_name -n <node_range> -r <xxhxxm> [-V]
Description:
Do probe for os provision process, realtime monitor of os provision process.
Please run this before rpower node.
Probe for OS provision process. Realtime monitor or replay history of OS provision process.
If realtime monitor, run this before 'rpower' node.
Currently, hierarchial structure is not supported.
Options:
-h : Get usage information of $program_name
-T : To verify if $program_name can work, reserve option for probe framework
-T : Verify if $program_name can work, reserved option for probe framework
-V : Output more information for debug
-n : The range of monitored node.
-n : The range of nodes for monitor or replay log.
-t : The maximum time in minutes to wait when doing monitor, default is 60.
-r : Replay history log for probe provisioniong. Input a start time when probe should begin.
Supported time formats are xxhxxm, xxh, or xxm. If units not specified, hour will be used by default.
";
#------------------------------------------
@@ -54,58 +176,74 @@ Options:
#------------------------------------------
sub check_noderange {
my $node_range = shift;
my @cmdoutput = `lsdef $node_range -i ip,mac 2>&1`;
my $rst = 0;
my $currentnode = "";
my $ip = "NOIP";
my $node_range = shift;
my @cmdoutput = `lsdef $node_range -i ip,mac -c 2>&1`;
my $rst = 0;
my %nodecheckrst;
my $mac_line;
my @macs;
foreach (@cmdoutput) {
chomp($_);
$_ =~ s/^\s+|\s+$//g;
if ($_ =~ /^Error: Could not find an object named '(\w+)' .+/i) {
$currentnode = $1;
$nodecheckrst{$currentnode}{"error"} = "Could not find node definition";
$rst = 1;
} elsif ($_ =~ /^\s*Object name: (\w+)/i) {
# 'rst' is used to check whether the node process finished, 1 is finished.
$monitor_nodes{$1}{"rst"} = 0;
$currentnode = $1;
$ip = "NOIP";
} elsif ($_ =~ /^ip=(.+)/i) {
if ($1) {
$ip = $1;
$nodecheckrst{$1}{"error"} = "Could not find node definition";
} elsif ($_ =~ /(\S+):\s+mac=(.*)/i) {
my $node = $1;
my $mac = $2;
if ($mac) {
$nodecheckrst{$node}{"mac"} = $mac;
} else {
$nodecheckrst{$node}{"error"} = "Node $1 doesn't have MAC address";
}
} elsif ($_ =~ /^mac=(.+)/i) {
next unless ($1);
$mac_line = $1;
@macs = split(/\|/, $mac_line);
foreach my $mac (@macs) {
if ($mac =~ /\!\*NOIP\*/) {
$mac =~ s/\!\*NOIP\*//g;
$macmap{$mac}{"ip"} = "NOIP";
$macmap{$mac}{"node"} = $currentnode;
}
else {
$macmap{$mac}{"ip"} = $ip;
$macmap{$mac}{"node"} = $currentnode;
}
} elsif ($_ =~ /(\S+):\s+ip=(.*)/i) {
my $node = $1;
my $ip = $2;
if ($ip) {
$nodecheckrst{$node}{"ip"} = $ip;
}
}
}
foreach my $node (keys %nodecheckrst) {
probe_utils->send_msg("$output", "d", "$node : $nodecheckrst{$node}{error}") if (exists($nodecheckrst{$node}{error}));
if (exists($nodecheckrst{$node}{error})) {
probe_utils->send_msg("$output", "d", "$node : $nodecheckrst{$node}{error}");
$rst = 1;
next;
}
my $noerror=1;
my @macs = split(/\|/, $nodecheckrst{$node}{"mac"});
foreach my $mac (@macs) {
#[NOTE] don't support 2 adapters in the same network now. TODO
if ($mac =~ /\!\*NOIP\*/) {
$mac =~ s/\!\*NOIP\*//g;
$macmap{$mac}{"ip"} = "NOIP";
$macmap{$mac}{"node"} = $node;
} else {
$macmap{$mac}{"node"} = $node;
if($nodecheckrst{$node}{"ip"}){
$macmap{$mac}{"ip"} = $nodecheckrst{$node}{"ip"};
}else{
my $nodeip = xCAT::NetworkUtils->getipaddr($node);
if($nodeip){
$macmap{$mac}{"ip"} = $nodeip;
}else{
$noerror = 0;
$rst = 1;
probe_utils->send_msg("$output", "f", "$node : can't be resolved to an IP address");
}
}
}
}
$monitor_nodes{$node}{"rst"} = 0 if($noerror);
}
unless (%monitor_nodes) {
probe_utils->send_msg("$output", "d", "There is no node to be monitored");
probe_utils->send_msg("$output", "d", "There is no valid node to handle");
$rst = 1;
}
return $rst;
}
@@ -116,7 +254,7 @@ sub check_noderange {
Handle one line log come from dhcp log file
Arguments:
msg: one line http log
nics: target network interfaces
installnic: target network interfaces
Returns:
0 : pass
1 : failed
@@ -132,8 +270,8 @@ sub handle_dhcp_msg {
if (exists $macmap{$mac}) {
my $node = $macmap{$mac}{"node"};
my $record = "Receive DHCPDISCOVER from [$node] $mac via $nic";
probe_utils->send_msg("$output", "d", "$record");
my $record = "Receive DHCPDISCOVER via $nic";
probe_utils->send_msg("$output", "d", "[$node] $record") if ($monitor);
push(@{ $rawdata{$node}{"history"} }, $record);
}
} elsif ($msg =~ /.+DHCPOFFER\s+on\s+(.+)\s+to\s+(.+)\s+via\s+(.+)/i) {
@@ -143,8 +281,8 @@ sub handle_dhcp_msg {
if (exists $macmap{$mac}) {
my $node = $macmap{$mac}{"node"};
my $record = "Send DHCPOFFER on $ip back to [$node] $mac via $nic";
probe_utils->send_msg("$output", "d", "$record");
my $record = "Send DHCPOFFER on $ip back to $mac via $nic";
probe_utils->send_msg("$output", "d", "[$node] $record") if ($monitor);
push(@{ $rawdata{$node}{"history"} }, $record);
}
@@ -155,16 +293,10 @@ sub handle_dhcp_msg {
my $nic = $4;
if (exists $macmap{$mac}) {
my $node = $macmap{$mac}{"node"};
my $record = "Receive DHCPREQUEST from [$node] $mac for $ip via $nic";
probe_utils->send_msg("$output", "d", "$record");
my $node = $macmap{$mac}{"node"};
my $record = "Receive DHCPREQUEST from $mac for $ip via $nic";
probe_utils->send_msg("$output", "d", "[$node] $record") if ($monitor);
push(@{ $rawdata{$node}{"history"} }, $record);
if ($macmap{$mac}{"ip"} != "NOIP" and $macmap{$mac}{"ip"} != $ip) {
my $warn_msg = "The ip of [$node] $mac from DHCP $ip is different with definition $macmap{$mac}{'ip'}.";
probe_utils->send_msg("$output", "w", "$warn_msg");
push(@{ $rawdata{$node}{"history"} }, $warn_msg);
}
}
} elsif ($msg =~ /.+DHCPACK\s+on\s+(.+)\s+to\s+(.+)\s+via\s+(.+)/) {
my $ip = $1;
@@ -173,19 +305,25 @@ sub handle_dhcp_msg {
if (exists $macmap{$mac}) {
my $node = $macmap{$mac}{"node"};
my $record = "Send DHCPACK on $ip back to [$node] $mac via $nic";
probe_utils->send_msg("$output", "d", "$record");
my $record = "Send DHCPACK on $ip back to $mac via $nic";
probe_utils->send_msg("$output", "d", "[$node] $record") if ($monitor);
push(@{ $rawdata{$node}{"history"} }, $record);
$ipnodemap{$ip} = $node;
push(@{ $rawdata{$node}{statehistory} }, $rawdata{$node}{state}) if (reset_state(\$rawdata{$node}{state}, "dhcp"));
if ($macmap{$mac}{"ip"} != "NOIP" and $macmap{$mac}{"ip"} != $ip) {
my $warn_msg = "The ip($ip) assigned to $mac via DHCP is different from the ip($macmap{$mac}{'ip'}) in node definition.";
probe_utils->send_msg("$output", "w", "$warn_msg") if ($monitor);
push(@{ $rawdata{$node}{"history"} }, $warn_msg);
}
}
} elsif ($msg =~ /.+BOOTREQUEST\s+from\s+(.+)\s+via\s+([^:]+)(.*)/) {
my $mac = $1;
my $nic = $2;
if (exists $macmap{$mac}) {
my $node = $macmap{$mac}{"node"};
my $record = "Receive BOOTREQUEST from [$node] $mac via $nic";
probe_utils->send_msg("$output", "d", "$record");
my $record = "Receive BOOTREQUEST from $mac via $nic";
probe_utils->send_msg("$output", "d", "[$node] $record") if ($monitor);
push(@{ $rawdata{$node}{"history"} }, $record);
}
} elsif ($msg =~ /.+BOOTREPLY\s+for\s+(.+)\s+to\s+.+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w).+via\s+(.+)/) {
@@ -195,14 +333,15 @@ sub handle_dhcp_msg {
if (exists $macmap{$mac}) {
my $node = $macmap{$mac}{"node"};
my $record = "Send BOOTREPLY on $ip back to [$node] $mac via $nic";
probe_utils->send_msg("$output", "d", "$record");
my $record = "Send BOOTREPLY on $ip back to $mac via $nic";
probe_utils->send_msg("$output", "d", "[$node] $record") if ($monitor);
push(@{ $rawdata{$node}{"history"} }, $record);
$ipnodemap{$ip} = $node;
push(@{ $rawdata{$node}{statehistory} }, $rawdata{$node}{state}) if (reset_state(\$rawdata{$node}{state}, "dhcp"));
if ($macmap{$mac}{"ip"} != "NOIP" and $macmap{$mac}{"ip"} != $ip) {
my $warn_msg = "The ip of [$node] $mac from DHCP $ip is different with definition $macmap{$mac}{'ip'}.";
probe_utils->send_msg("$output", "w", "$warn_msg");
my $warn_msg = "The ip($ip) assigned to $mac via DHCP is different from the ip($macmap{$mac}{'ip'}) in node definition.";
probe_utils->send_msg("$output", "w", "$warn_msg") if ($monitor);
push(@{ $rawdata{$node}{"history"} }, $warn_msg);
}
}
@@ -230,11 +369,11 @@ sub handle_tftp_msg {
if ($msg =~ /RRQ\s+from\s+(.+)\s+filename\s+(.+)/i) {
my $ip = $1;
my $file = $2;
my $record = "[$ipnodemap{$ip}] Via TFTP $ip download $file";
my $record = "Via TFTP download $file";
if (exists($rawdata{"$ipnodemap{$ip}"})) {
probe_utils->send_msg("$output", "d", "$record");
probe_utils->send_msg("$output", "d", "[$ipnodemap{$ip}] $record") if ($monitor);
push(@{ $rawdata{ $ipnodemap{$ip} }{"history"} }, $record);
push(@{ $rawdata{ $ipnodemap{$ip} }{statehistory} }, $rawdata{ $ipnodemap{$ip} }{state}) if (reset_state(\$rawdata{ $ipnodemap{$ip} }{state}, "tftp"));
}
}
}
@@ -257,11 +396,12 @@ sub handle_http_msg {
if ($msg =~ /(\d+\.\d+.\d+.\d+)\s.+GET\s+(.+)\s+HTTP.+/) {
my $ip = $1;
my $file = $2;
my $record = "[$ipnodemap{$ip}] Via HTTP $ip GET $file";
my $record = "Via HTTP get $file";
if (exists($rawdata{"$ipnodemap{$ip}"})) {
probe_utils->send_msg("$output", "d", "$record");
probe_utils->send_msg("$output", "d", "[$ipnodemap{$ip}] $record") if ($monitor);
push(@{ $rawdata{ $ipnodemap{$ip} }{"history"} }, $record);
push(@{ $rawdata{ $ipnodemap{$ip} }{statehistory} }, $rawdata{ $ipnodemap{$ip} }{state}) if (reset_state(\$rawdata{ $ipnodemap{$ip} }{state}, "http"));
}
}
return 0;
@@ -286,37 +426,29 @@ sub handle_cluster_msg {
my $msg;
my $status;
if ($line =~ /.+\s+xcat:\s+(.+)\s+status:\s+(.+)\s+statustime:\s(.+)/) {
$node = $1;
$status = $2;
my @splitline = split(/\s+/, $line);
if (($splitline[4] =~ /^xcat/i) || ($splitline[5] =~ /^xcat/i)) {
if (exists($rawdata{$node})) {
my $record = "Receive from $node : status is $status";
probe_utils->send_msg("$output", "d", "$record");
push(@{ $rawdata{$node}{"history"} }, $record);
}
#log like: Aug 7 22:30:31 c910f02c01p09 xcat: c910f02c04p04 status: booted statustime: 08-07-2016 22:30:31
if (($splitline[6] =~ /^status:$/i) && ($splitline[8] =~ /^statustime:$/)) {
$node = $splitline[5];
$status = $splitline[7];
if (exists($rawdata{$node})) {
my $record = "Node status is changed to $status";
probe_utils->send_msg("$output", "d", "[$node] $record") if ($monitor);
push(@{ $rawdata{$node}{"history"} }, $record);
# When receive 'status is booted', check whether the $monitor_nodes{$node}{"status"} is installing.
# If so, the node has finished its os provision.
if (exists($rawdata{$node}) and ($status eq "booted")) {
if ($monitor_nodes{$node}{"status"} eq "installing") {
$record = "Node $node has finished it's os provision process";
probe_utils->send_msg("$output", "o", "$record");
push(@{ $rawdata{$node}{"history"} }, $record);
} else {
$record = "NO installing process detected for node $node";
probe_utils->send_msg("$output", "f", "$record");
push(@{ $rawdata{$node}{"history"} }, $record);
#one node finish deployment
if ($status eq "booted") {
$monitor_nodes{$node}{"rst"} = 1 if (defined($monitor_nodes{$node}));
push(@{ $rawdata{$node}{statehistory} }, $rawdata{$node}{state}) if (reset_state(\$rawdata{$node}{state}, "booted"));
}
if ($status eq "powering-on") {
push(@{ $rawdata{$node}{statehistory} }, $rawdata{$node}{state}) if (reset_state(\$rawdata{$node}{state}, "poweron"));
}
}
$monitor_nodes{$node}{"rst"} = 1 if (defined($monitor_nodes{$node}));
} elsif (exists($rawdata{$node}) and ($status eq "failed")) {
$monitor_nodes{$node}{"rst"} = 1 if (defined($monitor_nodes{$node}));
probe_utils->send_msg("$output", "f", "Node $node has finished it's os provision process");
push(@{ $rawdata{$node}{"history"} }, "Node $node os provision failed");
} elsif (exists($rawdata{$node}) and ($status eq "installing")) {
# record 'installing' status, to check when receive 'booted' status
$monitor_nodes{$node}{"status"} = "installing";
}
}
return 0;
@@ -350,10 +482,15 @@ sub handle_compute_msg {
} else {
$node = $ipnodemap{$sender};
}
if ($node ne "" && exists($rawdata{$node})) {
my $record = "Receive from $node : $msg";
probe_utils->send_msg("$output", "d", "$record");
push(@{ $rawdata{$node}{"history"} }, $record);
probe_utils->send_msg("$output", "d", "[$node] $msg") if ($monitor);
push(@{ $rawdata{$node}{"history"} }, $msg);
#node start to run postscript or postbootscript
if ($msg =~ /Running postscript/) {
push(@{ $rawdata{$node}{statehistory} }, $rawdata{$node}{state}) if (reset_state(\$rawdata{$node}{state}, "postscript"));
}
}
}
@@ -407,30 +544,118 @@ sub dump_history {
print "$title\n";
foreach $node (keys %rawdata) {
my $line_num = 0;
my $http_num = 0;
my $length_http;
for (my $i = @{ $rawdata{$node}{"history"} } ; $i >= 0 ; $i--) {
if (${ $rawdata{$node}{"history"} }[$i] =~ /Via HTTP/) {
$length_http = $i;
last;
}
}
foreach my $line (@{ $rawdata{$node}{"history"} }) {
# Print http message less than 10 lines
if ($line =~ /Via HTTP/)
{
if (($http_num <= 4) or ($length_http - $line_num <= 4)) {
probe_utils->send_msg("$output", "d", "\t$line");
if ($verbose) {
print "[$node]\n";
my $httphit = 0;
my @httptmp;
foreach my $line (@{ $rawdata{$node}{"history"} }) {
if ($line =~ /Via HTTP/) {
if ($httphit) {
shift @httptmp if ($#httptmp > 0);
push @httptmp, $line;
} else {
print "\t$line\n";
$httphit = 1;
}
} else {
probe_utils->send_msg("$output", "d", "\t......") if ($http_num == 5);
if ($#httptmp > -1) {
print "\tVia HTTP ..........\n";
print "\t$_\n" foreach (@httptmp);
}
@httptmp = ();
$httphit = 0;
print "\t$line\n";
}
$http_num++;
} else {
probe_utils->send_msg("$output", "d", "\t$line");
}
$line_num++;
my $statelist = "";
for (my $i = 0 ; $i < scalar(@{ $rawdata{$node}{statehistory} }) ; $i++) {
$statelist .= "$state_set_reverse{$rawdata{$node}{statehistory}[$i]} ";
}
probe_utils->send_msg("$output", "d", "[$node] state history: $statelist");
}
my @tmpnodestatehistory = @{ $rawdata{$node}{statehistory} };
#print "state history = @tmpnodestatehistory\n";
my %match_result;
my $procidx = 0;
my $newloop = 0;
my $notfirstloop = 0;
while (@tmpnodestatehistory) {
undef %match_result if ($notfirstloop);
$newloop = 0;
foreach my $type (keys %valid_process) {
if ($notfirstloop) {
$procidx = 1;
} else {
$procidx = 0;
}
my $proclen = scalar(@{ $valid_process{$type}{process} });
my $i;
for ($i = 0 ; $i < scalar(@tmpnodestatehistory) ; $i++) {
if ($procidx < $proclen) {
if ($tmpnodestatehistory[$i] == $valid_process{$type}{process}[$procidx]) {
++$procidx;
} else {
--$procidx if (notfirstloop);
push @{ $match_result{$procidx} }, $type;
last;
}
} else {
splice(@tmpnodestatehistory, 0, $i);
$newloop = 1;
$notfirstloop = 1;
last;
}
}
if ($i == scalar(@tmpnodestatehistory)) {
push @{ $match_result{$procidx} }, $type;
next;
}
last if ($newloop);
}
last if (!$newloop);
}
#print "------------result---------------\n";
#print Dumper %match_result;
my $max_match = 0;
foreach my $key (keys %match_result) {
$max_match = $key if ($key > $max_match);
}
my $formatprefix;
if ($max_match == 0) {
my $statelist = "";
for (my $i = 0 ; $i < scalar(@{ $rawdata{$node}{statehistory} }) ; $i++) {
$statelist .= "$state_set_reverse{$rawdata{$node}{statehistory}[$i]} ";
}
probe_utils->send_msg("$output", "f", "[$node] deployment failed");
probe_utils->send_msg("$output", "d", "\t$node did unknown process, state change history is $statelist");
} elsif (scalar(@{ $match_result{$max_match} }) > 1) {
probe_utils->send_msg("$output", "f", "[$node] deployment failed");
probe_utils->send_msg("$output", "d", "\tThere are more than one possible process satisfy $node situation");
foreach my $proc (@{ $match_result{$max_match} }) {
if ($valid_process{$proc}{type} eq "deploy") {
probe_utils->send_msg("$output", "d", "\tpossible process \"deploy\", pass $state_set_reverse{$valid_process{$proc}{process}[$max_match-1]} stage, something wrong during $state_set_reverse{$valid_process{$proc}{process}[$max_match]} stage");
} elsif ($valid_process{$proc}{type} eq "reboot") {
probe_utils->send_msg("$output", "d", "\tpossible process \"reboot\", pass $state_set_reverse{$valid_process{$proc}{process}[$max_match-1]} stage, something wrong during $state_set_reverse{$valid_process{$proc}{process}[$max_match]} stage");
}
}
} else {
if (($valid_process{ $match_result{$max_match}[0] }{type} eq "deploy") && ($valid_process{ $match_result{$max_match}[0] }{process}[ $max_match - 1 ] == $state_set{done})) {
probe_utils->send_msg("$output", "o", "[$node] deployment completed");
} elsif (($valid_process{ $match_result{$max_match}[0] }{type} eq "deploy") && ($valid_process{ $match_result{$max_match}[0] }{process}[ $max_match - 1 ] != $state_set{done})) {
probe_utils->send_msg("$output", "f", "[$node] deployment failed, pass $state_set_reverse{$valid_process{$match_result{$max_match}[0]}{process}[$max_match-1]} stage, something wrong during $state_set_reverse{$valid_process{$match_result{$max_match}[0]}{process}[$max_match]} stage")
} elsif (($valid_process{ $match_result{$max_match}[0] }{type} eq "reboot") && ($valid_process{ $match_result{$max_match}[0] }{process}[ $max_match - 1 ] == $state_set{done})) {
probe_utils->send_msg("$output", "f", "[$node] reboot completed, without deployment process");
} elsif (($valid_process{ $match_result{$max_match}[0] }{type} eq "reboot") && ($valid_process{ $match_result{$max_match}[0] }{process}[ $max_match - 1 ] != $state_set{done})) {
probe_utils->send_msg("$output", "f", "[$node] reboot failed, without deployment process, stop at $state_set_reverse{$valid_process{$match_result{$max_match}[0]}{process}[$max_match-1]} stage, something wrong during $state_set_reverse{$valid_process{$match_result{$max_match}[0]}{process}[$max_match]} stage");
}
}
}
}
@@ -451,33 +676,10 @@ sub do_monitor {
$terminal = 1;
};
my $msg = "All pre_defined nodes are valid";
my $rc = check_noderange($noderange);
if ($rc) {
probe_utils->send_msg("$output", "f", $msg);
$rst = 1;
unless (%monitor_nodes) {
return $rst;
}
} else {
probe_utils->send_msg("$output", "o", $msg);
}
if (!$nics) {
my $masteripinsite = `tabdump site | awk -F',' '/^"master",/ { gsub(/"/, "", \$2) ; print \$2 }'`;
chomp($masteripinsite);
$nics = `ip addr |grep -B2 $masteripinsite|awk -F" " '/mtu/{gsub(/:/,"",\$2); print \$2}'`;
chomp($nics);
if (!$nics) {
probe_utils->send_msg("$output", "f", "The value of master in site table is $masteripinsite, can't get corresponding network interface");
return 1;
}
}
my $rst = 0;
my $startline =
"-------------------------------------------------------------
Start to capture every message during os provision process......
Start capturing every message during OS provision process......
-------------------------------------------------------------
";
@@ -514,6 +716,7 @@ Start to capture every message during os provision process......
if (!-e "$clusterlog") {
probe_utils->send_msg("$output", "w", "$clusterlog doesn't exist");
probe_utils->send_msg("$output", "i", "If using SLES11 or xCAT2.11.x, ignore above warning");
} else {
if (!($clusterpid = open(CLUSTERLOGFILE, "tail -f -n 0 $clusterlog 2>&1 |"))) {
probe_utils->send_msg("$output", "f", "Can't open $clusterlog to get logs");
@@ -532,6 +735,7 @@ Start to capture every message during os provision process......
}
if (!-e "$computelog") {
probe_utils->send_msg("$output", "w", "$computelog doesn't exist");
probe_utils->send_msg("$output", "i", "If sles11 or xCAT2.11.x, ignore above warning");
} else {
if (!($computerpid = open(COMPUTERFILE, "tail -f -n 0 $computelog 2>&1 |"))) {
probe_utils->send_msg("$output", "f", "Can't open $computelog to get logs");
@@ -551,21 +755,15 @@ Start to capture every message during os provision process......
my @hdls;
my $hdl;
my @candidate_svr_hostname_inlog;
my $svr_hostname_short = `hostname -s`;
chomp($svr_hostname_short);
my $svr_hostname_domain = `hostname -d`;
chomp($svr_hostname_domain);
push(@candidate_svr_hostname_inlog, $svr_hostname_short);
push(@candidate_svr_hostname_inlog, "$svr_hostname_short.$svr_hostname_domain");
my $starttime = time();
$monitor = 1;
for (; ;) {
if (@hdls = $select->can_read(0)) {
foreach $hdl (@hdls) {
if ($hdl == \*VARLOGMSGFILE) {
chomp($line = <VARLOGMSGFILE>);
my @tmp = split(/\s+/, $line);
if ($tmp[4] =~ /dhcpd:/i && $line =~ /$nics/) {
if ($tmp[4] =~ /dhcpd/i && $line =~ /$installnic/) {
handle_dhcp_msg("$line");
} elsif ($tmp[4] =~ /in.tftpd/i) {
handle_tftp_msg("$line");
@@ -593,10 +791,16 @@ Start to capture every message during os provision process......
if ($terminal) {
probe_utils->send_msg("$output", "d", "Get INT or TERM signal from STDIN");
} else {
probe_utils->send_msg("$output", "o", "All nodes need to monitor have finished os provision process");
probe_utils->send_msg("$output", "o", "All nodes specified to monitor, have finished OS provision process");
}
last;
} sleep 0.01;
}
if (time() - $starttime > ($maxwaittime * 60)) {
probe_utils->send_msg("$output", "i", "$maxwaittime minutes have expired, stop monitoring");
last;
}
sleep 0.01;
}
&dump_history;
}
@@ -612,6 +816,176 @@ Start to capture every message during os provision process......
return $rst;
}
sub get_valid_logs {
my $ref_timestamp = shift;
my $year = shift;
my $epoch_seconds_of_now = shift;
my $bthistory_ref = shift;
my @orglogfilelist = ("/var/log/xcat/cluster.log",
"/var/log/messages",
"/var/log/xcat/computes.log");
my $httplog;
if (-e "/var/log/httpd/access_log") {
$httplog = "/var/log/httpd/access_log";
} elsif (-e "/var/log/apache2/access_log") {
$httplog = "/var/log/apache2/access_log";
} elsif (-e "/var/log/apache2/access.log") {
$httplog = "/var/log/apache2/access.log";
}
push @orglogfilelist, $httplog;
foreach my $f (@orglogfilelist) {
my $filename = basename("$f");
$filename =~ s/(.+)\.(.+)/$1/g;
my $path_only = dirname("$f");
my @rotatefiles;
#TODO using opendir to refine below code
my @alltargetfiles = `ls -lt $path_only |awk -F" " '/ $filename/ {print \$9}'`;
foreach my $samenamefile (@alltargetfiles) {
chomp($samenamefile);
push @rotatefiles, "$path_only/$samenamefile";
}
my $ishttplog = 0;
$ishttplog = 1 if ($filename =~ /access/);
foreach my $file (@rotatefiles) {
my $fd;
my $filetype = `file $file 2>&1`;
chomp($filetype);
if ($filetype =~ /ASCII/) {
if (!open($fd, "$file")) {
print "open $files failed\n";
next;
}
} else {
#TODO handle compression files
}
#print "--->load $file\n";
my $line;
my $historynum = 0;
last unless ($line = <$fd>);
chomp($line);
my $needrotate = 0;
my $logindex = 0;
my @splitline = split(/\s+/, $line);
my $timestamp;
my $timestampepoch;
if ($ishttplog) {
$splitline[3] =~ s/^\[(.+)/$1/g;
$timestampepoch = probe_utils->convert_to_epoch_seconds($splitline[3]);
} else {
$timestamp = join(" ", @splitline[ 0 .. 2 ]);
$timestampepoch = probe_utils->convert_to_epoch_seconds($timestamp, $year, $epoch_seconds_of_now);
}
if ($ref_timestamp <= $timestampepoch) {
$needrotate = 1;
} else {
seek($fd, 0, 2);
my $tail = tell;
my $head = 0;
my $lasttail = $tail;
my $i = 0;
while ($head <= $tail) {
my $middle = int(($tail - $head) / 2) + $head;
seek($fd, $middle, 0);
$line = <$fd>;
$middle += length($line);
last unless ($line = <$fd>);
@splitline = split(/\s+/, $line);
if ($ishttplog) {
$splitline[3] =~ s/^\[(.+)/$1/g;
$timestampepoch = probe_utils->convert_to_epoch_seconds($splitline[3]);
} else {
$timestamp = join(" ", @splitline[ 0 .. 2 ]);
$timestampepoch = probe_utils->convert_to_epoch_seconds($timestamp, $year, $epoch_seconds_of_now);
} if ($ref_timestamp == $timestampepoch) {
$historynum = $middle;
last;
} elsif ($ref_timestamp < $timestampepoch) {
$tail = $middle;
last if ($tail == $lasttail);
$lasttail = $tail;
} else {
$head = $middle;
}
}
$historynum = $head unless ($historynum);
}
seek($fd, $historynum, 0);
while (<$fd>) {
chomp;
@splitline = split(/\s+/, $_);
if ($ishttplog) {
$splitline[3] =~ s/^\[(.+)/$1/g;
$timestampepoch = probe_utils->convert_to_epoch_seconds($splitline[3]);
} else {
$timestamp = join(" ", @splitline[ 0 .. 2 ]);
$timestampepoch = probe_utils->convert_to_epoch_seconds($timestamp, $year, $epoch_seconds_of_now);
}
if (($splitline[4] =~ /dhcpd/i && $_ =~ /$installnic/)
|| ($splitline[4] =~ /in.tftpd/i)
|| (($splitline[4] =~ /^xcat/i) || ($splitline[5] =~ /^xcat/i))
|| ($splitline[5] =~ /GET/ && $splitline[7] =~ /HTTP/)) {
my $log = "$timestampepoch $filename$logindex $_";
$logindex++;
push @$bthistory_ref, $log;
}
}
close($fd);
last unless ($needrotate);
}
}
#sort logs depending on time
my @sort_ht = sort(@$bthistory_ref);
for ($i = 0 ; $i <= $#sort_ht ; $i++) {
$sort_ht[$i] =~ s/^(\d+) (\S+) (.+)/$1 $3/g;
}
#delete duplicate logs
my %count;
@$bthistory_ref = grep { ++$count{$_} < 2; } @sort_ht;
}
sub do_replay {
my $ref_timestamp = shift;
my $timestr = scalar(localtime($ref_timestamp));
print "Start logs search after '$timestr', waiting for a while.............\n";
my ($sec, $min, $hour, $day, $mon, $year, $wday, $yday, $isdst) = localtime(time());
my $epoch_seconds_of_now = time();
my @bthistory;
get_valid_logs($ref_timestamp, $year, $epoch_seconds_of_now, \@bthistory);
foreach my $line (@bthistory) {
$line =~ s/(\d+) (.+)/$2/g;
my @tmp = split(/\s+/, $line);
if ($tmp[4] =~ /dhcpd/i && $line =~ /$installnic/) {
handle_dhcp_msg("$line");
} elsif ($tmp[4] =~ /in.tftpd/i) {
handle_tftp_msg("$line");
} elsif (($tmp[4] =~ /^xcat/i) || ($tmp[5] =~ /^xcat/i)) {
if (grep(/^$tmp[3]$/, @candidate_svr_hostname_inlog)) {
handle_cluster_msg("$line");
} else {
handle_compute_msg("$line");
}
} elsif ($tmp[5] =~ /GET/ && $tmp[7] =~ /HTTP/) {
handle_http_msg("$line");
}
}
&dump_history;
return 0;
}
#-------------------------------------
# main process
#-------------------------------------
@@ -619,6 +993,8 @@ if (
!GetOptions("--help|h|?" => \$help,
"T" => \$test,
"V" => \$verbose,
"t" => \$maxwaittime,
"r=s" => \$replaylog,
"n=s" => \$noderange))
{
probe_utils->send_msg("$output", "f", "Invalid parameter for $program_name");
@@ -636,16 +1012,65 @@ if ($help) {
}
if ($test) {
probe_utils->send_msg("$output", "o", "Do probe for os provision process, realtime monitor of os provision process.");
probe_utils->send_msg("$output", "o", "Probe for OS provision process, realtime monitor of OS provision process.");
exit 0;
}
unless ($noderange) {
probe_utils->send_msg("$output", "f", "Option -n is required");
probe_utils->send_msg("$output", "f", "A noderange is required");
probe_utils->send_msg("$output", "d", "$::USAGE");
exit 1;
}
my $epoch_starttime = time();
if ($replaylog) {
if ($replaylog =~ /(\d+)h(\d+)m/i) {
$epoch_starttime -= ($1 * 3600 + $2 * 60)
} elsif ($replaylog =~ /^(\d+)h*$/i) {
$epoch_starttime -= $1 * 3600;
} elsif ($replaylog =~ /^(\d+)m$/) {
$epoch_starttime -= $1 * 60;
} else {
probe_utils->send_msg("$output", "f", "Unsupported time format for history log replay");
print "$::USAGE";
exit 1;
}
}
my $msg = "All pre_defined nodes are valid";
my $rc = check_noderange($noderange);
if ($rc) {
probe_utils->send_msg("$output", "f", $msg);
$rst = 1;
} else {
probe_utils->send_msg("$output", "o", $msg);
}
unless ($installnic) {
my $masteripinsite = `tabdump site | awk -F',' '/^"master",/ { gsub(/"/, "", \$2) ; print \$2 }'`;
chomp($masteripinsite);
$installnic = `ip addr |grep -B2 $masteripinsite|awk -F" " '/mtu/{gsub(/:/,"",\$2); print \$2}'`;
chomp($installnic);
if (!$installnic) {
probe_utils->send_msg("$output", "f", "The value of 'master' in 'site' table is $masteripinsite, can't get corresponding network interface");
$rst = 1;
} else {
probe_utils->send_msg("$output", "i", "The installation network interface is $installnic");
}
}
exit $rst if ($rst);
foreach my $node (keys %monitor_nodes) {
$rawdata{$node}{state} = $state_set{unknown};
push(@{ $rawdata{$node}{statehistory} }, $rawdata{$node}{state});
}
if ($replaylog) {
$rst = do_replay($epoch_starttime);
exit $rst;
}
$rst = do_monitor();
exit $rst;
+6 -6
View File
@@ -23,8 +23,8 @@ Description:
Currently, this command does not support hierarchy.
Options:
-c: To check whether the switch is OK to retrieve MAC address mapping.
-V: Output verbose information when accessing switch
-c: Check if the switch is OK to retrieve MAC address mapping.
-V: Output verbose information when accessing the switch
";
my $help;
@@ -36,13 +36,13 @@ if (!GetOptions("help|h" => \$help,
"T" => \$test,
"c" => \$check,
"V" => \$verbose)) {
probe_utils->send_msg("$output", "f", "Option not support");
probe_utils->send_msg("$output", "f", "Option not supported");
probe_utils->send_msg("$output", "d", $::USAGE);
exit 1;
}
foreach (@ARGV) {
if (/^-\w*/) {
probe_utils->send_msg("$output", "f", "Option $_ not support");
probe_utils->send_msg("$output", "f", "Option $_ not supported");
exit 1;
} else {
push @nodes, $_;
@@ -63,10 +63,10 @@ if (!-e "$currdir/bin/switchprobe") {
if ($test) {
`$currdir/bin/switchprobe -h`;
if ($?) {
probe_utils->send_msg("$output", "f", "No switchprobe tool is available at $currdir/bin/");
probe_utils->send_msg("$output", "f", "No 'switchprobe' tool is available at $currdir/bin/");
exit 1;
} else {
probe_utils->send_msg("$output", "o", "To retrieve MAC address mapping for the specified switch, or all the switches defined in switches table in xCAT db. Currently, this command does not support hierarchy.");
probe_utils->send_msg("$output", "o", "To retrieve MAC address mapping for the specified switch, or all the switches defined in 'switches' table in xCAT db. Currently, this command does not support hierarchy.");
exit 0;
}
}
+936 -469
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -31,6 +31,7 @@ Options:
-h : get usage information of $program_name
-l : list all valid sub commands
-V : print verbose information of $program_name
-w : show each line completely. By default long lines are truncated.
";
#-----------------------------------
@@ -274,7 +275,7 @@ if ($ARGV[0] eq "-l") {
}
if (!defined($pluginname)) {
print "There isn't sub command input from command line, please use '-l' to list all valid subcommand\n";
print "There isn't sub command input from command line, use '-l' to list all valid subcommand\n";
exit 0;
}
-2
View File
@@ -2219,8 +2219,6 @@ sub process_request {
$request->{fsp_api} = 1;
#For using rspconfig options through ASMI
#my $arg = $request->{arg};
#if($request->{command} eq "rspconfig" and grep(/^(dev|celogin1)/, @$arg)) {
if ($request->{command} eq "rspconfig" and ref($request->{method}) eq 'HASH') {
$request->{fsp_api} = 0;
}
+6 -5
View File
@@ -114,7 +114,8 @@ sub subvars {
}
unless ($master) {
die "Unable to identify master for $node";
$tmplerr = "Unable to identify master for $node";
return;
}
$ENV{XCATMASTER} = $master;
@@ -1009,7 +1010,7 @@ sub kickstartnetwork {
$line .= $ulaaddr;
} elsif ($::XCATSITEVALS{managedaddressmode} =~ /static/) {
my ($ipaddr, $hostname, $gateway, $netmask) = xCAT::NetworkUtils->getNodeNetworkCfg($node);
unless ($ipaddr) { die "cannot resolve the network configuration of $node"; }
unless ($ipaddr) { $tmplerr = "cannot resolve the network configuration of $node"; return; }
if ($gateway eq '<xcatmaster>') {
@@ -1116,9 +1117,9 @@ sub yast2network {
my $line;
my $hoststab;
my $mactab = xCAT::Table->new('mac', -create => 0);
unless ($mactab) { die "mac table should always exist prior to template processing when doing autoula"; }
unless ($mactab) { $tmplerr="mac table should always exist prior to template processing when doing autoula"; return;}
my $ent = $mactab->getNodeAttribs($node, ['mac'], prefetchcache => 1);
unless ($ent and $ent->{mac}) { die "missing mac data for $node"; }
unless ($ent and $ent->{mac}) { $tmplerr="missing mac data for $node"; return; }
my $suffix = xCAT::Utils->parseMacTabEntry($ent->{mac}, $node);
$suffix = lc($suffix);
@@ -1128,7 +1129,7 @@ sub yast2network {
return "#YAST2NET autoula unsupported"
} elsif ($::XCATSITEVALS{managedaddressmode} =~ /static/) {
my ($ipaddr, $hostname, $gateway, $netmask) = xCAT::NetworkUtils->getNodeNetworkCfg($node);
unless ($ipaddr) { die "cannot resolve the network configuration of $node"; }
unless ($ipaddr) { $tmplerr = "cannot resolve the network configuration of $node"; return; }
if ($gateway eq '<xcatmaster>') {
my @gatewayd = xCAT::NetworkUtils->my_ip_facing($ipaddr);
+5 -3
View File
@@ -462,9 +462,11 @@ sub mknetboot
}
$platform = xCAT_plugin::anaconda::getplatform($osver);
my $suffix = 'gz';
my $suffix = 'cpio.gz';
$suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs");
$suffix = 'tgz' if (-r "$rootimgdir/rootimg.tgz");
$suffix = 'cpio.xz' if (-r "$rootimgdir/rootimg.cpio.xz");
$suffix = 'tar.gz' if (-r "$rootimgdir/rootimg.tar.gz");
$suffix = 'tar.xz' if (-r "$rootimgdir/rootimg.tar.xz");
# statelite images are not packed.
if ($statelite) {
@@ -513,7 +515,7 @@ sub mknetboot
copy("$rootimgdir/initrd.gz", "$rootimgdir/initrd-stateless.gz");
}
}
unless (-r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.tgz" or -r "$rootimgdir/rootimg.sfs") {
unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs") {
$callback->({
error => ["No packed image for platform $osver, architecture $arch, and profile $profile found at $rootimgdir/rootimg.gz or $rootimgdir/rootimg.sfs on $myname, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"],
errorcode => [1] });
+1 -1
View File
@@ -395,8 +395,8 @@ sub donodeent {
if ($cfgenthash->{$confnode}) {
$confluent->delete('/nodes/' . $confnode);
}
return;
}
return;
}
my @toconfignodes = keys %{$cfgenthash};
my $ipmitab = xCAT::Table->new('ipmi', -create => 0);
+14
View File
@@ -423,6 +423,8 @@ sub process_request {
my $names;
my @hosts;
my %nodehash;
my @eachhost;
my $invalid;
foreach (@contents) {
chomp; #no newline
@@ -439,6 +441,18 @@ sub process_request {
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, names $names contain invalid characters (valid characters include a through z, numbers and the '-', but not '_'", $callback);
next;
}
$invalid = "";
@eachhost = split(/ /,$names);
foreach my $hname (@eachhost) {
if ($hname =~ /^\./) {
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, name $hname start with . ", $callback);
$invalid = $names;
last;
}
}
if ($invalid) {
next;
}
my ($host, $ip) = xCAT::NetworkUtils->gethostnameandip($addr);
push @hosts, $host;
+7 -6
View File
@@ -891,7 +891,7 @@ sub mkinstall {
$kcmdline .= "n8r";
}
} else {
$callback->({ warning => ["rcons my not work since no serialport specified"], });
$callback->({ warning => ["rcons may not work since no serialport is specified for $node"], });
}
# need to add these in, otherwise aptitude will ask questions
@@ -1170,9 +1170,10 @@ sub mknetboot
}
$platform = xCAT_plugin::debian::getplatform($osver);
my $suffix = 'gz';
$suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs");
$suffix = 'tgz' if (-r "$rootimgdir/rootimg.tgz");
my $suffix = 'cpio.gz';
$suffix = 'cpio.xz' if (-r "$rootimgdir/rootimg.cpio.xz");
$suffix = 'tar.gz' if (-r "$rootimgdir/rootimg.tar.gz");
$suffix = 'tar.xz' if (-r "$rootimgdir/rootimg.tar.xz");
# statelite images are not packed.
if ($statelite) {
@@ -1222,7 +1223,7 @@ sub mknetboot
copy("$rootimgdir/initrd.gz", "$rootimgdir/initrd-stateless.gz");
}
}
unless (-r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.tgz" or -r "$rootimgdir/rootimg.sfs") {
unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs") {
$callback->({
error => ["No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"],
errorcode => [1] });
@@ -1547,7 +1548,7 @@ sub mknetboot
} else {
$callback->(
{
warning => ["rcons my not work since no serialport specified"],
warning => ["rcons may not work since no serialport is specified for $node"],
}
);
}
+46 -6
View File
@@ -524,6 +524,10 @@ sub on_bmc_connect {
} elsif ($command eq "rspreset") {
return resetbmc($sessdata);
} elsif ($command eq "rbeacon") {
unless (defined $sessdata->{device_id}) { #need get device id data initted for SD350 workaround
$sessdata->{ipmisession}->subcmd(netfn => 6, command => 1, data => [], callback => \&gotdevid, callback_args => $sessdata);
return;
}
return beacon($sessdata);
} elsif ($command eq "rsetboot") {
return setboot($sessdata);
@@ -1728,9 +1732,43 @@ sub do_firmware_update {
}
xCAT::SvrUtils::sendmsg("rflash started, please wait.......",
$callback, $sessdata->{node}, %allerrornodes);
# check for 8335-GTB Model Type to adjust buffer size
my $buffer_size = "30000";
my $cmd = $pre_cmd . " fru print 3";
$output = xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed: $output" ],
$callback, $sessdata->{node}, %allerrornodes);
return -1;
}
if ($output =~ /8335-GTB/) {
$buffer_size = "15000";
}
# check for 8335-GTB Firmware above 1610A release. If below, exit
if ($output =~ /8335-GTB/) {
$cmd = $pre_cmd . " fru print 47";
$output = xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed: $output" ],
$callback, $sessdata->{node}, %allerrornodes);
return -1;
}
my $grs_version = $output =~ /OP8_v(\d*\.\d*_\d*\.\d*)/;
if ($grs_version =~ /\d\.(\d+)_(\d+\.\d+)/) {
my $prim_grs_version = $1;
my $sec_grs_version = $2;
if ($prim_grs_version <= 7 && $sec_grs_version < 2.55) {
xCAT::SvrUtils::sendmsg([ 1, "Error: Current firmware level OP8v_$grs_version requires one-time manual update to at least version OP8v_1.7_2.55" ],
$callback, $sessdata->{node}, %allerrornodes);
return -1;
}
}
}
# step 1 power off
my $cmd = $pre_cmd . " chassis power off";
$cmd = $pre_cmd . " chassis power off";
$output = xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed: $output" ],
@@ -1747,14 +1785,14 @@ sub do_firmware_update {
return -1;
}
#check reset status
# check reset status
unless (check_bmc_status_with_ipmitool($pre_cmd, 5, 24)) {
xCAT::SvrUtils::sendmsg([ 1, "Timeout to check the bmc status" ],
$callback, $sessdata->{node}, %allerrornodes);
return -1;
}
#step 3 protect network
# step 3 protect network
$cmd = $pre_cmd . " raw 0x32 0xba 0x18 0x00";
$output = xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
@@ -1764,9 +1802,9 @@ sub do_firmware_update {
}
# step 4 upgrade firmware
$cmd = $pre_cmd . " -z 30000 hpm upgrade $hpm_file force";
$cmd = $pre_cmd . " -z " . $buffer_size . " hpm upgrade $hpm_file force";
$output = xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed." ],
$callback, $sessdata->{node}, %allerrornodes);
@@ -2354,7 +2392,9 @@ sub beacon {
#if stuck with 1.5, say light for 255 seconds. In 2.0, specify to turn it on forever
if ($subcommand eq "on") {
if ($ipmiv2) {
if ($sessdata->{mfg_id} == 19046 and $sessdata->{prod_id} == 13616) { # Lenovo SD350
$sessdata->{ipmisession}->subcmd(netfn => 0x3a, command => 6, data => [ 1, 1 ], callback => \&beacon_answer, callback_args => $sessdata);
} elsif ($ipmiv2) {
$sessdata->{ipmisession}->subcmd(netfn => 0, command => 4, data => [ 0, 1 ], callback => \&beacon_answer, callback_args => $sessdata);
} else {
$sessdata->{ipmisession}->subcmd(netfn => 0, command => 4, data => [0xff], callback => \&beacon_answer, callback_args => $sessdata);
+92 -2
View File
@@ -1807,7 +1807,7 @@ sub rmvm {
sub chvm {
shift;
my @addsizes;
my %resize;
my $resize;
my $cpucount;
my @purge;
my @derefdisks;
@@ -1831,7 +1831,7 @@ sub chvm {
"eject" => \$eject,
"cpus|cpu=s" => \$cpucount,
"p=s" => \@purge,
"resize=s%" => \%resize,
"resize=s" => \$resize,
"cpupin=s" => \$pcpuset,
"membind=s" => \$numanodeset,
"devpassthru=s" => \$passthrudevices,
@@ -1894,6 +1894,18 @@ sub chvm {
}
}
}
# The function get_multiple_paths_by_url() is used to polulate useddisks hash,
# but it only returns disk volumes from kvm host.
# cdrom is not returned by get_multiple_paths_by_url() but is defined as a disk device
# in xml definition of the VM.
# We add cdrom entry to useddisks hash to make sure the device name used by cdrom is not
# selected for the new disk about to be added (chvm -a)
my @cdrom_names = get_cdrom_device_names($vmxml);
foreach my $cdrom_name (@cdrom_names) {
$useddisks{$cdrom_name} = 1;
}
if (@addsizes) { #need to add disks, first identify used devnames
my @diskstoadd;
my $location = $confdata->{vm}->{$node}->[0]->{storage};
@@ -1938,6 +1950,7 @@ sub chvm {
$dev = $prefix . shift(@suffixes);
} while ($useddisks{$dev});
#ok, now I need a volume created to attach
push @diskstoadd, get_filepath_by_url(url => $location, dev => $dev, create => $_, format => $format);
}
@@ -2096,6 +2109,62 @@ sub chvm {
$updatetable->{kvm_nodedata}->{$node}->{xml} = $vmxml;
}
}
if ($resize) {
my $shrinking_not_supported = "qcow2 doesn't support shrinking images yet";
# Get a list of disk=size pairs
my @resize_disks = split(/,/, $resize);
for my $single_disk (@resize_disks) {
# For each comma separated disk, get disk name and the size to change it to
my ($disk_to_resize, $value) = split(/=/, $single_disk);
if ($disk_to_resize) {
unless (exists $useddisks{$disk_to_resize}) {
# Disk name given does not match any disks for this vm
xCAT::SvrUtils::sendmsg([ 1, "Disk $disk_to_resize does not exist" ], $callback, $node);
next;
}
# Get desired (new) disk size
$value = getUnits($value, "G", 1);
# Now search kvm_nodedata table to find the volume for this disk
my $myxml = $parser->parse_string($vmxml);
my @alldisks = $myxml->findnodes("/domain/devices/disk");
# Look through all the disk entries
foreach my $disknode (@alldisks) {
my $devicetype = $disknode->getAttribute("device");
# Skip cdrom devices
if ($devicetype eq "cdrom") { next; }
# Get name of the disk
my $diskname = $disknode->findnodes('./target')->[0]->getAttribute('dev');
# Is this a disk we were looking for to resize ?
if ($diskname eq $disk_to_resize) {
my $file = $disknode->findnodes('./source')->[0]->getAttribute('file');
my $vol = $hypconn->get_storage_volume_by_path($file);
if ($vol) {
# Always pass RESIZE_SHRINK flag to resize(). It is required when shrinking
# the volume size and is ignored when growing volume size
eval {
$vol->resize($value, &Sys::Virt::StorageVol::RESIZE_SHRINK);
};
if ($@) {
if ($@ =~ /$shrinking_not_supported/) {
# qcow2 does not support shrinking volumes, display more readable error
xCAT::SvrUtils::sendmsg([ 1, "Resizing disk $disk_to_resize failed, $shrinking_not_supported" ], $callback, $node);
}
else {
# some other resize error from libvirt, just display it
xCAT::SvrUtils::sendmsg([ 1, "Resizing disk $disk_to_resize failed, $@" ], $callback, $node);
}
}
else {
# success
xCAT::SvrUtils::sendmsg([ 0, "Resized disk $disk_to_resize" ], $callback, $node);
}
}
last; # Found the disk we were looking for. Go to the next disk.
}
}
}
}
}
if ($cpucount or $memory) {
if ($currstate eq 'on') {
if ($cpucount) { xCAT::SvrUtils::sendmsg([ 1, "Hot add of cpus not supported (VM must be powered down to successfuly change)" ], $callback, $node); }
@@ -4037,4 +4106,25 @@ sub dohyp {
#print $out $msgtoparent; #$node.": $_\n";
}
# Return array of device names used by cdrom as defined in the kvm_nodedata table
sub get_cdrom_device_names() {
my $xml = shift;
my $device_name;
my @cdrom_device_names;
my $myxml = $parser->parse_string($xml);
my @alldisks = $myxml->findnodes("/domain/devices/disk");
# Look through all the disk entries defined in the xml
foreach my $disknode (@alldisks) {
my $devicetype = $disknode->getAttribute("device");
# Check if it is cdrom
if ($devicetype eq "cdrom") {
# Get name of the cdrom
$device_name = $disknode->findnodes('./target')->[0]->getAttribute('dev');
push @cdrom_device_names, $device_name;
}
}
return @cdrom_device_names;
}
1;
+100 -44
View File
@@ -79,7 +79,7 @@ sub process_request {
@ARGV = @{$args};
}
if (scalar(@ARGV) == 0) {
$callback->({ info => ["Usage:\n packimage <imagename>\n packimage [-h| --help]\n packimage [-v| --version]"] });
$callback->({ info => ["Usage:\n packimage [-m| --method=cpio|tar] [-c| --compress=gzip|pigz|xz] <imagename>\n packimage [-h| --help]\n packimage [-v| --version]"] });
return 0;
}
@@ -87,6 +87,7 @@ sub process_request {
my $arch;
my $profile;
my $method = 'cpio';
my $compress;
my $exlistloc;
my $syncfile;
my $rootimg_dir;
@@ -102,17 +103,22 @@ sub process_request {
"arch|a=s" => \$arch,
"osver|o=s" => \$osver,
"method|m=s" => \$method,
"compress|c=s" => \$compress,
"tracker=s" => \$dotorrent,
"help|h" => \$help,
"version|v" => \$version
);
if ($arch or $osver or $profile) {
$callback->({ error => ["-o, -p and -a options are obsoleted, please use 'packimage <osimage name>' instead."], errorcode => [1] });
return 1;
}
if ($version) {
my $version = xCAT::Utils->Version();
$callback->({ info => [$version] });
return 0;
}
if ($help) {
$callback->({ info => ["Usage:\n packimage <imagename>\n packimage [-h| --help]\n packimage [-v| --version]"] });
$callback->({ info => ["Usage:\n packimage [-m| --method=cpio|tar] [-c| --compress=gzip|pigz|xz] <imagename>\n packimage [-h| --help]\n packimage [-v| --version]"] });
return 0;
}
@@ -218,7 +224,7 @@ sub process_request {
}
}
#before generating rootimg.gz, copy $installroot/postscripts into the image at /xcatpost
#before generating rootimg.$suffix, copy $installroot/postscripts into the image at /xcatpost
if (-e "$rootimg_dir/xcatpost") {
system("rm -rf $rootimg_dir/xcatpost");
}
@@ -238,7 +244,7 @@ sub process_request {
`echo TIMESTAMP="'$timestamp'" >> $rootimg_dir/opt/xcat/xcatinfo`;
# before generating rootimg.gz or rootimg.sfs, need to switch the rootimg to stateless mode if necessary
# before generating rootimg.$suffix or rootimg.sfs, need to switch the rootimg to stateless mode if necessary
my $rootimg_status = 0; # 0 means stateless mode, while 1 means statelite mode
$rootimg_status = 1 if (-f "$rootimg_dir/.statelite/litefile.save");
@@ -412,58 +418,101 @@ sub process_request {
my $temppath;
my $oldmask;
unless (-d $rootimg_dir) {
$callback->({ error => ["$rootimg_dir does not exist, run genimage -o $osver -p $profile on a server with matching architecture"] });
$callback->({ error => ["$rootimg_dir does not exist, run genimage -o $osver -p $profile on a server with matching architecture"], errorcode => [1] });
return 1;
}
$callback->({ data => ["Packing contents of $rootimg_dir"] });
unlink("$destdir/rootimg.gz");
unlink("$destdir/rootimg.sfs");
$callback->({ info => ["archive method:$method"] });
if ($method =~ /cpio/) {
my $compress = "gzip";
#use "pigz" as the compress tool instead of gzip if "pigz" exist
my $ispigz = system("bash -c 'type -p pigz' >/dev/null 2>&1");
if ($ispigz == 0) {
$compress = "pigz";
}
$callback->({ info => ["compress method:$compress"] });
if (!$exlistloc) {
$excludestr = "find . -xdev -print0 | cpio -H newc -o -0 | $compress -c - > ../rootimg.gz";
} else {
chdir("$rootimg_dir");
system("$excludestr >> $xcat_packimg_tmpfile");
if ($includestr) {
system("$includestr >> $xcat_packimg_tmpfile");
my $suffix;
if ($compress) {
if ($compress eq 'gzip') {
my $isgzip = system("bash -c 'type -p gzip' >/dev/null 2>&1");
unless ($isgzip == 0) {
$callback->({ error => ["Command gzip does not exist, please make sure it is installed."], errorcode => [1] });
return 1;
}
$excludestr = "cat $xcat_packimg_tmpfile|cpio -H newc -o | $compress -c - > ../rootimg.gz";
$suffix = "gz";
} elsif ($compress eq 'pigz') {
my $ispigz = system("bash -c 'type -p pigz' >/dev/null 2>&1");
unless ($ispigz == 0) {
$callback->({ error => ["Command pigz does not exist, please make sure it is installed."], errorcode => [1] });
return 1;
}
$suffix = "gz";
} elsif ($compress eq 'xz') {
my $isxz = system("bash -c 'type -p xz' >/dev/null 2>&1");
unless ($isxz == 0) {
$callback->({ error => ["Command xz does not exist, please make sure it is installed."], errorcode => [1] });
return 1;
}
$suffix = "xz";
} else {
$callback->({ error => ["Invalid compress method '$compress' requested"], errorcode => [1] });
return 1;
}
$oldmask = umask 0077;
} elsif ($method =~ /tar/) {
my $compress = "gzip";
#use "pigz" as the compress tool instead of gzip if "pigz" exist
} else {
my $ispigz = system("bash -c 'type -p pigz' >/dev/null 2>&1");
if ($ispigz == 0) {
$compress = "pigz";
} else {
my $isgzip = system("bash -c 'type -p gzip' >/dev/null 2>&1");
unless ($isgzip == 0) {
$callback->({ error => ["Command gzip does not exist, please make sure it works."] });
if ($isgzip == 0) {
$compress = "gzip";
} else {
$callback->({ error => ["The default compress tool 'gzip' and 'pigz' does not exist, please specify an available compress method with '-c'."], errorcode => [1] });
return 1;
}
}
$suffix = "gz";
}
unless (($method eq 'cpio') or ($method eq 'tar') or ($method eq 'squashfs')) {
$callback->({ error => ["Invalid archive method '$method' requested"], errorcode => [1] });
return 1;
}
$callback->({ data => ["Packing contents of $rootimg_dir"] });
$callback->({ info => ["archive method:$method"] });
unless ($method =~ /squashfs/) {
$callback->({ info => ["compress method:$compress"] });
}
$suffix = $method.".".$suffix;
unlink("$destdir/rootimg.sfs");
unlink("$destdir/rootimg.cpio.xz");
unlink("$destdir/rootimg.cpio.gz");
unlink("$destdir/rootimg.tar.xz");
unlink("$destdir/rootimg.tar.gz");
if ($method =~ /cpio/) {
if (!$exlistloc) {
$excludestr = "find . -xdev -print0 | tar --selinux --xattrs-include='*' --null -T - -c | $compress -c - > ../rootimg.tgz";
$excludestr = "find . -xdev -print0 | cpio -H newc -o -0 | $compress -c - > ../rootimg.$suffix";
} else {
chdir("$rootimg_dir");
system("$excludestr >> $xcat_packimg_tmpfile");
if ($includestr) {
system("$includestr >> $xcat_packimg_tmpfile");
}
$excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --xattrs-include='*' -T - -c | $compress -c - > ../rootimg.tgz";
$excludestr = "cat $xcat_packimg_tmpfile|cpio -H newc -o | $compress -c - > ../rootimg.$suffix";
}
$oldmask = umask 0077;
} elsif ($method =~ /tar/) {
my $checkoption1 = `tar --xattrs-include 2>&1`;
my $checkoption2 = `tar --selinux 2>&1`;
my $option;
if ($checkoption1 !~ /unrecognized/) {
$option .= "--xattrs-include='*' ";
}
if ($checkoption2 !~ /unrecognized/) {
$option .= "--selinux ";
}
if (!$exlistloc) {
$excludestr = "find . -xdev -print0 | tar $option --no-recursion --use-compress-program=$compress --null -T - -cf ../rootimg.$suffix";
} else {
chdir("$rootimg_dir");
system("$excludestr >> $xcat_packimg_tmpfile");
if ($includestr) {
system("$includestr >> $xcat_packimg_tmpfile");
}
$excludestr = "cat $xcat_packimg_tmpfile| tar $option --no-recursion --use-compress-program=$compress -T - -cf ../rootimg.$suffix";
}
$oldmask = umask 0077;
} elsif ($method =~ /squashfs/) {
@@ -475,25 +524,32 @@ sub process_request {
system("$includestr >> $xcat_packimg_tmpfile");
}
$excludestr = "cat $xcat_packimg_tmpfile|cpio -dump $temppath";
} else {
$callback->({ error => ["Invalid method '$method' requested"], errorcode => [1] });
}
chdir("$rootimg_dir");
my $outputmsg = `$excludestr`;
$callback->({ info => ["$outputmsg"] });
my $outputmsg = `$excludestr 2>&1`;
unless($?){
$callback->({ info => ["$outputmsg"] });
}else{
$callback->({ info => ["$outputmsg"] });
$callback->({ error => ["packimage failed while running: \n $excludestr"], errorcode => [1] });
system("rm -rf $xcat_packimg_tmpfile");
return 1;
}
if ($method =~ /cpio/) {
chmod 0644, "$destdir/rootimg.gz";
chmod 0644, "$destdir/rootimg.$suffix";
if ($dotorrent) {
my $currdir = getcwd;
chdir($destdir);
unlink("rootimg.gz.metainfo");
system("ctorrent -t -u $dotorrent -l 1048576 -s rootimg.gz.metainfo rootimg.gz");
chmod 0644, "rootimg.gz.metainfo";
unlink("rootimg.$suffix.metainfo");
system("ctorrent -t -u $dotorrent -l 1048576 -s rootimg.$suffix.metainfo rootimg.$suffix");
chmod 0644, "rootimg.$suffix.metainfo";
chdir($currdir);
}
umask $oldmask;
} elsif ($method =~ /tar/) {
chmod 0644, "$destdir/rootimg.tgz";
chmod 0644, "$destdir/rootimg.$suffix";
umask $oldmask;
} elsif ($method =~ /squashfs/) {
my $flags;
+10 -2
View File
@@ -996,8 +996,16 @@ Usage:
# Add BMC/FSP as reserve NICs and not remove it form nics table
foreach my $oldNic (keys %$oldNicsRef) {
if ($oldNicsRef->{$oldNic}->{'type'} ne 'BMC' and $oldNicsRef->{$oldNic}->{'type'} ne 'FSP') {
$updateNicsHash{$oldNic} = 1;
if ($oldNicsRef->{$oldNic}->{'type'} ne 'BMC' and $oldNicsRef->{$oldNic}->{'type'} ne 'FSP'){
if ($oldNicsRef->{$oldNic}->{'network'} eq $newNicsRef->{$oldNic}->{'network'}){
$reserveNicsHash{$oldNic} = 1;
if(exists $updateNicsHash{$oldNic})
{
delete($updateNicsHash{$oldNic});
}
} else {
$updateNicsHash{$oldNic} = 1;
}
} else {
$reserveNicsHash{$oldNic} = 1;
}
+5 -3
View File
@@ -327,9 +327,11 @@ sub mknetboot
$platform = "sles";
}
my $suffix = 'gz';
my $suffix = 'cpio.gz';
$suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs");
$suffix = 'tgz' if (-r "$rootimgdir/rootimg.tgz");
$suffix = 'cpio.xz' if (-r "$rootimgdir/rootimg.cpio.xz");
$suffix = 'tar.gz' if (-r "$rootimgdir/rootimg.tar.gz");
$suffix = 'tar.xz' if (-r "$rootimgdir/rootimg.tar.xz");
if ($statelite) {
unless (-r "$rootimgdir/kernel") {
@@ -381,7 +383,7 @@ sub mknetboot
}
}
unless (-r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.tgz" or -r "$rootimgdir/rootimg.sfs") {
unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs") {
$callback->({
error => [qq{No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage before nodeset}],
errorcode => [1]
@@ -1402,7 +1402,7 @@ sub switchsetup {
}
foreach my $mytype (keys %$nodes_to_config) {
my $config_script = "$::XCATROOT/shart/xcat/tools/config".$mytype;
my $config_script = "$::XCATROOT/share/xcat/scripts/config".$mytype;
if (-r -x $config_script) {
my $switches = join(",",@{${nodes_to_config}->{$mytype}});
send_msg($request, 0, "call to config $mytype switches $switches\n");
+22 -26
View File
@@ -1911,7 +1911,8 @@ sub setupLinuxexports
Creates a network boot root image on Linux
Run mknb to put xCAT-genesis-scripts-x86_64 and xCAT-genesis-base-x86_64 together and in /tftpboot
From 2.12.2, both xCAT-genesis-scripts-x86_64 and xCAT-genesis-scripts-ppc64 will be installed.
So, will run mknb twice, one for ppc64 and another for x86_64
=cut
#-----------------------------------------------------------------------------
@@ -1920,35 +1921,30 @@ sub mknb
# The xCAT-genesis-scripts.spec file touches /etc/xcat/genesis-scripts-updated or
# the xCAT-genesis-base.spec file touches /etc/xcat/genesis-base-updated,
# so we know to run mknb here.
my $cmd;
if ($::arch =~ /ppc/) {
$::arch = "ppc64";
}
if ((($::arch eq "x86_64") || ($::arch =~ /ppc/)) && (-f '/etc/xcat/genesis-scripts-updated')) {
my $cmd = "$::XCATROOT/sbin/mknb";
my $run_mknb = 0;
if (-f '/etc/xcat/genesis-scripts-updated') {
unlink '/etc/xcat/genesis-scripts-updated';
# Do not print messages or run command twice
if (-f '/etc/xcat/genesis-base-updated') {
unlink '/etc/xcat/genesis-base-updated';
}
$cmd = "$::XCATROOT/sbin/mknb $::arch";
xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-scripts-$::arch ...");
$run_mknb = 1;
xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-scripts ...");
}
if ((($::arch eq "x86_64") || ($::arch =~ /ppc/)) && (-f '/etc/xcat/genesis-base-updated')) {
if (-f '/etc/xcat/genesis-base-updated') {
unlink '/etc/xcat/genesis-base-updated';
$cmd = "$::XCATROOT/sbin/mknb $::arch";
xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-base-$::arch ...");
}
# my $outref = xCAT::Utils->runcmd("$cmd", 0);
if ($cmd) {
system($cmd);
if ($? != 0) {
my $rc = $? >> 8;
xCAT::MsgUtils->message('E', "The 'mknb $::arch' command returned error code: $rc.");
unless ($run_mknb) {
$run_mknb = 1;
xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-base ...");
}
else {
xCAT::MsgUtils->message('I', "The 'mknb $::arch' command completed successfully.");
}
if ($run_mknb) {
foreach (qw(ppc64 x86_64)) {
system("$cmd $_");
if ($? != 0) {
my $rc = $? >> 8;
xCAT::MsgUtils->message('E', "The 'mknb $_' command returned error code: $rc.");
}
else {
xCAT::MsgUtils->message('I', "The 'mknb $_' command completed successfully.");
}
}
}
}
@@ -17,3 +17,4 @@ cairo
gcc
createrepo
libnl
ethtool
@@ -1,6 +1,6 @@
#INCLUDE:compute.rhels7.pkglist#
#For Cuda 7.5
#For Cuda
kernel-devel
gcc
pciutils
@@ -1,9 +1,12 @@
#INCLUDE:compute.rhels7.pkglist#
#For Cuda 7.5
#For Cuda
kernel-devel
gcc
pciutils
dkms
cuda-runtime-7-5
#To install cuda-runtime-7-5
#cuda-runtime-7-5
#To install cuda-runtime-8-0
cuda-runtime-8-0
@@ -12,3 +12,6 @@ ntp
sysklogd
rpm
rsync
tar
gzip
xz
@@ -16,3 +16,6 @@ parted
bc
ntp
rsyslog
tar
gzip
xz
@@ -8,3 +8,6 @@ openssh-clients
busybox-anaconda
wget
rsync
tar
gzip
xz
@@ -17,3 +17,6 @@ qemu-kvm
e2fsprogs
parted
bc
tar
gzip
xz
@@ -10,3 +10,6 @@ vim
ntp
rsyslog
rsync
tar
gzip
xz-utils
@@ -12,3 +12,6 @@ ntp
rpm
rsync
rsyslog
tar
gzip
xz
@@ -12,3 +12,6 @@ ntp
rpm
rsync
rsyslog
tar
gzip
xz
@@ -10,3 +10,6 @@ wget
ntp
vim-minimal
rsync
tar
gzip
xz
@@ -9,3 +9,6 @@ openssh-server
openssh-clients
wget
rsync
tar
gzip
xz
@@ -23,3 +23,6 @@ unixODBC
perl-DBD-MySQL
mysql-connector-odbc
perl-DBD-Pg
tar
gzip
xz
@@ -9,3 +9,6 @@ wget
ntp
vim-minimal
rsync
tar
gzip
xz
@@ -9,3 +9,6 @@ openssh-server
openssh-clients
wget
rsync
tar
gzip
xz
@@ -19,3 +19,6 @@ wget
vsftpd
ntp
rsync
tar
gzip
xz
@@ -14,3 +14,4 @@ rpm
rsync
tar
gzip
xz
@@ -14,3 +14,6 @@ rpm
rsync
ppc64-utils
iputils
tar
gzip
xz
@@ -14,3 +14,6 @@ rpm
rsync
busybox
util-linux
tar
gzip
xz
@@ -15,3 +15,6 @@ rpm
rsync
udev
s390utils
tar
gzip
xz
@@ -12,3 +12,6 @@ ntp
rpm
rsync
rsyslog
tar
gzip
xz
@@ -22,3 +22,6 @@ bc
lsvpd
irqbalance
procps
tar
gzip
xz
@@ -14,3 +14,6 @@ rsync
rsyslog
udev
s390utils
tar
gzip
xz
@@ -20,3 +20,6 @@ rsync
rsyslog
e2fsprogs
parted
tar
gzip
xz
@@ -14,3 +14,6 @@ sysklogd
rpm
rsync
db4-utils
tar
gzip
xz
@@ -15,3 +15,6 @@ rpm
rsync
ppc64-utils
iputils
tar
gzip
xz
@@ -15,3 +15,4 @@ rsyslog
e2fsprogs
gzip
tar
xz
@@ -26,3 +26,4 @@ procps
parted
gzip
tar
xz
@@ -22,3 +22,4 @@ e2fsprogs
parted
gzip
tar
xz
@@ -26,3 +26,7 @@ parted
net-tools
gzip
tar
xz
grub2
grub2-tools
bzip2
@@ -32,6 +32,13 @@ END
#cons:12345:respawn:/sbin/smart_agetty -L 38400 console
echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab
#-- Disable SELinux in the rootimg
#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default
#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy"
if [ -f "$installroot/etc/selinux/config" ]
then
sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config
fi
#-- Example of booted image versioning
#-- We want to know, with what configuration (version of the image) each node was booted.
@@ -21,3 +21,4 @@ parted
net-tools
gzip
tar
xz
@@ -32,6 +32,14 @@ END
#echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab
#-- Disable SELinux in the rootimg
#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default
#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy"
if [ -f "$installroot/etc/selinux/config" ]
then
sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config
fi
#-- Example of booted image versioning
#-- We want to know, with what configuration (version of the image) each node was booted.
#-- Hence, we keep image definition files and postscripts in CVS. During image generation we create file /etc/IMGVERSION and fill it with CVS "$Id$" of files with image definition (.pkglist, .exlist, .repolist, .postinstall). Then, during boot, each "CVS enabled" postscript (see /install/postscripts/cvs_template.sh and /install/postscripts/cvs_template.pl) adds one line to /etc/IMGVERSION. Then you can determine in any time what image you are running and what postscipts in which versions were run.
@@ -1,5 +1,5 @@
#For Cuda 7.5
#For Cuda
kernel-devel
gcc
pciutils
@@ -1,8 +1,11 @@
#For Cuda 7.5
#For Cuda
kernel-devel
gcc
pciutils
dkms
cuda-runtime-7-5
#To install cuda-runtime-7-5
#cuda-runtime-7-5
#To install cuda-runtime-8-0
cuda-runtime-8-0
@@ -1,6 +1,6 @@
#!/bin/sh
echo $drivers
dracut_install wget tar cpio gzip dash modprobe touch echo cut wc
dracut_install wget tar cpio gzip dash modprobe touch echo cut wc xz
dracut_install -o ctorrent
dracut_install grep ifconfig hostname awk egrep grep dirname expr
dracut_install mount.nfs
@@ -67,8 +67,8 @@ if [ -r /rootimg.sfs ]; then
mkdir -p $NEWROOT/rw
mount --move /ro $NEWROOT/ro
mount --move /rw $NEWROOT/rw
elif [ -r /rootimg.gz ]; then
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.gz downloaded,setting up RAM-root tmpfs...."
elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...."
echo Setting up RAM-root tmpfs.
if [ -z $rootlimit ];then
mount -t tmpfs -o mode=755 rootfs $NEWROOT
@@ -79,15 +79,23 @@ elif [ -r /rootimg.gz ]; then
cd $NEWROOT
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:"
echo -n "Extracting root filesystem:"
if [ -x /bin/cpio ]; then
gzip -cd /rootimg.gz |/bin/cpio -idum
else
gzip -cd /rootimg.gz |cpio -idum
if [ -r /rootimg.cpio.gz ]; then
if [ -x /bin/cpio ]; then
gzip -cd /rootimg.cpio.gz |/bin/cpio -idum
else
gzip -cd /rootimg.cpio.gz |cpio -idum
fi
elif [ -r /rootimg.cpio.xz ]; then
if [ -x /bin/cpio ]; then
xz -cd /rootimg.cpio.xz |/bin/cpio -idum
else
xz -cd /rootimg.cpio.xz |cpio -idum
fi
fi
$NEWROOT/etc/init.d/localdisk
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...."
echo Done
elif [ -r /rootimg.tgz ]; then
elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then
echo Setting up RAM-root tmpfs.
if [ -z $rootlimit ];then
mount -t tmpfs -o mode=755 rootfs $NEWROOT
@@ -97,7 +105,17 @@ elif [ -r /rootimg.tgz ]; then
cd $NEWROOT
echo -n "Extracting root filesystem:"
tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz
if [ -r /rootimg.tar.gz ]; then
tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz
if [ $? -ne 0 ]; then
tar --selinux -zxf /rootimg.tar.gz
fi
elif [ -r /rootimg.tar.xz ]; then
tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz
if [ $? -ne 0 ]; then
tar --selinux -Jxf /rootimg.tar.xz
fi
fi
$NEWROOT/etc/init.d/localdisk
echo Done
elif [ -r /rootimg-statelite.gz ]; then
@@ -1,6 +1,6 @@
#!/bin/sh
echo $drivers
dracut_install wget tar cpio gzip modprobe touch echo cut wc
dracut_install wget tar cpio gzip modprobe touch echo cut wc xz
dracut_install grep ifconfig hostname awk egrep grep dirname expr
dracut_install mount.nfs
dracut_install parted mke2fs bc mkswap swapon chmod
@@ -69,8 +69,8 @@ if [ -r /rootimg.sfs ]; then
mkdir -p $NEWROOT/rw
mount --move /ro $NEWROOT/ro
mount --move /rw $NEWROOT/rw
elif [ -r /rootimg.gz ]; then
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.gz downloaded,setting up RAM-root tmpfs...."
elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...."
echo Setting up RAM-root tmpfs.
if [ -z $rootlimit ];then
mount -t tmpfs -o mode=755 rootfs $NEWROOT
@@ -81,16 +81,24 @@ elif [ -r /rootimg.gz ]; then
cd $NEWROOT
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:"
echo -n "Extracting root filesystem:"
if [ -x /bin/cpio ]; then
gzip -cd /rootimg.gz |/bin/cpio -idum
else
gzip -cd /rootimg.gz |cpio -idum
if [ -r /rootimg.cpio.gz ]; then
if [ -x /bin/cpio ]; then
gzip -cd /rootimg.cpio.gz |/bin/cpio -idum
else
gzip -cd /rootimg.cpio.gz |cpio -idum
fi
elif [ -r /rootimg.cpio.xz ]; then
if [ -x /bin/cpio ]; then
xz -cd /rootimg.cpio.xz |/bin/cpio -idum
else
xz -cd /rootimg.cpio.xz |cpio -idum
fi
fi
$NEWROOT/etc/init.d/localdisk
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...."
echo Done
elif [ -r /rootimg.tgz ]; then
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.tgz downloaded,setting up RAM-root tmpfs...."
elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...."
echo Setting up RAM-root tmpfs.
if [ -z $rootlimit ];then
mount -t tmpfs -o mode=755 rootfs $NEWROOT
@@ -101,7 +109,17 @@ elif [ -r /rootimg.tgz ]; then
cd $NEWROOT
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:"
echo -n "Extracting root filesystem:"
tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz
if [ -r /rootimg.tar.gz ]; then
tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz
if [ $? -ne 0 ]; then
tar --selinux -zxf /rootimg.tar.gz
fi
elif [ -r /rootimg.tar.xz ]; then
tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz
if [ $? -ne 0 ]; then
tar --selinux -Jxf /rootimg.tar.xz
fi
fi
$NEWROOT/etc/init.d/localdisk
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...."
echo Done
+27 -9
View File
@@ -70,7 +70,7 @@ my $noupdate;
sub xdie {
system("rm -rf /tmp/xcatinitrd.$$");
umount_chroot($rootimage_dir);
umount_chroot($rootimg_dir);
die @_;
}
@@ -1606,7 +1606,7 @@ if [ -r /rootimg.sfs ]; then
mount --move /ro \$NEWROOT/ro
mount --move /rw \$NEWROOT/rw
EOMS
print $inifile "elif [ -r /rootimg.gz ]; then\n";
print $inifile "elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then\n";
print $inifile "echo Setting up RAM-root tmpfs.\n";
if ($rootlimit) {
print $inifile " mount -o size=$rootlimit,mode=755 -t tmpfs rootfs \$NEWROOT\n";
@@ -1615,13 +1615,21 @@ EOMS
}
print $inifile " cd \$NEWROOT\n";
print $inifile " echo -n \"Extracting root filesystem:\"\n";
print $inifile " if [ -x /bin/cpio ]; then\n";
print $inifile " zcat /rootimg.gz |/bin/cpio -idum\n";
print $inifile " else\n";
print $inifile " zcat /rootimg.gz |cpio -idum\n";
print $inifile " if [ -r /rootimg.cpio.gz ]; then\n";
print $inifile " if [ -x /bin/cpio ]; then\n";
print $inifile " zcat /rootimg.cpio.gz |/bin/cpio -idum\n";
print $inifile " else\n";
print $inifile " zcat /rootimg.cpio.gz |cpio -idum\n";
print $inifile " fi\n";
print $inifile " elif [ -r /rootimg.cpio.xz ]; then\n";
print $inifile " if [ -x /bin/cpio ]; then\n";
print $inifile " xz -cd /rootimg.cpio.xz |/bin/cpio -idum\n";
print $inifile " else\n";
print $inifile " xz -cd /rootimg.cpio.xz |cpio -idum\n";
print $inifile " fi\n";
print $inifile " fi\n";
print $inifile " echo Done\n";
print $inifile "elif [ -r /rootimg.tgz ]; then\n";
print $inifile "elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then\n";
print $inifile " echo Setting up RAM-root tmpfs.\n";
if ($rootlimit) {
@@ -1631,7 +1639,17 @@ EOMS
}
print $inifile " cd \$NEWROOT\n";
print $inifile " echo -n \"Extracting root filesystem:\"\n";
print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz\n";
print $inifile " if [ -r /rootimg.tar.gz ]; then\n";
print $inifile " tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz\n";
print $inifile " if [ \$? -ne 0 ]; then\n";
print $inifile " tar --selinux -zxf /rootimg.tar.gz\n";
print $inifile " fi\n";
print $inifile " elif [ -r /rootimg.tar.xz ]; then\n";
print $inifile " tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz\n";
print $inifile " if [ \$? -ne 0 ]; then\n";
print $inifile " tar --selinux -Jxf /rootimg.tar.xz\n";
print $inifile " fi\n";
print $inifile " fi\n";
print $inifile " echo Done\n";
print $inifile "else\n";
print $inifile " echo -n Failed to download image, panicing in 5...\n";
@@ -1708,7 +1726,7 @@ EOMS
}
# add rsync for statelite
foreach ("bin/cpio", "sbin/nash", "sbin/busybox.anaconda", "sbin/rmmod", "bin/bash", "usr/sbin/chroot", "sbin/mount.nfs", "usr/bin/rsync", "usr/bin/wc", "usr/bin/gzip", "usr/bin/tar") {
foreach ("bin/cpio", "sbin/nash", "sbin/busybox.anaconda", "sbin/rmmod", "bin/bash", "usr/sbin/chroot", "sbin/mount.nfs", "usr/bin/rsync", "usr/bin/wc", "usr/bin/xz", "usr/bin/gzip", "usr/bin/tar") {
getlibs($_);
push @filestoadd, $_;
}
@@ -23,3 +23,6 @@ python-urlgrabber.noarch
python-virtinst
screen
xnba-kvm
tar
gzip
xz
@@ -17,3 +17,6 @@ qemu-kvm
e2fsprogs
parted
bc
tar
gzip
xz
@@ -12,3 +12,6 @@ ntp
sysklogd
rpm
rsync
tar
gzip
xz
@@ -13,6 +13,9 @@ ksh
nfs-utils
dhcp
bzip2
tar
gzip
xz
rootfiles
vixie-cron
wget

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