Disable wmi object caching by default
Due to the known issues related to WMI object caching, it's safer if we just disable it by default. Change-Id: If859917af9a185fc612231002d252c9e0ac6ddd3 Related-Bug: #1801701
This commit is contained in:
parent
21a2fe8758
commit
030df4e310
|
@ -23,12 +23,14 @@ os_win_opts = [
|
|||
help='Fibre Channel hbaapi library path. If no custom hbaapi '
|
||||
'library is requested, the default one will be used.'),
|
||||
cfg.BoolOpt('cache_temporary_wmi_objects',
|
||||
default=True,
|
||||
default=False,
|
||||
help='Caches temporary WMI objects in order to increase '
|
||||
'performance. This only affects networkutils, where '
|
||||
'almost all operations require a reference to a '
|
||||
'switch port. The cached objects are no longer valid '
|
||||
'if the VM they are associated with is destroyed.'),
|
||||
'if the VM they are associated with is destroyed. '
|
||||
'WARNING: use with caution, the cache may become '
|
||||
'invalid when certain resources are recreated.'),
|
||||
cfg.IntOpt('wmi_job_terminate_timeout',
|
||||
default=120,
|
||||
help='The default amount of seconds to wait when stopping '
|
||||
|
|
|
@ -72,6 +72,8 @@ class NetworkUtilsTestCase(test_base.OsWinBaseTestCase):
|
|||
self.assertEqual({}, self.netutils._switches)
|
||||
|
||||
def test_init_caches(self):
|
||||
self.netutils._enable_cache = True
|
||||
|
||||
self.netutils._switches = {}
|
||||
self.netutils._switch_ports = {}
|
||||
self.netutils._vlan_sds = {}
|
||||
|
@ -125,6 +127,8 @@ class NetworkUtilsTestCase(test_base.OsWinBaseTestCase):
|
|||
self.assertEqual({}, self.netutils._switch_ports)
|
||||
|
||||
def test_update_cache(self):
|
||||
self.netutils._enable_cache = True
|
||||
|
||||
self.netutils._switch_ports[mock.sentinel.other] = mock.sentinel.port
|
||||
conn = self.netutils._conn
|
||||
mock_port = mock.MagicMock(ElementName=mock.sentinel.port_name)
|
||||
|
|
Loading…
Reference in New Issue