use of com.emc.storageos.db.client.model.ComputeSystem in project coprhd-controller by CoprHD.
the class ComputeDeviceControllerImpl method setNoBoot.
private void setNoBoot(URI computeSystemId, URI computeElementId, URI hostId, boolean waitForServerRestart) throws InternalException {
log.info("Compute Element %s is being set to No Boot", computeElementId);
ComputeSystem cs = _dbClient.queryObject(ComputeSystem.class, computeSystemId);
getDevice(cs.getSystemType()).setNoBoot(cs, computeElementId, hostId, waitForServerRestart);
}
use of com.emc.storageos.db.client.model.ComputeSystem in project coprhd-controller by CoprHD.
the class ComputeDeviceControllerImpl method rebindHostToTemplateStep.
/**
* Bind host to a service profile template step
*
* @param computeSystemId
* {@link URI} computeSystem URI
* @param hostId
* {@link URI} host URI
* @param stepId
* {@link String} step id
*/
public void rebindHostToTemplateStep(URI computeSystemId, URI hostId, String stepId) {
log.info("rebindHostToTemplateStep");
ComputeSystem computeSystem = null;
try {
WorkflowStepCompleter.stepExecuting(stepId);
computeSystem = _dbClient.queryObject(ComputeSystem.class, hostId);
rebindHostToTemplate(computeSystemId, hostId);
// TODO COP-28961 process the return value, and mark step as failed in case of error
WorkflowStepCompleter.stepSucceded(stepId);
} catch (InternalException e) {
String opName = ResourceOperationTypeEnum.INSTALL_OPERATING_SYSTEM.getName();
ServiceCoded sce = ImageServerControllerException.exceptions.unexpectedException(opName, e);
if (computeSystem != null) {
sce = ComputeSystemControllerException.exceptions.unableToUpdateHostAfterOSInstall(hostId.toString(), e);
}
log.error("Exception rebindHostToTemplateStep: " + e.getMessage(), e);
WorkflowStepCompleter.stepFailed(stepId, sce);
} catch (Exception e) {
String opName = ResourceOperationTypeEnum.INSTALL_OPERATING_SYSTEM.getName();
ImageServerControllerException controllerException = ImageServerControllerException.exceptions.unexpectedException(opName, e);
log.error("Unexpected exception rebindHostToTemplateStep: " + e.getMessage(), e);
WorkflowStepCompleter.stepFailed(stepId, controllerException);
}
}
use of com.emc.storageos.db.client.model.ComputeSystem in project coprhd-controller by CoprHD.
the class ComputeDeviceControllerImpl method powerUpComputeElement.
private void powerUpComputeElement(URI computeSystemId, URI computeElementId) throws InternalException {
log.info("powerUpComputeElement");
ComputeSystem cs = _dbClient.queryObject(ComputeSystem.class, computeSystemId);
getDevice(cs.getSystemType()).powerUpComputeElement(computeSystemId, computeElementId);
}
use of com.emc.storageos.db.client.model.ComputeSystem in project coprhd-controller by CoprHD.
the class ComputeDeviceControllerImpl method addStepsVcenterHostCleanup.
/**
* Method to add steps to perform host cleanup operations on the vcenter
*
* @param workflow
* {@link Workflow} instance
* @param waitFor
* {@link String} If non-null, the step will not be queued for
* execution in the Dispatcher until the Step or StepGroup
* indicated by the waitFor has completed. The waitFor may either
* be a string representation of a Step UUID, or the name of a
* StepGroup.
* @param hostId
* {@link URI} hostId URI
* @return waitFor step name
*/
@Override
public String addStepsVcenterHostCleanup(Workflow workflow, String waitFor, URI hostId) throws InternalException {
Host host = _dbClient.queryObject(Host.class, hostId);
if (NullColumnValueGetter.isNullURI(host.getComputeElement())) {
/**
* No steps need to be added - as this was not a host that we
* created in ViPR. If it was computeElement property of the host
* would have been set.
*/
log.info("Skipping VCenter Host cleanup for host with no blade association. Host is " + hostId);
return waitFor;
}
ComputeElement computeElement = _dbClient.queryObject(ComputeElement.class, host.getComputeElement());
if (computeElement != null) {
ComputeSystem cs = _dbClient.queryObject(ComputeSystem.class, computeElement.getComputeSystem());
waitFor = workflow.createStep(CHECK_HOST_INITIATORS, "Check for host initiators", waitFor, cs.getId(), cs.getSystemType(), this.getClass(), new Workflow.Method("checkHostInitiators", hostId), null, null);
// any update to the host using the hostService automatically adds this association.
if (!NullColumnValueGetter.isNullURI(host.getVcenterDataCenter()) && host.getType() != null && host.getType().equalsIgnoreCase((Host.HostType.No_OS).name())) {
log.info("Skipping Vcenter host cleanup steps because No_OS is specified on host " + hostId);
} else {
waitFor = workflow.createStep(DEACTIVATION_MAINTENANCE_MODE, "If synced with vCenter, put the host in maintenance mode", waitFor, cs.getId(), cs.getSystemType(), this.getClass(), new Workflow.Method("putHostInMaintenanceMode", hostId), null, null);
waitFor = workflow.createStep(DEACTIVATION_REMOVE_HOST_VCENTER, "If synced with vCenter, remove the host from the cluster", waitFor, cs.getId(), cs.getSystemType(), this.getClass(), new Workflow.Method("removeHostFromVcenterCluster", hostId), null, null);
}
}
return waitFor;
}
use of com.emc.storageos.db.client.model.ComputeSystem in project coprhd-controller by CoprHD.
the class UcsComputeDevice method prepareOsInstallNetwork.
@Override
public Map<String, Boolean> prepareOsInstallNetwork(URI computeSystemId, URI computeElementId) throws InternalException {
LOGGER.info("prepareOsInstallNetwork");
ComputeSystem cs = _dbClient.queryObject(ComputeSystem.class, computeSystemId);
ComputeElement ce = _dbClient.queryObject(ComputeElement.class, computeElementId);
String osInstallVlan = cs.getOsInstallNetwork();
Map<String, Boolean> vlanMap = null;
try {
vlanMap = ucsmService.setOsInstallVlan(getUcsmURL(cs).toString(), cs.getUsername(), cs.getPassword(), ce.getDn(), osInstallVlan);
} catch (ClientGeneralException e) {
LOGGER.error("Unable to set os install vlan: " + cs.getOsInstallNetwork() + " On computeElement : " + ce.getId(), e);
throw ComputeSystemControllerException.exceptions.unableToSetOsInstallNetwork(osInstallVlan, ce.getId().toString(), e);
}
return vlanMap;
}
Aggregations