Hi Oliver, On Wed, 2014-08-20 at 11:53 +0200, Oliver Rath wrote: > Hi list, > > I try to reproduce the creating of an iscsi-target via iblock device as > shown in lio_node and tcm_node. Taken from > http://www.thomas-krenn.com/de/wiki/Linux-IO_Target_%28LIO%29_unter_Ubuntu_14.04#FILEIO_.28Linux_VFS_devices.29 > with targetcli: > > > |cd /backstores/iblock| > |create name=iscsi dev=/dev/sdb| > |cd /iscsi| > create > |cd > iscsi/root@dmicrash:iqn.2003-01.org.linux-iscsi.dmicrash.x8664:sn.a5bb4cf3e6cd/tpgt1/portals > # in my case > create > cd ../luns| > create /backstores/iblock/iscsi > # works fine, but here is my question point > > Now I tried the same with generic commands: > cd /sys/kernel/config/target/core/ > mkdir iblock_1 > cd iblock_1 > mkdir iblock_clone6/ > echo "udev_path=/dev/myvg/clone6" > control > echo -n 1 > enable > > # Now we can create the iscsi-Target > > cd cd /sys/kernel/config/target/iscsi/ > mkdir iqn.2012-03.org.clone6.liotarget > cd iqn.2012-03.org.clone6.liotarget > mkdir tpgt_1 > cd tpgt_1 > mkdir -p tpgt_1/lun/lun_0 > cd tpgt_1/lun/lun_0 > ---- break ---- > Here exists in the dir made by targetcli a link with the name > "81eb98828f", which points to the iblock device. This seems to be a 5 > byte hex-number. > Now my question: How is this number generated? Does the name matter for > functionality? It seems there a separate number for all links. Im able > to create the link with my own name and all seems ok. > --- break end --- > ln -s ../../../../../../target/core/iblock_1/iblock_clone6/ my_own_link > cd ../../np > mkdir '192.168.96.254:3260' > cd .. > echo 1 > enable > > > This all works and the output in targetcli shows me an enabled target > pointing to /dev/myvg/clone6. > > Is this a possible alternative to generate a target. Do I have to > prepare a special name for this link? > The LUN configfs symlink destination name is created from a uuid in the following rtslib code: https://github.com/Datera/rtslib/blob/master/rtslib/target.py#L407 There is no hard requirement from the kernel side for this to be a unique value, and IIRC is only used for indexing purposes by rtslib. That said, I'd still recommend using rtslib and/or targetcli for driving the configuration in real-world usage scenarios, beyond poking at configfs directly to better understand how the underlying system functions. --nab -- 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