Module netapp_ontap.resources.file_clone
Copyright © 2021 NetApp Inc. All rights reserved.
Overview
You can use these API's to create file clones, retrieve split status and manage split loads. These endpoints are used for cloning files within a volume, without taking much of extra space. Child and parent clones shares the unchanged blocks of data.
A file clone split operation detach child clone from its parent. Split operations use space. To ensure that file clone create operation is not affected by split, file clone tokens are use to reserve space. API endpoints can be used to update the validity and space reserved by token.
File clone APIs
The following APIs are used to perform the following operations:
- POST /api/storage/file/clone
- GET /api/storage/file/clone/split-status
- PATCH /api/storage/file/clone/split-loads/{node.uuid}
- GET /api/storage/file/clone/split-loads/{node.uuid}
- GET /api/storage/file/clone/split-loads
- GET /api/storage/file/clone/tokens/
- DELETE /api/storage/file/clone/tokens/{node.uuid}/{token.uuid}
- PATCH /api/storage/file/clone/tokens/{node.uuid}/{token.uuid}
Classes
class FileClone (*args, **kwargs)
-
File clone
Initialize the instance of the resource.
Any keyword arguments are set on the instance as properties. For example, if the class was named 'MyResource', then this statement would be true:
MyResource(name='foo').name == 'foo'
Args
*args
- Each positional argument represents a parent key as used in the URL of the object. That is, each value will be used to fill in a segment of the URL which refers to some parent object. The order of these arguments must match the order they are specified in the URL, from left to right.
**kwargs
- each entry will have its key set as an attribute name on the instance and its value will be the value of that attribute.
Ancestors
Static methods
def post_collection(records: Iterable[_ForwardRef('FileClone')], *args, hydrate: bool = False, poll: bool = True, poll_interval: Union[int, NoneType] = None, poll_timeout: Union[int, NoneType] = None, connection: HostConnection = None, **kwargs) -> Union[List[FileClone], NetAppResponse]
-
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
andvolume.uuid
to identify the volume.
Setsource_path
anddestination_path
to identify the file path of original and copied file. In case of full file clone, the new file is created usingdestination_path
.
In case of a sub file clone, setrange
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 toautodelete
, 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
]
Learn more
Send this collection of objects to the host as a creation request.
Args
records
- A list of
Resource
objects to send to the server to be created. *args
- Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to create a bar for a particular foo, the foo.name value should be passed.
hydrate
- If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of each object. When hydrate is set to True, poll must also be set to True.
poll
- If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
poll_interval
- If the operation returns a job, this specifies how often to query the job for updates.
poll_timeout
- If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
connection
- The
HostConnection
object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context. **kwargs
- Any key/value pairs passed will be sent as query parameters to the host. Only resources matching this query will be patched.
Returns
- A list of
Resource
objects matching the provided type
which
have
been
created
by
the
host
and
returned.
This
is
_not_
the
same
list
that
was
provided
,so
to
continue
using
the
object
,you
should save this list. If poll is set to False, then a
NetAppResponse
object is returned instead.Raises
NetAppRestError
: If the API call returned a status code >= 400
Methods
def post(self, hydrate: bool = False, poll: bool = True, poll_interval: Union[int, NoneType] = None, poll_timeout: Union[int, NoneType] = None, **kwargs) -> NetAppResponse
-
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
andvolume.uuid
to identify the volume.
Setsource_path
anddestination_path
to identify the file path of original and copied file. In case of full file clone, the new file is created usingdestination_path
.
In case of a sub file clone, setrange
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 toautodelete
, 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
]
Learn more
Send this object to the host as a creation request.
Args
hydrate
- If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of the object.
poll
- If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
poll_interval
- If the operation returns a job, this specifies how often to query the job for updates.
poll_timeout
- If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
**kwargs
- Any key/value pairs passed will normally be sent as query parameters to the host. If any of these pairs are parameters that are sent as formdata then only parameters of that type will be accepted and all others will be discarded.
Returns
A
NetAppResponse
object containing the details of the HTTP response.Raises
NetAppRestError
: If the API call returned a status code >= 400
Inherited members
class FileCloneSchema (*, only: Union[Sequence[str], Set[str]] = None, exclude: Union[Sequence[str], Set[str]] = (), many: bool = False, context: Dict = None, load_only: Union[Sequence[str], Set[str]] = (), dump_only: Union[Sequence[str], Set[str]] = (), partial: Union[bool, Sequence[str], Set[str]] = False, unknown: str = None)
-
The fields of the FileClone object
Ancestors
- netapp_ontap.resource.ResourceSchema
- marshmallow.schema.Schema
- marshmallow.base.SchemaABC
Class variables
-
autodelete GET POST PATCH
-
Mark clone file for auto deletion.
-
destination_path GET POST PATCH
-
Relative path of the clone/destination file in the volume.
Example: dest_file1, dir1/dest_file2
-
is_backup GET POST PATCH
-
Mark clone file for backup.
-
overwrite_destination GET POST PATCH
-
Destination file gets overwritten.
-
range GET POST PATCH
-
List of block ranges for sub-file cloning in the format "source-file-block-number:destination-file-block-number:block-count"
Example: [36605,73210]
-
source_path GET POST PATCH
-
Relative path of the source file in the volume.
Example: src_file1, dir1/src_file2, ./.snapshot/snap1/src_file3
-
token_uuid GET POST PATCH
-
UUID of existing clone token with reserved split load.
-
volume GET POST PATCH
-
The volume field of the file_clone.