Commit ce4a27cf authored by Eric Cano's avatar Eric Cano
Browse files

#132: Fixed host, library, mountType and added vid in `cta drive ls` output.

parent a507cab1
......@@ -29,6 +29,7 @@
#include "common/admin/AdminHost.hpp"
#include "common/admin/AdminUser.hpp"
#include "common/archiveRoutes/ArchiveRoute.hpp"
#include "common/utils/utils.hpp"
#include "scheduler/LogicalLibrary.hpp"
#include "common/TapePool.hpp"
#include "common/dataStructures/MountPolicy.hpp"
......@@ -1350,6 +1351,7 @@ std::unique_ptr<SchedulerDatabase::ArchiveMount>
am.mountInfo.vid = tape.vid;
// Fill up the mount info
am.mountInfo.drive = driveName;
am.mountInfo.host = hostName;
am.mountInfo.mountId = m_schedulerGlobalLock->getIncreaseCommitMountId();
m_schedulerGlobalLock->commit();
am.mountInfo.tapePool = tape.tapePool;
......@@ -1366,7 +1368,7 @@ std::unique_ptr<SchedulerDatabase::ArchiveMount>
common::dataStructures::DriveInfo driveInfo;
driveInfo.driveName=driveName;
driveInfo.logicalLibrary=logicalLibrary;
/// TODO! driveInfo.host=???
driveInfo.host=hostName;
ReportDriveStatusInputs inputs;
inputs.mountType = common::dataStructures::MountType::Archive;
inputs.byteTransfered = 0;
......@@ -1426,6 +1428,7 @@ std::unique_ptr<SchedulerDatabase::RetrieveMount>
// Fill up the mount info
rm.mountInfo.vid = vid;
rm.mountInfo.drive = driveName;
rm.mountInfo.host = hostName;
rm.mountInfo.mountId = m_schedulerGlobalLock->getIncreaseCommitMountId();
m_schedulerGlobalLock->commit();
rm.mountInfo.tapePool = tapePool;
......@@ -1442,7 +1445,7 @@ std::unique_ptr<SchedulerDatabase::RetrieveMount>
common::dataStructures::DriveInfo driveInfo;
driveInfo.driveName=driveName;
driveInfo.logicalLibrary=logicalLibrary;
/// TODO! driveInfo.host=???
driveInfo.host=hostName;
ReportDriveStatusInputs inputs;
inputs.mountType = common::dataStructures::MountType::Retrieve;
inputs.mountSessionId = rm.mountInfo.mountId;
......@@ -1908,7 +1911,7 @@ void OStoreDB::ArchiveMount::complete(time_t completionTime) {
common::dataStructures::DriveInfo driveInfo;
driveInfo.driveName=mountInfo.drive;
driveInfo.logicalLibrary=mountInfo.logicalLibrary;
/// TODO! driveInfo.host=???
driveInfo.host=mountInfo.host;
ReportDriveStatusInputs inputs;
inputs.mountType = common::dataStructures::MountType::NoMount;
inputs.mountSessionId = mountInfo.mountId;
......@@ -2050,7 +2053,7 @@ void OStoreDB::RetrieveMount::complete(time_t completionTime) {
common::dataStructures::DriveInfo driveInfo;
driveInfo.driveName=mountInfo.drive;
driveInfo.logicalLibrary=mountInfo.logicalLibrary;
/// TODO! driveInfo.host=???
driveInfo.host=mountInfo.host;
ReportDriveStatusInputs inputs;
inputs.mountType = common::dataStructures::MountType::NoMount;
inputs.mountSessionId = mountInfo.mountId;
......@@ -2081,7 +2084,7 @@ void OStoreDB::RetrieveMount::setDriveStatus(cta::common::dataStructures::DriveS
driveInfo.logicalLibrary=mountInfo.logicalLibrary;
/// TODO! driveInfo.host=???
ReportDriveStatusInputs inputs;
inputs.mountType = common::dataStructures::MountType::NoMount;
inputs.mountType = common::dataStructures::MountType::Retrieve;
inputs.mountSessionId = mountInfo.mountId;
inputs.reportTime = completionTime;
inputs.status = status;
......@@ -2111,9 +2114,9 @@ void OStoreDB::ArchiveMount::setDriveStatus(cta::common::dataStructures::DriveSt
common::dataStructures::DriveInfo driveInfo;
driveInfo.driveName=mountInfo.drive;
driveInfo.logicalLibrary=mountInfo.logicalLibrary;
/// TODO! driveInfo.host=???
driveInfo.host=mountInfo.host;
ReportDriveStatusInputs inputs;
inputs.mountType = common::dataStructures::MountType::NoMount;
inputs.mountType = common::dataStructures::MountType::Archive;
inputs.mountSessionId = mountInfo.mountId;
inputs.reportTime = completionTime;
inputs.status = status;
......
......@@ -173,6 +173,7 @@ public:
std::string logicalLibrary;
std::string tapePool;
std::string drive;
std::string host;
uint64_t mountId;
} mountInfo;
virtual const MountInfo & getMountInfo() = 0;
......@@ -323,6 +324,7 @@ public:
std::string logicalLibrary;
std::string tapePool;
std::string drive;
std::string host;
uint64_t mountId;
} mountInfo;
virtual const MountInfo & getMountInfo() = 0;
......
......@@ -61,7 +61,7 @@ castor::tape::tapeserver::daemon::DataTransferSession::DataTransferSession(
m_sysWrapper(sysWrapper),
m_driveConfig(driveConfig),
m_castorConf(castorConf),
m_driveInfo({driveConfig.unitName, cta::utils::getShortHostname(), driveConfig.rawLibrarySlot}),
m_driveInfo({driveConfig.unitName, cta::utils::getShortHostname(), driveConfig.logicalLibrary}),
m_mc(mc),
m_intialProcess(initialProcess),
m_capUtils(capUtils),
......
......@@ -424,7 +424,8 @@ TEST_P(DataTransferSessionTest, DataTransferSessionGooddayRecall) {
cta::tape::daemon::TpconfigLine driveConfig("T10D6116", "TestLogicalLibrary", "/dev/tape_T10D6116", "manual");
cta::common::dataStructures::DriveInfo driveInfo;
driveInfo.driveName=driveConfig.unitName;
driveInfo.logicalLibrary=driveConfig.rawLibrarySlot;
driveInfo.logicalLibrary=driveConfig.logicalLibrary;
driveInfo.host=="host";
// We need to create the drive in the registry before being able to put it up.
scheduler.reportDriveStatus(driveInfo, cta::common::dataStructures::MountType::NoMount, cta::common::dataStructures::DriveStatus::Down);
scheduler.setDesiredDriveState(s_adminOnAdminHost, driveConfig.unitName, true, false);
......@@ -616,7 +617,8 @@ TEST_P(DataTransferSessionTest, DataTransferSessionWrongRecall) {
cta::tape::daemon::TpconfigLine driveConfig("T10D6116", "TestLogicalLibrary", "/dev/tape_T10D6116", "manual");
cta::common::dataStructures::DriveInfo driveInfo;
driveInfo.driveName=driveConfig.unitName;
driveInfo.logicalLibrary=driveConfig.rawLibrarySlot;
driveInfo.logicalLibrary=driveConfig.logicalLibrary;
driveInfo.host=="host";
// We need to create the drive in the registry before being able to put it up.
scheduler.reportDriveStatus(driveInfo, cta::common::dataStructures::MountType::NoMount, cta::common::dataStructures::DriveStatus::Down);
scheduler.setDesiredDriveState(s_adminOnAdminHost, driveConfig.unitName, true, false);
......@@ -780,7 +782,8 @@ TEST_P(DataTransferSessionTest, DataTransferSessionNoSuchDrive) {
cta::tape::daemon::TpconfigLine driveConfig("T10D6116", "TestLogicalLibrary", "/dev/noSuchDrive", "manual");
cta::common::dataStructures::DriveInfo driveInfo;
driveInfo.driveName=driveConfig.unitName;
driveInfo.logicalLibrary=driveConfig.rawLibrarySlot;
driveInfo.logicalLibrary=driveConfig.logicalLibrary;
driveInfo.host=="host";
// We need to create the drive in the registry before being able to put it up.
scheduler.reportDriveStatus(driveInfo, cta::common::dataStructures::MountType::NoMount, cta::common::dataStructures::DriveStatus::Down);
scheduler.setDesiredDriveState(s_adminOnAdminHost, driveConfig.unitName, true, false);
......@@ -923,7 +926,8 @@ TEST_P(DataTransferSessionTest, DataTransferSessionFailtoMount) {
cta::tape::daemon::TpconfigLine driveConfig("T10D6116", "TestLogicalLibrary", "/dev/tape_T10D6116", "manual");
cta::common::dataStructures::DriveInfo driveInfo;
driveInfo.driveName=driveConfig.unitName;
driveInfo.logicalLibrary=driveConfig.rawLibrarySlot;
driveInfo.logicalLibrary=driveConfig.logicalLibrary;
driveInfo.host=="host";
// We need to create the drive in the registry before being able to put it up.
scheduler.reportDriveStatus(driveInfo, cta::common::dataStructures::MountType::NoMount, cta::common::dataStructures::DriveStatus::Down);
scheduler.setDesiredDriveState(s_adminOnAdminHost, driveConfig.unitName, true, false);
......@@ -1049,7 +1053,8 @@ TEST_P(DataTransferSessionTest, DataTransferSessionGooddayMigration) {
cta::tape::daemon::TpconfigLine driveConfig("T10D6116", "TestLogicalLibrary", "/dev/tape_T10D6116", "manual");
cta::common::dataStructures::DriveInfo driveInfo;
driveInfo.driveName=driveConfig.unitName;
driveInfo.logicalLibrary=driveConfig.rawLibrarySlot;
driveInfo.logicalLibrary=driveConfig.logicalLibrary;
driveInfo.host=="host";
// We need to create the drive in the registry before being able to put it up.
scheduler.reportDriveStatus(driveInfo, cta::common::dataStructures::MountType::NoMount, cta::common::dataStructures::DriveStatus::Down);
scheduler.setDesiredDriveState(s_adminOnAdminHost, driveConfig.unitName, true, false);
......@@ -1188,7 +1193,8 @@ TEST_P(DataTransferSessionTest, DataTransferSessionMissingFilesMigration) {
cta::tape::daemon::TpconfigLine driveConfig("T10D6116", "TestLogicalLibrary", "/dev/tape_T10D6116", "manual");
cta::common::dataStructures::DriveInfo driveInfo;
driveInfo.driveName=driveConfig.unitName;
driveInfo.logicalLibrary=driveConfig.rawLibrarySlot;
driveInfo.logicalLibrary=driveConfig.logicalLibrary;
driveInfo.host=="host";
// We need to create the drive in the registry before being able to put it up.
scheduler.reportDriveStatus(driveInfo, cta::common::dataStructures::MountType::NoMount, cta::common::dataStructures::DriveStatus::Down);
scheduler.setDesiredDriveState(s_adminOnAdminHost, driveConfig.unitName, true, false);
......@@ -1321,7 +1327,8 @@ TEST_P(DataTransferSessionTest, DataTransferSessionTapeFullMigration) {
cta::tape::daemon::TpconfigLine driveConfig("T10D6116", "TestLogicalLibrary", "/dev/tape_T10D6116", "manual");
cta::common::dataStructures::DriveInfo driveInfo;
driveInfo.driveName=driveConfig.unitName;
driveInfo.logicalLibrary=driveConfig.rawLibrarySlot;
driveInfo.logicalLibrary=driveConfig.logicalLibrary;
driveInfo.host=="host";
// We need to create the drive in the registry before being able to put it up.
scheduler.reportDriveStatus(driveInfo, cta::common::dataStructures::MountType::NoMount, cta::common::dataStructures::DriveStatus::Down);
scheduler.setDesiredDriveState(s_adminOnAdminHost, driveConfig.unitName, true, false);
......@@ -1468,7 +1475,8 @@ TEST_P(DataTransferSessionTest, DataTransferSessionTapeFullOnFlushMigration) {
cta::tape::daemon::TpconfigLine driveConfig("T10D6116", "TestLogicalLibrary", "/dev/tape_T10D6116", "manual");
cta::common::dataStructures::DriveInfo driveInfo;
driveInfo.driveName=driveConfig.unitName;
driveInfo.logicalLibrary=driveConfig.rawLibrarySlot;
driveInfo.logicalLibrary=driveConfig.logicalLibrary;
driveInfo.host=="host";
// We need to create the drive in the registry before being able to put it up.
scheduler.reportDriveStatus(driveInfo, cta::common::dataStructures::MountType::NoMount, cta::common::dataStructures::DriveStatus::Down);
scheduler.setDesiredDriveState(s_adminOnAdminHost, driveConfig.unitName, true, false);
......
......@@ -72,6 +72,8 @@ castor::tape::tapeserver::daemon::TapeWriteSingleThread::TapeCleaning::~TapeClea
try { m_this.logTapeAlerts(); } catch (...) {}
// Log (safely, exception-wise) the tape SCSI metrics at the end of the session
try { m_this.logSCSIMetrics(); } catch(...) {}
m_this.m_initialProcess.reportState(cta::tape::session::SessionState::Unmounting,
cta::tape::session::SessionType::Archive);
std::string currentErrorToCount = "Error_tapeUnload";
try{
// Do the final cleanup
......
......@@ -846,6 +846,8 @@ int DriveHandler::runChild() {
// Create the channel to talk back to the parent process.
cta::tape::daemon::DriveHandlerProxy driveHandlerProxy(*m_socketPair);
std::string hostname=cta::utils::getShortHostname();
// Before anything, we need to check we have access to the scheduler's central storages.
std::unique_ptr<cta::objectstore::Backend> backend(
cta::objectstore::BackendFactory::createBackend(m_tapedConfig.objectStoreURL.value()).release());
......@@ -909,7 +911,8 @@ int DriveHandler::runChild() {
try {
cta::common::dataStructures::DriveInfo driveInfo;
driveInfo.driveName=m_configLine.unitName;
driveInfo.logicalLibrary=m_configLine.rawLibrarySlot;
driveInfo.logicalLibrary=m_configLine.logicalLibrary;
driveInfo.host=hostname;
scheduler.reportDriveStatus(driveInfo, cta::common::dataStructures::MountType::NoMount, cta::common::dataStructures::DriveStatus::Down);
cta::common::dataStructures::SecurityIdentity securityIdentity;
scheduler.setDesiredDriveState(securityIdentity, m_configLine.unitName, false, false);
......@@ -934,7 +937,8 @@ int DriveHandler::runChild() {
try {
cta::common::dataStructures::DriveInfo driveInfo;
driveInfo.driveName=m_configLine.unitName;
driveInfo.logicalLibrary=m_configLine.rawLibrarySlot;
driveInfo.logicalLibrary=m_configLine.logicalLibrary;
driveInfo.host=hostname;
scheduler.reportDriveStatus(driveInfo, cta::common::dataStructures::MountType::NoMount, cta::common::dataStructures::DriveStatus::Down);
cta::common::dataStructures::SecurityIdentity securityIdentity;
scheduler.setDesiredDriveState(securityIdentity, m_configLine.unitName, false, false);
......@@ -1026,7 +1030,8 @@ int DriveHandler::runChild() {
// this is done by reporting the drive as down first.
cta::common::dataStructures::DriveInfo driveInfo;
driveInfo.driveName=m_configLine.unitName;
driveInfo.logicalLibrary=m_configLine.rawLibrarySlot;
driveInfo.logicalLibrary=m_configLine.logicalLibrary;
driveInfo.host=hostname;
scheduler.reportDriveStatus(driveInfo, common::dataStructures::MountType::NoMount, common::dataStructures::DriveStatus::Down);
cta::common::dataStructures::SecurityIdentity securityIdentity;
scheduler.setDesiredDriveState(securityIdentity, m_configLine.unitName, false /* down */, false /* no force down*/);
......
......@@ -1797,7 +1797,7 @@ void XrdCtaFile::xCom_drive() {
auto driveStates = m_scheduler->getDriveStates(m_cliIdentity);
if (driveStates.size()) {
std::vector<std::vector<std::string>> responseTable;
std::vector<std::string> headers = {"drive", "host", "library", "mountType", "status", "desiredUp", "forceDown"};
std::vector<std::string> headers = {"drive", "host", "library", "mountType", "status", "desiredUp", "forceDown", "vid"};
responseTable.push_back(headers);
for (auto ds: driveStates) {
if (singleDrive && m_requestTokens.at(3) != ds.driveName) continue;
......@@ -1809,6 +1809,7 @@ void XrdCtaFile::xCom_drive() {
currentRow.push_back(cta::common::dataStructures::toString(ds.driveStatus));
currentRow.push_back(ds.desiredDriveState.up?"UP":"DOWN");
currentRow.push_back(ds.desiredDriveState.forceDown?"FORCE":"");
currentRow.push_back(ds.currentVid==""?"-":ds.currentVid);
responseTable.push_back(currentRow);
}
cmdlineOutput<< formatResponse(responseTable, true);
......
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