Skip to content

Commit

Permalink
vcsim: Take the host parameter into account while cloning a VM on a c…
Browse files Browse the repository at this point in the history
…luster

Closes: vmware#2495
  • Loading branch information
jpillon authored and Yue Yin committed Jan 12, 2022
1 parent 2b565cb commit 7180480
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions simulator/virtual_machine.go
Expand Up @@ -1701,8 +1701,15 @@ func (vm *VirtualMachine) CloneVMTask(ctx *Context, req *types.CloneVM_Task) soa
pool = vm.ResourcePool
}
}

destHost := vm.Runtime.Host

if req.Spec.Location.Host != nil {
destHost = req.Spec.Location.Host
}

folder, _ := asFolderMO(Map.Get(req.Folder))
host := Map.Get(*vm.Runtime.Host).(*HostSystem)
host := Map.Get(*destHost).(*HostSystem)
event := vm.event()

ctx.postEvent(&types.VmBeingClonedEvent{
Expand Down Expand Up @@ -1775,7 +1782,7 @@ func (vm *VirtualMachine) CloneVMTask(ctx *Context, req *types.CloneVM_Task) soa
This: folder.Self,
Config: config,
Pool: *pool,
Host: vm.Runtime.Host,
Host: destHost,
})

ctask := Map.Get(res.(*methods.CreateVM_TaskBody).Res.Returnval).(*Task)
Expand Down

0 comments on commit 7180480

Please sign in to comment.