Search in sources :

Example 1 with LinuxVersion

use of com.iwave.ext.linux.model.LinuxVersion in project coprhd-controller by CoprHD.

the class LinuxHostDiscoveryAdapter method discoverHost.

@Override
protected void discoverHost(Host host, HostStateChange changes) {
    validateHost(host);
    List<LinuxVersion> versions = getVersions(host);
    LinuxVersion version = findVersion(versions);
    host.setOsVersion(version.toString());
    if (getVersionValidator().isValidLinuxVersion(version)) {
        host.setCompatibilityStatus(CompatibilityStatus.COMPATIBLE.name());
        save(host);
        super.discoverHost(host, changes);
        try {
            checkMultipathSoftwareCompatibility(host);
        } catch (CompatibilityException e) {
            host.setCompatibilityStatus(CompatibilityStatus.INCOMPATIBLE.name());
            save(host);
        }
    } else {
        host.setCompatibilityStatus(CompatibilityStatus.INCOMPATIBLE.name());
        save(host);
        throw ComputeSystemControllerException.exceptions.incompatibleLinuxHostVersion(getSupportedType(), version.toString(), getVersionValidator().getSuSELinuxMinimumVersion(false).toString(), getVersionValidator().getRedhatLinuxMinimumVersion(false).toString());
    }
}
Also used : CompatibilityException(com.emc.storageos.computesystemcontroller.exceptions.CompatibilityException) LinuxVersion(com.iwave.ext.linux.model.LinuxVersion)

Example 2 with LinuxVersion

use of com.iwave.ext.linux.model.LinuxVersion in project coprhd-controller by CoprHD.

the class LinuxHostDiscoveryAdapter method getVersions.

protected List<LinuxVersion> getVersions(Host host) {
    LinuxSystemCLI cli = createLinuxCLI(host);
    List<LinuxVersion> versions = new ArrayList<LinuxVersion>();
    LinuxVersionCommand[] commands = { new GetSuSEVersionCommand(), new GetRedhatVersionCommandOne(), new GetRedhatVersionCommandTwo(), new GetRedhatVersionCommandThree(), new GetLinuxVersionLSBReleaseCommand() };
    for (LinuxVersionCommand command : commands) {
        try {
            cli.executeCommand(command);
            LinuxVersion version = command.getResults();
            if (version != null) {
                versions.add(version);
            }
        } catch (CommandException e) {
            warn("Could not retrieve linux version", e);
        }
    }
    if (versions.isEmpty()) {
        error("Could not determine version of linux host %s", host.getLabel());
        versions.add(new LinuxVersion(LinuxDistribution.UNKNOWN, ""));
    }
    return versions;
}
Also used : GetSuSEVersionCommand(com.iwave.ext.linux.command.version.GetSuSEVersionCommand) GetRedhatVersionCommandOne(com.iwave.ext.linux.command.version.GetRedhatVersionCommandOne) LinuxSystemCLI(com.iwave.ext.linux.LinuxSystemCLI) LinuxVersionCommand(com.iwave.ext.linux.command.version.LinuxVersionCommand) ArrayList(java.util.ArrayList) GetRedhatVersionCommandThree(com.iwave.ext.linux.command.version.GetRedhatVersionCommandThree) GetRedhatVersionCommandTwo(com.iwave.ext.linux.command.version.GetRedhatVersionCommandTwo) CommandException(com.iwave.ext.command.CommandException) LinuxVersion(com.iwave.ext.linux.model.LinuxVersion) GetLinuxVersionLSBReleaseCommand(com.iwave.ext.linux.command.version.GetLinuxVersionLSBReleaseCommand)

Example 3 with LinuxVersion

use of com.iwave.ext.linux.model.LinuxVersion in project coprhd-controller by CoprHD.

the class GetLinuxVersionLSBReleaseCommand method parseOutput.

@Override
public void parseOutput() {
    String stdOut = getOutput().getStdout();
    String[] lines = stdOut.split("\n");
    LinuxVersion.LinuxDistribution distribution = LinuxVersion.LinuxDistribution.UNKNOWN;
    String release = "";
    for (String line : lines) {
        String[] lineElements = line.split("\t");
        String key = lineElements[0];
        String value = lineElements[1];
        if (key.equalsIgnoreCase(DISTRIBUTOR_ID)) {
            if (RHEL.equals(value)) {
                distribution = LinuxVersion.LinuxDistribution.REDHAT;
            } else if (SUSE.equals(value)) {
                distribution = LinuxVersion.LinuxDistribution.SUSE;
            }
        } else if (key.equalsIgnoreCase(RELEASE)) {
            release = value;
        }
    }
    results = new LinuxVersion(distribution, release);
}
Also used : LinuxVersion(com.iwave.ext.linux.model.LinuxVersion)

Example 4 with LinuxVersion

use of com.iwave.ext.linux.model.LinuxVersion in project coprhd-controller by CoprHD.

the class GetRedhatVersionCommandOne method parseOutput.

@Override
public void parseOutput() {
    String stdOut = getOutput().getStdout();
    results = new LinuxVersion(LinuxVersion.LinuxDistribution.REDHAT, stdOut);
}
Also used : LinuxVersion(com.iwave.ext.linux.model.LinuxVersion)

Example 5 with LinuxVersion

use of com.iwave.ext.linux.model.LinuxVersion in project coprhd-controller by CoprHD.

the class GetRedhatVersionCommandThree method parseOutput.

@Override
public void parseOutput() {
    String stdOut = getOutput().getStdout();
    results = new LinuxVersion(LinuxVersion.LinuxDistribution.REDHAT, stdOut);
}
Also used : LinuxVersion(com.iwave.ext.linux.model.LinuxVersion)

Aggregations

LinuxVersion (com.iwave.ext.linux.model.LinuxVersion)7 CompatibilityException (com.emc.storageos.computesystemcontroller.exceptions.CompatibilityException)1 CommandException (com.iwave.ext.command.CommandException)1 LinuxSystemCLI (com.iwave.ext.linux.LinuxSystemCLI)1 GetLinuxVersionLSBReleaseCommand (com.iwave.ext.linux.command.version.GetLinuxVersionLSBReleaseCommand)1 GetRedhatVersionCommandOne (com.iwave.ext.linux.command.version.GetRedhatVersionCommandOne)1 GetRedhatVersionCommandThree (com.iwave.ext.linux.command.version.GetRedhatVersionCommandThree)1 GetRedhatVersionCommandTwo (com.iwave.ext.linux.command.version.GetRedhatVersionCommandTwo)1 GetSuSEVersionCommand (com.iwave.ext.linux.command.version.GetSuSEVersionCommand)1 LinuxVersionCommand (com.iwave.ext.linux.command.version.LinuxVersionCommand)1 ArrayList (java.util.ArrayList)1