Commit 5dbeed40 authored by Cedric Caffy's avatar Cedric Caffy
Browse files

Removed TAPE.CAPACITY_IN_BYTES column from the catalogue

parent 6e7ae7bc
......@@ -169,7 +169,6 @@ CREATE TABLE TAPE(
LOGICAL_LIBRARY_ID BIGINT UNSIGNED CONSTRAINT TAPE_LLI_NN NOT NULL,
TAPE_POOL_ID BIGINT UNSIGNED CONSTRAINT TAPE_TPI_NN NOT NULL,
ENCRYPTION_KEY_NAME VARCHAR(100),
CAPACITY_IN_BYTES BIGINT UNSIGNED CONSTRAINT TAPE_CIB_NN NOT NULL,
DATA_IN_BYTES BIGINT UNSIGNED CONSTRAINT TAPE_DIB_NN NOT NULL,
LAST_FSEQ BIGINT UNSIGNED CONSTRAINT TAPE_LF_NN NOT NULL,
NB_MASTER_FILES BIGINT UNSIGNED DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,
......
......@@ -198,7 +198,6 @@ CREATE TABLE TAPE(
LOGICAL_LIBRARY_ID NUMERIC(20, 0) CONSTRAINT TAPE_LLI_NN NOT NULL,
TAPE_POOL_ID NUMERIC(20, 0) CONSTRAINT TAPE_TPI_NN NOT NULL,
ENCRYPTION_KEY_NAME VARCHAR2(100),
CAPACITY_IN_BYTES NUMERIC(20, 0) CONSTRAINT TAPE_CIB_NN NOT NULL,
DATA_IN_BYTES NUMERIC(20, 0) CONSTRAINT TAPE_DIB_NN NOT NULL,
LAST_FSEQ NUMERIC(20, 0) CONSTRAINT TAPE_LF_NN NOT NULL,
NB_MASTER_FILES NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,
......
......@@ -181,7 +181,6 @@ CREATE TABLE TAPE(
LOGICAL_LIBRARY_ID NUMERIC(20, 0) CONSTRAINT TAPE_LLI_NN NOT NULL,
TAPE_POOL_ID NUMERIC(20, 0) CONSTRAINT TAPE_TPI_NN NOT NULL,
ENCRYPTION_KEY_NAME VARCHAR(100),
CAPACITY_IN_BYTES NUMERIC(20, 0) CONSTRAINT TAPE_CIB_NN NOT NULL,
DATA_IN_BYTES NUMERIC(20, 0) CONSTRAINT TAPE_DIB_NN NOT NULL,
LAST_FSEQ NUMERIC(20, 0) CONSTRAINT TAPE_LF_NN NOT NULL,
NB_MASTER_FILES NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,
......
......@@ -157,7 +157,6 @@ CREATE TABLE TAPE(
LOGICAL_LIBRARY_ID INTEGER CONSTRAINT TAPE_LLI_NN NOT NULL,
TAPE_POOL_ID INTEGER CONSTRAINT TAPE_TPI_NN NOT NULL,
ENCRYPTION_KEY_NAME VARCHAR(100),
CAPACITY_IN_BYTES INTEGER CONSTRAINT TAPE_CIB_NN NOT NULL,
DATA_IN_BYTES INTEGER CONSTRAINT TAPE_DIB_NN NOT NULL,
LAST_FSEQ INTEGER CONSTRAINT TAPE_LF_NN NOT NULL,
NB_MASTER_FILES INTEGER DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,
......
......@@ -4002,7 +4002,6 @@ namespace catalogue{
" LOGICAL_LIBRARY_ID NUMERIC(20, 0) CONSTRAINT TAPE_LLI_NN NOT NULL,"
" TAPE_POOL_ID NUMERIC(20, 0) CONSTRAINT TAPE_TPI_NN NOT NULL,"
" ENCRYPTION_KEY_NAME VARCHAR2(100),"
" CAPACITY_IN_BYTES NUMERIC(20, 0) CONSTRAINT TAPE_CIB_NN NOT NULL,"
" DATA_IN_BYTES NUMERIC(20, 0) CONSTRAINT TAPE_DIB_NN NOT NULL,"
" LAST_FSEQ NUMERIC(20, 0) CONSTRAINT TAPE_LF_NN NOT NULL,"
" NB_MASTER_FILES NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,"
......@@ -4403,7 +4402,6 @@ namespace catalogue{
" LOGICAL_LIBRARY_ID BIGINT UNSIGNED CONSTRAINT TAPE_LLI_NN NOT NULL,"
" TAPE_POOL_ID BIGINT UNSIGNED CONSTRAINT TAPE_TPI_NN NOT NULL,"
" ENCRYPTION_KEY_NAME VARCHAR(100),"
" CAPACITY_IN_BYTES BIGINT UNSIGNED CONSTRAINT TAPE_CIB_NN NOT NULL,"
" DATA_IN_BYTES BIGINT UNSIGNED CONSTRAINT TAPE_DIB_NN NOT NULL,"
" LAST_FSEQ BIGINT UNSIGNED CONSTRAINT TAPE_LF_NN NOT NULL,"
" NB_MASTER_FILES BIGINT UNSIGNED DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,"
......@@ -4791,7 +4789,6 @@ namespace catalogue{
" LOGICAL_LIBRARY_ID INTEGER CONSTRAINT TAPE_LLI_NN NOT NULL,"
" TAPE_POOL_ID INTEGER CONSTRAINT TAPE_TPI_NN NOT NULL,"
" ENCRYPTION_KEY_NAME VARCHAR(100),"
" CAPACITY_IN_BYTES INTEGER CONSTRAINT TAPE_CIB_NN NOT NULL,"
" DATA_IN_BYTES INTEGER CONSTRAINT TAPE_DIB_NN NOT NULL,"
" LAST_FSEQ INTEGER CONSTRAINT TAPE_LF_NN NOT NULL,"
" NB_MASTER_FILES INTEGER DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,"
......@@ -5201,7 +5198,6 @@ namespace catalogue{
" LOGICAL_LIBRARY_ID NUMERIC(20, 0) CONSTRAINT TAPE_LLI_NN NOT NULL,"
" TAPE_POOL_ID NUMERIC(20, 0) CONSTRAINT TAPE_TPI_NN NOT NULL,"
" ENCRYPTION_KEY_NAME VARCHAR(100),"
" CAPACITY_IN_BYTES NUMERIC(20, 0) CONSTRAINT TAPE_CIB_NN NOT NULL,"
" DATA_IN_BYTES NUMERIC(20, 0) CONSTRAINT TAPE_DIB_NN NOT NULL,"
" LAST_FSEQ NUMERIC(20, 0) CONSTRAINT TAPE_LF_NN NOT NULL,"
" NB_MASTER_FILES NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,"
......
......@@ -552,7 +552,6 @@ public:
virtual void modifyTapeVendor(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &vendor) = 0;
virtual void modifyTapeLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &logicalLibraryName) = 0;
virtual void modifyTapeTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &tapePoolName) = 0;
virtual void modifyTapeCapacityInBytes(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const uint64_t capacityInBytes) = 0;
virtual void modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &encryptionKeyName) = 0;
/**
......
......@@ -344,10 +344,6 @@ public:
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeTapePoolName(admin, vid, tapePoolName);}, m_maxTriesToConnect);
}
void modifyTapeCapacityInBytes(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const uint64_t capacityInBytes) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeCapacityInBytes(admin, vid, capacityInBytes);}, m_maxTriesToConnect);
}
void modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &encryptionKeyName) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeEncryptionKeyName(admin, vid, encryptionKeyName);}, m_maxTriesToConnect);
}
......
......@@ -371,11 +371,11 @@ void cta_catalogue_CatalogueTest::createVo(const std::string &voName){
m_catalogue->createVirtualOrganization(m_admin,vo);
}
 
void cta_catalogue_CatalogueTest::createMediaType(const std::string& mediaTypeName) {
void cta_catalogue_CatalogueTest::createMediaType(const std::string& mediaTypeName, const uint64_t capacityInBytes) {
using namespace cta;
catalogue::MediaType mt;
mt.name = mediaTypeName;
mt.capacityInBytes = 10;
mt.capacityInBytes = capacityInBytes;
mt.cartridge = "cartridge";
mt.comment = "comment";
mt.maxLPos = 100;
......@@ -4550,7 +4550,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTape_9_exabytes_capacity) {
const bool readOnlyValue = true;
const std::string comment = "Create tape";
 
createMediaType(mediaType);
createMediaType(mediaType,capacityInBytes);
m_catalogue->createLogicalLibrary(m_admin, logicalLibraryName, logicalLibraryIsDisabled, "Create logical library");
 
createVo(vo);
......@@ -5796,107 +5796,6 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeTapePoolName_nonExistentTape) {
ASSERT_THROW(m_catalogue->modifyTapeTapePoolName(m_admin, vid, tapePoolName), exception::UserError);
}
 
TEST_P(cta_catalogue_CatalogueTest, modifyTapeCapacityInBytes) {
using namespace cta;
ASSERT_TRUE(m_catalogue->getTapes().empty());
const std::string vid = "vid";
const std::string mediaType = "media_type";
const std::string vendor = "vendor";
const std::string logicalLibraryName = "logical_library_name";
const bool logicalLibraryIsDisabled= false;
const std::string tapePoolName = "tape_pool_name";
const std::string vo = "vo";
const uint64_t nbPartialTapes = 2;
const bool isEncrypted = true;
const cta::optional<std::string> supply("value for the supply pool mechanism");
const uint64_t capacityInBytes = (uint64_t)10 * 1000 * 1000 * 1000 * 1000;
const bool disabledValue = true;
const bool fullValue = false;
const bool readOnlyValue = true;
const std::string comment = "Create tape";
createMediaType(mediaType);
m_catalogue->createLogicalLibrary(m_admin, logicalLibraryName, logicalLibraryIsDisabled, "Create logical library");
createVo(vo);
m_catalogue->createTapePool(m_admin, tapePoolName, vo, nbPartialTapes, isEncrypted, supply, "Create tape pool");
m_catalogue->createTape(m_admin, vid, mediaType, vendor, logicalLibraryName, tapePoolName, capacityInBytes,
disabledValue, fullValue, readOnlyValue, comment);
{
const std::list<common::dataStructures::Tape> tapes = m_catalogue->getTapes();
ASSERT_EQ(1, tapes.size());
const common::dataStructures::Tape tape = tapes.front();
ASSERT_EQ(vid, tape.vid);
ASSERT_EQ(mediaType, tape.mediaType);
ASSERT_EQ(vendor, tape.vendor);
ASSERT_EQ(logicalLibraryName, tape.logicalLibraryName);
ASSERT_EQ(tapePoolName, tape.tapePoolName);
ASSERT_EQ(vo, tape.vo);
ASSERT_EQ(capacityInBytes, tape.capacityInBytes);
ASSERT_TRUE(disabledValue == tape.disabled);
ASSERT_TRUE(fullValue == tape.full);
ASSERT_TRUE(readOnlyValue == tape.readOnly);
ASSERT_FALSE(tape.isFromCastor);
ASSERT_EQ(comment, tape.comment);
ASSERT_FALSE(tape.labelLog);
ASSERT_FALSE(tape.lastReadLog);
ASSERT_FALSE(tape.lastWriteLog);
const common::dataStructures::EntryLog creationLog = tape.creationLog;
ASSERT_EQ(m_admin.username, creationLog.username);
ASSERT_EQ(m_admin.host, creationLog.host);
const common::dataStructures::EntryLog lastModificationLog = tape.lastModificationLog;
ASSERT_EQ(creationLog, lastModificationLog);
}
const uint64_t modifiedCapacityInBytes = 2 * capacityInBytes;
m_catalogue->modifyTapeCapacityInBytes(m_admin, vid, modifiedCapacityInBytes);
{
const std::list<common::dataStructures::Tape> tapes = m_catalogue->getTapes();
ASSERT_EQ(1, tapes.size());
const common::dataStructures::Tape tape = tapes.front();
ASSERT_EQ(vid, tape.vid);
ASSERT_EQ(mediaType, tape.mediaType);
ASSERT_EQ(vendor, tape.vendor);
ASSERT_EQ(logicalLibraryName, tape.logicalLibraryName);
ASSERT_EQ(tapePoolName, tape.tapePoolName);
ASSERT_EQ(vo, tape.vo);
ASSERT_EQ(modifiedCapacityInBytes, tape.capacityInBytes);
ASSERT_TRUE(disabledValue == tape.disabled);
ASSERT_TRUE(fullValue == tape.full);
ASSERT_TRUE(readOnlyValue == tape.readOnly);
ASSERT_FALSE(tape.isFromCastor);
ASSERT_EQ(comment, tape.comment);
ASSERT_FALSE(tape.labelLog);
ASSERT_FALSE(tape.lastReadLog);
ASSERT_FALSE(tape.lastWriteLog);
const common::dataStructures::EntryLog creationLog = tape.creationLog;
ASSERT_EQ(m_admin.username, creationLog.username);
ASSERT_EQ(m_admin.host, creationLog.host);
}
}
TEST_P(cta_catalogue_CatalogueTest, modifyTapeCapacityInBytes_nonExistentTape) {
using namespace cta;
ASSERT_TRUE(m_catalogue->getTapes().empty());
const std::string vid = "vid";
const uint64_t capacityInBytes = (uint64_t)10 * 1000 * 1000 * 1000 * 1000;
ASSERT_THROW(m_catalogue->modifyTapeCapacityInBytes(m_admin, vid, capacityInBytes), exception::UserError);
}
TEST_P(cta_catalogue_CatalogueTest, modifyTapeEncryptionKeyName) {
using namespace cta;
 
......
......@@ -116,7 +116,7 @@ protected:
* Creates a media type in the catalogue
* @param mediaTypeName
*/
void createMediaType(const std::string & mediaTypeName);
void createMediaType(const std::string & mediaTypeName, const uint64_t capacityInBytes = (uint64_t)10 * 1000 * 1000 * 1000 * 1000);
}; // cta_catalogue_CatalogueTest
} // namespace unitTests
......@@ -126,7 +126,6 @@ public:
void modifyStorageClassVo(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyStorageClassName(const common::dataStructures::SecurityIdentity& admin, const std::string& currentName, const std::string& newName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyStorageClassNbCopies(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t nbCopies) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeCapacityInBytes(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const uint64_t capacityInBytes) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeComment(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& encryptionKeyName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeMediaType(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& mediaType) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
......
......@@ -1934,7 +1934,7 @@ std::list<TapePool> RdbmsCatalogue::getTapePools() const {
"TAPE_POOL.SUPPLY AS SUPPLY,"
"COALESCE(COUNT(TAPE.VID), 0) AS NB_TAPES,"
"COALESCE(SUM(TAPE.CAPACITY_IN_BYTES), 0) AS CAPACITY_IN_BYTES,"
"COALESCE(SUM(MEDIA_TYPE.CAPACITY_IN_BYTES), 0) AS CAPACITY_IN_BYTES,"
"COALESCE(SUM(TAPE.DATA_IN_BYTES), 0) AS DATA_IN_BYTES,"
"COALESCE(SUM(TAPE.LAST_FSEQ), 0) AS NB_PHYSICAL_FILES,"
......@@ -1953,6 +1953,8 @@ std::list<TapePool> RdbmsCatalogue::getTapePools() const {
"TAPE_POOL.VIRTUAL_ORGANIZATION_ID = VIRTUAL_ORGANIZATION.VIRTUAL_ORGANIZATION_ID "
"LEFT OUTER JOIN TAPE ON "
"TAPE_POOL.TAPE_POOL_ID = TAPE.TAPE_POOL_ID "
"LEFT OUTER JOIN MEDIA_TYPE ON "
"TAPE.MEDIA_TYPE_ID = MEDIA_TYPE.MEDIA_TYPE_ID "
"GROUP BY "
"TAPE_POOL.TAPE_POOL_NAME,"
"VIRTUAL_ORGANIZATION.VIRTUAL_ORGANIZATION_NAME,"
......@@ -3018,7 +3020,6 @@ void RdbmsCatalogue::createTape(
"VENDOR," "\n"
"LOGICAL_LIBRARY_ID," "\n"
"TAPE_POOL_ID," "\n"
"CAPACITY_IN_BYTES," "\n"
"DATA_IN_BYTES," "\n"
"LAST_FSEQ," "\n"
"IS_DISABLED," "\n"
......@@ -3041,7 +3042,6 @@ void RdbmsCatalogue::createTape(
":VENDOR," "\n"
":LOGICAL_LIBRARY_ID," "\n"
":TAPE_POOL_ID," "\n"
":CAPACITY_IN_BYTES," "\n"
":DATA_IN_BYTES," "\n"
":LAST_FSEQ," "\n"
":IS_DISABLED," "\n"
......@@ -3066,7 +3066,6 @@ void RdbmsCatalogue::createTape(
stmt.bindString(":VENDOR", vendor);
stmt.bindUint64(":LOGICAL_LIBRARY_ID", logicalLibraryId.value());
stmt.bindUint64(":TAPE_POOL_ID", tapePoolId.value());
stmt.bindUint64(":CAPACITY_IN_BYTES", capacityInBytes);
stmt.bindUint64(":DATA_IN_BYTES", 0);
stmt.bindUint64(":LAST_FSEQ", 0);
stmt.bindBool(":IS_DISABLED", disabled);
......@@ -3093,7 +3092,6 @@ void RdbmsCatalogue::createTape(
.add("vendor", vendor)
.add("logicalLibraryName", logicalLibraryName)
.add("tapePoolName", tapePoolName)
.add("capacityInBytes", capacityInBytes)
.add("isDisabled", disabled ? 1 : 0)
.add("isFull", full ? 1 : 0)
.add("isReadOnly", readOnly ? 1 : 0)
......@@ -3263,7 +3261,7 @@ std::list<common::dataStructures::Tape> RdbmsCatalogue::getTapes(rdbms::Conn &co
"TAPE_POOL.TAPE_POOL_NAME AS TAPE_POOL_NAME,"
"VIRTUAL_ORGANIZATION.VIRTUAL_ORGANIZATION_NAME AS VO,"
"TAPE.ENCRYPTION_KEY_NAME AS ENCRYPTION_KEY_NAME,"
"TAPE.CAPACITY_IN_BYTES AS CAPACITY_IN_BYTES,"
"MEDIA_TYPE.CAPACITY_IN_BYTES AS CAPACITY_IN_BYTES,"
"TAPE.DATA_IN_BYTES AS DATA_IN_BYTES,"
"TAPE.NB_MASTER_FILES AS NB_MASTER_FILES,"
"TAPE.MASTER_DATA_IN_BYTES AS MASTER_DATA_IN_BYTES,"
......@@ -3352,7 +3350,7 @@ std::list<common::dataStructures::Tape> RdbmsCatalogue::getTapes(rdbms::Conn &co
}
if(searchCriteria.capacityInBytes) {
if(addedAWhereConstraint) sql += " AND ";
sql += " TAPE.CAPACITY_IN_BYTES = :CAPACITY_IN_BYTES";
sql += " MEDIA_TYPE.CAPACITY_IN_BYTES = :CAPACITY_IN_BYTES";
addedAWhereConstraint = true;
}
if(searchCriteria.disabled) {
......@@ -3483,7 +3481,7 @@ common::dataStructures::VidToTapeMap RdbmsCatalogue::getTapesByVid(const std::se
"TAPE_POOL.TAPE_POOL_NAME AS TAPE_POOL_NAME,"
"VIRTUAL_ORGANIZATION.VIRTUAL_ORGANIZATION_NAME AS VO,"
"TAPE.ENCRYPTION_KEY_NAME AS ENCRYPTION_KEY_NAME,"
"TAPE.CAPACITY_IN_BYTES AS CAPACITY_IN_BYTES,"
"MEDIA_TYPE.CAPACITY_IN_BYTES AS CAPACITY_IN_BYTES,"
"TAPE.DATA_IN_BYTES AS DATA_IN_BYTES,"
"TAPE.LAST_FSEQ AS LAST_FSEQ,"
"TAPE.IS_DISABLED AS IS_DISABLED,"
......@@ -3615,7 +3613,7 @@ common::dataStructures::VidToTapeMap RdbmsCatalogue::getAllTapes() const {
"TAPE_POOL.TAPE_POOL_NAME AS TAPE_POOL_NAME,"
"VIRTUAL_ORGANIZATION.VIRTUAL_ORGANIZATION_NAME AS VO,"
"TAPE.ENCRYPTION_KEY_NAME AS ENCRYPTION_KEY_NAME,"
"TAPE.CAPACITY_IN_BYTES AS CAPACITY_IN_BYTES,"
"MEDIA_TYPE.CAPACITY_IN_BYTES AS CAPACITY_IN_BYTES,"
"TAPE.DATA_IN_BYTES AS DATA_IN_BYTES,"
"TAPE.LAST_FSEQ AS LAST_FSEQ,"
"TAPE.IS_DISABLED AS IS_DISABLED,"
......@@ -4157,50 +4155,6 @@ void RdbmsCatalogue::modifyTapeTapePoolName(const common::dataStructures::Securi
}
}
//------------------------------------------------------------------------------
// modifyTapeCapacityInBytes
//------------------------------------------------------------------------------
void RdbmsCatalogue::modifyTapeCapacityInBytes(const common::dataStructures::SecurityIdentity &admin,
const std::string &vid, const uint64_t capacityInBytes) {
try {
const time_t now = time(nullptr);
const char *const sql =
"UPDATE TAPE SET "
"CAPACITY_IN_BYTES = :CAPACITY_IN_BYTES,"
"LAST_UPDATE_USER_NAME = :LAST_UPDATE_USER_NAME,"
"LAST_UPDATE_HOST_NAME = :LAST_UPDATE_HOST_NAME,"
"LAST_UPDATE_TIME = :LAST_UPDATE_TIME "
"WHERE "
"VID = :VID";
auto conn = m_connPool.getConn();
auto stmt = conn.createStmt(sql);
stmt.bindUint64(":CAPACITY_IN_BYTES", capacityInBytes);
stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username);
stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host);
stmt.bindUint64(":LAST_UPDATE_TIME", now);
stmt.bindString(":VID", vid);
stmt.executeNonQuery();
if(0 == stmt.getNbAffectedRows()) {
throw exception::UserError(std::string("Cannot modify tape ") + vid + " because it does not exist");
}
log::LogContext lc(m_log);
log::ScopedParamContainer spc(lc);
spc.add("vid", vid)
.add("capacityInBytes", capacityInBytes)
.add("lastUpdateUserName", admin.username)
.add("lastUpdateHostName", admin.host)
.add("lastUpdateTime", now);
lc.log(log::INFO, "Catalogue - user modified tape - capacityInBytes");
} catch(exception::UserError &) {
throw;
} catch(exception::Exception &ex) {
ex.getMessage().str(std::string(__FUNCTION__) + ": " + ex.getMessage().str());
throw;
}
}
//------------------------------------------------------------------------------
// modifyTapeEncryptionKeyName
//------------------------------------------------------------------------------
......@@ -7367,7 +7321,7 @@ std::list<TapeForWriting> RdbmsCatalogue::getTapesForWriting(const std::string &
"LOGICAL_LIBRARY.LOGICAL_LIBRARY_NAME AS LOGICAL_LIBRARY_NAME,"
"TAPE_POOL.TAPE_POOL_NAME AS TAPE_POOL_NAME,"
"VIRTUAL_ORGANIZATION.VIRTUAL_ORGANIZATION_NAME AS VO,"
"TAPE.CAPACITY_IN_BYTES AS CAPACITY_IN_BYTES,"
"MEDIA_TYPE.CAPACITY_IN_BYTES AS CAPACITY_IN_BYTES,"
"TAPE.DATA_IN_BYTES AS DATA_IN_BYTES,"
"TAPE.LAST_FSEQ AS LAST_FSEQ "
"FROM "
......
......@@ -568,7 +568,6 @@ public:
void modifyTapeVendor(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &vendor) override;
void modifyTapeLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &logicalLibraryName) override;
void modifyTapeTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &tapePoolName) override;
void modifyTapeCapacityInBytes(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const uint64_t capacityInBytes) override;
void modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &encryptionKeyName) override;
/**
......
......@@ -139,7 +139,6 @@ CREATE TABLE TAPE(
LOGICAL_LIBRARY_ID UINT64TYPE CONSTRAINT TAPE_LLI_NN NOT NULL,
TAPE_POOL_ID UINT64TYPE CONSTRAINT TAPE_TPI_NN NOT NULL,
ENCRYPTION_KEY_NAME VARCHAR(100),
CAPACITY_IN_BYTES UINT64TYPE CONSTRAINT TAPE_CIB_NN NOT NULL,
DATA_IN_BYTES UINT64TYPE CONSTRAINT TAPE_DIB_NN NOT NULL,
LAST_FSEQ UINT64TYPE CONSTRAINT TAPE_LF_NN NOT NULL,
NB_MASTER_FILES UINT64TYPE DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,
......
......@@ -314,7 +314,7 @@ public:
cta::catalogue::MediaType mediaType;
mediaType.name = s_mediaType;
mediaType.capacityInBytes = 10;
mediaType.capacityInBytes = 12345678;
mediaType.cartridge = "cartridge";
mediaType.comment = "comment";
catalogue.createMediaType(s_adminOnAdminHost,mediaType);
......
......@@ -1714,9 +1714,6 @@ void RequestMessage::processTape_Ch(cta::xrd::Response &response)
if(tapepool) {
m_catalogue.modifyTapeTapePoolName(m_cliIdentity, vid, tapepool.value());
}
if(capacity) {
m_catalogue.modifyTapeCapacityInBytes(m_cliIdentity, vid, capacity.value());
}
if(comment) {
m_catalogue.modifyTapeComment(m_cliIdentity, vid, comment.value());
}
......
Markdown is supported
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