Replication Packages

This section details replication package and source commands.

Table 13-24 Replication Package Commands

Request Append to Path /api/storage/v{1|2}/replication Description

GET

/packages

List all replication packages

GET

/packages/package

Get the specified replication package

PUT

/packages/package

Modify the specified replication package

DELETE

/packages/package

Destroy the specified replication package

PUT

/packages/package/cancelupdate

Run cancelupdate on the specified package

PUT

/packages/package/sever

Run sever on the specified package

PUT

/packages/package/pkgreverse

Run reverse on the specified package

PUT

/packages/package/clone

Clone the specified package

GET

/packages/package/clone/conflicts

List share property conflicts

GET

/packages/package/projects

List package projects

GET

/packages/package/projects/project

Get package project

PUT

/packages/package/projects/project

Modify package project

GET

/packages/package/projects/project/usage/groups

Get package project group usage

GET

/packages/package/projects/project/usage/users

Get package project users usage

GET

/packages/package/projects/project/snapshots

List all snapshot objects

GET

/packages/package/projects/project/snapshots/snapshot

Get the specified snapshot properties

DELETE

/packages/package/projects/project/snapshots/snapshot

Destroy the specified snapshot object

PUT

/packages/package/projects/project/snapshots/snapshot

Rename the package project snapshot

GET

/packages/package/projects/project/automatic

List all package project automatic snapshot objects

GET

/packages/package/projects/project/automatic/automatic

Get the specified package project automatic snapshot properties

GET

/packages/package/projects/project/filesystems

List package filesystems

GET

/packages/package/projects/project/filesystems/filesystem

Get package filesystem

PUT

/packages/package/projects/project/filesystems/filesystem

Modify package filesystem

GET

/packages/package/projects/project/filesystems/filesystem/usage/groups

Get package filesystem group usage

GET

/packages/package/projects/project/filesystems/filesystem/usage/users

Get package filesystem users usage

GET

/packages/package/projects/project/filesystems/filesystem/snapshots/snapshot

Get the specified snapshot properties

GET

/packages/package/projects/project/filesystems/filesystem/snapshots

List all snapshot objects

DELETE

/packages/package/projects/project/filesystems/filesystem/snapshots/snapshot

Destroy the specified snapshot object

PUT

/packages/package/projects/project/filesystems/filesystem/snapshots/snapshot

Rename the package filesystem snapshot

GET

/packages/package/projects/project/filesystems/filesystem/automatic

List all package filesystem automatic snapshot objects

GET

/packages/package/projects/project/filesystems/filesystem/automatic/automatic

Get the specified package filesystem automatic snapshot properties

GET

/packages/package/projects/project/luns

List package LUNs

GET

/packages/package/projects/project/luns/lun

Get package LUN

PUT

/packages/package/projects/project/luns/lun

Modify package LUN

GET

/packages/package/projects/project/luns/lun/usage/groups

Get package LUN group usage

GET

/packages/package/projects/project/luns/lun/usage/users

Get package LUN users usage

GET

/packages/package/projects/project/luns/lun/snapshots/snapshot

Get the specified snapshot properties

GET

/packages/package/projects/project/luns/lun/snapshots

List all snapshot objects

DELETE

/packages/package/projects/project/luns/lun/snapshots/snapshot

Destroy the specified snapshot object

PUT

/packages/package/projects/project/luns/lun/snapshots/snapshot

Rename the package LUN snapshot

GET

/packages/package/projects/project/luns/lun/automatic

List all package LUN automatic snapshot objects

GET

/packages/package/projects/project/luns/lun/automatic/automatic

Get the specified package LUN automatic snapshot properties

Replication sources and their corresponding packages can also be accessed using the following commands.

Table 13-25 Replication Source Commands

Request Append to Path /api/storage/v{1|2}/replication/sources Description

GET

Use only /api/storage/v{1|2}/replication/sources

List replication sources

GET

/source

List replication source details

GET

/source/packages/package

Get the specified replication package

PUT

/source/packages/package

Modify the specified replication package

DELETE

/source/packages/package

Destroy the specified replication package

PUT

/source/packages/package/cancelupdate

Run cancelupdate on the specified package

PUT

/source/packages/package/sever

Run sever on the specified package

PUT

/source/packages/package/pkgreverse

Run reverse on the specified package

PUT

/source/packages/package/clone

Clone the specified package

GET

/source/packages/package/clone/conflicts

List share property conflicts

GET

/source/packages/package/projects

List package projects

GET

