mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
lvmdbusd: Add diagnostic validate for look ups
Make sure that the lookup tables don't have extranoues stuff in them.
This commit is contained in:
parent
d906fd5201
commit
a93616cf66
@ -115,6 +115,10 @@ class Manager(AutomatedProperties):
|
|||||||
|
|
||||||
# This is a diagnostic and should not be run in normal operation, so
|
# This is a diagnostic and should not be run in normal operation, so
|
||||||
# lets remove the log entries for refresh as it's implied.
|
# lets remove the log entries for refresh as it's implied.
|
||||||
|
|
||||||
|
# Run an internal diagnostic on the object manager look up tables
|
||||||
|
lc = cfg.om.validate_lookups()
|
||||||
|
|
||||||
rc = cfg.load(log=False)
|
rc = cfg.load(log=False)
|
||||||
|
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
@ -122,7 +126,7 @@ class Manager(AutomatedProperties):
|
|||||||
'bg_black', 'fg_light_red')
|
'bg_black', 'fg_light_red')
|
||||||
else:
|
else:
|
||||||
utils.log_debug('Manager.Refresh - exit %d' % (rc))
|
utils.log_debug('Manager.Refresh - exit %d' % (rc))
|
||||||
return rc
|
return rc + lc
|
||||||
|
|
||||||
@dbus.service.method(
|
@dbus.service.method(
|
||||||
dbus_interface=MANAGER_INTERFACE,
|
dbus_interface=MANAGER_INTERFACE,
|
||||||
|
@ -12,8 +12,9 @@ import threading
|
|||||||
import traceback
|
import traceback
|
||||||
import dbus
|
import dbus
|
||||||
import os
|
import os
|
||||||
|
import copy
|
||||||
from . import cfg
|
from . import cfg
|
||||||
from .utils import log_debug, pv_obj_path_generate
|
from .utils import log_debug, pv_obj_path_generate, log_error
|
||||||
from .automatedproperties import AutomatedProperties
|
from .automatedproperties import AutomatedProperties
|
||||||
|
|
||||||
|
|
||||||
@ -70,6 +71,31 @@ class ObjectManager(AutomatedProperties):
|
|||||||
log_debug(('SIGNAL: InterfacesRemoved(%s, %s)' %
|
log_debug(('SIGNAL: InterfacesRemoved(%s, %s)' %
|
||||||
(str(object_path), str(interface_list))))
|
(str(object_path), str(interface_list))))
|
||||||
|
|
||||||
|
def validate_lookups(self):
|
||||||
|
with self.rlock:
|
||||||
|
tmp_lookups = copy.deepcopy(self._id_to_object_path)
|
||||||
|
|
||||||
|
# iterate over all we know, removing from the copy. If all is well
|
||||||
|
# we will have zero items left over
|
||||||
|
for path, md in self._objects.items():
|
||||||
|
obj, lvm_id, uuid = md
|
||||||
|
|
||||||
|
if lvm_id:
|
||||||
|
assert path == tmp_lookups[lvm_id]
|
||||||
|
del tmp_lookups[lvm_id]
|
||||||
|
|
||||||
|
if uuid:
|
||||||
|
assert path == tmp_lookups[uuid]
|
||||||
|
del tmp_lookups[uuid]
|
||||||
|
|
||||||
|
rc = len(tmp_lookups)
|
||||||
|
if rc:
|
||||||
|
# Error condition
|
||||||
|
log_error("_id_to_object_path has extraneous lookups!")
|
||||||
|
for key, path in tmp_lookups.items():
|
||||||
|
log_error("Key= %s, path= %s" % (key, path))
|
||||||
|
return rc
|
||||||
|
|
||||||
def _lookup_add(self, obj, path, lvm_id, uuid):
|
def _lookup_add(self, obj, path, lvm_id, uuid):
|
||||||
"""
|
"""
|
||||||
Store information about what we added to the caches so that we
|
Store information about what we added to the caches so that we
|
||||||
|
Loading…
Reference in New Issue
Block a user