Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a7034fa4200d63207daa4…
Commit: a7034fa4200d63207daa45290150159dd02cf01f
Parent: 5bdcafff47ee6a2e57e0c57d18cbc36cf1a2973e
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Tue Dec 18 12:43:57 2018 -0600
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Thu Dec 20 10:27:30 2018 -0600
tests/dbus: Re-enable nesting and pvcreate via symlink
If we are running the test where the device is /dev/* we will will
run the unit tests 'test_nesting' and 'test_pv_symlinks'. Otherwise
we will skip them.
---
test/dbus/lvmdbustest.py | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index d633aa3..9bc1683 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -1873,14 +1873,13 @@ class TestDbusService(unittest.TestCase):
# when run from lvm2 testsuite. See dbustest.sh.
pv_object_path = self.objs[PV_INT][0].object_path
- if not pv_object_path.startswith("/dev"):
- std_err_print('Skipping test not running in /dev')
- return
+ if not self.objs[PV_INT][0].Pv.Name.startswith("/dev"):
+ raise unittest.SkipTest('test not running in /dev')
for i in range(0, 5):
pv_object_path = self._create_nested(pv_object_path)
- def DISABLED_test_pv_symlinks(self):
+ def test_pv_symlinks(self):
# Lets take one of our test PVs, pvremove it, find a symlink to it
# and re-create using the symlink to ensure we return an object
# path to it. Additionally, we will take the symlink and do a lookup
@@ -1891,6 +1890,9 @@ class TestDbusService(unittest.TestCase):
pv = self.objs[PV_INT][0]
pv_device_path = pv.Pv.Name
+ if not pv_device_path.startswith("/dev"):
+ raise unittest.SkipTest('test not running in /dev')
+
self._pv_remove(pv)
# Make sure we no longer find the pv
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ab1f1a306bf8e146c1221…
Commit: ab1f1a306bf8e146c1221786a1c1c24f8b71a377
Parent: 3320ab8334794684b4d324bb78d0b293a27287a6
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Tue Dec 18 09:49:36 2018 -0600
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Thu Dec 20 10:27:30 2018 -0600
lvmdbusd: Exit daemon when unable to retrieve state
In some cases we get stuck where we are unable to retrieve the current
state of lvm as we are encountering an error. When the error is
persistent we will log and exit the daemon instead of consuming vast
amounts of resources.
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
daemons/lvmdbusd/cfg.py | 10 ++++++++++
daemons/lvmdbusd/fetch.py | 19 ++++++++++++++++++-
2 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/daemons/lvmdbusd/cfg.py b/daemons/lvmdbusd/cfg.py
index 771909f..be497d0 100644
--- a/daemons/lvmdbusd/cfg.py
+++ b/daemons/lvmdbusd/cfg.py
@@ -87,3 +87,13 @@ blackbox = None
# RequestEntry ctor
create_request_entry = None
+
+
+def exit_daemon():
+ """
+ Exit the daemon cleanly
+ :return:
+ """
+ if run and loop:
+ run.value = 0
+ loop.quit()
diff --git a/daemons/lvmdbusd/fetch.py b/daemons/lvmdbusd/fetch.py
index 69a4aae..e8f3521 100644
--- a/daemons/lvmdbusd/fetch.py
+++ b/daemons/lvmdbusd/fetch.py
@@ -14,6 +14,7 @@ from . import cfg
from .utils import MThreadRunner, log_debug, log_error
import threading
import queue
+import time
import traceback
@@ -82,6 +83,8 @@ class StateUpdate(object):
@staticmethod
def update_thread(obj):
+ exception_count = 0
+
queued_requests = []
while cfg.run.value != 0:
# noinspection PyBroadException
@@ -136,12 +139,26 @@ class StateUpdate(object):
# wake up if we get an exception
queued_requests = []
+ # We retrieved OK, clear exception count
+ exception_count = 0
+
except queue.Empty:
pass
- except Exception:
+ except Exception as e:
st = traceback.format_exc()
log_error("update_thread exception: \n%s" % st)
cfg.blackbox.dump()
+ exception_count += 1
+ if exception_count >= 5:
+ for i in queued_requests:
+ i.set_result(e)
+
+ log_error("Too many errors in update_thread, exiting daemon")
+ cfg.exit_daemon()
+
+ else:
+ # Slow things down when encountering errors
+ time.sleep(1)
def __init__(self):
self.lock = threading.RLock()