step4_controller.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. require('controllers/main/admin/serviceAccounts_controller');
  20. App.RMHighAvailabilityWizardStep4Controller = App.HighAvailabilityProgressPageController.extend(App.WizardEnableDone, {
  21. name: "rMHighAvailabilityWizardStep4Controller",
  22. clusterDeployState: 'RM_HIGH_AVAILABILITY_DEPLOY',
  23. commands: ['stopRequiredServices', 'installResourceManager', 'reconfigureYARN', 'reconfigureHAWQ', 'reconfigureHDFS', 'startAllServices'],
  24. tasksMessagesPrefix: 'admin.rm_highAvailability.wizard.step',
  25. initializeTasks: function () {
  26. this._super();
  27. var numSpliced = 0;
  28. if (!App.Service.find().someProperty('serviceName', 'HAWQ')) {
  29. this.get('tasks').splice(this.get('tasks').findProperty('command', 'reconfigureHAWQ').get('id'), 1);
  30. }
  31. },
  32. stopRequiredServices: function () {
  33. this.stopServices(['HDFS']);
  34. },
  35. installResourceManager: function () {
  36. var hostName = this.get('content.rmHosts.additionalRM');
  37. this.createComponent('RESOURCEMANAGER', hostName, "YARN");
  38. },
  39. reconfigureYARN: function () {
  40. this.loadConfigsTags("Yarn");
  41. },
  42. reconfigureHAWQ: function () {
  43. this.loadConfigsTags("Hawq");
  44. },
  45. reconfigureHDFS: function () {
  46. this.loadConfigsTags("Hdfs");
  47. },
  48. loadConfigsTags: function (service) {
  49. var onLoadServiceConfigsTags = 'onLoad' + service + "ConfigsTags";
  50. App.ajax.send({
  51. name: 'config.tags',
  52. sender: this,
  53. success: onLoadServiceConfigsTags,
  54. error: 'onTaskError'
  55. });
  56. },
  57. onLoadYarnConfigsTags: function (data) {
  58. App.ajax.send({
  59. name: 'reassign.load_configs',
  60. sender: this,
  61. data: {
  62. urlParams: '(type=yarn-site&tag=' + data.Clusters.desired_configs['yarn-site'].tag + ')',
  63. type: 'yarn-site'
  64. },
  65. success: 'onLoadConfigs',
  66. error: 'onTaskError'
  67. });
  68. },
  69. onLoadHawqConfigsTags: function (data) {
  70. App.ajax.send({
  71. name: 'reassign.load_configs',
  72. sender: this,
  73. data: {
  74. urlParams: '(type=yarn-client&tag=' + data.Clusters.desired_configs['yarn-client'].tag + ')',
  75. type: 'yarn-client'
  76. },
  77. success: 'onLoadConfigs',
  78. error: 'onTaskError'
  79. });
  80. },
  81. onLoadHdfsConfigsTags: function (data) {
  82. App.ajax.send({
  83. name: 'reassign.load_configs',
  84. sender: this,
  85. data: {
  86. urlParams: '(type=core-site&tag=' + data.Clusters.desired_configs['core-site'].tag + ')',
  87. type: 'core-site'
  88. },
  89. success: 'onLoadConfigs',
  90. error: 'onTaskError'
  91. });
  92. },
  93. onLoadConfigs: function (data, opt, params) {
  94. var propertiesToAdd = this.get('content.configs').filterProperty('filename', params.type);
  95. propertiesToAdd.forEach(function (property) {
  96. data.items[0].properties[property.name] = property.value;
  97. });
  98. var configData = this.reconfigureSites([params.type], data, Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format(App.format.role('RESOURCEMANAGER')));
  99. App.ajax.send({
  100. name: 'common.service.configurations',
  101. sender: this,
  102. data: {
  103. desired_config: configData
  104. },
  105. success: 'onSaveConfigs',
  106. error: 'onTaskError'
  107. });
  108. },
  109. onSaveConfigs: function () {
  110. this.onTaskCompleted();
  111. },
  112. startAllServices: function () {
  113. this.startServices(true);
  114. }
  115. });