VMware {code} Community
VMVCenter
Contributor
Contributor

Customization of Virtual Machine at time of creation(cloning) using VSphere SDK 6.0 Java application.

Hi,

I'm working on Virtual Machine provisioning using VSphere SDK 6.0. I have succeeded in provisioning the virtual machine from template using the following method

ManagedObjectReference cloneTask = vimPort.cloneVMTask(vmRef, vmFolderRef, cloneName, cloneSpec);

I have also got the customization of Memory, CPU with the following method.


VirtualMachineConfigSpec configSpec = new VirtualMachineConfigSpec();
  configSpec
.setMemoryMB(512l);
  configSpec
.setNumCPUs(2);


I want to know more customization using the SDK like HarkDisk, N/W Adapter, Networking details etc. Help me to get some java code samples with the customization of the virtual machine or get me some links mentioning about the same. Any help would be grateful.


Thanks

Saumya T M

1 Reply
doskiran
Enthusiast
Enthusiast

Here is few java code samples to customize VM HardDisk(add or extend), Network adapters(add) and assigning specific nics to VSS/DVS portgroups.

1) Add new harddisk with specified capacity and disk provisioning type for a VM

Add new harddisk with specified capacity and disk provisioning type for a VM - Samples

2) Extend the existing VM harddisk with specified capacity

Extend VM Hard Disk - Samples

3) Add new network adapter and assign the nic to specified standard switch portgroup

Add and Reconfig VM Nic To VSS - Samples

4) Add new network adapter and assign the nic to specified distributed switch portgroup

Add a new network adapter and assign the nic to specified distributed switch portgroup - Samples

5) Assign particular dvSwitch portgroup to the specified network adapter

Assign dvSwitch portgroup to the specified VM network adapter - Samples

Thanks,

Kiran