mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #375 from dylanegan/force_detach
Public API for force_detach on Fog::Compute::AWS::Volume.
This commit is contained in:
commit
2edb89c512
2 changed files with 13 additions and 12 deletions
|
@ -62,6 +62,10 @@ module Fog
|
||||||
connection.snapshots(:volume => self)
|
connection.snapshots(:volume => self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def force_detach
|
||||||
|
detach(true)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def attachmentSet=(new_attachment_set)
|
def attachmentSet=(new_attachment_set)
|
||||||
|
@ -81,25 +85,15 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def detach
|
def detach(force = false)
|
||||||
@server = nil
|
@server = nil
|
||||||
self.server_id = nil
|
self.server_id = nil
|
||||||
unless new_record?
|
unless new_record?
|
||||||
connection.detach_volume(id)
|
connection.detach_volume(id, 'Force' => force)
|
||||||
reload
|
reload
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def force_detach
|
|
||||||
@server = nil
|
|
||||||
self.server_id = nil
|
|
||||||
unless new_record?
|
|
||||||
connection.detach_volume(id, 'Force' => true)
|
|
||||||
reload
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,6 +17,13 @@ Shindo.tests("Fog::Compute[:aws] | volume", ['aws']) do
|
||||||
@instance.server = nil
|
@instance.server = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@instance.server = @server
|
||||||
|
@instance.wait_for { state == 'in-use' }
|
||||||
|
|
||||||
|
tests('#force_detach').succeeds do
|
||||||
|
@instance.force_detach
|
||||||
|
end
|
||||||
|
|
||||||
@instance.wait_for { ready? }
|
@instance.wait_for { ready? }
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue