Go to main content
Oracle® ZFS Storage Appliance RESTful API Guide, Release OS8.7.0

Exit Print View

Updated: July 2017
 
 

Targets

The iSCSI target commands are used to manage iSCSI targets and iSCSI target groups. The available commands are listed below.

Table 53  Target Commands
Request
Path /san/v1.0
Description
GET
/<protocol>/targets
List all SAN target for the given protocol (FC, iSCSI, SRP) objects
GET
/<protocol>/targets/<target>
Get the specified SAN target for the given protocol (FC, iSCSI, SRP) properties
POST
/<protocol>/targets
Create a new SAN target for the given protocol (FC, iSCSI, SRP)
PUT
/<protocol>/targets/<target>
Modify the specified SAN target for the given protocol (FC, iSCSI, SRP) object
DELETE
/<protocol>/targets/<target>
Destroy the specified target object

The commands take the following URI parameters:

Table 54  URI Parameters
Type
Name
Description
string
protocol
The SAN protocol (FC, iSCSI, SRP)
string
target
The target ID (IQN, WWN, EUI)

All the "get" target commands return target properties, and the "create" and modify "target" commands use the following properties as input.

Table 55  Target Properties
Name
Protocol
Description
alias
iscsi
Simple human readable name
iqn
iscsi
The iSCSI qualified name
state
iscsi
State of the iSCSI target ("online", "offline")
auth
iscsi
Optional authentication type ("none", "chap")
targetchapuser
iscsi
Optional CHAP user authentication
targetchapsecret
iscsi
Optional CHAP secret authentication
interfaces
iscsi
List of network interfaces that target is available
wwn
fc
Worldwide name for this target
port
fc
Physical location of the port
mode
fc
Mode of this port (initiator or target)
speed
fc
Negotiated speed of this port
discovered_ports
fc
Number of discovered remote initiator ports
alias
srp
Alias for the SRP target
eui
srp
Extended unique identifier for this target

The following properties are used for getting iSCSI target group information.

Table 56  Target Group Properties
Type
Name
Description
string
protocol
The target group protocol (FC, iSCSI, SRP)
string
name
The iSCSI target group name
array
targets
A list of iSCSI target IQN group members

List Targets

Lists all of the SAN targets of the specified protocol available on the appliance.

Example Request:

GET /api/san/v1/iscsi/targets HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic abcd123MWE=
Accept: application/json

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1337

{
    "size": 7,
     "targets": [{
        "alias": "tst.volumes.py.12866.target",
        "href": "/api/san/v1/iscsi/targets/iqn.1986-03.com.sun:02:
            72b6fa9a-96c4-e511-db19-aadb9bac2052",
        "iqn": "iqn.1986-03.com.sun:02:72b6fa9a-96c4-
            e511-db19-aadb9bac2052",
        ...
    }, {
        "alias": "tst.volumes.py.96238.target",
         "href": "/api/san/v1/iscsi/targets/iqn.1986-03.com.sun:02:
            31d26d2e-6aa0-6054-fe58-8b1fb508b008",
        "iqn": "iqn.1986-03.com.sun:31d26d2e-6aa0-6054-fe58-8b1fb508b008",
        ...
    }
    ...]
}

Get Target Details

Gets properties from a single target. The target can be selected by using the "iqn" property or by using "alias=<alias>".

Example Request:

GET /api/san/v1/iscsi/targets/alias=test-target HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic abcd123MWE=
Accept: application/json

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 251

{
    "target": {
        "alias": "test-target",
        "auth": "none",
        "href": "/api/san/v1/iscsi/targets/alias=test-target",
        "interfaces": ["ixgbe0"],
        "iqn": "iqn.1986-03.com.sun:02:31d26d2e-6aa0-6054-fe58-8b1fb508b008",
        "targetchapsecret": "",
        "targetchapuser": ""
    }
}

Create a Target

Creates a new target. The request body has a JSON object with a single name property that is the name of the new iSCSI target group.

Example Request:

POST /api/san/v1/iscsi/targets HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic abcd123MWE=
Content-Type: application/json
Content-Length: 23
Accept: application/json

{"alias": "test-target"}

Example Response:

HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 233
X-Zfssa-San-Api: 1.0
Location: /api/san/v1/iscsi/targets/iqn.1986-03.com.sun:02:31d26d2e-6aa0-6054-fe58-8b1fb508b008

{
    "target": {
        "href": "/api/san/v1/iscsi/targets/iqn.1986-03.com.sun:02:31d26d2e-6aa0-6054-fe58-8b1fb508b008",
        "alias": "test-target",
        "iqn": "iqn.1986-03.com.sun:02:31d26d2e-6aa0-6054-fe58-8b1fb508b008",
        "auth": "none",
        "targetchapuser": "",
        "targetchapsecret": "",
        "interfaces": ["ixgbe0"]
    }
}

Modify a Target

Modifies an existing iSCSI target. The request body contains a JSON object that contains the iSCSI target properties that are modified. HTTP Status 202 (Accepted) is returned on success. The response body contains the resulting iSCSI target properties for the target encoded in a JSON object.

Example Request:

PUT /api/san/v1/iscsi/targets/alias=test-target HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic abcd123MWE=
Host: zfs-storage.example.com
Content-Type: application/json
Content-Length: 54
Accept: application/json

{"targetchapsecret":"letmeinnowplease", "auth":"chap",
 "targetchapuser":"argus"}

Example Response:

HTTP/1.1 202 Accepted
Content-Type: application/json
Content-Length: 189
X-Zfssa-San-Api: 1.0

{
    "target": {
        "href": "/api/san/v1/iscsi/targets/alias=test-target",
        "auth": "chap",
        "targetchapsecret": "letmeinnowplease",
        "alias": "test-arget",
        "iqn": "iqn.1986-03.com.sun:02:31d26d2e-6aa0-6054-fe58-8b1fb508b008",
        "targetchapuser": "argus",
        "interfaces": ["ixgbe0"]
    }
}

Delete a Target

Removes a SAN target from the system.

Example Request:

DELETE /api/san/v1/iscsi/targets/iqn.1986-03.com.sun:02:e7e688b1 HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic abcd123MWE=

Successful Delete returns HTTP code 204 (No Content):

HTTP/1.1 204 No-Content