/source/packages/package/projects/project

Get package project

PUT

/source/packages/package/projects/project

Modify package project

GET

/source/packages/package/projects/project/usage/groups

Get package project group usage

GET

/source/packages/package/projects/project/usage/users

Get package project users usage

GET

/source/packages/package/projects/project/snapshots/snapshot

Get the specified snapshot properties

GET

/source/packages/package/projects/project/snapshots

List all snapshot objects

DELETE

/source/packages/package/projects/project/snapshots/snapshot

Destroy the specified snapshot object

PUT

/source/packages/package/projects/project/snapshots/snapshot

Rename the package project snapshot

GET

/source/packages/package/projects/project/automatic

List all package project automatic snapshot objects

GET

/source/packages/package/projects/project/automatic/automatic

Get the specified package project automatic snapshot properties

GET

/source/packages/package/projects/project/filesystems

List package filesystems

GET

/source/packages/package/projects/project/filesystems/filesystem

Get package filesystem

PUT

/source/packages/package/projects/project/filesystems/filesystem

Modify package filesystem

GET

/source/packages/package/projects/project/filesystems/filesystem/usage/groups

Get package filesystem group usage

GET

/source/packages/package/projects/project/filesystems/filesystem/usage/users

Get package filesystem users usage

GET

/source/packages/package/projects/project/filesystems/filesystem/snapshots/snapshot

Get the specified snapshot properties

GET

/source/packages/package/projects/project/filesystems/filesystem/snapshots

List all snapshot objects

DELETE

/source/packages/package/projects/project/filesystems/filesystem/snapshots/snapshot

Destroy the specified snapshot object

PUT

/source/packages/package/projects/project/filesystems/filesystem/snapshots/snapshot

Rename the package filesystem snapshot

GET

/source/packages/package/projects/project/filesystems/filesystem/automatic

List all package filesystem automatic snapshot objects

GET

/source/packages/package/projects/project/filesystems/filesystem/automatic/automatic

Get the specified package filesystem automatic snapshot properties

GET

/source/packages/package/projects/project/luns

List package LUNs

GET

/source/packages/package/projects/project/luns/lun

Get package LUN

PUT

/source/packages/package/projects/project/luns/lun

Modify package LUN

GET

/source/packages/package/projects/project/luns/lun/usage/groups

Get package LUN group usage

GET

/source/packages/package/projects/project/luns/lun/usage/users

Get package LUN users usage

GET

/source/packages/package/projects/project/luns/lun/snapshots/snapshot

Get the specified snapshot properties

GET

/source/packages/package/projects/project/luns/lun/snapshots

List all snapshot objects

DELETE

/source/packages/package/projects/project/luns/lun/snapshots/snapshot

Destroy the specified snapshot object

PUT

/source/packages/package/projects/project/luns/lun/snapshots/snapshot

Rename the package LUN snapshot

GET

/source/packages/package/projects/project/luns/lun/automatic

List all package LUN automatic snapshot objects

GET

/source/packages/package/projects/project/luns/lun/automatic/automatic

Get the specified package LUN automatic snapshot properties

List Replication Sources

Lists all available replication sources.

Example Request:

GET /api/storage/v2/replication/sources HTTP/1.1
Host: zfs-storage.example.com:215
Accept: application/json

Example Output:

HTTP/1.1 200 OK
X-Zfssa-Replication-Api: 1.0
Content-Type: application/json
Content-Length: 529

{
    "sources": [{
        "asn": "314d252e-c42b-e844-dab1-a3bca680b563",
        "href": "/api/storage/v2/replication/sources/zfs-repl-host",
        "ip_address": "ipaddr-1",
        "name": "zfs-repl-host",
        "source": "source-000"
    }]
}

List Replication Packages

Lists all of the replication packages.

Example Request:

GET /api/storage/v2/replication/packages HTTP/1.1
Host: zfs-storage.example.com:215
Accept: application/json

Example Result:

HTTP/1.1 200 OK
X-Zfssa-Replication-Api: 1.0
Content-Type: application/json
Content-Length: 529

{
  "packages": [
    {
      "href": "/api/storage/v2/replication/packages/0efaab49-7b22-4d4a-def8-813c27780894",
      "id": "0efaab49-7b22-4d4a-def8-813c27780894",
      "source_name": "sourceA",
      "source_asn": "8a22f6e0-4ee4-4b85-f141-e152f5fac961",
      "source_ip": "ipaddr-1",
      "source_pool": "poolA",
      "target_pool": "poolA",
      "replica_of": "projTest",
      "enabled": true,
      "state": "idle",
      "state_description": "Idle (no update in progress)",
      "offline": false,
      "import_path": "",
      "data_timestamp": "2017-03-09T22:36:12Z",
      "last_sync": "2017-03-09T22:36:22Z",
      "last_try": "2017-03-09T22:36:22Z",
      "last_result": "success"
    }
  ]
}

