ebs_conductor 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +17 -0
- data/LICENSE.txt +202 -0
- data/NOTICE +12 -0
- data/README.rdoc +42 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/ebs_conductor.gemspec +112 -0
- data/lib/ebs_conductor.rb +356 -0
- data/test/helper.rb +18 -0
- metadata +224 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
gem "fog", "~> 0.8.2"
|
7
|
+
gem "skeme", ">= 0"
|
8
|
+
gem "rest_connection", ">= 0.0.21"
|
9
|
+
|
10
|
+
# Add dependencies to develop your gem here.
|
11
|
+
# Include everything needed to run rake, tests, features, etc.
|
12
|
+
group :development do
|
13
|
+
gem "shoulda", ">= 0"
|
14
|
+
gem "bundler", "~> 1.0.0"
|
15
|
+
gem "jeweler", "~> 1.5.2"
|
16
|
+
gem "rcov", ">= 0"
|
17
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
180
|
+
|
181
|
+
To apply the Apache License to your work, attach the following
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
+
replaced with your own identifying information. (Don't include
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
185
|
+
comment syntax for the file format. We also recommend that a
|
186
|
+
file or class name and description of purpose be included on the
|
187
|
+
same "printed page" as the copyright notice for easier
|
188
|
+
identification within third-party archives.
|
189
|
+
|
190
|
+
Copyright 2011 Ryan J. Geyer
|
191
|
+
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
+
you may not use this file except in compliance with the License.
|
194
|
+
You may obtain a copy of the License at
|
195
|
+
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
+
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
+
See the License for the specific language governing permissions and
|
202
|
+
limitations under the License.
|
data/NOTICE
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
Copyright 2011 Ryan J. Geyer
|
2
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
you may not use this file except in compliance with the License.
|
4
|
+
You may obtain a copy of the License at
|
5
|
+
|
6
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
|
8
|
+
Unless required by applicable law or agreed to in writing, software
|
9
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
See the License for the specific language governing permissions and
|
12
|
+
limitations under the License.
|
data/README.rdoc
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
= ebs_conductor
|
2
|
+
|
3
|
+
The EBS Conductor is a library for managing Amazon Elastic Block Storage volumes and snapshots. It is designed to persist a specific set of data (a "lineage") between different compute instances.
|
4
|
+
|
5
|
+
EBS Conductor can be used on it's own, but it's most powerful when executed on an EC2 instance using Chef, and the ebs_conductor cookbook[https://github.com/rgeyer/cookbooks/tree/master/cookbooks/ebs_conductor]
|
6
|
+
|
7
|
+
== Examples
|
8
|
+
|
9
|
+
=== Attach a new 1GB blan volume in the lineage "foobar" to a linux box at /dev/sdb1
|
10
|
+
|
11
|
+
ebs_conductor = Rgeyer::Gem::EbsConductor.new('...','...')
|
12
|
+
ebs_conductor.attach_from_lineage('i-abcd1234', 'foobar', 1, '/dev/sdb1')
|
13
|
+
|
14
|
+
=== Attach a specific snapshot to a 1GB volume in the lineage "foobar" to a linux box at /devb/sdb1
|
15
|
+
|
16
|
+
ebs_conductor = Rgeyer::Gem::EbsConductor.new('...','...')
|
17
|
+
ebs_conductor.attach_from_lineage('i-abcd1234', 'foobar', 1, '/dev/sdb1' {:snapshot_id => 'snap-abcd1234'})
|
18
|
+
|
19
|
+
=== Snapshot the lineage "foobar", do not purge any old snapshots in the lineage
|
20
|
+
|
21
|
+
ebs_conductor = Rgeyer::Gem::EbsConductor.new('...','...')
|
22
|
+
ebs_conductor.snapshot_lineage('foobar')
|
23
|
+
|
24
|
+
=== Snapshot the lineage "foobar", and purge old snapshots so that only 7 remain
|
25
|
+
|
26
|
+
ebs_conductor = Rgeyer::Gem::EbsConductor.new('...','...')
|
27
|
+
ebs_conductor.snapshot_lineage('foobar', {:history_to_keep => 7})
|
28
|
+
|
29
|
+
=== Snapshot the lineage "foobar" from the specified volume_id
|
30
|
+
This is useful if you're trying to start a lineage from a "naked" instance, or if you are trying to create a new lineage from an existing one
|
31
|
+
|
32
|
+
ebs_conductor = Rgeyer::Gem::EbsConductor.new('...','...')
|
33
|
+
ebs_conductor.snapshot_lineage('foobar', {:history_to_keep => 7, :volume_id => 'vol-abcd1234'})
|
34
|
+
|
35
|
+
== List of To Do Items
|
36
|
+
* Support for stripes in a lineage
|
37
|
+
|
38
|
+
== Copyright
|
39
|
+
|
40
|
+
Copyright (c) 2011 Ryan Geyer. See LICENSE.txt for
|
41
|
+
further details.
|
42
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "ebs_conductor"
|
16
|
+
gem.homepage = "http://github.com/rgeyer/ebs_conductor"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = %Q{A RightScale/Amazon EC2 EBS library}
|
19
|
+
gem.description = IO.read(File.join(File.dirname(__FILE__), "README.rdoc"))
|
20
|
+
gem.email = "me@ryangeyer.com"
|
21
|
+
gem.authors = ["Ryan Geyer"]
|
22
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
+
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
25
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rake/testtask'
|
30
|
+
Rake::TestTask.new(:test) do |test|
|
31
|
+
test.libs << 'lib' << 'test'
|
32
|
+
test.pattern = 'test/**/test_*.rb'
|
33
|
+
test.verbose = true
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'rcov/rcovtask'
|
37
|
+
Rcov::RcovTask.new do |test|
|
38
|
+
test.libs << 'test'
|
39
|
+
test.pattern = 'test/**/test_*.rb'
|
40
|
+
test.verbose = true
|
41
|
+
end
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "ebs_conductor #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{ebs_conductor}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Ryan Geyer"]
|
12
|
+
s.date = %q{2011-06-02}
|
13
|
+
s.description = %q{= ebs_conductor
|
14
|
+
|
15
|
+
The EBS Conductor is a library for managing Amazon Elastic Block Storage volumes and snapshots. It is designed to persist a specific set of data (a "lineage") between different compute instances.
|
16
|
+
|
17
|
+
EBS Conductor can be used on it's own, but it's most powerful when executed on an EC2 instance using Chef, and the ebs_conductor cookbook[https://github.com/rgeyer/cookbooks/tree/master/cookbooks/ebs_conductor]
|
18
|
+
|
19
|
+
== Examples
|
20
|
+
|
21
|
+
=== Attach a new 1GB blan volume in the lineage "foobar" to a linux box at /dev/sdb1
|
22
|
+
|
23
|
+
ebs_conductor = Rgeyer::Gem::EbsConductor.new('...','...')
|
24
|
+
ebs_conductor.attach_from_lineage('i-abcd1234', 'foobar', 1, '/dev/sdb1')
|
25
|
+
|
26
|
+
=== Attach a specific snapshot to a 1GB volume in the lineage "foobar" to a linux box at /devb/sdb1
|
27
|
+
|
28
|
+
ebs_conductor = Rgeyer::Gem::EbsConductor.new('...','...')
|
29
|
+
ebs_conductor.attach_from_lineage('i-abcd1234', 'foobar', 1, '/dev/sdb1' {:snapshot_id => 'snap-abcd1234'})
|
30
|
+
|
31
|
+
=== Snapshot the lineage "foobar", do not purge any old snapshots in the lineage
|
32
|
+
|
33
|
+
ebs_conductor = Rgeyer::Gem::EbsConductor.new('...','...')
|
34
|
+
ebs_conductor.snapshot_lineage('foobar')
|
35
|
+
|
36
|
+
=== Snapshot the lineage "foobar", and purge old snapshots so that only 7 remain
|
37
|
+
|
38
|
+
ebs_conductor = Rgeyer::Gem::EbsConductor.new('...','...')
|
39
|
+
ebs_conductor.snapshot_lineage('foobar', {:history_to_keep => 7})
|
40
|
+
|
41
|
+
=== Snapshot the lineage "foobar" from the specified volume_id
|
42
|
+
This is useful if you're trying to start a lineage from a "naked" instance, or if you are trying to create a new lineage from an existing one
|
43
|
+
|
44
|
+
ebs_conductor = Rgeyer::Gem::EbsConductor.new('...','...')
|
45
|
+
ebs_conductor.snapshot_lineage('foobar', {:history_to_keep => 7, :volume_id => 'vol-abcd1234'})
|
46
|
+
|
47
|
+
== List of To Do Items
|
48
|
+
* Support for stripes in a lineage
|
49
|
+
|
50
|
+
== Copyright
|
51
|
+
|
52
|
+
Copyright (c) 2011 Ryan Geyer. See LICENSE.txt for
|
53
|
+
further details.
|
54
|
+
|
55
|
+
}
|
56
|
+
s.email = %q{me@ryangeyer.com}
|
57
|
+
s.extra_rdoc_files = [
|
58
|
+
"LICENSE.txt",
|
59
|
+
"README.rdoc"
|
60
|
+
]
|
61
|
+
s.files = [
|
62
|
+
".document",
|
63
|
+
"Gemfile",
|
64
|
+
"LICENSE.txt",
|
65
|
+
"NOTICE",
|
66
|
+
"README.rdoc",
|
67
|
+
"Rakefile",
|
68
|
+
"VERSION",
|
69
|
+
"ebs_conductor.gemspec",
|
70
|
+
"lib/ebs_conductor.rb",
|
71
|
+
"test/helper.rb"
|
72
|
+
]
|
73
|
+
s.homepage = %q{http://github.com/rgeyer/ebs_conductor}
|
74
|
+
s.licenses = ["MIT"]
|
75
|
+
s.require_paths = ["lib"]
|
76
|
+
s.rubygems_version = %q{1.5.2}
|
77
|
+
s.summary = %q{A RightScale/Amazon EC2 EBS library}
|
78
|
+
s.test_files = [
|
79
|
+
"test/helper.rb"
|
80
|
+
]
|
81
|
+
|
82
|
+
if s.respond_to? :specification_version then
|
83
|
+
s.specification_version = 3
|
84
|
+
|
85
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
86
|
+
s.add_runtime_dependency(%q<fog>, ["~> 0.8.2"])
|
87
|
+
s.add_runtime_dependency(%q<skeme>, [">= 0"])
|
88
|
+
s.add_runtime_dependency(%q<rest_connection>, [">= 0.0.21"])
|
89
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
90
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
91
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
92
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
93
|
+
else
|
94
|
+
s.add_dependency(%q<fog>, ["~> 0.8.2"])
|
95
|
+
s.add_dependency(%q<skeme>, [">= 0"])
|
96
|
+
s.add_dependency(%q<rest_connection>, [">= 0.0.21"])
|
97
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
98
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
99
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
100
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
101
|
+
end
|
102
|
+
else
|
103
|
+
s.add_dependency(%q<fog>, ["~> 0.8.2"])
|
104
|
+
s.add_dependency(%q<skeme>, [">= 0"])
|
105
|
+
s.add_dependency(%q<rest_connection>, [">= 0.0.21"])
|
106
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
107
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
108
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
109
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
@@ -0,0 +1,356 @@
|
|
1
|
+
# Copyright 2011 Ryan J. Geyer
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
# you may not use this file except in compliance with the License.
|
4
|
+
# You may obtain a copy of the License at
|
5
|
+
#
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
14
|
+
require 'skeme'
|
15
|
+
require 'fog'
|
16
|
+
require 'rest_connection'
|
17
|
+
require 'yaml'
|
18
|
+
|
19
|
+
module Rgeyer
|
20
|
+
module Gem
|
21
|
+
class EbsConductor
|
22
|
+
@@skeme = nil
|
23
|
+
@@fog_aws_computes = {}
|
24
|
+
@@have_rs = false
|
25
|
+
@@logger = nil
|
26
|
+
@@default_timeout = 5*60
|
27
|
+
@@timeout_backoff = [2,5,10,15]
|
28
|
+
|
29
|
+
# Instantiates a new EbsConductor
|
30
|
+
#
|
31
|
+
# Amazon Web Services (AWS) credentials are required. RightScale credentials are optional, if provided all
|
32
|
+
# objects (volumes & snapshots) will be tagged in both EC2 and RightScale
|
33
|
+
#
|
34
|
+
# == Parameters
|
35
|
+
# * *aws_access_key_id* : The access key ID for the AWS API.
|
36
|
+
# * *aws_secret_access_key* : The secret access key (password) for the AWS API.
|
37
|
+
#
|
38
|
+
# === Options
|
39
|
+
# * :rs_email => 'foo@bar.baz' : The email address of a RightScale user with permissions to tag volumes & snapshots
|
40
|
+
# * :rs_pass => 'supersecret' : The password of a RightScale user with permissions to tag volumes & snapshots
|
41
|
+
# * :rs_acct_num => 123456 : Your RightScale account number
|
42
|
+
# * :logger => A logger object
|
43
|
+
#
|
44
|
+
# == Examples
|
45
|
+
# Create an EBS conductor which will only tag objects in EC2
|
46
|
+
# Rgeyer::Gem::EbsConductor.new('...','...')
|
47
|
+
#
|
48
|
+
# Create an EBS conductor which will tag objects in EC2 and RightScale
|
49
|
+
# Rgeyer::Gem::EbsConductor.new('...','...',{:rs_email => '...', :rs_pass => '...', :rs_acct_num => 123456})
|
50
|
+
#
|
51
|
+
# Create an EBS conductor which will tag objects in EC2 and RightScale, and log to Chef::Log
|
52
|
+
# Rgeyer::Gem::EbsConductor.new('...','...',{:rs_email => '...', :rs_pass => '...', :rs_acct_num => 123456, :logger => Chef::Log })
|
53
|
+
#
|
54
|
+
def initialize(aws_access_key_id, aws_secret_access_key, options={:rs_email => nil, :rs_pass => nil, :rs_acct_num => nil})
|
55
|
+
if options[:logger]
|
56
|
+
@@logger = options[:logger]
|
57
|
+
else
|
58
|
+
@@logger = Logger.new(STDOUT)
|
59
|
+
end
|
60
|
+
|
61
|
+
@@skeme = Skeme::Skeme.new({
|
62
|
+
:aws_access_key_id => aws_access_key_id,
|
63
|
+
:aws_secret_access_key => aws_secret_access_key,
|
64
|
+
:rs_email => options[:rs_email],
|
65
|
+
:rs_pass => options[:rs_pass],
|
66
|
+
:rs_acct_num => options[:rs_acct_num]
|
67
|
+
})
|
68
|
+
|
69
|
+
if options[:rs_email] && options[:rs_pass] && options[:rs_acct_num]
|
70
|
+
::RightScale::Api::BaseExtend.class_eval <<-EOF
|
71
|
+
@@connection ||= RestConnection::Connection.new
|
72
|
+
@@connection.settings = {
|
73
|
+
:user => "#{options[:rs_email]}",
|
74
|
+
:pass => "#{options[:rs_pass]}",
|
75
|
+
:api_url => "https://my.rightscale.com/api/acct/#{options[:rs_acct_num]}",
|
76
|
+
:common_headers => {
|
77
|
+
"X_API_VERSION" => "1.0"
|
78
|
+
}
|
79
|
+
}
|
80
|
+
EOF
|
81
|
+
::RightScale::Api::Base.class_eval <<-EOF
|
82
|
+
@@connection ||= RestConnection::Connection.new
|
83
|
+
@@connection.settings = {
|
84
|
+
:user => "#{options[:rs_email]}",
|
85
|
+
:pass => "#{options[:rs_pass]}",
|
86
|
+
:api_url => "https://my.rightscale.com/api/acct/#{options[:rs_acct_num]}",
|
87
|
+
:common_headers => {
|
88
|
+
"X_API_VERSION" => "1.0"
|
89
|
+
}
|
90
|
+
}
|
91
|
+
EOF
|
92
|
+
|
93
|
+
@@have_rs = true
|
94
|
+
end
|
95
|
+
|
96
|
+
fog_aws_compute = Fog::Compute.new({:aws_access_key_id => aws_access_key_id, :aws_secret_access_key => aws_secret_access_key, :provider => 'AWS'})
|
97
|
+
fog_aws_compute.describe_regions.body['regionInfo'].each do |region|
|
98
|
+
@@fog_aws_computes.store(region['regionName'],
|
99
|
+
Fog::Compute.new({
|
100
|
+
:aws_access_key_id => aws_access_key_id,
|
101
|
+
:aws_secret_access_key => aws_secret_access_key,
|
102
|
+
:provider => 'AWS',
|
103
|
+
:host => region['regionEndpoint']
|
104
|
+
})
|
105
|
+
)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# Attaches a volume from the specified lineage to the specified EC2 instance.
|
110
|
+
#
|
111
|
+
# The source of the new volume is as follows (in order of preference)
|
112
|
+
# * A new volume from the :snapshot_id option (if supplied)
|
113
|
+
# * The newest snapshot created by ebs_conductor for the specified lineage, provided it is in the same region as the server
|
114
|
+
# * A new blank volume
|
115
|
+
#
|
116
|
+
# == Parameters
|
117
|
+
# * *instance_id* : The AWS id of the server instance which should have the new volume attached. I.E. i-[0-9a-z]{8}
|
118
|
+
# * *lineage* : The name of the lineage to attach. *NOTE*: The lineage must be unique to an AWS account to avoid problems!
|
119
|
+
# * *size_in_gb* : The size of the new volume, measured in gigabytes (GB)
|
120
|
+
# * *device* : A valid device that the new volume will be attached to. For Windows this is xvdf - xvdp, and for Linux it is /dev/sdb - /dev/sdp
|
121
|
+
#
|
122
|
+
# === Options
|
123
|
+
# * :timeout => @@default_timeout : The timeout in seconds before EBS conductor should stop waiting for a volume to be created and attached. The default is 5 minutes
|
124
|
+
# * :snapshot_id => '...' : The AWS ID of a snapshot to create the new volume from. I.E. snap-[0-9a-z]{8}
|
125
|
+
# * :tags => [] : An array of strings which will be applied as additional tags to the new volume. I.E. ["foo:bar=baz", "database:name=sweet"]
|
126
|
+
#
|
127
|
+
# == Examples
|
128
|
+
# All examples assume that a new EBS conductor has been created and is assigned to *ebs_conductor*
|
129
|
+
# ebs_conductor = Rgeyer::Gem::EbsConductor.new('...','...')
|
130
|
+
#
|
131
|
+
# Attach a new 1GB blank volume in the lineage "foobar" to a linux box at /dev/sdb1
|
132
|
+
# ebs_conductor.attach_from_lineage('i-abcd1234', 'foobar', 1, '/dev/sdb1')
|
133
|
+
#
|
134
|
+
# Attach a specific snapshot to a 1GB volume in the lineage "foobar" to a linux box at /devb/sdb1
|
135
|
+
# ebs_conductor.attach_from_lineage('i-abcd1234', 'foobar', 1, '/dev/sdb1' {:snapshot_id => 'snap-abcd1234'})
|
136
|
+
#
|
137
|
+
def attach_from_lineage(instance_id, lineage, size_in_gb, device, options={:timeout => @@default_timeout, :snapshot_id => nil, :tags => nil})
|
138
|
+
|
139
|
+
lineage_tag_key = lineage_tag(lineage)
|
140
|
+
|
141
|
+
server_hash = find_instance_by_id(instance_id)
|
142
|
+
if !server_hash
|
143
|
+
raise "Instance #{instance_id} was not found!"
|
144
|
+
end
|
145
|
+
server = server_hash[:server]
|
146
|
+
region = server_hash[:region]
|
147
|
+
|
148
|
+
snapshot_id = options[:snapshot_id]
|
149
|
+
if !options[:snapshot_id]
|
150
|
+
snapshots_in_lineage = @@fog_aws_computes[region].snapshots.select { |snap| snap.tags.keys.include? lineage_tag_key }
|
151
|
+
if snapshots_in_lineage && snapshots_in_lineage.count
|
152
|
+
latest_snap = snapshots_in_lineage.sort! { |a,b| b.created_at <=> a.created_at }.first
|
153
|
+
if latest_snap
|
154
|
+
snapshot_id = latest_snap.id
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
new_vol = server.volumes.new({:snapshot_id => snapshot_id, :size => size_in_gb, :device => device})
|
160
|
+
new_vol.save()
|
161
|
+
|
162
|
+
timeout_message = "Timed out waiting for EBS volume to be created and attached to (#{server.id}). Elapsed time was #{options[:timeout]} seconds"
|
163
|
+
block_until_timeout(timeout_message, options[:timeout]) {
|
164
|
+
keep_baking = false
|
165
|
+
server = @@fog_aws_computes[region].servers.get(instance_id)
|
166
|
+
# Check things out on AWS
|
167
|
+
check_vol = server.block_device_mapping.select { |dev| dev['volumeId'] == new_vol.id }.first
|
168
|
+
keep_baking = true if !check_vol || check_vol['status'] != "attached"
|
169
|
+
|
170
|
+
# Check things out in RS if we've got RS credentials
|
171
|
+
if @@have_rs
|
172
|
+
vol = Ec2EbsVolume.find(:first) { |vol| vol.aws_id == new_vol.id }
|
173
|
+
keep_baking = (vol == nil)
|
174
|
+
end
|
175
|
+
|
176
|
+
keep_baking
|
177
|
+
}
|
178
|
+
|
179
|
+
@@skeme.set_tag({:ec2_ebs_volume_id => new_vol.id, :tag => lineage_tag(lineage)})
|
180
|
+
if options[:tags] && options[:tags].kind_of?(Array)
|
181
|
+
options[:tags].each do |tag|
|
182
|
+
@@skeme.set_tag({:ec2_ebs_volume_id => new_vol.id, :tag => tag})
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
new_vol.id
|
187
|
+
end
|
188
|
+
|
189
|
+
# Creates a new snapshot of the specified lineage. Optionally purges previous snapshots in the lineage based on the :history_to_keep option
|
190
|
+
#
|
191
|
+
# == Parameters
|
192
|
+
# * *lineage*: The name of the lineage to snapshot. *NOTE*: The lineage must be unique to an AWS account to avoid problems!
|
193
|
+
#
|
194
|
+
# === Options
|
195
|
+
# * :timeout => @@default_timeout : The timeout in seconds before EBS conductor should stop waiting for a volume to be created and attached. The default is 5 minutes
|
196
|
+
# * :volume_id => '...' : The AWS ID of a volume to create the snapshot of. I.E. vol-[0-9a-z]{8}
|
197
|
+
# * :history_to_keep => 7 : If supplied only :history_to_keep snapshots will be kept for the lineage. If there are more than :history_to_keep snapshots for the lineage, the oldest ones are deleted
|
198
|
+
# * :tags => [] : An array of strings which will be applied as additional tags to the new snapshot. I.E. ["foo:bar=baz", "database:name=sweet"]
|
199
|
+
#
|
200
|
+
# == Examples
|
201
|
+
# All examples assume that a new EBS conductor has been created and is assigned to *ebs_conductor*
|
202
|
+
# ebs_conductor = Rgeyer::Gem::EbsConductor.new('...','...')
|
203
|
+
#
|
204
|
+
# Snapshot the lineage "foobar", do not purge any old snapshots in the lineage
|
205
|
+
# ebs_conductor.snapshot_lineage('foobar')
|
206
|
+
#
|
207
|
+
# Snapshot the lineage "foobar", and purge old snapshots so that only 7 remain
|
208
|
+
# ebs_conductor.snapshot_lineage('foobar', {:history_to_keep => 7})
|
209
|
+
#
|
210
|
+
# Snapshot the lineage "foobar" from the specified volume_id. This is useful if you're trying to start a lineage from a "naked" instance, or if you are trying to create a new lineage from an existing one
|
211
|
+
# ebs_conductor.snapshot_lineage('foobar', {:history_to_keep => 7, :volume_id => 'vol-abcd1234'})
|
212
|
+
#
|
213
|
+
def snapshot_lineage(lineage, options={:timeout => @@default_timeout, :volume_id => nil, :history_to_keep => nil, :tags => nil})
|
214
|
+
vol_hash = {}
|
215
|
+
tag_hash ={}
|
216
|
+
if options[:volume_id]
|
217
|
+
vol_by_id = find_volume_by_id(options[:volume_id])
|
218
|
+
vol_hash[vol_by_id[:region]] = [vol_by_id[:volume]]
|
219
|
+
else
|
220
|
+
vol_hash = find_volumes_by_lineage(lineage)
|
221
|
+
end
|
222
|
+
|
223
|
+
vol_hash.each do |region,vols|
|
224
|
+
# TODO: warn about multiples in a region?
|
225
|
+
vols.each do |vol|
|
226
|
+
if ["available", "in-use"].include? vol.status
|
227
|
+
description = "Created by EBS Conductor for the (#{lineage}) lineage while the volume was #{vol.server_id ? "attached to #{vol.server_id}" : "detatched"}"
|
228
|
+
|
229
|
+
excon_resp = @@fog_aws_computes[region].create_snapshot(vol.id, description)
|
230
|
+
snapshot_id = excon_resp.body['snapshotId']
|
231
|
+
|
232
|
+
tags = options[:tags] || []
|
233
|
+
tags << lineage_tag(lineage)
|
234
|
+
tag_hash[snapshot_id] = {:snapshot_tags => tags, :volume_tags => vol.tags.keys}
|
235
|
+
else
|
236
|
+
@@logger.warn("Volume (#{vol.id}) had a status of (#{vol.status}). A snapshot could not be created..")
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
timeout_message = "Timed out waiting for EBS snapshots to start from volumes [#{vol_hash.collect{|key,val| val}}]. Elapsed time was #{options[:timeout]}"
|
242
|
+
block_until_timeout(timeout_message, options[:timeout]) {
|
243
|
+
keep_baking = false
|
244
|
+
|
245
|
+
if @@have_rs
|
246
|
+
snaps = Ec2EbsSnapshot.find(:all) { |snap| tag_hash.keys.include? snap.aws_id }
|
247
|
+
keep_baking = (snaps.count != tag_hash.keys.count)
|
248
|
+
end
|
249
|
+
|
250
|
+
keep_baking
|
251
|
+
}
|
252
|
+
|
253
|
+
# TODO: check for existing lineage which may be getting overwritten. Maybe warn, maybe just tag accordingly?
|
254
|
+
tag_hash.each do |key,val|
|
255
|
+
val[:snapshot_tags].each do |tag|
|
256
|
+
@@skeme.set_tag(:ec2_ebs_snapshot_id => key, :tag => tag)
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
if options[:history_to_keep] && options[:history_to_keep].kind_of?(Integer)
|
261
|
+
@@fog_aws_computes.keys.each do |region|
|
262
|
+
snaps = find_snapshots_in_lineage(lineage, {:region => region})
|
263
|
+
snaps.each do |key,val|
|
264
|
+
val.sort! { |a,b| a.created_at <=> b.created_at }
|
265
|
+
delete_count = (val.count - options[:history_to_keep])-1
|
266
|
+
(0..delete_count).each do |idx|
|
267
|
+
vol = val[idx]
|
268
|
+
vol.destroy
|
269
|
+
@@logger.info("Deleted snapshot #{vol.id}")
|
270
|
+
end unless delete_count <= -1
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
private
|
277
|
+
|
278
|
+
def find_instance_by_id(instance_id)
|
279
|
+
@@fog_aws_computes.each do |key,val|
|
280
|
+
srv = val.servers.get(instance_id)
|
281
|
+
if srv
|
282
|
+
return { :server => srv, :region => key }
|
283
|
+
end
|
284
|
+
end
|
285
|
+
nil
|
286
|
+
end
|
287
|
+
|
288
|
+
def find_volume_by_id(volume_id, options={:region => nil})
|
289
|
+
if options[:region]
|
290
|
+
return {:volume => @@fog_aws_computes[options[:region]].volumes.get(volume_id), :region => options[:region]}
|
291
|
+
else
|
292
|
+
@@fog_aws_computes.each do |key,val|
|
293
|
+
vol = val.volumes.get(volume_id)
|
294
|
+
if vol
|
295
|
+
return {:volume => vol, :region => key}
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
nil
|
301
|
+
end
|
302
|
+
|
303
|
+
def find_volumes_by_lineage(lineage)
|
304
|
+
vols = {}
|
305
|
+
@@fog_aws_computes.each do |key,val|
|
306
|
+
volz = val.volumes
|
307
|
+
vols[key] = volz.all('tag-key' => lineage_tag(lineage))
|
308
|
+
end
|
309
|
+
|
310
|
+
vols
|
311
|
+
end
|
312
|
+
|
313
|
+
def find_snapshots_in_lineage(lineage, options={:region => nil})
|
314
|
+
snaps = {}
|
315
|
+
if options[:region] != nil
|
316
|
+
snapshots_in_lineage = @@fog_aws_computes[options[:region]].snapshots.all('tag-key' => lineage_tag(lineage))
|
317
|
+
if snapshots_in_lineage
|
318
|
+
snaps[options[:region]] = snapshots_in_lineage
|
319
|
+
end
|
320
|
+
else
|
321
|
+
@@fog_aws_computes.each do |region,compute|
|
322
|
+
snapshots_in_lineage = compute.snapshots.all('tag-key' => lineage_tag(lineage))
|
323
|
+
if snapshots_in_lineage
|
324
|
+
snaps[region] = snapshots_in_lineage
|
325
|
+
end
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
snaps
|
330
|
+
end
|
331
|
+
|
332
|
+
def block_until_timeout(timeout_message, timeout, &block)
|
333
|
+
begin
|
334
|
+
idx=0
|
335
|
+
Timeout::timeout(timeout) do
|
336
|
+
while true
|
337
|
+
if yield
|
338
|
+
sleep @@timeout_backoff[idx] || @@timeout_backoff.last
|
339
|
+
idx += 1
|
340
|
+
else
|
341
|
+
break
|
342
|
+
end
|
343
|
+
end
|
344
|
+
end
|
345
|
+
rescue Timeout::Error
|
346
|
+
raise timeout_message
|
347
|
+
end
|
348
|
+
end
|
349
|
+
|
350
|
+
def lineage_tag(lineage)
|
351
|
+
"ebs_conductor:lineage=#{lineage}"
|
352
|
+
end
|
353
|
+
|
354
|
+
end
|
355
|
+
end
|
356
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'ebs_conductor'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,224 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ebs_conductor
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Ryan Geyer
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-06-02 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
prerelease: false
|
23
|
+
type: :runtime
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 59
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 8
|
33
|
+
- 2
|
34
|
+
version: 0.8.2
|
35
|
+
name: fog
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
prerelease: false
|
39
|
+
type: :runtime
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
49
|
+
name: skeme
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
prerelease: false
|
53
|
+
type: :runtime
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 53
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
- 0
|
63
|
+
- 21
|
64
|
+
version: 0.0.21
|
65
|
+
name: rest_connection
|
66
|
+
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
prerelease: false
|
69
|
+
type: :development
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
version: "0"
|
79
|
+
name: shoulda
|
80
|
+
version_requirements: *id004
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
prerelease: false
|
83
|
+
type: :development
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 23
|
90
|
+
segments:
|
91
|
+
- 1
|
92
|
+
- 0
|
93
|
+
- 0
|
94
|
+
version: 1.0.0
|
95
|
+
name: bundler
|
96
|
+
version_requirements: *id005
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
prerelease: false
|
99
|
+
type: :development
|
100
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ~>
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
hash: 7
|
106
|
+
segments:
|
107
|
+
- 1
|
108
|
+
- 5
|
109
|
+
- 2
|
110
|
+
version: 1.5.2
|
111
|
+
name: jeweler
|
112
|
+
version_requirements: *id006
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
prerelease: false
|
115
|
+
type: :development
|
116
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
hash: 3
|
122
|
+
segments:
|
123
|
+
- 0
|
124
|
+
version: "0"
|
125
|
+
name: rcov
|
126
|
+
version_requirements: *id007
|
127
|
+
description: |+
|
128
|
+
= ebs_conductor
|
129
|
+
|
130
|
+
The EBS Conductor is a library for managing Amazon Elastic Block Storage volumes and snapshots. It is designed to persist a specific set of data (a "lineage") between different compute instances.
|
131
|
+
|
132
|
+
EBS Conductor can be used on it's own, but it's most powerful when executed on an EC2 instance using Chef, and the ebs_conductor cookbook[https://github.com/rgeyer/cookbooks/tree/master/cookbooks/ebs_conductor]
|
133
|
+
|
134
|
+
== Examples
|
135
|
+
|
136
|
+
=== Attach a new 1GB blan volume in the lineage "foobar" to a linux box at /dev/sdb1
|
137
|
+
|
138
|
+
ebs_conductor = Rgeyer::Gem::EbsConductor.new('...','...')
|
139
|
+
ebs_conductor.attach_from_lineage('i-abcd1234', 'foobar', 1, '/dev/sdb1')
|
140
|
+
|
141
|
+
=== Attach a specific snapshot to a 1GB volume in the lineage "foobar" to a linux box at /devb/sdb1
|
142
|
+
|
143
|
+
ebs_conductor = Rgeyer::Gem::EbsConductor.new('...','...')
|
144
|
+
ebs_conductor.attach_from_lineage('i-abcd1234', 'foobar', 1, '/dev/sdb1' {:snapshot_id => 'snap-abcd1234'})
|
145
|
+
|
146
|
+
=== Snapshot the lineage "foobar", do not purge any old snapshots in the lineage
|
147
|
+
|
148
|
+
ebs_conductor = Rgeyer::Gem::EbsConductor.new('...','...')
|
149
|
+
ebs_conductor.snapshot_lineage('foobar')
|
150
|
+
|
151
|
+
=== Snapshot the lineage "foobar", and purge old snapshots so that only 7 remain
|
152
|
+
|
153
|
+
ebs_conductor = Rgeyer::Gem::EbsConductor.new('...','...')
|
154
|
+
ebs_conductor.snapshot_lineage('foobar', {:history_to_keep => 7})
|
155
|
+
|
156
|
+
=== Snapshot the lineage "foobar" from the specified volume_id
|
157
|
+
This is useful if you're trying to start a lineage from a "naked" instance, or if you are trying to create a new lineage from an existing one
|
158
|
+
|
159
|
+
ebs_conductor = Rgeyer::Gem::EbsConductor.new('...','...')
|
160
|
+
ebs_conductor.snapshot_lineage('foobar', {:history_to_keep => 7, :volume_id => 'vol-abcd1234'})
|
161
|
+
|
162
|
+
== List of To Do Items
|
163
|
+
* Support for stripes in a lineage
|
164
|
+
|
165
|
+
== Copyright
|
166
|
+
|
167
|
+
Copyright (c) 2011 Ryan Geyer. See LICENSE.txt for
|
168
|
+
further details.
|
169
|
+
|
170
|
+
email: me@ryangeyer.com
|
171
|
+
executables: []
|
172
|
+
|
173
|
+
extensions: []
|
174
|
+
|
175
|
+
extra_rdoc_files:
|
176
|
+
- LICENSE.txt
|
177
|
+
- README.rdoc
|
178
|
+
files:
|
179
|
+
- .document
|
180
|
+
- Gemfile
|
181
|
+
- LICENSE.txt
|
182
|
+
- NOTICE
|
183
|
+
- README.rdoc
|
184
|
+
- Rakefile
|
185
|
+
- VERSION
|
186
|
+
- ebs_conductor.gemspec
|
187
|
+
- lib/ebs_conductor.rb
|
188
|
+
- test/helper.rb
|
189
|
+
has_rdoc: true
|
190
|
+
homepage: http://github.com/rgeyer/ebs_conductor
|
191
|
+
licenses:
|
192
|
+
- MIT
|
193
|
+
post_install_message:
|
194
|
+
rdoc_options: []
|
195
|
+
|
196
|
+
require_paths:
|
197
|
+
- lib
|
198
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
199
|
+
none: false
|
200
|
+
requirements:
|
201
|
+
- - ">="
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
hash: 3
|
204
|
+
segments:
|
205
|
+
- 0
|
206
|
+
version: "0"
|
207
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
|
+
none: false
|
209
|
+
requirements:
|
210
|
+
- - ">="
|
211
|
+
- !ruby/object:Gem::Version
|
212
|
+
hash: 3
|
213
|
+
segments:
|
214
|
+
- 0
|
215
|
+
version: "0"
|
216
|
+
requirements: []
|
217
|
+
|
218
|
+
rubyforge_project:
|
219
|
+
rubygems_version: 1.5.2
|
220
|
+
signing_key:
|
221
|
+
specification_version: 3
|
222
|
+
summary: A RightScale/Amazon EC2 EBS library
|
223
|
+
test_files:
|
224
|
+
- test/helper.rb
|