Browse Source

AMBARI-4752. Rename MAINTENANCE and PassiveState (ncole)

Nate Cole 11 năm trước cách đây
mục cha
commit
e1f4f2e8b0
50 tập tin đã thay đổi với 496 bổ sung477 xóa
  1. 4 4
      ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
  2. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
  3. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java
  4. 7 7
      ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
  5. 5 6
      ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
  6. 24 25
      ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
  7. 5 5
      ambari-server/src/main/java/org/apache/ambari/server/controller/HostRequest.java
  8. 8 8
      ambari-server/src/main/java/org/apache/ambari/server/controller/HostResponse.java
  9. 29 21
      ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java
  10. 7 7
      ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
  11. 7 7
      ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostResponse.java
  12. 9 6
      ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
  13. 5 6
      ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceResponse.java
  14. 5 5
      ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
  15. 16 17
      ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
  16. 19 19
      ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
  17. 27 26
      ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
  18. 7 7
      ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
  19. 16 11
      ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java
  20. 7 7
      ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java
  21. 4 4
      ambari-server/src/main/java/org/apache/ambari/server/state/Host.java
  22. 5 5
      ambari-server/src/main/java/org/apache/ambari/server/state/MaintenanceState.java
  23. 5 5
      ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
  24. 4 4
      ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHost.java
  25. 2 2
      ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHostEvent.java
  26. 3 3
      ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHostEventType.java
  27. 5 5
      ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
  28. 5 5
      ambari-server/src/main/java/org/apache/ambari/server/state/State.java
  29. 20 20
      ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java
  30. 3 3
      ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostDisableEvent.java
  31. 13 13
      ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
  32. 20 23
      ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java
  33. 3 3
      ambari-server/src/main/python/UpgradeHelper_HDP2.py
  34. 3 3
      ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
  35. 3 3
      ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
  36. 3 3
      ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
  37. 3 3
      ambari-server/src/main/resources/Ambari-DDL-Postgres-REMOTE-CREATE.sql
  38. 3 3
      ambari-server/src/main/resources/properties.json
  39. 2 2
      ambari-server/src/main/resources/scripts/relocate_host_components.py
  40. 4 4
      ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
  41. 4 5
      ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
  42. 35 35
      ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
  43. 73 73
      ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
  44. 34 24
      ambari-server/src/test/java/org/apache/ambari/server/controller/MaintenanceStateHelperTest.java
  45. 3 3
      ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
  46. 2 2
      ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java
  47. 6 6
      ambari-server/src/test/java/org/apache/ambari/server/state/ServiceTest.java
  48. 7 7
      ambari-server/src/test/java/org/apache/ambari/server/state/host/HostTest.java
  49. 7 7
      ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
  50. 3 3
      ambari-server/src/test/python/TestUpgradeScript_HDP2.py

+ 4 - 4
ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java

@@ -31,7 +31,7 @@ import org.apache.ambari.server.ServiceNotFoundException;
 import org.apache.ambari.server.actionmanager.ActionManager;
 import org.apache.ambari.server.actionmanager.ActionManager;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.configuration.Configuration;
-import org.apache.ambari.server.controller.PassiveStateHelper;
+import org.apache.ambari.server.controller.MaintenanceStateHelper;
 import org.apache.ambari.server.metadata.ActionMetadata;
 import org.apache.ambari.server.metadata.ActionMetadata;
 import org.apache.ambari.server.state.AgentVersion;
 import org.apache.ambari.server.state.AgentVersion;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Cluster;
@@ -41,7 +41,7 @@ import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.HostHealthStatus;
 import org.apache.ambari.server.state.HostHealthStatus;
 import org.apache.ambari.server.state.HostHealthStatus.HealthStatus;
 import org.apache.ambari.server.state.HostHealthStatus.HealthStatus;
 import org.apache.ambari.server.state.HostState;
 import org.apache.ambari.server.state.HostState;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentHost;
 import org.apache.ambari.server.state.ServiceComponentHost;
@@ -245,7 +245,7 @@ public class HeartBeatHandler {
         Cluster cluster = clusterFsm.getCluster(clusterName);
         Cluster cluster = clusterFsm.getCluster(clusterName);
         stackId = cluster.getDesiredStackVersion();
         stackId = cluster.getDesiredStackVersion();
         
         
-        PassiveStateHelper psh = injector.getInstance(PassiveStateHelper.class);
+        MaintenanceStateHelper psh = injector.getInstance(MaintenanceStateHelper.class);
 
 
         List<ServiceComponentHost> scHosts = cluster.getServiceComponentHosts(heartbeat.getHostname());
         List<ServiceComponentHost> scHosts = cluster.getServiceComponentHosts(heartbeat.getHostname());
         for (ServiceComponentHost scHost : scHosts) {
         for (ServiceComponentHost scHost : scHosts) {
@@ -258,7 +258,7 @@ public class HeartBeatHandler {
 
 
           String category = componentInfo.getCategory();
           String category = componentInfo.getCategory();
 
 
-          if (PassiveState.ACTIVE == psh.getEffectiveState(scHost)) {
+          if (MaintenanceState.OFF == psh.getEffectiveState(scHost)) {
             if (category.equals("MASTER")) {
             if (category.equals("MASTER")) {
               ++masterCount;
               ++masterCount;
               if (status.equals("STARTED")) {
               if (status.equals("STARTED")) {

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java

@@ -134,7 +134,7 @@ public class HeartbeatMonitor implements Runnable {
               !sch.getState().equals(State.INSTALLING) &&
               !sch.getState().equals(State.INSTALLING) &&
               !sch.getState().equals(State.INSTALL_FAILED) &&
               !sch.getState().equals(State.INSTALL_FAILED) &&
               !sch.getState().equals(State.UNINSTALLED) &&
               !sch.getState().equals(State.UNINSTALLED) &&
-              !sch.getState().equals(State.MAINTENANCE)) {
+              !sch.getState().equals(State.DISABLED)) {
               LOG.warn("Setting component state to UNKNOWN for component " + sc.getName() + " on " + host);
               LOG.warn("Setting component state to UNKNOWN for component " + sc.getName() + " on " + host);
               sch.setState(State.UNKNOWN);
               sch.setState(State.UNKNOWN);
             }
             }

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java

@@ -325,7 +325,7 @@ public class AmbariActionExecutionHelper {
       
       
       // cluster passive map
       // cluster passive map
       execCmd.setPassiveInfo(
       execCmd.setPassiveInfo(
-          PassiveStateHelper.getPassiveHostComponents(clusters, cluster));
+          MaintenanceStateHelper.getMaintenanceHostCompoments(clusters, cluster));
           
           
     }
     }
   }
   }

+ 7 - 7
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java

@@ -37,7 +37,7 @@ import org.apache.ambari.server.state.ComponentInfo;
 import org.apache.ambari.server.state.ConfigHelper;
 import org.apache.ambari.server.state.ConfigHelper;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.HostComponentAdminState;
 import org.apache.ambari.server.state.HostComponentAdminState;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.RepositoryInfo;
 import org.apache.ambari.server.state.RepositoryInfo;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponent;
@@ -566,16 +566,16 @@ public class AmbariCustomCommandExecutionHelper {
         sch.setComponentAdminState(HostComponentAdminState.DECOMMISSIONED);
         sch.setComponentAdminState(HostComponentAdminState.DECOMMISSIONED);
         listOfExcludedHosts.add(sch.getHostName());
         listOfExcludedHosts.add(sch.getHostName());
         if (alignMtnState) {
         if (alignMtnState) {
-          sch.setPassiveState(PassiveState.PASSIVE);
+          sch.setMaintenanceState(MaintenanceState.ON);
         }
         }
-        LOG.info("Decommissioning " + slaveCompType + " and marking it PASSIVE on " + sch.getHostName());
+        LOG.info("Decommissioning " + slaveCompType + " and marking Maintenance=ON on " + sch.getHostName());
       }
       }
       if (includedHosts.contains(sch.getHostName())) {
       if (includedHosts.contains(sch.getHostName())) {
         sch.setComponentAdminState(HostComponentAdminState.INSERVICE);
         sch.setComponentAdminState(HostComponentAdminState.INSERVICE);
         if (alignMtnState) {
         if (alignMtnState) {
-          sch.setPassiveState(PassiveState.ACTIVE);
+          sch.setMaintenanceState(MaintenanceState.OFF);
         }
         }
-        LOG.info("Recommissioning " + slaveCompType + " and marking it ACTIVE on " + sch.getHostName());
+        LOG.info("Recommissioning " + slaveCompType + " and marking Maintenance=OFF on " + sch.getHostName());
       }
       }
     }
     }
 
 
@@ -787,8 +787,8 @@ public class AmbariCustomCommandExecutionHelper {
 
 
     Map<String, String> roleParams = new TreeMap<String, String>();
     Map<String, String> roleParams = new TreeMap<String, String>();
     execCmd.setRoleParams(roleParams);
     execCmd.setRoleParams(roleParams);
-
-    execCmd.setPassiveInfo(PassiveStateHelper.getPassiveHostComponents(clusters, cluster));
+    
+    execCmd.setPassiveInfo(MaintenanceStateHelper.getMaintenanceHostCompoments(clusters, cluster));
   }
   }
 
 
   private String getRepoInfo(Cluster cluster, Host host) throws AmbariException {
   private String getRepoInfo(Cluster cluster, Host host) throws AmbariException {

+ 5 - 6
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java

@@ -24,7 +24,7 @@ import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.scheduler.ExecutionScheduleManager;
 import org.apache.ambari.server.scheduler.ExecutionScheduleManager;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Clusters;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentFactory;
 import org.apache.ambari.server.state.ServiceComponentFactory;
@@ -526,13 +526,12 @@ public interface AmbariManagementController {
   public String getJobTrackerHost(Cluster cluster);
   public String getJobTrackerHost(Cluster cluster);
 
 
   /**
   /**
-   * Gets the effective passive state for a host component
-   * @param cluster the cluster
-   * @param service the service
+   * Gets the effective maintenance state for a host component
    * @param sch the service component host
    * @param sch the service component host
-   * @return the passive state
+   * @return the maintenance state
    * @throws AmbariException
    * @throws AmbariException
    */
    */
-  public PassiveState getEffectivePassiveState(ServiceComponentHost sch) throws AmbariException;
+  public MaintenanceState getEffectiveMaintenanceState(ServiceComponentHost sch)
+      throws AmbariException;
 }
 }
   
   

+ 24 - 25
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java

@@ -71,7 +71,7 @@ import org.apache.ambari.server.state.ConfigHelper;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.HostState;
 import org.apache.ambari.server.state.HostState;
 import org.apache.ambari.server.state.OperatingSystemInfo;
 import org.apache.ambari.server.state.OperatingSystemInfo;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.PropertyInfo;
 import org.apache.ambari.server.state.PropertyInfo;
 import org.apache.ambari.server.state.RepositoryInfo;
 import org.apache.ambari.server.state.RepositoryInfo;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.Service;
@@ -89,7 +89,7 @@ import org.apache.ambari.server.state.configgroup.ConfigGroupFactory;
 import org.apache.ambari.server.state.fsm.InvalidStateTransitionException;
 import org.apache.ambari.server.state.fsm.InvalidStateTransitionException;
 import org.apache.ambari.server.state.scheduler.RequestExecutionFactory;
 import org.apache.ambari.server.state.scheduler.RequestExecutionFactory;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostInstallEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostInstallEvent;
-import org.apache.ambari.server.state.svccomphost.ServiceComponentHostMaintenanceEvent;
+import org.apache.ambari.server.state.svccomphost.ServiceComponentHostDisableEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostRestoreEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostRestoreEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostStartEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostStartEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostStopEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostStopEvent;
@@ -734,7 +734,7 @@ public class AmbariManagementControllerImpl implements
             if (filterBasedConfigStaleness && r.isStaleConfig() != staleConfig) {
             if (filterBasedConfigStaleness && r.isStaleConfig() != staleConfig) {
               continue;
               continue;
             }
             }
-            r.setPassiveState(getEffectivePassiveState(sch).name());
+            r.setMaintenanceState(getEffectiveMaintenanceState(sch).name());
             response.add(r);
             response.add(r);
           } catch (ServiceComponentHostNotFoundException e) {
           } catch (ServiceComponentHostNotFoundException e) {
             if (request.getServiceName() != null && request.getComponentName() != null) {
             if (request.getServiceName() != null && request.getComponentName() != null) {
@@ -767,7 +767,7 @@ public class AmbariManagementControllerImpl implements
               continue;
               continue;
             }
             }
             
             
-            r.setPassiveState(getEffectivePassiveState(sch).name());
+            r.setMaintenanceState(getEffectiveMaintenanceState(sch).name());
             response.add(r);
             response.add(r);
           }
           }
         }
         }
@@ -777,11 +777,11 @@ public class AmbariManagementControllerImpl implements
   }
   }
   
   
   @Override
   @Override
-  public PassiveState getEffectivePassiveState(ServiceComponentHost sch)
+  public MaintenanceState getEffectiveMaintenanceState(ServiceComponentHost sch)
       throws AmbariException {
       throws AmbariException {
-    PassiveStateHelper psh = injector.getInstance(PassiveStateHelper.class);
+    MaintenanceStateHelper msh = injector.getInstance(MaintenanceStateHelper.class);
     
     
-    return psh.getEffectiveState(sch);
+    return msh.getEffectiveState(sch);
   }
   }
   
   
 
 
@@ -1452,7 +1452,6 @@ public class AmbariManagementControllerImpl implements
     Map<ServiceComponentHost, State> directTransitionScHosts = new HashMap<ServiceComponentHost, State>();
     Map<ServiceComponentHost, State> directTransitionScHosts = new HashMap<ServiceComponentHost, State>();
     Set<String> maintenanceClusters = new HashSet<String>();
     Set<String> maintenanceClusters = new HashSet<String>();
     
     
-    
     for (ServiceComponentHostRequest request : requests) {
     for (ServiceComponentHostRequest request : requests) {
       validateServiceComponentHostRequest(request);
       validateServiceComponentHostRequest(request);
 
 
@@ -1517,21 +1516,21 @@ public class AmbariManagementControllerImpl implements
         }
         }
       }
       }
       
       
