public Set<VirtualGuestBlockDevice> getVirtualGuestBlockDevices() { Set<VirtualGuestBlockDevice> virtualGuestBlockDevices = Sets.newHashSet(); for (final ContainerVirtualGuestConfigurationOption configurationOption : blockDevices) { virtualGuestBlockDevices.addAll(FluentIterable.from(configurationOption.getTemplate().getVirtualGuestBlockDevices()) .filter(new Predicate<VirtualGuestBlockDevice>() { @Override public boolean apply(VirtualGuestBlockDevice input) { return !input.getDevice().equals(SWAP_DEVICE); } }) .transform(new Function<VirtualGuestBlockDevice, VirtualGuestBlockDevice>() { @Override public VirtualGuestBlockDevice apply(VirtualGuestBlockDevice input) { return input.toBuilder().guest(configurationOption.getTemplate()).build(); } }) .toSet()); } return virtualGuestBlockDevices; }
public Set<VirtualGuestBlockDevice> getVirtualGuestBlockDevices() { Set<VirtualGuestBlockDevice> virtualGuestBlockDevices = Sets.newHashSet(); for (final ContainerVirtualGuestConfigurationOption configurationOption : blockDevices) { virtualGuestBlockDevices.addAll(FluentIterable.from(configurationOption.getTemplate().getVirtualGuestBlockDevices()) .filter(new Predicate<VirtualGuestBlockDevice>() { @Override public boolean apply(VirtualGuestBlockDevice input) { return !input.getDevice().equals(SWAP_DEVICE); } }) .transform(new Function<VirtualGuestBlockDevice, VirtualGuestBlockDevice>() { @Override public VirtualGuestBlockDevice apply(VirtualGuestBlockDevice input) { return input.toBuilder().guest(configurationOption.getTemplate()).build(); } }) .toSet()); } return virtualGuestBlockDevices; }
public Set<VirtualGuestBlockDevice> getVirtualGuestBlockDevices() { Set<VirtualGuestBlockDevice> virtualGuestBlockDevices = Sets.newHashSet(); for (final ContainerVirtualGuestConfigurationOption configurationOption : blockDevices) { virtualGuestBlockDevices.addAll(FluentIterable.from(configurationOption.getTemplate().getVirtualGuestBlockDevices()) .filter(new Predicate<VirtualGuestBlockDevice>() { @Override public boolean apply(VirtualGuestBlockDevice input) { return !input.getDevice().equals(SWAP_DEVICE); } }) .transform(new Function<VirtualGuestBlockDevice, VirtualGuestBlockDevice>() { @Override public VirtualGuestBlockDevice apply(VirtualGuestBlockDevice input) { return input.toBuilder().guest(configurationOption.getTemplate()).build(); } }) .toSet()); } return virtualGuestBlockDevices; }
public Set<VirtualGuestBlockDevice> getVirtualGuestBlockDevices() { if(blockDevices.isEmpty()) return ImmutableSet.of(); Set<VirtualGuestBlockDevice> virtualGuestBlockDevices = Sets.newHashSet(); for (final ContainerVirtualGuestConfigurationOption configurationOption : blockDevices) { virtualGuestBlockDevices.addAll(FluentIterable.from(configurationOption.getTemplate().getVirtualGuestBlockDevices()) .filter(new Predicate<VirtualGuestBlockDevice>() { @Override public boolean apply(VirtualGuestBlockDevice input) { return !input.getDevice().equals(SWAP_DEVICE); } }) .transform(new Function<VirtualGuestBlockDevice, VirtualGuestBlockDevice>() { @Override public VirtualGuestBlockDevice apply(VirtualGuestBlockDevice input) { return input.toBuilder().guest(configurationOption.getTemplate()).build(); } }) .toSet()); } return virtualGuestBlockDevices; }
private List<BlockDevice> getBlockDevices(VirtualGuest virtualGuest) { if (virtualGuest.getVirtualGuestBlockDevices() == null) { return null; } List<BlockDevice> blockDevices = Lists.newArrayList(); for (VirtualGuestBlockDevice blockDevice : virtualGuest.getVirtualGuestBlockDevices()) { blockDevices.add(new BlockDevice(blockDevice.getDevice(), blockDevice.getVirtualDiskImage().getCapacity())); } Collections.sort(blockDevices, new BlockDevicesComparator()); return ImmutableList.copyOf(blockDevices); }
private List<BlockDevice> getBlockDevices(VirtualGuest virtualGuest) { if (virtualGuest.getVirtualGuestBlockDevices() == null) { return null; } List<BlockDevice> blockDevices = Lists.newArrayList(); for (VirtualGuestBlockDevice blockDevice : virtualGuest.getVirtualGuestBlockDevices()) { blockDevices.add(new BlockDevice(blockDevice.getDevice(), blockDevice.getVirtualDiskImage().getCapacity())); } Collections.sort(blockDevices, new BlockDevicesComparator()); return ImmutableList.copyOf(blockDevices); }
private List<BlockDevice> getBlockDevices(VirtualGuest virtualGuest) { if (virtualGuest.getVirtualGuestBlockDevices() == null) { return null; } List<BlockDevice> blockDevices = Lists.newArrayList(); for (VirtualGuestBlockDevice blockDevice : virtualGuest.getVirtualGuestBlockDevices()) { blockDevices.add(new BlockDevice(blockDevice.getDevice(), blockDevice.getVirtualDiskImage().getCapacity())); } Collections.sort(blockDevices, new BlockDevicesComparator()); return ImmutableList.copyOf(blockDevices); }
private Set<BlockDevice> getBlockDevices(VirtualGuest virtualGuest) { if (virtualGuest.getVirtualGuestBlockDevices() == null) return null; Set<BlockDevice> set = FluentIterable.from(virtualGuest.getVirtualGuestBlockDevices()) .transform(new Function<VirtualGuestBlockDevice, BlockDevice>() { @Override public BlockDevice apply(VirtualGuestBlockDevice input) { return new BlockDevice(input.getDevice(), input.getVirtualDiskImage().getCapacity()); } }) .toSortedSet(new Comparator<BlockDevice>() { @Override public int compare(BlockDevice b1, BlockDevice b2) { return Integer.valueOf(b1.getDevice()).compareTo(Integer.valueOf(b2.getDevice())); } }); return set; }
@Override public Hardware apply(final VirtualGuest from) { HardwareBuilder builder = new HardwareBuilder().ids(from.getId() + "") .name(from.getHostname()) .hypervisor("XenServer") .processors(ImmutableList.of(new Processor(from.getStartCpus(), 0))) .ram(from.getMaxMemory()); if(from.getVirtualGuestBlockDevices() != null) { builder.volumes( FluentIterable.from(from.getVirtualGuestBlockDevices()).filter(new Predicate<VirtualGuestBlockDevice>() { @Override public boolean apply(VirtualGuestBlockDevice input) { return input.getMountType().equals("Disk"); } }) .transform(new Function<VirtualGuestBlockDevice, Volume>() { @Override public Volume apply(VirtualGuestBlockDevice item) { float volumeSize = item.getVirtualDiskImage().getCapacity(); return new VolumeImpl( item.getId() + "", from.isLocalDiskFlag() ? Volume.Type.LOCAL : Volume.Type.SAN, volumeSize, null, item.getBootableFlag() == 1, false); } }).toSet()); } return builder.build(); } }
.ram(from.getMaxMemory()); if (from.getVirtualGuestBlockDevices() != null) { builder.volumes( FluentIterable.from(from.getVirtualGuestBlockDevices()).filter(new Predicate<VirtualGuestBlockDevice>() { @Override public boolean apply(VirtualGuestBlockDevice input) {
.ram(from.getMaxMemory()); if (from.getVirtualGuestBlockDevices() != null) { builder.volumes( FluentIterable.from(from.getVirtualGuestBlockDevices()).filter(new Predicate<VirtualGuestBlockDevice>() { @Override public boolean apply(VirtualGuestBlockDevice input) {
.ram(from.getMaxMemory()); if (from.getVirtualGuestBlockDevices() != null) { builder.volumes( FluentIterable.from(from.getVirtualGuestBlockDevices()).filter(new Predicate<VirtualGuestBlockDevice>() { @Override public boolean apply(VirtualGuestBlockDevice input) {