From d69e923b3469b4f166d825d963829e602b54a41c Mon Sep 17 00:00:00 2001
From: Julien Leduc <julien.leduc@cern.ch>
Date: Fri, 8 Feb 2019 09:33:41 +0100
Subject: [PATCH] Adding an indirection level in the directory structure to
 allow a dedicated PV for quarkdb

---
 .../ctafrontend/cc7/opt/run/bin/start_quarkdb.sh  | 13 ++++++++++++-
 .../orchestration/eos-config-quarkdb.yaml         | 15 +++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 continuousintegration/orchestration/eos-config-quarkdb.yaml

diff --git a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/start_quarkdb.sh b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/start_quarkdb.sh
index 3cb8b21d9f..2c9d873a04 100755
--- a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/start_quarkdb.sh
+++ b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/start_quarkdb.sh
@@ -1,8 +1,19 @@
 #!/bin/bash
 
+# I need 2 level of directories for quarkdb:
+# /var/lib/<possible PV mount point>/<directory owned by xrootd>
+# this way I can either use:
+# - a PV that mounts a dedicated SSD for long tests
+# - a directory in the container for shorter ones
+
 QUARKDB_CONFIG=/etc/config/eos/xrootd-quarkdb.cfg
 
-QUARKDB_DIRECTORY=$(cat ${QUARKDB_CONFIG} | grep redis.database | sed -e 's/.*redis.database\ \+//')
+QUARKDB_DIRECTORY=$(cat ${QUARKDB_CONFIG} | grep redis.database | sed -e 's/.*redis.database\ \+//;s%/\ *$%%')
+
+QUARKDB_SUBDIRECTORY=$(echo ${QUARKDB_DIRECTORY} | sed -e 's%/[^/]\+/*\ *$%%')
+
+# make sure the first level of directory exists if there is no mounted PV
+mkdir -p ${QUARKDB_SUBDIRECTORY}
 
 yum-config-manager --enable eos-quarkdb
 
diff --git a/continuousintegration/orchestration/eos-config-quarkdb.yaml b/continuousintegration/orchestration/eos-config-quarkdb.yaml
new file mode 100644
index 0000000000..d393a55a8f
--- /dev/null
+++ b/continuousintegration/orchestration/eos-config-quarkdb.yaml
@@ -0,0 +1,15 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: eos-config
+  labels:
+    config: eos
+data:
+  xrd.cf.mgm: |
+    mgmofs.nslib /usr/lib64/libEosNsQuarkdb.so
+    mgmofs.qdbcluster localhost:7777
+  xrootd-quarkdb.cfg: |
+    xrd.port 7777
+    xrd.protocol redis:7777 /usr/lib64/libXrdQuarkDB.so
+    redis.mode standalone
+    redis.database /var/lib/quarkdb/quarkdb1
-- 
GitLab