@@ -16,6 +16,7 @@ const { NewlineReader } = require('../util/file_reader');
16
16
const lifecycle_utils = require ( '../util/lifecycle_utils' ) ;
17
17
const native_fs_utils = require ( '../util/native_fs_utils' ) ;
18
18
const SensitiveString = require ( '../util/sensitive_string' ) ;
19
+ const { GPFS_EXTERNAL_BINS } = require ( '../nc/nc_constants' ) ;
19
20
const { NoobaaEvent } = require ( './manage_nsfs_events_utils' ) ;
20
21
const notifications_util = require ( '../util/notifications_util' ) ;
21
22
const ManageCLIError = require ( './manage_nsfs_cli_errors' ) . ManageCLIError ;
@@ -55,6 +56,16 @@ const TIMED_OPS = Object.freeze({
55
56
* }} RuleState
56
57
*/
57
58
59
+ /**
60
+ * get_bin_path returns the full path to the binary file.
61
+ * @param {String } bin_dir
62
+ * @param {String } bin_name
63
+ * @returns {String }
64
+ */
65
+ function get_bin_path ( bin_dir , bin_name ) {
66
+ return path . join ( bin_dir , bin_name ) ;
67
+ }
68
+
58
69
class NCLifecycle {
59
70
constructor ( config_fs , options = { } ) {
60
71
this . lifecycle_config_dir_path = path . join ( config_fs . config_root , config . NC_LIFECYCLE_CONFIG_DIR_NAME ) ;
@@ -1134,7 +1145,9 @@ class NCLifecycle {
1134
1145
*/
1135
1146
async get_mount_points_map ( ) {
1136
1147
try {
1137
- const fs_list = await os_utils . exec ( `mmlsfs all -T -Y` , { return_stdout : true } ) ;
1148
+ const binary_file_path = get_bin_path ( config . NC_GPFS_BIN_DIR , GPFS_EXTERNAL_BINS . MMLSFS ) ;
1149
+ const command = `${ binary_file_path } all -T -Y` ;
1150
+ const fs_list = await os_utils . exec ( command , { return_stdout : true } ) ;
1138
1151
dbg . log2 ( 'get_mount_points fs_list res ' , fs_list ) ;
1139
1152
const lines = fs_list . trim ( ) . split ( '\n' ) ;
1140
1153
const res = { } ;
@@ -1376,15 +1389,16 @@ class NCLifecycle {
1376
1389
/**
1377
1390
* create_candidates_file_by_gpfs_ilm_policy gets the candidates by applying the ILM policy using mmapplypolicy
1378
1391
* the return value is a path to the output file that contains the candidates
1379
- * TODO - check if the output file is created - this is probablt not the correct path
1380
1392
* @param {String } mount_point_path
1381
1393
* @param {String } ilm_policy_tmp_path
1382
1394
* @returns {Promise<Void> }
1383
1395
*/
1384
1396
async create_candidates_file_by_gpfs_ilm_policy ( mount_point_path , ilm_policy_tmp_path ) {
1385
1397
try {
1386
- // TODO - understand which is better defer or prepare
1387
- const mmapply_policy_res = await os_utils . exec ( `mmapplypolicy ${ mount_point_path } -P ${ ilm_policy_tmp_path } -f ${ ILM_CANDIDATES_TMP_DIR } -I defer` , { return_stdout : true } ) ;
1398
+ const binary_file_path = get_bin_path ( config . NC_GPFS_BIN_DIR , GPFS_EXTERNAL_BINS . MMAPPLYPOLICY ) ;
1399
+ const allow_scan_on_remote = config . NC_LIFECYCLE_GPFS_ALLOW_SCAN_ON_REMOTE ? '--allow-scan-on-remote' : '' ;
1400
+ const command = `${ binary_file_path } ${ mount_point_path } -P ${ ilm_policy_tmp_path } ${ allow_scan_on_remote } -f ${ ILM_CANDIDATES_TMP_DIR } -I defer ` ;
1401
+ const mmapply_policy_res = await os_utils . exec ( command , { return_stdout : true } ) ;
1388
1402
dbg . log2 ( 'create_candidates_file_by_gpfs_ilm_policy mmapplypolicy res ' , mmapply_policy_res ) ;
1389
1403
} catch ( err ) {
1390
1404
throw new Error ( `create_candidates_file_by_gpfs_ilm_policy failed with error ${ err } ` ) ;
0 commit comments