2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-09-28 13:08:32 +00:00

Merge pull request #3988 from xcat2/master

Merge master to 2.13 branch for 2.13.7 release(3)
This commit is contained in:
zet809
2017-09-21 18:12:35 +08:00
committed by GitHub
19 changed files with 264 additions and 243 deletions

View File

@@ -0,0 +1,85 @@
Enabling the localdisk Option
-----------------------------
``Note``: You can skip this section if not using the ``localdisk`` option in your litefile table.
Several things need to be done to enable the 'localdisk' support:
Define how to partition the local disk
``````````````````````````````````````
When a node is deployed, the local hard disk needs to be partitioned and formatted before it can be used. This section explains how provide a configuration file that tells xCAT to partition a local disk and make it ready to use for the directories listed in the litefile table with the ``localdisk`` option.
The configuration file needs to be specified in the ``partitionfile`` attribute of the osimage definition. The configuration file includes several parts:
* Global parameters to control enabling or disabling the function
* [disk] part to control the partitioning of the disk
* [localspace] part to control which partition will be used to store the localdisk directories listed in the litefile table
* [swapspace] part to control the enablement of the swap space for the node.
An example localdisk configuration file: ::
enable=yes
enablepart=no
[disk]
dev=/dev/sdb
clear=yes
parts=100M-200M,1G-2G
[disk]
dev=/dev/sda
clear=yes
parts=10,20,30
[disk]
dev=/dev/sdc
clear=yes
parts=10,20,30
[localspace]
dev=/dev/sda1
fstype=ext3
[swapspace]
dev=/dev/sda2
The two global parameters ``enable`` and ``enablepart`` can be used to control the enabling/disabling of the functions:
* enable: The localdisk feature only works when ``enable`` is set to *yes*. If it is set to *no*, the localdisk configuration will not be run.
* enablepart: The partition action (refer to the ``[disk]`` section) will be run only when ``enablepart=yes``.
The ``[disk]`` section is used to configure how to partition a hard disk:
* dev: The path of the device file.
* clear: If set to ``yes`` it will clear all the existing partitions on this disk.
* fstype: The file system type for the new created partitions. ``ext3`` is the default value if not set.
* parts: A comma separated list of space ranges, one for each partition that will be created on the device. The valid format for each space range is ``<startpoint>-<endpoint>`` or ``<percentage of the disk>``. For example, you could set it to ``100M-10G`` or ``50``. If you set it to ``50``, that means 50% of the disk space will be assigned to that partition.
The ``[localspace]`` section is used to specify which partition will be used as local storage for the node.
* dev: The path of the partition.
* fstype: The file system type on the partition.
the ``[swapspace]`` section is used to configure the swap space for the statelite node.
* dev: The path of the partition file which will be used as the swap space.
To enable the local disk capability, create the configuration file (for example in ``/install/custom``) and set the path in the partitionfile attribute for the osimage: ::
chdef -t osimage partitionfile=/install/custom/cfglocaldisk
Now all nodes that use this osimage (i.e. have their provmethod attribute set to this osimage definition name), will have its local disk configured.
Configure the files in the litefile table
`````````````````````````````````````````
For the files/directories that you would like xCAT to store on the local disk, add an entry in the litefile table like this: ::
"ALL","/tmp/","localdisk",,
``Note``: you do not need to specify the swap space in the litefile table. Just putting it in the partitionfile config file is enough.
Add an entry in policy table to permit the running of the ``getpartitioin`` command from the node ::
chtab priority=7.1 policy.commands=getpartition policy.rule=allow

View File

@@ -31,8 +31,13 @@ Define attributes in the ``nics`` table
chdef cn1 nicips.bond0.1=40.0.0.1 nictypes.bond0.1=vlan
#. Define ``nicnetworks`` for ``bond0.1`` ::
chdef cn1 nicnetworks.bond0.1=net40
#. Define ``nichostnamesuffixes`` for ``bond0.1`` in case ``makehosts`` to update ``/etc/hosts``, since the value for ``nichostnamesuffixes`` cannot contain ".", other characters are recommended instead of ".", like following: ::
chdef cn1 nichostnamesuffixes.bond0.1=-bond0-1
Enable ``confignetwork`` to configure bridge
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -31,6 +31,10 @@ Define attributes in the ``nics`` table
chdef cn1 nicnetworks.eth0.6=net60 nicnetworks.eth0.7=net70
#. Define ``nichostnamesuffixes`` for ``eth0.6`` and ``eth0.7`` in case ``makehosts`` to update ``/etc/hosts``, since the value for ``nichostnamesuffixes`` cannot contain ".", other characters are recommended instead of ".", like following: ::
chdef cn1 nichostnamesuffixes.eth0.6=-eth0-6 nichostnamesuffixes.eth0.7=-eth0-7
Enable ``confignetwork`` to configure VLAN
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -12,7 +12,7 @@ The following example outlines the MTMS based hardware discovery for a single IP
+------------------------------+------------+
| Hostname | cn01 |
+------------------------------+------------+
| IP address | 10.1.2.1 |
| IP address | 10.0.101.1 |
+------------------------------+------------+
The BMC IP address is obtained by the open range dhcp server and the plan in this scenario is to change the IP address for the BMC to a static IP address in a different subnet than the open range addresses. The static IP address in this example is in the same subnet as the open range to simplify the networking configuration on the xCAT management node.
@@ -20,9 +20,9 @@ The BMC IP address is obtained by the open range dhcp server and the plan in thi
+------------------------------+------------+
| BMC Information | Value |
+==============================+============+
| IP address - dhcp | 172.30.0.1 |
| IP address - dhcp | 50.0.100.1 |
+------------------------------+------------+
| IP address - static | 172.20.2.1 |
| IP address - static | 50.0.101.1 |
+------------------------------+------------+
#. Detect the BMCs and add the node definitions into xCAT.
@@ -44,9 +44,9 @@ The BMC IP address is obtained by the open range dhcp server and the plan in thi
Use the ``bmcdiscover`` command to help discover the nodes over an IP range and easily create a starting file to define the compute nodes into xCAT.
To discover the compute nodes for the BMCs with an IP address of 172.30.0.1, use the command: ::
To discover the compute nodes for the BMCs with an IP address of 50.0.100.1, use the command: ::
bmcdiscover --range 172.30.0.1 -z > predefined.stanzas
bmcdiscover --range 50.0.100.1 -z > predefined.stanzas
The discovered nodes have the naming convention: node-<*model-type*>-<*serial-number*> ::
@@ -54,7 +54,7 @@ The BMC IP address is obtained by the open range dhcp server and the plan in thi
node-8247-22l-10112ca:
objtype=node
groups=all
bmc=172.30.0.1
bmc=50.0.100.1
cons=ipmi
mgt=ipmi
mtm=8247-22L
@@ -73,7 +73,7 @@ The BMC IP address is obtained by the open range dhcp server and the plan in thi
#. Add a ``ip`` attribute and give it the compute node IP address: ::
ip=10.1.2.1
ip=10.0.101.1
#. Remove ``nodetype`` and ``hwtype`` if defined in the ``predefined.stanza``.
@@ -86,12 +86,12 @@ The BMC IP address is obtained by the open range dhcp server and the plan in thi
cn01:
objtype=node
groups=all
bmc=172.30.0.1
bmc=50.0.100.1
cons=ipmi
mgt=ipmi
mtm=8247-22L
serial=10112CA
ip=10.1.2.1
ip=10.0.101.1
#. Define the compute nodes into xCAT: ::
@@ -109,9 +109,9 @@ The BMC IP address is obtained by the open range dhcp server and the plan in thi
Set the BMC IP address to a different value for the **predefined** compute node definitions.
To change the dhcp obtained IP address of 172.30.0.1 to a static IP address of 172.20.2.1, run the following command: ::
To change the dhcp obtained IP address of 50.0.100.1 to a static IP address of 50.0.101.1, run the following command: ::
chdef cn01 bmc=172.20.2.1
chdef cn01 bmc=50.0.101.1
#. Add the compute node IP information to ``/etc/hosts``: ::

View File

@@ -12,7 +12,7 @@ The following example outlines the MTMS based hardware discovery for a single IP
+------------------------------+------------+
| Hostname | cn01 |
+------------------------------+------------+
| IP address | 10.1.2.1 |
| IP address | 10.0.101.1 |
+------------------------------+------------+
The BMC IP address is obtained by the open range dhcp server and the plan is to leave the IP address the same, except we want to change the IP address to be static in the BMC.
@@ -20,9 +20,9 @@ The BMC IP address is obtained by the open range dhcp server and the plan is to
+------------------------------+------------+
| BMC Information | Value |
+==============================+============+
| IP address - dhcp | 172.30.0.1 |
| IP address - dhcp | 50.0.100.1 |
+------------------------------+------------+
| IP address - static | 172.30.0.1 |
| IP address - static | 50.0.100.1 |
+------------------------------+------------+
@@ -30,9 +30,9 @@ The BMC IP address is obtained by the open range dhcp server and the plan is to
Use the ``bmcdiscover`` command to help discover the nodes over an IP range and easily create a starting file to define the compute nodes into xCAT.
To discover the compute nodes for the BMCs with an IP address of 172.30.0.1, use the command: ::
To discover the compute nodes for the BMCs with an IP address of 50.0.100.1, use the command: ::
bmcdiscover --range 172.30.0.1 -z > predefined.stanzas
bmcdiscover --range 50.0.100.1 -z > predefined.stanzas
The discovered nodes have the naming convention: node-<*model-type*>-<*serial-number*> ::
@@ -40,7 +40,7 @@ The BMC IP address is obtained by the open range dhcp server and the plan is to
node-8247-22l-10112ca:
objtype=node
groups=all
bmc=172.30.0.1
bmc=50.0.100.1
cons=ipmi
mgt=ipmi
mtm=8247-22L
@@ -59,7 +59,7 @@ The BMC IP address is obtained by the open range dhcp server and the plan is to
#. Add a ``ip`` attribute and give it the compute node IP address: ::
ip=10.1.2.1
ip=10.0.101.1
#. Repeat for additional nodes in the ``predefined.stanza`` file based on the MTMS mapping.
@@ -70,13 +70,16 @@ The BMC IP address is obtained by the open range dhcp server and the plan is to
cn01:
objtype=node
groups=all
bmc=172.30.0.1
bmc=50.0.100.1
cons=ipmi
mgt=ipmi
mtm=8247-22L
serial=10112CA
ip=10.1.2.1
ip=10.0.101.1
#. Define the compute nodes into xCAT: ::
cat predefined.stanzas | mkdef -z
#. Set the chain table to run the ``bmcsetup`` script, this will set the BMC IP to static. ::
@@ -86,10 +89,6 @@ The BMC IP address is obtained by the open range dhcp server and the plan is to
chdef cn01 -p chain="osimage=<osimage_name>"
#. Define the compute nodes into xCAT: ::
cat predefined.stanzas | mkdef -z
#. Add the compute node IP information to ``/etc/hosts``: ::
makehosts cn01

View File

@@ -15,3 +15,4 @@ Optional means all the subitems in this page are not necessary to finish an OS d
install_new_kernel.rst
acc_initrd_rootimg_gen_ppc64le.rst
trim_diskless_rootimg.rst
localdisk.rst

View File

@@ -0,0 +1 @@
.. include:: ../../../common/deployment/enable_localdisk.rst

View File

@@ -0,0 +1,6 @@
.. include:: ../../../common/deployment/enable_localdisk.rst
``Note``:
* `localdisk` feature won't syncronize the files/directories defined in `litefile` table from diskless image to local disk at the node boot time. It might casue issue to the application which depends on some of those directories. For example, the ``httpd`` service cannot be started if ``/var/log/`` is defined in `litefile` table. To work around this, you may copy the required contents to local disk and restart service manually at the first time.
* To keep the contents on local disk after you use ``enablepart=yes`` to do partitioin, make sure to set ``enablepart=no`` in partitioin configuration file after the node is booted.

View File

@@ -162,91 +162,7 @@ Obtain you new kernel and kernel modules on the MN, for example here we have a n
uname -a
Enabling the localdisk Option
-----------------------------
``Note``: You can skip this section if not using the ``localdisk`` option in your litefile table.
Several things need to be done to enable the 'localdisk' support:
Define how to partition the local disk
``````````````````````````````````````
When a node is deployed, the local hard disk needs to be partitioned and formatted before it can be used. This section explains how provide a configuration file that tells xCAT to partition a local disk and make it ready to use for the directories listed in the litefile table with the ``localdisk`` option.
The configuration file needs to be specified in the ``partitionfile`` attribute of the osimage definition. The configuration file includes several parts:
* Global parameters to control enabling or disabling the function
* [disk] part to control the partitioning of the disk
* [localspace] part to control which partition will be used to store the localdisk directories listed in the litefile table
* [swapspace] part to control the enablement of the swap space for the node.
An example localdisk configuration file: ::
enable=yes
enablepart=no
[disk]
dev=/dev/sdb
clear=yes
parts=100M-200M,1G-2G
[disk]
dev=/dev/sda
clear=yes
parts=10,20,30
[disk]
dev=/dev/sdc
clear=yes
parts=10,20,30
[localspace]
dev=/dev/sda1
fstype=ext3
[swapspace]
dev=/dev/sda2
The two global parameters ``enable`` and ``enablepart`` can be used to control the enabling/disabling of the functions:
* enable: The localdisk feature only works when ``enable`` is set to *yes*. If it is set to *no*, the localdisk configuration will not be run.
* enablepart: The partition action (refer to the ``[disk]`` section) will be run only when ``enablepart=yes``.
The ``[disk]`` section is used to configure how to partition a hard disk:
* dev: The path of the device file.
* clear: If set to ``yes`` it will clear all the existing partitions on this disk.
* fstype: The file system type for the new created partitions. ``ext3`` is the default value if not set.
* parts: A comma separated list of space ranges, one for each partition that will be created on the device. The valid format for each space range is ``<startpoint>-<endpoint>`` or ``<percentage of the disk>``. For example, you could set it to ``100M-10G`` or ``50``. If you set it to ``50``, that means 50% of the disk space will be assigned to that partition.
The ``[localspace]`` section is used to specify which partition will be used as local storage for the node.
* dev: The path of the partition.
* fstype: The file system type on the partition.
the ``[swapspace]`` section is used to configure the swap space for the statelite node.
* dev: The path of the partition file which will be used as the swap space.
To enable the local disk capability, create the configuration file (for example in ``/install/custom``) and set the path in the partitionfile attribute for the osimage: ::
chdef -t osimage partitionfile=/install/custom/cfglocaldisk
Now all nodes that use this osimage (i.e. have their provmethod attribute set to this osimage definition name), will have its local disk configured.
Configure the files in the litefile table
`````````````````````````````````````````
For the files/directories that you would like xCAT to store on the local disk, add an entry in the litefile table like this: ::
"ALL","/tmp/","localdisk",,
``Note``: you do not need to specify the swap space in the litefile table. Just putting it in the partitionfile config file is enough.
Add an entry in policy table to permit the running of the ``getpartitioin`` command from the node ::
chtab priority=7.1 policy.commands=getpartition policy.rule=allow
.. include:: ../../common/deployment/enable_localdisk.rst
If Using the RAMdisk-based Image
````````````````````````````````

