step4_controller.js 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309
  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. /**
  20. * Additional data that is used in the `Move Component Initializers`
  21. *
  22. * @typedef {object} reassignComponentDependencies
  23. * @property {string} sourceHostName host where component was before moving
  24. * @property {string} targetHostName host where component will be after moving
  25. */
  26. App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageController.extend(App.WizardEnableDone, {
  27. name: "reassignMasterWizardStep4Controller",
  28. commands: [
  29. 'stopRequiredServices',
  30. 'cleanMySqlServer',
  31. 'createHostComponents',
  32. 'putHostComponentsInMaintenanceMode',
  33. 'reconfigure',
  34. 'installHostComponents',
  35. 'startZooKeeperServers',
  36. 'startNameNode',
  37. 'stopHostComponentsInMaintenanceMode',
  38. 'deleteHostComponents',
  39. 'configureMySqlServer',
  40. 'startMySqlServer',
  41. 'startNewMySqlServer',
  42. 'startRequiredServices'
  43. ],
  44. // custom commands for Components with DB Configuration and Check
  45. commandsForDB: [
  46. 'createHostComponents',
  47. 'installHostComponents',
  48. 'configureMySqlServer',
  49. 'restartMySqlServer',
  50. 'testDBConnection',
  51. 'stopRequiredServices',
  52. 'cleanMySqlServer',
  53. 'putHostComponentsInMaintenanceMode',
  54. 'reconfigure',
  55. 'stopHostComponentsInMaintenanceMode',
  56. 'deleteHostComponents',
  57. 'configureMySqlServer',
  58. 'startRequiredServices'
  59. ],
  60. clusterDeployState: 'REASSIGN_MASTER_INSTALLING',
  61. multiTaskCounter: 0,
  62. hostComponents: [],
  63. /**
  64. * Map with lists of related services.
  65. * Used to define list of services to stop/start.
  66. */
  67. relatedServicesMap: {
  68. 'JOBTRACKER': ['PIG', 'OOZIE'],
  69. 'RESOURCEMANAGER': ['YARN', 'MAPREDUCE2', 'TEZ', 'PIG', 'OOZIE', 'SLIDER', 'SPARK'],
  70. 'APP_TIMELINE_SERVER': ['YARN', 'MAPREDUCE2', 'TEZ', 'OOZIE', 'SLIDER', 'SPARK'],
  71. 'HIVE_SERVER': ['HIVE', 'FALCON', 'ATLAS', 'OOZIE'],
  72. 'HIVE_METASTORE': ['HIVE', 'PIG', 'FALCON', 'ATLAS', 'OOZIE'],
  73. 'WEBHCAT_SERVER': ['HIVE'],
  74. 'OOZIE_SERVER': ['OOZIE', 'FALCON', 'KNOX'],
  75. 'MYSQL_SERVER': ['HIVE', 'OOZIE', 'RANGER', 'RANGER_KMS']
  76. },
  77. dbPropertyMap: {
  78. 'HIVE_SERVER': 'javax.jdo.option.ConnectionDriverName',
  79. 'HIVE_METASTORE': 'javax.jdo.option.ConnectionDriverName',
  80. 'OOZIE_SERVER': 'oozie.service.JPAService.jdbc.url'
  81. },
  82. /**
  83. * additional configs with template values
  84. * Part of value to substitute has following format: "<replace-value>"
  85. */
  86. additionalConfigsMap: [
  87. {
  88. componentName: 'RESOURCEMANAGER',
  89. configs: {
  90. 'yarn-site': {
  91. 'yarn.resourcemanager.address': '<replace-value>:8050',
  92. 'yarn.resourcemanager.admin.address': '<replace-value>:8141',
  93. 'yarn.resourcemanager.resource-tracker.address': '<replace-value>:8025',
  94. 'yarn.resourcemanager.scheduler.address': '<replace-value>:8030',
  95. 'yarn.resourcemanager.webapp.address': '<replace-value>:8088',
  96. 'yarn.resourcemanager.hostname': '<replace-value>'
  97. }
  98. }
  99. },
  100. {
  101. componentName: 'JOBTRACKER',
  102. configs: {
  103. 'mapred-site': {
  104. 'mapred.job.tracker.http.address': '<replace-value>:50030',
  105. 'mapred.job.tracker': '<replace-value>:50300'
  106. }
  107. }
  108. },
  109. {
  110. componentName: 'SECONDARY_NAMENODE',
  111. configs: {
  112. 'hdfs-site': {
  113. 'dfs.secondary.http.address': '<replace-value>:50090'
  114. }
  115. },
  116. configs_Hadoop2: {
  117. 'hdfs-site': {
  118. 'dfs.namenode.secondary.http-address': '<replace-value>:50090'
  119. }
  120. }
  121. },
  122. {
  123. componentName: 'NAMENODE',
  124. configs: {
  125. 'hdfs-site': {
  126. 'dfs.http.address': '<replace-value>:50070',
  127. 'dfs.https.address': '<replace-value>:50470'
  128. },
  129. 'core-site': {
  130. 'fs.default.name': 'hdfs://<replace-value>:8020'
  131. }
  132. },
  133. configs_Hadoop2: {
  134. 'hdfs-site': {
  135. 'dfs.namenode.rpc-address': '<replace-value>:8020',
  136. 'dfs.namenode.http-address': '<replace-value>:50070',
  137. 'dfs.namenode.https-address': '<replace-value>:50470'
  138. },
  139. 'core-site': {
  140. 'fs.defaultFS': 'hdfs://<replace-value>:8020'
  141. }
  142. }
  143. },
  144. {
  145. componentName: 'APP_TIMELINE_SERVER',
  146. configs: {
  147. 'yarn-site': {
  148. 'yarn.timeline-service.webapp.address': '<replace-value>:8188',
  149. 'yarn.timeline-service.webapp.https.address': '<replace-value>:8190',
  150. 'yarn.timeline-service.address': '<replace-value>:10200'
  151. }
  152. }
  153. },
  154. {
  155. componentName: 'OOZIE_SERVER',
  156. configs: {
  157. 'oozie-site': {
  158. 'oozie.base.url': 'http://<replace-value>:11000/oozie'
  159. },
  160. 'core-site': {
  161. 'hadoop.proxyuser.oozie.hosts': '<replace-value>'
  162. }
  163. }
  164. },
  165. {
  166. componentName: 'HIVE_METASTORE',
  167. configs: {
  168. 'hive-site': {}
  169. }
  170. },
  171. {
  172. componentName: 'MYSQL_SERVER',
  173. configs: {
  174. 'hive-site': {
  175. 'javax.jdo.option.ConnectionURL': 'jdbc:mysql://<replace-value>/hive?createDatabaseIfNotExist=true'
  176. }
  177. }
  178. },
  179. {
  180. componentName: 'METRICS_COLLECTOR',
  181. configs: {
  182. 'ams-site': {
  183. 'timeline.metrics.service.webapp.address': '<replace-value>:6188'
  184. }
  185. }
  186. },
  187. {
  188. componentName: 'HISTORYSERVER',
  189. configs: {
  190. 'mapred-site': {
  191. 'mapreduce.jobhistory.webapp.address': '<replace-value>:19888',
  192. 'mapreduce.jobhistory.address': '<replace-value>:10020'
  193. }
  194. }
  195. }
  196. ],
  197. secureConfigsMap: [
  198. {
  199. componentName: 'NAMENODE',
  200. configs: [
  201. {
  202. site: 'hdfs-site',
  203. keytab: 'dfs.namenode.keytab.file',
  204. principal: 'dfs.namenode.kerberos.principal'
  205. },
  206. {
  207. site: 'hdfs-site',
  208. keytab: 'dfs.web.authentication.kerberos.keytab',
  209. principal: 'dfs.web.authentication.kerberos.principal'
  210. }
  211. ]
  212. },
  213. {
  214. componentName: 'SECONDARY_NAMENODE',
  215. configs: [
  216. {
  217. site: 'hdfs-site',
  218. keytab: 'dfs.secondary.namenode.keytab.file',
  219. principal: 'dfs.secondary.namenode.kerberos.principal'
  220. },
  221. {
  222. site: 'hdfs-site',
  223. keytab: 'dfs.web.authentication.kerberos.keytab',
  224. principal: 'dfs.web.authentication.kerberos.principal'
  225. }
  226. ]
  227. },
  228. {
  229. componentName: 'RESOURCEMANAGER',
  230. configs: [
  231. {
  232. site: 'yarn-site',
  233. keytab: 'yarn.resourcemanager.keytab',
  234. principal: 'yarn.resourcemanager.principal'
  235. },
  236. {
  237. site: 'yarn-site',
  238. keytab: 'yarn.resourcemanager.webapp.spnego-keytab-file',
  239. principal: 'yarn.resourcemanager.webapp.spnego-principal'
  240. }
  241. ]
  242. },
  243. {
  244. componentName: 'OOZIE_SERVER',
  245. configs: [
  246. {
  247. site: 'oozie-site',
  248. keytab: 'oozie.authentication.kerberos.keytab',
  249. principal: 'oozie.authentication.kerberos.principal'
  250. },
  251. {
  252. site: 'oozie-site',
  253. keytab: 'oozie.service.HadoopAccessorService.keytab.file',
  254. principal: 'oozie.service.HadoopAccessorService.kerberos.principal'
  255. }
  256. ]
  257. },
  258. {
  259. componentName: 'WEBHCAT_SERVER',
  260. configs: [
  261. {
  262. site: 'webhcat-site',
  263. keytab: 'templeton.kerberos.keytab',
  264. principal: 'templeton.kerberos.principal'
  265. }
  266. ]
  267. },
  268. {
  269. componentName: 'HIVE_SERVER',
  270. configs: [
  271. {
  272. site: 'hive-site',
  273. keytab: 'hive.server2.authentication.kerberos.keytab',
  274. principal: 'hive.server2.authentication.kerberos.principal'
  275. },
  276. {
  277. site: 'hive-site',
  278. keytab: 'hive.server2.authentication.spnego.keytab',
  279. principal: 'hive.server2.authentication.spnego.principal'
  280. }
  281. ]
  282. },
  283. {
  284. componentName: 'HIVE_METASTORE',
  285. configs: [
  286. {
  287. site: 'hive-site',
  288. keytab: 'hive.metastore.kerberos.keytab.file',
  289. principal: 'hive.metastore.kerberos.principal'
  290. }
  291. ]
  292. }
  293. ],
  294. /**
  295. * set additional configs
  296. * configs_Hadoop2 - configs which belongs to Hadoop 2 stack only
  297. * @param configs
  298. * @param componentName
  299. * @param replaceValue
  300. * @return {Boolean}
  301. */
  302. setAdditionalConfigs: function (configs, componentName, replaceValue) {
  303. var component = this.get('additionalConfigsMap').findProperty('componentName', componentName);
  304. if (Em.isNone(component)) return false;
  305. var additionalConfigs = (component.configs_Hadoop2) ? component.configs_Hadoop2 : component.configs;
  306. for (var site in additionalConfigs) {
  307. if (additionalConfigs.hasOwnProperty(site)) {
  308. for (var property in additionalConfigs[site]) {
  309. if (additionalConfigs[site].hasOwnProperty(property)) {
  310. if (App.get('isHaEnabled') && componentName === 'NAMENODE' && (property === 'fs.defaultFS' || property === 'dfs.namenode.rpc-address')) continue;
  311. configs[site][property] = additionalConfigs[site][property].replace('<replace-value>', replaceValue);
  312. }
  313. }
  314. }
  315. }
  316. return true;
  317. },
  318. /**
  319. * load step info
  320. */
  321. loadStep: function () {
  322. if (this.get('content.reassign.component_name') === 'NAMENODE' && App.get('isHaEnabled')) {
  323. this.set('hostComponents', ['NAMENODE', 'ZKFC']);
  324. } else {
  325. this.set('hostComponents', [this.get('content.reassign.component_name')]);
  326. }
  327. this.set('serviceName', [this.get('content.reassign.service_id')]);
  328. this._super();
  329. },
  330. /**
  331. * concat host-component names into string
  332. * @return {String}
  333. */
  334. getHostComponentsNames: function () {
  335. var hostComponentsNames = '';
  336. this.get('hostComponents').forEach(function (comp, index) {
  337. hostComponentsNames += index ? '+' : '';
  338. hostComponentsNames += comp === 'ZKFC' ? comp : App.format.role(comp, false);
  339. }, this);
  340. return hostComponentsNames;
  341. },
  342. /**
  343. * remove unneeded tasks
  344. */
  345. removeUnneededTasks: function () {
  346. var componentName = this.get('content.reassign.component_name');
  347. if (this.isComponentWithDB()) {
  348. var db_type = this.get('content.databaseType');
  349. var is_remote_db = this.get('content.serviceProperties.is_remote_db');
  350. if (is_remote_db || db_type !== 'mysql') {
  351. this.removeTasks(['configureMySqlServer', 'startMySqlServer', 'restartMySqlServer', 'cleanMySqlServer', 'configureMySqlServer']);
  352. }
  353. if (db_type === 'derby') {
  354. this.removeTasks(['testDBConnection']);
  355. }
  356. }
  357. if (componentName !== 'MYSQL_SERVER' && !this.isComponentWithDB()) {
  358. this.removeTasks(['configureMySqlServer', 'startMySqlServer', 'restartMySqlServer', 'cleanMySqlServer', 'startNewMySqlServer', 'configureMySqlServer']);
  359. }
  360. if (componentName === 'MYSQL_SERVER') {
  361. this.removeTasks(['cleanMySqlServer']);
  362. }
  363. if (this.get('content.hasManualSteps')) {
  364. if (componentName === 'NAMENODE' && App.get('isHaEnabled')) {
  365. // Only for reassign NameNode with HA enabled
  366. this.removeTasks(['stopHostComponentsInMaintenanceMode', 'deleteHostComponents', 'startRequiredServices']);
  367. } else {
  368. this.removeTasks(['startZooKeeperServers', 'startNameNode', 'stopHostComponentsInMaintenanceMode', 'deleteHostComponents', 'startRequiredServices']);
  369. }
  370. } else {
  371. this.removeTasks(['startZooKeeperServers', 'startNameNode']);
  372. }
  373. if (!this.get('content.reassignComponentsInMM.length')) {
  374. this.removeTasks(['stopHostComponentsInMaintenanceMode']);
  375. }
  376. },
  377. /**
  378. * remove tasks by command name
  379. */
  380. removeTasks: function(commands) {
  381. var tasks = this.get('tasks');
  382. commands.forEach(function(command) {
  383. var cmd = tasks.filterProperty('command', command);
  384. var index = null;
  385. if (cmd.length === 0) {
  386. return false;
  387. } else {
  388. index = tasks.indexOf( cmd[0] );
  389. }
  390. tasks.splice( index, 1 );
  391. });
  392. },
  393. /**
  394. * initialize tasks
  395. */
  396. initializeTasks: function () {
  397. var commands = this.get('commands');
  398. var currentStep = App.router.get('reassignMasterController.currentStep');
  399. var hostComponentsNames = this.getHostComponentsNames();
  400. if (this.isComponentWithDB()) {
  401. commands = this.get('commandsForDB');
  402. }
  403. for (var i = 0; i < commands.length; i++) {
  404. var TaskLabel = i === 3 ? this.get('serviceName') : hostComponentsNames; //For Reconfigure task, show serviceName
  405. var title = Em.I18n.t('services.reassign.step4.tasks.' + commands[i] + '.title').format(TaskLabel);
  406. this.get('tasks').pushObject(Ember.Object.create({
  407. title: title,
  408. status: 'PENDING',
  409. id: i,
  410. command: commands[i],
  411. showRetry: false,
  412. showRollback: false,
  413. name: title,
  414. displayName: title,
  415. progress: 0,
  416. isRunning: false,
  417. hosts: []
  418. }));
  419. }
  420. this.removeUnneededTasks();
  421. this.set('isLoaded', true);
  422. },
  423. hideRollbackButton: function () {
  424. var failedTask = this.get('tasks').findProperty('showRollback');
  425. if (failedTask) {
  426. failedTask.set('showRollback', false);
  427. }
  428. }.observes('tasks.@each.showRollback'),
  429. onComponentsTasksSuccess: function () {
  430. this.decrementProperty('multiTaskCounter');
  431. if (this.get('multiTaskCounter') <= 0) {
  432. this.onTaskCompleted();
  433. }
  434. },
  435. /**
  436. * make server call to stop services
  437. */
  438. stopRequiredServices: function () {
  439. this.stopServices(this.get('relatedServicesMap')[this.get('content.reassign.component_name')], true);
  440. },
  441. createHostComponents: function () {
  442. var hostComponents = this.get('hostComponents');
  443. var hostName = this.get('content.reassignHosts.target');
  444. this.set('multiTaskCounter', hostComponents.length);
  445. for (var i = 0; i < hostComponents.length; i++) {
  446. this.createComponent(hostComponents[i], hostName, this.get('content.reassign.service_id'));
  447. }
  448. },
  449. onCreateComponent: function () {
  450. this.onComponentsTasksSuccess();
  451. },
  452. putHostComponentsInMaintenanceMode: function () {
  453. var hostComponents = this.get('hostComponents');
  454. var hostName = this.get('content.reassignHosts.source');
  455. this.set('multiTaskCounter', hostComponents.length);
  456. for (var i = 0; i < hostComponents.length; i++) {
  457. App.ajax.send({
  458. name: 'common.host.host_component.passive',
  459. sender: this,
  460. data: {
  461. hostName: hostName,
  462. passive_state: "ON",
  463. componentName: hostComponents[i]
  464. },
  465. success: 'onComponentsTasksSuccess',
  466. error: 'onTaskError'
  467. });
  468. }
  469. },
  470. installHostComponents: function () {
  471. var hostComponents = this.get('hostComponents');
  472. var hostName = this.get('content.reassignHosts.target');
  473. this.set('multiTaskCounter', hostComponents.length);
  474. for (var i = 0; i < hostComponents.length; i++) {
  475. this.updateComponent(hostComponents[i], hostName, this.get('content.reassign.service_id'), "Install", hostComponents.length);
  476. }
  477. },
  478. reconfigure: function () {
  479. this.loadConfigsTags();
  480. },
  481. loadConfigsTags: function () {
  482. App.ajax.send({
  483. name: 'config.tags',
  484. sender: this,
  485. success: 'onLoadConfigsTags',
  486. error: 'onTaskError'
  487. });
  488. },
  489. serviceToConfigSiteMap: {
  490. 'NAMENODE': ['hdfs-site', 'core-site'],
  491. 'SECONDARY_NAMENODE': ['hdfs-site', 'core-site'],
  492. 'JOBTRACKER': ['mapred-site'],
  493. 'RESOURCEMANAGER': ['yarn-site'],
  494. 'WEBHCAT_SERVER': ['webhcat-site'],
  495. 'APP_TIMELINE_SERVER': ['yarn-site', 'yarn-env'],
  496. 'OOZIE_SERVER': ['oozie-site', 'core-site', 'oozie-env'],
  497. 'HIVE_SERVER': ['hive-site', 'webhcat-site', 'hive-env', 'core-site'],
  498. 'HIVE_METASTORE': ['hive-site', 'webhcat-site', 'hive-env', 'core-site'],
  499. 'MYSQL_SERVER': ['hive-site'],
  500. 'METRICS_COLLECTOR': ['ams-site'],
  501. 'HISTORYSERVER': ['mapred-site']
  502. },
  503. /**
  504. * construct URL parameters for config call
  505. * @param componentName
  506. * @param data
  507. * @return {Array}
  508. */
  509. getConfigUrlParams: function (componentName, data) {
  510. var urlParams = [];
  511. this.get('serviceToConfigSiteMap')[componentName].forEach(function(site){
  512. urlParams.push('(type=' + site + '&tag=' + data.Clusters.desired_configs[site].tag + ')');
  513. });
  514. // specific cases for NameNode component
  515. if (componentName === 'NAMENODE') {
  516. if (App.Service.find().someProperty('serviceName', 'HBASE')) {
  517. urlParams.push('(type=hbase-site&tag=' + data.Clusters.desired_configs['hbase-site'].tag + ')');
  518. }
  519. if (App.Service.find().someProperty('serviceName', 'ACCUMULO')) {
  520. urlParams.push('(type=accumulo-site&tag=' + data.Clusters.desired_configs['accumulo-site'].tag + ')');
  521. }
  522. if (App.Service.find().someProperty('serviceName', 'HAWQ')) {
  523. urlParams.push('(type=hawq-site&tag=' + data.Clusters.desired_configs['hawq-site'].tag + ')');
  524. urlParams.push('(type=hdfs-client&tag=' + data.Clusters.desired_configs['hdfs-client'].tag + ')');
  525. }
  526. }
  527. if (componentName === 'RESOURCEMANAGER') {
  528. if (App.Service.find().someProperty('serviceName', 'HAWQ')) {
  529. urlParams.push('(type=hawq-site&tag=' + data.Clusters.desired_configs['hawq-site'].tag + ')');
  530. urlParams.push('(type=yarn-client&tag=' + data.Clusters.desired_configs['yarn-client'].tag + ')');
  531. }
  532. }
  533. return urlParams;
  534. },
  535. onLoadConfigsTags: function (data) {
  536. var urlParams = this.getConfigUrlParams(this.get('content.reassign.component_name'), data);
  537. App.ajax.send({
  538. name: 'reassign.load_configs',
  539. sender: this,
  540. data: {
  541. urlParams: urlParams.join('|')
  542. },
  543. success: 'onLoadConfigs',
  544. error: 'onTaskError'
  545. });
  546. },
  547. /**
  548. *
  549. * @returns {extendedTopologyLocalDB}
  550. * @private
  551. * @method _prepareTopologyDB
  552. */
  553. _prepareTopologyDB: function () {
  554. var ret = this.get('content').getProperties(['masterComponentHosts', 'slaveComponentHosts', 'hosts']);
  555. ret.installedServices = App.Service.find().mapProperty('serviceName');
  556. return ret;
  557. },
  558. /**
  559. * Create dependencies for Config Initializers
  560. *
  561. * @param {object} additionalDependencies some additional information that should be added
  562. * @returns {reassignComponentDependencies}
  563. * @private
  564. * @method _prepareDependencies
  565. */
  566. _prepareDependencies: function (additionalDependencies) {
  567. additionalDependencies = additionalDependencies || {};
  568. var ret = {};
  569. ret.sourceHostName = this.get('content.reassignHosts.source');
  570. ret.targetHostName = this.get('content.reassignHosts.target');
  571. return Em.merge(ret, additionalDependencies);
  572. },
  573. /**
  574. * Get additional dependencies-data for App.MoveRmConfigInitializer
  575. *
  576. * @param {object} configs
  577. * @returns {object}
  578. * @private
  579. * @method _getRmAdditionalDependencies
  580. */
  581. _getRmAdditionalDependencies: function (configs) {
  582. var ret = {};
  583. var rm1 = configs['yarn-site']['yarn.resourcemanager.hostname.rm1'];
  584. if (rm1) {
  585. ret.rm1 = rm1;
  586. }
  587. var rm2 = configs['yarn-site']['yarn.resourcemanager.hostname.rm2'];
  588. if (rm2) {
  589. ret.rm2 = rm2;
  590. }
  591. return ret;
  592. },
  593. /**
  594. * Settings used to the App.MoveOSConfigInitializer setup
  595. *
  596. * @param {object} configs
  597. * @returns {object}
  598. * @private
  599. * @method _getOsInitializerSettings
  600. */
  601. _getOsInitializerSettings: function (configs) {
  602. var ret = {};
  603. var cfg = configs['oozie-env']['oozie_user'];
  604. if (cfg) {
  605. ret.oozieUser = cfg;
  606. }
  607. return ret;
  608. },
  609. /**
  610. * Get additional dependencies-data for App.MoveNameNodeConfigInitializer
  611. *
  612. * @param {object} configs
  613. * @returns {object}
  614. * @private
  615. * @method _getNnInitializerSettings
  616. */
  617. _getNnInitializerSettings: function (configs) {
  618. var ret = {};
  619. if (App.get('isHaEnabled')) {
  620. ret.namespaceId = configs['hdfs-site']['dfs.nameservices'];
  621. ret.suffix = (configs['hdfs-site']['dfs.namenode.http-address.' + ret.namespaceId + '.nn1'] === this.get('content.reassignHosts.source') + ':50070') ? 'nn1' : 'nn2';
  622. }
  623. return ret;
  624. },
  625. /**
  626. * Settings used to the App.MoveHsConfigInitializer and App.MoveHmConfigInitializer setup
  627. *
  628. * @param {object} configs
  629. * @returns {{hiveUser: string, webhcatUser: string}}
  630. * @private
  631. * @method _getHiveInitializerSettings
  632. */
  633. _getHiveInitializerSettings: function (configs) {
  634. return {
  635. hiveUser: configs['hive-env']['hive_user'],
  636. webhcatUser: configs['hive-env']['webhcat_user']
  637. };
  638. },
  639. /**
  640. * Settings used to the App.MoveRmConfigInitializer setup
  641. *
  642. * @param {object} configs
  643. * @returns {{suffix: string}}
  644. * @private
  645. * @method _getRmInitializerSettings
  646. */
  647. _getRmInitializerSettings: function (configs) {
  648. return {
  649. suffix: configs['yarn-site']['yarn.resourcemanager.hostname.rm1'] === this.get('content.reassignHosts.source') ? 'rm1': 'rm2'
  650. };
  651. },
  652. onLoadConfigs: function (data) {
  653. // Find hawq-site.xml location
  654. var hawqSiteIndex = -1;
  655. for(var i = 0; i < data.items.length; i++){
  656. if(data.items[i].type == 'hawq-site'){
  657. hawqSiteIndex = i;
  658. break;
  659. }
  660. }
  661. // if certain services are deployed, include related site files to additionalConfigsMap and relatedServicesMap.
  662. if(hawqSiteIndex >= 0){ // if HAWQ is deployed
  663. var hawqSiteProperties = {
  664. 'hawq_rm_yarn_address': '<replace-value>:8050',
  665. 'hawq_rm_yarn_scheduler_address': '<replace-value>:8030'
  666. }
  667. var rmComponent = this.get('additionalConfigsMap').findProperty('componentName', "RESOURCEMANAGER");
  668. rmComponent.configs["hawq-site"] = hawqSiteProperties;
  669. if(data.items[hawqSiteIndex].properties["hawq_global_rm_type"].toLowerCase() === "yarn"){
  670. this.get('relatedServicesMap')['RESOURCEMANAGER'].append('HAWQ');
  671. }
  672. }
  673. var componentName = this.get('content.reassign.component_name');
  674. var targetHostName = this.get('content.reassignHosts.target');
  675. var configs = {};
  676. var secureConfigs = [];
  677. data.items.forEach(function (item) {
  678. configs[item.type] = item.properties;
  679. }, this);
  680. this.setAdditionalConfigs(configs, componentName, targetHostName);
  681. this.setSecureConfigs(secureConfigs, configs, componentName);
  682. switch (componentName) {
  683. case 'NAMENODE':
  684. App.MoveNameNodeConfigInitializer.setup(this._getNnInitializerSettings(configs));
  685. configs = this.setDynamicConfigs(configs, App.MoveNameNodeConfigInitializer);
  686. App.MoveNameNodeConfigInitializer.cleanup();
  687. break;
  688. case 'RESOURCEMANAGER':
  689. App.MoveRmConfigInitializer.setup(this._getRmInitializerSettings(configs));
  690. var additionalDependencies = this._getRmAdditionalDependencies(configs);
  691. configs = this.setDynamicConfigs(configs, App.MoveRmConfigInitializer, additionalDependencies);
  692. App.MoveRmConfigInitializer.cleanup();
  693. break;
  694. case 'HIVE_METASTORE':
  695. App.MoveHmConfigInitializer.setup(this._getHiveInitializerSettings(configs));
  696. configs = this.setDynamicConfigs(configs, App.MoveHmConfigInitializer);
  697. App.MoveHmConfigInitializer.cleanup();
  698. break;
  699. case 'HIVE_SERVER':
  700. App.MoveHsConfigInitializer.setup(this._getHiveInitializerSettings(configs));
  701. configs = this.setDynamicConfigs(configs, App.MoveHsConfigInitializer);
  702. App.MoveHsConfigInitializer.cleanup();
  703. break;
  704. case 'OOZIE_SERVER':
  705. App.MoveOSConfigInitializer.setup(this._getOsInitializerSettings(configs));
  706. configs = this.setDynamicConfigs(configs, App.MoveOSConfigInitializer);
  707. App.MoveOSConfigInitializer.cleanup();
  708. }
  709. this.saveClusterStatus(secureConfigs, this.getComponentDir(configs, componentName));
  710. this.saveConfigsToServer(configs);
  711. this.saveServiceProperties(configs);
  712. },
  713. /**
  714. * Set config values according to the new cluster topology
  715. *
  716. * @param {object} configs
  717. * @param {MoveComponentConfigInitializerClass} initializer
  718. * @param {object} [additionalDependencies={}]
  719. * @returns {object}
  720. * @method setDynamicConfigs
  721. */
  722. setDynamicConfigs: function (configs, initializer, additionalDependencies) {
  723. additionalDependencies = additionalDependencies || {};
  724. var topologyDB = this._prepareTopologyDB();
  725. var dependencies = this._prepareDependencies(additionalDependencies);
  726. Em.keys(configs).forEach(function (site) {
  727. Em.keys(configs[site]).forEach(function (config) {
  728. // temporary object for initializer
  729. var cfg = {
  730. name: config,
  731. filename: site,
  732. value: configs[site][config]
  733. };
  734. configs[site][config] = initializer.initialValue(cfg, topologyDB, dependencies).value;
  735. });
  736. });
  737. return configs;
  738. },
  739. /**
  740. * make PUT call to save configs to server
  741. * @param configs
  742. */
  743. saveConfigsToServer: function (configs) {
  744. App.ajax.send({
  745. name: 'common.across.services.configurations',
  746. sender: this,
  747. data: {
  748. data: '[' + this.getServiceConfigData(configs).toString() + ']'
  749. },
  750. success: 'onSaveConfigs',
  751. error: 'onTaskError'
  752. });
  753. },
  754. /**
  755. * gather and format config data before sending to server
  756. * @param configs
  757. * @return {Array}
  758. * @method getServiceConfigData
  759. */
  760. getServiceConfigData: function (configs) {
  761. var componentName = this.get('content.reassign.component_name');
  762. var tagName = 'version' + (new Date).getTime();
  763. var configData = Object.keys(configs).map(function (_siteName) {
  764. return {
  765. type: _siteName,
  766. tag: tagName,
  767. properties: configs[_siteName],
  768. service_config_version_note: Em.I18n.t('services.reassign.step4.save.configuration.note').format(App.format.role(componentName, false))
  769. }
  770. });
  771. var allConfigData = [];
  772. App.Service.find().forEach(function (service) {
  773. var stackService = App.StackService.find().findProperty('serviceName', service.get('serviceName'));
  774. if (stackService) {
  775. var serviceConfigData = [];
  776. Object.keys(stackService.get('configTypesRendered')).forEach(function (type) {
  777. var serviceConfigTag = configData.findProperty('type', type);
  778. if (serviceConfigTag) {
  779. serviceConfigData.pushObject(serviceConfigTag);
  780. }
  781. }, this);
  782. allConfigData.pushObject(JSON.stringify({
  783. Clusters: {
  784. desired_config: serviceConfigData
  785. }
  786. }));
  787. }
  788. }, this);
  789. return allConfigData;
  790. },
  791. /**
  792. * Get the web address port when RM HA is enabled.
  793. * @param configs
  794. * @param webAddressKey (http vs https)
  795. * */
  796. getWebAddressPort: function (configs, webAddressKey){
  797. var result = null;
  798. var rmWebAddressValue = configs['yarn-site'][webAddressKey];
  799. if(rmWebAddressValue){
  800. var tokens = rmWebAddressValue.split(":");
  801. if(tokens.length > 1){
  802. result = tokens[1];
  803. result = result.replace(/^\s+|\s+$/g, '');
  804. }
  805. }
  806. if(result) //only return non-empty result
  807. return result;
  808. else
  809. return null;
  810. },
  811. /**
  812. * set secure configs for component
  813. * @param secureConfigs
  814. * @param configs
  815. * @param componentName
  816. * @return {Boolean}
  817. */
  818. setSecureConfigs: function (secureConfigs, configs, componentName) {
  819. var securityEnabled = App.get('isKerberosEnabled');
  820. var component = this.get('secureConfigsMap').findProperty('componentName', componentName);
  821. if (Em.isNone(component) || !securityEnabled) return false;
  822. component.configs.forEach(function (config) {
  823. secureConfigs.push({
  824. keytab: configs[config.site][config.keytab],
  825. principal: configs[config.site][config.principal]
  826. });
  827. });
  828. return true;
  829. },
  830. /**
  831. * derive component directory from configurations
  832. * @param configs
  833. * @param componentName
  834. * @return {String}
  835. */
  836. getComponentDir: function (configs, componentName) {
  837. if (componentName === 'NAMENODE') {
  838. return configs['hdfs-site']['dfs.namenode.name.dir'];
  839. } else if (componentName === 'SECONDARY_NAMENODE') {
  840. return configs['hdfs-site']['dfs.namenode.checkpoint.dir'];
  841. }
  842. return '';
  843. },
  844. /**
  845. * save cluster status to server
  846. *
  847. * @param secureConfigs
  848. * @param componentDir
  849. * @return {Boolean}
  850. */
  851. saveClusterStatus: function (secureConfigs, componentDir) {
  852. if (componentDir || secureConfigs.length) {
  853. App.router.get(this.get('content.controllerName')).saveComponentDir(componentDir);
  854. App.router.get(this.get('content.controllerName')).saveSecureConfigs(secureConfigs);
  855. App.clusterStatus.setClusterStatus({
  856. clusterName: this.get('content.cluster.name'),
  857. clusterState: this.get('clusterDeployState'),
  858. wizardControllerName: this.get('content.controllerName'),
  859. localdb: App.db.data
  860. });
  861. return true;
  862. }
  863. return false;
  864. },
  865. onSaveConfigs: function () {
  866. this.onTaskCompleted();
  867. },
  868. startZooKeeperServers: function () {
  869. var components = this.get('content.masterComponentHosts').filterProperty('component', 'ZOOKEEPER_SERVER');
  870. this.updateComponent('ZOOKEEPER_SERVER', components.mapProperty('hostName'), "ZOOKEEPER", "Start");
  871. },
  872. startNameNode: function () {
  873. var components = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE');
  874. this.updateComponent('NAMENODE', components.mapProperty('hostName').without(this.get('content.reassignHosts.source')), "HDFS", "Start");
  875. },
  876. /**
  877. * make server call to start services
  878. */
  879. startRequiredServices: function () {
  880. var relatedServices = this.get('relatedServicesMap')[this.get('content.reassign.component_name')];
  881. if (relatedServices) {
  882. this.startServices(false, relatedServices, true);
  883. } else {
  884. this.startServices(true);
  885. }
  886. },
  887. /**
  888. * make DELETE call for each host component on host
  889. */
  890. deleteHostComponents: function () {
  891. var hostComponents = this.get('hostComponents');
  892. var hostName = this.get('content.reassignHosts.source');
  893. this.set('multiTaskCounter', hostComponents.length);
  894. for (var i = 0; i < hostComponents.length; i++) {
  895. App.ajax.send({
  896. name: 'common.delete.host_component',
  897. sender: this,
  898. data: {
  899. hostName: hostName,
  900. componentName: hostComponents[i]
  901. },
  902. success: 'onComponentsTasksSuccess',
  903. error: 'onDeleteHostComponentsError'
  904. });
  905. }
  906. },
  907. onDeleteHostComponentsError: function (error) {
  908. if (error.responseText.indexOf('org.apache.ambari.server.controller.spi.NoSuchResourceException') !== -1) {
  909. this.onComponentsTasksSuccess();
  910. } else {
  911. this.onTaskError();
  912. }
  913. },
  914. done: function () {
  915. if (!this.get('isSubmitDisabled')) {
  916. this.removeObserver('tasks.@each.status', this, 'onTaskStatusChange');
  917. if (this.get('content.hasManualSteps')) {
  918. App.router.send('next');
  919. } else {
  920. App.router.send('complete');
  921. }
  922. }
  923. },
  924. /**
  925. * make server call to clean MYSQL
  926. */
  927. cleanMySqlServer: function () {
  928. var hostname = App.HostComponent.find().findProperty('componentName', 'MYSQL_SERVER').get('hostName');
  929. if (this.get('content.reassign.component_name') === 'MYSQL_SERVER') {
  930. hostname = this.get('content.reassignHosts.target');
  931. }
  932. App.ajax.send({
  933. name: 'service.mysql.clean',
  934. sender: this,
  935. data: {
  936. host: hostname
  937. },
  938. success: 'startPolling',
  939. error: 'onTaskError'
  940. });
  941. },
  942. /**
  943. * make server call to configure MYSQL
  944. */
  945. configureMySqlServer : function () {
  946. var hostname = App.HostComponent.find().findProperty('componentName', 'MYSQL_SERVER').get('hostName');
  947. if (this.get('content.reassign.component_name') === 'MYSQL_SERVER') {
  948. hostname = this.get('content.reassignHosts.target');
  949. }
  950. App.ajax.send({
  951. name: 'service.mysql.configure',
  952. sender: this,
  953. data: {
  954. host: hostname
  955. },
  956. success: 'startPolling',
  957. error: 'onTaskError'
  958. });
  959. },
  960. startMySqlServer: function() {
  961. App.ajax.send({
  962. name: 'common.host.host_component.update',
  963. sender: this,
  964. data: {
  965. context: "Start MySQL Server",
  966. hostName: App.HostComponent.find().findProperty('componentName', 'MYSQL_SERVER').get('hostName'),
  967. serviceName: "HIVE",
  968. componentName: "MYSQL_SERVER",
  969. HostRoles: {
  970. state: "STARTED"
  971. }
  972. },
  973. success: 'startPolling',
  974. error: 'onTaskError'
  975. });
  976. },
  977. restartMySqlServer: function() {
  978. var context = "Restart MySql Server";
  979. var resource_filters = {
  980. component_name: "MYSQL_SERVER",
  981. hosts: App.HostComponent.find().filterProperty('componentName', 'MYSQL_SERVER').get('firstObject.hostName'),
  982. service_name: "HIVE"
  983. };
  984. var operation_level = {
  985. level: "HOST_COMPONENT",
  986. cluster_name: this.get('content.cluster.name'),
  987. service_name: "HIVE",
  988. hostcomponent_name: "MYSQL_SERVER"
  989. };
  990. App.ajax.send({
  991. name: 'restart.hostComponents',
  992. sender: this,
  993. data: {
  994. context: context,
  995. resource_filters: [resource_filters],
  996. operation_level: operation_level
  997. },
  998. success: 'startPolling',
  999. error: 'onTaskError'
  1000. });
  1001. },
  1002. startNewMySqlServer: function() {
  1003. App.ajax.send({
  1004. name: 'common.host.host_component.update',
  1005. sender: this,
  1006. data: {
  1007. context: "Start MySQL Server",
  1008. hostName: this.get('content.reassignHosts.target'),
  1009. serviceName: "HIVE",
  1010. componentName: "MYSQL_SERVER",
  1011. HostRoles: {
  1012. state: "STARTED"
  1013. }
  1014. },
  1015. success: 'startPolling',
  1016. error: 'onTaskError'
  1017. });
  1018. },
  1019. testDBConnection: function() {
  1020. this.prepareDBCheckAction();
  1021. },
  1022. isComponentWithDB: function() {
  1023. return ['HIVE_SERVER', 'HIVE_METASTORE', 'OOZIE_SERVER'].contains(this.get('content.reassign.component_name'));
  1024. },
  1025. /** @property {Object} propertiesPattern - check pattern according to type of connection properties **/
  1026. propertiesPattern: function() {
  1027. return {
  1028. user_name: /(username|dblogin)$/ig,
  1029. user_passwd: /(dbpassword|password)$/ig,
  1030. db_connection_url: /jdbc\.url|connectionurl/ig,
  1031. driver_class: /ConnectionDriverName|jdbc\.driver/ig,
  1032. schema_name: /db\.schema\.name/ig
  1033. };
  1034. }.property(),
  1035. /** @property {Object} connectionProperties - service specific config values mapped for custom action request **/
  1036. connectionProperties: function() {
  1037. var propObj = {};
  1038. for (var key in this.get('propertiesPattern')) {
  1039. propObj[key] = this.getConnectionProperty(this.get('propertiesPattern')[key]);
  1040. }
  1041. return propObj;
  1042. }.property('propertiesPattern'),
  1043. getConnectionProperty: function(regexp) {
  1044. var propertyName = this.get('requiredProperties').filter(function(item) {
  1045. return regexp.test(item);
  1046. })[0];
  1047. return this.get('content.serviceProperties')[propertyName];
  1048. },
  1049. /**
  1050. * Properties that stores in local storage used for handling
  1051. * last success connection.
  1052. *
  1053. * @property {Object} preparedDBProperties
  1054. **/
  1055. preparedDBProperties: function() {
  1056. var propObj = {};
  1057. for (var key in this.get('propertiesPattern')) {
  1058. var propValue = this.getConnectionProperty(this.get('propertiesPattern')[key]);
  1059. propObj[key] = propValue;
  1060. }
  1061. return propObj;
  1062. }.property(),
  1063. /** @property {object} requiredProperties - properties that necessary for database connection **/
  1064. requiredProperties: function() {
  1065. var propertiesMap = {
  1066. OOZIE: ['oozie.db.schema.name','oozie.service.JPAService.jdbc.username','oozie.service.JPAService.jdbc.password','oozie.service.JPAService.jdbc.driver','oozie.service.JPAService.jdbc.url'],
  1067. HIVE: ['ambari.hive.db.schema.name','javax.jdo.option.ConnectionUserName','javax.jdo.option.ConnectionPassword','javax.jdo.option.ConnectionDriverName','javax.jdo.option.ConnectionURL']
  1068. };
  1069. return propertiesMap[this.get('content.reassign.service_id')];
  1070. }.property(),
  1071. dbType: function() {
  1072. var databaseTypes = /MySQL|PostgreS|Oracle|Derby|MSSQL|Anywhere/gi;
  1073. var databaseProp = this.get('content.serviceProperties')[Em.getWithDefault(this.get('dbPropertyMap'), this.get('content.reassign.component_name'), null)];
  1074. return databaseProp.match(databaseTypes)[0];
  1075. }.property(),
  1076. prepareDBCheckAction: function() {
  1077. var params = this.get('preparedDBProperties');
  1078. var ambariProperties = App.router.get('clusterController.ambariProperties');
  1079. params['db_name'] = this.get('dbType');
  1080. params['jdk_location'] = ambariProperties['jdk_location'];
  1081. params['jdk_name'] = ambariProperties['jdk.name'];
  1082. params['java_home'] = ambariProperties['java.home'];
  1083. params['threshold'] = 60;
  1084. params['ambari_server_host'] = location.hostname;
  1085. params['check_execute_list'] = "db_connection_check";
  1086. App.ajax.send({
  1087. name: 'cluster.custom_action.create',
  1088. sender: this,
  1089. data: {
  1090. requestInfo: {
  1091. "context": "Check host",
  1092. "action": "check_host",
  1093. "parameters": params
  1094. },
  1095. filteredHosts: [this.get('content.reassignHosts.target')]
  1096. },
  1097. success: 'onCreateActionSuccess',
  1098. error: 'onTaskError'
  1099. });
  1100. },
  1101. onCreateActionSuccess: function(data) {
  1102. this.set('checkDBRequestId', data.Requests.id);
  1103. App.ajax.send({
  1104. name: 'custom_action.request',
  1105. sender: this,
  1106. data: {
  1107. requestId: this.get('checkDBRequestId')
  1108. },
  1109. success: 'setCheckDBTaskId'
  1110. });
  1111. },
  1112. setCheckDBTaskId: function(data) {
  1113. this.set('checkDBTaskId', data.items[0].Tasks.id);
  1114. this.startDBCheckPolling();
  1115. },
  1116. startDBCheckPolling: function() {
  1117. this.getDBConnTaskInfo();
  1118. },
  1119. getDBConnTaskInfo: function() {
  1120. this.setTaskStatus(this.get('currentTaskId'), 'IN_PROGRESS');
  1121. this.get('tasks').findProperty('id', this.get('currentTaskId')).set('progress', 100);
  1122. this.set('logs', []);
  1123. App.ajax.send({
  1124. name: 'custom_action.request',
  1125. sender: this,
  1126. data: {
  1127. requestId: this.get('checkDBRequestId'),
  1128. taskId: this.get('checkDBTaskId')
  1129. },
  1130. success: 'getDBConnTaskInfoSuccess'
  1131. });
  1132. },
  1133. getDBConnTaskInfoSuccess: function(data) {
  1134. var task = data.Tasks;
  1135. if (task.status === 'COMPLETED') {
  1136. var structuredOut = task.structured_out.db_connection_check;
  1137. if (structuredOut.exit_code != 0) {
  1138. this.showConnectionErrorPopup(structuredOut.message);
  1139. this.onTaskError();
  1140. } else {
  1141. this.onTaskCompleted();
  1142. }
  1143. }
  1144. if (task.status === 'FAILED') {
  1145. this.onTaskError();
  1146. }
  1147. if (/PENDING|QUEUED|IN_PROGRESS/.test(task.status)) {
  1148. Em.run.later(this, function() {
  1149. this.startDBCheckPolling();
  1150. }, 3000);
  1151. }
  1152. },
  1153. showConnectionErrorPopup: function(error) {
  1154. var popup = App.showAlertPopup('Database Connection Error');
  1155. popup.set('body', error);
  1156. },
  1157. testDBRetryTooltip: function() {
  1158. var db_host = this.get('content.serviceProperties.database_hostname');
  1159. var db_type = this.get('dbType');
  1160. var db_props = this.get('preparedDBProperties');
  1161. return Em.I18n.t('services.reassign.step4.tasks.testDBConnection.tooltip').format(
  1162. db_host, db_type, db_props['schema_name'], db_props['user_name'],
  1163. db_props['user_passwd'], db_props['driver_class'], db_props['db_connection_url']
  1164. );
  1165. }.property('dbProperties'),
  1166. saveServiceProperties: function(configs) {
  1167. App.router.get(this.get('content.controllerName')).saveServiceProperties(configs);
  1168. },
  1169. stopHostComponentsInMaintenanceMode: function () {
  1170. var hostComponentsInMM = this.get('content.reassignComponentsInMM');
  1171. var hostName = this.get('content.reassignHosts.source');
  1172. var serviceName = this.get('content.reassign.service_id');
  1173. hostComponentsInMM = hostComponentsInMM.map(function(componentName){
  1174. return {
  1175. hostName: hostName,
  1176. serviceName: serviceName,
  1177. componentName: componentName
  1178. };
  1179. });
  1180. this.set('multiTaskCounter', hostComponentsInMM.length);
  1181. this.updateComponentsState(hostComponentsInMM, 'INSTALLED');
  1182. }
  1183. });