1
0
Fork 0
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:
Ohad Levy 2013-02-24 23:25:23 -08:00
commit ba335baf48
4 changed files with 20 additions and 2 deletions

View file

@ -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.

View file

@ -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

View file

@ -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]

View 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