From ddec6d82166240b48635029cba9105499cd6924b Mon Sep 17 00:00:00 2001 From: abhinavbansal29 Date: Mon, 23 Dec 2024 14:05:26 +0530 Subject: [PATCH] Addressed Comments --- ...tnx_volume_groups_iscsi_clients_info_v2.py | 25 ------ .../tasks/iscsi_client_connections.yml | 74 ---------------- .../tasks/ahv_vm_vg_connections.yml | 86 ------------------- 3 files changed, 185 deletions(-) diff --git a/plugins/modules/ntnx_volume_groups_iscsi_clients_info_v2.py b/plugins/modules/ntnx_volume_groups_iscsi_clients_info_v2.py index 24ec2d40..51bd912f 100644 --- a/plugins/modules/ntnx_volume_groups_iscsi_clients_info_v2.py +++ b/plugins/modules/ntnx_volume_groups_iscsi_clients_info_v2.py @@ -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) @@ -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 }}" @@ -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: [ @@ -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 @@ -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 @@ -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) diff --git a/tests/integration/targets/ntnx_volume_groups_iscsi_clients_v2/tasks/iscsi_client_connections.yml b/tests/integration/targets/ntnx_volume_groups_iscsi_clients_v2/tasks/iscsi_client_connections.yml index 4585ada3..c8abd40c 100644 --- a/tests/integration/targets/ntnx_volume_groups_iscsi_clients_v2/tasks/iscsi_client_connections.yml +++ b/tests/integration/targets/ntnx_volume_groups_iscsi_clients_v2/tasks/iscsi_client_connections.yml @@ -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 }}" @@ -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 }}" @@ -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 }}" @@ -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 diff --git a/tests/integration/targets/ntnx_volume_groups_vms_v2/tasks/ahv_vm_vg_connections.yml b/tests/integration/targets/ntnx_volume_groups_vms_v2/tasks/ahv_vm_vg_connections.yml index 63bb144a..05d35e3b 100644 --- a/tests/integration/targets/ntnx_volume_groups_vms_v2/tasks/ahv_vm_vg_connections.yml +++ b/tests/integration/targets/ntnx_volume_groups_vms_v2/tasks/ahv_vm_vg_connections.yml @@ -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 @@ -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 @@ -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