Search in sources :

Example 1 with ServerApiException

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

the class UpdateCfgCmd method execute.

@Override
public void execute() {
    Configuration cfg = _configService.updateConfiguration(this);
    if (cfg != null) {
        ConfigurationResponse response = _responseGenerator.createConfigurationResponse(cfg);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update config");
    }
}
Also used : ConfigurationResponse(com.cloud.api.response.ConfigurationResponse) Configuration(com.cloud.configuration.Configuration) ServerApiException(com.cloud.api.ServerApiException)

Example 2 with ServerApiException

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

the class UpdateDiskOfferingCmd method execute.

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

Example 3 with ServerApiException

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

the class UpdateHostCmd method execute.

@Override
public void execute() {
    Host result;
    try {
        result = _resourceService.updateHost(this);
        HostResponse hostResponse = _responseGenerator.createHostResponse(result);
        hostResponse.setResponseName(getCommandName());
        this.setResponseObject(hostResponse);
    } catch (Exception e) {
        s_logger.debug("Failed to update host:" + getId(), e);
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update host:" + getId() + "," + e.getMessage());
    }
}
Also used : ServerApiException(com.cloud.api.ServerApiException) HostResponse(com.cloud.api.response.HostResponse) Host(com.cloud.host.Host) ServerApiException(com.cloud.api.ServerApiException) NoTransitionException(com.cloud.utils.fsm.NoTransitionException)

Example 4 with ServerApiException

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

the class UpdateHypervisorCapabilitiesCmd method execute.

@Override
public void execute() {
    HypervisorCapabilities result = _mgr.updateHypervisorCapabilities(getId(), getMaxGuestsLimit(), getSecurityGroupEnabled());
    if (result != null) {
        HypervisorCapabilitiesResponse response = _responseGenerator.createHypervisorCapabilitiesResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update hypervisor capabilities");
    }
}
Also used : ServerApiException(com.cloud.api.ServerApiException) HypervisorCapabilities(com.cloud.hypervisor.HypervisorCapabilities) HypervisorCapabilitiesResponse(com.cloud.api.response.HypervisorCapabilitiesResponse)

Example 5 with ServerApiException

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

the class UpdateIsoCmd method execute.

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

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