Commit 6cdb86a4 authored by Cedric Caffy's avatar Cedric Caffy
Browse files

[lto_rao] Added the RAOAlgorithm parameter to the tapeserver configuration file

parent fa14810e
...@@ -117,6 +117,11 @@ struct DataTransferConfig { ...@@ -117,6 +117,11 @@ struct DataTransferConfig {
* Access Order * Access Order
*/ */
bool useRAO; bool useRAO;
/**
* The name of the raoAlgorithm to use
*/
std::string raoAlgorithm;
/** /**
* The path to the operator provided encyption control script (or empty string) * The path to the operator provided encyption control script (or empty string)
......
...@@ -272,7 +272,7 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction ...@@ -272,7 +272,7 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
// The RecallTaskInjector and the TapeReadSingleThread share the promise // The RecallTaskInjector and the TapeReadSingleThread share the promise
if (m_castorConf.useRAO) { if (m_castorConf.useRAO) {
rti.initRAO(); rti.initRAO(m_castorConf.raoAlgorithm);
} }
bool noFilesToRecall = false; bool noFilesToRecall = false;
if (rti.synchronousFetch(noFilesToRecall)) { //adapt the recall task injector (starting from synchronousFetch) if (rti.synchronousFetch(noFilesToRecall)) { //adapt the recall task injector (starting from synchronousFetch)
......
...@@ -93,8 +93,9 @@ void RecallTaskInjector::setDriveInterface(castor::tape::tapeserver::drive::Driv ...@@ -93,8 +93,9 @@ void RecallTaskInjector::setDriveInterface(castor::tape::tapeserver::drive::Driv
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
//initRAO //initRAO
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RecallTaskInjector::initRAO() { void RecallTaskInjector::initRAO(const std::string & raoAlgorithm) {
m_useRAO = true; m_useRAO = true;
m_raoAlgorithm = raoAlgorithm;
m_raoFuture = m_raoPromise.get_future(); m_raoFuture = m_raoPromise.get_future();
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -169,7 +170,7 @@ void RecallTaskInjector::injectBulkRecalls() { ...@@ -169,7 +170,7 @@ void RecallTaskInjector::injectBulkRecalls() {
* 2. the end of the jobs list has been reached and there are at least * 2. the end of the jobs list has been reached and there are at least
* 2 unordered files * 2 unordered files
*/ */
m_drive->queryRAO(files, m_raoLimits.maxSupported); m_drive->queryRAO(files, m_raoLimits.maxSupported,m_raoAlgorithm);
/* Add the RAO sorted files to the new list*/ /* Add the RAO sorted files to the new list*/
for (auto fit = files.begin(); fit != files.end(); fit++) { for (auto fit = files.begin(); fit != files.end(); fit++) {
......
...@@ -122,7 +122,7 @@ public: ...@@ -122,7 +122,7 @@ public:
/** /**
* Initialize Recommended Access Order parameters * Initialize Recommended Access Order parameters
*/ */
void initRAO(); void initRAO(const std::string & raoAlgorithm);
void waitForPromise(); void waitForPromise();
...@@ -234,6 +234,12 @@ private: ...@@ -234,6 +234,12 @@ private:
* the Recommended Access Order (RAO) * the Recommended Access Order (RAO)
*/ */
bool m_useRAO; bool m_useRAO;
/**
* The RAO algorithm to use, it is given by the tapeserver parameter
* RAOAlgorithm
*/
std::string m_raoAlgorithm;
/** Drive-specific RAO parameters */ /** Drive-specific RAO parameters */
SCSI::Structures::RAO::udsLimits m_raoLimits; SCSI::Structures::RAO::udsLimits m_raoLimits;
......
...@@ -156,6 +156,13 @@ std::vector<castor::tape::tapeserver::drive::endOfWrapPosition> drive::DriveLTO: ...@@ -156,6 +156,13 @@ std::vector<castor::tape::tapeserver::drive::endOfWrapPosition> drive::DriveLTO:
return ret; return ret;
} }
void drive::DriveLTO::queryRAO(std::list<SCSI::Structures::RAO::blockLims>& files, int maxSupported, const std::string & raoAlgorithm) {
//TODO : Create an interface RAOAlgorithm with a method called getRAO() taking the files list as input/output parameter
//Implement this method in three different classes : LinearRAOAlgorithm, RandomRAOAlgorithm, CERNRAOAlgorithm (or another name)
//Create a factory to return the correct implementation subclass regarding the raoAlgorithm string parameter.
//Call of that in this method
}
/** /**
* Information about the drive. The vendor id is used in the user labels of the files. * Information about the drive. The vendor id is used in the user labels of the files.
* @return The deviceInfo structure with the information about the drive. * @return The deviceInfo structure with the information about the drive.
...@@ -255,7 +262,7 @@ SCSI::Structures::RAO::udsLimits drive::DriveMHVTL::getLimitUDS(){ ...@@ -255,7 +262,7 @@ SCSI::Structures::RAO::udsLimits drive::DriveMHVTL::getLimitUDS(){
return lims; return lims;
} }
void drive::DriveMHVTL::queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported){ void drive::DriveMHVTL::queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported, const std::string & raoAlgorithm){
//The query RAO method of MHVTL drive returns nothing //The query RAO method of MHVTL drive returns nothing
//something could be implemented for testing... //something could be implemented for testing...
} }
...@@ -965,7 +972,7 @@ void drive::DriveGeneric::receiveRAO(std::list<SCSI::Structures::RAO::blockLims> ...@@ -965,7 +972,7 @@ void drive::DriveGeneric::receiveRAO(std::list<SCSI::Structures::RAO::blockLims>
} }
void drive::DriveGeneric::queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files, void drive::DriveGeneric::queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files,
int maxSupported) { int maxSupported, const std::string & raoAlgorithm) {
generateRAO(files, maxSupported); generateRAO(files, maxSupported);
receiveRAO(files); receiveRAO(files);
} }
......
...@@ -478,8 +478,11 @@ namespace drive { ...@@ -478,8 +478,11 @@ namespace drive {
* for a series of files * for a series of files
* @param filename The name of the file containing the sequential order of * @param filename The name of the file containing the sequential order of
* a list of files [line format: ID:BLOCK_START:BLOCK_END] * a list of files [line format: ID:BLOCK_START:BLOCK_END]
* @param maxSupported, the max number of files the drive is able to perform an RAO on
* @param raoAlgorithm, the name of the RAO algorithm to use, if the specified name
* does not match any raoAlgorithm, the linear algorithm will be used.
*/ */
virtual void queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported); virtual void queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported, const std::string & raoAlgorithm);
protected: protected:
SCSI::DeviceInfo m_SCSIInfo; SCSI::DeviceInfo m_SCSIInfo;
...@@ -580,7 +583,7 @@ namespace drive { ...@@ -580,7 +583,7 @@ namespace drive {
virtual std::map<std::string,uint32_t> getVolumeStats(); virtual std::map<std::string,uint32_t> getVolumeStats();
virtual drive::deviceInfo getDeviceInfo(); virtual drive::deviceInfo getDeviceInfo();
virtual SCSI::Structures::RAO::udsLimits getLimitUDS(); virtual SCSI::Structures::RAO::udsLimits getLimitUDS();
virtual void queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported); virtual void queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported, const std::string & raoAlgorithm);
}; };
class DriveLTO : public DriveGeneric { class DriveLTO : public DriveGeneric {
...@@ -592,6 +595,8 @@ namespace drive { ...@@ -592,6 +595,8 @@ namespace drive {
virtual compressionStats getCompression(); virtual compressionStats getCompression();
virtual void clearCompressionStats(); virtual void clearCompressionStats();
virtual std::vector<castor::tape::tapeserver::drive::endOfWrapPosition> getEndOfWrapPositions(); virtual std::vector<castor::tape::tapeserver::drive::endOfWrapPosition> getEndOfWrapPositions();
virtual void queryRAO(std::list<SCSI::Structures::RAO::blockLims>& files, int maxSupported, const std::string& raoAlgorithm);
}; };
class DriveIBM3592 : public DriveGeneric { class DriveIBM3592 : public DriveGeneric {
......
...@@ -273,7 +273,7 @@ namespace drive { ...@@ -273,7 +273,7 @@ namespace drive {
virtual bool hasTapeInPlace() = 0; virtual bool hasTapeInPlace() = 0;
virtual SCSI::Structures::RAO::udsLimits getLimitUDS() = 0; virtual SCSI::Structures::RAO::udsLimits getLimitUDS() = 0;
virtual void queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported) = 0; virtual void queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported, const std::string & raoAlgorithm) = 0;
/** /**
* The configuration of the tape drive as parsed from the TPCONFIG file. * The configuration of the tape drive as parsed from the TPCONFIG file.
......
...@@ -325,7 +325,7 @@ castor::tape::SCSI::Structures::RAO::udsLimits ...@@ -325,7 +325,7 @@ castor::tape::SCSI::Structures::RAO::udsLimits
} }
void castor::tape::tapeserver::drive::FakeDrive::queryRAO( void castor::tape::tapeserver::drive::FakeDrive::queryRAO(
std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported) { std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported, const std::string & queryRAO) {
files.reverse(); files.reverse();
} }
......
...@@ -112,7 +112,7 @@ namespace drive { ...@@ -112,7 +112,7 @@ namespace drive {
virtual lbpToUse getLbpToUse(); virtual lbpToUse getLbpToUse();
virtual bool hasTapeInPlace(); virtual bool hasTapeInPlace();
virtual castor::tape::SCSI::Structures::RAO::udsLimits getLimitUDS(); virtual castor::tape::SCSI::Structures::RAO::udsLimits getLimitUDS();
virtual void queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported); virtual void queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported,const std::string & raoAlgorithm);
}; };
}}}} }}}}
...@@ -260,7 +260,7 @@ int main (int argc, char *argv[]) ...@@ -260,7 +260,7 @@ int main (int argc, char *argv[])
throw -1; throw -1;
} }
castor::tape::SCSI::Structures::RAO::udsLimits limits = drive->getLimitUDS(); castor::tape::SCSI::Structures::RAO::udsLimits limits = drive->getLimitUDS();
drive->queryRAO(files, limits.maxSupported); drive->queryRAO(files, limits.maxSupported,"");
} }
} }
......
...@@ -1076,6 +1076,7 @@ int DriveHandler::runChild() { ...@@ -1076,6 +1076,7 @@ int DriveHandler::runChild() {
dataTransferConfig.nbDiskThreads = m_tapedConfig.nbDiskThreads.value(); dataTransferConfig.nbDiskThreads = m_tapedConfig.nbDiskThreads.value();
dataTransferConfig.useLbp = true; dataTransferConfig.useLbp = true;
dataTransferConfig.useRAO = m_tapedConfig.useRAO.value() == "yes" ? true : false; dataTransferConfig.useRAO = m_tapedConfig.useRAO.value() == "yes" ? true : false;
dataTransferConfig.raoAlgorithm = m_tapedConfig.raoAlgorithm.value();
dataTransferConfig.xrootPrivateKey = ""; dataTransferConfig.xrootPrivateKey = "";
// Before launching, and if this is the first session since daemon start, we will // Before launching, and if this is the first session since daemon start, we will
......
...@@ -107,7 +107,9 @@ TapedConfiguration TapedConfiguration::createFromCtaConf( ...@@ -107,7 +107,9 @@ TapedConfiguration TapedConfiguration::createFromCtaConf(
ret.mountCriteria.setFromConfigurationFile(cf, generalConfigPath); ret.mountCriteria.setFromConfigurationFile(cf, generalConfigPath);
// Disk file access parameters // Disk file access parameters
ret.nbDiskThreads.setFromConfigurationFile(cf, generalConfigPath); ret.nbDiskThreads.setFromConfigurationFile(cf, generalConfigPath);
//RAO
ret.useRAO.setFromConfigurationFile(cf, generalConfigPath); ret.useRAO.setFromConfigurationFile(cf, generalConfigPath);
ret.raoAlgorithm.setFromConfigurationFile(cf,generalConfigPath);
// Watchdog: parameters for timeouts in various situations. // Watchdog: parameters for timeouts in various situations.
ret.wdIdleSessionTimer.setFromConfigurationFile(cf, generalConfigPath); ret.wdIdleSessionTimer.setFromConfigurationFile(cf, generalConfigPath);
ret.wdMountMaxSecs.setFromConfigurationFile(cf, generalConfigPath); ret.wdMountMaxSecs.setFromConfigurationFile(cf, generalConfigPath);
......
...@@ -96,6 +96,9 @@ struct TapedConfiguration { ...@@ -96,6 +96,9 @@ struct TapedConfiguration {
/// Usage of Recommended Access Order for file recall /// Usage of Recommended Access Order for file recall
cta::SourcedParameter<std::string> useRAO{ cta::SourcedParameter<std::string> useRAO{
"taped", "UseRAO", "no", "Compile time default"}; "taped", "UseRAO", "no", "Compile time default"};
/// RAO type of algorithm
cta::SourcedParameter<std::string> raoAlgorithm{
"taped", "RAOAlgorithm","linear","Compile time default"};
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Watchdog: parameters for timeouts in various situations. // Watchdog: parameters for timeouts in various situations.
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
......
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