Examples of BlockDevice


Examples of com.axemblr.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);

        Uninterruptibles.sleepUninterruptibly(30, TimeUnit.SECONDS);
View Full Code Here

Examples of lcmc.drbd.domain.BlockDevice

                    tt.append("        ").append(tab);
                    final String lvName = "/dev/" + vg + '/' + lv;
                    if (lvName.equals(selectedLV)) {
                        if (bd.isDrbd()) {
                            tt.append(lv).append('\n');
                            final BlockDevice drbdBD = bd.getDrbdBlockDevice();
                            if (drbdBD != null) {
                                appendBlockDeviceHierarchy(drbdBD, tt, shift + 3);
                            }
                        } else {
                            tt.append("<b>").append(lv).append("</b>\n");
                        }
                    } else {
                        tt.append(lv).append('\n');
                    }
                }
            }
        } else {
            final BlockDevice drbdBD = bd.getDrbdBlockDevice();
            if (drbdBD != null) {
                tt.append(tab).append(bd.getName()).append('\n');
                appendBlockDeviceHierarchy(drbdBD, tt, shift + 1);
            } else {
                tt.append("<b>")
View Full Code Here

Examples of lcmc.drbd.domain.BlockDevice

    }

    @Override
    public String getToolTipForGraph(final Application.RunMode runMode) {
        final StringBuilder tt = new StringBuilder(60);
        final BlockDevice bd = getBlockDevice();

        tt.append("<pre>");
        appendBlockDeviceHierarchy(bd, tt, 0);
        tt.append("</pre>");
        if (bd.isDrbdMetaDisk()) {
            tt.append(" (Meta Disk)\n");
            for (final BlockDevice mb : getBlockDevice().getMetaDiskOfBlockDevices()) {
                tt.append("&nbsp;&nbsp;of ").append(mb.getName()).append('\n');
            }
        }

        final String uuid = bd.getDiskUuid();
        tt.append("\n<table>");
        if (uuid != null && uuid.startsWith(BY_UUID_PATH)) {
            tt.append("<tr><td><b>UUID:</b></td><td>")
              .append(uuid.substring(18))
              .append("</td></tr>");
        }
        String label = "ID:";
        for (final String diskId : bd.getDiskIds()) {
            if (diskId.length() > 16) {
                tt.append("<tr><td><b>")
                  .append(label)
                  .append("</b></td><td>")
                  .append(diskId.substring(16))
                  .append("</td></tr>");
                label = "";
            }
        }
        tt.append("\n</table>");

        if (bd.isDrbd()) {
            if (getHost().isDrbdStatusOk()) {
                String cs = bd.getConnectionState();
                String st = bd.getNodeState();
                String ds = bd.getDiskState();
                if (cs == null) {
                    cs = "not available";
                }
                if (st == null) {
                    st = "not available";
View Full Code Here

Examples of lcmc.drbd.domain.BlockDevice

        if (defaultValue != null) {
            list.add(defaultValue);
        }

        for (final BlockDevInfo bdi : blockDevInfos) {
            final BlockDevice bd = bdi.getBlockDevice();
            if (bdi.equals(savedMetaDisk) || (!bd.isDrbd() && !bd.isUsedByCRM() && !bd.isMounted())) {
                list.add(bdi);
            }
        }
        return list.toArray(new Value[list.size()]);
    }
View Full Code Here

Examples of lcmc.drbd.domain.BlockDevice

            final Value v = getWidget(DRBD_MD_PARAM, null).getValue();
            if (v.isNothingSelected() || "internal".equals(v.getValueForConfig())) {
                getBlockDevice().setMetaDisk(null); /* internal */
            } else {
                final BlockDevice metaDisk = ((BlockDevInfo) v).getBlockDevice();
                getBlockDevice().setMetaDisk(metaDisk);
            }
            getBrowser().getClusterBrowser().getGlobalInfo().setAllApplyButtons();
        }
    }
View Full Code Here

Examples of lcmc.drbd.domain.BlockDevice

    protected String getParamLongDesc(final String param) {
        return Tools.getString(param + ".Long");
    }

    public String getVGName() {
        final BlockDevice bd;
        if (getBlockDevice().isDrbd()) {
            bd = getBlockDevice().getDrbdBlockDevice();
            if (bd == null) {
                return null;
            }
        } else {
            bd = getBlockDevice();
        }
        final String vg = bd.getVolumeGroup();
        if (vg == null) {
            /* vg on pv */
            return bd.getVgOnPhysicalVolume();
        } else {
            /* lv on vg */
            return vg;
        }
    }
View Full Code Here

Examples of lcmc.drbd.domain.BlockDevice

        return !isLVM() && !getBlockDevice().isPhysicalVolume() && !getBlockDevice().isDrbdPhysicalVolume();
    }

    /** Whether PV can be removed from this BD. */
    boolean canRemovePV() {
        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();
    }
View Full Code Here

Examples of lcmc.drbd.domain.BlockDevice

        return bd.isPhysicalVolume() && !bd.isVolumeGroupOnPhysicalVolume();
    }

    /** Whether VG can be removed. */
    boolean canRemoveVG() {
        final BlockDevice bd;
        if (getBlockDevice().isDrbd()) {
            if (!getBlockDevice().isPrimary()) {
                return false;
            }
            bd = getBlockDevice().getDrbdBlockDevice();
            if (bd == null) {
                return false;
            }
        } else {
            bd = getBlockDevice();
        }
        if (!bd.isVolumeGroupOnPhysicalVolume()) {
            return false;
        }
        final String vg = bd.getVgOnPhysicalVolume();
        return getHost().getLogicalVolumesFromVolumeGroup(vg) == null;
    }
