diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 958e20f9619f40bcc35caa49d3d3240e53c505b5..a0485ca089e9cda10a9c1962fa478d3814360e9c 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -33,6 +33,7 @@ The following manual pages have been updated: ### Features - cta/CTA#979 - Document configuration options of daemons and command-line tools - cta/CTA#1252 - Adds Liquibase changelog files for PostgreSQL +- cta/CTA#3 - Implement listing of DISABLED libraries - cta/CTA#64 - Adds support for the OSM Tape Label format to the CTA ### Bug fixes - cta/CTA#947 - cta-taped should log the FST being used for a data transfer @@ -40,6 +41,7 @@ The following manual pages have been updated: - cta/CTA#1269 - cta-restore-deleted-files injects wrong diskFileId in CTA Catalogue - cta/CTA#1276 - Some configuration files should be renamed from `.conf` to `.conf.example` - cta/CTA#1278 - Add support for reading multiple tape formats by the ReadtpCmd command +- cta/CTA#28 - Do NOT allow capacity change of a cartridge if there a still files registered on that tape ### Continuous Integration ### Building and Packaging diff --git a/cmdline/CtaAdminCmdParse.hpp b/cmdline/CtaAdminCmdParse.hpp index fad0132734d09fda8e6f5423da4f5f8abd0edbf0..4d1c79959365df40bae435980af33220258263c4 100644 --- a/cmdline/CtaAdminCmdParse.hpp +++ b/cmdline/CtaAdminCmdParse.hpp @@ -504,6 +504,7 @@ const Option opt_justretrieve { Option::OPT_FLAG, "--justretrieve", const Option opt_log { Option::OPT_FLAG, "--log", "-l", "" }; const Option opt_logicallibrary { Option::OPT_STR, "--logicallibrary", "-l", " <logical_library_name>" }; const Option opt_logicallibrary_alias { Option::OPT_STR, "--name", "-n", " <logical_library_name>", "--logicallibrary" }; +const Option opt_logicallibrary_disabled { Option::OPT_BOOL, "--disabled", "-d", " <\"true\" or \"false\">" }; const Option opt_lookupns { Option::OPT_FLAG, "--lookupnamespace", "-l", "" }; const Option opt_maxfilesize { Option::OPT_UINT, "--maxfilesize", "--mfs", " <maximum_file_size>" }; const Option opt_maxlpos { Option::OPT_UINT, "--maxlpos", "--maxl", " <maximum_longitudinal_position>" }; @@ -595,7 +596,7 @@ const std::map<cmd_key_t, cmd_val_t> cmdOptions = { {{ AdminCmd::CMD_LOGICALLIBRARY, AdminCmd::SUBCMD_CH }, { opt_logicallibrary_alias, opt_disabled.optional(), opt_comment.optional(), opt_disabledreason.optional() }}, {{ AdminCmd::CMD_LOGICALLIBRARY, AdminCmd::SUBCMD_RM }, { opt_logicallibrary_alias }}, - {{ AdminCmd::CMD_LOGICALLIBRARY, AdminCmd::SUBCMD_LS }, { }}, + {{ AdminCmd::CMD_LOGICALLIBRARY, AdminCmd::SUBCMD_LS }, { opt_logicallibrary_disabled.optional()}}, /*----------------------------------------------------------------------------------------------------*/ {{ AdminCmd::CMD_MEDIATYPE, AdminCmd::SUBCMD_ADD }, { opt_mediatype_alias, opt_cartridge, opt_capacity, opt_primarydensitycode.optional(), opt_secondarydensitycode.optional(), opt_number_of_wraps.optional(), opt_minlpos.optional(), opt_maxlpos.optional(), opt_comment }}, diff --git a/xroot_plugins/XrdCtaLogicalLibraryLs.hpp b/xroot_plugins/XrdCtaLogicalLibraryLs.hpp index e016847104373e06f4be51abf86d0049cf935920..fdd1e666b4681e59722422c2ecf511dc7b4035dd 100644 --- a/xroot_plugins/XrdCtaLogicalLibraryLs.hpp +++ b/xroot_plugins/XrdCtaLogicalLibraryLs.hpp @@ -17,8 +17,10 @@ #pragma once -#include <xroot_plugins/XrdCtaStream.hpp> -#include <xroot_plugins/XrdSsiCtaRequestMessage.hpp> +#include <list> + +#include "xroot_plugins/XrdCtaStream.hpp" +#include "xroot_plugins/XrdSsiCtaRequestMessage.hpp" namespace cta { namespace xrd { @@ -34,44 +36,54 @@ public: * @param[in] requestMsg RequestMessage containing command-line arguments * @param[in] catalogue CTA Catalogue * @param[in] scheduler CTA Scheduler + * @param[in] disabled Logical Library disable status */ - LogicalLibraryLsStream(const RequestMessage &requestMsg, cta::catalogue::Catalogue &catalogue, cta::Scheduler &scheduler); + LogicalLibraryLsStream(const RequestMessage &requestMsg, cta::catalogue::Catalogue &catalogue, + cta::Scheduler &scheduler, const std::optional<bool>& disabled); private: /*! * Can we close the stream? */ - virtual bool isDone() const { + bool isDone() const override { return m_logicalLibraryList.empty(); } /*! * Fill the buffer */ - virtual int fillBuffer(XrdSsiPb::OStreamBuffer<Data> *streambuf); + int fillBuffer(XrdSsiPb::OStreamBuffer<Data> *streambuf) override; - std::list<cta::common::dataStructures::LogicalLibrary> m_logicalLibraryList; //!< List of logical libraries from the catalogue + // List of logical libraries from the catalogue + std::list<cta::common::dataStructures::LogicalLibrary> m_logicalLibraryList; + const std::optional<bool> m_disabled; static constexpr const char* const LOG_SUFFIX = "LogicalLibraryLsStream"; //!< Identifier for log messages }; -LogicalLibraryLsStream::LogicalLibraryLsStream(const RequestMessage &requestMsg, cta::catalogue::Catalogue &catalogue, cta::Scheduler &scheduler) : +LogicalLibraryLsStream::LogicalLibraryLsStream(const RequestMessage &requestMsg, cta::catalogue::Catalogue &catalogue, + cta::Scheduler &scheduler, const std::optional<bool>& disabled) : XrdCtaStream(catalogue, scheduler), - m_logicalLibraryList(catalogue.getLogicalLibraries()) -{ + m_logicalLibraryList(catalogue.getLogicalLibraries()), + m_disabled(disabled) { using namespace cta::admin; XrdSsiPb::Log::Msg(XrdSsiPb::Log::DEBUG, LOG_SUFFIX, "LogicalLibraryLsStream() constructor"); } int LogicalLibraryLsStream::fillBuffer(XrdSsiPb::OStreamBuffer<Data> *streambuf) { - for(bool is_buffer_full = false; !m_logicalLibraryList.empty() && !is_buffer_full; m_logicalLibraryList.pop_front()) { + for (bool is_buffer_full = false; !m_logicalLibraryList.empty() + && !is_buffer_full; m_logicalLibraryList.pop_front()) { Data record; auto &ll = m_logicalLibraryList.front(); auto ll_item = record.mutable_llls_item(); + if (m_disabled && m_disabled.value() != ll.isDisabled) { + continue; + } + ll_item->set_name(ll.name); ll_item->set_is_disabled(ll.isDisabled); if (ll.disabledReason) { @@ -90,4 +102,5 @@ int LogicalLibraryLsStream::fillBuffer(XrdSsiPb::OStreamBuffer<Data> *streambuf) return streambuf->Size(); } -}} // namespace cta::xrd +} // namespace xrd +} // namespace cta diff --git a/xroot_plugins/XrdSsiCtaRequestMessage.cpp b/xroot_plugins/XrdSsiCtaRequestMessage.cpp index ffe2d0e45299e203a4ab00001c24a195b184e619..8113c8e2b5a393698706f393208e78cd59ae4876 100644 --- a/xroot_plugins/XrdSsiCtaRequestMessage.cpp +++ b/xroot_plugins/XrdSsiCtaRequestMessage.cpp @@ -1330,8 +1330,10 @@ void RequestMessage::processLogicalLibrary_Ls(cta::xrd::Response &response, XrdS { using namespace cta::admin; + const auto disabled = getOptional(OptionBoolean::DISABLED); + // Create a XrdSsi stream object to return the results - stream = new LogicalLibraryLsStream(*this, m_catalogue, m_scheduler); + stream = new LogicalLibraryLsStream(*this, m_catalogue, m_scheduler, disabled); response.set_show_header(HeaderType::LOGICALLIBRARY_LS); response.set_type(cta::xrd::Response::RSP_SUCCESS);