if (profile.name == "rbd") {
// RBD read-write grant
- profile_grants.emplace_back(OSDCapMatch("", "", "rbd_children"),
+ profile_grants.emplace_back(OSDCapMatch({}, "rbd_children"),
OSDCapSpec(osd_rwxa_t(OSD_CAP_CLS_R)));
- profile_grants.emplace_back(OSDCapMatch("", "", "rbd_mirroring"),
+ profile_grants.emplace_back(OSDCapMatch({}, "rbd_mirroring"),
OSDCapSpec(osd_rwxa_t(OSD_CAP_CLS_R)));
profile_grants.emplace_back(OSDCapMatch(profile.pool_namespace),
OSDCapSpec(osd_rwxa_t(OSD_CAP_R |
profile_grants.emplace_back(OSDCapMatch(profile.pool_namespace),
OSDCapSpec(osd_rwxa_t(OSD_CAP_R |
OSD_CAP_CLS_R)));
+ profile_grants.emplace_back(OSDCapMatch(profile.pool_namespace,
+ "rbd_header."),
+ OSDCapSpec("rbd", "child_attach"));
+ profile_grants.emplace_back(OSDCapMatch(profile.pool_namespace,
+ "rbd_header."),
+ OSDCapSpec("rbd", "child_detach"));
}
}
OSDCapMatch() {}
OSDCapMatch(const OSDCapPoolTag& pt) : pool_tag(pt) {}
OSDCapMatch(const OSDCapPoolNamespace& pns) : pool_namespace(pns) {}
+ OSDCapMatch(const OSDCapPoolNamespace& pns, const std::string& pre)
+ : pool_namespace(pns), object_prefix(pre) {}
OSDCapMatch(const std::string& pl, const std::string& pre)
: pool_namespace(pl), object_prefix(pre) {}
OSDCapMatch(const std::string& pl, const std::string& ns,
ASSERT_FALSE(cap.is_capable("foo", "", 0, {}, "rbd_children", true, false, {}));
ASSERT_TRUE(cap.is_capable("abc", "", 0, {}, "asdf", true, false,
{{"rbd", "", true, false, true}}));
+ ASSERT_FALSE(cap.is_capable("abc", "", 0, {}, "asdf", true, true, {}));
+ ASSERT_TRUE(cap.is_capable("abc", "", 0, {}, "rbd_header.ABC", false, false,
+ {{"rbd", "child_attach", true, true, true}}));
+ ASSERT_TRUE(cap.is_capable("abc", "", 0, {}, "rbd_header.ABC", false, false,
+ {{"rbd", "child_detach", true, true, true}}));
+ ASSERT_FALSE(cap.is_capable("abc", "", 0, {}, "rbd_header.ABC", false, false,
+ {{"rbd", "other function", true, true, true}}));
}