1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[xenserver] added missing host_cpus attribute to Host model

This commit is contained in:
Sergio Rubio 2013-01-07 22:35:53 +01:00
parent e98dbf7f68
commit 905ff04e6d

View file

@ -22,7 +22,8 @@ module Fog
attribute :__pbds, :aliases => :PBDs attribute :__pbds, :aliases => :PBDs
attribute :__pifs, :aliases => :PIFs attribute :__pifs, :aliases => :PIFs
attribute :__resident_vms, :aliases => :resident_VMs attribute :__resident_vms, :aliases => :resident_VMs
attribute :__host_cpus, :aliases => :host_CPUs
def pifs def pifs
__pifs.collect { |pif| service.pifs.get pif } __pifs.collect { |pif| service.pifs.get pif }
end end
@ -39,6 +40,16 @@ module Fog
resident_servers resident_servers
end end
def host_cpus
cpus = []
(__host_cpus || []).each do |ref|
cpu_ref = connection.get_record(ref, 'host_cpu' )
cpu_ref[:connection] = connection
cpus << Fog::Compute::XenServer::HostCpu.new(cpu_ref)
end
cpus
end
def metrics def metrics
return nil unless __metrics return nil unless __metrics
rec = service.get_record(__metrics, 'host_metrics' ) rec = service.get_record(__metrics, 'host_metrics' )