Search in sources :

Example 11 with OutOfBandManagementResponse

use of org.apache.cloudstack.api.response.OutOfBandManagementResponse in project cloudstack by apache.

the class EnableOutOfBandManagementForClusterCmd method execute.

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public final void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
    final Cluster cluster = _resourceService.getCluster(getClusterId());
    if (cluster == null) {
        throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unable to find cluster by ID: " + getClusterId());
    }
    OutOfBandManagementResponse response = outOfBandManagementService.enableOutOfBandManagement(cluster);
    CallContext.current().setEventDetails("Cluster Id:" + cluster.getId() + " out-of-band management enabled: true");
    CallContext.current().putContextParameter(Cluster.class, cluster.getUuid());
    response.setResponseName(getCommandName());
    setResponseObject(response);
}
Also used : OutOfBandManagementResponse(org.apache.cloudstack.api.response.OutOfBandManagementResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException) Cluster(com.cloud.org.Cluster)

Example 12 with OutOfBandManagementResponse

use of org.apache.cloudstack.api.response.OutOfBandManagementResponse in project cloudstack by apache.

the class EnableOutOfBandManagementForHostCmd method execute.

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public final void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
    final Host host = _resourceService.getHost(getHostId());
    if (host == null) {
        throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unable to find host by ID: " + getHostId());
    }
    OutOfBandManagementResponse response = outOfBandManagementService.enableOutOfBandManagement(host);
    CallContext.current().setEventDetails("Host Id:" + host.getId() + " out-of-band management enabled: true");
    CallContext.current().putContextParameter(Host.class, host.getUuid());
    response.setId(host.getUuid());
    response.setResponseName(getCommandName());
    setResponseObject(response);
}
Also used : OutOfBandManagementResponse(org.apache.cloudstack.api.response.OutOfBandManagementResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException) Host(com.cloud.host.Host)

Example 13 with OutOfBandManagementResponse

use of org.apache.cloudstack.api.response.OutOfBandManagementResponse in project cloudstack by apache.

the class EnableOutOfBandManagementForZoneCmd method execute.

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public final void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
    final DataCenter zone = _resourceService.getZone(getZoneId());
    if (zone == null) {
        throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unable to find zone by ID: " + getZoneId());
    }
    OutOfBandManagementResponse response = outOfBandManagementService.enableOutOfBandManagement(zone);
    CallContext.current().setEventDetails("Zone Id:" + zone.getId() + " out-of-band management enabled: true");
    CallContext.current().putContextParameter(DataCenter.class, zone.getUuid());
    response.setResponseName(getCommandName());
    setResponseObject(response);
}
Also used : OutOfBandManagementResponse(org.apache.cloudstack.api.response.OutOfBandManagementResponse) DataCenter(com.cloud.dc.DataCenter) ServerApiException(org.apache.cloudstack.api.ServerApiException)

Aggregations

OutOfBandManagementResponse (org.apache.cloudstack.api.response.OutOfBandManagementResponse)13 ServerApiException (org.apache.cloudstack.api.ServerApiException)9 Host (com.cloud.host.Host)5 ActionEvent (com.cloud.event.ActionEvent)3 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)3 DataCenter (com.cloud.dc.DataCenter)2 Cluster (com.cloud.org.Cluster)2 OutOfBandManagementDriverResponse (org.apache.cloudstack.outofbandmanagement.driver.OutOfBandManagementDriverResponse)2 TransactionStatus (com.cloud.utils.db.TransactionStatus)1 NoTransitionException (com.cloud.utils.fsm.NoTransitionException)1 ConfigurationException (javax.naming.ConfigurationException)1 PowerOperation (org.apache.cloudstack.outofbandmanagement.OutOfBandManagement.PowerOperation)1 OutOfBandManagementDriverChangePasswordCommand (org.apache.cloudstack.outofbandmanagement.driver.OutOfBandManagementDriverChangePasswordCommand)1 OutOfBandManagementDriverPowerCommand (org.apache.cloudstack.outofbandmanagement.driver.OutOfBandManagementDriverPowerCommand)1