Hi Elisha, (Adding CC's for target-devel and Jerome) On Mon, 2013-08-19 at 16:26 +0300, Elisha Atzmon (PhD) wrote: > Hi, > > > I would like to ask a question which is related to targetcli. > > I’ve created on /sdb 4 gpt partitions: sdb20 , sdb21, sdb101 , > sdb111 > > > Whenever, I’ve tried to create iblock device with device which contain > 0 in the path (.i.e. zero) I’m getting “Device is not a TYPE_DISK > block device.” > > E.G. : /backstores/iblock create name=101 dev=/dev/sdb101 does > not work!! > > Getting “Device is not a TYPE_DISK bloc > device.” > > > /backstores/iblock create name=20 dev=/dev/sdb20 does not work!! > > Getting “Device is not a TYPE_DISK block device.” > > > However, > > /backstores/iblock create name=111 dev=/dev/sdb111 - it works!! > > /backstores/iblock create name=21 dev=/dev/sdb21 - it works !! > > > It seems to me a quite bizarre bug. > Thanks for reporting. rtslib does filtering of the available TYPE_DISK block devices in rtslib.git/utils.py:get_block_type() based upon major number here: https://github.com/nablio3000/rtslib/blob/master/rtslib/utils.py#L210 Looking closer, I think you are hitting a bug in is_disk_partition() here: https://github.com/nablio3000/rtslib/blob/master/rtslib/utils.py#L158 Namely the regex's below with the '[1-9]' def is_disk_partition(path): ''' Try to find out if path is a partition of a TYPE_DISK device. Handles both /dev/sdaX and /dev/disk/by-*/*-part? schemes. ''' regex = re.match(r'([a-z/]+)([1-9]+)$', path) if not regex: regex = re.match(r'(/dev/disk/.+)(-part[1-9]+)$', path) Care to give the following patch a shot..? Thanks, --nab diff --git a/rtslib/utils.py b/rtslib/utils.py index 5dcaeda..2aa29a8 100644 --- a/rtslib/utils.py +++ b/rtslib/utils.py @@ -160,9 +160,9 @@ def is_disk_partition(path): Try to find out if path is a partition of a TYPE_DISK device. Handles both /dev/sdaX and /dev/disk/by-*/*-part? schemes. ''' - regex = re.match(r'([a-z/]+)([1-9]+)$', path) + regex = re.match(r'([a-z/]+)([0-9]+)$', path) if not regex: - regex = re.match(r'(/dev/disk/.+)(-part[1-9]+)$', path) + regex = re.match(r'(/dev/disk/.+)(-part[0-9]+)$', path) if not regex: return False else: -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html