You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by wu...@apache.org on 2022/11/03 09:44:12 UTC

[ambari] branch trunk updated: AMBARI-25210: ONEFS installation via blueprint fails (#3434)

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

wuzhiguo 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 852d46387f AMBARI-25210: ONEFS installation via blueprint fails (#3434)
852d46387f is described below

commit 852d46387f5aafdfba9cb9b7b11609e636e66e95
Author: Zhiguo Wu <wu...@apache.org>
AuthorDate: Thu Nov 3 17:44:06 2022 +0800

    AMBARI-25210: ONEFS installation via blueprint fails (#3434)
---
 .../controller/internal/BlueprintConfigurationProcessor.java       | 2 +-
 .../java/org/apache/ambari/server/topology/ClusterTopology.java    | 4 ++--
 .../org/apache/ambari/server/topology/ClusterTopologyImpl.java     | 7 ++-----
 .../org/apache/ambari/server/topology/ClusterTopologyImplTest.java | 4 +---
 4 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index 8e22e0954b..b3540dce5d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -1955,7 +1955,7 @@ public class BlueprintConfigurationProcessor {
               return origValue;
             }
 
-            if (topology.isComponentHadoopCompatible(component)) {
+            if (isComponentNameNode() && topology.hasHadoopCompatibleService()) { // do not fail, could be a ONEFS installation
               return origValue;
             }
 
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopology.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopology.java
index 4d8bba3c28..bb6c1021f2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopology.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopology.java
@@ -186,7 +186,7 @@ public interface ClusterTopology {
   String getDefaultPassword();
 
   /**
-   * @return true if the given component belongs to a service that has serviceType=HCFS
+   * @return true if the topology contains any service with HCFS tag
    */
-  boolean isComponentHadoopCompatible(String component);
+  boolean hasHadoopCompatibleService();
 }
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java
index c1c57908b3..87d95fc203 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java
@@ -300,12 +300,9 @@ public class ClusterTopologyImpl implements ClusterTopology {
   }
 
   @Override
-  public boolean isComponentHadoopCompatible(String component) {
+  public boolean hasHadoopCompatibleService() {
     return blueprint.getServiceInfos().stream()
-      .filter(service -> service.getComponentByName(component) != null)
-      .findFirst()
-      .map(service -> HADOOP_COMPATIBLE_FS.equals(service.getServiceType()))
-      .orElse(false);
+      .anyMatch(service -> HADOOP_COMPATIBLE_FS.equals(service.getServiceType()));
   }
 
   private void registerHostGroupInfo(Map<String, HostGroupInfo> requestedHostGroupInfoMap) throws InvalidTopologyException {
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java
index d157ff6e4a..9b17c11c08 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java
@@ -21,7 +21,6 @@ package org.apache.ambari.server.topology;
 import static java.util.Arrays.asList;
 import static java.util.Collections.singletonList;
 import static org.easymock.EasyMock.expect;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.powermock.api.easymock.PowerMock.createNiceMock;
 import static org.powermock.api.easymock.PowerMock.replay;
@@ -187,8 +186,7 @@ public class ClusterTopologyImplTest {
     ).anyTimes();
     replayAll();
     ClusterTopologyImpl topology = new ClusterTopologyImpl(null, new TestTopologyRequest(TopologyRequest.Type.PROVISION));
-    assertTrue(topology.isComponentHadoopCompatible("ONEFS_CLIENT"));
-    assertFalse(topology.isComponentHadoopCompatible("ZOOKEEPER_CLIENT"));
+    assertTrue(topology.hasHadoopCompatibleService());
   }
 
   private ServiceInfo aHCFSWith(ComponentInfo... components) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ambari.apache.org
For additional commands, e-mail: commits-help@ambari.apache.org