From owner-freebsd-stable@freebsd.org Fri Dec 15 13:45:32 2017 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B96B5E81DE8 for ; Fri, 15 Dec 2017 13:45:32 +0000 (UTC) (envelope-from emz@norma.perm.ru) Received: from elf.hq.norma.perm.ru (mail.norma.perm.ru [IPv6:2a00:7540:1::5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.norma.perm.ru", Issuer "Vivat-Trade UNIX Root CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 3E7F57675E for ; Fri, 15 Dec 2017 13:45:31 +0000 (UTC) (envelope-from emz@norma.perm.ru) Received: from bsdrookie.norma.com. (asterisk.enaza.ru [46.146.220.88]) by elf.hq.norma.perm.ru (8.15.2/8.15.2) with ESMTPS id vBFDjQ55043260 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Fri, 15 Dec 2017 18:45:27 +0500 (YEKT) (envelope-from emz@norma.perm.ru) To: FreeBSD Stable Mailing List From: "Eugene M. Zheganin" Subject: ctladm - create the target using only cli Message-ID: Date: Fri, 15 Dec 2017 18:45:26 +0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spamd-Result: default: False [-1.10 / 25.00] BAYES_HAM(-3.00)[100.00%] RBL_SPAMHAUS_PBL(2.00)[88.220.146.46.zen.spamhaus.org : 127.0.0.10] RCPT_COUNT_ONE(0.00)[1] R_DKIM_NA(0.00)[] MIME_GOOD(-0.10)[text/plain] TO_DN_ALL(0.00)[] FROM_EQ_ENVFROM(0.00)[] ASN(0.00)[asn:12768, ipnet:46.146.0.0/16, country:RU] FROM_HAS_DN(0.00)[] ARC_NA(0.00)[] IP_SCORE(0.00)[ip: (-7.74), ipnet: 46.146.0.0/16(-7.33), asn: 12768(-0.94), country: RU(-0.22)] RCVD_TLS_ALL(0.00)[] R_SPF_SOFTFAIL(0.00)[~all] MID_RHS_MATCH_FROM(0.00)[] RCVD_COUNT_TWO(0.00)[2] RECEIVED_SPAMHAUS(0.00)[88.220.146.46.zen.spamhaus.org] DMARC_NA(0.00)[perm.ru] TO_MATCH_ENVRCPT_ALL(0.00)[] X-Rspamd-Server: localhost X-Rspamd-Scan-Time: 0.68 X-Rspamd-Queue-ID: vBFDjQ55043260 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Dec 2017 13:45:32 -0000 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@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@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.