Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=88530b2ef34527ea…
Commit: 88530b2ef34527eae2bacc86c765fb680f5b6b2b
Parent: 081359f6cd2ed8224992c91e99617ef576e01488
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Feb 25 16:57:01 2016 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Feb 25 17:02:18 2016 -0600
pvcreate: fix data alignment error check
Make the data_alignment variable 64 bits so it
can hold the invalid command line arg used in
pvreate-usage.sh pvcreate --dataalignment 1e.
On 32 bit arches, the smaller variable wouldn't
hold the invalid value so the error would not
trigger as expected by the test.
---
lib/metadata/metadata-exported.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 03e8572..6b39de4 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -522,8 +522,8 @@ struct vgnameid_list {
*/
struct pv_create_args {
uint64_t size;
- unsigned long data_alignment;
- unsigned long data_alignment_offset;
+ uint64_t data_alignment;
+ uint64_t data_alignment_offset;
uint64_t label_sector;
int pvmetadatacopies;
uint64_t pvmetadatasize;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=26b826ccf59b891a…
Commit: 26b826ccf59b891a7947d9f7f2bacf8d0a5172a9
Parent: 0d620e681fe42d0a1b2a5666677c36753838c6fd
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Thu Feb 25 16:12:53 2016 -0600
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Thu Feb 25 16:43:55 2016 -0600
lvmdbusd testing: Add validatestate.py utility
This simple tool calls the Manager.Refresh method on the dbus service
to check and see if the dbus service has the most up to date state.
This is to be used for testing to ensure that event driven updates are
working as planned.
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
test/dbus/validatestate.py | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/test/dbus/validatestate.py b/test/dbus/validatestate.py
new file mode 100755
index 0000000..faa2083
--- /dev/null
+++ b/test/dbus/validatestate.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+
+# Copyright (C) 2015-2016 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Simply connects to the dbus service and calls Refresh and ensures that the
+# value returned is zero
+
+import testlib
+import dbus
+from dbus.mainloop.glib import DBusGMainLoop
+import sys
+import os
+
+
+if __name__ == "__main__":
+
+ use_session = os.getenv('LVMDBUSD_USE_SESSION', False)
+
+ if use_session:
+ bus = dbus.SessionBus(mainloop=DBusGMainLoop())
+ else:
+ bus = dbus.SystemBus(mainloop=DBusGMainLoop())
+
+ mgr_proxy = testlib.ClientProxy(bus, testlib.MANAGER_OBJ)
+ sys.exit(mgr_proxy.Manager.Refresh())
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f1bc68beb4e493a9…
Commit: f1bc68beb4e493a9c1a52750e99d50f874ca89d9
Parent: 045d086a570d327b00a4a06d139b387d059ade60
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Thu Feb 25 14:57:12 2016 -0600
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Thu Feb 25 16:43:55 2016 -0600
lvmdbusd: Reduce unnecessary state refreshes
When we use udev or have lvm call back into the dbus service when a
change occurs, even if that change originated from the dbus service
we end up refreshing the state of the system twice which is not
needed or wanted. This change handles this case by removing any
pending refreshes in the worker queue if the state of the system
was just updated.
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
daemons/lvmdbusd/lvmdb.py | 3 +--
daemons/lvmdbusd/main.py | 43 ++++++++++++++++++++++++++++++++++++-------
2 files changed, 37 insertions(+), 9 deletions(-)
diff --git a/daemons/lvmdbusd/lvmdb.py b/daemons/lvmdbusd/lvmdb.py
index 46e2099..132bee7 100755
--- a/daemons/lvmdbusd/lvmdb.py
+++ b/daemons/lvmdbusd/lvmdb.py
@@ -272,10 +272,9 @@ class DataStore(object):
:param log Add debug log entry/exit messages
:return: None
"""
-
+ self.num_refreshes += 1
if log:
log_debug("lvmdb - refresh entry")
- self.num_refreshes += 1
# Grab everything first then parse it
_raw_pvs = cmdhandler.pv_retrieve_with_segs()
diff --git a/daemons/lvmdbusd/main.py b/daemons/lvmdbusd/main.py
index c9211f7..6cabcc4 100644
--- a/daemons/lvmdbusd/main.py
+++ b/daemons/lvmdbusd/main.py
@@ -24,11 +24,11 @@ from .manager import Manager
from .background import background_reaper
import traceback
import queue
-import sys
from . import udevwatch
from .utils import log_debug
import argparse
import os
+from .refresh import handle_external_event, event_complete
class Lvm(objectmanager.ObjectManager):
@@ -36,6 +36,30 @@ class Lvm(objectmanager.ObjectManager):
super(Lvm, self).__init__(object_path, BASE_INTERFACE)
+def _discard_pending_refreshes():
+ # We just handled a refresh, if we have any in the queue they can be
+ # removed because by definition they are older than the refresh we just did.
+ # As we limit the number of refreshes getting into the queue
+ # we should only ever have one to remove.
+ requests = []
+ while not cfg.worker_q.empty():
+ try:
+ r = cfg.worker_q.get(block=False)
+ if r.method != handle_external_event:
+ requests.append(r)
+ else:
+ # Make sure we make this event complete even though it didn't
+ # run, otherwise no other events will get processed
+ event_complete()
+ break
+ except queue.Empty:
+ break
+
+ # Any requests we removed, but did not discard need to be re-queued
+ for r in requests:
+ cfg.worker_q.put(r)
+
+
def process_request():
while cfg.run.value != 0:
try:
@@ -50,16 +74,21 @@ def process_request():
end = cfg.db.num_refreshes
- if end - start > 1:
- log_debug(
- "Inspect method %s for too many refreshes" %
- (str(req.method)))
+ num_refreshes = end - start
+
+ if num_refreshes > 0:
+ _discard_pending_refreshes()
+
+ if num_refreshes > 1:
+ log_debug(
+ "Inspect method %s for too many refreshes" %
+ (str(req.method)))
log_debug("Complete ")
except queue.Empty:
pass
except Exception:
- traceback.print_exc(file=sys.stdout)
- pass
+ st = traceback.format_exc()
+ utils.log_error("process_request exception: \n%s" % st)
def main():