Skip to content

Commit

Permalink
fix for issue#360 (#408)
Browse files Browse the repository at this point in the history
* fix for issue#360

* fix

---------

Co-authored-by: Gevorg-Khachatryaan <Gevorg1050.1>
  • Loading branch information
Gevorg-Khachatryan-97 authored Oct 31, 2023
1 parent 5c94380 commit 7a9f51a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 12 additions & 1 deletion plugins/module_utils/prism/vms.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,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(
{
Expand Down Expand Up @@ -241,7 +249,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):
Expand Down Expand Up @@ -357,7 +365,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"]

Expand Down
4 changes: 3 additions & 1 deletion plugins/modules/ntnx_vms_clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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


Expand Down

0 comments on commit 7a9f51a

Please sign in to comment.