This commit is contained in:
2024-12-23 16:59:51 +03:00
parent 45355b3dd3
commit 6b102946de
3 changed files with 43 additions and 19 deletions

View File

@@ -76,7 +76,8 @@ class decort_kvmvm(DecortController):
self.comp_id, self.comp_info, self.rg_id = self.compute_find(comp_id=arg_amodule.params['id'],
comp_name=arg_amodule.params['name'],
rg_id=validated_rg_id,
check_state=False)
check_state=False,
need_custom_fields=True)
if self.comp_id:
self.comp_should_exist = True
@@ -346,7 +347,10 @@ class decort_kvmvm(DecortController):
)
# read in Compute facts once more after all initial setup is complete
_, self.comp_info, _ = self.compute_find(comp_id=self.comp_id)
_, self.comp_info, _ = self.compute_find(
comp_id=self.comp_id,
need_custom_fields=True,
)
self.skip_final_get = True
@@ -369,7 +373,10 @@ class decort_kvmvm(DecortController):
"""
self.compute_restore(comp_id=self.comp_id)
# TODO - do we need updated comp_info to manage port forwards and size after VM is restored?
_, self.comp_info, _ = self.compute_find(comp_id=self.comp_id)
_, self.comp_info, _ = self.compute_find(
comp_id=self.comp_id,
need_custom_fields=True,
)
self.modify()
self.comp_should_exist = True
return
@@ -801,7 +808,10 @@ def main():
# TODO - check if restore API returns VM ID (similarly to VM create API)
subj.compute_restore(comp_id=subj.comp_id)
# TODO - do we need updated comp_info to manage port forwards and size after VM is restored?
_, subj.comp_info, _ = subj.compute_find(comp_id=subj.comp_id)
_, subj.comp_info, _ = subj.compute_find(
comp_id=subj.comp_id,
need_custom_fields=True,
)
subj.modify()
elif amodule.params['state'] == 'absent':
# subj.nop()
@@ -837,7 +847,10 @@ def main():
if subj.comp_should_exist:
if subj.result['changed'] and not subj.skip_final_get:
# There were changes to the Compute - refresh Compute facts.
_, subj.comp_info, _ = subj.compute_find(comp_id=subj.comp_id)
_, subj.comp_info, _ = subj.compute_find(
comp_id=subj.comp_id,
need_custom_fields=True,
)
#
# We no longer need to re-read RG facts, as all network info is now available inside
# compute structure