summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2012-01-12 16:58:43 +0000
committerAlasdair Kergon <agk@redhat.com>2012-01-12 16:58:43 +0000
commit8f95d94b4f8c38f59afec14635bb1efcb4ff30e7 (patch)
tree1e53e4ab5c8b01b418bd755637684fddf8de4a18
parent5d5c80ace7ae1181aef7af3c18ba3a566df8a906 (diff)
downloadlvm2-8f95d94b4f8c38f59afec14635bb1efcb4ff30e7.tar.gz
lvm2-8f95d94b4f8c38f59afec14635bb1efcb4ff30e7.tar.xz
lvm2-8f95d94b4f8c38f59afec14635bb1efcb4ff30e7.zip
Show read-only activation in display tools.
-rw-r--r--WHATS_NEW2
-rw-r--r--lib/display/display.c14
-rw-r--r--lib/metadata/lv.c7
-rw-r--r--man/lvs.8.in3
4 files changed, 22 insertions, 4 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index ed5f2436..c0a15dd1 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,7 @@
Version 2.02.89 -
==================================
+ Use R lv_attr to indicate read-only activation of non-read-only device in lvs.
+ Show read-only activation override in lvdisplay & add 4 to perms in -c.
Add activation/read_only_volume_list to override LV permission in metadata.
Give priority to emcpower devices with duplicate PVIDs.
Add check for error in _adjust_policy_params() (lvextend --use-policies).
diff --git a/lib/display/display.c b/lib/display/display.c
index 298abc95..e42e9dc5 100644
--- a/lib/display/display.c
+++ b/lib/display/display.c
@@ -485,7 +485,8 @@ void lvdisplay_colons(const struct logical_volume *lv)
lv->vg->name,
lv->name,
lv->vg->name,
- (lv->status & (LVM_READ | LVM_WRITE)) >> 8, inkernel ? 1 : 0,
+ ((lv->status & (LVM_READ | LVM_WRITE)) >> 8) |
+ ((inkernel & info.read_only) ? 4 : 0), inkernel ? 1 : 0,
/* FIXME lv->lv_number, */
inkernel ? info.open_count : 0, lv->size, lv->le_count,
/* FIXME Add num allocated to struct! lv->lv_allocated_le, */
@@ -500,6 +501,7 @@ int lvdisplay_full(struct cmd_context *cmd,
struct lvinfo info;
int inkernel, snap_active = 0;
char uuid[64] __attribute__((aligned(8)));
+ const char *access_str;
struct lv_segment *snap_seg = NULL, *mirror_seg = NULL;
percent_t snap_percent;
@@ -508,6 +510,13 @@ int lvdisplay_full(struct cmd_context *cmd,
inkernel = lv_info(cmd, lv, 0, &info, 1, 1) && info.exists;
+ if ((lv->status & LVM_WRITE) && inkernel && info.read_only)
+ access_str = "read/write (activated read only)";
+ else if (lv->status & LVM_WRITE)
+ access_str = "read/write";
+ else
+ access_str = "read only";
+
log_print("--- Logical volume ---");
log_print("LV Name %s%s/%s", lv->vg->cmd->dev_dir,
@@ -516,8 +525,7 @@ int lvdisplay_full(struct cmd_context *cmd,
log_print("LV UUID %s", uuid);
- log_print("LV Write Access %s",
- (lv->status & LVM_WRITE) ? "read/write" : "read only");
+ log_print("LV Write Access %s", access_str);
if (lv_is_origin(lv)) {
log_print("LV snapshot status source of");
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index a730394f..ed6b42dc 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -431,6 +431,13 @@ char *lv_attr_dup(struct dm_pool *mem, const struct logical_volume *lv)
repstr[4] = 'I'; /* Invalid snapshot */
}
+ /*
+ * 'R' indicates read-only activation of a device that
+ * does not have metadata flagging it as read-only.
+ */
+ if (repstr[1] != 'r' && info.read_only)
+ repstr[1] = 'R';
+
repstr[5] = (info.open_count) ? 'o' : '-';
} else {
repstr[4] = '-';
diff --git a/man/lvs.8.in b/man/lvs.8.in
index 5c9607cb..74edd8bd 100644
--- a/man/lvs.8.in
+++ b/man/lvs.8.in
@@ -94,7 +94,8 @@ mirror or raid (i)mage, mirror or raid (I)mage out-of-sync, mirror (l)og device,
under (c)onversion, thin (V)olume, (t)hin pool, (T)hin pool data, raid or
thin pool m(e)tadata
.IP 2 3
-Permissions: (w)riteable, (r)ead-only
+Permissions: (w)riteable, (r)ead-only, (R)ead-only activation of non-read-only
+volume
.IP 3 3
Allocation policy: (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere, (i)nherited
This is capitalised if the volume is currently locked against allocation