public static double getCores(Hardware input) { double cores = 0; for (Processor processor : input.getProcessors()) cores += processor.getCores(); return cores; }
public static double getCores(Hardware input) { double cores = 0; for (Processor processor : input.getProcessors()) cores += processor.getCores(); return cores; }
public static double getCores(Hardware input) { double cores = 0; for (Processor processor : input.getProcessors()) cores += processor.getCores(); return cores; }
public static double getCores(Hardware input) { double cores = 0; for (Processor processor : input.getProcessors()) cores += processor.getCores(); return cores; }
protected double getCpuCores(Hardware hardware) { int nb = 0; for (Processor p : hardware.getProcessors()) { nb += p.getCores(); } return nb; }
public static double getCoresAndSpeed(Hardware input) { double total = 0; for (Processor processor : input.getProcessors()) total += processor.getCores() * processor.getSpeed(); return total; }
public static double getCoresAndSpeed(Hardware input) { double total = 0; for (Processor processor : input.getProcessors()) total += processor.getCores() * processor.getSpeed(); return total; }
public static double getCoresAndSpeed(Hardware input) { double total = 0; for (Processor processor : input.getProcessors()) total += processor.getCores() * processor.getSpeed(); return total; }
protected double getCpuUnits(Hardware hardware) { double nb = 0; for (Processor p : hardware.getProcessors()) { nb += p.getCores() * p.getSpeed(); } return nb; }
public static double getCoresAndSpeed(Hardware input) { double total = 0; for (Processor processor : input.getProcessors()) total += processor.getCores() * processor.getSpeed(); return total; }
@Test public void machineTypeParserTest() { URI uri = URI.create("https://www.googleapis.com/compute/v1/projects/jclouds-dev/zones/asia-east1-a/machineTypes/custom-1-1024"); Hardware hardware = machineTypeURIToCustomHardware(uri); assertThat(hardware.getRam()).isEqualTo(1024); assertThat(hardware.getProcessors().get(0).getCores()).isEqualTo(1); assertThat(hardware.getUri()) .isEqualTo(URI.create("https://www.googleapis.com/compute/v1/projects/jclouds-dev/zones/asia-east1-a/machineTypes/custom-1-1024")); assertThat(hardware.getId()) .isEqualTo("https://www.googleapis.com/compute/v1/projects/jclouds-dev/zones/asia-east1-a/machineTypes/custom-1-1024"); }
@Test public void testVirtualGuestToHardware() { VirtualGuest virtualGuest = createVirtualGuest(); Hardware hardware = new VirtualGuestToHardware().apply(virtualGuest); assertNotNull(hardware); assertEquals(hardware.getRam(), virtualGuest.getMaxMemory()); assertTrue(hardware.getProcessors().size() == 1); assertEquals(Iterables.get(hardware.getProcessors(), 0).getCores(), (double) virtualGuest.getStartCpus()); }
@Test(dataProvider = "onlyIfAutomaticHardwareSupported", groups = {"integration", "live"}) public void testAutoGeneratedHardwareFromId() { Template template = view.getComputeService().templateBuilder() .hardwareId("automatic:cores=2;ram=1024").build(); assertThat(template.getHardware().getId()).isEqualTo("automatic:cores=2.0;ram=1024"); assertThat(template.getHardware().getRam()).isEqualTo(1024); assertThat(template.getHardware().getProcessors().get(0).getCores()).isEqualTo(2); }
@Override @Test(dataProvider = "onlyIfAutomaticHardwareSupported", groups = {"integration", "live"}) public void testAutoGeneratedHardwareFromId() { Template template = view.getComputeService().templateBuilder() .hardwareId("automatic:cores=2;ram=1024").build(); assertThat(template.getHardware().getId()).isEqualTo(template.getLocation() .getDescription() + "/machineTypes/custom-2-1024"); assertThat(template.getHardware().getRam()).isEqualTo(1024); assertThat(template.getHardware().getProcessors().get(0).getCores()).isEqualTo(2); assertThat(template.getHardware().getUri()).isEqualTo(URI.create(template.getLocation() .getDescription() + "/machineTypes/custom-2-1024")); }
@Test(dataProvider = "onlyIfAutomaticHardwareSupported", groups = {"integration", "live"}) public void testAutoGeneratedHardwareWithOnlyMinCoresMatchHardwareProfile() { if (!view.getComputeService().listHardwareProfiles().isEmpty()) { Template template = view.getComputeService().templateBuilder().minCores(4).build(); assertThat(AutomaticHardwareIdSpec.isAutomaticId(template.getHardware().getId())).isFalse(); assertThat(template.getHardware().getProcessors().get(0).getCores()).isGreaterThanOrEqualTo(4); } else { throw new SkipException("Hardware profile list is empty, this provider can not match any hardware profile" + "to the specified minRam and minCores."); } }
@Test(groups={"Live", "Live-sanity"}) public void testJcloudsCreateWithHardwareProfiles() throws Exception { // default minRam is 1gb obtainMachine(); assertTrue(template.getHardware().getRam() >= 1000, "template="+template); assertEquals(template.getHardware().getId(), G1_SMALL_HARDWARE_ID_LONG_FORM, "template="+template); obtainMachine(MutableMap.of(JcloudsLocationConfig.MIN_RAM, "4096")); assertTrue(template.getHardware().getRam() >= 4096, "template="+template); assertEquals(template.getHardware().getId(), N1_STANDARD_2_HARDWARE_ID_LONG_FORM, "template="+template); obtainMachine(MutableMap.of(JcloudsLocationConfig.MIN_CORES, "4")); assertTrue(template.getHardware().getProcessors().get(0).getCores() >= 4, "template="+template); assertEquals(template.getHardware().getId(), N1_HIGHCPU_4_HARDWARE_ID_LONG_FORM, "template="+template); }
@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()); } }
@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()); } }
@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()); } }
@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()); } }