]> sourceware.org Git - lvm2.git/commitdiff
report: Shift (u)sed pv_attr under (a)llocatable.
authorAlasdair G Kergon <agk@redhat.com>
Fri, 26 Feb 2016 15:46:37 +0000 (15:46 +0000)
committerAlasdair G Kergon <agk@redhat.com>
Fri, 26 Feb 2016 15:46:37 +0000 (15:46 +0000)
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.)

WHATS_NEW
lib/metadata/pv.c
man/pvs.8.in
test/shell/pvchange-usage.sh

index f91b3d0ed1b689c6661f18e3a56c7fffdafb46c1..610ea43bcef6acfcdab752040ee45860d97d669f 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 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.
   Fix SystemdService lvm2-lvmdbusd.service name.
   Improve support for env LVM_VG_NAME for reference VG name in lvconvert.
index 1d68045146819d6785759777c161330c2817d5a6..7ea993f0ece8260ed06b8ce70d85583690d51447 100644 (file)
@@ -237,15 +237,17 @@ char *pv_attr_dup(struct dm_pool *mem, const struct physical_volume *pv)
        char *repstr;
        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");
                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[2] = (pv->status & MISSING_PV) ? 'm' : '-';
-       repstr[3] = used <= 0 ? '-' : 'u';
 
        return repstr;
 }
index 4bc042bb84f49802f304184d3f52b3a0c960ed25..0e0ad925d954509a2539c80cdd9190df8cb6d825 100644 (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
 "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
-(u)sed.
+(u)sed (but not allocatable).
 .TP
 .B \-\-segments
 Produces one line of output for each contiguous allocation of space on each
index efffe18cc2818a63b66518cff09b5f8c350ed77e..df7893ee6e64f0f2d0522e0debb61ce0e7ee0c34 100644 (file)
@@ -24,11 +24,11 @@ aux prepare_pvs 4
 
 # check 'allocatable' pv attribute
 pvcreate "$dev1"
-check pv_field "$dev1" pv_attr ----
+check pv_field "$dev1" pv_attr ---
 vgcreate $vg1 "$dev1"
-check pv_field "$dev1" pv_attr a--u
+check pv_field "$dev1" pv_attr a--
 pvchange --allocatable n "$dev1"
-check pv_field "$dev1" pv_attr ---u
+check pv_field "$dev1" pv_attr u--
 vgremove -ff $vg1
 not pvchange --allocatable y "$dev1"
 pvremove -ff "$dev1"
@@ -51,10 +51,10 @@ do
 # "vgchange disable/enable allocation for pvs with metadatacopies = $mda (bz452982)"
        pvchange "$dev1" -x n
        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   # 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
        if test $mda -gt 0 ; then
This page took 0.055417 seconds and 5 git commands to generate.