]>
git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/volumes/fs/operations/template.py
3fca8dd87f9ec0dc27415d0c25daa632053f14e7
3 from enum
import Enum
, unique
5 from ..exception
import VolumeException
7 class GroupTemplate(object):
8 def list_subvolumes(self
):
9 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
11 def create_snapshot(self
, snapname
):
13 create a subvolume group snapshot.
15 :param: group snapshot name
18 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
20 def remove_snapshot(self
, snapname
):
22 remove a subvolume group snapshot.
24 :param: group snapshot name
27 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
29 def list_snapshots(self
):
31 list all subvolume group snapshots.
36 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
39 class SubvolumeOpType(Enum
):
42 REMOVE_FORCE
= 'rm-force'
48 SNAP_CREATE
= 'snap-create'
49 SNAP_REMOVE
= 'snap-rm'
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'
60 class SubvolumeTemplate(object):
61 VERSION
= None # type: int
65 return SubvolumeTemplate
.VERSION
67 def open(self
, op_type
):
68 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
71 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
73 def create(self
, size
, isolate_nspace
, pool
, mode
, uid
, gid
):
75 set up metadata, pools and auth for a subvolume.
77 This function is idempotent. It is safe to call this again
78 for an already-created subvolume, even if it is in use.
80 :param size: In bytes, or None for no size limit
81 :param isolate_nspace: If true, use separate RADOS namespace for this subvolume
82 :param pool: the RADOS pool where the data objects of the subvolumes will be stored
83 :param mode: the user permissions
84 :param uid: the user identifier
85 :param gid: the group identifier
88 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
90 def create_clone(self
, pool
, source_volname
, source_subvolume
, snapname
):
92 prepare a subvolume to be cloned.
94 :param pool: the RADOS pool where the data objects of the cloned subvolume will be stored
95 :param source_volname: source volume of snapshot
96 :param source_subvolume: source subvolume of snapshot
97 :param snapname: snapshot name to be cloned from
100 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
104 make a subvolume inaccessible to guests.
106 This function is idempotent. It is safe to call this again
111 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
113 def resize(self
, newsize
, nshrink
):
117 :param newsize: new size In bytes (or inf/infinite)
118 :return: new quota size and used bytes as a tuple
120 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
122 def pin(self
, pin_type
, pin_setting
):
126 :param pin_type: type of pin
127 :param pin_setting: setting for pin
130 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
132 def create_snapshot(self
, snapname
):
134 snapshot a subvolume.
136 :param: subvolume snapshot name
139 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
141 def remove_snapshot(self
, snapname
):
143 remove a subvolume snapshot.
145 :param: subvolume snapshot name
148 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
150 def list_snapshots(self
):
152 list all subvolume snapshots.
157 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
159 def attach_snapshot(self
, snapname
, tgt_subvolume
):
161 attach a snapshot to a target cloned subvolume. the target subvolume
162 should be an empty subvolume (type "clone") in "pending" state.
164 :param: snapname: snapshot to attach to a clone
165 :param: tgt_subvolume: target clone subvolume
168 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")
170 def detach_snapshot(self
, snapname
, tgt_subvolume
):
172 detach a snapshot from a target cloned subvolume. the target subvolume
173 should either be in "failed" or "completed" state.
175 :param: snapname: snapshot to detach from a clone
176 :param: tgt_subvolume: target clone subvolume
179 raise VolumeException(-errno
.ENOTSUP
, "operation not supported.")