Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.HardwareBuilder


      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


   @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

   @Override
   public Hardware apply(final VirtualMachineTemplateInVirtualDatacenter templateInVirtualDatacenter) {
      VirtualMachineTemplate template = templateInVirtualDatacenter.getTemplate();
      VirtualDatacenter virtualDatacenter = templateInVirtualDatacenter.getZone();

      HardwareBuilder builder = new HardwareBuilder();
      builder.providerId(template.getId().toString());
      builder.id(template.getId().toString() + "/" + virtualDatacenter.getId());
      builder.uri(template.getURI());

      builder.name(template.getName());
      builder.processor(new Processor(template.getCpuRequired(), DEFAULT_CORE_SPEED));
      builder.ram(template.getRamRequired());

      // Location information
      builder.location(virtualDatacenterToLocation.apply(virtualDatacenter));
      builder.hypervisor(virtualDatacenter.getHypervisorType().name());
      builder.supportsImage(ImagePredicates.idEquals(template.getId().toString()));

      VolumeBuilder volumeBuilder = new VolumeBuilder();
      volumeBuilder.bootDevice(true);
      volumeBuilder.size(toGb(template.getHdRequired()));
      volumeBuilder.type(Volume.Type.LOCAL);
      volumeBuilder.durable(false);
      builder.volume(volumeBuilder.build());

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

@Singleton
public class HardwareBuilderFromResourceAllocations implements
         Function<Iterable<? extends ResourceAllocationSettingData>, HardwareBuilder> {
   @Override
   public HardwareBuilder apply(Iterable<? extends ResourceAllocationSettingData> from) {
      HardwareBuilder builder = new HardwareBuilder();
      builder.volumes(transform(filter(from, CIMPredicates.resourceTypeIn(ResourceType.DISK_DRIVE,
               ResourceType.BASE_PARTITIONABLE_UNIT, ResourceType.PARTITIONABLE_UNIT)),
               new Function<ResourceAllocationSettingData, Volume>() {

                  @Override
                  public Volume apply(ResourceAllocationSettingData from) {
                     return HardwareBuilderFromResourceAllocations.this.apply(from);
                  }

               }));

      builder.ram((int) find(from, CIMPredicates.resourceTypeIn(ResourceType.MEMORY)).getVirtualQuantity().longValue());

      builder.processors(transform(filter(from, CIMPredicates.resourceTypeIn(ResourceType.PROCESSOR)),
               new Function<ResourceAllocationSettingData, Processor>() {

                  @Override
                  public Processor apply(ResourceAllocationSettingData arg0) {
                     return new Processor(arg0.getVirtualQuantity().longValue(), 1);
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

   }

   @Override
   public Hardware apply(ServerType from) {
      checkNotNull(from, "ServerType");
      HardwareBuilder builder = new HardwareBuilder();

      builder.ids(from.getId());
      builder.name(from.getName());
      builder.ram((int) (1000d * Double.valueOf(from.getMemory().getSize())));
      builder.processor(cpuToProcessor.apply(from.getCpu()));
      builder.supportsImage(Predicates.<Image> alwaysTrue());
      // all servers are 64bit. The OS however may be 32 bit.
      builder.is64Bit(true);
      builder.volumes(Iterables.transform(from.getDisks(), diskToVolume));

      return builder.build();
   }
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

@Singleton
public class VMSpecToHardware implements Function<VMSpec, Hardware> {

   @Override
   public Hardware apply(VMSpec from) {
      HardwareBuilder builder = new HardwareBuilder();
      builder.ids(from.toString());
      for (int i = 0; i < from.getProcessorCount(); i++)
         builder.processor(new Processor(1, 3.0));
      builder.ram(from.getMemoryInGig() * 1024);
      builder.volume(new VolumeBuilder().type(Volume.Type.LOCAL).device(from.getBootDeviceName()).size(
               new Float(from.getBootDiskSize())).bootDevice(true).durable(true).build());
      for (Entry<String, Integer> disk : from.getDataDiskDeviceNameToSizeInGig().entrySet())
         builder.volume(new VolumeBuilder().type(Volume.Type.LOCAL).device(disk.getKey()).size(
                  new Float(disk.getValue())).durable(true).build());
      builder.hypervisor("VMware");
      return builder.build();
   }
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());
      Link vdc = Iterables.find(checkNotNull(from, "from").getLinks(), LinkPredicates.typeEquals(VCloudDirectorMediaType.VDC));
      if (vdc != null) {
         builder.location(findLocationForResource.apply(vdc));
      } 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.