How to attach and detach direct LUNs to Virtual Machines in oVirt Setup

Hello Techies, there are some scenarios where we are required to present Direct LUNs and RDM Disk to Virtual machines under oVirt / RHEV Setup. In this article I will demonstrate how to attach and detach Direct LUNs to Virtual machines hosted in oVirt Setup.

Let’s suppose I have non-production Data center and under this DC I have one Cluster with name “Non_Prod_Cluster” and under this cluster I have two ovirt host or ovirt hypervisor.

Let’s assign 100 GB Direct LUN to CentOS7 Virtual Machine.

Step:1 Login to your oVirt Manager Portal.

First login to oVirt engine / oVirt Manager and select your data center and then click on the Disks Tab

Datacenter-Disk-Tab-ovirt-engine

Click on New

Direct-LUN-Option-oVirt-Engine

Select the ‘Direct LUN‘ option, then specify the followings, In my case I am using beneath

  •  Alias : direct_lun_centos7
  •  Description: Automatically Populates
  • Datacenter : Automatically Selected.
  • Use Host : Specify the Host on which LUN is directly attached via Fibre Channel
  • Storage Type : Fibre Channel / iSCSI

Click on OK

Step:2 Select the VM on which we want attach Direct LUN

Click on Virtual Machines Tab and then select the Virtual Machine (CentOS7_Server) on which we want map or present Direct LUN and then Click on Disks Tab for the selected Virtual Machine.

Click on Attach Option from Disks Tab,

Disk-Attach-Virtual-Machine-Ovirt-engine

Click on Direct LUN option and then Select the LUN that you want to map or present to the VM, In our previous step we have added alias to our Direct LUN, So we can select LUN by its Alias

Direct-LUN-Mapping-Virtual-Machine-oVirt-Engine

When we click on OK, the it will map the direct lun to the VM

To verify the LUN details like its LUN ID, Serial Number and Vendor ID click on Direct LUN option from Disk Tab.

Direct-LUN-Details-VM-Ovirt-Engine

Let’s Verify from the OS as well whether new 100 GB LUN is visible or not. Login to your virtual machine run ‘fdisk -l‘ and ‘multipath -l‘ command,

fdisk-command-output-linux

Detach Direct LUN from Virtual Machine in oVirt Setup

To detach Direct LUN from virtual machine refer the following steps:

Select the LUN from Disks Tab of Virtual Machine and then click on Deactivate

detach-direct-luns-virtual-machine-ovirt-engine

Click on ok

Once the LUN is deactivated then remove it by clicking on Remove Option from the Disks Tab

Remove-Direct-LUN-Permanently-oVirt-Engine

Click on Ok

Now Verify from OS side as well whether LUN has been removed or not, Run ‘fdisk -l’ and ‘multipath -l’ from the terminal

fdisk-l-command-output-centos7

As we can see there is no disk of 100 GB present on the server as well , so we can say LUN has remove successfully from the server as well.

That’s all from this article. I hope you got an idea how to map direct LUN to a virtual machine in oVirt Setup. In the past we have already discuss the following topics on oVirt.

How to install and configure oVirt 4.0 on CentOS 7 / RHEL 7

How  to  Create Virtual  Machines  in  oVirt 4.0  Environment

1 Response

  1. Johan Kragsterman says:

    Hi!

    I’ve been doing some research on oVirt/KVM with fibre channel as SAN storage. I was using NPIV to get LU’s for the VM’s. One problem I never solved was how to get multipathing working for the LU’s in the KVM virtual machines. The host saw the multipathed LU’s, but not the VM’s.
    How is the case with this solution you present here? Do the VM’s see, and is able to use the true multipaths of the LU’s, so that they can fail over from one path to another?

    Regards Johan

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest