Fixing KVM VM mgmt scenarios (contd.)
This commit is contained in:
@@ -628,6 +628,7 @@ class decort_kvmvm(DecortController):
|
|||||||
disk_size=0,
|
disk_size=0,
|
||||||
data_disks=[], # IDs of attached data disks; this list can be emty
|
data_disks=[], # IDs of attached data disks; this list can be emty
|
||||||
state="CHECK_MODE",
|
state="CHECK_MODE",
|
||||||
|
tech_status="",
|
||||||
account_id=0,
|
account_id=0,
|
||||||
rg_id=0,
|
rg_id=0,
|
||||||
username="",
|
username="",
|
||||||
@@ -649,6 +650,7 @@ class decort_kvmvm(DecortController):
|
|||||||
ret_dict['name'] = self.comp_info['name']
|
ret_dict['name'] = self.comp_info['name']
|
||||||
ret_dict['arch'] = self.comp_info['arch']
|
ret_dict['arch'] = self.comp_info['arch']
|
||||||
ret_dict['state'] = self.comp_info['status']
|
ret_dict['state'] = self.comp_info['status']
|
||||||
|
ret_dict['tech_status'] = self.comp_info['techStatus']
|
||||||
ret_dict['account_id'] = self.comp_info['accountId']
|
ret_dict['account_id'] = self.comp_info['accountId']
|
||||||
ret_dict['rg_id'] = self.comp_info['rgId']
|
ret_dict['rg_id'] = self.comp_info['rgId']
|
||||||
# if the VM is an imported VM, then the 'accounts' list may be empty,
|
# if the VM is an imported VM, then the 'accounts' list may be empty,
|
||||||
@@ -792,9 +794,9 @@ def main():
|
|||||||
if subj.comp_id:
|
if subj.comp_id:
|
||||||
# Compute is found - package facts and report success to Ansible
|
# Compute is found - package facts and report success to Ansible
|
||||||
subj.result['failed'] = False
|
subj.result['failed'] = False
|
||||||
subj.comp_info = subj.compute_find(comp_id=subj.comp_id)
|
# _, subj.comp_info, _ = subj.compute_find(comp_id=subj.comp_id)
|
||||||
_, rg_facts = subj.rg_find(rg_id=subj.rg_id)
|
# _, rg_facts = subj.rg_find(arg_account_id=0, arg_rg_id=subj.rg_id)
|
||||||
subj.result['facts'] = subj.package_facts(rg_facts, amodule.check_mode)
|
subj.result['facts'] = subj.package_facts(amodule.check_mode)
|
||||||
amodule.exit_json(**subj.result)
|
amodule.exit_json(**subj.result)
|
||||||
# we exit the module at this point
|
# we exit the module at this point
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -685,7 +685,7 @@ class DecortController(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
powerstate_api = "" # this string will also be used as a flag to indicate that API call is necessary
|
powerstate_api = "" # this string will also be used as a flag to indicate that API call is necessary
|
||||||
api_params = dict(compId=comp_facts['id'])
|
api_params = dict(computeId=comp_facts['id'])
|
||||||
expected_state = ""
|
expected_state = ""
|
||||||
|
|
||||||
if comp_facts['techStatus'] == "STARTED":
|
if comp_facts['techStatus'] == "STARTED":
|
||||||
@@ -694,7 +694,7 @@ class DecortController(object):
|
|||||||
expected_techState = "PAUSED"
|
expected_techState = "PAUSED"
|
||||||
elif target_state in ('poweredoff', 'halted', 'stopped'):
|
elif target_state in ('poweredoff', 'halted', 'stopped'):
|
||||||
powerstate_api = "/restmachine/cloudapi/compute/stop"
|
powerstate_api = "/restmachine/cloudapi/compute/stop"
|
||||||
params['force'] = force_change
|
api_params['force'] = force_change
|
||||||
expected_techState = "STOPPED"
|
expected_techState = "STOPPED"
|
||||||
elif target_state == 'restarted':
|
elif target_state == 'restarted':
|
||||||
powerstate_api = "/restmachine/cloudapi/compute/reboot"
|
powerstate_api = "/restmachine/cloudapi/compute/reboot"
|
||||||
|
|||||||
Reference in New Issue
Block a user