ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oleew...@apache.org
Subject ambari git commit: AMBARI-15881. Primary log in component info (Miklos Gergely via oleewere)
Date Tue, 19 Apr 2016 12:52:57 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 3d2ba98fd -> 1d4effce6


AMBARI-15881. Primary log in component info (Miklos Gergely via oleewere)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1d4effce
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1d4effce
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1d4effce

Branch: refs/heads/trunk
Commit: 1d4effce606a0ec434032cb2ae56211ab7b86cfa
Parents: 3d2ba98
Author: Miklos Gergely <mgergely@hortonworks.com>
Authored: Tue Apr 19 14:50:33 2016 +0200
Committer: oleewere <oleewere@gmail.com>
Committed: Tue Apr 19 14:50:50 2016 +0200

----------------------------------------------------------------------
 .../ambari/server/stack/ServiceDirectory.java   |  2 +-
 .../ambari/server/state/ComponentInfo.java      | 14 +++++
 .../ambari/server/state/LogDefinition.java      |  7 +++
 .../apache/ambari/server/state/ServiceInfo.java | 12 +++++
 .../ACCUMULO/1.6.1.2.2.0/metainfo.xml           |  5 ++
 .../AMBARI_METRICS/0.1.0/metainfo.xml           |  7 +--
 .../ATLAS/0.1.0.2.3/metainfo.xml                |  1 +
 .../FALCON/0.5.0.2.1/metainfo.xml               |  1 +
 .../HBASE/0.96.0.2.0/metainfo.xml               |  2 +
 .../common-services/HDFS/2.1.0.2.0/metainfo.xml |  5 ++
 .../HIVE/0.12.0.2.0/metainfo.xml                |  2 +
 .../KAFKA/0.8.1.2.2/metainfo.xml                |  7 +--
 .../common-services/KNOX/0.5.0.2.2/metainfo.xml |  1 +
 .../LOGSEARCH/0.5.0/metainfo.xml                |  2 +
 .../OOZIE/4.0.0.2.0/metainfo.xml                |  1 +
 .../OOZIE/4.2.0.2.3/metainfo.xml                |  1 +
 .../common-services/RANGER/0.4.0/metainfo.xml   |  2 +
 .../RANGER_KMS/0.5.0.2.3/metainfo.xml           |  3 +-
 .../STORM/0.9.1.2.1/metainfo.xml                | 18 ++++---
 .../common-services/YARN/2.1.0.2.0/metainfo.xml | 13 ++---
 .../ZOOKEEPER/3.4.5.2.0/metainfo.xml            |  3 +-
 .../BIGTOP/0.8/services/HBASE/metainfo.xml      | 12 +++++
 .../BIGTOP/0.8/services/HDFS/metainfo.xml       | 33 ++++++++++++
 .../BIGTOP/0.8/services/HIVE/metainfo.xml       | 12 +++++
 .../BIGTOP/0.8/services/OOZIE/metainfo.xml      |  6 +++
 .../BIGTOP/0.8/services/YARN/metainfo.xml       | 30 +++++++++++
 .../BIGTOP/0.8/services/ZOOKEEPER/metainfo.xml  |  8 ++-
 .../HDP/2.3.ECS/services/HBASE/metainfo.xml     |  6 +++
 .../HDP/2.3.ECS/services/YARN/metainfo.xml      | 56 +++++++++++++++-----
 .../stacks/HDP/2.3/services/STORM/metainfo.xml  |  6 +++
 .../stacks/HDP/2.5/services/ATLAS/metainfo.xml  |  8 ++-
 .../stacks/HDP/2.5/services/HIVE/metainfo.xml   |  6 +++
 .../server/api/services/AmbariMetaInfoTest.java |  6 ++-
 .../ambari/server/state/ServiceInfoTest.java    | 54 +++++++++++++++++++
 .../stacks/HDP/2.1.1/services/HDFS/metainfo.xml |  5 ++
 35 files changed, 318 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceDirectory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceDirectory.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceDirectory.java
