Hi Gil,

Thanks for the question.  I'll start with a quick status update and encourage 
anyone interested to participate in the activates listed below as well.  IRC is 
a great place to bring up questions/discussion topics as well:


-        We're currently tracking outstanding activates on a Trello board at 
https://trello.com/b/LlvIFIQs/swift-erasure-codes-and-storage-policies

-        There's no policy code on master right now

-        All policy code is currently checked in on the feature/EC branch - the 
majorly of the work is done but there are some patches still in review, and a 
few still being coded so 100% functionality is not there yet (see Trello for 
details).

-        One the policy related items on Trello are merged, John will be 
determining at what point we merge to master and after that policy work will 
continue on master and EC work will be isolated on the feature/EC branch

-        If you grab the feature/EC branch now, you'll get basic functionality 
of policies, enough to mess around with it - the biggest missing patch (in 
final review) for evaluation is replication support.

Note that one to-do item is on the docs which we'll tackle after wrapping up 
the last of the required patches that will get us onto master.  No single patch 
right now will provide a good overview as most of the functionality is on the 
EC branch and the result of several earlier patches.   For example, the patch 
mentioned below, on its own, doesn't define policies - it was put on top of an 
already functional policy code base to better integrate with diskfile  Until 
that happens, here's some quick hints to help answer your question and 
hopefully get you, or anyone else, started messing around with them:


-        Policies is essentially support for multiple object rings.  It's an 
extremely powerful feature for being so simple in concept.  John blogged about 
it here 
https://swiftstack.com/blog/2014/01/27/openstack-swift-storage-policies/ so I 
won't spend any time describing how it can be used



-        To setup policies, you need to do the following:

o   Define your policies in swift.conf (in etc/swift).  Below is a section from 
swift.conf-sample from the pending replicator patch 
https://review.openstack.org/#/c/52194/  I use this example because it also 
includes the 'type' key which is optional but helps to see that some policies 
will be replication, others can be erasure code (future).



# storage policies are defined here and determine various characteristics

# about how objects are stored and treated.  Policies are specified by name

# on a per container basis.  The policy index is specified in the section

# header and is used internally.  Policy 0 is always used for legacy

# containers and can be given a name for use in metadata however the ring

# file name will always be 'object' for backwards compatibility.  The name

# is optional for policy 0.  A default policy is used when creating new

# containers and no policy is specified, any policy can be marked as default.

# The 'type' element is optional and if not specified will default to

# 'replication' and is important for some services, such as the replicator,

# to understand how to process the data.  For example purposes, 'replication'

# is called out explicitly below.

#[storage-policy:0]

#name = chicken

#type = replication



# the following declares a policy called 'turkey' and uses replication by

# default, the number of replicas will be determined by how the ring is built.

# In this example the 'turkey' policy could have a lower or higher # of

# replicas than the 'chicken' policy above. The ring filename will be

# 'object-1'. When a new container is created w/o a policy specified,

# it will get the 'turkey' policy because it is specified as the default

# however if a legacy container is accessed (one created with a pre-policy

# version of swift) and no policy is specified, policy 0 will be used (chicken)

#[storage-policy:1]

#name = turkey

#default = yes



-        After you've defined some policy names, and optional parameters, you 
need to setup your object rings.  The policy defined with ":0" maps to the 
object ring that everyone knows and loves today so create that the same way you 
would normally and include all of the devices that you want to participate in 
this policy



-        Next you need to create an object ring for other policies that you've 
defined.  You create them in the same way you did with the first ring except 
now you include the policy number (aka index) in the object ring name so it 
would be "object-N" where N is the index.  For example, to create the ring that 
corresponds to the turkey policy above:

o   swift-ring-builder object-1.builder create 18 3 1
               and then add the devices to this ring, using the object-1 name, 
that you want to participate in this policy


-        To use the new policy simply add the header "X-Storage-Policy" when 
creating a container and all future writes to that container will operate only 
on devices assorted with the policy specified. For example if you wanted to 
create a container that maps to the turkey policy:

o   curl -v -X PUT -H 'X-Auth-Token:AUTH_tk13909e8beb0e4b5faafc5c9c7d219c6a' -H 
"X-Storage-Policy: turkey" http://127.0.0.1:8080/v1/AUTH_test/myCont/



-        Object operations (API) do not change, the fact that you're using a 
container created with a specific policy is all that's needed



-        Note that you can't change the policy  of a container once set - 
you'll get an error if you try) but you can move object from one container to 
another where the container can, of course, have different policies



-        You will find, if you look, that the directory hierarchy on the object 
nodes is slightly different, instead of just an "objects" directory, you will 
see "objects", "objects-1", and so on.


Hopefully that answers your question and helps you, and anyone else, get 
started if you want an early look....

Thanks!
Paul





From: Gil Vernik [mailto:g...@il.ibm.com]
Sent: Saturday, February 8, 2014 11:29 PM
To: Luse, Paul E
Subject: question about storage policies for Swift

Dear Paul Luse,

I am trying to better understand your new additions to Swift about storage 
policies.
I started with your recently merged patch - Storage Policy / DiskFile Interface 
Support .
Unfortunately I find it a bit hard to understand or to find correct place where 
is the definition of storage policy itself.

Can you please, explain to me in few sentences, what is storage policy looks 
like?  Some real examples?
I see that storage_policy.py loads policies from swift.conf and each policy has 
index and name, but I don't understand how policies looks like, since i didn't 
find swift.conf and I didn't find examples in documentation.

Thanking you in advance,
Gil Vernik.
_______________________________________________
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to