Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.Image


      return findObjectOfTypeForServerOrNull(hardwares.get(), "hardware", serverInZone.getServer().getFlavor().getId(),
            serverInZone);
   }

   protected OperatingSystem findOperatingSystemForServerOrNull(ServerInZone serverInZone) {
      Image image = findObjectOfTypeForServerOrNull(images.get(), "image", serverInZone.getServer().getImage().getId(),
            serverInZone);
      return (image != null) ? image.getOperatingSystem() : null;
   }
View Full Code Here


      Set<? extends Image> images = getImages();
      checkState(images.size() > 0, "no images present!");
      Set<? extends Hardware> hardwaresToSearch = hardwares.get();
      checkState(hardwaresToSearch.size() > 0, "no hardware profiles present!");

      Image image = null;
      if (imageId != null) {
         image = findImageWithId(images);
         if (currentLocationWiderThan(image.getLocation()))
            this.location = image.getLocation();
      }
     
      Hardware hardware = null;
      if (hardwareId != null) {
         hardware = findHardwareWithId(hardwaresToSearch);
         if (currentLocationWiderThan(hardware.getLocation()))
            this.location = hardware.getLocation();
      }
     
      // if the user hasn't specified a location id, or an image or hardware
      // with location, let's search scoped to the implicit one
      if (location == null)
         location = defaultLocation.get();
     
      if (image == null) {
         Iterable<? extends Image> supportedImages = findSupportedImages(images);
         if (hardware == null)
            hardware = resolveHardware(hardwaresToSearch, supportedImages);
         image = resolveImage(hardware, supportedImages);
      } else {
         if (hardware == null)
            hardware = resolveHardware(hardwaresToSearch, ImmutableSet.of(image));
      }

      logger.debug("<<   matched image(%s) hardware(%s) location(%s)", image.getId(), hardware.getId(),
            location.getId());
      return new TemplateImpl(image, hardware, location, options);
   }
View Full Code Here

      }
      return supportedImages;
   }

   private Image findImageWithId(Set<? extends Image> images) {
      Image image;
      // TODO: switch to GetImageStrategy in version 1.5
      image = tryFind(images, idPredicate).orNull();
      if (image == null)
         throwNoSuchElementExceptionAfterLoggingImageIds(format("%s not found", idPredicate), images);
      return image;
View Full Code Here

          failedNodes.put(nodeMeta, new Exception("Simulated failing node"));
          LOG.info("{} - Node failing to start: {}", roles, nodeMeta.getId());
        }
      }
      if (failedNodes.size() > 0) {
        Image image = new ImageImpl("ec2", "test", "testId", location, new URI("http://node"),
            userMetadata, ImmutableSet.<String>of(), new OperatingSystem(null, null, null, null, "op", true),
            "description", null, null, loginCredentials);
        Hardware hardware = new HardwareImpl("ec2", "test", "testId", location, new URI("http://node"),
                userMetadata, ImmutableSet.<String>of(), new ArrayList<Processor>(), 1,
                new ArrayList<Volume>(), null);
View Full Code Here

               // our group
               Set<? extends NodeMetadata> nodes = Sets.filter(input.listNodesDetailsMatching(NodePredicates.all()),
                        NodePredicates.inGroup(poolGroupPrefix));
               checkState(!nodes.isEmpty(), "service provided no template and no node was in this nodepool's group.");
               final NodeMetadata node = Iterables.get(nodes, 0);
               final Image image = new ImageBuilder().id(node.getId()).location(node.getLocation())
                        .operatingSystem(node.getOperatingSystem()).status(Status.AVAILABLE)
                        .description("physical node").build();
               final Hardware hardware = new HardwareBuilder().id(node.getId()).build();
               return new Template() {
View Full Code Here

      return ImmutableSet.of(backendTemplate.get().getLocation());
   }

   @Override
   public Image getImage(String id) {
      Image backendImage = backendTemplate.get().getImage();
      return backendImage.getId().equals(id) ? backendImage : null;
   }
View Full Code Here

      builder.imageId(container.getImage());
      builder.loginPort(getLoginPort(container));
      builder.publicAddresses(getPublicIpAddresses());
      builder.privateAddresses(getPrivateIpAddresses(container));
      builder.location(Iterables.getOnlyElement(locations.get()));
      Image image = images.get().get(container.getImage());
      builder.imageId(image.getId());
      builder.operatingSystem(image.getOperatingSystem());

      return builder.build();
   }
View Full Code Here

      replay(vbm, vBox, vm, guestOsType);

      IMachineToImage fn = new IMachineToImage(VirtualBoxComputeServiceContextModule.toPortableImageStatus, Suppliers
               .ofInstance(vbm), map);

      Image image = fn.apply(vm);

      assertEquals(image.getDescription(), "my-ubuntu-machine");
      assertEquals(image.getOperatingSystem().getDescription(), linuxDescription);
      assertTrue(image.getOperatingSystem().is64Bit());
      assertEquals(image.getOperatingSystem().getFamily(), OsFamily.UBUNTU);
      assertEquals(image.getOperatingSystem().getVersion(), "10.04");
      assertEquals(image.getId(), "my-vm-id");
      assertEquals(image.getStatus(), Image.Status.AVAILABLE);

   }
View Full Code Here

      replay(vbm, vBox, vm, guestOsType);

      IMachineToImage fn = new IMachineToImage(VirtualBoxComputeServiceContextModule.toPortableImageStatus, Suppliers
               .ofInstance(vbm), map);

      Image image = fn.apply(vm);

      assertEquals(image.getDescription(), vmDescription);
      assertEquals(image.getOperatingSystem().getDescription(), guestOsDescription);
      assertTrue(image.getOperatingSystem().is64Bit());
      assertEquals(image.getOperatingSystem().getFamily(), OsFamily.UBUNTU);
      assertEquals(image.getOperatingSystem().getVersion(), "11.04");
      assertEquals(image.getId(), "my-vm-id");
      assertEquals(image.getStatus(), Image.Status.PENDING);

   }
View Full Code Here

      replay(vbm, vBox, vm, guestOsType);

      IMachineToImage fn = new IMachineToImage(VirtualBoxComputeServiceContextModule.toPortableImageStatus, Suppliers
               .ofInstance(vbm), map);

      Image image = fn.apply(vm);

      assertEquals(image.getOperatingSystem().getDescription(), "SomeOtherOs 2.04");
      assertEquals(image.getOperatingSystem().getVersion(), "");
      assertEquals(image.getId(), "my-vm-id");

   }
View Full Code Here

TOP

Related Classes of org.jclouds.compute.domain.Image

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.