Vinod Subramaniam

Virtualization : Decoding EMC LUN IDs output by raidcom

Discussion created by Vinod Subramaniam Employee on Sep 4, 2013

get_emc_device_name(){
    LUN_WWN="$1"
    EMC_SERIAL="$2"
    EMC_MODEL="$3"
    VENDOR_ID="${LUN_WWN:2:7}"
    EMC_DISC_SERIAL="${LUN_WWN:13:9}"
    if [ "$VENDOR_ID" == "6006048" ]
    then
        if [ "$EMC_MODEL" == "DMX" ]
        then
            if [ "$EMC_DISC_SERIAL" == "$EMC_SERIAL" ]
            then
                TEMP_LUN_STR="\x${LUN_WWN:24:2}\x${LUN_WWN:26:2}\x${LUN_WWN:28:2}\x${LUN_WWN:30:2}\x${LUN_WWN:32:2}"
                EMC_NAME=`echo -e $TEMP_LUN_STR | awk '{printf "%s", $_}'`
            else
                return 1
            fi
        else
            return 2
        fi
    else
        return 3
    fi
}

 


LUN_DISC="0x60060480000190301080533030373635 0x60060480000190301080533030373644 0x60060480000190301080533030373735 0x60060480000190301080533030373744 0x60060480000190301080533030373835 0x60060480000190301080533030373844 0x60060480000190301080533030373935 0x60060480000190301080533030373944 0x60060480000190301080533030374135 0x60060480000190301080533030374144 0x60060480000190301080533030374146 0x60060480000190301080533030374231 0x60060480000190301080533030383034 0x60060480000190301080533030383043 0x60060480000190301080533030383134 0x60060480000190301080533030383143 0x60060480000190301080533030383234 0x60060480000190301080533030383243 0x60060480000190301080533030413033 0x60060480000190301080533031313336 0x60060480000190301080533031313341 0x60060480000190301080533031313345 0x60060480000190301080533031313432 0x60060480000190301080533031313436 0x60060480000190301080533031313441 0x60060480000190301080533031313445 0x60060480000190301080533031313639 0x60060480000190301080533031314536 0x60060480000190301080533031323032 0x60060480000190301080533031323041 0x60060480000190301080533031323132 0x60060480000190301080533031323141 0x60060480000190301080533031323232 0x60060480000190301080533031323241 0x60060480000190301080533031323332 0x60060480000190301080533031323341 0x60060480000190301080533031323432 0x60060480000190301080533031323441 0x60060480000190301080533031323532"
EMC_NAME="00000"
for i in $LUN_DISC
do
    get_emc_device_name $i "190301080" "DMX"
    printf "%s," $EMC_NAME
done

Outcomes