use of com.cloud.api.ServerApiException in project CloudStack-archive by CloudStack-extras.
the class ReconnectHostCmd method execute.
@Override
public void execute() {
try {
Host result = _resourceService.reconnectHost(this);
if (result != null) {
HostResponse response = _responseGenerator.createHostResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reconnect host");
}
} catch (Exception ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
}
}
use of com.cloud.api.ServerApiException in project CloudStack-archive by CloudStack-extras.
the class RecoverVMCmd method execute.
@Override
public void execute() throws ResourceAllocationException {
UserVm result = _userVmService.recoverVirtualMachine(this);
if (result != null) {
UserVmResponse recoverVmResponse = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
recoverVmResponse.setResponseName(getCommandName());
this.setResponseObject(recoverVmResponse);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to recover vm");
}
}
use of com.cloud.api.ServerApiException in project CloudStack-archive by CloudStack-extras.
the class UpdateNetworkServiceProviderCmd method execute.
@Override
public void execute() {
PhysicalNetworkServiceProvider result = _networkService.updateNetworkServiceProvider(getId(), getState(), getEnabledServices());
if (result != null) {
ProviderResponse response = _responseGenerator.createNetworkServiceProviderResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update service provider");
}
}
use of com.cloud.api.ServerApiException in project CloudStack-archive by CloudStack-extras.
the class UpdatePhysicalNetworkCmd method execute.
@Override
public void execute() {
PhysicalNetwork result = _networkService.updatePhysicalNetwork(getId(), getNetworkSpeed(), getTags(), getVlan(), getState());
if (result != null) {
PhysicalNetworkResponse response = _responseGenerator.createPhysicalNetworkResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update physical network");
}
}
use of com.cloud.api.ServerApiException in project CloudStack-archive by CloudStack-extras.
the class UpdateResourceCountCmd method execute.
@Override
public void execute() {
List<? extends ResourceCount> result = _resourceLimitService.recalculateResourceCount(finalyzeAccountId(accountName, domainId, projectId, true), getDomainId(), getResourceType());
if ((result != null) && (result.size() > 0)) {
ListResponse<ResourceCountResponse> response = new ListResponse<ResourceCountResponse>();
List<ResourceCountResponse> countResponses = new ArrayList<ResourceCountResponse>();
for (ResourceCount count : result) {
ResourceCountResponse resourceCountResponse = _responseGenerator.createResourceCountResponse(count);
resourceCountResponse.setObjectName("resourcecount");
countResponses.add(resourceCountResponse);
}
response.setResponses(countResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to recalculate resource counts");
}
}
Aggregations