diff --git a/api/src/com/cloud/api/commands/AddHostCmd.java b/api/src/com/cloud/api/commands/AddHostCmd.java index bfbd6904e8e..4674c69a14a 100644 --- a/api/src/com/cloud/api/commands/AddHostCmd.java +++ b/api/src/com/cloud/api/commands/AddHostCmd.java @@ -125,6 +125,7 @@ public class AddHostCmd extends BaseCmd { this.setResponseObject(response); } catch (DiscoveryException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); } } diff --git a/api/src/com/cloud/api/commands/AddSecondaryStorageCmd.java b/api/src/com/cloud/api/commands/AddSecondaryStorageCmd.java index 1c71ce50efd..91a8a380465 100644 --- a/api/src/com/cloud/api/commands/AddSecondaryStorageCmd.java +++ b/api/src/com/cloud/api/commands/AddSecondaryStorageCmd.java @@ -84,6 +84,7 @@ public class AddSecondaryStorageCmd extends BaseCmd { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add secondary storage"); } } catch (DiscoveryException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); } } diff --git a/api/src/com/cloud/api/commands/AddVpnUserCmd.java b/api/src/com/cloud/api/commands/AddVpnUserCmd.java index ca7a326e426..61d56fd6ea0 100644 --- a/api/src/com/cloud/api/commands/AddVpnUserCmd.java +++ b/api/src/com/cloud/api/commands/AddVpnUserCmd.java @@ -146,6 +146,7 @@ public class AddVpnUserCmd extends BaseAsyncCmd { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user"); } } catch (ConcurrentOperationException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); } } diff --git a/api/src/com/cloud/api/commands/AssociateIPAddrCmd.java b/api/src/com/cloud/api/commands/AssociateIPAddrCmd.java index 1ee8bb73e71..2badfe630f5 100644 --- a/api/src/com/cloud/api/commands/AssociateIPAddrCmd.java +++ b/api/src/com/cloud/api/commands/AssociateIPAddrCmd.java @@ -92,10 +92,14 @@ public class AssociateIPAddrCmd extends BaseCmd { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to assign ip address"); } } catch (ResourceAllocationException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.RESOURCE_ALLOCATION_ERROR, ex.getMessage()); } catch (ConcurrentOperationException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); } catch (InsufficientAddressCapacityException ex) { + s_logger.info(ex); + s_logger.trace(ex); throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); } } diff --git a/api/src/com/cloud/api/commands/CopyIsoCmd.java b/api/src/com/cloud/api/commands/CopyIsoCmd.java index 68a28934dd8..50e24c7450b 100644 --- a/api/src/com/cloud/api/commands/CopyIsoCmd.java +++ b/api/src/com/cloud/api/commands/CopyIsoCmd.java @@ -117,6 +117,7 @@ public class CopyIsoCmd extends BaseAsyncCmd { isoResponse.setResponseName(getName()); this.setResponseObject(isoResponse); } catch (StorageUnavailableException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } } diff --git a/api/src/com/cloud/api/commands/CopyTemplateCmd.java b/api/src/com/cloud/api/commands/CopyTemplateCmd.java index d347ce01a87..62f502cc3ca 100644 --- a/api/src/com/cloud/api/commands/CopyTemplateCmd.java +++ b/api/src/com/cloud/api/commands/CopyTemplateCmd.java @@ -119,6 +119,7 @@ public class CopyTemplateCmd extends BaseAsyncCmd { this.setResponseObject(templateResponse); } catch (StorageUnavailableException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } } diff --git a/api/src/com/cloud/api/commands/CreateLoadBalancerRuleCmd.java b/api/src/com/cloud/api/commands/CreateLoadBalancerRuleCmd.java index 345530e6d7d..aacd44282a4 100644 --- a/api/src/com/cloud/api/commands/CreateLoadBalancerRuleCmd.java +++ b/api/src/com/cloud/api/commands/CreateLoadBalancerRuleCmd.java @@ -110,6 +110,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd implements Lo try { result = _lbService.createLoadBalancerRule(this); } catch (NetworkRuleConflictException e) { + s_logger.warn("Exception: ", e); throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage()); } LoadBalancerResponse response = _responseGenerator.createLoadBalancerResponse(result); diff --git a/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java b/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java index bc3e2063da6..60b18b98432 100644 --- a/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java +++ b/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java @@ -116,6 +116,7 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements fwResponse.setResponseName(getName()); setResponseObject(fwResponse); } catch (NetworkRuleConflictException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage()); } } diff --git a/api/src/com/cloud/api/commands/CreateRemoteAccessVpnCmd.java b/api/src/com/cloud/api/commands/CreateRemoteAccessVpnCmd.java index cebffef0aba..cdc9b9912d4 100644 --- a/api/src/com/cloud/api/commands/CreateRemoteAccessVpnCmd.java +++ b/api/src/com/cloud/api/commands/CreateRemoteAccessVpnCmd.java @@ -167,8 +167,10 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create remote access vpn"); } } catch (ResourceUnavailableException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } catch (ConcurrentOperationException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); } } diff --git a/api/src/com/cloud/api/commands/CreateSnapshotCmd.java b/api/src/com/cloud/api/commands/CreateSnapshotCmd.java index abb1e4ef800..df5b2038053 100644 --- a/api/src/com/cloud/api/commands/CreateSnapshotCmd.java +++ b/api/src/com/cloud/api/commands/CreateSnapshotCmd.java @@ -136,6 +136,7 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + volumeId); } } catch (ResourceAllocationException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.RESOURCE_ALLOCATION_ERROR, ex.getMessage()); } } diff --git a/api/src/com/cloud/api/commands/CreateStoragePoolCmd.java b/api/src/com/cloud/api/commands/CreateStoragePoolCmd.java index d84f971f5b8..0474d395222 100644 --- a/api/src/com/cloud/api/commands/CreateStoragePoolCmd.java +++ b/api/src/com/cloud/api/commands/CreateStoragePoolCmd.java @@ -118,10 +118,13 @@ public class CreateStoragePoolCmd extends BaseCmd { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add storage pool"); } } catch (ResourceAllocationException ex1) { + s_logger.warn("Exception: ", ex1); throw new ServerApiException(BaseCmd.RESOURCE_ALLOCATION_ERROR, ex1.getMessage()); }catch (ResourceInUseException ex2) { + s_logger.warn("Exception: ", ex2); throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, ex2.getMessage()); } catch (UnknownHostException ex3) { + s_logger.warn("Exception: ", ex3); throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex3.getMessage()); } } diff --git a/api/src/com/cloud/api/commands/CreateVlanIpRangeCmd.java b/api/src/com/cloud/api/commands/CreateVlanIpRangeCmd.java index c46b3ae0dc1..ce4dffbc955 100644 --- a/api/src/com/cloud/api/commands/CreateVlanIpRangeCmd.java +++ b/api/src/com/cloud/api/commands/CreateVlanIpRangeCmd.java @@ -136,8 +136,10 @@ public class CreateVlanIpRangeCmd extends BaseCmd { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create vlan ip range"); } } catch (ConcurrentOperationException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); } catch (InsufficientCapacityException ex) { + s_logger.info(ex); throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); } } diff --git a/api/src/com/cloud/api/commands/DeleteRemoteAccessVpnCmd.java b/api/src/com/cloud/api/commands/DeleteRemoteAccessVpnCmd.java index dd3ded9a509..d99ca7ace94 100644 --- a/api/src/com/cloud/api/commands/DeleteRemoteAccessVpnCmd.java +++ b/api/src/com/cloud/api/commands/DeleteRemoteAccessVpnCmd.java @@ -118,6 +118,7 @@ public class DeleteRemoteAccessVpnCmd extends BaseAsyncCmd { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete remote access vpn"); } } catch (ConcurrentOperationException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); } } diff --git a/api/src/com/cloud/api/commands/ExtractIsoCmd.java b/api/src/com/cloud/api/commands/ExtractIsoCmd.java index 9c82c801e99..f5021c81779 100755 --- a/api/src/com/cloud/api/commands/ExtractIsoCmd.java +++ b/api/src/com/cloud/api/commands/ExtractIsoCmd.java @@ -128,6 +128,7 @@ public class ExtractIsoCmd extends BaseAsyncCmd { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to extract iso"); } } catch (InternalErrorException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); } } diff --git a/api/src/com/cloud/api/commands/ExtractVolumeCmd.java b/api/src/com/cloud/api/commands/ExtractVolumeCmd.java index 6fc46176cb1..d4b47426dfc 100755 --- a/api/src/com/cloud/api/commands/ExtractVolumeCmd.java +++ b/api/src/com/cloud/api/commands/ExtractVolumeCmd.java @@ -146,7 +146,8 @@ public class ExtractVolumeCmd extends BaseAsyncCmd { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to extract volume"); } } catch (URISyntaxException ex) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + s_logger.info(ex); + throw new ServerApiException(BaseCmd.PARAM_ERROR, ex.getMessage()); } } } diff --git a/api/src/com/cloud/api/commands/ReconnectHostCmd.java b/api/src/com/cloud/api/commands/ReconnectHostCmd.java index 124670e6b09..332fe23b07a 100644 --- a/api/src/com/cloud/api/commands/ReconnectHostCmd.java +++ b/api/src/com/cloud/api/commands/ReconnectHostCmd.java @@ -108,6 +108,7 @@ public class ReconnectHostCmd extends BaseAsyncCmd { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reconnect host"); } } catch (AgentUnavailableException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } } diff --git a/api/src/com/cloud/api/commands/RecoverVMCmd.java b/api/src/com/cloud/api/commands/RecoverVMCmd.java index cc7b0eb7d5c..9549cb8c63a 100644 --- a/api/src/com/cloud/api/commands/RecoverVMCmd.java +++ b/api/src/com/cloud/api/commands/RecoverVMCmd.java @@ -71,6 +71,7 @@ public class RecoverVMCmd extends BaseCmd { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to recover vm"); } } catch (ResourceAllocationException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.RESOURCE_ALLOCATION_ERROR, ex.getMessage()); } } diff --git a/api/src/com/cloud/api/commands/RegisterIsoCmd.java b/api/src/com/cloud/api/commands/RegisterIsoCmd.java index 811b0a458e2..9f7f9bca459 100755 --- a/api/src/com/cloud/api/commands/RegisterIsoCmd.java +++ b/api/src/com/cloud/api/commands/RegisterIsoCmd.java @@ -134,6 +134,7 @@ public class RegisterIsoCmd extends BaseCmd { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to register iso"); } } catch (ResourceAllocationException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.RESOURCE_ALLOCATION_ERROR, ex.getMessage()); } } diff --git a/api/src/com/cloud/api/commands/RegisterTemplateCmd.java b/api/src/com/cloud/api/commands/RegisterTemplateCmd.java index f8e528513f2..9cf02d18afb 100755 --- a/api/src/com/cloud/api/commands/RegisterTemplateCmd.java +++ b/api/src/com/cloud/api/commands/RegisterTemplateCmd.java @@ -177,9 +177,11 @@ public class RegisterTemplateCmd extends BaseCmd { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to register template"); } } catch (ResourceAllocationException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.RESOURCE_ALLOCATION_ERROR, ex.getMessage()); } catch (URISyntaxException ex1) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex1.getMessage()); + s_logger.info(ex1); + throw new ServerApiException(BaseCmd.PARAM_ERROR, ex1.getMessage()); } } } diff --git a/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java b/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java index 125ce75ff8f..35c1c094af0 100644 --- a/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java +++ b/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java @@ -121,6 +121,7 @@ public class RemoveVpnUserCmd extends BaseAsyncCmd { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to remove vpn user"); } } catch (ConcurrentOperationException ex) { + s_logger.warn("Exception: ", ex); throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); } }