Package lcmc.crm.domain

Examples of lcmc.crm.domain.ClusterStatus


        boolean createOrd = false;
        for (final ServiceInfo serviceInfo : servicesAll) {
            final boolean isFrom = servicesFrom.contains(serviceInfo);
            final String idToAdd = serviceInfo.getService().getCrmId();
            if (colocation) {
                final ClusterStatus clStatus = getBrowser().getClusterStatus();
                /* colocation */
                if (colId == null) {
                    final List<String> rscIds = new ArrayList<String>();
                    rscIds.add(idToAdd);
                    int colIdInt = Integer.parseInt(getService().getId());
                    colId = "c" + colIdInt;
                    while (clStatus.getRscSetsCol(colId) != null) {
                        colIdInt++;
                        colId = "c" + colIdInt;
                    }
                    createCol = true;
                    if (isFrom) {
                        /* require all for col is noop in pcmk 1.1.7 */
                        colRscSet2 = new CrmXml.RscSet(colId,
                                                       new ArrayList<String>(),
                                                       "false",
                                                       requireAll,
                                                       null,
                                                       null);
                        colRscSet1 = new CrmXml.RscSet(colId,
                                                       rscIds,
                                                       "false",
                                                       CrmXml.REQUIRE_ALL_TRUE_VALUE.getValueForConfig(),
                                                       null,
                                                       null);
                        outColRscSet1 = colRscSet1;
                    } else {
                        colRscSet2 = new CrmXml.RscSet(colId,
                                                       rscIds,
                                                       "false",
                                                       CrmXml.REQUIRE_ALL_TRUE_VALUE.getValueForConfig(),
                                                       null,
                                                       null);
                        colRscSet1 = new CrmXml.RscSet(colId,
                                                       new ArrayList<String>(),
                                                       "false",
                                                       requireAll,
                                                       null,
                                                       null);
                        outColRscSet2 = colRscSet2;
                    }
                } else {
                    final CrmXml.RscSet toRscSet;
                    if (isFrom) {
                        if (outColRscSet1 == null) {
                            toRscSet = colRscSet1;
                        } else {
                            toRscSet = outColRscSet1;
                        }
                    } else {
                        if (outColRscSet2 == null) {
                            toRscSet = colRscSet2;
                        } else {
                            toRscSet = outColRscSet2;
                        }
                    }
                    final List<CrmXml.RscSet> rscSetsColList = clStatus.getRscSetsCol(colId);
                    boolean colRscSetAdded = false;
                    if (rscSetsColList != null) {
                        for (final CrmXml.RscSet rscSet : rscSetsColList) {
                            if (rscSet.equals(toRscSet)) {
                                final List<String> newRscIds = new ArrayList<String>();
                                newRscIds.addAll(rscSet.getRscIds());

                                newRscIds.add(0, idToAdd);
                                final CrmXml.RscSet newRscSet = new CrmXml.RscSet(rscSet.getId(),
                                                                                  newRscIds,
                                                                                  rscSet.getSequential(),
                                                                                  rscSet.getRequireAll(),
                                                                                  rscSet.getOrderAction(),
                                                                                  rscSet.getColocationRole());
                                if (isFrom) {
                                    outColRscSet1 = newRscSet;
                                } else {
                                    outColRscSet2 = newRscSet;
                                }
                                colRscSetAdded = true;
                            } else {
                                if (isFrom) {
                                    outColRscSet2 = rscSet;
                                } else {
                                    outColRscSet1 = rscSet;
                                }
                            }
                        }
                    }
                    if (!colRscSetAdded) {
                        final List<String> newRscIds = new ArrayList<String>();
                        final CrmXml.RscSet newRscSet;
                        if (toRscSet == null) {
                            newRscSet = new CrmXml.RscSet(colId, newRscIds, "false", requireAll, null, null);
                        } else {
                            newRscIds.addAll(toRscSet.getRscIds());
                            newRscSet = new CrmXml.RscSet(toRscSet.getId(),
                                                          newRscIds,
                                                          toRscSet.getSequential(),
                                                          toRscSet.getRequireAll(),
                                                          toRscSet.getOrderAction(),
                                                          toRscSet.getColocationRole());
                        }
                        newRscSet.addRscId(idToAdd);
                        if (isFrom) {
                            outColRscSet1 = newRscSet;
                        } else {
                            outColRscSet2 = newRscSet;
                        }
                    }
                }
            }

            if (order) {
                /* order */
                final ClusterStatus clStatus = getBrowser().getClusterStatus();
                if (ordId == null) {
                    final List<String> rscIds = new ArrayList<String>();
                    rscIds.add(idToAdd);
                    int ordIdInt = Integer.parseInt(getService().getId());
                    ordId = "o" + ordIdInt;
                    while (clStatus.getRscSetsOrd(ordId) != null) {
                        ordIdInt++;
                        ordId = "o" + ordIdInt;
                    }
                    createOrd = true;
                    if (isFrom) {
                        ordRscSet1 = new CrmXml.RscSet(ordId,
                                                       rscIds,
                                                       "false",
                                                       CrmXml.REQUIRE_ALL_TRUE_VALUE.getValueForConfig(),
                                                       null,
                                                       null);
                        ordRscSet2 = new CrmXml.RscSet(ordId,
                                                       new ArrayList<String>(),
                                                       "false",
                                                       requireAll,
                                                       null,
                                                       null);
                        outOrdRscSet1 = ordRscSet1;
                    } else {
                        ordRscSet1 = new CrmXml.RscSet(ordId,
                                                       new ArrayList<String>(),
                                                       "false",
                                                       requireAll,
                                                       null,
                                                       null);
                        ordRscSet2 = new CrmXml.RscSet(ordId,
                                                       rscIds,
                                                       "false",
                                                       CrmXml.REQUIRE_ALL_TRUE_VALUE.getValueForConfig(),
                                                       null,
                                                       null);
                        outOrdRscSet2 = ordRscSet2;
                    }
                } else {
                    final CrmXml.RscSet toRscSet;
                    if (isFrom) {
                        if (outOrdRscSet1 == null) {
                            toRscSet = ordRscSet1;
                        } else {
                            toRscSet = outOrdRscSet1;
                        }
                    } else {
                        if (outOrdRscSet2 == null) {
                            toRscSet = ordRscSet2;
                        } else {
                            toRscSet = outOrdRscSet2;
                        }
                    }
                    final List<CrmXml.RscSet> rscSetsOrdList = clStatus.getRscSetsOrd(ordId);
                    boolean ordRscSetAdded = false;
                    if (rscSetsOrdList != null) {
                        for (final CrmXml.RscSet rscSet : rscSetsOrdList) {
                            if (rscSet.equals(toRscSet)) {
                                final List<String> newRscIds = new ArrayList<String>();
View Full Code Here


                final CountDownLatch startTestLatch = new CountDownLatch(1);
                crmg.startTestAnimation((JComponent) component, startTestLatch);
                final Host dcHost = getBrowser().getClusterBrowser().getDCHost();
                getBrowser().getClusterBrowser().ptestLockAcquire();
                try {
                    final ClusterStatus clStatus = getBrowser().getClusterBrowser().getClusterStatus();
                    clStatus.setPtestResult(null);
                    CRM.crmConfigureCommit(host, ta.getText(), Application.RunMode.TEST);
                    final PtestData ptestData = new PtestData(CRM.getPtest(dcHost));
                    component.setToolTipText(ptestData.getToolTip());
                    clStatus.setPtestResult(ptestData);
                } finally {
                    getBrowser().getClusterBrowser().ptestLockRelease();
                }
                startTestLatch.countDown();
            }
View Full Code Here

        } else if (getHost().isCommLayerStarting()) {
            return STARTING_COLOR_TEXT;
        } else if (getHost().isPacemakerStarting()) {
            return STARTING_COLOR_TEXT;
        }
        final ClusterStatus cs = getClusterStatus();
        if (cs != null && cs.isFencedNode(host.getName())) {
            return FENCED_COLOR_TEXT;
        } else if (getHost().isCrmStatusOk()) {
            if (isStandby(runMode)) {
                return STANDBY_COLOR_TEXT;
            } else {
                return ONLINE_COLOR_TEXT;
            }
        } else if (getHost().isConnected()) {
            final Boolean running = getHost().getCorosyncOrHeartbeatRunning();
            if (running == null) {
                return UNKNOWN_COLOR_TEXT;
            } else if (!running) {
                return CORO_STOPPED_COLOR_TEXT;
            }
            if (cs != null && cs.isPendingNode(host.getName())) {
                return PENDING_COLOR_TEXT;
            } else if (!getHost().isPacemakerRunning()) {
                return PCMK_STOPPED_COLOR_TEXT;
            } else if (cs != null && "no".equals(cs.isOnlineNode(host.getName()))) {
                return OFFLINE_COLOR_TEXT;
            } else {
                return UNKNOWN_COLOR_TEXT;
            }
        }
View Full Code Here

        final Map<String, String> operationsId = new HashMap<String, String>();
        final Map<String, String> metaAttrsRefId = new HashMap<String, String>();
        final Map<String, String> operationsRefId = new HashMap<String, String>();
        final Map<String, Boolean> stonith = new HashMap<String, Boolean>();

        final ClusterStatus cs = getBrowser().getClusterStatus();
        for (final String resId : newOrder) {
            final ServiceInfo gsi = getBrowser().getServiceInfoFromCRMId(resId);
            if (gsi == null) {
                continue;
            }
            application.invokeAndWait(new Runnable() {
                @Override
                public void run() {
                    gsi.getInfoPanel();
                }
            });
        }
        application.waitForSwing();
        for (final String resId : newOrder) {
            final ServiceInfo gsi = getBrowser().getServiceInfoFromCRMId(resId);
            if (gsi == null) {
                continue;
            }
            pacemakerResAttrs.put(resId, gsi.getPacemakerResAttrs(runMode));
            pacemakerResArgs.put(resId, gsi.getPacemakerResArgs());
            pacemakerMetaArgs.put(resId, gsi.getPacemakerMetaArgs());
            instanceAttrId.put(resId, cs.getResourceInstanceAttrId(resId));
            nvpairIdsHash.put(resId, cs.getParametersNvpairsIds(resId));
            pacemakerOps.put(resId, gsi.getOperations(resId));
            operationsId.put(resId, cs.getOperationsId(resId));
            metaAttrsRefId.put(resId, gsi.getMetaAttrsRefId());
            operationsRefId.put(resId, gsi.getOperationsRefId());
            stonith.put(resId, gsi.getResourceAgent().isStonith());
        }
        final CloneInfo ci = getCloneInfo();
View Full Code Here

     * all the services are running. Null if they running on different
     * nodes or not at all.
     */
    @Override
    protected List<String> getRunningOnNodes(final Application.RunMode runMode) {
        final ClusterStatus cs = getBrowser().getClusterStatus();
        final List<String> resources = cs.getGroupResources(getHeartbeatId(runMode), runMode);
        final List<String> allNodes = new ArrayList<String>();
        if (resources != null) {
            for (final String hbId : resources) {
                final List<String> ns = cs.getRunningOnNodes(hbId, runMode);
                if (ns != null) {
                    for (final String n : ns) {
                        if (!allNodes.contains(n)) {
                            allNodes.add(n);
                        }
View Full Code Here

    }

    /** Returns node name of the host where this service is running. */
    @Override
    List<String> getMasterOnNodes(final Application.RunMode runMode) {
        final ClusterStatus cs = getBrowser().getClusterStatus();
        final List<String> resources = cs.getGroupResources(getHeartbeatId(runMode), runMode);
        final List<String> allNodes = new ArrayList<String>();
        if (resources != null) {
            for (final String hbId : resources) {
                final List<String> ns = cs.getMasterOnNodes(hbId, runMode);
                if (ns != null) {
                    for (final String n : ns) {
                        if (!allNodes.contains(n)) {
                            allNodes.add(n);
                        }
View Full Code Here

                final CountDownLatch startTestLatch = new CountDownLatch(1);
                hg.startTestAnimation((JComponent) component, startTestLatch);
                final Host dcHost = getBrowser().getDCHost();
                getBrowser().ptestLockAcquire();
                try {
                    final ClusterStatus clStatus = getBrowser().getClusterStatus();
                    clStatus.setPtestResult(null);
                    apply(dcHost, Application.RunMode.TEST);
                    final PtestData ptestData = new PtestData(CRM.getPtest(dcHost));
                    component.setToolTipText(ptestData.getToolTip());
                    clStatus.setPtestResult(ptestData);
                } finally {
                    getBrowser().ptestLockRelease();
                }
                startTestLatch.countDown();
            }
View Full Code Here

        return crmXML.getRscDefaultsMetaAttrDefault(param);
    }

    @Override
    public Value getParamSaved(final String param) {
        final ClusterStatus clStatus = getBrowser().getClusterStatus();
        Value value = super.getParamSaved(param);
        if (value == null) {
            value = new StringValue(clStatus.getRscDefaultsParameter(param, Application.RunMode.LIVE));
            if (value.isNothingSelected()) {
                value = getParamPreferred(param);
                if (value == null) {
                    return getParamDefault(param);
                }
View Full Code Here

    List<String> getSlaveOnNodes(final Application.RunMode runMode) {
        final ServiceInfo cs = containedService;
        if (cs == null) {
            return null;
        }
        final ClusterStatus clStatus = getBrowser().getClusterStatus();
        if (clStatus == null) {
            return null;
        }
        if (cs.getResourceAgent().isGroup()) {
            final List<String> resources = clStatus.getGroupResources(cs.getHeartbeatId(runMode), runMode);
            if (resources == null) {
                return null;
            }
            final Set<String> slaves = new TreeSet<String>();
            for (final String hbId : resources) {
                final List<String> slNodes = clStatus.getSlaveOnNodes(hbId, runMode);
                if (slNodes != null) {
                    slaves.addAll(slNodes);
                }
            }
            return new ArrayList<String>(slaves);
        } else {
            return clStatus.getSlaveOnNodes(cs.getHeartbeatId(runMode), runMode);
        }
    }
View Full Code Here

            notRunningOnNodes.put(h.getName().toLowerCase(Locale.US), h.getName());
        }
        texts.add(new ColorText(toString(), null, Color.BLACK));
        final ServiceInfo cs = getContainedService();
        if (cs != null && cs.getResourceAgent().isGroup()) {
            final ClusterStatus clStatus = getBrowser().getClusterStatus();
            final List<String> resources = clStatus.getGroupResources(cs.getHeartbeatId(runMode), runMode);
            if (resources != null) {
                for (final String hbId : resources) {
                    final ServiceInfo si = getBrowser().getServiceInfoFromCRMId(hbId);
                    if (si == null) {
                        texts.add(new ColorText("   unknown", null, Color.BLACK));
View Full Code Here

TOP

Related Classes of lcmc.crm.domain.ClusterStatus

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.