istgt configuration is a pain, and doesn't report PEBCAK properly
|Reported by:||jgreco||Owned by:|
So I've been through the process of configuring iSCSI on FreeNAS and ESXi a bunch of times now.
I'd like to make the following observation:
It's a pain to configure. You kind of need to step into Target Global Configuration to set the Base Name, but you cannot complete that screen because setting up CHAP requires other tabs to be configured first. So usually I wind up going to Portals, then working backwards a bit through Authentication and then forward to Authorized Initiators, then back to TGC to set up the CHAP options, then once I've set up what's to me the "login/user" stuff, I switch into "device" mode and go to "Extents", set up the extent, then to "Targets" to set up a target, then over to "Associated Targets". This is admittedly not the only way one could do this, but it's logical, and if you look at it, it's a messy bunch of hopping around.
So that's only outlining the FreeNAS end of things; at the same time, one is also setting up stuff on ESXi in lockstep. More stuff that has to be got-right.
Not sure what to suggest about that, except that I wanted to point out that it feels completely wrong, but anyways, on to my bug report. I was grinding through that for about the dozenth time this year, and I had my ESXi hosts rescan for new targets. One of them (and only one of them) was kicking up a
Jun 7 18:49:35 freenas istgt: istgt_iscsi.c:2088:istgt_iscsi_op_login: *ERROR* lu_find_target() failed
error. Obviously something not right; the fact that only one of them was causing the FreeNAS box to throw this made me re-walk through the CHAP stuff several times looking for stupid spaces and other errors, which can eat up a fair bit of time. When I became convinced that this couldn't be the problem, I dug some other ways and discovered that I hadn't committed the "Associated Targets" screen, and as a result istgt.conf ended with
# LogicalUnit? section
...and nothing more...
So, since this is clearly a configuration-generated file, could someone please add some sanity checking to iSCSI configuration? It's obviously not possible to catch all possible errors, but it might be nice to generate a warning if a target was unused, or an extent was unused, or the resulting iSCSI configuration lacked a mandatory section, or stuff like that.