Opened 14 years ago

Closed 14 years ago

#415 closed defect (fixed)

analyze-my-lvm doesn't handle "unknown device" from pvscan

Reported by: Michael Shapiro Owned by: Bruno Cornec
Priority: normal Milestone: 2.2.9.3
Component: mindi Version: 2.2.9.2
Severity: major Keywords:
Cc:

Description

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 ####

Attachments (1)

analyze-my-lvm.pvscan_mod (10.9 KB ) - added by Michael Shapiro 14 years ago.

Download all attachments as: .zip

Change History (2)

by Michael Shapiro, 14 years ago

Attachment: analyze-my-lvm.pvscan_mod added

comment:1 by Bruno Cornec, 14 years ago

Resolution: fixed
Status: newclosed

Thanks again Mike for your patch. Integrated in rev [2617]. Will be in 2.2.9.3 final.

Note: See TracTickets for help on using tickets.