vmware_web_service 2.1.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/lib/VMwareWebService/MiqHostDatastoreSystem.rb +5 -1
  3. data/lib/VMwareWebService/MiqVim.rb +58 -56
  4. data/lib/VMwareWebService/MiqVimClientBase.rb +11 -10
  5. data/lib/VMwareWebService/MiqVimCluster.rb +6 -2
  6. data/lib/VMwareWebService/MiqVimDataStore.rb +9 -6
  7. data/lib/VMwareWebService/MiqVimDump.rb +1 -1
  8. data/lib/VMwareWebService/MiqVimEventHistoryCollector.rb +5 -1
  9. data/lib/VMwareWebService/MiqVimEventMonitor.rb +22 -20
  10. data/lib/VMwareWebService/MiqVimFolder.rb +15 -11
  11. data/lib/VMwareWebService/MiqVimHost.rb +15 -13
  12. data/lib/VMwareWebService/MiqVimInventory.rb +78 -79
  13. data/lib/VMwareWebService/MiqVimPerfHistory.rb +13 -10
  14. data/lib/VMwareWebService/MiqVimUpdate.rb +50 -50
  15. data/lib/VMwareWebService/MiqVimVdlMod.rb +7 -7
  16. data/lib/VMwareWebService/MiqVimVm.rb +102 -101
  17. data/lib/VMwareWebService/VimService.rb +5 -2
  18. data/lib/VMwareWebService/VixDiskLib/VixDiskLib.rb +10 -6
  19. data/lib/VMwareWebService/VixDiskLib/VixDiskLibServer.rb +15 -13
  20. data/lib/VMwareWebService/VixDiskLib/vdl_wrapper.rb +26 -25
  21. data/lib/VMwareWebService/exception.rb +0 -2
  22. data/lib/VMwareWebService/logging.rb +16 -0
  23. data/lib/VMwareWebService/version.rb +1 -1
  24. data/lib/vmware_web_service.rb +2 -0
  25. metadata +6 -25
  26. data/lib/VMwareWebService/DMiqVim.rb +0 -95
  27. data/lib/VMwareWebService/DMiqVimSync.rb +0 -45
  28. data/lib/VMwareWebService/MiqVimBroker.rb +0 -581
  29. data/lib/VMwareWebService/MiqVimBrokerMods.rb +0 -222
  30. data/lib/VMwareWebService/MiqVimCoreUpdater.rb +0 -269
  31. data/lib/VMwareWebService/miq_fault_tolerant_vim.rb +0 -246
@@ -60,7 +60,7 @@ module MiqVimDump
60
60
 
61
61
  def indentedPrint(s, i)
62
62
  if @dumpToLog
63
- $vim_log.debug @globalIndent + (" " * i) + s.to_s
63
+ logger.debug @globalIndent + (" " * i) + s.to_s
64
64
  else
65
65
  print @globalIndent + " " * i
66
66
  puts s
@@ -1,4 +1,8 @@
1
+ require 'VMwareWebService/logging'
2
+
1
3
  class MiqVimEventHistoryCollector
4
+ include VMwareWebService::Logging
5
+
2
6
  attr_reader :invObj
3
7
 
4
8
  def initialize(invObj, eventFilterSpec = nil, pgSize = 20)
@@ -14,7 +18,7 @@ class MiqVimEventHistoryCollector
14
18
 
15
19
  def release
16
20
  return unless @eventHistoryCollector
17
- $vim_log.info "MiqVimEventHistoryCollector.release: destroying #{@eventHistoryCollector}"
21
+ logger.info "MiqVimEventHistoryCollector.release: destroying #{@eventHistoryCollector}"
18
22
  @invObj.destroyCollector(@eventHistoryCollector)
19
23
  @eventHistoryCollector = nil
20
24
  end
@@ -1,15 +1,17 @@
1
- require 'enumerator'
1
+ require 'VMwareWebService/logging'
2
2
  require 'VMwareWebService/MiqVimInventory'
3
3
 
4
4
  class MiqVimEventMonitor < MiqVimInventory
5
- def initialize(server, username, password, eventFilterSpec = nil, pgSize = 100, maxWait = 60)
6
- super(server, username, password, :cache_scope_event_monitor)
5
+ include VMwareWebService::Logging
7
6
 
8
- @eventFilterSpec = eventFilterSpec || VimHash.new("EventFilterSpec")
9
- @pgSize = pgSize
10
- @maxWait = maxWait
11
- @_monitorEvents = true
12
- @emPropCol = nil
7
+ def initialize(server:, username:, password:, port: 443, ssl_options: {}, event_filter_spec: nil, page_size: 100, max_wait: 60)
8
+ super(:server => server, :port => port, :ssl_options => ssl_options, :username => username, :password => password, :cache_scope => :cache_scope_event_monitor)
9
+
10
+ @eventFilterSpec = event_filter_spec || VimHash.new("EventFilterSpec")
11
+ @pgSize = page_size
12
+ @maxWait = max_wait
13
+ @_monitorEvents = true
14
+ @emPropCol = nil
13
15
 
14
16
  hostSystemsByMor
15
17
  # datacentersByMor
@@ -73,25 +75,25 @@ class MiqVimEventMonitor < MiqVimInventory
73
75
  end
74
76
  rescue HTTPClient::ReceiveTimeoutError => terr
75
77
  retry if isAlive?
76
- $vim_log.debug "MiqVimEventMonitor.monitorEvents: connection lost"
78
+ logger.debug "MiqVimEventMonitor.monitorEvents: connection lost"
77
79
  raise
78
80
  end
79
81
  rescue SignalException => err
80
82
  ensure
81
- $vim_log.info "MiqVimEventMonitor: calling destroyPropertyFilter"
83
+ logger.info "MiqVimEventMonitor: calling destroyPropertyFilter"
82
84
  destroyPropertyFilter(filterSpecRef) if filterSpecRef
83
- $vim_log.info "MiqVimEventMonitor: returned from destroyPropertyFilter"
85
+ logger.info "MiqVimEventMonitor: returned from destroyPropertyFilter"
84
86
  disconnect
85
87
  end
86
88
  end # def monitorEvents
87
89
 
88
90
  def stop
89
- $vim_log.info "MiqVimEventMonitor stopping..."
91
+ logger.info "MiqVimEventMonitor stopping..."
90
92
  @_monitorEvents = false
91
93
  if @emPropCol
92
- $vim_log.info "MiqVimEventMonitor: calling cancelWaitForUpdates"
94
+ logger.info "MiqVimEventMonitor: calling cancelWaitForUpdates"
93
95
  cancelWaitForUpdates(@emPropCol)
