VMware Cloud Community
bernsian
Contributor
Contributor

adding multiple RDMs to a guest

I need to add nearly 75 luns to a guest OS as RDM's (pas through) to do some work with NPIV. I don't want to have to click over 280 times or so to do this. Any ideas on how I can script this? I have gotten this far: vmkfstools -z /vmfs/devices/disks/vmhba1:0:7:0 /vmfs/volumes/GuestOS2/mb-1/mb-1_7.vmdk, but now how do I get that RDM added to the machine? I have tried using vdiskcreate.pl and rdmCreate.pl but neither of them seem to work.

Tags (4)
0 Kudos
6 Replies
Texiwill
Leadership
Leadership

Hello,

Well it is possible but you can only add 4 x 16 - 5 devices to a single VM or 59 available SCSI IDs after the controllers and boot disk come into play. You are allowed only 4 SCSI controllers and you have 16 devices possible off each. There is one device for the controller and you will take up one device for the boot VMDK.

You will need to use multiple VMs to get your 75 LUNs even so. You can do the following... Note the first scsi$X.present only needs to be done once per SCSI Controller.

vmkfstools ... $RDM
echo "scsi$X,present = \"TRUE\"" >> $VMX
echo "scsi$X:$Y.present = \"TRUE\"" >> $VMX
echo "scsi$X:$Y.deviceType=\"scsi-hardDisk\"" >> $VMX
echo "scsi$X:$Y.fileName=\"$RDM\"" >> $VMX
echo "scsi$X:XY.redo=\"TRUE\" >> $VMX


Best regards,

Edward L. Haletky

VMware Communities User Moderator

====

Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education.

CIO Virtualization Blog: http://www.cio.com/blog/index/topic/168354

As well as the Virtualization Wiki at http://www.astroarch.com/wiki/index.php/Virtualization

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
0 Kudos
bernsian
Contributor
Contributor

okay, being that this is a shell script, I translate this to basically piping the following into the text vmx text file for the VM

So, here is what I have, first I run the following command

vmkfstools -z /vmfs/devices/disks/vmhba1:0:7:0 /vmfs/volumes/GuestOS2/mb-1/mb-1_7.vmdk -a lsilogic

I then put the following into the text file (via a shell script, or whatever)

scsi0:1.present = "true"

scsi0:1.deviceType = "scsi-hardDisk"

scsi0:1.filename = "mb-1_7.vmdk"

scsi0:1.mode = "independent-persistent"

scsi0:1.redo = "true"

This now has two problems:

  1. These settings do not show up if I look at the settings through the GUI

  2. NPIV won't work correctly

  3. If I go through the add new hardware GUI, and add the RDM, the lun of vmhba1:0:7:0 still shows up as available to map as an RDM (I have waited 10 minutes between adding the RDM via vmkfstools and updating the file.

0 Kudos
Texiwill
Leadership
Leadership

Hello,

You mentioned NPIV originally. Note that NPIV should not be using an RDM, that is standard SAN access. Also, you should NOT set the mode as it is not a VMDK but an RDM. One thing you can do is edit the settings within the VIC, the duplicate that as appropriately to add more. The disk type may also be incorrect but it should not be.


Best regards,

Edward L. Haletky

VMware Communities User Moderator

====

Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education.

CIO Virtualization Blog: http://www.cio.com/blog/index/topic/168354

As well as the Virtualization Wiki at http://www.astroarch.com/wiki/index.php/Virtualization

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
0 Kudos
bernsian
Contributor
Contributor

So how do I add a disk as an them via a command line? NPIV is crucial in this project.

0 Kudos
Texiwill
Leadership
Leadership

Hello,

Unfortunately I do not have an NPIV capable fabric (I wish I could afford the upgrade), but remember that NPIV gives each participating VM a WWPN that you can then Zone/present a LUN to the VM. Then you would be looking at using tools within the Guest to access the LUN.

I would enable NPIV in the guest using the VIC. Then I would present to the WWPN of the NPIV enabled VM some LUNs. then reboot the Guest and you should see the LUNs.


Best regards,

Edward L. Haletky

VMware Communities User Moderator

====

Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education.

CIO Virtualization Blog: http://www.cio.com/blog/index/topic/168354

As well as the Virtualization Wiki at http://www.astroarch.com/wiki/index.php/Virtualization

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
0 Kudos
BUGCHK
Commander
Commander

> You mentioned NPIV originally.

> Note that NPIV should not be using an RDM, that is standard SAN access.

But currently you MUST configure an RDM before you can even enable NPIV.

0 Kudos