On Fri, 2013-10-11 at 10:24 -0700, Andy Grover wrote: > On 10/11/2013 08:09 AM, Seth Call wrote: > > I'm porting an application which runs on OpenIndiana. In OpenIndiana, > > we just invoke itadm and stmfadm to create and destroy ISCSI targets. > > > > The command targetcli, however, seems a bit unfriendly to scripting in > > this fashion, seeing how it's interactive and all. > > > > I found this patch, and applied it, and it's allowed me to invoke > > targetcli as a one-liner, like: > > > > targetcli /iscsi create iqn.a.b.c:x > > > > Unfortunately, if the command fails, the exit code is still always 0. > > patch: http://www.spinics.net/lists/target-devel/msg01554.html > > > > But forget my approach for a second--I feel I might be missing how > > this is usually done. Does anyone script using targetcli, or do they > > use some other command instead? > > This is a longtime issue with targetcli. Errors are not propagated all > the way up to a single place that would make exiting with an error code > possible. Alternatives include: > > 1) Poking configfs yourself, directly or with lio-utils Please don't recommend doing this.. > 2) If using Python, using rtslib library > Yes, this is what most folks probably want to end up doing. > if using targetcli-fb: > > 3) reading/modifying/writing /etc/target/saveconfig.json then reloading > config Ugh.. > 4) cmdline invocation with that patch you referenced > > with another possibility of course being: > > 5) Fix targetcli > FYI, we're now in the process of reconciling the upstream rtslib/configshell/targetcli trees with -fb, and avoiding the stuff that was included to -fb with no community review. --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