简体   繁体   中英

Create a Virtual machine using vmware vcenter VM template

I have a virtual machine template in VMware vCenter. I wanted to use that VM template, again and again, to create multiple virtual machines using Java API. I looked at site http://pubs.vmware.com/vsphere-50/index.jsp?topic=/com.vmware.wssdk.pg.doc_50/PG_Ch10_VM_Config.12.3.html for reference. Here I got the creation of VM with new gest os, But I wanted to create VMs using a specific template within vCenter.

Any code snippet to create VMs using VM template will be very helpful.

Instead of using the "CreateVM_Task" method, you'll want to use the "CloneVM_Task" method.

Here's some example code: https://communities.vmware.com/docs/DOC-10818

Finally I found a good example https://github.com/Juniper/vijava/blob/master/src/com/vmware/vim25/mo/samples/vm/VMClone.java

In my case, I had to add ResourcePool MOR to VirtualMachineRelocateSpec object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM