Using xrdcp and http to write extended attributes

Hello,

I’m creating files with various bits of metadata, and I’d like to write in the extended metadata too, as fetched from the method in a previous conversation here.

Looking into the EOS source code, it appears that I can pass along eos.xattr as a field, but I can’t figure out the particular format for this value.

How does one format this string such that it’ll work with an xrdcp root://mgm/path/file?eos.xattr=... sequence?

Hi David,

I had a quick look at this but I’m afraid there is a bug which makes this functionality unusable for the moment. I’ve pushed this fix and things work file now:
https://gitlab.cern.ch/dss/eos/commit/e971c7ce898005a50b494aa57772be49d0de0c18

For example:
xrdcp -f -d 1 /etc/passwd root://localhost//eos/dev/replica/david1.dat?eos.xattr=user.acl=u:esindril:rwx

Looks like this on the MGM side:

EOS Console [root://localhost] |/eos/dev/replica/> attr ls david1.dat
user.acl="u:esindril:rwx"

Unfortunately, this will require a new release and update of the MGM unless you can build it yourself …
A new release will probably happen next week.

Cheers,
Elvin

1 Like

Thank you @esindril. For some reason I never saw an email about this reply, apologies for my delay in getting back to you.

How does one then use to set multiple metadata fields? Specify eos.xattr as a parameter for each extended attribute, so that it reads “?eos.xattr=my.attribute=foo&eos.xattr=your.attribute=baz” ?

Hi David,

No worries. Well now, looking at the functionality to add multiple xattrs in one command this can not work since it assumes the “&” is the separator. But the “&” is the default separator for the opaque tokens.
I’ve pushed another fix to use “#” as separator between multiple xattr values. This will be available in 4.5.3:
https://gitlab.cern.ch/dss/eos/commit/ce83d6b347d704c3bf3d486c5ad24367295d1e62

Now, you should be able to set multiple xattrs in one go like this:

sudo xrdcp -f -d 1 /etc/passwd "root://localhost//eos/dev/replica/davida1.dat?eos.xattr=user.acl=u:esindril:rwx#user.mask=700"                                                                                                                           
[3.236kB/3.236kB][100%][==================================================][3.236kB/s]  


EOS Console [root://localhost] |/eos/dev/replica/> attr ls davida1.dat
sys.eos.btime="1563972113.221350554"
user.acl="u:esindril:rwx"
user.mask="700"

Cheers,
Elvin