Program: 48296
Project: 48296
Buggy source:
/** 
 * populate the base node with placement attributes, cluster/rp/host/datastore, etc. make sure there are enough cpu/mem/storage inside the rp and vc host
 * @param vcClusterName
 * @param rpName
 * @param host
 */
public void place(String rack,String vcClusterName,String rpName,AbstractHost host){
  AuAssert.check(getDisks() != null && getDisks().size() != 0);
  setTargetVcCluster(vcClusterName);
  setTargetHost(host.getName());
  setTargetRp(rpName);
  setTargetRack(rack);
  ArrayList<Disk> tmDisks=new ArrayList<Disk>();
  int lsiScsiIndex=1;
  int paraVirtualScsiIndex=0;
  for (  DiskSpec disk : this.disks) {
    if (disk.isSystemDisk()) {
      setTargetDs(disk.getTargetDs());
    }
 else {
      Disk tmDisk=new Disk();
      tmDisk.name=disk.getName();
      tmDisk.initialSizeMB=disk.getSize() * 1024;
      tmDisk.datastore=disk.getTargetDs();
      tmDisk.mode=DiskMode.independent_persistent;
      if (DiskScsiControllerType.LSI_CONTROLLER.equals(disk.getController())) {
        if (lsiScsiIndex == PlacementUtil.CONTROLLER_RESERVED_CHANNEL) {
          lsiScsiIndex++;
        }
        tmDisk.externalAddress=PlacementUtil.LSI_CONTROLLER_EXTERNAL_ADDRESS_PREFIX + lsiScsiIndex;
        lsiScsiIndex++;
      }
 else {
        tmDisk.externalAddress=PlacementUtil.getParaVirtualAddress(paraVirtualScsiIndex);
        paraVirtualScsiIndex=PlacementUtil.getNextValidParaVirtualScsiIndex(paraVirtualScsiIndex);
      }
      tmDisk.allocationType=AllocationType.valueOf(disk.getAllocType());
      tmDisk.type=disk.getDiskType().getType();
      tmDisks.add(tmDisk);
    }
  }
  DiskSchema diskSchema=new DiskSchema();
  diskSchema.setName("String_Node_Str");
  diskSchema.setDisks(tmDisks);
  this.vmSchema.diskSchema=diskSchema;
}

Fixed version (ground truth):
/** 
 * populate the base node with placement attributes, cluster/rp/host/datastore, etc. make sure there are enough cpu/mem/storage inside the rp and vc host
 * @param vcClusterName
 * @param rpName
 * @param host
 */
public void place(String rack,String vcClusterName,String rpName,AbstractHost host){
  AuAssert.check(getDisks() != null && getDisks().size() != 0);
  setTargetVcCluster(vcClusterName);
  setTargetHost(host.getName());
  setTargetRp(rpName);
  setTargetRack(rack);
  ArrayList<Disk> tmDisks=new ArrayList<Disk>();
  int lsiScsiIndex=0;
  int paraVirtualScsiIndex=0;
  StorageRead.DiskScsiControllerType sysSwapCtrlType=CommonUtil.getSystemAndSwapControllerType();
  for (  DiskSpec disk : this.disks) {
    if (disk.isSystemDisk()) {
      setTargetDs(disk.getTargetDs());
    }
 else {
      Disk tmDisk=new Disk();
      tmDisk.name=disk.getName();
      tmDisk.initialSizeMB=disk.getSize() * 1024;
      tmDisk.datastore=disk.getTargetDs();
      tmDisk.mode=DiskMode.independent_persistent;
      if (disk.isSwapDisk()) {
        tmDisk.externalAddress=PlacementUtil.getSwapAddress(sysSwapCtrlType);
      }
 else {
        if (DiskScsiControllerType.LSI_CONTROLLER.equals(disk.getController())) {
          if (lsiScsiIndex == PlacementUtil.CONTROLLER_RESERVED_CHANNEL) {
            lsiScsiIndex++;
          }
          tmDisk.externalAddress=PlacementUtil.LSI_CONTROLLER_EXTERNAL_ADDRESS_PREFIX + lsiScsiIndex;
          lsiScsiIndex++;
        }
 else {
          tmDisk.externalAddress=PlacementUtil.getParaVirtualAddress(paraVirtualScsiIndex);
          paraVirtualScsiIndex=PlacementUtil.getNextValidParaVirtualScsiIndex(paraVirtualScsiIndex);
        }
      }
      tmDisk.allocationType=AllocationType.valueOf(disk.getAllocType());
      tmDisk.type=disk.getDiskType().getType();
      tmDisks.add(tmDisk);
    }
  }
  DiskSchema diskSchema=new DiskSchema();
  diskSchema.setName("String_Node_Str");
  diskSchema.setDisks(tmDisks);
  this.vmSchema.diskSchema=diskSchema;
}