use of com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException in project coprhd-controller by CoprHD.
the class LinuxMountUtils method unmountPath.
public void unmountPath(String path) throws InternalException {
UnmountCommand command = new UnmountCommand(STD_TIMEOUT);
command.setPath(path);
command.addArgument("; if [ $? -eq 124 ] ; then >&2 echo TIMEOUT ; else >&2 echo SUCCESSFUL ; fi");
_log.info("unmount command:" + command.getResolvedCommandLine());
cli.executeCommand(command);
CommandOutput output = command.getOutput();
if (output.getStderr().contains("TIMEOUT")) {
ComputeSystemControllerException exception = ComputeSystemControllerException.exceptions.commandTimedOut(host.getHostName());
throw exception;
} else {
String errMessage = output.getStderr().replace("SUCCESSFUL", "").replace("\n", "");
if (!errMessage.isEmpty()) {
ComputeSystemControllerException exception = ComputeSystemControllerException.exceptions.unableToUnmount(host.getHostName(), new Exception(errMessage));
throw exception;
}
}
}
use of com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException in project coprhd-controller by CoprHD.
the class EsxHostDiscoveryAdapter method checkDuplicateHost.
/**
* Check if the host already exists in VIPR
*
* @param host - {@link Host} instance being discovered / added.
* @param targetHost {@link Host} instance from VIPR DB.
*/
private void checkDuplicateHost(Host host, Host targetHost) {
if (targetHost != null && !(host.getId().equals(targetHost.getId()))) {
ComputeSystemControllerException ex = ComputeSystemControllerException.exceptions.duplicateSystem("Host", targetHost.getLabel());
DiscoveryStatusUtils.markAsFailed(modelClient, host, ex.getMessage(), ex);
throw ex;
}
}
use of com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException in project coprhd-controller by CoprHD.
the class UcsDiscoveryWorker method discoverComputeSystem.
public void discoverComputeSystem(URI computeSystemURI) {
String ucsmVersion;
ComputeSystem cs = _dbClient.queryObject(ComputeSystem.class, computeSystemURI);
_log.info("Inside discoverComputeSystems of class : " + getClass().toString());
URL ucsmURL = getUcsmURL(cs);
List<ComputeBlade> computeBlades;
List<LsServer> allServiceProfiles;
Map<String, LsServer> associatedLsServers;
List<LsServer> serviceProfileTemplates;
List<VnicLanConnTempl> vnicTemplates;
List<VnicSanConnTempl> vhbaTemplates;
Map<String, FcPIo> uplinkMap;
Map<String, SwFcSanEp> fcInterfaceMap;
List<SwVsan> vsanList;
Map<String, SwFcSanPc> portChannelMap;
List<FabricVlan> vlanList;
List<FabricVsan> vsanFabricList;
List<com.emc.cloud.platform.ucs.out.model.LsbootPolicy> bootPolicies;
try {
ucsmVersion = ucsmService.getDeviceVersion(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
verifyVersion(cs, ucsmVersion);
computeBlades = ucsmService.getComputeBlades(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
allServiceProfiles = ucsmService.getAllServiceProfiles(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
associatedLsServers = ucsmService.getAllAssociatedLsServers(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
serviceProfileTemplates = ucsmService.getServiceProfileTemplates(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
bootPolicies = ucsmService.getBootPolicies(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
vnicTemplates = ucsmService.getVnicTemplates(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
vhbaTemplates = ucsmService.getVhbaTemplates(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
uplinkMap = ucsmService.getFICUplinkPorts(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
fcInterfaceMap = ucsmService.getSwitchFCInterfaces(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
vsanList = ucsmService.getUcsSwitchVSans(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
portChannelMap = ucsmService.getUplinkPortChannels(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
vlanList = ucsmService.getUcsVlans(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
vsanFabricList = ucsmService.getUcsFabricVsans(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
} catch (Exception e) {
_log.error("Failed to pull device data: " + cs.getId(), e);
if (e.getCause() != null && e.getCause().getMessage() != null) {
cs.setLastDiscoveryStatusMessage(e.getCause().getMessage());
} else {
cs.setLastDiscoveryStatusMessage(e.getMessage());
}
_dbClient.updateObject(cs);
throw ComputeSystemControllerException.exceptions.discoverFailed(computeSystemURI.toString(), e);
}
try {
reconcileServiceProfileTemplates(cs, serviceProfileTemplates);
reconcileServiceProfiles(cs, allServiceProfiles);
reconcileComputeBlades(cs, computeBlades, associatedLsServers);
reconcileVhbas(cs, associatedLsServers, new VhbaHelper(vsanFabricList));
reconcileServiceProfileTemplatesHBAs(cs, serviceProfileTemplates, new VhbaHelper(vsanFabricList));
reconcileServiceProfileTemplatesVnics(cs, serviceProfileTemplates);
reconcileServiceProfileTemplatesBootDefinitions(cs, serviceProfileTemplates);
reconcileBootPolicies(cs, bootPolicies);
reconcileVnicTemplates(cs, vnicTemplates);
reconcileVhbaTemplates(cs, vhbaTemplates);
Map<String, Set<String>> unpinnedVsans = getUnpinnedVSans(vsanList, fcInterfaceMap);
reconcileUplinkPorts(cs, uplinkMap, fcInterfaceMap, unpinnedVsans);
reconcileUplinkPortChannels(cs, portChannelMap, unpinnedVsans);
reconcileVlans(cs, vlanList);
associateComputeImageServer(cs);
matchComputeBladesToHosts(cs);
cs.setLastDiscoveryRunTime(Calendar.getInstance().getTimeInMillis());
cs.setSuccessDiscoveryTime(Calendar.getInstance().getTimeInMillis());
cs.setDiscoveryStatus(DiscoveredDataObject.DataCollectionJobStatus.COMPLETE.name());
} catch (ComputeSystemControllerException e) {
cs.setLastDiscoveryStatusMessage(e.getMessage());
throw ComputeSystemControllerException.exceptions.discoverFailed(cs.getId().toString(), e);
} finally {
_dbClient.persistObject(cs);
}
}
use of com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException in project coprhd-controller by CoprHD.
the class LinuxMountUtils method mountPath.
public void mountPath(String path) throws InternalException {
MountCommand command = new MountCommand(STD_TIMEOUT);
command.setPath(path);
command.addArgument("; if [ $? -eq 124 ] ; then >&2 echo TIMEOUT ; else >&2 echo SUCCESSFUL ; fi");
_log.info("mount command:" + command.getResolvedCommandLine());
cli.executeCommand(command);
CommandOutput output = command.getOutput();
if (output.getStderr().contains("TIMEOUT")) {
ComputeSystemControllerException exception = ComputeSystemControllerException.exceptions.commandTimedOut(host.getHostName());
throw exception;
} else {
String errMessage = output.getStderr().replace("SUCCESSFUL", "").replace("\n", "");
if (!errMessage.isEmpty()) {
ComputeSystemControllerException exception = ComputeSystemControllerException.exceptions.unableToMount(host.getHostName(), new Exception(errMessage));
throw exception;
}
}
}
use of com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException in project coprhd-controller by CoprHD.
the class AbstractHostDiscoveryAdapter method checkDuplicateHost.
protected void checkDuplicateHost(Host host, String nativeGuid) {
if (nativeGuid != null && !nativeGuid.isEmpty()) {
for (Host existingHost : modelClient.hosts().findByNativeGuid(nativeGuid, true)) {
if (!existingHost.getId().equals(host.getId())) {
ComputeSystemControllerException ex = ComputeSystemControllerException.exceptions.duplicateSystem("Host", existingHost.getLabel());
DiscoveryStatusUtils.markAsFailed(modelClient, host, ex.getMessage(), ex);
throw ex;
}
}
}
}
Aggregations