[xenserver] replace #connection with #service in models

connection is now deprecated as per #1415, #1392
This commit is contained in:
Sergio Rubio 2013-01-08 00:14:13 +01:00
parent 6f0f4c4349
commit f12faea594
5 changed files with 17 additions and 17 deletions

View File

@ -45,8 +45,8 @@ module Fog
def host_cpus
cpus = []
(__host_cpus || []).each do |ref|
cpu_ref = connection.get_record(ref, 'host_cpu' )
cpu_ref[:connection] = connection
cpu_ref = service.get_record(ref, 'host_cpu' )
cpu_ref[:service] = service
cpus << Fog::Compute::XenServer::HostCpu.new(cpu_ref)
end
cpus
@ -72,7 +72,7 @@ module Fog
#
def reboot(auto_disable = true)
disable if auto_disable
connection.reboot_host(reference)
service.reboot_host(reference)
end
#
@ -82,7 +82,7 @@ module Fog
# @see http://docs.vmd.citrix.com/XenServer/6.0.0/1.0/en_gb/api/?c=host
#
def disable
connection.disable_host(reference)
service.disable_host(reference)
end
#
@ -91,7 +91,7 @@ module Fog
# @see http://docs.vmd.citrix.com/XenServer/6.0.0/1.0/en_gb/api/?c=host
#
def enable
connection.enable_host(reference)
service.enable_host(reference)
end
#
@ -108,11 +108,11 @@ module Fog
#
def shutdown(auto_disable = true)
disable if auto_disable
connection.shutdown_host(reference)
service.shutdown_host(reference)
end
def set_attribute(name, *val)
data = connection.set_attribute( 'host', reference, name, *val )
data = service.set_attribute( 'host', reference, name, *val )
# Do not reload automatically for performance reasons
# We can set multiple attributes at the same time and
# then reload manually

View File

@ -27,7 +27,7 @@ module Fog
attribute :vendor
def host
connection.hosts.get __host
service.hosts.get __host
end
end

View File

@ -28,7 +28,7 @@ module Fog
end
def unplug
connection.unplug_pbd reference
service.unplug_pbd reference
end
end

View File

@ -27,7 +27,7 @@ module Fog
end
def default_sr=(sr)
connection.set_attribute( 'pool', reference, 'default_SR', sr.reference )
service.set_attribute( 'pool', reference, 'default_SR', sr.reference )
end
alias :default_storage_repository= :default_sr=
@ -36,11 +36,11 @@ module Fog
end
def suspend_image_sr=(sr)
connection.set_attribute( 'pool', reference, 'suspend_image_SR', sr.reference )
service.set_attribute( 'pool', reference, 'suspend_image_SR', sr.reference )
end
def suspend_image_sr
connection.storage_repositories.get __suspend_image_sr
service.storage_repositories.get __suspend_image_sr
end
def master
@ -48,7 +48,7 @@ module Fog
end
def set_attribute(name, *val)
data = connection.set_attribute( 'pool', reference, name, *val )
data = service.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

View File

@ -41,7 +41,7 @@ module Fog
end
def destroy
connection.destroy_sr reference
service.destroy_sr reference
end
def save
@ -59,8 +59,8 @@ module Fog
# create_sr request provides sane defaults if some attributes are
# missing
attr = connection.get_record(
connection.create_sr( host.reference,
attr = service.get_record(
service.create_sr( host.reference,
name,
type,
description || '',
@ -76,7 +76,7 @@ module Fog
end
def set_attribute(name, *val)
data = connection.set_attribute( 'SR', reference, name, *val )
data = service.set_attribute( 'SR', reference, name, *val )
# Do not reload automatically for performance reasons
# We can set multiple attributes at the same time and
# then reload manually