Go to main content

Oracle® ZFS Storage Appliance RESTful API Guide, Release OS8.7.x

Exit Print View

Updated: December 2017
 
 

LUN Operations

All LUN or volume operations are scoped to a given pool or project. The following LUN commands are available.

Table 77  Volume Commands
Request
Path /api/storage/v1
Description
GET
/luns
List all LUNS
GET
/pools/<pool>/projects /<project>/luns
List LUNS
GET
/pools/<pool>/projects /<project>/luns?snaps=true
List all LUNs, including snapshots
GET
/pools/<pool>/projects /<project>/luns/<lun>
Get LUN details
POST
/pools/<pool>/projects /<project>/luns
Create a LUN
PUT
/pools/<pool>/projects /<project>/luns/<lun>
Modify a LUN
DELETE
/pools/<pool>/projects /<project>/luns/<lun>
Destroy a LUN

The following table lists the LUN properties. Volumes can also inherit or override project properties.

Table 78  Volume Properties
Type
Name
Description
number / list of numbers
assignednumber
The assigned LU number. If presented to multiple initiator groups, the type is a list of numbers
If presented to multiple initiator groups, the ordering of assignednumber and initiatorgroups are aligned. For example, the first item in the assignednumber list pertains to the first item in the initiatorgroups list.
boolean
fixednumber
Flag to fix LU number at current value
list of strings
initiatorgroup
The initiator group
If the LUN is presented to multiple initiator groups, the ordering of assignednumber and initiatorgroups are aligned. For example, the first item in the assignednumber list pertains to the first item in the initiatorgroups list.
string
lunguid
STMF GUID
number / string
lunumber
The LU number. Either a number or “auto”
string
project
The project name (immutable)
object
source
Lists source of properties ("local", "inherited")
boolean
sparse
Flag to enable thin provisioning
string
status
Logical unit status ("online", "offline")
string
targetgroup
The target group
object
usage
Lists LUN usage statistics
number
volblocksize
Volume block size
number
volsize
Volume size
boolean
writecache
Flag to enable write cache

Some properties can be inherited from the project. The source object lists each of these properties and identifies whether the property is "local" to the LUN or is "inherited" from the project. By default these properties are inherited by the project. Once set then they are local to the LUN. The source object is immutable. To change the source back to inherited, the properties can be "unset".

Example JSON Request to Unset Compression:

{"unset": ["compression"]}

List LUNS

The list luns command returns a list of LUNS available in a given pool or project.


Note -  The depth query parameter and the match_Property-Name=Value query parameter are not supported.
Table 79  URI Parameters
Parameter
Description
pool
Storage pool name
project
The project name

Example Request (to list LUNS within Project "proj-01"):

GET /api/storage/v1/pools/gold/projects/proj-01/luns HTTP/1.1
Host: zfs-storage.example.com
Accept: application/json

Successful get returns HTTP Status 200 (OK) along with the LUN properties in JSON format.

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "luns": [{
        "id": "fa4ac6fb-0bcc-d2e3-0000-000000000000",
        “name”: “vol-01”
        ...
    }, {
         "id": "690ae407-7c4d-b5d2-0000-000000000000",
         “name”: “vol-01”,
         ....
    }]
}

Get LUN

The get LUN command returns a single LUN's properties in a given pool or project.

Table 80  URI Parameters
Parameter
Description
pool
Storage pool name
project
The project name
lun
The lun name

Example Request (to get a LUN named "vol-01"):

GET /api/storage/v1/pools/gold/projects/proj-01/lun/vol-01 HTTP/1.1
Host: zfs-storage.example.com
Accept: application/json

Successful get returns HTTP Status 200 (OK) along with the LUN properties in JSON format.

Example Response:

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

