examples/rgw/lua/storage_class.md
This directory contains an example storage_class.lua on how to
use Lua Scripting
to read and write the Storage Class field of a put request.
# Create Storage Class
./bin/radosgw-admin zonegroup placement add --rgw-zonegroup default --placement-id default-placement --storage-class QLC_CLASS
# Steer objects in QLC_CLASS to the qlc_pool data pool
./bin/radosgw-admin zone placement add --rgw-zone default --placement-id default-placement --storage-class QLC_CLASS --data-pool qlc_pool
Restart radosgw for Zone/ZoneGroup placement changes to take effect.
Upload the script:
./bin/radosgw-admin script put --infile=storage_class.lua --context=preRequest
aws --profile=ceph --endpoint=http://localhost:8000 s3api create-bucket --bucket test-bucket
aws --profile=ceph --endpoint=http://localhost:8000 s3api put-object --bucket test-bucket --key truv-0 --body ./64KiB_object.bin --storage-class STANDARD
aws --profile=ceph --endpoint=http://localhost:8000 s3api put-object --bucket test-bucket --key truv-0 --body ./64KiB_object.bin
NOTE: If you use s3cmd instead of aws command-line, s3cmd adds "STANDARD" StorageClass to any put request so the example Lua script will not modify it.
grep Lua ceph/build/out/radosgw.8000.log
2021-11-01T17:10:14.048-0400 7f9c7f697640 20 Lua INFO: Put_Obj with StorageClass:
2021-11-01T17:10:14.048-0400 7f9c7f697640 20 Lua INFO: No StorageClass for Object and size >= threshold: truv-0 adding QLC StorageClass