View File

@@ -14,14 +14,26 @@ xCAT 2.13.x
|xCAT |New OS |New |New Feature |
|Version | |Hardware | |
+=================================+===============+=============+==================================+
|| xCAT 2.13.6 |- RHEL 7.4 |-Boston |- OpenBMC support |
|| 2017/8/10 | | server | |
|| xCAT 2.13.7 | | |- OpenBMC support: |
|| 2017/9/22 | | | |
|| | | | rflash for OpenBMC and PNOR |
| `2.13.7 Release Notes <https:// | | | |
| github.com/xcat2/xcat-core/wiki | | | reventlog to get/clear event log|
| /XCAT_2.13.7_Release_Notes>`_ | | | |
| | | |- xcatprobe clusterstatus enhance |
| | | | |
| | | |- PDU support: discover, config |
| | | | |
| | | |- SRIOV support for VMs |
+---------------------------------+---------------+-------------+----------------------------------+
|| xCAT 2.13.6 |- RHEL 7.4 |- Boston |- OpenBMC support |
|| 2017/8/10 | | server | |
|| | | | rsetboot net/hd/def |
| `2.13.6 Release Notes <https:// | | | |
| github.com/xcat2/xcat-core/wiki | | | rflash list/upload/activate |
| /XCAT_2.13.6_Release_Notes>`_ | | | /delete/check |
| | | | |
| | | | rspconfig retrieve OpenBCM ip/ |
| | | | rspconfig retrieve OpenBMC ip/ |
| | | | netmask/gateway information |
| | | |- nodeset performance enhancement |
| | | | (Phase 3) |

View File

@@ -1970,24 +1970,6 @@ sub do_firmware_update {
}
}
}
if (defined $directory_name) {
unless (File::Spec->file_name_is_absolute($directory_name)) {
# Directory name was passed in as relative path, prepend current working dir
$directory_name = xCAT::Utils->full_path($directory_name, $::cwd);
}
# directory was passed in, verify it is valid
if (-d $directory_name) {
# Passed in directory name exists
$pUpdate_directory = $directory_name;
}
else {
$exit_with_error_func->($sessdata->{node}, $callback, "Can not access data directory $directory_name");
}
}
else {
$exit_with_error_func->($sessdata->{node}, $callback, "Data directory must be specified.");
}
}
# For IBM Power S822LC for Big Data (Supermicro) machines such as
@@ -1996,11 +1978,23 @@ sub do_firmware_update {
# specified data directory along with the update files .bin for BMC or .pnor for Host
if ($output =~ /8001-22C|9006-22C|5104-22C|9006-12C/) {
# Verify valid data directory was specified
unless ($pUpdate_directory) {
$exit_with_error_func->($sessdata->{node}, $callback,
"Directory name is required to update Boston or Briggs machines.");
if (defined $directory_name) {
unless (File::Spec->file_name_is_absolute($directory_name)) {
# Directory name was passed in as relative path, prepend current working dir
$directory_name = xCAT::Utils->full_path($directory_name, $::cwd);
}
# directory was passed in, verify it is valid
if (-d $directory_name) {
# Passed in directory name exists
$pUpdate_directory = $directory_name;
}
else {
$exit_with_error_func->($sessdata->{node}, $callback, "Can not access data directory $directory_name");
}
}
else {
$exit_with_error_func->($sessdata->{node}, $callback, "Directory name is required to update IBM Power S822LC for Big Data machines.");
}
# Verify specified directory contains pUpdate utility
unless (-e "$pUpdate_directory/pUpdate") {
$exit_with_error_func->($sessdata->{node}, $callback,
@@ -2126,7 +2120,7 @@ sub do_firmware_update {
$exit_with_error_func->($sessdata->{node}, $callback,
"Running ipmitool command $cmd failed: $output");
}
my $grs_version = $output =~ /OP8_v(\d*\.\d*_\d*\.\d*)/;
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;
@@ -2148,7 +2142,7 @@ sub do_firmware_update {
"Running ipmitool command $cmd failed: $output");
}
# Check what firmware version is currently running on the machine
if ($output =~ /OP8_v\d\.\d+_(\d+)\.\d+/) {
if ($output =~ /OP8_.*v\d\.\d+_(\d+)\.\d+/) {
my $frs_version = $1;
if ($frs_version == 1) {
$firestone_update_version = "810";
@@ -2189,7 +2183,7 @@ sub do_firmware_update {
}
}
if ($is_firestone and
if ($is_firestone and $firestone_update_version and
(($firestone_update_version eq "820" and $htm_update_version eq "810") or
($firestone_update_version eq "810" and $htm_update_version eq "820"))
) {

View File

@@ -248,8 +248,16 @@ sub process_request {
#for onie switch, lookup and set the switchtype via mac of mgt interface
my $switchestab = xCAT::Table->new('switches');
if ($switchestab) {
my $switchtype=$xCAT::data::switchinfo::global_mac_identity{substr(lc($request->{_xcat_clientmac}->[0]),0,8)};
if(defined $switchtype){
my $switchtype;
my $switchvendor=$xCAT::data::switchinfo::global_mac_identity{substr(lc($request->{_xcat_clientmac}->[0]),0,8)};
if(defined $switchvendor){
my $search_string = join '|', keys(%xCAT::data::switchinfo::global_switch_type);
if ($switchvendor =~ /($search_string)/) {
$switchtype=$xCAT::data::switchinfo::global_switch_type{$1};
}
}
if($switchtype){
$switchestab->setNodeAttribs($node,{ switchtype => $switchtype });
}
$switchestab->close();

View File

@@ -138,8 +138,8 @@ my %status_info = (
},
REVENTLOG_CLEAR_REQUEST => {
method => "POST",
init_url => "$openbmc_project_url/logging//action/delete",
data => '{ "data": [] }',
init_url => "$openbmc_project_url/logging/action/deleteAll",
data => "[]",
},
REVENTLOG_CLEAR_RESPONSE => {
process => \&reventlog_response,
@@ -240,11 +240,6 @@ my %status_info = (
init_url => "$openbmc_project_url/state/host0/attr/RequestedHostTransition",
data => "xyz.openbmc_project.State.Host.Transition.Off",
},
RPOWER_RESET_REQUEST => {
method => "PUT",
init_url => "$openbmc_project_url/state/host0/attr/RequestedHostTransition",
data => "xyz.openbmc_project.State.Host.Transition.Reboot",
},
RPOWER_RESET_RESPONSE => {
process => \&rpower_response,
},
@@ -258,7 +253,7 @@ my %status_info = (
RSETBOOT_SET_REQUEST => {
method => "PUT",
init_url => "$openbmc_project_url/control/host0/boot_source/attr/BootSource",
init_url => "$openbmc_project_url/control/host0/boot/attr/BootSource",
data => "xyz.openbmc_project.Control.Boot.Source.Sources.",
},
RSETBOOT_SET_RESPONSE => {
@@ -266,7 +261,7 @@ my %status_info = (
},
RSETBOOT_STATUS_REQUEST => {
method => "GET",
init_url => "$openbmc_project_url/control/host0/boot_source",
init_url => "$openbmc_project_url/control/host0/boot",
},
RSETBOOT_STATUS_RESPONSE => {
process => \&rsetboot_response,
@@ -534,7 +529,7 @@ sub parse_args {
return ([ 1, "Error parsing arguments." ]) if ($option !~ /V|verbose/);
}
if (scalar(@ARGV) >= 2 and ($command =~ /rpower|rinv|rsetboot|rvitals/)) {
if (scalar(@ARGV) >= 2 and ($command =~ /rpower|rinv|rvitals/)) {
return ([ 1, "Only one option is supported at the same time for $command" ]);
} elsif (scalar(@ARGV) == 0 and $command =~ /rpower|rspconfig|rflash/) {
return ([ 1, "No option specified for $command" ]);
@@ -550,6 +545,13 @@ sub parse_args {
unless ($subcommand =~ /^on$|^off$|^softoff$|^reset$|^boot$|^bmcreboot$|^bmcstate$|^status$|^stat$|^state$/) {
return ([ 1, "Unsupported command: $command $subcommand" ]);
}
if ($subcommand =~ /^reset$|^boot$/) {
$check = unsupported($callback);
if (ref($check) eq "ARRAY") {
@$check[1] = "Command $command $subcommand is not supported now.\nPlease run 'rpower <node> off' and then 'rpower <node> on' instead.";
return $check;
}
}
} elsif ($command eq "rinv") {
$subcommand = "all" if (!defined($ARGV[0]));
unless ($subcommand =~ /^model$|^serial$|^firm$|^cpu$|^dimm$|^all$/) {
@@ -671,6 +673,8 @@ sub parse_command_status {
my $subcommands = shift;
my $subcommand;
return if ($command eq "getopenbmccons");
if ($$subcommands[-1] and $$subcommands[-1] =~ /V|verbose/) {
$::VERBOSE = 1;
pop(@$subcommands);
@@ -703,19 +707,24 @@ sub parse_command_status {
$next_status{LOGIN_RESPONSE} = "RPOWER_SOFTOFF_REQUEST";
$next_status{RPOWER_SOFTOFF_REQUEST} = "RPOWER_OFF_RESPONSE";
} elsif ($subcommand eq "reset") {
$next_status{LOGIN_RESPONSE} = "RPOWER_RESET_REQUEST";
$next_status{RPOWER_RESET_REQUEST} = "RPOWER_RESET_RESPONSE";
$next_status{LOGIN_RESPONSE} = "RPOWER_STATUS_REQUEST";
$next_status{RPOWER_STATUS_REQUEST} = "RPOWER_STATUS_RESPONSE";
$next_status{RPOWER_STATUS_RESPONSE}{OFF} = "DO_NOTHING";
$next_status{RPOWER_STATUS_RESPONSE}{ON} = "RPOWER_OFF_REQUEST";
$next_status{RPOWER_OFF_REQUEST} = "RPOWER_OFF_RESPONSE";
$next_status{RPOWER_OFF_RESPONSE} = "RPOWER_ON_REQUEST";
$next_status{RPOWER_ON_REQUEST} = "RPOWER_ON_RESPONSE";
$status_info{RPOWER_ON_RESPONSE}{argv} = "$subcommand";
} elsif ($subcommand =~ /^bmcstate$|^status$|^state$|^stat$/) {
$next_status{LOGIN_RESPONSE} = "RPOWER_STATUS_REQUEST";
$next_status{RPOWER_STATUS_REQUEST} = "RPOWER_STATUS_RESPONSE";
$status_info{RPOWER_STATUS_RESPONSE}{argv} = "$subcommand";
} elsif ($subcommand eq "boot") {
$next_status{LOGIN_RESPONSE} = "RPOWER_STATUS_REQUEST";
$next_status{RPOWER_STATUS_REQUEST} = "RPOWER_STATUS_RESPONSE";
$next_status{RPOWER_STATUS_RESPONSE}{OFF} = "RPOWER_ON_REQUEST";
$next_status{LOGIN_RESPONSE} = "RPOWER_OFF_REQUEST";
$next_status{RPOWER_OFF_REQUEST} = "RPOWER_OFF_RESPONSE";
$next_status{RPOWER_OFF_RESPONSE} = "RPOWER_ON_REQUEST";
$next_status{RPOWER_ON_REQUEST} = "RPOWER_ON_RESPONSE";
$next_status{RPOWER_STATUS_RESPONSE}{ON} = "RPOWER_RESET_REQUEST";
$next_status{RPOWER_RESET_REQUEST} = "RPOWER_RESET_RESPONSE";
$status_info{RPOWER_ON_RESPONSE}{argv} = "$subcommand";
} elsif ($subcommand eq "bmcreboot") {
$next_status{LOGIN_RESPONSE} = "RPOWER_BMCREBOOT_REQUEST";
$next_status{RPOWER_BMCREBOOT_REQUEST} = "RPOWER_RESET_RESPONSE";
@@ -747,6 +756,12 @@ sub parse_command_status {
}
if ($command eq "rsetboot") {
if ($$subcommands[-1] and $$subcommands[-1] eq "-o") {
pop(@$subcommands);
$status_info{RSETBOOT_SET_REQUEST}{init_url} = "$openbmc_project_url/control/host0/boot_source/attr/BootSource";
$status_info{RSETBOOT_STATUS_REQUEST}{init_url} = "$openbmc_project_url/control/host0/boot_source";
}
if (defined($$subcommands[0])) {
$subcommand = $$subcommands[0];
} else {
@@ -788,8 +803,6 @@ sub parse_command_status {
if ($subcommand eq "clear") {
$next_status{LOGIN_RESPONSE} = "REVENTLOG_CLEAR_REQUEST";
$next_status{REVENTLOG_CLEAR_REQUEST} = "REVENTLOG_CLEAR_RESPONSE";
xCAT::SvrUtils::sendmsg("Command $command is not available now!", $callback);
return 1;
} else {
$next_status{LOGIN_RESPONSE} = "REVENTLOG_REQUEST";
$next_status{REVENTLOG_REQUEST} = "REVENTLOG_RESPONSE";
@@ -1247,14 +1260,18 @@ sub rpower_response {
if ($node_info{$node}{cur_status} eq "RPOWER_ON_RESPONSE") {
if ($response_info->{'message'} eq $::RESPONSE_OK) {
xCAT::SvrUtils::sendmsg("$::POWER_STATE_ON", $callback, $node);
if ($status_info{RPOWER_ON_RESPONSE}{argv}) {
xCAT::SvrUtils::sendmsg("$::POWER_STATE_RESET", $callback, $node);
} else {
xCAT::SvrUtils::sendmsg("$::POWER_STATE_ON", $callback, $node);
}
$new_status{$::STATUS_POWERING_ON} = [$node];
}
}
if ($node_info{$node}{cur_status} eq "RPOWER_OFF_RESPONSE") {
if ($response_info->{'message'} eq $::RESPONSE_OK) {
xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node);
xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} });
$new_status{$::STATUS_POWERING_OFF} = [$node];
}
}
@@ -1263,8 +1280,6 @@ sub rpower_response {
if ($response_info->{'message'} eq $::RESPONSE_OK) {
if (defined $status_info{RPOWER_RESET_RESPONSE}{argv} and $status_info{RPOWER_RESET_RESPONSE}{argv} =~ /bmcreboot$/) {
xCAT::SvrUtils::sendmsg("BMC $::POWER_STATE_REBOOT", $callback, $node);
} else {
xCAT::SvrUtils::sendmsg("$::POWER_STATE_RESET", $callback, $node);
}
$new_status{$::STATUS_POWERING_ON} = [$node];
}
@@ -1272,7 +1287,8 @@ sub rpower_response {
xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%new_status, 1) if (%new_status);
if ($node_info{$node}{cur_status} eq "RPOWER_STATUS_RESPONSE" and !$next_status{ $node_info{$node}{cur_status} }) {
my $all_status;
if ($node_info{$node}{cur_status} eq "RPOWER_STATUS_RESPONSE") {
my $bmc_state = "";
my $bmc_transition_state = "";
my $chassis_state = "";
@@ -1299,41 +1315,56 @@ sub rpower_response {
xCAT::SvrUtils::sendmsg("BMC $bmc_short_state", $callback, $node);
} else {
if ($chassis_state =~ /Off$/) {
xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node);
xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} });
$all_status = $::POWER_STATE_OFF;
} elsif ($chassis_state =~ /On$/) {
if ($host_state =~ /Off$/) {
# State is off, but check if it is transitioning
if ($host_transition_state =~ /On$/) {
#xCAT::SvrUtils::sendmsg("$::POWER_STATE_POWERING_ON", $callback, $node);
# ignore transition state until get stable firmware
xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node);
xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} });
$all_status = $::POWER_STATE_OFF;
} else {
xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node);
xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} });
$all_status = $::POWER_STATE_OFF;
}
} elsif ($host_state =~ /Quiesced$/) {
xCAT::SvrUtils::sendmsg("$::POWER_STATE_QUIESCED", $callback, $node);
xCAT::SvrUtils::sendmsg("$::POWER_STATE_QUIESCED", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} });
$all_status = $::POWER_STATE_ON;
} elsif ($host_state =~ /Running$/) {
# State is on, but check if it is transitioning
if ($host_transition_state =~ /Off$/) {
#xCAT::SvrUtils::sendmsg("$::POWER_STATE_POWERING_OFF", $callback, $node);
# ignore transition state until get stable firmware
xCAT::SvrUtils::sendmsg("$::POWER_STATE_ON", $callback, $node);
xCAT::SvrUtils::sendmsg("$::POWER_STATE_ON", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} });
$all_status = $::POWER_STATE_ON;
} else {
xCAT::SvrUtils::sendmsg("$::POWER_STATE_ON", $callback, $node);
xCAT::SvrUtils::sendmsg("$::POWER_STATE_ON", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} });
$all_status = $::POWER_STATE_ON;
}
} else {
xCAT::SvrUtils::sendmsg("Unexpected host state=$host_state", $callback, $node);
xCAT::SvrUtils::sendmsg("Unexpected host state=$host_state", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} });
$all_status = $::POWER_STATE_ON;
}
} else {
xCAT::SvrUtils::sendmsg("Unexpected chassis state=$chassis_state", $callback, $node);
xCAT::SvrUtils::sendmsg("Unexpected chassis state=$chassis_state", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} });
$all_status = $::POWER_STATE_ON;
}
}
}
if ($next_status{ $node_info{$node}{cur_status} }) {
if ($node_info{$node}{cur_status} eq "RPOWER_STATUS_RESPONSE") {
if ($response_info->{'data'}->{CurrentHostState} =~ /Off$/) {
$node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }{OFF};
if ($all_status eq "$::POWER_STATE_OFF") {
if ($next_status{ $node_info{$node}{cur_status} }{OFF} eq "DO_NOTHING") {
xCAT::SvrUtils::sendmsg("$::POWER_STATE_RESET", $callback, $node);
$node_info{$node}{cur_status} = "";
$wait_node_num--;
return;
} else {
$node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }{OFF};
}
} else {
$node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }{ON};
}
@@ -1631,12 +1662,14 @@ sub reventlog_response {
my $count = 0;
if ($option_s) {
xCAT::SvrUtils::sendmsg("$::NO_ATTRIBUTES_RETURNED", $callback, $node) if (!%output);
foreach my $key ( sort { $b <=> $a } keys %output) {
xCAT::MsgUtils->message("I", { data => ["$node: $output{$key}"] }, $callback) if ($output{$key});
$count++;
last if ($entry_string ne "all" and $count >= $entry_num);
}
} else {
xCAT::SvrUtils::sendmsg("$::NO_ATTRIBUTES_RETURNED", $callback, $node) if (!%output);
foreach my $key (sort keys %output) {
xCAT::MsgUtils->message("I", { data => ["$node: $output{$key}"] }, $callback) if ($output{$key});
$count++;

View File

@@ -548,11 +548,6 @@ sub rinstall {
arg => \@rpowerarg
);
#TODO: When OPENBMC support is finished, this line should be removed
if($hmkey =~ /^openbmc$/){
$req{environment}{XCAT_OPENBMC_DEVEL} = "YES";
}
my $res =
xCAT::Utils->runxcmd(
\%req,

View File

@@ -339,74 +339,31 @@ sub process_request {
@scan_types = @{$globalopt{scan_types}};
}
my $all_result;
my %username_hash = ();
$result = undef;
foreach my $st (@scan_types) {
no strict;
my $fn = $global_scan_type{$st};
my $tmp_result = &$fn(\%request, $callback);
if (ref($tmp_result) eq 'HASH') {
$all_result->{$st} = $tmp_result;
}
}
#consolidate the results by merging the swithes with the same ip or same mac
my $result;
my $merged;
my $counter=0;
foreach my $st (keys %$all_result) {
my $tmp_result = $all_result->{$st};
#send_msg( \%request, 1, Dumper($tmp_result));
foreach my $old_mac (keys %$tmp_result) {
$same = 0;
foreach my $new_mac (keys %$result) {
my $old_ip = $tmp_result->{$old_mac}->{ip};
my $old_name = $tmp_result->{$old_mac}->{name};
my $old_vendor = $tmp_result->{$old_mac}->{vendor};
my $new_ip = $result->{$new_mac}->{ip};
my $new_name = $result->{$new_mac}->{name};
my $new_vendor = $result->{$new_mac}->{vendor};
my $key =$new_mac;
if (($old_mac eq $new_mac) ||
($old_ip && ($old_ip eq $new_ip))) {
$same = 1;
if ($new_mac =~ /nomac/) {
if ($old_mac =~ /nomac/) {
$key = "nomac_$counter";
$counter++;
} else {
$key = $old_mac;
}
foreach (keys %$tmp_result) {
$result->{$_} = $tmp_result->{$_};
#appending mac address to end of hostname
my $name = $result->{$_}->{name};
if (exists $username_hash{$name}) {
if ($name eq '') {
$name = "$device";
}
if ($old_ip) {
$result->{$key}->{ip} = $old_ip;
}
$result->{$key}->{vendor} = $new_vendor;
if ($old_vendor) {
if ($old_vendor ne $new_vendor) {
$result->{$key}->{vendor} .= " " . $old_vendor;
} else {
$result->{$key}->{vendor} = $old_vendor;
}
}
if ($key ne $new_mac) {
delete $result->{$new_mac};
}
}
if ( $old_name && ($old_name eq $new_name)) {
#appending mac address to end of hostname
my $mac_str = lc($old_mac);
my $mac_str = lc($_);
$mac_str =~ s/\://g;
$result->{$key}->{name} = "$old_name-$mac_str";
$result->{$_}->{name} = "$name-$mac_str";
} else {
$username_hash{$name} = 1;
}
}
if (!$same) {
$result->{$old_mac} = $tmp_result->{$old_mac};
}
}
}
}
if (!($result)) {
send_msg( \%request, 0, " No $device found ");
return;

View File

@@ -265,7 +265,7 @@ elif [ "bridgeprereq" = "$1" ]; then
nwdir="/etc/network/interfaces.d"
isDebian=1
getcap /usr/bin/qemu-system-x86_64 | grep cap_net_admin
if [ $? ne 0 ];then
if [ $? -ne 0 ];then
setcap cap_net_admin=ei /usr/bin/qemu-system-x86_64
fi
else

View File

@@ -27,5 +27,5 @@ rvitals_all
rvitals_noderange_err
reventlog_null
reventlog_all
reventlog_clear
reventlog_numofentries
reventlog_clear

View File

@@ -145,33 +145,38 @@ cmd:rpower $$CN onstandby
cmd:a=0;while ! `rpower $$CN stat|grep "standby\|Standby" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
check:ouptut=~standby|Standby
end
start:rpower__wrongpasswd
start:rpower_wrongpasswd
description:rpower ipmi and openbmc using wrong passwd
Attribute: $$CN-The operation object of rpower command
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh -pt $$CN $$rightbmcpasswd $$rightbmcusername
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh -pt $$CN $$bmcpasswd $$bmcusername
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh -c $$CN
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh -apt $$CN $$rightbmcpasswd $$rightbmcusername
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh -apt $$CN $$bmcpasswd $$bmcusername
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh -c $$CN
check:rc==0
end
start:rpower_suspend_OpenpowerBmc
cmd:rpower $$CN suspend
check:output=~Error: unsupported command rpower suspend for OpenPOWER
check:rc==1
end
start:rpower_softoff_OpenpowerBmc
cmd:rpower $$CN softoff
check:output=~Error: unsupported command rpower softoff for OpenPOWER
check:rc==1
end
start:rpower_wake_OpenpowerBmc
cmd:rpower $$CN wake
check:output=~Error: unsupported command rpower wake for OpenPOWER
check:rc==1
end
start:rpower_errorcommand_OpenpowerBmc
cmd:rpower $$CN ddd
check:output=~Unsupported command:

View File

@@ -1182,18 +1182,18 @@ sub run_case {
#to run single line command
log_this($running_log_fd, "RUN:$cmd->[0] [$runstartstr]");
$cmd->[0] = getfunc($cmd->[0]);
@output = &runcmd($cmd->[0]);
$rc = $::RUNCMD_RC;
log_this($running_log_fd, "RUN:$cmd->[0] [$runstartstr]");
push(@caselog, "RUN:$cmd->[0] [$runstartstr]");
} else {
#to run multiple lines command
log_this($running_log_fd, "RUN: [$runstartstr]", @{$cmd});
@output = runscript($cmd);
$rc = $::RUNCMD_RC;
log_this($running_log_fd, "RUN: [$runstartstr]", @{$cmd});
push(@caselog, ("RUN: [$runstartstr]", @{$cmd}));
}