From 38b7c80217c4e72b1d8988eb1e60bb6e77334114 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 18 Apr 2024 07:52:22 +0200 Subject: Adding upstream version 9.4.0+dfsg. Signed-off-by: Daniel Baumann --- .../dellemc/powerflex/plugins/modules/device.py | 85 +++++++++++++--------- 1 file changed, 51 insertions(+), 34 deletions(-) (limited to 'ansible_collections/dellemc/powerflex/plugins/modules/device.py') diff --git a/ansible_collections/dellemc/powerflex/plugins/modules/device.py b/ansible_collections/dellemc/powerflex/plugins/modules/device.py index a321315e3..e83353185 100644 --- a/ansible_collections/dellemc/powerflex/plugins/modules/device.py +++ b/ansible_collections/dellemc/powerflex/plugins/modules/device.py @@ -109,6 +109,14 @@ options: choices: ['present', 'absent'] required: true type: str + force: + description: + - Using the Force flag to add a device. + - Use this flag, to overwrite existing data on the device. + - Use this flag with caution, because all data on the device will be + destroyed. + type: bool + default: false notes: - The value for device_id is generated only after successful addition of the device. @@ -135,6 +143,22 @@ EXAMPLES = r''' protection_domain_name: "domain1" external_acceleration_type: "ReadAndWrite" state: "present" +- name: Add a device with force flag + dellemc.powerflex.device: + hostname: "{{hostname}}" + username: "{{username}}" + password: "{{password}}" + validate_certs: "{{validate_certs}}" + port: "{{port}}" + current_pathname: "/dev/sdb" + sds_name: "node1" + media_type: "HDD" + device_name: "device2" + storage_pool_name: "pool1" + protection_domain_name: "domain1" + external_acceleration_type: "ReadAndWrite" + force: true + state: "present" - name: Get device details using device_id dellemc.powerflex.device: hostname: "{{hostname}}" @@ -166,23 +190,23 @@ EXAMPLES = r''' state: "present" - name: Remove a device using device_id dellemc.powerflex.device: - hostname: "{{hostname}}" - username: "{{username}}" - password: "{{password}}" - validate_certs: "{{validate_certs}}" - port: "{{port}}" - device_id: "76eb7e2f00010000" - state: "absent" + hostname: "{{hostname}}" + username: "{{username}}" + password: "{{password}}" + validate_certs: "{{validate_certs}}" + port: "{{port}}" + device_id: "76eb7e2f00010000" + state: "absent" - name: Remove a device using (current_pathname, sds_id) dellemc.powerflex.device: - hostname: "{{hostname}}" - username: "{{username}}" - password: "{{password}}" - validate_certs: "{{validate_certs}}" - port: "{{port}}" - current_pathname: "/dev/sdb" - sds_name: "node1" - state: "absent" + hostname: "{{hostname}}" + username: "{{username}}" + password: "{{password}}" + validate_certs: "{{validate_certs}}" + port: "{{port}}" + current_pathname: "/dev/sdb" + sds_name: "node1" + state: "absent" ''' RETURN = r''' @@ -715,12 +739,11 @@ class PowerFlexDevice(object): self.powerflex_conn.device.create( current_pathname=current_pathname, - sds_id=sds_id, - acceleration_pool_id=acceleration_pool_id, + sds_id=sds_id, acceleration_pool_id=acceleration_pool_id, external_acceleration_type=external_acceleration_type, - media_type=media_type, - name=device_name, - storage_pool_id=storage_pool_id) + media_type=media_type, name=device_name, + storage_pool_id=storage_pool_id, + force=self.module.params['force']) return True except Exception as e: error_msg = "Adding device %s operation failed with " \ @@ -1076,21 +1099,15 @@ def get_powerflex_device_parameters(): """This method provide parameter required for the device module on PowerFlex""" return dict( - current_pathname=dict(), - device_name=dict(), - device_id=dict(), - sds_name=dict(), - sds_id=dict(), - storage_pool_name=dict(), - storage_pool_id=dict(), - acceleration_pool_id=dict(), - acceleration_pool_name=dict(), - protection_domain_name=dict(), - protection_domain_id=dict(), - external_acceleration_type=dict(choices=['Invalid', 'None', 'Read', - 'Write', 'ReadAndWrite']), + current_pathname=dict(), device_name=dict(), device_id=dict(), + sds_name=dict(), sds_id=dict(), storage_pool_name=dict(), + storage_pool_id=dict(), acceleration_pool_id=dict(), + acceleration_pool_name=dict(), protection_domain_name=dict(), + protection_domain_id=dict(), external_acceleration_type=dict( + choices=['Invalid', 'None', 'Read', 'Write', 'ReadAndWrite']), media_type=dict(choices=['HDD', 'SSD', 'NVDIMM']), - state=dict(required=True, type='str', choices=['present', 'absent']) + state=dict(required=True, type='str', choices=['present', 'absent']), + force=dict(type='bool', default=False) ) -- cgit v1.2.3