return True
return False
-def listdir(fs, dirpath):
+def listdir(fs, dirpath, filter_entries=None):
"""
Get the directory names (only dirs) for a given path
"""
dirs = []
+ if filter_entries is None:
+ filter_entries = [b".", b".."]
+ else:
+ filter_entries.extend([b".", b".."])
try:
with fs.opendir(dirpath) as dir_handle:
d = fs.readdir(dir_handle)
while d:
- if (d.d_name not in (b".", b"..")) and d.is_dir():
+ if (d.d_name not in filter_entries) and d.is_dir():
dirs.append(d.d_name)
d = fs.readdir(dir_handle)
except cephfs.Error as e:
from .operations.group import open_group, create_group, remove_group, open_group_unique
from .operations.subvolume import open_subvol, create_subvol, remove_subvol, \
create_clone
+from .operations.trash import Trash
from .vol_spec import VolSpec
from .exception import VolumeException, ClusterError, ClusterTimeout, EvictionError
try:
with open_volume(self, volname) as fs_handle:
volume_exists = True
- groups = listdir(fs_handle, self.volspec.base_dir)
+ groups = listdir(fs_handle, self.volspec.base_dir, filter_entries=[Trash.GROUP_NAME.encode('utf-8')])
ret = 0, name_to_json(groups), ""
except VolumeException as ve:
if not ve.errno == -errno.ENOENT or not volume_exists: