VMware

rdmManagmement.pl

VERSION 1 Published

Created on: Oct 21, 2009 8:50 PM by lamw - Last Modified:  Oct 21, 2009 8:56 PM by lamw

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.

Requirements:
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!

Attachments:
Average User Rating
(2 ratings)




Comments

Nov 11, 2009 7:13 AM rub1  says:

Hi Lamw

I am looking for a similar script that does the same but with virtual disks
which are not rdm.
can I use the rdmManagement.pl current script with " --compatmode virtual" to achieve this task ?
( I guess no..)

thanks
rub1

Nov 11, 2009 8:15 AM lamw  says: in response to: rub1

I don't think you understand what an RDM is ... it can be both physical and virtual and has nothing to do wit normal virtual disks. You've seen to have posted all over the forums but I've already created a fully functional script that allows you to add existing VMDK(s) to a VM: vmdkManagement.pl. If you need further clarification, please post on your original thread versus going all over the forums. These scripts are intended to provide functional sample code performing certain operations using the vSphere API's, if you have a more specific use case then you're more than welcome to extend and modify any of the scripts that I've or others have created.


=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
Twitter: @lamw
vGhetto Script Repository
Getting Started with the vMA (tips/tricks)
Getting Started with the vSphere SDK for Perl
VMware Code Central - Scripts/Sample code for Developers and Administrators
VMware Developer Comuunity

http://engineering.ucsb.edu/~duonglt/vmware/vexpert_silver_icon.jpg

If you find this information useful, please award points for "correct" or "helpful".

 

Developer Social Media

Communities