瀏覽代碼

AMBARI-1481. Stack Upgrade Wizard - Step 2 (confirm and check all master components are running). (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1449223 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 年之前
父節點
當前提交
c5faec7ab4

+ 3 - 0
CHANGES.txt

@@ -12,6 +12,9 @@ Trunk (unreleased changes):
 
  NEW FEATURES
 
+ AMBARI-1481. Stack Upgrade Wizard - Step 2 (confirm and check all master
+ components are running). (yusaku)
+
  AMBARI-1469. Allow user to add multiple HBase masters in Install Wizard.
  (yusaku)
 

+ 26 - 26
ambari-web/app/assets/data/wizard/stack/stacks.json

@@ -721,11 +721,11 @@
   } ]
 }, {
   "name" : "HDP",
-  "version" : "1.2.0",
+  "version" : "1.3.0",
   "repositories" : [ {
-    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/centos6",
+    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.3.0/repos/centos6",
     "osType" : "centos6",
-    "repoId" : "HDP-1.2.0",
+    "repoId" : "HDP-1.3.0",
     "repoName" : "HDP",
     "mirrorsList" : null
   }, {
@@ -735,9 +735,9 @@
     "repoName" : "HDP-epel",
     "mirrorsList" : "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch"
   }, {
-    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/centos5",
+    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.3.0/repos/centos5",
     "osType" : "centos5",
-    "repoId" : "HDP-1.2.0",
+    "repoId" : "HDP-1.3.0",
     "repoName" : "HDP",
     "mirrorsList" : null
   }, {
@@ -747,9 +747,9 @@
     "repoName" : "HDP-epel",
     "mirrorsList" : "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch"
   }, {
-    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/centos6",
+    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.3.0/repos/centos6",
     "osType" : "redhat6",
-    "repoId" : "HDP-1.2.0",
+    "repoId" : "HDP-1.3.0",
     "repoName" : "HDP",
     "mirrorsList" : null
   }, {
@@ -759,9 +759,9 @@
     "repoName" : "HDP-epel",
     "mirrorsList" : "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch"
   }, {
-    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/centos5",
+    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.3.0/repos/centos5",
     "osType" : "redhat5",
-    "repoId" : "HDP-1.2.0",
+    "repoId" : "HDP-1.3.0",
     "repoName" : "HDP",
     "mirrorsList" : null
   }, {
@@ -771,9 +771,9 @@
     "repoName" : "HDP-epel",
     "mirrorsList" : "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch"
   }, {
-    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/suse11",
+    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.3.0/repos/suse11",
     "osType" : "suse11",
-    "repoId" : "HDP-1.2.0",
+    "repoId" : "HDP-1.3.0",
     "repoName" : "HDP",
     "mirrorsList" : null
   }, {
@@ -783,9 +783,9 @@
     "repoName" : "HDP-UTILS",
     "mirrorsList" : null
   }, {
-    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/suse11",
+    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.3.0/repos/suse11",
     "osType" : "sles11",
-    "repoId" : "HDP-1.2.0",
+    "repoId" : "HDP-1.3.0",
     "repoName" : "HDP",
     "mirrorsList" : null
   }, {
@@ -1447,11 +1447,11 @@
   } ]
 }, {
   "name" : "HDPLocal",
-  "version" : "1.2.0",
+  "version" : "1.3.0",
   "repositories" : [ {
-    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/centos6",
+    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.3.0/repos/centos6",
     "osType" : "centos6",
-    "repoId" : "HDP-1.2.0",
+    "repoId" : "HDP-1.3.0",
     "repoName" : "HDP",
     "mirrorsList" : null
   }, {
@@ -1461,9 +1461,9 @@
     "repoName" : "HDP-epel",
     "mirrorsList" : "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch"
   }, {
-    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/centos5",
+    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.3.0/repos/centos5",
     "osType" : "centos5",
-    "repoId" : "HDP-1.2.0",
+    "repoId" : "HDP-1.3.0",
     "repoName" : "HDP",
     "mirrorsList" : null
   }, {
@@ -1473,9 +1473,9 @@
     "repoName" : "HDP-epel",
     "mirrorsList" : "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch"
   }, {
-    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/centos6",
+    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.3.0/repos/centos6",
     "osType" : "redhat6",
-    "repoId" : "HDP-1.2.0",
+    "repoId" : "HDP-1.3.0",
     "repoName" : "HDP",
     "mirrorsList" : null
   }, {
@@ -1485,9 +1485,9 @@
     "repoName" : "HDP-epel",
     "mirrorsList" : "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch"
   }, {
-    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/centos5",
+    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.3.0/repos/centos5",
     "osType" : "redhat5",
-    "repoId" : "HDP-1.2.0",
+    "repoId" : "HDP-1.3.0",
     "repoName" : "HDP",
     "mirrorsList" : null
   }, {
@@ -1497,9 +1497,9 @@
     "repoName" : "HDP-epel",
     "mirrorsList" : "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch"
   }, {
-    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/suse11",
+    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.3.0/repos/suse11",
     "osType" : "suse11",
-    "repoId" : "HDP-1.2.0",
+    "repoId" : "HDP-1.3.0",
     "repoName" : "HDP",
     "mirrorsList" : null
   }, {
@@ -1509,9 +1509,9 @@
     "repoName" : "HDP-UTILS",
     "mirrorsList" : null
   }, {
-    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/suse11",
+    "baseUrl" : "http://public-repo-1.hortonworks.com/HDP-1.3.0/repos/suse11",
     "osType" : "sles11",
-    "repoId" : "HDP-1.2.0",
+    "repoId" : "HDP-1.3.0",
     "repoName" : "HDP",
     "mirrorsList" : null
   }, {

+ 1 - 0
ambari-web/app/controllers.js

@@ -72,5 +72,6 @@ require('controllers/wizard/step8_controller');
 require('controllers/wizard/step9_controller');
 require('controllers/wizard/step10_controller');
 require('controllers/wizard/stack_upgrade/step1_controller');
+require('controllers/wizard/stack_upgrade/step2_controller');
 require('controllers/global/cluster_controller');
 require('controllers/global/update_controller');

+ 23 - 21
ambari-web/app/controllers/main/admin/cluster.js

@@ -33,8 +33,8 @@ App.MainAdminClusterController = Em.Controller.extend({
         '/data/wizard/stack/stacks.json'
       );
       var upgradeVersion = this.get('upgradeVersion') || App.defaultStackVersion;
-      var installedServices = [];
-      var newServices = [];
+      var installedServices = {};
+      var newServices = {};
       $.ajax({
         type: "GET",
         url: url,
@@ -66,26 +66,28 @@ App.MainAdminClusterController = Em.Controller.extend({
     var result = [];
     var installedServices = App.Service.find().mapProperty('serviceName');
     var displayOrderConfig = require('data/services');
-    // loop through all the service components
-    for (var i = 0; i < displayOrderConfig.length; i++) {
-      var entry = oldServices.services.findProperty("name", displayOrderConfig[i].serviceName);
-      if (installedServices.contains(entry.name)) {
-        var myService = Em.Object.create({
-          serviceName: entry.name,
-          displayName: displayOrderConfig[i].displayName,
-          isDisabled: i === 0,
-          isSelected: true,
-          isInstalled: false,
-          isHidden: displayOrderConfig[i].isHidden,
-          description: entry.comment,
-          version: entry.version,
-          newVersion: newServices.services.findProperty("name", displayOrderConfig[i].serviceName).version
-        });
-        //From 1.3.0 for Hive we display only "Hive" (but it installes HCat and WebHCat as well)
-        if (this.get('upgradeVersion').replace(/HDP-/, '') >= '1.3.0' && displayOrderConfig[i].serviceName == 'HIVE') {
-          myService.set('displayName', 'Hive');
+    if(oldServices.services && newServices.services){
+      // loop through all the service components
+      for (var i = 0; i < displayOrderConfig.length; i++) {
+        var entry = oldServices.services.findProperty("name", displayOrderConfig[i].serviceName);
+        if (installedServices.contains(entry.name)) {
+          var myService = Em.Object.create({
+            serviceName: entry.name,
+            displayName: displayOrderConfig[i].displayName,
+            isDisabled: i === 0,
+            isSelected: true,
+            isInstalled: false,
+            isHidden: displayOrderConfig[i].isHidden,
+            description: entry.comment,
+            version: entry.version,
+            newVersion: newServices.services.findProperty("name", displayOrderConfig[i].serviceName).version
+          });
+          //From 1.3.0 for Hive we display only "Hive" (but it installes HCat and WebHCat as well)
+          if (this.get('upgradeVersion').replace(/HDP-/, '') >= '1.3.0' && displayOrderConfig[i].serviceName == 'HIVE') {
+            myService.set('displayName', 'Hive');
+          }
+          result.push(myService);
         }
-        result.push(myService);
       }
     }
     this.set('services', result);

+ 25 - 1
ambari-web/app/controllers/main/admin/stack_upgrade_controller.js

@@ -50,13 +50,37 @@ App.StackUpgradeController = App.WizardController.extend({
   getCluster: function(){
     return jQuery.extend({}, this.get('clusterStatusTemplate'), {name: App.get('ClusterName')});
   },
+  /**
+   * return new object extended from upgradeOptionsTemplate
+   * @return Object
+   */
+  getUpgradeOptions: function(){
+    return jQuery.extend({}, this.get('upgradeOptionsTemplate'));
+  },
   /**
    * Load data for all steps until <code>current step</code>
    */
   loadAllPriorSteps: function () {
     this.load('cluster');
+    this.load('upgradeOptions');
+  },
+  upgradeOptionsTemplate:{
+    localRepo: false
+  },
+  clear: function () {
+    this.set('content', Ember.Object.create({
+      servicesInfo: function(){
+        return App.router.get('mainAdminClusterController.services');
+      }.property('App.router.mainAdminClusterController.services'),
+      upgradeVersion: function(){
+        return App.router.get('mainAdminClusterController.upgradeVersion');
+      }.property('App.router.mainAdminClusterController.upgradeVersion'),
+      'controllerName': this.get('content.controllerName'),
+      'isWizard': !(this.get('content.controllerName') === 'installerController')
+    }));
+    this.set('currentStep', 0);
+    this.clearStorageData();
   },
-
   /**
    * Finish upgrade
    */

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

@@ -421,6 +421,7 @@ App.WizardController = Em.Controller.extend({
     App.db.setSlaveProperties(undefined);
     App.db.setInstallOptions(undefined);
     App.db.setAllHostNamesPattern(undefined);
+    App.db.setUpgradeOptions(undefined);
   },
 
   installOptionsTemplate: {

+ 58 - 0
ambari-web/app/controllers/wizard/stack_upgrade/step2_controller.js

@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.StackUpgradeStep2Controller = Em.Controller.extend({
+  name: 'stackUpgradeStep2Controller',
+  /**
+   * check whether all services are running
+   * @return {Array}
+   */
+  isAllServicesRunning:function(){
+    var masterComponents = App.HostComponent.find().filterProperty('isMaster', true);
+    return masterComponents.everyProperty('workStatus', 'STARTED');
+  },
+  /**
+   * callback, which save step data and route to next step
+   * @param event
+   */
+  upgradeAction: function(event){
+    if(this.get('isAllServicesRunning')){
+      App.db.setUpgradeOptions(this.get('content.upgradeOptions'));
+      App.router.send('next');
+    } else {
+      this.showWarningPopup();
+    }
+  },
+  /**
+   * show warning popup if not all services are running
+   */
+  showWarningPopup: function(){
+    App.ModalPopup.show({
+      header: Em.I18n.t('installer.step2.manualInstall.popup.header'),
+      onPrimary: function () {
+        this.hide();
+      },
+      secondary: null,
+      bodyClass: Ember.View.extend({
+        template: Em.Handlebars.compile('{{t installer.stackUpgrade.step2.popup.body}}')
+      })
+    });
+  }
+});

+ 9 - 0
ambari-web/app/messages.js

@@ -396,6 +396,15 @@ Em.I18n.translations = {
   'installer.stackUpgrade.step1.upgradeStackVersion':'Upgrade stack version',
   'installer.stackUpgrade.step1.description':'This Stack Upgrade Wizard will walk you through the steps of upgrading the cluster to the latest available stack version.',
 
+  'installer.stackUpgrade.step2.notice.header':'Important before you proceed, please perform following.',
+  'installer.stackUpgrade.step2.notice.first':'Make sure that your NameNode is backed up.',
+  'installer.stackUpgrade.step2.notice.second':'Make sure that your NameNode is backed up.',
+  'installer.stackUpgrade.step2.notice.third':'Make sure that your NameNode is backed up.',
+  'installer.stackUpgrade.step2.notice.complete':'Once you have completed the above, click on Upgrade to initiate the upgrade process on all hosts in your cluster',
+  'installer.stackUpgrade.step2.advancedOption':'Advanced Option',
+  'installer.stackUpgrade.step2.localRepository':'Use a local repository',
+  'installer.stackUpgrade.step2.popup.body':'We cannot proceed since some of the master components are not currently running. Please ensure that all services are running before continuing.',
+
   'form.create':'Create',
   'form.save':'Save',
   'form.cancel':'Cancel',

+ 3 - 0
ambari-web/app/router.js

@@ -262,6 +262,9 @@ App.Router = Em.Router.extend({
     } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName === App.router.get('addHostController.name')) {
       // if wizardControllerName == "addHostController", then it means someone closed the browser or the browser was crashed when we were last in Add Hosts wizard
       return 'main.hostAdd';
+    } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName === App.router.get('stackUpgradeController.name')) {
+      // if wizardControllerName == "stackUpgradeController", then it means someone closed the browser or the browser was crashed when we were last in Stack Upgrade wizard
+      return 'main.stackUpgrade';
     } else {
       // if wizardControllerName == "installerController", then it means someone closed the browser or the browser was crashed when we were last in Installer wizard
       return 'installer';

+ 14 - 7
ambari-web/app/routes/stack_upgrade.js

@@ -71,9 +71,7 @@ module.exports = Em.Route.extend({
       controller.loadAllPriorSteps();
       controller.connectOutlet('stackUpgradeStep1', controller.get('content'));
     },
-    next: function(router){
-      //Em.Router.transitionTo('step2');
-    }
+    next: Em.Router.transitionTo('step2')
   }),
 
   step2: Em.Route.extend({
@@ -82,11 +80,18 @@ module.exports = Em.Route.extend({
       console.log('in stackUpgrade.step2:connectOutlets');
       var controller = router.get('stackUpgradeController');
       controller.setCurrentStep('2');
+      controller.loadAllPriorSteps();
       controller.connectOutlet('stackUpgradeStep2', controller.get('content'));
     },
     back: Em.Router.transitionTo('step1'),
-    next: function (router, context) {
-      router.transitionTo('step3');
+    next: function(router){
+      /*router.transitionTo('step3');
+       App.clusterStatus.setClusterStatus({
+       clusterName: this.get('clusterName'),
+       clusterState: 'UPGRADING_STACK',
+       wizardControllerName: 'stackUpgradeController',
+       localdb: App.db.data
+       });*/
     }
   }),
 
@@ -97,10 +102,12 @@ module.exports = Em.Route.extend({
       var controller = router.get('stackUpgradeController');
       controller.setCurrentStep('3');
       controller.setLowerStepsDisable(3);
+      controller.loadAllPriorSteps();
       controller.connectOutlet('stackUpgradeStep3', controller.get('content'));
     },
-    back: Em.Router.transitionTo('step2'),
-    complete: function (router, context) {
+    retry: function(router){
+    },
+    done: function (router, context) {
       App.router.get('updateController').set('isWorking', true);
       $(context.currentTarget).parents("#modal").find(".close").trigger('click');
 

+ 3 - 0
ambari-web/app/styles/application.less

@@ -406,6 +406,9 @@ h1 {
   table th {
     vertical-align: middle;
   }
+  .btn-area {
+    margin-top: 30px;
+  }
 }
 
 #host-log {

+ 49 - 0
ambari-web/app/templates/wizard/stack_upgrade/step2.hbs

@@ -0,0 +1,49 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+
+<div class="box alert-info">
+  <div>
+  {{t installer.stackUpgrade.step2.notice.header}}
+  </div>
+  <br/>
+  <ul class="unstyled">
+      <li>1&#41;&nbsp;{{t installer.stackUpgrade.step2.notice.first}}</li>
+      <li>2&#41;&nbsp;{{t installer.stackUpgrade.step2.notice.second}}</li>
+      <li>3&#41;&nbsp;{{t installer.stackUpgrade.step2.notice.third}}</li>
+  </ul>
+  <div>
+      <strong>{{t installer.stackUpgrade.step2.notice.complete}}</strong>
+  </div>
+</div>
+<div class="control-group">
+    <label><strong>
+      {{t installer.stackUpgrade.step2.advancedOption}}
+      <i href="javascript:void(null)" class="icon-question-sign"
+         rel="popover"
+         {{translateAttr title="installer.step2.localRepo.tooltip.title" data-content="installer.step2.localRepo.tooltip.content"}}>
+      </i>
+    </strong></label>
+    <label class="checkbox">
+      {{view Ember.Checkbox checkedBinding="content.upgradeOptions.localRepo"}}
+      {{t installer.stackUpgrade.step2.localRepository}}
+    </label>
+</div>
+<div class="btn-area">
+  <a class="btn pull-left" {{action back}}>{{t common.back}}</a>
+  <a class="btn btn-success pull-right" {{action upgradeAction target="controller"}}>{{t common.upgrade}}</a>
+</div>

+ 13 - 0
ambari-web/app/utils/db.js

@@ -213,6 +213,13 @@ App.db.setCluster = function (status) {
   localStorage.setObject('ambari', App.db.data);
 };
 
+App.db.setUpgradeOptions = function (upgradeOptions) {
+  App.db.data = localStorage.getObject('ambari');
+  App.db.data.StackUpgrade.upgradeOptions = upgradeOptions;
+  console.log('db.setUpgradeOptions called: ' + JSON.stringify(upgradeOptions));
+  localStorage.setObject('ambari', App.db.data);
+};
+
 /**
  * Set current step value for specified Wizard Type
  * @param wizardType
@@ -357,4 +364,10 @@ App.db.getCluster = function () {
   return App.db.data.Installer.clusterStatus;
 };
 
+App.db.getUpgradeOptions = function () {
+  console.log('TRACE: Entering db:getUpgradeOptions function');
+  App.db.data = localStorage.getObject('ambari');
+  return App.db.data.StackUpgrade.upgradeOptions;
+};
+
 module.exports = App.db;

+ 1 - 0
ambari-web/app/views.js

@@ -122,4 +122,5 @@ require('views/wizard/step8_view');
 require('views/wizard/step9_view');
 require('views/wizard/step10_view');
 require('views/wizard/stack_upgrade/step1_view');
+require('views/wizard/stack_upgrade/step2_view');
 require('views/loading');

+ 27 - 0
ambari-web/app/views/wizard/stack_upgrade/step2_view.js

@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var App = require('app');
+
+App.StackUpgradeStep2View = Em.View.extend({
+  templateName: require('templates/wizard/stack_upgrade/step2'),
+  didInsertElement: function(){
+    $("[rel=popover]").popover({'placement': 'right', 'trigger': 'hover'});
+  }
+});