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

toollib: fix ignored_mdas process_each_pv rescan

In process_each_pv() if we haven't yet scanned and the PV appears
to be an orphan, we must scan the other PVs looking for mdas that
reference it to find out what VG it is in.

1. If the PV has no mdas, we must scan.
2. If the PV has an mda that is not ignored we do not need to scan.
3. If the PV has an mda that is ignored, we do need to scan.

This patch fixes case 3.

> pvs -o +mda_count,vg_mda_count /dev/loop[0123]
  PV         VG   Fmt  Attr PSize  PFree  #PMda #VMda
  /dev/loop0 vg3  lvm2 a-   96.00m 96.00m     0     1
  /dev/loop1 vg3  lvm2 a-   96.00m 96.00m     1     1
  /dev/loop2 vg2  lvm2 a-   96.00m 96.00m     1     2
  /dev/loop3 vg2  lvm2 a-   28.00m 28.00m     1     2

Before:
> pvs /dev/loop2 /dev/loop3 /dev/loop0 /dev/loop1 --unbuffered
  PV         VG   Fmt  Attr PSize   PFree
  /dev/loop2      lvm2 a--  100.00m 100.00m
  /dev/loop3 vg2  lvm2 a--   28.00m  28.00m
  /dev/loop0      lvm2 a--  100.00m 100.00m
  /dev/loop1 vg3  lvm2 a--   96.00m  96.00m

After:
> pvs /dev/loop2 /dev/loop3 /dev/loop0 /dev/loop1 --unbuffered
  PV         VG   Fmt  Attr PSize  PFree
  /dev/loop2 vg2  lvm2 a--  96.00m 96.00m
  /dev/loop3 vg2  lvm2 a--  28.00m 28.00m
  /dev/loop0 vg3  lvm2 a--  96.00m 96.00m
  /dev/loop1 vg3  lvm2 a--  96.00m 96.00m
This commit is contained in:
Alasdair G Kergon 2012-06-29 21:22:09 +01:00
parent d84e1ae5f2
commit 1d0a2b919f
2 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.97 -
===============================
Fix test for PV with unknown VG in process_each_pv to ignore ignored mdas.
Update man pages with --activate ay option and auto_activation_volume_list.
Fix _alloc_parallel_area to avoid picking already-full areas for raid devices.
Use vgchange -aay instead of vgchange -ay in clmvd init script.

View File

@ -770,8 +770,7 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
* PV on the system.
*/
if (!scanned && is_orphan(pv) &&
!dm_list_size(&pv->fid->metadata_areas_in_use) &&
!dm_list_size(&pv->fid->metadata_areas_ignored)) {
!dm_list_size(&pv->fid->metadata_areas_in_use)) {
if (!scan_label_only &&
!scan_vgs_for_pvs(cmd, 1)) {
stack;