Search in sources :

Example 6 with ServerApiException

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

the class UpdateLoadBalancerRuleCmd method execute.

@Override
public void execute() {
    UserContext.current().setEventDetails("Load balancer Id: " + getId());
    LoadBalancer result = _lbService.updateLoadBalancerRule(this);
    if (result != null) {
        LoadBalancerResponse response = _responseGenerator.createLoadBalancerResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update load balancer rule");
    }
}
Also used : LoadBalancerResponse(com.cloud.api.response.LoadBalancerResponse) ServerApiException(com.cloud.api.ServerApiException) LoadBalancer(com.cloud.network.rules.LoadBalancer)

Example 7 with ServerApiException

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

the class UpdateNetworkCmd method execute.

@Override
public void execute() throws InsufficientCapacityException, ConcurrentOperationException {
    User callerUser = _accountService.getActiveUser(UserContext.current().getCallerUserId());
    Account callerAccount = _accountService.getActiveAccountById(callerUser.getAccountId());
    Network result = _networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount, callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr());
    if (result != null) {
        NetworkResponse response = _responseGenerator.createNetworkResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update network");
    }
}
Also used : Account(com.cloud.user.Account) User(com.cloud.user.User) ServerApiException(com.cloud.api.ServerApiException) Network(com.cloud.network.Network) NetworkResponse(com.cloud.api.response.NetworkResponse)

Example 8 with ServerApiException

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

the class UpdateNetworkOfferingCmd method execute.

@Override
public void execute() {
    NetworkOffering result = _configService.updateNetworkOffering(this);
    if (result != null) {
        NetworkOfferingResponse response = _responseGenerator.createNetworkOfferingResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update network offering");
    }
}
Also used : NetworkOfferingResponse(com.cloud.api.response.NetworkOfferingResponse) ServerApiException(com.cloud.api.ServerApiException) NetworkOffering(com.cloud.offering.NetworkOffering)

Example 9 with ServerApiException

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

the class MigrateVolumeCmd method execute.

@Override
public void execute() {
    Volume result;
    try {
        result = _storageService.migrateVolume(getVolumeId(), getStoragePoolId());
        if (result != null) {
            VolumeResponse response = _responseGenerator.createVolumeResponse(result);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        }
    } catch (ConcurrentOperationException e) {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate volume: ");
    }
}
Also used : VolumeResponse(com.cloud.api.response.VolumeResponse) ServerApiException(com.cloud.api.ServerApiException) Volume(com.cloud.storage.Volume) ConcurrentOperationException(com.cloud.exception.ConcurrentOperationException)

Example 10 with ServerApiException

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

the class PreparePrimaryStorageForMaintenanceCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException {
    StoragePool result = _storageService.preparePrimaryStorageForMaintenance(getId());
    if (result != null) {
        StoragePoolResponse response = _responseGenerator.createStoragePoolResponse(result);
        response.setResponseName("storagepool");
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to prepare primary storage for maintenance");
    }
}
Also used : StoragePoolResponse(com.cloud.api.response.StoragePoolResponse) StoragePool(com.cloud.storage.StoragePool) ServerApiException(com.cloud.api.ServerApiException)

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