org.jclouds.compute.domain.Hardware.getVolumes()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中org.jclouds.compute.domain.Hardware.getVolumes()方法的一些代码示例,展示了Hardware.getVolumes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hardware.getVolumes()方法的具体详情如下:
包路径:org.jclouds.compute.domain.Hardware
类名称:Hardware
方法名:getVolumes

Hardware.getVolumes介绍

[英]volumes associated with this.
[中]与此关联的卷。

代码示例

代码示例来源:origin: jclouds/legacy-jclouds

public static double getSpace(Hardware input) {
 double total = 0;
 for (Volume volume : input.getVolumes()) {
   Float size = volume.getSize();
   if (size != null) {
    total += size;
   }
 }
 return total;
}

代码示例来源:origin: io.cloudsoft.jclouds/jclouds-compute

public static double getSpace(Hardware input) {
 double total = 0;
 for (Volume volume : input.getVolumes()) {
   Float size = volume.getSize();
   if (size != null) {
    total += size;
   }
 }
 return total;
}

代码示例来源:origin: org.apache.jclouds/jclouds-compute

public static double getSpace(Hardware input) {
 double total = 0;
 for (Volume volume : input.getVolumes()) {
   Float size = volume.getSize();
   if (size != null) {
    total += size;
   }
 }
 return total;
}

代码示例来源:origin: org.apache.jclouds.provider/softlayer

private static int getBootableDeviceType(Hardware hardware) {
 List<? extends Volume> volumes = hardware.getVolumes();
 Optional<? extends Volume> optionalBootableVolume = tryFind(volumes, new Predicate<Volume>() {
   @Override
   public boolean apply(Volume volume) {
    return volume.getDevice().equals(BOOTABLE_DEVICE);
   }
 });
 if (!optionalBootableVolume.isPresent()) {
   return Type.LOCAL.ordinal();
 }
 return optionalBootableVolume.get().getType().ordinal();
}

代码示例来源:origin: org.jclouds/jclouds-antcontrib

private void listHardwares(ComputeService computeService) {
 log("list hardwares");
 for (Hardware hardware : computeService.listHardwareProfiles()) {// TODO
   log(String.format("   hardware id=%s, cores=%s, ram=%s, volumes=%s", hardware.getProviderId(), getCores(hardware), hardware
       .getRam(), hardware.getVolumes()));
 }
}

代码示例来源:origin: jclouds/legacy-jclouds

protected Hardware parseHardware(final RunningInstance instance) {
 Hardware hardware = getHardwareForInstance(instance);
 if (hardware != null) {
   hardware = HardwareBuilder.fromHardware(hardware).volumes(addEBS(instance, hardware.getVolumes())).build();
 }
 return hardware;
}

代码示例来源:origin: org.jclouds/jclouds-aws

protected Hardware parseHardware(final RunningInstance instance) {
 Hardware hardware = getHardwareForInstance(instance);
 if (hardware != null) {
   hardware = HardwareBuilder.fromHardware(hardware).volumes(addEBS(instance, hardware.getVolumes())).build();
 }
 return hardware;
}

代码示例来源:origin: com.amysta.jclouds.api/ec2

protected Hardware parseHardware(final RunningInstance instance) {
 Hardware hardware = getHardwareForInstance(instance);
 if (hardware != null) {
   hardware = HardwareBuilder.fromHardware(hardware).volumes(addEBS(instance, hardware.getVolumes())).build();
 }
 return hardware;
}

代码示例来源:origin: org.apache.jclouds.api/ec2

protected Hardware parseHardware(final RunningInstance instance) {
 Hardware hardware = getHardwareForInstance(instance);
 if (hardware != null) {
   hardware = HardwareBuilder.fromHardware(hardware).volumes(addEBS(instance, hardware.getVolumes())).build();
 }
 return hardware;
}

代码示例来源:origin: org.jclouds.api/ec2

protected Hardware parseHardware(final RunningInstance instance) {
 Hardware hardware = getHardwareForInstance(instance);
 if (hardware != null) {
   hardware = HardwareBuilder.fromHardware(hardware).volumes(addEBS(instance, hardware.getVolumes())).build();
 }
 return hardware;
}

代码示例来源:origin: apache/jclouds

protected Hardware parseHardware(final RunningInstance instance) {
 Hardware hardware = getHardwareForInstance(instance);
 if (hardware != null) {
   hardware = HardwareBuilder.fromHardware(hardware).volumes(addEBS(instance, hardware.getVolumes())).build();
 }
 return hardware;
}

代码示例来源:origin: jclouds/legacy-jclouds

public void testListSizes() throws Exception {
 for (Hardware hardware : client.listHardwareProfiles()) {
   assert hardware.getProviderId() != null : hardware;
   assert getCores(hardware) > 0 : hardware;
   assert hardware.getVolumes().size() >= 0 : hardware;
   assert hardware.getRam() > 0 : hardware;
   assertEquals(hardware.getType(), ComputeType.HARDWARE);
 }
}

