You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2018/05/09 19:37:18 UTC

[ambari] branch trunk updated: Revert "Revert "AMBARI-23778 Ambari assigns /home for NameNode, DataNode and NodeManager directories (#1201)" (#1215)" (#1224)

This is an automated email from the ASF dual-hosted git repository.

swagle pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new fef6634  Revert "Revert "AMBARI-23778 Ambari assigns /home for NameNode, DataNode and NodeManager directories (#1201)" (#1215)" (#1224)
fef6634 is described below

commit fef6634106429d1715c2e137cbd5e5ab9b0f8262
Author: Siddharth <sw...@apache.org>
AuthorDate: Wed May 9 12:37:16 2018 -0700

    Revert "Revert "AMBARI-23778 Ambari assigns /home for NameNode, DataNode and NodeManager directories (#1201)" (#1215)" (#1224)
    
    This reverts commit bc38be0fae82e444152c63d6f466c4e81a3dd64c.
---
 .../src/main/resources/stacks/stack_advisor.py      | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/ambari-server/src/main/resources/stacks/stack_advisor.py b/ambari-server/src/main/resources/stacks/stack_advisor.py
index b199f5f..23db162 100644
--- a/ambari-server/src/main/resources/stacks/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/stack_advisor.py
@@ -2280,7 +2280,7 @@ class DefaultStackAdvisor(StackAdvisor):
 
     return sorted(mounts)
 
-  def getMountPathVariations(self, initial_value, component_name, services, hosts):
+  def getMountPathVariations(self, initial_value, component_name, services, hosts, banned_mounts=[]):
     """
     Recommends best fitted mount by prefixing path with it.
 
@@ -2291,6 +2291,7 @@ class DefaultStackAdvisor(StackAdvisor):
     :type component_name str
     :type services dict
     :type hosts dict
+    :type banned_mounts list
     :rtype list
     """
     available_mounts = []
@@ -2299,6 +2300,8 @@ class DefaultStackAdvisor(StackAdvisor):
       return available_mounts
 
     mounts = self.__getSameHostMounts(hosts)
+    for banned in banned_mounts:
+      mounts.remove(banned)
     sep = "/"
 
     if not mounts:
@@ -2312,7 +2315,7 @@ class DefaultStackAdvisor(StackAdvisor):
     # no list transformations after filling the list, because this will cause item order change
     return available_mounts
 
-  def getMountPathVariation(self, initial_value, component_name, services, hosts):
+  def getMountPathVariation(self, initial_value, component_name, services, hosts, banned_mounts=[]):
     """
     Recommends best fitted mount by prefixing path with it.
 
@@ -2323,14 +2326,15 @@ class DefaultStackAdvisor(StackAdvisor):
         :type component_name str
     :type services dict
     :type hosts dict
+    :type banned_mounts list
     :rtype str
     """
     try:
-      return [self.getMountPathVariations(initial_value, component_name, services, hosts)[0]]
+      return [self.getMountPathVariations(initial_value, component_name, services, hosts, banned_mounts)[0]]
     except IndexError:
       return []
 
-  def updateMountProperties(self, siteConfig, propertyDefinitions, configurations,  services, hosts):
+  def updateMountProperties(self, siteConfig, propertyDefinitions, configurations,  services, hosts, banned_mounts=[]):
     """
     Update properties according to recommendations for available mount-points
 
@@ -2349,6 +2353,7 @@ class DefaultStackAdvisor(StackAdvisor):
     :type configurations dict
     :type services dict
     :type hosts dict
+    :type banned_mounts list
     """
 
     props = self.getServicesSiteProperties(services, siteConfig)
@@ -2360,14 +2365,14 @@ class DefaultStackAdvisor(StackAdvisor):
 
       if props is None or name not in props:
         if rc_type == "multi":
-          recommendation = self.getMountPathVariations(default_value, component, services, hosts)
+          recommendation = self.getMountPathVariations(default_value, component, services, hosts, banned_mounts)
         else:
-          recommendation = self.getMountPathVariation(default_value, component, services, hosts)
+          recommendation = self.getMountPathVariation(default_value, component, services, hosts, banned_mounts)
       elif props and name in props and props[name] == default_value:
         if rc_type == "multi":
-          recommendation = self.getMountPathVariations(default_value, component, services, hosts)
+          recommendation = self.getMountPathVariations(default_value, component, services, hosts, banned_mounts)
         else:
-          recommendation = self.getMountPathVariation(default_value, component, services, hosts)
+          recommendation = self.getMountPathVariation(default_value, component, services, hosts, banned_mounts)
 
       if recommendation:
         put_f(name, ",".join(recommendation))

-- 
To stop receiving notification emails like this one, please contact
swagle@apache.org.