4.8.7 decort/basis version update

rc-5.2.5
Alex_geth 2 years ago
parent 5be2e850ce
commit 207c04bb77

@ -541,7 +541,7 @@ class DecortController(object):
return return
def compute_delete(self, comp_id, permanently=False): def compute_delete(self, comp_id, permanently=False,detach=True):
"""Delete a Compute instance identified by its ID. It is assumed that the Compute with the specified """Delete a Compute instance identified by its ID. It is assumed that the Compute with the specified
ID exists. ID exists.
@ -559,7 +559,8 @@ class DecortController(object):
return return
api_params = dict(computeId=comp_id, api_params = dict(computeId=comp_id,
permanently=permanently, ) permanently=permanently,
detachDisks=detach, )
self.decort_api_call(requests.post, "/restmachine/cloudapi/compute/delete", api_params) self.decort_api_call(requests.post, "/restmachine/cloudapi/compute/delete", api_params)
# On success the above call will return here. On error it will abort execution by calling fail_json. # On success the above call will return here. On error it will abort execution by calling fail_json.
self.result['failed'] = False self.result['failed'] = False
@ -657,7 +658,7 @@ class DecortController(object):
# if we have validated RG ID at this point, look up Compute by name in this RG # if we have validated RG ID at this point, look up Compute by name in this RG
# rg.vms list contains IDs of compute instances registered with this RG until compute is # rg.vms list contains IDs of compute instances registered with this RG until compute is
# destroyed. So we may see here computes in "active" and DELETED states. # destroyed. So we may see here computes in "active" and DELETED states.
for runner in comp_list: for runner in comp_list['data']:
if runner['name'] == comp_name and runner['rgId'] == rg_id: if runner['name'] == comp_name and runner['rgId'] == rg_id:
if not check_state or runner['status'] not in COMP_INVALID_STATES: if not check_state or runner['status'] not in COMP_INVALID_STATES:
ret_comp_id = runner['id'] ret_comp_id = runner['id']
@ -800,7 +801,7 @@ class DecortController(object):
sepId=sep_id, sepId=sep_id,
pool=pool_name, pool=pool_name,
start=start_on_create, # start_machine parameter requires DECORT API ver 3.3.1 or higher start=start_on_create, # start_machine parameter requires DECORT API ver 3.3.1 or higher
netType="NONE") # we create VM without any network connections interfaces='[]') # we create VM without any network connections
if userdata: if userdata:
api_params['userdata'] = json.dumps(userdata) # we need to pass a string object as "userdata" api_params['userdata'] = json.dumps(userdata) # we need to pass a string object as "userdata"
@ -1657,7 +1658,7 @@ class DecortController(object):
if api_resp.status_code == 200: if api_resp.status_code == 200:
account_specs = json.loads(api_resp.content.decode('utf8')) account_specs = json.loads(api_resp.content.decode('utf8'))
#api_params.pop('accountId') #api_params.pop('accountId')
for rg_item in account_specs: for rg_item in account_specs['data']:
# #
if rg_item['name'] == arg_rg_name: if rg_item['name'] == arg_rg_name:
# name matches # name matches
@ -2084,7 +2085,7 @@ class DecortController(object):
if api_resp.status_code == 200: if api_resp.status_code == 200:
locations = json.loads(api_resp.content.decode('utf8')) locations = json.loads(api_resp.content.decode('utf8'))
if location_code == "" and locations: if location_code == "" and locations:
ret_gid = locations[0]['gid'] ret_gid = locations['data'][0]['gid']
else: else:
for runner in locations: for runner in locations:
if runner['locationCode'] == location_code: if runner['locationCode'] == location_code:
@ -2178,7 +2179,7 @@ class DecortController(object):
"response {}.").format(rg_id, api_resp.status_code, api_resp.reason) "response {}.").format(rg_id, api_resp.status_code, api_resp.reason)
return [] return []
return ret_rg_vins_list return ret_rg_vins_list['data']
def vins_find(self, vins_id, vins_name="", account_id=0, rg_id=0, rg_facts="", check_state=True): def vins_find(self, vins_id, vins_name="", account_id=0, rg_id=0, rg_facts="", check_state=True):
"""Find specified ViNS. """Find specified ViNS.
@ -2626,7 +2627,8 @@ class DecortController(object):
else: else:
self.result['warning'] = ("get_all_account_vinses(): failed to get list VINS in Account ID {}. HTTP code {}, " self.result['warning'] = ("get_all_account_vinses(): failed to get list VINS in Account ID {}. HTTP code {}, "
"response {}.").format(acc_id, api_resp.status_code, api_resp.reason) "response {}.").format(acc_id, api_resp.status_code, api_resp.reason)
return ret_listvins_dict return []
return ret_listvins_dict['data']
def _vins_vnf_addmgmtaddr(self,dev_id,mgmtip): def _vins_vnf_addmgmtaddr(self,dev_id,mgmtip):
api_params = dict(devId=dev_id,ip=mgmtip) api_params = dict(devId=dev_id,ip=mgmtip)
@ -3281,7 +3283,7 @@ class DecortController(object):
api_resp = self.decort_api_call(requests.post, "/restmachine/cloudapi/k8s/list", api_params) api_resp = self.decort_api_call(requests.post, "/restmachine/cloudapi/k8s/list", api_params)
if api_resp.status_code == 200: if api_resp.status_code == 200:
k8s_list = json.loads(api_resp.content.decode('utf8')) k8s_list = json.loads(api_resp.content.decode('utf8'))
for k8s_item in k8s_list: for k8s_item in k8s_list['data']:
if k8s_item['name'] == k8s_name and k8s_item['rgId'] == rg_id: if k8s_item['name'] == k8s_name and k8s_item['rgId'] == rg_id:
if not check_state or k8s_item['status'] not in K8S_INVALID_STATES: if not check_state or k8s_item['status'] not in K8S_INVALID_STATES:
# TODO: rework after k8s/get wilb be updated # TODO: rework after k8s/get wilb be updated
@ -3576,7 +3578,7 @@ class DecortController(object):
k8ci_id_present = False k8ci_id_present = False
if api_resp.status_code == 200: if api_resp.status_code == 200:
ret_k8ci_list = json.loads(api_resp.content.decode('utf8')) ret_k8ci_list = json.loads(api_resp.content.decode('utf8'))
for k8ci_item in ret_k8ci_list: for k8ci_item in ret_k8ci_list['data']:
if k8ci_item['id'] == arg_k8ci_id: if k8ci_item['id'] == arg_k8ci_id:
k8ci_id_present = True k8ci_id_present = True
break break
@ -3636,7 +3638,8 @@ class DecortController(object):
else: else:
self.result['warning'] = ("bservice_rg_list(): failed to get B-service list. HTTP code {}, " self.result['warning'] = ("bservice_rg_list(): failed to get B-service list. HTTP code {}, "
"response {}.").format(api_resp.status_code, api_resp.reason) "response {}.").format(api_resp.status_code, api_resp.reason)
return ret_bs_dict return []
return ret_bs_dict['data']
def bservice_find(self,account_id,rg_id,bservice_name="",bservice_id = 0,check_state=True): def bservice_find(self,account_id,rg_id,bservice_name="",bservice_id = 0,check_state=True):
@ -3992,7 +3995,7 @@ class DecortController(object):
"response {}.").format(rg_id, api_resp.status_code, api_resp.reason) "response {}.").format(rg_id, api_resp.status_code, api_resp.reason)
return [] return []
return ret_rg_vins_list return ret_rg_vins_list['data']
def lb_find(self,lb_id=0,lb_name="",rg_id=0): def lb_find(self,lb_id=0,lb_name="",rg_id=0):
"""Find specified LB. """Find specified LB.

Loading…
Cancel
Save