Le 2011-04-06 14:58, Dustin Marquess a écrit :
I believe since each VM's vdi is assigned a different 'chunk' of the
LUN, no two machines will ever be writing to the same chunk at the
same time.
With a LVMOISCSI SR (LVM over iSCSI), the same VDI cannot be shared
between two VM's, this seems to be designed like this, even if you
set the sharable flag at "true".
However, there is a way to share a VDI between 2 VM's with
XenServer/XCP: you need to create iSCSI SR using xe (XenCenter can
only create LVMOISCSI SR). This a "VDI-per-LUN" approach, and when
using this, you will be able to attach the same VDI to two VM's, in
order to use a clustered filesystem (gfs, ocfs2)
The iSCSI SR type driver requires an IP address and IQN identifier.
It will initialise the iSCSI session and detect all LUNs presented
from that target. All LUNs get assigned a VDI UUID and are entered
into the XAPI DB with the managed flag set to false. As you call
VDI.create for that SR with a virtual-size parameter it will select
the closest matching VDI from the unmanaged freelist and toggle the
flag to managed. At this point you can attach VDIs via VBDs to VMs,
and existing content on the LUN should be accessible to the VM over
the virtual block device.
Example :
xe sr-create name-label="SAN raw view" type=iscsi shared=true
device-config:target=<target IP>
device-config:targetIQN=<target IQN>
xe vdi-create sr-uuid=<SR uuid returned>
name-label="shared_vdi" type=user virtual-size=<your LUN size>
sharable=true
xe vbd-create vm-uuid=<vm1_uuid> vdi-uuid=<VDI UUID
returned> device=<requested device position>
xe vbd-create vm-uuid=<vm2_uuid> vdi-uuid=<VDI UUID
returned> device=<requested device position>
Hope this helps,
Pierre
|