from IPy import IP
from teuthology.contextutil import safe_while
-from teuthology.misc import get_file, sudo_write_file
+from teuthology.misc import get_file, write_file
from teuthology.orchestra import run
from teuthology.orchestra.run import CommandFailedError, ConnectionLostError, Raw
for suffix in self.test_files:
log.info("Creating file {0}".format(suffix))
self.client_remote.run(args=[
- 'sudo', 'touch', os.path.join(self.hostfs_mntpt, suffix)
+ 'touch', os.path.join(self.hostfs_mntpt, suffix)
])
def test_create_file(self, filename='testfile', dirname=None, user=None,
for suffix in self.test_files:
log.info("Checking file {0}".format(suffix))
r = self.client_remote.run(args=[
- 'sudo', 'ls', os.path.join(self.hostfs_mntpt, suffix)
+ 'ls', os.path.join(self.hostfs_mntpt, suffix)
], check_status=False)
if r.exitstatus != 0:
raise RuntimeError("Expected file {0} not found".format(suffix))
if path.find(self.hostfs_mntpt) == -1:
path = os.path.join(self.hostfs_mntpt, path)
- sudo_write_file(self.client_remote, path, data)
+ write_file(self.client_remote, path, data)
if perms:
self.run_shell(args=f'chmod {perms} {path}')
if path.find(self.hostfs_mntpt) == -1:
path = os.path.join(self.hostfs_mntpt, path)
- return self.run_shell(args=['sudo', 'cat', path], omit_sudo=False).\
+ return self.run_shell(args=['cat', path]).\
stdout.getvalue().strip()
def create_destroy(self):
filename = "{0} {1}".format(datetime.datetime.now(), self.client_id)
log.debug("Creating test file {0}".format(filename))
self.client_remote.run(args=[
- 'sudo', 'touch', os.path.join(self.hostfs_mntpt, filename)
+ 'touch', os.path.join(self.hostfs_mntpt, filename)
])
log.debug("Deleting test file {0}".format(filename))
self.client_remote.run(args=[
- 'sudo', 'rm', '-f', os.path.join(self.hostfs_mntpt, filename)
+ 'rm', '-f', os.path.join(self.hostfs_mntpt, filename)
])
- def _run_python(self, pyscript, py_version='python3'):
- return self.client_remote.run(
- args=['sudo', 'adjust-ulimits', 'daemon-helper', 'kill',
- py_version, '-c', pyscript], wait=False, stdin=run.PIPE,
- stdout=StringIO())
+ def _run_python(self, pyscript, py_version='python3', sudo=False):
+ args = []
+ if sudo:
+ args.append('sudo')
+ args += ['adjust-ulimits', 'daemon-helper', 'kill', py_version, '-c', pyscript]
+ return self.client_remote.run(args=args, wait=False, stdin=run.PIPE, stdout=StringIO())
- def run_python(self, pyscript, py_version='python3'):
- p = self._run_python(pyscript, py_version)
+ def run_python(self, pyscript, py_version='python3', sudo=False):
+ p = self._run_python(pyscript, py_version, sudo=sudo)
p.wait()
return p.stdout.getvalue().strip()
- def run_shell(self, args, omit_sudo=True, timeout=900, **kwargs):
+ def run_shell(self, args, timeout=900, **kwargs):
args = args.split() if isinstance(args, str) else args
- # XXX: all commands ran with CephFS mount as CWD must be executed with
- # superuser privileges when tests are being run using teuthology.
- if args[0] != 'sudo':
- args.insert(0, 'sudo')
+ kwargs.pop('omit_sudo', False)
+ sudo = kwargs.pop('sudo', False)
cwd = kwargs.pop('cwd', self.mountpoint)
stdout = kwargs.pop('stdout', StringIO())
stderr = kwargs.pop('stderr', StringIO())
+ if sudo:
+ args.insert(0, 'sudo')
+
return self.client_remote.run(args=args, cwd=cwd, timeout=timeout, stdout=stdout, stderr=stderr, **kwargs)
def run_shell_payload(self, payload, **kwargs):
i = 0
while i < timeout:
r = self.client_remote.run(args=[
- 'sudo', 'ls', os.path.join(self.hostfs_mntpt, basename)
+ 'stat', os.path.join(self.hostfs_mntpt, basename)
], check_status=False)
if r.exitstatus == 0:
log.debug("File {0} became visible from {1} after {2}s".format(
log.info("check lock on file {0}".format(basename))
self.client_remote.run(args=[
- 'sudo', 'python3', '-c', pyscript
+ 'python3', '-c', pyscript
])
def write_background(self, basename="background_file", loop=False):
def validate_test_pattern(self, filename, size):
log.info("Validating {0} bytes from {1}".format(size, filename))
+ # Use sudo because cephfs-data-scan may recreate the file with owner==root
return self.run_python(dedent("""
import zlib
path = "{path}"
""".format(
path=os.path.join(self.hostfs_mntpt, filename),
size=size
- )))
+ )), sudo=True)
def open_n_background(self, fs_path, count):
"""
def lstat(self, fs_path, follow_symlinks=False, wait=True):
return self.stat(fs_path, follow_symlinks=False, wait=True)
- def stat(self, fs_path, follow_symlinks=True, wait=True):
+ def stat(self, fs_path, follow_symlinks=True, wait=True, **kwargs):
"""
stat a file, and return the result as a dictionary like this:
{
dict([(a, getattr(s, a)) for a in attrs]),
indent=2))
""").format(stat_call=stat_call)
- proc = self._run_python(pyscript)
+ proc = self._run_python(pyscript, **kwargs)
if wait:
proc.wait()
return json.loads(proc.stdout.getvalue().strip())
proc.wait()
return int(proc.stdout.getvalue().strip())
- def ls(self, path=None):
+ def ls(self, path=None, **kwargs):
"""
Wrap ls: return a list of strings
"""
if path:
cmd.append(path)
- ls_text = self.run_shell(cmd).stdout.getvalue().strip()
+ ls_text = self.run_shell(cmd, **kwargs).stdout.getvalue().strip()
if ls_text:
return ls_text.split("\n")
# gives you [''] instead of []
return []
- def setfattr(self, path, key, val):
+ def setfattr(self, path, key, val, **kwargs):
"""
Wrap setfattr.
:param val: xattr value
:return: None
"""
- self.run_shell(["setfattr", "-n", key, "-v", val, path])
+ self.run_shell(["setfattr", "-n", key, "-v", val, path], **kwargs)
- def getfattr(self, path, attr):
+ def getfattr(self, path, attr, **kwargs):
"""
Wrap getfattr: return the values of a named xattr on one file, or
None if the attribute is not found.
:return: a string
"""
- p = self.run_shell(["getfattr", "--only-values", "-n", attr, path], wait=False)
+ p = self.run_shell(["getfattr", "--only-values", "-n", attr, path], wait=False, **kwargs)
try:
p.wait()
except CommandFailedError as e:
subvolpath = self._get_subvolume_path(self.volname, subvolume, group_name=subvolume_group)
if pool is not None:
- self.mount_a.setfattr(subvolpath, 'ceph.dir.layout.pool', pool)
+ self.mount_a.setfattr(subvolpath, 'ceph.dir.layout.pool', pool, sudo=True)
if pool_namespace is not None:
- self.mount_a.setfattr(subvolpath, 'ceph.dir.layout.pool_namespace', pool_namespace)
+ self.mount_a.setfattr(subvolpath, 'ceph.dir.layout.pool_namespace', pool_namespace, sudo=True)
def _do_subvolume_attr_update(self, subvolume, uid, gid, mode, subvolume_group=None):
subvolpath = self._get_subvolume_path(self.volname, subvolume, group_name=subvolume_group)
# mode
- self.mount_a.run_shell(['chmod', mode, subvolpath])
+ self.mount_a.run_shell(['chmod', mode, subvolpath], sudo=True)
# ownership
- self.mount_a.run_shell(['chown', uid, subvolpath])
- self.mount_a.run_shell(['chgrp', gid, subvolpath])
+ self.mount_a.run_shell(['chown', uid, subvolpath], sudo=True)
+ self.mount_a.run_shell(['chgrp', gid, subvolpath], sudo=True)
def _do_subvolume_io(self, subvolume, subvolume_group=None, create_dir=None,
number_of_files=DEFAULT_NUMBER_OF_FILES, file_size=DEFAULT_FILE_SIZE):
io_path = subvolpath
if create_dir:
io_path = os.path.join(subvolpath, create_dir)
- self.mount_a.run_shell(["mkdir", "-p", io_path])
+ self.mount_a.run_shell_payload(f"mkdir -p {io_path}")
log.debug("filling subvolume {0} with {1} files each {2}MB size under directory {3}".format(subvolume, number_of_files, file_size, io_path))
for i in range(number_of_files):
# this symlink's ownership would be changed
sym_path2 = os.path.join(dir_path, "sym.0")
- self.mount_a.run_shell(["sudo", "mkdir", dir_path], omit_sudo=False)
- self.mount_a.run_shell(["sudo", "ln", "-s", "./{}".format(reg_file), sym_path1], omit_sudo=False)
- self.mount_a.run_shell(["sudo", "ln", "-s", "./{}".format(reg_file), sym_path2], omit_sudo=False)
+ self.mount_a.run_shell(["mkdir", dir_path])
+ self.mount_a.run_shell(["ln", "-s", "./{}".format(reg_file), sym_path1])
+ self.mount_a.run_shell(["ln", "-s", "./{}".format(reg_file), sym_path2])
# flip ownership to nobody. assumption: nobody's id is 65534
- self.mount_a.run_shell(["sudo", "chown", "-h", "65534:65534", sym_path2], omit_sudo=False)
+ self.mount_a.run_shell(["chown", "-h", "65534:65534", sym_path2], sudo=True, omit_sudo=False)
def _wait_for_trash_empty(self, timeout=30):
# XXX: construct the trash dir path (note that there is no mgr
group = subvol_group if subvol_group is not None else '_nogroup'
metapath = os.path.join(".", "volumes", group, subvol_name, ".meta")
- out = self.mount_a.run_shell(['cat', metapath])
+ out = self.mount_a.run_shell(['cat', metapath], sudo=True)
lines = out.stdout.getvalue().strip().split('\n')
sv_version = -1
for line in lines:
basepath = os.path.join("volumes", group, subvol_name)
uuid_str = str(uuid.uuid4())
createpath = os.path.join(basepath, uuid_str)
- self.mount_a.run_shell(['mkdir', '-p', createpath])
+ self.mount_a.run_shell(['mkdir', '-p', createpath], sudo=True)
# create a v1 snapshot, to prevent auto upgrades
if has_snapshot:
snappath = os.path.join(createpath, ".snap", "fake")
- self.mount_a.run_shell(['mkdir', '-p', snappath])
+ self.mount_a.run_shell(['mkdir', '-p', snappath], sudo=True)
# add required xattrs to subvolume
default_pool = self.mount_a.getfattr(".", "ceph.dir.layout.pool")
- self.mount_a.setfattr(createpath, 'ceph.dir.layout.pool', default_pool)
+ self.mount_a.setfattr(createpath, 'ceph.dir.layout.pool', default_pool, sudo=True)
# create a v1 .meta file
meta_contents = "[GLOBAL]\nversion = 1\ntype = {0}\npath = {1}\nstate = {2}\n".format(subvol_type, "/" + createpath, state)
# add a fake clone source
meta_contents = meta_contents + '[source]\nvolume = fake\nsubvolume = fake\nsnapshot = fake\n'
meta_filepath1 = os.path.join(self.mount_a.mountpoint, basepath, ".meta")
- self.mount_a.client_remote.write_file(meta_filepath1,
- meta_contents, sudo=True)
+ self.mount_a.client_remote.write_file(meta_filepath1, meta_contents, sudo=True)
return createpath
def _update_fake_trash(self, subvol_name, subvol_group=None, trash_name='fake', create=True):
group = subvol_group if subvol_group is not None else '_nogroup'
trashpath = os.path.join("volumes", group, subvol_name, '.trash', trash_name)
if create:
- self.mount_a.run_shell(['mkdir', '-p', trashpath])
+ self.mount_a.run_shell(['mkdir', '-p', trashpath], sudo=True)
else:
- self.mount_a.run_shell(['rmdir', trashpath])
+ self.mount_a.run_shell(['rmdir', trashpath], sudo=True)
def _configure_guest_auth(self, guest_mount, authid, key):
"""
# create group
self._fs_cmd("subvolumegroup", "create", self.volname, group1)
- self._fs_cmd("subvolumegroup", "create", self.volname, group2, "--mode", "777")
+ self._fs_cmd("subvolumegroup", "create", self.volname, group2, f"--mode={expected_mode2}")
group1_path = self._get_subvolume_group_path(self.volname, group1)
group2_path = self._get_subvolume_group_path(self.volname, group2)
# create subvolumes
for subvolume in subvolumes:
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
self._do_subvolume_io(subvolume, number_of_files=10)
self.mount_a.umount_wait()
else:
raise RuntimeError("expected renaming subvolume incarnation out of subvolume directory to fail")
""")
- self.mount_a.run_python(rename_script.format(src=srcpath, dst=dstpath))
+ self.mount_a.run_python(rename_script.format(src=srcpath, dst=dstpath), sudo=True)
# remove subvolume
self._fs_cmd("subvolume", "rm", self.volname, subvolume)
# emulate a old-fashioned subvolume in a custom group
createpath = os.path.join(".", "volumes", group, subvolume)
- self.mount_a.run_shell(['mkdir', '-p', createpath])
+ self.mount_a.run_shell(['mkdir', '-p', createpath], sudo=True)
# add required xattrs to subvolume
default_pool = self.mount_a.getfattr(".", "ceph.dir.layout.pool")
- self.mount_a.setfattr(createpath, 'ceph.dir.layout.pool', default_pool)
+ self.mount_a.setfattr(createpath, 'ceph.dir.layout.pool', default_pool, sudo=True)
mount_path = os.path.join("/", "volumes", group, subvolume)
guest_mount.umount_wait()
# create group
- self._fs_cmd("subvolumegroup", "create", self.volname, group)
+ self._fs_cmd("subvolumegroup", "create", self.volname, group, "--mode=777")
# create subvolume in group
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--group_name", group)
# Induce partial auth update state by modifying the auth metadata file,
# and then run authorize again.
- guest_mount.run_shell(['sed', '-i', 's/false/true/g', 'volumes/{0}'.format(auth_metadata_filename)])
+ guest_mount.run_shell(['sed', '-i', 's/false/true/g', 'volumes/{0}'.format(auth_metadata_filename)], sudo=True)
# Authorize 'guestclient_1' to access the subvolume.
self._fs_cmd("subvolume", "authorize", self.volname, subvolume, guestclient_1["auth_id"],
# Induce partial auth update state by modifying the auth metadata file,
# and then run de-authorize.
- guest_mount.run_shell(['sed', '-i', 's/false/true/g', 'volumes/{0}'.format(auth_metadata_filename)])
+ guest_mount.run_shell(['sed', '-i', 's/false/true/g', 'volumes/{0}'.format(auth_metadata_filename)], sudo=True)
# Deauthorize 'guestclient_1' to access the subvolume2.
self._fs_cmd("subvolume", "deauthorize", self.volname, subvolume2, guestclient_1["auth_id"],
self.assertIn(auth_metadata_filename, guest_mount.ls("volumes"))
# Replace 'subvolumes' to 'volumes', old style auth-metadata file
- guest_mount.run_shell(['sed', '-i', 's/subvolumes/volumes/g', 'volumes/{0}'.format(auth_metadata_filename)])
+ guest_mount.run_shell(['sed', '-i', 's/subvolumes/volumes/g', 'volumes/{0}'.format(auth_metadata_filename)], sudo=True)
# Authorize 'guestclient_1' to access the subvolume2. This should transparently update 'volumes' to 'subvolumes'
self._fs_cmd("subvolume", "authorize", self.volname, subvolume2, guestclient_1["auth_id"],
self.assertIn(auth_metadata_filename, guest_mount.ls("volumes"))
# Replace 'subvolumes' to 'volumes', old style auth-metadata file
- guest_mount.run_shell(['sed', '-i', 's/subvolumes/volumes/g', 'volumes/{0}'.format(auth_metadata_filename)])
+ guest_mount.run_shell(['sed', '-i', 's/subvolumes/volumes/g', 'volumes/{0}'.format(auth_metadata_filename)], sudo=True)
# Deauthorize 'guestclient_1' to access the subvolume2. This should update 'volumes' to subvolumes'
self._fs_cmd("subvolume", "deauthorize", self.volname, subvolume2, auth_id, "--group_name", group)
# subvolumes. Mount the two subvolumes. Write data to the volumes.
for i in range(2):
# Create subvolume.
- self._fs_cmd("subvolume", "create", self.volname, subvolumes[i], "--group_name", group)
+ self._fs_cmd("subvolume", "create", self.volname, subvolumes[i], "--group_name", group, "--mode=777")
# authorize guest authID read-write access to subvolume
key = self._fs_cmd("subvolume", "authorize", self.volname, subvolumes[i], guestclient_1["auth_id"],
osize = self.DEFAULT_FILE_SIZE*1024*1024*20
# create subvolume
subvolname = self._generate_random_subvolume_name()
- self._fs_cmd("subvolume", "create", self.volname, subvolname, "--size", str(osize))
+ self._fs_cmd("subvolume", "create", self.volname, subvolname, "--size", str(osize), "--mode=777")
# make sure it exists
subvolpath = self._get_subvolume_path(self.volname, subvolname)
osize = self.DEFAULT_FILE_SIZE*1024*1024*20
# create subvolume
subvolname = self._generate_random_subvolume_name()
- self._fs_cmd("subvolume", "create", self.volname, subvolname, "--size", str(osize))
+ self._fs_cmd("subvolume", "create", self.volname, subvolname, "--size", str(osize), "--mode=777")
# make sure it exists
subvolpath = self._get_subvolume_path(self.volname, subvolname)
osize = self.DEFAULT_FILE_SIZE*1024*1024*10
# create subvolume of quota 10MB and make sure it exists
subvolname = self._generate_random_subvolume_name()
- self._fs_cmd("subvolume", "create", self.volname, subvolname, "--size", str(osize))
+ self._fs_cmd("subvolume", "create", self.volname, subvolname, "--size", str(osize), "--mode=777")
subvolpath = self._get_subvolume_path(self.volname, subvolname)
self.assertNotEqual(subvolpath, None)
# create subvolume
subvolname = self._generate_random_subvolume_name()
self._fs_cmd("subvolume", "create", self.volname, subvolname, "--size",
- str(self.DEFAULT_FILE_SIZE*1024*1024*5))
+ str(self.DEFAULT_FILE_SIZE*1024*1024*5), "--mode=777")
# make sure it exists
subvolpath = self._get_subvolume_path(self.volname, subvolname)
snapshot, snap_missing = self._generate_random_snapshot_name(2)
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# do some IO
self._do_subvolume_io(subvolume, number_of_files=1)
# Create snapshot at ancestral level
ancestral_snappath1 = os.path.join(".", "volumes", group, ".snap", "ancestral_snap_1")
ancestral_snappath2 = os.path.join(".", "volumes", group, ".snap", "ancestral_snap_2")
- self.mount_a.run_shell(['mkdir', '-p', ancestral_snappath1, ancestral_snappath2])
+ self.mount_a.run_shell(['mkdir', '-p', ancestral_snappath1, ancestral_snappath2], sudo=True)
subvolsnapshotls = json.loads(self._fs_cmd('subvolume', 'snapshot', 'ls', self.volname, subvolume, group))
self.assertEqual(len(subvolsnapshotls), snap_count)
# remove ancestral snapshots
- self.mount_a.run_shell(['rmdir', ancestral_snappath1, ancestral_snappath2])
+ self.mount_a.run_shell(['rmdir', ancestral_snappath1, ancestral_snappath2], sudo=True)
# remove snapshot
for snapshot in snapshots:
# Create snapshot at ancestral level
ancestral_snap_name = "ancestral_snap_1"
ancestral_snappath1 = os.path.join(".", "volumes", group, ".snap", ancestral_snap_name)
- self.mount_a.run_shell(['mkdir', '-p', ancestral_snappath1])
+ self.mount_a.run_shell(['mkdir', '-p', ancestral_snappath1], sudo=True)
# Validate existence of inherited snapshot
group_path = os.path.join(".", "volumes", group)
self.fail("expected snapshot info of inherited snapshot to fail")
# remove ancestral snapshots
- self.mount_a.run_shell(['rmdir', ancestral_snappath1])
+ self.mount_a.run_shell(['rmdir', ancestral_snappath1], sudo=True)
# remove subvolume
self._fs_cmd("subvolume", "rm", self.volname, subvolume, "--group_name", group)
# Create snapshot at ancestral level
ancestral_snap_name = "ancestral_snap_1"
ancestral_snappath1 = os.path.join(".", "volumes", group, ".snap", ancestral_snap_name)
- self.mount_a.run_shell(['mkdir', '-p', ancestral_snappath1])
+ self.mount_a.run_shell(['mkdir', '-p', ancestral_snappath1], sudo=True)
# Validate existence of inherited snap
group_path = os.path.join(".", "volumes", group)
self.fail("expected removing inheirted snapshot to fail")
# remove ancestral snapshots
- self.mount_a.run_shell(['rmdir', ancestral_snappath1])
+ self.mount_a.run_shell(['rmdir', ancestral_snappath1], sudo=True)
# remove subvolume
self._fs_cmd("subvolume", "rm", self.volname, subvolume, group)
# Create subvolumegroup snapshot
group_snapshot_path = os.path.join(".", "volumes", group, ".snap", group_snapshot)
- self.mount_a.run_shell(['mkdir', '-p', group_snapshot_path])
+ self.mount_a.run_shell(['mkdir', '-p', group_snapshot_path], sudo=True)
# Validate existence of subvolumegroup snapshot
self.mount_a.run_shell(['ls', group_snapshot_path])
self.fail("expected subvolume snapshot creation with same name as subvolumegroup snapshot to fail")
# remove subvolumegroup snapshot
- self.mount_a.run_shell(['rmdir', group_snapshot_path])
+ self.mount_a.run_shell(['rmdir', group_snapshot_path], sudo=True)
# remove subvolume
self._fs_cmd("subvolume", "rm", self.volname, subvolume, group)
clone = self._generate_random_clone_name()
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# do some IO
self._do_subvolume_io(subvolume, number_of_files=64)
clone = self._generate_random_clone_name()
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# do some IO
self._do_subvolume_io(subvolume, number_of_files=1)
osize = self.DEFAULT_FILE_SIZE*1024*1024*12
# create subvolume, in an isolated namespace with a specified size
- self._fs_cmd("subvolume", "create", self.volname, subvolume, "--namespace-isolated", "--size", str(osize))
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--namespace-isolated", "--size", str(osize), "--mode=777")
# do some IO
self._do_subvolume_io(subvolume, number_of_files=8)
clone = self._generate_random_clone_name()
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# do some IO
self._do_subvolume_io(subvolume, number_of_files=64)
clone = self._generate_random_clone_name()
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# do some IO
self._do_subvolume_io(subvolume, number_of_files=64)
clone = self._generate_random_clone_name()
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# do some IO
self._do_subvolume_io(subvolume, number_of_files=64)
clone = self._generate_random_clone_name()
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# store path for clone verification
subvol1_path = self._get_subvolume_path(self.volname, subvolume)
clone = self._generate_random_clone_name()
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# store path for clone verification
subvol_path = self._get_subvolume_path(self.volname, subvolume)
clone = self._generate_random_clone_name(1)
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# do some IO
self._do_subvolume_io(subvolume, number_of_files=16)
self._fs_cmd("subvolume", "rm", self.volname, subvolume, "--retain-snapshots")
# recreate subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# get and store path for clone verification
subvol2_path = self._get_subvolume_path(self.volname, subvolume)
snapshot = self._generate_random_snapshot_name()
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# store path for clone verification
subvol_path = self._get_subvolume_path(self.volname, subvolume)
clone = self._generate_random_clone_name()
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# do some IO
self._do_subvolume_io_mixed(subvolume)
clone = self._generate_random_clone_name()
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# do some IO
self._do_subvolume_io(subvolume, number_of_files=64)
clone = self._generate_random_clone_name()
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# Create a file with suid, guid bits set along with executable bit.
args = ["subvolume", "getpath", self.volname, subvolume]
clone1, clone2 = self._generate_random_clone_name(2)
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# do some IO
self._do_subvolume_io(subvolume, number_of_files=32)
clone = self._generate_random_clone_name()
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# do some IO
self._do_subvolume_io(subvolume, number_of_files=128)
clones = self._generate_random_clone_name(NR_CLONES)
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# do some IO
self._do_subvolume_io(subvolume, number_of_files=4, file_size=FILE_SIZE_MB)
self._fs_cmd("subvolumegroup", "create", self.volname, c_group)
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume, s_group)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, s_group, "--mode=777")
# do some IO
self._do_subvolume_io(subvolume, subvolume_group=s_group, number_of_files=32)
nr_files = int((pool_capacity * 0.99) / (TestVolumes.DEFAULT_FILE_SIZE * 1024 * 1024))
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# do some IO
self._do_subvolume_io(subvolume, number_of_files=nr_files)
clone = self._generate_random_clone_name()
# create subvolumes
- self._fs_cmd("subvolume", "create", self.volname, subvolume1)
- self._fs_cmd("subvolume", "create", self.volname, subvolume2)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume1, "--mode=777")
+ self._fs_cmd("subvolume", "create", self.volname, subvolume2, "--mode=777")
# do some IO
self._do_subvolume_io(subvolume1, number_of_files=32)
newid = self.fs.add_data_pool(new_pool)
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# do some IO
self._do_subvolume_io(subvolume, number_of_files=32)
group = self._generate_random_group_name()
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
# do some IO
self._do_subvolume_io(subvolume, number_of_files=32)
# emulate a old-fashioned subvolume
createpath = os.path.join(".", "volumes", "_nogroup", subvolume)
- self.mount_a.run_shell(['mkdir', '-p', createpath])
+ self.mount_a.run_shell_payload(f"mkdir -p -m 777 {createpath}", sudo=True)
# add required xattrs to subvolume
default_pool = self.mount_a.getfattr(".", "ceph.dir.layout.pool")
- self.mount_a.setfattr(createpath, 'ceph.dir.layout.pool', default_pool)
+ self.mount_a.setfattr(createpath, 'ceph.dir.layout.pool', default_pool, sudo=True)
# do some IO
self._do_subvolume_io(subvolume, number_of_files=64)
self._fs_cmd("subvolumegroup", "create", self.volname, group)
# create subvolume
- self._fs_cmd("subvolume", "create", self.volname, subvolume, group)
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, group, "--mode=777")
# do some IO
self._do_subvolume_io(subvolume, subvolume_group=group, number_of_files=32)
# emulate a old-fashioned subvolume -- one in the default group and
# the other in a custom group
createpath1 = os.path.join(".", "volumes", "_nogroup", subvolume1)
- self.mount_a.run_shell(['mkdir', '-p', createpath1])
+ self.mount_a.run_shell(['mkdir', '-p', createpath1], sudo=True)
# create group
createpath2 = os.path.join(".", "volumes", group, subvolume2)
- self.mount_a.run_shell(['mkdir', '-p', createpath2])
+ self.mount_a.run_shell(['mkdir', '-p', createpath2], sudo=True)
# this would auto-upgrade on access without anyone noticing
subvolpath1 = self._fs_cmd("subvolume", "getpath", self.volname, subvolume1)