Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.HardwareBuilder


   @Override
   public Hardware apply(FlavorInZone flavorInZone) {
      Location location = locationIndex.get().get(flavorInZone.getZone());
      checkState(location != null, "location %s not in locationIndex: %s", flavorInZone.getZone(), locationIndex.get());
      Flavor flavor = flavorInZone.getFlavor();
      return new HardwareBuilder().id(flavorInZone.slashEncode()).providerId(flavor.getId()).name(flavor.getName())
               .ram(flavor.getRam()).processor(new Processor(flavor.getVcpus(), 1.0)).volume(
                        new VolumeImpl(Float.valueOf(flavor.getDisk()), true, true)).location(location).build();
   }
View Full Code Here


      double cores = ProductItems.capacity().apply(coresItem).doubleValue();
      Matcher cpuMatcher = cpuDescriptionRegex.matcher(coresItem.getDescription());
      double coreSpeed = (cpuMatcher.matches()) ? Double.parseDouble(cpuMatcher.group(cpuMatcher.groupCount())) : DEFAULT_CORE_SPEED;
      int ram = ProductItems.capacity().apply(ramItem).intValue() * 1024;

      return new HardwareBuilder().ids(hardwareId).processors(ImmutableList.of(new Processor(cores, coreSpeed)))
               .ram(ram).hypervisor("XenServer")
               .volumes(
                  Iterables.transform(filter(items, categoryCodeMatches(diskCategoryRegex)),
                        new Function<ProductItem, Volume>() {
                           @Override
View Full Code Here

         super(createNiceMock(SoftLayerApi.class), createNiceMock(Function.class));
      }

      @Override
      public Hardware getHardware(VirtualGuest guest) {
         return new HardwareBuilder().ids("mocked hardware").build();
      }
View Full Code Here

   @Override
   public Iterable<Hardware> listHardwareProfiles() {
      Set<Hardware> hardware = Sets.newLinkedHashSet();
      // todo they are only placeholders at the moment
      hardware.add(new HardwareBuilder().ids("micro").hypervisor("lxc").name("micro").processor(new Processor(1, 1)).ram(512).build());
      hardware.add(new HardwareBuilder().ids("small").hypervisor("lxc").name("small").processor(new Processor(1, 1)).ram(1024).build());
      hardware.add(new HardwareBuilder().ids("medium").hypervisor("lxc").name("medium").processor(new Processor(1, 1)).ram(2048).build());
      hardware.add(new HardwareBuilder().ids("large").hypervisor("lxc").name("large").processor(new Processor(1, 1)).ram(3072).build());
      return hardware;
   }
View Full Code Here

      builder.ids(container.getId())
              .name(name)
              .group(group)
              .hostname(container.getContainerConfig().getHostname())
               // TODO Set up hardware
              .hardware(new HardwareBuilder()
                      .id("")
                      .ram(container.getContainerConfig().getMemory())
                      .processor(new Processor(container.getContainerConfig().getCpuShares(), container.getContainerConfig().getCpuShares()))
                      .build());
      builder.status(toPortableStatus.apply(container.getState()));
View Full Code Here

         GroupNamingConvention.Factory.class);

   @Test
   public void testWhenNoHardwareOrImageMatchImageIdIsStillSet() {

      Hardware existingHardware = new HardwareBuilder().id("us-sw-1/FOOOOOOOO").providerId("FOOOOOOOO").location(zone)
            .build();
      Image existingImage = new ImageBuilder().id("us-sw-1/FOOOOOOOO")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("FOOOOOOOO").description("foobuntu").location(zone).status(Image.Status.AVAILABLE).build();
View Full Code Here

   }

   @Test
   public void testWhenHardwareAndImageMatchHardwareOperatingSystemAndImageIdAreSet() {

      Hardware existingHardware = new HardwareBuilder().id("us-sw-1/Small 1GB").providerId("Small 1GB").ram(1024)
            .volume(new VolumeImpl(Float.valueOf(61440), true, true)).location(zone).build();
      Image existingImage = new ImageBuilder().id("us-sw-1/sdc:sdc:centos-5.7:1.2.1")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("sdc:sdc:centos-5.7:1.2.1").description("foobuntu").status(Image.Status.AVAILABLE)
            .location(zone).build();
View Full Code Here

      extNic = new ExternalIpDto();
      extNic.setIp("10.10.10.10");
      extNic.setMac("2a:6e:40:69:84:e2");

      hardware = new HardwareBuilder() //
            .ids("1") //
            .build();

      function = new VirtualMachineToNodeMetadata(templateToImage(), templateToHardware(), stateToNodeState(),
            virtualDatacenterToLocation());
View Full Code Here

      });

      Location location = checkNotNull(getOnlyElement(zonesForMachineType),
              "location for %s",
              input.getMachineType().getZone());
      return new HardwareBuilder()
              .id(SlashEncodedIds.fromTwoIds(input.getMachineType().getZone(), input.getMachineType().getName()).slashEncode())
              .location(location)
              .name(input.getMachineType().getName())
              .hypervisor("kvm")
              .processor(new Processor(input.getMachineType().getGuestCpus(), 1.0))
View Full Code Here

      if (ovf.getVirtualSystem().getVirtualHardwareSections().size() > 1) {
         logger.warn("multiple hardware choices found. using first", ovf);
      }
      VirtualHardwareSection hardware = Iterables.get(ovf.getVirtualSystem().getVirtualHardwareSections(), 0);
      HardwareBuilder builder = rasdToHardwareBuilder.apply(hardware.getItems());
      if (from.getVDC() != null) {
         builder.location(findLocationForResource.apply(from.getVDC()));
      } else {
         // otherwise, it could be in a public catalog, which is not assigned to a VDC
      }
      builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage(
               ImagePredicates.idEquals(from.getHref().toASCIIString()));
      builder.hypervisor("VMware");
      return builder.build();

   }
View Full Code Here

TOP

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

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.