]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/volumes/fs/operations/template.py
import ceph 15.2.10
[ceph.git] / ceph / src / pybind / mgr / volumes / fs / operations / template.py
CommitLineData
9f95a23c
TL
1import errno
2
adb31ebb
TL
3from enum import Enum, unique
4
92f5a8d4
TL
5from ..exception import VolumeException
6
7class GroupTemplate(object):
8 def list_subvolumes(self):
9 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
10
11 def create_snapshot(self, snapname):
12 """
13 create a subvolume group snapshot.
14
15 :param: group snapshot name
16 :return: None
17 """
18 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
19
20 def remove_snapshot(self, snapname):
21 """
22 remove a subvolume group snapshot.
23
24 :param: group snapshot name
25 :return: None
26 """
27 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
28
29 def list_snapshots(self):
30 """
31 list all subvolume group snapshots.
32
33 :param: None
34 :return: None
35 """
36 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
37
adb31ebb
TL
38@unique
39class SubvolumeOpType(Enum):
40 CREATE = 'create'
41 REMOVE = 'rm'
42 REMOVE_FORCE = 'rm-force'
43 PIN = 'pin'
44 LIST = 'ls'
45 GETPATH = 'getpath'
46 INFO = 'info'
47 RESIZE = 'resize'
48 SNAP_CREATE = 'snap-create'
49 SNAP_REMOVE = 'snap-rm'
50 SNAP_LIST = 'snap-ls'
51 SNAP_INFO = 'snap-info'
52 SNAP_PROTECT = 'snap-protect'
53 SNAP_UNPROTECT = 'snap-unprotect'
54 CLONE_SOURCE = 'clone-source'
55 CLONE_CREATE = 'clone-create'
56 CLONE_STATUS = 'clone-status'
57 CLONE_CANCEL = 'clone-cancel'
58 CLONE_INTERNAL = 'clone_internal'
cd265ab1
TL
59 ALLOW_ACCESS = 'allow-access'
60 DENY_ACCESS = 'deny-access'
61 AUTH_LIST = 'auth-list'
62 EVICT = 'evict'
adb31ebb 63
92f5a8d4 64class SubvolumeTemplate(object):
adb31ebb 65 VERSION = None # type: int
92f5a8d4
TL
66
67 @staticmethod
68 def version():
69 return SubvolumeTemplate.VERSION
70
adb31ebb 71 def open(self, op_type):
92f5a8d4
TL
72 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
73
74 def status(self):
75 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
76
77 def create(self, size, isolate_nspace, pool, mode, uid, gid):
78 """
79 set up metadata, pools and auth for a subvolume.
80
81 This function is idempotent. It is safe to call this again
82 for an already-created subvolume, even if it is in use.
83
84 :param size: In bytes, or None for no size limit
85 :param isolate_nspace: If true, use separate RADOS namespace for this subvolume
86 :param pool: the RADOS pool where the data objects of the subvolumes will be stored
87 :param mode: the user permissions
88 :param uid: the user identifier
89 :param gid: the group identifier
90 :return: None
91 """
92 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
93
94 def create_clone(self, pool, source_volname, source_subvolume, snapname):
95 """
96 prepare a subvolume to be cloned.
97
98 :param pool: the RADOS pool where the data objects of the cloned subvolume will be stored
99 :param source_volname: source volume of snapshot
100 :param source_subvolume: source subvolume of snapshot
101 :param snapname: snapshot name to be cloned from
102 :return: None
103 """
104 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
105
106 def remove(self):
107 """
108 make a subvolume inaccessible to guests.
109
110 This function is idempotent. It is safe to call this again
111
112 :param: None
113 :return: None
114 """
115 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
116
117 def resize(self, newsize, nshrink):
118 """
119 resize a subvolume
120
121 :param newsize: new size In bytes (or inf/infinite)
122 :return: new quota size and used bytes as a tuple
123 """
124 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
125
f6b5b4d7
TL
126 def pin(self, pin_type, pin_setting):
127 """
128 pin a subvolume
129
130 :param pin_type: type of pin
131 :param pin_setting: setting for pin
132 :return: None
133 """
134 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
135
92f5a8d4
TL
136 def create_snapshot(self, snapname):
137 """
138 snapshot a subvolume.
139
140 :param: subvolume snapshot name
141 :return: None
142 """
143 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
144
145 def remove_snapshot(self, snapname):
146 """
147 remove a subvolume snapshot.
148
149 :param: subvolume snapshot name
150 :return: None
151 """
152 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
153
92f5a8d4
TL
154 def list_snapshots(self):
155 """
156 list all subvolume snapshots.
157
158 :param: None
159 :return: None
160 """
161 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
162
92f5a8d4
TL
163 def attach_snapshot(self, snapname, tgt_subvolume):
164 """
165 attach a snapshot to a target cloned subvolume. the target subvolume
166 should be an empty subvolume (type "clone") in "pending" state.
167
168 :param: snapname: snapshot to attach to a clone
169 :param: tgt_subvolume: target clone subvolume
170 :return: None
171 """
172 raise VolumeException(-errno.ENOTSUP, "operation not supported.")
173
174 def detach_snapshot(self, snapname, tgt_subvolume):
175 """
176 detach a snapshot from a target cloned subvolume. the target subvolume
177 should either be in "failed" or "completed" state.
178
179 :param: snapname: snapshot to detach from a clone
180 :param: tgt_subvolume: target clone subvolume
181 :return: None
182 """
183 raise VolumeException(-errno.ENOTSUP, "operation not supported.")