new_pool_id = self.fs.add_data_pool(new_pool_name)
# That an object which has switched pools gets its backtrace updated
- self.mount_a.run_shell(["setfattr", "-n", "ceph.file.layout.pool", "-v", new_pool_name, "./parent_b/alpha"])
+ self.mount_a.setfattr("./parent_b/alpha",
+ "ceph.file.layout.pool", new_pool_name)
self.fs.mds_asok(["flush", "journal"])
backtrace_old_pool = self.fs.read_backtrace(file_ino, pool=old_data_pool_name)
self.assertEqual(backtrace_old_pool['pool'], new_pool_id)
self.assertEqual(['alpha', 'parent_c'], [a['dname'] for a in backtrace_new_pool['ancestors']])
# That layout is written to new pool after change to other field in layout
- self.mount_a.run_shell(["setfattr", "-n", "ceph.file.layout.object_size", "-v", "8388608", "./parent_c/alpha"])
+ self.mount_a.setfattr("./parent_c/alpha",
+ "ceph.file.layout.object_size", "8388608")
self.fs.mds_asok(["flush", "journal"])
new_pool_layout = self.fs.read_layout(file_ino, pool=new_pool_name)
# Create a dir with a striped layout set on it
self._mount.run_shell(["mkdir", "stripey"])
- self._mount.run_shell([
- "setfattr", "-n", "ceph.dir.layout", "-v",
- "stripe_unit={ss} stripe_count={sc} object_size={os} pool={pool}".format(
- ss=self.ss, os=self.os, sc=self.sc,
- pool=self._filesystem.get_data_pool_name()
- ),
- "./stripey"])
+ self._mount.setfattr("./stripey", "ceph.dir.layout",
+ "stripe_unit={ss} stripe_count={sc} object_size={os} pool={pool}".format(
+ ss=self.ss, os=self.os, sc=self.sc,
+ pool=self._filesystem.get_data_pool_name()
+ ))
# Write files, then flush metadata so that its layout gets written into an xattr
for i, n_bytes in enumerate(self.interesting_sizes):
"""
def write(self):
self._mount.run_shell(["touch", "datafile"])
- self._mount.run_shell(["setfattr", "-n", "ceph.file.layout.object_size", "-v", "8388608", "./datafile"])
+ self._mount.setfattr("./datafile", "ceph.file.layout.object_size", "8388608")
self._mount.run_shell(["dd", "if=/dev/urandom", "of=./datafile", "bs=1M", "count=32"])
self._initial_state = self._mount.stat("datafile")
def validate(self):
- p = self._mount.run_shell(["sudo", "getfattr", "--only-values", "-n", "ceph.file.layout.object_size", "./datafile"])
-
# Check we got the layout reconstructed properly
- object_size = int(p.stdout.getvalue().strip())
+ object_size = int(self._mount.getfattr(
+ "./datafile", "ceph.file.layout.object_size"))
self.assert_equal(object_size, 8388608)
# Check we got the file size reconstructed properly
self.mount_a.wait_until_mounted()
with self.assertRaises(CommandFailedError):
- self.mount_a.run_shell(["setfattr",
- "-n", "ceph.file.layout.pool",
- "-v", new_pool_name, "layoutfile"])
+ self.mount_a.setfattr("layoutfile", "ceph.file.layout.pool",
+ new_pool_name)
with self.assertRaises(CommandFailedError):
- self.mount_a.run_shell(["setfattr",
- "-n", "ceph.dir.layout.pool",
- "-v", new_pool_name, "layoutdir"])
+ self.mount_a.setfattr("layoutdir", "ceph.dir.layout.pool",
+ new_pool_name)
self.mount_a.umount_wait()
# Set MDS 'rwp' perms: should now be able to set layouts
))
self.mount_a.mount()
self.mount_a.wait_until_mounted()
- self.mount_a.run_shell(["setfattr",
- "-n", "ceph.file.layout.pool",
- "-v", new_pool_name, "layoutfile"])
- self.mount_a.run_shell(["setfattr",
- "-n", "ceph.dir.layout.pool",
- "-v", new_pool_name, "layoutdir"])
+ self.mount_a.setfattr("layoutfile", "ceph.file.layout.pool",
+ new_pool_name)
+ self.mount_a.setfattr("layoutdir", "ceph.dir.layout.pool",
+ new_pool_name)
self.mount_a.umount_wait()
def tearDown(self):
self.mount_a.run_shell(["touch", file_name])
file_layout = "stripe_unit=1048576 stripe_count=4 object_size=8388608"
- self.mount_a.run_shell(["setfattr", "-n", "ceph.file.layout", "-v", file_layout, file_name])
+ self.mount_a.setfattr(file_name, "ceph.file.layout", file_layout)
# 35MB requires 7 objects
size_mb = 35