2 .\" Copyright (c) 2008, Sun Microsystems Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH IT_TGT_CREATE 3ISCSIT "Oct 1, 2008"
8 it_tgt_create, it_tgt_setprop, it_tgt_delete, it_tpgt_create, it_tpgt_delete,
9 it_tgt_free, it_tpgt_free \- create, modify and delete iSCSI Targets
13 cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-liscsit\fR [ \fIlibrary\fR\&.\|.\|. ]
14 #include <libiscsit.h>
16 \fBint\fR \fBit_tgt_create\fR(\fBit_config_t **\fR\fIcfg\fR, \fBit_tgt_t **\fR\fItgt\fR,
17 \fBchar *\fR\fItgt_name\fR);
22 \fBint\fR \fBit_tgt_setprop\fR(\fBit_config_t *\fR\fIcfg\fR \fBit_tgt_t *\fR\fItgt\fR,
23 \fBnvlist_t *\fR\fIproplist\fR, \fBnvlist_t **\fR\fIerrlist\fR);
28 \fBint\fR \fBit_tgt_delete\fR(\fBit_config_t *\fR\fIcfg\fR, \fBit_tgt_t *\fR\fItgt\fR,
29 \fBboolean_t\fR \fIforce\fR);
34 \fBint\fR \fBit_tpgt_create\fR(\fBit_config_t *\fR\fIcfg\fR, \fBit_tgt_t *\fR\fItgt\fR,
35 \fBit_tpgt_t **\fR\fItpgt\fR, \fBchar *\fR\fItpg_name\fR, \fBuint16_t\fR \fItpgt_tag\fR);
40 \fBvoid\fR \fBit_tpgt_delete\fR(\fBit_config_t *\fR\fIcfg\fR, \fBit_tgt_t *\fR\fItgt\fR,
41 \fBit_tpgt_t *\fR\fItpgt\fR);
46 \fBvoid\fR \fBit_tgt_free\fR(\fBit_tgt_t *\fR\fItgt\fR);
51 \fBvoid\fR \fBit_tpgt_free\fR(\fBit_tpgt_t *\fR\fItpgt\fR);
61 a pointer to the iSCSI configuration structure
70 a pointer to an iSCSI target structure
79 the target node name for the target to be created. The name must be in either
80 IQN or EUI format. If this value is \fINULL\fR, a node name will be generated
81 automatically in IQN format.
90 a pointer to an \fBnvlist_t\fR containing the target properties to be set
99 an optional pointer to an \fBnvlist_t\fR that will be used to store specific
100 errors (if any) when validating target properties
109 a boolean value indicating if the target should be set to offline before
110 removing it from the configuration. If not specified, the operation will fail
111 if the target is determined to be online
120 a pointer to a target portal group tag structure
126 \fB\fItpgt_name\fR\fR
129 the name of the target portal group to be associated with this target portal
139 a 16-bit numerical identifier for this target portal group tag. Valid values
140 are 2 through 65535. If tpgt_tag is '0', \fBit_tpgt_create()\fR will assign an
141 appropriate tag number. If \fItpgt_tag\fR is != 0, and the requested tag number
142 is unavailable, another value will be chosen.
148 The \fBit_tgt_create()\fR function allocates and creates an \fBit_tgt_t\fR
149 structure representing a new iSCSI target node. If \fItgt_name\fR is
150 \fINULL\fR, then a unique target node name will be generated automatically.
151 Otherwise, the value of \fItgt_name\fR will be used as the target node name.
152 The new \fBit_tgt_t\fR structure is added to the target list
153 (\fIcfg_tgt_list\fR) in the configuration structure.
156 The \fBit_tgt_setprop()\fR function validates the provided property list and
157 sets the properties for the specified target. If \fIerrlist\fR is not
158 \fINULL\fR, this function returns detailed errors for each property that
159 failed. The format for \fIerrlist\fR is \fIkey\fR = \fIproperty\fR,
160 \fIvalue\fR = \fIerror\fR string.
163 The \fBit_tgt_delete()\fR function removes the target represented by \fItgt\fR
164 from the configuration. The \fItgt\fR argument is an existing \fBit_tgt_t\fR
165 structure within the configuration \fIcfg\fR.
168 The \fBit_tpgt_create()\fR function allocates and creates an \fBit_tpgt_t\fR
169 structure representing a new iSCSI target portal group tag. The new
170 \fBit_tpgt_t\fR structure is added to the target \fItpgt\fR list
171 (\fItgt_tpgt_list\fR) in the \fBit_tgt_t\fR structure.
174 The \fBit_tpgt_delete()\fR function removes the target portal group tag
175 represented by \fItpgt\fR, from the configuration. The \fItpgt\fR argument is
176 an existing \fBis_tpgt_t\fR structure within the target \fItgt\fR.
179 The \fBit_tgt_free()\fR function frees an \fBit_tgt_t\fR structure. If
180 \fItgt\fR\(->\fInext\fR is not \fINULL\fR, this function frees all structures
184 The \fBit_tpgt_free()\fR function deallocates resources of an \fBit_tpgt_t\fR
185 structure. If \fItpgt\fR->\fInext\fR is not \fINULL\fR, this function frees
186 all members of the list.
189 Configuration changes as a result of these functions are not instantiated until
190 the modified configuration is committed by calling
191 \fBit_config_commit\fR(3ISCSIT).
194 Target nvlist properties are as follows:
201 \fBnvlist\fR Key Type Valid Values
203 \fBtargetchapuser\fR \fBstring\fR any string, or \fBnone\fR to remove
204 \fBtargetchapsecret\fR \fBstring\fR T{
205 string of at least 12 characters but not more than 255 characters. secret will be base64 encoded when stored.
207 \fBalias\fR \fBstring\fR any string or \fBnone\fR to remove
208 \fBauth\fR \fBstring\fR \fBradius\fR, \fBchap\fR, or \fBnone\fR
214 The \fBit_tgt_create()\fR, \fBit_tgt_setprop()\fR, \fBit_tgt_delete()\fR,
215 \fBit_tpgt_create()\fR, and \fBit_tpgt_delete()\fR functions return 0 on
216 success and an error value on failure.
220 The \fBit_tgt_create()\fR, \fBit_tgt_setprop()\fR, \fBit_tgt_delete()\fR,
221 \fBit_tpgt_create()\fR, and \fBit_tpgt_delete()\fR functions will fail if:
228 All tag numbers are already in use.
237 The target is online.
246 The requested target node name is already configured.
255 A parameter or property is invalid.
264 Resources could not be allocated.
270 See \fBattributes\fR(5) for descriptions of the following attributes:
278 ATTRIBUTE TYPE ATTRIBUTE VALUE
280 Interface Stability Committed
288 \fBit_config_commit\fR(3ISCSIT), \fBit_ini_create\fR(3ISCSIT),
289 \fBit_portal_create\fR(3ISCSIT), \fBit_tpg_create\fR(3ISCSIT),
290 \fBlibiscsit\fR(3LIB), \fBlibnvpair\fR(3LIB), \fBlibstmf\fR(3LIB),