94
- $vim_log.info "MiqVimEventMonitor: returned from cancelWaitForUpdates"
96
+ logger.info "MiqVimEventMonitor: returned from cancelWaitForUpdates"
95
97
  end
96
98
  end
97
99
 
@@ -100,14 +102,14 @@ class MiqVimEventMonitor < MiqVimInventory
100
102
 
101
103
  def fixupEvent(event)
102
104
  unless event.kind_of?(Hash)
103
- $vim_log.error "MiqVimEventMonitor.fixupEvent: Expecting Hash, got #{event.class}"
105
+ logger.error "MiqVimEventMonitor.fixupEvent: Expecting Hash, got #{event.class}"
104
106
  if event.kind_of?(Array)
105
107
  event.each_index do |i|
106
- $vim_log.error "MiqVimEventMonitor.fixupEvent: event[#{i}] is a #{event[i].class}"
107
- $vim_log.error "\tMiqVimEventMonitor.fixupEvent: event[#{i}] = #{event[i].inspect}"
108
+ logger.error "MiqVimEventMonitor.fixupEvent: event[#{i}] is a #{event[i].class}"
109
+ logger.error "\tMiqVimEventMonitor.fixupEvent: event[#{i}] = #{event[i].inspect}"
108
110
  end
109
111
  else
110
- $vim_log.error "\tMiqVimEventMonitor.fixupEvent: event = #{event.inspect}"
112
+ logger.error "\tMiqVimEventMonitor.fixupEvent: event = #{event.inspect}"
111
113
  end
112
114
  raise "MiqVimEventMonitor.fixupEvent: Expecting Hash, got #{event.class}"
113
115
  end
@@ -164,8 +166,8 @@ class MiqVimEventMonitor < MiqVimInventory
164
166
  begin
165
167
  cancelTask(String.new(e['info']['task'].to_str))
166
168
  rescue => err
167
- $vim_log.error err.to_s
168
- $vim_log.error err.backtrace.join("\n")
169
+ logger.error err.to_s
170
+ logger.error err.backtrace.join("\n")
169
171
  end
170
172
  end
171
173
  end # module MiqVimEventMonitor
@@ -1,4 +1,8 @@
1
+ require 'VMwareWebService/logging'
2
+
1
3
  class MiqVimFolder
4
+ include VMwareWebService::Logging
5
+
2
6
  attr_reader :name, :invObj
3
7
 
4
8
  def initialize(invObj, fh)
@@ -36,10 +40,10 @@ class MiqVimFolder
36
40
  hmor = (host.kind_of?(Hash) ? host['MOR'] : host) if host
37
41
  pmor = (pool.kind_of?(Hash) ? pool['MOR'] : pool) if pool
38
42
 
39
- $vim_log.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).registerVM: calling registerVM_Task" if $vim_log
43
+ logger.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).registerVM: calling registerVM_Task"
40
44
  taskMor = @invObj.registerVM_Task(@fMor, path, name, asTemplate.to_s, pmor, hmor)
41
- $vim_log.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).registerVM: returned from registerVM_Task" if $vim_log
42
- $vim_log.debug "MiqVimFolder::registerVM: taskMor = #{taskMor}" if $vim_log
45
+ logger.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).registerVM: returned from registerVM_Task"
46
+ logger.debug "MiqVimFolder::registerVM: taskMor = #{taskMor}"
43
47
  waitForTask(taskMor)
44
48
  end
45
49
 
@@ -65,9 +69,9 @@ class MiqVimFolder
65
69
  cs.vmFolder = ah[:vmFolder] unless ah[:vmFolder].nil?
66
70
  end
67
71
 
68
- $vim_log.info "MiqVimCluster(#{@invObj.server}, #{@invObj.username}).addStandaloneHost: calling addStandaloneHost_Task" if $vim_log
72
+ logger.info "MiqVimCluster(#{@invObj.server}, #{@invObj.username}).addStandaloneHost: calling addStandaloneHost_Task"
69
73
  taskMor = @invObj.addStandaloneHost_Task(@fMor, cspec, ah[:asConnected].to_s, ah[:license])
70
- $vim_log.info "MiqVimCluster(#{@invObj.server}, #{@invObj.username}).addStandaloneHost: returned from addStandaloneHost_Task" if $vim_log
74
+ logger.info "MiqVimCluster(#{@invObj.server}, #{@invObj.username}).addStandaloneHost: returned from addStandaloneHost_Task"
71
75
  return taskMor unless ah[:wait]
72
76
  waitForTask(taskMor)
73
77
  end # def addStandaloneHost
@@ -77,10 +81,10 @@ class MiqVimFolder
77
81
  oMor = nil
78
82
  oMor = (vCenterObject.kind_of?(Hash) ? vCenterObject['MOR'] : vCenterObject) if vCenterObject
79
83
 
80
- $vim_log.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).moveIntoFolder: calling moveIntoFolder_Task" if $vim_log
84
+ logger.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).moveIntoFolder: calling moveIntoFolder_Task"
81
85
  taskMor = @invObj.moveIntoFolder_Task(@fMor, oMor)
82
- $vim_log.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).moveIntoFolder: returned from moveIntoFolder_Task" if $vim_log
83
- $vim_log.debug "MiqVimFolder::moveIntoFolder: taskMor = #{taskMor}" if $vim_log
86
+ logger.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).moveIntoFolder: returned from moveIntoFolder_Task"
87
+ logger.debug "MiqVimFolder::moveIntoFolder: taskMor = #{taskMor}"
84
88
  waitForTask(taskMor)
85
89
  end
86
90
 
@@ -96,10 +100,10 @@ class MiqVimFolder
96
100
  hMor = (host.kind_of?(Hash) ? host['MOR'] : host) if host
97
101
  pMor = (pool.kind_of?(Hash) ? pool['MOR'] : pool) if pool
98
102
 
99
- $vim_log.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).createVM calling createVM_Task" if $vim_log
103
+ logger.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).createVM calling createVM_Task"
100
104
  taskMor = @invObj.createVM_Task(@fMor, configSpec, pMor, hMor)
101
- $vim_log.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).createVM returned from createVM_Task" if $vim_log
102
- $vim_log.debug "MiqVimFolder::createVM: taskMor = #{taskMor}" if $vim_log
105
+ logger.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).createVM returned from createVM_Task"
106
+ logger.debug "MiqVimFolder::createVM: taskMor = #{taskMor}"
103
107
  waitForTask(taskMor)
104
108
  end
105
109
 
