targetd exposes a remote API for configuring a Linux host to perform a block-based storage array role and a file system storage role. API calls use the jsonrpc-2.0 format over HTTP, on TCP port 18700. The API optionally uses TLS for connection encryption, but does authentication via HTTP Basic auth for both encrypted and non-encrypted connections.
Raw storage space on the host is a
pool. From a pool, a volume
vol is allocated. A volume is shared with remote hosts via an
For file system related operations, the pool refers to a btrfs mount point. Each newly created file system is a subvolume on that mount point.
- All sizes are in bytes, and are passed as numbers.
- All names must only contain characters in '[a-z][A-Z][0-9]_-'
- Uuid fields are represented as strings.
- If an error occurs, it will be indicated by returning a jsonrpc error object with a negative error code. Non-negative error codes (including 0) are not defined.
Pools are configured on the host, and are not remotely configurable via this API.
Returns an array of pool objects. Each pool object contains
type fields, and may also contain a 'uuid'
field. The domain of the type field is [block|fs].
Returns an array of volume objects in
pool. Each volume object
Volume names may be reused, such as when a volume is created and then removed. Another volume could then be created with the same name, but the new volume's UUID would be a different, unique value.
Creates a volume named
name with size
size in the pool
name volume from pool
pool. This destroys the backing
data, and the data in the volume is lost even if another volume with
the same name is created.
Creates a new volume named
pool the same size as
pool, and copies the contents from
vol_new will have differing UUIDs.
Exports make a volume accessible to a remote iSCSI initiator.
Returns an array of export objects. Each export object contains
initiator_wwn is the iSCSI name (iqn.*) of the initiator
with access to the export.
lun is the SCSI logical unit number the
initiator will see for this export.
vol_name is the name of the
vol_size return the unique identifier
and size of the volume. The
pool attribute is the name of the pool
containing the backing volume.
Creates an export of volume
vol in pool
pool to the given
initiator, and maps it to logical unit number
Removes an export of
Sets the inbound and outbound login credentials for the given initiator. 'in_user' and 'in_pass' are credentials that the initiator will use to login to the target and access luns exported by 'export_create'. 'out_user' and 'out_pass' are the credentials the target will use to authenticate itself back to the initiator.
'initiator_wwn' must be set, but 'in_user', 'in_pass', 'out_user' and 'out_pass' may be 'null'. If either or both of each directions' parameters are 'null', then authentication is disabled for that direction.
Calling this method is not required for exports to work. If it is not called, exports require no authentication.
Ability to create different file systems and perform operation on them. The pool is a btrfs sub volume and new file systems are sub volumes within that sub volume.
Returns an array of file system objects. Each file system object contains:
pool they were created from.
Destroys the sub volume identified by file system
uuid and any snapshots
created from it.
Create a new sub volume within the specified
pool_name with the new
size_bytes is currently ignored, but will eventually be used
to set the quota for the sub volume.
Create a read/write-able copy of the file system with uuid
fs_uuid to the new
snapshot_id is specified the new file system
contents will be created from the snapshot copy.
Returns an array of read only snapshot objects for the file system specified in
fs_uuid. The returned objects contain:
stamp is when the snapshot was taken and it is represented as seconds from epoch.
Creates a read only copy of the file system specified by
fs_uuid. The new
file system has the name represented by
Deletes the read only snapshot specified by
Returns an array of supported NFS client authentication mechanisms.
Returns an array of export objects. Each export object contains:
Adds a NFS export given a
host, and an export
path to export and a list of
Options is a list of NFS export options. Each option can be either a single value
eg. no_root_squash or can be a
man 5 exports for all available
supported options and the formats supported for
Removes a NFS export given a
host and an export
Obsolete, no longer defined.