@Override public boolean apply(Volume input) { return !input.isBootDevice(); }
@Override public boolean apply(Volume input) { return !input.isBootDevice(); }
@Override public boolean apply(Volume input) { return !input.isBootDevice(); }
@Override public boolean apply(Volume input) { return !input.isBootDevice(); }
@Override public boolean apply(Volume input) { return !input.isBootDevice(); }
@Override public boolean apply(Volume input) { return !input.isBootDevice(); }
public Map<String, String> getDeviceMappings(ClusterSpec clusterSpec, Instance instance) { Map<String, String> mappings = Maps.newLinkedHashMap(); int number = 0; Hardware hardware = instance.getNodeMetadata().getHardware(); /* null when using the BYON jclouds compute provider */ if (hardware != null) { List<? extends Volume> volumes = instance.getNodeMetadata().getHardware().getVolumes(); boolean foundBootDevice = false; SortedSet<String> volumeDevicesSansBoot = new TreeSet<String>(); for (Volume volume : volumes) { if (!volume.isBootDevice()) { volumeDevicesSansBoot.add(volume.getDevice()); } else { foundBootDevice = true; } } // if no boot device is reported from the cloud provider (as is sometimes the case) // assume it is the first in the natural order list of devices if (!foundBootDevice && !volumeDevicesSansBoot.isEmpty()) { volumeDevicesSansBoot.remove(volumeDevicesSansBoot.iterator().next()); } for (String device : volumeDevicesSansBoot) { mappings.put(MOUNT_PREFIX + number++, device); } } return mappings; }
public Map<String, String> getDeviceMappings(ClusterSpec clusterSpec, Instance instance) { Map<String, String> mappings = Maps.newLinkedHashMap(); int number = 0; Hardware hardware = instance.getNodeMetadata().getHardware(); /* null when using the BYON jclouds compute provider */ if (hardware != null) { List<? extends Volume> volumes = instance.getNodeMetadata().getHardware().getVolumes(); for (Volume volume : volumes) { if (volume.isBootDevice()) { continue; } mappings.put(MOUNT_PREFIX + number++, volume.getDevice()); } } return mappings; }
private void mapDevices(EC2TemplateOptions ec2TemplateOptions, Template template, String user) { String mkfsOptions = simulatorProperties.get("INSTANCE_STORAGE_MKFS_OPTIONS", DEFAULT_MKFS_OPTIONS); String mountOptions = simulatorProperties.get("INSTANCE_STORAGE_MOUNT_OPTIONS", DEFAULT_MOUNT_OPTIONS); int ephemeralCounter = 0; for (Volume volume : template.getHardware().getVolumes()) { if (!volume.isBootDevice() && LOCAL.equals(volume.getType())) { String device = volume.getDevice(); LOGGER.info(format("Mapping device %s (%d GB)", device, round(volume.getSize()))); ec2TemplateOptions.mapEphemeralDeviceToDeviceName(device, "ephemeral" + ephemeralCounter++); mountDevice(device, mkfsOptions, mountOptions, user); } } }
public static Volume fromVolume(Volume in) { return new VolumeImpl(in.getId(), in.getType(), in.getSize(), in.getDevice(), in.isBootDevice(), in.isDurable()); } }
public static Volume fromVolume(Volume in) { return new VolumeImpl(in.getId(), in.getType(), in.getSize(), in.getDevice(), in.isBootDevice(), in.isDurable()); } }
public static Volume fromVolume(Volume in) { return new VolumeImpl(in.getId(), in.getType(), in.getSize(), in.getDevice(), in.isBootDevice(), in.isDurable()); } }
public static Volume fromVolume(Volume in) { return new VolumeImpl(in.getId(), in.getType(), in.getSize(), in.getDevice(), in.isBootDevice(), in.isDurable()); } }
@Override public Volume apply(@Nullable org.jclouds.compute.domain.Volume input) { if (input == null) { return null; } return Volume.builder().id(input.getId()).size(input.getSize()).type(input.getType().name()).device(input.getDevice()) .durable(input.isDurable()).bootDevice(input.isBootDevice()).build(); } }
@Test public void testHardware() { Hardware hardware = toHardware.apply(ImmutableSet.of(cpuItem, ramItem, volumeItem)); assertEquals("123,456,789", hardware.getId()); List<? extends Processor> processors = hardware.getProcessors(); assertEquals(1, processors.size()); assertEquals(2.0, processors.get(0).getCores()); assertEquals(2, hardware.getRam()); List<? extends Volume> volumes = hardware.getVolumes(); assertEquals(1, volumes.size()); Volume volume = volumes.get(0); assertEquals(100F, volume.getSize()); assertEquals(Volume.Type.SAN, volume.getType()); assertEquals(true, volume.isBootDevice()); }
@Test public void testHardwareWithTwoDisks() { ProductItem localVolumeItem = ProductItem.builder().id(4).description("25 GB").capacity(25F).prices( ProductItemPrice.builder().id(987).build()).categories( ProductItemCategory.builder().categoryCode("guest_disk1").build()).build(); Hardware hardware = toHardware.apply(ImmutableSet.of(cpuItem, ramItem, volumeItem,localVolumeItem)); List<? extends Volume> volumes = hardware.getVolumes(); assertEquals(2, volumes.size()); Volume volume = volumes.get(0); assertEquals(100F, volume.getSize()); assertEquals(Volume.Type.SAN, volume.getType()); assertEquals(true, volume.isBootDevice()); Volume volume1 = volumes.get(1); assertEquals(25F, volume1.getSize()); assertEquals(Volume.Type.LOCAL, volume1.getType()); assertEquals(false, volume1.isBootDevice()); } }