Monday, November 21, 2016

Find a netapp lun by WWID

When you create userinput and you need to present some luns in a dropdownbox, most of the time, you just list up your luns. However, sometimes you want to create a portal to non-netapp people. Linux people for example. And they have no clue of what the lun is named. They do however have the WWID, a hexadecimal string. Part of that string is the actual netapp lun serial number. With some simple MySQL querying, it's very simple to determine the actual lun.


SELECT
    DISTINCT lun.name,
    ROUND(lun.size_mb/1024) as 'Size (GB)',
    lun.os_type as 'OS type',
    volume.type as 'Volume type'
FROM
    cm_storage.lun,
    cm_storage.volume
WHERE
    lun.volume_id = volume.id
    AND volume.type='rw'
    AND lun.is_online
    AND (
        HEX(lun.serial_number)=
    RIGHT('${Wwid}',32-8)
    OR HEX(lun.serial_number)=RIGHT('${Wwid}',33-9)
)

No comments :

Post a Comment