Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.HardwareBuilder


      String osTypeId = vm.getOSTypeId();
      String vmNameWithoutPrefix = vm.getName().replace(VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX, "");
     
      IGuestOSType guestOSType = virtualBoxManager.get().getVBox().getGuestOSType(osTypeId);
      Boolean is64Bit = guestOSType.getIs64Bit();
      HardwareBuilder hardwareBuilder = new HardwareBuilder();
      hardwareBuilder.ids(vmNameWithoutPrefix);
      hardwareBuilder.is64Bit(is64Bit);
      hardwareBuilder.supportsImage(ImagePredicates.idEquals(vmNameWithoutPrefix));
      hardwareBuilder.hypervisor("VirtualBox");
      return hardwareBuilder.build();
   }
View Full Code Here


      // TODO make this work with composite vApps
      if (from == null)
         return null;
     
      VirtualHardwareSection hardware = findVirtualHardwareSectionForVm.apply(from);
      HardwareBuilder builder = rasdToHardwareBuilder.apply(hardware.getItems());
      builder.location(findLocationForResource.apply(Iterables.find(checkNotNull(from, "from").getLinks(),
            LinkPredicates.typeEquals(VCloudDirectorMediaType.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

   public Hardware apply(PackageInDatacenter pkgInDatacenter) {
      Location location = locationIndex.get().get(pkgInDatacenter.getDatacenter());
      checkState(location != null, "location %s not in locationIndex: %s", pkgInDatacenter.getDatacenter(),
            locationIndex.get());
      org.jclouds.joyent.cloudapi.v6_5.domain.Package pkg = pkgInDatacenter.get();
      return new HardwareBuilder().id(pkgInDatacenter.slashEncode()).providerId(pkg.getName()).name(pkg.getName())
            .ram(pkg.getMemorySizeMb())
            // TODO: no api call to get processors.. either hard-code or
            // calculate
            .processor(new Processor(1, 1.0)).volume(new VolumeImpl(Float.valueOf(pkg.getDiskSizeGb()), true, true))
            .location(location).build();
View Full Code Here

   }

   @Override
   public Iterable<Hardware> listHardwareProfiles() {
      Set<Hardware> hardware = Sets.newLinkedHashSet();
      hardware.add(new HardwareBuilder().ids("t1.micro").hypervisor("VirtualBox").name("t1.micro").ram(512).build());
      hardware.add(new HardwareBuilder().ids("m1.small").hypervisor("VirtualBox").name("m1.small").ram(1024).build());
      hardware.add(new HardwareBuilder().ids("m1.medium").hypervisor("VirtualBox").name("m1.medium").ram(3840).build());
      hardware.add(new HardwareBuilder().ids("m1.large").hypervisor("VirtualBox").name("m1.large").ram(7680).build());
      return hardware;
   }
View Full Code Here

@Singleton
public class VmSpecificationToHardware implements Function<VmSpecification, Hardware> {

   @Override
   public Hardware apply(VmSpecification from) {
      HardwareBuilder builder = new HardwareBuilder();
      builder.ids(from.getAlias());
      builder.name(from.getAlias());
      builder.processors(ImmutableList.of(new Processor(1, 1.0)));
      builder.ram(from.getMaxPhysicalMemory());
      // builder.volumes(ImmutableList.<Volume> of(new VolumeImpl(from.disk, true, false)));
      return builder.build();
   }
View Full Code Here

            .name("alternateImageName").build();
  
   @SuppressWarnings("unchecked")
   public void testLocationPredicateWhenComputeMetadataIsNotLocationBound() {

      Hardware hardware = new HardwareBuilder().id("hardwareId").build();

      Supplier<Set<? extends Location>> locations = Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet
               .<Location> of(region));
      Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of(image));
      Supplier<Set<? extends Hardware>> hardwares = Suppliers.<Set<? extends Hardware>> ofInstance(ImmutableSet
View Full Code Here

   }
  
   @SuppressWarnings("unchecked")
   protected void doTestResolveImages(Supplier<Set<? extends Image>> images, Image expectedBest,
           Function<TemplateBuilderImpl, TemplateBuilderImpl> builderCustomisation) {
      Hardware hardware = new HardwareBuilder().id("hardwareId").build();

      Supplier<Set<? extends Location>> locations = Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet
               .<Location> of(region));
      Supplier<Set<? extends Hardware>> hardwares = Suppliers.<Set<? extends Hardware>> ofInstance(ImmutableSet
               .<Hardware> of(hardware));
View Full Code Here

   @SuppressWarnings("unchecked")
   @Test
   public void testArchWins() {

      Hardware hardware = new HardwareBuilder().id("hardwareId").build();

      Supplier<Set<? extends Location>> locations = Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet
               .<Location> of(region));
      Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of(
               image, image64bit));
View Full Code Here

   @SuppressWarnings("unchecked")
   @Test
   public void testHardwareWithImageIdPredicateOnlyAcceptsImage() {

      Hardware hardware = new HardwareBuilder().id("hardwareId").supportsImage(ImagePredicates.idEquals(getProviderFormatId("imageId")))
               .build();

      Supplier<Set<? extends Location>> locations = Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet
               .<Location> of(region));
      Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends Image>> ofInstance(ImmutableSet
View Full Code Here

   @SuppressWarnings("unchecked")
   @Test
   public void testHardwareWithImageIdPredicateOnlyAcceptsImageWhenLocationNull() {

      Hardware hardware = new HardwareBuilder().id("hardwareId").supportsImage(ImagePredicates.idEquals(getProviderFormatId("imageId")))
               .build();

      Supplier<Set<? extends Location>> locations = Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet
               .<Location> of(region));
      Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends Image>> ofInstance(ImmutableSet
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.