Only log msg as debug if lvm2-lvmdbusd unit missing for D-Bus notification.

This commit is contained in:
Peter Rajnoha 2016-11-15 09:00:17 +01:00
parent 7afed5c3ab
commit 5f4f83014b
2 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,48 @@
WHATS_NEW | 4 ++++
lib/notify/lvmnotify.c | 7 ++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 379bd3b..4f11256 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,3 +1,7 @@
+Version 2.02.168 -
+====================================
+ Only log msg as debug if lvm2-lvmdbusd unit missing for D-Bus notification.
+
Version 2.02.167 - 5th November 2016
====================================
Use log_error in regex and sysfs filter to describe reason of failure.
diff --git a/lib/notify/lvmnotify.c b/lib/notify/lvmnotify.c
index e9f8e29..ac0ca73 100644
--- a/lib/notify/lvmnotify.c
+++ b/lib/notify/lvmnotify.c
@@ -15,6 +15,7 @@
#define LVM_DBUS_DESTINATION "com.redhat.lvmdbus1"
#define LVM_DBUS_PATH "/com/redhat/lvmdbus1/Manager"
#define LVM_DBUS_INTERFACE "com.redhat.lvmdbus1.Manager"
+#define SD_BUS_NO_SUCH_UNIT_ERROR "org.freedesktop.systemd1.NoSuchUnit"
#ifdef NOTIFYDBUS_SUPPORT
#include <systemd/sd-bus.h>
@@ -26,6 +27,7 @@ int lvmnotify_is_supported(void)
void lvmnotify_send(struct cmd_context *cmd)
{
+ static const char _dbus_notification_failed_msg[] = "D-Bus notification failed";
sd_bus *bus = NULL;
sd_bus_message *m = NULL;
sd_bus_error error = SD_BUS_ERROR_NULL;
@@ -61,7 +63,10 @@ void lvmnotify_send(struct cmd_context *cmd)
cmd_name);
if (ret < 0) {
- log_warn("WARNING: D-Bus notification failed: %s", error.message);
+ if (sd_bus_error_has_name(&error, SD_BUS_NO_SUCH_UNIT_ERROR))
+ log_debug_dbus("%s: %s", _dbus_notification_failed_msg, error.message);
+ else
+ log_warn("WARNING: %s: %s", _dbus_notification_failed_msg, error.message);
goto out;
}

View File

@ -53,13 +53,14 @@ Summary: Userland logical volume management tools
Name: lvm2
Version: 2.02.167
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2
Group: System Environment/Base
URL: http://sources.redhat.com/lvm2
Source0: ftp://sources.redhat.com/pub/lvm2/releases/LVM2.%{version}.tgz
Patch0: lvm2-set-default-preferred_names.patch
Patch1: lvm2-lvmetad-timeout.patch
Patch2: lvm2-2_02_168-only-log-msg-as-debug-if-lvm2-dbusd-unit-missing-for-d-bus-notification.patch
BuildRequires: libselinux-devel >= %{libselinux_version}, libsepol-devel
BuildRequires: libblkid-devel >= %{util_linux_version}
@ -115,6 +116,7 @@ or more physical volumes and creating one or more logical volumes
%setup -q -n LVM2.%{version}
%patch0 -p1 -b .preferred_names
%patch1 -p1 -b .lvmetad_timeout
%patch2 -p1 -b .lvmdbus_msg
%build
%global _default_pid_dir /run
@ -838,6 +840,9 @@ the device-mapper event library.
%{_libdir}/pkgconfig/devmapper-event.pc
%changelog
* Tue Nov 15 2016 Peter Rajnoha <prajnoha@redhat.com> - 2.02.167-2
- Only log msg as debug if lvm2-lvmdbusd unit missing for D-Bus notification.
* Mon Nov 07 2016 Peter Rajnoha <prajnoha@redhat.com> - 2.02.167-1
- Use log_error in regex and sysfs filter to describe reason of failure.
- Fix blkdeactivate to deactivate dev stack if dev on top already unmounted.