By thomas, Fri, 09/18/2009 - 15:05
To allow for live migration, the disk devices must appear to be the same on all the hypervisors. As we are using fibre channel, all of our luns will appear as separate scsi devices, but he names will probably be different, what is sdb on machine x might be sdf on machine y. Also, since our fibre channel has redundant connections to the switch, each lun will appear twice on the servers. To ensure the devices appear the same on all servers, we implemented multipath.

Using multipath is a critical step, and it's very straightforward to implement. When setting up a new virtual machine we carve out part of the fibre channel array for the device. Our array will return the id of the new device upon creation of a new lun, we make note of that to make sure we are talking about the right slice of the disk.

First, we configure multipath to look at the scsi devices, by default everything is blacklisted, so comment out the lines that look like this in /etc/multipath.conf:

blacklist {
        devnode "*"
}
change to:
#blacklist {
#        devnode "*"
#}
Next we'll tell multipath how to recognise the different luns on the system. This is usually at the bottom of the default multipath.conf file.
devices {
        device {
                vendor  "Vendor"
                product "OurFC"
                getuid_callout "/sbin/scsi_id -g -u -s /block/%n"
}

This tells multipath how to identify luns on the system uniquely. For example, we have a lun configured for a test vm, it appears on the system as device /dev/sdb, we run scsi_id against /block/sdc to determine the scsi_id of the lun.
[root@hypervisor0 ~]# /sbin/scsi_id -g -u -s /block/sdc
Vendor_FF01000033100100
In our case, since we have redundant links to the fibre channel so both /dev/sdc and /dev/sde return the same results
[root@hypervisor0 ~]# /sbin/scsi_id -g -u -s /block/sde
Vendor_FF01000033100100
Now, to make this useful, we have to define an alias for this scsi_id, so we'll make an alias called vm1, since this is our first vm.
multipaths {
        multipath {
                wwid            Vendor_FF01000033100100
                alias           vm1
        }
}
Here we are telling multipath to create a device in /dev/mapper called vm1 and have any data destined to that device to be routed to either /dev/sdc or /dev/sde depending on which is available. You can specify a round-robin on that, but that's no important right now. The important thing is that on any server we build, if we have the same multipath.conf file, the device /dev/mapper/vm1 will exist on that server. Moreoever, it will be the correct lun on the fibre channel each time.