use of com.vmware.vim25.FileBackedVirtualDiskSpec in project photon-model by vmware.
the class DiskClient method createVirtualDiskSpec.
/**
* Create virtual disk spec for creating the virtual disk
*/
private FileBackedVirtualDiskSpec createVirtualDiskSpec(DiskStateExpanded diskStateExpanded, List<VirtualMachineDefinedProfileSpec> pbmSpec) {
if (diskStateExpanded.capacityMBytes <= 0) {
throw new IllegalArgumentException("Capacity of disk should be greater than 0");
}
if (diskStateExpanded.name == null || diskStateExpanded.name.isEmpty()) {
throw new IllegalArgumentException("Disk name should not be empty");
}
FileBackedVirtualDiskSpec diskSpec = new FileBackedVirtualDiskSpec();
diskSpec.setCapacityKb(toKb(diskStateExpanded.capacityMBytes));
VirtualDiskType provisionType = getDiskProvisioningType(diskStateExpanded);
if (provisionType != null) {
diskSpec.setDiskType(provisionType.value());
} else {
// Default it to THIN
diskSpec.setDiskType(VirtualDiskType.THIN.value());
}
diskSpec.setAdapterType(VirtualDiskAdapterType.LSI_LOGIC.value());
if (pbmSpec != null) {
diskSpec.getProfile().addAll(pbmSpec);
}
return diskSpec;
}
Aggregations