huawei.enterprise.hw_enterprise_lun_snapshot module – LUN Snapshot 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_snapshot.

Synopsis

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

  • Supports query all snapshots on storage.

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

active

string

Whether active or unactive snapshot.

Support set when need modify snapshot active status.

Choices:

  • "true"

  • "false"

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 snapshot.

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"

  • "wwn"

hostname

string / required

IP or FQDN of the huawei enterprise management system.

MultiIP config as ip1,ip2

id

string

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

when needs to be active or deactive multi snapshots, it need be set like this:”id1,id2,id3”.

name

string

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

when needs to be active or deactive multi snapshots, it need be set like this:”snap_01,snap_02,snap_03”.

new_name

string

Snapshot new unique name, Required for modify snapshot name.

parent_id

string

LUN ID, Required for create operation.

password

string / required

The password of the PowerStore host.

revert

string

Whether revert or cancel revert snapshot.

Support set when need revert or cancel revert snapshot.

Choices:

  • "true"

  • "false"

rollback_speed

string

Snapshot revert speed

It defaults to medium if not specified

Choices:

  • "low"

  • "medium"

  • "high"

  • "highest"

socket_timeout

integer

Huawei Enterprise Storage rest api Timeout time.

Default: 60

state

string / required

Define whether the snapshot 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

target_id

string

Rollback target object id

The default rollback object is a parent snapshot.

If there is no parent snapshot, the rollback object is the source LUN.

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:system_vstore if not specified.

Notes

Note

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

Examples

---
  tasks:
    - name: Create LUN Snapshot
      register: lun_snap_info
      huawei.enterprise.hw_enterprise_lun_snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< lun_snapshot_name >"
        parent_id: "< lun_id >"
        description: "< description >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Modify Snapshot Running status to activated or unactivated by id
      register: lun_snap_info
      huawei.enterprise.hw_enterprise_lun_snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "< id1,id2,id3 >"
        active: "< true | false >"
        state: "present"

    - name: Modify Snapshot Running status to activated or unactivated by name
      register: lun_snap_info
      huawei.enterprise.hw_enterprise_lun_snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< snapshot_01,snapshot_02,snapshot_03 >"
        active: "< true | false >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Rename LUN Snapshot by name
      register: lun_snap_info
      huawei.enterprise.hw_enterprise_lun_snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< snapshot_name >"
        new_name: "< new_snapshot_name >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Rename LUN Snapshot by id
      register: lun_snap_info
      huawei.enterprise.hw_enterprise_lun_snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ lun_snap_info.snap_detail.id }}"
        new_name: "new_snapshot_name"
        state: "present"

    - name: Revert snapshot
      register: lun_snap_info
      huawei.enterprise.hw_enterprise_lun_snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< snapshot_name >"
        id: "{{ lun_snap_info.snap_detail.id }}"
        revert: "true"
        target_id: "{{ target_id }}"
        rollback_speed: "medium"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Cancel Revert snapshot
      register: lun_snap_info
      huawei.enterprise.hw_enterprise_lun_snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ lun_snap_info.snap_detail.id }}"
        name: "< snapshot_name >"
        revert: "false"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Query Snapshot detail by name
      register: lun_snap_info
      huawei.enterprise.hw_enterprise_lun_snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< snapshot_name >"
        filter:
          - id
          - name
          - vstore_name
          - vstore_id
          - parent_id
          - parent_name
          - running_status
          - wwn
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Query Snapshot detail by id
      register: lun_snap_info
      huawei.enterprise.hw_enterprise_lun_snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ lun_snap_info.snap_detail.id }}"
        filter:
          - id
          - name
          - vstore_name
          - vstore_id
          - parent_id
          - parent_name
          - running_status
          - wwn
        state: "present"

    - name: Query Multi Snapshot
      register: all_snapshot
      huawei.enterprise.hw_enterprise_lun_snapshot:
        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
          - wwn
        state: "present"

    - name: Delete Snapshot by name
      huawei.enterprise.hw_enterprise_lun_snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< snapshot_name >"
        vstore_id: "< vstore_id >"
        state: "absent"

    - name: Delete Snapshot by id
      huawei.enterprise.hw_enterprise_lun_snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ lun_snap_info.snap_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

remark

string

task execute remark

Returned: always

Sample: "LUN snapshot sample_snapshot create successfully"

snap_detail

complex

Details of the snapshot.

Returned: When snapshot exists else return {}

Sample: {"id": "1", "name": "sample_snapshot", "parent_id": 10, "parent_name": "LUN_O1", "running_status": "active", "vstore_id": "0", "vstore_name": "System_vStore", "wwn": "618cf24100f6b2e0111a63fc0000003d"}

id

string

The system generated ID given to the LUN snapshot.

Returned: success

name

string

Name of the LUN snapshot.

Returned: success

parent_id

string

id of source lun.

Returned: success

parent_name

string

Name of source lun.

Returned: success

running_status

string

running status of the LUN snapshot.

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 snapshot.

Returned: success

Authors

  • Huawei eSDK Ansible Team