mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
image_pool request introduced.
This commit is contained in:
parent
754c663cb5
commit
f6fb892a62
2 changed files with 33 additions and 0 deletions
|
@ -30,6 +30,7 @@ module Fog
|
|||
request :template_pool
|
||||
request :vm_disk_snapshot
|
||||
request :vm_shutdown
|
||||
request :image_pool
|
||||
|
||||
class Mock
|
||||
include Collections
|
||||
|
|
32
lib/fog/opennebula/requests/compute/image_pool.rb
Normal file
32
lib/fog/opennebula/requests/compute/image_pool.rb
Normal file
|
@ -0,0 +1,32 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class OpenNebula
|
||||
class Real
|
||||
def image_pool(filter = { })
|
||||
|
||||
images = ::OpenNebula::ImagePool.new(client)
|
||||
if filter[:mine].nil?
|
||||
images.info!
|
||||
else
|
||||
images.info_mine!
|
||||
end # if filter[:mine].nil?
|
||||
|
||||
if not filter[:id].nil?
|
||||
images.each do |i|
|
||||
if filter[:id] == i.id
|
||||
return [ i ] # return an array with only one element - found image
|
||||
end
|
||||
end
|
||||
end
|
||||
images.delete nil
|
||||
images
|
||||
end #def image_pool
|
||||
end #class Real
|
||||
|
||||
class Mock
|
||||
def image_pool(filter = { })
|
||||
end
|
||||
end #class Mock
|
||||
end #class OpenNebula
|
||||
end #module Compute
|
||||
end #module Fog
|
Loading…
Add table
Reference in a new issue