Builder<VMSpec> vmSpecs = ImmutableSet.builder();
int noOfVms = 2;
for (int i = 0; i < noOfVms; i++) {
// TODO: determine the sizes available in the VDC, for example there's
// a minimum size of boot disk, and also a preset combination of cpu count vs ram
VMSpec vmSpec = VMSpec.builder().name(name + i).operatingSystem(os).memoryInGig(2).networkTierName(
networkTierName).addDataDrive("/data01", 25).build();
vmSpecs.add(vmSpec);
}
Set<Task> tasks = api.addMultipleVMsIntoVDC(vpdc.getHref(), vmSpecs.build());