From fd69c3d4f62a49e4ba77a30400498c2b17283a31 Mon Sep 17 00:00:00 2001
From: Victor Kotlyar <Victor.Kotlyar@cern.ch>
Date: Tue, 5 Sep 2017 14:43:24 +0200
Subject: [PATCH] Unify the config files name for the object store backend.

For cta-taped.conf and cta-frontend.conf use the same parameter
ObjectStore BackendPath .......
---
 .../docker/ctafrontend/cc7/opt/run/bin/taped.sh    | 10 +---------
 tapeserver/cta-tapedSystemtests.cpp                |  2 +-
 tapeserver/daemon/DriveHandler.cpp                 |  4 ++--
 tapeserver/daemon/GarbageCollectorHandler.cpp      |  2 +-
 tapeserver/daemon/TapedConfiguration.cpp           |  4 ++--
 tapeserver/daemon/TapedConfiguration.hpp           |  4 ++--
 tapeserver/daemon/TapedConfigurationTests.cpp      | 14 +++++++-------
 7 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/taped.sh b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/taped.sh
index 309402867b..3cd26eb4c5 100755
--- a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/taped.sh
+++ b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/taped.sh
@@ -30,18 +30,10 @@ echo "Configuring database"
 
 echo ${DATABASEURL} >/etc/cta/cta_catalogue_db.conf
 
-# cta-tapserverd setup 
-# to be drop later
-  echo "${tpconfig}" > /etc/castor/TPCONFIG
-  echo "TapeServer ObjectStoreBackendPath $OBJECTSTOREURL" >/etc/castor/castor.conf
-  echo "TapeServer BufSize 5242880" >>/etc/castor/castor.conf
-  echo "TapeServer NbBufs 10" >>/etc/castor/castor.conf
-  echo "TapeServer EOSRemoteHostAndPort ${eoshost}" >>/etc/castor/castor.conf
-
 # cta-taped setup
   echo "taped BufferCount 10" > /etc/cta/cta-taped.conf
   echo "taped MountCriteria 2000000, 5" >> /etc/cta/cta-taped.conf 
-  echo "general ObjectStoreURL $OBJECTSTOREURL" >> /etc/cta/cta-taped.conf
+  echo "ObjectStore BackendPath $OBJECTSTOREURL" >> /etc/cta/cta-taped.conf
   echo "${tpconfig}" > /etc/cta/TPCONFIG
 
 
