Package lcmc.drbd.ui.resource

Examples of lcmc.drbd.ui.resource.BlockDevInfo


            final String drbdDev = dxml.getDrbdDevice(resName, volumeNr);
            final Map<String, String> hostDiskMap = dxml.getHostDiskMap(resName, volumeNr);
            if (hostDiskMap == null) {
                continue;
            }
            BlockDevInfo bd1 = null;
            BlockDevInfo bd2 = null;
            for (final String hostName : hostDiskMap.keySet()) {
                if (!cluster.contains(hostName)) {
                    continue;
                }
                final String disk = hostDiskMap.get(hostName);
                final BlockDevInfo bdi = drbdGraph.findBlockDevInfo(hostName, disk);
                if (bdi == null) {
                    if (getDrbdDeviceHash().containsKey(disk)) {
                        /* TODO: ignoring stacked device */
                        putDrbdDevHash();
                        continue;
                    } else {
                        putDrbdDevHash();
                        LOG.appWarning("updateDrbdResources: could not find disk: " + disk + " on host: " + hostName);
                        continue;
                    }
                }
                bdi.setParameters(resName);
                if (bd1 == null) {
                    bd1 = bdi;
                } else {
                    bd2 = bdi;
                }
View Full Code Here


     * Returns how much of the disk is used.
     * -1 for not used or not applicable.
     */
    protected int getUsed(final Vertex v) {
        if (isVertexBlockDevice(v)) {
            final BlockDevInfo bdi = (BlockDevInfo) getInfo(v);
            if (bdi == null) {
                return 0;
            }
            return bdi.getUsed();
        }
        final HostDrbdInfo hi = vertexToHostMap.get(v);
        if (hi == null) {
            return 0;
        } else {
View Full Code Here

                              final Shape shape) {
        final double used = getUsed(v);
        final float height = (float) shape.getBounds().getHeight();
        final float width = (float) shape.getBounds().getWidth();
        if (isVertexBlockDevice(v)) {
            final BlockDevInfo bdi = (BlockDevInfo) getInfo(v);
            if (bdi != null && bdi.getBlockDevice().isDrbdMetaDisk()) {
                final Color[] colors = {null, null};
                colors[1] = getVertexFillColor(blockDeviceToVertexMap.get(
                                                 bdi.getBlockDevice().getMetaDiskOfBlockDevices().get(0)));
                drawInsideVertex(g2d, v, colors, x, y, height, width);
            }
        } else {
            final HostDrbdInfo hi = (HostDrbdInfo) getInfo(v);
            if (hi != null) {
View Full Code Here

            if (oldBlockDevices.size() != blockDevInfos.size()) {
                changed = true;
            }
            blockDevInfos.clear();
            for (final BlockDevice blockDevice : blockDevices) {
                final BlockDevInfo blockDevInfo;
                if (oldBlockDevices.containsKey(blockDevice)) {
                    blockDevInfo = oldBlockDevices.get(blockDevice);
                    blockDevInfo.updateInfo();
                } else {
                    changed = true;
                    blockDevInfo = blockDevInfoFactory.get();
                    blockDevInfo.init(blockDevice.getName(), blockDevice, this);
                }
                blockDevInfos.put(blockDevice, blockDevInfo);
            }
        } finally {
            mBlockDevInfosWriteLock.unlock();
        }
        if (changed) {
            mBlockDevInfosWriteLock.lock();
            try {
                treeMenuController.removeChildren(blockDevicesNode);
                for (final Map.Entry<BlockDevice, BlockDevInfo> bdEntry : blockDevInfos.entrySet()) {
                    final BlockDevInfo bdi = bdEntry.getValue();
                    final MutableTreeNode resource = treeMenuController.createMenuItem(blockDevicesNode, bdi);
                }
                treeMenuController.reloadNode(blockDevicesNode, false);
            } finally {
                mBlockDevInfosWriteLock.unlock();
View Full Code Here

            oldVertexList = new ArrayList<Vertex>(vertexList);
        }
        final Set<BlockDevInfo> blockDevInfos = host.getBrowser().getSortedBlockDevInfos();
        if (oldVertexList != null) {
            for (final Vertex vertex : oldVertexList) {
                final BlockDevInfo bdi = (BlockDevInfo) getInfo(vertex);
                if (bdi == null) {
                    continue;
                }
                if (!blockDevInfos.contains(bdi)) {
                    /* removing */
                    final Vertex bdv = bdiToVertexMap.get(bdi);
                    final VolumeInfo dvi = bdi.getDrbdVolumeInfo();
                    if (dvi != null) {
                        removeDrbdVolume(dvi);
                        dvi.getDrbdResourceInfo().removeDrbdVolumeFromHashes(dvi);
                    }
                    application.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            lockGraph();
                            getGraph().removeVertex(bdv);
                            unlockGraph();
                        }
                    });
                    removeInfo(bdv);
                    removeVertex(bdi);
                    getVertexToMenus().remove(bdv);
                    bdiToVertexMap.remove(bdi);
                    blockDeviceToVertexMap.remove(bdi.getBlockDevice());
                    vertexToHostMap.remove(bdv);
                    vertexList.remove(bdv);
                    somethingChanged();
                }
            }
        }
        BlockDevInfo prevBdi = null;
        for (final BlockDevInfo bdi : blockDevInfos) {
            stopAnimation(bdi);
            Vertex bdv = null;
            if (!blockDeviceToVertexMap.containsKey(bdi.getBlockDevice())) {
                bdv = new Vertex();
                somethingChanged();
                bdiToVertexMap.put(bdi, bdv);
                blockDeviceToVertexMap.put(bdi.getBlockDevice(), bdv);
                putVertexToInfo(bdv, bdi);
                putInfoToVertex(bdi, bdv);
                vertexToHostMap.put(bdv, hostDrbdInfo);
                vertexList.add(bdv);
                // TODO: get saved position is disabled at the moment,
                // because it does more harm than good at the moment.
            }
            if (bdv == null) {
                bdv = blockDeviceToVertexMap.get(bdi.getBlockDevice());
            }
            if (prevBdi != null
                && bdi.getBlockDevice().isVolumeGroupOnPhysicalVolume()
                && bdi.getBlockDevice().getVgOnPhysicalVolume().equals(
                                               prevBdi.getBlockDevice().getVgOnPhysicalVolume())) {
                devYPos -= 8;
            } else if (prevBdi != null
                && (!bdi.getBlockDevice().isDrbd() || !prevBdi.getBlockDevice().isDrbd())) {
                devYPos -= 4;
            } else if (prevBdi != null
                      && bdi.getBlockDevice().isDrbd()
                      && prevBdi.getBlockDevice().isDrbd()
                      && bdi.getDrbdVolumeInfo().getDrbdResourceInfo()
                         == prevBdi.getDrbdVolumeInfo().getDrbdResourceInfo()) {
                devYPos -= 6;
            }
            final Point2D pos = new Point2D.Double(hostXPos + BD_X_OFFSET + VERTEX_SIZE_BD / 2, devYPos);
            devYPos += BD_STEP_Y;
            getVertexLocations().put(bdv, pos);
View Full Code Here

     */
    @Override
    protected List<ImageIcon> getIconsForVertex(final Vertex v, final Application.RunMode runMode) {
        final List<ImageIcon> icons = new ArrayList<ImageIcon>();
        if (isVertexBlockDevice(v)) {
            final BlockDevInfo bdi = (BlockDevInfo) getInfo(v);
            if (bdi == null) {
                return icons;
            }
            if (bdi.getBlockDevice().isDrbd()) {
                icons.add(BlockDevInfo.HARDDISK_DRBD_ICON_LARGE);
            } else {
                icons.add(BlockDevInfo.HARDDISK_ICON_LARGE);
            }
            if (bdi.isDiskless(runMode)) {
                icons.add(BlockDevInfo.NO_HARDDISK_ICON_LARGE);
                return icons;
            } else {
                return icons;
            }
View Full Code Here

        if (dvi != null
            && dvi.getName() != null
            && dvi.getDrbdResourceInfo() != null) {
            final Vertex source = edge.getSource();
            final Vertex dest = edge.getDest();
            final BlockDevInfo sourceBDI = (BlockDevInfo) getInfo(source);
            if (sourceBDI == null) {
                return "";
            }
            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();
View Full Code Here

    /** Small text that appears above the icon. */
    @Override
    protected String getIconText(final Vertex v, final Application.RunMode runMode) {
        if (isVertexBlockDevice(v)) {
            final BlockDevInfo bdi = (BlockDevInfo) getInfo(v);
            if (bdi != null) {
                return bdi.getIconTextForGraph(runMode);
            }
        } else {
            final HostDrbdInfo hi = vertexToHostMap.get(v);
            if (hi != null) {
                return hi.getIconTextForDrbdGraph(runMode);
View Full Code Here

    /** Small text that appears in the right corner. */
    @Override
    protected ColorText getRightCornerText(final Vertex v, final Application.RunMode runMode) {
        if (isVertexBlockDevice(v)) {
            final BlockDevInfo bdi = (BlockDevInfo) getInfo(v);
            if (bdi != null) {
                return bdi.getRightCornerTextForDrbdGraph(runMode);

            }
        } else {
            final HostDrbdInfo hi = vertexToHostMap.get(v);
            if (hi != null) {
View Full Code Here

    /** Small text that appears down. */
    @Override
    protected ColorText[] getSubtexts(final Vertex v, final Application.RunMode runMode) {
        if (isVertexBlockDevice(v)) {
            final BlockDevInfo bdi = (BlockDevInfo) getInfo(v);
            if (bdi != null && bdi.getBlockDevice().isDrbd()
                && bdi.getBlockDevice().getConnectionState() != null
                && bdi.getBlockDevice().getDiskState() != null) {
                final String connState = bdi.getBlockDevice().getConnectionState();
                final String diskState = bdi.getBlockDevice().getDiskState();
                String diskStateOther = null;
                final BlockDevInfo oBdi = bdi.getOtherBlockDevInfo();
                if (oBdi != null
                    && !diskState.equals(oBdi.getBlockDevice().getDiskStateOther())) {
                    diskStateOther = oBdi.getBlockDevice().getDiskStateOther();
                }

                Color color = null;
                Color textColor = Color.BLACK;
                final String proxyState = bdi.getProxyStateForGraph(runMode);
View Full Code Here

TOP

Related Classes of lcmc.drbd.ui.resource.BlockDevInfo

Copyright © 2018 www.massapicom. 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.