View Full Code Here

Examples of lcmc.drbd.domain.BlockDevice

            }
            final BlockDevInfo destBDI = (BlockDevInfo) getInfo(dest);
            if (destBDI == null) {
                return "";
            }
            final BlockDevice sourceBD = sourceBDI.getBlockDevice();
            final BlockDevice destBD = destBDI.getBlockDevice();
            final Application.RunMode runMode = getRunMode();
            if (!destBDI.isConnected(runMode)) {
                if (sourceBDI.isWFConnection(runMode)
                    && !destBDI.isWFConnection(runMode)) {
                    edge.setDirection(dest, source);
                    application.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            repaint();
                        }
                    });

                }
            } else if (!sourceBD.isPrimary() && destBD.isPrimary()) {
                edge.setDirection(dest, source);
                application.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        repaint();
                    }
                });
            }
            final StringBuilder l = new StringBuilder(dvi.getNameForGraph());
            final Map<Vertex, Point2D> vl = getVertexLocations();
            final Point2D sp = vl.get(source);
            final Point2D dp = vl.get(dest);
            putVertexLocations();
            final int len = (int) Math.sqrt(Math.pow(sp.getX() - dp.getX(), 2) + Math.pow(sp.getY() - dp.getY(), 2));
            final int maxLen = (len - 200) / 7;
            if (l.length() > maxLen) {
                l.delete(0, l.length() - maxLen + 3);
                l.insert(0, "...");
            }
            if (dvi.isSyncing()) {
                String syncedProgress = dvi.getSyncedProgress();
                if (syncedProgress == null) {
                    syncedProgress = "?.?";
                }
                final double sourceX = getLayout().transform(source).getX();
                final double destX = getLayout().transform(dest).getX();
                if (sourceBD.isPausedSync() || destBD.isPausedSync()) {
                    l.append(" (").append(syncedProgress).append("% paused)");
                } else if (sourceBD.isSyncSource() && sourceX < destX
                           || destBD.isSyncSource() && sourceX > destX) {
                    l.append(" (").append(syncedProgress).append("% \u2192)"); /* -> */
                } else {
                    l.append(" (\u2190 ").append(syncedProgress).append("%)"); /* <- */
                }
            } else if (dvi.isSplitBrain()) {
View Full Code Here

Examples of lcmc.drbd.domain.BlockDevice

        final BlockDevInfo sourceBDI = (BlockDevInfo) getInfo(edge.getSource());
        final BlockDevInfo destBDI = (BlockDevInfo) getInfo(edge.getDest());
        if (sourceBDI == null || destBDI == null) {
            return false;
        }
        final BlockDevice sourceBD = sourceBDI.getBlockDevice();
        final BlockDevice destBD = destBDI.getBlockDevice();
        final Application.RunMode runMode = getRunMode();
        if (sourceBDI.isConnected(runMode)
            && sourceBD.isPrimary() != destBD.isPrimary()) {
            return true;
        } else if (sourceBDI.isWFConnection(runMode) ^ destBDI.isWFConnection(runMode)) {
            /* show arrow from wf connection */
            return true;
        }
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.