You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/03/10 22:42:05 UTC

[1/2] ambari git commit: AMBARI-10014. Do not pick up /boot and /mnt for suggesting directories (alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk fea33155a -> eba68bfcc


AMBARI-10014. Do not pick up /boot and /mnt for suggesting directories (alexantonenko)


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

Branch: refs/heads/trunk
Commit: eba68bfcced0aae26bb5c3f50fdb51ac8f9d3271
Parents: e8daa48
Author: Alex Antonenko <hi...@gmail.com>
Authored: Tue Mar 10 20:58:27 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Tue Mar 10 23:42:00 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/models/service_config.js       |   9 +-
 ambari-web/test/models/service_config_test.js | 306 +++++++++++++++++++++
 2 files changed, 310 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/eba68bfc/ambari-web/app/models/service_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service_config.js b/ambari-web/app/models/service_config.js
index dc7a4e7..73abf51 100644
--- a/ambari-web/app/models/service_config.js
+++ b/ambari-web/app/models/service_config.js
@@ -776,10 +776,10 @@ App.ServiceConfigProperty = Em.Object.extend({
       }
 
       mountPointsPerHost = mountPointsPerHost.filter(function (mPoint) {
-        return !(['/', '/home', '/boot'].contains(mPoint.mountpoint)
-        || ['devtmpfs', 'tmpfs', 'vboxsf'].contains(mPoint.type)
-        || mPoint.available == 0
-        || mPoint.type == 'CDFS');
+        return !(['/', '/home'].contains(mPoint.mountpoint)
+        || mPoint.mountpoint && (mPoint.mountpoint.startsWith('/boot') || mPoint.mountpoint.startsWith('/mnt'))
+        || ['devtmpfs', 'tmpfs', 'vboxsf', 'CDFS'].contains(mPoint.type)
+        || mPoint.available == 0);
       });
 
       mountPointsPerHost.forEach(function (mPoint) {
@@ -803,7 +803,6 @@ App.ServiceConfigProperty = Em.Object.extend({
           mPoint += this.get('defaultDirectory') + "\n";
         } else if(winRegex.test(eachDrive.mountpoint.toLowerCase())) {
           switch (this.get('name')) {
-            case 'dfs.datanode.data.dir':
             case 'dfs.name.dir':
             case 'dfs.namenode.name.dir':
             case 'dfs.data.dir':

http://git-wip-us.apache.org/repos/asf/ambari/blob/eba68bfc/ambari-web/test/models/service_config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/service_config_test.js b/ambari-web/test/models/service_config_test.js
index 7b0b516..bba0f31 100644
--- a/ambari-web/test/models/service_config_test.js
+++ b/ambari-web/test/models/service_config_test.js
@@ -1088,4 +1088,310 @@ describe('App.ServiceConfigProperty', function () {
 
   });
 
+  describe('#unionAllMountPoints', function () {
+
+    var localDB = {
+        masterComponentHosts: [
+          {
+            component: 'NAMENODE',
+            hostName: 'h0'
+          },
+          {
+            component: 'SECONDARY_NAMENODE',
+            hostName: 'h4'
+          },
+          {
+            component: 'APP_TIMELINE_SERVER',
+            hostName: 'h0'
+          },
+          {
+            component: 'ZOOKEEPER_SERVER',
+            hostName: 'h0'
+          },
+          {
+            component: 'ZOOKEEPER_SERVER',
+            hostName: 'h1'
+          },
+          {
+            component: 'OOZIE_SERVER',
+            hostName: 'h0'
+          },
+          {
+            component: 'OOZIE_SERVER',
+            hostName: 'h1'
+          },
+          {
+            component: 'NIMBUS',
+            hostName: 'h2'
+          },
+          {
+            component: 'FALCON_SERVER',
+            hostName: 'h3'
+          },
+          {
+            component: 'KAFKA_BROKER',
+            hostName: 'h0'
+          },
+          {
+            component: 'KAFKA_BROKER',
+            hostName: 'h1'
+          }
+        ],
+        slaveComponentHosts: [
+          {
+            componentName: 'DATANODE',
+            hosts: [
+              {
+                hostName: 'h0'
+              },
+              {
+                hostName: 'h1'
+              }
+            ]
+          },
+          {
+            componentName: 'TASKTRACKER',
+            hosts: [
+              {
+                hostName: 'h0'
+              },
+              {
+                hostName: 'h1'
+              }
+            ]
+          },
+          {
+            componentName: 'NODEMANAGER',
+            hosts: [
+              {
+                hostName: 'h0'
+              },
+              {
+                hostName: 'h1'
+              },
+              {
+                hostName: 'h4'
+              }
+            ]
+          },
+          {
+            componentName: 'HBASE_REGIONSERVER',
+            hosts: [
+              {
+                hostName: 'h0'
+              },
+              {
+                hostName: 'h1'
+              }
+            ]
+          },
+          {
+            componentName: 'SUPERVISOR',
+            hosts: [
+              {
+                hostName: 'h0'
+              },
+              {
+                hostName: 'h1'
+              }
+            ]
+          }
+        ],
+        hosts: {
+          h0: {
+            disk_info: [
+              {
+                mountpoint: '/'
+              },
+              {
+                mountpoint: '/home'
+              },
+              {
+                mountpoint: '/boot'
+              },
+              {
+                mountpoint: '/boot/efi'
+              },
+              {
+                mountpoint: '/mnt'
+              },
+              {
+                mountpoint: '/mnt/efi'
+              },
+              {
+                mountpoint: '/media/disk0',
+                available: '100000000'
+              },
+              {
+                mountpoint: '/mount0',
+                available: '100000000'
+              }
+            ]
+          },
+          h4: {
+            disk_info: [
+              {
+                mountpoint: 'c:',
+                available: '100000000'
+              }
+            ]
+          }
+        }
+      },
+      cases = [
+        {
+          name: 'dfs.namenode.name.dir',
+          isOnlyFirstOneNeeded: false,
+          value: '/media/disk0/default\n/mount0/default\n'
+        },
+        {
+          name: 'dfs.name.dir',
+          isOnlyFirstOneNeeded: false,
+          value: '/media/disk0/default\n/mount0/default\n'
+        },
+        {
+          name: 'fs.checkpoint.dir',
+          isOnlyFirstOneNeeded: true,
+          value: 'file:///c:/default\n'
+        },
+        {
+          name: 'dfs.namenode.checkpoint.dir',
+          isOnlyFirstOneNeeded: true,
+          value: 'file:///c:/default\n'
+        },
+        {
+          name: 'dfs.data.dir',
+          isOnlyFirstOneNeeded: false,
+          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\n'
+        },
+        {
+          name: 'dfs.datanode.data.dir',
+          isOnlyFirstOneNeeded: false,
+          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\n'
+        },
+        {
+          name: 'mapred.local.dir',
+          isOnlyFirstOneNeeded: false,
+          value:  '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\n'
+        },
+        {
+          name: 'yarn.nodemanager.log-dirs',
+          isOnlyFirstOneNeeded: false,
+          value:  '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\nc:\\default\n'
+        },
+        {
+          name: 'yarn.nodemanager.local-dirs',
+          isOnlyFirstOneNeeded: false,
+          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\nc:\\default\n'
+        },
+        {
+          name: 'yarn.timeline-service.leveldb-timeline-store.path',
+          isOnlyFirstOneNeeded: true,
+          value: '/media/disk0/default'
+        },
+        {
+          name: 'dataDir',
+          isOnlyFirstOneNeeded: true,
+          value: '/media/disk0/default'
+        },
+        {
+          name: 'oozie_data_dir',
+          isOnlyFirstOneNeeded: true,
+          value: '/media/disk0/default'
+        },
+        {
+          name: 'hbase.tmp.dir',
+          isOnlyFirstOneNeeded: true,
+          value: '/media/disk0/default'
+        },
+        {
+          name: 'storm.local.dir',
+          isOnlyFirstOneNeeded: true,
+          value: '/media/disk0/default'
+        },
+        {
+          name: '*.falcon.graph.storage.directory',
+          isOnlyFirstOneNeeded: true,
+          value: '/default'
+        },
+        {
+          name: '*.falcon.graph.serialize.path',
+          isOnlyFirstOneNeeded: true,
+          value: '/default'
+        },
+        {
+          name: 'log.dirs',
+          isOnlyFirstOneNeeded: false,
+          value:  '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\n'
+        }
+      ];
+
+    beforeEach(function () {
+      sinon.stub(App.Host, 'find').returns([
+        Em.Object.create({
+          id: 'h1',
+          diskInfo: [
+            {
+              mountpoint: '/media/disk1',
+              type: 'devtmpfs'
+            },
+            {
+              mountpoint: '/media/disk1',
+              type: 'tmpfs'
+            },
+            {
+              mountpoint: '/media/disk1',
+              type: 'vboxsf'
+            },
+            {
+              mountpoint: '/media/disk1',
+              type: 'CDFS'
+            },
+            {
+              mountpoint: '/media/disk1',
+              available: '0'
+            },
+            {
+              mountpoint: '/media/disk1',
+              available: '100000000'
+            },
+            {
+              mountpoint: '/mount1',
+              available: '100000000'
+            }
+          ]
+        }),
+        Em.Object.create({
+          id: 'h2',
+          diskInfo: [
+            {
+              mountpoint: '/'
+            }
+          ]
+        }),
+        Em.Object.create({
+          id: 'h3',
+          diskInfo: []
+        })
+      ]);
+    });
+
+    afterEach(function () {
+      App.Host.find.restore();
+    });
+
+    cases.forEach(function (item) {
+      it(item.name, function () {
+        serviceConfigProperty.setProperties({
+          name: item.name,
+          defaultDirectory: '/default'
+        });
+        serviceConfigProperty.unionAllMountPoints(item.isOnlyFirstOneNeeded, localDB);
+        expect(serviceConfigProperty.get('value')).to.equal(item.value);
+        expect(serviceConfigProperty.get('defaultValue')).to.equal(item.value);
+      });
+    });
+
+  });
+
 });


[2/2] ambari git commit: AMBARI-10012. Slider View. UI can't recreate new app with same name (page refresh fixes the issue) (alexantonenko)

Posted by al...@apache.org.
AMBARI-10012. Slider View. UI can't recreate new app with same name (page refresh fixes the issue) (alexantonenko)


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

Branch: refs/heads/trunk
Commit: e8daa485f66d4c14d21d81101e79ab21ae5b3d7e
Parents: fea3315
Author: Alex Antonenko <hi...@gmail.com>
Authored: Tue Mar 10 20:32:33 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Tue Mar 10 23:42:00 2015 +0200

----------------------------------------------------------------------
 .../resources/ui/app/controllers/slider_app_controller.js     | 7 +++++--
 .../src/main/resources/ui/app/mappers/slider_apps_mapper.js   | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e8daa485/contrib/views/slider/src/main/resources/ui/app/controllers/slider_app_controller.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/slider_app_controller.js b/contrib/views/slider/src/main/resources/ui/app/controllers/slider_app_controller.js
index 0684e53..bdebf13 100644
--- a/contrib/views/slider/src/main/resources/ui/app/controllers/slider_app_controller.js
+++ b/contrib/views/slider/src/main/resources/ui/app/controllers/slider_app_controller.js
@@ -350,9 +350,10 @@ App.SliderAppController = Ember.ObjectController.extend(App.AjaxErrorHandler, {
       name: 'destroyApp',
       sender: this,
       data: {
+        model: this.get('model'),
         id: this.get('model.id')
       },
-      complete: 'destroyCompleteCallback',
+      success: 'destroySuccessCallback',
       error: 'actionErrorCallback'
     });
   },
@@ -361,7 +362,9 @@ App.SliderAppController = Ember.ObjectController.extend(App.AjaxErrorHandler, {
    * Complete-callback for "destroy app"-request
    * @method destroyCompleteCallback
    */
-  destroyCompleteCallback: function() {
+  destroySuccessCallback: function(data, opt, params) {
+    params.model.deleteRecord();
+    this.store.dematerializeRecord(params.model);
     this.transitionToRoute('slider_apps');
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8daa485/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js b/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
index 4b3fae2..44ea18d 100644
--- a/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
+++ b/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
@@ -282,7 +282,7 @@ App.SliderAppsMapper = App.Mapper.createWithMixins(App.RunPeriodically, {
     appsToDelete.forEach(function (app) {
       var appRecord = App.SliderApp.store.getById('sliderApp', app);
       if (appRecord) {
-        appRecord.destroyRecord();
+        appRecord.deleteRecord();
       }
     });
     apps.forEach(function(app) {