Target Groups

Target groups are collections of targets. The target groups commands are listed in the following table.

The target groups commands take the following URI parameters:

protocol

NAS protocol for the initiator: fc, iscsi, or srp

target-group

Name of the target group

Table 11-8 Target Groups Commands

Request Append to Path /san/v{1|2} Description

GET

/protocol/target-groups

List all SAN target group for the given protocol: fc, iscsi, or srp objects

GET

/protocol/target-groups/target-group

Get the specified SAN target group for the given protocol: fc, iscsi, or srp properties

POST

/protocol/target-groups

Create a new SAN target group for the given protocol: fc, iscsi, or srp

PUT

/protocol/target-groups/target-group

Modify the specified SAN target group for the given protocol: fc, iscsi, or srp object

DELETE

/protocol/target-groups/target-group

Destroy the specified target-group object

List Target Groups

Lists all of the target groups available for an Oracle ZFS Storage Appliance system. On success, HTTP status 200 (OK) is returned and the body contains a JSON object with a property named groups that contains an array of target group objects.

Example Request:

GET /api/san/v1/iscsi/target-groups
Host: zfs-storage.example.com:215
Authorization: Basic Tm8gcGVla2luZyE=
Accept: application/json

Example Result:

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

{
    "groups": [{
        "href": "/api/san/v1/iscsi/target-groups/test-group",
        "name": "test-group",
        "targets": [
            "iqn.zfs-storage.example.com.sun:02:31d26d2e-6aa0-6054-fe58-8b1fb508b008"
        ]
    }, {
        "href": "/api/san/v1/iscsi/target-groups/alt-group",
        ...
    }]
}

Get Target Group

Gets a single target group. The request takes a single URI parameter, which is the target group name. The response body contains a JSON object property named group that contains the target group properties.

Example Request:

GET /api/san/v1/iscsi/target-groups/test-group
Host: zfs-storage.example.com:215
Authorization: Basic Tm8gcGVla2luZyE=
Accept: application/json

Example Result:

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

{
    "group": {
        "href": "/api/san/v1/iscsi/target-groups/test-group",
        "name": "test-group",
        "targets": [
            "iqn.zfs-storage.example.com.sun:02:0d5a0ed8-44b6-49f8-a594-872bf787ca5a"]
    }
}

Create a Target Group

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

Example Request:

POST /api/san/v1/iscsi/target-groups HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic Tm8gcGVla2luZyE=
Accept: application/json
Content-Type: application/json
Content-Length: 97

{"name":"test-group",
 "targets": ["iqn.zfs-storage.example.com.sun:02:31d26d2e-6aa0-6054-fe58-8b1fb508b008"]}

Example Result:

HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 154
X-Zfssa-San-Api: 1.0
Location: /api/san/v1/iscsi/target-groups/test-group

{
    "group": {
        "href": "/api/san/v1/iscsi/target-groups/test-group",
        "name": "test-group",
        "targets": [
            "iqn.zfs-storage.example.com.sun:02:31d26d2e-6aa0-6054-fe58-8b1fb508b008"]
    }
}

Delete a Target Group

Deletes an existing target group.

Example Request:

DELETE /api/san/v1.0/iscsi/target-groups/test-group

Successful delete returns HTTP status 204 (No Content):

HTTP/1.1 204 No-Content