From 688ee2c0705c9454b78a065a18221211a54bfa59 Mon Sep 17 00:00:00 2001 From: Jorge Camarero Vera <jorge.camarero@cern.ch> Date: Tue, 7 Sep 2021 16:45:04 +0200 Subject: [PATCH] Resolve "Fix Warning in updateDriveStatus" --- ReleaseNotes.md | 11 +++++++++++ scheduler/TapeDrivesCatalogueState.cpp | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 418bf63239..d9770e1095 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -6,6 +6,17 @@ ### Bug fixes - cta/CTA#1029 Fix segmentatin fault in frontend when list repacks of a tape that has been deleted in the catalogue +- cta/CTA#1031 Fix Warning in updateDriveStatus + +# v4.2-3 + +# v4.2-2 + +## Summary + +### Features +- cta/CTA#976 Add logical part of Drive Status using Catalogue +- cta/CTA#988 Add diskSpaceReservations map in cta-admin --json dr ls output. # v4.2-1 diff --git a/scheduler/TapeDrivesCatalogueState.cpp b/scheduler/TapeDrivesCatalogueState.cpp index 7297ca741f..f7b4bc1b68 100644 --- a/scheduler/TapeDrivesCatalogueState.cpp +++ b/scheduler/TapeDrivesCatalogueState.cpp @@ -21,6 +21,7 @@ #include "common/dataStructures/DriveInfo.hpp" #include "common/dataStructures/TapeDrive.hpp" #include "common/log/Logger.hpp" +#include "scheduler/DiskSpaceReservation.hpp" #include "TapeDrivesCatalogueState.hpp" #include "tapeserver/daemon/TpconfigLine.hpp" @@ -206,14 +207,16 @@ void TapeDrivesCatalogueState::updateDriveStatus(const common::dataStructures::D case common::dataStructures::DriveStatus::Unknown: case common::dataStructures::DriveStatus::Up: { - log::ScopedParamContainer params(lc); - params.add("diskSystem", driveState.diskSystemName) - .add("bytes", driveState.reservedBytes) - .add("previousStatus", toString(previousStatus)) - .add("newStatus", toString(driveState.driveStatus)); - lc.log(log::WARNING, "In TapeDrivesCatalogueState::updateDriveStatus(): will clear non-empty disk space reservation on status change."); - driveState.diskSystemName = "NULL"; - driveState.reservedBytes = 0; + if (driveState.diskSystemName != "NULL") { + log::ScopedParamContainer params(lc); + params.add("diskSystem", driveState.diskSystemName) + .add("bytes", driveState.reservedBytes) + .add("previousStatus", toString(previousStatus)) + .add("newStatus", toString(driveState.driveStatus)); + lc.log(log::WARNING, "In TapeDrivesCatalogueState::updateDriveStatus(): will clear non-empty disk space reservation on status change."); + driveState.diskSystemName = "NULL"; + driveState.reservedBytes = 0; + } } default: break; -- GitLab