use of org.apache.cloudstack.api.ServerApiException in project cloudstack by apache.
the class AssociateLunCmd method execute.
@Override
public void execute() {
try {
AssociateLunCmdResponse response = new AssociateLunCmdResponse();
String[] returnVals = null;
returnVals = netappMgr.associateLun(getGuestIQN(), getLunName());
response.setLun(returnVals[0]);
response.setIpAddress(returnVals[2]);
response.setTargetIQN(returnVals[1]);
response.setObjectName("lun");
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (ServerException e) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
} catch (InvalidParameterValueException e) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString());
}
}
use of org.apache.cloudstack.api.ServerApiException in project cloudstack by apache.
the class DeleteVolumePoolCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
netappMgr.deletePool(poolName);
DeleteVolumePoolCmdResponse response = new DeleteVolumePoolCmdResponse();
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException e) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
} catch (ResourceInUseException e) {
throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, e.toString());
}
}
use of org.apache.cloudstack.api.ServerApiException in project cloudstack by apache.
the class DestroyVolumeOnFilerCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
netappMgr.destroyVolumeOnFiler(ipAddr, aggrName, volumeName);
DeleteVolumeOnFilerCmdResponse response = new DeleteVolumeOnFilerCmdResponse();
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException e) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
} catch (ResourceInUseException e) {
throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, e.toString());
} catch (ServerException e) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString());
}
}
use of org.apache.cloudstack.api.ServerApiException in project cloudstack by apache.
the class DissociateLunCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
netappMgr.disassociateLun(guestIQN, path);
DissociateLunCmdResponse response = new DissociateLunCmdResponse();
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException e) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
} catch (ServerException e) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString());
}
}
use of org.apache.cloudstack.api.ServerApiException in project cloudstack by apache.
the class ListDedicatedHostsCmd method execute.
@Override
public void execute() {
Pair<List<? extends DedicatedResourceVO>, Integer> result = dedicatedService.listDedicatedHosts(this);
ListResponse<DedicateHostResponse> response = new ListResponse<DedicateHostResponse>();
List<DedicateHostResponse> Responses = new ArrayList<DedicateHostResponse>();
if (result != null) {
for (DedicatedResources resource : result.first()) {
DedicateHostResponse hostResponse = dedicatedService.createDedicateHostResponse(resource);
Responses.add(hostResponse);
}
response.setResponses(Responses, result.second());
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to list dedicated hosts");
}
}
Aggregations