2012-04-02 07:25:03 -04:00
|
|
|
require 'fog/core/model'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class XenServer
|
2012-12-22 18:21:33 -05:00
|
|
|
|
2012-04-02 07:25:03 -04:00
|
|
|
class Pool < Fog::Model
|
|
|
|
# API Reference here:
|
|
|
|
# http://docs.vmd.citrix.com/XenServer/5.6.0/1.0/en_gb/api/?c=pool
|
2012-12-22 18:21:33 -05:00
|
|
|
|
2012-04-02 07:25:03 -04:00
|
|
|
identity :reference
|
2012-12-22 18:21:33 -05:00
|
|
|
|
2012-04-02 07:25:03 -04:00
|
|
|
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
|
2012-12-22 18:21:33 -05:00
|
|
|
attribute :tags
|
2012-04-02 09:27:35 -04:00
|
|
|
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-12-22 18:21:33 -05:00
|
|
|
|
2012-04-02 07:25:03 -04:00
|
|
|
def default_sr
|
2012-12-22 18:21:33 -05:00
|
|
|
service.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)
|
2013-01-07 18:14:13 -05:00
|
|
|
service.set_attribute( 'pool', reference, 'default_SR', sr.reference )
|
2012-12-30 18:50:55 -05:00
|
|
|
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)
|
2013-01-07 18:14:13 -05:00
|
|
|
service.set_attribute( 'pool', reference, 'suspend_image_SR', sr.reference )
|
2012-12-30 18:50:55 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def suspend_image_sr
|
2013-01-07 18:14:13 -05:00
|
|
|
service.storage_repositories.get __suspend_image_sr
|
2012-12-30 18:50:55 -05:00
|
|
|
end
|
|
|
|
|
2012-04-02 09:27:35 -04:00
|
|
|
def master
|
2012-12-22 18:21:33 -05:00
|
|
|
service.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)
|
2013-01-07 18:14:13 -05:00
|
|
|
data = service.set_attribute( 'pool', reference, name, *val )
|
2012-12-30 18:50:55 -05:00
|
|
|
# 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
|
2012-12-22 18:21:33 -05:00
|
|
|
|
2012-04-02 07:25:03 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|