@@ -1,9 +1,9 @@
1
1
  require 'sync'
2
2
 
3
- require 'enumerator'
4
3
  require "ostruct"
5
4
 
6
5
  require 'more_core_extensions/core_ext/hash'
6
+ require 'VMwareWebService/logging'
7
7
  require 'VMwareWebService/MiqHostDatastoreSystem'
8
8
  require 'VMwareWebService/MiqHostStorageSystem'
9
9
  require 'VMwareWebService/MiqHostFirewallSystem'
@@ -14,6 +14,8 @@ require 'VMwareWebService/MiqHostAdvancedOptionManager'
14
14
  require 'VMwareWebService/MiqHostSnmpSystem'
15
15
 
16
16
  class MiqVimHost
17
+ include VMwareWebService::Logging
18
+
17
19
  attr_reader :name, :invObj
18
20
 
19
21
  def initialize(invObj, hh)
@@ -108,49 +110,49 @@ class MiqVimHost
108
110
  end
109
111
 
110
112
  def enterMaintenanceMode(timeout = 0, evacuatePoweredOffVms = false, wait = true)
111
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).enterMaintenanceMode: calling enterMaintenanceMode_Task" if $vim_log
113
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).enterMaintenanceMode: calling enterMaintenanceMode_Task"
112
114
  taskMor = @invObj.enterMaintenanceMode_Task(@hMor, timeout, evacuatePoweredOffVms)
113
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).enterMaintenanceMode: returned from enterMaintenanceMode_Task" if $vim_log
115
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).enterMaintenanceMode: returned from enterMaintenanceMode_Task"
114
116
  return taskMor unless wait
115
117
  waitForTask(taskMor)
116
118
  end
117
119
 
118
120
  def exitMaintenanceMode(timeout = 0, wait = true)
119
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).exitMaintenanceMode: calling exitMaintenanceMode_Task" if $vim_log
121
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).exitMaintenanceMode: calling exitMaintenanceMode_Task"
120
122
  taskMor = @invObj.exitMaintenanceMode_Task(@hMor, timeout)
121
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).exitMaintenanceMode: returned from exitMaintenanceMode_Task" if $vim_log
123
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).exitMaintenanceMode: returned from exitMaintenanceMode_Task"
122
124
  return taskMor unless wait
123
125
  waitForTask(taskMor)
124
126
  end
125
127
 
126
128
  def powerDownHostToStandBy(timeout = 0, evacuatePoweredOffVms = false, wait = true)
127
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerDownHostToStandBy: calling powerDownHostToStandBy_Task" if $vim_log
129
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerDownHostToStandBy: calling powerDownHostToStandBy_Task"
128
130
  taskMor = @invObj.powerDownHostToStandBy_Task(@hMor, timeout, evacuatePoweredOffVms)
129
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerDownHostToStandBy: returned from powerDownHostToStandBy_Task" if $vim_log
131
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerDownHostToStandBy: returned from powerDownHostToStandBy_Task"
130
132
  return taskMor unless wait
131
133
  waitForTask(taskMor)
132
134
  end
133
135
 
134
136
  def powerUpHostFromStandBy(timeout = 0, wait = true)
135
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerUpHostFromStandBy: calling powerUpHostFromStandBy_Task" if $vim_log
137
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerUpHostFromStandBy: calling powerUpHostFromStandBy_Task"
136
138
  taskMor = @invObj.powerUpHostFromStandBy_Task(@hMor, timeout)
137
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerUpHostFromStandBy: returned from powerUpHostFromStandBy_Task" if $vim_log
139
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerUpHostFromStandBy: returned from powerUpHostFromStandBy_Task"
138
140
  return taskMor unless wait
139
141
  waitForTask(taskMor)
140
142
  end
141
143
 
142
144
  def rebootHost(force = false, wait = true)
143
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).rebootHost: calling rebootHost_Task" if $vim_log
145
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).rebootHost: calling rebootHost_Task"
144
146
  taskMor = @invObj.rebootHost_Task(@hMor, force)
145
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).rebootHost: returned from rebootHost_Task" if $vim_log
147
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).rebootHost: returned from rebootHost_Task"
146
148
  return taskMor unless wait
147
149
  waitForTask(taskMor)
148
150
  end
149
151
 
150
152
  def shutdownHost(force = false, wait = true)
151
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).shutdownHost: calling shutdownHost_Task" if $vim_log
153
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).shutdownHost: calling shutdownHost_Task"
152
154
  taskMor = @invObj.shutdownHost_Task(@hMor, force)
153
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).shutdownHost: returned from shutdownHost_Task" if $vim_log
155
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).shutdownHost: returned from shutdownHost_Task"
154
156
  return taskMor unless wait
155
157
  waitForTask(taskMor)
156
158
  end
@@ -1,5 +1,4 @@
1
1
  require 'sync'
2
- require 'enumerator'
3
2
  require 'VMwareWebService/MiqVimClientBase'
4
3
  require 'VMwareWebService/MiqVimDump'
5
4
  require 'VMwareWebService/VimPropMaps'
@@ -18,31 +17,31 @@ class MiqVimInventory < MiqVimClientBase
18
17
  @@selectorHash = {}
19
18
  @@cacheScope = :cache_scope_full
20
19
 
21
- def initialize(server, username, password, cacheScope = nil)
22
- super(server, username, password)
20
+ def initialize(server:, username:, password:, port: 443, ssl_options: {}, cache_scope: nil)
21
+ super(:server => server, :port => port, :ssl_options => ssl_options, :username => username, :password => password)
23
22
 
24
- cacheScope ||= @@cacheScope
23
+ cache_scope ||= @@cacheScope
25
24
 
26
- case cacheScope
25
+ case cache_scope
27
26
  when :cache_scope_full
28
27
  @propMap = FullPropMap
29
- $vim_log.info "MiqVimInventory: using property map FullPropMap"
28
+ logger.info "MiqVimInventory: using property map FullPropMap"
30
29
  when :cache_scope_ems_refresh
31
30
  @propMap = EmsRefreshPropMap
32
- $vim_log.info "MiqVimInventory: using property map EmsRefreshPropMap"
31
+ logger.info "MiqVimInventory: using property map EmsRefreshPropMap"
33
32
  when :cache_scope_core
34
33
  @propMap = CorePropMap
35
- $vim_log.info "MiqVimInventory: using property map CorePropMap"
34
+ logger.info "MiqVimInventory: using property map CorePropMap"
36
35
  when :cache_scope_event_monitor
37
36
  @propMap = EventMonitorPropMap
