swift icon indicating copy to clipboard operation
swift copied to clipboard

Support for storage policies

Open fcantournet opened this issue 8 years ago • 3 comments

Is there any plan to add storage polocy support ?

fcantournet avatar Nov 04 '15 17:11 fcantournet

I'm not familiar with that - can you link to the API or the docs about it?

ncw avatar Nov 04 '15 17:11 ncw

Since swift 2.0 (so that would be openstack Juno and above) you can define storage policies.

http://docs.openstack.org/developer/swift/overview_policies.html

Basically you can have several object rings in a cluster, for instance to provide a hot storage with replication, and a cold storage with erasure coding. One object ring == one storage policy. This can also be used to split your cluster geographically.

In terms of API, it means that when you create a container, you can specify the storage policy by adding a X-Storage-Policy: XXX filed in the headers. All the objects of this container will then go to the object ring corresponding.

For backward compatibility, there is a default storage policy in the configuration of the swift-proxy, so if you don't specify a storage policy in your request, it will be added by the proxy.

This also adds reponse fields when you ask for Container metadata, and for Account metadata because you have statistics about the bytes used, the number of containers and the number of objects per storage policy

fcantournet avatar Nov 04 '15 20:11 fcantournet

It is possible to create containers with policy at the moment. If you look at the docs for ContainerCreate you'll see a headers parameter. You can put a X-Storage-Policy: XXX in there and the container should be created with the right policy.

In the same way you can read the extra headers when using the Account method.

I couldn't see docs for extra headers in the Container metadata though?

None of these extra bits are in the normal API docs which is a bit confusing.

ncw avatar Nov 08 '15 18:11 ncw