All project operations can be scoped to a given pool. Commands that operate across all projects append /projects to the URI, and commands that operate on a single project append /projects/project.
|
The following table shows the list of editable properties within a project resource.
|
This command lists all of the projects in a given pool. The request takes a single URI parameter, which is the storage pool name. Each returned project contains the list of modifiable properties listed above as well as the pool name, creation time, loading state, replication actions, and data usage.
Request parameters: filter – A simple string match filter that requires a property within the project to contain the same filter string within its value.
Example Request:
GET /api/storage/v1/pools/p1/projects HTTP/1.1 Host: zfs-storage.example.com Accept: application/json
On a successful get, an HTTP code 200 (OK) is returned along with an array of project properties in JSON format.
Example Result:
HTTP/1.1 200 OK Content-Type: application/json { "projects": [{ "name": "proj-01", ... }, { "name": "proj-02", ... } }
A list of all projects across all pools is also supported; the URI would contain only the /projects path.
Example Request to get all projects with backup as part of its properties:
GET /projects?filter=backup HTTP/1.1 Host: zfs-storage.example.com Accept: application/json
This command lists the properties for a single project in a given pool. A successful get returns HTTP Code 200 (OK) along with the project properties in JSON format.
Example Request to list the project named proj-01 in the zfs-storage-1 pool:
GET /api/storage/v1/pools/p1/projects/proj-01 HTTP/1.1 Host: zfs-storage.example.com Accept: application/json
Example Response:
HTTP/1.1 200 OK Content-Type: application/json { "project": { "default_volblocksize": 8192.0, "logbias": "latency", "creation": "20130411T20:02:35", "nodestroy": false, "dedup": false, "sharenfs": "on", "sharesmb": "off", "default_permissions": "700", "mountpoint": "/export", "snaplabel": "", "id": "042919bb-0882-d903-0000-000000000000", "readonly": false, "rrsrc_actions": [], "compression": "off", "sharetftp": "", "default_sparse": false, "snapdir": "hidden", "aclmode": "discard", "copies": 1, "aclinherit": "restricted", "shareftp": "", "canonical_name": "zfs-storage-1/local/default", "recordsize": 131072.0, "usage": { "available": 1758424767306.0, "loading": false, "quota": 0.0, "snapshots": 0.0, "compressratio": 100.0, "child_reservation": 0.0, "reservation": 0.0, "total": 45960.0, "data": 45960.0 }, "default_volsize": 0.0, "secondarycache": "all", "collection": "local", "exported": true, "vscan": false, "reservation": 0.0, "atime": true, "pool": "p1", "default_user": "nobody", "name": "default", "checksum": "fletcher4", "default_group": "other", "sharesftp": "", "nbmand": false, "sharedav": "", "rstchown": true } }
The create project command creates a project with a given name residing in the given storage pool. The request takes a single URI parameter, which is the storage pool name. The new project with default properties is returned.
JSON body request parameters:
name – The project name must be supplied to create a project.
Project properties – Any of the project properties can be set as the new project's initial values.
Example request to create a project named proj-01:
POST /api/storage/v1/pools/p1/projects HTTP/1.1 Hosta: zfs-storage.example.com Content-Type: application/json Accept: application/json { "name": "proj-01", "sharenfs": "ro" }
Successful creation returns HTTP status 201 (Created) with the location header containing the URI of the new project. The body contains all of the project properties in JSON format.
Example Results:
HTTP/1.1 201 Created Content-Type: application/json Location: http://zfs-storage.example.com:215 /pools/p1/projects/proj-01 { "project": { "name": "proj-01", "href": "/api/storage/v1/pools/p1/projects/proj-01", "mountpoint": "/export/acme/zfs-storage-1", ... } }
The modify project command changes the attributes of an existing project. The following URI parameters are used:
Storage pool name
Project name
Request parameters: project properties – Any of the project properties can be set as the new project's initial values.
Example request to change a project's name from proj-01 to new-name:
POST /api/storage/v1/pools/p1/projects/proj-01 HTTP/1.1 Host: zfs-storage.example.com Content-Type: application/json Accept: application/json { "name": "new-name", "sharenfs": "rw", "compression": "gzip-9" }
Successful response returns HTTP status 202 (Accepted) and lists all project properties.
Example Response:
HTTP/1.1 201 Created Content-Type: application/json Location: /api/storage/v1/pools/p1/projects/new-name { "project": { "name": "new-name", "sharenfs": "rw", "compression: "gzip-9", ... } }
The delete project command removes a single project in a given pool. The following URI parameters are used:
Storage pool name
Project name
To monitor the amount of space to be reclaimed in the storage pool if deferred update Asynchronous Dataset Deletion (OS8.7.0) has been accepted, 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 /api/storage/v1/pools/p1/projects/proj-01 HTTP/1.1 Host: zfs-storage.example.com Accept: application/json
Get requests project usage resources can be used to get usage data per user or per group for the project.