1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

dbus: only log msg as debug if lvm2-lvmdbusd unit missing for D-Bus notification

Do not emit warning message but only log debug message if
lvm2-lvmdbusd.service unit is missing and at the same time
we have global/notify_dbus=1 (which is used by default if we
configured sources with "--enable-notify-dbus"). We don't want
hard dependency between LVM2 and lvmdbusd so it's enough to log
only debug message in this case.
This commit is contained in:
Peter Rajnoha 2016-11-14 14:46:44 +01:00
parent e7da8e7e1f
commit 68d6d342f8
2 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.168 - Version 2.02.168 -
==================================== ====================================
Only log msg as debug if lvm2-lvmdbusd unit missing for D-Bus notification.
Missing stripe filler now could be also 'zero'. Missing stripe filler now could be also 'zero'.
lvconvert --repair accepts --interval and --background option. lvconvert --repair accepts --interval and --background option.
More efficiently prepare _rmeta devices when creating a new raid LV. More efficiently prepare _rmeta devices when creating a new raid LV.

View File

@ -15,6 +15,7 @@
#define LVM_DBUS_DESTINATION "com.redhat.lvmdbus1" #define LVM_DBUS_DESTINATION "com.redhat.lvmdbus1"
#define LVM_DBUS_PATH "/com/redhat/lvmdbus1/Manager" #define LVM_DBUS_PATH "/com/redhat/lvmdbus1/Manager"
#define LVM_DBUS_INTERFACE "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 #ifdef NOTIFYDBUS_SUPPORT
#include <systemd/sd-bus.h> #include <systemd/sd-bus.h>
@ -26,6 +27,7 @@ int lvmnotify_is_supported(void)
void lvmnotify_send(struct cmd_context *cmd) void lvmnotify_send(struct cmd_context *cmd)
{ {
static const char _dbus_notification_failed_msg[] = "D-Bus notification failed";
sd_bus *bus = NULL; sd_bus *bus = NULL;
sd_bus_message *m = NULL; sd_bus_message *m = NULL;
sd_bus_error error = SD_BUS_ERROR_NULL; sd_bus_error error = SD_BUS_ERROR_NULL;
@ -61,7 +63,10 @@ void lvmnotify_send(struct cmd_context *cmd)
cmd_name); cmd_name);
if (ret < 0) { 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; goto out;
} }