vmware_web_service 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/VMwareWebService/MiqVimBroker.rb +0 -9
- data/lib/VMwareWebService/MiqVimInventory.rb +228 -4
- data/lib/VMwareWebService/MiqVimObjectSet.rb +6 -0
- data/lib/VMwareWebService/VimPropMaps.rb +30 -0
- data/lib/VMwareWebService/version.rb +1 -1
- metadata +4 -7
- data/lib/VMwareWebService/VimSyncDebug.rb +0 -16
- data/lib/VMwareWebService/broker_sync_debug.rb +0 -33
- data/lib/VMwareWebService/vim_base_sync_debug.rb +0 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 226087a0ff6c13ce429b1afcc992b15be50f5bdd1b69cfff1d7ac6dd7783f947
|
4
|
+
data.tar.gz: fe185b7ae7a35bbb2b7c35e620b7a867644ab58d40b31dc927d1199d5ba9d528
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56d673e90ebcd77929efdd966466d074fb47a244c8ab98de0ff1f31ffd25d210396e9e9a2ac3a1d8984ac20980af76e5e176263c362ac6bd5bfd28880fcae0a3
|
7
|
+
data.tar.gz: 75d6e04f83ef0fee9df9d73dbaaca3497c0aa4f214da4ef83572e74c5697d9f40541e1bda8a3dad31ba628a37aa8e010b69c4b3286dc54a2a6141b21471a329a
|
@@ -73,10 +73,6 @@ class MiqVimBroker
|
|
73
73
|
require 'timeout'
|
74
74
|
require 'VMwareWebService/broker_timeout'
|
75
75
|
|
76
|
-
# Un-comment following 2 lines to enable Sync lock debugging.
|
77
|
-
# require 'broker_sync_debug'
|
78
|
-
# extend BrokerSyncDebug
|
79
|
-
|
80
76
|
unless @@classModed
|
81
77
|
DRb.instance_variable_set(:@mutex, sync_for_drb)
|
82
78
|
DRb::DRbConn.instance_variable_set(:@mutex, sync_for_drb_drbconn)
|
@@ -107,27 +103,22 @@ class MiqVimBroker
|
|
107
103
|
end
|
108
104
|
end
|
109
105
|
|
110
|
-
# Can be overridden by BrokerSyncDebug.
|
111
106
|
def connection_lock
|
112
107
|
Sync.new
|
113
108
|
end
|
114
109
|
|
115
|
-
# Can be overridden by BrokerSyncDebug.
|
116
110
|
def config_lock
|
117
111
|
Sync.new
|
118
112
|
end
|
119
113
|
|
120
|
-
# Can be overridden by BrokerSyncDebug.
|
121
114
|
def sync_for_lock_hash(_key)
|
122
115
|
Sync.new
|
123
116
|
end
|
124
117
|
|
125
|
-
# Can be overridden by BrokerSyncDebug.
|
126
118
|
def sync_for_drb_drbconn
|
127
119
|
Sync.new
|
128
120
|
end
|
129
121
|
|
130
|
-
# Can be overridden by BrokerSyncDebug.
|
131
122
|
def sync_for_drb
|
132
123
|
Sync.new
|
133
124
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'VMwareWebService/VimSyncDebug'
|
2
1
|
require 'sync'
|
3
2
|
require 'enumerator'
|
4
3
|
require 'VMwareWebService/MiqVimClientBase'
|
@@ -94,9 +93,6 @@ class MiqVimInventory < MiqVimClientBase
|
|
94
93
|
@cacheLock = Sync.new
|
95
94
|
@configLock = Sync.new
|
96
95
|
|
97
|
-
# Un-comment to enable Sync lock debugging.
|
98
|
-
# extend VimSyncDebug
|
99
|
-
|
100
96
|
resetCache
|
101
97
|
__connect
|
102
98
|
@alive = true
|
@@ -201,6 +197,14 @@ class MiqVimInventory < MiqVimClientBase
|
|
201
197
|
ps.type = "Datastore"
|
202
198
|
ps.all = "false"
|
203
199
|
end
|
200
|
+
psa << VimHash.new("PropertySpec") do |ps|
|
201
|
+
ps.type = "LicenseManager"
|
202
|
+
ps.all = "false"
|
203
|
+
end
|
204
|
+
psa << VimHash.new("PropertySpec") do |ps|
|
205
|
+
ps.type = "ExtensionManager"
|
206
|
+
ps.all = "false"
|
207
|
+
end
|
204
208
|
end
|
205
209
|
VimArray.new("ArrayOfPropertyFilterSpec") do |pfsa|
|
206
210
|
pfsa << VimHash.new("PropertyFilterSpec") do |pfs|
|
@@ -1772,6 +1776,226 @@ class MiqVimInventory < MiqVimClientBase
|
|
1772
1776
|
addObjHash(:StoragePod, spObj)
|
1773
1777
|
end
|
1774
1778
|
|
1779
|
+
###################
|
1780
|
+
# License Managers
|
1781
|
+
###################
|
1782
|
+
|
1783
|
+
#
|
1784
|
+
# For internal use.
|
1785
|
+
# Must be called with cache lock held
|
1786
|
+
# Returns with the cache lock held - must be unlocked by caller.
|
1787
|
+
#
|
1788
|
+
def licenseManagers_locked
|
1789
|
+
raise "licenseManagers_locked: cache lock not held" unless @cacheLock.sync_locked?
|
1790
|
+
return(@licenseManagers) if @licenseManagers
|
1791
|
+
|
1792
|
+
$vim_log.info "MiqVimInventory.licenseManagers_locked: loading LicenseManager cache for #{@connId}"
|
1793
|
+
begin
|
1794
|
+
@cacheLock.sync_lock(:EX) if (unlock = @cacheLock.sync_shared?)
|
1795
|
+
|
1796
|
+
ra = getMoPropMulti(inventoryHash_locked['LicenseManager'], @propMap[:LicenseManager][:props])
|
1797
|
+
|
1798
|
+
@licenseManagers = {}
|
1799
|
+
@licenseManagersByMor = {}
|
1800
|
+
ra.each do |licenseManagerObj|
|
1801
|
+
addLicenseManagerObj(licenseManagerObj)
|
1802
|
+
end
|
1803
|
+
ensure
|
1804
|
+
@cacheLock.sync_unlock if unlock
|
1805
|
+
end
|
1806
|
+
$vim_log.info "MiqVimInventory.licenseManagers_locked: loaded LicenseManager cache for #{@connId}"
|
1807
|
+
|
1808
|
+
@licenseManagers
|
1809
|
+
end # def licenseManagers_locked
|
1810
|
+
protected :licenseManagers_locked
|
1811
|
+
|
1812
|
+
#
|
1813
|
+
# For internal use.
|
1814
|
+
# Must be called with cache lock held
|
1815
|
+
# Returns with the cache lock held - must be unlocked by caller.
|
1816
|
+
#
|
1817
|
+
def licenseManagersByMor_locked
|
1818
|
+
raise "licenseManagerByMor_locked: cache lock not held" unless @cacheLock.sync_locked?
|
1819
|
+
return(@licenseManagersByMor) if @licenseManagersByMor
|
1820
|
+
licenseManagers_locked
|
1821
|
+
@licenseManagersByMor
|
1822
|
+
end # def licenseManagersByMor_locked
|
1823
|
+
protected :licenseManagersByMor_locked
|
1824
|
+
|
1825
|
+
#
|
1826
|
+
# Public accessor
|
1827
|
+
#
|
1828
|
+
def licenseManagersByMor(selSpec = nil)
|
1829
|
+
license_managers = nil
|
1830
|
+
@cacheLock.synchronize(:SH) do
|
1831
|
+
if selSpec.nil?
|
1832
|
+
license_managers = dupObj(licenseManagersByMor_locked)
|
1833
|
+
else
|
1834
|
+
license_managers = applySelector(licenseManagersByMor_locked, selSpec)
|
1835
|
+
end
|
1836
|
+
end
|
1837
|
+
assert_no_locks
|
1838
|
+
license_managers
|
1839
|
+
end
|
1840
|
+
|
1841
|
+
#
|
1842
|
+
# Return a single License Manager object, given its MOR
|
1843
|
+
#
|
1844
|
+
def licenseManagerByMor(licenseManagerMor, selSpec = nil)
|
1845
|
+
@cacheLock.synchronize(:SH) do
|
1846
|
+
return(dupObj(licenseManagersByMor_locked[licenseManagerMor])) if selSpec.nil?
|
1847
|
+
return(applySelector(licenseManagersByMor_locked[licenseManagerMor], selSpec))
|
1848
|
+
end
|
1849
|
+
end
|
1850
|
+
|
1851
|
+
#
|
1852
|
+
# Public accessor
|
1853
|
+
#
|
1854
|
+
# Return an array of license manager objects that match the given property filter.
|
1855
|
+
#
|
1856
|
+
def licenseManagersByFilter(filter)
|
1857
|
+
license_managers = nil
|
1858
|
+
@cacheLock.synchronize(:SH) do
|
1859
|
+
license_managers = applyFilter(licenseManagersByMor_locked.values, filter)
|
1860
|
+
license_managers = dupObj(license_managers)
|
1861
|
+
end
|
1862
|
+
assert_no_locks
|
1863
|
+
license_managers
|
1864
|
+
end
|
1865
|
+
|
1866
|
+
def addLicenseManager(licenseManagerMor)
|
1867
|
+
@cacheLock.synchronize(:EX) do
|
1868
|
+
return(addObjByMor(licenseManagerMor))
|
1869
|
+
end
|
1870
|
+
end
|
1871
|
+
|
1872
|
+
def refreshLicenseManager(licenseManagerMor)
|
1873
|
+
@cacheLock.synchronize(:EX) do
|
1874
|
+
return(conditionalCopy(addObjByMor(licenseManagerMor)))
|
1875
|
+
end
|
1876
|
+
end
|
1877
|
+
|
1878
|
+
def addLicenseManagerObj(licenseManagerObj)
|
1879
|
+
addObjHash(:LicenseManager, licenseManagerObj)
|
1880
|
+
end
|
1881
|
+
protected :addLicenseManagerObj
|
1882
|
+
|
1883
|
+
def removeLicenseManager(licenseManagerMor)
|
1884
|
+
@cacheLock.synchronize(:EX) do
|
1885
|
+
removeObjByMor(licenseManagerMor)
|
1886
|
+
end
|
1887
|
+
end
|
1888
|
+
|
1889
|
+
###################
|
1890
|
+
# Extension Managers
|
1891
|
+
###################
|
1892
|
+
|
1893
|
+
#
|
1894
|
+
# For internal use.
|
1895
|
+
# Must be called with cache lock held
|
1896
|
+
# Returns with the cache lock held - must be unlocked by caller.
|
1897
|
+
#
|
1898
|
+
def extensionManagers_locked
|
1899
|
+
raise "extensionManagers_locked: cache lock not held" unless @cacheLock.sync_locked?
|
1900
|
+
return(@extensionManagers) if @extensionManagers
|
1901
|
+
|
1902
|
+
$vim_log.info "MiqVimInventory.extensionManagers_locked: loading ExtensionManager cache for #{@connId}"
|
1903
|
+
begin
|
1904
|
+
@cacheLock.sync_lock(:EX) if (unlock = @cacheLock.sync_shared?)
|
1905
|
+
|
1906
|
+
ra = getMoPropMulti(inventoryHash_locked['ExtensionManager'], @propMap[:ExtensionManager][:props])
|
1907
|
+
|
1908
|
+
@extensionManagers = {}
|
1909
|
+
@extensionManagersByMor = {}
|
1910
|
+
ra.each do |extensionManagerObj|
|
1911
|
+
addExtensionManagerObj(extensionManagerObj)
|
1912
|
+
end
|
1913
|
+
ensure
|
1914
|
+
@cacheLock.sync_unlock if unlock
|
1915
|
+
end
|
1916
|
+
$vim_log.info "MiqVimInventory.extensionManagers_locked: loaded ExtensionManager cache for #{@connId}"
|
1917
|
+
|
1918
|
+
@extensionManagers
|
1919
|
+
end # def extensionManagers_locked
|
1920
|
+
protected :extensionManagers_locked
|
1921
|
+
|
1922
|
+
#
|
1923
|
+
# For internal use.
|
1924
|
+
# Must be called with cache lock held
|
1925
|
+
# Returns with the cache lock held - must be unlocked by caller.
|
1926
|
+
#
|
1927
|
+
def extensionManagersByMor_locked
|
1928
|
+
raise "extensionManagersByMor_locked: cache lock not held" unless @cacheLock.sync_locked?
|
1929
|
+
return(@extensionManagersByMor) if @extensionManagersByMor
|
1930
|
+
extensionManagers_locked
|
1931
|
+
@extensionManagersByMor
|
1932
|
+
end # def extensionManagersByMor_locked
|
1933
|
+
protected :extensionManagersByMor_locked
|
1934
|
+
|
1935
|
+
#
|
1936
|
+
# Public accessor
|
1937
|
+
#
|
1938
|
+
def extensionManagersByMor(selSpec = nil)
|
1939
|
+
extension_managers = nil
|
1940
|
+
@cacheLock.synchronize(:SH) do
|
1941
|
+
if selSpec.nil?
|
1942
|
+
extension_managers = dupObj(extensionManagersByMor_locked)
|
1943
|
+
else
|
1944
|
+
extension_managers = applySelector(extensionManagersByMor_locked, selSpec)
|
1945
|
+
end
|
1946
|
+
end
|
1947
|
+
assert_no_locks
|
1948
|
+
extension_managers
|
1949
|
+
end
|
1950
|
+
|
1951
|
+
#
|
1952
|
+
# Return a single Extension Manager object, given its MOR
|
1953
|
+
#
|
1954
|
+
def extensionManagerByMor(extensionManagerMor, selSpec = nil)
|
1955
|
+
@cacheLock.synchronize(:SH) do
|
1956
|
+
return(dupObj(extensionManagersByMor_locked[extensionManagerMor])) if selSpec.nil?
|
1957
|
+
return(applySelector(extensionManagersByMor_locked[extensionManagerMor], selSpec))
|
1958
|
+
end
|
1959
|
+
end
|
1960
|
+
|
1961
|
+
#
|
1962
|
+
# Public accessor
|
1963
|
+
#
|
1964
|
+
# Return an array of extension manager objects that match the given property filter.
|
1965
|
+
#
|
1966
|
+
def extensionManagersByFilter(filter)
|
1967
|
+
extension_managers = nil
|
1968
|
+
@cacheLock.synchronize(:SH) do
|
1969
|
+
extension_managers = applyFilter(extensionManagersByMor_locked.values, filter)
|
1970
|
+
extension_managers = dupObj(extension_managers)
|
1971
|
+
end
|
1972
|
+
assert_no_locks
|
1973
|
+
extension_managers
|
1974
|
+
end
|
1975
|
+
|
1976
|
+
def addExtensionManager(extensionManagerMor)
|
1977
|
+
@cacheLock.synchronize(:EX) do
|
1978
|
+
return(addObjByMor(extensionManagerMor))
|
1979
|
+
end
|
1980
|
+
end
|
1981
|
+
|
1982
|
+
def refreshExtensionManager(extensionManagerMor)
|
1983
|
+
@cacheLock.synchronize(:EX) do
|
1984
|
+
return(conditionalCopy(addObjByMor(extensionManagerMor)))
|
1985
|
+
end
|
1986
|
+
end
|
1987
|
+
|
1988
|
+
def addExtensionManagerObj(extensionManagerObj)
|
1989
|
+
addObjHash(:ExtensionManager, extensionManagerObj)
|
1990
|
+
end
|
1991
|
+
protected :addExtensionManagerObj
|
1992
|
+
|
1993
|
+
def removeExtensionManager(extensionManagerMor)
|
1994
|
+
@cacheLock.synchronize(:EX) do
|
1995
|
+
removeObjByMor(extensionManagerMor)
|
1996
|
+
end
|
1997
|
+
end
|
1998
|
+
|
1775
1999
|
#
|
1776
2000
|
# A hash of managed object references for all the objects we care about.
|
1777
2001
|
#
|
@@ -139,6 +139,12 @@ module MiqVimObjectSet
|
|
139
139
|
os.skip = "false"
|
140
140
|
os.selectSet = VimArray.new("ArrayOfSelectionSpec") { |ssa| ssa << folderTs }
|
141
141
|
end
|
142
|
+
osa << VimHash.new("ObjectSpec") do |os|
|
143
|
+
os.obj = @sic.licenseManager
|
144
|
+
end
|
145
|
+
osa << VimHash.new("ObjectSpec") do |os|
|
146
|
+
os.obj = @sic.extensionManager
|
147
|
+
end
|
142
148
|
end
|
143
149
|
|
144
150
|
(aOobjSpec)
|
@@ -86,6 +86,20 @@ module VimPropMaps
|
|
86
86
|
'summary',
|
87
87
|
'parent'
|
88
88
|
]
|
89
|
+
},
|
90
|
+
:LicenseManager => {
|
91
|
+
:baseName => "@licenseManagers",
|
92
|
+
:keyPath => nil,
|
93
|
+
:props => [
|
94
|
+
'licenses'
|
95
|
+
]
|
96
|
+
},
|
97
|
+
:ExtensionManager => {
|
98
|
+
:baseName => "@extensionManagers",
|
99
|
+
:keyPath => nil,
|
100
|
+
:props => [
|
101
|
+
'extensionList'
|
102
|
+
]
|
89
103
|
}
|
90
104
|
}
|
91
105
|
|
@@ -303,6 +317,8 @@ module VimPropMaps
|
|
303
317
|
"config.network.dnsConfig.domainName",
|
304
318
|
"config.network.dnsConfig.hostName",
|
305
319
|
"config.network.ipRouteConfig.defaultGateway",
|
320
|
+
"config.network.opaqueNetwork",
|
321
|
+
"config.network.opaqueSwitch",
|
306
322
|
"config.network.pnic",
|
307
323
|
"config.network.portgroup",
|
308
324
|
"config.network.vnic",
|
@@ -393,6 +409,20 @@ module VimPropMaps
|
|
393
409
|
'summary.hostMember',
|
394
410
|
'parent'
|
395
411
|
]
|
412
|
+
},
|
413
|
+
:LicenseManager => {
|
414
|
+
:baseName => "@licenseManagers",
|
415
|
+
:keyPath => nil,
|
416
|
+
:props => [
|
417
|
+
'licenses'
|
418
|
+
]
|
419
|
+
},
|
420
|
+
:ExtensionManager => {
|
421
|
+
:baseName => "@extensionManagers",
|
422
|
+
:keyPath => nil,
|
423
|
+
:props => [
|
424
|
+
'extensionList'
|
425
|
+
]
|
396
426
|
}
|
397
427
|
}
|
398
428
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vmware_web_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ManageIQ Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -106,14 +106,14 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 2.
|
109
|
+
version: 2.0.0
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: 2.
|
116
|
+
version: 2.0.0
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
name: bundler
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -255,12 +255,10 @@ files:
|
|
255
255
|
- lib/VMwareWebService/VimMappingRegistry.rb
|
256
256
|
- lib/VMwareWebService/VimPropMaps.rb
|
257
257
|
- lib/VMwareWebService/VimService.rb
|
258
|
-
- lib/VMwareWebService/VimSyncDebug.rb
|
259
258
|
- lib/VMwareWebService/VimTypes.rb
|
260
259
|
- lib/VMwareWebService/VixDiskLib/VixDiskLib.rb
|
261
260
|
- lib/VMwareWebService/VixDiskLib/VixDiskLibServer.rb
|
262
261
|
- lib/VMwareWebService/VixDiskLib/vdl_wrapper.rb
|
263
|
-
- lib/VMwareWebService/broker_sync_debug.rb
|
264
262
|
- lib/VMwareWebService/broker_timeout.rb
|
265
263
|
- lib/VMwareWebService/esx_thumb_print.rb
|
266
264
|
- lib/VMwareWebService/exception.rb
|
@@ -268,7 +266,6 @@ files:
|
|
268
266
|
- lib/VMwareWebService/thumb_print.rb
|
269
267
|
- lib/VMwareWebService/vcenter_thumb_print.rb
|
270
268
|
- lib/VMwareWebService/version.rb
|
271
|
-
- lib/VMwareWebService/vim_base_sync_debug.rb
|
272
269
|
- lib/VMwareWebService/wsdl41/convert_mapping_registry_to_yaml.rb
|
273
270
|
- lib/VMwareWebService/wsdl41/core-types.xsd
|
274
271
|
- lib/VMwareWebService/wsdl41/methods/AboutInfo.yml
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'util/SyncDebug'
|
2
|
-
require 'VMwareWebService/vim_base_sync_debug'
|
3
|
-
|
4
|
-
module VimSyncDebug
|
5
|
-
def self.extended(obj)
|
6
|
-
obj.cacheLock.extend(SyncDebug_m)
|
7
|
-
obj.cacheLock.lock_name = "#{obj.class.name}#cacheLock(#{obj.connId})"
|
8
|
-
VimBaseSyncDebug.vsd_set_callbacks(obj.cacheLock)
|
9
|
-
obj.cacheLock.watchdog_enabled = true
|
10
|
-
|
11
|
-
obj.configLock.extend(SyncDebug_m)
|
12
|
-
obj.configLock.lock_name = "#{obj.class.name}#configLock(#{obj.connId})"
|
13
|
-
VimBaseSyncDebug.vsd_set_callbacks(obj.configLock)
|
14
|
-
obj.configLock.watchdog_enabled = true
|
15
|
-
end
|
16
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'util/SyncDebug'
|
2
|
-
require 'VMwareWebService/vim_base_sync_debug'
|
3
|
-
|
4
|
-
module BrokerSyncDebug
|
5
|
-
def connection_lock
|
6
|
-
alloc_sync_lock("#{self.class.name}#connectionLock")
|
7
|
-
end
|
8
|
-
|
9
|
-
def config_lock
|
10
|
-
alloc_sync_lock("#{self.class.name}#configLock")
|
11
|
-
end
|
12
|
-
|
13
|
-
def sync_for_lock_hash(key)
|
14
|
-
alloc_sync_lock("#{self.class.name}#lockHash[#{key}]")
|
15
|
-
end
|
16
|
-
|
17
|
-
def sync_for_drb
|
18
|
-
alloc_sync_lock("DRB#mutex")
|
19
|
-
end
|
20
|
-
|
21
|
-
def sync_for_drb_drbconn
|
22
|
-
alloc_sync_lock("DRb::DRbConn#mutex")
|
23
|
-
end
|
24
|
-
|
25
|
-
def alloc_sync_lock(lock_name)
|
26
|
-
lock = Sync.new
|
27
|
-
lock.extend(SyncDebug_m)
|
28
|
-
lock.lock_name = lock_name
|
29
|
-
VimBaseSyncDebug.vsd_set_callbacks(lock)
|
30
|
-
lock.watchdog_enabled = true
|
31
|
-
lock
|
32
|
-
end
|
33
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
module VimBaseSyncDebug
|
2
|
-
def self.vsd_set_callbacks(lock)
|
3
|
-
lock.on_lock_request do |li|
|
4
|
-
$vim_log.info "VimSyncDebug - Requesting lock: #{li[:lock].lock_name}, from_mode = #{li[:lock].sync_mode}, to_mode = #{li[:mode]} [#{li[:call_stack][0]}]"
|
5
|
-
end
|
6
|
-
|
7
|
-
lock.on_lock_acquire do |li|
|
8
|
-
$vim_log.info "VimSyncDebug - Acquired lock: #{li[:lock].lock_name}, acquired_mode = #{li[:lock].sync_mode}, requested_mode = #{li[:mode]} [#{li[:call_stack][0]}]"
|
9
|
-
end
|
10
|
-
|
11
|
-
lock.on_unlock_request do |li|
|
12
|
-
$vim_log.info "VimSyncDebug - Releasing lock: #{li[:lock].lock_name}, pre-release_mode = #{li[:lock].sync_mode}, [#{li[:call_stack][0]}]"
|
13
|
-
end
|
14
|
-
|
15
|
-
lock.on_unlock do |li|
|
16
|
-
$vim_log.info "VimSyncDebug - Released lock: #{li[:lock].lock_name}, post-release_mode = #{li[:lock].sync_mode}, [#{li[:call_stack][0]}]"
|
17
|
-
end
|
18
|
-
|
19
|
-
lock.on_dead_locker do |lia|
|
20
|
-
li = lia.first
|
21
|
-
thr = li[:thread]
|
22
|
-
ln = li[:lock].lock_name
|
23
|
-
$vim_log.error "VimSyncDebug - Locking Thread has terminated: Lock(#{ln}), Thread(#{thr.object_id})."
|
24
|
-
$vim_log.error "VimSyncDebug - Start backtrace"
|
25
|
-
$vim_log.error li[:call_stack].join("\n")
|
26
|
-
$vim_log.error "VimSyncDebug - End backtrace"
|
27
|
-
end
|
28
|
-
|
29
|
-
lock.on_lock_timeout lambda { |li, dt|
|
30
|
-
thr = li[:thread]
|
31
|
-
$vim_log.error "VimSyncDebug - Lock timeout: thread #{thr.object_id} has held #{li[:lock].lock_name} for #{dt} seconds"
|
32
|
-
$vim_log.error "VimSyncDebug - Lock acquisition: Start backtrace"
|
33
|
-
$vim_log.error li[:call_stack].join("\n")
|
34
|
-
$vim_log.error "VimSyncDebug - Lock acquisition: End backtrace"
|
35
|
-
|
36
|
-
$vim_log.error "VimSyncDebug - Locking thread: Start backtrace"
|
37
|
-
$vim_log.error thr.backtrace.join("\n") if thr.alive?
|
38
|
-
$vim_log.error "VimSyncDebug - Locking thread: End backtrace"
|
39
|
-
return false # don't raise an exception
|
40
|
-
}
|
41
|
-
|
42
|
-
lock.on_watchdog_start do |l|
|
43
|
-
$vim_log.info "VimSyncDebug - Watchdog starting for #{l.lock_name}"
|
44
|
-
end
|
45
|
-
|
46
|
-
lock.on_watchdog_stop do |l, err|
|
47
|
-
$vim_log.info "VimSyncDebug - Watchdog for #{l.lock_name} stopping"
|
48
|
-
if err
|
49
|
-
$vim_log.error "VimSyncDebug - Watchdog ERROR: #{err}"
|
50
|
-
$vim_log.error "VimSyncDebug - Watchdog: Start backtrace"
|
51
|
-
$vim_log.error err.backtrace.join("\n")
|
52
|
-
$vim_log.error "VimSyncDebug - Watchdog: End backtrace"
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
lock.on_watchdog_heartbeat do |l|
|
57
|
-
$vim_log.debug "Watchdog for #{l.lock_name}: HEARTBEAT"
|
58
|
-
end
|
59
|
-
|
60
|
-
# lock.on_watchdog_acquire_mutex do |l|
|
61
|
-
# $vim_log.debug "Watchdog for #{l.lock_name}: MUTEX acquired"
|
62
|
-
# end
|
63
|
-
#
|
64
|
-
# lock.on_watchdog_release_mutex do |l|
|
65
|
-
# $vim_log.debug "Watchdog for #{l.lock_name}: MUTEX released"
|
66
|
-
# end
|
67
|
-
end
|
68
|
-
end
|