Skip to content

Resolve "Fix missing toString for `Cleanup` in SessionType"

Summary

While doing some investigation for https://gitlab.cern.ch/cta/operations/-/issues/1390 I noticed that we get an UnknownType (4) in cta-taped when logging a SessionType::Cleanup because it was never implemented (??).

hpp file:

amespace cta::tape::session {

/** Possible type for the tape session. */
enum class SessionType: uint32_t {
    Undetermined, ///< The initial direction for the session is undetermined.
    Archive,      ///< Direction is disk to tape.
    Retrieve,     ///< Direction is tape to disk.
    Label,        ///< (Re)label the tape.
    Cleanup       ///< Check the drive for the presence of a tape and eject it if necessary.
  };
/** Session state to string */
std::string toString(SessionType type);

} // namespace cta::tape::session

cpp file:

namespace cta::tape::session {

std::string toString(SessionType type) {
  switch(type) {
  case SessionType::Archive:
    return "Archive";
  case SessionType::Retrieve:
    return "Retrieve";
  case SessionType::Label:
    return "Label";
  case SessionType::Undetermined:
    return "Undetermined";
  default:
    {
      std::stringstream st;
      st << "UnknownType (" << ((uint32_t) type) << ")";
      return st.str();
    }
  }
}

} // namespace cta::tape::session

Requires manual tests in pre-production

NO

References

Closes #678 (closed)

Edited by Pablo Oliver Cortes

Merge request reports