38
- $vim_log.info "MiqVimInventory: using property map EventMonitorPropMap"
37
+ logger.info "MiqVimInventory: using property map EventMonitorPropMap"
39
38
  else
40
39
  @propMap = FullPropMap
41
- $vim_log.info "MiqVimInventory: unrecognized cache scope #{cacheScope}, using FullPropMap"
40
+ logger.info "MiqVimInventory: unrecognized cache scope #{cacheScope}, using FullPropMap"
42
41
  end
43
42
 
44
43
  # If we are connected to a virtual center then we can access additional properties
45
- @propMap.merge!(PropMapVCenter) if isVirtualCenter && cacheScope != :cache_scope_event_monitor
44
+ @propMap.merge!(PropMapVCenter) if isVirtualCenter && cache_scope != :cache_scope_event_monitor
46
45
 
47
46
  @propCol = @sic.propertyCollector
48
47
  @rootFolder = @sic.rootFolder
@@ -88,11 +87,11 @@ class MiqVimInventory < MiqVimClientBase
88
87
 
89
88
  unless instance_variable_get(hnm).nil?
90
89
  hnmc = instance_variable_get(hnm).keys.length
91
- $vim_log.info "#{pref}#{hnm}: #{hnmc}"
90
+ logger.info "#{pref}#{hnm}: #{hnmc}"
92
91
  end
93
92
  unless instance_variable_get(hn).nil?
94
93
  hnc = instance_variable_get(hn).keys.length
95
- $vim_log.info "#{pref}#{hn}: #{hnc}"
94
+ logger.info "#{pref}#{hn}: #{hnc}"
96
95
  end
97
96
  end
98
97
  end
@@ -108,37 +107,37 @@ class MiqVimInventory < MiqVimClientBase
108
107
  hashByKey = pm[:keyPath] ? instance_variable_get(hn) : nil
109
108
 
110
109
  if hashByMor.nil?
111
- $vim_log.info "#{pref}#{hnm}: is nil"
110
+ logger.info "#{pref}#{hnm}: is nil"
112
111
  next
113
112
  end
114
113
 
115
114
  keya = hashByMor.keys
116
115
  obja = hashByMor.values
117
- $vim_log.info "#{pref}#{hnm}: #keys = #{keya.length}"
118
- $vim_log.info "#{pref}#{hnm}: #objects = #{obja.length}"
116
+ logger.info "#{pref}#{hnm}: #keys = #{keya.length}"
117
+ logger.info "#{pref}#{hnm}: #objects = #{obja.length}"
119
118
  obja.compact!
120
119
  obja.uniq!
121
- $vim_log.info "#{pref}#{hnm}: #unique non-nill objects = #{obja.length}"
120
+ logger.info "#{pref}#{hnm}: #unique non-nill objects = #{obja.length}"
122
121
 
123
122
  unless hashByKey.nil?
124
123
  keyb = hashByKey.keys
125
124
  objb = hashByKey.values
126
- $vim_log.info "#{pref}#{hn}: #keys = #{keyb.length}"
127
- $vim_log.info "#{pref}#{hn}: #objects = #{objb.length}"
125
+ logger.info "#{pref}#{hn}: #keys = #{keyb.length}"
126
+ logger.info "#{pref}#{hn}: #objects = #{objb.length}"
128
127
  objb.compact!
129
128
  objb.uniq!
130
- $vim_log.info "#{pref}#{hn}: #unique non-nill objects = #{objb.length}"
129
+ logger.info "#{pref}#{hn}: #unique non-nill objects = #{objb.length}"
131
130
  obja.concat(objb).uniq!
132
131
  end
133
- $vim_log.info "#{pref}TOTAL: #unique non-nill objects = #{obja.length}"
132
+ logger.info "#{pref}TOTAL: #unique non-nill objects = #{obja.length}"
134
133
  cacheSz = Marshal.dump(obja).length
135
- $vim_log.info "#{pref}TOTAL: size of objects = #{cacheSz}"
136
- $vim_log.info "#{pref}****"
134
+ logger.info "#{pref}TOTAL: size of objects = #{cacheSz}"
135
+ logger.info "#{pref}****"
137
136
  totalCacheSz += cacheSz
138
137
  end
139
- $vim_log.info "#{pref}****************"
140
- $vim_log.info "#{pref}TOTAL: cache size = #{totalCacheSz}"
141
- $vim_log.info "#{pref}****************"
138
+ logger.info "#{pref}****************"
139
+ logger.info "#{pref}TOTAL: cache size = #{totalCacheSz}"
140
+ logger.info "#{pref}****************"
142
141
  end
143
142
  totalCacheSz
144
143
  end
@@ -219,7 +218,7 @@ class MiqVimInventory < MiqVimClientBase
219
218
  end
220
219
 
221
220
  def resetCache
222
- $vim_log.info "MiqVimInventory.resetCache: clearing cache for #{@connId}"
221
+ logger.info "MiqVimInventory.resetCache: clearing cache for #{@connId}"
223
222
  @cacheLock.synchronize(:EX) do
224
223
  @inventoryHash = nil
225
224
 
@@ -228,7 +227,7 @@ class MiqVimInventory < MiqVimClientBase
228
227
  instance_variable_set(pm[:baseName], nil)
229
228
  end
230
229
  end
231
- $vim_log.info "MiqVimInventory.resetCache: cleared cache for #{@connId}"
230
+ logger.info "MiqVimInventory.resetCache: cleared cache for #{@connId}"
232
231
  end # def resetCache
233
232
 
234
233
  def currentSession
@@ -239,11 +238,11 @@ class MiqVimInventory < MiqVimClientBase
239
238
  return false unless @alive
240
239
  begin
241
240
  unless currentSession
242
- $vim_log.info "MiqVimInventory.isAlive?: Current session no longer exists."
241
+ logger.info "MiqVimInventory.isAlive?: Current session no longer exists."
243
242
  @alive = false
244
243
  end
245
244
  rescue Exception => err
246
- $vim_log.info "MiqVimInventory.isAlive?: Could not access connection - #{err}"
245
+ logger.info "MiqVimInventory.isAlive?: Could not access connection - #{err}"
247
246
  @alive = false
248
247
  end
249
248
  @alive
@@ -278,9 +277,9 @@ class MiqVimInventory < MiqVimClientBase
278
277
  if keyPath
279
278
  key = props.fetch_path(keyPath)
280
279
  if !key
281
- $vim_log.debug "hashObj: key is nil for #{mor}: #{keyPath}"
280
+ logger.debug "hashObj: key is nil for #{mor}: #{keyPath}"
282
281
  elsif key.empty?
