Modified exception handing in API. Following exceptions are supported now (location - BaseCmd.java):

* MALFORMED_PARAMETER_ERROR - when type of the request parameter is invalid (String instead of Long for id for example)
* PARAM_ERROR - when invalid parameter value is specified in api request. For example, id of non existing vm for StartVmCmd
* ACCOUNT_RESOURCE_LIMIT_ERROR - when user tries to exceed his resource limits by executing the api command.
* INSUFFICIENT_CAPACITY_ERROR - when resource fails to create/start due to insufficient capacity.
* RESOURCE_UNAVAILABLE_ERROR - when user tries to create a vm when storage is not available.
* RESOURCE_IN_USE_ERROR - when user tries to delete/modify resource while it's in use. For example, when we try to delete a network group when it contains ingress rules.
* NETWORK_RULE_CONFLICT_ERROR - when LB/PF rule to add conflicts with existing rule
* ACCOUNT_ERROR - when user is not authorized to execute operation on the resource.
* INTERNAL_ERROR
This commit is contained in:
alena 2010-11-15 19:08:30 -08:00
parent 2dae6ea836
commit c5d78a726e
177 changed files with 518 additions and 1344 deletions

View File

@ -1395,7 +1395,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
HostVO host = _hostDao.findById(hostId);
if (host == null) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Host with id " + hostId.toString() + " doesn't exist");
throw new InvalidParameterValueException("Host with id " + hostId.toString() + " doesn't exist");
}
boolean result = reconnect(hostId);
@ -1463,12 +1463,12 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
//verify input parameters
HostVO host = _hostDao.findById(hostId);
if (host == null || host.getRemoved() != null) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Host with id " + hostId.toString() + " doesn't exist");
throw new InvalidParameterValueException("Host with id " + hostId.toString() + " doesn't exist");
}
boolean success = cancelMaintenance(hostId);
if (!success) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Internal error cancelling maintenance.");
throw new CloudRuntimeException("Internal error cancelling maintenance.");
}
return host;
}

View File

@ -28,8 +28,7 @@ import java.util.StringTokenizer;
import org.apache.log4j.Logger;
import com.cloud.api.BaseCmd.CommandType;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.AccountLimitException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@ -66,78 +65,59 @@ public class ApiDispatcher {
try {
cmd.callCreate();
} catch (InvalidParameterValueException e1) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, e1.getMessage());
} catch (IllegalArgumentException e2) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, e2.getMessage());
} catch (PermissionDeniedException e3) {
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, e3.getMessage());
} catch (InsufficientAddressCapacityException e4) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e4.getMessage());
} catch (InsufficientCapacityException e5) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e5.getMessage());
} catch (ConcurrentOperationException e6) {
s_logger.error("Exception while executing " + cmd.getName() + ":", e6);
} catch (Throwable t) {
if (t instanceof InvalidParameterValueException || t instanceof IllegalArgumentException) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, t.getMessage());
}else if (t instanceof PermissionDeniedException) {
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, t.getMessage());
}else if (t instanceof AccountLimitException) {
throw new ServerApiException(BaseCmd.ACCOUNT_RESOURCE_LIMIT_ERROR, t.getMessage());
}else if (t instanceof InsufficientCapacityException) {
throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, t.getMessage());
}else if (t instanceof ResourceAllocationException) {
throw new ServerApiException(BaseCmd.RESOURCE_ALLOCATION_ERROR, t.getMessage());
}else if (t instanceof ResourceUnavailableException) {
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, t.getMessage());
}else if (t instanceof ServerApiException) {
throw new ServerApiException(((ServerApiException) t).getErrorCode(), ((ServerApiException) t).getDescription());
}else {
s_logger.error("Exception while executing " + cmd.getName() + ":", t);
if (UserContext.current().getAccount() == null || UserContext.current().getAccount().getType() == Account.ACCOUNT_TYPE_ADMIN)
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e6.getMessage());
else
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, BaseCmd.USER_ERROR_MESSAGE);
} catch (ResourceUnavailableException e7) {
s_logger.error("Exception while executing " + cmd.getName() + ":", e7);
if (UserContext.current().getAccount() == null || UserContext.current().getAccount().getType() == Account.ACCOUNT_TYPE_ADMIN)
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e7.getMessage());
else
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, BaseCmd.USER_ERROR_MESSAGE);
} catch (ResourceAllocationException e8) {
s_logger.error("Exception while executing " + cmd.getName() + ":", e8);
if (UserContext.current().getAccount() == null || UserContext.current().getAccount().getType() == Account.ACCOUNT_TYPE_ADMIN)
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e8.getMessage());
else
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, BaseCmd.USER_ERROR_MESSAGE);
} catch (CloudRuntimeException e9) {
s_logger.error("Exception while executing " + cmd.getName() + ":", e9);
if (UserContext.current().getAccount() == null || UserContext.current().getAccount().getType() == Account.ACCOUNT_TYPE_ADMIN)
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e9.getMessage());
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, t.getMessage());
else
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, BaseCmd.USER_ERROR_MESSAGE);
}
}
}
public void dispatch(BaseCmd cmd, Map<String, String> params) {
setupParameters(cmd, params);
try {
cmd.execute();
} catch (InvalidParameterValueException e1) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, e1.getMessage());
} catch (IllegalArgumentException e2) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, e2.getMessage());
} catch (PermissionDeniedException e3) {
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, e3.getMessage());
} catch (InsufficientAddressCapacityException e4) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e4.getMessage());
} catch (InsufficientCapacityException e5) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e5.getMessage());
} catch (ConcurrentOperationException e6) {
s_logger.error("Exception while executing " + cmd.getName() + ":", e6);
} catch (Throwable t) {
if (t instanceof InvalidParameterValueException || t instanceof IllegalArgumentException) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, t.getMessage());
}else if (t instanceof PermissionDeniedException) {
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, t.getMessage());
}else if (t instanceof AccountLimitException) {
throw new ServerApiException(BaseCmd.ACCOUNT_RESOURCE_LIMIT_ERROR, t.getMessage());
}else if (t instanceof InsufficientCapacityException) {
throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, t.getMessage());
}else if (t instanceof ResourceAllocationException) {
throw new ServerApiException(BaseCmd.RESOURCE_ALLOCATION_ERROR, t.getMessage());
}else if (t instanceof ResourceUnavailableException) {
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, t.getMessage());
}else if (t instanceof ServerApiException) {
throw new ServerApiException(((ServerApiException) t).getErrorCode(), ((ServerApiException) t).getDescription());
} else {
s_logger.error("Exception while executing " + cmd.getName() + ":", t);
if (UserContext.current().getAccount() == null || UserContext.current().getAccount().getType() == Account.ACCOUNT_TYPE_ADMIN)
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e6.getMessage());
else
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, BaseCmd.USER_ERROR_MESSAGE);
} catch (ResourceUnavailableException e7) {
s_logger.error("Exception while executing " + cmd.getName() + ":", e7);
if (UserContext.current().getAccount() == null || UserContext.current().getAccount().getType() == Account.ACCOUNT_TYPE_ADMIN)
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e7.getMessage());
else
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, BaseCmd.USER_ERROR_MESSAGE);
} catch (CloudRuntimeException e8) {
s_logger.error("Exception while executing " + cmd.getName() + ":", e8);
if (UserContext.current().getAccount() == null || UserContext.current().getAccount().getType() == Account.ACCOUNT_TYPE_ADMIN)
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e8.getMessage());
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, t.getMessage());
else
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, BaseCmd.USER_ERROR_MESSAGE);
}
}
}
public static void setupParameters(BaseCmd cmd, Map<String, String> params) {
Map<String, Object> unpackedParams = cmd.unpackParams(params);
@ -225,7 +205,7 @@ public class ApiDispatcher {
listParam.add(Long.valueOf(token));
break;
case STRING:
listParam.add(token.toString());
listParam.add(token);
break;
}
}

