]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/volumes/fs/operations/template.py
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / pybind / mgr / volumes / fs / operations / template.py
1 from ..exception import VolumeException
2
3 class GroupTemplate(object):
4 def list_subvolumes(self):
5 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
6
7 def create_snapshot(self, snapname):
8 """
9 create a subvolume group snapshot.
10
11 :param: group snapshot name
12 :return: None
13 """
14 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
15
16 def remove_snapshot(self, snapname):
17 """
18 remove a subvolume group snapshot.
19
20 :param: group snapshot name
21 :return: None
22 """
23 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
24
25 def list_snapshots(self):
26 """
27 list all subvolume group snapshots.
28
29 :param: None
30 :return: None
31 """
32 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
33
34 class SubvolumeTemplate(object):
35 VERSION = None
36
37 @staticmethod
38 def version():
39 return SubvolumeTemplate.VERSION
40
41 def open(self, need_complete=True, expected_types=[]):
42 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
43
44 def status(self):
45 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
46
47 def create(self, size, isolate_nspace, pool, mode, uid, gid):
48 """
49 set up metadata, pools and auth for a subvolume.
50
51 This function is idempotent. It is safe to call this again
52 for an already-created subvolume, even if it is in use.
53
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
60 :return: None
61 """
62 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
63
64 def create_clone(self, pool, source_volname, source_subvolume, snapname):
65 """
66 prepare a subvolume to be cloned.
67
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
72 :return: None
73 """
74 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
75
76 def remove(self):
77 """
78 make a subvolume inaccessible to guests.
79
80 This function is idempotent. It is safe to call this again
81
82 :param: None
83 :return: None
84 """
85 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
86
87 def resize(self, newsize, nshrink):
88 """
89 resize a subvolume
90
91 :param newsize: new size In bytes (or inf/infinite)
92 :return: new quota size and used bytes as a tuple
93 """
94 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
95
96 def create_snapshot(self, snapname):
97 """
98 snapshot a subvolume.
99
100 :param: subvolume snapshot name
101 :return: None
102 """
103 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
104
105 def remove_snapshot(self, snapname):
106 """
107 remove a subvolume snapshot.
108
109 :param: subvolume snapshot name
110 :return: None
111 """
112 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
113
114 def snapshot_path(self, snapname):
115 """
116 return the snapshot path for a given snapshot name
117
118 :param: subvolume snapshot name
119 :return: snapshot path
120 """
121 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
122
123 def list_snapshots(self):
124 """
125 list all subvolume snapshots.
126
127 :param: None
128 :return: None
129 """
130 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
131
132 def is_snapshot_protected(self, snapname):
133 """
134 check if a snapshot is protected.
135
136 :param: snapname: snapshot to protect
137 :return: True if the snapshot is protected, False otherwise.
138 """
139 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
140
141 def protect_snapshot(self, snapname):
142 """
143 protect a subvolume snapshot. only a protected snapshot can be cloned.
144
145 :param: snapname: snapshot to protect
146 :return: None
147 """
148 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
149
150 def unprotect_snapshot(self, snapname):
151 """
152 unprotect a subvolume snapshot. fail to unprotect if there are pending
153 clone operations on the snapshot.
154
155 :param: snapname: snapshot to unprotect
156 :return: None
157 """
158 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
159
160 def attach_snapshot(self, snapname, tgt_subvolume):
161 """
162 attach a snapshot to a target cloned subvolume. the target subvolume
163 should be an empty subvolume (type "clone") in "pending" state.
164
165 :param: snapname: snapshot to attach to a clone
166 :param: tgt_subvolume: target clone subvolume
167 :return: None
168 """
169 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
170
171 def detach_snapshot(self, snapname, tgt_subvolume):
172 """
173 detach a snapshot from a target cloned subvolume. the target subvolume
174 should either be in "failed" or "completed" state.
175
176 :param: snapname: snapshot to detach from a clone
177 :param: tgt_subvolume: target clone subvolume
178 :return: None
179 """
180 raise VolumeException(-errno.ENOTSUP, "operation not supported.")