Mapping MPxIO paths into something sane (array & LUN ids)

OK, so MPxIO “Just Works”. I exposed a small number of LUNs (four, to be precise) from each of a pair of SataBeasts. One of those had something on it: to wit, a prototypical “bb-archive” zpool.

zpool status etc. will show the MPxIO devices that comprise the particular zpool in question – but what about the other seven LUNs? And what about when it comes to stiching LUNs together, and so on? This is going to turn into a cross-referencing nightmare!

OK, so the SataBeasts have fairly well-known IDs (their WWNs) and we can start there. Each LUN exposed by a SataBeast gets a randomly-allocated volume ID; both of these parts are visible within the derived device name that MPxio presents.

However, we typically plan and work using LUNs, rather than those volume IDs. So it’d be nice to at least get a way to dump that information.

That information is exposed in a number of places – prtconf will expose it, for instance – but it’s probably simpler to use fcinfo, as follows:

$ which hbas
hbas () {
        fcinfo hba-port | awk '/^HBA Port WWN:/ {print $4}'
}

And to list the LUNs, we can use this:

$ which luns
luns() {
        printf 'HBA\t\t\trPort\t\t\tLUN\tPath\n'
        while [[ $# != 0 ]]
        do
                fcinfo remote-port -p "$1" -s |
                awk '
                        BEGIN { hba = "'"$1"'" }
                        /^Remote Port WWN:/ { rport = $4 }
                        /LUN:/ { lun = $2 }
                        /OS Device Name:/ {
                                print hba "\t" rport "\t" lun "\t" $4
                        }
                '
                shift
        done
}

Then:

# luns $( hbas )

provides what we’re after in a tabular form.

Tags: , , , , ,

Leave a Reply

You must be logged in to post a comment.


css.php