Repository: ambari Updated Branches: refs/heads/trunk 2016fa316 -> 4bd14a966
AMBARI-5074. Service Start/Stop should respect Host level maintenance mode. (swagle) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4bd14a96 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4bd14a96 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4bd14a96 Branch: refs/heads/trunk Commit: 4bd14a96638fc40703030129e2355c3ad70429a2 Parents: 2016fa3 Author: Siddharth Wagle <[email protected]> Authored: Thu Mar 13 13:50:48 2014 -0700 Committer: Siddharth Wagle <[email protected]> Committed: Thu Mar 13 13:50:48 2014 -0700 ---------------------------------------------------------------------- .../internal/ServiceResourceProvider.java | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/4bd14a96/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java index c64bb57..76a17d2 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java @@ -56,6 +56,7 @@ import org.apache.ambari.server.controller.utilities.PropertyHelper; import org.apache.ambari.server.state.Cluster; import org.apache.ambari.server.state.Clusters; import org.apache.ambari.server.state.ComponentInfo; +import org.apache.ambari.server.state.Host; import org.apache.ambari.server.state.MaintenanceState; import org.apache.ambari.server.state.Service; import org.apache.ambari.server.state.ServiceComponent; @@ -637,7 +638,8 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider + ", currentDesiredState=" + oldScState + ", newDesiredState=" + newState); } - for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()){ + + for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) { State oldSchState = sch.getState(); if (oldSchState == State.DISABLED || oldSchState == State.UNKNOWN) { //Ignore host components updates in this state @@ -680,6 +682,22 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider } continue; } + Host host = clusters.getHost(sch.getHostName()); + + if (schMaint == MaintenanceState.IMPLIED + && host != null + && host.getMaintenanceState(cluster.getClusterId()) != MaintenanceState.OFF) { + + // Host is in Passive mode, ignore the SCH + ignoredScHosts.add(sch); + LOG.info("Ignoring ServiceComponentHost since " + + "the host is in passive mode" + + ", clusterName=" + request.getClusterName() + + ", serviceName=" + s.getName() + + ", componentName=" + sc.getName() + + ", hostname=" + sch.getHostName()); + continue; + } if (sc.isClientComponent() &&
