本文整理了Java中org.jclouds.compute.domain.Hardware.getLocation()
方法的一些代码示例,展示了Hardware.getLocation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hardware.getLocation()
方法的具体详情如下:
包路径:org.jclouds.compute.domain.Hardware
类名称:Hardware
方法名:getLocation
暂无
代码示例来源:origin: jclouds/legacy-jclouds
/**
* {@inheritDoc}
*/
@Override
public TemplateBuilder fromHardware(Hardware hardware) {
if (currentLocationWiderThan(hardware.getLocation()))
this.location = hardware.getLocation();
this.minCores = getCores(hardware);
this.minRam = hardware.getRam();
this.minDisk = getSpace(hardware);
this.hypervisor = hardware.getHypervisor();
return this;
}
代码示例来源:origin: com.hazelcast.stabilizer/stabilizer
public void showHardware() {
Set<? extends Hardware> hardwares = computeService.listHardwareProfiles();
for (Hardware hardware : hardwares) {
if (verbose) {
System.out.println(hardware);
} else {
StringBuilder sb = new StringBuilder(hardware.getId());
sb.append(" Ram: ").append(hardware.getRam());
sb.append(" Processors: ").append(hardware.getProcessors());
if (locationId == null) {
Location location = hardware.getLocation();
if (location != null) {
sb.append(" Location: ").append(location.getId());
}
}
System.out.println(sb.toString());
}
}
}
代码示例来源:origin: org.apache.jclouds/jclouds-compute
/**
* {@inheritDoc}
*/
@Override
public TemplateBuilder fromHardware(Hardware hardware) {
if (currentLocationWiderThan(hardware.getLocation()))
this.location = hardware.getLocation();
this.minCores = getCores(hardware);
this.minRam = hardware.getRam();
this.minDisk = getSpace(hardware);
this.hypervisor = hardware.getHypervisor();
return this;
}
代码示例来源:origin: apache/jclouds
/**
* {@inheritDoc}
*/
@Override
public TemplateBuilder fromHardware(Hardware hardware) {
if (currentLocationWiderThan(hardware.getLocation()))
this.location = hardware.getLocation();
this.minCores = getCores(hardware);
this.minRam = hardware.getRam();
this.minDisk = getSpace(hardware);
this.hypervisor = hardware.getHypervisor();
return this;
}
代码示例来源:origin: io.cloudsoft.jclouds/jclouds-compute
/**
* {@inheritDoc}
*/
@Override
public TemplateBuilder fromHardware(Hardware hardware) {
if (currentLocationWiderThan(hardware.getLocation()))
this.location = hardware.getLocation();
this.minCores = getCores(hardware);
this.minRam = hardware.getRam();
this.minDisk = getSpace(hardware);
this.hypervisor = hardware.getHypervisor();
return this;
}
代码示例来源:origin: io.cloudsoft.jclouds.labs/joyent-cloudapi
@Override
public boolean apply(Hardware input) {
return input.getRam() == machineInDatacenter.get().getMemorySizeMb()
&& getSpace(input) == machineInDatacenter.get().getDiskSizeGb()
&& input.getLocation().getId().equals(machineInDatacenter.getDatacenter());
}
}).orNull();
代码示例来源:origin: org.apache.jclouds.labs/joyent-cloudapi
@Override
public boolean apply(Hardware input) {
return input.getRam() == machineInDatacenter.get().getMemorySizeMb()
&& getSpace(input) == machineInDatacenter.get().getDiskSizeGb()
&& input.getLocation().getId().equals(machineInDatacenter.getDatacenter());
}
}).orNull();
代码示例来源:origin: org.jclouds.labs/joyent-sdc
@Override
public boolean apply(Hardware input) {
return input.getRam() == machineInDatacenter.get().getMemorySizeMb()
&& getSpace(input) == machineInDatacenter.get().getDiskSizeGb()
&& input.getLocation().getId().equals(machineInDatacenter.getDatacenter());
}
}).orNull();
代码示例来源:origin: jclouds/legacy-jclouds
if (hardwareId != null) {
hardware = findHardwareWithId(hardwaresToSearch);
if (currentLocationWiderThan(hardware.getLocation()))
this.location = hardware.getLocation();
代码示例来源:origin: io.cloudsoft.jclouds/jclouds-compute
if (hardwareId != null) {
hardware = findHardwareWithId(hardwaresToSearch);
if (currentLocationWiderThan(hardware.getLocation()))
this.location = hardware.getLocation();
代码示例来源:origin: org.apache.jclouds/jclouds-compute
if (hardwareId != null) {
hardware = findHardwareWithId(hardwaresToSearch);
if (currentLocationWiderThan(hardware.getLocation()))
this.location = hardware.getLocation();
代码示例来源:origin: apache/jclouds
if (hardwareId != null) {
hardware = findHardwareWithId(hardwaresToSearch);
if (currentLocationWiderThan(hardware.getLocation()))
this.location = hardware.getLocation();
代码示例来源:origin: jclouds/legacy-jclouds
@Test
public void testConversionWhereLocationFound() {
UUID id = UUID.randomUUID();
FlavorInZone flavorInZoneToConvert = new FlavorInZone(Flavor.builder().id(id.toString())
.name("Test Flavor " + id).ram(262144).disk(10000).vcpus(16).build(), "az-1.region-a.geo-1");
Hardware converted = new FlavorInZoneToHardware(locationIndex).apply(flavorInZoneToConvert);
Flavor flavorToConvert = flavorInZoneToConvert.getFlavor();
assertEquals(converted.getName(), flavorToConvert.getName());
assertEquals(converted.getId(), flavorInZoneToConvert.slashEncode());
assertEquals(converted.getProviderId(), flavorToConvert.getId());
assertEquals(converted.getLocation(), locationIndex.get().get("az-1.region-a.geo-1"));
assertEquals(converted.getRam(), flavorToConvert.getRam());
assertNotNull(converted.getProcessors());
assertFalse(converted.getProcessors().isEmpty());
assertEquals(converted.getProcessors().iterator().next().getCores(), (double) flavorToConvert.getVcpus());
assertNotNull(converted.getVolumes());
assertFalse(converted.getVolumes().isEmpty());
assertEquals(converted.getVolumes().iterator().next().getSize(), Float.valueOf(flavorToConvert.getDisk()));
}
代码示例来源:origin: apache/jclouds
@Test
public void testConversionWhereLocationFound() {
UUID id = UUID.randomUUID();
FlavorInRegion flavorInRegionToConvert = new FlavorInRegion(Flavor.builder().id(id.toString())
.name("Test Flavor " + id).ram(262144).disk(10000).vcpus(16).build(), "az-1.region-a.geo-1");
Hardware converted = new FlavorInRegionToHardware(locationIndex).apply(flavorInRegionToConvert);
Flavor flavorToConvert = flavorInRegionToConvert.getFlavor();
assertEquals(converted.getName(), flavorToConvert.getName());
assertEquals(converted.getId(), flavorInRegionToConvert.slashEncode());
assertEquals(converted.getProviderId(), flavorToConvert.getId());
assertEquals(converted.getLocation(), locationIndex.get().get("az-1.region-a.geo-1"));
assertEquals(converted.getRam(), flavorToConvert.getRam());
assertNotNull(converted.getProcessors());
assertFalse(converted.getProcessors().isEmpty());
assertEquals(converted.getProcessors().iterator().next().getCores(), (double) flavorToConvert.getVcpus());
assertNotNull(converted.getVolumes());
assertFalse(converted.getVolumes().isEmpty());
assertEquals(converted.getVolumes().iterator().next().getSize(), Float.valueOf(flavorToConvert.getDisk()));
}
代码示例来源: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());
}
}
代码示例来源:origin: apache/jclouds
@Test
public void testTemplateBuilder() {
Template defaultTemplate = this.view.getComputeService().templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertTrue(defaultTemplate.getImage().getName().contains("Ubuntu"));
assertEquals(defaultTemplate.getImage().getDefaultCredentials().getUser(), "root");
assertEquals(defaultTemplate.getLocation().getId(), "SYD");
assertEquals(defaultTemplate.getImage().getLocation().getId(), "SYD");
assertEquals(defaultTemplate.getHardware().getLocation().getId(), "SYD");
assertEquals(defaultTemplate.getOptions().as(NovaTemplateOptions.class).shouldAutoAssignFloatingIp(), false);
assertNull(defaultTemplate.getOptions().as(NovaTemplateOptions.class).getDiskConfig());
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}
代码示例来源: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: apache/jclouds
@Test
public void testTemplateBuilder() {
Template defaultTemplate = this.view.getComputeService().templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertTrue(defaultTemplate.getImage().getName().contains("Ubuntu"));
assertEquals(defaultTemplate.getImage().getDefaultCredentials().getUser(), "root");
assertEquals(defaultTemplate.getLocation().getId(), "LON");
assertEquals(defaultTemplate.getImage().getLocation().getId(), "LON");
assertEquals(defaultTemplate.getHardware().getLocation().getId(), "LON");
assertEquals(defaultTemplate.getOptions().as(NovaTemplateOptions.class).shouldAutoAssignFloatingIp(), false);
assertNull(defaultTemplate.getOptions().as(NovaTemplateOptions.class).getDiskConfig());
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}
代码示例来源: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: apache/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());
}
}
内容来源于网络,如有侵权,请联系作者删除!