You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vg...@apache.org on 2011/10/26 21:58:59 UTC

svn commit: r1189417 - in /incubator/ambari/trunk: ./ client/src/main/java/org/apache/ambari/client/ controller/src/main/java/org/apache/ambari/controller/ controller/src/main/java/org/apache/ambari/controller/rest/resources/

Author: vgogate
Date: Wed Oct 26 19:58:58 2011
New Revision: 1189417

URL: http://svn.apache.org/viewvc?rev=1189417&view=rev
Log:
AMBARI-105

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterCreate.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClusterResource.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClustersResource.java

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1189417&r1=1189416&r2=1189417&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Wed Oct 26 19:58:58 2011
@@ -2,6 +2,8 @@ Ambari Change log
 
 Release 0.1.0 - unreleased
 
+  AMBARI-105. Remove post on clusters resource to create new cluster (instead use put operation on cluster resource along with update cluster) (vgogate)
+
   AMBARI-104. Polishes the CLI doc some (ddas)
 
   AMBARI-103. Refactor agent entities package to 

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterCreate.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterCreate.java?rev=1189417&r1=1189416&r2=1189417&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterCreate.java (original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterCreate.java Wed Oct 26 19:58:58 2011
@@ -241,7 +241,7 @@ public class ClusterCreate extends Comma
         /*
          * Create cluster
          */
-        ClientResponse response = service.path("clusters").queryParam("dry_run", dry_run).accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON).post(ClientResponse.class, clsDef);
+        ClientResponse response = service.path("clusters/"+line.getOptionValue("name")).queryParam("dry_run", dry_run).accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON).put(ClientResponse.class, clsDef);
         if (response.getStatus() != 200) { 
             System.err.println("Cluster create command failed. Reason [Code: <"+response.getStatus()+">, Message: <"+response.getHeaders().getFirst("ErrorMessage")+">]");
             System.exit(-1);

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java?rev=1189417&r1=1189416&r2=1189417&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java Wed Oct 26 19:58:58 2011
@@ -183,105 +183,236 @@ public class Clusters {
     }
     
     /* 
-     * Add new Cluster to cluster list 
-     * Validate the cluster definition
-     * Lock the cluster list
-     *   -- Check if cluster with given name already exist?
-     *   -- Set the cluster state and timestamps 
-     *   -- Reserve the nodes. i.e. add the cluster and role referenes to Node
-     *   -- Throw exception, if some nodes are already preallocated to other cluster.
-     *   -- Persist the cluster definition as revision 0 and list of node names against cluster & service:role 
-     *   -- Background daemon should trigger the agent installation on the new nodes (UNREGISTERED), if not done already. 
-     *      (daemon can keep track of which nodes agent is already installed or check it by ssh to nodes, if nodes added
-     *       are in UNREGISTERED state).  
-     */   
-    public ClusterDefinition addCluster(ClusterDefinition cdef, boolean dry_run) throws Exception {
-
+     * Create/Update cluster definition 
+     * TODO: As nodes or role to node association changes, validate key services nodes are not removed
+    */
+    public ClusterDefinition updateCluster(String clusterName, ClusterDefinition c, boolean dry_run) throws Exception {
+        
         /*
-         * TODO: Validate the cluster definition and set the default
+         * if cluster does not exist create it  
          */
-        validateClusterDefinition(cdef);
+        synchronized (this.operational_clusters) {
+            if (!this.operational_clusters.containsKey(clusterName)) {
+                return addCluster(c, dry_run);
+            }
+        }
         
-        synchronized (operational_clusters) {
-            /* 
-             * Check if cluster already exist
-             */
-            if (operational_clusters.containsKey(cdef.getName())) {
-                String msg = "Cluster ["+cdef.getName()+"] already exists";
-                throw new WebApplicationException((new ExceptionResponse(msg, Response.Status.CONFLICT)).get());
+        Cluster cls = this.operational_clusters.get(clusterName);
+        /*
+         * Time being we will keep entire updated copy as new revision
+         */
+        ClusterDefinition newcd = new ClusterDefinition ();
+        
+        synchronized (cls.getClusterDefinitionRevisionsList()) {
+            newcd.setName(clusterName);
+            if (c.getBlueprintName() != null) {
+                newcd.setBlueprintName(c.getBlueprintName());
+            } else {
+                newcd.setBlueprintName(cls.getLatestClusterDefinition().getBlueprintName());
             }
- 
+            if (c.getBlueprintRevision() != null) {
+                newcd.setBlueprintRevision(c.getBlueprintRevision());
+            } else {
+                newcd.setBlueprintRevision(cls.getLatestClusterDefinition().getBlueprintRevision());
+            }
+            if (c.getDescription() != null) {
+                newcd.setDescription(c.getDescription());
+            } else {
+                newcd.setDescription(cls.getLatestClusterDefinition().getDescription());
+            }
+            if (c.getGoalState() != null) {
+                newcd.setGoalState(c.getGoalState());
+            } else {
+                newcd.setGoalState(cls.getLatestClusterDefinition().getGoalState());
+            }
+            if (c.getActiveServices() != null) {
+                newcd.setActiveServices(c.getActiveServices());
+            } else {
+                newcd.setActiveServices(cls.getLatestClusterDefinition().getActiveServices());
+            }
+            
             /*
-             * Create new cluster object
+             * TODO: What if controller is crashed after updateClusterNodesReservation 
+             * before updating and adding new revision of cluster definition?
              */
-            Date requestTime = new Date();
-            Cluster cls = new Cluster();
-            ClusterState clsState = new ClusterState();
-            clsState.setCreationTime(requestTime);
-            clsState.setLastUpdateTime(requestTime);
-            clsState.setDeployTime((Date)null);          
-            if (cdef.getGoalState().equals(ClusterDefinition.GOAL_STATE_ATTIC)) {
-                clsState.setState(ClusterState.CLUSTER_STATE_ATTIC);
+            boolean updateNodesReservation = false;
+            boolean updateNodeToRolesAssociation = false;
+            if (c.getNodes() != null) {
+                newcd.setNodes(c.getNodes());
+                updateNodesReservation = true;
+                
             } else {
-                clsState.setState(ClusterDefinition.GOAL_STATE_INACTIVE);
+                newcd.setNodes(cls.getLatestClusterDefinition().getNodes());
             }
-            cls.addClusterDefinition(cdef);
-            cls.setClusterState(clsState);
+            if (c.getRoleToNodes() != null) {
+                newcd.setRoleToNodesMap(c.getRoleToNodes());
+                updateNodeToRolesAssociation = true;
+                
+            }  
             
             /*
-             * If dry run then update roles to nodes map, if not specified explicitly
-             * and return
+             * if Cluster goal state is ATTIC then no need to take any action other than
+             * updating the cluster definition.
              */
-            if (dry_run) {
-                List<RoleToNodes> role2NodesList = generateRoleToNodesListBasedOnNodeAttributes (cdef);
-                cdef.setRoleToNodesMap(role2NodesList);
-                return cdef;
+            if (newcd.getGoalState().equals(ClusterState.CLUSTER_STATE_ATTIC)) {
+                cls.getClusterState().setLastUpdateTime(new Date());
+                cls.addClusterDefinition(newcd);
+                /*
+                 * TODO: Persist the latest cluster definition under new revision
+                 */
+                return cls.getLatestClusterDefinition();
             }
             
             /*
-             * Update cluster nodes reservation. 
+             * Validate the updated cluster definition
+             */
+            validateClusterDefinition(newcd);
+            
+            /*
+             * TODO: If dry_run then return the newcd at this point
              */
-            if (cdef.getNodes() != null 
-                && !cdef.getGoalState().equals(ClusterDefinition.GOAL_STATE_ATTIC)) {
-                updateClusterNodesReservation (cls.getName(), cdef);
+            if (dry_run) {
+                System.out.println ("Dry run for update cluster..");
+                return newcd;
             }
             
             /*
-             * Update the Node to Roles association, if specified
-             * If role is not explicitly associated w/ any node, then assign it w/ default role
-             * If RoleToNodes list is not specified then derive it based on the node attributes  
+             * Update the nodes reservation and node to roles association 
              */
-            if (!cdef.getGoalState().equals(ClusterDefinition.GOAL_STATE_ATTIC)) {
-                if (cdef.getRoleToNodes() == null) {
-                    /*
-                     * TODO: Derive the role to nodes map based on nodes attributes
-                     * then populate the node to roles association.
-                     */
-                    List<RoleToNodes> role2NodesList = generateRoleToNodesListBasedOnNodeAttributes (cdef);
-                    cdef.setRoleToNodesMap(role2NodesList);
-                }
-                updateNodeToRolesAssociation(cdef.getNodes(), cdef.getRoleToNodes());
+            if (updateNodesReservation) {
+                updateClusterNodesReservation (cls.getName(), c);   
+            }
+            if (updateNodeToRolesAssociation) {
+                updateNodeToRolesAssociation(newcd.getNodes(), c.getRoleToNodes());
             }
             
             /*
-             * TODO: Persist the cluster definition to data store as a initial version r0. 
-             *          Persist reserved nodes against the cluster & service/role
+             *  Update the last update time & revision
+             */
+            cls.getClusterState().setLastUpdateTime(new Date());
+            cls.addClusterDefinition(newcd);
+            
+            /*
+             * TODO: Persist the latest cluster definition under new revision
              */
-                
-            // Add the cluster to the list, after definition is persisted
-            this.operational_clusters.put(cdef.getName(), cls);
             
             /*
-             * Activate the cluster if the goal state is ACTIVE
-             * TODO: What to do if activate fails ??? 
-            */
-            if(cdef.getGoalState().equals(ClusterDefinition.GOAL_STATE_ACTIVE)) {          
-                org.apache.ambari.resource.statemachine.ClusterFSM cs = 
-                    StateMachineInvoker.createCluster(cls,cls.getLatestRevision(),
-                        cls.getClusterState());
-                cs.activate();
+             * Invoke state machine event
+             */
+            ClusterFSM clusterFSM = StateMachineInvoker.
+                getStateMachineClusterInstance(cls.getName());
+            if(c.getGoalState().equals(ClusterState.CLUSTER_STATE_ACTIVE)) {
+              clusterFSM.activate();
+            } else if(c.getGoalState().
+                equals(ClusterState.CLUSTER_STATE_INACTIVE)) {
+              clusterFSM.deactivate();
+            } else if(c.getGoalState().
+                equals(ClusterState.CLUSTER_STATE_ATTIC)) {
+              clusterFSM.deactivate();
+              clusterFSM.terminate();
             }
         }
+        return cls.getLatestClusterDefinition();
+    }
+    
+    /* 
+     * Add new Cluster to cluster list 
+     * Validate the cluster definition
+     * Lock the cluster list
+     *   -- Check if cluster with given name already exist?
+     *   -- Set the cluster state and timestamps 
+     *   -- Reserve the nodes. i.e. add the cluster and role referenes to Node
+     *   -- Throw exception, if some nodes are already preallocated to other cluster.
+     *   -- Persist the cluster definition as revision 0 and list of node names against cluster & service:role 
+     *   -- Background daemon should trigger the agent installation on the new nodes (UNREGISTERED), if not done already. 
+     *      (daemon can keep track of which nodes agent is already installed or check it by ssh to nodes, if nodes added
+     *       are in UNREGISTERED state).  
+     */   
+    private ClusterDefinition addCluster(ClusterDefinition cdef, boolean dry_run) throws Exception {
+
+        /*
+         * TODO: Validate the cluster definition and set the default
+         */
+        validateClusterDefinition(cdef);
+        
+        /* 
+         * Check if cluster already exist
+         */
+        if (operational_clusters.containsKey(cdef.getName())) {
+            String msg = "Cluster ["+cdef.getName()+"] already exists";
+                throw new WebApplicationException((new ExceptionResponse(msg, Response.Status.CONFLICT)).get());
+            }
+ 
+            /*
+         * Create new cluster object
+         */
+        Date requestTime = new Date();
+        Cluster cls = new Cluster();
+        ClusterState clsState = new ClusterState();
+        clsState.setCreationTime(requestTime);
+        clsState.setLastUpdateTime(requestTime);
+        clsState.setDeployTime((Date)null);          
+        if (cdef.getGoalState().equals(ClusterDefinition.GOAL_STATE_ATTIC)) {
+            clsState.setState(ClusterState.CLUSTER_STATE_ATTIC);
+        } else {
+            clsState.setState(ClusterDefinition.GOAL_STATE_INACTIVE);
+        }
+        cls.addClusterDefinition(cdef);
+        cls.setClusterState(clsState);
+        
+        /*
+         * If dry run then update roles to nodes map, if not specified explicitly
+         * and return
+         */
+        if (dry_run) {
+            List<RoleToNodes> role2NodesList = generateRoleToNodesListBasedOnNodeAttributes (cdef);
+            cdef.setRoleToNodesMap(role2NodesList);
+            return cdef;
+        }
+        
+        /*
+         * Update cluster nodes reservation. 
+         */
+        if (cdef.getNodes() != null 
+            && !cdef.getGoalState().equals(ClusterDefinition.GOAL_STATE_ATTIC)) {
+            updateClusterNodesReservation (cls.getName(), cdef);
+        }
+        
+        /*
+         * Update the Node to Roles association, if specified
+         * If role is not explicitly associated w/ any node, then assign it w/ default role
+         * If RoleToNodes list is not specified then derive it based on the node attributes  
+         */
+        if (!cdef.getGoalState().equals(ClusterDefinition.GOAL_STATE_ATTIC)) {
+            if (cdef.getRoleToNodes() == null) {
+                /*
+                 * TODO: Derive the role to nodes map based on nodes attributes
+                 * then populate the node to roles association.
+                 */
+                List<RoleToNodes> role2NodesList = generateRoleToNodesListBasedOnNodeAttributes (cdef);
+                cdef.setRoleToNodesMap(role2NodesList);
+            }
+            updateNodeToRolesAssociation(cdef.getNodes(), cdef.getRoleToNodes());
+        }
+        
+        /*
+         * TODO: Persist the cluster definition to data store as a initial version r0. 
+         *          Persist reserved nodes against the cluster & service/role
+         */
+            
+        // Add the cluster to the list, after definition is persisted
+        this.operational_clusters.put(cdef.getName(), cls);
+        
+        /*
+         * Activate the cluster if the goal state is ACTIVE
+         * TODO: What to do if activate fails ??? 
+        */
+        if(cdef.getGoalState().equals(ClusterDefinition.GOAL_STATE_ACTIVE)) {          
+            org.apache.ambari.resource.statemachine.ClusterFSM cs = 
+                StateMachineInvoker.createCluster(cls,cls.getLatestRevision(),
+                    cls.getClusterState());
+            cs.activate();
+        }
         return cdef;
     } 
     
@@ -532,146 +663,7 @@ public class Clusters {
         return bp;
     }
     
-    /* 
-     * Update cluster definition 
-     * TODO: As nodes or role to node association changes, validate key services nodes are not removed
-     * TODO: Don't allow update of blueprint name/version if cluster is in ACTIVE/INACTIVE state
-    */
-    public ClusterDefinition updateCluster(String clusterName, ClusterDefinition c, boolean dry_run) throws Exception {
-        
-        /*
-         * Validate cluster definition
-         */
-        if (c.getName() == null || c.getName().equals("") || !c.getName().equals(clusterName)) {
-            String msg = "Cluster name in resource URI ["+clusterName+"] does not match with one specified in update request element";
-            throw new WebApplicationException((new ExceptionResponse(msg, Response.Status.BAD_REQUEST)).get());
-        }
-        
-        /*
-         * Check if cluster already exist.  
-         */
-        if (!this.operational_clusters.containsKey(clusterName)) {
-            String msg = "Cluster ["+clusterName+"] does not exist";
-            throw new WebApplicationException((new ExceptionResponse(msg, Response.Status.NOT_FOUND)).get());
-        }
-        
-        Cluster cls = this.operational_clusters.get(clusterName);
-        /*
-         * Time being we will keep entire updated copy as new revision
-         */
-        ClusterDefinition newcd = new ClusterDefinition ();
-        
-        synchronized (cls.getClusterDefinitionRevisionsList()) {
-            newcd.setName(clusterName);
-            if (c.getBlueprintName() != null) {
-                newcd.setBlueprintName(c.getBlueprintName());
-            } else {
-                newcd.setBlueprintName(cls.getLatestClusterDefinition().getBlueprintName());
-            }
-            if (c.getBlueprintRevision() != null) {
-                newcd.setBlueprintRevision(c.getBlueprintRevision());
-            } else {
-                newcd.setBlueprintRevision(cls.getLatestClusterDefinition().getBlueprintRevision());
-            }
-            if (c.getDescription() != null) {
-                newcd.setDescription(c.getDescription());
-            } else {
-                newcd.setDescription(cls.getLatestClusterDefinition().getDescription());
-            }
-            if (c.getGoalState() != null) {
-                newcd.setGoalState(c.getGoalState());
-            } else {
-                newcd.setGoalState(cls.getLatestClusterDefinition().getGoalState());
-            }
-            if (c.getActiveServices() != null) {
-                newcd.setActiveServices(c.getActiveServices());
-            } else {
-                newcd.setActiveServices(cls.getLatestClusterDefinition().getActiveServices());
-            }
-            
-            /*
-             * TODO: What if controller is crashed after updateClusterNodesReservation 
-             * before updating and adding new revision of cluster definition?
-             */
-            boolean updateNodesReservation = false;
-            boolean updateNodeToRolesAssociation = false;
-            if (c.getNodes() != null) {
-                newcd.setNodes(c.getNodes());
-                updateNodesReservation = true;
-                
-            } else {
-                newcd.setNodes(cls.getLatestClusterDefinition().getNodes());
-            }
-            if (c.getRoleToNodes() != null) {
-                newcd.setRoleToNodesMap(c.getRoleToNodes());
-                updateNodeToRolesAssociation = true;
-                
-            }  
-            
-            /*
-             * if Cluster goal state is ATTIC then no need to take any action other than
-             * updating the cluster definition.
-             */
-            if (newcd.getGoalState().equals(ClusterState.CLUSTER_STATE_ATTIC)) {
-                cls.getClusterState().setLastUpdateTime(new Date());
-                cls.addClusterDefinition(newcd);
-                /*
-                 * TODO: Persist the latest cluster definition under new revision
-                 */
-                return cls.getLatestClusterDefinition();
-            }
-            
-            /*
-             * Validate the updated cluster definition
-             */
-            validateClusterDefinition(newcd);
-            
-            /*
-             * TODO: If dry_run then return the newcd at this point
-             */
-            if (dry_run) {
-                System.out.println ("Dry run for update cluster..");
-                return newcd;
-            }
-            
-            /*
-             * Update the nodes reservation and node to roles association 
-             */
-            if (updateNodesReservation) {
-                updateClusterNodesReservation (cls.getName(), c);   
-            }
-            if (updateNodeToRolesAssociation) {
-                updateNodeToRolesAssociation(newcd.getNodes(), c.getRoleToNodes());
-            }
-            
-            /*
-             *  Update the last update time & revision
-             */
-            cls.getClusterState().setLastUpdateTime(new Date());
-            cls.addClusterDefinition(newcd);
-            
-            /*
-             * TODO: Persist the latest cluster definition under new revision
-             */
-            
-            /*
-             * Invoke state machine event
-             */
-            ClusterFSM clusterFSM = StateMachineInvoker.
-                getStateMachineClusterInstance(cls.getName());
-            if(c.getGoalState().equals(ClusterState.CLUSTER_STATE_ACTIVE)) {
-              clusterFSM.activate();
-            } else if(c.getGoalState().
-                equals(ClusterState.CLUSTER_STATE_INACTIVE)) {
-              clusterFSM.deactivate();
-            } else if(c.getGoalState().
-                equals(ClusterState.CLUSTER_STATE_ATTIC)) {
-              clusterFSM.deactivate();
-              clusterFSM.terminate();
-            }
-        }
-        return cls.getLatestClusterDefinition();
-    }
+
     
     /*
      * Delete Cluster 

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClusterResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClusterResource.java?rev=1189417&r1=1189416&r2=1189417&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClusterResource.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClusterResource.java Wed Oct 26 19:58:58 2011
@@ -78,17 +78,38 @@ public class ClusterResource {
     }
     
     /** 
-     * Update cluster definition.
+     * Add/Update cluster definition. If cluster does not exist it will created.
+     *  
+     *  While creating new cluster, cluster definition must specify name, blueprint name 
+     *  and nodes associated with the cluster. 
+     *  Default values for new cluster definition parameters, if not specified
+     *    -- goalstate          = "INACTIVE"  (optionally, it can be set to ACTIVE)
+     *    -- blueprint revision = latest revision
+     *    -- RoleToNodes        = If explicit association is not specified then Ambari
+     *                            will determine the optimal role to nodes association. 
+     *                            User can view it by running the command in dry_run.
+     *    -- active services    = "ALL" i.e. if not specified all the configured 
+     *                            services will be activated
+     *    -- description        = Default description will be associated
+     *    -- dry_run            = false
+     *  
+     *  
+     *  For new cluster to be in active state cluster definition needs to be 
+     *  complete & valid e.g. number of nodes associated are sufficient for 
+     *  each role, specified blueprint for cluster configuration should exist 
+     *  etc. 
+     *  
+     *  Updating existing cluster definition would require only specific sub elements
+     *  of cluster definition to be specified. 
      * 
-     * @response.representation.200.doc         Returns updated cluster definition.
+     * @response.representation.200.doc         Returns new or updated cluster definition.
      * @response.representation.200.mediaType   application/json
      * @response.representation.400.doc         Bad request (See "ErrorMessage" in the response
      *                                          http header describing specific error condition).
-     * @response.representation.404.doc        Cluster does not exist
      * @response.representation.200.example
      * 
-     * @param   clusterName                     Name of the cluster; Each cluster is identified w/ unique name
-     * @param   cluster                         Cluster definition with only specific sub-elements to be updated.
+     * @param   clusterName                     Name of the cluster
+     * @param   cluster                         Cluster definition to be created new or updated existing one
      *                                          Cluster name can not be updated through this API.
      * @param   dry_run                         Boolean option to specify dry_run. In dry_run, updates to cluster
      *                                          definition are validated but actual updates are not made

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClustersResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClustersResource.java?rev=1189417&r1=1189416&r2=1189417&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClustersResource.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClustersResource.java Wed Oct 26 19:58:58 2011
@@ -79,48 +79,4 @@ public class ClustersResource {
         } 
         return searchResults;
     }
-    
-    /** 
-     * Add new cluster definition.
-     *
-     *  Cluster definition must specify name, blueprint name and nodes associated with
-     *  the cluster. 
-     *  Default values of cluster definition parameters, if not specified
-     *    -- goalstate          = "INACTIVE"  (optionally, it can be set to ACTIVE)
-     *    -- blueprint revision = latest revision
-     *    -- RoleToNodes        = If explicit association is not specified then Ambari
-     *                            will determine the optimal role to nodes association. 
-     *                            User can view it by running the command in dry_run.
-     *    -- active services    = "ALL" i.e. if not specified all the configured 
-     *                            services will be activated
-     *    -- description        = Default description will be associated
-     *    -- dry_run            = false
-     *  
-     *  
-     *  For cluster to be in active state cluster definition needs to be 
-     *  complete & valid e.g. number of nodes associated are sufficient for 
-     *  each role, specified blueprint for cluster configuration should exist 
-     *  etc. 
-     *  
-     *  @request.representation.doc ClusterDefinition object
-     *  @request.representation.example
-     *      
-     *  @param  dry_run   Enable dry run by setting it to true
-     *  @param  cluster   Definition of the cluster to be created 
-     *  @return           Returns the cluster definition 
-     *  @throws Exception Throws exception (TBD)
-     */
-    @POST
-    @Consumes({"application/json"})
-    public ClusterDefinition addCluster(
-            @DefaultValue("false") @QueryParam("dry_run") boolean dry_run,
-            ClusterDefinition cluster) throws Exception {
-        try {
-            return Clusters.getInstance().addCluster(cluster, dry_run);
-        }catch (WebApplicationException we) {
-            throw we;
-        }catch (Exception e) {
-            throw new WebApplicationException((new ExceptionResponse(e)).get());
-        } 
-    }
 }