ctladm - create the target using only cli
Eugene M. Zheganin
emz at norma.perm.ru
Fri Dec 15 13:45:32 UTC 2017
Hi,
my company is developing some sort of API for iSCSI managing, and at
this time we are trying to figure out how to create and delete targets
using ctladm and not usingb the configuration file.
And the relationship between LUNs and ports are unclear to us if we
don't use the configuration file. As abount the creation of LUN
everyting is clear:
ctladm create -b block -o file=/dev/zvol/dataflash/kvm/emz -o
ctld_name=iqn.2016-04.net.playkey.iscsi:emz666,lun,0 -o
scsiname=iqn.2016-04.net.playkey.iscsi:emz666,lun,0 -d EMZ666 -S EMZ666
But what next ? How do I create the port ? Because without port there's
no way the iSCSI initiator would see the target. And there's no port,
create created only the LUN:
[root at san:~]# ctladm portlist
Port Online Frontend Name pp vp
0 YES tpc tpc 0 0
1 YES camsim camsim 0 0 naa.500000079e708702
2 YES ioctl ioctl 0 0
3 YES iscsi iscsi 257 1
iqn.2016-04.net.playkey.iscsi:games,t,0x0101
4 YES iscsi iscsi 257 2
iqn.2016-04.net.playkey.iscsi:games-worker01,t,0x0101
5 YES iscsi iscsi 257 3
iqn.2016-04.net.playkey.iscsi:games-worker02,t,0x0101
6 YES iscsi iscsi 257 4
iqn.2016-04.net.playkey.iscsi:games-worker03,t,0x0101
7 YES iscsi iscsi 257 5
iqn.2016-04.net.playkey.iscsi:games-worker04,t,0x0101
8 YES iscsi iscsi 257 6
iqn.2016-04.net.playkey.iscsi:games-worker05,t,0x0101
9 YES iscsi iscsi 257 7
iqn.2016-04.net.playkey.iscsi:cirrascale1,t,0x0101
10 YES iscsi iscsi 257 8
iqn.2016-04.net.playkey.iscsi:userdata1,t,0x0101
11 YES iscsi iscsi 257 9
iqn.2016-04.net.playkey.iscsi:userdata2,t,0x0101
12 YES iscsi iscsi 257 10
iqn.2016-04.net.playkey.iscsi:foobar,t,0x0101
13 YES iscsi iscsi 257 11
iqn.2016-04.net.playkey.iscsi:guest1,t,0x0101
14 YES iscsi iscsi 257 12
iqn.2016-04.net.playkey.iscsi:win7,t,0x0101
15 YES iscsi iscsi 257 13
iqn.2016-04.net.playkey.iscsi:guest2,t,0x0101
16 YES iscsi iscsi 257 14
iqn.2016-04.net.playkey.iscsi:guest3,t,0x0101
17 YES iscsi iscsi 257 19
iqn.2016-04.net.playkey.iscsi:guest4,t,0x0101
19 YES iscsi iscsi 257 17
iqn.2016-04.net.playkey.iscsi:zeppelin,t,0x0101
(obviously there's no entity named 'emz')
[root at san:~]# ctladm devlist
LUN Backend Size (Blocks) BS Serial Number Device ID
0 block 6442450944 512 MYSERIAL 0 MYDEVID 0
1 block 6442450944 512 MYSERIAL 1 MYDEVID 1
2 block 6442450944 512 MYSERIAL 2 MYDEVID 2
3 block 6442450944 512 MYSERIAL 3 MYDEVID 3
4 block 6442450944 512 MYSERIAL 4 MYDEVID 4
5 block 6442450944 512 MYSERIAL 5 MYDEVID 5
6 block 62914560 512 MYSERIAL 6 MYDEVID 6
7 block 104857600 512 MYSERIAL 7 MYDEVID 7
8 block 104857600 512 MYSERIAL 8 MYDEVID 8
9 block 2048 512 MYSERIAL 9 MYDEVID 9
10 block 104857600 512 MYSERIAL 10 MYDEVID 10
11 block 104857600 512 MYSERIAL 11 win7
12 block 104857600 512 MYSERIAL 12 guest2
13 block 104857600 512 MYSERIAL 13 guest3
16 block 104857600 512 MYSERIAL 16 zeppelin
15 block 104857600 512 666 guest4
14 block 104857600 512 MYSERIAL7777 MYDEVID7777
17 block 204800 512 EMZ666 EMZ666 <--- this
is the device I want to create the target from.
Thanks.
Eugene.
More information about the freebsd-stable
mailing list