On 2016-05-05 12:32, Steven Haigh wrote: > Overview > > If you're using iSCSI, you can mount a target by multiple Dom0 > machines on the same target. For non-cluster aware filesystems, this > can lead to disk corruption and general bad times by all. The iSCSI > protocol allows the use of persistent reservations as per the SCSI > disk spec. Low level SCSI commands for locking are handled by the > sg_persist program (bundled with sg3_utils package in EL). > > The aim of this patch is to create a 'locktarget=y' option specified > within the disk 'target' command for iSCSI to lock the target in > exclusive mode on VM start with a key generated from the local systems > IP, and release this lock on the shutdown of the DomU. > > Example Config: > disk = > ['script=block-iscsi,vdev=xvda,target=iqn=iqn.1986-03.com.sun:02:mytarget,portal=iscsi.example.com,locktarget=y'] > > In writing this, I have also re-factored parts of the script to put > some things in what I believe to be a better place to make expansion > easier. This is mainly in removing functions that purely call other > functions with no actual code execution. > > Signed-off-by: Steven Haigh > > (on a side note, first time I've submitted a patch to the list and I'm > currently stuck on a webmail client, so apologies in advance if this > all goes wrong ;) Changes in v2: Bugfix: Call find_device to locate the /dev/sdX component of the iSCSI target before trying to run unlock_device(). Apologies for this oversight. -- Steven Haigh Email: netwiz@crc.id.au Web: https://www.crc.id.au Phone: (03) 9001 6090 - 0412 935 897