1it_tgt_create(3ISCSIT)iSCSI Management Library Functionsit_tgt_create(3ISCSIT)
2
3
4

NAME

6       it_tgt_create,     it_tgt_setprop,    it_tgt_delete,    it_tpgt_create,
7       it_tpgt_delete, it_tgt_free, it_tpgt_free - create, modify  and  delete
8       iSCSI Targets
9

SYNOPSIS

11       cc [ flag... ] file... -liscsit [ library... ]
12       #include <libiscsit.h>
13
14       int it_tgt_create(it_config_t **cfg, it_tgt_t **tgt,
15            char *tgt_name);
16
17
18       int it_tgt_setprop(it_config_t *cfg it_tgt_t *tgt,
19            nvlist_t *proplist, nvlist_t **errlist);
20
21
22       int it_tgt_delete(it_config_t *cfg, it_tgt_t *tgt,
23            boolean_t force);
24
25
26       int it_tpgt_create(it_config_t *cfg, it_tgt_t *tgt,
27            it_tpgt_t **tpgt, char *tpg_name, uint16_t tpgt_tag);
28
29
30       void it_tpgt_delete(it_config_t *cfg, it_tgt_t *tgt,
31            it_tpgt_t *tpgt);
32
33
34       void it_tgt_free(it_tgt_t *tgt);
35
36
37       void it_tpgt_free(it_tpgt_t *tpgt);
38
39

PARAMETERS

41       cfg          a pointer to the iSCSI configuration structure
42
43
44       tgt          a pointer to an iSCSI target structure
45
46
47       tgt_name     the  target  node  name  for the target to be created. The
48                    name must be in either IQN or EUI format. If this value is
49                    NULL,  a  node name will be generated automatically in IQN
50                    format.
51
52
53       proplist     a pointer to an nvlist_t containing the target  properties
54                    to be set
55
56
57       errlist      an  optional  pointer  to an nvlist_t that will be used to
58                    store specific errors  (if  any)  when  validating  target
59                    properties
60
61
62       force        a  boolean value indicating if the target should be set to
63                    offline before removing it from the configuration. If  not
64                    specified, the operation will fail if the target is deter‐
65                    mined to be online
66
67
68       tpgt         a pointer to a target portal group tag structure
69
70
71       tpgt_name    the name of the target portal group to be associated  with
72                    this target portal group tag
73
74
75       tpgt_tag     a 16-bit numerical identifier for this target portal group
76                    tag. Valid values are 2 through 65535. If tpgt_tag is '0',
77                    it_tpgt_create() will assign an appropriate tag number. If
78                    tpgt_tag is != 0, and the requested tag number is unavail‐
79                    able, another value will be chosen.
80
81

DESCRIPTION

83       The  it_tgt_create()  function allocates and creates an it_tgt_t struc‐
84       ture representing a new iSCSI target node. If tgt_name is NULL, then  a
85       unique target node name will be generated automatically. Otherwise, the
86       value of tgt_name will be  used  as  the  target  node  name.  The  new
87       it_tgt_t  structure  is  added to the target list (cfg_tgt_list) in the
88       configuration structure.
89
90
91       The it_tgt_setprop() function validates the provided property list  and
92       sets  the properties for the specified target.  If errlist is not NULL,
93       this function returns detailed errors for each  property  that  failed.
94       The format for errlist is key = property, value = error string.
95
96
97       The it_tgt_delete() function removes the target represented by tgt from
98       the configuration. The tgt argument is an existing  it_tgt_t  structure
99       within the configuration cfg.
100
101
102       The it_tpgt_create() function allocates and creates an it_tpgt_t struc‐
103       ture representing  a  new  iSCSI  target  portal  group  tag.  The  new
104       it_tpgt_t structure is added to the target tpgt list (tgt_tpgt_list) in
105       the it_tgt_t structure.
106
107
108       The it_tpgt_delete() function removes the target portal group tag  rep‐
109       resented  by  tpgt,  from  the  configuration.  The tpgt argument is an
110       existing is_tpgt_t structure within the target tgt.
111
112
113       The it_tgt_free() function frees an it_tgt_t structure.  If tgtnext is
114       not NULL, this function frees all structures in the list.
115
116
117       The  it_tpgt_free()  function  deallocates  resources  of  an it_tpgt_t
118       structure.  If tpgt->next is not NULL, this function frees all  members
119       of the list.
120
121
122       Configuration  changes as a result of these functions are not instanti‐
123       ated until the modified configuration is committed by  calling  it_con‐
124       fig_commit(3ISCSIT).
125
126
127       Target nvlist properties are as follows:
128
129
130
131
132
133          nvlist Key        Type                 Valid Values
134       ───────────────────────────────────────────────────────────────────
135       targetchapuser     string      any string, or none to remove
136       targetchapsecret   string      string  of  at  least 12 characters
137                                      but not more than  255  characters.
138                                      secret  will be base64 encoded when
139                                      stored.
140       alias              string      any string or none to remove
141       auth               string      radius, chap, or none
142
143

RETURN VALUES

145       The it_tgt_create(),  it_tgt_setprop(),  it_tgt_delete(),  it_tpgt_cre‐
146       ate(),  and it_tpgt_delete() functions return 0 on success and an error
147       value on failure.
148

ERRORS

150       The it_tgt_create(),  it_tgt_setprop(),  it_tgt_delete(),  it_tpgt_cre‐
151       ate(), and it_tpgt_delete() functions will fail if:
152
153       E2BIG     All tag numbers are already in use.
154
155
156       EBUSY     The target is online.
157
158
159       EEXIST    The requested target node name is already configured.
160
161
162       EINVAL    A parameter or property is invalid.
163
164
165       ENOMEM    Resources could not be allocated.
166
167

ATTRIBUTES

169       See attributes(5) for descriptions of the following attributes:
170
171
172
173
174       ┌─────────────────────────────┬─────────────────────────────┐
175       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
176       ├─────────────────────────────┼─────────────────────────────┤
177       │Interface Stability          │Committed                    │
178       ├─────────────────────────────┼─────────────────────────────┤
179       │MT-Level                     │MT-Safe                      │
180       └─────────────────────────────┴─────────────────────────────┘
181

SEE ALSO

183       it_config_commit(3ISCSIT),    it_ini_create(3ISCSIT),    it_portal_cre‐
184       ate(3ISCSIT), it_tpg_create(3ISCSIT), libiscsit(3LIB), libnvpair(3LIB),
185       libstmf(3LIB), attributes(5)
186
187
188
189SunOS 5.11                        1 Oct 2008            it_tgt_create(3ISCSIT)
Impressum