Hi Marcus,

  Something like this should do you:

RULE 'setxattr' LIST 'do_setxattr'
FOR FILESET ('xattrfileset')
WEIGHT(DIRECTORY_HASH)
ACTION(SETXATTR('user.testflag1','projectX'))
WHERE
    KB_ALLOCATED >  [insert required file size limit]


Then with one file larger and another file smaller than the limit:

root@elmo:/mmfs1/policies# getfattr -n user.testflag1 /mmfs1/data/xattrfileset/*
getfattr: Removing leading '/' from absolute path names
# file: mmfs1/data/xattrfileset/file.1
user.testflag1="projectX"

/mmfs1/data/xattrfileset/file.2: user.testflag1: No such attribute


As xattrs are a superb way of automating data operations, for those of you with our Python API have a look over the xattr examples in the git repo: https://github.com/arcapix/gpfsapi-examples as an alternative Pythonic way to achieve this.

Cheers,

Jez



On 22/11/17 03:13, Marcus Koenig wrote:
Hi there,

I've got a question around setting userdefined extended attributes. I have played around a bit with setting certain attributes via mmchattr - but now I want to run a policy to do this for me for certain filesets or file sizes.

How would I write my policy to set an attribute like user.testflag1=projectX on a number of files in a fileset that are bigger than 1G for example?

Thanks folks.

Cheers,
Marcus


_______________________________________________
gpfsug-discuss mailing list
gpfsug-discuss at spectrumscale.org
http://gpfsug.org/mailman/listinfo/gpfsug-discuss

--
*Jez Tucker*
Head of Research and Development, Pixit Media
07764193820 | [email protected] <mailto:[email protected]>
www.pixitmedia.com <http://www.pixitmedia.com> | Tw:@pixitmedia.com <https://twitter.com/PixitMedia>

--
<[email protected]>
This email is confidential in that it is intended for the exclusive attention of the addressee(s) indicated. If you are not the intended recipient, this email should not be read or disclosed to any other person. Please notify the sender immediately and delete this email from your computer system. Any opinions expressed are not necessarily those of the company from which this email was sent and, whilst to the best of our knowledge no viruses or defects exist, no responsibility can be accepted for any loss or damage arising from its receipt or subsequent use of this email.
_______________________________________________
gpfsug-discuss mailing list
gpfsug-discuss at spectrumscale.org
http://gpfsug.org/mailman/listinfo/gpfsug-discuss

Reply via email to