Opened 12 years ago

Closed 12 years ago

#609 closed defect (fixed)

analyze-my-lvm doesn't work for more than "1" /dev/mapper/* lvm PV devices on RHEL6.2

Reported by: bzium Owned by: Bruno Cornec
Priority: normal Milestone: 3.0.2
Component: mindi Version: 3.0.1
Severity: major Keywords:
Cc:

Description

Function GiveMapperOfdm() in analyze-my-lvm doesn't work for more than "1" /dev/mapper/* lvm PV devices on RHEL6.2

/dev/mapper/(dev_name) is symbolic link to /dev/dm-X "stat" command in GiveMapperOfdm should be run with "-L" switch.

GiveMapperOfdm () {

major=`stat -c "%t" $1 2> /dev/null`
minor=`stat -c "%T" $1 2> /dev/null`

for i in `ls /dev/mapper/*`; do
        mj=`stat -c "%t" $i`
        mn=`stat -c "%T" $i`
        if [ "$mj" = "$major" ] && [ "$mn" = "$minor" ]; then
                echo "$i"
                return
        fi
done
echo $1
}

should be

GiveMapperOfdm () {

major=`stat -L -c "%t" $1 2> /dev/null`
minor=`stat -L -c "%T" $1 2> /dev/null`

for i in `ls /dev/mapper/*`; do
        mj=`stat -L -c "%t" $i`
        mn=`stat -L -c "%T" $i`
        if [ "$mj" = "$major" ] && [ "$mn" = "$minor" ]; then
                echo "$i"
                return
        fi
done
echo $1
}

Attachments (2)

givemappefdm.sh.gz (251 bytes ) - added by bzium 12 years ago.
givemappefdm-new.sh.gz (258 bytes ) - added by bzium 12 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Bruno Cornec, 12 years ago

Milestone: 3.0.2
Status: newassigned

comment:2 by Bruno Cornec, 12 years ago

I'm not sure I understand your problem. stat doesn't use -L as we need to have all the links, and the role of GiveMapperOfdm is to just give the /dev/mapper/ device correspondance to the /dev/dm-* one.

So while I'm not disagreeing that there may be an issue with multiple PVs, I'd like to get the /var/log/mondoarchive.log to have a better understanding of the issue, and see how to best fix it. For the moment, I think your fix risks to create more issues elsewhere.

TIA, Bruno.

by bzium, 12 years ago

Attachment: givemappefdm.sh.gz added

by bzium, 12 years ago

Attachment: givemappefdm-new.sh.gz added

comment:3 by bzium, 12 years ago

Please take givemappefdm.sh.gz from attachment and check two or more devices.

# ls -la /dev/mapper/mpath*
lrwxrwxrwx 1 root root 7 Apr 18 10:34 /dev/mapper/mpatha -> ../dm-2
lrwxrwxrwx 1 root root 7 Apr 18 10:34 /dev/mapper/mpathb -> ../dm-3
lrwxrwxrwx 1 root root 8 Apr 19 10:27 /dev/mapper/mpathc -> ../dm-10
# ./givemappefdm.sh /dev/mapper/mpatha
/dev/mapper/mpatha
# ./givemappefdm.sh /dev/mapper/mpathb
/dev/mapper/mpatha
# ./givemappefdm.sh /dev/mapper/mpathc
/dev/mapper/mpatha

Your function always display first device /dev/mapper/mpatha. After that try givemappefdm-new.sh.gz from attachments.

# ./givemappefdm-new.sh /dev/mapper/mpatha
/dev/mapper/mpatha
# ./givemappefdm-new.sh /dev/mapper/mpathb
/dev/mapper/mpathb
# ./givemappefdm-new.sh /dev/mapper/mpathc
/dev/mapper/mpathc

If you do not add "-L" stat for each device will show:

# stat -c "%T" /dev/mapper/mpath*
0
0
0
[root@proddb1 mondo-test]# stat -c "%t" /dev/mapper/mpath*
0
0
0

All devices have a "major minor = 0 0". If you add "-L" switch stat show correct "major minor".

# stat -L -c "%T" /dev/mapper/mpath*
2
3
a
# stat -L -c "%t" /dev/mapper/mpath*
fd
fd
fd

Do you understand now what's the problem?

Version 0, edited 12 years ago by bzium (next)

comment:4 by Bruno Cornec, 12 years ago

Resolution: fixed
Status: assignedclosed

Many thanks for your explanations, that showed I completely missed the point :-(.

Now fixed in rev [3001]. Will be in mindi 2.1.2.

Note: See TracTickets for help on using tickets.