2012-04-09 09:42:58 -04:00
|
|
|
require 'fog/core/collection'
|
|
|
|
require 'fog/ovirt/models/compute/volume'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class Ovirt
|
|
|
|
|
|
|
|
class Volumes < Fog::Collection
|
|
|
|
|
|
|
|
model Fog::Compute::Ovirt::Volume
|
|
|
|
|
|
|
|
attr_accessor :vm
|
|
|
|
|
|
|
|
def all(filters = {})
|
|
|
|
requires :vm
|
|
|
|
if vm.is_a? Fog::Compute::Ovirt::Server
|
2012-12-22 18:24:20 -05:00
|
|
|
load service.list_vm_volumes(vm.id)
|
2012-04-09 09:42:58 -04:00
|
|
|
elsif vm.is_a? Fog::Compute::Ovirt::Template
|
2012-12-22 18:24:20 -05:00
|
|
|
load service.list_template_volumes(vm.id)
|
2012-04-09 09:42:58 -04:00
|
|
|
else
|
|
|
|
raise 'volumes should have vm or template'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(id)
|
2012-12-22 18:24:20 -05:00
|
|
|
new service.get_volume(id)
|
2012-04-09 09:42:58 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|