Browse Source

AMBARI-8753 Turn on pre-upgrade checks when API is ready. (ababiichuk)

aBabiichuk 10 years ago
parent
commit
c62b378c51

+ 25 - 77
ambari-web/app/assets/data/stack_versions/pre_upgrade_check.json

@@ -1,81 +1,29 @@
 {
-  "UpgradeChecks": [
-    {
-      "check": "NameNode HA is enabled",
-      "status": "PASS",
-      "reason": "",
-      "failed_on": [],
-      "check_type": "SERVICE"
-    },
-    {
-      "check": "Work-preserving RM/NM restart is enabled in YARN configs",
-      "status": "FAIL",
-      "reason": "X should be set to Y in yarn-site",
-      "failed_on": [ "YARN" ],
-      "check_type": "SERVICE"
-    },
-    {
-      "check": "MapReduce jobs are referencing Hadoop libraries from the distributed cache instead of the cluster",
-      "status": "PASS",
-      "reason": "",
-      "failed_on": [],
-      "check_type": "SERVICE"
-    },
-    {
-      "check": "Tez jobs are referencing Hadoop libraries from the distributed cache instead of the cluster",
-      "status": "PASS",
-      "reason": "",
-      "failed_on": [],
-      "check_type": "SERVICE"
-    },
-    {
-      "check": "Oozie jobs are referencing Hadoop libraries from the distributed cache instead of the cluster",
-      "status": "PASS",
-      "reason": "",
-      "failed_on": [],
-      "check_type": "SERVICE"
-    },
-    {
-      "check": "All services are up",
-      "status": "FAIL",
-      "reason": "Some services are down",
-      "failed_on": [ "STORM" ],
-      "check_type": "SERVICE"
-    },
-    {
-      "check": "All services must not in Maintenance Mode",
-      "status": "FAIL",
-      "reason": "Some services are in Maintenance Mode",
-      "failed_on": [ "FALCON", "OOZIE" ],
-      "check_type": "SERVICE"
-    },
-    {
-      "check": "There must not be any DataNodes in decommissioning state",
-      "status": "FAIL",
-      "reason": "Some DataNodes are in decommissioning state",
-      "failed_on": [ "host004", "host005" ],
-      "check_type": "HOST"
-    },
-    {
-      "check": "All hosts must be heartbeating with the server unless they are in Maintenance Mode",
-      "status": "FAIL",
-      "reason": "Some hosts are not heartbeating with the server",
-      "failed_on": [ "host009", "host010" ],
-      "check_type": "HOST"
-    },
-    {
-      "check": "All hosts must not have any components in Maintenance Mode",
-      "status": "FAIL",
-      "reason": "Some hosts have host components in Maintenance Mode",
-      "failed_on": [ "host001", "host002" ],
-      "check_type": "HOST"
-    },
-    {
-      "check": "All hosts must have the new version installed",
-      "status": "FAIL",
-      "reason": "Some hosts do not have HDP-2.2.1 installed",
-      "failed_on": [ "host001", "host002" ],
-      "check_type": "HOST"
+  "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/clus/rolling_upgrades_check/",
+  "items" : [
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/clus/rolling_upgrade_check/HOST_HEARTBEAT",
+      "UpgradeChecks" : {
+        "cluster_name" : "clus",
+        "id" : "HOST_HEARTBEAT",
+        "check" : "All hosts must be heartbeating with the server unless they are in Maintenance Mode",
+        "check_type" : "HOST",
+        "failed_on" : ["c6401.ambari.apache.org"],
+        "reason" : "Some hosts are not heartbeating with the server",
+        "status" : "FAIL"
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/clus/rolling_upgrade_check/SERVICES_MAINTENANCE_MODE",
+      "UpgradeChecks" : {
+        "cluster_name" : "clus",
+        "id" : "SERVICES_MAINTENANCE_MODE",
+        "check" : "All services must not in Maintenance Mode",
+        "check_type" : "SERVICE",
+        "failed_on" : [],
+        "reason" : "",
+        "status" : "PASS"
+      }
     }
   ]
 }

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

@@ -57,7 +57,7 @@ App.isManagedMySQLForHiveEnabled = false;
 App.enableExperimental = false;
 
 App.supports = {
-  preUpgradeCheck: false,
+  preUpgradeCheck: true,
   stackUpgrade: true,
   autoRollbackHA: false,
   alwaysEnableManagedMySQLForHive: false,

+ 3 - 5
ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js

@@ -283,7 +283,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
    * @param version
    */
   runPreUpgradeCheck: function(version) {
-    if (App.supports.preUpgradeCheck) {
+    if (App.get('supports.preUpgradeCheck')) {
       App.ajax.send({
         name: "admin.rolling_upgrade.pre_upgrade_check",
         sender: this,
@@ -304,16 +304,14 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
    * @returns {App.ModalPopup|void}
    */
   runPreUpgradeCheckSuccess: function(data, opt, params) {
-    if (data.UpgradeChecks.someProperty('status',"FAIL")) {
+    if (data.items.someProperty('UpgradeChecks.status',"FAIL")) {
       return App.ModalPopup.show({
         header: Em.I18n.t('admin.stackUpgrade.preupgradeCheck.header').format(params.label),
         primary: Em.I18n.t('common.dismiss'),
         secondary: false,
         bodyClass: Em.View.extend({
           templateName: require('templates/main/admin/stack_upgrade/pre_upgrade_check_dialog'),
-          checks: function() {
-            return data.UpgradeChecks.filterProperty('status',"FAIL");
-          }.property()
+          checks: data.items.filterProperty('UpgradeChecks.status',"FAIL")
         })
       })
     } else {

+ 2 - 2
ambari-web/app/templates/main/admin/stack_upgrade/pre_upgrade_check_dialog.hbs

@@ -22,8 +22,8 @@
   </div>
   <div class="limited-height-2">
     {{#each item in view.checks}}
-        <i class="icon-remove"></i>&nbsp;<span>{{item.check}}</span>
-        <pre>{{t admin.stackUpgrade.preupgradeCheck.reason}}{{item.reason}}<br/>{{t admin.stackUpgrade.preupgradeCheck.failedOn}}{{item.failed_on}}</pre>
+        <i class="icon-remove"></i>&nbsp;<span>{{item.UpgradeChecks.check}}</span>
+        <pre>{{t admin.stackUpgrade.preupgradeCheck.reason}}{{item.UpgradeChecks.reason}}<br/>{{t admin.stackUpgrade.preupgradeCheck.failedOn}}{{item.UpgradeChecks.failed_on}}</pre>
     {{/each}}
   </div>
 </div>

+ 1 - 1
ambari-web/app/utils/ajax/ajax.js

@@ -1394,7 +1394,7 @@ var urls = {
     'mock': ''
   },
   'admin.rolling_upgrade.pre_upgrade_check': {
-    'real': '/clusters/{clusterName}/rolling_upgrades_check',
+    'real': '/clusters/{clusterName}/rolling_upgrades_check?fields=*',
     'mock': '/data/stack_versions/pre_upgrade_check.json'
   },
 

+ 16 - 12
ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js

@@ -248,24 +248,28 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       controller.upgrade.restore();
     });
     it("shows popup", function () {
-      var check =  {UpgradeChecks: [{
-        "check": "Work-preserving RM/NM restart is enabled in YARN configs",
-        "status": "FAIL",
-        "reason": "FAIL",
-        "failed_on": [],
-        "check_type": "SERVICE"
+      var check =  { items: [{
+        UpgradeChecks: {
+          "check": "Work-preserving RM/NM restart is enabled in YARN configs",
+          "status": "FAIL",
+          "reason": "FAIL",
+          "failed_on": [],
+          "check_type": "SERVICE"
+        }
       }]};
       controller.runPreUpgradeCheckSuccess(check,null,{label: "name"});
       expect(controller.upgrade.calledOnce).to.be.false;
       expect(App.ModalPopup.show.calledOnce).to.be.true;
     });
     it("runs upgrade popup", function () {
-      var check = {UpgradeChecks: [{
-        "check": "Work-preserving RM/NM restart is enabled in YARN configs",
-        "status": "PASS",
-        "reason": "OK",
-        "failed_on": [],
-        "check_type": "SERVICE"
+      var check = { items: [{
+        UpgradeChecks: {
+          "check": "Work-preserving RM/NM restart is enabled in YARN configs",
+          "status": "PASS",
+          "reason": "OK",
+          "failed_on": [],
+          "check_type": "SERVICE"
+        }
       }]};
       controller.runPreUpgradeCheckSuccess(check,null,{label: "name"});
       expect(controller.upgrade.calledOnce).to.be.true;