index d574d60..356adb1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceDirectory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceDirectory.java
@@ -217,7 +217,7 @@ public abstract class ServiceDirectory extends StackDefinitionDirectory {
       metaInfoXml.setValid(false);
       String msg = String.format("Unable to parse service metainfo.xml file '%s' ", f.getAbsolutePath());
       metaInfoXml.setErrors(msg);
-      LOG.warn(msg);
+      LOG.warn(msg, e);
       metaInfoXml.setSchemaVersion(getAbsolutePath().replace(f.getParentFile().getParentFile().getParent()+File.separator, ""));
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/java/org/apache/ambari/server/state/ComponentInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ComponentInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ComponentInfo.java
index 5e576a8..a5004b2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ComponentInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ComponentInfo.java
@@ -207,9 +207,23 @@ public class ComponentInfo {
   }
 
   public List<LogDefinition> getLogs() {
+    if (logs == null) {
+      logs = new ArrayList<LogDefinition>();
+    }
+    
     return logs;
   }
 
+  public LogDefinition getPrimaryLog() {
+    for (LogDefinition log : getLogs()) {
+      if (log.isPrimary()) {
+        return log;
+      }
+    }
+    
+    return null;
+  }
+
   public void setLogs(List<LogDefinition> logs) {
     this.logs = logs;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/java/org/apache/ambari/server/state/LogDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/LogDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/state/LogDefinition.java
index 7a70e98..b416314 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/LogDefinition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/LogDefinition.java
@@ -32,11 +32,16 @@ import org.apache.commons.lang.builder.ToStringStyle;
 public class LogDefinition
 {
   private String logId;
+  private boolean primary;
 
   public String getLogId() {
     return logId;
   }
 
+  public boolean isPrimary() {
+    return primary;
+  }
+
   @Override
   public boolean equals(Object obj)
   {
@@ -52,6 +57,7 @@ public class LogDefinition
     LogDefinition other = (LogDefinition) obj;
     return new EqualsBuilder()
         .append(logId, other.logId)
+        .append(primary, other.primary)
         .isEquals();
   }
 
@@ -60,6 +66,7 @@ public class LogDefinition
   {
     return new HashCodeBuilder(17, 31)
         .append(logId)
+        .append(primary)
         .toHashCode();
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
index db95fec..5a2bf84 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
@@ -902,6 +902,18 @@ public String getVersion() {
         setErrors("Duplicate service property with name '" + propertyName + "' found in " + getName() + ":" + getVersion() + " service definition !");
       }
     }
+
+    for (ComponentInfo component : getComponents()) {
+      int primaryLogs = 0;
+      for (LogDefinition log : component.getLogs()) {
+        primaryLogs += log.isPrimary() ? 1 : 0;
+      }
+
+      if (primaryLogs > 1) {
+        setValid(false);
+        setErrors("More than one primary log exists for the component " + component.getName());
+      }
+    }
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/metainfo.xml b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/metainfo.xml
index a5a4414..377e74c 100644
--- a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/metainfo.xml
@@ -57,6 +57,7 @@
           <logs>
             <log>
               <logId>accumulo_master</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>
@@ -76,6 +77,7 @@
           <logs>
             <log>
               <logId>accumulo_monitor</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>
@@ -95,6 +97,7 @@
           <logs>
             <log>
               <logId>accumulo_gc</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>
@@ -114,6 +117,7 @@
           <logs>
             <log>
               <logId>accumulo_tracer</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>
@@ -132,6 +136,7 @@
           <logs>
             <log>
               <logId>accumulo_tserver</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml
index aaba3e9..152ea72 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml
@@ -50,13 +50,14 @@
           </commandScript>
           <logs>
             <log>
-              <logId>ams_hbase_master</logId>
+              <logId>ams_collector</logId>
+              <primary>true</primary>
             </log>
             <log>
-              <logId>ams_hbase_regionserver</logId>
+              <logId>ams_hbase_master</logId>
             </log>
             <log>
-              <logId>ams_collector</logId>
+              <logId>ams_hbase_regionserver</logId>
             </log>
           </logs>
           <configuration-dependencies>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/metainfo.xml b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/metainfo.xml
index 3172af3..133b264 100644
--- a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/metainfo.xml
@@ -41,6 +41,7 @@
           <logs>
             <log>
               <logId>atlas_app</logId>
+              <primary>true</primary>
             </log>
           </logs>
           <configFile>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/metainfo.xml b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/metainfo.xml
index 451a500..985e7f4 100644
--- a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/metainfo.xml
@@ -83,6 +83,7 @@
           <logs>
             <log>
               <logId>falcon_app</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metainfo.xml b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metainfo.xml
index db46879..a56ff10 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metainfo.xml
@@ -58,6 +58,7 @@
           <logs>
             <log>
               <logId>hbase_master</logId>
+              <primary>true</primary>
             </log>
           </logs>
           <customCommands>
@@ -92,6 +93,7 @@
           <logs>
             <log>
               <logId>hbase_regionserver</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
index df7bf05..07080b4 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
@@ -40,6 +40,7 @@
           <logs>
             <log>
               <logId>hdfs_namenode</logId>
+              <primary>true</primary>
             </log>
             <log>
               <logId>hdfs_audit</logId>
@@ -85,6 +86,7 @@
           <logs>
             <log>
               <logId>hdfs_datanode</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>
@@ -105,6 +107,7 @@
           <logs>
             <log>
               <logId>hdfs_secondarynamenode</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>
@@ -158,6 +161,7 @@
           <logs>
             <log>
               <logId>hdfs_journalnode</logId>
+              <primary>true</primary>
             </log>
           </logs>
           <dependencies>
@@ -186,6 +190,7 @@
           <logs>
             <log>
               <logId>hdfs_zkfc</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
index c35c420..42a7a4a 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
@@ -45,6 +45,7 @@
           <logs>
             <log>
               <logId>hive_metastore</logId>
+              <primary>true</primary>
             </log>
           </logs>
           <configuration-dependencies>
@@ -91,6 +92,7 @@
           <logs>
             <log>
               <logId>hive_hiveserver2</logId>
+              <primary>true</primary>
             </log>
           </logs>
           <configuration-dependencies>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/metainfo.xml b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/metainfo.xml
index c2cb8f5..8dd050f 100644
--- a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/metainfo.xml
@@ -46,6 +46,10 @@
           </commandScript>
           <logs>
             <log>
+              <logId>kafka_server</logId>
+              <primary>true</primary>
+            </log>
+            <log>
               <logId>kafka_controller</logId>
             </log>
             <log>
@@ -55,9 +59,6 @@
               <logId>kafka_logcleaner</logId>
             </log>
             <log>
-              <logId>kafka_server</logId>
-            </log>
-            <log>
               <logId>kafka_statechange</logId>
             </log>
           </logs>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/metainfo.xml b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/metainfo.xml
index 940fc8f..37bbceb 100644
--- a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/metainfo.xml
@@ -38,6 +38,7 @@
           <logs>
             <log>
               <logId>knox_gateway</logId>
+              <primary>true</primary>
             </log>
             <log>
               <logId>knox_cli</logId>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/metainfo.xml b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/metainfo.xml
index 9d7f0c1..5966704 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/metainfo.xml
@@ -40,6 +40,7 @@
           <logs>
             <log>
               <logId>logsearch_app</logId>
+              <primary>true</primary>
             </log>
             <log>
               <logId>logsearch_perf</logId>
@@ -73,6 +74,7 @@
           <logs>
             <log>
               <logId>logsearch_feeder</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/metainfo.xml b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/metainfo.xml
index 9e9e642..cb08a9c 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/metainfo.xml
@@ -63,6 +63,7 @@
           <logs>
             <log>
               <logId>oozie_app</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/metainfo.xml b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/metainfo.xml
index 9502b94..c383a82 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/metainfo.xml
@@ -64,6 +64,7 @@
           <logs>
             <log>
               <logId>oozie_app</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/common-services/RANGER/0.4.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/metainfo.xml b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/metainfo.xml
index 3e59f91..54228d2 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/metainfo.xml
@@ -42,6 +42,7 @@
           <logs>
             <log>
               <logId>ranger_admin</logId>
+              <primary>true</primary>
             </log>
             <log>
               <logId>ranger_dbpatch</logId>
@@ -63,6 +64,7 @@
           <logs>
             <log>
               <logId>ranger_usersync</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/metainfo.xml b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/metainfo.xml
index f61059b..b20201c 100644
--- a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/metainfo.xml
@@ -42,6 +42,7 @@
           <logs>
             <log>
               <logId>ranger_kms</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>
@@ -62,7 +63,7 @@
       <commandScript>
         <script>scripts/service_check.py</script>
         <scriptType>PYTHON</scriptType>
-        <timeout>300</timeout>        
+        <timeout>300</timeout>
       </commandScript>
 
       <requiredServices>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/metainfo.xml b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/metainfo.xml
index a62e8a0..acb4a57 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/metainfo.xml
@@ -49,6 +49,7 @@
           <logs>
             <log>
               <logId>storm_nimbus</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>
@@ -64,14 +65,6 @@
             <scriptType>PYTHON</scriptType>
             <timeout>1200</timeout>
           </commandScript>
-          <logs>
-            <log>
-              <logId>storm_logviewer</logId>
-            </log>
-            <log>
-              <logId>storm_worker</logId>
-            </log>
-          </logs>
         </component>
 
         <component>
@@ -92,6 +85,13 @@
           <logs>
             <log>
               <logId>storm_supervisor</logId>
+              <primary>true</primary>
+            </log>
+            <log>
+              <logId>storm_worker</logId>
+            </log>
+            <log>
+              <logId>storm_logviewer</logId>
             </log>
           </logs>
         </component>
@@ -110,6 +110,7 @@
           <logs>
             <log>
               <logId>storm_ui</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>
@@ -128,6 +129,7 @@
           <logs>
             <log>
               <logId>storm_drpc</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml
index 702ccb8..10e6405 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml
@@ -40,13 +40,8 @@
           </commandScript>
           <logs>
             <log>
-              <logId>mapred_historyserver</logId>
-            </log>
-            <log>
               <logId>yarn_resourcemanager</logId>
-            </log>
-            <log>
-              <logId>yarn_timelineserver</logId>
+              <primary>true</primary>h
             </log>
             <log>
               <logId>yarn_historyserver</logId>
@@ -224,6 +219,12 @@
             <scriptType>PYTHON</scriptType>
             <timeout>1200</timeout>
           </commandScript>
+          <logs>
+            <log>
+              <logId>mapred_historyserver</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
         </component>
 
         <component>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/metainfo.xml b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/metainfo.xml
index e9e8407..231d2be 100644
--- a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/metainfo.xml
@@ -39,6 +39,7 @@
           <logs>
             <log>
               <logId>zookeeper</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>
@@ -63,7 +64,7 @@
               <type>env</type>
               <fileName>log4j.properties</fileName>
               <dictionaryName>zookeeper-log4j</dictionaryName>
-            </configFile>            
+            </configFile>
           </configFiles>
         </component>
       </components>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HBASE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HBASE/metainfo.xml b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HBASE/metainfo.xml
index c304772..00d7cf9 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HBASE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HBASE/metainfo.xml
@@ -53,6 +53,12 @@
             <scriptType>PYTHON</scriptType>
             <timeout>600</timeout>
           </commandScript>
+          <logs>
+            <log>
+              <logId>hbase_master</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
           <customCommands>
             <customCommand>
               <name>DECOMMISSION</name>
@@ -74,6 +80,12 @@
             <script>scripts/hbase_regionserver.py</script>
             <scriptType>PYTHON</scriptType>
           </commandScript>
+          <logs>
+            <log>
+              <logId>hbase_regionserver</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
         </component>
 
         <component>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/metainfo.xml b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/metainfo.xml
index d1d1069..8500839 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/metainfo.xml
@@ -35,6 +35,15 @@
             <scriptType>PYTHON</scriptType>
             <timeout>600</timeout>
           </commandScript>
+          <logs>
+            <log>
+              <logId>hdfs_namenode</logId>
+              <primary>true</primary>
+            </log>
+            <log>
+              <logId>hdfs_audit</logId>
+            </log>
+          </logs>
           <customCommands>
             <customCommand>
               <name>DECOMMISSION</name>
@@ -65,6 +74,12 @@
             <scriptType>PYTHON</scriptType>
             <timeout>600</timeout>
           </commandScript>
+          <logs>
+            <log>
+              <logId>hdfs_datanode</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
         </component>
 
         <component>
@@ -78,6 +93,12 @@
             <scriptType>PYTHON</scriptType>
             <timeout>600</timeout>
           </commandScript>
+          <logs>
+            <log>
+              <logId>hdfs_secondarynamenode</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
         </component>
 
         <component>
@@ -124,6 +145,12 @@
             <scriptType>PYTHON</scriptType>
             <timeout>600</timeout>
           </commandScript>
+          <logs>
+            <log>
+              <logId>hdfs_journalnode</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
         </component>
 
         <component>
@@ -137,6 +164,12 @@
             <scriptType>PYTHON</scriptType>
             <timeout>600</timeout>
           </commandScript>
+          <logs>
+            <log>
+              <logId>hdfs_zkfc</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
         </component>
       </components>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/metainfo.xml b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/metainfo.xml
index 2d8bd10..d14ce67 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/metainfo.xml
@@ -40,6 +40,12 @@
             <scriptType>PYTHON</scriptType>
             <timeout>600</timeout>
           </commandScript>
+          <logs>
+            <log>
+              <logId>hive_metastore</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
         </component>
 
         <component>
@@ -76,6 +82,12 @@
             <script>scripts/hive_server.py</script>
             <scriptType>PYTHON</scriptType>
           </commandScript>
+          <logs>
+            <log>
+              <logId>hive_hiveserver2</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
         </component>
         <component>
           <name>WEBHCAT_SERVER</name>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/OOZIE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/OOZIE/metainfo.xml b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/OOZIE/metainfo.xml
index e0e7a6c..20c3b32 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/OOZIE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/OOZIE/metainfo.xml
@@ -58,6 +58,12 @@
             <scriptType>PYTHON</scriptType>
             <timeout>600</timeout>
           </commandScript>
+          <logs>
+            <log>
+              <logId>oozie_app</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
         </component>
 
         <component>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/YARN/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/YARN/metainfo.xml b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/YARN/metainfo.xml
index 63dfcff..7f76b8b 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/YARN/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/YARN/metainfo.xml
@@ -36,6 +36,12 @@
             <scriptType>PYTHON</scriptType>
             <timeout>600</timeout>
           </commandScript>
+          <logs>
+            <log>
+              <logId>yarn_timelineserver</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
         </component>
         
         <component>
@@ -48,6 +54,18 @@
             <scriptType>PYTHON</scriptType>
             <timeout>600</timeout>
           </commandScript>
+          <logs>
+            <log>
+              <logId>yarn_resourcemanager</logId>
+              <primary>true</primary>
+            </log>
+            <log>
+              <logId>yarn_historyserver</logId>
+            </log>
+            <log>
+              <logId>yarn_jobsummary</logId>
+            </log>
+          </logs>
           <customCommands>
             <customCommand>
               <name>DECOMMISSION</name>
@@ -81,6 +99,12 @@
             <scriptType>PYTHON</scriptType>
             <timeout>600</timeout>
           </commandScript>
+          <logs>
+            <log>
+              <logId>yarn_nodemanager</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
         </component>
 
         <component>
@@ -184,6 +208,12 @@
             <scriptType>PYTHON</scriptType>
             <timeout>600</timeout>
           </commandScript>
+          <logs>
+            <log>
+              <logId>mapred_historyserver</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
         </component>
 
         <component>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/ZOOKEEPER/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/ZOOKEEPER/metainfo.xml b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/ZOOKEEPER/metainfo.xml
index 56c6738..95082d2 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/ZOOKEEPER/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/ZOOKEEPER/metainfo.xml
@@ -35,6 +35,12 @@
             <scriptType>PYTHON</scriptType>
             <timeout>600</timeout>
           </commandScript>
+          <logs>
+            <log>
+              <logId>zookeeper</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
         </component>
 
         <component>
@@ -56,7 +62,7 @@
               <type>env</type>
               <fileName>log4j.properties</fileName>
               <dictionaryName>zookeeper-log4j</dictionaryName>
-            </configFile>            
+            </configFile>
           </configFiles>
         </component>
       </components>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/stacks/HDP/2.3.ECS/services/HBASE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3.ECS/services/HBASE/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3.ECS/services/HBASE/metainfo.xml
index 16fb847..f45a44a 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3.ECS/services/HBASE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3.ECS/services/HBASE/metainfo.xml
@@ -29,6 +29,12 @@
           <cardinality>1+</cardinality>
           <versionAdvertised>true</versionAdvertised>
           <timelineAppid>HBASE</timelineAppid>
+          <logs>
+            <log>
+              <logId>hbase_master</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
           <dependencies>
             <dependency>
               <name>ECS/ECS_CLIENT</name>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/stacks/HDP/2.3.ECS/services/YARN/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3.ECS/services/YARN/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3.ECS/services/YARN/metainfo.xml
index 97be2db..556a6cc 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3.ECS/services/YARN/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3.ECS/services/YARN/metainfo.xml
@@ -34,6 +34,12 @@
           <category>SLAVE</category>
           <cardinality>1+</cardinality>
           <versionAdvertised>true</versionAdvertised>
+          <logs>
+            <log>
+              <logId>yarn_nodemanager</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
           <dependencies>
             <dependency>
               <name>ECS/ECS_CLIENT</name>
@@ -56,6 +62,12 @@
           <displayName>App Timeline Server</displayName>
           <category>MASTER</category>
           <cardinality>0-1</cardinality>
+          <logs>
+            <log>
+              <logId>yarn_timelineserver</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
           <dependencies>
             <dependency>
               <name>ECS/ECS_CLIENT</name>
@@ -66,18 +78,30 @@
             </dependency>
           </dependencies>
         </component>
-       <component>
-         <name>RESOURCEMANAGER</name>
-         <category>MASTER</category>
-         <cardinality>1-2</cardinality>
-         <dependencies>
-           <dependency>
-              <name>TEZ/TEZ_CLIENT</name>
-              <scope>host</scope>
-              <auto-deploy>
-                <enabled>true</enabled>
-              </auto-deploy>
-           </dependency>
+        <component>
+          <name>RESOURCEMANAGER</name>
+          <category>MASTER</category>
+          <cardinality>1-2</cardinality>
+          <logs>
+            <log>
+              <logId>yarn_resourcemanager</logId>
+              <primary>true</primary>
+            </log>
+            <log>
+              <logId>yarn_historyserver</logId>
+            </log>
+            <log>
+              <logId>yarn_jobsummary</logId>
+            </log>
+          </logs>
+          <dependencies>
+            <dependency>
+               <name>TEZ/TEZ_CLIENT</name>
+               <scope>host</scope>
+               <auto-deploy>
+                 <enabled>true</enabled>
+               </auto-deploy>
+            </dependency>
             <dependency>
               <name>ECS/ECS_CLIENT</name>
               <scope>host</scope>
@@ -85,7 +109,7 @@
                 <enabled>true</enabled>
               </auto-deploy>
             </dependency>
-         </dependencies>
+          </dependencies>
           <configuration-dependencies>
             <config-type>capacity-scheduler</config-type>
           </configuration-dependencies>
@@ -107,6 +131,12 @@
             <enabled>true</enabled>
             <co-locate>YARN/RESOURCEMANAGER</co-locate>
           </auto-deploy>
+          <logs>
+            <log>
+              <logId>mapred_historyserver</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
           <dependencies>
             <dependency>
               <name>ECS/ECS_CLIENT</name>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/metainfo.xml
index 18e0daf..29bd6a4 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/metainfo.xml
@@ -43,6 +43,12 @@
             <scriptType>PYTHON</scriptType>
             <timeout>1200</timeout>
           </commandScript>
+          <logs>
+            <log>
+              <logId>storm_nimbus</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
         </component>
       </components>
     </service>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/stacks/HDP/2.5/services/ATLAS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/services/ATLAS/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/services/ATLAS/metainfo.xml
index a25c2ae..c787b40 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/services/ATLAS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/ATLAS/metainfo.xml
@@ -30,7 +30,13 @@
             <fileName>atlas-application.properties</fileName>
             <dictionaryName>application-properties</dictionaryName>
           </configFile>
-        </component>
+          <logs>
+            <log>
+              <logId>atlas_app</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
+         </component>
 
         <component>
           <name>ATLAS_CLIENT</name>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/metainfo.xml
index be55bb0..568648b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/metainfo.xml
@@ -91,6 +91,12 @@
             <script>scripts/hive_server_interactive.py</script>
             <scriptType>PYTHON</scriptType>
           </commandScript>
+          <logs>
+            <log>
+              <logId>hive_hiveserver2</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
           <customCommands>
             <customCommand>
               <name>RESTART_LLAP</name>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
index 8c844eb..e5bb7ca 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
@@ -195,16 +195,20 @@ public class AmbariMetaInfoTest {
     assertTrue(component.getLogs().size() == 2);
     assertEquals(component.getLogs().get(0).getLogId(), "hdfs_namenode");
     assertEquals(component.getLogs().get(1).getLogId(), "hdfs_audit");
+    assertTrue(component.getLogs().get(0).isPrimary());
+    assertFalse(component.getLogs().get(1).isPrimary());
 
     component = metaInfo.getComponent(STACK_NAME_HDP, "2.1.1", SERVICE_NAME_HDFS, "DATANODE");
     assertNotNull(component);
     assertNotNull(component.getLogs());
     assertTrue(component.getLogs().size() == 1);
     assertEquals(component.getLogs().get(0).getLogId(), "hdfs_datanode");
+    assertTrue(component.getLogs().get(0).isPrimary());
 
     component = metaInfo.getComponent(STACK_NAME_HDP, "2.1.1", SERVICE_NAME_HDFS, "HDFS_CLIENT");
     assertNotNull(component);
-    assertNull(component.getLogs());
+    assertNotNull(component.getLogs());
+    assertTrue(component.getLogs().isEmpty());
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java
index 43cea91..1754cbb 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java
@@ -301,6 +301,60 @@ public class ServiceInfoTest {
 
   }
 
+
+  @Test
+  public void testMultiplePimaryLogsValidationAfterXmlDeserialization() throws Exception
+  {
+    // Given
+    String serviceInfoXml =
+        "<metainfo>" +
+        "  <schemaVersion>2.0</schemaVersion>" +
+        "  <services>" +
+        "    <service>" +
+        "      <version>1.0</version>" +
+        "      <name>WITH_MULTIPLE_PRIMARY_LOGS</name>" +
+        "      <displayName>WITH_MULTIPLE_PRIMARY_LOGS</displayName>" +
+        "      <properties>" +
+        "        <property>" +
+        "          <name>managed</name>" +
+        "          <value>false</value>" +
+        "        </property>" +
+        "      </properties>" +
+        "      <components> " +
+        "        <component> " +
+        "          <name>COMPONENT_WITH_MULTIPLE_PRIMARY_LOG</name> " +
+        "          <displayName>COMPONENT_WITH_MULTIPLE_PRIMARY_LOG</displayName> " +
+        "          <category>MASTER</category> " +
+        "          <cardinality>0-1</cardinality> " +
+        "          <versionAdvertised>true</versionAdvertised> " +
+        "          <logs> " +
+        "            <log> " +
+        "              <logId>log1</logId> " +
+        "              <primary>true</primary> " +
+        "            </log> " +
+        "            <log> " +
+        "              <logId>log2</logId> " +
+        "              <primary>true</primary> " +
+        "            </log> " +
+        "          </logs> " +
+        "       </component> " +
+        "      </components> " +
+        "    </service>" +
+        "  </services>" +
+        "</metainfo>";
+
+    // When
+    Map<String, ServiceInfo> serviceInfoMap = getServiceInfo(serviceInfoXml);
+    ServiceInfo serviceInfo = serviceInfoMap.get("WITH_MULTIPLE_PRIMARY_LOGS");
+
+    // Then
+    assertFalse("Service info should be in invalid state due to multiple primary logs at one of it's components!", serviceInfo.isValid());
+
+    assertTrue("Service info error collection should contain the name of the component with the multiple primary logs!",
+        serviceInfo.getErrors().contains("More than one primary log exists for the component COMPONENT_WITH_MULTIPLE_PRIMARY_LOG"));
+  }
+
+
   @Test
   public void testSetServicePropertiesAfterPropertyListSet() {
     // Given

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d4effce/ambari-server/src/test/resources/stacks/HDP/2.1.1/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.1.1/services/HDFS/metainfo.xml b/ambari-server/src/test/resources/stacks/HDP/2.1.1/services/HDFS/metainfo.xml
index f23d0d7..a7d43a4 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.1.1/services/HDFS/metainfo.xml
+++ b/ambari-server/src/test/resources/stacks/HDP/2.1.1/services/HDFS/metainfo.xml
@@ -35,6 +35,7 @@
           <logs>
             <log>
               <logId>hdfs_namenode</logId>
+              <primary>true</primary>
             </log>
             <log>
               <logId>hdfs_audit</logId>
@@ -71,6 +72,7 @@
           <logs>
             <log>
               <logId>hdfs_datanode</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>
@@ -86,6 +88,7 @@
           <logs>
             <log>
               <logId>hdfs_secondarynamenode</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>
@@ -111,6 +114,7 @@
           <logs>
             <log>
               <logId>hdfs_journalnode</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>
@@ -126,6 +130,7 @@
           <logs>
             <log>
               <logId>hdfs_zkfc</logId>
+              <primary>true</primary>
             </log>
           </logs>
         </component>


Mime
View raw message