You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2016/10/13 12:31:52 UTC

[1/7] ambari git commit: AMBARI-18568. Hive shows restart indicator after RU (ncole)

Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-18456 18c74125a -> a851d8f12


AMBARI-18568. Hive shows restart indicator after RU (ncole)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 82afd3a0ff4dac37a8c56b914b37c1c9476c30ee
Parents: 9511638
Author: Nate Cole <nc...@hortonworks.com>
Authored: Tue Oct 11 17:08:05 2016 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Wed Oct 12 10:36:03 2016 -0400

----------------------------------------------------------------------
 .../src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/82afd3a0/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml
index 88d9b13..28b34a2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml
@@ -246,8 +246,8 @@
       <skippable>true</skippable>
       <supports-auto-skip-failure>false</supports-auto-skip-failure>
       <service name="HIVE">
-        <component>HIVE_METASTORE</component>
         <component>HIVE_SERVER</component>
+        <component>HIVE_METASTORE</component>
         <component>HIVE_SERVER_INTERACTIVE</component>
         <component>WEBHCAT_SERVER</component>
       </service>


[7/7] ambari git commit: Merge branch 'trunk' into branch-feature-AMBARI-18456

Posted by jo...@apache.org.
Merge branch 'trunk' into branch-feature-AMBARI-18456


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: a851d8f128b6ea5f1b247a931f48f35fdc35db2a
Parents: 18c7412 2131466
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Thu Oct 13 08:31:03 2016 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Thu Oct 13 08:31:03 2016 -0400

----------------------------------------------------------------------
 ambari-server/conf/windows/ambari.properties    |  1 +
 .../server/actionmanager/ActionDBAccessor.java  | 13 +++
 .../actionmanager/ActionDBAccessorImpl.java     | 14 +++
 .../server/actionmanager/ActionScheduler.java   |  4 +-
 .../server/configuration/Configuration.java     | 23 +++++
 .../ambari/server/controller/AmbariServer.java  | 50 +++++++++++
 .../apache/ambari/server/orm/dao/StageDAO.java  | 10 +++
 .../ambari/server/orm/entities/StageEntity.java |  5 +-
 .../0.1.0/package/scripts/metrics_grafana.py    |  6 +-
 .../0.1.0/package/scripts/params_linux.py       |  6 ++
 .../stacks/HDP/2.5/upgrades/upgrade-2.5.xml     |  2 +-
 .../actionmanager/TestActionScheduler.java      | 12 +--
 .../scheduler/ExecutionScheduleManagerTest.java | 90 ++++++++++----------
 .../server/upgrade/UpgradeCatalog221Test.java   | 42 +++++----
 .../AMBARI_METRICS/test_metrics_grafana.py      |  5 +-
 .../2.0.6/configs/default_ams_embedded.json     |  9 +-
 ambari-web/app/controllers/installer.js         |  3 +
 ambari-web/app/views/wizard/step1_view.js       |  8 +-
 18 files changed, 223 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a851d8f1/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
----------------------------------------------------------------------


[5/7] ambari git commit: AMBARI-18566 Installer wizard-> Select Versions page: Selecting Red Hat Satellite option and clicking next button makes wizard stuck (zhewang)

Posted by jo...@apache.org.
AMBARI-18566 Installer wizard-> Select Versions page: Selecting Red Hat Satellite option and clicking next button makes wizard stuck (zhewang)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 2709304c50a934679069c2ac63e1dfe64e7dfc3c
Parents: 911deb7
Author: Zhe (Joe) Wang <zh...@apache.org>
Authored: Wed Oct 12 13:50:01 2016 -0700
Committer: Zhe (Joe) Wang <zh...@apache.org>
Committed: Wed Oct 12 13:51:34 2016 -0700

----------------------------------------------------------------------
 ambari-web/app/controllers/installer.js   | 3 +++
 ambari-web/app/views/wizard/step1_view.js | 8 +++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2709304c/ambari-web/app/controllers/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/installer.js b/ambari-web/app/controllers/installer.js
index f8f70a0..5493b3a 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -831,6 +831,9 @@ App.InstallerController = App.WizardController.extend({
         return os.get('repositories.length');
       }).reduce(Em.sum, 0));
       var verifyBaseUrl = !wizardStep1Controller.get('skipValidationChecked') && !wizardStep1Controller.get('selectedStack.useRedhatSatellite');
