]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
tasks/cephfs: updates for cmake environ
authorJohn Spray <john.spray@redhat.com>
Thu, 6 Aug 2015 09:20:34 +0000 (10:20 +0100)
committerJohn Spray <john.spray@redhat.com>
Fri, 2 Oct 2015 16:41:17 +0000 (17:41 +0100)
Signed-off-by: John Spray <john.spray@redhat.com>
tasks/cephfs/filesystem.py
tasks/cephfs/vstart_runner.py

index f32a12f9ebb96db81ba320fb4c9923f30996c80d..11db39a13783eb1d10bc93b290f422c926fe0c64 100644 (file)
@@ -2,6 +2,7 @@
 from StringIO import StringIO
 import json
 import logging
+import os
 import time
 import datetime
 import re
@@ -344,12 +345,12 @@ class Filesystem(object):
 
         # 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:
@@ -510,7 +511,7 @@ class Filesystem(object):
         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(
@@ -523,7 +524,7 @@ class Filesystem(object):
         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
         )
@@ -637,7 +638,7 @@ class Filesystem(object):
 
         # 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,
@@ -711,9 +712,9 @@ class Filesystem(object):
         # 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])
index c77da3665fc7ea9f7c9533e33f14daefd26ebe1b..cd73871933fccd8aed3db03ec39e6ad8d47fc0df 100644 (file)
@@ -37,6 +37,13 @@ handler.setFormatter(formatter)
 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):
@@ -207,7 +214,7 @@ class LocalDaemon(object):
         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):
@@ -295,7 +302,7 @@ class LocalFuseMount(FuseMount):
 
     @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
@@ -344,7 +351,7 @@ class LocalFuseMount(FuseMount):
         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"]
 
@@ -497,7 +504,7 @@ class LocalFilesystem(Filesystem):
 
     @property
     def _prefix(self):
-        return "./"
+        return BIN_PREFIX
 
     def set_clients_block(self, blocked, mds_id=None):
         raise NotImplementedError()