#include "activate.h"
#include "toolcontext.h"
#include "segtype.h"
+#include "defaults.h"
#define SIZE_BUF 128
char uuid[64] __attribute__((aligned(8)));
const char *access_str;
struct lv_segment *snap_seg = NULL, *mirror_seg = NULL;
+ struct lv_segment *seg = NULL;
+ int lvm1compat;
percent_t snap_percent;
+ int thin_data_active = 0, thin_metadata_active = 0;
+ percent_t thin_data_percent, thin_metadata_percent;
+ int thin_active = 0;
+ percent_t thin_percent;
if (!id_write_format(&lv->lvid.id[1], uuid, sizeof(uuid)))
return_0;
log_print("--- Logical volume ---");
- log_print("LV Name %s%s/%s", lv->vg->cmd->dev_dir,
- lv->vg->name, lv->name);
- log_print("VG Name %s", lv->vg->name);
+ lvm1compat = find_config_tree_int(cmd, "global/lvm1_compatible_display",
+ DEFAULT_LVM1_COMPATIBLE_DISPLAY);
+
+ if (lvm1compat) {
+ /* Note: Invisible devices do not get /dev/vg/lv */
+ log_print("LV Name %s%s/%s",
+ 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);
+ log_print("LV Name %s", lv->name);
+ } else
+ log_print("Invisible LV Name %s", lv->name);
+ log_print("VG Name %s", lv->vg->name);
log_print("LV UUID %s", uuid);
-
log_print("LV Write Access %s", access_str);
+ log_print("LV Creation host, time %s, %s",
+ lv_host_dup(cmd->mem, lv), lv_time_dup(cmd->mem, lv));
if (lv_is_origin(lv)) {
log_print("LV snapshot status source of");
&snap_percent)))
if (snap_percent == PERCENT_INVALID)
snap_active = 0;
- log_print(" %s%s/%s [%s]",
- lv->vg->cmd->dev_dir, lv->vg->name,
- snap_seg->cow->name,
- snap_active ? "active" : "INACTIVE");
+ if (lvm1compat)
+ log_print(" %s%s/%s [%s]",
+ lv->vg->cmd->dev_dir, lv->vg->name,
+ snap_seg->cow->name,
+ snap_active ? "active" : "INACTIVE");
+ else
+ log_print(" %s [%s]",
+ snap_seg->cow->name,
+ snap_active ? "active" : "INACTIVE");
}
snap_seg = NULL;
} else if ((snap_seg = find_cow(lv))) {
if (snap_percent == PERCENT_INVALID)
snap_active = 0;
- log_print("LV snapshot status %s destination for %s%s/%s",
- snap_active ? "active" : "INACTIVE",
- lv->vg->cmd->dev_dir, lv->vg->name,
- snap_seg->origin->name);
+ if (lvm1compat)
+ log_print("LV snapshot status %s destination for %s%s/%s",
+ snap_active ? "active" : "INACTIVE",
+ lv->vg->cmd->dev_dir, lv->vg->name,
+ snap_seg->origin->name);
+ else
+ log_print("LV snapshot status %s destination for %s",
+ snap_active ? "active" : "INACTIVE",
+ snap_seg->origin->name);
}
if (lv_is_thin_volume(lv)) {
- log_print("LV Thin pool %s%s/%s", lv->vg->cmd->dev_dir,
- lv->vg->name, first_seg(lv)->pool_lv->name);
+ seg = first_seg(lv);
+ log_print("LV Pool name %s", seg->pool_lv->name);
+ if (seg->origin)
+ log_print("LV Thin origin name %s",
+ seg->origin->name);
+ if (inkernel)
+ thin_active = lv_thin_percent(lv, 0, &thin_percent);
} else if (lv_is_thin_pool(lv)) {
+ if (inkernel) {
+ thin_data_active = lv_thin_pool_percent(lv, 0, &thin_data_percent);
+ thin_metadata_active = lv_thin_pool_percent(lv, 1, &thin_metadata_percent);
+ }
/* FIXME: display thin_pool targets transid for activated LV as well */
- log_print("LV Thin transaction ID %" PRIu64,
- first_seg(lv)->transaction_id);
- log_print("LV Thin metadata %s%s/%s", lv->vg->cmd->dev_dir,
- lv->vg->name, first_seg(lv)->metadata_lv->name);
- log_print("LV Thin data pool %s%s/%s", lv->vg->cmd->dev_dir,
- lv->vg->name, seg_lv(first_seg(lv), 0)->name);
+ seg = first_seg(lv);
+ log_print("LV Pool transaction ID %" PRIu64, seg->transaction_id);
+ log_print("LV Pool metadata %s", seg->metadata_lv->name);
+ log_print("LV Pool data %s", seg_lv(seg, 0)->name);
+ log_print("LV Pool chunk size %s",
+ display_size(cmd, seg->data_block_size));
log_print("LV Zero new blocks %s",
- first_seg(lv)->zero_new_blocks ? "yes" : "no");
+ seg->zero_new_blocks ? "yes" : "no");
}
if (inkernel && info.suspended)
display_size(cmd,
snap_seg ? snap_seg->origin->size : lv->size));
+ if (thin_data_active)
+ log_print("Allocated pool data %.2f%%",
+ percent_to_float(thin_data_percent));
+
+ if (thin_metadata_active)
+ log_print("Allocated metadata %.2f%%",
+ percent_to_float(thin_metadata_percent));
+
+ if (thin_active)
+ log_print("Mapped size %.2f%%",
+ percent_to_float(thin_percent));
+
log_print("Current LE %u",
snap_seg ? snap_seg->origin->le_count : lv->le_count);
log_print("COW-table LE %u", lv->le_count);
if (snap_active)
- log_print("Allocated to snapshot %.2f%% ",
+ log_print("Allocated to snapshot %.2f%%",
percent_to_float(snap_percent));
log_print("Snapshot chunk size %s",
}
if (lv->status & MIRRORED) {
- mirror_seg = first_seg(lv);
+ mirror_seg = first_seg(lv);
log_print("Mirrored volumes %" PRIu32, mirror_seg->area_count);
if (lv->status & CONVERTING)
log_print("LV type Mirror undergoing conversion");