def is_mounted(self):
raise NotImplementedError()
- def mount(self):
+ def mount(self, mount_path=None):
raise NotImplementedError()
def umount(self):
def wait_until_mounted(self):
raise NotImplementedError()
+ def get_keyring_path(self):
+ return '/etc/ceph/ceph.client.{id}.keyring'.format(id=self.client_id)
+
+ @property
+ def config_path(self):
+ """
+ Path to ceph.conf: override this if you're not a normal systemwide ceph install
+ :return: stringv
+ """
+ return "/etc/ceph/ceph.conf"
+
@contextmanager
def mounted(self):
"""
def run_python(self, pyscript):
p = self._run_python(pyscript)
p.wait()
+ return p.stdout.getvalue().strip()
def run_shell(self, args, wait=True):
args = ["cd", self.mountpoint, run.Raw('&&'), "sudo"] + args
shutil.copy(path, tmpfile)
return tmpfile
+ def put_file(self, src, dst, sudo=False):
+ assert sudo is False
+ shutil.copy(src, dst)
+
def run(self, args, check_status=True, wait=True,
stdout=None, stderr=None, cwd=None, stdin=None,
logger=None, label=None):
super(LocalFuseMount, self).__init__(None, test_dir, client_id, LocalRemote())
self.mountpoint = mount_point
+ @property
+ def config_path(self):
+ return "./ceph.conf"
+
+ def get_keyring_path(self):
+ # This is going to end up in a config file, so use an absolute path
+ # to avoid assumptions about daemons' pwd
+ return os.path.abspath("./client.{0}.keyring".format(self.client_id))
+
def run_shell(self, args, wait=True):
# FIXME maybe should add a pwd arg to teuthology.orchestra so that
# the "cd foo && bar" shenanigans isn't needed to begin with and
if self.is_mounted():
super(LocalFuseMount, self).umount()
- def mount(self):
+ def mount(self, mount_path=None):
self.client_remote.run(
args=[
'mkdir',
if os.getuid() != 0:
prefix += ["--client-die-on-failed-remount=false"]
+ if mount_path is not None:
+ prefix += ["--client_mountpoint={0}".format(mount_path)]
+
self._proc = self.client_remote.run(args=
prefix + [
"--name",
for subsys, kvs in self._conf.items():
existing_str += "\n[{0}]\n".format(subsys)
for key, val in kvs.items():
- # comment out any existing instances
- if key in existing_str:
- existing_str = existing_str.replace(key, "#{0}".format(key))
+ # Comment out existing instance if it exists
+ log.info("Searching for existing instance {0}/{1}".format(
+ key, subsys
+ ))
+ existing_section = re.search("^\[{0}\]$([\n]|[^\[])+".format(
+ subsys
+ ), existing_str, re.MULTILINE)
+
+ if existing_section:
+ section_str = existing_str[existing_section.start():existing_section.end()]
+ existing_val = re.search("^\s*[^#]({0}) =".format(key), section_str, re.MULTILINE)
+ if existing_val:
+ start = existing_section.start() + existing_val.start(1)
+ log.info("Found string to replace at {0}".format(
+ start
+ ))
+ existing_str = existing_str[0:start] + "#" + existing_str[start:]
existing_str += "{0} = {1}\n".format(key, val)
test_dir = tempfile.mkdtemp()
- # Run with two clients because some tests require the second one
- clients = ["0", "1"]
+ # Create as many of these as the biggest test requires
+ clients = ["0", "1", "2"]
remote = LocalRemote()