You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ra...@apache.org on 2015/02/25 12:29:44 UTC

stratos git commit: throwing exception if couldn't get the deployment policy/network partion from cc

Repository: stratos
Updated Branches:
  refs/heads/4.1.0-beta-deployment-policy-fix 8f4005e39 -> 5870a583c


throwing exception if couldn't get the deployment policy/network partion from cc


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/5870a583
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/5870a583
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/5870a583

Branch: refs/heads/4.1.0-beta-deployment-policy-fix
Commit: 5870a583cb1922a8fbbab893ed5f16523d636d0e
Parents: 8f4005e
Author: R-Rajkumar <rr...@gmail.com>
Authored: Wed Feb 25 16:59:23 2015 +0530
Committer: R-Rajkumar <rr...@gmail.com>
Committed: Wed Feb 25 16:59:23 2015 +0530

----------------------------------------------------------------------
 .../autoscaler/context/cluster/ClusterContext.java    | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/5870a583/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java
index cfa2756..c2b5242 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java
@@ -27,6 +27,7 @@ import org.apache.stratos.autoscaler.applications.ApplicationHolder;
 import org.apache.stratos.autoscaler.context.member.MemberStatsContext;
 import org.apache.stratos.autoscaler.context.partition.ClusterLevelPartitionContext;
 import org.apache.stratos.autoscaler.context.partition.network.ClusterLevelNetworkPartitionContext;
+import org.apache.stratos.autoscaler.exception.AutoScalerException;
 import org.apache.stratos.autoscaler.exception.partition.PartitionValidationException;
 import org.apache.stratos.autoscaler.exception.policy.PolicyValidationException;
 import org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy;
@@ -121,10 +122,9 @@ public class ClusterContext extends AbstractClusterContext {
    	 	try {
    	 		deploymentPolicy = CloudControllerServiceClient.getInstance().getDeploymentPolicy(deploymentPolicyName);
    	 	} catch (Exception e) {
-   	 		String msg = String.format("Error while getting deployment policy from cloud controller [deployment-policy-id] %s", clusterId);
+   	 		String msg = String.format("Error while getting deployment policy from cloud controller [deployment-policy-id] %s", deploymentPolicyName);
    	 		log.error(msg, e);
-   	 		//TODO throw an exception
-   	 		return;
+   	 		throw new AutoScalerException(msg, e);
    	 	}
         
         if (networkPartitionCtxts.containsKey(clusterInstance.getNetworkPartitionId())) {
@@ -179,10 +179,9 @@ public class ClusterContext extends AbstractClusterContext {
 		} catch (Exception e) {
 			String msg = String
 					.format("Error while getting deployment policy from cloud controller [deployment-policy-id] %s",
-							clusterId);
+							deploymentPolicyName);
 			log.error(msg, e);
-			// TODO throw an exception
-			return null;
+			throw new AutoScalerException(msg, e);
 		}
 
 		// TODO introduce methods in network/partition reference classes
@@ -293,8 +292,7 @@ public class ClusterContext extends AbstractClusterContext {
 		} catch (Exception e) {
 			String msg = String.format("Error while getting network partitioin from cloud controller : [network-partition-id] %s", nPartitionId);
 			log.error(msg, e);
-			//TODO thrown an exception
-			return null;
+			throw new AutoScalerException(msg, e);
 		}
 		
         Partition partition = null;