dell / dellemc-openmanage-ansible-modules

Dell OpenManage Ansible Modules
GNU General Public License v3.0
339 stars 163 forks source link

[BUG]: PxeDev3Interface: Read only attribute cannot be modified. #495

Open mdn19866 opened 1 year ago

mdn19866 commented 1 year ago

Bug Description

Hello everyone! We have Dell PowerEdge R640 and R840 in our landscape which were installed in BIOS boot mode in the past. We are now moving all the servers to UEFI boot mode and want to enable the PXE devices in order to boot from them. The code looks like the following. We set UEFI boot mode in a previous step as this is needed.

      - name: "Actually adjust settings"
      dellemc.openmanage.idrac_bios:
        idrac_ip: "{{ hostname }}"
        idrac_user: "{{ username }}"
        idrac_password: "{{ password }}"
        validate_certs: false
        attributes:
              IntegratedNetwork1: "Enabled"
              PxeDev1EnDis: "Enabled"
              PxeDev3EnDis: "Enabled"
              PxeDev1Interface: "NIC.Slot.2-1-1"
              PxeDev3Interface: "NIC.Slot.3-1-1"

The error message we get is: PxeDev3Interface: Read only attribute cannot be modified.. For whatever reason PxeDev1EnDis was already enabled for us and therefore we don't see the issue only with the third PXE interface.

I already tried to understand what is happening and found the cause of my issue here: https://github.com/dell/dellemc-openmanage-ansible-modules/blob/3c0ca3948b8c605cddbce0d62b49405086bfec90/plugins/modules/idrac_bios.py#L617-L644

So, the BiosRegistry resource reports a ReadOnly: true and prevents the module from executing the job doesn't matter if I set PxeDev3EnDis to Enabled in the same step.

{
                "AttributeName": "PxeDev3Interface",
                "CurrentValue": null,
                "DisplayName": "Interface",
                "DisplayOrder": 6700,
                "HelpText": "NIC interface used for this PXE device.",
                "Hidden": false,
                "Immutable": false,
                "MenuPath": "./NetworkSettingsRef/PxeDev3SettingsRef",
                "ReadOnly": true,
                "ResetRequired": true,
                "Type": "Enumeration",
                "Value": [
                    {
                    ...

There are several workarounds available: 1) Run dellemc.openmanage.idrac_bios two times. First only to enable the PXE interfaces and the second time for the setting of the interface. Involves two reboots and extends duration of everything. 2) Use the redfish config module: https://docs.ansible.com/ansible/latest/collections/community/general/redfish_config_module.html. With this we can send everything in one step as the BiosRegistryis not checked for ReadOnly in this module. But we have to handle the creation of the configuration job and reboot separately.

Would be good to see not so many reboots involved in the process as this consumes a lot of time. To be honest, I also won't run three separate tasks to achieve what I want.

What do you suggest?

Component or Module Name

idrac_bios

Ansible Version

ansible [core 2.12.5.post0]

Python Version

3.8.13

iDRAC/OME/OME-M version

iDRAC 6.10.30.00

Operating System

CentOS 8

Playbook Used

  - name: "Actually adjust settings"
  dellemc.openmanage.idrac_bios:
    idrac_ip: "{{ hostname }}"
    idrac_user: "{{ username }}"
    idrac_password: "{{ password }}"
    validate_certs: false
    attributes:
          IntegratedNetwork1: "Enabled"
          PxeDev1EnDis: "Enabled"
          PxeDev3EnDis: "Enabled"
          PxeDev1Interface: "NIC.Slot.2-1-1"
          PxeDev3Interface: "NIC.Slot.3-1-1"

Logs

fatal: [server -> localhost]: FAILED! => changed=false invalid_attributes: PxeDev3Interface: Read only attribute cannot be modified. invocation: module_args: apply_time: Immediate attributes: IntegratedNetwork1: Enabled PxeDev1EnDis: Enabled PxeDev1Interface: NIC.Slot.2-1-1 PxeDev3EnDis: Enabled PxeDev3Interface: NIC.Slot.3-1-1 boot_sources: null ca_path: null clear_pending: null idrac_ip: server idrac_password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER idrac_port: 443 idrac_user: support job_wait: true job_wait_timeout: 1200 maintenance_window: null reset_bios: null reset_type: graceful_restart share_mnt: null share_name: null share_password: null share_user: null timeout: 30 validate_certs: false status_msg: The values specified for the attributes are invalid.

Steps to Reproduce

UEFI boot mode is set. PxeDev3EnDis is disabled. Run the task mentioned above.

Expected Behavior

When I enable PxeDev3EnDis and want to configure PxeDev3Interface in one step it should work.

Actual Behavior

PxeDev3Interface is a read only attribute even if I set PxeDev3EnDis to enable in the same task.

Screenshots

No response

Additional Information

No response

jagadeeshnv commented 1 year ago

@mdn19866 Thanks for the details, will check if we can improvise to reduce the number of steps. will get back soon

jagadeeshnv commented 1 year ago

@mdn19866 For your case do make the required changes. We will work on the permanent fix and update soon if val_dict.get("_ReadOnly"): invalid[k] = "Read only attribute cannot be modified."