mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #1591 from abenari/ovirt3.1
[ovirt] fix issues with oVirt 3.1 API disk locking status.
This commit is contained in:
commit
ba335baf48
4 changed files with 20 additions and 2 deletions
|
@ -42,6 +42,7 @@ module Fog
|
|||
request :list_template_volumes
|
||||
request :add_volume
|
||||
request :destroy_volume
|
||||
request :get_api_version
|
||||
|
||||
module Shared
|
||||
# converts an OVIRT object into an hash for fog to consume.
|
||||
|
|
|
@ -33,7 +33,7 @@ module Fog
|
|||
end
|
||||
|
||||
def locked?
|
||||
!!(status =~ /locked/i)
|
||||
!!(status =~ /locked/i) || (attributes[:volumes]=nil) || volumes.any?{|v| !!(v.status =~ /locked/i)}
|
||||
end
|
||||
|
||||
def stopped?
|
||||
|
@ -84,7 +84,7 @@ module Fog
|
|||
end
|
||||
|
||||
def start(options = {})
|
||||
wait_for { stopped? } if options[:blocking]
|
||||
wait_for { !locked? } if options[:blocking]
|
||||
service.vm_action(:id =>id, :action => :start)
|
||||
reload
|
||||
end
|
||||
|
|
|
@ -15,6 +15,7 @@ module Fog
|
|||
attribute :format
|
||||
attribute :sparse
|
||||
attribute :size_gb
|
||||
attribute :status
|
||||
|
||||
def size_gb
|
||||
attributes[:size_gb] ||= attributes[:size].to_i / DISK_SIZE_TO_GB if attributes[:size]
|
||||
|
|
16
lib/fog/ovirt/requests/compute/get_api_version.rb
Normal file
16
lib/fog/ovirt/requests/compute/get_api_version.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Ovirt
|
||||
class Real
|
||||
def api_version
|
||||
client.api_version
|
||||
end
|
||||
end
|
||||
class Mock
|
||||
def api_version
|
||||
"3.1"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue