lvm2/display-dm-name-for-lv-name.diff

50 lines
2.4 KiB
Diff

---
lib/config/config_settings.h | 1 +
lib/config/defaults.h | 1 +
lib/display/display.c | 14 ++++++++++----
lib/display/display.h | 1 +
4 files changed, 13 insertions(+), 4 deletions(-)
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -187,6 +187,7 @@ cfg_array(global_cache_check_options_CFG
cfg(global_cache_dump_executable_CFG, "cache_dump_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, CACHE_DUMP_CMD, vsn(2, 2, 108), NULL)
cfg(global_cache_repair_executable_CFG, "cache_repair_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, CACHE_REPAIR_CMD, vsn(2, 2, 108), NULL)
cfg_array(global_cache_repair_options_CFG, "cache_repair_options", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S" DEFAULT_CACHE_REPAIR_OPTIONS, vsn(2, 2, 108), NULL)
+cfg(global_display_dm_name_for_lv_name_CFG, "display_dm_name_for_lv_name", global_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_DISPLAY_DM_NAME_FOR_LV_NAME, vsn(2, 2, 98), NULL)
cfg(activation_checks_CFG, "checks", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_ACTIVATION_CHECKS, vsn(2, 2, 86), NULL)
cfg(activation_udev_sync_CFG, "udev_sync", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_UDEV_SYNC, vsn(2, 2, 51), NULL)
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -31,6 +31,7 @@
#define DEFAULT_PROC_DIR "/proc"
#define DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV 1
#define DEFAULT_SYSFS_SCAN 1
+#define DEFAULT_DISPLAY_DM_NAME_FOR_LV_NAME 0
#define DEFAULT_MD_COMPONENT_DETECTION 1
#define DEFAULT_MD_CHUNK_ALIGNMENT 1
#define DEFAULT_IGNORE_LVM_MIRRORS 1
--- a/lib/display/display.c
+++ b/lib/display/display.c
@@ -461,10 +461,15 @@ int lvdisplay_full(struct cmd_context *c
lv->vg->cmd->dev_dir, lv->vg->name, lv->name);
else if (lv_is_visible(lv)) {
/* Thin pool does not have /dev/vg/name link */
- if (!lv_is_thin_pool(lv))
- log_print("LV Path %s%s/%s",
- lv->vg->cmd->dev_dir,
- lv->vg->name, lv->name);
+ if (!lv_is_thin_pool(lv)) {
+ if (find_config_tree_bool(cmd, global_display_dm_name_for_lv_name_CFG, NULL)) {
+ log_print("LV Path %smapper/%s-%s", lv->vg->cmd->dev_dir,
+ lv->vg->name, lv->name);
+ } else {
+ log_print("LV Path %s%s/%s", lv->vg->cmd->dev_dir,
+ lv->vg->name, lv->name);
+ }
+ }
log_print("LV Name %s", lv->name);
} else
log_print("Internal LV Name %s", lv->name);