vmware_web_service 2.0.3 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/VMwareWebService/MiqHostDatastoreSystem.rb +5 -1
- data/lib/VMwareWebService/MiqVim.rb +80 -56
- data/lib/VMwareWebService/MiqVimClientBase.rb +11 -10
- data/lib/VMwareWebService/MiqVimCluster.rb +6 -2
- data/lib/VMwareWebService/MiqVimDataStore.rb +9 -6
- data/lib/VMwareWebService/MiqVimDump.rb +1 -1
- data/lib/VMwareWebService/MiqVimEventHistoryCollector.rb +5 -1
- data/lib/VMwareWebService/MiqVimEventMonitor.rb +22 -20
- data/lib/VMwareWebService/MiqVimFolder.rb +15 -11
- data/lib/VMwareWebService/MiqVimHost.rb +15 -13
- data/lib/VMwareWebService/MiqVimInventory.rb +78 -79
- data/lib/VMwareWebService/MiqVimPerfHistory.rb +13 -10
- data/lib/VMwareWebService/MiqVimUpdate.rb +50 -50
- data/lib/VMwareWebService/MiqVimVdlMod.rb +7 -7
- data/lib/VMwareWebService/MiqVimVm.rb +102 -101
- data/lib/VMwareWebService/VimService.rb +5 -2
- data/lib/VMwareWebService/VixDiskLib/VixDiskLib.rb +15 -7
- data/lib/VMwareWebService/VixDiskLib/VixDiskLibServer.rb +15 -15
- data/lib/VMwareWebService/VixDiskLib/vdl_wrapper.rb +26 -27
- data/lib/VMwareWebService/exception.rb +0 -2
- data/lib/VMwareWebService/logging.rb +16 -0
- data/lib/VMwareWebService/version.rb +1 -1
- data/lib/vmware_web_service.rb +2 -0
- metadata +15 -48
- data/lib/VMwareWebService/DMiqVim.rb +0 -95
- data/lib/VMwareWebService/DMiqVimSync.rb +0 -45
- data/lib/VMwareWebService/MiqVimBroker.rb +0 -581
- data/lib/VMwareWebService/MiqVimBrokerMods.rb +0 -222
- data/lib/VMwareWebService/MiqVimCoreUpdater.rb +0 -269
- data/lib/VMwareWebService/miq_fault_tolerant_vim.rb +0 -246
@@ -27,9 +27,9 @@ module MiqVimUpdate
|
|
27
27
|
|
28
28
|
while truncated
|
29
29
|
begin
|
30
|
-
|
30
|
+
logger.info "#{log_prefix}: call to waitForUpdates...Starting"
|
31
31
|
updateSet = waitForUpdatesEx(@umPropCol, version, wait_options)
|
32
|
-
|
32
|
+
logger.info "#{log_prefix}: call to waitForUpdates...Complete"
|
33
33
|
|
34
34
|
version = updateSet.version
|
35
35
|
truncated = updateSet.truncated
|
@@ -46,7 +46,7 @@ module MiqVimUpdate
|
|
46
46
|
# Help out the Ruby Garbage Collector by resetting variables pointing to large objects back to nil
|
47
47
|
updateSet = nil
|
48
48
|
rescue HTTPClient::ReceiveTimeoutError => terr
|
49
|
-
|
49
|
+
logger.info "#{log_prefix}: call to waitForUpdates...Timeout"
|
50
50
|
raise terr if !isAlive?
|
51
51
|
retry
|
52
52
|
end
|
@@ -58,9 +58,9 @@ module MiqVimUpdate
|
|
58
58
|
def monitorUpdatesSince(version)
|
59
59
|
log_prefix = "MiqVimUpdate.monitorUpdatesSince (#{@connId})"
|
60
60
|
begin
|
61
|
-
|
61
|
+
logger.info "#{log_prefix}: call to waitForUpdates...Starting (version = #{version})"
|
62
62
|
updateSet = waitForUpdatesEx(@umPropCol, version, :max_wait => @maxWait)
|
63
|
-
|
63
|
+
logger.info "#{log_prefix}: call to waitForUpdates...Complete (version = #{version})"
|
64
64
|
return version if updateSet.nil?
|
65
65
|
|
66
66
|
version = updateSet.version
|
@@ -70,11 +70,11 @@ module MiqVimUpdate
|
|
70
70
|
updateSet.filterSet.each do |fu|
|
71
71
|
next if fu.filter != @filterSpecRef
|
72
72
|
fu.objectSet.each do |objUpdate|
|
73
|
-
|
73
|
+
logger.info "#{log_prefix}: applying update...Starting (version = #{version})"
|
74
74
|
@cacheLock.synchronize(:EX) do
|
75
75
|
updateObject(objUpdate)
|
76
76
|
end
|
77
|
-
|
77
|
+
logger.info "#{log_prefix}: applying update...Complete (version = #{version})"
|
78
78
|
Thread.pass
|
79
79
|
end
|
80
80
|
end # updateSet.filterSet.each
|
@@ -82,9 +82,9 @@ module MiqVimUpdate
|
|
82
82
|
updateSet = nil
|
83
83
|
return version
|
84
84
|
rescue HTTPClient::ReceiveTimeoutError => terr
|
85
|
-
|
85
|
+
logger.info "#{log_prefix}: call to waitForUpdates...Timeout (version = #{version})"
|
86
86
|
retry if isAlive?
|
87
|
-
|
87
|
+
logger.warn "#{log_prefix}: connection lost"
|
88
88
|
raise terr
|
89
89
|
end
|
90
90
|
end
|
@@ -97,7 +97,7 @@ module MiqVimUpdate
|
|
97
97
|
@debugUpdates = false if @debugUpdates.nil?
|
98
98
|
@dumpToLog = true if @debugUpdates
|
99
99
|
|
100
|
-
|
100
|
+
logger.debug "#{log_prefix}: debugUpdates = #{@debugUpdates}"
|
101
101
|
|
102
102
|
begin
|
103
103
|
@umPropCol = @sic.propertyCollector
|
@@ -116,18 +116,18 @@ module MiqVimUpdate
|
|
116
116
|
# Ignore signals, except TERM
|
117
117
|
rescue => herr
|
118
118
|
if herr.respond_to?(:reason) && herr.reason == 'The task was canceled by a user.'
|
119
|
-
|
119
|
+
logger.info "#{log_prefix}: waitForUpdates canceled"
|
120
120
|
else
|
121
|
-
|
122
|
-
|
123
|
-
|
121
|
+
logger.error "******* #{herr.class}"
|
122
|
+
logger.error herr.to_s
|
123
|
+
logger.error herr.backtrace.join("\n") unless herr.kind_of?(HTTPClient::ReceiveTimeoutError) # already logged in monitorUpdatesInitial or monitorUpdatesSince
|
124
124
|
raise herr
|
125
125
|
end
|
126
126
|
ensure
|
127
127
|
if @filterSpecRef && isAlive?
|
128
|
-
|
128
|
+
logger.info "#{log_prefix}: calling destroyPropertyFilter...Starting"
|
129
129
|
destroyPropertyFilter(@filterSpecRef)
|
130
|
-
|
130
|
+
logger.info "#{log_prefix}: calling destroyPropertyFilter...Complete"
|
131
131
|
end
|
132
132
|
@filterSpecRef = nil
|
133
133
|
# @umPropCol = nil
|
@@ -137,18 +137,18 @@ module MiqVimUpdate
|
|
137
137
|
def stopUpdateMonitor
|
138
138
|
log_prefix = "MiqVimUpdate.stopUpdateMonitor (#{@connId})"
|
139
139
|
|
140
|
-
|
140
|
+
logger.info "#{log_prefix}: for address=<#{@server}>, username=<#{@username}>...Starting"
|
141
141
|
@monitor = false
|
142
142
|
if @umPropCol
|
143
143
|
if isAlive?
|
144
|
-
|
144
|
+
logger.info "#{log_prefix}: calling cancelWaitForUpdates...Starting"
|
145
145
|
cancelWaitForUpdates(@umPropCol)
|
146
|
-
|
146
|
+
logger.info "#{log_prefix}: calling cancelWaitForUpdates...Complete"
|
147
147
|
end
|
148
148
|
@umPropCol = nil
|
149
149
|
@updateThread.run if @updateThread.status == "sleep"
|
150
150
|
end
|
151
|
-
|
151
|
+
logger.info "#{log_prefix}: for address=<#{@server}>, username=<#{@username}>...Complete"
|
152
152
|
end
|
153
153
|
|
154
154
|
def forceFail
|
@@ -159,7 +159,7 @@ module MiqVimUpdate
|
|
159
159
|
def updateObject(objUpdate, initialUpdate = false)
|
160
160
|
unless @inventoryHash # no cache to update
|
161
161
|
return unless initialUpdate
|
162
|
-
|
162
|
+
logger.info "MiqVimUpdate.updateObject: setting @inventoryHash to empty hash"
|
163
163
|
@inventoryHash = {}
|
164
164
|
end
|
165
165
|
|
@@ -171,12 +171,12 @@ module MiqVimUpdate
|
|
171
171
|
when 'modify'
|
172
172
|
updateProps(objUpdate, initialUpdate)
|
173
173
|
else
|
174
|
-
|
174
|
+
logger.warn "MiqVimUpdate.updateObject (#{@connId}): unrecognized operation: #{objUpdate.kind}"
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
178
178
|
def updateProps(objUpdate, initialUpdate = false)
|
179
|
-
|
179
|
+
logger.debug "Update object (#{@connId}): #{objUpdate.obj.vimType}: #{objUpdate.obj}" if @debugUpdates
|
180
180
|
return if !objUpdate.changeSet || objUpdate.changeSet.empty?
|
181
181
|
|
182
182
|
#
|
@@ -191,7 +191,7 @@ module MiqVimUpdate
|
|
191
191
|
hashName = "#{pm[:baseName]}ByMor"
|
192
192
|
return unless (objHash = instance_variable_get(hashName)) # no cache to update
|
193
193
|
unless (obj = objHash[objUpdate.obj])
|
194
|
-
|
194
|
+
logger.warn "updateProps (#{@connId}): object #{objUpdate.obj} not found in #{hashName}"
|
195
195
|
return
|
196
196
|
end
|
197
197
|
|
@@ -234,8 +234,8 @@ module MiqVimUpdate
|
|
234
234
|
# Call the notify callback if enabled, defined and we are past the initial update
|
235
235
|
#
|
236
236
|
if @notifyMethod && !initialUpdate
|
237
|
-
|
238
|
-
|
237
|
+
logger.debug "MiqVimUpdate.updateProps (#{@connId}): server = #{@server}, mor = (#{objUpdate.obj.vimType}, #{objUpdate.obj})"
|
238
|
+
logger.debug "MiqVimUpdate.updateProps (#{@connId}): changedProps = [ #{changedProps.join(', ')} ]"
|
239
239
|
Thread.new do
|
240
240
|
@notifyMethod.call(:server => @server,
|
241
241
|
:username => @username,
|
@@ -251,9 +251,9 @@ module MiqVimUpdate
|
|
251
251
|
end
|
252
252
|
|
253
253
|
rescue => err
|
254
|
-
|
255
|
-
|
256
|
-
|
254
|
+
logger.warn "MiqVimUpdate::updateProps (#{@connId}): #{err}"
|
255
|
+
logger.warn "Clearing cache for (#{@connId}): #{pm[:baseName]}"
|
256
|
+
logger.debug err.backtrace.join("\n")
|
257
257
|
dumpCache("#{pm[:baseName]}ByMor")
|
258
258
|
|
259
259
|
instance_variable_set("#{pm[:baseName]}ByMor", nil)
|
@@ -266,9 +266,9 @@ module MiqVimUpdate
|
|
266
266
|
objBaseType = objUpdate.obj.vimBaseType
|
267
267
|
|
268
268
|
# always log additions to the inventory.
|
269
|
-
|
269
|
+
logger.info "MiqVimUpdate.addObject (#{@connId}): #{objType}: #{objUpdate.obj}"
|
270
270
|
return unless (pm = @propMap[objBaseType.to_sym]) # not an object type we cache
|
271
|
-
|
271
|
+
logger.info "MiqVimUpdate.addObject (#{@connId}): Adding object #{objType}: #{objUpdate.obj}"
|
272
272
|
|
273
273
|
#
|
274
274
|
# First, add the object's MOR to the @inventoryHash entry for the object's type.
|
@@ -283,7 +283,7 @@ module MiqVimUpdate
|
|
283
283
|
hashName = "#{pm[:baseName]}ByMor"
|
284
284
|
unless instance_variable_get(hashName) # no cache to update
|
285
285
|
return unless initialUpdate
|
286
|
-
|
286
|
+
logger.info "MiqVimUpdate.addObject: setting #{hashName} and #{pm[:baseName]} to empty hash"
|
287
287
|
instance_variable_set(hashName, {})
|
288
288
|
instance_variable_set(pm[:baseName], {})
|
289
289
|
end
|
@@ -298,7 +298,7 @@ module MiqVimUpdate
|
|
298
298
|
# Call the notify callback if enabled, defined and we are past the initial update
|
299
299
|
#
|
300
300
|
if @notifyMethod && !initialUpdate
|
301
|
-
|
301
|
+
logger.debug "MiqVimUpdate.addObject: server = #{@server}, mor = (#{objUpdate.obj.vimType}, #{objUpdate.obj})"
|
302
302
|
Thread.new do
|
303
303
|
@notifyMethod.call(:server => @server,
|
304
304
|
:username => @username,
|
@@ -310,9 +310,9 @@ module MiqVimUpdate
|
|
310
310
|
end
|
311
311
|
|
312
312
|
rescue => err
|
313
|
-
|
314
|
-
|
315
|
-
|
313
|
+
logger.warn "MiqVimUpdate::addObject: #{err}"
|
314
|
+
logger.warn "Clearing cache for: #{pm[:baseName]}"
|
315
|
+
logger.debug err.backtrace.join("\n")
|
316
316
|
dumpCache("#{pm[:baseName]}ByMor")
|
317
317
|
|
318
318
|
instance_variable_set("#{pm[:baseName]}ByMor", nil)
|
@@ -325,9 +325,9 @@ module MiqVimUpdate
|
|
325
325
|
objBaseType = objUpdate.obj.vimBaseType
|
326
326
|
|
327
327
|
# always log deletions from the inventory.
|
328
|
-
|
328
|
+
logger.info "MiqVimUpdate.deleteObject (#{@connId}): #{objType}: #{objUpdate.obj}"
|
329
329
|
return unless (pm = @propMap[objBaseType.to_sym]) # not an object type we cache
|
330
|
-
|
330
|
+
logger.info "MiqVimUpdate.deleteObject (#{@connId}): Deleting object: #{objType}: #{objUpdate.obj}"
|
331
331
|
|
332
332
|
ia = @inventoryHash[objType]
|
333
333
|
ia.delete(objUpdate.obj)
|
@@ -341,7 +341,7 @@ module MiqVimUpdate
|
|
341
341
|
# Call the notify callback if enabled, defined and we are past the initial update
|
342
342
|
#
|
343
343
|
if @notifyMethod && !initialUpdate
|
344
|
-
|
344
|
+
logger.debug "MiqVimUpdate.deleteObject: server = #{@server}, mor = (#{objUpdate.obj.vimType}, #{objUpdate.obj})"
|
345
345
|
Thread.new do
|
346
346
|
@notifyMethod.call(:server => @server,
|
347
347
|
:username => @username,
|
@@ -353,9 +353,9 @@ module MiqVimUpdate
|
|
353
353
|
end
|
354
354
|
|
355
355
|
rescue => err
|
356
|
-
|
357
|
-
|
358
|
-
|
356
|
+
logger.warn "MiqVimUpdate::deleteObject: #{err}"
|
357
|
+
logger.warn "Clearing cache for: #{pm[:baseName]}"
|
358
|
+
logger.debug err.backtrace.join("\n")
|
359
359
|
dumpCache("#{pm[:baseName]}ByMor")
|
360
360
|
|
361
361
|
instance_variable_set("#{pm[:baseName]}ByMor", nil)
|
@@ -367,17 +367,17 @@ module MiqVimUpdate
|
|
367
367
|
changedProps = [] if returnChangedProps
|
368
368
|
changeSet.each do |propChange|
|
369
369
|
if @debugUpdates
|
370
|
-
|
371
|
-
|
372
|
-
|
370
|
+
logger.debug "\tpropChange name (path): #{propChange.name}"
|
371
|
+
logger.debug "\tpropChange op: #{propChange.op}"
|
372
|
+
logger.debug "\tpropChange val (type): #{propChange.val.class}"
|
373
373
|
|
374
|
-
|
374
|
+
logger.debug "\t*** propChange val START:"
|
375
375
|
oGi = @globalIndent
|
376
376
|
@globalIndent = "\t\t"
|
377
377
|
dumpObj(propChange.val)
|
378
378
|
@globalIndent = oGi
|
379
|
-
|
380
|
-
|
379
|
+
logger.debug "\t*** propChange val END"
|
380
|
+
logger.debug "\t***"
|
381
381
|
end
|
382
382
|
|
383
383
|
#
|
@@ -424,9 +424,9 @@ module MiqVimUpdate
|
|
424
424
|
|
425
425
|
def dumpCache(cache)
|
426
426
|
return unless @debugUpdates
|
427
|
-
|
427
|
+
logger.debug "**** Dumping #{cache} cache"
|
428
428
|
dumbObj(instance_variable_get(cache))
|
429
|
-
|
429
|
+
logger.debug "**** #{cache} dump end"
|
430
430
|
end
|
431
431
|
private :dumpCache
|
432
432
|
|
@@ -5,9 +5,9 @@ module MiqVimVdlConnectionMod
|
|
5
5
|
#
|
6
6
|
def vdlConnection
|
7
7
|
require 'VMwareWebService/VixDiskLib/VixDiskLib'
|
8
|
-
VixDiskLib.init(->(s) {
|
9
|
-
->(s) {
|
10
|
-
->(s) {
|
8
|
+
VixDiskLib.init(->(s) { logger.info "VMware(VixDiskLib): #{s}" },
|
9
|
+
->(s) { logger.warn "VMware(VixDiskLib): #{s}" },
|
10
|
+
->(s) { logger.error "VMware(VixDiskLib): #{s}" })
|
11
11
|
$log.info "MiqVimVdlConnectionMod.vdlConnection: server - #{@server}"
|
12
12
|
VixDiskLib.connect(:serverName => server,
|
13
13
|
:port => 902,
|
@@ -17,7 +17,7 @@ module MiqVimVdlConnectionMod
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def closeVdlConnection(connection)
|
20
|
-
|
20
|
+
logger.info "MiqVimMod.closeVdlConnection: #{connection.serverName}"
|
21
21
|
connection.disconnect
|
22
22
|
end
|
23
23
|
end # module MiqVimVdlConnectionMod
|
@@ -31,9 +31,9 @@ module MiqVimVdlVcConnectionMod
|
|
31
31
|
def vdlVcConnection
|
32
32
|
require 'VMwareWebService/VixDiskLib/VixDiskLib'
|
33
33
|
|
34
|
-
VixDiskLib.init(->(s) {
|
35
|
-
->(s) {
|
36
|
-
->(s) {
|
34
|
+
VixDiskLib.init(->(s) { logger.info "VMware(VixDiskLib): #{s}" },
|
35
|
+
->(s) { logger.warn "VMware(VixDiskLib): #{s}" },
|
36
|
+
->(s) { logger.error "VMware(VixDiskLib): #{s}" })
|
37
37
|
|
38
38
|
$log.info "MiqVimVdlVcConnectionMod.vdlVcConnection: server - #{invObj.server}"
|
39
39
|
thumb_print = if invObj.isVirtualCenter?
|