2012-04-02 07:25:03 -04:00
|
|
|
require 'fog/core/model'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class XenServer
|
|
|
|
|
|
|
|
class Pool < Fog::Model
|
|
|
|
# API Reference here:
|
|
|
|
# http://docs.vmd.citrix.com/XenServer/5.6.0/1.0/en_gb/api/?c=pool
|
|
|
|
|
|
|
|
identity :reference
|
|
|
|
|
|
|
|
attribute :uuid
|
2012-04-02 09:27:35 -04:00
|
|
|
attribute :name, :aliases => :name_label
|
|
|
|
attribute :description, :aliases => :name_description
|
2012-04-02 07:25:03 -04:00
|
|
|
attribute :__default_sr, :aliases => :default_SR
|
2012-04-02 09:27:35 -04:00
|
|
|
attribute :__master, :aliases => :master
|
|
|
|
attribute :tags
|
|
|
|
attribute :restrictions
|
|
|
|
attribute :ha_enabled
|
|
|
|
attribute :vswitch_controller
|
2012-12-30 18:50:55 -05:00
|
|
|
attribute :__suspend_image_sr, :aliases => :suspend_image_SR
|
2012-04-02 07:25:03 -04:00
|
|
|
|
2012-04-02 09:27:35 -04:00
|
|
|
|
2012-04-02 07:25:03 -04:00
|
|
|
def default_sr
|
2012-04-02 09:27:35 -04:00
|
|
|
connection.storage_repositories.get __default_sr
|
2012-04-02 07:25:03 -04:00
|
|
|
end
|
|
|
|
|
2012-12-30 18:50:55 -05:00
|
|
|
def default_sr=(sr)
|
|
|
|
connection.set_attribute( 'pool', reference, 'default_SR', sr.reference )
|
|
|
|
end
|
|
|
|
alias :default_storage_repository= :default_sr=
|
|
|
|
|
2012-04-02 07:25:03 -04:00
|
|
|
def default_storage_repository
|
2012-04-02 09:27:35 -04:00
|
|
|
default_sr
|
|
|
|
end
|
|
|
|
|
2012-12-30 18:50:55 -05:00
|
|
|
def suspend_image_sr=(sr)
|
|
|
|
connection.set_attribute( 'pool', reference, 'suspend_image_SR', sr.reference )
|
|
|
|
end
|
|
|
|
|
|
|
|
def suspend_image_sr
|
|
|
|
connection.storage_repositories.get __suspend_image_sr
|
|
|
|
end
|
|
|
|
|
2012-04-02 09:27:35 -04:00
|
|
|
def master
|
|
|
|
connection.hosts.get __master
|
2012-04-02 07:25:03 -04:00
|
|
|
end
|
2012-12-30 18:50:55 -05:00
|
|
|
|
|
|
|
def set_attribute(name, *val)
|
|
|
|
data = connection.set_attribute( 'pool', reference, name, *val )
|
|
|
|
# Do not reload automatically for performance reasons
|
|
|
|
# We can set multiple attributes at the same time and
|
|
|
|
# then reload manually
|
|
|
|
#reload
|
|
|
|
end
|
2012-04-02 07:25:03 -04:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|