1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

added create_snapshot method to Fog::Rackspace::BlockStorage::Volume

This commit is contained in:
Kyle Rames 2012-12-19 16:32:23 -06:00
parent 140f09472d
commit 21d5892d44
2 changed files with 12 additions and 5 deletions

View file

@ -34,6 +34,11 @@ module Fog
def snapshots
connection.snapshots.select { |s| s.volume_id == identity }
end
def create_snapshot(options={})
requires :identity
connection.snapshots.create(options.merge(:volume_id => identity))
end
def save
requires :size

View file

@ -14,12 +14,14 @@ Shindo.tests('Fog::Rackspace::BlockStorage | volume', ['rackspace']) do
end
tests('#snapshots').succeeds do
snapshot = service.snapshots.create({ :volume_id => @instance.id })
snapshot.wait_for { ready? }
begin
snapshot = @instance.create_snapshot
snapshot.wait_for(timeout=1200) { ready? }
returns(true) { @instance.snapshots.first.id == snapshot.id }
snapshot.destroy
returns(true) { @instance.snapshots.first.id == snapshot.id }
ensure
snapshot.destroy
end
end
@instance.wait_for { snapshots.empty? }