From 64612868dabe6c9809e000962f1b1f075ea9cc12 Mon Sep 17 00:00:00 2001 From: Sergio Rubio Date: Mon, 31 Dec 2012 00:50:55 +0100 Subject: [PATCH] [xenserver] missing Pool model attribute, new methods - Added missing suspend_image_sr attribute - added default_sr getter/setter - added suspend_image_sr getter/setter - added generic set_attribute method --- lib/fog/xenserver/models/compute/pool.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/fog/xenserver/models/compute/pool.rb b/lib/fog/xenserver/models/compute/pool.rb index d29829114..a9c580d0e 100644 --- a/lib/fog/xenserver/models/compute/pool.rb +++ b/lib/fog/xenserver/models/compute/pool.rb @@ -19,19 +19,41 @@ module Fog attribute :restrictions attribute :ha_enabled attribute :vswitch_controller + attribute :__suspend_image_sr, :aliases => :suspend_image_SR def default_sr connection.storage_repositories.get __default_sr end + def default_sr=(sr) + connection.set_attribute( 'pool', reference, 'default_SR', sr.reference ) + end + alias :default_storage_repository= :default_sr= + def default_storage_repository default_sr end + 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 + def master connection.hosts.get __master end + + 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 end