283
- $vim_log.debug "hashObj: key is empty for #{mor}: #{keyPath}"
282
+ logger.debug "hashObj: key is empty for #{mor}: #{keyPath}"
284
283
  key = nil
285
284
  props.store_path(keyPath, nil)
286
285
  end
@@ -491,7 +490,7 @@ class MiqVimInventory < MiqVimClientBase
491
490
  raise "virtualMachines_locked: cache lock not held" unless @cacheLock.sync_locked?
492
491
  return(@virtualMachines) if @virtualMachines
493
492
 
494
- $vim_log.info "MiqVimInventory.virtualMachines_locked: loading VirtualMachine cache for #{@connId}"
493
+ logger.info "MiqVimInventory.virtualMachines_locked: loading VirtualMachine cache for #{@connId}"
495
494
  begin
496
495
  @cacheLock.sync_lock(:EX) if (unlock = @cacheLock.sync_shared?)
497
496
 
@@ -505,7 +504,7 @@ class MiqVimInventory < MiqVimClientBase
505
504
  ensure
506
505
  @cacheLock.sync_unlock if unlock
507
506
  end
508
- $vim_log.info "MiqVimInventory.virtualMachines_locked: loaded VirtualMachine cache for #{@connId}"
507
+ logger.info "MiqVimInventory.virtualMachines_locked: loaded VirtualMachine cache for #{@connId}"
509
508
 
510
509
  @virtualMachines
511
510
  end # def virtualMachines_locked
@@ -617,7 +616,7 @@ class MiqVimInventory < MiqVimClientBase
617
616
  raise "computeResources_locked: cache lock not held" unless @cacheLock.sync_locked?
618
617
  return(@computeResources) if @computeResources
619
618
 
620
- $vim_log.info "MiqVimInventory.computeResources_locked: loading ComputeResource cache for #{@connId}"
619
+ logger.info "MiqVimInventory.computeResources_locked: loading ComputeResource cache for #{@connId}"
621
620
  begin
622
621
  @cacheLock.sync_lock(:EX) if (unlock = @cacheLock.sync_shared?)
623
622
 
@@ -631,7 +630,7 @@ class MiqVimInventory < MiqVimClientBase
631
630
  ensure
632
631
  @cacheLock.sync_unlock if unlock
633
632
  end
634
- $vim_log.info "MiqVimInventory.computeResources_locked: loaded ComputeResource cache for #{@connId}"
633
+ logger.info "MiqVimInventory.computeResources_locked: loaded ComputeResource cache for #{@connId}"
635
634
 
636
635
  @computeResources
637
636
  end # def computeResources_locked
@@ -720,7 +719,7 @@ class MiqVimInventory < MiqVimClientBase
720
719
  raise "clusterComputeResources_locked: cache lock not held" unless @cacheLock.sync_locked?
721
720
  return(@clusterComputeResources) if @clusterComputeResources
722
721
 
723
- $vim_log.info "MiqVimInventory.clusterComputeResources_locked: loading ClusterComputeResource cache for #{@connId}"
722
+ logger.info "MiqVimInventory.clusterComputeResources_locked: loading ClusterComputeResource cache for #{@connId}"
724
723
  begin
725
724
  @cacheLock.sync_lock(:EX) if (unlock = @cacheLock.sync_shared?)
726
725
 
@@ -734,7 +733,7 @@ class MiqVimInventory < MiqVimClientBase
734
733
  ensure
735
734
  @cacheLock.sync_unlock if unlock
736
735
  end
737
- $vim_log.info "MiqVimInventory.clusterComputeResources_locked: loaded ClusterComputeResource cache for #{@connId}"
736
+ logger.info "MiqVimInventory.clusterComputeResources_locked: loaded ClusterComputeResource cache for #{@connId}"
738
737
 
739
738
  @clusterComputeResources
740
739
  end # def clusterComputeResources_locked
@@ -823,7 +822,7 @@ class MiqVimInventory < MiqVimClientBase
823
822
  raise "resourcePools_locked: cache lock not held" unless @cacheLock.sync_locked?
824
823
  return(@resourcePools) if @resourcePools
825
824
 
826
- $vim_log.info "MiqVimInventory.resourcePools_locked: loading ResourcePool cache for #{@connId}"
825
+ logger.info "MiqVimInventory.resourcePools_locked: loading ResourcePool cache for #{@connId}"
827
826
  begin
828
827
  @cacheLock.sync_lock(:EX) if (unlock = @cacheLock.sync_shared?)
829
828
 
@@ -837,7 +836,7 @@ class MiqVimInventory < MiqVimClientBase
837
836
  ensure
838
837
  @cacheLock.sync_unlock if unlock
839
838
  end
840
- $vim_log.info "MiqVimInventory.resourcePools_locked: loaded ResourcePool cache for #{@connId}"
839
+ logger.info "MiqVimInventory.resourcePools_locked: loaded ResourcePool cache for #{@connId}"
841
840
 
842
841
  @resourcePools
843
842
  end # def resourcePools_locked
@@ -935,7 +934,7 @@ class MiqVimInventory < MiqVimClientBase
935
934
 
936
935
  return(@virtualApps) if @virtualApps
937
936
 
938
- $vim_log.info "MiqVimInventory.virtualApps_locked: loading VirtualApp cache for #{@connId}"
937
+ logger.info "MiqVimInventory.virtualApps_locked: loading VirtualApp cache for #{@connId}"
939
938
  begin
940
939
  @cacheLock.sync_lock(:EX) if (unlock = @cacheLock.sync_shared?)
941
940
 
@@ -949,7 +948,7 @@ class MiqVimInventory < MiqVimClientBase
949
948
  ensure
950
949
  @cacheLock.sync_unlock if unlock
951
950
  end
952
- $vim_log.info "MiqVimInventory.virtualApps_locked: loaded VirtualApp cache for #{@connId}"
951
+ logger.info "MiqVimInventory.virtualApps_locked: loaded VirtualApp cache for #{@connId}"
953
952
 
954
953
  @virtualApps
955
954
  end # def virtualApps_locked
@@ -1038,7 +1037,7 @@ class MiqVimInventory < MiqVimClientBase
1038
1037
  raise "folders_locked: cache lock not held" unless @cacheLock.sync_locked?
1039
1038
  return(@folders) if @folders
1040
1039
 
1041
- $vim_log.info "MiqVimInventory.folders_locked: loading Folder cache for #{@connId}"
1040
+ logger.info "MiqVimInventory.folders_locked: loading Folder cache for #{@connId}"
1042
1041
  begin
