From bc317d1438c0bf625cce63539fe8da126e3f6c66 Mon Sep 17 00:00:00 2001 From: Sergey Shubin svs1370 Date: Mon, 29 Mar 2021 10:14:43 +0300 Subject: [PATCH] Change default pool name for disk provisioning to empty string --- library/decort_disk.py | 7 +++---- module_utils/decort_utils.py | 7 ++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/library/decort_disk.py b/library/decort_disk.py index d71025f..b117113 100644 --- a/library/decort_disk.py +++ b/library/decort_disk.py @@ -139,7 +139,7 @@ options: description: - Name of the pool where to place new disk. Once disk is created, its pool cannot be changed. - This parameter is used when creating new disk and igonred for all other operations. - default: default + default: empty string required: no sep_id: description: @@ -209,7 +209,6 @@ EXAMPLES = ''' controller_url: "https://cloud.digitalenergy.online" name: "MyDataDisk01" sep_id: 1 - pool: "default" size: 50 account_name: "MyAccount" state: present @@ -316,7 +315,7 @@ def decort_disk_parameters(): fallback=(env_fallback, ['DECORT_PASSWORD']), no_log=True), place_with=dict(type='int', required=False, default=0), - pool=dict(type='str', required=False, default='default'), + pool=dict(type='str', required=False, default=''), sep_id=dict(type='int', required=False, default=0), size=dict(type='int', required=False), state=dict(type='str', @@ -402,7 +401,7 @@ def main(): disk_should_exist = False target_sep_id = 0 - target_pool = "default" + # target_pool = "" if disk_id: disk_should_exist = True diff --git a/module_utils/decort_utils.py b/module_utils/decort_utils.py index d45270d..e3c18ac 100644 --- a/module_utils/decort_utils.py +++ b/module_utils/decort_utils.py @@ -2323,7 +2323,7 @@ class DecortController(object): return 0, None - def disk_provision(self, disk_name, size, account_id, sep_id, pool="default", desc="", location=""): + def disk_provision(self, disk_name, size, account_id, sep_id, pool_name="", desc="", location=""): """Provision Disk according to the specified arguments. Note that disks created by this method will be of type 'D' (data disks). If critical error occurs the embedded call to API function will abort further execution @@ -2361,8 +2361,9 @@ class DecortController(object): description=desc, size=size, type='D', - sep_id=sep_id, - pool=pool,) + sep_id=sep_id,) + if pool_name != "": + api_params['pool'] = pool_name api_resp = self.decort_api_call(requests.post, "/restmachine/cloudapi/disks/create", api_params) if api_resp.status_code == 200: ret_disk_id = json.loads(api_resp.content.decode('utf8'))