Преглед изворни кода

AMBARI-4089. HDFS/ZKFC relations in EmberData. (onechiporenko)

Oleg Nechiporenko пре 11 година
родитељ
комит
54791d17ae

+ 1 - 2
ambari-web/app/app.js

@@ -69,10 +69,9 @@ module.exports = Em.Application.create({
    * @type {Boolean}
    */
   isHaEnabled: function() {
-    if (!this.clusterStatus.get('isInstalled')) return false;
     if (!this.get('isHadoop2Stack')) return false;
     return !this.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE');
-  }.property('clusterStatus.isInstalled')
+  }.property('router.clusterController.isLoaded')
 
 });
 

+ 0 - 3
ambari-web/app/controllers/application.js

@@ -133,9 +133,6 @@ App.ApplicationController = Em.Controller.extend({
             self.postUserPref(key, curValue);
           }
           this.hide();
-        },
-        onSecondary: function() {
-          this.hide();
         }
       })
     });

+ 2 - 4
ambari-web/app/controllers/main/host/details.js

@@ -546,10 +546,8 @@ App.MainHostDetailsController = Em.Controller.extend({
     });
     zks_with_port = zks_with_port.slice(0,-1);
 
-    if (App.get('isHadoop2Stack')) {
-      if (!App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE')) {
-        configs['core-site']['ha.zookeeper.quorum'] = zks_with_port;
-      }
+    if (App.get('isHaEnabled')) {
+      configs['core-site']['ha.zookeeper.quorum'] = zks_with_port;
     }
     if (configs['hbase-site']) {
       configs['hbase-site']['hbase.zookeeper.quorum'] = zks.join(',');

+ 1 - 1
ambari-web/app/controllers/main/service/item.js

@@ -272,7 +272,7 @@ App.MainServiceItemController = Em.Controller.extend({
 
   isStopDisabled: function () {
     if(this.get('isPending')) return true;
-    if (!App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE') && this.get('content.serviceName') == 'HDFS' && this.get('content.hostComponents').filterProperty('componentName', 'NAMENODE').someProperty('workStatus', App.HostComponentStatus.started)) {
+    if (App.get('isHaEnabled') && this.get('content.serviceName') == 'HDFS' && this.get('content.hostComponents').filterProperty('componentName', 'NAMENODE').someProperty('workStatus', App.HostComponentStatus.started)) {
       return false;
     }
     return (this.get('content.healthStatus') != 'green');

+ 4 - 4
ambari-web/app/controllers/main/service/reassign/step4_controller.js

@@ -31,7 +31,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
   hostComponents: [],
 
   loadStep: function () {
-    if (this.get('content.reassign.component_name') === 'NAMENODE' && !App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE')) {
+    if (this.get('content.reassign.component_name') === 'NAMENODE' && App.get('isHaEnabled')) {
       this.set('hostComponents', ['NAMENODE', 'ZKFC']);
     } else {
       this.set('hostComponents', [this.get('content.reassign.component_name')]);
@@ -69,7 +69,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
     }
 
     if (this.get('content.hasManualSteps')) {
-      if (this.get('content.reassign.component_name') === 'NAMENODE' && !App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE')) {
+      if (this.get('content.reassign.component_name') === 'NAMENODE' && App.get('isHaEnabled')) {
         // Only for reassign NameNode with HA enabled
         this.get('tasks').splice(7, 2);
       } else {
@@ -210,7 +210,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
     switch (componentName) {
       case 'NAMENODE':
         if (isHadoop2Stack) {
-          if (!App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE')) {
+          if (App.get('isHaEnabled')) {
             var nameServices = configs['hdfs-site']['dfs.nameservices'];
             if (configs['hdfs-site']['dfs.namenode.http-address.' + nameServices + '.nn1'] === sourceHostName + ':50070') {
               configs['hdfs-site']['dfs.namenode.http-address.' + nameServices + '.nn1'] = targetHostName + ':50070';
@@ -233,7 +233,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
           configs['hdfs-site']['dfs.https.address'] = targetHostName + ':50470';
           configs['core-site']['fs.default.name'] = 'hdfs://' + targetHostName + ':8020';
         }
-        if (App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE')) {
+        if (!App.get('isHaEnabled')) {
           if (App.Service.find().someProperty('serviceName', 'HBASE')) {
             configs['hbase-site']['hbase.rootdir'] = configs['hbase-site']['hbase.rootdir'].replace(/\/\/[^\/]*/, '//' + targetHostName);
           }

+ 1 - 1
ambari-web/app/controllers/main/service/reassign/step6_controller.js

@@ -31,7 +31,7 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro
   hostComponents: [],
 
   loadStep: function () {
-    if (this.get('content.reassign.component_name') === 'NAMENODE' && !App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE')) {
+    if (this.get('content.reassign.component_name') === 'NAMENODE' && App.get('isHaEnabled')) {
       this.set('hostComponents', ['NAMENODE', 'ZKFC']);
     } else {
       this.set('hostComponents', [this.get('content.reassign.component_name')]);

+ 1 - 1
ambari-web/app/controllers/wizard/step5_controller.js

@@ -243,7 +243,7 @@ App.WizardStep5Controller = Em.Controller.extend({
 
       if (item.component_name == 'SECONDARY_NAMENODE') {
         if (self.get('isAddServiceWizard')) {
-          if (!App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE')) {
+          if (App.get('isHaEnabled')) {
             return;
           }
         }

+ 1 - 1
ambari-web/app/controllers/wizard/step7_controller.js

@@ -117,7 +117,7 @@ App.WizardStep7Controller = Em.Controller.extend({
       });
 
       // Remove SNameNode if HA is enabled
-      if (!App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE')) {
+      if (App.get('isHaEnabled')) {
         configs = serviceConfigs.findProperty('serviceName', 'HDFS').configs;
         var removedConfigs = configs.filterProperty('category', 'SNameNode');
         removedConfigs.map(function(config) {

+ 3 - 2
ambari-web/app/mappers/server_data_mapper.js

@@ -171,7 +171,7 @@ App.QuickDataMapper = App.ServerDataMapper.extend({
 //    }
     return json;
   }
-})
+});
 
 App.QuickDataMapper.componentServiceMap = {
   'NAMENODE': 'HDFS',
@@ -179,6 +179,7 @@ App.QuickDataMapper.componentServiceMap = {
   'DATANODE': 'HDFS',
   'HDFS_CLIENT': 'HDFS',
   'JOURNALNODE': 'HDFS',
+  'ZKFC': 'HDFS',
   'JOBTRACKER': 'MAPREDUCE',
   'TASKTRACKER': 'MAPREDUCE',
   'MAPREDUCE_CLIENT': 'MAPREDUCE',
@@ -211,4 +212,4 @@ App.QuickDataMapper.componentServiceMap = {
   'KERBEROS_CLIENT': 'KERBEROS',
   'HUE_SERVER': 'HUE',
   'GLUSTERFS_CLIENT': 'GLUSTERFS'
-}
+};

+ 1 - 1
ambari-web/app/templates/main/admin/highAvailability.hbs

@@ -17,7 +17,7 @@
 }}
 
 <div>
-  {{#if view.isHighAvailabilityEnabled}}
+  {{#if App.isHaEnabled}}
     {{#if App.supports.autoRollbackHA}}
       <p class="text-success">
         {{t admin.highAvailability.enabled}}

+ 1 - 6
ambari-web/app/views/main/admin/highAvailability_view.js

@@ -23,10 +23,5 @@ App.MainAdminHighAvailabilityView = Em.View.extend({
 
   didInsertElement: function () {
     this.get('controller').setSecurityStatus();
-  },
-
-  isHighAvailabilityEnabled: function () {
-    return !App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE');
-  }.property()
-
+  }
 });

+ 2 - 2
ambari-web/app/views/main/host/configs_service_menu.js

@@ -27,15 +27,15 @@ App.MainHostServiceMenuView = Em.CollectionView.extend({
     if (hostComponents) {
       hostComponents.forEach(function (hc) {
         var service = hc.get('service');
+        if (service) {
         var serviceName = service.get('serviceName');
-        if (serviceName) {
           if(!['PIG', 'SQOOP', 'HCATALOG', 'GANGLIA'].contains(serviceName)){
             if (!services.findProperty('serviceName', serviceName)) {
               services.push(service);
             }
           }
         } else {
-          console.warn("serviceName not found for " + hc.get('componentName'));
+          console.warn("service not found for " + hc.get('componentName'));
         }
       });
     }

+ 1 - 1
ambari-web/app/views/main/service/reassign/step2_view.js

@@ -21,7 +21,7 @@ var App = require('app');
 
 App.ReassignMasterWizardStep2View = App.WizardStep5View.extend({
   body: function () {
-    if (this.get('controller.content.reassign.component_name') === 'NAMENODE' && !App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE')) {
+    if (this.get('controller.content.reassign.component_name') === 'NAMENODE' && App.get('isHaEnabled')) {
       return Em.I18n.t('services.reassign.step2.body.namenodeHA').format(this.get('controller.content.reassign.display_name'));
     }
     return Em.I18n.t('services.reassign.step2.body').format(this.get('controller.content.reassign.display_name'));

+ 1 - 1
ambari-web/app/views/main/service/reassign/step5_view.js

@@ -31,7 +31,7 @@ App.ReassignMasterWizardStep5View = Em.View.extend({
     var sourceHost = this.get('controller.content.reassignHosts.source');
     var targetHost = this.get('controller.content.reassignHosts.target');
     var ha = '';
-    if (this.get('controller.content.reassign.component_name') === 'NAMENODE' && !App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE')) {
+    if (this.get('controller.content.reassign.component_name') === 'NAMENODE' && App.get('isHaEnabled')) {
       ha = '_ha';
       var nnStartedHost = this.get('controller.content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName').without(this.get('controller.content.reassignHosts.target'));
     }