﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
415	"analyze-my-lvm doesn't handle ""unknown device"" from pvscan"	Michael Shapiro	Bruno Cornec	" mindi-2.0.7.3-0.20100407121858.rhel5

We have some servers running !RedHat Cluster Suite and the pvscan's return an ""unknown device"" to stdout, not to stderr:


{{{
# pvscan 2>/dev/null
  PV /dev/emcpoweri1     VG vgbmr        lvm2 [25.29 GB / 296.00 MB free]
  PV /dev/emcpowerh1     VG vgmbr        lvm2 [505.75 GB / 505.75 GB free]
  PV /dev/cciss/c0d0p2   VG vgroot_xen   lvm2 [132.42 GB / 88.92 GB free]
  PV /dev/emcpowerc      VG xengfs       lvm2 [505.75 GB / 0    free]
  PV /dev/emcpowero      VG xengfs       lvm2 [505.75 GB / 0    free]
  PV /dev/emcpowerg      VG xengfs       lvm2 [505.75 GB / 0    free]
  PV unknown device      VG xengfs       lvm2 [505.75 GB / 0    free]
  PV /dev/emcpowera      VG xengfs       lvm2 [505.75 GB / 0    free]
  PV /dev/emcpowerd      VG xengfs       lvm2 [505.75 GB / 12.00 MB free]
  Total: 9 [3.61 TB] / in use: 9 [3.61 TB] / in no VG: 0 [0   ]
}}}

This causes analyze-my-lvm to add a device called unknown to the lvm.res file:


{{{
/usr/sbin/lvmdiskscan
/sbin/lvm
i=2
LVM version >= 2.0 found.
Just before you extrapolate mountlist to include RAID partitions,
extrapolate it to include the following LVM drives and partitions:-
>>>>> /dev/cciss/c0d0p2   unknown
To get started, type:-
(insmod dm-mod)
(insmod dm_mod)
# lvm vgchange -an
# echo y | lvm pvcreate -ff /dev/cciss/c0d0p2   
# echo y | lvm pvcreate -ff unknown
# lvm vgscan
.
.
.
}}}

I was able to fix the problem by filtering out the unknown devices in the !ListAllPhysicalVolumes() function by grep'ing the output of the pvscan command and selecting only lines that don't match ""unknown"":


{{{
ListAllPhysicalVolumes() {
        if [ $lvmversion = 2 ]; then
                $LVMCMD pvscan 2> /dev/null | grep 'PV' | grep -v unknown | awk '{print $2}' >  $MINDI_TMP/pv.tmp
        else
                pvscan 2> /dev/null | grep '""' | cut -d'""' -f2  >  $MINDI_TMP/pv.tmp
        fi
}}}


The attached file has the change in it. Look for the line:

'''#### MODIFIED BY MIKE SHAPIRO ####'''
"	defect	closed	normal	2.2.9.3	mindi	2.2.9.2	major	fixed		
