diff --git a/plugins/module_utils/prism/vms.py b/plugins/module_utils/prism/vms.py index a1ca89876..feddffaf3 100644 --- a/plugins/module_utils/prism/vms.py +++ b/plugins/module_utils/prism/vms.py @@ -169,6 +169,14 @@ def _get_default_spec(self): } ) + def _get_default_boot_config_spec(self): + return deepcopy( + { + "boot_type": "LEGACY", + "boot_device_order_list": ["CDROM", "DISK", "NETWORK"], + } + ) + def _get_default_network_spec(self): return deepcopy( { @@ -224,7 +232,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 +348,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_boot_config_spec() 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