pyvmomi-community-samples icon indicating copy to clipboard operation
pyvmomi-community-samples copied to clipboard

how to create a linked clone vm out of a template?

Open plrnr opened this issue 6 years ago • 2 comments

According to this: https://github.com/vmware/pyvmomi/issues/362 you have to have a snapshot which is not possible on a template.

So, is it even possible to do a linked clone out of a template? If not, is there another method to create a VM fastly from template?

plrnr avatar Apr 05 '19 01:04 plrnr

You would have to take a snapshot while it is still a VM, then mark it as a template and then link clone from that. Note that some versions of vSphere don't handle this properly, so try it on a test vm before hooking that up to your main automation.

prziborowski avatar Apr 05 '19 02:04 prziborowski

The govc client from the govmomi project lets you create a clone with the following.

$ govc ls -json /mydc/vm/user/template/eval-win81x86-enterprise | jq .elements[].Object.Config | grep -i Template
  "Template": true,
$ govc vm.clone -ds=mydc -vm=user/template/eval-win81x86-enterprise -link=true removethis
[05-08-20 17:24:22] Cloning /mydc/vm/user/template/eval-win81x86-enterprise to removethis...(42%)^C
$

So it's definitely possible...

arizvisa avatar Aug 05 '20 22:08 arizvisa