1043
1042
  @cacheLock.sync_lock(:EX) if (unlock = @cacheLock.sync_shared?)
1044
1043
 
@@ -1052,7 +1051,7 @@ class MiqVimInventory < MiqVimClientBase
1052
1051
  ensure
1053
1052
  @cacheLock.sync_unlock if unlock
1054
1053
  end
1055
- $vim_log.info "MiqVimInventory.folders_locked: loaded Folder cache for #{@connId}"
1054
+ logger.info "MiqVimInventory.folders_locked: loaded Folder cache for #{@connId}"
1056
1055
 
1057
1056
  @folders
1058
1057
  end # def folders_locked
@@ -1141,7 +1140,7 @@ class MiqVimInventory < MiqVimClientBase
1141
1140
  raise "datacenters_locked: cache lock not held" unless @cacheLock.sync_locked?
1142
1141
  return(@datacenters) if @datacenters
1143
1142
 
1144
- $vim_log.info "MiqVimInventory.datacenters_locked: loading Datacenter cache for #{@connId}"
1143
+ logger.info "MiqVimInventory.datacenters_locked: loading Datacenter cache for #{@connId}"
1145
1144
  begin
1146
1145
  @cacheLock.sync_lock(:EX) if (unlock = @cacheLock.sync_shared?)
1147
1146
 
@@ -1155,7 +1154,7 @@ class MiqVimInventory < MiqVimClientBase
1155
1154
  ensure
1156
1155
  @cacheLock.sync_unlock if unlock
1157
1156
  end
1158
- $vim_log.info "MiqVimInventory.datacenters_locked: loaded Datacenter cache for #{@connId}"
1157
+ logger.info "MiqVimInventory.datacenters_locked: loaded Datacenter cache for #{@connId}"
1159
1158
 
1160
1159
  @datacenters
1161
1160
  end # def datacenters_locked
@@ -1244,7 +1243,7 @@ class MiqVimInventory < MiqVimClientBase
1244
1243
  raise "hostSystems_locked: cache lock not held" unless @cacheLock.sync_locked?
1245
1244
  return(@hostSystems) if @hostSystems
1246
1245
 
1247
- $vim_log.info "MiqVimInventory.hostSystems_locked: loading HostSystem cache for #{@connId}"
1246
+ logger.info "MiqVimInventory.hostSystems_locked: loading HostSystem cache for #{@connId}"
1248
1247
  begin
1249
1248
  @cacheLock.sync_lock(:EX) if (unlock = @cacheLock.sync_shared?)
1250
1249
 
@@ -1258,7 +1257,7 @@ class MiqVimInventory < MiqVimClientBase
1258
1257
  ensure
1259
1258
  @cacheLock.sync_unlock if unlock
1260
1259
  end
1261
- $vim_log.info "MiqVimInventory.hostSystems_locked: loaded HostSystem cache for #{@connId}"
1260
+ logger.info "MiqVimInventory.hostSystems_locked: loaded HostSystem cache for #{@connId}"
1262
1261
 
1263
1262
  @hostSystems
1264
1263
  end # def hostSystems_locked
@@ -1369,7 +1368,7 @@ class MiqVimInventory < MiqVimClientBase
1369
1368
  raise "dataStores_locked: cache lock not held" unless @cacheLock.sync_locked?
1370
1369
  return(@dataStores) if @dataStores
1371
1370
 
1372
- $vim_log.info "MiqVimInventory.dataStores_locked: loading Datastore cache for #{@connId}"
1371
+ logger.info "MiqVimInventory.dataStores_locked: loading Datastore cache for #{@connId}"
1373
1372
  begin
1374
1373
  @cacheLock.sync_lock(:EX) if (unlock = @cacheLock.sync_shared?)
1375
1374
 
@@ -1383,7 +1382,7 @@ class MiqVimInventory < MiqVimClientBase
1383
1382
  ensure
1384
1383
  @cacheLock.sync_unlock if unlock
1385
1384
  end
1386
- $vim_log.info "MiqVimInventory.dataStores_locked: loaded Datastore cache for #{@connId}"
1385
+ logger.info "MiqVimInventory.dataStores_locked: loaded Datastore cache for #{@connId}"
1387
1386
 
1388
1387
  @dataStores
1389
1388
  end # def dataStores_locked
@@ -1488,7 +1487,7 @@ class MiqVimInventory < MiqVimClientBase
1488
1487
  raise "dvPortgroups_locked: cache lock not held" unless @cacheLock.sync_locked?
1489
1488
  return(@dvPortgroups) if @dvPortgroups
1490
1489
 
1491
- $vim_log.info "MiqVimInventory.dvPortgroups_locked: loading DV Portgroup cache for #{@connId}"
1490
+ logger.info "MiqVimInventory.dvPortgroups_locked: loading DV Portgroup cache for #{@connId}"
1492
1491
  begin
1493
1492
  @cacheLock.sync_lock(:EX) if (unlock = @cacheLock.sync_shared?)
1494
1493
 
@@ -1502,7 +1501,7 @@ class MiqVimInventory < MiqVimClientBase
1502
1501
  ensure
1503
1502
  @cacheLock.sync_unlock if unlock
1504
1503
  end
1505
- $vim_log.info "MiqVimInventory.dvPortgroups_locked: loaded DV Portgroup cache for #{@connId}"
1504
+ logger.info "MiqVimInventory.dvPortgroups_locked: loaded DV Portgroup cache for #{@connId}"
1506
1505
 
1507
1506
  @dvPortgroups
1508
1507
  end # def dvPortgroups_locked
@@ -1576,7 +1575,7 @@ class MiqVimInventory < MiqVimClientBase
1576
1575
  raise "dvSwitches_locked: cache lock not held" unless @cacheLock.sync_locked?
1577
1576
  return(@dvSwithces) if @dvSwitches
1578
1577
 
1579
- $vim_log.info "MiqVimInventory.dvSwitches_locked: loading DV Switch cache for #{@connId}"
1578
+ logger.info "MiqVimInventory.dvSwitches_locked: loading DV Switch cache for #{@connId}"
1580
1579
 
1581
1580
  base_class = 'DistributedVirtualSwitch'.freeze
1582
1581
  child_classes = VimClass.child_classes(base_class)
@@ -1596,7 +1595,7 @@ class MiqVimInventory < MiqVimClientBase
1596
1595
  ensure
1597
1596
  @cacheLock.sync_unlock if unlock
1598
1597
  end
