Skip to content

Commit

Permalink
Addressed Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinavbansal29 committed Dec 23, 2024
1 parent eef4345 commit ddec6d8
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 185 deletions.
25 changes: 0 additions & 25 deletions plugins/modules/ntnx_volume_groups_iscsi_clients_info_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
description:
- By default, Fetch all iscsi clients currently attached to any VG
- Fetch iscsi client if C(ext_id) is given
- Fetch all iscsi clients attached to a particular VG if C(volume_group_ext_id) is given
version_added: "2.0.0"
author:
- Prem Karat (@premkarat)
Expand All @@ -26,27 +25,12 @@
- This will fetch the iscsi client with the given external ID.
type: str
required: false
volume_group_ext_id:
description:
- The external ID of the volume group.
- This will fetch all iscsi clients attached to the given volume group.
type: str
required: false
extends_documentation_fragment:
- nutanix.ncp.ntnx_credentials
- nutanix.ncp.ntnx_info_v2
"""

EXAMPLES = r"""
- name: Fetch iscsi clients attached to VG
ntnx_volume_groups_iscsi_clients_info_v2:
nutanix_host: "{{ ip }}"
nutanix_username: "{{ username }}"
nutanix_password: "{{ password }}"
state: "present"
volume_group_ext_id: 0005b6b1-0b3b-4b3b-8b3b-0b3b4b3b4b35
register: result
- name: Fetch specific iscsi client info
ntnx_volume_groups_iscsi_clients_info_v2:
nutanix_host: "{{ ip }}"
Expand All @@ -71,7 +55,6 @@
description:
- list of iscsi clients currently attached to any VG
- specific iscsi client if ext_id given
- List of all iscsi clients attached to a particular VG using volume_group_ext_id
type: dict
returned: always
sample: [
Expand All @@ -93,11 +76,6 @@
type: str
returned: always
sample: "0005b6b1-0b3b-4b3b-8b3b-0b3b4b3b4b3b"
volume_group_ext_id:
description: Volume group external ID.
type: str
returned: always
sample: "0005b6b1-0b3b-4b3b-8b3b-0b3b4b3b4b3b"
error:
description: The error message if any.
type: str
Expand Down Expand Up @@ -125,7 +103,6 @@
def get_module_spec():
module_args = dict(
ext_id=dict(type="str", required=False),
volume_group_ext_id=dict(type="str", required=False),
)
return module_args

Expand Down Expand Up @@ -177,9 +154,7 @@ def run_module():
argument_spec=get_module_spec(),
supports_check_mode=False,
mutually_exclusive=[
("ext_id", "volume_group_ext_id"),
("ext_id", "filter"),
("volume_group_ext_id", "filter"),
],
)
remove_param_with_none_value(module.params)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,25 +156,6 @@
fail_msg: "Unable to attach iscsi client using initiator name"
success_msg: "ISCSI client attached successfully using initiator name"

# Need to verify attachment

# - name: List all clients attached to VG to verify attachment
# ntnx_volume_groups_iscsi_clients_info_v2:
# volume_group_ext_id: "{{ vg1_uuid }}"
# register: result

# - name: Verify if attachment was correct
# ansible.builtin.assert:
# that:
# - result.error == None
# - result.response is defined
# - result.changed == false
# - result.response | length == 1
# - result.response[0].ext_id == iscsi_client_uuid
# - result.volume_group_ext_id == vg1_uuid
# fail_msg: "Unable to list iscsi clients attached to VG"
# success_msg: "ISCSI clients attached to VG listed successfully"

- name: Fetch specific client
ntnx_volume_groups_iscsi_clients_info_v2:
ext_id: "{{ iscsi_client_uuid }}"
Expand Down Expand Up @@ -211,24 +192,6 @@
fail_msg: "Unable to detach iscsi client using initiator name"
success_msg: "ISCSI client detached successfully using initiator name"

# Need to verify detachment

# - name: List all clients attached to VG to verify detachment
# ntnx_volume_groups_iscsi_clients_info_v2:
# volume_group_ext_id: "{{ vg1_uuid }}"
# register: result

# - name: Verify if attachment went fine
# ansible.builtin.assert:
# that:
# - result.error == None
# - result.response is defined
# - result.changed == false
# - result.response | length == 0
# - result.volume_group_ext_id == vg1_uuid
# fail_msg: "Unable to verify detachment of iscsi client"
# success_msg: "Detachment of client verified successfully"

- name: Attach iscsi client to VG using iscsi client id
ntnx_volume_groups_iscsi_clients_v2:
volume_group_ext_id: "{{ vg1_uuid }}"
Expand All @@ -248,25 +211,6 @@
fail_msg: "Unable to attach iscsi client using ext_id"
success_msg: "ISCSI client attached successfully using ext_id"

# Need to verify attachment

# - name: List all clients attached to VG to verify attachment
# ntnx_volume_groups_iscsi_clients_info_v2:
# volume_group_ext_id: "{{ vg1_uuid }}"
# register: result

