Commit bae8f6d7 authored by Cedric CAFFY's avatar Cedric CAFFY
Browse files

The repack buffer URL option is not mandatory anymore

If this option is used, then the bufferURL provided to the repack request will be the one specified. Otherwise, the repack buffer URL will be the one from the cta-frontend-xrootd.conf file
parent c9eabc0c
......@@ -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 }},
......
......@@ -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;
......
......@@ -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
......
......@@ -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);
......
......@@ -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
......
......@@ -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
#
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment