Skip to content

GetChassisPower fails to report power information when multiple chassis are present #4901

@jyundt

Description

@jyundt

Summary

The GetChassisPower command in redfish_info will fail to report power for all chassis if:

  • multiple chassis are present
  • at least one chassis does not report power information

We are encountering this on servers that have backplanes which report as a "Chassis" (but do not report power information).

Issue Type

Bug Report

Component Name

redfish_info

Ansible Version

ansible 2.10.7
  config file = None
  configured module search path = ['/home/jyundt/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/jyundt/git/firmware_updater/venv/lib/python3.8/site-packages/ansible
  executable location = /home/jyundt/git/firmware_updater/venv/bin/ansible
  python version = 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0]

Community.general Version

# /home/jyundt/git/firmware_updater/venv/lib/python3.8/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 1.3.6  

# /home/jyundt/ansible/ansible_collections
Collection        Version
----------------- -------
community.general 5.3.0  

Configuration

No response

OS / Environment

No response

Steps to Reproduce

Sample playbook

---
- hosts: all
  gather_facts: false
  vars:
    bmc_username: root
    bmc_password: hunter2
    default_uri_timeout: 50
    default_uri_retries: 5
  tasks:
  - name: Gather initial BMC lan infomration
    command: ipmitool lan print
    register: ipmitool_output
    changed_when: ipmitool_output.rc != 0
    become: true

  - name: Set BMC IP address as fact
    set_fact:
      bmc_address: "{{ ipmitool_output.stdout | regex_search('IP Address\\s+:\\s+(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})', '\\1')
                                              | first }}"

  - name: Get Chassis Power
    community.general.redfish_info:
      category: Chassis
      command: GetChassisPower
      baseuri: "{{ bmc_address }}"
      username: "{{ bmc_username }}"
      password: "{{ bmc_password }}"
      timeout: "{{ default_uri_timeout }}"
    retries: "{{ default_uri_retries }}"
    register: redfish_chassis_power

  - debug:
      var: redfish_chassis_power


Results in:

PLAY [all] **********************************************************************************************************************************************************************************

TASK [Gather initial BMC lan infomration] ***************************************************************************************************************************************************
ok: [s2r8node79]

TASK [Set BMC IP address as fact] ***********************************************************************************************************************************************************
ok: [s2r8node79]

TASK [Get Chassis Power] ********************************************************************************************************************************************************************
ok: [s2r8node79]

TASK [debug] ********************************************************************************************************************************************************************************
ok: [s2r8node79] => {
    "redfish_chassis_power": {
        "changed": false,
        "failed": false,
        "redfish_facts": {
            "chassis_power": {
                "msg": "Key Power not found.",
                "ret": false
            }
        }
    }
}

Sample Server:

jyundt@prod-jump04:~$ curl -skL -u root:$BMC_PASSWORD https://10.208.9.24/redfish/v1/Chassis | jq '.'
{
  "@odata.type": "#ChassisCollection.ChassisCollection",
  "@odata.id": "/redfish/v1/Chassis",
  "Id": "Chassis",
  "Name": "Chassis Collection",
  "Members": [
    {
      "@odata.id": "/redfish/v1/Chassis/1"
    },
    {
      "@odata.id": "/redfish/v1/Chassis/NVMeSSD.0.Group.0.StorageBackplane"
    }
  ],
  "Members@odata.count": 2
}
jyundt@prod-jump04:~$ curl -skL -u root:$BMC_PASSWORD https://10.208.9.24/redfish/v1/Chassis/1/ | jq '.Power'
{
  "@odata.id": "/redfish/v1/Chassis/1/Power"
}
jyundt@prod-jump04:~$ curl -skL -u root:$BMC_PASSWORD https://10.208.9.24/redfish/v1/Chassis/NVMeSSD.0.Group.0.StorageBackplane | jq '.Power'
null
jyundt@prod-jump04:~$

Expected Results

I would expect the Chassis Power to report correctly for this server and skip the backplane / Chassis that does not have Power data.

Actual Results

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions