You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by mi...@apache.org on 2016/04/12 02:31:25 UTC
ambari git commit: AMBARI-15783: Assign Slaves and Clients Page:
Incorrect validation error shown (mithmatt)
Repository: ambari
Updated Branches:
refs/heads/trunk 8531c115f -> bce64344f
AMBARI-15783: Assign Slaves and Clients Page: Incorrect validation error shown (mithmatt)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bce64344
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bce64344
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bce64344
Branch: refs/heads/trunk
Commit: bce64344fc8238a50c2f01f72c1050e47d7c3dc3
Parents: 8531c11
Author: Matt <mm...@pivotal.io>
Authored: Mon Apr 11 17:29:07 2016 -0700
Committer: Matt <mm...@pivotal.io>
Committed: Mon Apr 11 17:29:07 2016 -0700
----------------------------------------------------------------------
.../src/main/resources/stacks/stack_advisor.py | 22 ++++++++++----------
.../stacks/2.0.6/common/test_stack_advisor.py | 5 +++--
2 files changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/bce64344/ambari-server/src/main/resources/stacks/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/stack_advisor.py b/ambari-server/src/main/resources/stacks/stack_advisor.py
index 636de01..539bd25 100644
--- a/ambari-server/src/main/resources/stacks/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/stack_advisor.py
@@ -387,21 +387,20 @@ class DefaultStackAdvisor(StackAdvisor):
for component in slaveClientComponents:
componentName = component["StackServiceComponents"]["component_name"]
- componentIsPopulated = self.isComponentHostsPopulated(component)
- hostsForComponent = []
-
- if componentIsPopulated:
- hostsForComponent = component["StackServiceComponents"]["hostnames"]
+ if component["StackServiceComponents"]["cardinality"] == "ALL":
+ hostsForComponent = hostsList
else:
+ componentIsPopulated = self.isComponentHostsPopulated(component)
+ if componentIsPopulated:
+ hostsForComponent = component["StackServiceComponents"]["hostnames"]
+ else:
+ hostsForComponent = []
if self.isSlaveComponent(component):
cardinality = str(component["StackServiceComponents"]["cardinality"])
if self.isComponentUsingCardinalityForLayout(componentName) and cardinality:
# cardinality types: 1+, 1-2, 1, ALL
- if cardinality == "ALL":
- hostsMin = len(hostsList)
- hostsForComponent = hostsList
- elif "+" in cardinality:
+ if "+" in cardinality:
hostsMin = int(cardinality[:-1])
elif "-" in cardinality:
nums = cardinality.split("-")
@@ -410,12 +409,13 @@ class DefaultStackAdvisor(StackAdvisor):
hostsMin = int(cardinality)
if hostsMin > len(hostsForComponent):
hostsForComponent.extend(freeHosts[0:hostsMin-len(hostsForComponent)])
- else:
+ # Components which are already installed, keep the recommendation as the existing layout
+ elif not componentIsPopulated:
hostsForComponent.extend(freeHosts)
if not hostsForComponent: # hostsForComponent is empty
hostsForComponent = hostsList[-1:]
hostsForComponent = list(set(hostsForComponent)) # removing duplicates
- elif self.isClientComponent(component):
+ elif self.isClientComponent(component) and not componentIsPopulated:
hostsForComponent = freeHosts[0:1]
if not hostsForComponent: # hostsForComponent is empty
hostsForComponent = hostsList[-1:]
http://git-wip-us.apache.org/repos/asf/ambari/blob/bce64344/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
index d434cae..5490955 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
@@ -79,7 +79,8 @@ class TestHDP206StackAdvisor(TestCase):
}
self.assertHostLayout(expectedComponentsHostsMap, result)
- def test_recommendationAssignmentNotChanged(self):
+ def test_recommendOnAllHosts(self):
+ """ Recommend on all hosts for cardinality ALL even if the component has been installed in the cluster before """
servicesInfo = [
{
"name": "GANGLIA",
@@ -91,7 +92,7 @@ class TestHDP206StackAdvisor(TestCase):
result = self.stackAdvisor.recommendComponentLayout(services, hosts)
expectedComponentsHostsMap = {
- "GANGLIA_MONITOR": ["host1"]
+ "GANGLIA_MONITOR": ["host1", "host2"]
}
self.assertHostLayout(expectedComponentsHostsMap, result)