from StringIO import StringIO
import json
import logging
+import os
import time
import datetime
import re
# FIXME get the metadata pool name from mdsmap instead of hardcoding
self.client_remote.run(args=[
- 'sudo', self._prefix + 'rados', '-p', 'metadata', 'get', object_id, temp_bin_path
+ 'sudo', os.path.join(self._prefix, 'rados'), '-p', 'metadata', 'get', object_id, temp_bin_path
])
stdout = StringIO()
self.client_remote.run(args=[
- 'sudo', self._prefix + 'ceph-dencoder', 'type', object_type, 'import', temp_bin_path, 'decode', 'dump_json'
+ 'sudo', os.path.join(self._prefix, 'ceph-dencoder'), 'type', object_type, 'import', temp_bin_path, 'decode', 'dump_json'
], stdout=stdout)
dump_json = stdout.getvalue().strip()
try:
obj_name = "{0:x}.00000000".format(ino_no)
args = [
- self._prefix + "rados", "-p", pool, "getxattr", obj_name, xattr_name
+ os.path.join(self._prefix, "rados"), "-p", pool, "getxattr", obj_name, xattr_name
]
try:
proc = remote.run(
data = proc.stdout.getvalue()
p = remote.run(
- args=[self._prefix + "ceph-dencoder", "type", type, "import", "-", "decode", "dump_json"],
+ args=[os.path.join(self._prefix, "ceph-dencoder"), "type", type, "import", "-", "decode", "dump_json"],
stdout=StringIO(),
stdin=data
)
# NB we could alternatively use librados pybindings for this, but it's a one-liner
# using the `rados` CLI
- args = [self._prefix + "rados", "-p", pool] + args
+ args = [os.path.join(self._prefix, "rados"), "-p", pool] + args
p = remote.run(
args=args,
stdin=stdin_data,
# the objecter log level (unlikely to be interesting here)
# and does not set the mds log level (very interesting here)
if quiet:
- base_args = [self._prefix + tool, '--debug-mds=1', '--debug-objecter=1']
+ base_args = [os.path.join(self._prefix, tool), '--debug-mds=1', '--debug-objecter=1']
else:
- base_args = [self._prefix + tool, '--debug-mds=4', '--debug-objecter=1']
+ base_args = [os.path.join(self._prefix, tool), '--debug-mds=4', '--debug-objecter=1']
if rank is not None:
base_args.extend(["--rank", "%d" % rank])
log.addHandler(handler)
log.setLevel(logging.INFO)
+if os.path.exists("./CMakeCache.txt"):
+ # Running in build dir of a cmake build
+ BIN_PREFIX = "./src"
+else:
+ # Running in src/ of an autotools build
+ BIN_PREFIX = "./"
+
class LocalRemoteProcess(object):
def __init__(self, args, subproc, check_status, stdout, stderr):
if self._get_pid() is not None:
self.stop()
- self.controller.run(["./ceph-{0}".format(self.daemon_type), "-i", self.daemon_id])
+ self.controller.run([os.path.join(BIN_PREFIX, "./ceph-{0}".format(self.daemon_type)), "-i", self.daemon_id])
def safe_kill(pid):
@property
def _prefix(self):
- return "./"
+ return BIN_PREFIX
def _asok_path(self):
# In teuthology, the asok is named after the PID of the ceph-fuse process, because it's
pre_mount_conns = list_connections()
log.info("Pre-mount connections: {0}".format(pre_mount_conns))
- prefix = ["./ceph-fuse"]
+ prefix = [os.path.join(BIN_PREFIX, "ceph-fuse")]
if os.getuid() != 0:
prefix += ["--client-die-on-failed-remount=false"]
@property
def _prefix(self):
- return "./"
+ return BIN_PREFIX
def set_clients_block(self, blocked, mds_id=None):
raise NotImplementedError()