1599
- $vim_log.info "MiqVimInventory.dvSwitches_locked: loaded DV Switch cache for #{@connId}"
1598
+ logger.info "MiqVimInventory.dvSwitches_locked: loaded DV Switch cache for #{@connId}"
1600
1599
 
1601
1600
  @dvSwitches
1602
1601
  end # def dvSwitches_locked
@@ -1669,7 +1668,7 @@ class MiqVimInventory < MiqVimClientBase
1669
1668
  raise "storagePods_locked: cache lock not held" unless @cacheLock.sync_locked?
1670
1669
  return(@storagePods) if @storagePods
1671
1670
 
1672
- $vim_log.info "MiqVimInventory.storagePods_locked: loading Datastore Cluster cache for #{@connId}"
1671
+ logger.info "MiqVimInventory.storagePods_locked: loading Datastore Cluster cache for #{@connId}"
1673
1672
  begin
1674
1673
  @cacheLock.sync_lock(:EX) if (unlock = @cacheLock.sync_shared?)
1675
1674
 
@@ -1683,7 +1682,7 @@ class MiqVimInventory < MiqVimClientBase
1683
1682
  ensure
1684
1683
  @cacheLock.sync_unlock if unlock
1685
1684
  end
1686
- $vim_log.info "MiqVimInventory.storagePods_locked: loaded Datastore Cluster cache for #{@connId}"
1685
+ logger.info "MiqVimInventory.storagePods_locked: loaded Datastore Cluster cache for #{@connId}"
1687
1686
 
1688
1687
  @storagePods
1689
1688
  end # def storagePods_locked
@@ -1761,7 +1760,7 @@ class MiqVimInventory < MiqVimClientBase
1761
1760
  raise "licenseManagers_locked: cache lock not held" unless @cacheLock.sync_locked?
1762
1761
  return(@licenseManagers) if @licenseManagers
1763
1762
 
1764
- $vim_log.info "MiqVimInventory.licenseManagers_locked: loading LicenseManager cache for #{@connId}"
1763
+ logger.info "MiqVimInventory.licenseManagers_locked: loading LicenseManager cache for #{@connId}"
1765
1764
  begin
1766
1765
  @cacheLock.sync_lock(:EX) if (unlock = @cacheLock.sync_shared?)
1767
1766
 
@@ -1775,7 +1774,7 @@ class MiqVimInventory < MiqVimClientBase
1775
1774
  ensure
1776
1775
  @cacheLock.sync_unlock if unlock
1777
1776
  end
1778
- $vim_log.info "MiqVimInventory.licenseManagers_locked: loaded LicenseManager cache for #{@connId}"
1777
+ logger.info "MiqVimInventory.licenseManagers_locked: loaded LicenseManager cache for #{@connId}"
1779
1778
 
1780
1779
  @licenseManagers
1781
1780
  end # def licenseManagers_locked
@@ -1871,7 +1870,7 @@ class MiqVimInventory < MiqVimClientBase
1871
1870
  raise "extensionManagers_locked: cache lock not held" unless @cacheLock.sync_locked?
1872
1871
  return(@extensionManagers) if @extensionManagers
1873
1872
 
1874
- $vim_log.info "MiqVimInventory.extensionManagers_locked: loading ExtensionManager cache for #{@connId}"
1873
+ logger.info "MiqVimInventory.extensionManagers_locked: loading ExtensionManager cache for #{@connId}"
1875
1874
  begin
1876
1875
  @cacheLock.sync_lock(:EX) if (unlock = @cacheLock.sync_shared?)
1877
1876
 
@@ -1885,7 +1884,7 @@ class MiqVimInventory < MiqVimClientBase
1885
1884
  ensure
1886
1885
  @cacheLock.sync_unlock if unlock
1887
1886
  end
1888
- $vim_log.info "MiqVimInventory.extensionManagers_locked: loaded ExtensionManager cache for #{@connId}"
1887
+ logger.info "MiqVimInventory.extensionManagers_locked: loaded ExtensionManager cache for #{@connId}"
1889
1888
 
1890
1889
  @extensionManagers
1891
1890
  end # def extensionManagers_locked
@@ -1977,22 +1976,22 @@ class MiqVimInventory < MiqVimClientBase
1977
1976
  raise "inventoryHash_locked: cache lock not held" unless @cacheLock.sync_locked?
1978
1977
  return(@inventoryHash) if @inventoryHash
1979
1978
 
1980
- $vim_log.info "MiqVimInventory.inventoryHash_locked: loading inventoryHash for #{@connId}"
1979
+ logger.info "MiqVimInventory.inventoryHash_locked: loading inventoryHash for #{@connId}"
1981
1980
  begin
1982
1981
  @cacheLock.sync_lock(:EX) if (unlock = @cacheLock.sync_shared?)
1983
1982
 
1984
- $vim_log.info "MiqVimInventory(#{@server}, #{@username}).inventoryHash_locked: calling retrieveProperties" if $vim_log
1983
+ logger.info "MiqVimInventory(#{@server}, #{@username}).inventoryHash_locked: calling retrieveProperties"
1985
1984
 
1986
1985
  @inventoryHash = {}
1987
1986
  retrievePropertiesIter(@propCol, @spec) do |oc|
1988
1987
  (@inventoryHash[oc.obj.vimType] ||= []) << oc.obj
1989
1988
  end
1990
1989
 
1991
- $vim_log.info "MiqVimInventory(#{@server}, #{@username}).inventoryHash_locked: returned from retrieveProperties" if $vim_log
1990
+ logger.info "MiqVimInventory(#{@server}, #{@username}).inventoryHash_locked: returned from retrieveProperties"
1992
1991
  ensure
1993
1992
  @cacheLock.sync_unlock if unlock
1994
1993
  end
1995
- $vim_log.info "MiqVimInventory.inventoryHash_locked: loaded inventoryHash for #{@connId}"
1994
+ logger.info "MiqVimInventory.inventoryHash_locked: loaded inventoryHash for #{@connId}"
1996
1995
 
1997
1996
  @inventoryHash
1998
1997
  end
@@ -2009,9 +2008,9 @@ class MiqVimInventory < MiqVimClientBase
2009
2008
  # Generate a user event associated with the given managed object.
2010
2009
  #
2011
2010
  def logUserEvent(entity, msg)
2012
- $vim_log.info "MiqVimInventory(#{@server}, #{@username}).logUserEvent: calling logUserEvent" if $vim_log
2011
+ logger.info "MiqVimInventory(#{@server}, #{@username}).logUserEvent: calling logUserEvent"
2013
2012
  super(@sic.eventManager, entity, msg)
