Go to main content
Oracle® ZFS Storage Appliance RESTful API Guide, Release OS8.7.0

Exit Print View

Updated: July 2017
 
 

Project Operations

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}".

Table 63  Project Commands
Request
Path /api/storage/v1
Description
GET
/projects
List all projects
GET
/pools/<pool>/projects
List projects
GET
/pools/<pool>/projects?snaps=true
List all projects, including snapshots
GET
/pools/<pool>/projects /<project>
Get project details
POST
/pools/<pool>/projects
Create a project
PUT
/pools/<pool>/projects /<project>
Modify a project
DELETE
/pools/<pool>/projects /<project>
Destroy a project
GET
/pools/<pool>/projects /<project>/usage/groups
Get project group usage
GET
/pools/<pool>/projects /<project>/usage/groups/<group>
Get project usage for the specified group
GET
/pools/<pool>/projects /<project>/usage/users
Get project user usage
GET
/pools/<pool>/projects /<project>/usage/users/<user>
Get project usage for the specified user

The following table shows the list of editable properties within a project resource.

Table 64  Project Properties
Type
Name
Description
string
aclinherit
ACL inheritance behavior ("discard", "noallow", "restricted", "passthrough", "passthrough-x", "passthrough-mode-preserve")
string
aclmode
ACL behavior on mode change ("discard", "mask", "passthrough")
boolean
atime
Update access time on read flag
string
canonical_name
Canonical name
string
checksum
Block checksum ("fletcher2", "fletcher4", "sha256")
string
compression
Data compression setting ("off", "lzjb", "gzip-2", "gzip", "gzip-9")
number
copies
Number of additional replication copies
datetime
creation
Date and time of project (or LUN, filesystem) creation
boolean
dedup
Data deduplication flag
string
default_group
Project default filesystem group: "other"
string
default_permissions
Project default filesystem permissions "700"
boolean
default_sparse
Project default LUN sparse data flag
string
default_user
Project default filesystem user: "nobody"
number
default_volblocksize
Project default LUN blocksize: 8192
number
default_volsize
Project default LUN Size
boolean
exported
Exported flag
string
logbias
Synchronous write bias ("latency", "throughput")
string
mountpoint
Share mountpoint default "/export/proj-01"
string
name
Project Name
boolean
nbmand
Non-blocking mandatory locking flag
boolean
nodestroy
Prevent destruction flag
number
quota
Project Quota Size in bytes
string
origin
Clone origin
string
pool
Pool names
boolean
readonly
Data is read only if set to true
string
recordsize
Database record size "128k"
number
reservation
Data Reservation Size
boolean
rstchown
Restrict Ownership change flag
string
secondarycache
Secondary Cache Usage ("all", "metadata", "none")
string
sharedav
HTTP share ("off", "rw", "ro")
string
shareftp
FTP share ("off", "rw", "ro")
string
sharenfs
NFS share ("off", "on", "ro", "rw")
string
sharesftp
SFTP share ("off", "rw", "ro")
string
sharesmb
SMB/CIFS share ("off", "rw", "ro")
string
sharetftp
TFTP share ("off", "rw", "ro")
string
snapdir
.zfs/snaphsot visibility ("hidden", "visible")
string
snaplabel
Scheduled Snapshot Label
boolean
vscan
Virus Scan flag

List Projects

This command lists all of the projects in a given pool. 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.


Note -  The depth query parameter and the match_Property-Name=Value query parameter are not supported.

Query Parameters filter– A simple string match filter that requires a property within the project to contain the same filter string within its value.

Table 65  URI Parameters
Parameter
Description
pool
Storage pool name

Example Request:

GET /api/storage/v1/pools/gold/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 its Properties:

GET /projects?filter=backup HTTP/1.1
Host: zfs-storage.example.com
Accept: application/json

Get Project Properties

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.

Table 66  Get Project URI Parameters
Parameter
Description
pool
Storage pool name
project
The project name

Example Request to List Project Named "proj-01" in the "gold" Pool:

GET /api/storage/v1/pools/gold/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": "gold/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": "gold",
        "default_user": "nobody",
        "name": "default",
        "checksum": "fletcher4",
        "default_group": "other",
        "sharesftp": "",
        "nbmand": false,
        "sharedav": "",
        "rstchown": true
    }
}

Create Project

The create project command creates a project with a given name residing in the given storage pool. The new project with default properties is returned.

Table 67  URI Parameters
Parameter
Description
pool
Storage pool name

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/gold/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/gold/projects/proj-01

{
    “project”: {
        “name”: “proj-01”,
        "href": "/api/storage/v1/pools/gold/projects/proj-01",
        “mountpoint”: “/export/acme/gold”,
        ...
    }
}

Modify Project

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

Table 68  URI Parameters
Parameter
Description
pool
Storage pool name
project
The 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/gold/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/gold/projects/new-name

{
    “project”: {
        “name”: “new-name”,
        “sharenfs”: “rw”,
        “compression: “gzip-9”,
         ...
    }
}

Delete Project

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

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

Example Request:

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

Project Usage

Get requests project usage resources can be used to get usage data per user or per group for the project.