Create a clone of the file
- PDF of this doc site
Collection of separate PDF docs
Creating your file...
POST /storage/file/clone
Introduced In: 9.6
Creates a clone of the file.
Required Properties
-
source_path
-
destination_path
-
volume.uuid
andvolume.name
- Instance UUID and name of volume in which to create clone.
Optional Properties
-
range
- Required only in the case of a sub file clone. -
autodelete
- Marks a cloned file for auto deletion. -
backup
- Cloned file is used as a backup.
Related Ontap commands
-
volume file clone create
Creating file clones
The POST operation is used to create file clones with the specified attributes in body. Set the volume.name
and volume.uuid
to identify the volume.
Set source_path
and destination_path
to identify the file path of original and copied file. In case of full file clone, the new file is created using destination_path
.<br>
In case of a sub file clone, set range
in the format source-file-block-number:destination-file-block-number:block-count. The API returns an error for the following overlapping conditions: (a) if source and destination files are same and any of the source ranges overlap with any of the destination ranges. (b) if any of the source ranges overlap amongst themselves. (c) if any of the destination ranges overlap amongst themselves. If not provided, full file cloning is assumed.
If set to autodelete
, the cloned file is deleted when the volumes are full.<br>
# The API: curl -X POST "https://<mgmt_ip>/api/storage/file/clone" -H "accept: application/hal+json" -d '{"volume": {"name": "vol1", "uuid": "40e0fdc5-c28f-11eb-8270-005056bbeb0b"}, "source_path": "f1", "destination_path": "f2_c1"}' # The response: { "job": { "uuid": "0d025fd9-c4dc-11eb-adb5-005056bbeb0b", "_links": { "self": { "href": "/api/cluster/jobs/0d025fd9-c4dc-11eb-adb5-005056bbeb0b" } } } }
Learn More
-
[
DOC /storage/file/clone
]
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
return_timeout |
integer |
query |
False |
The number of seconds to allow the call to execute before returning. When doing a POST, PATCH, or DELETE operation on a single record, the default is 0 seconds. This means that if an asynchronous operation is started, the server immediately returns HTTP code 202 (Accepted) along with a link to the job. If a non-zero value is specified for POST, PATCH, or DELETE operations, ONTAP waits that length of time to see if the job completes so it can return something other than 202.
|
return_records |
boolean |
query |
False |
The default is false. If set to true, the records are returned.
|
Request Body
Name | Type | Description |
---|---|---|
autodelete |
boolean |
Mark clone file for auto deletion. |
destination_path |
string |
Relative path of the clone/destination file in the volume. |
is_backup |
boolean |
Mark clone file for backup. |
overwrite_destination |
boolean |
Destination file gets overwritten. |
range |
array[string] |
List of block ranges for sub-file cloning in the format "source-file-block-number:destination-file-block-number:block-count" |
source_path |
string |
Relative path of the source file in the volume. |
token_uuid |
string |
UUID of existing clone token with reserved split load. |
volume |
Example request
{
"destination_path": "dest_file1, dir1/dest_file2",
"range": 36605,
"source_path": "src_file1, dir1/src_file2, ./.snapshot/snap1/src_file3",
"token_uuid": "string",
"volume": {
"_links": {
"self": {
"href": "/api/resourcelink"
}
},
"name": "volume1",
"uuid": "028baa66-41bd-11e9-81d5-00a0986138f7"
}
}
Response
Status: 202, Accepted
Name | Type | Description |
---|---|---|
job |
Example response
{
"job": {
"_links": {
"self": {
"href": "/api/resourcelink"
}
},
"uuid": "string"
}
}
Headers
Name | Description | Type |
---|---|---|
Location |
Useful for tracking the resource location |
string |
Response
Status: 201, Created
Error
Status: Default
ONTAP Error Response Codes
Error Code | Description |
---|---|
917898 |
Invalid value |
918236 |
The specified |
13565952 |
Clone start failed. |
Also see the table of common errors in the Response body overview section of this documentation.
Name | Type | Description |
---|---|---|
error |
Example error
{
"error": {
"arguments": [
{
"code": "string",
"message": "string"
}
],
"code": "4",
"message": "entry doesn't exist",
"target": "uuid"
}
}
Definitions
See Definitions
href
Name | Type | Description |
---|---|---|
href |
string |
_links
Name | Type | Description |
---|---|---|
self |
volume
Name | Type | Description |
---|---|---|
_links |
||
name |
string |
The name of the volume. This field cannot be specified in a POST or PATCH method. |
uuid |
string |
Unique identifier for the volume. This corresponds to the instance-uuid that is exposed in the CLI and ONTAPI. It does not change due to a volume move.
|
file_clone
File clone
Name | Type | Description |
---|---|---|
autodelete |
boolean |
Mark clone file for auto deletion. |
destination_path |
string |
Relative path of the clone/destination file in the volume. |
is_backup |
boolean |
Mark clone file for backup. |
overwrite_destination |
boolean |
Destination file gets overwritten. |
range |
array[string] |
List of block ranges for sub-file cloning in the format "source-file-block-number:destination-file-block-number:block-count" |
source_path |
string |
Relative path of the source file in the volume. |
token_uuid |
string |
UUID of existing clone token with reserved split load. |
volume |
job_link
Name | Type | Description |
---|---|---|
_links |
||
uuid |
string |
The UUID of the asynchronous job that is triggered by a POST, PATCH, or DELETE operation. |
error_arguments
Name | Type | Description |
---|---|---|
code |
string |
Argument code |
message |
string |
Message argument |
returned_error
Name | Type | Description |
---|---|---|
arguments |
array[error_arguments] |
Message arguments |
code |
string |
Error code |
message |
string |
Error message |
target |
string |
The target parameter that caused the error. |