Version 1

    This scripts allows you to create and add either physical or virtual RDM to a VM and also removing and deleting pRDM/vRDM to a VM. You must connect directly to the ESX(i) host that is housing the VM in which the RDM is to be added.



    ESX(i) 3.5/4.0

    vSphere SDK for Perl or vMA


    Sample Execution:


    Querying for available LUNS to be used as an RDM ( operation: query):

    [vi-admin@scofield ~]$ ./rdmManagmement.pl --server esx40-1.primp-industries.com --username root --vmname rdmVM --operation query
    Enter password:
    Device Name: /vmfs/devices/disks/eui.caa68a778fc27982
    Capacity: 30.00 GB
    Device Name: /vmfs/devices/disks/eui.1f79d354801b3936
    Capacity: 1000.00 MB
    Device Name: /vmfs/devices/disks/eui.8f713e8e3c0a58d2
    Capacity: 1.95 GB
    Device Name: /vmfs/devices/disks/eui.c028c79e0ee07daa
    Capacity: 28.00 GB


    Let's create an physical RDM using 1.95gb LUN ( operation: add ):

    [vi-admin@scofield ~]$ ./rdmManagmement.pl --server esx40-1.primp-industries.com --username root --vmname rdmVM --operation add --device /vmfs/devices/disks/eui.8f713e8e3c0a58d2 --compatmode physical --filename databaseRDM.vmdk
    Enter password:
    Creating and adding "physicalMode" RDM: "databaseRDM.vmdk" to rdmVM ...
            Successfully added RDM to VM!


    Let's remove and delete the RDM from the VM ( operation: destroy ):

    [vi-admin@scofield ~]$ ./rdmManagmement.pl --server esx40-1.primp-industries.com --username root --vmname rdmVM --operation destroy --filename databaseRDM.vmdk
    Enter password:
    Destroying RDM: "databaseRDM.vmdk" to rdmVM ...
            Successfully destroyed RDM to VM!