1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

report: fix pvs -o pv_free reporting for PVs with 0 PEs

[0] raw/~ # lsblk -o NAME,SIZE /dev/sda
NAME  SIZE
sda   128M

[0] raw/~ # pvcreate --dataalignment 128m /dev/sda
  Physical volume "/dev/sda" successfully created

[0] raw/~ # vgcreate vg /dev/sda
  Volume group "vg" successfully created

[0] raw/~ # lvcreate -l1 vg
  Volume group "vg" has insufficient free space (0 extents): 1 required.

Before this patch:
[0] raw/~ # pvs -o pv_name,pv_free
  PV         PFree
  /dev/sda   128.00m

After this patch:
[0] raw/~ # pvs -o pv_name,pv_free
  PV         PFree
  /dev/sda      0
This commit is contained in:
Peter Rajnoha 2013-02-21 13:28:07 +01:00
parent e566faaae6
commit 722ca363f0
2 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
Fix pvs -o pv_free reporting for PVs with zero PE count.
Fix missing cleanup of flags when the LV is detached from pool.
Fix check for some forbidden discards conversion of thin pools.
Add pool_is_active() to check for any pool related active LV.

View File

@ -106,7 +106,7 @@ uint64_t pv_free(const struct physical_volume *pv)
{
uint64_t freespace;
if (!pv->pe_count)
if (!pv->vg || is_orphan_vg(pv->vg->name))
freespace = pv->size;
else
freespace = (uint64_t)