-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsetexpire.pol
29 lines (25 loc) · 1.03 KB
/
setexpire.pol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* exclude list */
define( exclude_list,
(PATH_NAME LIKE '%/.SpaceMan/%' OR
PATH_NAME LIKE '%/.ltfsee/%' OR
PATH_NAME LIKE '%/.mmSharedTmpDir/%' OR
PATH_NAME LIKE '%.mmbackupCfg/%' OR
PATH_NAME LIKE '%/.snapshots/%' OR
NAME LIKE '.mmbackupShadow%' OR
NAME LIKE 'mmbackup%')
)
/* define is_migrated */
define(is_migrated, (MISC_ATTRIBUTES LIKE '%V%'))
/* list files with restore request that are not migrated and invoke setExpire script to set user.noobaa.restore.expiry and remove user.noobaa.restore.request */
RULE 'extlist' EXTERNAL LIST 'setExpiry' EXEC '/path-to/setExpire.sh'
RULE 'listFiles' LIST 'setExpiry' FOR FILESET('buckets') WHERE
NOT (exclude_list) AND
xattr('user.storage_class') = 'GLACIER' AND
NOT (is_migrated) AND
xattr('user.noobaa.restore.request') IS NOT NULL
/*Invokation:
# mmapplypolicy [path-or-device] -P setexpire.pol -m [num] -N [nodes] -B [bucket-size] --single-instance
-m number of parallel threads per node
-N nodes exuting the policy
-B bucket-size per thread, between 1000 and 20000
*/