def ls_dir(request):
    if 'root_dir' in request.GET:
        root = request.GET['root_dir']
    else:
        root = "/"
    if 'depth' in request.GET:
        depth = int(request.GET['depth'])
    else:
        depth = 1
    if depth > 5:
        logger.warning("Limiting depth to maximum value of 5: input depth=%s", depth)
        depth = 5
    root = '{}/'.format(root) if not root.endswith('/') else root

    try:
        cluster = FsidContext(request=request, module_name='ceph_nfs').cluster
        paths = CephFSUtil.instance(cluster).get_dir_list(root, depth)
        paths = [p[:-1] for p in paths if p != root]
        return Response({'paths': paths})
    except libcephfs.ObjectNotFound, libcephfs.PermissionError:
        return Response({'paths': []})