From nobody Tue Dec 20 20:43:34 2022 X-Original-To: freebsd-scsi@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Nc7p81zQZz1GxW5 for ; Tue, 20 Dec 2022 20:43:44 +0000 (UTC) (envelope-from pz-freebsd-scsi@ziemba.us) Received: from osmtp.ziemba.us (tc-v.ziemba.us [149.28.207.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Nc7p70tbyz4L8r for ; Tue, 20 Dec 2022 20:43:42 +0000 (UTC) (envelope-from pz-freebsd-scsi@ziemba.us) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=ziemba.us header.s=hairball header.b=bLsXGJIO; spf=pass (mx1.freebsd.org: domain of pz-freebsd-scsi@ziemba.us designates 149.28.207.195 as permitted sender) smtp.mailfrom=pz-freebsd-scsi@ziemba.us; dmarc=none Received: from osmtp.ziemba.us (cyrus.ziemba.us [10.0.0.33]) by dkim.ziemba.us (8.17.1/8.17.1) with ESMTP id 2BKKhZDB072457 for ; Tue, 20 Dec 2022 12:43:35 -0800 (PST) (envelope-from pz-freebsd-scsi@ziemba.us) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ziemba.us; s=hairball; t=1671569015; bh=LvHUgTETUs2s4MYE6IBRGOYlbfuqaIf3jwuHN2gukLM=; h=From:To:Subject:Date:Reply-to; z=From:=20"G.=20Paul=20Ziemba"=20|To:=20 freebsd-scsi@freebsd.org|Subject:=20How=20do=20I=20assign=20an=20i scsi=20target=20to=20a=20specific=20local=20device?|Date:=20Tue,=2 020=20Dec=202022=2020:43:34=20+0000=20(UTC)|Reply-to:=20unp@ziemba .us; b=bLsXGJIOgXbzvUJU9X4KFvU5ZCebSH/exUneiLIwnRY4h5JAiTGHLbotQMBgVNEY/ sMpq7JpN5XzDsXj6f+eu1ZVPhkMgdgeD7wogU4TPQZSswYMpVzfyXNg8G9AdoFn5hs LItUNy3Y7dz8V5fqvZKL6vv/pAdC8HFc2fs1M8Xmo6x9wZDzmyaobymBcIGa3tVL+d BkQAiVithL0gxZCv3ydeLxlpRoZgfOEma/rS5pVhDrLWpjoMnIswFRrnV5lETdkBK/ LjNEEPjQgH7mIH1DpntV4uqICcWS1MFkvWnxNKdErcFfxj9ZSYa+DMs2tjmg3z6iW4 aThTMy1ZFzt+g== X-Authentication-Warning: hairball.ziemba.us: Host cyrus.ziemba.us [10.0.0.33] claimed to be osmtp.ziemba.us Received: from hairball.ziemba.us (localhost.ziemba.us [127.0.0.1]) by hairball.ziemba.us (8.17.1/8.17.1) with ESMTP id 2BKKhZVG072454 for ; Tue, 20 Dec 2022 12:43:35 -0800 (PST) (envelope-from pz-freebsd-scsi@ziemba.us) X-Authentication-Warning: hairball.ziemba.us: Host localhost.ziemba.us [127.0.0.1] claimed to be hairball.ziemba.us Received: (from mailnull@localhost) by hairball.ziemba.us (8.17.1/8.17.1/Submit) id 2BKKhY4o072453 for freebsd-scsi@freebsd.org; Tue, 20 Dec 2022 12:43:34 -0800 (PST) (envelope-from pz-freebsd-scsi@ziemba.us) X-Authentication-Warning: hairball.ziemba.us: mailnull set sender to pz-freebsd-scsi@ziemba.us using -f Received: (from news@localhost) by usenet.ziemba.us (8.14.5/8.14.5/Submit) id 2BKKhY3i034033 for treehouse-mail-freebsd-scsi@hairball.ziemba.us; Tue, 20 Dec 2022 12:43:34 -0800 (PST) (envelope-from news) From: "G. Paul Ziemba" To: freebsd-scsi@freebsd.org Subject: How do I assign an iscsi target to a specific local device? Date: Tue, 20 Dec 2022 20:43:34 +0000 (UTC) Message-id: Reply-to: unp@ziemba.us Errors-to: "G. Paul Ziemba" X-Spamd-Result: default: False [-2.47 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.97)[-0.973]; R_SPF_ALLOW(-0.20)[+ip4:149.28.207.195]; R_DKIM_ALLOW(-0.20)[ziemba.us:s=hairball]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[ziemba.us]; HAS_REPLYTO(0.00)[unp@ziemba.us]; MLMMJ_DEST(0.00)[freebsd-scsi@freebsd.org]; DKIM_TRACE(0.00)[ziemba.us:+]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ASN(0.00)[asn:20473, ipnet:149.28.192.0/19, country:US]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; ARC_NA(0.00)[]; TO_DN_NONE(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-scsi@freebsd.org]; REPLYTO_DOM_EQ_FROM_DOM(0.00)[]; HAS_XAW(0.00)[]; RCVD_TLS_LAST(0.00)[] X-Rspamd-Queue-Id: 4Nc7p70tbyz4L8r X-Spamd-Bar: -- X-ThisMailContainsUnwantedMimeParts: N List-Id: SCSI subsystem List-Archive: https://lists.freebsd.org/archives/freebsd-scsi List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-scsi@freebsd.org X-BeenThere: freebsd-scsi@freebsd.org FreeBSD 13.1-STABLE (stable branch as of 2022-May-01) On a freebsd iscsi initiator, I'd like to map remote devices (accesed via iscsi) to specific device names on the initiator. In my case, the remote devices happen to be tape library changers and tape drives, which show up as ch and sa devices on the initiator. Here is partial output of "camcontrol devlist -v" showing relevant dynamically-assigned entries: scbus12 on iscsi4 bus 0: at scbus12 target 0 lun 0 (pass10,ch2) at scbus12 target 0 lun 1 (pass11,sa2) <> at scbus12 target -1 lun ffffffff () I'm familiar with "wiring" mappings as described in cam(4) via /boot/device.hints. However, I believe that in the case of the iscsi initiator, the controller instance "iscsi4" depends on past history, so I can't expect consistency via a device.hints entry such as: hint.scbus.0.at="iscsi4" "iscsictl -L -v" output indicates: Session ID: 4 [...] Device nodes: ch2 sa2 And /usr/src/sys/dev/iscsi_initiator/iscsi.c has: static int i_create_session(struct cdev *dev, int *ndev) { [...] int error, n; [...] if((n = alloc_unr(sc->unit)) < 0) { [...] xdebug("too many sessions!"); return EPERM; } I'm guessing that "4" in "iscsi4" comes from the iscsi session ID and, based on the session ID assignment code, there is no current way to assign fixed session IDs to specific targets. I'm hoping someone can dispute this claim. In theory I could hack something up that parsed the "iscsictl -L -v" output and symlinked the devices to fixed names, but that's ugly and asynchronous. Is there a better approach? Many thanks! -- G. Paul Ziemba FreeBSD unix: 12:41PM up 8 days, 22:19, 29 users, load averages: 0.29, 0.17, 0.15