From b17858af719a71c1903c7d7e42e3a6c0443f5f0f Mon Sep 17 00:00:00 2001 From: Gevorg-Khachatryaan Date: Tue, 3 Oct 2023 16:59:05 +0400 Subject: [PATCH] fix for issue#360 --- plugins/module_utils/prism/vms.py | 5 ++++- plugins/modules/ntnx_vms_clone.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/module_utils/prism/vms.py b/plugins/module_utils/prism/vms.py index a1ca89876..687dbfedb 100644 --- a/plugins/module_utils/prism/vms.py +++ b/plugins/module_utils/prism/vms.py @@ -224,7 +224,7 @@ def _build_spec_cluster(self, payload, param): uuid, err = get_cluster_uuid(param, self.module) if err: return None, err - payload["spec"]["cluster_reference"]["uuid"] = uuid + payload["spec"]["cluster_reference"] = {"kind": "cluster", "uuid": uuid} return payload, None def _build_spec_vcpus(self, payload, vcpus): @@ -340,7 +340,10 @@ def _build_spec_disks(self, payload, vdisks): return payload, None def _build_spec_boot_config(self, payload, param): + if not payload["spec"]["resources"].get("boot_config"): + payload["spec"]["resources"]["boot_config"] = self._get_default_spec()["spec"]["resources"]["boot_config"] boot_config = payload["spec"]["resources"]["boot_config"] + if "LEGACY" == param["boot_type"] and "boot_order" in param: boot_config["boot_device_order_list"] = param["boot_order"] diff --git a/plugins/modules/ntnx_vms_clone.py b/plugins/modules/ntnx_vms_clone.py index dd1d0dc6a..5b4d35a5f 100644 --- a/plugins/modules/ntnx_vms_clone.py +++ b/plugins/modules/ntnx_vms_clone.py @@ -285,6 +285,7 @@ def get_module_spec(): def clone_vm(module, result): src_vm_uuid = module.params["src_vm_uuid"] + result["src_vm_uuid"] = src_vm_uuid vm = VM(module) @@ -305,7 +306,8 @@ def clone_vm(module, result): if module.params.get("wait"): wait_for_task_completion(module, result) - resp = vm.read(src_vm_uuid) + vm_uuid = result["response"]["entity_reference_list"][0]["uuid"] + resp = vm.read(vm_uuid) result["response"] = resp