Repository: ambari
Updated Branches:
  refs/heads/trunk 18183be42 -> 3efb5fc48


AMBARI-6412. Usability: integrate THP check to Host Checks.(xiwang)


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

Branch: refs/heads/trunk
Commit: 3efb5fc4897936c855163a9579803f2fbfc97102
Parents: 18183be
Author: Xi Wang <[email protected]>
Authored: Mon Jul 7 17:49:25 2014 -0700
Committer: Xi Wang <[email protected]>
Committed: Tue Jul 8 12:05:03 2014 -0700

----------------------------------------------------------------------
 .../app/controllers/wizard/step3_controller.js  | 36 +++++++++++++++++++-
 ambari-web/app/messages.js                      |  7 ++++
 .../wizard/step3/hostWarningPopupBody_view.js   | 29 ++++++++++++++--
 ambari-web/app/views/wizard/step3_view.js       |  5 +--
 4 files changed, 71 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3efb5fc4/ambari-web/app/controllers/wizard/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step3_controller.js 
b/ambari-web/app/controllers/wizard/step3_controller.js
index e03c58a..e88ef41 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -35,6 +35,7 @@ App.WizardStep3Controller = Em.Controller.extend({
   hostCheckWarnings: [],
   repoCategoryWarnings: [],
   diskCategoryWarnings: [],
+  thpCategoryWarnings: [],
   jdkCategoryWarnings: null,
   jdkRequestIndex: null,
 
@@ -955,7 +956,8 @@ App.WizardStep3Controller = Em.Controller.extend({
     var hosts = this.get('bootHosts'),
       self = this,
       repoWarnings = [], hostsRepoNames = [], hostsContext = [],
-      diskWarnings = [], hostsDiskContext = [], hostsDiskNames = [];
+      diskWarnings = [], hostsDiskContext = [], hostsDiskNames = [],
+      thpWarnings = [], thpContext = [], thpHostsNames = [];
 
     // parse host checks warning
     this.parseWarnings(jsonData);
@@ -979,6 +981,12 @@ App.WizardStep3Controller = Em.Controller.extend({
             hostsDiskContext.push(diskContext);
             hostsDiskNames.push(host_name);
           }
+          // "Transparent Huge Pages" check
+          context = self.checkTHP(host_name, 
host.Hosts.last_agent_env.transparentHugePage);
+          if (context) {
+            thpContext.push(context);
+            thpHostsNames.push(host_name);
+          }
         }
       }
     });
@@ -1000,9 +1008,19 @@ App.WizardStep3Controller = Em.Controller.extend({
         onSingleHost: false
       });
     }
+    if (thpContext.length > 0) { // THP warning existed
+      thpWarnings.push({
+        name: Em.I18n.t('installer.step3.hostWarningsPopup.thp.name'),
+        hosts: thpContext,
+        hostsNames: thpHostsNames,
+        category: 'thp',
+        onSingleHost: false
+      });
+    }
 
     this.set('repoCategoryWarnings', repoWarnings);
     this.set('diskCategoryWarnings', diskWarnings);
+    this.set('thpCategoryWarnings', thpWarnings);
     this.stopRegistration();
   },
 