View File

@ -2,20 +2,12 @@ package com.cloud.api;
import com.cloud.api.response.ApiResponseSerializer;
import com.cloud.api.response.CreateCmdResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
public abstract class BaseAsyncCreateCmd extends BaseAsyncCmd {
@Parameter(name="id", type=CommandType.LONG)
private Long id;
public abstract void callCreate() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, ResourceAllocationException;
public abstract void callCreate();
public Long getId() {
return id;

View File

@ -31,12 +31,6 @@ import com.cloud.agent.AgentManager;
import com.cloud.async.AsyncJobManager;
import com.cloud.configuration.ConfigurationService;
import com.cloud.consoleproxy.ConsoleProxyManager;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.DomainRouterService;
import com.cloud.network.NetworkManager;
import com.cloud.network.security.NetworkGroupManager;
@ -66,46 +60,19 @@ public abstract class BaseCmd {
// FIXME: Extract these out into a separate file
// Client error codes
public static final int MALFORMED_PARAMETER_ERROR = 430;
public static final int VM_INVALID_PARAM_ERROR = 431;
public static final int NET_INVALID_PARAM_ERROR = 432;
public static final int VM_ALLOCATION_ERROR = 433;
public static final int IP_ALLOCATION_ERROR = 434;
public static final int SNAPSHOT_INVALID_PARAM_ERROR = 435;
public static final int PARAM_ERROR = 436;
public static final int PARAM_ERROR = 431;
public static final int UNSUPPORTED_ACTION_ERROR = 432;
// Server error codes
public static final int INTERNAL_ERROR = 530;
public static final int ACCOUNT_ERROR = 531;
public static final int UNSUPPORTED_ACTION_ERROR = 532;
public static final int ACCOUNT_RESOURCE_LIMIT_ERROR= 532;
public static final int INSUFFICIENT_CAPACITY_ERROR = 533;
public static final int RESOURCE_UNAVAILABLE_ERROR = 534;
public static final int RESOURCE_ALLOCATION_ERROR = 534;
public static final int RESOURCE_IN_USE_ERROR = 536;
public static final int NETWORK_RULE_CONFLICT_ERROR = 537;
public static final int VM_DEPLOY_ERROR = 540;
public static final int VM_DESTROY_ERROR = 541;
public static final int VM_REBOOT_ERROR = 542;
public static final int VM_START_ERROR = 543;
public static final int VM_STOP_ERROR = 544;
public static final int VM_RESET_PASSWORD_ERROR = 545;
public static final int VM_CHANGE_SERVICE_ERROR = 546;
public static final int VM_LIST_ERROR = 547;
public static final int VM_RECOVER_ERROR = 548;
public static final int SNAPSHOT_LIST_ERROR = 549;
public static final int CREATE_VOLUME_FROM_SNAPSHOT_ERROR = 550;
public static final int VM_INSUFFICIENT_CAPACITY = 551;
public static final int CREATE_PRIVATE_TEMPLATE_ERROR = 552;
public static final int VM_HOST_LICENSE_EXPIRED = 553;
public static final int NET_IP_ASSOC_ERROR = 560;
public static final int NET_IP_DIASSOC_ERROR = 561;
public static final int NET_CREATE_IPFW_RULE_ERROR = 562;
public static final int NET_DELETE_IPFW_RULE_ERROR = 563;
public static final int NET_CONFLICT_IPFW_RULE_ERROR = 564;
public static final int NET_CREATE_LB_RULE_ERROR = 566;
public static final int NET_DELETE_LB_RULE_ERROR = 567;
public static final int NET_CONFLICT_LB_RULE_ERROR = 568;
public static final int NET_LIST_ERROR = 570;
public static final int CUSTOM_CERT_UPDATE_ERROR = 571;
public static final int PREPARE_STORAGE_MAINTENANCE_ERROR = 572;
public static final int CANCEL_STORAGE_MAINTENANCE_ERROR = 573;
public static final int STORAGE_RESOURCE_IN_USE = 580;
public static final DateFormat INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
private static final DateFormat _outputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
@ -148,7 +115,7 @@ public abstract class BaseCmd {
_routerMgr = locator.getManager(DomainRouterService.class);
}
public abstract void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException;
public abstract void execute();
public String getResponseType() {
if (responseType == null) {

View File

@ -30,12 +30,7 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.HostResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.DiscoveryException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.host.HostVO;
@Implementation(description="Adds a new host.", responseObject=HostResponse.class)
@ -112,7 +107,7 @@ public class AddHostCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
try {
List<HostVO> result = _agentMgr.discoverHosts(this);
ListResponse<HostResponse> response = new ListResponse<HostResponse>();

View File

@ -29,12 +29,7 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.HostResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.DiscoveryException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.host.HostVO;
@Implementation(description="Adds secondary storage.", responseObject=HostResponse.class)
@ -74,7 +69,7 @@ public class AddSecondaryStorageCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
try {
List<HostVO> result = _agentMgr.discoverHosts(this);
HostResponse hostResponse = null;

View File

@ -29,10 +29,6 @@ import com.cloud.api.ServerApiException;
import com.cloud.api.response.VpnUsersResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.network.VpnUserVO;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@ -127,7 +123,8 @@ public class AddVpnUserCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
try {
VpnUserVO vpnUser = _networkMgr.addVpnUser(this);
if (vpnUser != null) {
VpnUsersResponse vpnResponse = new VpnUsersResponse();
@ -147,5 +144,8 @@ public class AddVpnUserCmd extends BaseAsyncCmd {
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user");
}
} catch (ConcurrentOperationException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
}
}
}

View File

@ -30,12 +30,7 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.network.LoadBalancerVO;
import com.cloud.user.Account;
@ -103,7 +98,7 @@ public class AssignToLoadBalancerRuleCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
try {
boolean result = _networkMgr.assignToLoadBalancer(this);
if (result) {
@ -113,7 +108,7 @@ public class AssignToLoadBalancerRuleCmd extends BaseAsyncCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to assign load balancer rule");
}
} catch (NetworkRuleConflictException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
}
}
}

View File

@ -28,9 +28,6 @@ import com.cloud.api.ServerApiException;
import com.cloud.api.response.IPAddressResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.IPAddressVO;
@ -84,7 +81,7 @@ public class AssociateIPAddrCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
try {
IPAddressVO result = _networkMgr.associateIP(this);
if (result != null) {
@ -95,7 +92,11 @@ public class AssociateIPAddrCmd extends BaseCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to assign ip address");
}
} catch (ResourceAllocationException ex) {
throw new ServerApiException(BaseCmd.RESOURCE_ALLOCATION_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
} catch (InsufficientAddressCapacityException ex) {
throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
}
}
}

View File

@ -29,11 +29,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.UserVmResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.storage.VMTemplateVO;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
@ -97,7 +92,7 @@ public class AttachIsoCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _templateMgr.attachIso(this);
if (result) {
UserVm userVm = ApiDBUtils.findUserVmById(virtualMachineId);

View File

@ -30,11 +30,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.VolumeResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.storage.Volume;
import com.cloud.storage.VolumeVO;
import com.cloud.user.Account;
@ -114,7 +109,7 @@ public class AttachVolumeCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
Volume result = _userVmService.attachVolumeToVM(this);
if (result != null) {
VolumeResponse response = ApiResponseHelper.createVolumeResponse((VolumeVO)result);

View File

@ -37,11 +37,6 @@ import com.cloud.api.ServerApiException;
import com.cloud.api.response.IngressRuleResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.network.security.IngressRuleVO;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@ -83,7 +78,7 @@ public class AuthorizeNetworkGroupIngressCmd extends BaseAsyncCmd {
//FIXME - add description
@Parameter(name=ApiConstants.CIDR_LIST, type=CommandType.LIST, collectionType=CommandType.STRING)
private List<String> cidrList;
private List cidrList;
//FIXME - add description
@Parameter(name=ApiConstants.USER_NETWORK_GROUP_LIST, type=CommandType.MAP)
@ -106,7 +101,7 @@ public class AuthorizeNetworkGroupIngressCmd extends BaseAsyncCmd {
return accountName;
}
public List<String> getCidrList() {
public List getCidrList() {
return cidrList;
}
@ -213,7 +208,7 @@ public class AuthorizeNetworkGroupIngressCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<IngressRuleVO> ingressRules = _networkGroupMgr.authorizeNetworkGroupIngress(this);
ListResponse<IngressRuleResponse> response = new ListResponse<IngressRuleResponse>();
if ((ingressRules != null) && !ingressRules.isEmpty()) {

View File

@ -29,11 +29,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.HostResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.host.HostVO;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@ -95,7 +90,7 @@ public class CancelMaintenanceCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
HostVO result = _agentMgr.cancelMaintenance(this);
if (result != null) {
HostResponse response = ApiResponseHelper.createHostResponse(result);

View File

@ -29,11 +29,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.StoragePoolResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.storage.StoragePoolVO;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@ -95,7 +90,7 @@ public class CancelPrimaryStorageMaintenanceCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
StoragePoolVO result = _storageMgr.cancelPrimaryStorageForMaintenance(this);
if (result != null) {
StoragePoolResponse response = ApiResponseHelper.createStoragePoolResponse(result);

View File

@ -29,11 +29,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.TemplateResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.StorageUnavailableException;
import com.cloud.storage.GuestOS;
import com.cloud.storage.VMTemplateHostVO;
@ -111,7 +106,7 @@ public class CopyIsoCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
try {
VMTemplateVO iso = _templateMgr.copyIso(this);
TemplateResponse isoResponse = new TemplateResponse();
@ -184,7 +179,7 @@ public class CopyIsoCmd extends BaseAsyncCmd {
isoResponse.setObjectName("iso");
this.setResponseObject(isoResponse);
} catch (StorageUnavailableException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
}
}
}

View File

@ -29,11 +29,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.TemplateResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.StorageUnavailableException;
import com.cloud.storage.GuestOS;
import com.cloud.storage.VMTemplateHostVO;
@ -112,7 +107,7 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
try {
VMTemplateVO template = _templateMgr.copyTemplate(this);
TemplateResponse templateResponse = new TemplateResponse();
@ -188,7 +183,7 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
this.setResponseObject(templateResponse);
} catch (StorageUnavailableException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
}
}
}

View File

@ -28,11 +28,6 @@ import com.cloud.api.ServerApiException;
import com.cloud.api.response.ConfigurationResponse;
import com.cloud.configuration.Configuration;
import com.cloud.configuration.ConfigurationVO;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Adds configuration value", responseObject=ConfigurationResponse.class)
public class CreateCfgCmd extends BaseCmd {
@ -101,7 +96,7 @@ public class CreateCfgCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
Configuration cfg = _configService.addConfig(this);
if (cfg != null) {
ConfigurationResponse response = ApiResponseHelper.createConfigurationResponse((ConfigurationVO)cfg);

View File

@ -26,11 +26,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.DiskOfferingResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.offering.DiskOffering;
import com.cloud.storage.DiskOfferingVO;
@ -92,7 +87,7 @@ public class CreateDiskOfferingCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
DiskOffering offering = _configService.createDiskOffering(this);
if (offering != null) {
DiskOfferingResponse response = ApiResponseHelper.createDiskOfferingResponse((DiskOfferingVO)offering);

View File

@ -27,11 +27,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.DomainResponse;
import com.cloud.domain.DomainVO;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Creates a domain", responseObject=DomainResponse.class)
public class CreateDomainCmd extends BaseCmd {
@ -73,7 +68,7 @@ public class CreateDomainCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
DomainVO domain = _mgr.createDomain(this);
if (domain != null) {
DomainResponse response = ApiResponseHelper.createDomainResponse(domain);

View File

@ -29,13 +29,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.FirewallRuleResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.FirewallRuleVO;
import com.cloud.user.Account;
@ -79,20 +72,20 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
FirewallRuleVO result = _networkMgr.createIpForwardingRuleOnDomr(this.getId());
if (result != null) {
FirewallRuleResponse fwResponse = ApiResponseHelper.createFirewallRuleResponse(result);
fwResponse.setResponseName(getName());
this.setResponseObject(fwResponse);
} else {
throw new ServerApiException(NET_CREATE_IPFW_RULE_ERROR, "Error in creating ip forwarding rule on the domr");
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Error in creating ip forwarding rule on the domr");
}
}
@Override
public void callCreate() throws ServerApiException,InvalidParameterValueException, PermissionDeniedException,InsufficientAddressCapacityException,InsufficientCapacityException, ResourceUnavailableException,ConcurrentOperationException, ResourceAllocationException{
public void callCreate(){
FirewallRuleVO rule = _networkMgr.createIpForwardingRuleInDb(ipAddress,virtualMachineId);
if (rule != null){
this.setId(rule.getId());

View File

@ -27,11 +27,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.LoadBalancerResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.network.LoadBalancerVO;
@Implementation(description="Creates a load balancer rule", responseObject=LoadBalancerResponse.class)
@ -101,7 +96,7 @@ public class CreateLoadBalancerRuleCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
LoadBalancerVO result = _networkMgr.createLoadBalancerRule(this);
if (result != null) {
LoadBalancerResponse response = ApiResponseHelper.createLoadBalancerResponse(result);

View File

@ -26,11 +26,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.NetworkGroupResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.network.security.NetworkGroupVO;
//TODO - add description to implementation
@ -87,7 +82,7 @@ public class CreateNetworkGroupCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
NetworkGroupVO group = _networkGroupMgr.createNetworkGroup(this);
if (group != null) {
NetworkGroupResponse response = new NetworkGroupResponse();

View File

@ -29,11 +29,6 @@ import com.cloud.api.ServerApiException;
import com.cloud.api.response.PodResponse;
import com.cloud.dc.HostPodVO;
import com.cloud.dc.Pod;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Creates a new Pod.", responseObject=PodResponse.class)
public class CreatePodCmd extends BaseCmd {
@ -102,7 +97,7 @@ public class CreatePodCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
Pod result = _configService.createPod(this);
if (result != null) {
PodResponse response = ApiResponseHelper.createPodResponse((HostPodVO)result);

View File

@ -27,12 +27,7 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.FirewallRuleResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.network.FirewallRuleVO;
@Implementation(description="Creates a port forwarding rule", responseObject=FirewallRuleResponse.class)
@ -96,7 +91,7 @@ public class CreatePortForwardingRuleCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
try {
FirewallRuleVO result = _networkMgr.createPortForwardingRule(this);
if (result != null) {
@ -104,10 +99,10 @@ public class CreatePortForwardingRuleCmd extends BaseCmd {
fwResponse.setResponseName(getName());
this.setResponseObject(fwResponse);
} else {
throw new ServerApiException(NET_CREATE_IPFW_RULE_ERROR, "An existing rule for ipAddress / port / protocol of " + ipAddress + " / " + publicPort + " / " + protocol + " exits.");
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "An existing rule for ipAddress / port / protocol of " + ipAddress + " / " + publicPort + " / " + protocol + " exits.");
}
} catch (NetworkRuleConflictException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
}
}

View File

@ -29,10 +29,6 @@ import com.cloud.api.ServerApiException;
import com.cloud.api.response.RemoteAccessVpnResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.RemoteAccessVpnVO;
import com.cloud.user.Account;
@ -137,17 +133,21 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd {
}
@Override
public void callCreate() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException{
public void callCreate(){
try {
RemoteAccessVpnVO vpn = _networkMgr.createRemoteAccessVpn(this);
if (vpn != null) {
this.setId(vpn.getId());
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create remote access vpn");
}
} catch (ConcurrentOperationException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
}
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
try {
RemoteAccessVpnVO result = _networkMgr.startRemoteAccessVpn(this);
if (result != null) {
@ -166,6 +166,8 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create remote access vpn");
}
} catch (ResourceUnavailableException ex) {
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
}
}

View File

@ -27,11 +27,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ServiceOfferingResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.offering.ServiceOffering;
import com.cloud.service.ServiceOfferingVO;
@ -121,7 +116,7 @@ public class CreateServiceOfferingCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
ServiceOffering result = _configService.createServiceOffering(this);
if (result != null) {
ServiceOfferingResponse response = ApiResponseHelper.createServiceOfferingResponse((ServiceOfferingVO)result);

View File

@ -30,11 +30,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SnapshotResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.storage.SnapshotVO;
import com.cloud.storage.VolumeVO;
@ -109,7 +104,7 @@ public class CreateSnapshotCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
try {
SnapshotVO snapshot = _snapshotMgr.createSnapshot(this);
if (snapshot != null) {
@ -120,7 +115,7 @@ public class CreateSnapshotCmd extends BaseAsyncCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + volumeId);
}
} catch (ResourceAllocationException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
throw new ServerApiException(BaseCmd.RESOURCE_ALLOCATION_ERROR, ex.getMessage());
}
}
}

View File

@ -28,11 +28,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SnapshotResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.storage.Snapshot.SnapshotType;
import com.cloud.storage.SnapshotVO;
@ -101,7 +96,7 @@ public class CreateSnapshotInternalCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
try {
SnapshotVO snapshot = _snapshotMgr.createSnapshotInternal(this);
if (snapshot != null) {
@ -130,7 +125,7 @@ public class CreateSnapshotInternalCmd extends BaseAsyncCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create snapshot");
}
} catch (ResourceAllocationException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
throw new ServerApiException(BaseCmd.RESOURCE_ALLOCATION_ERROR, ex.getMessage());
}
}
}

View File

@ -27,11 +27,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SnapshotPolicyResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.storage.SnapshotPolicyVO;
@Implementation(description="Creates a snapshot policy for the account.", responseObject=SnapshotPolicyResponse.class)
@ -114,7 +109,7 @@ public class CreateSnapshotPolicyCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
SnapshotPolicyVO result = _snapshotMgr.createPolicy(this);
if (result != null) {
SnapshotPolicyResponse response = ApiResponseHelper.createSnapshotPolicyResponse(result);

View File

@ -30,11 +30,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.StoragePoolResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceInUseException;
import com.cloud.storage.StoragePoolVO;
@ -113,7 +108,7 @@ public class CreateStoragePoolCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
try {
StoragePoolVO result = _storageMgr.createPool(this);
if (result != null) {
@ -124,9 +119,9 @@ public class CreateStoragePoolCmd extends BaseCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add storage pool");
}
} catch (ResourceAllocationException ex1) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex1.getMessage());
throw new ServerApiException(BaseCmd.RESOURCE_ALLOCATION_ERROR, ex1.getMessage());
}catch (ResourceInUseException ex2) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex2.getMessage());
throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, ex2.getMessage());
} catch (UnknownHostException ex3) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex3.getMessage());
}

View File

@ -31,12 +31,6 @@ import com.cloud.api.response.StoragePoolResponse;
import com.cloud.api.response.TemplateResponse;
import com.cloud.dc.DataCenterVO;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.storage.GuestOS;
import com.cloud.storage.Snapshot;
import com.cloud.storage.VMTemplateHostVO;
@ -174,7 +168,7 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
}
@Override
public void callCreate() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException{
public void callCreate(){
VMTemplateVO template = _userVmService.createPrivateTemplateRecord(this);
if (template != null){
this.setId(template.getId());
@ -184,7 +178,7 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
VMTemplateVO template = _userVmService.createPrivateTemplate(this);
if (template != null) {
TemplateResponse response = new TemplateResponse();

View File

@ -27,11 +27,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.UserResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.user.UserAccount;
@Implementation(description="Creates a user account", responseObject=UserResponse.class)
@ -128,7 +123,7 @@ public class CreateUserCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
UserAccount user = _accountService.createUser(this);
if (user != null) {
UserResponse response = ApiResponseHelper.createUserResponse(user);

View File

@ -26,11 +26,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.InstanceGroupResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.vm.InstanceGroupVO;
@Implementation(description="Creates a vm group", responseObject=InstanceGroupResponse.class)
@ -78,7 +73,7 @@ public class CreateVMGroupCmd extends BaseCmd{
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
InstanceGroupVO result = _userVmService.createVmGroup(this);
if (result != null) {
InstanceGroupResponse response = ApiResponseHelper.createInstanceGroupResponse(result);

View File

@ -30,10 +30,7 @@ import com.cloud.api.response.VlanIpRangeResponse;
import com.cloud.dc.Vlan;
import com.cloud.dc.VlanVO;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Creates a VLAN IP range.", responseObject=VlanIpRangeResponse.class)
public class CreateVlanIpRangeCmd extends BaseCmd {
@ -130,7 +127,8 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
try {
Vlan result = _configService.createVlanAndPublicIpRange(this);
if (result != null) {
VlanIpRangeResponse response = ApiResponseHelper.createVlanIpRangeResponse((VlanVO)result);
@ -139,5 +137,10 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
}else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create vlan ip range");
}
} catch (ConcurrentOperationException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
} catch (InsufficientCapacityException ex) {
throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
}
}
}

View File

@ -30,11 +30,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.VolumeResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.storage.Volume;
import com.cloud.storage.VolumeVO;
@ -147,17 +142,21 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
}
@Override
public void callCreate() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException{
public void callCreate(){
try {
Volume volume = _storageMgr.allocVolume(this);
if (volume != null) {
this.setId(volume.getId());
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create volume");
}
} catch (ResourceAllocationException ex) {
throw new ServerApiException(BaseCmd.RESOURCE_ALLOCATION_ERROR, ex.getMessage());
}
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
Volume volume = _storageMgr.createVolume(this);
if (volume != null) {
VolumeResponse response = ApiResponseHelper.createVolumeResponse((VolumeVO)volume);

View File

@ -29,11 +29,6 @@ import com.cloud.api.ServerApiException;
import com.cloud.api.response.ZoneResponse;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenterVO;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Creates a Zone.", responseObject=ZoneResponse.class)
public class CreateZoneCmd extends BaseCmd {
@ -122,7 +117,7 @@ public class CreateZoneCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
DataCenter result = _configService.createZone(this);
if (result != null){
ZoneResponse response = ApiResponseHelper.createZoneResponse((DataCenterVO)result);

View File

@ -25,11 +25,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Updates a disk offering.", responseObject=SuccessResponse.class)
public class DeleteDiskOfferingCmd extends BaseCmd {
@ -62,7 +57,7 @@ public class DeleteDiskOfferingCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _configService.deleteDiskOffering(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -29,11 +29,6 @@ import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.domain.DomainVO;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.user.Account;
@Implementation(description="Deletes a specified domain", responseObject=SuccessResponse.class)
@ -94,7 +89,7 @@ public class DeleteDomainCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _mgr.deleteDomain(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -26,11 +26,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Deletes a host.", responseObject=SuccessResponse.class)
@ -66,7 +61,7 @@ public class DeleteHostCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _agentMgr.deleteHost(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -28,11 +28,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.user.Account;
@Implementation(description="Deletes an ip forwarding rule", responseObject=SuccessResponse.class)
@ -66,7 +61,7 @@ public class DeleteIpForwardingRuleCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = false;
result = _networkMgr.deleteIpForwardingRule(id);
if (result) {

View File

@ -28,11 +28,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.storage.VMTemplateVO;
import com.cloud.user.Account;
@ -98,7 +93,7 @@ public class DeleteIsoCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _templateMgr.deleteIso(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -28,11 +28,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.network.LoadBalancerVO;
import com.cloud.user.Account;
@ -86,7 +81,7 @@ public class DeleteLoadBalancerRuleCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _networkMgr.deleteLoadBalancerRule(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -8,11 +8,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceInUseException;
@Implementation(description="Deletes network group", responseObject=SuccessResponse.class)
@ -61,7 +56,7 @@ public class DeleteNetworkGroupCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
try{
boolean result = _networkGroupMgr.deleteNetworkGroup(this);
if (result) {
@ -71,7 +66,7 @@ public class DeleteNetworkGroupCmd extends BaseCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network group");
}
} catch (ResourceInUseException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, ex.getMessage());
}
}
}

View File

@ -26,11 +26,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Deletes a Pod.", responseObject=SuccessResponse.class)
public class DeletePodCmd extends BaseCmd {
@ -63,7 +58,7 @@ public class DeletePodCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _configService.deletePod(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -8,11 +8,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Deletes a storage pool.", responseObject=SuccessResponse.class)
public class DeletePoolCmd extends BaseCmd {
@ -46,7 +41,7 @@ public class DeletePoolCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _storageMgr.deletePool(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -25,11 +25,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Deletes a port forwarding rule", responseObject=SuccessResponse.class)
public class DeletePortForwardingRuleCmd extends BaseCmd {
@ -62,7 +57,7 @@ public class DeletePortForwardingRuleCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _networkMgr.deletePortForwardingRule(id,false);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -23,11 +23,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Unregisters PreallocatedLun", responseObject=SuccessResponse.class)
public class DeletePreallocatedLunCmd extends BaseCmd {
@ -58,7 +53,7 @@ public class DeletePreallocatedLunCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _mgr.unregisterPreallocatedLun(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -29,10 +29,6 @@ import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@ -112,7 +108,8 @@ public class DeleteRemoteAccessVpnCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
try {
boolean result = _networkMgr.destroyRemoteAccessVpn(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());
@ -120,6 +117,9 @@ public class DeleteRemoteAccessVpnCmd extends BaseAsyncCmd {
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete remote access vpn");
}
} catch (ConcurrentOperationException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
}
}
}

View File

@ -26,11 +26,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Deletes a service offering.", responseObject=SuccessResponse.class)
public class DeleteServiceOfferingCmd extends BaseCmd{
@ -64,7 +59,7 @@ public class DeleteServiceOfferingCmd extends BaseCmd{
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _configService.deleteServiceOffering(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -29,11 +29,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.storage.Snapshot;
import com.cloud.user.Account;
@ -88,7 +83,7 @@ public class DeleteSnapshotCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _snapshotMgr.deleteSnapshot(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -28,11 +28,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Deletes snapshot policies for the account.", responseObject=SuccessResponse.class)
public class DeleteSnapshotPoliciesCmd extends BaseCmd {
@ -74,7 +69,7 @@ public class DeleteSnapshotPoliciesCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _snapshotMgr.deleteSnapshotPolicies(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -29,11 +29,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.storage.VMTemplateVO;
import com.cloud.user.Account;
@ -100,7 +95,7 @@ public class DeleteTemplateCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _templateMgr.deleteTemplate(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -29,11 +29,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserContext;
@ -95,7 +90,7 @@ public class DeleteUserCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _accountService.deleteUser(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -25,11 +25,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Deletes a vm group", responseObject=SuccessResponse.class)
public class DeleteVMGroupCmd extends BaseCmd{
@ -61,7 +56,7 @@ public class DeleteVMGroupCmd extends BaseCmd{
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _userVmService.deleteVmGroup(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -26,11 +26,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Creates a VLAN IP range.", responseObject=SuccessResponse.class)
public class DeleteVlanIpRangeCmd extends BaseCmd {
@ -63,7 +58,7 @@ public class DeleteVlanIpRangeCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _configService.deleteVlanIpRange(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -26,11 +26,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Deletes a detached disk volume.", responseObject=SuccessResponse.class)
public class DeleteVolumeCmd extends BaseCmd {
@ -68,7 +63,7 @@ public class DeleteVolumeCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _storageMgr.deleteVolume(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -26,11 +26,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Deletes a Zone.", responseObject=SuccessResponse.class)
public class DeleteZoneCmd extends BaseCmd {
@ -65,7 +60,7 @@ public class DeleteZoneCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _configService.deleteZone(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -32,18 +32,13 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.UserVmResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.InsufficientStorageCapacityException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.StorageUnavailableException;
import com.cloud.storage.VMTemplateVO;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
import com.cloud.uservm.UserVm;
import com.cloud.utils.exception.ExecutionException;
@Implementation(description="Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.", responseObject=UserVmResponse.class)
public class DeployVMCmd extends BaseAsyncCmd {
@ -199,7 +194,7 @@ public class DeployVMCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException, StorageUnavailableException{
public void execute(){
try {
String password = null;
if (templateId != null ) {
@ -218,9 +213,13 @@ public class DeployVMCmd extends BaseAsyncCmd {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to deploy vm");
}
} catch (ResourceAllocationException ex) {
throw new ServerApiException(BaseCmd.RESOURCE_ALLOCATION_ERROR, ex.getMessage());
} catch (InsufficientStorageCapacityException ex) {
throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
} catch (StorageUnavailableException ex) {
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (Exception ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
} catch (ExecutionException ex1) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex1.getMessage());
}
}
}

View File

@ -33,10 +33,7 @@ import com.cloud.api.ServerApiException;
import com.cloud.api.response.UserVmResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@ -157,8 +154,9 @@ public class DeployVm2Cmd extends BaseAsyncCreateCmd {
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException{
public void execute(){
UserVm result;
try {
result = _userVmService.startVirtualMachine(this);
if (result != null) {
UserVmResponse response = ApiResponseHelper.createUserVm2Response(result);
@ -168,16 +166,31 @@ public class DeployVm2Cmd extends BaseAsyncCreateCmd {
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to deploy vm");
}
} catch (ResourceUnavailableException ex) {
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
} catch (InsufficientCapacityException ex) {
throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
}
}
@Override
public void callCreate() throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
public void callCreate() {
try {
UserVm vm = _userVmService.createVirtualMachine(this);
if (vm != null) {
this.setId(vm.getId());
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to deploy vm");
}
} catch (ResourceUnavailableException ex) {
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
} catch (InsufficientCapacityException ex) {
throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
}
}

View File

@ -28,11 +28,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@ -89,7 +84,7 @@ public class DestroyConsoleProxyCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _consoleProxyMgr.destroyConsoleProxy(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -29,11 +29,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.UserVmResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.StorageUnavailableException;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
@ -89,7 +84,7 @@ public class DestroyVMCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException, StorageUnavailableException{
public void execute(){
UserVm result = _userVmService.destroyVm(this);
if (result != null) {
UserVmResponse response = ApiResponseHelper.createUserVmResponse(result);

View File

@ -23,6 +23,7 @@ import com.cloud.api.ApiConstants;
import com.cloud.api.ApiDBUtils;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseAsyncCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
@ -88,10 +89,20 @@ public class DestroyVm2Cmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException{
public void execute(){
try {
UserVm result = _userVmService.destroyVm(this);
if (result != null) {
UserVmResponse response = ApiResponseHelper.createUserVmResponse(result);
response.setResponseName("virtualmachine");
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to destroy vm");
}
}catch (ConcurrentOperationException ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
}catch (ResourceUnavailableException ex) {
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
}
}
}

View File

@ -29,11 +29,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.UserVmResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
@ -88,7 +83,7 @@ public class DetachIsoCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _templateMgr.detachIso(this);
if (result) {
UserVm userVm = ApiDBUtils.findUserVmById(virtualMachineId);

View File

@ -29,11 +29,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.VolumeResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.storage.Volume;
import com.cloud.storage.VolumeVO;
import com.cloud.user.Account;
@ -124,7 +119,7 @@ public class DetachVolumeCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
Volume result = _userVmService.detachVolumeFromVM(this);
if (result != null){
VolumeResponse response = ApiResponseHelper.createVolumeResponse((VolumeVO)result);

View File

@ -28,11 +28,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.AccountResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@ -93,7 +88,7 @@ public class DisableAccountCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
Account result = _accountService.disableAccount(this);
if (result != null){
AccountResponse response = ApiResponseHelper.createAccountResponse(result);

View File

@ -28,11 +28,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.UserResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.user.Account;
import com.cloud.user.UserAccount;
import com.cloud.user.UserContext;
@ -88,7 +83,7 @@ public class DisableUserCmd extends BaseAsyncCmd {
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
UserAccount user = _accountService.disableUser(this);
if (user != null){
UserResponse response = ApiResponseHelper.createUserResponse(user);

View File

@ -25,11 +25,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Disassociates an ip address from the account.", responseObject=SuccessResponse.class)
public class DisassociateIPAddrCmd extends BaseCmd {
@ -62,7 +57,7 @@ public class DisassociateIPAddrCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
boolean result = _networkMgr.disassociateIpAddress(this);
if (result) {
SuccessResponse response = new SuccessResponse(getName());

View File

@ -26,11 +26,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.AccountResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.user.Account;
@Implementation(description="Enables an account", responseObject=AccountResponse.class)
@ -70,7 +65,7 @@ public class EnableAccountCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
Account result = _accountService.enableAccount(this);
if (result != null){
AccountResponse response = ApiResponseHelper.createAccountResponse(result);

View File

@ -27,11 +27,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.UserResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.user.UserAccount;
@Implementation(description="Enables a user account", responseObject=UserResponse.class)
@ -65,7 +60,7 @@ public class EnableUserCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
UserAccount user = _accountService.enableUser(this);
if (user != null){
UserResponse response = ApiResponseHelper.createUserResponse(user);

View File

@ -28,13 +28,7 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ExtractResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InternalErrorException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.storage.UploadVO;
import com.cloud.storage.VMTemplateVO;
import com.cloud.user.Account;
@ -115,7 +109,7 @@ public class ExtractIsoCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException{
public void execute(){
try {
Long uploadId = _templateMgr.extract(this);
if (uploadId != null){

View File

@ -28,13 +28,7 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ExtractResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InternalErrorException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.storage.UploadVO;
import com.cloud.storage.VMTemplateVO;
import com.cloud.user.Account;
@ -116,7 +110,7 @@ public class ExtractTemplateCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException{
public void execute(){
try {
Long uploadId = _templateMgr.extract(this);
if (uploadId != null){

View File

@ -30,12 +30,6 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ExtractResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.storage.UploadVO;
import com.cloud.storage.VolumeVO;
import com.cloud.user.Account;
@ -120,7 +114,7 @@ public class ExtractVolumeCmd extends BaseAsyncCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException{
public void execute(){
try {
Long uploadId = _mgr.extractVolume(this);
if (uploadId != null){

View File

@ -28,11 +28,6 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.CloudIdentifierResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Retrieves a cloud identifier.", responseObject=CloudIdentifierResponse.class)
public class GetCloudIdentifierCmd extends BaseCmd {
@ -65,18 +60,18 @@ public class GetCloudIdentifierCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
ArrayList<String> result = _mgr.getCloudIdentifierResponse(this);
CloudIdentifierResponse response = new CloudIdentifierResponse();
if (result != null) {
response.setCloudIdentifier(result.get(0));
response.setSignature(result.get(1));
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to get cloud identifier");
}
response.setObjectName("cloudidentifier");
response.setResponseName(getName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to get cloud identifier");
}
}
}

View File

@ -27,14 +27,8 @@ import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.AccountResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.user.AccountVO;
@Implementation(description="Lists accounts and provides detailed account information for listed accounts", responseObject=AccountResponse.class)
@ -110,7 +104,7 @@ public class ListAccountsCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<AccountVO> accounts = _mgr.searchForAccounts(this);
ListResponse<AccountResponse> response = new ListResponse<AccountResponse>();
List<AccountResponse> accountResponses = new ArrayList<AccountResponse>();
@ -119,7 +113,6 @@ public class ListAccountsCmd extends BaseListCmd {
acctResponse.setObjectName("account");
accountResponses.add(acctResponse);
}
response.setResponses(accountResponses);
response.setResponseName(getName());

View File

@ -27,14 +27,8 @@ import com.cloud.api.ApiConstants;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.AlertResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Lists all alerts.", responseObject=AlertResponse.class)
public class ListAlertsCmd extends BaseListCmd {
@ -68,7 +62,7 @@ public class ListAlertsCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<AlertVO> result = _mgr.searchForAlerts(this);
ListResponse<AlertResponse> response = new ListResponse<AlertResponse>();
List<AlertResponse> alertResponseList = new ArrayList<AlertResponse>();

View File

@ -27,15 +27,9 @@ import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ResponseObject;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.AsyncJobResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.async.AsyncJobVO;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Lists all pending asynchronous jobs for the account.", responseObject=AsyncJobResponse.class)
public class ListAsyncJobsCmd extends BaseListCmd {
@ -80,7 +74,7 @@ public class ListAsyncJobsCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<AsyncJobVO> result = _mgr.searchForAsyncJobs(this);
ListResponse<AsyncJobResponse> response = new ListResponse<AsyncJobResponse>();
List<AsyncJobResponse> jobResponses = new ArrayList<AsyncJobResponse>();

View File

@ -23,13 +23,7 @@ import org.apache.log4j.Logger;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.CapabilitiesResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Lists capabilities", responseObject=CapabilitiesResponse.class)
public class ListCapabilitiesCmd extends BaseCmd {
@ -43,7 +37,7 @@ public class ListCapabilitiesCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
Map<String, String> capabilities = _mgr.listCapabilities(this);
CapabilitiesResponse response = new CapabilitiesResponse();
response.setNetworkGroupsEnabled(capabilities.get("networkGroupsEnabled"));

View File

@ -34,15 +34,9 @@ import com.cloud.api.ApiDBUtils;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.CapacityResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.capacity.CapacityVO;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.server.Criteria;
import com.cloud.storage.Storage.StoragePoolType;
import com.cloud.storage.StoragePoolVO;
@ -200,7 +194,7 @@ public class ListCapacityCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<CapacityVO> result = _mgr.listCapacities(this);
ListResponse<CapacityResponse> response = new ListResponse<CapacityResponse>();
List<CapacityResponse> capacityResponses = new ArrayList<CapacityResponse>();

View File

@ -28,15 +28,9 @@ import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ConfigurationResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.configuration.ConfigurationVO;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Lists all configurations.", responseObject=ConfigurationResponse.class)
public class ListCfgsByCmd extends BaseListCmd {
@ -78,7 +72,7 @@ public class ListCfgsByCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<ConfigurationVO> result = _mgr.searchForConfigurations(this);
ListResponse<ConfigurationResponse> response = new ListResponse<ConfigurationResponse>();
List<ConfigurationResponse> configResponses = new ArrayList<ConfigurationResponse>();

View File

@ -28,15 +28,9 @@ import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ClusterResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.dc.ClusterVO;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Lists clusters.", responseObject=ClusterResponse.class)
public class ListClustersCmd extends BaseListCmd {
@ -91,7 +85,7 @@ public class ListClustersCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<ClusterVO> result = _mgr.searchForClusters(this);
ListResponse<ClusterResponse> response = new ListResponse<ClusterResponse>();
List<ClusterResponse> clusterResponses = new ArrayList<ClusterResponse>();

View File

@ -27,14 +27,8 @@ import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.DiskOfferingResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.storage.DiskOfferingVO;
@Implementation(description="Lists all available disk offerings.", responseObject=DiskOfferingResponse.class)
@ -82,7 +76,7 @@ public class ListDiskOfferingsCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<DiskOfferingVO> result = _mgr.searchForDiskOfferings(this);
ListResponse<DiskOfferingResponse> response = new ListResponse<DiskOfferingResponse>();
List<DiskOfferingResponse> diskOfferingResponses = new ArrayList<DiskOfferingResponse>();

View File

@ -27,15 +27,9 @@ import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.DomainResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.domain.DomainVO;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Lists all children domains belonging to a specified domain", responseObject=DomainResponse.class)
public class ListDomainChildrenCmd extends BaseListCmd {
@ -82,7 +76,7 @@ public class ListDomainChildrenCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<DomainVO> result = _mgr.searchForDomainChildren(this);
ListResponse<DomainResponse> response = new ListResponse<DomainResponse>();
List<DomainResponse> domainResponses = new ArrayList<DomainResponse>();

View File

@ -27,15 +27,9 @@ import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.DomainResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.domain.DomainVO;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Lists domains and provides detailed information for listed domains", responseObject=DomainResponse.class)
public class ListDomainsCmd extends BaseListCmd {
@ -82,7 +76,7 @@ public class ListDomainsCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<DomainVO> result = _mgr.searchForDomains(this);
ListResponse<DomainResponse> response = new ListResponse<DomainResponse>();
List<DomainResponse> domainResponses = new ArrayList<DomainResponse>();

View File

@ -28,15 +28,9 @@ import com.cloud.api.ApiDBUtils;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.EventResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.event.EventVO;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.user.User;
@Implementation(description="A command to list events.", responseObject=EventResponse.class)
@ -119,7 +113,7 @@ public class ListEventsCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<EventVO> result = _mgr.searchForEvents(this);
ListResponse<EventResponse> response = new ListResponse<EventResponse>();
List<EventResponse> eventResponses = new ArrayList<EventResponse>();

View File

@ -27,14 +27,8 @@ import com.cloud.api.ApiConstants;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.GuestOSCategoryResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.storage.GuestOSCategoryVO;
@Implementation(description="Lists all supported OS categories for this cloud.", responseObject=GuestOSCategoryResponse.class)
@ -70,7 +64,7 @@ public class ListGuestOsCategoriesCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<GuestOSCategoryVO> result = _mgr.listGuestOSCategoriesByCriteria(this);
ListResponse<GuestOSCategoryResponse> response = new ListResponse<GuestOSCategoryResponse>();
List<GuestOSCategoryResponse> osCatResponses = new ArrayList<GuestOSCategoryResponse>();

View File

@ -27,14 +27,8 @@ import com.cloud.api.ApiConstants;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.GuestOSResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.storage.GuestOSVO;
@Implementation(description="Lists all supported OS types for this cloud.", responseObject=GuestOSResponse.class)
@ -87,7 +81,7 @@ public class ListGuestOsCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<GuestOSVO> result = _mgr.listGuestOSByCriteria(this);
ListResponse<GuestOSResponse> response = new ListResponse<GuestOSResponse>();
List<GuestOSResponse> osResponses = new ArrayList<GuestOSResponse>();

View File

@ -28,14 +28,8 @@ import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.HostResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.host.HostVO;
@Implementation(description="Lists hosts.", responseObject=HostResponse.class)
@ -113,7 +107,7 @@ public class ListHostsCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<HostVO> result = _mgr.searchForServers(this);
ListResponse<HostResponse> response = new ListResponse<HostResponse>();

View File

@ -23,14 +23,8 @@ import org.apache.log4j.Logger;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.HypervisorResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="List hypervisors", responseObject=HypervisorResponse.class)
public class ListHypervisorsCmd extends BaseCmd {
@ -43,7 +37,7 @@ public class ListHypervisorsCmd extends BaseCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
String[] result = _mgr.getHypervisors(this);
ListResponse<HypervisorResponse> response = new ListResponse<HypervisorResponse>();
ArrayList<HypervisorResponse> responses = new ArrayList<HypervisorResponse>();

View File

@ -30,16 +30,10 @@ import com.cloud.api.ApiDBUtils;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.TemplateResponse;
import com.cloud.async.AsyncJobVO;
import com.cloud.dc.DataCenterVO;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.host.HostVO;
import com.cloud.storage.GuestOS;
import com.cloud.storage.VMTemplateHostVO;
@ -147,7 +141,7 @@ public class ListIsosCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<VMTemplateVO> isos = _mgr.listIsos(this);
TemplateFilter isoFilterObj = null;

View File

@ -27,14 +27,8 @@ import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.UserVmResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.vm.UserVmVO;
@Implementation(description="List all virtual machine instances that are assigned to a load balancer rule.", responseObject=UserVmResponse.class)
@ -75,7 +69,7 @@ public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<UserVmVO> result = _mgr.listLoadBalancerInstances(this);
ListResponse<UserVmResponse> response = new ListResponse<UserVmResponse>();
List<UserVmResponse> vmResponses = new ArrayList<UserVmResponse>();

View File

@ -28,14 +28,8 @@ import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.LoadBalancerResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.network.LoadBalancerVO;
@Implementation(description="Lists load balancer rules.", responseObject=LoadBalancerResponse.class)
@ -104,7 +98,7 @@ public class ListLoadBalancerRulesCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<LoadBalancerVO> loadBalancers = _mgr.searchForLoadBalancers(this);
ListResponse<LoadBalancerResponse> response = new ListResponse<LoadBalancerResponse>();
List<LoadBalancerResponse> lbResponses = new ArrayList<LoadBalancerResponse>();

View File

@ -27,17 +27,11 @@ import com.cloud.api.ApiDBUtils;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.IngressRuleResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.NetworkGroupResponse;
import com.cloud.async.executor.IngressRuleResultObject;
import com.cloud.async.executor.NetworkGroupResultObject;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.network.security.NetworkGroupRulesVO;
@Implementation(description="Lists network groups", responseObject=NetworkGroupResponse.class)
@ -92,7 +86,7 @@ public class ListNetworkGroupsCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<NetworkGroupRulesVO> networkGroups = _networkGroupMgr.searchForNetworkGroupRules(this);
List<NetworkGroupResultObject> groupResultObjs = NetworkGroupResultObject.transposeNetworkGroups(networkGroups);

View File

@ -28,15 +28,9 @@ import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.PodResponse;
import com.cloud.dc.HostPodVO;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Lists all Pods.", responseObject=PodResponse.class)
public class ListPodsByCmd extends BaseListCmd {
@ -84,7 +78,7 @@ public class ListPodsByCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<HostPodVO> result = _mgr.searchForPods(this);
ListResponse<PodResponse> response = new ListResponse<PodResponse>();
List<PodResponse> podResponses = new ArrayList<PodResponse>();

View File

@ -27,14 +27,8 @@ import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.FirewallRuleResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.network.FirewallRuleVO;
@Implementation(description="Lists all port forwarding rules for an IP address.", responseObject=FirewallRuleResponse.class)
@ -68,7 +62,7 @@ public class ListPortForwardingRulesCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<FirewallRuleVO> result = _networkMgr.listPortForwardingRules(this);
ListResponse<FirewallRuleResponse> response = new ListResponse<FirewallRuleResponse>();
List<FirewallRuleResponse> fwResponses = new ArrayList<FirewallRuleResponse>();

View File

@ -28,14 +28,8 @@ import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.PreallocatedLunResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.storage.preallocatedlun.PreallocatedLunVO;
@Implementation(responseObject=PreallocatedLunResponse.class)
@ -78,7 +72,7 @@ public class ListPreallocatedLunsCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<PreallocatedLunVO> preallocatedLuns = _mgr.getPreAllocatedLuns(this);
ListResponse<PreallocatedLunResponse> response = new ListResponse<PreallocatedLunResponse>();
List<PreallocatedLunResponse> lunResponses = new ArrayList<PreallocatedLunResponse>();

View File

@ -28,14 +28,8 @@ import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.IPAddressResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.network.IPAddressVO;
@Implementation(description="Lists all public ip addresses", responseObject=IPAddressResponse.class)
@ -111,7 +105,7 @@ public class ListPublicIpAddressesCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<IPAddressVO> result = _mgr.searchForIPAddresses(this);
ListResponse<IPAddressResponse> response = new ListResponse<IPAddressResponse>();
List<IPAddressResponse> ipAddrResponses = new ArrayList<IPAddressResponse>();

View File

@ -24,14 +24,8 @@ import com.cloud.api.ApiConstants;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.SnapshotScheduleResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.storage.SnapshotScheduleVO;
@Implementation(description="Lists recurring snapshot schedule", responseObject=SnapshotScheduleResponse.class)
@ -70,7 +64,7 @@ public class ListRecurringSnapshotScheduleCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<SnapshotScheduleVO> snapshotSchedules = _snapshotMgr.findRecurringSnapshotSchedule(this);
ListResponse<SnapshotScheduleResponse> response = new ListResponse<SnapshotScheduleResponse>();
List<SnapshotScheduleResponse> snapshotScheduleResponses = new ArrayList<SnapshotScheduleResponse>();

View File

@ -27,14 +27,8 @@ import com.cloud.api.ApiDBUtils;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.RemoteAccessVpnResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.network.RemoteAccessVpnVO;
import com.cloud.user.Account;
@ -103,7 +97,7 @@ public class ListRemoteAccessVpnsCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<RemoteAccessVpnVO> vpns = _mgr.searchForRemoteAccessVpns(this);
ListResponse<RemoteAccessVpnResponse> response = new ListResponse<RemoteAccessVpnResponse>();
List<RemoteAccessVpnResponse> vpnResponses = new ArrayList<RemoteAccessVpnResponse>();

View File

@ -28,16 +28,10 @@ import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.ResourceLimitResponse;
import com.cloud.configuration.ResourceLimit;
import com.cloud.configuration.ResourceLimitVO;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@Implementation(description="Lists resource limits.", responseObject=ResourceLimitResponse.class)
public class ListResourceLimitsCmd extends BaseListCmd {
@ -95,7 +89,7 @@ public class ListResourceLimitsCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<ResourceLimitVO> result = _accountService.searchForLimits(this);
ListResponse<ResourceLimitResponse> response = new ListResponse<ResourceLimitResponse>();
List<ResourceLimitResponse> limitResponses = new ArrayList<ResourceLimitResponse>();

View File

@ -28,14 +28,8 @@ import com.cloud.api.ApiResponseHelper;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.DomainRouterResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.vm.DomainRouter;
import com.cloud.vm.DomainRouterVO;
@ -112,7 +106,7 @@ public class ListRoutersCmd extends BaseListCmd {
}
@Override
public void execute() throws ServerApiException, InvalidParameterValueException, PermissionDeniedException, InsufficientAddressCapacityException, InsufficientCapacityException, ConcurrentOperationException{
public void execute(){
List<DomainRouterVO> result = _mgr.searchForRouters(this);
ListResponse<DomainRouterResponse> response = new ListResponse<DomainRouterResponse>();
List<DomainRouterResponse> routerResponses = new ArrayList<DomainRouterResponse>();

Some files were not shown because too many files have changed in this diff Show More