diff --git a/tapeserver/cta-tapedSystemtests.cpp b/tapeserver/cta-tapedSystemtests.cpp
index 22962ac9d3..6f544c5d06 100644
--- a/tapeserver/cta-tapedSystemtests.cpp
+++ b/tapeserver/cta-tapedSystemtests.cpp
@@ -53,7 +53,7 @@ TEST(cta_taped, InvocationTests) {
     unitTests::TempFile ctaConf, tpConfig;
     ctaConf.stringAppend(
       "#A good enough configuration file for taped\n"
-      "general ObjectStoreURL vfsObjectStore:///tmp/dir\n"
+      "ObjectStore BackendPath vfsObjectStore:///tmp/dir\n"
       "general FileCatalogURL sqliteFileCatalog:///tmp/dir2\n"
       "taped BufferCount 1\n"
       "taped TpConfigPath ");
diff --git a/tapeserver/daemon/DriveHandler.cpp b/tapeserver/daemon/DriveHandler.cpp
index 655b310db4..1ac7fa6f42 100644
--- a/tapeserver/daemon/DriveHandler.cpp
+++ b/tapeserver/daemon/DriveHandler.cpp
@@ -868,12 +868,12 @@ int DriveHandler::runChild() {
   auto &lc=m_processManager.logContext();
   {
     log::ScopedParamContainer params(lc);
-    params.add("objectStoreURL", m_tapedConfig.objectStoreURL.value());
+    params.add("backendPath", m_tapedConfig.backendPath.value());
     lc.log(log::DEBUG, "In DriveHandler::runChild(): will connect to object store backend.");
   }
   // Before anything, we need to check we have access to the scheduler's central storages.
   std::unique_ptr<cta::objectstore::Backend> backend(
-    cta::objectstore::BackendFactory::createBackend(m_tapedConfig.objectStoreURL.value()).release());
+    cta::objectstore::BackendFactory::createBackend(m_tapedConfig.backendPath.value()).release());
   // If the backend is a VFS, make sure we don't delete it on exit.
   // If not, nevermind.
   try {
diff --git a/tapeserver/daemon/GarbageCollectorHandler.cpp b/tapeserver/daemon/GarbageCollectorHandler.cpp
index ceacf31181..b83c84fbac 100644
--- a/tapeserver/daemon/GarbageCollectorHandler.cpp
+++ b/tapeserver/daemon/GarbageCollectorHandler.cpp
@@ -254,7 +254,7 @@ int GarbageCollectorHandler::runChild() {
   // fail likewise, so we just wait for shutdown signal (no feedback to main
   // process).
   std::unique_ptr<cta::objectstore::Backend> backend(
-    cta::objectstore::BackendFactory::createBackend(m_tapedConfig.objectStoreURL.value()).release());
+    cta::objectstore::BackendFactory::createBackend(m_tapedConfig.backendPath.value()).release());
   // If the backend is a VFS, make sure we don't delete it on exit.
   // If not, nevermind.
   try {
diff --git a/tapeserver/daemon/TapedConfiguration.cpp b/tapeserver/daemon/TapedConfiguration.cpp
index 6ab1b14023..fe11ac9d57 100644
--- a/tapeserver/daemon/TapedConfiguration.cpp
+++ b/tapeserver/daemon/TapedConfiguration.cpp
@@ -57,7 +57,7 @@ TapedConfiguration TapedConfiguration::createFromCtaConf(
   ret.wdNoBlockMoveMaxSecs.setFromConfigurationFile(cf, generalConfigPath);
   ret.wdScheduleMaxSecs.setFromConfigurationFile(cf, generalConfigPath);
   // The central storage access configuration
-  ret.objectStoreURL.setFromConfigurationFile(cf, generalConfigPath);
+  ret.backendPath.setFromConfigurationFile(cf, generalConfigPath);
   ret.fileCatalogConfigFile.setFromConfigurationFile(cf, generalConfigPath);
   // Extract drive list from tpconfig + parsed config file
   ret.driveConfigs = Tpconfig::parseFile(ret.tpConfigPath.value());
@@ -82,7 +82,7 @@ TapedConfiguration TapedConfiguration::createFromCtaConf(
   ret.wdNoBlockMoveMaxSecs.log(log);
   ret.wdScheduleMaxSecs.log(log);
   
-  ret.objectStoreURL.log(log);
+  ret.backendPath.log(log);
   ret.fileCatalogConfigFile.log(log);
   
   for (auto & i:ret.driveConfigs) {
diff --git a/tapeserver/daemon/TapedConfiguration.hpp b/tapeserver/daemon/TapedConfiguration.hpp
index f1394fdfb9..577e163c72 100644
--- a/tapeserver/daemon/TapedConfiguration.hpp
+++ b/tapeserver/daemon/TapedConfiguration.hpp
@@ -105,8 +105,8 @@ struct TapedConfiguration {
   // The central storage access configuration
   //---------------------------------------------------------------------------- 
   /// URL of the object store.
-  SourcedParameter<std::string> objectStoreURL{
-    "general", "ObjectStoreURL"};
+  SourcedParameter<std::string> backendPath{
+    "ObjectStore", "BackendPath"};
   /// Path to the file catalog config file
   SourcedParameter<std::string> fileCatalogConfigFile{
     "general", "FileCatalogConfigFile", "/etc/cta/cta_catalogue_db.conf", "Compile time default"};
diff --git a/tapeserver/daemon/TapedConfigurationTests.cpp b/tapeserver/daemon/TapedConfigurationTests.cpp
index f26321799f..4da6a6733f 100644
--- a/tapeserver/daemon/TapedConfigurationTests.cpp
+++ b/tapeserver/daemon/TapedConfigurationTests.cpp
@@ -32,7 +32,7 @@ TEST(cta_Daemon, TapedConfiguration) {
   );
   completeConfFile.stringFill(
   "#A good enough configuration file for taped\n"
-  "general ObjectStoreURL vfsObjectStore:///tmp/dir\n"
+  "ObjectStore BackendPath vfsObjectStore:///tmp/dir\n"
   "general FileCatalogConfigFile /etc/cta/catalog.conf\n"
   "taped BufferCount 1\n"
   "taped TpConfigPath ");
@@ -42,8 +42,8 @@ TEST(cta_Daemon, TapedConfiguration) {
       cta::tape::daemon::SourcedParameter<uint64_t>::MandatoryParameterNotDefined);
   auto completeConfig = 
     cta::tape::daemon::TapedConfiguration::createFromCtaConf(completeConfFile.path());
-  ASSERT_EQ(completeConfFile.path()+":2", completeConfig.objectStoreURL.source());
-  ASSERT_EQ("vfsObjectStore:///tmp/dir", completeConfig.objectStoreURL.value());
+  ASSERT_EQ(completeConfFile.path()+":2", completeConfig.backendPath.source());
+  ASSERT_EQ("vfsObjectStore:///tmp/dir", completeConfig.backendPath.value());
   ASSERT_EQ(completeConfFile.path()+":3", completeConfig.fileCatalogConfigFile.source());
   ASSERT_EQ("/etc/cta/catalog.conf", completeConfig.fileCatalogConfigFile.value());
 }
@@ -53,7 +53,7 @@ TEST(cta_Daemon, TapedConfigurationFull) {
   TempFile completeConfFile;
   completeConfFile.stringFill(
   "#A good enough configuration file for taped\n"
-  "general ObjectStoreURL vfsObjectStore:///tmp/dir\n"
+  "ObjectStore BackendPath vfsObjectStore:///tmp/dir\n"
   "general FileCatalogConfigFile /etc/cta/catalog.conf\n"
   "taped ArchiveFetchBytesFiles 1,2\n"
   "taped ArchiveFlushBytesFiles              3 , 4 \n"
@@ -68,8 +68,8 @@ TEST(cta_Daemon, TapedConfigurationFull) {
   // The log parameter can be uncommented to inspect the result on the output.
   auto completeConfig = 
     cta::tape::daemon::TapedConfiguration::createFromCtaConf(completeConfFile.path()/*, log*/);
-  ASSERT_EQ(completeConfFile.path()+":2", completeConfig.objectStoreURL.source());
-  ASSERT_EQ("vfsObjectStore:///tmp/dir", completeConfig.objectStoreURL.value());
+  ASSERT_EQ(completeConfFile.path()+":2", completeConfig.backendPath.source());
+  ASSERT_EQ("vfsObjectStore:///tmp/dir", completeConfig.backendPath.value());
   ASSERT_EQ(completeConfFile.path()+":3", completeConfig.fileCatalogConfigFile.source());
   ASSERT_EQ("/etc/cta/catalog.conf", completeConfig.fileCatalogConfigFile.value());
   ASSERT_EQ(1, completeConfig.archiveFetchBytesFiles.value().maxBytes);
@@ -82,4 +82,4 @@ TEST(cta_Daemon, TapedConfigurationFull) {
   ASSERT_EQ("/dev/tape1", completeConfig.driveConfigs.at("drive1").value().devFilename);
 }
 
-} // namespace unitTests
\ No newline at end of file
+} // namespace unitTests
-- 
GitLab