summaryrefslogtreecommitdiff
path: root/qa/540
blob: dd165866ff57bf429e55a6005f8be6c79f11d1ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#! /bin/sh
# PCP QA Test No. 540
# Check Linux hinv.map.lvname metric
#
# Copyright (c) 2013 Red Hat.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
. ./localconfig

[ $PCP_PLATFORM = linux ] || _notrun "Depends on Linux logical volume manager"
[ $PCP_VER -ge 3801 ] || _notrun "Requires more recent Linux kernel PMDA"
[ -d /dev/mapper ] || _notrun "Requires kernel support for Device Mapper"

status=1	# failure is the default!
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15

# real QA test starts here
echo >$seq.full

# Get the device mapper names from /dev/mapper
#
echo "== /dev/mapper" >> $seq.full
ls -l /dev/mapper | tee -a $seq.full \
    | $PCP_AWK_PROG '/^l/ { print $11, $9 }' \
    | sed -e 's/^\.\.\///' \
    | LC_COLLATE=POSIX sort \
    > $tmp.dev.mapper

# Get the device mapper names from pmdalinux
#
echo "== pmdalinux" >> $seq.full
pminfo -f hinv.map.lvname | tee -a $seq.full \
    | $PCP_AWK_PROG '/inst/ { print $4, $6 }' \
    | tr -d '"]' \
    | LC_COLLATE=POSIX sort \
    > $tmp.pcp.indom

if diff $tmp.pcp.indom $tmp.dev.mapper >$tmp.indom.diff
then
    echo "Device mapper instance matches expected values"
    status=0
else
    echo "Instance domain for hinv.map.lvname incorrect:"
    echo "diff output (PCP first, then ifconfig):"
    cat $tmp.indom.diff
fi

exit