@@ -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 ) ;
@@ -1111,7 +1122,9 @@ class NCLifecycle {
1111
1122
*/
1112
1123
async get_mount_points_map ( ) {
1113
1124
try {
1114
- const fs_list = await os_utils . exec ( `mmlsfs all -T -Y` , { return_stdout : true } ) ;
1125
+ const binary_file_path = get_bin_path ( config . NC_GPFS_BIN_DIR , GPFS_EXTERNAL_BINS . MMLSFS ) ;
1126
+ const command = `${ binary_file_path } all -T -Y` ;
1127
+ const fs_list = await os_utils . exec ( command , { return_stdout : true } ) ;
1115
1128
dbg . log2 ( 'get_mount_points fs_list res ' , fs_list ) ;
1116
1129
const lines = fs_list . trim ( ) . split ( '\n' ) ;
1117
1130
const res = { } ;
@@ -1353,15 +1366,16 @@ class NCLifecycle {
1353
1366
/**
1354
1367
* create_candidates_file_by_gpfs_ilm_policy gets the candidates by applying the ILM policy using mmapplypolicy
1355
1368
* the return value is a path to the output file that contains the candidates
1356
- * TODO - check if the output file is created - this is probablt not the correct path
1357
1369
* @param {String } mount_point_path
1358
1370
* @param {String } ilm_policy_tmp_path
1359
1371
* @returns {Promise<Void> }
1360
1372
*/
1361
1373
async create_candidates_file_by_gpfs_ilm_policy ( mount_point_path , ilm_policy_tmp_path ) {
1362
1374
try {
1363
- // TODO - understand which is better defer or prepare
1364
- 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 } ) ;
1375
+ const binary_file_path = get_bin_path ( config . NC_GPFS_BIN_DIR , GPFS_EXTERNAL_BINS . MMAPPLYPOLICY ) ;
1376
+ const allow_scan_on_remote = config . NC_LIFECYCLE_GPFS_ALLOW_SCAN_ON_REMOTE ? '--allow-scan-on-remote' : '' ;
1377
+ const command = `${ binary_file_path } ${ mount_point_path } -P ${ ilm_policy_tmp_path } ${ allow_scan_on_remote } -f ${ ILM_CANDIDATES_TMP_DIR } -I defer ` ;
1378
+ const mmapply_policy_res = await os_utils . exec ( command , { return_stdout : true } ) ;
1365
1379
dbg . log2 ( 'create_candidates_file_by_gpfs_ilm_policy mmapplypolicy res ' , mmapply_policy_res ) ;
1366
1380
} catch ( err ) {
1367
1381
throw new Error ( `create_candidates_file_by_gpfs_ilm_policy failed with error ${ err } ` ) ;
0 commit comments