Examples of BlockDevice


Examples of lcmc.drbd.domain.BlockDevice

                    }
                } else {
                    LOG.appWarning("update: could not parse: " + line);
                }
            }
            final BlockDevice blockDevice = new BlockDevice(this, device);
            blockDevice.setDiskUuid(tokens.get(TOKEN_UUID));
            blockDevice.setBlockSize(tokens.get(TOKEN_SIZE));
            blockDevice.setMountedOn(tokens.get(TOKEN_MP));
            blockDevice.setFsType(tokens.get(TOKEN_FS));
            blockDevice.setVolumeGroup(tokens.get(TOKEN_VG));
            blockDevice.setLogicalVolume(tokens.get(TOKEN_LV));
            blockDevice.setVgOnPhysicalVolume(tokens.get(TOKEN_PV));
            blockDevice.setDiskIds(diskIds);
            return Optional.of(blockDevice);
        }
    }
View Full Code Here

Examples of lcmc.drbd.domain.BlockDevice

     * ones that are in the drbd and are already used in CRM.
     */
    public Collection<String> getBlockDevicesNames() {
        final Collection<String> blockDevicesNames = new ArrayList<String>();
        for (final String bdName : byName.keySet()) {
            final BlockDevice bd = byName.get(bdName);
            if (!bd.isDrbd() && !bd.isUsedByCRM()) {
                blockDevicesNames.add(bdName);
            }
        }
        return blockDevicesNames;
    }
View Full Code Here

Examples of lcmc.drbd.domain.BlockDevice

        if (!otherBlockDevices.isPresent()) {
            return Optional.of(getBlockDevicesNames());
        }
        final Collection<String> blockDevicesIntersection = new ArrayList<String>();
        for (final String otherBlockDevice : otherBlockDevices.get()) {
            final BlockDevice blockDevice = byName.get(otherBlockDevice);
            if (blockDevice != null && !blockDevice.isDrbd()) {
                blockDevicesIntersection.add(otherBlockDevice);
            }
        }
        return Optional.of(blockDevicesIntersection);
    }
View Full Code Here

Examples of lcmc.drbd.domain.BlockDevice

        return Optional.fromNullable(byName.get(device));
    }

    public void setDiskSpace(final Map<String, String> diskSpaces) {
        for (final Map.Entry<String, String> entry : diskSpaces.entrySet()) {
            final BlockDevice blockDevice = byName.get(entry.getKey());
            if (blockDevice != null) {
                blockDevice.setUsed(entry.getValue());
            }
        }
    }
View Full Code Here

Examples of lcmc.drbd.domain.BlockDevice

                    if (selectedBlockDevInfos.isEmpty()) {
                        return false;
                    }

                    for (final BlockDevInfo bdi : selectedBlockDevInfos) {
                        final BlockDevice bd;
                        if (bdi.getBlockDevice().isDrbd()) {
                            if (!bdi.getBlockDevice().isPrimary()) {
                                return false;
                            }
                            bd = bdi.getBlockDevice().getDrbdBlockDevice();
                            if (bd == null) {
                                return false;
                            }
                        } else {
                            bd = bdi.getBlockDevice();
                        }
                        if (!bd.isPhysicalVolume() || bd.isVolumeGroupOnPhysicalVolume()) {
                            return false;
                        }
                    }
                    return true;
                }
View Full Code Here

Examples of lcmc.drbd.domain.BlockDevice

        for (final Map.Entry<String, JCheckBox> pvEntry : pvCheckBoxes.entrySet()) {
            if (!pvEntry.getValue().isSelected()) {
                continue;
            }
            selected++;
            final BlockDevice opv = oPVS.get(pvEntry.getKey());
            if (opv == null) {
                return false;
            }
            if (!opv.isPhysicalVolume() || opv.isVolumeGroupOnPhysicalVolume()) {
                return false;
            }
        }
        return selected > 0;
    }
View Full Code Here

Examples of lcmc.drbd.domain.BlockDevice

    private void addLVMMenu(final MyMenu submenu, final Host host) {
        submenu.removeAll();
        submenu.add(getVGCreateItem(host));
        for (final BlockDevice bd : host.getBlockDevices()) {
            final String vg;
            final BlockDevice drbdBD = bd.getDrbdBlockDevice();
            if (drbdBD == null) {
                vg = bd.getVgOnPhysicalVolume();
            } else {
                vg = drbdBD.getVgOnPhysicalVolume();
            }
            if (vg != null) {
                submenu.add(getLVMCreateItem(vg, bd, host));
            }
        }
View Full Code Here

Examples of lcmc.drbd.domain.BlockDevice

                new AccessMode(AccessMode.OP, AccessMode.NORMAL),
                new AccessMode(AccessMode.OP, AccessMode.NORMAL))
                .visiblePredicate(new VisiblePredicate() {
                    @Override
                    public boolean check() {
                        final BlockDevice bd;
                        if (getBlockDevice().isDrbd()) {
                            if (!getBlockDevice().isPrimary()) {
                                return false;
                            }
                            bd = getBlockDevice().getDrbdBlockDevice();
                            if (bd == null) {
                                return false;
                            }
                        } else {
                            bd = getBlockDevice();
                        }
                        return bd.isPhysicalVolume() && !bd.isVolumeGroupOnPhysicalVolume();
                    }
                })
                .enablePredicate(new EnablePredicate() {
                    @Override
                    public String check() {
View Full Code Here

Examples of lcmc.drbd.domain.BlockDevice

                new AccessMode(AccessMode.OP, AccessMode.NORMAL),
                new AccessMode(AccessMode.OP, AccessMode.NORMAL))
                .visiblePredicate(new VisiblePredicate() {
                    @Override
                    public boolean check() {
                        final BlockDevice bd;
                        if (getBlockDevice().isDrbd()) {
                            if (!getBlockDevice().isPrimary()) {
                                return false;
                            }
                            bd = getBlockDevice().getDrbdBlockDevice();
                            if (bd == null) {
                                return false;
                            }
                        } else {
                            bd = getBlockDevice();
                        }
                        return bd.isVolumeGroupOnPhysicalVolume();
                    }
                })
                .enablePredicate(new EnablePredicate() {
                    @Override
                    public String check() {
                        final String vg;
                        final BlockDevice bd = getBlockDevice();
                        final BlockDevice drbdBD = bd.getDrbdBlockDevice();
                        if (drbdBD == null) {
                            vg = bd.getVgOnPhysicalVolume();
                        } else {
                            vg = drbdBD.getVgOnPhysicalVolume();
                        }
                        if (getHost().getLogicalVolumesFromVolumeGroup(vg) != null) {
                            return "has LV on it";
                        }
                        return null;
View Full Code Here

Examples of org.apache.provisionr.api.hardware.BlockDevice

    }

    @Test
    public void testRunInstancesWithBlockDevices() throws Exception {
        // TODO: maybe we should also test for spot instances
        BlockDevice blockDevice = mock(BlockDevice.class);
        when(blockDevice.getSize()).thenReturn(8); // TODO: understand why it doesn't work for smaller volumes
        when(blockDevice.getName()).thenReturn("/dev/sda1");

        BlockDevice blockDevice2 = mock(BlockDevice.class);
        when(blockDevice2.getSize()).thenReturn(16);
        when(blockDevice2.getName()).thenReturn("/dev/sda4");

        when(hardware.getBlockDevices()).thenReturn(Lists.newArrayList(blockDevice, blockDevice2));

        activity.execute(execution);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.