uid = kwargs['uid']
gid = kwargs['gid']
mode = kwargs['mode']
+ isolate_nspace = kwargs['namespace_isolated']
oct_mode = octal_str_to_decimal_int(mode)
try:
create_subvol(
- fs_handle, self.volspec, group, subvolname, size, False, pool, oct_mode, uid, gid)
+ fs_handle, self.volspec, group, subvolname, size, isolate_nspace, pool, oct_mode, uid, gid)
except VolumeException as ve:
# kick the purge threads for async removal -- note that this
# assumes that the subvolume is moved to trashcan for cleanup on error.
volname = kwargs['vol_name']
subvolname = kwargs['sub_name']
groupname = kwargs['group_name']
+ size = kwargs['size']
+ pool = kwargs['pool_layout']
+ uid = kwargs['uid']
+ gid = kwargs['gid']
+ isolate_nspace = kwargs['namespace_isolated']
try:
with open_volume(self, volname) as fs_handle:
with open_group(fs_handle, self.volspec, groupname) as group:
try:
- with open_subvol(fs_handle, self.volspec, group, subvolname):
- # idempotent creation -- valid.
- pass
+ with open_subvol(fs_handle, self.volspec, group, subvolname) as subvolume:
+ # idempotent creation -- valid. Attributes set is supported.
+ uid = uid if uid else subvolume.uid
+ gid = gid if gid else subvolume.gid
+ subvolume.set_attrs(subvolume.path, size, isolate_nspace, pool, uid, gid)
except VolumeException as ve:
if ve.errno == -errno.ENOENT:
self._create_subvolume(fs_handle, volname, group, subvolname, **kwargs)
ret = self.volume_exception_to_retval(ve)
return ret
+ def subvolume_snapshot_info(self, **kwargs):
+ ret = 0, "", ""
+ volname = kwargs['vol_name']
+ subvolname = kwargs['sub_name']
+ snapname = kwargs['snap_name']
+ groupname = kwargs['group_name']
+
+ try:
+ with open_volume(self, volname) as fs_handle:
+ with open_group(fs_handle, self.volspec, groupname) as group:
+ with open_subvol(fs_handle, self.volspec, group, subvolname) as subvolume:
+ snap_info_dict = subvolume.snapshot_info(snapname)
+ ret = 0, json.dumps(snap_info_dict, indent=4, sort_keys=True), ""
+ except VolumeException as ve:
+ ret = self.volume_exception_to_retval(ve)
+ return ret
+
def list_subvolume_snapshots(self, **kwargs):
ret = 0, "", ""
volname = kwargs['vol_name']
target_subvolume.remove()
self.purge_queue.queue_job(volname)
except Exception as e:
- log.warn("failed to cleanup clone subvolume '{0}' ({1})".format(target_subvolname, e))
+ log.warning("failed to cleanup clone subvolume '{0}' ({1})".format(target_subvolname, e))
raise ve
def _clone_subvolume_snapshot(self, fs_handle, volname, subvolume, **kwargs):