1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

report: Shift (u)sed pv_attr under (a)llocatable.

Showing 'u' in the pv_attr reporting field is mostly unnecessary because
most PVs are allocatable, and being allocatable implies it is (u)sed,
and this is already obvious from other fields in the default 'pvs'
output like the VG name.

So move the new (u)sed pv_attr from character position 4 to 1, and only
show it in those rare cases when the PV is not (a)llocatable or the
relevant metadata is missing.

(Scripts should not be using pv_attr, but rather pv_allocatable,
pv_exported, pv_missing, pv_in_use etc.)
This commit is contained in:
Alasdair G Kergon 2016-02-26 15:46:37 +00:00
parent 183bd8ca03
commit 9898126596
4 changed files with 12 additions and 9 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.144 - Version 2.02.144 -
===================================== =====================================
Only show (u)sed pv_attr char when PV is not (a)llocatable. (2.02.143)
Update makefile to generate lcov output also for lvmpolld and lvmlockd. Update makefile to generate lcov output also for lvmpolld and lvmlockd.
Fix SystemdService lvm2-lvmdbusd.service name. Fix SystemdService lvm2-lvmdbusd.service name.
Improve support for env LVM_VG_NAME for reference VG name in lvconvert. Improve support for env LVM_VG_NAME for reference VG name in lvconvert.

View File

@ -237,15 +237,17 @@ char *pv_attr_dup(struct dm_pool *mem, const struct physical_volume *pv)
char *repstr; char *repstr;
int used = is_used_pv(pv); int used = is_used_pv(pv);
if (!(repstr = dm_pool_zalloc(mem, 5))) { if (!(repstr = dm_pool_zalloc(mem, 4))) {
log_error("dm_pool_alloc failed"); log_error("dm_pool_alloc failed");
return NULL; return NULL;
} }
repstr[0] = (pv->status & ALLOCATABLE_PV) ? 'a' : '-'; /*
* An allocatable PV is always used, so we don't need to show 'u'.
*/
repstr[0] = (pv->status & ALLOCATABLE_PV) ? 'a' : (used > 0) ? 'u' : '-';
repstr[1] = (pv->status & EXPORTED_VG) ? 'x' : '-'; repstr[1] = (pv->status & EXPORTED_VG) ? 'x' : '-';
repstr[2] = (pv->status & MISSING_PV) ? 'm' : '-'; repstr[2] = (pv->status & MISSING_PV) ? 'm' : '-';
repstr[3] = used <= 0 ? '-' : 'u';
return repstr; return repstr;
} }

View File

@ -86,7 +86,7 @@ pv_mda_used_count, pvseg_start, and pvseg_size
With \fB\-\-segments\fP, any "pvseg_" prefixes are optional; otherwise any With \fB\-\-segments\fP, any "pvseg_" prefixes are optional; otherwise any
"pv_" prefixes are optional. Columns mentioned in \fBvgs\fP(8) can also "pv_" prefixes are optional. Columns mentioned in \fBvgs\fP(8) can also
be chosen. The pv_attr bits are: (a)llocatable, e(x)ported, (m)issing and be chosen. The pv_attr bits are: (a)llocatable, e(x)ported, (m)issing and
(u)sed. (u)sed (but not allocatable).
.TP .TP
.B \-\-segments .B \-\-segments
Produces one line of output for each contiguous allocation of space on each Produces one line of output for each contiguous allocation of space on each

View File

@ -24,11 +24,11 @@ aux prepare_pvs 4
# check 'allocatable' pv attribute # check 'allocatable' pv attribute
pvcreate "$dev1" pvcreate "$dev1"
check pv_field "$dev1" pv_attr ---- check pv_field "$dev1" pv_attr ---
vgcreate $vg1 "$dev1" vgcreate $vg1 "$dev1"
check pv_field "$dev1" pv_attr a--u check pv_field "$dev1" pv_attr a--
pvchange --allocatable n "$dev1" pvchange --allocatable n "$dev1"
check pv_field "$dev1" pv_attr ---u check pv_field "$dev1" pv_attr u--
vgremove -ff $vg1 vgremove -ff $vg1
not pvchange --allocatable y "$dev1" not pvchange --allocatable y "$dev1"
pvremove -ff "$dev1" pvremove -ff "$dev1"
@ -51,10 +51,10 @@ do
# "vgchange disable/enable allocation for pvs with metadatacopies = $mda (bz452982)" # "vgchange disable/enable allocation for pvs with metadatacopies = $mda (bz452982)"
pvchange "$dev1" -x n pvchange "$dev1" -x n
pvchange "$dev1" -x n # already disabled pvchange "$dev1" -x n # already disabled
check pv_field "$dev1" pv_attr ---u check pv_field "$dev1" pv_attr u--
pvchange "$dev1" -x y pvchange "$dev1" -x y
pvchange "$dev1" -x y # already enabled pvchange "$dev1" -x y # already enabled
check pv_field "$dev1" pv_attr a--u check pv_field "$dev1" pv_attr a--
# check we are able to change number of managed metadata areas # check we are able to change number of managed metadata areas
if test $mda -gt 0 ; then if test $mda -gt 0 ; then