+      if (!verifyBaseUrl) {
+        dfd.resolve();
+      }
       selectedStack.get('operatingSystems').forEach(function (os) {
         if (os.get('isSelected') && !os.get('isEmpty')) {
           os.get('repositories').forEach(function (repo) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/2709304c/ambari-web/app/views/wizard/step1_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step1_view.js b/ambari-web/app/views/wizard/step1_view.js
index 2b80ad5..bfabc02 100644
--- a/ambari-web/app/views/wizard/step1_view.js
+++ b/ambari-web/app/views/wizard/step1_view.js
@@ -76,7 +76,13 @@ App.WizardStep1View = Em.View.extend({
    *
    * @type {bool}
    */
-  showWarning: Em.computed.or('invalidFormatUrlExist', 'isNoOsChecked', 'isNoOsFilled'),
+  warningExist: Em.computed.or('invalidFormatUrlExist', 'isNoOsChecked', 'isNoOsFilled'),
+
+  skipVerifyBaseUrl: Em.computed.or('controller.selectedStack.skipValidationChecked', 'controller.selectedStack.useRedhatSatellite'),
+
+  verifyBaseUrl: Em.computed.not('skipVerifyBaseUrl'),
+
+  showWarning: Em.computed.and('warningExist', 'verifyBaseUrl'),
 
   /**
    * Onclick handler for recheck repos urls. Used in Advanced Repository Options.


[6/7] ambari git commit: AMBARI-18576. When multiple requests are running, aborting any will incorrectly abort all requests instead the desired one (alejandro)

Posted by jo...@apache.org.
AMBARI-18576. When multiple requests are running, aborting any will incorrectly abort all requests instead the desired one (alejandro)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 2131466610b41af761fd1a105312c6553685c5ac
Parents: 2709304
Author: Alejandro Fernandez <af...@hortonworks.com>
Authored: Wed Oct 12 15:59:29 2016 -0700
Committer: Alejandro Fernandez <af...@hortonworks.com>
Committed: Wed Oct 12 15:59:32 2016 -0700

----------------------------------------------------------------------
 .../ambari/server/actionmanager/ActionDBAccessor.java | 13 +++++++++++++
 .../server/actionmanager/ActionDBAccessorImpl.java    | 14 ++++++++++++++
 .../ambari/server/actionmanager/ActionScheduler.java  |  4 ++--
 .../org/apache/ambari/server/orm/dao/StageDAO.java    | 10 ++++++++++
 .../ambari/server/orm/entities/StageEntity.java       |  5 ++++-
 .../server/actionmanager/TestActionScheduler.java     | 12 ++++++------
 6 files changed, 49 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/21314666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java
index 0e78cbc..8aef70d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java
@@ -86,6 +86,19 @@ public interface ActionDBAccessor {
   public List<Stage> getStagesInProgress();
 
   /**
+   * Returns all the pending stages in a request, including queued and not-queued. A stage is
+   * considered in progress if it is in progress for any host.
+   * <p/>
+   * The results will be sorted by stage ID making this call
+   * expensive in some scenarios. Use {@link #getCommandsInProgressCount()} in
+   * order to determine if there are stages that are in progress before getting
+   * the stages from this method.
+   *
+   * @see HostRoleStatus#IN_PROGRESS_STATUSES
+   */
+  public List<Stage> getStagesInProgressForRequest(Long requestId);
+
+  /**
    * Gets the number of commands in progress.
    *
    * @return the number of commands in progress.

http://git-wip-us.apache.org/repos/asf/ambari/blob/21314666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
index c31ca7e..2c87583 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
@@ -270,10 +270,24 @@ public class ActionDBAccessorImpl implements ActionDBAccessor {
    */
   @Override
   @Experimental(feature = ExperimentalFeature.PARALLEL_PROCESSING)
+  public List<Stage> getStagesInProgressForRequest(Long requestId) {
+    List<StageEntity> stageEntities = stageDAO.findByRequestIdAndCommandStatuses(requestId, HostRoleStatus.IN_PROGRESS_STATUSES);
+    return getStagesForEntities(stageEntities);
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  @Experimental(feature = ExperimentalFeature.PARALLEL_PROCESSING)
   public List<Stage> getStagesInProgress() {
     List<StageEntity> stageEntities = stageDAO.findByCommandStatuses(
       HostRoleStatus.IN_PROGRESS_STATUSES);
+    return getStagesForEntities(stageEntities);
+  }
 
+  @Experimental(feature = ExperimentalFeature.PARALLEL_PROCESSING)
+  private List<Stage> getStagesForEntities(List<StageEntity> stageEntities) {
     // experimentally enable parallel stage processing
     @Experimental(feature = ExperimentalFeature.PARALLEL_PROCESSING)
     boolean useConcurrentStageProcessing = configuration.isExperimentalConcurrentStageProcessingEnabled();

http://git-wip-us.apache.org/repos/asf/ambari/blob/21314666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
index e380ae4..8cbfb1e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
@@ -1139,10 +1139,10 @@ class ActionScheduler implements Runnable {
           cancelHostRoleCommands(tasksToDequeue, reason);
         }
 
-        // abort any stages in progress; don't execute this for all stages since
+        // abort any stages in progress that belong to this request; don't execute this for all stages since
         // that could lead to OOM errors on large requests, like those for
         // upgrades
-        List<Stage> stagesInProgress = db.getStagesInProgress();
+        List<Stage> stagesInProgress = db.getStagesInProgressForRequest(requestId);
         for (Stage stageInProgress : stagesInProgress) {
           abortOperationsForStage(stageInProgress);
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/21314666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java
index 8ef4a1b..d2f899f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java
@@ -164,6 +164,16 @@ public class StageDAO {
   }
 
   @RequiresSession
+  public List<StageEntity> findByRequestIdAndCommandStatuses(Long requestId, Collection<HostRoleStatus> statuses) {
+    TypedQuery<StageEntity> query = entityManagerProvider.get().createNamedQuery(
+        "StageEntity.findByRequestIdAndCommandStatuses", StageEntity.class);
+
+    query.setParameter("requestId", requestId);
+    query.setParameter("statuses", statuses);
+    return daoUtils.selectList(query);
+  }
+
+  @RequiresSession
   public List<StageEntity> findByCommandStatuses(
       Collection<HostRoleStatus> statuses) {
     TypedQuery<StageEntity> query = entityManagerProvider.get().createNamedQuery(

http://git-wip-us.apache.org/repos/asf/ambari/blob/21314666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
index 7659a23..eaea913 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
@@ -42,7 +42,10 @@ import javax.persistence.Table;
 @NamedQueries({
     @NamedQuery(
         name = "StageEntity.findByCommandStatuses",
-        query = "SELECT stage from StageEntity stage WHERE EXISTS (SELECT roleCommand.stageId from HostRoleCommandEntity roleCommand WHERE roleCommand.status IN :statuses AND roleCommand.stageId = stage.stageId AND roleCommand.requestId = stage.requestId ) ORDER by stage.requestId, stage.stageId"),
+        query = "SELECT stage from StageEntity stage WHERE stage.stageId IN (SELECT roleCommand.stageId from HostRoleCommandEntity roleCommand WHERE roleCommand.status IN :statuses AND roleCommand.stageId = stage.stageId AND roleCommand.requestId = stage.requestId ) ORDER BY stage.requestId, stage.stageId"),
+    @NamedQuery(
+        name = "StageEntity.findByRequestIdAndCommandStatuses",
+        query = "SELECT stage from StageEntity stage WHERE stage.stageId IN (SELECT roleCommand.stageId from HostRoleCommandEntity roleCommand WHERE roleCommand.requestId = :requestId AND roleCommand.status IN :statuses AND roleCommand.stageId = stage.stageId AND roleCommand.requestId = stage.requestId ) ORDER BY stage.stageId"),
     @NamedQuery(
         name = "StageEntity.findIdsByRequestId",
         query = "SELECT stage.stageId FROM StageEntity stage WHERE stage.requestId = :requestId ORDER BY stage.stageId ASC") })

http://git-wip-us.apache.org/repos/asf/ambari/blob/21314666/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
index ccb95a6..f86c02e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
@@ -2204,10 +2204,9 @@ public class TestActionScheduler {
     hosts.put(hostname, sch);
     when(scomp.getServiceComponentHosts()).thenReturn(hosts);
 
-    long requestId = 1;
-
-    // create 3 stages, each with a single task - the first stage will be completed and should not
+    // Create a single request with 3 stages, each with a single task - the first stage will be completed and should not
     // be included when cancelling the unfinished tasks of the request
+    long requestId = 1;
     final List<Stage> allStages = new ArrayList<Stage>();
     final List<Stage> stagesInProgress = new ArrayList<Stage>();
     final List<HostRoleCommand> tasksInProgress = new ArrayList<>();
@@ -2219,7 +2218,7 @@ public class TestActionScheduler {
 
     Stage stageWithTask = getStageWithSingleTask(
         hostname, "cluster1", Role.SECONDARY_NAMENODE, RoleCommand.START,
-        Service.Type.HDFS, secondaryNamenodeCmdTaskId, 1, (int)requestId);
+        Service.Type.HDFS, secondaryNamenodeCmdTaskId, 1, (int) requestId);
 
     // complete the first stage
     stageWithTask.getOrderedHostRoleCommands().get(0).setStatus(HostRoleStatus.COMPLETED);
@@ -2227,7 +2226,7 @@ public class TestActionScheduler {
 
     stageWithTask = getStageWithSingleTask(
         hostname, "cluster1", Role.NAMENODE, RoleCommand.START,
-        Service.Type.HDFS, namenodeCmdTaskId, 2, (int)requestId);
+        Service.Type.HDFS, namenodeCmdTaskId, 2, (int) requestId);
 
     tasksInProgress.addAll(stageWithTask.getOrderedHostRoleCommands());
     stagesInProgress.add(stageWithTask);
@@ -2235,7 +2234,7 @@ public class TestActionScheduler {
 
     stageWithTask = getStageWithSingleTask(
         hostname, "cluster1", Role.DATANODE, RoleCommand.START,
-        Service.Type.HDFS, datanodeCmdTaskId, 3, (int)requestId);
+        Service.Type.HDFS, datanodeCmdTaskId, 3, (int) requestId);
 
     tasksInProgress.addAll(stageWithTask.getOrderedHostRoleCommands());
     stagesInProgress.add(stageWithTask);
@@ -2271,6 +2270,7 @@ public class TestActionScheduler {
 
     when(db.getCommandsInProgressCount()).thenReturn(stagesInProgress.size());
     when(db.getStagesInProgress()).thenReturn(stagesInProgress);
+    when(db.getStagesInProgressForRequest(requestId)).thenReturn(stagesInProgress);
     when(db.getAllStages(anyLong())).thenReturn(allStages);
 
     List<HostRoleCommand> requestTasks = new ArrayList<HostRoleCommand>();


[4/7] ambari git commit: AMBARI-18575. Fix for improving time taken by 'ExecutionScheduleManagerTest' and 'UpgradeCatalog221Test' java tests.

Posted by jo...@apache.org.
AMBARI-18575. Fix for improving time taken by 'ExecutionScheduleManagerTest' and 'UpgradeCatalog221Test' java tests.


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 911deb744485aa0366aad168c98566cf6381d4cc
Parents: 60dc240
Author: Swapan Shridhar <ss...@hortonworks.com>
Authored: Tue Oct 11 16:09:00 2016 -0700
Committer: Swapan Shridhar <ss...@hortonworks.com>
Committed: Wed Oct 12 13:08:48 2016 -0700

----------------------------------------------------------------------
 .../scheduler/ExecutionScheduleManagerTest.java | 90 ++++++++++----------
 .../server/upgrade/UpgradeCatalog221Test.java   | 42 +++++----
 2 files changed, 69 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/911deb74/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java
index f2fe3b8..0179486 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java
@@ -17,26 +17,16 @@
  */
 package org.apache.ambari.server.scheduler;
 
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.capture;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.createMockBuilder;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.google.gson.Gson;
+import com.google.inject.Binder;
+import com.google.inject.Guice;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+import com.google.inject.persist.PersistService;
+import com.google.inject.persist.Transactional;
+import com.google.inject.util.Modules;
+import junit.framework.Assert;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.ActionDBAccessor;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
@@ -58,8 +48,8 @@ import org.apache.ambari.server.state.scheduler.RequestExecutionFactory;
 import org.apache.ambari.server.state.scheduler.Schedule;
 import org.easymock.Capture;
 import org.easymock.EasyMock;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.quartz.CronTrigger;
 import org.quartz.JobDataMap;
@@ -76,34 +66,42 @@ import org.quartz.impl.matchers.GroupMatcher;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.gson.Gson;
-import com.google.inject.Binder;
-import com.google.inject.Guice;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-import com.google.inject.persist.PersistService;
-import com.google.inject.persist.Transactional;
-import com.google.inject.util.Modules;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
-import junit.framework.Assert;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.capture;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.createMockBuilder;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
 
 public class ExecutionScheduleManagerTest {
-  private Clusters clusters;
-  private Cluster cluster;
-  private String clusterName;
-  private Injector injector;
-  private AmbariMetaInfo metaInfo;
-  private ExecutionScheduleManager executionScheduleManager;
-  private RequestExecutionFactory requestExecutionFactory;
-  private ExecutionScheduler executionScheduler;
-  private Scheduler scheduler;
+  private static Clusters clusters;
+  private static Cluster cluster;
+  private static String clusterName;
+  private static Injector injector;
+  private static AmbariMetaInfo metaInfo;
+  private static ExecutionScheduleManager executionScheduleManager;
+  private static RequestExecutionFactory requestExecutionFactory;
+  private static ExecutionScheduler executionScheduler;
+  private static Scheduler scheduler;
 
   private static final Logger LOG =
     LoggerFactory.getLogger(ExecutionScheduleManagerTest.class);
 
-  @Before
-  public void setup() throws Exception {
+  @BeforeClass
+  public static void setup() throws Exception {
     InMemoryDefaultTestModule defaultTestModule = new InMemoryDefaultTestModule();
     injector  = Guice.createInjector(Modules.override(defaultTestModule)
       .with(new ExecutionSchedulerTestModule()));
@@ -128,8 +126,8 @@ public class ExecutionScheduleManagerTest {
     executionScheduleManager.start();
   }
 
-  @After
-  public void teardown() throws Exception {
+  @AfterClass
+  public static void teardown() throws Exception {
     executionScheduleManager.stop();
     injector.getInstance(PersistService.class).stop();
   }
@@ -154,7 +152,7 @@ public class ExecutionScheduleManagerTest {
     }
   }
 
-  public class ExecutionSchedulerTestModule implements Module {
+  public static class ExecutionSchedulerTestModule implements Module {
     @Override
     public void configure(Binder binder) {
       binder.bind(ExecutionScheduler.class).to(TestExecutionScheduler.class);

http://git-wip-us.apache.org/repos/asf/ambari/blob/911deb74/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
index e754a41..4663c6c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
@@ -33,10 +33,10 @@ import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.ActionManager;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.controller.AmbariManagementController;
-import org.apache.ambari.server.orm.DBAccessor;
 import org.apache.ambari.server.controller.AmbariManagementControllerImpl;
 import org.apache.ambari.server.controller.KerberosHelper;
 import org.apache.ambari.server.controller.MaintenanceStateHelper;
+import org.apache.ambari.server.orm.DBAccessor;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
 import org.apache.ambari.server.orm.dao.AlertDefinitionDAO;
@@ -46,39 +46,47 @@ import org.apache.ambari.server.orm.entities.StackEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
-import org.apache.ambari.server.state.RepositoryInfo;
 import org.apache.ambari.server.state.StackId;
-import org.apache.ambari.server.state.StackInfo;
 import org.apache.ambari.server.state.stack.OsFamily;
 import org.easymock.Capture;
 import org.easymock.EasyMock;
 import org.easymock.EasyMockSupport;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 import javax.persistence.EntityManager;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.anyString;
+import static org.easymock.EasyMock.capture;
+import static org.easymock.EasyMock.createMockBuilder;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.createStrictMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.reset;
+import static org.easymock.EasyMock.verify;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 public class UpgradeCatalog221Test {
-  private Injector injector;
-  private Provider<EntityManager> entityManagerProvider = createStrictMock(Provider.class);
-  private EntityManager entityManager = createNiceMock(EntityManager.class);
-  private UpgradeCatalogHelper upgradeCatalogHelper;
-  private StackEntity desiredStackEntity;
-
-  @Before
-  public void init() {
+  private static Injector injector;
+  private static Provider<EntityManager> entityManagerProvider = createStrictMock(Provider.class);
+  private static EntityManager entityManager = createNiceMock(EntityManager.class);
+  private static UpgradeCatalogHelper upgradeCatalogHelper;
+  private static StackEntity desiredStackEntity;
+
+  @BeforeClass
+  public static void init() {
     reset(entityManagerProvider);
     expect(entityManagerProvider.get()).andReturn(entityManager).anyTimes();
     replay(entityManagerProvider);
@@ -93,8 +101,8 @@ public class UpgradeCatalog221Test {
     desiredStackEntity = stackDAO.find("HDP", "2.2.0");
   }
 
-  @After
-  public void tearDown() {
+  @AfterClass
+  public static void tearDown() {
     injector.getInstance(PersistService.class).stop();
   }
 


[3/7] ambari git commit: AMBARI-18543. Option to enable request/access logs in Ambari. (Amarnath reddy pappu via swagle)

Posted by jo...@apache.org.
AMBARI-18543. Option to enable request/access logs in Ambari. (Amarnath reddy pappu via swagle)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 60dc240216bf54f35dfb5d3fea823ccceee2c9a4
Parents: 5d007e2
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Wed Oct 12 11:04:54 2016 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Wed Oct 12 11:04:54 2016 -0700

----------------------------------------------------------------------
 ambari-server/conf/windows/ambari.properties    |  1 +
 .../server/configuration/Configuration.java     | 23 +++++++++
 .../ambari/server/controller/AmbariServer.java  | 50 ++++++++++++++++++++
 3 files changed, 74 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/60dc2402/ambari-server/conf/windows/ambari.properties
----------------------------------------------------------------------
diff --git a/ambari-server/conf/windows/ambari.properties b/ambari-server/conf/windows/ambari.properties
index c1c0a99..e47319e 100644
--- a/ambari-server/conf/windows/ambari.properties
+++ b/ambari-server/conf/windows/ambari.properties
@@ -51,6 +51,7 @@ server.execution.scheduler.maxThreads=5
 server.execution.scheduler.maxDbConnections=5
 server.execution.scheduler.misfire.toleration.minutes=480
 
+
 # Kerberos settings
 kerberos.keytab.cache.dir = data\\cache
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/60dc2402/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index e976f45..378db18 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -1680,6 +1680,27 @@ public class Configuration {
       "server.tmp.dir", AmbariPath.getPath("/var/lib/ambari-server/tmp"));
 
   /**
+   * Request logs path .
+   */
+  @Markdown(description = "The location on the Ambari Server where request logs can be created.")
+  public static final ConfigurationProperty<String> REQUEST_LOGPATH = new ConfigurationProperty<>(
+      "server.requestlogs.path", null);
+
+  /**
+   * The pattern of request  logs .
+   */
+  @Markdown(description = "The pattern of request log file name")
+  public static final ConfigurationProperty<String> REQUEST_LOGNAMEPATTERN = new ConfigurationProperty<>(
+          "server.requestlogs.namepattern", "ambari-access-yyyy_mm_dd.log");
+
+  /**
+   * The number of days request logs can be retained.
+   */
+  @Markdown(description = "The number of days that request log would be retained.")
+  public static final ConfigurationProperty<Integer> REQUEST_LOG_RETAINDAYS = new ConfigurationProperty<>(
+          "server.requestlogs.retaindays", 15);
+
+  /**
    * The time, in {@link TimeUnit#MILLISECONDS}, until an external script is killed.
    */
   @Markdown(description = "The time, in milliseconds, until an external script is killed.")
@@ -2566,6 +2587,8 @@ public class Configuration {
     configsMap.put(JAVA_HOME.getKey(), getProperty(JAVA_HOME));
     configsMap.put(PARALLEL_STAGE_EXECUTION.getKey(), getProperty(PARALLEL_STAGE_EXECUTION));
     configsMap.put(SERVER_TMP_DIR.getKey(), getProperty(SERVER_TMP_DIR));
+    configsMap.put(REQUEST_LOGPATH.getKey(), getProperty(REQUEST_LOGPATH));
+    configsMap.put(REQUEST_LOG_RETAINDAYS.getKey(), getProperty(REQUEST_LOG_RETAINDAYS));
     configsMap.put(EXTERNAL_SCRIPT_TIMEOUT.getKey(), getProperty(EXTERNAL_SCRIPT_TIMEOUT));
     configsMap.put(SHARED_RESOURCES_DIR.getKey(), getProperty(SHARED_RESOURCES_DIR));
     configsMap.put(KDC_PORT.getKey(), getProperty(KDC_PORT));

http://git-wip-us.apache.org/repos/asf/ambari/blob/60dc2402/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index 5e498f0..c05840e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -124,12 +124,17 @@ import org.apache.ambari.server.view.AmbariViewsMDCLoggingFilter;
 import org.apache.ambari.server.view.ViewDirectoryWatcher;
 import org.apache.ambari.server.view.ViewRegistry;
 import org.apache.ambari.server.view.ViewThrottleFilter;
+import org.apache.commons.lang.StringUtils;
 import org.apache.velocity.app.Velocity;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.SessionIdManager;
 import org.eclipse.jetty.server.SessionManager;
 import org.eclipse.jetty.server.nio.SelectChannelConnector;
 import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
+import org.eclipse.jetty.server.NCSARequestLog;
+import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.handler.RequestLogHandler;
 import org.eclipse.jetty.servlet.DefaultServlet;
 import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.servlet.ServletContextHandler;
@@ -497,6 +502,9 @@ public class AmbariServer {
       viewRegistry.readViewArchives();
       viewDirectoryWatcher.start();
 
+      //Check and load requestlog handler.
+      loadRequestlogHandler(handlerList, serverForAgent, configsMap);
+
       handlerList.addHandler(root);
       server.setHandler(handlerList);
 
@@ -933,6 +941,48 @@ public class AmbariServer {
     LOG.info(Joiner.on("\n" + linePrefix).join(rawMessages));
   }
 
+  /**
+   * For loading requestlog handlers
+   */
+  private static void loadRequestlogHandler(AmbariHandlerList handlerList, Server serverForAgent , Map<String, String> configsMap) {
+
+    //Example:  /var/log/ambari-server/ambari-server-access-yyyy_mm_dd.log
+    String requestlogpath =  configsMap.get(Configuration.REQUEST_LOGPATH.getKey());
+
+    //Request logs can be disable by removing the property from ambari.properties file
+    if(!StringUtils.isBlank(requestlogpath)) {
+      String logfullpath = requestlogpath + "//" + Configuration.REQUEST_LOGNAMEPATTERN.getDefaultValue();
+      LOG.info("********* Initializing request access log: " + logfullpath);
+      RequestLogHandler requestLogHandler = new RequestLogHandler();
+
+      NCSARequestLog requestLog = new NCSARequestLog(requestlogpath);
+
+      String retaindays = configsMap.get(Configuration.REQUEST_LOG_RETAINDAYS.getKey());
+      int retaindaysInt = Configuration.REQUEST_LOG_RETAINDAYS.getDefaultValue();
+      if(retaindays != null && !StringUtils.isBlank(retaindays)) {
+        retaindaysInt = Integer.parseInt(retaindays.trim());
+      }
+
+      requestLog.setRetainDays(retaindaysInt);
+      requestLog.setAppend(true);
+      requestLog.setLogLatency(true);
+      requestLog.setExtended(true);
+      requestLogHandler.setRequestLog(requestLog);
+      //Add requestloghandler to existing handlerlist.
+      handlerList.addHandler(requestLogHandler);
+
+      //For agent communication.
+      HandlerCollection handlers = new HandlerCollection();
+      Handler[] handler = serverForAgent.getHandlers();
+      if(handler != null ) {
+        handlers.setHandlers((Handler[])handler);
+        handlers.addHandler(requestLogHandler);
+        serverForAgent.setHandler(handlers);
+      }
+
+    }
+  }
+
   public static void main(String[] args) throws Exception {
     logStartup();
     Injector injector = Guice.createInjector(new ControllerModule(), new AuditLoggerModule());


[2/7] ambari git commit: AMBARI-18579. Grafana fails to start after deployment (aonishuk)

Posted by jo...@apache.org.
AMBARI-18579. Grafana fails to start after deployment (aonishuk)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 5d007e248e24e02d4d8c5c818a1125830370936c
Parents: 82afd3a
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Wed Oct 12 20:12:27 2016 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Wed Oct 12 20:13:13 2016 +0300

----------------------------------------------------------------------
 .../AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py | 6 ++++--
 .../AMBARI_METRICS/0.1.0/package/scripts/params_linux.py    | 6 ++++++
 .../stacks/2.0.6/AMBARI_METRICS/test_metrics_grafana.py     | 5 +++--
 .../python/stacks/2.0.6/configs/default_ams_embedded.json   | 9 +++++++--
 4 files changed, 20 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5d007e24/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
index 542663f..606f119 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
@@ -43,7 +43,8 @@ class AmsGrafana(Script):
 
     start_cmd = format("{ams_grafana_script} start")
     Execute(start_cmd,
-            user=params.ams_user
+            user=params.ams_user,
+            not_if = params.grafana_process_exists_cmd,
             )
     # Create datasource
     create_ams_datasource()
@@ -55,7 +56,8 @@ class AmsGrafana(Script):
     env.set_params(params)
     self.configure(env, action = 'stop')
     Execute((format("{ams_grafana_script}"), 'stop'),
-            sudo=True
+            sudo=True,
+            only_if = params.grafana_process_exists_cmd,
             )
 
   def status(self, env):

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d007e24/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params_linux.py
index 58c7c1d..da399f7 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params_linux.py
@@ -22,6 +22,7 @@ from resource_management.libraries.script.script import Script
 from resource_management.libraries.functions import conf_select
 from resource_management.libraries.functions.default import default
 from resource_management.libraries.functions.format import format
+from resource_management.core.shell import as_user
 from ambari_commons import OSCheck
 from ambari_commons.constants import AMBARI_SUDO_BINARY
 from resource_management.libraries.functions.expect import expect
@@ -34,6 +35,8 @@ ams_user = config['configurations']['ams-env']['ambari_metrics_user']
 #RPM versioning support
 rpm_version = default("/configurations/hadoop-env/rpm_version", None)
 
+ams_grafana_pid_dir = config['configurations']['ams-grafana-env']['metrics_grafana_pid_dir']
+
 #hadoop params
 if rpm_version is not None:
   #RPM versioning support
@@ -56,3 +59,6 @@ dfs_type = default("/commandParams/dfs_type", "")
 
 hbase_regionserver_shutdown_timeout = expect('/configurations/ams-hbase-env/hbase_regionserver_shutdown_timeout', int,
                                              30)
+
+grafana_pid_file = format("{ams_grafana_pid_dir}/grafana-server.pid")
+grafana_process_exists_cmd = as_user(format("test -f {grafana_pid_file} && ps -p `cat {grafana_pid_file}`"), ams_user)

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d007e24/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_grafana.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_grafana.py b/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_grafana.py
index 2e24d82..9ac14c4 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_grafana.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_grafana.py
@@ -70,8 +70,9 @@ class TestMetricsGrafana(RMFTestCase):
     self.assertResourceCalled('Execute', 'ambari-sudo.sh rm -rf /some_tmp_dir',
                               )
     self.assertResourceCalled('Execute', '/usr/sbin/ambari-metrics-grafana start',
-                              user = 'ams'
-                              )
+        not_if = "ambari-sudo.sh su ams -l -s /bin/bash -c '[RMF_EXPORT_PLACEHOLDER]test -f /var/run/ambari-metrics-grafana/grafana-server.pid && ps -p `cat /var/run/ambari-metrics-grafana/grafana-server.pid`'",
+        user = 'ams',
+    )
     create_ams_datasource_mock.assertCalled()
     create_ams_dashboards_mock.assertCalled()
     self.assertNoMoreResources()

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d007e24/ambari-server/src/test/python/stacks/2.0.6/configs/default_ams_embedded.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/configs/default_ams_embedded.json b/ambari-server/src/test/python/stacks/2.0.6/configs/default_ams_embedded.json
index 13dce2b..71423c8 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/configs/default_ams_embedded.json
+++ b/ambari-server/src/test/python/stacks/2.0.6/configs/default_ams_embedded.json
@@ -42,8 +42,13 @@
     "taskId": 152, 
     "public_hostname": "c6401.ambari.apache.org", 
     "configurations": {
-        "ams-grafana-env" : {
-            "metrics_grafana_pid_dir" : "/var/run/ambari-metrics-monitor"
+        "ams-grafana-env": {
+            "metrics_grafana_username": "admin", 
+            "metrics_grafana_pid_dir": "/var/run/ambari-metrics-grafana", 
+            "metrics_grafana_data_dir": "/var/lib/ambari-metrics-grafana", 
+            "content": "\n# Set environment variables here.\n\n# AMS UI Server Home Dir\nexport AMS_GRAFANA_HOME_DIR={{ams_grafana_home_dir}}\n\n# AMS UI Server Data Dir\nexport AMS_GRAFANA_DATA_DIR={{ams_grafana_data_dir}}\n\n# AMS UI Server Log Dir\nexport AMS_GRAFANA_LOG_DIR={{ams_grafana_log_dir}}\n\n# AMS UI Server PID Dir\nexport AMS_GRAFANA_PID_DIR={{ams_grafana_pid_dir}}", 
+            "metrics_grafana_password": "admin", 
+            "metrics_grafana_log_dir": "/var/log/ambari-metrics-grafana"
         },
         "mapred-site": {
             "mapreduce.jobhistory.address": "c6402.ambari.apache.org:10020",