2014
- $vim_log.info "MiqVimInventory(#{@server}, #{@username}).logUserEvent: returned from logUserEvent" if $vim_log
2013
+ logger.info "MiqVimInventory(#{@server}, #{@username}).logUserEvent: returned from logUserEvent"
2015
2014
  end
2016
2015
 
2017
2016
  ##################################
@@ -2184,13 +2183,13 @@ class MiqVimInventory < MiqVimClientBase
2184
2183
 
2185
2184
  def getTaskMor(tmor)
2186
2185
  if tmor.respond_to?(:vimType)
2187
- $vim_log.debug "getTaskMor: returning #{tmor}, no search"
2186
+ logger.debug "getTaskMor: returning #{tmor}, no search"
2188
2187
  return tmor
2189
2188
  else
2190
- $vim_log.debug "getTaskMor: searching for task #{tmor}"
2189
+ logger.debug "getTaskMor: searching for task #{tmor}"
2191
2190
  getTasks.each do |tmo|
2192
2191
  if tmo.to_str == tmor
2193
- $vim_log.debug "getTaskMor: returning #{tmo} (#{tmo.vimType})"
2192
+ logger.debug "getTaskMor: returning #{tmo} (#{tmo.vimType})"
2194
2193
  return tmo
2195
2194
  end
2196
2195
  end
@@ -2205,7 +2204,7 @@ class MiqVimInventory < MiqVimClientBase
2205
2204
  def waitForTask(tmor, className = nil)
2206
2205
  className ||= self.class.to_s
2207
2206
 
2208
- $vim_log.info "#{className}(#{@server}, #{@username})::waitForTask(#{tmor})" if $vim_log
2207
+ logger.info "#{className}(#{@server}, #{@username})::waitForTask(#{tmor})"
2209
2208
  args = VimArray.new("ArrayOfPropertyFilterSpec") do |pfsa|
2210
2209
  pfsa << VimHash.new("PropertyFilterSpec") do |pfs|
2211
2210
  pfs.propSet = VimArray.new("ArrayOfPropertySpec") do |psa|
@@ -2241,14 +2240,14 @@ class MiqVimInventory < MiqVimClientBase
2241
2240
  end
2242
2241
 
2243
2242
  raise VimFault.new(error) if state == TaskInfoState::Error
2244
- $vim_log.info "#{className}(#{@server}, #{@username})::waitForTask: result = #{result}" if $vim_log
2243
+ logger.info "#{className}(#{@server}, #{@username})::waitForTask: result = #{result}"
2245
2244
  result
2246
2245
  end # def waitForTask
2247
2246
 
2248
2247
  def pollTask(tmor, className = nil)
2249
2248
  className ||= self.class.to_s
2250
2249
 
2251
- $vim_log.info "#{className}(#{@server}, #{@username})::pollTask(#{tmor})" if $vim_log
2250
+ logger.info "#{className}(#{@server}, #{@username})::pollTask(#{tmor})"
2252
2251
  args = VimArray.new("ArrayOfPropertyFilterSpec") do |pfsa|
2253
2252
  pfsa << VimHash.new("PropertyFilterSpec") do |pfs|
2254
2253
  pfs.propSet = VimArray.new("ArrayOfPropertySpec") do |psa|
@@ -2324,9 +2323,9 @@ class MiqVimInventory < MiqVimClientBase
2324
2323
  end
2325
2324
  end
2326
2325
 
2327
- $vim_log.info "MiqVimInventory(#{@server}, #{@username}).getMoProp_local: calling retrieveProperties(#{mo.vimType})" if $vim_log
2326
+ logger.info "MiqVimInventory(#{@server}, #{@username}).getMoProp_local: calling retrieveProperties(#{mo.vimType})"
2328
2327
  oca = retrievePropertiesCompat(@propCol, pfSpec)
2329
- $vim_log.info "MiqVimInventory(#{@server}, #{@username}).getMoProp_local: return from retrieveProperties(#{mo.vimType})" if $vim_log
2328
+ logger.info "MiqVimInventory(#{@server}, #{@username}).getMoProp_local: return from retrieveProperties(#{mo.vimType})"
2330
2329
 
2331
2330
  return nil if !oca || !oca[0] || !oca[0].propSet
2332
2331
 
@@ -2442,9 +2441,9 @@ class MiqVimInventory < MiqVimClientBase
2442
2441
  end
2443
2442
 
2444
2443
  def self.setSelector(selSpec)
2445
- raise "MiqVimBroker.setSelector: selSpec must be a hash, received #{selSpec.class}" unless selSpec.kind_of?(Hash)
2444
+ raise "MiqVimInventory.setSelector: selSpec must be a hash, received #{selSpec.class}" unless selSpec.kind_of?(Hash)
2446
2445
  selSpec.each_key do |k|
2447
- raise "MiqVimBroker.setSelector: selSpec keys must be symbols, received #{k.class}" unless k.kind_of?(Symbol)
2446
+ raise "MiqVimInventory.setSelector: selSpec keys must be symbols, received #{k.class}" unless k.kind_of?(Symbol)
2448
2447
  end
2449
2448
  ov = nil
2450
2449
  selSpec.each_value do |v|
@@ -2458,7 +2457,7 @@ class MiqVimInventory < MiqVimClientBase
2458
2457
  else
2459
2458
  ov = v unless v.kind_of?(String)
2460
2459
  end
2461
- raise "MiqVimBroker.setSelector: selSpec values must be strings or arrays of strings, received #{ov.class}" unless ov.nil?
2460
+ raise "MiqVimInventory.setSelector: selSpec values must be strings or arrays of strings, received #{ov.class}" unless ov.nil?
2462
2461
  end
2463
2462
  @@selectorHash.merge!(selSpec)
2464
2463
  end
@@ -2472,10 +2471,10 @@ class MiqVimInventory < MiqVimClientBase
2472
2471
  elsif selName.kind_of?(Array)
2473
2472
  remKeys = selName
2474
2473
  else
2475
- raise "MiqVimBroker.removeSelector: selName must be a symbol, hash or array, received #{selName.class}"
2474
+ raise "MiqVimInventory.removeSelector: selName must be a symbol, hash or array, received #{selName.class}"
2476
2475
  end
2477
2476
  remKeys.each do |rk|
2478
- raise "MiqVimBroker.removeSelector: keys must be symbols, received #{rk.class}" unless rk.kind_of?(Symbol)
2477
+ raise "MiqVimInventory.removeSelector: keys must be symbols, received #{rk.class}" unless rk.kind_of?(Symbol)
2479
2478
  end
2480
2479
 
2481
2480
  remKeys.each do |rk|