I have been asked lately if NPIV could be used to attach a tape library to a VM, & as attaching tape libraries to a VM has never been well documented. I have decided to write a small post about it. I don’t want to be a smart A**, but I will start by asking why would you want to attach a tape to a VM? Why not utilize VMware Storage API for backup & move on with it. As any method that can be utilized to connect a tape Drive/ Tape library to a VM running on ESX will compromise on many feature & introduce many restrictions to your environment. That have been said let’s see what options are available & what option is just confusing people.
– As the question was about NPIV & most people are mostly confused by it, I will start by saying NPIV will not help you add a tape library to a VM. NPIV is mainly useful when attaching LUNs & dealing with storage devices. It does not deal with tape libraries.
Ok, now that we had got NPIV confusion out of the way we still left with the question is it possible to attach a tape Library/Tape drive to a VM running on ESX/ESXi? The answer is yes, and there is actually two methods in going about it:
1- Adding a tape Library/Tape drive utilizing VMDirectPath (Make sure your hardware & software setup meet VMDirectPath before you proceed with this method)
Note: The below steps has been obtained from VMware KB Article: 1010789
About VMDirectPath I/O pass-through devices
You can connect up to two passthrough devices to a virtual machine. When selecting the devices, keep in mind these restrictions:
- Devices cannot be plugged in after a PCI Bridge.
- You cannot have two devices in two different contexts (for example, one used by VMkernel and one in pass-through) using the same PCI slot. For example, the dual head NIC is dedicated to the VMkernel OR is available for pass-through. If you select one, the other is automatically selected as well. A dialog informs you why this occurred.
Configuring pass-through devices
To configure pass-through devices on an ESX host:
- Select an ESX host from the Inventory panel of VMware Infrastructure (VI) Client.
- On the Configuration tab, click Advanced Settings. The Pass-through Configuration page lists all available pass-through devices.Note: A green icon indicates that a device is enabled and active. An orange icon indicates that the state of the device has changed and the host must be rebooted before the device can be used.
- Click Edit.
- Select the devices and click OK.Note: If you have a chipset with VT-d, when you click Advanced Settings in VI Client, you can select what devices are dedicated to the VMDirectPath I/O.
- When the devices are selected, they are marked with an orange icon. Reboot for the change to take effect. After rebooting, the devices are marked with a green icon and are enabled.Note: The configuration changes are saved in the /etc/vmware/esx.conf file. The parent PCI bridge, and if two devices are under the same PCI bridge, only one entry is recorded.The PCI slot number where the device was connected is 00:0b:0. It is recorded as:/device/000:11.0/owner = “passthru”Note: 0b is 11 in decimal.
To configure a PCI device on a virtual machine:
- From the Inventory in VI Client, right-click the virtual machine and choose Edit Settings.
- Click the Hardware tab.
- Click Add.
- Choose the PCI Device.
- Click Next.
Note: When the device is assigned, the virtual machine must have a memory reservation for the full configured memory size.
2- Adding a Tape Library/Drive as a SCSI device to the VM running on ESX/ESXi.
The below instruction are coming from VMware KB Article: 1016407.
To configure a tape device with a virtual machine in ESX 4.0 and ESX 4.1:
- Consult your backup hardware and software vendor to ensure that your tape device and backup software are supported to work with VMware ESX 4.0 and ESX 4.1. For more information, see the Additional Information section in this article.
- Configure the tape device and controller according to the hardware vendor’s guidelines.
- Connect VMware vSphere Client to the VMware vCenter Server or VMware ESX host.
- Click on the VMware ESX host which has the hardware connected.
- Click Configuration tab > Storage Adapters.
- On the Storage Adapters list, identify the controller which has the tape attached.
- Under Details, record the Runtime Name of the tape device. For example, vmhba2:C0:T1:L0.
- Select the virtual machine that will use the tape device, and click Summary tab > Edit Settings….
- Click the Hardware tab > Add….
- Select SCSI Device from the list of device types and click Next.
- Select the appropriate device from the SCSI Device drop down list.
- Select the Virtual Device Node which matches the Adapter and Target of the Runtime Name of the device, as recorded in step 6. The Virtual Device Nodes are denoted as <Bus>:<Target>. For example, the Runtime Name vmhba2:C0:T1:L0 corresponds with a Virtual Device Node of (1:1), (2:1), or (3:1).Note: For more information about the Runtime Name, see Identifying disks when working with VMware ESX (1014953).Warning: For clarification, (0:1) is also available for configuration. However this bus is usually already populated by a virtual disk in a typical virtual machine setup. As tape operations by nature are quite disruptive for devices on the same bus, to avoid interruption, ensure the tape devices’ target IDs are on a separate bus from the other virtual machine disks attached to the virtual machine. For example, bus (0:x) can have several virtual machine disks, while bus (1:x) has the tape pass-through device(s).
- Proceed to install and configure the backup software according to the software vendor’s guidelines.
The functionality of the tape library and the backup software in conjunction with VMware ESX is partner-supported. VMware assumes that the third party vendor has completed necessary validation to support this configuration in a production environment.
In the event that a problem is found, VMware recommends opening a support request directly with the third-party or partner vendor’s support organization. VMware collaborates with other vendors via Technical Support Alliance Network (TSANet) or Cooperative Support Agreement (CSA).
For more information regarding third party vendor support, see Third Party Hardware and Software Support Policy.
- As of vSphere 4.0, ESX only supports connectivity to parallel SCSI tape libraries.
- VMware only supports the attaching of Parallel SCSI based tape Devices to an Adaptec SCSI Controller, see Page 20 of the Virtual Machine Backup Guide for further information
Now, you ask which method shall I use. If your hardware & software configuration is supported by VMDirectPath, then I would check with the tape library vendor on which method to use, else you are stuck with the attaching directly to SCSI method. Remember the support statement here highly depend on your tape library vendor, so consult your vendor before implementing it.
At the end, I would still say if you can avoid attaching a tape library to a virtual VM then by all mean just avoid it as it will make your life much easier beside there is many other good methods for backing up VMs that does not require it (Ex: vStorage API)
I hope this help some one, & please leave your ideas and comment in the comments area below.