# cleanup
self.mount_a.run_shell(['rm', '-rf', 'group/subvol3'])
+
+ def test_subvolume_vxattr_retrieval(self):
+ """
+ To verify that the ceph.dir.subvolume vxattr can be acquired using getfattr
+ """
+ # create subvolume dir
+ subvol_dir:str = 'group/subvol5'
+ self.mount_a.run_shell(['mkdir', subvol_dir])
+ mkdir_fattr = self.mount_a.getfattr(subvol_dir, 'ceph.dir.subvolume')
+ self.assertEqual('0', mkdir_fattr)
+
+ self.mount_a.setfattr(subvol_dir, 'ceph.dir.subvolume', '1')
+ new_fattr:str = self.mount_a.getfattr(subvol_dir, 'ceph.dir.subvolume')
+ self.assertEqual('1', new_fattr)
+
+ # clear subvolume flag
+ self.mount_a.removexattr(subvol_dir, 'ceph.dir.subvolume')
+
+ # cleanup
+ self.mount_a.run_shell(['rm', '-rf', subvol_dir])
+
+
class TestSubvolumeReplicated(CephFSTestCase):
CLIENTS_REQUIRED = 1
MDSS_REQUIRED = 2
// since we only handle ceph vxattrs here
r = -ENODATA; // no such attribute
}
+ } else if (xattr_name == "ceph.dir.subvolume"sv) {
+ const auto* srnode = cur->get_projected_srnode();
+ *css << (srnode && srnode->is_subvolume() ? "1"sv : "0"sv);
} else {
// otherwise respond as invalid request
// since we only handle ceph vxattrs here
static bool is_ceph_dir_vxattr(std::string_view xattr_name) {
return xattr_name == "ceph.dir.layout" ||
- xattr_name == "ceph.dir.layout.json" ||
- xattr_name == "ceph.dir.layout.object_size" ||
- xattr_name == "ceph.dir.layout.stripe_unit" ||
- xattr_name == "ceph.dir.layout.stripe_count" ||
- xattr_name == "ceph.dir.layout.pool" ||
- xattr_name == "ceph.dir.layout.pool_name" ||
- xattr_name == "ceph.dir.layout.pool_id" ||
- xattr_name == "ceph.dir.layout.pool_namespace" ||
- xattr_name == "ceph.dir.pin" ||
- xattr_name == "ceph.dir.pin.random" ||
- xattr_name == "ceph.dir.pin.distributed" ||
- xattr_name == "ceph.dir.charmap"sv ||
- xattr_name == "ceph.dir.normalization"sv ||
- xattr_name == "ceph.dir.encoding"sv ||
- xattr_name == "ceph.dir.casesensitive"sv;
+ xattr_name == "ceph.dir.layout.json" ||
+ xattr_name == "ceph.dir.layout.object_size" ||
+ xattr_name == "ceph.dir.layout.stripe_unit" ||
+ xattr_name == "ceph.dir.layout.stripe_count" ||
+ xattr_name == "ceph.dir.layout.pool" ||
+ xattr_name == "ceph.dir.layout.pool_name" ||
+ xattr_name == "ceph.dir.layout.pool_id" ||
+ xattr_name == "ceph.dir.layout.pool_namespace" ||
+ xattr_name == "ceph.dir.pin" ||
+ xattr_name == "ceph.dir.pin.random" ||
+ xattr_name == "ceph.dir.pin.distributed" ||
+ xattr_name == "ceph.dir.charmap"sv ||
+ xattr_name == "ceph.dir.normalization"sv ||
+ xattr_name == "ceph.dir.encoding"sv ||
+ xattr_name == "ceph.dir.casesensitive"sv ||
+ xattr_name == "ceph.dir.subvolume"sv;
}
static bool is_ceph_file_vxattr(std::string_view xattr_name) {