Quantcast
Channel: VMware Communities : Discussion List - vSphere SDK for Perl
Viewing all articles
Browse latest Browse all 1577

ViJava: Thin provisioned disks when cloning from template

$
0
0

I have been trying to change the disks on a vm cloned from a template to be thin provisioned.

 

 

final List<VirtualDeviceConfigSpec> deviceChange = new ArrayList<VirtualDeviceConfigSpec>();
final VirtualMachineConfigInfo templateConfig = (VirtualMachineConfigInfo) template                .getConfig();
final VirtualDevice[] vds = templateConfig.getHardware().getDevice();      
for (int k = 0; k < vds.length; k++) {    if (vds[k].getDeviceInfo().getLabel()            .contains("Hard disk")) {        final VirtualDeviceConfigSpec spec = new VirtualDeviceConfigSpec();        spec.setOperation(VirtualDeviceConfigSpecOperation.edit);        VirtualDiskFlatVer2BackingInfo backing = (VirtualDiskFlatVer2BackingInfo) vds[k].getBacking();        backing.setThinProvisioned(true);        vds[k].setBacking(backing);        spec.setDevice(vds[k]);        deviceChange.add(spec);    }

deviceChange is then added to a VirtualMachineConfigSpec which is added to a VirtualMachineCloneSpec which is then used to get a storagePod recommendation.  Using this code I can successfully clone the template and change any of the other disk attributes but the disks on the cloned vm are always thick.  I am running vijava 5.1 on VMFS5 datastores organized into a storagePod.  Any help would be greatly appreciated.


Viewing all articles
Browse latest Browse all 1577

Trending Articles