Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.Hardware


         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


         throwNoSuchElementExceptionAfterLoggingImageIds(format("%s not found", idPredicate), images);
      return image;
   }

   private Hardware findHardwareWithId(Set<? extends Hardware> hardwaresToSearch) {
      Hardware hardware;
      // TODO: switch to GetHardwareStrategy in version 1.5
      hardware = tryFind(hardwaresToSearch, hardwareIdPredicate).orNull();
      if (hardware == null)
         throw throwNoSuchElementExceptionAfterLoggingHardwareIds(format("%s not found", hardwareIdPredicate),
               hardwaresToSearch);
View Full Code Here

         throw throwNoSuchElementExceptionAfterLoggingHardwareIds(message, hardwarel);
      }

      Iterable<? extends Hardware> hardwareCompatibleWithOurImages = filter(hardwarel, supportsImagesPredicate(images));
      Predicate<Hardware> hardwarePredicate = buildHardwarePredicate();
      Hardware hardware;
      try {
         hardware = hardwareOrdering.max(filter(hardwareCompatibleWithOurImages, hardwarePredicate));
      } catch (NoSuchElementException exception) {
         String message = format("no hardware profiles match params: %s", hardwarePredicate);
         throw throwNoSuchElementExceptionAfterLoggingHardwareIds(message, hardwareCompatibleWithOurImages);
      }
      logger.trace("<<   matched hardware(%s)", hardware.getId());
      return hardware;
   }
View Full Code Here

    Set<Instance> taskTrackers = cluster
      .getInstancesMatching(role(HadoopTaskTrackerClusterActionHandler.ROLE));
   
    if (!taskTrackers.isEmpty()) {
     
      Hardware hardware = Iterables.getFirst(taskTrackers, null)
        .getNodeMetadata().getHardware();

      /* null when using the BYON jclouds compute provider */
      if (hardware != null) {

        int coresPerNode = 0;
        for (Processor processor : hardware.getProcessors()) {
          coresPerNode += processor.getCores();
        }
        int mapTasksPerNode = (int) Math.ceil(coresPerNode * 1.0);
        int reduceTasksPerNode = (int) Math.ceil(coresPerNode * 0.75);

 
View Full Code Here

      }
      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);
        Template template = new TemplateImpl(image, hardware, location, TemplateOptions.NONE);
        throw new RunNodesException("tag" + id, num, template, nodes, executionExceptions, failedNodes);
      }
View Full Code Here

  }
 
  private Cluster newCluster(int numberOfWorkers) {
    NodeMetadata node = mock(NodeMetadata.class);
    List<Processor> processors = ImmutableList.of(new Processor(4, 1.0));
    Hardware hardware = new HardwareImpl(null, null, "id", null, null,
        ImmutableMap.<String,String>of(), ImmutableSet.<String>of(), processors,
        1024, ImmutableList.<Volume>of(), null);
    when(node.getHardware()).thenReturn(hardware);
   
    Builder<Instance> instances = ImmutableSet.<Instance>builder();
View Full Code Here

public class SizeToHardwareTest {

   @Test
   public void testConvertSize() {
      Size size = new Size(1, "Medium", "2gb", 2048, 1, 20, "0.05", "10");
      Hardware expected = new HardwareBuilder().id("2gb").providerId("1").name("Medium")
            .processor(new Processor(1.0, 1.0)).ram(2048)
            .volume(new VolumeBuilder().size(20f).type(Type.LOCAL).build())
            .userMetadata(ImmutableMap.of("costPerHour", "0.05", "costPerMonth", "10")).build();

      SizeToHardware function = new SizeToHardware();
View Full Code Here

               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() {

                  @Override
                  public Image getImage() {
                     return image;
View Full Code Here

      expect(vbm.getVBox()).andReturn(vBox);
      expect(guestOsType.getIs64Bit()).andReturn(true);

      replay(vbm, vBox, vm, guestOsType);

      Hardware hardware = new IMachineToHardware(Suppliers.ofInstance(vbm)).apply(vm);

      assertEquals(hardware.getId(), machineName);
      assertEquals(hardware.getProviderId(), machineName);
      // for starters assume 1-to-1 relationship hardware to image (which
      // correlate to a single source IMachine)
      assertEquals(hardware.supportsImage().toString(), ImagePredicates.idEquals(machineName).toString());

   }
View Full Code Here

      Image image = virtualMachineTemplateToImage.apply(template);
      builder.imageId(image.getId().toString());
      builder.operatingSystem(image.getOperatingSystem());

      // Hardware details
      Hardware defaultHardware = virtualMachineTemplateToHardware.apply(new VirtualMachineTemplateInVirtualDatacenter(
            template, vdc));

      Hardware hardware = HardwareBuilder
            .fromHardware(defaultHardware)
            .ram(vm.getRam())
            .processors(
                  Lists.newArrayList(new Processor(vm.getCpu(),
                        VirtualMachineTemplateInVirtualDatacenterToHardware.DEFAULT_CORE_SPEED))) //
View Full Code Here

TOP

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

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.