Share virtual disk between guests

Latest response

Is it possible to share virtual disk between two  guests ?


I'd like to  check if this  scenario  may be impelemted  :


  • run two rh5 guests
  • each guest has  one system disk
  • add second  virtual disk on  first  of these guests
  • defince some database on this extra  disk
  • Launch  db application on the first guest.
  • in a case of the db failure unmount/detach this  virtual disk from original  guest and  mount/attach it on the second guest  using API .
  • Run  db app  on  second guest .


/Vlad .


Hi, this is not currently possible, but a feature to allow this is being developed.


Generally speaking, attaching two VMs to the same disk is possible via a vdsm hook, since libvirt allows it, but the disk needs to be somehow managed so that the right VM would have access to it, and that requires additional development.

This would imply some serious limitations to running RHCS (or HA, whatever it's called now) in VMs, wouldn't it? Or how else will I be able to share storage on VMs other than by assigning the same disk/LUN?


For RHCS you will also need the fence_rhev fence agent, which, unless I've missed the announcement, is not released yet (I might be wrong here actually, need to check).


If both VMs are able to access the same storage without RHEV having to manage that storage (usually a good example is when both are running on the same host, accessing an image on the local FS of that host), and if the fence agent is available, I think there should be no problem to run RHCS. 


There is an easier way in terms of storage though - use iscsi with iscsi initiator in the VMs - all that requires is for the VMs to have access tot he same iSCSI target

I'm thinking of the traditional scenario where two servers have access to the same SAN LUN. Which may be either non-clustered (either manually mounted on only 1 server or read-only on all) or clustered (using e.g. RHCS or GFS2).

I don't see any way to add an existing disk to a VM within RHEV-M?

So it would seem the only way to do this is using iSCSI, which isn't always an option.

Not within RHEV-M (yet), but if all the hosts are able to see a LUN or a file on a shared LUN, you can use a vdsm hook to connect your VM pair to that LUN.