mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge branch 'master' of github.com:fog/fog into cdn
This commit is contained in:
commit
99e221ad8f
9 changed files with 21 additions and 7 deletions
|
@ -19,7 +19,6 @@ module Fog
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
response = request({
|
response = request({
|
||||||
:block => block,
|
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => 'GET',
|
:method => 'GET',
|
||||||
:path => "#{Fog::HP.escape(container)}/#{Fog::HP.escape(object)}"
|
:path => "#{Fog::HP.escape(container)}/#{Fog::HP.escape(object)}"
|
||||||
|
|
|
@ -22,7 +22,6 @@ module Fog
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
response = shared_request({
|
response = shared_request({
|
||||||
:block => block,
|
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => 'GET',
|
:method => 'GET',
|
||||||
:path => path
|
:path => path
|
||||||
|
|
|
@ -17,7 +17,6 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
request(params.merge!({
|
request(params.merge!({
|
||||||
:block => block,
|
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => 'GET',
|
:method => 'GET',
|
||||||
:path => "#{Fog::OpenStack.escape(container)}/#{Fog::OpenStack.escape(object)}"
|
:path => "#{Fog::OpenStack.escape(container)}/#{Fog::OpenStack.escape(object)}"
|
||||||
|
|
|
@ -42,6 +42,7 @@ module Fog
|
||||||
request :list_template_volumes
|
request :list_template_volumes
|
||||||
request :add_volume
|
request :add_volume
|
||||||
request :destroy_volume
|
request :destroy_volume
|
||||||
|
request :get_api_version
|
||||||
|
|
||||||
module Shared
|
module Shared
|
||||||
# converts an OVIRT object into an hash for fog to consume.
|
# converts an OVIRT object into an hash for fog to consume.
|
||||||
|
|
|
@ -33,7 +33,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def locked?
|
def locked?
|
||||||
!!(status =~ /locked/i)
|
!!(status =~ /locked/i) || (attributes[:volumes]=nil) || volumes.any?{|v| !!(v.status =~ /locked/i)}
|
||||||
end
|
end
|
||||||
|
|
||||||
def stopped?
|
def stopped?
|
||||||
|
@ -84,7 +84,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def start(options = {})
|
def start(options = {})
|
||||||
wait_for { stopped? } if options[:blocking]
|
wait_for { !locked? } if options[:blocking]
|
||||||
service.vm_action(:id =>id, :action => :start)
|
service.vm_action(:id =>id, :action => :start)
|
||||||
reload
|
reload
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,6 +15,7 @@ module Fog
|
||||||
attribute :format
|
attribute :format
|
||||||
attribute :sparse
|
attribute :sparse
|
||||||
attribute :size_gb
|
attribute :size_gb
|
||||||
|
attribute :status
|
||||||
|
|
||||||
def size_gb
|
def size_gb
|
||||||
attributes[:size_gb] ||= attributes[:size].to_i / DISK_SIZE_TO_GB if attributes[:size]
|
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
|
|
@ -17,7 +17,6 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
request(params.merge!({
|
request(params.merge!({
|
||||||
:block => block,
|
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => 'GET',
|
:method => 'GET',
|
||||||
:path => "#{Fog::Rackspace.escape(container)}/#{Fog::Rackspace.escape(object)}"
|
:path => "#{Fog::Rackspace.escape(container)}/#{Fog::Rackspace.escape(object)}"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Shindo.tests('Fog::Connection', 'core') do
|
Shindo.tests('Fog::Connection', 'core') do
|
||||||
tests('user_agent').returns("fog/#{Fog::VERSION}") do
|
tests('user_agent').returns("fog/#{Fog::VERSION}") do
|
||||||
conn = Fog::Connection.new("http://www.testserviceurl.com", false, {})
|
conn = Fog::Connection.new("http://www.testserviceurl.com", false, {})
|
||||||
conn.instance_variable_get(:@excon).connection[:headers]['User-Agent']
|
conn.instance_variable_get(:@excon).data[:headers]['User-Agent']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue