Examples of HostLocation


Examples of lcmc.crm.domain.HostLocation

    void migrateFromResource(final Host dcHost, final String fromHost, final Application.RunMode runMode) {
        String role = null;
        if (getService().isMaster()) {
            role = "Master";
        }
        final HostLocation hostLoc = new HostLocation(CrmXml.MINUS_INFINITY_VALUE.getValueForConfig(),
                                                      "eq",
                                                      null,
                                                      role);
        final String action;
        if (getMigratedFrom(runMode) == null) {
View Full Code Here

Examples of lcmc.crm.domain.HostLocation

        }

        /* set scores */
        for (final Host host : getBrowser().getClusterHosts()) {
            final HostInfo hi = host.getBrowser().getHostInfo();
            final HostLocation hostLocation = cs.getScore(getService().getCrmId(),
                                                          hi.getName(),
                                                          Application.RunMode.LIVE);
            final HostLocation savedLocation = savedHostLocations.get(hi);
            if (Tools.areEqual(hostLocation, savedLocation)) {
                if (hostLocation == null) {
                    savedHostLocations.remove(hi);
                } else {
                    savedHostLocations.put(hi, hostLocation);
                }
                if (infoPanelOk) {
                    final Widget wi = scoreComboBoxHash.get(hi);
                    if (wi != null) {
                        String score = null;
                        String op = null;
                        if (hostLocation != null) {
                            score = hostLocation.getScore();
                            op = hostLocation.getOperation();
                        }
                        wi.setValue(new StringValue(score));
                        final JLabel label = wi.getLabel();
                        final String text = getHostLocationLabel(hi.getName(), op);
                        label.setText(text);
                    }
                }
            }
        }

        /* set ping constraint */
        final HostLocation hostLocation = cs.getPingScore(getService().getCrmId(), Application.RunMode.LIVE);
        Value pingOperation = null;
        if (hostLocation != null) {
            final String op = hostLocation.getOperation();
            final String value = hostLocation.getValue();
            if ("eq".equals(op) && "0".equals(value)) {
                pingOperation = new StringValue("eq0");
            } else {
                pingOperation = new StringValue(hostLocation.getOperation());
            }
        }
        if (!Tools.areEqual(pingOperation, savedPingOperation)) {
            savedPingOperation = pingOperation;
        }
View Full Code Here

Examples of lcmc.crm.domain.HostLocation

                    && !locationId.startsWith("cli-standby-")
                    && !locationId.startsWith("cli-ban-"))) {
                continue;
            }
            final HostInfo hi = host.getBrowser().getHostInfo();
            final HostLocation hostLocation = cs.getScore(getHeartbeatId(runMode), hi.getName(), runMode);
            String score = null;
            String op = null;
            if (hostLocation != null) {
                score = hostLocation.getScore();
                op = hostLocation.getOperation();
            }
            if ((CrmXml.INFINITY_VALUE.getValueForConfig().equals(score)
                 || CrmXml.PLUS_INFINITY_VALUE.getValueForConfig().equals(score))
                && "eq".equals(op)) {
                final List<Host> hosts = new ArrayList<Host>();
View Full Code Here

Examples of lcmc.crm.domain.HostLocation

            final String locationId = cs.getLocationId(getHeartbeatId(runMode), host.getName(), runMode);
            if (locationId == null || !locationId.contains("fence")) {
                continue;
            }
            final HostInfo hi = host.getBrowser().getHostInfo();
            final HostLocation hostLocation = cs.getScore(getHeartbeatId(runMode), hi.getName(), runMode);
            String score = null;
            if (hostLocation != null) {
                score = hostLocation.getScore();
            }
            if (CrmXml.MINUS_INFINITY_VALUE.getValueForConfig().equals(score)) {
                final List<Host> hosts = new ArrayList<Host>();
                hosts.add(host);
                return hosts;
View Full Code Here

Examples of lcmc.crm.domain.HostLocation

                    && !locationId.startsWith("cli-standby-")
                    && !locationId.startsWith("cli-ban-"))) {
                continue;
            }
            final HostInfo hi = host.getBrowser().getHostInfo();
            final HostLocation hostLocation = cs.getScore(getHeartbeatId(runMode), hi.getName(), runMode);
            String score = null;
            String op = null;
            if (hostLocation != null) {
                score = hostLocation.getScore();
                op = hostLocation.getOperation();
            }
            if (CrmXml.MINUS_INFINITY_VALUE.getValueForConfig().equals(score) && "eq".equals(op)) {
                final List<Host> hosts = new ArrayList<Host>();
                hosts.add(host);
                return hosts;
View Full Code Here

Examples of lcmc.crm.domain.HostLocation

            final Value score = wi.getValue();
            final String op = getOpFromLabel(hi.getName(), wi.getLabel().getText());
            if (score == null || score.isNothingSelected()) {
                savedHostLocations.remove(hi);
            } else {
                savedHostLocations.put(hi, new HostLocation(score.getValueForConfig(), op, null, null));
            }
        }
        /* ping */
        savedPingOperation = pingComboBox.getValue();
    }
