1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/opennebula/models/compute/flavors.rb
Andrew Brown 2702f22e33 Improved OpenNebula support
This patch improves Fog's OpenNebula support in a number of ways:
Better NIC support in VM templates
Better ability to tune number of CPUs and memory
Ability to add/remove entries from a VM template's context section
Ability to add/remove entries from a VM template's user variables
Improved filtering for templates and NICs
2014-11-11 14:59:27 -05:00

42 lines
914 B
Ruby

require 'fog/core/collection'
require 'fog/opennebula/models/compute/flavor'
module Fog
module Compute
class OpenNebula
class Flavors < Fog::Collection
model Fog::Compute::OpenNebula::Flavor
def all
data = service.template_pool
load(data)
end
def get(flavor_id)
data = service.template_pool({:id => flavor_id})
load(data).first
rescue Fog::Compute::OpenNebula::NotFound
nil
end
def get_by_name(flavor_name)
data = service.template_pool({:name => flavor_name})
load(data)
rescue Fog::Compute::OpenNebula::NotFound
nil
end
def get_by_filter(flavor_filter)
data = service.template_pool(flavor_filter)
load(data)
rescue Fog::Compute::OpenNebula::NotFound
nil
end
end
end
end
end