]>
git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/volumes/fs/operations/template.py
1 from ..exception
import VolumeException
3 class GroupTemplate(object):
4 def list_subvolumes(self
):
5 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
7 def create_snapshot(self
, snapname
):
9 create a subvolume group snapshot.
11 :param: group snapshot name
14 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
16 def remove_snapshot(self
, snapname
):
18 remove a subvolume group snapshot.
20 :param: group snapshot name
23 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
25 def list_snapshots(self
):
27 list all subvolume group snapshots.
32 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
34 class SubvolumeTemplate(object):
39 return SubvolumeTemplate
.VERSION
41 def open(self
, need_complete
=True, expected_types
=[]):
42 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
45 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
47 def create(self
, size
, isolate_nspace
, pool
, mode
, uid
, gid
):
49 set up metadata, pools and auth for a subvolume.
51 This function is idempotent. It is safe to call this again
52 for an already-created subvolume, even if it is in use.
54 :param size: In bytes, or None for no size limit
55 :param isolate_nspace: If true, use separate RADOS namespace for this subvolume
56 :param pool: the RADOS pool where the data objects of the subvolumes will be stored
57 :param mode: the user permissions
58 :param uid: the user identifier
59 :param gid: the group identifier
62 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
64 def create_clone(self
, pool
, source_volname
, source_subvolume
, snapname
):
66 prepare a subvolume to be cloned.
68 :param pool: the RADOS pool where the data objects of the cloned subvolume will be stored
69 :param source_volname: source volume of snapshot
70 :param source_subvolume: source subvolume of snapshot
71 :param snapname: snapshot name to be cloned from
74 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
78 make a subvolume inaccessible to guests.
80 This function is idempotent. It is safe to call this again
85 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
87 def resize(self
, newsize
, nshrink
):
91 :param newsize: new size In bytes (or inf/infinite)
92 :return: new quota size and used bytes as a tuple
94 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
96 def create_snapshot(self
, snapname
):
100 :param: subvolume snapshot name
103 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
105 def remove_snapshot(self
, snapname
):
107 remove a subvolume snapshot.
109 :param: subvolume snapshot name
112 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
114 def snapshot_path(self
, snapname
):
116 return the snapshot path for a given snapshot name
118 :param: subvolume snapshot name
119 :return: snapshot path
121 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
123 def list_snapshots(self
):
125 list all subvolume snapshots.
130 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
132 def is_snapshot_protected(self
, snapname
):
134 check if a snapshot is protected.
136 :param: snapname: snapshot to protect
137 :return: True if the snapshot is protected, False otherwise.
139 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
141 def protect_snapshot(self
, snapname
):
143 protect a subvolume snapshot. only a protected snapshot can be cloned.
145 :param: snapname: snapshot to protect
148 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
150 def unprotect_snapshot(self
, snapname
):
152 unprotect a subvolume snapshot. fail to unprotect if there are pending
153 clone operations on the snapshot.
155 :param: snapname: snapshot to unprotect
158 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
160 def attach_snapshot(self
, snapname
, tgt_subvolume
):
162 attach a snapshot to a target cloned subvolume. the target subvolume
163 should be an empty subvolume (type "clone") in "pending" state.
165 :param: snapname: snapshot to attach to a clone
166 :param: tgt_subvolume: target clone subvolume
169 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
171 def detach_snapshot(self
, snapname
, tgt_subvolume
):
173 detach a snapshot from a target cloned subvolume. the target subvolume
174 should either be in "failed" or "completed" state.
176 :param: snapname: snapshot to detach from a clone
177 :param: tgt_subvolume: target clone subvolume
180 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")