1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

filters: do not print [none:nil] as external device info's [source:handler] if "none" source is used

Print [source:handler] in filters' debug messages only if external
device info source other than "none" is used.

$ lvmconfig --type full devices/external_device_info_source
external_device_info_source="none

Before this patch (from the -vvvv log):

filters/filter-usable.c:47         /dev/mapper/test: Skipping: Too small to hold a PV [none:(nil)]
filters/filter-md.c:33         /dev/sdb: Skipping md component device [none:(nil)]
filters/filter-partitioned.c:25         /dev/vda: Skipping: Partition table signature found [none:(nil)]

With this patch applied:

filters/filter-usable.c:44         /dev/mapper/test: Skipping: Too small to hold a PV
filters/filter-md.c:35         /dev/sdb: Skipping md component device
filters/filter-partitioned.c:27         /dev/vda: Skipping: Partition table signature found
This commit is contained in:
Peter Rajnoha 2015-09-03 14:19:48 +02:00
parent fc35b6988d
commit 00b610e542
5 changed files with 32 additions and 15 deletions

View File

@ -61,6 +61,8 @@ static int _dev_is_fwraid(struct device *dev)
return 0; return 0;
} }
#define MSG_SKIPPING "%s: Skipping firmware RAID component device"
static int _ignore_fwraid(struct dev_filter *f __attribute__((unused)), static int _ignore_fwraid(struct dev_filter *f __attribute__((unused)),
struct device *dev) struct device *dev)
{ {
@ -72,8 +74,11 @@ static int _ignore_fwraid(struct dev_filter *f __attribute__((unused)),
ret = _dev_is_fwraid(dev); ret = _dev_is_fwraid(dev);
if (ret == 1) { if (ret == 1) {
log_debug_devs("%s: Skipping firmware RAID component device [%s:%p]", if (dev->ext.src == DEV_EXT_NONE)
dev_name(dev), dev_ext_name(dev), dev->ext.handle); log_debug_devs(MSG_SKIPPING, dev_name(dev));
else
log_debug_devs(MSG_SKIPPING " [%s:%p]", dev_name(dev),
dev_ext_name(dev), dev->ext.handle);
return 0; return 0;
} }

View File

@ -18,6 +18,8 @@
#ifdef __linux__ #ifdef __linux__
#define MSG_SKIPPING "%s: Skipping md component device"
static int _ignore_md(struct dev_filter *f __attribute__((unused)), static int _ignore_md(struct dev_filter *f __attribute__((unused)),
struct device *dev) struct device *dev)
{ {
@ -29,8 +31,11 @@ static int _ignore_md(struct dev_filter *f __attribute__((unused)),
ret = dev_is_md(dev, NULL); ret = dev_is_md(dev, NULL);
if (ret == 1) { if (ret == 1) {
log_debug_devs("%s: Skipping md component device [%s:%p]", if (dev->ext.src == DEV_EXT_NONE)
dev_name(dev), dev_ext_name(dev), dev->ext.handle); log_debug_devs(MSG_SKIPPING, dev_name(dev));
else
log_debug_devs(MSG_SKIPPING " [%s:%p]", dev_name(dev),
dev_ext_name(dev), dev->ext.handle);
return 0; return 0;
} }

View File

@ -244,11 +244,16 @@ static int _dev_is_mpath(struct dev_filter *f, struct device *dev)
return 0; return 0;
} }
#define MSG_SKIPPING "%s: Skipping mpath component device"
static int _ignore_mpath(struct dev_filter *f, struct device *dev) static int _ignore_mpath(struct dev_filter *f, struct device *dev)
{ {
if (_dev_is_mpath(f, dev) == 1) { if (_dev_is_mpath(f, dev) == 1) {
log_debug_devs("%s: Skipping mpath component device [%s:%p]", if (dev->ext.src == DEV_EXT_NONE)
dev_name(dev), dev_ext_name(dev), dev->ext.handle); log_debug_devs(MSG_SKIPPING, dev_name(dev));
else
log_debug_devs(MSG_SKIPPING " [%s:%p]", dev_name(dev),
dev_ext_name(dev), dev->ext.handle);
return 0; return 0;
} }

View File

@ -16,13 +16,18 @@
#include "lib.h" #include "lib.h"
#include "filter.h" #include "filter.h"
#define MSG_SKIPPING "%s: Skipping: Partition table signature found"
static int _passes_partitioned_filter(struct dev_filter *f, struct device *dev) static int _passes_partitioned_filter(struct dev_filter *f, struct device *dev)
{ {
struct dev_types *dt = (struct dev_types *) f->private; struct dev_types *dt = (struct dev_types *) f->private;
if (dev_is_partitioned(dt, dev)) { if (dev_is_partitioned(dt, dev)) {
log_debug_devs("%s: Skipping: Partition table signature found [%s:%p]", if (dev->ext.src == DEV_EXT_NONE)
dev_name(dev), dev_ext_name(dev), dev->ext.handle); log_debug_devs(MSG_SKIPPING, dev_name(dev));
else
log_debug_devs(MSG_SKIPPING " [%s:%p]", dev_name(dev),
dev_ext_name(dev), dev->ext.handle);
return 0; return 0;
} }

View File

@ -29,22 +29,19 @@ static int _native_check_pv_min_size(struct device *dev)
/* Check it's accessible */ /* Check it's accessible */
if (!dev_open_readonly_quiet(dev)) { if (!dev_open_readonly_quiet(dev)) {
log_debug_devs("%s: Skipping: open failed [%s:%p]", log_debug_devs("%s: Skipping: open failed", dev_name(dev));
dev_name(dev), dev_ext_name(dev), dev->ext.handle);
return 0; return 0;
} }
/* Check it's not too small */ /* Check it's not too small */
if (!dev_get_size(dev, &size)) { if (!dev_get_size(dev, &size)) {
log_debug_devs("%s: Skipping: dev_get_size failed [%s:%p]", log_debug_devs("%s: Skipping: dev_get_size failed", dev_name(dev));
dev_name(dev), dev_ext_name(dev), dev->ext.handle);
goto out; goto out;
} }
if (size < pv_min_size()) { if (size < pv_min_size()) {
log_debug_devs("%s: Skipping: %s [%s:%p]", dev_name(dev), log_debug_devs("%s: Skipping: %s", dev_name(dev),
_too_small_to_hold_pv_msg, _too_small_to_hold_pv_msg);
dev_ext_name(dev), dev->ext.handle);
goto out; goto out;
} }