You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ni...@apache.org on 2013/12/11 09:24:52 UTC

[2/8] git commit: new operation: checkServiceLBExistenceAgainstPolicy

new operation: checkServiceLBExistenceAgainstPolicy


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

Branch: refs/heads/master
Commit: 4060378996f4f80d78096eb1b9cca8c9dfaa3088
Parents: f7f3878
Author: Nirmal Fernando <ni...@apache.org>
Authored: Wed Dec 11 13:36:37 2013 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Wed Dec 11 13:41:42 2013 +0530

----------------------------------------------------------------------
 .../autoscaler/api/AutoScalerServiceImpl.java   | 23 ++++++++++++++++++++
 .../interfaces/AutoScalerServiceInterface.java  |  1 +
 2 files changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/40603789/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java
index 71dde3b..842c014 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java
@@ -176,6 +176,29 @@ public class AutoScalerServiceImpl implements AutoScalerServiceInterface{
 	    
     }
 	
+	public boolean checkServiceLBExistenceAgainstPolicy(String serviceName, String deploymentPolicyId) {
+        Partition[] partitions = getPartitionsOfDeploymentPolicy(deploymentPolicyId);
+        
+        for (Partition partition : partitions) {
+            if (partition != null) {
+                NetworkPartitionContext nwPartitionCtxt =
+                                                          partitionManager.getNetworkPartitionOfPartition(partition.getId());
+                if (!nwPartitionCtxt.isServiceLBExist(serviceName)) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("Service LB [service name] "+serviceName+" does not exist in [network partition] " +
+                                  nwPartitionCtxt.getId() + " of [Deployment Policy] " +
+                                  deploymentPolicyId);
+
+                    }
+                    return false;
+                }
+            }
+        }
+        
+        return true;
+        
+    }
+	
 	public boolean checkClusterLBExistenceAgainstPolicy(String clusterId, String deploymentPolicyId) {
         Partition[] partitions = getPartitionsOfDeploymentPolicy(deploymentPolicyId);
         

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/40603789/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java
index 642a78e..a9b30de 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java
@@ -31,4 +31,5 @@ public interface AutoScalerServiceInterface {
 	public void checkLBExistenceAgainstPolicy(String lbClusterId, String deploymentPolicyId) throws NonExistingLBException;
 	public boolean checkDefaultLBExistenceAgainstPolicy(String deploymentPolicyId);
 	public boolean checkClusterLBExistenceAgainstPolicy(String clusterId, String deploymentPolicyId);
+	public boolean checkServiceLBExistenceAgainstPolicy(String serviceName, String deploymentPolicyId);
 }