Modify Package

Modifies the package properties.

Property Type Description

enabled

boolean

Current state of replication updates

Example Request:

PUT /api/storage/v2/replication/packages/8373d331-de60-e590-90e8-9ad69fcb4aec HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic Tm8gcGVla2luZyE=
Content-Type: application/json

{
    "enabled": false
}

Example Result:

HTTP/1.1 202 Accepted
X-Zfssa-Replication-Api: 1.0

Example Request:

PUT /api/storage/v2/replication/packages/8373d331-de60-e590-90e8-9ad69fcb4aec/pkgreverse HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic Tm8gcGVla2luZyE=
Content-Type: application/json

{
    "new_project_name":"restrev", 
    "enable_action_upon_reversal":"true"
}

Example Result:

HTTP/1.1 202 Accepted
X-Zfssa-Replication-Api: 1.0

Delete Package

Destroys a replication package.

Example Request:

DELETE /api/storage/v2/replication/packages/8373d331-de60-e590-90e8-9ad69fcb4aec HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic Tm8gcGVla2luZyE=

Successful delete returns HTTP status 204 (No Content).

Example Result:

HTTP/1.1 204 No-Content
X-Zfssa-Replication-Api: 1.0

Cancel Update

Cancels an ongoing update for this package.

Example Request:

PUT /api/storage/v2/replication/packages/8373d331-de60-e590-90e8-9ad69fcb4aec/cancelupdate HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic Tm8gcGVla2luZyE=

If no update is in progress, HTTP status 409 (Conflict) is returned.

Example Result:

HTTP/1.1 409 Conflict
X-Zfssa-Replication-Api: 1.0
Content-Type: application/json
Content-Length: 137

{
    "cancelupdate": {
        "AKSH_ERROR": "EAK_NAS_REPL_BADSTATE",
        "message": "operation illegal for state"
    }
}

Example Result:

HTTP/1.1 202 Accepted
X-Zfssa-Replication-Api: 1.0

Clone Package

Clones the package project.

Example Request:

PUT /api/v2/storage/replication/packages/8373d331-de60-e590-90e8-9ad69fcb4aec/clone HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic Tm8gcGVla2luZyE=

Example Result:

HTTP/1.1 202 Accepted
X-Zfssa-Replication-Api: 1.0

Successful clone returns HTTP status 202 (Accepted). A helper command can be used to determine whether there are conflicts with the clone operation.

Example Clone Conflicts Request:

GET /api/storage/v2/replication/packages/8373d331-de60-e590-90e8-9ad69fcb4aec/clone/conflicts HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic Tm8gcGVla2luZyE=

Clone/conflicts Returns Conflicts:

HTTP/1.1 200 OK
X-Zfssa-Replication-Api: 1.0
Content-Type: application/json
Content-Length: 58

{
    "conflicts": "There are no conflicts."
}

Properties:

Default settings:
            target_project = (unset)
       original_mountpoint = /export
       override_mountpoint = false
                mountpoint =

Sever Package

Severs a replication connection and moves the package contents into new project. This action permanently severs this package and its replicated shares from the source system, making them local projects on this system. Subsequent replication updates in either direction requires defining new actions and sending a full update.

Example Request:

PUT /api/storage/v2/replication/packages/8373d331-de60-e590-90e8-9ad69fcb4aec/sever HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic Tm8gcGVla2luZyE=

{
    "projname":"restsev"
}

Success Response:

HTTP/1.1 202 Accepted
X-Zfssa-Replication-Api: 1.0

Reverse Package

Reverses the direction of replication. This action disables replication for this package and moves the contents of this package into a new local project configured to replicate back to the source. Any metadata or data changes made on the source since the last successful update are lost when the new project is first replicated back to the source.

Example Request:

PUT /api/storage/v2/replication/packages/8373d331-de60-e590-90e8-9ad69fcb4aec/reverse HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic Tm8gcGVla2luZyE=

{
    "projname":"restrev"
}

Success Response:

HTTP/1.1 202 Accepted
X-Zfssa-Replication-Api: 1.0