Search in sources :

Example 56 with ServerApiException

use of com.cloud.api.ServerApiException in project CloudStack-archive by CloudStack-extras.

the class UpdateResourceLimitCmd method execute.

@Override
public void execute() {
    ResourceLimit result = _resourceLimitService.updateResourceLimit(finalyzeAccountId(accountName, domainId, projectId, true), getDomainId(), resourceType, max);
    if (result != null || (result == null && max != null && max.longValue() == -1L)) {
        ResourceLimitResponse response = _responseGenerator.createResourceLimitResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update resource limit");
    }
}
Also used : ServerApiException(com.cloud.api.ServerApiException) ResourceLimitResponse(com.cloud.api.response.ResourceLimitResponse) ResourceLimit(com.cloud.configuration.ResourceLimit)

Example 57 with ServerApiException

use of com.cloud.api.ServerApiException in project CloudStack-archive by CloudStack-extras.

the class UpdateStorageNetworkIpRangeCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    try {
        StorageNetworkIpRange result = _storageNetworkService.updateIpRange(this);
        StorageNetworkIpRangeResponse response = _responseGenerator.createStorageNetworkIpRangeResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } catch (Exception e) {
        s_logger.warn("Update storage network IP range failed", e);
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
    }
}
Also used : ServerApiException(com.cloud.api.ServerApiException) StorageNetworkIpRange(com.cloud.dc.StorageNetworkIpRange) StorageNetworkIpRangeResponse(com.cloud.api.response.StorageNetworkIpRangeResponse) ServerApiException(com.cloud.api.ServerApiException) ResourceUnavailableException(com.cloud.exception.ResourceUnavailableException) ResourceAllocationException(com.cloud.exception.ResourceAllocationException) ConcurrentOperationException(com.cloud.exception.ConcurrentOperationException) InsufficientCapacityException(com.cloud.exception.InsufficientCapacityException)

Example 58 with ServerApiException

use of com.cloud.api.ServerApiException in project CloudStack-archive by CloudStack-extras.

the class UpdateStoragePoolCmd method execute.

@Override
public void execute() {
    StoragePool result = _storageService.updateStoragePool(this);
    if (result != null) {
        StoragePoolResponse response = _responseGenerator.createStoragePoolResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update storage pool");
    }
}
Also used : StoragePoolResponse(com.cloud.api.response.StoragePoolResponse) StoragePool(com.cloud.storage.StoragePool) ServerApiException(com.cloud.api.ServerApiException)

Example 59 with ServerApiException

use of com.cloud.api.ServerApiException in project CloudStack-archive by CloudStack-extras.

the class UpdateTemplateCmd method execute.

@Override
public void execute() {
    VirtualMachineTemplate result = _mgr.updateTemplate(this);
    if (result != null) {
        TemplateResponse response = _responseGenerator.createIsoResponse(result);
        response.setObjectName("template");
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update template");
    }
}
Also used : VirtualMachineTemplate(com.cloud.template.VirtualMachineTemplate) ServerApiException(com.cloud.api.ServerApiException) TemplateResponse(com.cloud.api.response.TemplateResponse)

Example 60 with ServerApiException

use of com.cloud.api.ServerApiException in project CloudStack-archive by CloudStack-extras.

the class UpdateTrafficTypeCmd method execute.

@Override
public void execute() {
    PhysicalNetworkTrafficType result = _networkService.updatePhysicalNetworkTrafficType(getId(), getXenLabel(), getKvmLabel(), getVmwareLabel());
    if (result != null) {
        TrafficTypeResponse response = _responseGenerator.createTrafficTypeResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update traffic type");
    }
}
Also used : ServerApiException(com.cloud.api.ServerApiException) TrafficTypeResponse(com.cloud.api.response.TrafficTypeResponse) PhysicalNetworkTrafficType(com.cloud.network.PhysicalNetworkTrafficType)

Aggregations

ServerApiException (com.cloud.api.ServerApiException)170 SuccessResponse (com.cloud.api.response.SuccessResponse)46 UserVm (com.cloud.uservm.UserVm)15 UserVmResponse (com.cloud.api.response.UserVmResponse)14 ConcurrentOperationException (com.cloud.exception.ConcurrentOperationException)12 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)12 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)12 Account (com.cloud.user.Account)9 Host (com.cloud.host.Host)8 VirtualMachineTemplate (com.cloud.template.VirtualMachineTemplate)8 ListResponse (com.cloud.api.response.ListResponse)7 NetworkRuleConflictException (com.cloud.exception.NetworkRuleConflictException)7 HostResponse (com.cloud.api.response.HostResponse)6 TemplateResponse (com.cloud.api.response.TemplateResponse)6 InsufficientCapacityException (com.cloud.exception.InsufficientCapacityException)6 AccountResponse (com.cloud.api.response.AccountResponse)5 SystemVmResponse (com.cloud.api.response.SystemVmResponse)5 UserResponse (com.cloud.api.response.UserResponse)5 VolumeResponse (com.cloud.api.response.VolumeResponse)5 ResourceAllocationException (com.cloud.exception.ResourceAllocationException)5