The iSCSI target commands are used to manage iSCSI targets and iSCSI target groups. The available commands are listed below.
|
The commands take the following URI parameters:
|
All the "get" target commands return target properties, and the "create" and modify "target" commands use the following properties as input.
|
The following properties are used for getting iSCSI target group information.
|
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", ... } ...] }
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": "" } }
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"] } }
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"] } }
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