master - lvmdbusd: Use one thread to fetch state updates
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fa444906bbe5eda22aa5823ef2f9e196b0c15602 Commit: fa444906bbe5eda22aa5823ef2f9e196b0c15602 Parent: affe2cebf51169bff01fe20d9f4f1298bba9e1f9 Author: Tony Asleson <[email protected]> AuthorDate: Thu Nov 10 12:19:48 2016 -0600 Committer: Tony Asleson <[email protected]> CommitterDate: Thu Nov 17 11:35:16 2016 -0600
lvmdbusd: Use one thread to fetch state updates
In preparation to have more than one thread issuing commands to lvm at the same time we need to serialize updates to the dbus state and retrieving the global lvm state. To achieve this we have one thread handling this with a thread safe queue taking and coalescing requests.
--- daemons/lvmdbusd/cfg.py | 1 + daemons/lvmdbusd/fetch.py | 114 ++++++++++++++++++++++++++++++++++++++++- daemons/lvmdbusd/main.py | 63 +++++----------------- daemons/lvmdbusd/manager.py | 5 +- daemons/lvmdbusd/refresh.py | 45 ---------------- daemons/lvmdbusd/udevwatch.py | 3 +- 6 files changed, 131 insertions(+), 100 deletions(-)
daemons/lvmdbusd/cfg.py +1 -0
@@ -78,6 +78,7 @@ hidden_lv = itertools.count() # Used to prevent circular imports... load = None +event = None # Global cached state db = None
daemons/lvmdbusd/fetch.py +113 -1
123 lines not on this page · raw message
daemons/lvmdbusd/main.py +14 -49
110 lines not on this page · raw message
daemons/lvmdbusd/manager.py +2 -3
@@ -14,9 +14,7 @@ from .cfg import MANAGER_INTERFACE import dbus from . import cfg from . import cmdhandler -from .fetch import load_pvs, load_vgs from .request import RequestEntry -from .refresh import event_add from . import udevwatch
@@ -183,7 +181,8 @@ class Manager(AutomatedProperties): "udev monitoring") # We are dependent on external events now to stay current! cfg.ee = True - event_add((command,)) + utils.log_debug("ExternalEvent %s" % command) + cfg.event() return dbus.Int32(0) @staticmethod
daemons/lvmdbusd/refresh.py deleted +0 -45
45 lines not on this page · raw message
daemons/lvmdbusd/udevwatch.py +1 -2
@@ -9,7 +9,6 @@ import pyudev import threading -from .refresh import event_add from . import cfg observer = None
@@ -38,7 +37,7 @@ def filter_event(action, device): refresh = True if refresh: - event_add(('udev',)) + cfg.event() def add():