Class: VCenterDriver::VCenterCachedHost
- Inherits:
-
Object
- Object
- VCenterDriver::VCenterCachedHost
- Defined in:
- lib/vcenter_driver.rb
Overview
Cached Classes to speed up import and monitoring
Instance Method Summary collapse
- #cluster_name ⇒ Object
- #cpumhz ⇒ Object
- #ds_list ⇒ Object
- #get_child_rp_names(rp, parent_prefix) ⇒ Object
-
#initialize(rbVmomiHost) ⇒ VCenterCachedHost
constructor
A new instance of VCenterCachedHost.
- #name ⇒ Object
- #rp_list ⇒ Object
Constructor Details
#initialize(rbVmomiHost) ⇒ VCenterCachedHost
Returns a new instance of VCenterCachedHost.
953 954 955 956 |
# File 'lib/vcenter_driver.rb', line 953 def initialize(rbVmomiHost) @host = rbVmomiHost @attributes = Hash.new end |
Instance Method Details
#cluster_name ⇒ Object
965 966 967 968 969 970 |
# File 'lib/vcenter_driver.rb', line 965 def cluster_name if !@attributes['cluster_name'] @attributes['cluster_name']=@host.parent.name end @attributes['cluster_name'] end |
#cpumhz ⇒ Object
1020 1021 1022 1023 1024 1025 |
# File 'lib/vcenter_driver.rb', line 1020 def cpumhz if !@attributes['cpumhz'] @attributes['cpumhz']=@host.summary.hardware.cpuMhz.to_f end @attributes['cpumhz'] end |
#ds_list ⇒ Object
972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 |
# File 'lib/vcenter_driver.rb', line 972 def ds_list if !@attributes['ds_list'] @attributes['ds_list']="" datacenter = @host.parent while !datacenter.is_a? RbVmomi::VIM::Datacenter datacenter = datacenter.parent end datastores=VIClient.get_entities( datacenter.datastoreFolder, 'Datastore') datastores.each { |ds| @attributes['ds_list'] += ds.name + "," } @attributes['ds_list']=@attributes['ds_list'][0..-2] end @attributes['ds_list'] end |
#get_child_rp_names(rp, parent_prefix) ⇒ Object
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 |
# File 'lib/vcenter_driver.rb', line 1003 def get_child_rp_names(rp, parent_prefix) rp_str = "" current_rp = (parent_prefix.empty? ? "" : parent_prefix + "/") current_rp += rp.name if rp.resourcePool.size != 0 rp.resourcePool.each{|child_rp| rp_str += get_child_rp_names(child_rp, current_rp) } end rp_str += current_rp + "," return rp_str end |
#name ⇒ Object
958 959 960 961 962 963 |
# File 'lib/vcenter_driver.rb', line 958 def name if !@attributes['name'] @attributes['name']=@host.parent.name end @attributes['name'] end |
#rp_list ⇒ Object
992 993 994 995 996 997 998 999 1000 1001 |
# File 'lib/vcenter_driver.rb', line 992 def rp_list if !@attributes['rp_list'] @attributes['rp_list']="" @host.parent.resourcePool.resourcePool.each{|rp| @attributes['rp_list'] += get_child_rp_names(rp, "") } @attributes['rp_list']=@attributes['rp_list'][0..-2] end @attributes['rp_list'] end |