Пример #1
0
 private void checkRamdiskStateAndType(Reservation reservation, Image image) {
   LOG.debug(String.format("checkRamdiskStateAndType(%s, %s)", reservation, image));
   String ramdiskId = image.getRamdiskId();
   if (StringUtils.isNotBlank(reservation.getRamdiskId())) ramdiskId = reservation.getRamdiskId();
   if (StringUtils.isBlank(ramdiskId)) return;
   Image ramdiskImage = readImage(ramdiskId);
   if (!ImageState.AVAILABLE.equals(ramdiskImage.getState()))
     throw new IllegalArgumentException(
         String.format("ramdisk %s must be in state %s", ramdiskId, ImageState.AVAILABLE));
   if (MachineType.RAMDISK.equals(ramdiskImage.getMachineType())) return;
   throw new IllegalArgumentException(
       String.format("ramdisk %s must be a %s machine type", ramdiskId, MachineType.RAMDISK));
 }
Пример #2
0
 private void checkKernelStateAndType(Reservation reservation, Image image) {
   LOG.debug(String.format("checkKernelStateAndType(%s, %s)", reservation, image));
   String kernelId = image.getKernelId();
   if (StringUtils.isNotBlank(reservation.getKernelId())) kernelId = reservation.getKernelId();
   if (StringUtils.isBlank(kernelId)) return;
   Image kernelImage = readImage(kernelId);
   if (!ImageState.AVAILABLE.equals(kernelImage.getState()))
     throw new IllegalArgumentException(
         String.format("kernel %s must be in state %s", kernelId, ImageState.AVAILABLE));
   if (MachineType.KERNEL.equals(kernelImage.getMachineType())) return;
   throw new IllegalArgumentException(
       String.format("kernel %s must be a %s machine type", kernelId, MachineType.KERNEL));
 }
Пример #3
0
 private void checkImageState(Image image) {
   LOG.debug(String.format("checkImageState(%s)", image));
   if (ImageState.AVAILABLE.equals(image.getState())) return;
   throw new IllegalArgumentException(
       String.format("image %s must be in state %s", image.getImageId(), ImageState.AVAILABLE));
 }