You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by xi...@apache.org on 2014/03/05 00:07:35 UTC
git commit: AMBARI-4927. Decommissioned data node allows
decommissioning with NN HA enabled.
Repository: ambari
Updated Branches:
refs/heads/trunk e1aa2ddae -> db1554766
AMBARI-4927. Decommissioned data node allows decommissioning with NN HA enabled.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/db155476
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/db155476
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/db155476
Branch: refs/heads/trunk
Commit: db1554766f923daecdb321ea156f6ee5188f6a84
Parents: e1aa2dd
Author: Xi Wang <xi...@apache.org>
Authored: Mon Mar 3 16:40:07 2014 -0800
Committer: Xi Wang <xi...@apache.org>
Committed: Tue Mar 4 15:03:28 2014 -0800
----------------------------------------------------------------------
ambari-web/app/utils/ajax.js | 4 ++
.../host_component_views/datanode_view.js | 45 +++++++++++++++++++-
2 files changed, 48 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/db155476/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index bca06cb..9c39793 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -354,6 +354,10 @@ var urls = {
'real': '/clusters/{clusterName}/services/{serviceName}/components/{componentName}/?fields=ServiceComponentInfo',
'mock': ''
},
+ 'host.host_component.decommission_status_datanode': {
+ 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}?fields=metrics/dfs/namenode',
+ 'mock': ''
+ },
'host.host_component.decommission_slave': {
'real' : '/clusters/{clusterName}/requests',
'mock' : '',
http://git-wip-us.apache.org/repos/asf/ambari/blob/db155476/ambari-web/app/views/main/host/details/host_component_views/datanode_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/details/host_component_views/datanode_view.js b/ambari-web/app/views/main/host/details/host_component_views/datanode_view.js
index e0ee4f0..46f0382 100644
--- a/ambari-web/app/views/main/host/details/host_component_views/datanode_view.js
+++ b/ambari-web/app/views/main/host/details/host_component_views/datanode_view.js
@@ -23,13 +23,56 @@ App.DataNodeComponentView = App.HostComponentView.extend(App.Decommissionable, {
componentForCheckDecommission: 'NAMENODE',
/**
+ * Get component decommission status from server
+ * @returns {$.ajax}
+ */
+ getDNDecommissionStatus: function() {
+ // always get datanode decommission statue from active namenode (if NN HA enabled)
+ var hdfs = App.HDFSService.find().objectAt(0);
+ var activeNNHostName = (!hdfs.get('snameNode') && hdfs.get('activeNameNode')) ? hdfs.get('activeNameNode.hostName'): hdfs.get('nameNode.hostName');
+ return App.ajax.send({
+ name: 'host.host_component.decommission_status_datanode',
+ sender: this,
+ data: {
+ hostName: activeNNHostName,
+ componentName: this.get('componentForCheckDecommission')
+ },
+ success: 'getDNDecommissionStatusSuccessCallback',
+ error: 'getDNDecommissionStatusErrorCallback'
+ });
+ },
+
+ /**
+ * Set received value or null to <code>decommissionedStatusObject</code>
+ * @param {Object} response
+ * @returns {Object|null}
+ */
+ getDNDecommissionStatusSuccessCallback: function (response) {
+ var statusObject = response.metrics.dfs.namenode;
+ if ( statusObject != null) {
+ this.set('decommissionedStatusObject', statusObject);
+ return statusObject;
+ }
+ return null;
+ },
+
+ /**
+ * Set null to <code>decommissionedStatusObject</code> if server returns error
+ * @returns {null}
+ */
+ getDNDecommissionStatusErrorCallback: function () {
+ this.set('decommissionedStatusObject', null);
+ return null;
+ },
+
+ /**
* load Recommission/Decommission status from adminState of each live node
*/
loadComponentDecommissionStatus: function () {
var hostName = this.get('content.host.hostName');
var dfd = $.Deferred();
var self = this;
- this.getDecommissionStatus().done(function () {
+ this.getDNDecommissionStatus().done(function () {
var curObj = self.get('decommissionedStatusObject');
self.set('decommissionedStatusObject', null);
// HDP-2 stack