ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
816 stars 1.5k forks source link

CapacityBytes should not be a required parameters to create a volume with Redfish #8955

Open pyfontan opened 2 days ago

pyfontan commented 2 days ago

Summary

For the CreateVolume command of the redfish_config module, the documentation doesn't mention the fact that CapacityBytes is a required parameter of the command. But it is effectively required on the line #L3732 of redfish_utils.py. https://github.com/ansible-collections/community.general/blob/9.4.0/plugins/module_utils/redfish_utils.py#L3732

So when i try to use this command without CapacityBytes, my task fail with :

"msg": "['RAIDType', 'Drives', 'CapacityBytes'] are required parameter to create a volume"

This parameter is not really needed and i can create a volume with curl without CapacityBytes

Issue Type

Bug Report

Component Name

redfish_config

Ansible Version

$ ansible --version
ansible [core 2.15.3]
  ...
  python version = 3.11.0rc1 (main, Aug 12 2022, 10:02:14) [GCC 11.2.0] 
  jinja version = 3.1.2

Community.general Version

$ ansible-galaxy collection list community.general
# /home/pyfontan/Dev/gitlab/ansible/ccin2p3/sysadmin_tools/.collections/ansible_collections
Collection        Version
----------------- -------
community.general 9.4.0

Configuration

$ ansible-config dump --only-changed

OS / Environment

Not relevant

Steps to Reproduce

- name: Create Volume
  community.general.redfish_config:
    category: Systems
    command: CreateVolume
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
    storage_subsystem_id: "DE07A000"
    volume_details:
      Name: "SYSTEM"
      RAIDType: "RAID1"
      Drives:
        - "/redfish/v1/Systems/1/Storage/DE07A000/Drives/36"
        - "/redfish/v1/Systems/1/Storage/DE07A000/Drives/37"

Expected Results

I expected the creation of the volume SYSTEM and the changed value of :

{                                                                                                          
    "changed": true,                                                                                                                                           
    "invocation": {                                                                                                                                            
        "module_args": {                                                       
            "auth_token": null,                                                
            "baseuri": "X.X.X.X",                                        
            "bios_attributes": {},                                             
            "boot_order": [],                                                  
            "category": "Systems",                                             
            "ciphers": null,                                                   
            "command": [                                                       
                "CreateVolume"                                                 
            ],                                                                 
            "hostinterface_config": {},                                        
            "hostinterface_id": null,                                          
            "network_protocols": {},                                           
            "nic_addr": "null",                                                
            "nic_config": {},                                                  
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",                                                                                                 
            "resource_id": null,                                               
            "secure_boot_enable": true,                                        
            "service_id": null,                                                
            "sessions_config": {},                                             
            "storage_subsystem_id": "DE07A000",                                                                                                                
            "strip_etag_quotes": false,                                        
            "timeout": 60,                                                     
            "username": "XXX",                                                                                                                       
            "volume_details": {                                                
                "Links": {                                                     
                    "Drives": [                                                
                        {                                                      
                            "@odata.id": "/redfish/v1/Systems/1/Storage/DE07A000/Drives/36"
                        },                                                     
                        {                                                      
                            "@odata.id": "/redfish/v1/Systems/1/Storage/DE07A000/Drives/37"
                        }                                                      
                    ]                                                          
                },                                                             
                "Name": "SYSTEM",                                              
                "RAIDType": "RAID1"                                            
            },                                                                 
            "volume_ids": []                                                   
        }                                                                      
    },                                                                         
    "msg": "Volume Created"                                                    
}    

Actual Results

{                                                                                                   
    "changed": false,                                                                                                                                          
    "invocation": {                                                                                                                                            
        "module_args": {                                                                                                                                       
            "auth_token": null,                                                                                                                                
            "baseuri": "X.X.X.X",                                                                                                                        
            "bios_attributes": {},                                                                                                                             
            "boot_order": [],                                                                                                                                  
            "category": "Systems",                                                                                                                             
            "ciphers": null,                                                                                                                                   
            "command": [                                                                                                                                       
                "CreateVolume"                                                                                                                                 
            ],                                                                                                                                                 
            "hostinterface_config": {},                                                                                                                        
            "hostinterface_id": null,                                                                                                                          
            "network_protocols": {},                                                                                                                           
            "nic_addr": "null",                                                                                                                                
            "nic_config": {},                                                                                                                                  
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",                                                                                                 
            "resource_id": null,                                                                                                                               
            "secure_boot_enable": true,                                                                                                                        
            "service_id": null,                                                                                                                                
            "sessions_config": {},                                                                                                                             
            "storage_subsystem_id": "DE07A000",                                                                                                                
            "strip_etag_quotes": false,                                                                                                                        
            "timeout": 60,                                                                                                                                     
            "username": "XXX",                                                                                                                       
            "volume_details": {                                                                                                                                
                "Drives": [                                                                                                                                    
                    "/redfish/v1/Systems/1/Storage/DE07A000/Drives/36",                                                                                        
                    "/redfish/v1/Systems/1/Storage/DE07A000/Drives/37"                                                                                         
                ],                                                                                                                                             
                "Name": "SYSTEM",                                                                                                                              
                "RAIDType": "Mirrored"                                                                                                                         
            },                                                                                                                                                 
            "volume_ids": []                                                                                                                                   
        }                                                                                                                                                      
    },                                                                                                                                                         
    "msg": "['RAIDType', 'Drives', 'CapacityBytes'] are required parameter to create a volume"                                                                 
}

Code of Conduct

ansibullbot commented 2 days ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 2 days ago

cc @TSKushal @bhavya06 @jyundt @mraineri @rajeevkallur @renxulei @tomasg2012 @xmadsen click here for bot help