@VisibleForTesting protected static void updateBootDiskCapacity(List<AttachedDiskCreateSpec> disks,ImageEntity image,List<Throwable> warnings) throws InvalidVmDisksSpecException, InvalidImageStateException {
  for (  AttachedDiskCreateSpec disk : disks) {
    if (disk.isBootDisk()) {
      if (image.getSize() == null) {
        throw new InvalidImageStateException("Image " + image.getId() + " has null size");
      }
      if (disk.getCapacityGb() != null) {
        warnings.add(new InvalidVmDisksSpecException("Specified boot disk capacityGb is not used"));
      }
      disk.setCapacityGb((int)(image.getSize() / GB_TO_BYTE_CONVERSION_RATIO));
      return;
    }
  }
  throw new InvalidVmDisksSpecException("No boot disk is specified in VM create Spec!");
}

@ VisibleForTesting protected static void updateBootDiskCapacity ( List < AttachedDiskCreateSpec > disks , ImageEntity image , List < Throwable > warnings ) throws InvalidVmDisksSpecException , InvalidImageStateException { for ( AttachedDiskCreateSpec disk : disks ) { if ( disk . isBootDisk ( ) ) { if ( image . getSize ( ) == null ) { throw new InvalidImageStateException ( "Image " + image . getId ( ) + " has null size" ) ; } if ( disk . getCapacityGb ( ) != null ) { warnings . add ( new InvalidVmDisksSpecException ( "Specified boot disk capacityGb is not used" ) ) ; } disk . setCapacityGb ( ( int ) ( image . getSize ( ) / GB_TO_BYTE_CONVERSION_RATIO ) ) ; return ; } } throw new InvalidVmDisksSpecException ( "No boot disk is specified in VM create Spec!" ) ; }
find boot disk and update capacitygb to be image size .
