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

Removed the notion of tape density.

parent 0574e0c1
......@@ -32,14 +32,12 @@ cta::objectstore::Tape::Tape(GenericObject& go):
}
void cta::objectstore::Tape::initialize(const std::string &name,
const std::string &logicallibrary, const std::string & density,
const cta::CreationLog & creationLog) {
const std::string &logicallibrary, const cta::CreationLog & creationLog) {
ObjectOps<serializers::Tape>::initialize();
// Set the reguired fields
objectstore::CreationLog oscl(creationLog);
oscl.serialize(*m_payload.mutable_log());
m_payload.set_vid(name);
m_payload.set_density(density);
m_payload.set_bytesstored(0);
m_payload.set_lastfseq(0);
m_payload.set_logicallibrary(logicallibrary);
......@@ -119,18 +117,6 @@ std::string cta::objectstore::Tape::getVid() {
return m_payload.vid();
}
void cta::objectstore::Tape::setDensity(const std::string& density) {
checkPayloadWritable();
m_payload.set_density(density);
}
std::string cta::objectstore::Tape::getDensity() {
checkPayloadReadable();
return m_payload.density();
}
std::string cta::objectstore::Tape::dump() {
checkPayloadReadable();
std::stringstream ret;
......
......@@ -35,7 +35,7 @@ public:
Tape(const std::string & address, Backend & os);
Tape(GenericObject & go);
void initialize(const std::string & vid, const std::string &logicalLibrary,
const std::string & density, const cta::CreationLog & creationLog);
const cta::CreationLog & creationLog);
void garbageCollect();
bool isEmpty();
CTA_GENERATE_EXCEPTION_CLASS(NotEmpty);
......@@ -95,8 +95,6 @@ public:
uint64_t getLastFseq();
// -- Generic parameters
std::string getVid();
std::string getDensity();
void setDensity(const std::string &density);
};
}}
\ No newline at end of file
......@@ -73,8 +73,8 @@ namespace {
}
std::string cta::objectstore::TapePool::addOrGetTapeAndCommit(const std::string& vid,
const std::string& logicalLibraryName, const uint64_t capacityInBytes,
const std::string &density, Agent& agent, const cta::CreationLog& creationLog) {
const std::string& logicalLibraryName, const uint64_t capacityInBytes,
Agent& agent, const cta::CreationLog& creationLog) {
checkPayloadWritable();
// Check the tape already exists
try {
......@@ -90,7 +90,7 @@ std::string cta::objectstore::TapePool::addOrGetTapeAndCommit(const std::string&
agent.commit();
// The create the tape object
Tape t(tapeAddress, ObjectOps<serializers::TapePool>::m_objectStore);
t.initialize(vid, logicalLibraryName, density, creationLog);
t.initialize(vid, logicalLibraryName, creationLog);
t.setOwner(agent.getAddressIfSet());
t.setBackupOwner(getAddressIfSet());
t.insert();
......
......@@ -51,8 +51,7 @@ public:
// Tapes management ==========================================================
std::string addOrGetTapeAndCommit(const std::string &vid,
const std::string &logicalLibraryName, const uint64_t capacityInBytes,
const std::string &density, Agent & agent,
const cta::CreationLog & CreationLog);
Agent & agent, const cta::CreationLog & CreationLog);
CTA_GENERATE_EXCEPTION_CLASS(NoSuchTape);
CTA_GENERATE_EXCEPTION_CLASS(WrongTape);
void removeTapeAndCommit(const std::string &vid);
......
......@@ -32,7 +32,7 @@ TEST(ObjectStore, TapeBasicAccess) {
// Try to create the tape entry
cta::objectstore::Tape t(tapeAddress, be);
cta::CreationLog cl(cta::UserIdentity(123,456), "testHost", time(NULL), "Unit test");
t.initialize("V12345", "LIB0", "8000GC", cl);
t.initialize("V12345", "LIB0", cl);
t.insert();
}
{
......
......@@ -240,29 +240,28 @@ message MountInfo {
message Tape {
required string vid = 4300;
required string logicallibrary = 4301;
required string density = 4302;
// Statistics about what is stored in the tape
required uint64 lastfseq = 4303;
required uint64 bytesstored = 4304;
required uint64 lastfseq = 4302;
required uint64 bytesstored = 4303;
// Tape lifetime statistics
repeated MountInfo readmounts = 4305;
repeated MountInfo writemounts = 4306;
repeated MountInfo readmounts = 4304;
repeated MountInfo writemounts = 4305;
// Information about retrive jobs queued on this tape
repeated RetrieveJobPointer retrievejobs = 4307;
required uint64 retrievejobstotalsize = 4308;
required uint64 oldestjobtime = 4309;
required uint64 priority = 4310;
repeated RetrieveJobPointer retrievejobs = 4306;
required uint64 retrievejobstotalsize = 4307;
required uint64 oldestjobtime = 4308;
required uint64 priority = 4309;
// There are no per tape mount criteria/quotas (they are per tape pool).
// Tape status
required bool busy = 4311;
required MountType currentmounttype = 4312;
required MountInfo currentmount = 4313;
required bool archived = 4314;
required bool disabled = 4315;
required bool readonly = 4316;
required bool full = 4317;
required bool busy = 4310;
required MountType currentmounttype = 4311;
required MountInfo currentmount = 4312;
required bool archived = 4313;
required bool disabled = 4314;
required bool readonly = 4315;
required bool full = 4316;
// Creation log
required CreationLog log = 4318;
required CreationLog log = 4317;
}
message ArchiveFile {
......
......@@ -52,13 +52,6 @@ std::string cta::ArchiveMount::getVid() const {
return m_dbMount->mountInfo.vid;
}
//------------------------------------------------------------------------------
// getDensity
//------------------------------------------------------------------------------
std::string cta::ArchiveMount::getDensity() const {
return m_dbMount->mountInfo.density;
}
//------------------------------------------------------------------------------
// getPoolName
//------------------------------------------------------------------------------
......
......@@ -67,14 +67,7 @@ namespace cta {
* @return The volume identifier of the tape to be mounted.
*/
virtual std::string getVid() const;
/**
* Returns the density of the tape to be mounted.
*
* @return The density of the tape to be mounted.
*/
virtual std::string getDensity() const;
/**
* Returns the mount transaction id.
*
......
......@@ -507,7 +507,7 @@ void OStoreDB::deleteTapePool(const SecurityIdentity& requester,
void OStoreDB::createTape(const std::string& vid,
const std::string& logicalLibraryName,
const std::string& tapePoolName, const uint64_t capacityInBytes,
const std::string & density, const cta::CreationLog& creationLog) {
const cta::CreationLog& creationLog) {
// To create a tape, we have to
// - Find the storage class and lock for write.
// - Create the tape object.
......@@ -540,8 +540,7 @@ void OStoreDB::createTape(const std::string& vid,
throw TapeAlreadyExists("In OStoreDB::createTape: trying to create an existing tape.");
} catch (cta::exception::Exception &) {}
// Create the tape. The tape pool method takes care of the gory details for us.
tp.addOrGetTapeAndCommit(vid, logicalLibraryName, capacityInBytes, density,
*m_agent, creationLog);
tp.addOrGetTapeAndCommit(vid, logicalLibraryName, capacityInBytes, *m_agent, creationLog);
tp.commit();
}
......@@ -1239,7 +1238,6 @@ std::unique_ptr<SchedulerDatabase::RetrieveMount>
std::unique_ptr<OStoreDB::RetrieveMount> privateRet(
new OStoreDB::RetrieveMount(m_objectStore, m_agent));
auto &rm = *privateRet;
std::string tapeDensity;
// Check we hold the scheduling lock
if (!m_lockTaken)
throw SchedulingLockNotHeld("In OStoreDB::TapeMountDecisionInfo::createRetrieveMount: "
......@@ -1293,7 +1291,6 @@ std::unique_ptr<SchedulerDatabase::RetrieveMount>
}
t.setBusy(driveName, objectstore::Tape::MountType::Archive, hostName, startTime,
m_agent.getAddressIfSet());
tapeDensity = t.getDensity();
t.commit();
}
// Fill up the mount info
......@@ -1302,7 +1299,6 @@ std::unique_ptr<SchedulerDatabase::RetrieveMount>
rm.mountInfo.logicalLibrary = logicalLibrary;
rm.mountInfo.mountId = m_schedulerGlobalLock->getIncreaseCommitMountId();
rm.mountInfo.tapePool = tapePool;
rm.mountInfo.density = tapeDensity;
// Update the status of the drive in the registry
{
// Get hold of the drive registry
......
......@@ -213,7 +213,7 @@ public:
CTA_GENERATE_EXCEPTION_CLASS(NoSuchTape);
virtual void createTape(const std::string& vid, const std::string& logicalLibraryName,
const std::string& tapePoolName, const uint64_t capacityInBytes,
const std::string& density, const cta::CreationLog& creationLog);
const cta::CreationLog& creationLog);
virtual Tape getTape(const std::string &vid) const;
......
......@@ -101,8 +101,8 @@ public:
m_OStoreDB.createStorageClass(name, nbCopies, creationLog);
}
virtual void createTape(const std::string& vid, const std::string& logicalLibraryName, const std::string& tapePoolName, const uint64_t capacityInBytes, const std::string & density, const cta::CreationLog & creationLog) {
m_OStoreDB.createTape(vid, logicalLibraryName, tapePoolName, capacityInBytes, density, creationLog);
virtual void createTape(const std::string& vid, const std::string& logicalLibraryName, const std::string& tapePoolName, const uint64_t capacityInBytes, const cta::CreationLog & creationLog) {
m_OStoreDB.createTape(vid, logicalLibraryName, tapePoolName, capacityInBytes, creationLog);
}
virtual void createTapePool(const std::string& name, const uint32_t nbPartialTapes, const CreationLog& creationLog) {
......
......@@ -47,13 +47,6 @@ std::string cta::RetrieveMount::getVid() const{
return m_dbMount->mountInfo.vid;
}
//------------------------------------------------------------------------------
// getDensity
//------------------------------------------------------------------------------
std::string cta::RetrieveMount::getDensity() const{
return m_dbMount->mountInfo.density;
}
//------------------------------------------------------------------------------
// getMountTransactionId
//------------------------------------------------------------------------------
......
......@@ -67,13 +67,6 @@ namespace cta {
*/
virtual std::string getVid() const;
/**
* Returns the density of the tape to be mounted.
*
* @return The density of the tape to be mounted.
*/
virtual std::string getDensity() const;
/**
* Returns the mount transaction id.
*
......
......@@ -401,12 +401,11 @@ void cta::Scheduler::createTape(
const std::string &logicalLibraryName,
const std::string &tapePoolName,
const uint64_t capacityInBytes,
const std::string &density,
const std::string & comment) {
m_db.assertIsAdminOnAdminHost(requester);
cta::CreationLog cl (requester.getUser(), requester.getHost(), time(NULL), comment);
m_db.createTape(vid, logicalLibraryName, tapePoolName,
capacityInBytes, density, cl);
capacityInBytes, cl);
}
//------------------------------------------------------------------------------
......
......@@ -448,7 +448,6 @@ public:
const std::string &logicalLibraryName,
const std::string &tapePoolName,
const uint64_t capacityInBytes,
const std::string &density,
const std::string & comment);
/**
......
......@@ -167,7 +167,6 @@ public:
std::string tapePool;
std::string drive;
uint64_t mountId;
std::string density;
} mountInfo;
virtual const MountInfo & getMountInfo() = 0;
virtual std::unique_ptr<ArchiveJob> getNextJob() = 0;
......@@ -246,7 +245,6 @@ public:
std::string tapePool;
std::string drive;
uint64_t mountId;
std::string density;
} mountInfo;
virtual const MountInfo & getMountInfo() = 0;
virtual std::unique_ptr<RetrieveJob> getNextJob() = 0;
......@@ -597,7 +595,6 @@ public:
const std::string &logicalLibraryName,
const std::string &tapePoolName,
const uint64_t capacityInBytes,
const std::string &density,
const CreationLog &creationLog) = 0;
/**
......
......@@ -467,16 +467,16 @@ TEST_P(SchedulerDatabaseTest, getMountInfo) {
ASSERT_EQ(cl.time, tmdi.potentialMounts.front().oldestJobStartTime);
}
// Add 2 tapes
ASSERT_THROW(db.createTape("Tape2", "Lib2", "pool2", 10L*1000*1000*1000*1000*1000, "8000GC", cl),
ASSERT_THROW(db.createTape("Tape2", "Lib2", "pool2", 10L*1000*1000*1000*1000*1000, cl),
cta::exception::Exception);
db.createLogicalLibrary("Lib2", cl);
ASSERT_THROW(db.createTape("Tape2", "Lib2", "pool2", 10L*1000*1000*1000*1000*1000, "8000GC", cl),
ASSERT_THROW(db.createTape("Tape2", "Lib2", "pool2", 10L*1000*1000*1000*1000*1000, cl),
cta::exception::Exception);
db.createTapePool("pool2", 5, cl);
ASSERT_NO_THROW(db.createTape("Tape2", "Lib2", "pool2", 10L*1000*1000*1000*1000*1000, "8000GC", cl));
ASSERT_NO_THROW(db.createTape("Tape2", "Lib2", "pool2", 10L*1000*1000*1000*1000*1000, cl));
db.createLogicalLibrary("Lib3", cl);
db.createTapePool("pool3", 5, cl);
ASSERT_NO_THROW(db.createTape("Tape3", "Lib3", "pool3", 10L*1000*1000*1000*1000*1000, "8000GC", cl));
ASSERT_NO_THROW(db.createTape("Tape3", "Lib3", "pool3", 10L*1000*1000*1000*1000*1000, cl));
// Add retrieve jobs
std::list<TapeFileLocation> tcl;
tcl.push_back(TapeFileLocation());
......@@ -602,9 +602,9 @@ TEST_P(SchedulerDatabaseTest, createArchiveMountAndGetJob) {
"drive1", "lib1", "host1", time(NULL)), cta::OStoreDB::NoSuchTape);
}
// Add the tape (and library)
ASSERT_THROW(db.createTape("Tape1", "lib1", "pool1", 10L*1000*1000*1000*1000, "8000GC", cl), cta::OStoreDB::NoSuchLibrary);
ASSERT_THROW(db.createTape("Tape1", "lib1", "pool1", 10L*1000*1000*1000*1000, cl), cta::OStoreDB::NoSuchLibrary);
db.createLogicalLibrary("lib1", cl);
ASSERT_NO_THROW(db.createTape("Tape1", "lib1", "pool1", 10L*1000*1000*1000*1000, "8000GC", cl));
ASSERT_NO_THROW(db.createTape("Tape1", "lib1", "pool1", 10L*1000*1000*1000*1000, cl));
// This should go through
{
auto mountInfo = db.getMountInfo();
......
......@@ -886,10 +886,9 @@ TEST_P(SchedulerTest, admin_createTape_new) {
const std::string vid = "TestVid";
const uint64_t capacityInBytes = 12345678;
const std::string tapeDensity = "8000GC";
const std::string tapeComment = "Tape comment";
ASSERT_NO_THROW(scheduler.createTape(s_adminOnAdminHost, vid, libraryName, tapePoolName,
capacityInBytes, tapeDensity, tapeComment));
capacityInBytes, tapeComment));
{
std::list<Tape> tapes;
ASSERT_NO_THROW(tapes = scheduler.getTapes(s_adminOnAdminHost));
......@@ -963,10 +962,9 @@ TEST_P(SchedulerTest,
const std::string vid = "TestVid";
const uint64_t capacityInBytes = 12345678;
const std::string tapeDensity = "8000GC";
const std::string tapeComment = "Tape comment";
ASSERT_THROW(scheduler.createTape(s_adminOnAdminHost, vid, libraryName, tapePoolName,
capacityInBytes, tapeDensity, tapeComment), std::exception);
capacityInBytes, tapeComment), std::exception);
}
TEST_P(SchedulerTest, admin_createTape_new_non_existing_pool) {
......@@ -1012,10 +1010,9 @@ TEST_P(SchedulerTest, admin_createTape_new_non_existing_pool) {
const std::string vid = "TestVid";
const uint64_t capacityInBytes = 12345678;
const std::string tapeDensity = "8000GC";
const std::string tapeComment = "Tape comment";
ASSERT_THROW(scheduler.createTape(s_adminOnAdminHost, vid, libraryName, tapePoolName,
capacityInBytes, tapeDensity, tapeComment), std::exception);
capacityInBytes, tapeComment), std::exception);
}
TEST_P(SchedulerTest, getDirContents_root_dir_is_empty) {
......@@ -2326,10 +2323,9 @@ TEST_P(SchedulerTest, archive_and_retrieve_new_file) {
const std::string vid = "TestVid";
const uint64_t capacityInBytes = 12345678;
const std::string tapeDensity = "8000GC";
const std::string tapeComment = "Tape comment";
ASSERT_NO_THROW(scheduler.createTape(s_adminOnAdminHost, vid, libraryName,
tapePoolName, capacityInBytes, tapeDensity, tapeComment));
tapePoolName, capacityInBytes, tapeComment));
const uint16_t copyNb = 1;
const std::string archiveRouteComment = "Archive-route comment";
......
......@@ -44,13 +44,6 @@ namespace cta {
*/
virtual std::string getVid() const = 0;
/**
* Returns the density of the tape to be mounted.
*
* @return The density of the tape to be mounted.
*/
virtual std::string getDensity() const = 0;
/**
* Returns the mount transaction id.
*
......
......@@ -93,7 +93,6 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
return MARK_DRIVE_AS_UP;
m_volInfo.vid=tapeMount->getVid();
m_volInfo.mountType=tapeMount->getMountType();
m_volInfo.density=tapeMount->getDensity();
// 2b) ... and log.
// Make the DGN and TPVID parameter permanent.
log::ScopedParamContainer params(lc);
......@@ -101,7 +100,6 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
{
log::ScopedParamContainer localParams(lc);
localParams.add("tapebridgeTransId", tapeMount->getMountTransactionId())
.add("density", m_volInfo.density)
.add("mountType", mountTypeToString(m_volInfo.mountType));
lc.log(LOG_INFO, "Got volume from client");
}
......@@ -342,7 +340,7 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
* 3) Try to open it, log if we fail
*/
/**
* Try to find the drive that is described by m_request.driveUnit and m_volInfo.density
* Try to find the drive that is described by m_request.driveUnit
* @param lc For logging purpose
* @return the drive if found, NULL otherwise
*/
......@@ -356,7 +354,6 @@ castor::tape::tapeserver::daemon::DataTransferSession::findDrive(const DriveConf
driveInfo = dv.findBySymlink(driveConfig.getDevFilename());
} catch (castor::tape::SCSI::DeviceVector::NotFound & e) {
// We could not find this drive in the system's SCSI devices
log::LogContext::ScopedParam sp08(lc, log::Param("density", m_volInfo.density));
log::LogContext::ScopedParam sp09(lc, log::Param("devFilename", driveConfig.getDevFilename()));
lc.log(LOG_ERR, "Drive not found on this path");
......@@ -370,7 +367,6 @@ castor::tape::tapeserver::daemon::DataTransferSession::findDrive(const DriveConf
return NULL;
} catch (castor::exception::Exception & e) {
// We could not find this drive in the system's SCSI devices
log::LogContext::ScopedParam sp08(lc, log::Param("density", m_volInfo.density));
log::LogContext::ScopedParam sp09(lc, log::Param("devFilename", driveConfig.getDevFilename()));
log::LogContext::ScopedParam sp10(lc, log::Param("errorMessage", e.getMessageValue()));
lc.log(LOG_ERR, "Error looking to path to tape drive");
......@@ -385,7 +381,6 @@ castor::tape::tapeserver::daemon::DataTransferSession::findDrive(const DriveConf
return NULL;
} catch (...) {
// We could not find this drive in the system's SCSI devices
log::LogContext::ScopedParam sp08(lc, log::Param("density", m_volInfo.density));
log::LogContext::ScopedParam sp09(lc, log::Param("devFilename", driveConfig.getDevFilename()));
lc.log(LOG_ERR, "Unexpected exception while looking for drive");
......@@ -405,7 +400,6 @@ castor::tape::tapeserver::daemon::DataTransferSession::findDrive(const DriveConf
return drive.release();
} catch (castor::exception::Exception & e) {
// We could not find this drive in the system's SCSI devices
log::LogContext::ScopedParam sp08(lc, log::Param("density", m_volInfo.density));
log::LogContext::ScopedParam sp09(lc, log::Param("devFilename", driveConfig.getDevFilename()));
log::LogContext::ScopedParam sp10(lc, log::Param("errorMessage", e.getMessageValue()));
lc.log(LOG_ERR, "Error opening tape drive");
......@@ -420,7 +414,6 @@ castor::tape::tapeserver::daemon::DataTransferSession::findDrive(const DriveConf
return NULL;
} catch (...) {
// We could not find this drive in the system's SCSI devices
log::LogContext::ScopedParam sp08(lc, log::Param("density", m_volInfo.density));
log::LogContext::ScopedParam sp09(lc, log::Param("devFilename", driveConfig.getDevFilename()));
lc.log(LOG_ERR, "Unexpected exception while opening drive");
......
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