{
    “lun”: {
        "logbias": "latency",
        "creation": "20130423T21:31:17",
        "nodestroy": false,
        "dedup": false,
        "rrsrc_actions": [],
        "id": "e3045406-319b-cf7a-0000-000000000000",
        "writecache": false,
        "compression": "off",
        "copies": 1,
        "stmfguid": "600144F0D8E0AE4100005176FDA60001",
        "source": {
            "compression": "default",
            "checksum": "inherited",
            "logbias": "default",
            "dedup": "default",
            "copies": "default",
            "exported": "inherited",
            "rrsrc_actions": "inherited",
            "secondarycache": "default"
        },
        "canonical_name": "platinum/local/default/disk1",
        "snaplabel": "",
        "usage": {
            "available": 881469214720.0,
            "loading": false,
            "snapshots": 0.0,
            "compressratio": 100.0,
            "total": 1073758208.0,
            "data": 1073758208.0
        },
        "secondarycache": "all",
        "collection": "local",
        "exported": true,
        "volsize": 1073741824.0,
        "pool": "platinum",
        "volblocksize": 8192,
        "checksum": "fletcher4",
        "project": "default",
        "sparse": false
    }
}

Create a New LUN

This command creates a new LUN. You must supply a size or a cloning source for the new LUN.

Table 81  URI Parameters
Parameter
Description
pool
Storage pool name
project
The project name

Request Parameters:

  • name - The LUN name must be supplied to create a new LUN.

  • volume properties – Any of the properties listed in LUN properties or project properties can be set as initial values.

Example Request:

POST /api/storage/v1/pools/gold/projects/proj-01/luns HTTP/1.1
Host: zfs-storage.example.com
Accept: application/json

Request JSON:
{
        name : "vol-001",           // Volume name (required)

        size : 500000,              // New Volume size
        blocksize : 8192,           // New Volume block size
        sparse : true,              // New Volume sparse data flag

        initiatorgroup : 'default', // Initiator group name
        targetgroup : 'default',    // Target group name
        lunnumber : 'auto',         // Volume LUN number
        status : 'online',          // Initial Status ('online', 'offline')
        fixednumber : false,

        "source": {
            "snapshot_id" : "76b8950a-8594-4e5b-8dce-0dfa9c696358",
            "snapshot": "/pool-001/local/proj-001/snap-001"
        }
}

Successful creation returns HTTP Status 201 (Created) with the Location header containing the URI of the new LUN. The body contains all of the LUN properties in JSON format.

Example Results:

HTTP/1.1 201 Created
Content-Type: application/json
Location: http://zfs-storage.example.com:215
          /pools/gold/projects/proj-01/luns/vol-001

{
    “lun”: {
        "name": "vol-001",
        ...
    }
}

Modify LUN

The modify LUN command changes the attributes of an existing LUN.

Table 82  URI Parameters
Parameter
Description
pool
Storage pool name
project
The project name
lun
The LUN name

Request Parameters - Volume Properties – Any of the LUN or project properties can be modified.

Example Request (to change a LUN name from "vol-01" to "new-name"):

POST /api/storage/v1/pools/gold/projects/proj-01/luns/vol-01 HTTP/1.1
Host: zfs-storage.example.com
Content-Type: application/json
Accept: application/json

{
    “name”: “new-name”,
}

Successful response returns HTTP Status 202 (Accepted) and lists all LUN properties.

Example Response:

HTTP/1.1 201 Created
Content-Type: application/json
Location: /api/storage/v1/pools/gold/projects/proj-01/luns/new-name

{
    “lun”: {
        “name”: “new-name”,
        “pool”: “gold”,
        “collection”: “local”,
        “project”: “proj-01”,
        ...
    }
}

Delete Lun

The delete LUN command removes a single LUN in a given pool or project.

Table 83  URI Parameters
Parameter
Description
pool
Storage pool name
project
The project name
lun
The LUN name

To monitor the amount of space to be reclaimed in the storage pool, enter the GET command for pools/<pool>. Note the amount of space for property async_destroy_reclaim_space. When the operation has completed, 0 (zero) is displayed.

Example Request:

DELETE /pools/gold/projects/proj-01/luns/lun-01 HTTP/1.1
Host: zfs-storage.example.com
Accept: application/json

Successful get returns HTTP Status 204 (No Content).

Example Response:

HTTP/1.1 204 No-Content