# - name: Verify if attachment went fine
# ansible.builtin.assert:
# that:
# - result.error == None
# - result.response is defined
# - result.changed == false
# - result.response | length == 1
# - result.response[0].ext_id == iscsi_client_uuid
# - result.volume_group_ext_id == vg1_uuid
# fail_msg: "Unable to list iscsi clients attached to VG"
# success_msg: "ISCSI clients attached to VG listed successfully"

- name: Detach client from VG
ntnx_volume_groups_iscsi_clients_v2:
volume_group_ext_id: "{{ vg1_uuid }}"
Expand All @@ -286,24 +230,6 @@
fail_msg: "Unable to detach iscsi client using initiator name"
success_msg: "ISCSI client detached successfully using initiator name"

# Need to verify detachment

# - name: List all clients attached to VG to verify detachment
# ntnx_volume_groups_iscsi_clients_info_v2:
# volume_group_ext_id: "{{ vg1_uuid }}"
# register: result

# - name: Verify if attachment went fine
# ansible.builtin.assert:
# that:
# - result.error == None
# - result.response is defined
# - result.changed == false
# - result.response | length == 0
# - result.volume_group_ext_id == vg1_uuid
# fail_msg: "Unable to list iscsi clients attached to VG"
# success_msg: "ISCSI clients attached to VG listed successfully"

############################################ Cleanup ############################################

- name: Delete Volume group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,57 +188,6 @@
fail_msg: "Unable to verify VG attachment from VM side"
success_msg: "VG attachment verified from VM side"

############################################ Info tests ############################################
# - name: Fetch all VMs attached to VG
# ntnx_volume_groups_vms_info_v2:
# ext_id: "{{ vg1_uuid }}"
# register: result

# - name: Verify all VMs attached to VG
# ansible.builtin.assert:
# that:
# - result.error == None
# - result.changed == false
# - result.response | length == 2
# - result.response[0].ext_id in [ "{{ vm1_uuid }}", "{{ vm2_uuid }}" ]
# - result.response[1].ext_id in [ "{{ vm1_uuid }}", "{{ vm2_uuid }}" ]

# fail_msg: "Unable to verify all VMs attached to VG"
# success_msg: "All VMs attached to VG verified successfully"

# - name: Fetch all VMs attached to VG with limit
# ntnx_volume_groups_vms_info_v2:
# limit: 1
# ext_id: "{{ vg1_uuid }}"
# register: result

# - name: Verify all VMs attached to VG with limit
# ansible.builtin.assert:
# that:
# - result.error == None
# - result.changed == false
# - result.response | length == 1

# fail_msg: "Unable to verify all VMs attached to VG with limit query"
# success_msg: "All VMs attached to VG with limit verified successfully query"

# - name: Fetch all VMs attached to VG with filter
# ntnx_volume_groups_vms_info_v2:
# filter: extId eq '{{ vm1_uuid }}'
# ext_id: "{{ vg1_uuid }}"
# register: result

# - name: Verify fetching VM attached using filter
# ansible.builtin.assert:
# that:
# - result.error == None
# - result.changed == false
# - result.response | length == 1
# - result.response[0].ext_id == "{{ vm1_uuid }}"

# fail_msg: "Unable to verify fetching VM attached using filter"
# success_msg: "Fetching VM attached using filter verified successfully"

############################################ Detach VM tests ############################################

- name: Detach VM1 from VG
Expand All @@ -259,24 +208,6 @@
fail_msg: "Unable to detach VM from VG"
success_msg: "VM detached from VG successfully"

# Need to verify here that VM is detached from VG

# - name: Fetch all VMs attached to VG
# ntnx_volume_groups_vms_info_v2:
# ext_id: "{{ vg1_uuid }}"
# register: result

# - name: Verify VM1 is detached from VG
# ansible.builtin.assert:
# that:
# - result.error == None
# - result.changed == false
# - result.response | length == 1
# - result.response[0].ext_id == "{{ vm2_uuid }}"

# fail_msg: "Unable to verify VM1 is detached from VG"
# success_msg: "VM1 is detached from VG verified successfully"

- name: Detach VM2 from VG
ntnx_volume_groups_vms_v2:
state: absent
Expand All @@ -295,23 +226,6 @@
fail_msg: "Unable to detach VM2 from VG"
success_msg: "VM2 detached from VG successfully"

# Need to verify here that VM is detached from VG

# - name: Fetch all VMs attached to VG
# ntnx_volume_groups_vms_info_v2:
# ext_id: "{{ vg1_uuid }}"
# register: result

# - name: Verify VM2 is detached from VG
# ansible.builtin.assert:
# that:
# - result.error == None
# - result.changed == false
# - result.response | length == 0

# fail_msg: "Unable to verify VM2 is detached from VG"
# success_msg: "VM2 is detached from VG verified successfully"

############################################ Cleanup tests ############################################

- name: Delete VM1
Expand Down

0 comments on commit ddec6d8

Please sign in to comment.