View Full Code Here

Examples of lcmc.crm.domain.HostLocation

        final List<String> incorrect = new ArrayList<String>();
        boolean hostLocationFound = false;
        for (final Host host : getBrowser().getClusterHosts()) {
            final HostInfo hi = host.getBrowser().getHostInfo();
            final Widget wi = scoreComboBoxHash.get(hi);
            final HostLocation hlSaved = savedHostLocations.get(hi);
            final Value hsSaved;
            String opSaved = null;
            if (hlSaved == null) {
                hsSaved = NOTHING_SELECTED_VALUE;
            } else {
                hsSaved = new StringValue(hlSaved.getScore());
                opSaved = hlSaved.getOperation();
            }
            final String opSavedLabel = getHostLocationLabel(host.getName(), opSaved);
            if (wi == null) {
                continue;
            }
View Full Code Here

Examples of lcmc.crm.domain.HostLocation

            scoreComboBoxHash.put(hi, wi);

            /* set selected host scores in the combo box from
             * savedHostLocations */
            if (prevWi == null) {
                final HostLocation hl = savedHostLocations.get(hi);
                String hsSaved = null;
                if (hl != null) {
                    hsSaved = hl.getScore();
                }
                wi.setValue(new StringValue(hsSaved));
            } else {
                wi.setValue(prevWi.getValue());
            }
        }

        /* host score combo boxes */
        int rows = 0;
        for (final Host host : getBrowser().getClusterHosts()) {
            final HostInfo hi = host.getBrowser().getHostInfo();
            final Widget wi = scoreComboBoxHash.get(hi);
            String op = null;
            final HostLocation hl = savedHostLocations.get(hi);
            if (hl != null) {
                op = hl.getOperation();
            }
            final String text = getHostLocationLabel(hi.getName(), op);
            final JLabel label = new JLabel(text);
            final String onText = getHostLocationLabel(hi.getName(), "eq");
            final String notOnText = getHostLocationLabel(hi.getName(), "ne");
View Full Code Here

Examples of lcmc.crm.domain.HostLocation

            if ("ALWAYS".equals(hs)) {
                hs = CrmXml.INFINITY_VALUE.getValueForConfig();
            } else if ("NEVER".equals(hs)) {
                hs = CrmXml.MINUS_INFINITY_VALUE.getValueForConfig();
            }
            final HostLocation hlSaved = savedHostLocations.get(hi);
            String opSaved = null;
            if (hlSaved != null) {
                opSaved = hlSaved.getOperation();
            }
            final String onHost = hi.getName();
            final String op = getOpFromLabel(onHost, wi.getLabel().getText());
            final HostLocation hostLoc = new HostLocation(hs, op, null, null);
            if (!hostLoc.equals(hlSaved)) {
                String locationId = cs.getLocationId(getHeartbeatId(runMode), onHost, runMode);
                if ((hs == null || hs.isEmpty() || !Tools.areEqual(op, opSaved))
                    && locationId != null) {
                    CRM.removeLocation(dcHost, locationId, getHeartbeatId(runMode), runMode);
                    locationId = null;
View Full Code Here

Examples of lcmc.crm.domain.HostLocation

    /** Revert locations to saved values. */
    protected final void revertLocations() {
        for (final Host host : getBrowser().getClusterHosts()) {
            final HostInfo hi = host.getBrowser().getHostInfo();
            final HostLocation savedLocation = savedHostLocations.get(hi);
            final Widget wi = scoreComboBoxHash.get(hi);
            if (wi == null) {
                continue;
            }

            String score = null;
            String op = null;
            if (savedLocation != null) {
                score = savedLocation.getScore();
                op = savedLocation.getOperation();
            }
            wi.setValue(new StringValue(score));
            final JLabel label = wi.getLabel();
            final String text = getHostLocationLabel(hi.getName(), op);
            label.setText(text);
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.