@@ -1066,6 +1084,22 @@ App.WizardStep3Controller = Em.Controller.extend({
   },
 
   /**
+   * Check if the 'Transparent Huge Pages' enabled.
+   * @param {string} transparentHugePage
+   * @param {string} hostName
+   * @return {string} error-message or empty string
+   * @method checkTHP
+   */
+  checkTHP: function (hostName, transparentHugePage) {
+    if (transparentHugePage == "always") {
+      console.log('WARNING: Transparent Huge Page enabled on host: '+ 
hostName);
+      return 
Em.I18n.t('installer.step3.hostWarningsPopup.thp.context').format(hostName);
+    } else {
+      return '';
+    }
+  },
+
+  /**
    * Check if the customized os group contains the registered host os type. If 
not the repo on that host is invalid.
    * @param {string} osType
    * @param {string} hostName

http://git-wip-us.apache.org/repos/asf/ambari/blob/3efb5fc4/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 94a8c62..5cfe957 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -458,6 +458,7 @@ Em.I18n.translations = {
   'installer.step3.hostWarningsPopup.report.disk': 
'<br><br>######################################<br># Disk <br>#<br># A newline 
delimited list of disk 
issues.<br>######################################<br>DISK ISSUES<br>',
   'installer.step3.hostWarningsPopup.report.repositories': 
'<br><br>######################################<br># Repositories <br>#<br># A 
newline delimited list of repositories 
issues.<br>######################################<br>REPOSITORIES ISSUES<br>',
   'installer.step3.hostWarningsPopup.report.hostNameResolution': 
'<br><br>######################################<br># Hostname 
Resolution<br>#<br># A newline delimited list of hostname resolution 
issues.<br>######################################<br>HOSTNAME RESOLUTION 
ISSUES<br>',
+  'installer.step3.hostWarningsPopup.report.thp': 
'<br><br>######################################<br># Transparent Huge 
Pages(THP) <br>#<br># A space delimited list of hostnames on which Transparent 
Huge Pages are enabled.<br>######################################<br>THP ISSUES 
HOSTS<br>',
   'installer.step3.hostWarningsPopup.report.firewall': 
'<br><br>######################################<br># Firewall<br>#<br># A 
newline delimited list of firewall 
issues.<br>######################################<br>FIREWALL<br>',
   'installer.step3.hostWarningsPopup.report.fileFolders': 
'<br><br>######################################<br># Files and 
Folders<br>#<br># A space delimited list of files and folders which should not 
exist.<br># Provided so that administrators can easily copy paths into scripts, 
email etc.<br># Example: rm -r /etc/hadoop 
/etc/hbase<br>######################################<br>FILES AND FOLDERS<br>',
   'installer.step3.hostWarningsPopup.report.reverseLookup': 
'<br><br>######################################<br># Reverse Lookup<br># <br># 
The hostname was not found in the reverse DNS lookup. This may result in 
incorrect behavior. <br># Please check the DNS setup and fix the 
issue.<br>######################################<br>REVERSE LOOKUP<br>',
@@ -485,6 +486,10 @@ Em.I18n.translations = {
   'installer.step3.hostWarningsPopup.disk.context1':'Not enough disk space on 
host ({0}).',
   'installer.step3.hostWarningsPopup.disk.context2':'A minimum of {0} is 
required for "{1}" mount.',
   'installer.step3.hostWarningsPopup.disk.message':'The following registered 
hosts have issues related to disk space',
+  'installer.step3.hostWarningsPopup.thp':'Transparent Huge Pages Issues',
+  'installer.step3.hostWarningsPopup.thp.name':'Transparent Huge Pages',
+  'installer.step3.hostWarningsPopup.thp.context':'{0}',
+  'installer.step3.hostWarningsPopup.thp.message':'The following hosts have 
Transparent Huge Pages (THP) enabled. THP should be disabled to avoid potential 
Hadoop performance issues.',
   'installer.step3.hostWarningsPopup.firewall':'Firewall Issues',
   'installer.step3.hostWarningsPopup.firewall.message':'Firewall is running on 
the following hosts. Please configure the firewall to allow communications on 
the ports documented in the <i>Configuring Ports</i> section of  the <a 
target=\"_blank\" 
href=\"http://ambari.apache.org/current/installing-hadoop-using-ambari/content/\";>Ambari
 documentation</a>',
   'installer.step3.hostWarningsPopup.firewall.name':'<i>iptables</i> Running',
@@ -519,6 +524,7 @@ Em.I18n.translations = {
   'installer.step3.hostWarningsPopup.empty.repositories':'repositories OS type 
mis-match with registered hosts',
   'installer.step3.hostWarningsPopup.empty.disk':'disk space issues',
   'installer.step3.hostWarningsPopup.empty.jdk':'JDK issues',
+  'installer.step3.hostWarningsPopup.empty.thp':'THP issues',
   'installer.step3.hostWarningsPopup.reverseLookup.name': 'Reverse Lookup 
validation failed on',
   'installer.step3.hostWarningsPopup.reverseLookup': 'Reverse Lookup Issues',
   'installer.step3.hostWarningsPopup.reverseLookup.message': 'The hostname was 
not found in the reverse DNS lookup. This may result in incorrect behavior. 
Please check the DNS setup and fix the issue.',
@@ -535,6 +541,7 @@ Em.I18n.translations = {
   'installer.step3.hostWarningsPopup.action.running':'Running on',
   'installer.step3.hostWarningsPopup.action.invalid':'Invalid on',
   'installer.step3.hostWarningsPopup.action.failed':'Failed on',
+  'installer.step3.hostWarningsPopup.action.enabled':'Enabled on',
   'installer.step3.hostWarningsPopup.host':'host',
   'installer.step3.hostWarningsPopup.hosts':'hosts',
   'installer.step3.hostWarningsPopup.moreHosts':'{0} more hosts...<br>Click on 
link to view all hosts.',

http://git-wip-us.apache.org/repos/asf/ambari/blob/3efb5fc4/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js 
b/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js
index 2843dc5..fe03189 100644
--- a/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js
+++ b/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js
@@ -146,9 +146,20 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
     var repoCategoryWarnings = this.get('bodyController.repoCategoryWarnings');
     var diskCategoryWarnings = this.get('bodyController.diskCategoryWarnings');
     var jdkCategoryWarnings = this.get('bodyController.jdkCategoryWarnings') 
|| [];
+    var thpCategoryWarnings = this.get('bodyController.thpCategoryWarnings');
     var categoryWarnings = this.get('categoryWarnings');
     return [
       Em.Object.create({
+        warnings: thpCategoryWarnings,
+        title: Em.I18n.t('installer.step3.hostWarningsPopup.thp'),
+        message: Em.I18n.t('installer.step3.hostWarningsPopup.thp.message'),
+        type: Em.I18n.t('common.issues'),
+        emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.thp'),
+        action: Em.I18n.t('installer.step3.hostWarningsPopup.action.enabled'),
+        category: 'thp',
+        isCollapsed: true
+      }),
+      Em.Object.create({
         warnings: jdkCategoryWarnings,
         title: Em.I18n.t('installer.step3.hostWarningsPopup.jdk'),
         message: Em.I18n.t('installer.step3.hostWarningsPopup.jdk.message'),
@@ -277,7 +288,7 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
         isCollapsed: true
       })
     ]
-  }.property('category', 'warningsByHost', 
'bodyController.jdkCategoryWarnings', 'bodyController.repoCategoryWarnings', 
'bodyController.diskCategoryWarnings', 'bodyController.hostCheckWarnings'),
+  }.property('category', 'warningsByHost', 
'bodyController.jdkCategoryWarnings', 'bodyController.repoCategoryWarnings', 
'bodyController.diskCategoryWarnings', 'bodyController.hostCheckWarnings',  
'bodyController.thpCategoryWarnings'),
 
   /**
    * Message with info about warnings
@@ -285,13 +296,13 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
    */
   warningsNotice: function () {
     var issuesNumber = this.get('warnings.length') + 
this.get('bodyController.repoCategoryWarnings.length') + 
this.get('bodyController.diskCategoryWarnings.length')
-      + this.get('bodyController.jdkCategoryWarnings.length') + 
this.get('bodyController.hostCheckWarnings.length');
+      + this.get('bodyController.jdkCategoryWarnings.length') + 
this.get('bodyController.hostCheckWarnings.length') + 
this.get('bodyController.thpCategoryWarnings.length');
     this.set('totalWarningsCount', issuesNumber);
     var issues = issuesNumber + ' ' + (issuesNumber.length === 1 ? 
Em.I18n.t('installer.step3.hostWarningsPopup.issue') : 
Em.I18n.t('installer.step3.hostWarningsPopup.issues'));
     var hostsCnt = this.warningHostsNamesCount();
     var hosts = hostsCnt + ' ' + (hostsCnt === 1 ? 
Em.I18n.t('installer.step3.hostWarningsPopup.host') : 
Em.I18n.t('installer.step3.hostWarningsPopup.hosts'));
     return 
Em.I18n.t('installer.step3.hostWarningsPopup.summary').format(issues, hosts);
-  }.property('warnings', 'warningsByHost', 
'bodyController.jdkCategoryWarnings', 'bodyController.repoCategoryWarnings', 
'bodyController.diskCategoryWarnings', 'bodyController.hostCheckWarnings'),
+  }.property('warnings', 'warningsByHost', 
'bodyController.jdkCategoryWarnings', 'bodyController.repoCategoryWarnings', 
'bodyController.diskCategoryWarnings', 'bodyController.hostCheckWarnings',  
'bodyController.diskCategoryWarnings'),
 
   /**
    * Detailed content to show it in new window
@@ -303,6 +314,10 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
     newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.header') 
+ new Date;
     newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.hosts');
     newContent += this.get('hostNamesWithWarnings').join(' ');
+    if (content.findProperty('category', 'thp').warnings.length) {
+      newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.thp');
+      newContent += content.findProperty('category', 
'thp').warnings[0].hosts.join(' ');
+    }
     if (content.findProperty('category', 'jdk').warnings.length) {
       newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.jdk');
       newContent += content.findProperty('category', 
'jdk').warnings[0].hosts.join('<br>');
@@ -411,6 +426,7 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
     var repoCategoryWarnings = this.get('bodyController.repoCategoryWarnings');
     var diskCategoryWarnings = this.get('bodyController.diskCategoryWarnings');
     var jdkCategoryWarnings = this.get('bodyController.jdkCategoryWarnings');
+    var thpCategoryWarnings = this.get('bodyController.thpCategoryWarnings');
     var hostResolutionWarnings = this.get('bodyController.hostCheckWarnings');
 
     if (repoCategoryWarnings.length) {
@@ -441,6 +457,13 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
         }
       });
     }
+    if (thpCategoryWarnings.length) {
+      thpCategoryWarnings[0].hostsNames.forEach(function (_hostName) {
+        if (!hostNameMap[_hostName]) {
+          hostNameMap[_hostName] = true;
+        }
+      });
+    }
     this.set('hostNamesWithWarnings', Em.keys(hostNameMap));
     return Em.keys(hostNameMap).length;
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/3efb5fc4/ambari-web/app/views/wizard/step3_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step3_view.js 
b/ambari-web/app/views/wizard/step3_view.js
index fbc4a4c..c083e6b 100644
--- a/ambari-web/app/views/wizard/step3_view.js
+++ b/ambari-web/app/views/wizard/step3_view.js
@@ -277,7 +277,8 @@ App.WizardStep3View = App.TableView.extend({
         this.set('message', Em.I18n.t('installer.step3.warning.loading'));
       }
       else {
-        if (this.get('controller.isHostHaveWarnings') || 
this.get('controller.repoCategoryWarnings.length') || 
this.get('controller.diskCategoryWarnings.length') || 
this.get('controller.jdkCategoryWarnings.length') || 
this.get('controller.hostCheckWarnings.length')) {
+        if (this.get('controller.isHostHaveWarnings') || 
this.get('controller.repoCategoryWarnings.length') || 
this.get('controller.diskCategoryWarnings.length') || 
this.get('controller.jdkCategoryWarnings.length')
+          || this.get('controller.hostCheckWarnings.length') || 
this.get('controller.thpCategoryWarnings.length')) {
           this.set('status', 'alert-warn');
           this.set('linkText', Em.I18n.t('installer.step3.warnings.linkText'));
           this.set('message', 
Em.I18n.t('installer.step3.warnings.fails').format(hosts.length - failedHosts));
@@ -305,7 +306,7 @@ App.WizardStep3View = App.TableView.extend({
       }
     }
 
-  }.observes('controller.isWarningsLoaded','controller.hostCheckWarnings', 
'controller.isHostHaveWarnings', 'controller.repoCategoryWarnings', 
'controller.diskCategoryWarnings', 'controller.jdkCategoryWarnings')
+  }.observes('controller.isWarningsLoaded','controller.hostCheckWarnings', 
'controller.isHostHaveWarnings', 'controller.repoCategoryWarnings', 
'controller.diskCategoryWarnings', 'controller.jdkCategoryWarnings', 
'controller.thpCategoryWarnings')
 });
 
 //todo: move it inside WizardStep3View

Reply via email to