and operate on specific Ceph file systems. The FS can be specificed using
``fsname`` in caps. This also affects subcommand ``fs authorize``, the caps
produce by it will be specific to the FS name passed in its arguments.
+
+* fs: "fs authorize" now sets MON cap to "allow <perm> fsname=<fsname>"
+ instead of setting it to "allow r" all the time.
match = -(
(uid >> gidlist)[_val = phoenix::construct<MDSCapMatch>(_1, _2)] |
(path >> uid >> gidlist)[_val = phoenix::construct<MDSCapMatch>(_1, _2, _3)] |
+ (fs_name >> path)[_val = phoenix::construct<MDSCapMatch>(_2, _1)] |
(path)[_val = phoenix::construct<MDSCapMatch>(_1)] |
(fs_name)[_val = phoenix::construct<MDSCapMatch>(std::string(),
_1)]);
typedef int32_t fs_cluster_id_t;
constexpr fs_cluster_id_t FS_CLUSTER_ID_NONE = -1;
+
// The namespace ID of the anonymous default filesystem from legacy systems
constexpr fs_cluster_id_t FS_CLUSTER_ID_ANONYMOUS = 0;
mds_cap_string += mds_cap_string.empty() ? "" : ", ";
mds_cap_string += "allow " + cap;
- if (path != "/") {
- mds_cap_string += " path=" + path;
+
+ if (filesystem != "*" && filesystem != "all") {
+ auto fs = mon->mdsmon()->get_fsmap().get_filesystem(filesystem);
+ if (!fs) {
+ ss << "filesystem " << filesystem << " does not exist.";
+ err = -EINVAL;
+ goto done;
+ } else {
+ mds_cap_string += " fsname=" + std::string(fs->mds_map.get_fs_name());
+ }
}
- }
- if (filesystem != "*" && filesystem != "all") {
- auto fs = mon->mdsmon()->get_fsmap().get_filesystem(filesystem);
- if (!fs) {
- ss << "filesystem " << filesystem << " does not exist.";
- err = -EINVAL;
- goto done;
+ if (path != "/") {
+ mds_cap_string += " path=" + path;
}
}
- osd_cap_string += osd_cap_string.empty()? "" : ", ";
+ osd_cap_string += osd_cap_string.empty() ? "" : ", ";
osd_cap_string += "allow " + osd_cap_wanted
+ " tag " + pg_pool_t::APPLICATION_NAME_CEPHFS
+ " data=" + filesystem;