iSCSI Management Library Functions ittgtcreate(3ISCSIT)
NAME
ittgtcreate, ittgtsetprop, ittgtdelete,
ittpgtcreate, ittpgtdelete, ittgtfree, ittpgtfree -
create, modify and delete iSCSI Targets
SYNOPSIS
cc [ flag... ] file... -liscsit [ library... ]
#include
int ittgtcreate(itconfigt **cfg, ittgtt **tgt,
char *tgtname);
int ittgtsetprop(itconfigt *cfg ittgtt *tgt,
nvlistt *proplist, nvlistt **errlist);
int ittgtdelete(itconfigt *cfg, ittgtt *tgt,
booleant force);
int ittpgtcreate(itconfigt *cfg, ittgtt *tgt,
ittpgtt **tpgt, char *tpgname, uint16t tpgttag);
void ittpgtdelete(itconfigt *cfg, ittgtt *tgt,
ittpgtt *tpgt);
void ittgtfree(ittgtt *tgt);
void ittpgtfree(ittpgtt *tpgt);
PARAMETERS
cfg a pointer to the iSCSI configuration structure
tgt a pointer to an iSCSI target structure
tgtname the target node name for the target to be
created. The name must be in either IQN or EUI
format. If this value is NUL, a node name will
be generated automatically in IQN format.
proplist a pointer to an nvlistt containing the target
properties to be set
SunOS 5.11 Last change: 1 Oct 2008 1
iSCSI Management Library Functions ittgtcreate(3ISCSIT)
errlist an optional pointer to an nvlistt that will be
used to store specific errors (if any) when
validating target properties
force a boolean value indicating if the target should
be set to offline before removing it from the
configuration. If not specified, the operation
will fail if the target is determined to be
online
tpgt a pointer to a target portal group tag struc-
ture
tpgtname the name of the target portal group to be asso-
ciated with this target portal group tag
tpgttag a 16-bit numerical identifier for this target
portal group tag. Valid values are 2 through
65535. If tpgttag is '0', ittpgtcreate()
will assign an appropriate tag number. If
tpgttag is != 0, and the requested tag number
is unavailable, another value will be chosen.
DESCRIPTION
The ittgtcreate() function allocates and creates an
ittgtt structure representing a new iSCSI target node. If
tgtname is NUL, then a unique target node name will be
generated automatically. Otherwise, the value of tgtname
will be used as the target node name. The new ittgtt
structure is added to the target list (cfgtgtlist) in the
configuration structure.
The ittgtsetprop() function validates the provided pro-
perty list and sets the properties for the specified target.
If errlist is not NUL, this function returns detailed
errors for each property that failed. The format for
errlist is key = property, value = error string.
The ittgtdelete() function removes the target represented
by tgt from the configuration. The tgt argument is an exist-
ing ittgtt structure within the configuration cfg.
The ittpgtcreate() function allocates and creates an
ittpgtt structure representing a new iSCSI target portal
SunOS 5.11 Last change: 1 Oct 2008 2
iSCSI Management Library Functions ittgtcreate(3ISCSIT)
group tag. The new ittpgtt structure is added to the tar-
get tpgt list (tgttpgtlist) in the ittgtt structure.
The ittpgtdelete() function removes the target portal
group tag represented by tpgt, from the configuration. The
tpgt argument is an existing istpgtt structure within the
target tgt.
The ittgtfree() function frees an ittgtt structure. If
tgt->next is not NUL, this function frees all structures in
the list.
The ittpgtfree() function deallocates resources of an
ittpgtt structure. If tpgt->next is not NUL, this func-
tion frees all members of the list.
Configuration changes as a result of these functions are not
instantiated until the modified configuration is committed
by calling itconfigcommit(3ISCSIT).
Target nvlist properties are as follows:
nvlist Key Type Valid Values
targetchapuser string any string, or none to remove
targetchapsecret string string of at least 12 characters
but not more than 255 characters.
secret will be base64 encoded when
stored.
alias string any string or none to remove
auth string radius, chap, or none
RETURN VALUES
The ittgtcreate(), ittgtsetprop(), ittgtdelete(),
ittpgtcreate(), and ittpgtdelete() functions return 0 on
success and an error value on failure.
ERORS
The ittgtcreate(), ittgtsetprop(), ittgtdelete(),
ittpgtcreate(), and ittpgtdelete() functions will fail
if:
E2BIG All tag numbers are already in use.
SunOS 5.11 Last change: 1 Oct 2008 3
iSCSI Management Library Functions ittgtcreate(3ISCSIT)
EBUSY The target is online.
EXIST The requested target node name is already config-
ured.
EINVAL A parameter or property is invalid.
ENOMEM Resources could not be allocated.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Committed
MT-Level MT-Safe
SEE ALSO
itconfigcommit(3ISCSIT), itinicreate(3ISCSIT),
itportalcreate(3ISCSIT), ittpgcreate(3ISCSIT),
libiscsit(3LIB), libnvpair(3LIB), libstmf(3LIB), attri-
butes(5)
SunOS 5.11 Last change: 1 Oct 2008 4
|