dell / ansible-powermax

Ansible Modules for Dell PowerMax
GNU General Public License v3.0
36 stars 37 forks source link

[BUG]: Unable to Create a New Volume without vol_name #43

Closed dhrony closed 5 months ago

dhrony commented 5 months ago

Describe the bug

I was testing a volume create automation using dellemc.powermax.volume module. I was able to create a volume from Unisphere GUI without providing a volume name but when I tried to create the same usning ansible module without vol_name getting error "one of the following is required: vol_id, vol_name, vol_wwn". But as per our standard practice name/id/wwn we let autoassign by array and also vol_name is marked as mandatory field as per documentation

To Reproduce Steps to reproduce the behavior:

  1. Create a new playbook as per following template

Expected behavior Playbook task should execute without providing vol_name/vol_id/vol_wwn as per similar behavior as volume creation from GUI

Screenshots N/A

Logs "one of the following is required: vol_id, vol_name, vol_wwn"

System Information (please complete the following information):

Additional context N/A

anupamaloke commented 5 months ago

Hi @dhrony, volume creation feature is supported via the dellemc.powermax.storagegroup module and the volume name is an optional field for creating a new volume(s).

From storagegroup.py: Line#58

  volumes:
    description:
    - This is a list of volumes.
    - Each volume has four attributes; vol_name, size, cap_unit, vol_id.
    - Volume ID must be provided for existing volumes.
    - The size must be provided to add new volumes to SG.
    - The cap_unit is optional.
    - Default value of cap_unit is GB, choices are MB, GB, TB.
    type: list
    elements: dict
dhrony commented 5 months ago

@anupamaloke Thanks for the quick response. I was under the same impression but when I run the playbook without vol_name getting error ""one of the following is required: vol_id, vol_name, vol_wwn""

anupamaloke commented 5 months ago

@dhrony , I just ran the below playbook to create a volume without any name and it ran to completion:

- hosts: powermax
  gather_facts: no

  vars:
    unisphere_conn: &unisphere_conn
      unispherehost: "{{ inventory_hostname }}"
      universion: "{{ universion }}"
      user: "{{ user }}"
      password: "{{ password }}"
      serial_no: "{{ serial_no }}"
      verifycert: false

  tasks:
    - name: create volume without name
      dellemc.powermax.storagegroup:
        <<: *unisphere_conn
        sg_name: "Ansible_Test_SRDF1"
        volumes:
          - size: 1
            cap_unit: "GB"
        state: "present"
        vol_state: "present-in-group"
      register: result
      delegate_to: localhost

$ ansible-playbook -vvv volume.yml -i hosts

changed: [192.168.10.10] => {
    "add_child_sg": "",
    "add_new_vols_to_sg": true,
    "add_snapshot_policy_to_sg": "",
    "add_vols_to_sg": false,
    "added_vols_details": [
        "00142"
    ],
    "changed": true,
    "create_sg": "",
    "delete_sg": "",
    "invocation": {
        "module_args": {
            "child_sg_state": null,
            "child_storage_groups": null,
            "compression": null,
            "force": null,
            "host_io_limit": null,
            "new_sg_name": null,
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "serial_no": "<< omitted >>",
            "service_level": null,
            "sg_name": "Ansible_Test_SRDF1",
            "snapshot_policies": null,
            "snapshot_policy_state": null,
            "srp": null,
            "state": "present",
            "target_sg_name": null,
            "timeout": 120,
            "unispherehost": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "universion": 92,
            "user": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "verifycert": "False",
            "vol_state": "present-in-group",
            "volumes": [
                {
                    "cap_unit": "GB",
                    "size": 1
                }
            ]
        }
    },
    "modify_sg": "",
    "remove_child_sg": "",
    "remove_snapshot_policy_to_sg": "",
    "remove_vols_from_sg": "",
    "removed_vols_details": [],
    "rename_sg": "",
    "snapshot_policy_compliance_details": "",
    "storage_group_details": {
        "base_slo_name": "Diamond",
        "cap_gb": 201.0,
        "compression": true,
        "device_emulation": "FBA",
        "num_of_child_sgs": 0,
        "num_of_masking_views": 0,
        "num_of_parent_sgs": 0,
        "num_of_snapshots": 0,
        "num_of_vols": 2,
        "service_level": "Diamond",
        "slo": "Diamond",
        "slo_compliance": "NONE",
        "srp": "SRP_1",
        "storageGroupId": "Ansible_Test_SRDF1",
        "type": "Standalone",
        "unprotected": false,
        "unreducible_data_gb": 0.0,
        "vp_saved_percent": 100.0
    },
    "storage_group_volumes": [
        "0002E",
        "00142"
    ],
    "storage_group_volumes_details": [
        {
            "effective_wwn": "<< omitted >>",
            "type": "RDF1+TDEV",
            "volumeId": "0002E",
            "volume_identifier": "ansible-x0",
            "wwn": "<< omitted >>"
        },
        {
            "effective_wwn": "<< omitted >>",
            "type": "RDF1+TDEV",
            "volumeId": "00142",
            "volume_identifier": "",
            "wwn": "<< omitted >>"
        }
    ]
}

PLAY RECAP ********************************************************************************************************************************************************
192.168.10.10              : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
dhrony commented 5 months ago

Hello, May I know what version of pyU4V you are using? We are testing on PMAX 2000 and using pyU4V 9.2 version. We cannot use pyU4V 9.2 due to compatibility.

anupamaloke commented 5 months ago

@dhrony, please see below:

PyU4V version:

$ pip freeze | grep PyU4V
PyU4V==9.2.1.7

Unisphere Version:

dhrony commented 5 months ago

Thank you @anupamaloke . I can see the difference. I was using dellemc.powermax.volume module and received the error though vol_name was marked as optional. I just tried with dellemc.powermax.storagegroup module as you did and able to create a volume without providing vol_name. Is this expected behavior for dellemc.powermax.volume module?

anupamaloke commented 5 months ago

@dhrony, for all volume mgmt. operations, we recommend using SG. Please also see the Dell PowerMax: Ansible Modules Best Practices for more details.

dhrony commented 5 months ago

Thank you @anupamaloke. In future release if you could test volume module for new volume that would be awsome.