Permalink
Browse files

AMBARI-1059. Refactor cluster management. (yusaku)

  • Loading branch information...
1 parent 2f2ad38 commit ee1801a10bdf1a74de65b377a5b18efbd89a0df0 Yusaku Sako committed Dec 9, 2012
@@ -726,8 +726,8 @@ App.WizardStep8Controller = Em.Controller.extend({
timeout: App.timeout,
success: function (data) {
var jsonData = jQuery.parseJSON(data);
- console.log("TRACE: STep8 -> In success function for createCluster call");
- console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
+ console.log("TRACE: Step8 -> In success function for createCluster call");
+ console.log("TRACE: Step8 -> value of the received data is: " + jsonData);
},
error: function (request, ajaxOptions, error) {
@@ -755,9 +755,9 @@ App.WizardStep8Controller = Em.Controller.extend({
timeout: App.timeout,
success: function (data) {
var jsonData = jQuery.parseJSON(data);
- console.log("TRACE: STep8 -> In success function for the createService call");
- console.log("TRACE: STep8 -> value of the url is: " + url);
- console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
+ console.log("TRACE: Step8 -> In success function for the createSelectedServices call");
+ console.log("TRACE: Step8 -> value of the url is: " + url);
+ console.log("TRACE: Step8 -> value of the received data is: " + jsonData);
},
@@ -804,9 +804,9 @@ App.WizardStep8Controller = Em.Controller.extend({
timeout: App.timeout,
success: function (data) {
var jsonData = jQuery.parseJSON(data);
- console.log("TRACE: STep8 -> In success function for createComponent");
- console.log("TRACE: STep8 -> value of the url is: " + url);
- console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
+ console.log("TRACE: Step8 -> In success function for createComponents");
+ console.log("TRACE: Step8 -> value of the url is: " + url);
+ console.log("TRACE: Step8 -> value of the received data is: " + jsonData);
},
error: function (request, ajaxOptions, error) {
@@ -838,9 +838,9 @@ App.WizardStep8Controller = Em.Controller.extend({
timeout: App.timeout,
success: function (data) {
var jsonData = jQuery.parseJSON(data);
- console.log("TRACE: STep8 -> In success function for registerHostToCluster");
- console.log("TRACE: STep8 -> value of the url is: " + url);
- console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
+ console.log("TRACE: Step8 -> In success function for registerHostsToCluster");
+ console.log("TRACE: Step8 -> value of the url is: " + url);
+ console.log("TRACE: Step8 -> value of the received data is: " + jsonData);
},
@@ -926,42 +926,62 @@ App.WizardStep8Controller = Em.Controller.extend({
}
console.log('registering ' + componentName + ' to ' + JSON.stringify(hostNames));
- var hostsPredicate = hostNames.map(function (hostName) {
- return 'Hosts/host_name=' + hostName;
- }).join('|');
+ // currently we are specifying the predicate as a query string.
+ // this can hit a ~4000-character limit in Jetty server.
+ // chunk to multiple calls if needed
+ // var hostsPredicate = hostNames.map(function (hostName) {
+ // return 'Hosts/host_name=' + hostName;
+ // }).join('|');
+
+ var queryStrArr = []
+ var queryStr = '';
+ hostNames.forEach(function (hostName) {
+ queryStr += 'Hosts/host_name=' + hostName + '|';
+ if (queryStr.length > 3500) {
+ queryStrArr.push(queryStr.slice(0, -1));
+ queryStr = '';
+ }
+ });
- var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/hosts?' + hostsPredicate;
- var data = {
- "host_components": [
- {
- "HostRoles": {
- "component_name": componentName
+ if (queryStr.length > 0) {
+ queryStrArr.push(queryStr.slice(0, -1));
+ }
+
+ queryStrArr.forEach(function (queryStr) {
+ // console.log('creating host components for ' + queryStr);
+ var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/hosts?' + queryStr;
+ var data = {
+ "host_components": [
+ {
+ "HostRoles": {
+ "component_name": componentName
+ }
}
- }
- ]
- };
+ ]
+ };
- $.ajax({
- type: 'POST',
- url: url,
- async: false,
- dataType: 'text',
- timeout: App.timeout,
- data: JSON.stringify(data),
- success: function (data) {
- var jsonData = jQuery.parseJSON(data);
- console.log("TRACE: STep8 -> In success function for the createComponent with new host call");
- console.log("TRACE: STep8 -> value of the url is: " + url);
- console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
- },
+ $.ajax({
+ type: 'POST',
+ url: url,
+ async: false,
+ dataType: 'text',
+ timeout: App.timeout,
+ data: JSON.stringify(data),
+ success: function (data) {
+ var jsonData = jQuery.parseJSON(data);
+ console.log("TRACE: Step8 -> In success function for the registerHostsToComponent");
+ console.log("TRACE: Step8 -> value of the url is: " + url);
+ console.log("TRACE: Step8 -> value of the received data is: " + jsonData);
+ },
- error: function (request, ajaxOptions, error) {
- console.log('Step8: In Error ');
- console.log('Step8: Error message is: ' + request.responseText);
- },
+ error: function (request, ajaxOptions, error) {
+ console.log('Step8: In Error ');
+ console.log('Step8: Error message is: ' + request.responseText);
+ },
- statusCode: require('data/statusCodes')
- });
+ statusCode: require('data/statusCodes')
+ });
+ }, this);
},
createConfigurations: function () {
@@ -31,7 +31,7 @@
<thead>
<tr>
<th>Name</th>
- <th>Ip</th>
+ <th>IP Address</th>
<th>CPU</th>
<th>RAM</th>
<th>Disk Usage</th>
@@ -133,7 +133,7 @@
<div class="span6">
<div class="box">
<div class="box-header">
- <h4>Alerts</h4>
+ <h4>Alerts and Health Checks</h4>
<div class="btn-group">
<a class="btn" target="_blank" rel="tooltip" title="Go to Nagios" {{bindAttr href="controller.nagiosUrl"}}><i class="icon-link"></i></a>
</div>

0 comments on commit ee1801a

Please sign in to comment.