use of com.emc.storageos.computesystemcontroller.exceptions.CompatibilityException 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.emc.storageos.computesystemcontroller.exceptions.CompatibilityException in project coprhd-controller by CoprHD.
the class LinuxHostDiscoveryAdapter method checkMultipathSoftwareCompatibility.
private void checkMultipathSoftwareCompatibility(Host host) {
LinuxSystemCLI cli = createLinuxCLI(host);
String powerpathMessage = null;
String multipathMessage = null;
try {
PowermtCheckRegistrationCommand command = new PowermtCheckRegistrationCommand();
cli.executeCommand(command, SecureShellSupport.SHORT_TIMEOUT);
// powerpath is installed
LOG.info("PowerPath is installed");
return;
} catch (PowerPathException e) {
powerpathMessage = e.getMessage();
LOG.info("PowerPath is unavailable: " + powerpathMessage);
} catch (Exception e) {
LOG.info("Error while checking for powerpath: " + e.getMessage(), e);
}
try {
MultipathCommand command = new MultipathCommand();
command.addArgument("-l");
cli.executeCommand(command, SecureShellSupport.SHORT_TIMEOUT);
// multipath is installed
LOG.info("Multipath is installed");
return;
} catch (MultipathException e) {
multipathMessage = e.getMessage();
LOG.info("Multipath is unavailable: " + multipathMessage);
} catch (Exception e) {
LOG.info("Error while checking for multipath: " + e.getMessage(), e);
}
throw new CompatibilityException("No multipath software available: \n" + powerpathMessage + "\n" + multipathMessage);
}
use of com.emc.storageos.computesystemcontroller.exceptions.CompatibilityException in project coprhd-controller by CoprHD.
the class ComputeSystemDiscoveryEngine method discoverInLock.
/**
* Performs the discovery, within a lock.
*
* @param targetId
* the ID of the target to discover.
*/
protected void discoverInLock(String targetId) {
DiscoveredSystemObject target = modelClient.findById(URI.create(targetId));
if (target == null) {
LOG.error("Could not find: " + targetId);
throw ComputeSystemControllerException.exceptions.targetNotFound(targetId);
}
ComputeSystemDiscoveryAdapter adapter = getDiscoveryAdapter(targetId);
if (adapter != null) {
if (LOG.isInfoEnabled()) {
LOG.info("Discovering target " + target.getLabel() + " [" + targetId + "]");
}
try {
adapter.discoverTarget(targetId);
if (LOG.isInfoEnabled()) {
LOG.info("Discovery completed for " + target.getLabel() + " [" + targetId + "]");
}
} catch (CompatibilityException e) {
String errorMessage = adapter.getErrorMessage(e);
LOG.error("Device is incompatible: " + target.getLabel() + " [" + targetId + "]: " + errorMessage);
adapter.discoveryFailure(target, DiscoveredDataObject.CompatibilityStatus.INCOMPATIBLE.name(), errorMessage);
throw e;
} catch (RuntimeException e) {
String errorMessage = adapter.getErrorMessage(e);
LOG.error("Discovery failed for " + target.getLabel() + " [" + targetId + "]: " + errorMessage, e);
adapter.discoveryFailure(target, DiscoveredDataObject.CompatibilityStatus.UNKNOWN.name(), errorMessage);
throw ComputeSystemControllerException.exceptions.discoverFailed(targetId, e);
}
} else {
LOG.warn("No discovery adapter for target " + target.getLabel() + " [" + targetId + "]");
target.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.UNKNOWN.name());
dbClient.persistObject(target);
throw ComputeSystemControllerException.exceptions.discoveryAdapterNotFound(target.getLabel(), targetId);
}
}
Aggregations