-      if (null != request.getPassiveState()) {
-        PassiveStateHelper psh = injector.getInstance(PassiveStateHelper.class);
+      if (null != request.getMaintenanceState()) {
+        MaintenanceStateHelper psh = injector.getInstance(MaintenanceStateHelper.class);
         
         
-        PassiveState newPassive = PassiveState.valueOf(request.getPassiveState());
-        PassiveState oldPassive = psh.getEffectiveState(sch);
+        MaintenanceState newMaint = MaintenanceState.valueOf(request.getMaintenanceState());
+        MaintenanceState oldMaint = psh.getEffectiveState(sch);
         
         
-        if (newPassive != oldPassive) {
+        if (newMaint != oldMaint) {
           if (sc.isClientComponent()) {
           if (sc.isClientComponent()) {
             throw new IllegalArgumentException("Invalid arguments, cannot set " +
             throw new IllegalArgumentException("Invalid arguments, cannot set " +
-              "passive state on a client component");
-          } else if (newPassive.equals(PassiveState.IMPLIED)) {
+              "maintenance state on a client component");
+          } else if (newMaint.equals(MaintenanceState.IMPLIED)) {
             throw new IllegalArgumentException("Invalid arguments, can only set " +
             throw new IllegalArgumentException("Invalid arguments, can only set " +
-              "passive state to one of " + EnumSet.of(PassiveState.ACTIVE, PassiveState.PASSIVE));
+              "maintenance state to one of " + EnumSet.of(MaintenanceState.OFF, MaintenanceState.ON));
           } else {
           } else {
-            sch.setPassiveState(newPassive);
+            sch.setMaintenanceState(newMaint);
             
             
             maintenanceClusters.add(sch.getClusterName());
             maintenanceClusters.add(sch.getClusterName());
           }
           }
@@ -1634,8 +1633,8 @@ public class AmbariManagementControllerImpl implements
       ServiceComponentHostEvent event;
       ServiceComponentHostEvent event;
       componentHost.setDesiredState(newState);
       componentHost.setDesiredState(newState);
       switch (newState) {
       switch (newState) {
-        case MAINTENANCE:
-          event = new ServiceComponentHostMaintenanceEvent(
+        case DISABLED:
+          event = new ServiceComponentHostDisableEvent(
               componentHost.getServiceComponentName(),
               componentHost.getServiceComponentName(),
               componentHost.getHostName(),
               componentHost.getHostName(),
               timestamp);
               timestamp);
@@ -1659,10 +1658,10 @@ public class AmbariManagementControllerImpl implements
     
     
     if (maintenanceClusters.size() > 0) {
     if (maintenanceClusters.size() > 0) {
       try {
       try {
-        PassiveStateHelper.createRequests(this, requestProperties,
+        MaintenanceStateHelper.createRequests(this, requestProperties,
             maintenanceClusters);
             maintenanceClusters);
       } catch (Exception e) {
       } catch (Exception e) {
-        LOG.warn("Could not send passive status to Nagios (" + e.getMessage() + ")");
+        LOG.warn("Could not send maintenance status to Nagios (" + e.getMessage() + ")");
       }
       }
     }
     }
 
 
@@ -1714,11 +1713,11 @@ public class AmbariManagementControllerImpl implements
   private boolean isDirectTransition(State oldState, State newState) {
   private boolean isDirectTransition(State oldState, State newState) {
     switch (newState) {
     switch (newState) {
       case INSTALLED:
       case INSTALLED:
-        if (oldState == State.MAINTENANCE) {
+        if (oldState == State.DISABLED) {
           return true;
           return true;
         }
         }
         break;
         break;
-      case MAINTENANCE:
+      case DISABLED:
         if (oldState == State.INSTALLED ||
         if (oldState == State.INSTALLED ||
           oldState == State.UNKNOWN) {
           oldState == State.UNKNOWN) {
           return true;
           return true;
@@ -1834,13 +1833,13 @@ public class AmbariManagementControllerImpl implements
             + ", request=" + request);
             + ", request=" + request);
       }
       }
 
 
-      // Only allow removing master/slave components in MAINTENANCE/UNKNOWN/INSTALL_FAILED/INIT state without stages
+      // Only allow removing master/slave components in DISABLED/UNKNOWN/INSTALL_FAILED/INIT state without stages
       // generation.
       // generation.
       // Clients may be removed without a state check.
       // Clients may be removed without a state check.
       if (!component.isClientComponent() &&
       if (!component.isClientComponent() &&
           !componentHost.getState().isRemovableState()) {
           !componentHost.getState().isRemovableState()) {
         throw new AmbariException("To remove master or slave components they must be in " +
         throw new AmbariException("To remove master or slave components they must be in " +
-            "MAINTENANCE/INIT/INSTALLED/INSTALL_FAILED/UNKNOWN state. Current=" + componentHost.getState() + ".");
+            "DISABLED/INIT/INSTALLED/INSTALL_FAILED/UNKNOWN state. Current=" + componentHost.getState() + ".");
       }
       }
 
 
       if (!safeToRemoveSCHs.containsKey(component)) {
       if (!safeToRemoveSCHs.containsKey(component)) {

+ 5 - 5
ambari-server/src/main/java/org/apache/ambari/server/controller/HostRequest.java

@@ -29,7 +29,7 @@ public class HostRequest {
   private Map<String, String> hostAttributes; // CREATE/UPDATE
   private Map<String, String> hostAttributes; // CREATE/UPDATE
   private String rackInfo;
   private String rackInfo;
   private ConfigurationRequest desiredConfig; // UPDATE
   private ConfigurationRequest desiredConfig; // UPDATE
-  private String passiveState; // UPDATE
+  private String maintenanceState; // UPDATE
 
 
   public HostRequest(String hostname, String clusterName, Map<String, String> hostAttributes) {
   public HostRequest(String hostname, String clusterName, Map<String, String> hostAttributes) {
     this.hostname = hostname;
     this.hostname = hostname;
@@ -85,12 +85,12 @@ public class HostRequest {
     return desiredConfig;
     return desiredConfig;
   }
   }
   
   
-  public void setPassiveState(String state) {
-    passiveState = state;
+  public void setMaintenanceState(String state) {
+    maintenanceState = state;
   }
   }
   
   
-  public String getPassiveState() {
-    return passiveState;
+  public String getMaintenanceState() {
+    return maintenanceState;
   }
   }
 
 
   public String toString() {
   public String toString() {

+ 8 - 8
ambari-server/src/main/java/org/apache/ambari/server/controller/HostResponse.java

@@ -29,7 +29,7 @@ import org.apache.ambari.server.state.AgentVersion;
 import org.apache.ambari.server.state.DesiredConfig;
 import org.apache.ambari.server.state.DesiredConfig;
 import org.apache.ambari.server.state.HostConfig;
 import org.apache.ambari.server.state.HostConfig;
 import org.apache.ambari.server.state.HostHealthStatus;
 import org.apache.ambari.server.state.HostHealthStatus;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 
 
 public class HostResponse {
 public class HostResponse {
 
 
@@ -145,7 +145,7 @@ public class HostResponse {
    */
    */
   private String status;
   private String status;
 
 
-  private PassiveState passiveState = null;
+  private MaintenanceState maintenanceState = null;
 
 
   public HostResponse(String hostname, String clusterName,
   public HostResponse(String hostname, String clusterName,
                       String ipv4, String ipv6, int cpuCount, int phCpuCount, String osArch, String osType,
                       String ipv4, String ipv6, int cpuCount, int phCpuCount, String osArch, String osType,
@@ -523,16 +523,16 @@ public class HostResponse {
   }
   }
 
 
   /**
   /**
-   * @param state
+   * @param state the maintenance state
    */
    */
-  public void setPassiveState(PassiveState state) {
-    passiveState = state;
+  public void setMaintenanceState(MaintenanceState state) {
+    maintenanceState = state;
   }
   }
   
   
   /**
   /**
-   * @return the passive state
+   * @return the maintenance state
    */
    */
-  public PassiveState getPassiveState() {
-    return passiveState;
+  public MaintenanceState getMaintenanceState() {
+    return maintenanceState;
   }
   }
 }
 }

+ 29 - 21
ambari-server/src/main/java/org/apache/ambari/server/controller/PassiveStateHelper.java → ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java

@@ -17,7 +17,6 @@
  */
  */
 package org.apache.ambari.server.controller;
 package org.apache.ambari.server.controller;
 
 
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Map;
@@ -29,7 +28,7 @@ import org.apache.ambari.server.RoleCommand;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.Host;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentHost;
 import org.apache.ambari.server.state.ServiceComponentHost;
@@ -38,9 +37,9 @@ import com.google.inject.Inject;
 import com.google.inject.Injector;
 import com.google.inject.Injector;
 
 
 /**
 /**
- * Used to help manage passive state checks.
+ * Used to help manage maintenance state checks.
  */
  */
-public class PassiveStateHelper {
+public class MaintenanceStateHelper {
   private static final String NAGIOS_SERVICE = "NAGIOS";
   private static final String NAGIOS_SERVICE = "NAGIOS";
   private static final String NAGIOS_COMPONENT = "NAGIOS_SERVER";
   private static final String NAGIOS_COMPONENT = "NAGIOS_SERVER";
   private static final String NAGIOS_ACTION_NAME = "nagios_update_ignore";
   private static final String NAGIOS_ACTION_NAME = "nagios_update_ignore";
@@ -49,23 +48,23 @@ public class PassiveStateHelper {
   private Clusters clusters;
   private Clusters clusters;
   
   
   @Inject
   @Inject
-  public PassiveStateHelper(Injector injector) {
+  public MaintenanceStateHelper(Injector injector) {
     injector.injectMembers(this);
     injector.injectMembers(this);
   }
   }
 
 
   /**
   /**
    * Gets the effective state for a HostComponents
    * Gets the effective state for a HostComponents
    * @param sch the host component
    * @param sch the host component
-   * @return the passive state
+   * @return the maintenance state
    * @throws AmbariException
    * @throws AmbariException
    */
    */
-  public PassiveState getEffectiveState(ServiceComponentHost sch) throws AmbariException {
+  public MaintenanceState getEffectiveState(ServiceComponentHost sch) throws AmbariException {
     Cluster cluster = clusters.getCluster(sch.getClusterName());
     Cluster cluster = clusters.getCluster(sch.getClusterName());
     Service service = cluster.getService(sch.getServiceName());
     Service service = cluster.getService(sch.getServiceName());
     
     
     Map<String, Host> map = clusters.getHostsForCluster(cluster.getClusterName());
     Map<String, Host> map = clusters.getHostsForCluster(cluster.getClusterName());
     if (null == map)
     if (null == map)
-      return PassiveState.ACTIVE;
+      return MaintenanceState.OFF;
     
     
     Host host = clusters.getHostsForCluster(cluster.getClusterName()).get(sch.getHostName());
     Host host = clusters.getHostsForCluster(cluster.getClusterName()).get(sch.getHostName());
     if (null == host) // better not
     if (null == host) // better not
@@ -74,23 +73,33 @@ public class PassiveStateHelper {
     return getEffectiveState(cluster.getClusterId(), service, host, sch);
     return getEffectiveState(cluster.getClusterId(), service, host, sch);
   }
   }
   
   
-  private static PassiveState getEffectiveState(long clusterId, Service service,
+  /**
+   * @param clusterId the cluster id
+   * @param service the service
+   * @param host the host
+   * @param sch the host component
+   * @return the effective maintenance state
+   */
+  private static MaintenanceState getEffectiveState(long clusterId, Service service,
       Host host, ServiceComponentHost sch) {
       Host host, ServiceComponentHost sch) {
-    if (PassiveState.PASSIVE == sch.getPassiveState())
-      return PassiveState.PASSIVE;
+    if (MaintenanceState.ON == sch.getMaintenanceState())
+      return MaintenanceState.ON;
 
 
-    if (PassiveState.ACTIVE != service.getPassiveState() ||
-        PassiveState.ACTIVE != host.getPassiveState(clusterId))
-      return PassiveState.IMPLIED;
+    if (MaintenanceState.OFF != service.getMaintenanceState() ||
+        MaintenanceState.OFF != host.getMaintenanceState(clusterId))
+      return MaintenanceState.IMPLIED;
     
     
-    return sch.getPassiveState();
+    return sch.getMaintenanceState();
   }
   }
 
 
   /**
   /**
-   * @param cluster
-   * @return
+   * @param clusters the collection of clusters
+   * @param cluster the specific cluster to check
+   * @return a property map of all host components that are in a
+   * maintenance state (either {@link MaintenanceState#ON} or
+   * {@link MaintenanceState#IMPLIED})
    */
    */
-  public static Set<Map<String, String>> getPassiveHostComponents(Clusters clusters,
+  public static Set<Map<String, String>> getMaintenanceHostCompoments(Clusters clusters,
       Cluster cluster) throws AmbariException {
       Cluster cluster) throws AmbariException {
     
     
     Set<Map<String, String>> set = new HashSet<Map<String, String>>();
     Set<Map<String, String>> set = new HashSet<Map<String, String>>();
@@ -104,7 +113,7 @@ public class PassiveStateHelper {
           Host host = clusters.getHostsForCluster(
           Host host = clusters.getHostsForCluster(
               cluster.getClusterName()).get(sch.getHostName());
               cluster.getClusterName()).get(sch.getHostName());
           
           
-          if (PassiveState.ACTIVE != getEffectiveState(cluster.getClusterId(),
+          if (MaintenanceState.OFF != getEffectiveState(cluster.getClusterId(),
               service, host, sch)) {
               service, host, sch)) {
             Map<String, String> map = new HashMap<String, String>();
             Map<String, String> map = new HashMap<String, String>();
             map.put("host", sch.getHostName());
             map.put("host", sch.getHostName());
@@ -142,8 +151,7 @@ public class PassiveStateHelper {
       
       
       if (null == response)
       if (null == response)
         response = amc.createAction(actionRequest, requestProperties);
         response = amc.createAction(actionRequest, requestProperties);
-    }
-    
+    }    
     return response;
     return response;
   }  
   }  
   
   

+ 7 - 7
ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java

@@ -30,7 +30,7 @@ public class ServiceComponentHostRequest {
   private String desiredStackId; // UPDATE
   private String desiredStackId; // UPDATE
   private String staleConfig; // GET - predicate
   private String staleConfig; // GET - predicate
   private String adminState; // GET - predicate
   private String adminState; // GET - predicate
-  private String passiveState; // UPDATE
+  private String maintenanceState; // UPDATE
   
   
   public ServiceComponentHostRequest(String clusterName,
   public ServiceComponentHostRequest(String clusterName,
                                      String serviceName,
                                      String serviceName,
@@ -173,16 +173,16 @@ public class ServiceComponentHostRequest {
   }
   }
 
 
   /**
   /**
-   * @param state the passive state
+   * @param state the maintenance state
    */
    */
-  public void setPassiveState(String state) {
-    passiveState = state;
+  public void setMaintenanceState(String state) {
+    maintenanceState = state;
   }
   }
   
   
   /**
   /**
-   * @return the passive state
+   * @return the maintenance state
    */
    */
-  public String getPassiveState() {
-    return passiveState;
+  public String getMaintenanceState() {
+    return maintenanceState;
   }
   }
 }
 }

+ 7 - 7
ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostResponse.java

@@ -37,7 +37,7 @@ public class ServiceComponentHostResponse {
   private String desiredState;
   private String desiredState;
   private boolean staleConfig = false;
   private boolean staleConfig = false;
   private String adminState = null;
   private String adminState = null;
-  private String passiveState = null;
+  private String maintenanceState = null;
 
 
 
 
   public ServiceComponentHostResponse(String clusterName, String serviceName,
   public ServiceComponentHostResponse(String clusterName, String serviceName,
@@ -254,17 +254,17 @@ public class ServiceComponentHostResponse {
   }
   }
 
 
   /**
   /**
-   * @return the passive state
+   * @return the maintenance state
    */
    */
-  public String getPassiveState() {
-    return passiveState;
+  public String getMaintenanceState() {
+    return maintenanceState;
   }
   }
   
   
   /**
   /**
-   * @param state the passive state
+   * @param state the maintenance state
    */
    */
-  public void setPassiveState(String state) {
-    passiveState = state;
+  public void setMaintenanceState(String state) {
+    maintenanceState = state;
   }
   }
 
 
 }
 }

+ 9 - 6
ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java

@@ -24,7 +24,7 @@ public class ServiceRequest {
   private String clusterName; // REF
   private String clusterName; // REF
   private String serviceName; // GET/CREATE/UPDATE/DELETE
   private String serviceName; // GET/CREATE/UPDATE/DELETE
   private String desiredState; // CREATE/UPDATE
   private String desiredState; // CREATE/UPDATE
-  private String passiveState; // UPDATE
+  private String maintenanceState; // UPDATE
 
 
   public ServiceRequest(String clusterName, String serviceName,
   public ServiceRequest(String clusterName, String serviceName,
                         String desiredState) {
                         String desiredState) {
@@ -76,14 +76,17 @@ public class ServiceRequest {
   }
   }
   
   
   /**
   /**
-   * @param state the new passive state
+   * @param state the new maintenance state
    */
    */
-  public void setPassiveState(String state) {
-    passiveState = state;
+  public void setMaintenanceState(String state) {
+    maintenanceState = state;
   }
   }
   
   
-  public String getPassiveState() {
-    return passiveState;
+  /**
+   * @return the maintenance state
+   */
+  public String getMaintenanceState() {
+    return maintenanceState;
   }
   }
 
 
   public String toString() {
   public String toString() {

+ 5 - 6
ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceResponse.java

@@ -18,7 +18,6 @@
 
 
 package org.apache.ambari.server.controller;
 package org.apache.ambari.server.controller;
 
 
-import org.apache.ambari.server.state.PassiveState;
 
 
 public class ServiceResponse {
 public class ServiceResponse {
 
 
@@ -27,7 +26,7 @@ public class ServiceResponse {
   private String serviceName;
   private String serviceName;
   private String desiredStackVersion;
   private String desiredStackVersion;
   private String desiredState;
   private String desiredState;
-  private String passiveState;
+  private String maintenanceState;
 
 
   public ServiceResponse(Long clusterId, String clusterName,
   public ServiceResponse(Long clusterId, String clusterName,
                          String serviceName,
                          String serviceName,
@@ -134,12 +133,12 @@ public class ServiceResponse {
     return true;
     return true;
   }
   }
   
   
-  public void setPassiveState(String state) {
-    passiveState = state;
+  public void setMaintenanceState(String state) {
+    maintenanceState = state;
   }
   }
   
   
-  public String getPassiveState() {
-    return passiveState;
+  public String getMaintenanceState() {
+    return maintenanceState;
   }
   }
 
 
   @Override
   @Override

+ 5 - 5
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java

@@ -49,7 +49,7 @@ import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ComponentInfo;
 import org.apache.ambari.server.state.ComponentInfo;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentFactory;
 import org.apache.ambari.server.state.ServiceComponentFactory;
@@ -708,7 +708,7 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
 
 
       for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
       for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
         State oldSchState = sch.getState();
         State oldSchState = sch.getState();
-        if (oldSchState == State.MAINTENANCE || oldSchState == State.UNKNOWN) {
+        if (oldSchState == State.DISABLED || oldSchState == State.UNKNOWN) {
           if (LOG.isDebugEnabled()) {
           if (LOG.isDebugEnabled()) {
             LOG.debug("Ignoring ServiceComponentHost"
             LOG.debug("Ignoring ServiceComponentHost"
                 + ", clusterName=" + request.getClusterName()
                 + ", clusterName=" + request.getClusterName()
@@ -736,15 +736,15 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
         }
         }
 
 
         // do not update or alter any HC that is not active
         // do not update or alter any HC that is not active
-        PassiveState schPassive = controller.getEffectivePassiveState(sch);
-        if (PassiveState.ACTIVE != schPassive) {
+        MaintenanceState schMaint = controller.getEffectiveMaintenanceState(sch);
+        if (MaintenanceState.OFF != schMaint) {
           if (LOG.isDebugEnabled()) {
           if (LOG.isDebugEnabled()) {
             LOG.debug("Ignoring ServiceComponentHost"
             LOG.debug("Ignoring ServiceComponentHost"
                 + ", clusterName=" + request.getClusterName()
                 + ", clusterName=" + request.getClusterName()
                 + ", serviceName=" + s.getName()
                 + ", serviceName=" + s.getName()
                 + ", componentName=" + sc.getName()
                 + ", componentName=" + sc.getName()
                 + ", hostname=" + sch.getHostName()
                 + ", hostname=" + sch.getHostName()
-                + ", passive=" + schPassive);
+                + ", maintenance=" + schMaint);
           }
           }
           continue;
           continue;
         }
         }

+ 16 - 17
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java

@@ -17,9 +17,12 @@
  */
  */
 package org.apache.ambari.server.controller.internal;
 package org.apache.ambari.server.controller.internal;
 
 
-import com.google.inject.assistedinject.Assisted;
-import com.google.inject.assistedinject.AssistedInject;
-import com.google.inject.persist.Transactional;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
 
 
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.configuration.ComponentSSLConfiguration;
 import org.apache.ambari.server.configuration.ComponentSSLConfiguration;
@@ -38,14 +41,10 @@ import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
 import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
-import org.apache.ambari.server.state.PassiveState;
 
 
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
+import com.google.inject.assistedinject.Assisted;
+import com.google.inject.assistedinject.AssistedInject;
+import com.google.inject.persist.Transactional;
 
 
 /**
 /**
  * Resource provider for host component resources.
  * Resource provider for host component resources.
@@ -77,8 +76,8 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
       = PropertyHelper.getPropertyId("HostRoles", "stale_configs");
       = PropertyHelper.getPropertyId("HostRoles", "stale_configs");
   protected static final String HOST_COMPONENT_DESIRED_ADMIN_STATE_PROPERTY_ID
   protected static final String HOST_COMPONENT_DESIRED_ADMIN_STATE_PROPERTY_ID
       = PropertyHelper.getPropertyId("HostRoles", "desired_admin_state");
       = PropertyHelper.getPropertyId("HostRoles", "desired_admin_state");
-  protected static final String HOST_COMPONENT_PASSIVE_STATE_PROPERTY_ID
-      = "HostRoles/passive_state";
+  protected static final String HOST_COMPONENT_MAINTENANCE_STATE_PROPERTY_ID
+      = "HostRoles/maintenance_state";
   
   
   //Component name mappings
   //Component name mappings
   private static final Map<String, PropertyProvider> HOST_COMPONENT_PROPERTIES_PROVIDER = new HashMap<String, PropertyProvider>();
   private static final Map<String, PropertyProvider> HOST_COMPONENT_PROPERTIES_PROVIDER = new HashMap<String, PropertyProvider>();
@@ -203,9 +202,9 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
             response.getAdminState(), requestedIds);
             response.getAdminState(), requestedIds);
       }
       }
       
       
-      if (null != response.getPassiveState()) {
-        setResourceProperty(resource, HOST_COMPONENT_PASSIVE_STATE_PROPERTY_ID,
-            response.getPassiveState(), requestedIds);
+      if (null != response.getMaintenanceState()) {
+        setResourceProperty(resource, HOST_COMPONENT_MAINTENANCE_STATE_PROPERTY_ID,
+            response.getMaintenanceState(), requestedIds);
       }
       }
 
 
       String componentName = (String) resource.getPropertyValue(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID);
       String componentName = (String) resource.getPropertyValue(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID);
@@ -319,9 +318,9 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
           properties.get(HOST_COMPONENT_DESIRED_ADMIN_STATE_PROPERTY_ID).toString());
           properties.get(HOST_COMPONENT_DESIRED_ADMIN_STATE_PROPERTY_ID).toString());
     }
     }
     
     
-    Object o = properties.get(HOST_COMPONENT_PASSIVE_STATE_PROPERTY_ID);
+    Object o = properties.get(HOST_COMPONENT_MAINTENANCE_STATE_PROPERTY_ID);
     if (null != o) {
     if (null != o) {
-      serviceComponentHostRequest.setPassiveState (o.toString());
+      serviceComponentHostRequest.setMaintenanceState (o.toString());
     }
     }
 
 
     return serviceComponentHostRequest;
     return serviceComponentHostRequest;

+ 19 - 19
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java

@@ -37,7 +37,7 @@ import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.ConfigurationRequest;
 import org.apache.ambari.server.controller.ConfigurationRequest;
 import org.apache.ambari.server.controller.HostRequest;
 import org.apache.ambari.server.controller.HostRequest;
 import org.apache.ambari.server.controller.HostResponse;
 import org.apache.ambari.server.controller.HostResponse;
-import org.apache.ambari.server.controller.PassiveStateHelper;
+import org.apache.ambari.server.controller.MaintenanceStateHelper;
 import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
 import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
 import org.apache.ambari.server.controller.spi.NoSuchResourceException;
 import org.apache.ambari.server.controller.spi.NoSuchResourceException;
 import org.apache.ambari.server.controller.spi.Predicate;
 import org.apache.ambari.server.controller.spi.Predicate;
@@ -53,7 +53,7 @@ import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.DesiredConfig;
 import org.apache.ambari.server.state.DesiredConfig;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.Host;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.ServiceComponentHost;
 import org.apache.ambari.server.state.ServiceComponentHost;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
@@ -101,8 +101,8 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
   
   
   protected static final String HOST_HOST_STATUS_PROPERTY_ID =
   protected static final String HOST_HOST_STATUS_PROPERTY_ID =
       PropertyHelper.getPropertyId("Hosts", "host_status");
       PropertyHelper.getPropertyId("Hosts", "host_status");
-  protected static final String HOST_PASSIVE_STATE_PROPERTY_ID = 
-      PropertyHelper.getPropertyId("Hosts", "passive_state");
+  protected static final String HOST_MAINTENANCE_STATE_PROPERTY_ID = 
+      PropertyHelper.getPropertyId("Hosts", "maintenance_state");
   
   
   protected static final String HOST_HOST_HEALTH_REPORT_PROPERTY_ID =
   protected static final String HOST_HOST_HEALTH_REPORT_PROPERTY_ID =
       PropertyHelper.getPropertyId("Hosts", "host_health_report");
       PropertyHelper.getPropertyId("Hosts", "host_health_report");
@@ -230,9 +230,9 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
           response.getDesiredHostConfigs(), requestedIds);
           response.getDesiredHostConfigs(), requestedIds);
       
       
       // only when a cluster request
       // only when a cluster request
-      if (null != response.getPassiveState()) {
-        setResourceProperty(resource, HOST_PASSIVE_STATE_PROPERTY_ID,
-            response.getPassiveState(), requestedIds);
+      if (null != response.getMaintenanceState()) {
+        setResourceProperty(resource, HOST_MAINTENANCE_STATE_PROPERTY_ID,
+            response.getMaintenanceState(), requestedIds);
       }
       }
       
       
       resources.add(resource);
       resources.add(resource);
@@ -322,9 +322,9 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
     hostRequest.setPublicHostName((String) properties.get(HOST_PUBLIC_NAME_PROPERTY_ID));
     hostRequest.setPublicHostName((String) properties.get(HOST_PUBLIC_NAME_PROPERTY_ID));
     hostRequest.setRackInfo((String) properties.get(HOST_RACK_INFO_PROPERTY_ID));
     hostRequest.setRackInfo((String) properties.get(HOST_RACK_INFO_PROPERTY_ID));
     
     
-    Object o = properties.get(HOST_PASSIVE_STATE_PROPERTY_ID);
+    Object o = properties.get(HOST_MAINTENANCE_STATE_PROPERTY_ID);
     if (null != o)
     if (null != o)
-      hostRequest.setPassiveState(o.toString());
+      hostRequest.setMaintenanceState(o.toString());
     
     
     ConfigurationRequest cr = getConfigurationRequest("Hosts", properties);
     ConfigurationRequest cr = getConfigurationRequest("Hosts", properties);
     
     
@@ -498,7 +498,7 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
           
           
           r.setClusterName(clusterName);
           r.setClusterName(clusterName);
           r.setDesiredHostConfigs(h.getDesiredHostConfigs(cluster));
           r.setDesiredHostConfigs(h.getDesiredHostConfigs(cluster));
-          r.setPassiveState(h.getPassiveState(cluster.getClusterId()));
+          r.setMaintenanceState(h.getMaintenanceState(cluster.getClusterId()));
 
 
           response.add(r);
           response.add(r);
         } else if (hostName != null) {
         } else if (hostName != null) {
@@ -530,7 +530,7 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
     AmbariManagementController controller = getManagementController();
     AmbariManagementController controller = getManagementController();
     Clusters                   clusters   = controller.getClusters();
     Clusters                   clusters   = controller.getClusters();
     Set<String>                maintenanceClusters = new HashSet<String>();
     Set<String>                maintenanceClusters = new HashSet<String>();
-
+    
     for (HostRequest request : requests) {
     for (HostRequest request : requests) {
       if (request.getHostname() == null
       if (request.getHostname() == null
           || request.getHostname().isEmpty()) {
           || request.getHostname().isEmpty()) {
@@ -567,16 +567,16 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
         h.setPublicHostName(request.getPublicHostName());
         h.setPublicHostName(request.getPublicHostName());
       }
       }
       
       
-      if (null != request.getClusterName() && null != request.getPassiveState()) {
+      if (null != request.getClusterName() && null != request.getMaintenanceState()) {
         Cluster c = clusters.getCluster(request.getClusterName());
         Cluster c = clusters.getCluster(request.getClusterName());
-        PassiveState newState = PassiveState.valueOf(request.getPassiveState());
-        PassiveState oldState = h.getPassiveState(c.getClusterId());
+        MaintenanceState newState = MaintenanceState.valueOf(request.getMaintenanceState());
+        MaintenanceState oldState = h.getMaintenanceState(c.getClusterId());
         if (!newState.equals(oldState)) {
         if (!newState.equals(oldState)) {
-          if (newState.equals(PassiveState.IMPLIED)) {
+          if (newState.equals(MaintenanceState.IMPLIED)) {
             throw new IllegalArgumentException("Invalid arguments, can only set " +
             throw new IllegalArgumentException("Invalid arguments, can only set " +
-              "passive state to one of " + EnumSet.of(PassiveState.ACTIVE, PassiveState.PASSIVE));
+              "maintenance state to one of " + EnumSet.of(MaintenanceState.OFF, MaintenanceState.ON));
           } else {
           } else {
-            h.setPassiveState(c.getClusterId(), newState);
+            h.setMaintenanceState(c.getClusterId(), newState);
             
             
             maintenanceClusters.add(c.getClusterName());
             maintenanceClusters.add(c.getClusterName());
           }
           }
@@ -624,10 +624,10 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
     
     
     if (maintenanceClusters.size() > 0) {
     if (maintenanceClusters.size() > 0) {
       try {
       try {
-        PassiveStateHelper.createRequests(controller, requestProperties,
+        MaintenanceStateHelper.createRequests(controller, requestProperties,
             maintenanceClusters);
             maintenanceClusters);
       } catch (Exception e) {
       } catch (Exception e) {
-        LOG.warn("Could not send passive status to Nagios (" + e.getMessage() + ")");
+        LOG.warn("Could not send maintenance status to Nagios (" + e.getMessage() + ")");
       }
       }
     }
     }
   }
   }

+ 27 - 26
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java

@@ -37,7 +37,7 @@ import org.apache.ambari.server.ParentObjectNotFoundException;
 import org.apache.ambari.server.ServiceNotFoundException;
 import org.apache.ambari.server.ServiceNotFoundException;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.AmbariManagementController;
-import org.apache.ambari.server.controller.PassiveStateHelper;
+import org.apache.ambari.server.controller.MaintenanceStateHelper;
 import org.apache.ambari.server.controller.RequestStatusResponse;
 import org.apache.ambari.server.controller.RequestStatusResponse;
 import org.apache.ambari.server.controller.ServiceComponentHostRequest;
 import org.apache.ambari.server.controller.ServiceComponentHostRequest;
 import org.apache.ambari.server.controller.ServiceComponentHostResponse;
 import org.apache.ambari.server.controller.ServiceComponentHostResponse;
@@ -56,7 +56,7 @@ import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ComponentInfo;
 import org.apache.ambari.server.state.ComponentInfo;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentHost;
 import org.apache.ambari.server.state.ServiceComponentHost;
@@ -81,7 +81,7 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
   protected static final String SERVICE_CLUSTER_NAME_PROPERTY_ID    = PropertyHelper.getPropertyId("ServiceInfo", "cluster_name");
   protected static final String SERVICE_CLUSTER_NAME_PROPERTY_ID    = PropertyHelper.getPropertyId("ServiceInfo", "cluster_name");
   protected static final String SERVICE_SERVICE_NAME_PROPERTY_ID    = PropertyHelper.getPropertyId("ServiceInfo", "service_name");
   protected static final String SERVICE_SERVICE_NAME_PROPERTY_ID    = PropertyHelper.getPropertyId("ServiceInfo", "service_name");
   protected static final String SERVICE_SERVICE_STATE_PROPERTY_ID   = PropertyHelper.getPropertyId("ServiceInfo", "state");
   protected static final String SERVICE_SERVICE_STATE_PROPERTY_ID   = PropertyHelper.getPropertyId("ServiceInfo", "state");
-  protected static final String SERVICE_PASSIVE_STATE_PROPERTY_ID   = PropertyHelper.getPropertyId("ServiceInfo", "passive_state");
+  protected static final String SERVICE_MAINTENANCE_STATE_PROPERTY_ID   = PropertyHelper.getPropertyId("ServiceInfo", "maintenance_state");
 
 
   //Parameters from the predicate
   //Parameters from the predicate
   private static final String QUERY_PARAMETERS_RUN_SMOKE_TEST_ID =
   private static final String QUERY_PARAMETERS_RUN_SMOKE_TEST_ID =
@@ -176,8 +176,8 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
       setResourceProperty(resource, SERVICE_SERVICE_STATE_PROPERTY_ID,
       setResourceProperty(resource, SERVICE_SERVICE_STATE_PROPERTY_ID,
           calculateServiceState(response.getClusterName(), response.getServiceName()),
           calculateServiceState(response.getClusterName(), response.getServiceName()),
           requestedIds);
           requestedIds);
-      setResourceProperty(resource, SERVICE_PASSIVE_STATE_PROPERTY_ID,
-          response.getPassiveState(), requestedIds);
+      setResourceProperty(resource, SERVICE_MAINTENANCE_STATE_PROPERTY_ID,
+          response.getMaintenanceState(), requestedIds);
       resources.add(resource);
       resources.add(resource);
     }
     }
     return resources;
     return resources;
@@ -277,9 +277,9 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
         (String) properties.get(SERVICE_SERVICE_NAME_PROPERTY_ID),
         (String) properties.get(SERVICE_SERVICE_NAME_PROPERTY_ID),
         (String) properties.get(SERVICE_SERVICE_STATE_PROPERTY_ID));
         (String) properties.get(SERVICE_SERVICE_STATE_PROPERTY_ID));
     
     
-    Object o = properties.get(SERVICE_PASSIVE_STATE_PROPERTY_ID);
+    Object o = properties.get(SERVICE_MAINTENANCE_STATE_PROPERTY_ID);
     if (null != o)
     if (null != o)
-      svcRequest.setPassiveState(o.toString());
+      svcRequest.setMaintenanceState(o.toString());
 
 
     return svcRequest;
     return svcRequest;
   }
   }
@@ -505,6 +505,7 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
     Map<String, Set<String>> serviceNames = new HashMap<String, Set<String>>();
     Map<String, Set<String>> serviceNames = new HashMap<String, Set<String>>();
     Set<State> seenNewStates = new HashSet<State>();
     Set<State> seenNewStates = new HashSet<State>();
 
 
+
     Clusters       clusters        = controller.getClusters();
     Clusters       clusters        = controller.getClusters();
     AmbariMetaInfo ambariMetaInfo   = controller.getAmbariMetaInfo();
     AmbariMetaInfo ambariMetaInfo   = controller.getAmbariMetaInfo();
     Set<String> maintenanceClusters = new HashSet<String>();
     Set<String> maintenanceClusters = new HashSet<String>();
@@ -553,14 +554,14 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
         }
         }
       }
       }
       
       
-      if (null != request.getPassiveState()) {
-        PassiveState newPassive = PassiveState.valueOf(request.getPassiveState());
-        if (newPassive  != s.getPassiveState()) {
-          if (newPassive.equals(PassiveState.IMPLIED)) {
+      if (null != request.getMaintenanceState()) {
+        MaintenanceState newMaint = MaintenanceState.valueOf(request.getMaintenanceState());
+        if (newMaint  != s.getMaintenanceState()) {
+          if (newMaint.equals(MaintenanceState.IMPLIED)) {
             throw new IllegalArgumentException("Invalid arguments, can only set " +
             throw new IllegalArgumentException("Invalid arguments, can only set " +
-              "passive state to one of " + EnumSet.of(PassiveState.ACTIVE, PassiveState.PASSIVE));
+              "maintenance state to one of " + EnumSet.of(MaintenanceState.OFF, MaintenanceState.ON));
           } else {
           } else {
-            s.setPassiveState(newPassive);
+            s.setMaintenanceState(newMaint);
             
             
             maintenanceClusters.add(cluster.getClusterName());
             maintenanceClusters.add(cluster.getClusterName());
           }
           }
@@ -577,9 +578,9 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
         continue;
         continue;
       }
       }
       
       
-      if (requests.size() > 1 && PassiveState.ACTIVE != s.getPassiveState()) {
+      if (requests.size() > 1 && MaintenanceState.OFF != s.getMaintenanceState()) {
         LOG.info("Operations cannot be applied to service " + s.getName() +
         LOG.info("Operations cannot be applied to service " + s.getName() +
-            " in the passive state of " + s.getPassiveState());
+            " in the maintenance state of " + s.getMaintenanceState());
         continue;
         continue;
       }
       }
       
       
@@ -638,7 +639,7 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
         }
         }
         for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()){
         for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()){
           State oldSchState = sch.getState();
           State oldSchState = sch.getState();
-          if (oldSchState == State.MAINTENANCE || oldSchState == State.UNKNOWN) {
+          if (oldSchState == State.DISABLED || oldSchState == State.UNKNOWN) {
             //Ignore host components updates in this state
             //Ignore host components updates in this state
             if (LOG.isDebugEnabled()) {
             if (LOG.isDebugEnabled()) {
               LOG.debug("Ignoring ServiceComponentHost"
               LOG.debug("Ignoring ServiceComponentHost"
@@ -666,12 +667,12 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
             continue;
             continue;
           }
           }
           
           
-          PassiveState schPassive = controller.getEffectivePassiveState(sch);
-          if (PassiveState.PASSIVE == schPassive ||
-              (requests.size() > 1 && PassiveState.ACTIVE != schPassive)) {
+          MaintenanceState schMaint = controller.getEffectiveMaintenanceState(sch);
+          if (MaintenanceState.ON == schMaint ||
+              (requests.size() > 1 && MaintenanceState.OFF != schMaint)) {
             ignoredScHosts.add(sch);
             ignoredScHosts.add(sch);
             if (LOG.isDebugEnabled()) {
             if (LOG.isDebugEnabled()) {
-              LOG.debug("Ignoring " + schPassive + " ServiceComponentHost"
+              LOG.debug("Ignoring " + schMaint + " ServiceComponentHost"
                   + ", clusterName=" + request.getClusterName()
                   + ", clusterName=" + request.getClusterName()
                   + ", serviceName=" + s.getName()
                   + ", serviceName=" + s.getName()
                   + ", componentName=" + sc.getName()
                   + ", componentName=" + sc.getName()
@@ -738,12 +739,12 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
           + " changes for a set of services at the same time");
           + " changes for a set of services at the same time");
     }
     }
     
     
-    if (maintenanceClusters.size() > -0) {
+    if (maintenanceClusters.size() > 0) {
       try {
       try {
-        PassiveStateHelper.createRequests(controller, requestProperties,
+        MaintenanceStateHelper.createRequests(controller, requestProperties,
             maintenanceClusters);
             maintenanceClusters);
       } catch (Exception e) {
       } catch (Exception e) {
-        LOG.warn("Could not send passive status to Nagios (" + e.getMessage() + ")");
+        LOG.warn("Could not send maintenance state to Nagios (" + e.getMessage() + ")");
       }
       }
     }
     }
 
 
@@ -830,7 +831,7 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
                   State state = getHostComponentState(hostComponentResponse);
                   State state = getHostComponentState(hostComponentResponse);
                   switch (state) {
                   switch (state) {
                     case STARTED:
                     case STARTED:
-                    case MAINTENANCE:
+                    case DISABLED:
                       break;
                       break;
                     default:
                     default:
                       return state;
                       return state;
@@ -900,7 +901,7 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
 
 
                   switch (state) {
                   switch (state) {
                     case STARTED:
                     case STARTED:
-                    case MAINTENANCE:
+                    case DISABLED:
                       if (isNameNode) {
                       if (isNameNode) {
                         ++nameNodeActiveCount;
                         ++nameNodeActiveCount;
                       }
                       }
@@ -964,7 +965,7 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
 
 
                   switch (state) {
                   switch (state) {
                     case STARTED:
                     case STARTED:
-                    case MAINTENANCE:
+                    case DISABLED:
                       String componentName = hostComponentResponse.getComponentName();
                       String componentName = hostComponentResponse.getComponentName();
                       if (componentName.equals("HBASE_MASTER")) {
                       if (componentName.equals("HBASE_MASTER")) {
                         ++hBaseMasterActiveCount;
                         ++hBaseMasterActiveCount;

+ 7 - 7
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java

@@ -20,7 +20,7 @@ package org.apache.ambari.server.orm.entities;
 import javax.persistence.*;
 import javax.persistence.*;
 
 
 import org.apache.ambari.server.state.HostComponentAdminState;
 import org.apache.ambari.server.state.HostComponentAdminState;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.State;
 import org.apache.ambari.server.state.State;
 
 
 import static org.apache.commons.lang.StringUtils.defaultString;
 import static org.apache.commons.lang.StringUtils.defaultString;
@@ -71,8 +71,8 @@ public class HostComponentDesiredStateEntity {
   private HostEntity hostEntity;
   private HostEntity hostEntity;
   
   
   @Enumerated(value = EnumType.STRING)
   @Enumerated(value = EnumType.STRING)
-  @Column(name="passive_state", nullable = false, insertable = true, updatable = true)
-  private PassiveState passiveState = PassiveState.ACTIVE;
+  @Column(name="maintenance_state", nullable = false, insertable = true, updatable = true)
+  private MaintenanceState maintenanceState = MaintenanceState.OFF;
 
 
   public Long getClusterId() {
   public Long getClusterId() {
     return clusterId;
     return clusterId;
@@ -131,12 +131,12 @@ public class HostComponentDesiredStateEntity {
     this.adminState = attribute;
     this.adminState = attribute;
   }
   }
   
   
-  public PassiveState getPassiveState() {
-    return passiveState;
+  public MaintenanceState getMaintenanceState() {
+    return maintenanceState;
   }
   }
   
   
-  public void setPassiveState(PassiveState state) {
-    passiveState = state;
+  public void setMaintenanceState(MaintenanceState state) {
+    maintenanceState = state;
   }
   }
 
 
   @Override
   @Override

+ 16 - 11
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java

@@ -18,13 +18,18 @@
 
 
 package org.apache.ambari.server.orm.entities;
 package org.apache.ambari.server.orm.entities;
 
 
-import org.apache.ambari.server.state.HostState;
-import org.apache.ambari.server.state.PassiveState;
-import org.apache.commons.lang.StringUtils;
+import static org.apache.commons.lang.StringUtils.defaultString;
 
 
-import javax.persistence.*;
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
 
 
-import static org.apache.commons.lang.StringUtils.defaultString;
+import org.apache.ambari.server.state.HostState;
 
 
 @javax.persistence.Table(name = "hoststate")
 @javax.persistence.Table(name = "hoststate")
 @Entity
 @Entity
@@ -54,8 +59,8 @@ public class HostStateEntity {
   @Enumerated(value = EnumType.STRING)
   @Enumerated(value = EnumType.STRING)
   private HostState currentState = HostState.INIT;
   private HostState currentState = HostState.INIT;
   
   
-  @Column(name="passive_state", nullable = true, insertable = true, updatable = true)
-  private String passiveState = null;
+  @Column(name="maintenance_state", nullable = true, insertable = true, updatable = true)
+  private String maintenanceState = null;
   
   
 
 
   @OneToOne
   @OneToOne
@@ -110,12 +115,12 @@ public class HostStateEntity {
     this.currentState = currentState;
     this.currentState = currentState;
   }
   }
 
 
-  public String getPassiveState() {
-    return passiveState;
+  public String getMaintenanceState() {
+    return maintenanceState;
   }  
   }  
   
   
-  public void setPassiveState(String state) {
-    passiveState = state;
+  public void setMaintenanceState(String state) {
+    maintenanceState = state;
   }
   }
 
 
   @Override
   @Override

+ 7 - 7
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java

@@ -18,7 +18,7 @@
 
 
 package org.apache.ambari.server.orm.entities;
 package org.apache.ambari.server.orm.entities;
 
 
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.State;
 import org.apache.ambari.server.state.State;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
 
 
@@ -49,9 +49,9 @@ public class ServiceDesiredStateEntity {
   @Basic
   @Basic
   private String desiredStackVersion = "";
   private String desiredStackVersion = "";
 
 
-  @Column(name = "passive_state", nullable = false, insertable = true, updatable = true)
+  @Column(name = "maintenance_state", nullable = false, insertable = true, updatable = true)
   @Enumerated(value = EnumType.STRING)
   @Enumerated(value = EnumType.STRING)
-  private PassiveState passiveState = PassiveState.ACTIVE;
+  private MaintenanceState maintenanceState = MaintenanceState.OFF;
   
   
   
   
   @OneToOne
   @OneToOne
@@ -102,12 +102,12 @@ public class ServiceDesiredStateEntity {
     this.desiredStackVersion = desiredStackVersion;
     this.desiredStackVersion = desiredStackVersion;
   }
   }
   
   
-  public PassiveState getPassiveState() {
-    return passiveState;
+  public MaintenanceState getMaintenanceState() {
+    return maintenanceState;
   }  
   }  
   
   
-  public void setPassiveState(PassiveState state) {
-    passiveState = state;
+  public void setMaintenanceState(MaintenanceState state) {
+    maintenanceState = state;
   }
   }
 
 
   @Override
   @Override

+ 4 - 4
ambari-server/src/main/java/org/apache/ambari/server/state/Host.java

@@ -331,15 +331,15 @@ public interface Host {
   public Map<String, HostConfig> getDesiredHostConfigs(Cluster cluster) throws AmbariException;
   public Map<String, HostConfig> getDesiredHostConfigs(Cluster cluster) throws AmbariException;
   
   
   /**
   /**
-   * Sets the passive state for the host.
+   * Sets the maintenance state for the host.
    * @param clusterId the cluster id
    * @param clusterId the cluster id
    * @param state the state
    * @param state the state
    */
    */
-  public void setPassiveState(long clusterId, PassiveState state);
+  public void setMaintenanceState(long clusterId, MaintenanceState state);
   
   
   /**
   /**
    * @param clusterId the cluster id
    * @param clusterId the cluster id
-   * @return the passive state
+   * @return the maintenance state
    */
    */
-  public PassiveState getPassiveState(long clusterId);
+  public MaintenanceState getMaintenanceState(long clusterId);
 }
 }

+ 5 - 5
ambari-server/src/main/java/org/apache/ambari/server/state/PassiveState.java → ambari-server/src/main/java/org/apache/ambari/server/state/MaintenanceState.java

@@ -21,17 +21,17 @@ package org.apache.ambari.server.state;
  * Indicates when a Service or Host participates in automated opererations, and
  * Indicates when a Service or Host participates in automated opererations, and
  * if alerts are enabled.
  * if alerts are enabled.
  */
  */
-public enum PassiveState {
+public enum MaintenanceState {
   /**
   /**
    * All group-targeted commands are available.  Alerts enabled.
    * All group-targeted commands are available.  Alerts enabled.
    */
    */
-  ACTIVE,
+  OFF,
   /**
   /**
-   * Target was actively put into passive state.  Alerts disabled.
+   * Target was explicitly put into maintenance state.  Alerts disabled.
    */
    */
-  PASSIVE,
+  ON,
   /**
   /**
-   * Target is passive, implied by a parent target.
+   * Target is in maintenance, implied by a parent target.
    */
    */
   IMPLIED
   IMPLIED
 }
 }

+ 5 - 5
ambari-server/src/main/java/org/apache/ambari/server/state/Service.java

@@ -90,15 +90,15 @@ public interface Service {
   ReadWriteLock getClusterGlobalLock();
   ReadWriteLock getClusterGlobalLock();
   
   
   /**
   /**
-   * Sets the passive state for the service
-   * @param state the status
+   * Sets the maintenance state for the service
+   * @param state the state
    */
    */
-  public void setPassiveState(PassiveState state);
+  public void setMaintenanceState(MaintenanceState state);
   
   
   /**
   /**
-   * @return the passive state
+   * @return the maintenance state
    */
    */
-  public PassiveState getPassiveState();
+  public MaintenanceState getMaintenanceState();
 
 
   public enum Type {
   public enum Type {
     HDFS,
     HDFS,

+ 4 - 4
ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHost.java

@@ -115,14 +115,14 @@ public interface ServiceComponentHost {
   public HostState getHostState();
   public HostState getHostState();
 
 
   /**
   /**
-   * @param state the passive state
+   * @param state the maintenance state
    */
    */
-  public void setPassiveState(PassiveState state);
+  public void setMaintenanceState(MaintenanceState state);
   
   
   /**
   /**
-   * @return the passive state
+   * @return the maintenance state
    */
    */
-  public PassiveState getPassiveState();
+  public MaintenanceState getMaintenanceState();
 
 
   
   
 }
 }

+ 2 - 2
ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHostEvent.java

@@ -118,8 +118,8 @@ public abstract class ServiceComponentHostEvent
         return new ServiceComponentHostWipeoutEvent(serviceComponentName, hostName, opTimestamp);
         return new ServiceComponentHostWipeoutEvent(serviceComponentName, hostName, opTimestamp);
       case HOST_SVCCOMP_UPGRADE:
       case HOST_SVCCOMP_UPGRADE:
         return new ServiceComponentHostUpgradeEvent(serviceComponentName, hostName, opTimestamp, stackId);
         return new ServiceComponentHostUpgradeEvent(serviceComponentName, hostName, opTimestamp, stackId);
-      case HOST_SVCCOMP_MAINTENANCE:
-        return new ServiceComponentHostMaintenanceEvent(serviceComponentName, hostName, opTimestamp);
+      case HOST_SVCCOMP_DISABLE:
+        return new ServiceComponentHostDisableEvent(serviceComponentName, hostName, opTimestamp);
       case HOST_SVCCOMP_RESTORE:
       case HOST_SVCCOMP_RESTORE:
         return new ServiceComponentHostRestoreEvent(serviceComponentName, hostName, opTimestamp);
         return new ServiceComponentHostRestoreEvent(serviceComponentName, hostName, opTimestamp);
     }
     }

+ 3 - 3
ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHostEventType.java

@@ -68,11 +68,11 @@ public enum ServiceComponentHostEventType {
    */
    */
   HOST_SVCCOMP_UPGRADE,
   HOST_SVCCOMP_UPGRADE,
   /**
   /**
-   * Putting host component into maintenance state
+   * Putting host component into disabled state
    */
    */
-  HOST_SVCCOMP_MAINTENANCE,
+  HOST_SVCCOMP_DISABLE,
   /**
   /**
-   * Recovering host component from maintenance state
+   * Recovering host component from disable state
    */
    */
   HOST_SVCCOMP_RESTORE
   HOST_SVCCOMP_RESTORE
 
 

+ 5 - 5
ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java

@@ -385,7 +385,7 @@ public class ServiceImpl implements Service {
             getDesiredStackVersion().getStackId(),
             getDesiredStackVersion().getStackId(),
             getDesiredState().toString());
             getDesiredState().toString());
         
         
-        r.setPassiveState(getPassiveState().name());
+        r.setMaintenanceState(getMaintenanceState().name());
         return r;
         return r;
       } finally {
       } finally {
         readWriteLock.readLock().unlock();
         readWriteLock.readLock().unlock();
@@ -652,12 +652,12 @@ public class ServiceImpl implements Service {
   }
   }
   
   
   @Override
   @Override
-  public void setPassiveState(PassiveState state) {
+  public void setMaintenanceState(MaintenanceState state) {
     clusterGlobalLock.readLock().lock();
     clusterGlobalLock.readLock().lock();
     try {
     try {
       try {
       try {
         readWriteLock.writeLock().lock();
         readWriteLock.writeLock().lock();
-        serviceDesiredStateEntity.setPassiveState(state);
+        serviceDesiredStateEntity.setMaintenanceState(state);
         saveIfPersisted();
         saveIfPersisted();
       } finally {
       } finally {
         readWriteLock.writeLock().unlock();
         readWriteLock.writeLock().unlock();
@@ -668,8 +668,8 @@ public class ServiceImpl implements Service {
   }
   }
   
   
   @Override
   @Override
-  public PassiveState getPassiveState() {
-    return serviceDesiredStateEntity.getPassiveState();
+  public MaintenanceState getMaintenanceState() {
+    return serviceDesiredStateEntity.getMaintenanceState();
   }
   }
 
 
 }
 }

+ 5 - 5
ambari-server/src/main/java/org/apache/ambari/server/state/State.java

@@ -68,7 +68,7 @@ public enum State {
   /**
   /**
    * Disabled master's backup state
    * Disabled master's backup state
    */
    */
-  MAINTENANCE,
+  DISABLED,
   /**
   /**
    * State could not be determined.
    * State could not be determined.
    */
    */
@@ -85,7 +85,7 @@ public enum State {
       case INSTALLED:
       case INSTALLED:
       case STARTED:
       case STARTED:
       case UNINSTALLED:
       case UNINSTALLED:
-      case MAINTENANCE:
+      case DISABLED:
         return true;
         return true;
       default:
       default:
         return false;
         return false;
@@ -121,7 +121,7 @@ public enum State {
       case INSTALL_FAILED:
       case INSTALL_FAILED:
       case UNINSTALLED:
       case UNINSTALLED:
       case UNKNOWN:
       case UNKNOWN:
-      case MAINTENANCE:
+      case DISABLED:
         return true;
         return true;
       default:
       default:
         return false;
         return false;
@@ -148,7 +148,7 @@ public enum State {
             || startState == State.UPGRADING
             || startState == State.UPGRADING
             || startState == State.STOPPING
             || startState == State.STOPPING
             || startState == State.UNKNOWN
             || startState == State.UNKNOWN
-            || startState == State.MAINTENANCE) {
+            || startState == State.DISABLED) {
           return true;
           return true;
         }
         }
         break;
         break;
@@ -171,7 +171,7 @@ public enum State {
             || startState == State.WIPING_OUT) {
             || startState == State.WIPING_OUT) {
           return true;
           return true;
         }
         }
-      case MAINTENANCE:
+      case DISABLED:
         if (startState == State.INSTALLED
         if (startState == State.INSTALLED
             || startState == State.UNKNOWN) {
             || startState == State.UNKNOWN) {
           return true;
           return true;

+ 20 - 20
ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java

@@ -52,7 +52,7 @@ import org.apache.ambari.server.state.HostEventType;
 import org.apache.ambari.server.state.HostHealthStatus;
 import org.apache.ambari.server.state.HostHealthStatus;
 import org.apache.ambari.server.state.HostHealthStatus.HealthStatus;
 import org.apache.ambari.server.state.HostHealthStatus.HealthStatus;
 import org.apache.ambari.server.state.HostState;
 import org.apache.ambari.server.state.HostState;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.configgroup.ConfigGroup;
 import org.apache.ambari.server.state.configgroup.ConfigGroup;
 import org.apache.ambari.server.state.fsm.InvalidStateTransitionException;
 import org.apache.ambari.server.state.fsm.InvalidStateTransitionException;
 import org.apache.ambari.server.state.fsm.SingleArcTransition;
 import org.apache.ambari.server.state.fsm.SingleArcTransition;
@@ -93,8 +93,8 @@ public class HostImpl implements Host {
 
 
   private static final Type hostAttributesType =
   private static final Type hostAttributesType =
       new TypeToken<Map<String, String>>() {}.getType();
       new TypeToken<Map<String, String>>() {}.getType();
-  private static final Type passiveMapType =
-      new TypeToken<Map<Long, PassiveState>>() {}.getType();
+  private static final Type maintMapType =
+      new TypeToken<Map<Long, MaintenanceState>>() {}.getType();
 
 
   ReadWriteLock rwLock;
   ReadWriteLock rwLock;
   private final Lock readLock;
   private final Lock readLock;
@@ -115,7 +115,7 @@ public class HostImpl implements Host {
   private Integer currentPingPort = null;
   private Integer currentPingPort = null;
   
   
   private final StateMachine<HostState, HostEventType, HostEvent> stateMachine;
   private final StateMachine<HostState, HostEventType, HostEvent> stateMachine;
-  private Map<Long, PassiveState> passiveMap = null;
+  private Map<Long, MaintenanceState> maintMap = null;
 
 
   
   
   
   
@@ -1230,32 +1230,32 @@ public class HostImpl implements Host {
     return findSelectedByType;
     return findSelectedByType;
   }
   }
   
   
-  private void ensurePassiveMap() {
-    if (null == passiveMap) {
-      String entity = hostStateEntity.getPassiveState();
+  private void ensureMaintMap() {
+    if (null == maintMap) {
+      String entity = hostStateEntity.getMaintenanceState();
       if (null == entity) {
       if (null == entity) {
-        passiveMap = new HashMap<Long, PassiveState>();
+        maintMap = new HashMap<Long, MaintenanceState>();
       } else {
       } else {
         try {
         try {
-          passiveMap = gson.fromJson(entity, passiveMapType);
+          maintMap = gson.fromJson(entity, maintMapType);
         } catch (Exception e) {
         } catch (Exception e) {
-          passiveMap = new HashMap<Long, PassiveState>();
+          maintMap = new HashMap<Long, MaintenanceState>();
         }
         }
       }
       }
     }
     }
   }
   }
   
   
   @Override
   @Override
-  public void setPassiveState(long clusterId, PassiveState state) {
+  public void setMaintenanceState(long clusterId, MaintenanceState state) {
     try {
     try {
       writeLock.lock();
       writeLock.lock();
       
       
-      ensurePassiveMap();
+      ensureMaintMap();
       
       
-      passiveMap.put(Long.valueOf(clusterId), state);
-      String json = gson.toJson(passiveMap, passiveMapType);
+      maintMap.put(Long.valueOf(clusterId), state);
+      String json = gson.toJson(maintMap, maintMapType);
       
       
-      hostStateEntity.setPassiveState(json);
+      hostStateEntity.setMaintenanceState(json);
       saveIfPersisted();
       saveIfPersisted();
     } finally {
     } finally {
       writeLock.unlock();
       writeLock.unlock();
@@ -1263,18 +1263,18 @@ public class HostImpl implements Host {
   }
   }
   
   
   @Override
   @Override
-  public PassiveState getPassiveState(long clusterId) {
+  public MaintenanceState getMaintenanceState(long clusterId) {
     try {
     try {
       readLock.lock();
       readLock.lock();
 
 
-      ensurePassiveMap();
+      ensureMaintMap();
       
       
       Long id = Long.valueOf(clusterId);
       Long id = Long.valueOf(clusterId);
       
       
-      if (!passiveMap.containsKey(id))
-        passiveMap.put(id, PassiveState.ACTIVE);
+      if (!maintMap.containsKey(id))
+        maintMap.put(id, MaintenanceState.OFF);
         
         
-      return passiveMap.get(id);
+      return maintMap.get(id);
     } finally {
     } finally {
       readLock.unlock();
       readLock.unlock();
     }
     }

+ 3 - 3
ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostMaintenanceEvent.java → ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostDisableEvent.java

@@ -21,9 +21,9 @@ package org.apache.ambari.server.state.svccomphost;
 import org.apache.ambari.server.state.ServiceComponentHostEvent;
 import org.apache.ambari.server.state.ServiceComponentHostEvent;
 import org.apache.ambari.server.state.ServiceComponentHostEventType;
 import org.apache.ambari.server.state.ServiceComponentHostEventType;
 
 
-public class ServiceComponentHostMaintenanceEvent extends ServiceComponentHostEvent {
-  public ServiceComponentHostMaintenanceEvent(String serviceComponentName, String hostName, long opTimestamp) {
-    super(ServiceComponentHostEventType.HOST_SVCCOMP_MAINTENANCE,
+public class ServiceComponentHostDisableEvent extends ServiceComponentHostEvent {
+  public ServiceComponentHostDisableEvent(String serviceComponentName, String hostName, long opTimestamp) {
+    super(ServiceComponentHostEventType.HOST_SVCCOMP_DISABLE,
         serviceComponentName, hostName, opTimestamp);
         serviceComponentName, hostName, opTimestamp);
   }
   }
 }
 }

+ 13 - 13
ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java

@@ -45,7 +45,7 @@ import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.HostComponentAdminState;
 import org.apache.ambari.server.state.HostComponentAdminState;
 import org.apache.ambari.server.state.HostConfig;
 import org.apache.ambari.server.state.HostConfig;
 import org.apache.ambari.server.state.HostState;
 import org.apache.ambari.server.state.HostState;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentHost;
 import org.apache.ambari.server.state.ServiceComponentHost;
 import org.apache.ambari.server.state.ServiceComponentHostEvent;
 import org.apache.ambari.server.state.ServiceComponentHostEvent;
@@ -329,21 +329,21 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
          new ServiceComponentHostOpStartedTransition())
          new ServiceComponentHostOpStartedTransition())
 
 
       .addTransition(State.INSTALLED,
       .addTransition(State.INSTALLED,
-          State.MAINTENANCE,
-          ServiceComponentHostEventType.HOST_SVCCOMP_MAINTENANCE,
+          State.DISABLED,
+          ServiceComponentHostEventType.HOST_SVCCOMP_DISABLE,
           new ServiceComponentHostOpCompletedTransition())
           new ServiceComponentHostOpCompletedTransition())
-      .addTransition(State.MAINTENANCE,
-          State.MAINTENANCE,
-          ServiceComponentHostEventType.HOST_SVCCOMP_MAINTENANCE,
+      .addTransition(State.DISABLED,
+          State.DISABLED,
+          ServiceComponentHostEventType.HOST_SVCCOMP_DISABLE,
           new ServiceComponentHostOpCompletedTransition())
           new ServiceComponentHostOpCompletedTransition())
-      .addTransition(State.MAINTENANCE,
+      .addTransition(State.DISABLED,
           State.INSTALLED,
           State.INSTALLED,
           ServiceComponentHostEventType.HOST_SVCCOMP_RESTORE,
           ServiceComponentHostEventType.HOST_SVCCOMP_RESTORE,
           new ServiceComponentHostOpCompletedTransition())
           new ServiceComponentHostOpCompletedTransition())
       
       
       .addTransition(State.UNKNOWN,
       .addTransition(State.UNKNOWN,
-          State.MAINTENANCE,
-          ServiceComponentHostEventType.HOST_SVCCOMP_MAINTENANCE,
+          State.DISABLED,
+          ServiceComponentHostEventType.HOST_SVCCOMP_DISABLE,
           new ServiceComponentHostOpCompletedTransition())
           new ServiceComponentHostOpCompletedTransition())
 
 
      .installTopology();
      .installTopology();
@@ -1383,12 +1383,12 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
   }
   }
   
   
   @Override
   @Override
-  public void setPassiveState(PassiveState state) {
+  public void setMaintenanceState(MaintenanceState state) {
     clusterGlobalLock.readLock().lock();
     clusterGlobalLock.readLock().lock();
     try {
     try {
       writeLock.lock();
       writeLock.lock();
       try {
       try {
-        desiredStateEntity.setPassiveState(state);
+        desiredStateEntity.setMaintenanceState(state);
         saveIfPersisted();
         saveIfPersisted();
       } finally {
       } finally {
         writeLock.unlock();
         writeLock.unlock();
@@ -1399,12 +1399,12 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
   }
   }
 
 
   @Override
   @Override
-  public PassiveState getPassiveState() {
+  public MaintenanceState getMaintenanceState() {
     clusterGlobalLock.readLock().lock();
     clusterGlobalLock.readLock().lock();
     try {
     try {
       readLock.lock();
       readLock.lock();
       try {
       try {
-        return desiredStateEntity.getPassiveState();
+        return desiredStateEntity.getMaintenanceState();
       } finally {
       } finally {
         readLock.unlock();
         readLock.unlock();
       }
       }

+ 20 - 23
ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java

@@ -1,41 +1,38 @@
 package org.apache.ambari.server.upgrade;
 package org.apache.ambari.server.upgrade;
 
 
-import com.google.inject.Inject;
-import com.google.inject.Injector;
+import java.io.File;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Expression;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.orm.DBAccessor.DBColumnInfo;
 import org.apache.ambari.server.orm.DBAccessor.DBColumnInfo;
 import org.apache.ambari.server.orm.dao.ClusterDAO;
 import org.apache.ambari.server.orm.dao.ClusterDAO;
 import org.apache.ambari.server.orm.dao.ClusterStateDAO;
 import org.apache.ambari.server.orm.dao.ClusterStateDAO;
-import org.apache.ambari.server.orm.dao.HostComponentDesiredStateDAO;
 import org.apache.ambari.server.orm.dao.HostComponentStateDAO;
 import org.apache.ambari.server.orm.dao.HostComponentStateDAO;
 import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
 import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
-import org.apache.ambari.server.orm.dao.ServiceComponentDesiredStateDAO;
-import org.apache.ambari.server.orm.dao.ServiceDesiredStateDAO;
 import org.apache.ambari.server.orm.entities.ClusterEntity;
 import org.apache.ambari.server.orm.entities.ClusterEntity;
 import org.apache.ambari.server.orm.entities.ClusterStateEntity;
 import org.apache.ambari.server.orm.entities.ClusterStateEntity;
-import org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity;
 import org.apache.ambari.server.orm.entities.HostComponentStateEntity;
 import org.apache.ambari.server.orm.entities.HostComponentStateEntity;
 import org.apache.ambari.server.orm.entities.HostRoleCommandEntity;
 import org.apache.ambari.server.orm.entities.HostRoleCommandEntity;
-import org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity;
-import org.apache.ambari.server.orm.entities.ServiceDesiredStateEntity;
 import org.apache.ambari.server.state.State;
 import org.apache.ambari.server.state.State;
 import org.eclipse.persistence.jpa.JpaEntityManager;
 import org.eclipse.persistence.jpa.JpaEntityManager;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Expression;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-import java.io.File;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
+
+import com.google.inject.Inject;
+import com.google.inject.Injector;
 
 
 public class UpgradeCatalog150 extends AbstractUpgradeCatalog {
 public class UpgradeCatalog150 extends AbstractUpgradeCatalog {
   private static final Logger LOG = LoggerFactory.getLogger(UpgradeCatalog150.class);
   private static final Logger LOG = LoggerFactory.getLogger(UpgradeCatalog150.class);
@@ -208,9 +205,9 @@ public class UpgradeCatalog150 extends AbstractUpgradeCatalog {
     // ========================================================================
     // ========================================================================
     // Add columns
     // Add columns
 
 
-    dbAccessor.addColumn("hostcomponentdesiredstate", new DBColumnInfo("passive_state", String.class, 32, "ACTIVE", false));
-    dbAccessor.addColumn("servicedesiredstate", new DBColumnInfo("passive_state", String.class, 32, "ACTIVE", false));
-    dbAccessor.addColumn("hoststate", new DBColumnInfo("passive_state", String.class, 512, null, true));
+    dbAccessor.addColumn("hostcomponentdesiredstate", new DBColumnInfo("maintenance_state", String.class, 32, "OFF", false));
+    dbAccessor.addColumn("servicedesiredstate", new DBColumnInfo("maintenance_state", String.class, 32, "OFF", false));
+    dbAccessor.addColumn("hoststate", new DBColumnInfo("maintenance_state", String.class, 512, null, true));
     dbAccessor.addColumn("hostcomponentdesiredstate", new DBColumnInfo("admin_state", String.class, 32, null, true));
     dbAccessor.addColumn("hostcomponentdesiredstate", new DBColumnInfo("admin_state", String.class, 32, null, true));
     dbAccessor.addColumn("hosts", new DBColumnInfo("ph_cpu_count", Integer.class, 32, null, true));
     dbAccessor.addColumn("hosts", new DBColumnInfo("ph_cpu_count", Integer.class, 32, null, true));
     dbAccessor.addColumn("clusterstate", new DBColumnInfo("current_stack_version", String.class, 255, null, false));
     dbAccessor.addColumn("clusterstate", new DBColumnInfo("current_stack_version", String.class, 255, null, false));

+ 3 - 3
ambari-server/src/main/python/UpgradeHelper_HDP2.py

@@ -706,7 +706,7 @@ def delete_mr(options):
   SERVICE_URL_FORMAT = URL_FORMAT + '/services/MAPREDUCE'
   SERVICE_URL_FORMAT = URL_FORMAT + '/services/MAPREDUCE'
   COMPONENT_URL_FORMAT = URL_FORMAT + '/hosts/{2}/host_components/{3}'
   COMPONENT_URL_FORMAT = URL_FORMAT + '/hosts/{2}/host_components/{3}'
   NON_CLIENTS = ["JOBTRACKER", "TASKTRACKER"]
   NON_CLIENTS = ["JOBTRACKER", "TASKTRACKER"]
-  PUT_IN_MAINTENANCE = """{"HostRoles": {"state": "MAINTENANCE"}}"""
+  PUT_IN_DISABLED = """{"HostRoles": {"state": "DISABLED"}}"""
   hostmapping = read_mapping()
   hostmapping = read_mapping()
 
 
   for key, value in hostmapping.items():
   for key, value in hostmapping.items():
@@ -716,7 +716,7 @@ def delete_mr(options):
                         AUTH_FORMAT.format(options.user, options.password),
                         AUTH_FORMAT.format(options.user, options.password),
                         '-H', 'X-Requested-By: ambari',
                         '-H', 'X-Requested-By: ambari',
                         '-X', 'PUT', '-d',
                         '-X', 'PUT', '-d',
-                        PUT_IN_MAINTENANCE,
+                        PUT_IN_DISABLED,
                         COMPONENT_URL_FORMAT.format(options.hostname, options.clustername, host, key))
                         COMPONENT_URL_FORMAT.format(options.hostname, options.clustername, host, key))
         retcode, errdata = validate_response(response, False)
         retcode, errdata = validate_response(response, False)
         if not retcode == 0:
         if not retcode == 0:
@@ -1153,4 +1153,4 @@ if __name__ == "__main__":
     main()
     main()
   except (KeyboardInterrupt, EOFError):
   except (KeyboardInterrupt, EOFError):
     print("\nAborting ... Keyboard Interrupt.")
     print("\nAborting ... Keyboard Interrupt.")
-    sys.exit(1)
+    sys.exit(1)

+ 3 - 3
ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql

@@ -30,12 +30,12 @@ CREATE TABLE clusters (cluster_id BIGINT NOT NULL, cluster_info VARCHAR(255) NOT
 CREATE TABLE clusterconfig (version_tag VARCHAR(255) NOT NULL, type_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, config_data LONGTEXT NOT NULL, create_timestamp BIGINT NOT NULL, PRIMARY KEY (version_tag, type_name, cluster_id));
 CREATE TABLE clusterconfig (version_tag VARCHAR(255) NOT NULL, type_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, config_data LONGTEXT NOT NULL, create_timestamp BIGINT NOT NULL, PRIMARY KEY (version_tag, type_name, cluster_id));
 CREATE TABLE clusterservices (service_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, service_enabled INTEGER NOT NULL, PRIMARY KEY (service_name, cluster_id));
 CREATE TABLE clusterservices (service_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, service_enabled INTEGER NOT NULL, PRIMARY KEY (service_name, cluster_id));
 CREATE TABLE clusterstate (cluster_id BIGINT NOT NULL, current_cluster_state VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id));
 CREATE TABLE clusterstate (cluster_id BIGINT NOT NULL, current_cluster_state VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id));
-CREATE TABLE hostcomponentdesiredstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, admin_state VARCHAR(32), passive_state VARCHAR(32) NOT NULL DEFAULT 'ACTIVE', PRIMARY KEY (cluster_id, component_name, host_name, service_name));
+CREATE TABLE hostcomponentdesiredstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, admin_state VARCHAR(32), maintenance_state VARCHAR(32) NOT NULL DEFAULT 'ACTIVE', PRIMARY KEY (cluster_id, component_name, host_name, service_name));
 CREATE TABLE hostcomponentstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, current_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
 CREATE TABLE hostcomponentstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, current_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
 CREATE TABLE hosts (host_name VARCHAR(255) NOT NULL, cpu_count INTEGER NOT NULL, cpu_info VARCHAR(255) NOT NULL, discovery_status VARCHAR(2000) NOT NULL, host_attributes LONGTEXT NOT NULL, ipv4 VARCHAR(255), ipv6 VARCHAR(255), last_registration_time BIGINT NOT NULL, os_arch VARCHAR(255) NOT NULL, os_info VARCHAR(1000) NOT NULL, os_type VARCHAR(255) NOT NULL, ph_cpu_count INTEGER, public_host_name VARCHAR(255), rack_info VARCHAR(255) NOT NULL, total_mem BIGINT NOT NULL, PRIMARY KEY (host_name));
 CREATE TABLE hosts (host_name VARCHAR(255) NOT NULL, cpu_count INTEGER NOT NULL, cpu_info VARCHAR(255) NOT NULL, discovery_status VARCHAR(2000) NOT NULL, host_attributes LONGTEXT NOT NULL, ipv4 VARCHAR(255), ipv6 VARCHAR(255), last_registration_time BIGINT NOT NULL, os_arch VARCHAR(255) NOT NULL, os_info VARCHAR(1000) NOT NULL, os_type VARCHAR(255) NOT NULL, ph_cpu_count INTEGER, public_host_name VARCHAR(255), rack_info VARCHAR(255) NOT NULL, total_mem BIGINT NOT NULL, PRIMARY KEY (host_name));
-CREATE TABLE hoststate (agent_version VARCHAR(255) NOT NULL, available_mem BIGINT NOT NULL, current_state VARCHAR(255) NOT NULL, health_status VARCHAR(255), host_name VARCHAR(255) NOT NULL, time_in_state BIGINT NOT NULL, passive_state VARCHAR(512), PRIMARY KEY (host_name));
+CREATE TABLE hoststate (agent_version VARCHAR(255) NOT NULL, available_mem BIGINT NOT NULL, current_state VARCHAR(255) NOT NULL, health_status VARCHAR(255), host_name VARCHAR(255) NOT NULL, time_in_state BIGINT NOT NULL, maintenance_state VARCHAR(512), PRIMARY KEY (host_name));
 CREATE TABLE servicecomponentdesiredstate (component_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (component_name, cluster_id, service_name));
 CREATE TABLE servicecomponentdesiredstate (component_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (component_name, cluster_id, service_name));
-CREATE TABLE servicedesiredstate (cluster_id BIGINT NOT NULL, desired_host_role_mapping INTEGER NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, passive_state VARCHAR(32) NOT NULL DEFAULT 'ACTIVE', PRIMARY KEY (cluster_id, service_name));
+CREATE TABLE servicedesiredstate (cluster_id BIGINT NOT NULL, desired_host_role_mapping INTEGER NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, maintenance_state VARCHAR(32) NOT NULL DEFAULT 'ACTIVE', PRIMARY KEY (cluster_id, service_name));
 CREATE TABLE roles (role_name VARCHAR(255) NOT NULL, PRIMARY KEY (role_name));
 CREATE TABLE roles (role_name VARCHAR(255) NOT NULL, PRIMARY KEY (role_name));
 CREATE TABLE users (user_id INTEGER, create_time TIMESTAMP DEFAULT NOW(), ldap_user INTEGER NOT NULL DEFAULT 0, user_name VARCHAR(255) NOT NULL, user_password VARCHAR(255), PRIMARY KEY (user_id));
 CREATE TABLE users (user_id INTEGER, create_time TIMESTAMP DEFAULT NOW(), ldap_user INTEGER NOT NULL DEFAULT 0, user_name VARCHAR(255) NOT NULL, user_password VARCHAR(255), PRIMARY KEY (user_id));
 CREATE TABLE execution_command (task_id BIGINT NOT NULL, command LONGBLOB, PRIMARY KEY (task_id));
 CREATE TABLE execution_command (task_id BIGINT NOT NULL, command LONGBLOB, PRIMARY KEY (task_id));

+ 3 - 3
ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql

@@ -20,12 +20,12 @@ CREATE TABLE clusters (cluster_id NUMBER(19) NOT NULL, cluster_info VARCHAR2(255
 CREATE TABLE clusterconfig (version_tag VARCHAR2(255) NOT NULL, type_name VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, config_data CLOB NOT NULL, create_timestamp NUMBER(19) NOT NULL, PRIMARY KEY (version_tag, type_name, cluster_id));
 CREATE TABLE clusterconfig (version_tag VARCHAR2(255) NOT NULL, type_name VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, config_data CLOB NOT NULL, create_timestamp NUMBER(19) NOT NULL, PRIMARY KEY (version_tag, type_name, cluster_id));
 CREATE TABLE clusterservices (service_name VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, service_enabled NUMBER(10) NOT NULL, PRIMARY KEY (service_name, cluster_id));
 CREATE TABLE clusterservices (service_name VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, service_enabled NUMBER(10) NOT NULL, PRIMARY KEY (service_name, cluster_id));
 CREATE TABLE clusterstate (cluster_id NUMBER(19) NOT NULL, current_cluster_state VARCHAR2(255) NULL, current_stack_version VARCHAR2(255) NULL, PRIMARY KEY (cluster_id));
 CREATE TABLE clusterstate (cluster_id NUMBER(19) NOT NULL, current_cluster_state VARCHAR2(255) NULL, current_stack_version VARCHAR2(255) NULL, PRIMARY KEY (cluster_id));
-CREATE TABLE hostcomponentdesiredstate (cluster_id NUMBER(19) NOT NULL, component_name VARCHAR2(255) NOT NULL, desired_stack_version VARCHAR2(255) NULL, desired_state VARCHAR2(255) NOT NULL, host_name VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, admin_state VARCHAR2(32) NULL, passive_state VARCHAR2(32) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
+CREATE TABLE hostcomponentdesiredstate (cluster_id NUMBER(19) NOT NULL, component_name VARCHAR2(255) NOT NULL, desired_stack_version VARCHAR2(255) NULL, desired_state VARCHAR2(255) NOT NULL, host_name VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, admin_state VARCHAR2(32) NULL, maintenance_state VARCHAR2(32) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
 CREATE TABLE hostcomponentstate (cluster_id NUMBER(19) NOT NULL, component_name VARCHAR2(255) NOT NULL, current_stack_version VARCHAR2(255) NOT NULL, current_state VARCHAR2(255) NOT NULL, host_name VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
 CREATE TABLE hostcomponentstate (cluster_id NUMBER(19) NOT NULL, component_name VARCHAR2(255) NOT NULL, current_stack_version VARCHAR2(255) NOT NULL, current_state VARCHAR2(255) NOT NULL, host_name VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
 CREATE TABLE hosts (host_name VARCHAR2(255) NOT NULL, cpu_count INTEGER NOT NULL, cpu_info VARCHAR2(255) NULL, discovery_status VARCHAR2(2000) NULL, host_attributes CLOB NULL, ipv4 VARCHAR2(255) NULL, ipv6 VARCHAR2(255) NULL, last_registration_time INTEGER NOT NULL, os_arch VARCHAR2(255) NULL, os_info VARCHAR2(1000) NULL, os_type VARCHAR2(255) NULL, ph_cpu_count INTEGER NOT NULL, public_host_name VARCHAR2(255) NULL, rack_info VARCHAR2(255) NOT NULL, total_mem INTEGER NOT NULL, PRIMARY KEY (host_name));
 CREATE TABLE hosts (host_name VARCHAR2(255) NOT NULL, cpu_count INTEGER NOT NULL, cpu_info VARCHAR2(255) NULL, discovery_status VARCHAR2(2000) NULL, host_attributes CLOB NULL, ipv4 VARCHAR2(255) NULL, ipv6 VARCHAR2(255) NULL, last_registration_time INTEGER NOT NULL, os_arch VARCHAR2(255) NULL, os_info VARCHAR2(1000) NULL, os_type VARCHAR2(255) NULL, ph_cpu_count INTEGER NOT NULL, public_host_name VARCHAR2(255) NULL, rack_info VARCHAR2(255) NOT NULL, total_mem INTEGER NOT NULL, PRIMARY KEY (host_name));
-CREATE TABLE hoststate (agent_version VARCHAR2(255) NULL, available_mem NUMBER(19) NOT NULL, current_state VARCHAR2(255) NOT NULL, health_status VARCHAR2(255) NULL, host_name VARCHAR2(255) NOT NULL, time_in_state NUMBER(19) NOT NULL, passive_state VARCHAR2(512), PRIMARY KEY (host_name));
+CREATE TABLE hoststate (agent_version VARCHAR2(255) NULL, available_mem NUMBER(19) NOT NULL, current_state VARCHAR2(255) NOT NULL, health_status VARCHAR2(255) NULL, host_name VARCHAR2(255) NOT NULL, time_in_state NUMBER(19) NOT NULL, maintenance_state VARCHAR2(512), PRIMARY KEY (host_name));
 CREATE TABLE servicecomponentdesiredstate (component_name VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, desired_stack_version VARCHAR2(255) NULL, desired_state VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, PRIMARY KEY (component_name, cluster_id, service_name));
 CREATE TABLE servicecomponentdesiredstate (component_name VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, desired_stack_version VARCHAR2(255) NULL, desired_state VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, PRIMARY KEY (component_name, cluster_id, service_name));
-CREATE TABLE servicedesiredstate (cluster_id NUMBER(19) NOT NULL, desired_host_role_mapping NUMBER(10) NOT NULL, desired_stack_version VARCHAR2(255) NULL, desired_state VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, passive_state VARCHAR2(32) NOT NULL, PRIMARY KEY (cluster_id, service_name));
+CREATE TABLE servicedesiredstate (cluster_id NUMBER(19) NOT NULL, desired_host_role_mapping NUMBER(10) NOT NULL, desired_stack_version VARCHAR2(255) NULL, desired_state VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, maintenance_state VARCHAR2(32) NOT NULL, PRIMARY KEY (cluster_id, service_name));
 CREATE TABLE roles (role_name VARCHAR2(255) NOT NULL, PRIMARY KEY (role_name));
 CREATE TABLE roles (role_name VARCHAR2(255) NOT NULL, PRIMARY KEY (role_name));
 CREATE TABLE users (user_id NUMBER(10) NOT NULL, create_time TIMESTAMP NULL, ldap_user NUMBER(10) DEFAULT 0, user_name VARCHAR2(255) NULL, user_password VARCHAR2(255) NULL, PRIMARY KEY (user_id));
 CREATE TABLE users (user_id NUMBER(10) NOT NULL, create_time TIMESTAMP NULL, ldap_user NUMBER(10) DEFAULT 0, user_name VARCHAR2(255) NULL, user_password VARCHAR2(255) NULL, PRIMARY KEY (user_id));
 CREATE TABLE execution_command (task_id NUMBER(19) NOT NULL, command BLOB NULL, PRIMARY KEY (task_id));
 CREATE TABLE execution_command (task_id NUMBER(19) NOT NULL, command BLOB NULL, PRIMARY KEY (task_id));

+ 3 - 3
ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql

@@ -43,7 +43,7 @@ GRANT ALL PRIVILEGES ON TABLE ambari.clusterservices TO :username;
 CREATE TABLE ambari.clusterstate (cluster_id BIGINT NOT NULL, current_cluster_state VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id));
 CREATE TABLE ambari.clusterstate (cluster_id BIGINT NOT NULL, current_cluster_state VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id));
 GRANT ALL PRIVILEGES ON TABLE ambari.clusterstate TO :username;
 GRANT ALL PRIVILEGES ON TABLE ambari.clusterstate TO :username;
 
 
-CREATE TABLE ambari.hostcomponentdesiredstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, admin_state VARCHAR(32), passive_state VARCHAR(32) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
+CREATE TABLE ambari.hostcomponentdesiredstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, admin_state VARCHAR(32), maintenance_state VARCHAR(32) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
 GRANT ALL PRIVILEGES ON TABLE ambari.hostcomponentdesiredstate TO :username;
 GRANT ALL PRIVILEGES ON TABLE ambari.hostcomponentdesiredstate TO :username;
 
 
 CREATE TABLE ambari.hostcomponentstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, current_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
 CREATE TABLE ambari.hostcomponentstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, current_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
@@ -52,13 +52,13 @@ GRANT ALL PRIVILEGES ON TABLE ambari.hostcomponentstate TO :username;
 CREATE TABLE ambari.hosts (host_name VARCHAR(255) NOT NULL, cpu_count INTEGER NOT NULL, ph_cpu_count INTEGER, cpu_info VARCHAR(255) NOT NULL, discovery_status VARCHAR(2000) NOT NULL, host_attributes VARCHAR(20000) NOT NULL, ipv4 VARCHAR(255), ipv6 VARCHAR(255), public_host_name VARCHAR(255), last_registration_time BIGINT NOT NULL, os_arch VARCHAR(255) NOT NULL, os_info VARCHAR(1000) NOT NULL, os_type VARCHAR(255) NOT NULL, rack_info VARCHAR(255) NOT NULL, total_mem BIGINT NOT NULL, PRIMARY KEY (host_name));
 CREATE TABLE ambari.hosts (host_name VARCHAR(255) NOT NULL, cpu_count INTEGER NOT NULL, ph_cpu_count INTEGER, cpu_info VARCHAR(255) NOT NULL, discovery_status VARCHAR(2000) NOT NULL, host_attributes VARCHAR(20000) NOT NULL, ipv4 VARCHAR(255), ipv6 VARCHAR(255), public_host_name VARCHAR(255), last_registration_time BIGINT NOT NULL, os_arch VARCHAR(255) NOT NULL, os_info VARCHAR(1000) NOT NULL, os_type VARCHAR(255) NOT NULL, rack_info VARCHAR(255) NOT NULL, total_mem BIGINT NOT NULL, PRIMARY KEY (host_name));
 GRANT ALL PRIVILEGES ON TABLE ambari.hosts TO :username;
 GRANT ALL PRIVILEGES ON TABLE ambari.hosts TO :username;
 
 
-CREATE TABLE ambari.hoststate (agent_version VARCHAR(255) NOT NULL, available_mem BIGINT NOT NULL, current_state VARCHAR(255) NOT NULL, health_status VARCHAR(255), host_name VARCHAR(255) NOT NULL, time_in_state BIGINT NOT NULL, passive_state VARCHAR(512), PRIMARY KEY (host_name));
+CREATE TABLE ambari.hoststate (agent_version VARCHAR(255) NOT NULL, available_mem BIGINT NOT NULL, current_state VARCHAR(255) NOT NULL, health_status VARCHAR(255), host_name VARCHAR(255) NOT NULL, time_in_state BIGINT NOT NULL, maintenance_state VARCHAR(512), PRIMARY KEY (host_name));
 GRANT ALL PRIVILEGES ON TABLE ambari.hoststate TO :username;
 GRANT ALL PRIVILEGES ON TABLE ambari.hoststate TO :username;
 
 
 CREATE TABLE ambari.servicecomponentdesiredstate (component_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (component_name, cluster_id, service_name));
 CREATE TABLE ambari.servicecomponentdesiredstate (component_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (component_name, cluster_id, service_name));
 GRANT ALL PRIVILEGES ON TABLE ambari.servicecomponentdesiredstate TO :username;
 GRANT ALL PRIVILEGES ON TABLE ambari.servicecomponentdesiredstate TO :username;
 
 
-CREATE TABLE ambari.servicedesiredstate (cluster_id BIGINT NOT NULL, desired_host_role_mapping INTEGER NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, passive_state VARCHAR(32) NOT NULL, PRIMARY KEY (cluster_id, service_name));
+CREATE TABLE ambari.servicedesiredstate (cluster_id BIGINT NOT NULL, desired_host_role_mapping INTEGER NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, maintenance_state VARCHAR(32) NOT NULL, PRIMARY KEY (cluster_id, service_name));
 GRANT ALL PRIVILEGES ON TABLE ambari.servicedesiredstate TO :username;
 GRANT ALL PRIVILEGES ON TABLE ambari.servicedesiredstate TO :username;
 
 
 CREATE TABLE ambari.roles (role_name VARCHAR(255) NOT NULL, PRIMARY KEY (role_name));
 CREATE TABLE ambari.roles (role_name VARCHAR(255) NOT NULL, PRIMARY KEY (role_name));

+ 3 - 3
ambari-server/src/main/resources/Ambari-DDL-Postgres-REMOTE-CREATE.sql

@@ -24,12 +24,12 @@ CREATE TABLE ambari.clusterconfig (version_tag VARCHAR(255) NOT NULL, type_name
 CREATE TABLE ambari.clusterconfigmapping (cluster_id bigint NOT NULL, type_name VARCHAR(255) NOT NULL, version_tag VARCHAR(255) NOT NULL, create_timestamp BIGINT NOT NULL, selected INTEGER NOT NULL DEFAULT 0, user_name VARCHAR(255) NOT NULL DEFAULT '_db', PRIMARY KEY (cluster_id, type_name, create_timestamp));
 CREATE TABLE ambari.clusterconfigmapping (cluster_id bigint NOT NULL, type_name VARCHAR(255) NOT NULL, version_tag VARCHAR(255) NOT NULL, create_timestamp BIGINT NOT NULL, selected INTEGER NOT NULL DEFAULT 0, user_name VARCHAR(255) NOT NULL DEFAULT '_db', PRIMARY KEY (cluster_id, type_name, create_timestamp));
 CREATE TABLE ambari.clusterservices (service_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, service_enabled INTEGER NOT NULL, PRIMARY KEY (service_name, cluster_id));
 CREATE TABLE ambari.clusterservices (service_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, service_enabled INTEGER NOT NULL, PRIMARY KEY (service_name, cluster_id));
 CREATE TABLE ambari.clusterstate (cluster_id BIGINT NOT NULL, current_cluster_state VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id));
 CREATE TABLE ambari.clusterstate (cluster_id BIGINT NOT NULL, current_cluster_state VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id));
-CREATE TABLE ambari.hostcomponentdesiredstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, passive_state VARCHAR(32) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
+CREATE TABLE ambari.hostcomponentdesiredstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, maintenance_state VARCHAR(32) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
 CREATE TABLE ambari.hostcomponentstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, current_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
 CREATE TABLE ambari.hostcomponentstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, current_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
 CREATE TABLE ambari.hosts (host_name VARCHAR(255) NOT NULL, cpu_count INTEGER NOT NULL, ph_cpu_count INTEGER, cpu_info VARCHAR(255) NOT NULL, discovery_status VARCHAR(2000) NOT NULL, host_attributes VARCHAR(20000) NOT NULL, ipv4 VARCHAR(255), ipv6 VARCHAR(255), public_host_name VARCHAR(255), last_registration_time BIGINT NOT NULL, os_arch VARCHAR(255) NOT NULL, os_info VARCHAR(1000) NOT NULL, os_type VARCHAR(255) NOT NULL, rack_info VARCHAR(255) NOT NULL, total_mem BIGINT NOT NULL, PRIMARY KEY (host_name));
 CREATE TABLE ambari.hosts (host_name VARCHAR(255) NOT NULL, cpu_count INTEGER NOT NULL, ph_cpu_count INTEGER, cpu_info VARCHAR(255) NOT NULL, discovery_status VARCHAR(2000) NOT NULL, host_attributes VARCHAR(20000) NOT NULL, ipv4 VARCHAR(255), ipv6 VARCHAR(255), public_host_name VARCHAR(255), last_registration_time BIGINT NOT NULL, os_arch VARCHAR(255) NOT NULL, os_info VARCHAR(1000) NOT NULL, os_type VARCHAR(255) NOT NULL, rack_info VARCHAR(255) NOT NULL, total_mem BIGINT NOT NULL, PRIMARY KEY (host_name));
-CREATE TABLE ambari.hoststate (agent_version VARCHAR(255) NOT NULL, available_mem BIGINT NOT NULL, current_state VARCHAR(255) NOT NULL, health_status VARCHAR(255), host_name VARCHAR(255) NOT NULL, time_in_state BIGINT NOT NULL, passive_state VARCHAR(512) PRIMARY KEY (host_name));
+CREATE TABLE ambari.hoststate (agent_version VARCHAR(255) NOT NULL, available_mem BIGINT NOT NULL, current_state VARCHAR(255) NOT NULL, health_status VARCHAR(255), host_name VARCHAR(255) NOT NULL, time_in_state BIGINT NOT NULL, maintenance_state VARCHAR(512) PRIMARY KEY (host_name));
 CREATE TABLE ambari.servicecomponentdesiredstate (component_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (component_name, cluster_id, service_name));
 CREATE TABLE ambari.servicecomponentdesiredstate (component_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (component_name, cluster_id, service_name));
-CREATE TABLE ambari.servicedesiredstate (cluster_id BIGINT NOT NULL, desired_host_role_mapping INTEGER NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, passive_state VARCHAR(32) NOT NULL, PRIMARY KEY (cluster_id, service_name));
+CREATE TABLE ambari.servicedesiredstate (cluster_id BIGINT NOT NULL, desired_host_role_mapping INTEGER NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, maintenance_state VARCHAR(32) NOT NULL, PRIMARY KEY (cluster_id, service_name));
 CREATE TABLE ambari.roles (role_name VARCHAR(255) NOT NULL, PRIMARY KEY (role_name));
 CREATE TABLE ambari.roles (role_name VARCHAR(255) NOT NULL, PRIMARY KEY (role_name));
 CREATE TABLE ambari.users (user_id INTEGER, ldap_user INTEGER NOT NULL DEFAULT 0, user_name VARCHAR(255) NOT NULL, create_time TIMESTAMP DEFAULT NOW(), user_password VARCHAR(255), PRIMARY KEY (user_id), UNIQUE (ldap_user, user_name));
 CREATE TABLE ambari.users (user_id INTEGER, ldap_user INTEGER NOT NULL DEFAULT 0, user_name VARCHAR(255) NOT NULL, create_time TIMESTAMP DEFAULT NOW(), user_password VARCHAR(255), PRIMARY KEY (user_id), UNIQUE (ldap_user, user_name));
 CREATE TABLE ambari.execution_command (command bytea, task_id BIGINT NOT NULL, PRIMARY KEY (task_id));
 CREATE TABLE ambari.execution_command (command bytea, task_id BIGINT NOT NULL, PRIMARY KEY (task_id));

+ 3 - 3
ambari-server/src/main/resources/properties.json

@@ -11,7 +11,7 @@
         "ServiceInfo/service_name",
         "ServiceInfo/service_name",
         "ServiceInfo/cluster_name",
         "ServiceInfo/cluster_name",
         "ServiceInfo/state",
         "ServiceInfo/state",
-        "ServiceInfo/passive_state",
+        "ServiceInfo/maintenance_state",
         "Services/description",
         "Services/description",
         "Services/display_name",
         "Services/display_name",
         "Services/attributes",
         "Services/attributes",
@@ -38,7 +38,7 @@
         "Hosts/host_health_report",
         "Hosts/host_health_report",
         "Hosts/public_host_name",
         "Hosts/public_host_name",
         "Hosts/host_state",
         "Hosts/host_state",
-        "Hosts/passive_state",
+        "Hosts/maintenance_state",
         "Hosts/desired_configs",
         "Hosts/desired_configs",
         "_"
         "_"
     ],
     ],
@@ -67,7 +67,7 @@
         "HostRoles/nagios_alerts",
         "HostRoles/nagios_alerts",
         "HostRoles/stale_configs",
         "HostRoles/stale_configs",
         "HostRoles/desired_admin_state",
         "HostRoles/desired_admin_state",
-        "HostRoles/passive_state",
+        "HostRoles/maintenance_state",
         "_"
         "_"
     ],
     ],
     "Configuration":[
     "Configuration":[

+ 2 - 2
ambari-server/src/main/resources/scripts/relocate_host_components.py

@@ -40,7 +40,7 @@ START_ON_RELOCATE = False
 
 
 # Supported Actions
 # Supported Actions
 RELOCATE_ACTION = 'relocate'
 RELOCATE_ACTION = 'relocate'
-ALLOWED_ACTUAL_STATES_FOR_RELOCATE = [ 'INIT', 'UNKNOWN', 'MAINTENANCE', 'UNINSTALLED' ]
+ALLOWED_ACTUAL_STATES_FOR_RELOCATE = [ 'INIT', 'UNKNOWN', 'DISABLED', 'UNINSTALLED' ]
 ALLOWED_HOST_STATUS_FOR_RELOCATE = [ 'HEALTHY' ]
 ALLOWED_HOST_STATUS_FOR_RELOCATE = [ 'HEALTHY' ]
 STATUS_WAIT_TIMEOUT = 120 # seconds
 STATUS_WAIT_TIMEOUT = 120 # seconds
 STATUS_CHECK_INTERVAL = 10 # seconds
 STATUS_CHECK_INTERVAL = 10 # seconds
@@ -129,7 +129,7 @@ class AmbariResource:
 
 
     # Put host component in Maintenance state
     # Put host component in Maintenance state
     self.updateHostComponentStatus(self.old_hostname, self.componentName,
     self.updateHostComponentStatus(self.old_hostname, self.componentName,
-                                   "Maintenance", "MAINTENANCE")
+                                   "Disable", "DISABLED")
 
 
     # Delete current host component
     # Delete current host component
     self.deleteHostComponent(self.old_hostname, self.componentName)
     self.deleteHostComponent(self.old_hostname, self.componentName)

+ 4 - 4
ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java

@@ -71,7 +71,7 @@ import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.HostHealthStatus;
 import org.apache.ambari.server.state.HostHealthStatus;
 import org.apache.ambari.server.state.HostState;
 import org.apache.ambari.server.state.HostState;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponentHost;
 import org.apache.ambari.server.state.ServiceComponentHost;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.StackId;
@@ -1389,9 +1389,9 @@ public class TestHeartbeatHandler {
     handler.handleHeartBeat(hb2);
     handler.handleHeartBeat(hb2);
     assertEquals(HostHealthStatus.HealthStatus.ALERT.name(), hostObject.getStatus());
     assertEquals(HostHealthStatus.HealthStatus.ALERT.name(), hostObject.getStatus());
     
     
-    // mark the installed DN as passive
+    // mark the installed DN as maintenance
     hdfs.getServiceComponent(DATANODE).getServiceComponentHost(
     hdfs.getServiceComponent(DATANODE).getServiceComponentHost(
-        DummyHostname1).setPassiveState(PassiveState.PASSIVE);
+        DummyHostname1).setMaintenanceState(MaintenanceState.ON);
     HeartBeat hb2a = new HeartBeat();
     HeartBeat hb2a = new HeartBeat();
     hb2a.setResponseId(2);
     hb2a.setResponseId(2);
     hb2a.setNodeStatus(new HostStatus(Status.HEALTHY, DummyHostStatus));
     hb2a.setNodeStatus(new HostStatus(Status.HEALTHY, DummyHostStatus));
@@ -1414,7 +1414,7 @@ public class TestHeartbeatHandler {
     assertEquals(HostHealthStatus.HealthStatus.HEALTHY.name(), hostObject.getStatus());
     assertEquals(HostHealthStatus.HealthStatus.HEALTHY.name(), hostObject.getStatus());
     
     
     hdfs.getServiceComponent(DATANODE).getServiceComponentHost(
     hdfs.getServiceComponent(DATANODE).getServiceComponentHost(
-        DummyHostname1).setPassiveState(PassiveState.ACTIVE);
+        DummyHostname1).setMaintenanceState(MaintenanceState.OFF);
     
     
     //Some masters are down
     //Some masters are down
     HeartBeat hb3 = new HeartBeat();
     HeartBeat hb3 = new HeartBeat();

+ 4 - 5
ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java

@@ -18,7 +18,6 @@
 package org.apache.ambari.server.agent;
 package org.apache.ambari.server.agent;
 
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import static org.junit.Assert.fail;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Matchers.eq;
@@ -48,8 +47,8 @@ import org.apache.ambari.server.state.ServiceComponentHost;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.State;
 import org.apache.ambari.server.state.State;
 import org.apache.ambari.server.state.fsm.InvalidStateTransitionException;
 import org.apache.ambari.server.state.fsm.InvalidStateTransitionException;
+import org.apache.ambari.server.state.svccomphost.ServiceComponentHostDisableEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostInstallEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostInstallEvent;
-import org.apache.ambari.server.state.svccomphost.ServiceComponentHostMaintenanceEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostOpSucceededEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostOpSucceededEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostStartedEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostStartedEvent;
 import org.junit.After;
 import org.junit.After;
@@ -441,8 +440,8 @@ public class TestHeartbeatMonitor {
         sch.handleEvent(new ServiceComponentHostOpSucceededEvent(sch.getServiceComponentName(),
         sch.handleEvent(new ServiceComponentHostOpSucceededEvent(sch.getServiceComponentName(),
           sch.getHostName(), System.currentTimeMillis()));
           sch.getHostName(), System.currentTimeMillis()));
 
 
-        // maintenance
-        sch.handleEvent(new ServiceComponentHostMaintenanceEvent(sch.getServiceComponentName(),
+        // disabled
+        sch.handleEvent(new ServiceComponentHostDisableEvent(sch.getServiceComponentName(),
           sch.getHostName(), System.currentTimeMillis()));
           sch.getHostName(), System.currentTimeMillis()));
       }
       }
     }
     }
@@ -474,7 +473,7 @@ public class TestHeartbeatMonitor {
       else if (sc.isClientComponent())
       else if (sc.isClientComponent())
         assertEquals(sch.getServiceComponentName(), State.INIT, sch.getState());
         assertEquals(sch.getServiceComponentName(), State.INIT, sch.getState());
       else if (sch.getServiceComponentName().equals("SECONDARY_NAMENODE"))
       else if (sch.getServiceComponentName().equals("SECONDARY_NAMENODE"))
-        assertEquals(sch.getServiceComponentName(), State.MAINTENANCE,
+        assertEquals(sch.getServiceComponentName(), State.DISABLED,
           sch.getState());
           sch.getState());
     }
     }
   }
   }

+ 35 - 35
ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java

@@ -48,7 +48,7 @@ import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.Host;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentHost;
 import org.apache.ambari.server.state.ServiceComponentHost;
@@ -281,8 +281,8 @@ public class AmbariManagementControllerImplTest {
     ServiceComponentHost componentHost = createNiceMock(ServiceComponentHost.class);
     ServiceComponentHost componentHost = createNiceMock(ServiceComponentHost.class);
     ServiceComponentHostResponse response = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response = createNiceMock(ServiceComponentHostResponse.class);
 
 
-    PassiveStateHelper passiveHelper = createNiceMock(PassiveStateHelper.class);
-    expect(passiveHelper.getEffectiveState(componentHost)).andReturn(PassiveState.ACTIVE).anyTimes();
+    MaintenanceStateHelper maintHelper = createNiceMock(MaintenanceStateHelper.class);
+    expect(maintHelper.getEffectiveState(componentHost)).andReturn(MaintenanceState.OFF).anyTimes();
     
     
     // requests
     // requests
     ServiceComponentHostRequest request1 = new ServiceComponentHostRequest(
     ServiceComponentHostRequest request1 = new ServiceComponentHostRequest(
@@ -296,7 +296,7 @@ public class AmbariManagementControllerImplTest {
     injector.injectMembers(capture(controllerCapture));
     injector.injectMembers(capture(controllerCapture));
     
     
     expect(injector.getInstance(Gson.class)).andReturn(null);
     expect(injector.getInstance(Gson.class)).andReturn(null);
-    expect(injector.getInstance(PassiveStateHelper.class)).andReturn(passiveHelper);
+    expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(maintHelper);
 
 
     // getHostComponent
     // getHostComponent
     expect(clusters.getCluster("cluster1")).andReturn(cluster);
     expect(clusters.getCluster("cluster1")).andReturn(cluster);
@@ -314,7 +314,7 @@ public class AmbariManagementControllerImplTest {
     expect(componentHost.convertToResponse()).andReturn(response);
     expect(componentHost.convertToResponse()).andReturn(response);
 
 
     // replay mocks
     // replay mocks
-    replay(passiveHelper, injector, clusters, cluster, host, response, stack,
+    replay(maintHelper, injector, clusters, cluster, host, response, stack,
         metaInfo, service, component, componentHost);
         metaInfo, service, component, componentHost);
 
 
     //test
     //test
@@ -420,9 +420,9 @@ public class AmbariManagementControllerImplTest {
     ServiceComponentHost componentHost2 = createNiceMock(ServiceComponentHost.class);
     ServiceComponentHost componentHost2 = createNiceMock(ServiceComponentHost.class);
     ServiceComponentHostResponse response1 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response1 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response2 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response2 = createNiceMock(ServiceComponentHostResponse.class);
-    PassiveStateHelper passiveStateHelper = createNiceMock(PassiveStateHelper.class);
-    expect(passiveStateHelper.getEffectiveState(capture(new Capture<ServiceComponentHost>())
-        )).andReturn(PassiveState.ACTIVE).anyTimes();
+    MaintenanceStateHelper stateHelper = createNiceMock(MaintenanceStateHelper.class);
+    expect(stateHelper.getEffectiveState(capture(new Capture<ServiceComponentHost>())
+        )).andReturn(MaintenanceState.OFF).anyTimes();
     
     
     // requests
     // requests
     ServiceComponentHostRequest request1 = new ServiceComponentHostRequest(
     ServiceComponentHostRequest request1 = new ServiceComponentHostRequest(
@@ -444,7 +444,7 @@ public class AmbariManagementControllerImplTest {
     // constructor init
     // constructor init
     injector.injectMembers(capture(controllerCapture));
     injector.injectMembers(capture(controllerCapture));
     expect(injector.getInstance(Gson.class)).andReturn(null);
     expect(injector.getInstance(Gson.class)).andReturn(null);
-    expect(injector.getInstance(PassiveStateHelper.class)).andReturn(passiveStateHelper).anyTimes();
+    expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(stateHelper).anyTimes();
 
 
 
 
     // getHostComponent
     // getHostComponent
@@ -477,7 +477,7 @@ public class AmbariManagementControllerImplTest {
     expect(componentHost2.convertToResponse()).andReturn(response2);
     expect(componentHost2.convertToResponse()).andReturn(response2);
 
 
     // replay mocks
     // replay mocks
-    replay(passiveStateHelper, injector, clusters, cluster, host, stack,
+    replay(stateHelper, injector, clusters, cluster, host, stack,
         metaInfo, service, component, component2, component3, componentHost1,
         metaInfo, service, component, component2, component3, componentHost1,
         componentHost2, response1, response2);
         componentHost2, response1, response2);
 
 
@@ -521,9 +521,9 @@ public class AmbariManagementControllerImplTest {
     ServiceComponentHost componentHost2 = createNiceMock(ServiceComponentHost.class);
     ServiceComponentHost componentHost2 = createNiceMock(ServiceComponentHost.class);
     ServiceComponentHostResponse response1 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response1 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response2 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response2 = createNiceMock(ServiceComponentHostResponse.class);
-    PassiveStateHelper passiveHelper = createNiceMock(PassiveStateHelper.class);
-    expect(passiveHelper.getEffectiveState(capture(
-        new Capture<ServiceComponentHost>()))).andReturn(PassiveState.ACTIVE).anyTimes();
+    MaintenanceStateHelper maintHelper = createNiceMock(MaintenanceStateHelper.class);
+    expect(maintHelper.getEffectiveState(capture(
+        new Capture<ServiceComponentHost>()))).andReturn(MaintenanceState.OFF).anyTimes();
 
 
     // requests
     // requests
     ServiceComponentHostRequest request1 = new ServiceComponentHostRequest(
     ServiceComponentHostRequest request1 = new ServiceComponentHostRequest(
@@ -545,7 +545,7 @@ public class AmbariManagementControllerImplTest {
     // constructor init
     // constructor init
     injector.injectMembers(capture(controllerCapture));
     injector.injectMembers(capture(controllerCapture));
     expect(injector.getInstance(Gson.class)).andReturn(null);
     expect(injector.getInstance(Gson.class)).andReturn(null);
-    expect(injector.getInstance(PassiveStateHelper.class)).andReturn(passiveHelper).anyTimes();
+    expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(maintHelper).anyTimes();
     
     
     // getHostComponent
     // getHostComponent
     expect(clusters.getCluster("cluster1")).andReturn(cluster).times(3);
     expect(clusters.getCluster("cluster1")).andReturn(cluster).times(3);
@@ -575,7 +575,7 @@ public class AmbariManagementControllerImplTest {
     expect(componentHost2.convertToResponse()).andReturn(response2);
     expect(componentHost2.convertToResponse()).andReturn(response2);
 
 
     // replay mocks
     // replay mocks
-    replay(passiveHelper, injector, clusters, cluster, host, stack, metaInfo,
+    replay(maintHelper, injector, clusters, cluster, host, stack, metaInfo,
         service, component, component2, component3, componentHost1,
         service, component, component2, component3, componentHost1,
         componentHost2, response1, response2);
         componentHost2, response1, response2);
 
 
@@ -621,9 +621,9 @@ public class AmbariManagementControllerImplTest {
     ServiceComponentHostResponse response1 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response1 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response2 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response2 = createNiceMock(ServiceComponentHostResponse.class);
     
     
-    PassiveStateHelper passiveHelper = createNiceMock(PassiveStateHelper.class);
-    expect(passiveHelper.getEffectiveState(capture(
-        new Capture<ServiceComponentHost>()))).andReturn(PassiveState.ACTIVE).anyTimes();
+    MaintenanceStateHelper maintHelper = createNiceMock(MaintenanceStateHelper.class);
+    expect(maintHelper.getEffectiveState(capture(
+        new Capture<ServiceComponentHost>()))).andReturn(MaintenanceState.OFF).anyTimes();
 
 
     // requests
     // requests
     ServiceComponentHostRequest request1 = new ServiceComponentHostRequest(
     ServiceComponentHostRequest request1 = new ServiceComponentHostRequest(
@@ -645,7 +645,7 @@ public class AmbariManagementControllerImplTest {
     // constructor init
     // constructor init
     injector.injectMembers(capture(controllerCapture));
     injector.injectMembers(capture(controllerCapture));
     expect(injector.getInstance(Gson.class)).andReturn(null);
     expect(injector.getInstance(Gson.class)).andReturn(null);
-    expect(injector.getInstance(PassiveStateHelper.class)).andReturn(passiveHelper).anyTimes();
+    expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(maintHelper).anyTimes();
 
 
     // getHostComponent
     // getHostComponent
     expect(clusters.getCluster("cluster1")).andReturn(cluster).times(3);
     expect(clusters.getCluster("cluster1")).andReturn(cluster).times(3);
@@ -676,7 +676,7 @@ public class AmbariManagementControllerImplTest {
     expect(componentHost2.convertToResponse()).andReturn(response2);
     expect(componentHost2.convertToResponse()).andReturn(response2);
 
 
     // replay mocks
     // replay mocks
-    replay(passiveHelper, injector, clusters, cluster, host, stack, metaInfo,
+    replay(maintHelper, injector, clusters, cluster, host, stack, metaInfo,
         service, service2, component, component2, component3, componentHost1,
         service, service2, component, component2, component3, componentHost1,
         componentHost2, response1, response2);
         componentHost2, response1, response2);
 
 
@@ -721,9 +721,9 @@ public class AmbariManagementControllerImplTest {
     ServiceComponentHost componentHost2 = createNiceMock(ServiceComponentHost.class);
     ServiceComponentHost componentHost2 = createNiceMock(ServiceComponentHost.class);
     ServiceComponentHostResponse response1 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response1 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response2 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response2 = createNiceMock(ServiceComponentHostResponse.class);
-    PassiveStateHelper passiveHelper = createNiceMock(PassiveStateHelper.class);
-    expect(passiveHelper.getEffectiveState(
-        capture(new Capture<ServiceComponentHost>()))).andReturn(PassiveState.ACTIVE).anyTimes();
+    MaintenanceStateHelper maintHelper = createNiceMock(MaintenanceStateHelper.class);
+    expect(maintHelper.getEffectiveState(
+        capture(new Capture<ServiceComponentHost>()))).andReturn(MaintenanceState.OFF).anyTimes();
 
 
     // requests
     // requests
     ServiceComponentHostRequest request1 = new ServiceComponentHostRequest(
     ServiceComponentHostRequest request1 = new ServiceComponentHostRequest(
@@ -745,7 +745,7 @@ public class AmbariManagementControllerImplTest {
     // constructor init
     // constructor init
     injector.injectMembers(capture(controllerCapture));
     injector.injectMembers(capture(controllerCapture));
     expect(injector.getInstance(Gson.class)).andReturn(null);
     expect(injector.getInstance(Gson.class)).andReturn(null);
-    expect(injector.getInstance(PassiveStateHelper.class)).andReturn(passiveHelper).anyTimes();
+    expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(maintHelper).anyTimes();
 
 
     // getHostComponent
     // getHostComponent
     expect(clusters.getCluster("cluster1")).andReturn(cluster).times(3);
     expect(clusters.getCluster("cluster1")).andReturn(cluster).times(3);
@@ -772,7 +772,7 @@ public class AmbariManagementControllerImplTest {
     expect(componentHost2.convertToResponse()).andReturn(response2);
     expect(componentHost2.convertToResponse()).andReturn(response2);
 
 
     // replay mocks
     // replay mocks
-    replay(passiveHelper, injector, clusters, cluster, host, stack, metaInfo,
+    replay(maintHelper, injector, clusters, cluster, host, stack, metaInfo,
         service, service2, component, component2, component3, componentHost1,
         service, service2, component, component2, component3, componentHost1,
         componentHost2, response1, response2);
         componentHost2, response1, response2);
 
 
@@ -929,9 +929,9 @@ public class AmbariManagementControllerImplTest {
     ServiceComponentHost componentHost2 = createNiceMock(ServiceComponentHost.class);
     ServiceComponentHost componentHost2 = createNiceMock(ServiceComponentHost.class);
     ServiceComponentHostResponse response1 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response1 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response2 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response2 = createNiceMock(ServiceComponentHostResponse.class);
-    PassiveStateHelper passiveHelper = createNiceMock(PassiveStateHelper.class);
-    expect(passiveHelper.getEffectiveState(
-        capture(new Capture<ServiceComponentHost>()))).andReturn(PassiveState.ACTIVE).anyTimes();
+    MaintenanceStateHelper maintHelper = createNiceMock(MaintenanceStateHelper.class);
+    expect(maintHelper.getEffectiveState(
+        capture(new Capture<ServiceComponentHost>()))).andReturn(MaintenanceState.OFF).anyTimes();
 
 
     // requests
     // requests
     ServiceComponentHostRequest request1 = new ServiceComponentHostRequest(
     ServiceComponentHostRequest request1 = new ServiceComponentHostRequest(
@@ -950,7 +950,7 @@ public class AmbariManagementControllerImplTest {
     // constructor init
     // constructor init
     injector.injectMembers(capture(controllerCapture));
     injector.injectMembers(capture(controllerCapture));
     expect(injector.getInstance(Gson.class)).andReturn(null);
     expect(injector.getInstance(Gson.class)).andReturn(null);
-    expect(injector.getInstance(PassiveStateHelper.class)).andReturn(passiveHelper).anyTimes();
+    expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(maintHelper).anyTimes();
 
 
     // getHostComponent
     // getHostComponent
     expect(clusters.getCluster("cluster1")).andReturn(cluster);
     expect(clusters.getCluster("cluster1")).andReturn(cluster);
@@ -969,7 +969,7 @@ public class AmbariManagementControllerImplTest {
     expect(componentHost2.convertToResponse()).andReturn(response2);
     expect(componentHost2.convertToResponse()).andReturn(response2);
 
 
     // replay mocks
     // replay mocks
-    replay(passiveHelper, injector, clusters, cluster, response1, response2,
+    replay(maintHelper, injector, clusters, cluster, response1, response2,
         stack, metaInfo, service, component, componentHost1, componentHost2);
         stack, metaInfo, service, component, componentHost1, componentHost2);
 
 
     //test
     //test
@@ -1011,9 +1011,9 @@ public class AmbariManagementControllerImplTest {
     ServiceComponentHostResponse response1 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response1 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response2 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response2 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response3 = createNiceMock(ServiceComponentHostResponse.class);
     ServiceComponentHostResponse response3 = createNiceMock(ServiceComponentHostResponse.class);
-    PassiveStateHelper passiveHelper = createNiceMock(PassiveStateHelper.class);
-    expect(passiveHelper.getEffectiveState(
-        capture(new Capture<ServiceComponentHost>()))).andReturn(PassiveState.ACTIVE).anyTimes();
+    MaintenanceStateHelper maintHelper = createNiceMock(MaintenanceStateHelper.class);
+    expect(maintHelper.getEffectiveState(
+        capture(new Capture<ServiceComponentHost>()))).andReturn(MaintenanceState.OFF).anyTimes();
 
 
     // requests
     // requests
     ServiceComponentHostRequest request1 = new ServiceComponentHostRequest(
     ServiceComponentHostRequest request1 = new ServiceComponentHostRequest(
@@ -1036,7 +1036,7 @@ public class AmbariManagementControllerImplTest {
     // constructor init
     // constructor init
     injector.injectMembers(capture(controllerCapture));
     injector.injectMembers(capture(controllerCapture));
     expect(injector.getInstance(Gson.class)).andReturn(null);
     expect(injector.getInstance(Gson.class)).andReturn(null);
-    expect(injector.getInstance(PassiveStateHelper.class)).andReturn(passiveHelper).anyTimes();
+    expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(maintHelper).anyTimes();
 
 
     // getHostComponent
     // getHostComponent
     expect(clusters.getCluster("cluster1")).andReturn(cluster);
     expect(clusters.getCluster("cluster1")).andReturn(cluster);
@@ -1056,7 +1056,7 @@ public class AmbariManagementControllerImplTest {
     expect(componentHost3.convertToResponse()).andReturn(response3);
     expect(componentHost3.convertToResponse()).andReturn(response3);
 
 
     // replay mocks
     // replay mocks
-    replay(passiveHelper, injector, clusters, cluster, response1, response2,
+    replay(maintHelper, injector, clusters, cluster, response1, response2,
         response3, stack, metaInfo, service1, service2, component1, component2,
         response3, stack, metaInfo, service1, service2, component1, component2,
         componentHost1, componentHost2, componentHost3);
         componentHost1, componentHost2, componentHost3);
 
 

+ 73 - 73
ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java

@@ -95,7 +95,7 @@ import org.apache.ambari.server.state.ConfigImpl;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.HostComponentAdminState;
 import org.apache.ambari.server.state.HostComponentAdminState;
 import org.apache.ambari.server.state.HostState;
 import org.apache.ambari.server.state.HostState;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.RepositoryInfo;
 import org.apache.ambari.server.state.RepositoryInfo;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponent;
@@ -2363,7 +2363,7 @@ public class AmbariManagementControllerTest {
     Assert.assertNotNull(storedTasks);
     Assert.assertNotNull(storedTasks);
     Assert.assertEquals(1, storedTasks.size());
     Assert.assertEquals(1, storedTasks.size());
     Assert.assertEquals(HostComponentAdminState.DECOMMISSIONED, scHost.getComponentAdminState());
     Assert.assertEquals(HostComponentAdminState.DECOMMISSIONED, scHost.getComponentAdminState());
-    Assert.assertEquals(PassiveState.PASSIVE, scHost.getPassiveState());
+    Assert.assertEquals(MaintenanceState.ON, scHost.getMaintenanceState());
     HostRoleCommand command = storedTasks.get(0);
     HostRoleCommand command = storedTasks.get(0);
     Assert.assertTrue("DECOMMISSION, Excluded: h2".equals(command.getCommandDetail()));
     Assert.assertTrue("DECOMMISSION, Excluded: h2".equals(command.getCommandDetail()));
     Assert.assertTrue("DECOMMISSION".equals(command.getCustomCommandName()));
     Assert.assertTrue("DECOMMISSION".equals(command.getCustomCommandName()));
@@ -2401,7 +2401,7 @@ public class AmbariManagementControllerTest {
     Assert.assertNotNull(storedTasks);
     Assert.assertNotNull(storedTasks);
     Assert.assertEquals(1, storedTasks.size());
     Assert.assertEquals(1, storedTasks.size());
     Assert.assertEquals(HostComponentAdminState.DECOMMISSIONED, scHost.getComponentAdminState());
     Assert.assertEquals(HostComponentAdminState.DECOMMISSIONED, scHost.getComponentAdminState());
-    Assert.assertEquals(PassiveState.PASSIVE, scHost.getPassiveState());
+    Assert.assertEquals(MaintenanceState.ON, scHost.getMaintenanceState());
     cInfo = execCmd.getClusterHostInfo();
     cInfo = execCmd.getClusterHostInfo();
     Assert.assertTrue(cInfo.containsKey("decom_hbase_rs_hosts"));
     Assert.assertTrue(cInfo.containsKey("decom_hbase_rs_hosts"));
     command = storedTasks.get(0);
     command = storedTasks.get(0);
@@ -2428,7 +2428,7 @@ public class AmbariManagementControllerTest {
     Assert.assertNotNull(storedTasks);
     Assert.assertNotNull(storedTasks);
     Assert.assertEquals(1, storedTasks.size());
     Assert.assertEquals(1, storedTasks.size());
     Assert.assertEquals(HostComponentAdminState.INSERVICE, scHost.getComponentAdminState());
     Assert.assertEquals(HostComponentAdminState.INSERVICE, scHost.getComponentAdminState());
-    Assert.assertEquals(PassiveState.PASSIVE, scHost.getPassiveState());
+    Assert.assertEquals(MaintenanceState.ON, scHost.getMaintenanceState());
     command = storedTasks.get(0);
     command = storedTasks.get(0);
     Assert.assertTrue("DECOMMISSION, Included: h2".equals(command.getCommandDetail()));
     Assert.assertTrue("DECOMMISSION, Included: h2".equals(command.getCommandDetail()));
     Assert.assertTrue("DECOMMISSION".equals(command.getCustomCommandName()));
     Assert.assertTrue("DECOMMISSION".equals(command.getCustomCommandName()));
@@ -5975,7 +5975,7 @@ public class AmbariManagementControllerTest {
     Assert.assertNotNull(execCmd.getConfigurationTags().get("hdfs-site"));
     Assert.assertNotNull(execCmd.getConfigurationTags().get("hdfs-site"));
     Assert.assertEquals(1, storedTasks.size());
     Assert.assertEquals(1, storedTasks.size());
     Assert.assertEquals(HostComponentAdminState.DECOMMISSIONED, scHost.getComponentAdminState());
     Assert.assertEquals(HostComponentAdminState.DECOMMISSIONED, scHost.getComponentAdminState());
-    Assert.assertEquals(PassiveState.PASSIVE, scHost.getPassiveState());
+    Assert.assertEquals(MaintenanceState.ON, scHost.getMaintenanceState());
     HostRoleCommand command =  storedTasks.get(0);
     HostRoleCommand command =  storedTasks.get(0);
     Assert.assertEquals(Role.NAMENODE, command.getRole());
     Assert.assertEquals(Role.NAMENODE, command.getRole());
     Assert.assertEquals(RoleCommand.CUSTOM_COMMAND, command.getRoleCommand());
     Assert.assertEquals(RoleCommand.CUSTOM_COMMAND, command.getRoleCommand());
@@ -6006,7 +6006,7 @@ public class AmbariManagementControllerTest {
     Assert.assertNotNull(storedTasks);
     Assert.assertNotNull(storedTasks);
     Assert.assertEquals(1, storedTasks.size());
     Assert.assertEquals(1, storedTasks.size());
     Assert.assertEquals(HostComponentAdminState.DECOMMISSIONED, scHost.getComponentAdminState());
     Assert.assertEquals(HostComponentAdminState.DECOMMISSIONED, scHost.getComponentAdminState());
-    Assert.assertEquals(PassiveState.PASSIVE, scHost.getPassiveState());
+    Assert.assertEquals(MaintenanceState.ON, scHost.getMaintenanceState());
     cInfo = execCmd.getClusterHostInfo();
     cInfo = execCmd.getClusterHostInfo();
     Assert.assertTrue(cInfo.containsKey("decom_dn_hosts"));
     Assert.assertTrue(cInfo.containsKey("decom_dn_hosts"));
     Assert.assertEquals("0,1", cInfo.get("decom_dn_hosts").iterator().next());
     Assert.assertEquals("0,1", cInfo.get("decom_dn_hosts").iterator().next());
@@ -6042,7 +6042,7 @@ public class AmbariManagementControllerTest {
     Assert.assertNotNull(storedTasks);
     Assert.assertNotNull(storedTasks);
     scHost = s.getServiceComponent("DATANODE").getServiceComponentHost("h2");
     scHost = s.getServiceComponent("DATANODE").getServiceComponentHost("h2");
     Assert.assertEquals(HostComponentAdminState.INSERVICE, scHost.getComponentAdminState());
     Assert.assertEquals(HostComponentAdminState.INSERVICE, scHost.getComponentAdminState());
-    Assert.assertEquals(PassiveState.ACTIVE, scHost.getPassiveState());
+    Assert.assertEquals(MaintenanceState.OFF, scHost.getMaintenanceState());
     execCmd = storedTasks.get(0).getExecutionCommandWrapper
     execCmd = storedTasks.get(0).getExecutionCommandWrapper
         ().getExecutionCommand();
         ().getExecutionCommand();
     Assert.assertNotNull(storedTasks);
     Assert.assertNotNull(storedTasks);
@@ -6064,7 +6064,7 @@ public class AmbariManagementControllerTest {
     // Slave components will have admin state as INSERVICE even if the state in DB is null
     // Slave components will have admin state as INSERVICE even if the state in DB is null
     scHost.setComponentAdminState(null);
     scHost.setComponentAdminState(null);
     Assert.assertEquals(HostComponentAdminState.INSERVICE, scHost.getComponentAdminState());
     Assert.assertEquals(HostComponentAdminState.INSERVICE, scHost.getComponentAdminState());
-    Assert.assertEquals(PassiveState.ACTIVE, scHost.getPassiveState());
+    Assert.assertEquals(MaintenanceState.OFF, scHost.getMaintenanceState());
   }
   }
 
 
   @Test
   @Test
@@ -8001,7 +8001,7 @@ public class AmbariManagementControllerTest {
     sc3.getServiceComponentHosts().values().iterator().next().setState(State.INSTALL_FAILED);
     sc3.getServiceComponentHosts().values().iterator().next().setState(State.INSTALL_FAILED);
     ServiceComponent sc4 = s2.getServiceComponent(componentName4);
     ServiceComponent sc4 = s2.getServiceComponent(componentName4);
     sc4.getServiceComponentHosts().values().iterator().next().setDesiredState(State.INSTALLED);
     sc4.getServiceComponentHosts().values().iterator().next().setDesiredState(State.INSTALLED);
-    sc4.getServiceComponentHosts().values().iterator().next().setState(State.MAINTENANCE);
+    sc4.getServiceComponentHosts().values().iterator().next().setState(State.DISABLED);
     ServiceComponent sc5 = s2.getServiceComponent(componentName5);
     ServiceComponent sc5 = s2.getServiceComponent(componentName5);
     sc5.getServiceComponentHosts().values().iterator().next().setState(State.INSTALLED);
     sc5.getServiceComponentHosts().values().iterator().next().setState(State.INSTALLED);
     ServiceComponent sc6 = s2.getServiceComponent(componentName6);
     ServiceComponent sc6 = s2.getServiceComponent(componentName6);
@@ -8082,9 +8082,9 @@ public class AmbariManagementControllerTest {
     }
     }
 
 
     Set<ServiceComponentHostRequest> schRequests = new HashSet<ServiceComponentHostRequest>();
     Set<ServiceComponentHostRequest> schRequests = new HashSet<ServiceComponentHostRequest>();
-    // maintenance HC for non-clients
-    schRequests.add(new ServiceComponentHostRequest(clusterName, serviceName, componentName1, host1, "MAINTENANCE"));
-    schRequests.add(new ServiceComponentHostRequest(clusterName, serviceName, componentName2, host1, "MAINTENANCE"));
+    // disable HC for non-clients
+    schRequests.add(new ServiceComponentHostRequest(clusterName, serviceName, componentName1, host1, "DISABLED"));
+    schRequests.add(new ServiceComponentHostRequest(clusterName, serviceName, componentName2, host1, "DISABLED"));
     controller.updateHostComponents(schRequests, new HashMap<String,String>(), false);
     controller.updateHostComponents(schRequests, new HashMap<String,String>(), false);
 
 
     // delete HC
     // delete HC
@@ -8266,8 +8266,8 @@ public class AmbariManagementControllerTest {
     sch.handleEvent(new ServiceComponentHostStoppedEvent (sch.getServiceComponentName(), sch.getHostName(), System.currentTimeMillis()));
     sch.handleEvent(new ServiceComponentHostStoppedEvent (sch.getServiceComponentName(), sch.getHostName(), System.currentTimeMillis()));
 
 
     schRequests.clear();
     schRequests.clear();
-    // maintenance HC, DN was already stopped
-    schRequests.add(new ServiceComponentHostRequest(clusterName, serviceName, componentName1, host1, "MAINTENANCE"));
+    // disable HC, DN was already stopped
+    schRequests.add(new ServiceComponentHostRequest(clusterName, serviceName, componentName1, host1, "DISABLED"));
     controller.updateHostComponents(schRequests, new HashMap<String,String>(), false);
     controller.updateHostComponents(schRequests, new HashMap<String,String>(), false);
 
 
     // delete HC
     // delete HC
@@ -8495,7 +8495,7 @@ public class AmbariManagementControllerTest {
   }
   }
 
 
   @Test
   @Test
-  public void testMaintenanceAndDeleteStates() throws Exception {
+  public void testDisableAndDeleteStates() throws Exception {
     Map<String,String> mapRequestProps = new HashMap<String, String>();
     Map<String,String> mapRequestProps = new HashMap<String, String>();
     Injector injector = Guice.createInjector(new AbstractModule() {
     Injector injector = Guice.createInjector(new AbstractModule() {
       @Override
       @Override
@@ -8623,11 +8623,11 @@ public class AmbariManagementControllerTest {
       }
       }
 
 
       componentHostRequests.clear();
       componentHostRequests.clear();
-      componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "NAMENODE", "host1", "MAINTENANCE"));
+      componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "NAMENODE", "host1", "DISABLED"));
 
 
       amc.updateHostComponents(componentHostRequests, mapRequestProps, true);
       amc.updateHostComponents(componentHostRequests, mapRequestProps, true);
 
 
-      Assert.assertEquals(State.MAINTENANCE, componentHost.getState());
+      Assert.assertEquals(State.DISABLED, componentHost.getState());
 
 
       componentHostRequests.clear();
       componentHostRequests.clear();
       componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "NAMENODE", "host1", "INSTALLED"));
       componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "NAMENODE", "host1", "INSTALLED"));
@@ -8637,11 +8637,11 @@ public class AmbariManagementControllerTest {
       Assert.assertEquals(State.INSTALLED, componentHost.getState());
       Assert.assertEquals(State.INSTALLED, componentHost.getState());
 
 
       componentHostRequests.clear();
       componentHostRequests.clear();
-      componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "NAMENODE", "host1", "MAINTENANCE"));
+      componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "NAMENODE", "host1", "DISABLED"));
 
 
       amc.updateHostComponents(componentHostRequests, mapRequestProps, true);
       amc.updateHostComponents(componentHostRequests, mapRequestProps, true);
 
 
-      Assert.assertEquals(State.MAINTENANCE, componentHost.getState());
+      Assert.assertEquals(State.DISABLED, componentHost.getState());
 
 
       componentHostRequests.clear();
       componentHostRequests.clear();
       componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "NAMENODE", "host2", null));
       componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "NAMENODE", "host2", null));
@@ -8706,26 +8706,26 @@ public class AmbariManagementControllerTest {
       }
       }
       assertNotNull(sch);
       assertNotNull(sch);
 
 
-      // make maintenance
+      // make disabled
       componentHostRequests.clear();
       componentHostRequests.clear();
-      componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "DATANODE", "host2", "MAINTENANCE"));
+      componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "DATANODE", "host2", "DISABLED"));
       amc.updateHostComponents(componentHostRequests, mapRequestProps, false);
       amc.updateHostComponents(componentHostRequests, mapRequestProps, false);
-      org.junit.Assert.assertEquals(State.MAINTENANCE, sch.getState());
+      org.junit.Assert.assertEquals(State.DISABLED, sch.getState());
 
 
-      // ServiceComponentHost remains in maintenance after service stop
+      // ServiceComponentHost remains in disabled after service stop
       assertEquals(sch.getServiceComponentName(),"DATANODE");
       assertEquals(sch.getServiceComponentName(),"DATANODE");
       serviceRequests.clear();
       serviceRequests.clear();
       serviceRequests.add(new ServiceRequest("c1", "HDFS", "INSTALLED"));
       serviceRequests.add(new ServiceRequest("c1", "HDFS", "INSTALLED"));
       ServiceResourceProviderTest.updateServices(amc, serviceRequests,
       ServiceResourceProviderTest.updateServices(amc, serviceRequests,
         mapRequestProps, true, false);
         mapRequestProps, true, false);
-      assertEquals(State.MAINTENANCE, sch.getState());
+      assertEquals(State.DISABLED, sch.getState());
 
 
-      // ServiceComponentHost remains in maintenance after service start
+      // ServiceComponentHost remains in disabled after service start
       serviceRequests.clear();
       serviceRequests.clear();
       serviceRequests.add(new ServiceRequest("c1", "HDFS", "STARTED"));
       serviceRequests.add(new ServiceRequest("c1", "HDFS", "STARTED"));
       ServiceResourceProviderTest.updateServices(amc, serviceRequests,
       ServiceResourceProviderTest.updateServices(amc, serviceRequests,
         mapRequestProps, true, false);
         mapRequestProps, true, false);
-      assertEquals(State.MAINTENANCE, sch.getState());
+      assertEquals(State.DISABLED, sch.getState());
 
 
       // confirm delete
       // confirm delete
       componentHostRequests.clear();
       componentHostRequests.clear();
@@ -9150,7 +9150,7 @@ public class AmbariManagementControllerTest {
   }
   }
 
 
   @Test
   @Test
-  public void testPassiveStates() throws Exception {
+  public void testMaintenanceState() throws Exception {
     String clusterName = "c1";
     String clusterName = "c1";
     createCluster(clusterName);
     createCluster(clusterName);
     clusters.getCluster(clusterName)
     clusters.getCluster(clusterName)
@@ -9194,133 +9194,133 @@ public class AmbariManagementControllerTest {
     
     
     // test updating a service
     // test updating a service
     ServiceRequest sr = new ServiceRequest(clusterName, serviceName, null);
     ServiceRequest sr = new ServiceRequest(clusterName, serviceName, null);
-    sr.setPassiveState(PassiveState.PASSIVE.name());
+    sr.setMaintenanceState(MaintenanceState.ON.name());
     ServiceResourceProviderTest.updateServices(controller, Collections.singleton(sr),
     ServiceResourceProviderTest.updateServices(controller, Collections.singleton(sr),
         requestProperties, false, false);
         requestProperties, false, false);
-    Assert.assertEquals(PassiveState.PASSIVE, service.getPassiveState());
+    Assert.assertEquals(MaintenanceState.ON, service.getMaintenanceState());
     
     
     // check the host components implied state vs desired state
     // check the host components implied state vs desired state
     for (ServiceComponent sc : service.getServiceComponents().values()) {
     for (ServiceComponent sc : service.getServiceComponents().values()) {
       for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
       for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
-        Assert.assertEquals(PassiveState.IMPLIED,
-            controller.getEffectivePassiveState(sch));
-        Assert.assertEquals(PassiveState.ACTIVE, sch.getPassiveState());
+        Assert.assertEquals(MaintenanceState.IMPLIED,
+            controller.getEffectiveMaintenanceState(sch));
+        Assert.assertEquals(MaintenanceState.OFF, sch.getMaintenanceState());
       }
       }
     }
     }
     
     
     // reset
     // reset
-    sr.setPassiveState(PassiveState.ACTIVE.name());
+    sr.setMaintenanceState(MaintenanceState.OFF.name());
     ServiceResourceProviderTest.updateServices(controller, Collections.singleton(sr),
     ServiceResourceProviderTest.updateServices(controller, Collections.singleton(sr),
         requestProperties, false, false);
         requestProperties, false, false);
-    Assert.assertEquals(PassiveState.ACTIVE, service.getPassiveState());
+    Assert.assertEquals(MaintenanceState.OFF, service.getMaintenanceState());
     
     
     // check the host components implied state vs desired state
     // check the host components implied state vs desired state
     for (ServiceComponent sc : service.getServiceComponents().values()) {
     for (ServiceComponent sc : service.getServiceComponents().values()) {
       for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
       for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
-        Assert.assertEquals(PassiveState.ACTIVE,
-            controller.getEffectivePassiveState(sch));
-        Assert.assertEquals(PassiveState.ACTIVE, sch.getPassiveState());
+        Assert.assertEquals(MaintenanceState.OFF,
+            controller.getEffectiveMaintenanceState(sch));
+        Assert.assertEquals(MaintenanceState.OFF, sch.getMaintenanceState());
       }
       }
     }
     }
     
     
     // passivate a host
     // passivate a host
     HostRequest hr = new HostRequest(host1, clusterName, requestProperties);
     HostRequest hr = new HostRequest(host1, clusterName, requestProperties);
-    hr.setPassiveState(PassiveState.PASSIVE.name());
+    hr.setMaintenanceState(MaintenanceState.ON.name());
     HostResourceProviderTest.updateHosts(controller, Collections.singleton(hr),
     HostResourceProviderTest.updateHosts(controller, Collections.singleton(hr),
         new HashMap<String, String>());
         new HashMap<String, String>());
     
     
     Host host = hosts.get(host1);
     Host host = hosts.get(host1);
-    Assert.assertEquals(PassiveState.PASSIVE, host.getPassiveState(cluster.getClusterId()));
+    Assert.assertEquals(MaintenanceState.ON, host.getMaintenanceState(cluster.getClusterId()));
     
     
     // check the host components implied state vs desired state, only for affected hosts
     // check the host components implied state vs desired state, only for affected hosts
     for (ServiceComponent sc : service.getServiceComponents().values()) {
     for (ServiceComponent sc : service.getServiceComponents().values()) {
       for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
       for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
-        PassiveState implied = controller.getEffectivePassiveState(sch);
+        MaintenanceState implied = controller.getEffectiveMaintenanceState(sch);
         if (sch.getHostName().equals(host1)) {
         if (sch.getHostName().equals(host1)) {
-          Assert.assertEquals(PassiveState.IMPLIED, implied);
+          Assert.assertEquals(MaintenanceState.IMPLIED, implied);
         } else {
         } else {
-          Assert.assertEquals(PassiveState.ACTIVE, implied);
+          Assert.assertEquals(MaintenanceState.OFF, implied);
         }
         }
-        Assert.assertEquals(PassiveState.ACTIVE, sch.getPassiveState());
+        Assert.assertEquals(MaintenanceState.OFF, sch.getMaintenanceState());
       }
       }
     }
     }
     
     
     // reset
     // reset
-    hr.setPassiveState(PassiveState.ACTIVE.name());
+    hr.setMaintenanceState(MaintenanceState.OFF.name());
     HostResourceProviderTest.updateHosts(controller, Collections.singleton(hr),
     HostResourceProviderTest.updateHosts(controller, Collections.singleton(hr),
         new HashMap<String, String>());
         new HashMap<String, String>());
     
     
     host = hosts.get(host1);
     host = hosts.get(host1);
-    Assert.assertEquals(PassiveState.ACTIVE, host.getPassiveState(cluster.getClusterId()));
+    Assert.assertEquals(MaintenanceState.OFF, host.getMaintenanceState(cluster.getClusterId()));
     
     
     // check the host components active state vs desired state
     // check the host components active state vs desired state
     for (ServiceComponent sc : service.getServiceComponents().values()) {
     for (ServiceComponent sc : service.getServiceComponents().values()) {
       for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
       for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
-        Assert.assertEquals(PassiveState.ACTIVE,
-            controller.getEffectivePassiveState(sch));
-        Assert.assertEquals(PassiveState.ACTIVE, sch.getPassiveState());
+        Assert.assertEquals(MaintenanceState.OFF,
+            controller.getEffectiveMaintenanceState(sch));
+        Assert.assertEquals(MaintenanceState.OFF, sch.getMaintenanceState());
       }
       }
     }
     }
     
     
     // passivate several hosts
     // passivate several hosts
     HostRequest hr1 = new HostRequest(host1, clusterName, requestProperties);
     HostRequest hr1 = new HostRequest(host1, clusterName, requestProperties);
-    hr1.setPassiveState(PassiveState.PASSIVE.name());
+    hr1.setMaintenanceState(MaintenanceState.ON.name());
     HostRequest hr2 = new HostRequest(host2, clusterName, requestProperties);
     HostRequest hr2 = new HostRequest(host2, clusterName, requestProperties);
-    hr2.setPassiveState(PassiveState.PASSIVE.name());
+    hr2.setMaintenanceState(MaintenanceState.ON.name());
     Set<HostRequest> set = new HashSet<HostRequest>();
     Set<HostRequest> set = new HashSet<HostRequest>();
     set.add(hr1);
     set.add(hr1);
     set.add(hr2);
     set.add(hr2);
     HostResourceProviderTest.updateHosts(controller, set, new HashMap<String, String>());
     HostResourceProviderTest.updateHosts(controller, set, new HashMap<String, String>());
 
 
     host = hosts.get(host1);
     host = hosts.get(host1);
-    Assert.assertEquals(PassiveState.PASSIVE, host.getPassiveState(cluster.getClusterId()));
+    Assert.assertEquals(MaintenanceState.ON, host.getMaintenanceState(cluster.getClusterId()));
     host = hosts.get(host2);
     host = hosts.get(host2);
-    Assert.assertEquals(PassiveState.PASSIVE, host.getPassiveState(cluster.getClusterId()));
+    Assert.assertEquals(MaintenanceState.ON, host.getMaintenanceState(cluster.getClusterId()));
     
     
     // reset
     // reset
     hr1 = new HostRequest(host1, clusterName, requestProperties);
     hr1 = new HostRequest(host1, clusterName, requestProperties);
-    hr1.setPassiveState(PassiveState.ACTIVE.name());
+    hr1.setMaintenanceState(MaintenanceState.OFF.name());
     hr2 = new HostRequest(host2, clusterName, requestProperties);
     hr2 = new HostRequest(host2, clusterName, requestProperties);
-    hr2.setPassiveState(PassiveState.ACTIVE.name());
+    hr2.setMaintenanceState(MaintenanceState.OFF.name());
     set = new HashSet<HostRequest>();
     set = new HashSet<HostRequest>();
     set.add(hr1);
     set.add(hr1);
     set.add(hr2);
     set.add(hr2);
 
 
     HostResourceProviderTest.updateHosts(controller, set, new HashMap<String, String>());
     HostResourceProviderTest.updateHosts(controller, set, new HashMap<String, String>());
     host = hosts.get(host1);
     host = hosts.get(host1);
-    Assert.assertEquals(PassiveState.ACTIVE, host.getPassiveState(cluster.getClusterId()));
+    Assert.assertEquals(MaintenanceState.OFF, host.getMaintenanceState(cluster.getClusterId()));
     host = hosts.get(host2);
     host = hosts.get(host2);
-    Assert.assertEquals(PassiveState.ACTIVE, host.getPassiveState(cluster.getClusterId()));
+    Assert.assertEquals(MaintenanceState.OFF, host.getMaintenanceState(cluster.getClusterId()));
 
 
     
     
     // only do one SCH
     // only do one SCH
     ServiceComponentHost targetSch = service.getServiceComponent(
     ServiceComponentHost targetSch = service.getServiceComponent(
         componentName2).getServiceComponentHosts().get(host2);
         componentName2).getServiceComponentHosts().get(host2);
     Assert.assertNotNull(targetSch);
     Assert.assertNotNull(targetSch);
-    targetSch.setPassiveState(PassiveState.PASSIVE);
+    targetSch.setMaintenanceState(MaintenanceState.ON);
 
 
     // check the host components active state vs desired state
     // check the host components active state vs desired state
-    Assert.assertEquals(PassiveState.PASSIVE, controller.getEffectivePassiveState(targetSch));
+    Assert.assertEquals(MaintenanceState.ON, controller.getEffectiveMaintenanceState(targetSch));
     
     
     // update the service
     // update the service
-    service.setPassiveState(PassiveState.PASSIVE);
-    Assert.assertEquals(PassiveState.PASSIVE, controller.getEffectivePassiveState(targetSch));
+    service.setMaintenanceState(MaintenanceState.ON);
+    Assert.assertEquals(MaintenanceState.ON, controller.getEffectiveMaintenanceState(targetSch));
     
     
     // make SCH active
     // make SCH active
-    targetSch.setPassiveState(PassiveState.ACTIVE);
-    Assert.assertEquals(PassiveState.IMPLIED, controller.getEffectivePassiveState(targetSch));
+    targetSch.setMaintenanceState(MaintenanceState.OFF);
+    Assert.assertEquals(MaintenanceState.IMPLIED, controller.getEffectiveMaintenanceState(targetSch));
     
     
     // update the service
     // update the service
-    service.setPassiveState(PassiveState.ACTIVE);
-    Assert.assertEquals(PassiveState.ACTIVE, controller.getEffectivePassiveState(targetSch));
+    service.setMaintenanceState(MaintenanceState.OFF);
+    Assert.assertEquals(MaintenanceState.OFF, controller.getEffectiveMaintenanceState(targetSch));
     
     
     host = hosts.get(host2);
     host = hosts.get(host2);
     // update host
     // update host
-    host.setPassiveState(cluster.getClusterId(), PassiveState.PASSIVE);
-    Assert.assertEquals(PassiveState.IMPLIED, controller.getEffectivePassiveState(targetSch));
+    host.setMaintenanceState(cluster.getClusterId(), MaintenanceState.ON);
+    Assert.assertEquals(MaintenanceState.IMPLIED, controller.getEffectiveMaintenanceState(targetSch));
     
     
-    targetSch.setPassiveState(PassiveState.PASSIVE);
-    Assert.assertEquals(PassiveState.PASSIVE, controller.getEffectivePassiveState(targetSch));
+    targetSch.setMaintenanceState(MaintenanceState.ON);
+    Assert.assertEquals(MaintenanceState.ON, controller.getEffectiveMaintenanceState(targetSch));
 
 
     // check the host components active state vs desired state
     // check the host components active state vs desired state
     for (ServiceComponent sc : service.getServiceComponents().values()) {
     for (ServiceComponent sc : service.getServiceComponents().values()) {
@@ -9428,7 +9428,7 @@ public class AmbariManagementControllerTest {
     }
     }
     
     
     Service service2 = cluster.getService(serviceName2);
     Service service2 = cluster.getService(serviceName2);
-    service2.setPassiveState(PassiveState.PASSIVE);
+    service2.setMaintenanceState(MaintenanceState.ON);
     
     
     Set<ServiceRequest> srs = new HashSet<ServiceRequest>();
     Set<ServiceRequest> srs = new HashSet<ServiceRequest>();
     srs.add(new ServiceRequest(clusterName, serviceName1, State.INSTALLED.name()));
     srs.add(new ServiceRequest(clusterName, serviceName1, State.INSTALLED.name()));
@@ -9448,7 +9448,7 @@ public class AmbariManagementControllerTest {
         Assert.assertEquals(State.INSTALLED, service.getDesiredState());
         Assert.assertEquals(State.INSTALLED, service.getDesiredState());
     }
     }
     
     
-    service2.setPassiveState(PassiveState.ACTIVE);
+    service2.setMaintenanceState(MaintenanceState.OFF);
     ServiceResourceProviderTest.updateServices(controller, srs, requestProperties, false, false);
     ServiceResourceProviderTest.updateServices(controller, srs, requestProperties, false, false);
     for (Service service : cluster.getServices().values()) {
     for (Service service : cluster.getServices().values()) {
       Assert.assertEquals(State.INSTALLED, service.getDesiredState());
       Assert.assertEquals(State.INSTALLED, service.getDesiredState());
@@ -9459,7 +9459,7 @@ public class AmbariManagementControllerTest {
     
     
     // test host
     // test host
     Host h1 = clusters.getHost(host1);
     Host h1 = clusters.getHost(host1);
-    h1.setPassiveState(cluster.getClusterId(), PassiveState.PASSIVE);
+    h1.setMaintenanceState(cluster.getClusterId(), MaintenanceState.ON);
     
     
     srs = new HashSet<ServiceRequest>();
     srs = new HashSet<ServiceRequest>();
     srs.add(new ServiceRequest(clusterName, serviceName1, State.INSTALLED.name()));
     srs.add(new ServiceRequest(clusterName, serviceName1, State.INSTALLED.name()));
@@ -9471,10 +9471,10 @@ public class AmbariManagementControllerTest {
       Assert.assertFalse(sts.getHostName().equals(host1));
       Assert.assertFalse(sts.getHostName().equals(host1));
     }
     }
     
     
-    h1.setPassiveState(cluster.getClusterId(), PassiveState.ACTIVE);
+    h1.setMaintenanceState(cluster.getClusterId(), MaintenanceState.OFF);
     startService(clusterName, serviceName2, false, false);
     startService(clusterName, serviceName2, false, false);
     
     
-    service2.setPassiveState(PassiveState.PASSIVE);
+    service2.setMaintenanceState(MaintenanceState.ON);
     
     
     ServiceRequest sr = new ServiceRequest(clusterName, serviceName2, State.INSTALLED.name());
     ServiceRequest sr = new ServiceRequest(clusterName, serviceName2, State.INSTALLED.name());
     rsr = ServiceResourceProviderTest.updateServices(controller,
     rsr = ServiceResourceProviderTest.updateServices(controller,

+ 34 - 24
ambari-server/src/test/java/org/apache/ambari/server/controller/PassiveStateHelperTest.java → ambari-server/src/test/java/org/apache/ambari/server/controller/MaintenanceStateHelperTest.java

@@ -29,60 +29,64 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.Host;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentHost;
 import org.apache.ambari.server.state.ServiceComponentHost;
 import org.easymock.Capture;
 import org.easymock.Capture;
-import org.easymock.EasyMock;
 import org.junit.Assert;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.Test;
 
 
 /**
 /**
- * Tests the PassiveAlertHelper class
+ * Tests the {@link MaintenanceStateHelper} class
  */
  */
-public class PassiveStateHelperTest {
+public class MaintenanceStateHelperTest {
 
 
   @Test
   @Test
   public void testService() throws Exception {
   public void testService() throws Exception {
-    testService(PassiveState.PASSIVE);
-    testService(PassiveState.ACTIVE);
+    testService(MaintenanceState.ON);
+    testService(MaintenanceState.OFF);
   }
   }
   
   
   @Test
   @Test
   public void testHost() throws Exception {
   public void testHost() throws Exception {
-    testHost(PassiveState.PASSIVE);
-    testHost(PassiveState.ACTIVE);
+    testHost(MaintenanceState.ON);
+    testHost(MaintenanceState.OFF);
   }
   }
   
   
   @Test
   @Test
   public void testHostComponent() throws Exception {
   public void testHostComponent() throws Exception {
-    testHostComponent(PassiveState.PASSIVE);
-    testHostComponent(PassiveState.ACTIVE);
+    testHostComponent(MaintenanceState.ON);
+    testHostComponent(MaintenanceState.OFF);
   }
   }
   
   
-  private void testHostComponent(PassiveState state) throws Exception {
+  private void testHostComponent(MaintenanceState state) throws Exception {
     AmbariManagementController amc = createMock(AmbariManagementController.class);
     AmbariManagementController amc = createMock(AmbariManagementController.class);
     Capture<ExecuteActionRequest> earCapture = new Capture<ExecuteActionRequest>();
     Capture<ExecuteActionRequest> earCapture = new Capture<ExecuteActionRequest>();
     Capture<Map<String, String>> rpCapture = new Capture<Map<String, String>>();
     Capture<Map<String, String>> rpCapture = new Capture<Map<String, String>>();
     expect(amc.createAction(capture(earCapture), capture(rpCapture))).andReturn(null);
     expect(amc.createAction(capture(earCapture), capture(rpCapture))).andReturn(null);
     
     
+    Clusters clusters = createMock(Clusters.class);
     Cluster cluster = createMock(Cluster.class);
     Cluster cluster = createMock(Cluster.class);
+    expect(amc.getClusters()).andReturn(clusters).anyTimes();
+    expect(clusters.getClusterById(1L)).andReturn(cluster);
     expect(cluster.getClusterName()).andReturn("c1").anyTimes();
     expect(cluster.getClusterName()).andReturn("c1").anyTimes();
     
     
     ServiceComponentHost sch = createMock(ServiceComponentHost.class);
     ServiceComponentHost sch = createMock(ServiceComponentHost.class);
     expect(sch.getClusterName()).andReturn("c1");
     expect(sch.getClusterName()).andReturn("c1");
-    expect(sch.getPassiveState()).andReturn(state);
+    expect(sch.getClusterId()).andReturn(1L);
+    expect(sch.getMaintenanceState()).andReturn(state);
     expect(sch.getServiceName()).andReturn("HDFS");
     expect(sch.getServiceName()).andReturn("HDFS");
     expect(sch.getServiceComponentName()).andReturn("NAMENODE").anyTimes();
     expect(sch.getServiceComponentName()).andReturn("NAMENODE").anyTimes();
     expect(sch.getHostName()).andReturn("h1");
     expect(sch.getHostName()).andReturn("h1");
     
     
-    replay(amc, cluster, sch);
+    replay(amc, clusters, cluster, sch);
     
     
     Map<String, String> map = new HashMap<String, String>();
     Map<String, String> map = new HashMap<String, String>();
     map.put("context", "abc");
     map.put("context", "abc");
-    PassiveStateHelper.createRequests(amc, map,
+    MaintenanceStateHelper.createRequests(amc, map,
         Collections.singleton(sch.getClusterName()));
         Collections.singleton(sch.getClusterName()));
     
     
     ExecuteActionRequest ear = earCapture.getValue();
     ExecuteActionRequest ear = earCapture.getValue();
@@ -96,14 +100,14 @@ public class PassiveStateHelperTest {
     Assert.assertTrue(map.containsKey("context"));  
     Assert.assertTrue(map.containsKey("context"));  
   }
   }
   
   
-  private void testHost(PassiveState state) throws Exception {
+  private void testHost(MaintenanceState state) throws Exception {
     AmbariManagementController amc = createMock(AmbariManagementController.class);
     AmbariManagementController amc = createMock(AmbariManagementController.class);
     Capture<ExecuteActionRequest> earCapture = new Capture<ExecuteActionRequest>();
     Capture<ExecuteActionRequest> earCapture = new Capture<ExecuteActionRequest>();
     Capture<Map<String, String>> rpCapture = new Capture<Map<String, String>>();
     Capture<Map<String, String>> rpCapture = new Capture<Map<String, String>>();
     expect(amc.createAction(capture(earCapture), capture(rpCapture))).andReturn(null);
     expect(amc.createAction(capture(earCapture), capture(rpCapture))).andReturn(null);
-    
-    Cluster cluster = createMock(Cluster.class);
 
 
+    Clusters clusters = createMock(Clusters.class);
+    Cluster cluster = createMock(Cluster.class);
     Service service = createMock(Service.class);
     Service service = createMock(Service.class);
     
     
     ServiceComponent sc1 = createMock(ServiceComponent.class);
     ServiceComponent sc1 = createMock(ServiceComponent.class);
@@ -120,6 +124,8 @@ public class PassiveStateHelperTest {
     
     
     List<ServiceComponentHost> schList = new ArrayList<ServiceComponentHost>(schMap.values());
     List<ServiceComponentHost> schList = new ArrayList<ServiceComponentHost>(schMap.values());
     
     
+    expect(amc.getClusters()).andReturn(clusters).anyTimes();
+    expect(clusters.getClusterById(1L)).andReturn(cluster);
     expect(cluster.getClusterName()).andReturn("c1").anyTimes();
     expect(cluster.getClusterName()).andReturn("c1").anyTimes();
     expect(cluster.getService("HDFS")).andReturn(service).anyTimes();
     expect(cluster.getService("HDFS")).andReturn(service).anyTimes();
     expect(cluster.getClusterId()).andReturn(Long.valueOf(1L));
     expect(cluster.getClusterId()).andReturn(Long.valueOf(1L));
@@ -128,13 +134,13 @@ public class PassiveStateHelperTest {
     
     
     Host host = createMock(Host.class);
     Host host = createMock(Host.class);
     expect(host.getHostName()).andReturn("h1").anyTimes();
     expect(host.getHostName()).andReturn("h1").anyTimes();
-    expect(host.getPassiveState(1L)).andReturn(state);
+    expect(host.getMaintenanceState(1L)).andReturn(state);
     
     
-    replay(amc, cluster, service, sch1, host);
+    replay(amc, clusters, cluster, service, sch1, host);
     
     
     Map<String, String> map = new HashMap<String, String>();
     Map<String, String> map = new HashMap<String, String>();
     map.put("context", "abc");
     map.put("context", "abc");
-    PassiveStateHelper.createRequests(amc, map,
+    MaintenanceStateHelper.createRequests(amc, map,
         Collections.singleton(cluster.getClusterName()));
         Collections.singleton(cluster.getClusterName()));
     
     
     ExecuteActionRequest ear = earCapture.getValue();
     ExecuteActionRequest ear = earCapture.getValue();
@@ -149,12 +155,13 @@ public class PassiveStateHelperTest {
   }
   }
   
   
   
   
-  private void testService(PassiveState state) throws Exception {
+  private void testService(MaintenanceState state) throws Exception {
     AmbariManagementController amc = createMock(AmbariManagementController.class);
     AmbariManagementController amc = createMock(AmbariManagementController.class);
     Capture<ExecuteActionRequest> earCapture = new Capture<ExecuteActionRequest>();
     Capture<ExecuteActionRequest> earCapture = new Capture<ExecuteActionRequest>();
     Capture<Map<String, String>> rpCapture = new Capture<Map<String, String>>();
     Capture<Map<String, String>> rpCapture = new Capture<Map<String, String>>();
     expect(amc.createAction(capture(earCapture), capture(rpCapture))).andReturn(null);
     expect(amc.createAction(capture(earCapture), capture(rpCapture))).andReturn(null);
     
     
+    Clusters clusters = createMock(Clusters.class);
     Cluster cluster = createMock(Cluster.class);
     Cluster cluster = createMock(Cluster.class);
     Service service = createMock(Service.class);
     Service service = createMock(Service.class);
     
     
@@ -176,17 +183,20 @@ public class PassiveStateHelperTest {
     scMap.put("NAMENODE", sc1);
     scMap.put("NAMENODE", sc1);
     scMap.put("HDFS_CLIENT", sc2);
     scMap.put("HDFS_CLIENT", sc2);
     
     
+    expect(amc.getClusters()).andReturn(clusters).anyTimes();
+    expect(clusters.getClusterById(1L)).andReturn(cluster);
     expect(cluster.getClusterName()).andReturn("c1");
     expect(cluster.getClusterName()).andReturn("c1");
+    expect(cluster.getClusterId()).andReturn(1L);
     expect(service.getCluster()).andReturn(cluster);
     expect(service.getCluster()).andReturn(cluster);
     expect(service.getServiceComponents()).andReturn(scMap);
     expect(service.getServiceComponents()).andReturn(scMap);
-    expect(service.getPassiveState()).andReturn(state);
+    expect(service.getMaintenanceState()).andReturn(state);
     expect(service.getName()).andReturn("HDFS");
     expect(service.getName()).andReturn("HDFS");
     
     
-    replay(amc, cluster, service, sc1, sc2, sch1);
+    replay(amc, clusters, cluster, service, sc1, sc2, sch1);
     
     
     Map<String, String> map = new HashMap<String, String>();
     Map<String, String> map = new HashMap<String, String>();
     map.put("context", "abc");
     map.put("context", "abc");
-    PassiveStateHelper.createRequests(amc, map,
+    MaintenanceStateHelper.createRequests(amc, map,
         Collections.singleton("c1"));
         Collections.singleton("c1"));
     
     
     ExecuteActionRequest ear = earCapture.getValue();
     ExecuteActionRequest ear = earCapture.getValue();

+ 3 - 3
ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java

@@ -60,7 +60,7 @@ import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ComponentInfo;
 import org.apache.ambari.server.state.ComponentInfo;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentFactory;
 import org.apache.ambari.server.state.ServiceComponentFactory;
@@ -239,8 +239,8 @@ public class ComponentResourceProviderTest {
     // set expectations
     // set expectations
     expect(managementController.getClusters()).andReturn(clusters).anyTimes();
     expect(managementController.getClusters()).andReturn(clusters).anyTimes();
     expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
     expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
-    expect(managementController.getEffectivePassiveState(
-        capture(new Capture<ServiceComponentHost>()))).andReturn(PassiveState.ACTIVE).anyTimes();
+    expect(managementController.getEffectiveMaintenanceState(
+        capture(new Capture<ServiceComponentHost>()))).andReturn(MaintenanceState.OFF).anyTimes();
     
     
     expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
     expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
     expect(cluster.getDesiredStackVersion()).andReturn(stackId);
     expect(cluster.getDesiredStackVersion()).andReturn(stackId);

+ 2 - 2
ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java

@@ -669,7 +669,7 @@ public class ServiceResourceProviderTest {
   }
   }
 
 
   @Test
   @Test
-  public void testDefaultServiceState_MAINTENANCE() throws Exception{
+  public void testDefaultServiceState_DISABLED() throws Exception{
     AmbariManagementController managementController = createMock(AmbariManagementController.class);
     AmbariManagementController managementController = createMock(AmbariManagementController.class);
     Clusters clusters = createNiceMock(Clusters.class);
     Clusters clusters = createNiceMock(Clusters.class);
     Cluster cluster = createNiceMock(Cluster.class);
     Cluster cluster = createNiceMock(Cluster.class);
@@ -677,7 +677,7 @@ public class ServiceResourceProviderTest {
     StackId stackId = createNiceMock(StackId.class);
     StackId stackId = createNiceMock(StackId.class);
     ComponentInfo componentInfo = createNiceMock(ComponentInfo.class);
     ComponentInfo componentInfo = createNiceMock(ComponentInfo.class);
 
 
-    ServiceComponentHostResponse shr1 = new ServiceComponentHostResponse("C1", "MAPREDUCE", "JOBTRACKER", "Host100", "MAINTENANCE", "", null, null, null);
+    ServiceComponentHostResponse shr1 = new ServiceComponentHostResponse("C1", "MAPREDUCE", "JOBTRACKER", "Host100", "DISABLED", "", null, null, null);
     ServiceComponentHostResponse shr2 = new ServiceComponentHostResponse("C1", "MAPREDUCE", "MAPREDUCE_CLIENT", "Host100", "STARTED", "", null, null, null);
     ServiceComponentHostResponse shr2 = new ServiceComponentHostResponse("C1", "MAPREDUCE", "MAPREDUCE_CLIENT", "Host100", "STARTED", "", null, null, null);
     ServiceComponentHostResponse shr3 = new ServiceComponentHostResponse("C1", "MAPREDUCE", "TASKTRACKER", "Host100", "STARTED", "", null, null, null);
     ServiceComponentHostResponse shr3 = new ServiceComponentHostResponse("C1", "MAPREDUCE", "TASKTRACKER", "Host100", "STARTED", "", null, null, null);
 
 

+ 6 - 6
ambari-server/src/test/java/org/apache/ambari/server/state/ServiceTest.java

@@ -285,7 +285,7 @@ public class ServiceTest {
   }
   }
 
 
   @Test
   @Test
-  public void testServicePassive() throws Exception {
+  public void testServiceMaintenance() throws Exception {
     String serviceName = "HDFS";
     String serviceName = "HDFS";
     Service s = serviceFactory.createNew(cluster, serviceName);
     Service s = serviceFactory.createNew(cluster, serviceName);
     cluster.addService(s);
     cluster.addService(s);
@@ -297,15 +297,15 @@ public class ServiceTest {
     ClusterServiceDAO dao = injector.getInstance(ClusterServiceDAO.class);
     ClusterServiceDAO dao = injector.getInstance(ClusterServiceDAO.class);
     ClusterServiceEntity entity = dao.findByClusterAndServiceNames(clusterName, serviceName);
     ClusterServiceEntity entity = dao.findByClusterAndServiceNames(clusterName, serviceName);
     Assert.assertNotNull(entity);
     Assert.assertNotNull(entity);
-    Assert.assertEquals(PassiveState.ACTIVE, entity.getServiceDesiredStateEntity().getPassiveState());
-    Assert.assertEquals(PassiveState.ACTIVE, service.getPassiveState());
+    Assert.assertEquals(MaintenanceState.OFF, entity.getServiceDesiredStateEntity().getMaintenanceState());
+    Assert.assertEquals(MaintenanceState.OFF, service.getMaintenanceState());
     
     
-    service.setPassiveState(PassiveState.PASSIVE);
-    Assert.assertEquals(PassiveState.PASSIVE, service.getPassiveState());
+    service.setMaintenanceState(MaintenanceState.ON);
+    Assert.assertEquals(MaintenanceState.ON, service.getMaintenanceState());
 
 
     entity = dao.findByClusterAndServiceNames(clusterName, serviceName);
     entity = dao.findByClusterAndServiceNames(clusterName, serviceName);
     Assert.assertNotNull(entity);
     Assert.assertNotNull(entity);
-    Assert.assertEquals(PassiveState.PASSIVE, entity.getServiceDesiredStateEntity().getPassiveState());
+    Assert.assertEquals(MaintenanceState.ON, entity.getServiceDesiredStateEntity().getMaintenanceState());
     
     
     
     
   }
   }

+ 7 - 7
ambari-server/src/test/java/org/apache/ambari/server/state/host/HostTest.java

@@ -51,7 +51,7 @@ import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.HostHealthStatus;
 import org.apache.ambari.server.state.HostHealthStatus;
 import org.apache.ambari.server.state.HostHealthStatus.HealthStatus;
 import org.apache.ambari.server.state.HostHealthStatus.HealthStatus;
 import org.apache.ambari.server.state.HostState;
 import org.apache.ambari.server.state.HostState;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.StackId;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.logging.LogFactory;
@@ -414,7 +414,7 @@ public class HostTest {
   }
   }
   
   
   @Test
   @Test
-  public void testHostPassive() throws Exception {
+  public void testHostMaintenance() throws Exception {
     AmbariMetaInfo metaInfo = injector.getInstance(AmbariMetaInfo.class);
     AmbariMetaInfo metaInfo = injector.getInstance(AmbariMetaInfo.class);
     metaInfo.init();
     metaInfo.init();
     
     
@@ -433,14 +433,14 @@ public class HostTest {
 
 
     HostEntity entity = hostDAO.findByName("h1");
     HostEntity entity = hostDAO.findByName("h1");
     HostStateEntity stateEntity = entity.getHostStateEntity();
     HostStateEntity stateEntity = entity.getHostStateEntity();
-    Assert.assertNull(stateEntity.getPassiveState());
-    Assert.assertEquals(PassiveState.ACTIVE, host.getPassiveState(c1.getClusterId()));
+    Assert.assertNull(stateEntity.getMaintenanceState());
+    Assert.assertEquals(MaintenanceState.OFF, host.getMaintenanceState(c1.getClusterId()));
     
     
-    host.setPassiveState(c1.getClusterId(), PassiveState.PASSIVE);
+    host.setMaintenanceState(c1.getClusterId(), MaintenanceState.ON);
 
 
     entity = hostDAO.findByName("h1");
     entity = hostDAO.findByName("h1");
     stateEntity = entity.getHostStateEntity();
     stateEntity = entity.getHostStateEntity();
-    Assert.assertNotNull(stateEntity.getPassiveState());
-    Assert.assertEquals(PassiveState.PASSIVE, host.getPassiveState(c1.getClusterId()));
+    Assert.assertNotNull(stateEntity.getMaintenanceState());
+    Assert.assertEquals(MaintenanceState.ON, host.getMaintenanceState(c1.getClusterId()));
   }
   }
 }
 }

+ 7 - 7
ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java

@@ -39,7 +39,7 @@ import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.ConfigFactory;
 import org.apache.ambari.server.state.ConfigFactory;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.HostConfig;
 import org.apache.ambari.server.state.HostConfig;
-import org.apache.ambari.server.state.PassiveState;
+import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentFactory;
 import org.apache.ambari.server.state.ServiceComponentFactory;
@@ -802,7 +802,7 @@ public class ServiceComponentHostTest {
   }
   }
   
   
   @Test
   @Test
-  public void testPassive() throws Exception {
+  public void testMaintenance() throws Exception {
     String stackVersion="HDP-2.0.6";
     String stackVersion="HDP-2.0.6";
     String clusterName = "c2";
     String clusterName = "c2";
     String hostName = "h3";
     String hostName = "h3";
@@ -830,14 +830,14 @@ public class ServiceComponentHostTest {
     
     
     HostComponentDesiredStateDAO dao = injector.getInstance(HostComponentDesiredStateDAO.class);
     HostComponentDesiredStateDAO dao = injector.getInstance(HostComponentDesiredStateDAO.class);
     HostComponentDesiredStateEntity entity = dao.findByPK(pk);
     HostComponentDesiredStateEntity entity = dao.findByPK(pk);
-    Assert.assertEquals(PassiveState.ACTIVE, entity.getPassiveState());
-    Assert.assertEquals(PassiveState.ACTIVE, sch1.getPassiveState());
+    Assert.assertEquals(MaintenanceState.OFF, entity.getMaintenanceState());
+    Assert.assertEquals(MaintenanceState.OFF, sch1.getMaintenanceState());
     
     
-    sch1.setPassiveState(PassiveState.PASSIVE);
-    Assert.assertEquals(PassiveState.PASSIVE, sch1.getPassiveState());
+    sch1.setMaintenanceState(MaintenanceState.ON);
+    Assert.assertEquals(MaintenanceState.ON, sch1.getMaintenanceState());
     
     
     entity = dao.findByPK(pk);
     entity = dao.findByPK(pk);
-    Assert.assertEquals(PassiveState.PASSIVE, entity.getPassiveState());
+    Assert.assertEquals(MaintenanceState.ON, entity.getMaintenanceState());
 
 
   }
   }
 
 

+ 3 - 3
ambari-server/src/test/python/TestUpgradeScript_HDP2.py

@@ -183,11 +183,11 @@ class TestUpgradeHDP2Script(TestCase):
       "MAPREDUCE_CLIENT": ["c6401"]}
       "MAPREDUCE_CLIENT": ["c6401"]}
     UpgradeHelper_HDP2.main()
     UpgradeHelper_HDP2.main()
     expected_curl_calls = [
     expected_curl_calls = [
-      call(False, "-u", "admin:admin", '-H', 'X-Requested-By: ambari', "-X", "PUT", "-d", """{"HostRoles": {"state": "MAINTENANCE"}}""",
+      call(False, "-u", "admin:admin", '-H', 'X-Requested-By: ambari', "-X", "PUT", "-d", """{"HostRoles": {"state": "DISABLED"}}""",
            "http://localhost:8080/api/v1/clusters/c1/hosts/c6401/host_components/TASKTRACKER"),
            "http://localhost:8080/api/v1/clusters/c1/hosts/c6401/host_components/TASKTRACKER"),
-      call(False, "-u", "admin:admin", '-H', 'X-Requested-By: ambari', "-X", "PUT", "-d", """{"HostRoles": {"state": "MAINTENANCE"}}""",
+      call(False, "-u", "admin:admin", '-H', 'X-Requested-By: ambari', "-X", "PUT", "-d", """{"HostRoles": {"state": "DISABLED"}}""",
            "http://localhost:8080/api/v1/clusters/c1/hosts/c6402/host_components/TASKTRACKER"),
            "http://localhost:8080/api/v1/clusters/c1/hosts/c6402/host_components/TASKTRACKER"),
-      call(False, "-u", "admin:admin", '-H', 'X-Requested-By: ambari', "-X", "PUT", "-d", """{"HostRoles": {"state": "MAINTENANCE"}}""",
+      call(False, "-u", "admin:admin", '-H', 'X-Requested-By: ambari', "-X", "PUT", "-d", """{"HostRoles": {"state": "DISABLED"}}""",
            "http://localhost:8080/api/v1/clusters/c1/hosts/c6401/host_components/JOBTRACKER"),
            "http://localhost:8080/api/v1/clusters/c1/hosts/c6401/host_components/JOBTRACKER"),
       call(False, "-u", "admin:admin", '-H', 'X-Requested-By: ambari', "-X", "DELETE",
       call(False, "-u", "admin:admin", '-H', 'X-Requested-By: ambari', "-X", "DELETE",
            "http://localhost:8080/api/v1/clusters/c1/services/MAPREDUCE")]
            "http://localhost:8080/api/v1/clusters/c1/services/MAPREDUCE")]