Package org.platformlayer.ops.images

Examples of org.platformlayer.ops.images.CloudImage


      if (cloud == null) {
        throw new IllegalStateException("Cloud instance not found");
      }
      ImageStore imageStore = cloudHelpers.getImageStore(cloud);
      MachineProvider machineProvider = providers.toInterface(cloud, MachineProvider.class);
      CloudImage imageInfo = imageFactory.getOrCreateImageId(machineProvider, imageFormats, recipeKey);

      if (imageStore == null) {
        throw new OpsException("Image store not configured");
      }

      String fileName = imageInfo.getId() + ".image." + imageInfo.getFormat().name();

      // TODO: We don't need rawImage; delete or just request a read-only version
      File rawImage = new File(IMAGES_DIR, fileName);
      target.mkdir(IMAGES_DIR);
      // TODO: Caching / reuse ... need to check md5 though
      imageStore.bringToMachine(imageInfo.getId(), target, rawImage);

      ImageFormat imageFormat = imageInfo.getFormat();
      switch (imageFormat) {
      case Tar: {
        target.mkdir(imageFile);
        target.executeCommand(Command.build("cd {0}; tar jxf {1}", imageFile, rawImage).setTimeout(
            TimeSpan.FIVE_MINUTES));
View Full Code Here


        if (foundImage == null) {
          throw new IllegalArgumentException("Could not find image");
        }
      } else {
        List<ImageFormat> formats = Collections.singletonList(ImageFormat.DiskQcow2);
        CloudImage image = imageFactory.getOrCreateImageId(cloud, formats, request.recipeId);

        String imageId = image.getId();
        log.info("Getting image details for image: " + imageId);
        foundImage = computeClient.root().images().image(imageId).show();
        if (foundImage == null) {
          throw new IllegalArgumentException("Could not find image: " + imageId);
        }
View Full Code Here

      PlatformLayerKey recipeKey) throws OpsException {
    if (recipeKey == null) {
      log.debug("Looking for bootstrap image");

      for (ImageFormat format : formats) {
        CloudImage bootstrapImage = findBootstrapImage(format, cloud.getImageStore(targetCloud));
        if (bootstrapImage != null) {
          return bootstrapImage;
          // Tags tags = bootstrapImage.getTags();
          // String compression = tags.findUnique("org.openstack.sync__1__expand");
          // return new ImageInfo(bootstrapImage.getId(), format, compression);
View Full Code Here

      break;
    case DiskRaw:
      compression = "gzip";
      break;
    }
    return new CloudImage() {

      @Override
      public String getId() {
        return imageId;
      }
View Full Code Here

TOP

Related Classes of org.platformlayer.ops.images.CloudImage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.