diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 39cacbb6e94219408785ce43fcb8f1d8373064f6..24a37ad6253b7aa5a3a65d036ae776c031c03262 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -14,6 +14,7 @@ - cta/CTA#1059 - Clean up warnings reported by static analysis - cta/CTA#1062 - cta-admin tf rm should store the diskFilePath when deleting the tape file copy - cta/CTA#1073 - Retry failed reporting for archive jobs +- cta/CTA#1078 - fix STALE message when cta-taped is restarting # v4.3-3 diff --git a/scheduler/TapeDrivesCatalogueState.cpp b/scheduler/TapeDrivesCatalogueState.cpp index 4e1843a14af812a7577f1ec461eca264cf1ceaa2..1b73114b9d0fe0d3da2187f3ac3c8c0d15426b2c 100644 --- a/scheduler/TapeDrivesCatalogueState.cpp +++ b/scheduler/TapeDrivesCatalogueState.cpp @@ -619,7 +619,7 @@ common::dataStructures::TapeDrive TapeDrivesCatalogueState::setTapeDriveStatus( const common::dataStructures::DesiredDriveState & desiredState, const common::dataStructures::MountType& type, const common::dataStructures::DriveStatus& status, const tape::daemon::TpconfigLine& tpConfigLine, const common::dataStructures::SecurityIdentity& identity) { - const time_t reportTime = time(NULL); + const time_t reportTime = time(nullptr); common::dataStructures::TapeDrive tapeDriveStatus; tapeDriveStatus.driveName = driveInfo.driveName; tapeDriveStatus.host = driveInfo.host; @@ -636,8 +636,14 @@ common::dataStructures::TapeDrive TapeDrivesCatalogueState::setTapeDriveStatus( tapeDriveStatus.reservedBytes = 0; tapeDriveStatus.devFileName = tpConfigLine.devFilename; tapeDriveStatus.rawLibrarySlot = tpConfigLine.rawLibrarySlot; - tapeDriveStatus.creationLog = common::dataStructures::EntryLog(identity.username, identity.host, reportTime); - tapeDriveStatus.lastModificationLog = common::dataStructures::EntryLog(identity.username, identity.host, reportTime); + if (identity.username.empty()) { + tapeDriveStatus.creationLog = common::dataStructures::EntryLog("NO_USER", driveInfo.host, reportTime); + tapeDriveStatus.lastModificationLog = common::dataStructures::EntryLog("NO_USER", driveInfo.host, reportTime); + } else { + tapeDriveStatus.creationLog = common::dataStructures::EntryLog(identity.username, identity.host, reportTime); + tapeDriveStatus.lastModificationLog = common::dataStructures::EntryLog(identity.username, identity.host, + reportTime); + } return tapeDriveStatus; } diff --git a/xroot_plugins/XrdCtaDriveLs.hpp b/xroot_plugins/XrdCtaDriveLs.hpp index 880dae0dbfa9ab5f812f13d0fe78fabb9afb0805..4289418953cb600e9a9b5fb13b28eee8cc2eb48b 100644 --- a/xroot_plugins/XrdCtaDriveLs.hpp +++ b/xroot_plugins/XrdCtaDriveLs.hpp @@ -127,7 +127,7 @@ int DriveLsStream::fillBuffer(XrdSsiPb::OStreamBuffer<Data> *streambuf) { else dr_item->set_latest_bandwidth(0); dr_item->set_session_id(dr.sessionId ? dr.sessionId.value() : 0); - const auto lastUpdateTime = dr.lastModificationLog ? dr.lastModificationLog.value().time : 0; + const auto lastUpdateTime = dr.lastModificationLog ? dr.lastModificationLog.value().time : time(nullptr); dr_item->set_time_since_last_update(time(nullptr) - lastUpdateTime); dr_item->set_current_priority(dr.currentPriority ? dr.currentPriority.value() : 0); dr_item->set_current_activity(dr.currentActivity ? dr.currentActivity.value() : "");