Procedure
This procedure uses virt-manager GUI interface. I'm sure there is a way to do this from the command line as well.
- Create a shared device to be used by two VMs
- Open virt-manager
- Double click on one of the VMs which you want to add the shared device on and go to
View->Details
- Select:
Add Hardware
on the bottom left - Select:
Select or create custom storage
- Select:
Manage
- Select:
"+"
- Give the volume a name
- Select
"raw"
from the"format"
dropdown - Give it a size
- Hit
"Finish"
- Back in the
"Add New Virtual Hardware"
window, set"Bus Type"
to"SCSI"
- Hit
"Finish"
- In the
"Detailed"
view of the VM, under the new storage device, select"Shareable"
- On the second VM, go through the same steps to add a storage device, but select the existing shared device you just created and make it shareable as well
- Start the VMs
- You should now see a
"/dev/sda" (or similar)
which is the shared device - To setup OST failover for example, do the following from one of the VMs using the shared device
# on VM-1 mkfs.lustre --ost --fsname=lustrewt --servicenode=192.168.122.114@tcp --servicenode=192.168.122.110@tcp --reformat --index=0 --mgsnode=192.168.122.117@tcp /dev/sda mount -t lustre /dev/sda /mnt/ost/ # to go through a failover do # on VM-1 umount /mnt/ost # on VM-2 mount -t lustre /dev/sda /mnt/ost/