All LUN or volume operations are scoped to a given pool or project. The following LUN commands are available.
|
The following table lists the LUN properties. Volumes can also inherit or override project properties.
|
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"]}
The list luns command returns a list of LUNS available in a given pool or project.
|
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”, .... }] }
The get LUN command returns a single LUN's properties in a given pool or project.
|
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 } }
This command creates a new LUN. You must supply a size or a cloning source for the new LUN.
|
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", ... } }
The modify LUN command changes the attributes of an existing LUN.
|
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”, ... } }
The delete LUN command removes a single LUN in a given pool or project.
|
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