[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] v3 - Add exclusive locking option to block-iscsi



On 2016-05-05 15:52, Steven Haigh wrote:
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 <netwiz@xxxxxxxxx>

(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.


Changes in v3:
* Split the block-iscsi cleanup into a seperate patch (block-iscsi-locking-v3_01_simplify_block-iscsi.patch). * Add locking in second patch file (block-iscsi-locking-v3_02_add_locking.patch)

--
Steven Haigh

Email: netwiz@xxxxxxxxx
Web: https://www.crc.id.au
Phone: (03) 9001 6090 - 0412 935 897

Attachment: block-iscsi-locking-v3_01_simplify_block-iscsi.patch
Description: Text Data

Attachment: block-iscsi-locking-v3_02_add_locking.patch
Description: Text Data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.