Author: asavu
Date: Thu Apr 26 22:11:47 2012
New Revision: 1331128

URL: http://svn.apache.org/viewvc?rev=1331128&view=rev
Log:
WHIRR-494. Update the BYON cluster controller to support all the operations the 
regular controller supports (Cosmin Dumitrache via asavu)

Modified:
    whirr/trunk/CHANGES.txt
    whirr/trunk/core/src/main/java/org/apache/whirr/ByonClusterController.java
    whirr/trunk/core/src/main/java/org/apache/whirr/service/ComputeCache.java

Modified: whirr/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/whirr/trunk/CHANGES.txt?rev=1331128&r1=1331127&r2=1331128&view=diff
==============================================================================
--- whirr/trunk/CHANGES.txt (original)
+++ whirr/trunk/CHANGES.txt Thu Apr 26 22:11:47 2012
@@ -110,6 +110,9 @@ Trunk (unreleased changes)
 
     WHIRR-572. Ensure ZooKeeper data directories are created. (tomwhite)
 
+    WHIRR-494. Update the BYON cluster controller to support all the 
operations the 
+    regular controller supports (Cosmin Dumitrache via asavu)
+
 Release 0.7.1 - 2012-02-23
 
   IMPROVEMENTS

Modified: 
whirr/trunk/core/src/main/java/org/apache/whirr/ByonClusterController.java
URL: 
http://svn.apache.org/viewvc/whirr/trunk/core/src/main/java/org/apache/whirr/ByonClusterController.java?rev=1331128&r1=1331127&r2=1331128&view=diff
==============================================================================
--- whirr/trunk/core/src/main/java/org/apache/whirr/ByonClusterController.java 
(original)
+++ whirr/trunk/core/src/main/java/org/apache/whirr/ByonClusterController.java 
Thu Apr 26 22:11:47 2012
@@ -56,30 +56,50 @@ public class ByonClusterController exten
     return "byon";
   }
 
-  public Cluster launchCluster(ClusterSpec clusterSpec) throws IOException,
+  /**
+   * Destroys a whirr BYON cluster.
+   * Because this is a BYON cluster it also stops the services.
+   */
+  @Override
+  public void destroyCluster(ClusterSpec clusterSpec) throws IOException,
       InterruptedException {
-
+    stopServices(clusterSpec); // for BYON only
     LoadingCache<String, ClusterActionHandler> handlerMap = handlerMapFactory
         .create();
-
-    ClusterAction bootstrapper = new ByonClusterAction(BOOTSTRAP_ACTION, 
getCompute(), handlerMap);
+    ClusterAction destroyer = new ByonClusterAction(DESTROY_ACTION,
+        getCompute(), handlerMap);
+    destroyer.execute(clusterSpec, null);
+  }
+  
+  /**
+   * Provisions the hardware for a BYON cluster.
+   */
+  @Override
+  public Cluster bootstrapCluster(ClusterSpec clusterSpec) throws IOException,
+      InterruptedException {
+    LoadingCache<String, ClusterActionHandler> handlerMap = handlerMapFactory
+        .create();
+    ClusterAction bootstrapper = new ByonClusterAction(BOOTSTRAP_ACTION,
+        getCompute(), handlerMap);
     Cluster cluster = bootstrapper.execute(clusterSpec, null);
-
-    ClusterAction configurer = new ByonClusterAction(CONFIGURE_ACTION, 
getCompute(), handlerMap);
-    cluster = configurer.execute(clusterSpec, cluster);
-
     getClusterStateStore(clusterSpec).save(cluster);
-    
     return cluster;
   }
 
-  public void destroyCluster(ClusterSpec clusterSpec) throws IOException,
-      InterruptedException {
+  /**
+   * Configures cluster services for a BYON cluster.
+   */
+  @Override
+  public Cluster configureServices(ClusterSpec clusterSpec, Cluster cluster,
+      Set<String> targetRoles, Set<String> targetInstanceIds)
+      throws IOException, InterruptedException {
     LoadingCache<String, ClusterActionHandler> handlerMap = handlerMapFactory
         .create();
-
-    ClusterAction destroyer = new ByonClusterAction(DESTROY_ACTION, 
getCompute(), handlerMap);
-    destroyer.execute(clusterSpec, null);
+    ClusterAction configurer = new ByonClusterAction(CONFIGURE_ACTION,
+        getCompute(), handlerMap);
+    cluster = configurer.execute(clusterSpec, cluster);
+    getClusterStateStore(clusterSpec).save(cluster);
+    return cluster;
   }
   
   public Map<? extends NodeMetadata, ExecResponse> 
runScriptOnNodesMatching(final ClusterSpec spec,

Modified: 
whirr/trunk/core/src/main/java/org/apache/whirr/service/ComputeCache.java
URL: 
http://svn.apache.org/viewvc/whirr/trunk/core/src/main/java/org/apache/whirr/service/ComputeCache.java?rev=1331128&r1=1331127&r2=1331128&view=diff
==============================================================================
--- whirr/trunk/core/src/main/java/org/apache/whirr/service/ComputeCache.java 
(original)
+++ whirr/trunk/core/src/main/java/org/apache/whirr/service/ComputeCache.java 
Thu Apr 26 22:11:47 2012
@@ -210,7 +210,7 @@ public enum ComputeCache implements Func
    * configurable properties, scoped to a provider.
    */
   public static final Iterable<String> PROVIDER_PROPERTIES = ImmutableSet.of(
-    "endpoint", "api", "apiversion", "iso3166-codes");
+    "endpoint", "api", "apiversion", "iso3166-codes","nodes");
 
   /**
    * Key class for the compute context cache


Reply via email to