Project

General

Profile

Rgw - Snapshots » History » Version 6

Jessica Mack, 07/03/2015 09:47 PM

1 1 Jessica Mack
h1. Rgw - Snapshots
2
3 2 Jessica Mack
h3. Summary
4
5 4 Jessica Mack
*NOTE: The approach on this blueprint is outdated and needs to be revisited for Hammer development.*
6 1 Jessica Mack
 
7
RADOS supports snapshots, but RGW doesn't make this visible.  When using RADOS snapshots to implement RGW snapshots, it is very time consuming to manually reconstruct a RGW object from RADOS objects.  It should be easy to create/remove snapshots via the radosgw-admin tool and the REST API.  It should be easy to retrieve a list of snapshots.  It should be easy to retrieve an object from a particular snapshot.
8
 
9
 
10 2 Jessica Mack
h3. Owners
11
12
* Craig Lewis (Central Desktop) <clewis@centraldesktop.com> 
13
14
h3. Interested Parties
15 1 Jessica Mack
 
16 2 Jessica Mack
h3. Current Status
17
18 1 Jessica Mack
Not currently accepted.  I am planning to do this work myself, but I'm willing to work with anybody that is interested.
19
 
20
I have hacked up a demo that uses a hardcoded snapshot name.  It works remarkably well.  I believe that rados provides all the necessary functionality, and it's just a matter of letting radosgw use snapshots.
21
 
22
 
23 2 Jessica Mack
h3. Detailed Description
24 1 Jessica Mack
 
25 2 Jessica Mack
h3. Use Case
26
27 1 Jessica Mack
These snapshots are intended to be RGW wide, not per bucket.  They are intended to be controlled by the RGW administrator, not the user.  The user should be able to make use of them.
28
 
29
The primary goal is to implement RGW snapshots for backup purposes.  Mainly to provide insurance against end-user or administrative error.  Coupled with Federation, this will provide offsite backups.  Since snapshots are "online", this is not protection against malicious intent.  Malicious intent could be managed by administrator partitioning (ie, no one user has system access to all zones).
30
 
31 2 Jessica Mack
h3. Code changes
32 1 Jessica Mack
 
33
My demo hack:
34
 
35 2 Jessica Mack
<pre>
36 5 Jessica Mack
01| int RGWRados::open_bucket_pool_ctx(const string& bucket_name, const string& pool, librados::IoCtx&  io_ctx)
37
02| {
38
03|   int r = rados->ioctx_create(pool.c_str(), io_ctx);
39
04| -  if (r != -ENOENT)
40
05| +  if (r != -ENOENT) {
41
06| +    rados_snap_t snapid;
42
07| +    r = rados->ioctx_snap_lookup( "snap3", &snapid, io_ctx);
43
08| +    if (r < 0)
44
09| +      return r;
45
10| +
46
11| +    rados->ioctx_snap_set_read( snapid, io_ctx);
47
12| +
48
13|     return r;
49
14| +  }
50 2 Jessica Mack
</pre>
51 1 Jessica Mack
 
52
That's the heart of the change.  As a bonus, this change already prevents all write operations, and only allows read operations.  The rest of the work is parsing the GET parameters or HTTP headers, and passing the values around.
53
 
54
The changes to radosgw-admin and the Admin REST API are relatively straight forward.  These changes are slightly complicated by making sure that it works correctly with regions and zones.  These changes aren't technically required.  They're syntactic sugar to make managing the snapshots easier.  Everything can already be accomplished using the rados command line tool. 
55
 
56
h3. Federation
57
58
I am not planning on making snapshots replicate with radosgw-admin.  For my use case, I would prefer to have different snapshot policies on the master and slave zones.  It's a nice bonus that avoiding replication makes the change simpler. 
59
 
60 2 Jessica Mack
h3. Additional Tools
61
 
62 1 Jessica Mack
As part of this project, I intend to port a ZFS snapshot management tool to manage RGW snapshots.  I have not decided which tool yet.  The ZFS tool I currently use (zfs-snapshot-mgmt?) is written in Ruby.  I would prefer to fork a tool that is written in python, for consistency.  If I can't find a suitable python project, I'll fork zfs-snapshot-mgmt rather than implement from scratch.
63
 
64 2 Jessica Mack
It would be nice if this tool can manage both rados and radosgw snapshots, but I'm going to focus on radosgw.
65 1 Jessica Mack
 
66 6 Jessica Mack
h3. Things to discuss
67 5 Jessica Mack
68
h4. Naming Conventions
69
70 1 Jessica Mack
When extending radosgw-admin, I'm planning to add @radosgw-admin (lssnap|mksnap|rmsnap)@ commands.  I would prefer to use a sub-command, ie @radosgw-admin snap (ls|mk|rm)@, but I think it's more important to be consistent with the existing rados commands.
71
 
72 2 Jessica Mack
I'm open to discussion on this.
73 5 Jessica Mack
74
h4. Extending the S3 API
75
76 1 Jessica Mack
I would like some input on how best to add optional snapshot support to the S3 API.  I'm unsure of the best way to add Ceph only features.
77
 
78
I was thinking of using an X-Snapshot header.  It's a bit cumbersome though, and would require the user to write code to use this feature.  I think I prefer a URL parameter, eg http://bucket.ceph.com/object?snapshot=snapshot.  This would be easier to use, and  should work with s3cmd out of the box.
79
 
80
Mostly I'm looking for advice on the best way to add Ceph only extensions to the S3 API.
81
 
82 2 Jessica Mack
h3. Work items
83 1 Jessica Mack
 
84 2 Jessica Mack
h4. Coding tasks
85
86
# REST API, GET with snapshot argument
87
# REST API, GET (/|bucket|object) returning a list of snapshots
88
# REST API, verify all modifying operations fail with snapshot argument
89
# @radosgw-admin lssnap@
90
# @radosgw-admin mksnap@
91
# @radosgw-admin rmsnap@  
92
# Investigate implementation of @radosgw-admin rollback <object>@.  I suspect that implementing this will require more code that I want to write at this point.  Verify or implement.
93
# Add optional --snap argument support to radosgw-admin,  Add support in reading sub-commands, like user show, bucket list, region show, etc.  Make sure writing sub-commands fail with an error when called with --snap.
94
# Admin REST API, List Snapshots
95
# Admin REST API, Create Snapshot
96
# Admin REST API, Remove Snapshot
97
# Optional: Admin REST API, Rollback Snapshot <object>
98
# Find suitable ZFS snapshot manager, and port to manage RGW snapshots
99 1 Jessica Mack
 
100 2 Jessica Mack
h4. Documentation tasks
101
102
# Update radosgw-admin documentation for snapshots, snapshot create/remove
103
# Update Admin REST API for List/Create/Remote snapshot
104
# Update radosgw GET documentation to include the optional snapshot parameter.
105
106
h4. Deprecation tasks
107
108 3 Jessica Mack
None that I'm aware of.