@Override public boolean apply(Volume volume) { return volume.getDevice().equals(BOOTABLE_DEVICE); } });
@Override public boolean apply(Volume volume) { return volume.getDevice().equals(BOOTABLE_DEVICE); } });
@Override public boolean apply(Volume volume) { return volume.getDevice().equals(BOOTABLE_DEVICE); } });
@Override public boolean apply(Volume volume) { return volume.getDevice().equals(BOOTABLE_DEVICE); } });
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(); } }
private void applyAndAssert(Server server) { final Hardware hardware = serverToHardware.apply(server); assertEquals(server.memoryGb() * 1024, hardware.getRam()); assertEquals("vmx", hardware.getHypervisor()); assertEquals(server.id(), hardware.getId()); assertEquals(server.id(), hardware.getProviderId()); assertEquals(server.name(), hardware.getName()); assertEquals(server.disks().size(), hardware.getVolumes().size()); assertEquals(Float.valueOf(server.disks().get(0).sizeGb()), hardware.getVolumes().get(0).getSize()); assertEquals(Volume.Type.LOCAL, hardware.getVolumes().get(0).getType()); assertEquals(server.disks().get(0).id(), hardware.getVolumes().get(0).getId()); assertEquals(server.disks().get(0).scsiId().toString(), hardware.getVolumes().get(0).getDevice()); assertEquals(server.cpu().count(), hardware.getProcessors().size()); assertEquals(Double.valueOf(server.cpu().coresPerSocket()), hardware.getProcessors().get(0).getCores()); assertEquals(CpuSpeed.STANDARD.getSpeed(), hardware.getProcessors().get(0).getSpeed()); }
private void applyAndAssert(BaseImage baseImage) { final Hardware hardware = baseImageToHardware.apply(baseImage); assertEquals(baseImage.memoryGb() * 1024, hardware.getRam()); assertEquals("vmx", hardware.getHypervisor()); assertEquals(baseImage.id(), hardware.getId()); assertEquals(baseImage.id(), hardware.getProviderId()); assertEquals(baseImage.name(), hardware.getName()); assertEquals(baseImage.disks().size(), hardware.getVolumes().size()); assertEquals(Float.valueOf(baseImage.disks().get(0).sizeGb()), hardware.getVolumes().get(0).getSize()); assertEquals(Volume.Type.LOCAL, hardware.getVolumes().get(0).getType()); assertEquals(baseImage.disks().get(0).id(), hardware.getVolumes().get(0).getId()); assertEquals(baseImage.disks().get(0).scsiId().toString(), hardware.getVolumes().get(0).getDevice()); assertEquals(baseImage.cpu().count(), hardware.getProcessors().size()); assertEquals(Double.valueOf(baseImage.cpu().coresPerSocket()), hardware.getProcessors().get(0).getCores()); assertEquals(CpuSpeed.STANDARD.getSpeed(), hardware.getProcessors().get(0).getSpeed()); }