huawei.enterprise.hw_enterprise_lun module – LUN operations for Huawei Enterprise Storage

Note

This module is part of the huawei.enterprise collection (version 2.0.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install huawei.enterprise. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: huawei.enterprise.hw_enterprise_lun.

Synopsis

  • Supports the provisioning operations on a LUN such as create, modify, delete and get the details of a LUN.

Requirements

The below requirements are needed on the host that executes this module.

  • Huawei Dorado v5/v6/v7 and OceanStor v5/v6/v7 Storage

Parameters

Parameter

Comments

alloc_type

string

Only can set for Oceanstor V5 storage.V6 or later.

It defaults to thin if not specified.

Choices:

  • "thick"

  • "thin"

capacity

integer

lun total capacity, Required for create operation.

can set when need modify exist lun capacity.

capacity should be greater or equal to 512 KB.

custom_vars

dictionary

Parameters used to extend those not currently supported by the module.

Configuration needs to be based on the REST API documentation for storage.

If necessary, you can contact the plugin technical support for assistance.

description

string

Description of the LUN.

filter

list / elements=string

Parameter required for all query operations.

The response will include the storage parameters that match the indicate filter criteria.

Choices:

  • "id"

  • "name"

  • "vstore_name"

  • "vstore_id"

  • "parent_id"

  • "parent_name"

  • "running_status"

  • "capacity"

  • "alloc_capacity"

  • "wwn"

  • "unit"

hostname

string / required

IP or FQDN of the huawei enterprise management system.

MultiIP config as ip1,ip2

id

string

LUN unique id, Mutually exclusive with name, Priority is higher than name.

name

string

LUN unique name, Required for create operation. Mutually exclusive with id.

new_name

string

LUN new unique name, Required for modify lun name.

parent_id

string

StoragePool ID, Required for create operation.

password

string / required

The password of the PowerStore host.

socket_timeout

integer

Huawei Enterprise Storage rest api Timeout time.

Default: 60

state

string / required

Define whether the LUN should exist or not.

Choices:

  • "absent"

  • "present"

storage_port

integer

Port number for the Huawei Enterprise array.

If not passed, it will take 8088 as default.

Default: 8088

unit

string

capacity unit.

It defaults to "GB" if not specified.

Choices:

  • "B"

  • "KB"

  • "MB"

  • "GB"

  • "TB"

  • "PB"

use_log

boolean

Whether to write plugin log to local filesystem.

Choices:

  • false ← (default)

  • true

username

string / required

The username of the PowerStore host.

valid_certs

string

The path of the SSL certificate variable to specify whether to validate SSL certificate or not.

If don’t set means no need to verify ssl cert.

vstore_id

string

id of storage vstore.

It defaults to 0:SystemVstore if not specified.

For V5 storage, don’t need to be configured in non-multi-tenant scenarios.

workload_type_id

string

id of lun workload Type.

Only support when create lun, can not be modify.

Notes

Note

  • The check_mode is not supported.

  • The modules present in this collection named as ‘huawei.enterprise’ are built to support the Huawei Enterprise Storage System.

Examples

---
  tasks:
    - name: Create LUN
      register: lun_info
      huawei.enterprise.hw_enterprise_lun:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< lun_name >"
        parent_id: "< storage_pool_id >"
        capacity: < capacity >
        unit: "< B | KB | MB | GB | TB | PB >"
        description: "< description >"
        alloc_type: "< thin | thick >"
        workload_type_id: "< work_load_type_id >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Modify LUN By Name
      register: lun_info
      huawei.enterprise.hw_enterprise_lun:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< lun_name >"
        new_name: "< lun_new_name >"
        capacity: < capacity >
        unit: "< B | KB | MB | GB | TB | PB >"
        description: "< new description >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Modify LUN By ID
      register: lun_info
      huawei.enterprise.hw_enterprise_lun:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ lun_info.lun_detail.id }}"
        new_name: "< lun_new_name >"
        capacity: < capacity >
        unit: "< B | KB | MB | GB | TB | PB >"
        description: "< new description >"
        state: "present"

    - name: Query LUN Detail By Name
      register: lun_info
      huawei.enterprise.hw_enterprise_lun:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< lun_name >"
        filter:
          - id
          - name
          - vstore_name
          - vstore_id
          - parent_id
          - parent_name
          - running_status
          - capacity
          - alloc_capacity
          - alloc_type
          - workload_type_id
          - wwn
          - unit
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Query LUN Detail By ID
      register: lun_info
      huawei.enterprise.hw_enterprise_lun:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ lun_info.lun_detail.id }}"
        filter:
          - id
          - name
          - vstore_name
          - vstore_id
          - parent_id
          - parent_name
          - running_status
          - capacity
          - alloc_capacity
          - alloc_type
          - workload_type_id
          - wwn
          - unit
        state: "present"

    - name: Query Multi LUN
      register: all_lun
      huawei.enterprise.hw_enterprise_lun:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        vstore_id: "< vstore_id >"
        filter:
          - id
          - name
          - vstore_name
          - vstore_id
          - parent_id
          - parent_name
          - running_status
          - capacity
          - alloc_capacity
          - alloc_type
          - workload_type_id
          - wwn
          - unit
        state: "present"

    - name: Delete LUN Detail By Name
      huawei.enterprise.hw_enterprise_lun:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< lun_name >"
        vstore_id: "< vstore_id >"
        state: "absent"

    - name: Delete LUN Detail By ID
      huawei.enterprise.hw_enterprise_lun:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ lun_info.lun_detail.id }}"
        state: "absent"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

actions

list / elements=string

playbook action lists

Returned: always

Sample: ["create"]

changed

boolean

Whether or not the resource has changed.

Returned: always

Sample: false

lun_detail

complex

Details of the LUN.

Returned: When lun exists

Sample: {"capacity": 10, "id": "1", "name": "sample_lun", "running_status": "27:online", "unit": "GB", "used_capacity": 5, "vstore_id": "0", "vstore_name": "System_vStore", "wwn": "618cf24100f6b2e0111a63fc0000003d"}

capacity

integer

total capacity of the LUN.

Returned: success

id

string

The system generated ID given to the LUN.

Returned: success

name

string

Name of the LUN.

Returned: success

running_status

string

running status of the LUN.

Returned: success

unit

string

unit of all capacity.

Returned: success

used_capacity

integer

Used capacity of the LUN.

Returned: success

vstore_id

string

id of storage vstore.

Returned: success

vstore_name

string

Name of storage vstore.

Returned: success

wwn

string

WWN of the LUN.

Returned: success

remark

string

task execute remark

Returned: always

Sample: "Volume sample_lun create successfully"

Authors

  • Huawei eSDK Ansible Team