Package lcmc.cluster.service.ssh

Examples of lcmc.cluster.service.ssh.SshOutput


        final Map<String, String> replaceHash = new HashMap<String, String>();
        replaceHash.put(SIZE_PLACE_HOLDER, size);
        replaceHash.put(DEVICE_PLACE_HOLDER, device);
        replaceHash.put(LV_NAME_PLACE_HOLDER, snapshotName);
        final String command = host.getDistCommand("LVM.lvsnapshot", replaceHash);
        final SshOutput ret = execCommand(host, command);
        return ret.getExitCode() == 0;
    }
View Full Code Here


    }

    /** Executes the specified virsh commands on the specified host. */
    private static boolean execCommand(final Host host, final String commands) {
        if (host.isConnected()) {
            final SshOutput ret = host.captureCommandProgressIndicator(Tools.getString("VIRSH.ExecutingCommand")
                                                                       + ' '
                                                                       + commands.replaceAll(DistResource.SUDO, " ")
                                                                       + "...",
                                                                       new ExecCommandConfig().command(commands));
            if (ret.getExitCode() != 0) {
                return false;
            }
        }
        return true;
    }
View Full Code Here

            final String dir = getComboBoxValue("directory").getValueForConfig();
            boolean confirm = false; /* confirm only once */
            for (final Host host : getBrowser().getClusterHosts()) {
                final String statCmd = DistResource.SUDO + "stat -c \"%F\" " + dir + "||true";
                final String text = statCmd.replaceAll(DistResource.SUDO, "");
                final SshOutput ret = host.captureCommandProgressIndicator(text,
                                                                           new ExecCommandConfig().command(statCmd));

                if (ret == null || !"directory".equals(ret.getOutput().trim())) {
                    String title = Tools.getString("ClusterBrowser.CreateDir.Title");
                    String desc  = Tools.getString("ClusterBrowser.CreateDir.Description");
                    title = title.replaceAll("@DIR@", dir);
                    title = title.replaceAll("@HOST@", host.getName());
                    desc  = desc.replaceAll("@DIR@", dir);
                    desc  = desc.replaceAll("@HOST@", host.getName());
                    if (confirm || application.confirmDialog(title,
                                                       desc,
                                                       Tools.getString("ClusterBrowser.CreateDir.Yes"),
                                                       Tools.getString("ClusterBrowser.CreateDir.No"))) {
                        final String cmd = DistResource.SUDO + "/bin/mkdir " + dir;
                        final String progressText = cmd.replaceAll(DistResource.SUDO, "");
                        final SshOutput out = host.captureCommandProgressIndicator(progressText,
                                                                                   new ExecCommandConfig().command(cmd));
                        confirm = true;
                    }
                }
            }
View Full Code Here

        xml.append("</");
        xml.append(tag);
        xml.append(">'");

        final String command = getCibCommand(cibadminOpt, "constraints", xml.toString());
        final SshOutput ret = execCommand(host, command, runMode);
        return ret.getExitCode() == 0;
    }
View Full Code Here

            score = hostLocation.getScore();
            op = hostLocation.getOperation();
            role = hostLocation.getRole();
        }
        final String xml = getLocationXML(resId, onHost, "#uname", score, null, op, role, locationId);
        final SshOutput ret = execCommand(host, getCibCommand(command, "constraints", xml), runMode);
        return ret.getExitCode() == 0;
    }
View Full Code Here

            locationId = "loc_" + resId + "-ping-" + idPart;
            command = "-C";
        }
        final String attribute = "pingd";
        final String xml = getLocationXML(resId, value, attribute, score, scoreAttribute, op, null, locationId);
        final SshOutput ret = execCommand(host, getCibCommand(command, "constraints", xml), runMode);
        return ret.getExitCode() == 0;
    }
View Full Code Here

                                         final String locationId,
                                         final String resId,
                                         final Application.RunMode runMode) {
        final String xml = getLocationXML(resId, null, null, null, null, null, null, locationId);
        final String command = getCibCommand("-D", "constraints", xml);
        final SshOutput ret = execCommand(host, command, runMode);
        return ret.getExitCode() == 0;
    }
View Full Code Here

                xml.append("</clone>");
            }
        }
        xml.append('\'');
        final String command = getCibCommand("-D", "resources", xml.toString());
        final SshOutput ret = execCommand(host, command, runMode);
        return ret.getExitCode() == 0;
    }
View Full Code Here

            cmd = "CRM.2.1.4.startResource";
        }
        final Map<String, String> replaceHash = new HashMap<String, String>();
        replaceHash.put("@ID@", resId);
        final String command = host.getDistCommand(cmd, replaceHash);
        final SshOutput ret = execCommand(host, command, runMode);
        return ret.getExitCode() == 0;
    }
View Full Code Here

        }
        final Map<String, String> replaceHash = new HashMap<String, String>();
        replaceHash.put("@ID@", resId);

        final String command = host.getDistCommand(cmd, replaceHash);
        final SshOutput ret = execCommand(host, command, runMode);
        return ret.getExitCode() == 0;
    }
View Full Code Here

TOP

Related Classes of lcmc.cluster.service.ssh.SshOutput

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.