Search in sources :

Example 1 with LsBinding

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;
}
Also used : LsBinding(com.emc.cloud.platform.ucs.in.model.LsBinding) LsServer(com.emc.cloud.platform.ucs.out.model.LsServer) ConfigConfMo(com.emc.cloud.platform.ucs.in.model.ConfigConfMo) ConfigConfig(com.emc.cloud.platform.ucs.in.model.ConfigConfig) ClientGeneralException(com.emc.cloud.platform.clientlib.ClientGeneralException)

Example 2 with LsBinding

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;
}
Also used : LsBinding(com.emc.cloud.platform.ucs.in.model.LsBinding) LsServer(com.emc.cloud.platform.ucs.out.model.LsServer) ConfigConfMo(com.emc.cloud.platform.ucs.in.model.ConfigConfMo) ConfigConfig(com.emc.cloud.platform.ucs.in.model.ConfigConfig)

Aggregations

ConfigConfMo (com.emc.cloud.platform.ucs.in.model.ConfigConfMo)2 ConfigConfig (com.emc.cloud.platform.ucs.in.model.ConfigConfig)2 LsBinding (com.emc.cloud.platform.ucs.in.model.LsBinding)2 LsServer (com.emc.cloud.platform.ucs.out.model.LsServer)2 ClientGeneralException (com.emc.cloud.platform.clientlib.ClientGeneralException)1