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());
}
}
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;
}
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);
}
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);
}
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);
}
Aggregations