This commit is contained in:
2024-12-18 14:08:14 +03:00
parent 54c306b13b
commit 45355b3dd3
4 changed files with 28 additions and 100 deletions

View File

@@ -1207,6 +1207,13 @@ class DecortController(object):
ret_comp_dict['interfaces'].sort(key=lambda k: k['pciSlot'])
ret_rg_id = ret_comp_dict['rgId']
custom_fields = None
if ret_comp_dict['status'] not in ('DESTROYED', 'DELETED'):
custom_fields = self.compute_get_custom_fields(
compute_id=ret_comp_id,
)
ret_comp_dict['custom_fields'] = custom_fields
else:
self.result['warning'] = ("compute_get_by_id(): failed to get Compute by ID {}. HTTP code {}, "
"response {}.").format(comp_id, api_resp.status_code, api_resp.reason)
@@ -1378,8 +1385,7 @@ class DecortController(object):
start_on_create=True,
cpu_pin: bool = False,
hp_backed: bool = False,
numa_affinity: Literal['none', 'loose', 'strict'] = 'none',
custom_fields: Optional[dict] = None):
numa_affinity: Literal['none', 'loose', 'strict'] = 'none'):
"""Manage KVM VM provisioning. To remove existing KVM VM compute instance use compute_remove method,
to resize use compute_resize, to manage power state use compute_powerstate method.
@@ -1430,8 +1436,6 @@ class DecortController(object):
api_params['hpBacked'] = hp_backed
api_params['numaAffinity'] = numa_affinity
if custom_fields is not None:
api_params['customFields'] = json.dumps(custom_fields)
if userdata:
api_params['userdata'] = json.dumps(userdata) # we need to pass a string object as "userdata"