diff --git a/cmdline/CtaAdminCmdParse.hpp b/cmdline/CtaAdminCmdParse.hpp index ae2528e6fe7b28ac5b70d61b2b8c888f2210e9cb..ef521e133b1d7e91a56a5cc22614314cf26797db 100644 --- a/cmdline/CtaAdminCmdParse.hpp +++ b/cmdline/CtaAdminCmdParse.hpp @@ -488,7 +488,7 @@ const std::map<cmd_key_t, cmd_val_t> cmdOptions = { {{ AdminCmd::CMD_MOUNTPOLICY, AdminCmd::SUBCMD_LS }, { }}, /*----------------------------------------------------------------------------------------------------*/ {{ AdminCmd::CMD_REPACK, AdminCmd::SUBCMD_ADD }, - { opt_vid.optional(), opt_vidfile.optional(), opt_bufferurl, opt_justmove.optional(), opt_justaddcopies.optional() }}, + { opt_vid.optional(), opt_vidfile.optional(), opt_bufferurl.optional(), opt_justmove.optional(), opt_justaddcopies.optional() }}, {{ AdminCmd::CMD_REPACK, AdminCmd::SUBCMD_RM }, { opt_vid }}, {{ AdminCmd::CMD_REPACK, AdminCmd::SUBCMD_LS }, { opt_vid.optional() }}, {{ AdminCmd::CMD_REPACK, AdminCmd::SUBCMD_ERR }, { opt_vid }}, diff --git a/xroot_plugins/XrdSsiCtaRequestMessage.cpp b/xroot_plugins/XrdSsiCtaRequestMessage.cpp index 3452ad4f47e6d5917912e3be387277fc670acb61..75f4d2ac421290190dfc4cc5ce1a8e81538817c2 100644 --- a/xroot_plugins/XrdSsiCtaRequestMessage.cpp +++ b/xroot_plugins/XrdSsiCtaRequestMessage.cpp @@ -1070,10 +1070,19 @@ void RequestMessage::processRepack_Add(cta::xrd::Response &response) } auto buff = getOptional(OptionString::BUFFERURL); - if (buff) + if (buff){ + //The buffer is provided by the user bufferURL = buff.value(); - else - throw cta::exception::UserError("Must specify the buffer URL using --bufferurl option."); + } + else { + //Buffer is not provided by the user, try to get the one from the configuration file + if(m_repackBufferURL){ + bufferURL = m_repackBufferURL.value(); + } else { + //Buffer is neither provided by the user, neither provided by the frontend configuration file, exception + throw cta::exception::UserError("Must specify the buffer URL using --bufferurl option or using the frontend configuration file."); + } + } // Expand, repack, or both ? cta::common::dataStructures::RepackInfo::Type type; diff --git a/xroot_plugins/XrdSsiCtaRequestMessage.hpp b/xroot_plugins/XrdSsiCtaRequestMessage.hpp index 0d08dbcfc1250fc9ebaf870864fbac3108dce032..89eb5e68a24ce177723d3b5508720ec0bb270726 100644 --- a/xroot_plugins/XrdSsiCtaRequestMessage.hpp +++ b/xroot_plugins/XrdSsiCtaRequestMessage.hpp @@ -36,6 +36,7 @@ public: m_scheddb (service->getSchedDb()), m_catalogue(service->getCatalogue()), m_scheduler(service->getScheduler()), + m_repackBufferURL(service->getRepackBufferURL()), m_lc (service->getLogContext()) { m_cliIdentity.username = client.name; m_cliIdentity.host = client.host; @@ -264,6 +265,7 @@ private: cta::OStoreDBWithAgent &m_scheddb; //!< Reference to CTA ObjectStore cta::catalogue::Catalogue &m_catalogue; //!< Reference to CTA Catalogue cta::Scheduler &m_scheduler; //!< Reference to CTA Scheduler + optional<std::string> m_repackBufferURL; //!< Repack buffer URL cta::log::LogContext m_lc; //!< CTA Log Context std::map<cta::admin::OptionBoolean::Key, bool> m_option_bool; //!< Boolean options std::map<cta::admin::OptionUInt64::Key, uint64_t> m_option_uint64; //!< UInt64 options diff --git a/xroot_plugins/XrdSsiCtaServiceProvider.cpp b/xroot_plugins/XrdSsiCtaServiceProvider.cpp index f490969036fcacb7fcfaefbabc7f24ed04a5988e..e8729af8e79509d7af0a654fb7d908341c125f48 100644 --- a/xroot_plugins/XrdSsiCtaServiceProvider.cpp +++ b/xroot_plugins/XrdSsiCtaServiceProvider.cpp @@ -147,6 +147,12 @@ void XrdSsiCtaServiceProvider::ExceptionThrowingInit(XrdSsiLogger *logP, XrdSsiC } catch (std::bad_cast &) { // If not, never mind } + + //Initialize the repack buffer URL + auto repackBufferURLConf = config.getOptionValueStr("cta.repack.repack_buffer_url"); + if(repackBufferURLConf.first){ + m_repackBufferURL = repackBufferURLConf.second; + } // Start the heartbeat thread for the agent object. The thread is guaranteed to have started before we call the unique_ptr deleter auto aht = new cta::objectstore::AgentHeartbeatThread(m_backendPopulator->getAgentReference(), *m_backend, *m_log); diff --git a/xroot_plugins/XrdSsiCtaServiceProvider.hpp b/xroot_plugins/XrdSsiCtaServiceProvider.hpp index 34ba96f57d0590694e725d2a78e62b4e8a35c4bc..4f200a2082bb2fc6aa51cb1677f471677f8c4c55 100644 --- a/xroot_plugins/XrdSsiCtaServiceProvider.hpp +++ b/xroot_plugins/XrdSsiCtaServiceProvider.hpp @@ -103,6 +103,8 @@ public: * Get the log context for this Service */ cta::log::LogContext getLogContext() const { return cta::log::LogContext(*m_log); } + + cta::optional<std::string> getRepackBufferURL() const { return m_repackBufferURL; } private: /*! @@ -138,6 +140,7 @@ private: std::unique_ptr<cta::catalogue::Catalogue> m_catalogue; //!< CTA catalogue of tapes and tape files std::unique_ptr<cta::Scheduler> m_scheduler; //!< The scheduler std::unique_ptr<cta::log::Logger> m_log; //!< The logger + cta::optional<std::string> m_repackBufferURL; //!< The repack buffer URL UniquePtrAgentHeartbeatThread m_agentHeartbeat; //!< Agent heartbeat thread static constexpr const char* const LOG_SUFFIX = "XrdSsiCtaServiceProvider"; //!< Identifier for log messages diff --git a/xroot_plugins/cta-frontend-xrootd.conf b/xroot_plugins/cta-frontend-xrootd.conf index 25159c3b7727f6d02b2d177545716d8905a0234f..2aaac02d3c3168e912fb73dabe6935f26d7e8e53 100644 --- a/xroot_plugins/cta-frontend-xrootd.conf +++ b/xroot_plugins/cta-frontend-xrootd.conf @@ -17,6 +17,9 @@ cta.log.url file:/var/log/cta/cta-frontend.log # CTA XRootD SSI/Protobuf log level cta.log.ssi warning +# CTA Repack buffer URL +cta.repack.repack_buffer_url root://ctaeos//eos/ctaeos/repack + # # XRootD/SSI options #