代码示例来源:origin: org.jclouds/jclouds-vcloud

@Override
public NodeMetadata addNodeWithTag(String tag, String name, Template template) {
 InstantiateVAppTemplateOptions options = processorCount((int) getCores(template.getHardware())).memory(
    template.getHardware().getRam()).disk(
    (long) ((template.getHardware().getVolumes().get(0).getSize()) * 1024 * 1024l));
 if (!template.getOptions().shouldBlockUntilRunning())
   options.block(false);
 VCloudExpressVApp vApp = computeClient.start(URI.create(template.getLocation().getId()),
    URI.create(template.getImage().getId()), name, options, template.getOptions().getInboundPorts());
 return vAppToNodeMetadata.apply(vApp);
}

代码示例来源:origin: jclouds/legacy-jclouds

@Test
public void testFastestTemplateBuilder() throws IOException {
 Template template = view.getComputeService().templateBuilder().fastest().build();
 assertEquals(getCores(template.getHardware()), 16.0d);
 assertEquals(template.getHardware().getRam(), 1);
 assertEquals(getSpace(template.getHardware()), 25.0d);
 assertEquals(template.getHardware().getVolumes().get(0).getType(), Volume.Type.LOCAL);
}

代码示例来源:origin: jclouds/legacy-jclouds

@Test
public void testBiggestTemplateBuilder() throws IOException {
 Template template = view.getComputeService().templateBuilder().biggest().build();
 assertEquals(getCores(template.getHardware()), 16.0d);
 assertEquals(template.getHardware().getRam(), 16);
 assertEquals(getSpace(template.getHardware()), 100.0d);
 assertEquals(template.getHardware().getVolumes().get(0).getType(), Volume.Type.LOCAL);
}

代码示例来源:origin: apache/jclouds

@Test
public void testFastestTemplateBuilder() throws IOException {
 Template template = view.getComputeService().templateBuilder().fastest().build();
 assertEquals(getCores(template.getHardware()), 16.0d);
 assertEquals(template.getHardware().getRam(), 1 * 1024);
 assertEquals(getSpace(template.getHardware()), 25.0d);
 assertEquals(template.getHardware().getVolumes().get(0).getType(), Volume.Type.LOCAL);
}

代码示例来源:origin: jclouds/legacy-jclouds

@Test
public void testDefaultTemplateBuilder() throws IOException {
 Template defaultTemplate = view.getComputeService().templateBuilder().build();
 assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "12.04");
 assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
 assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
 assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
 assertEquals(defaultTemplate.getHardware().getRam(), 1);
 assertEquals(getSpace(defaultTemplate.getHardware()), 25.0d);
 assertEquals(defaultTemplate.getHardware().getVolumes().get(0).getType(), Volume.Type.LOCAL);
 // test that we bound the correct templateoptions in guice
 assertEquals(defaultTemplate.getOptions().getClass(), SoftLayerTemplateOptions.class);
}

代码示例来源:origin: jclouds/legacy-jclouds

@SuppressWarnings("unchecked")
  public static HardwareBuilder fromHardware(Hardware in) {
   return new HardwareBuilder().id(in.getId()).providerId(in.getProviderId()).location(in.getLocation()).name(
        in.getName()).uri(in.getUri()).userMetadata(in.getUserMetadata()).tags(in.getTags()).processors(
        List.class.cast(in.getProcessors())).ram(in.getRam()).volumes(List.class.cast(in.getVolumes()))
        .supportsImage(in.supportsImage()).hypervisor(in.getHypervisor());
  }
}

代码示例来源:origin: org.apache.jclouds/jclouds-compute

@SuppressWarnings("unchecked")
  public static HardwareBuilder fromHardware(Hardware in) {
   return new HardwareBuilder().id(in.getId()).providerId(in.getProviderId()).location(in.getLocation()).name(
        in.getName()).uri(in.getUri()).userMetadata(in.getUserMetadata()).tags(in.getTags()).processors(
        List.class.cast(in.getProcessors())).ram(in.getRam()).volumes(List.class.cast(in.getVolumes()))
        .supportsImage(in.supportsImage()).hypervisor(in.getHypervisor());
  }
}

代码示例来源:origin: io.cloudsoft.jclouds/jclouds-compute

@SuppressWarnings("unchecked")
  public static HardwareBuilder fromHardware(Hardware in) {
   return new HardwareBuilder().id(in.getId()).providerId(in.getProviderId()).location(in.getLocation()).name(
        in.getName()).uri(in.getUri()).userMetadata(in.getUserMetadata()).tags(in.getTags()).processors(
        List.class.cast(in.getProcessors())).ram(in.getRam()).volumes(List.class.cast(in.getVolumes()))
        .supportsImage(in.supportsImage()).hypervisor(in.getHypervisor());
  }
}

相关文章