use of com.emc.cloud.platform.ucs.in.model.LsBinding in project coprhd-controller by CoprHD.
the class UCSMServiceImpl method bindSPToComputeElement.
@Override
public LsServer bindSPToComputeElement(String ucsmURL, String username, String password, String serviceProfileDn, String computeElementDn, StringBuilder errorMessage) throws ClientGeneralException {
ComputeSession computeSession = sessionManager.getSession(ucsmURL, username, password);
ConfigConfMo bindSPToCEConfigConfMo = new ConfigConfMo();
bindSPToCEConfigConfMo.setInHierarchical(Boolean.toString(true));
// bindSPToCEConfigConfMo.
com.emc.cloud.platform.ucs.in.model.LsServer lsServer = new com.emc.cloud.platform.ucs.in.model.LsServer();
lsServer.setDn(serviceProfileDn);
LsBinding lsBinding = new LsBinding();
lsBinding.setPnDn(computeElementDn);
lsServer.getContent().add(factory.createLsBinding(lsBinding));
ConfigConfig configConfig = new ConfigConfig();
configConfig.setManagedObject(factory.createLsServer(lsServer));
bindSPToCEConfigConfMo.getContent().add(factory.createConfigConfMoInConfig(configConfig));
LsServer returnedLsServer = pushLsServer(computeSession, factory, bindSPToCEConfigConfMo, errorMessage);
if ((returnedLsServer == null) || returnedLsServer.getAssignState().equals(ASSOC_STATE_UNASSOCIATED)) {
throw new ClientGeneralException(ClientMessageKeys.UNEXPECTED_FAILURE, new String[] { "Failed to bind ServiceProfile " + serviceProfileDn + " to ComputeElement '" + computeElementDn + "' on LsServer : " + serviceProfileDn });
}
return returnedLsServer;
}
use of com.emc.cloud.platform.ucs.in.model.LsBinding in project coprhd-controller by CoprHD.
the class UCSMServiceImpl method unbindServiceProfile.
@Override
public LsServer unbindServiceProfile(String ucsmURL, String username, String password, String spDn, StringBuilder errorMessage) throws ClientGeneralException {
ComputeSession computeSession = sessionManager.getSession(ucsmURL, username, password);
ConfigConfMo disAssocSPFromBladeMO = new ConfigConfMo();
disAssocSPFromBladeMO.setInHierarchical(Boolean.toString(true));
com.emc.cloud.platform.ucs.in.model.LsServer lsServer = new com.emc.cloud.platform.ucs.in.model.LsServer();
lsServer.setDn(spDn);
LsBinding lsBinding = new LsBinding();
lsBinding.setPnDn("");
lsBinding.setStatus(MO_DELETED_STATUS);
lsServer.getContent().add(factory.createLsBinding(lsBinding));
ConfigConfig configConfig = new ConfigConfig();
configConfig.setManagedObject(factory.createLsServer(lsServer));
disAssocSPFromBladeMO.getContent().add(factory.createConfigConfMoInConfig(configConfig));
LsServer updatedLsServer = pushLsServer(computeSession, factory, disAssocSPFromBladeMO, errorMessage);
log.info("The new Oper State of the Service Profile is : " + updatedLsServer.getOperState());
return updatedLsServer;
}
Aggregations