diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 49f406c4369dc387d0b10abf329dd8a767e3ea82..dfc372f41a16d04cc55217ec77c9ade106c16bbd 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -27,6 +27,7 @@ Please consult the [database upgrade documentation](https://eoscta.docs.cern.ch/ - cta/CTA#1171 - Add LABEL_FORMAT column to TAPE table - cta/CTA#1172 - Add disabled reason column to logical library table - cta/CTA#1177 - Fix CTA catalogue schema verify index checker for PostgreSQL +- cta/CTA#1147 - Add foreign key constraint between the disk instance name of a vo and the disk instance table ### Continuous Integration diff --git a/catalogue/10.0/oracle_catalogue_schema.sql b/catalogue/10.0/oracle_catalogue_schema.sql index fc2cb2e8e6831592ccbd4eea0163e9fdc429971e..7b9e33d2506370dfd61a9f692d78ac4417ea1bf8 100644 --- a/catalogue/10.0/oracle_catalogue_schema.sql +++ b/catalogue/10.0/oracle_catalogue_schema.sql @@ -148,10 +148,13 @@ CREATE TABLE VIRTUAL_ORGANIZATION( LAST_UPDATE_USER_NAME VARCHAR2(100) CONSTRAINT VIRTUAL_ORGANIZATION_LUUN_NN NOT NULL, LAST_UPDATE_HOST_NAME VARCHAR2(100) CONSTRAINT VIRTUAL_ORGANIZATION_LUHN_NN NOT NULL, LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT VIRTUAL_ORGANIZATION_LUT_NN NOT NULL, - DISK_INSTANCE_NAME VARCHAR2(100), - CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID) + DISK_INSTANCE_NAME VARCHAR2(100) CONSTRAINT VIRTUAL_ORGANIZATION_DIN_NN NOT NULL, + CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID), + CONSTRAINT VIRTUAL_ORGANIZATION_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME) ); CREATE UNIQUE INDEX VIRTUAL_ORG_VON_UN_IDX ON VIRTUAL_ORGANIZATION(LOWER(VIRTUAL_ORGANIZATION_NAME)); +CREATE INDEX VIRTUAL_ORG_DIN_IDX ON VIRTUAL_ORGANIZATION(DISK_INSTANCE_NAME); + CREATE TABLE STORAGE_CLASS( STORAGE_CLASS_ID NUMERIC(20, 0) CONSTRAINT STORAGE_CLASS_SCI_NN NOT NULL, STORAGE_CLASS_NAME VARCHAR2(100) CONSTRAINT STORAGE_CLASS_SCN_NN NOT NULL, @@ -324,10 +327,12 @@ CREATE TABLE REQUESTER_ACTIVITY_MOUNT_RULE( LAST_UPDATE_HOST_NAME VARCHAR2(100) CONSTRAINT RQSTER_ACT_RULE_LUHN_NN NOT NULL, LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT RQSTER_ACT_RULE_LUT_NN NOT NULL, CONSTRAINT RQSTER_ACT_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_NAME, ACTIVITY_REGEX), - CONSTRAINT RQSTER_ACT_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) - REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME) + CONSTRAINT RQSTER_ACT_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME), + CONSTRAINT RQSTER_ACT_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME) ); CREATE INDEX REQ_ACT_MNT_RULE_MPN_IDX ON REQUESTER_ACTIVITY_MOUNT_RULE(MOUNT_POLICY_NAME); +CREATE INDEX REQ_ACT_MNT_RULE_DIN_IDX ON REQUESTER_ACTIVITY_MOUNT_RULE(DISK_INSTANCE_NAME); + CREATE TABLE REQUESTER_MOUNT_RULE( DISK_INSTANCE_NAME VARCHAR2(100) CONSTRAINT RQSTER_RULE_DIN_NN NOT NULL, REQUESTER_NAME VARCHAR2(100) CONSTRAINT RQSTER_RULE_RN_NN NOT NULL, @@ -340,10 +345,12 @@ CREATE TABLE REQUESTER_MOUNT_RULE( LAST_UPDATE_HOST_NAME VARCHAR2(100) CONSTRAINT RQSTER_RULE_LUHN_NN NOT NULL, LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT RQSTER_RULE_LUT_NN NOT NULL, CONSTRAINT RQSTER_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_NAME), - CONSTRAINT RQSTER_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) - REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME) + CONSTRAINT RQSTER_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME), + CONSTRAINT RQSTER_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME) ); CREATE INDEX REQ_MNT_RULE_MPN_IDX ON REQUESTER_MOUNT_RULE(MOUNT_POLICY_NAME); +CREATE INDEX REQ_MNT_RULE_DIN_IDX ON REQUESTER_MOUNT_RULE(DISK_INSTANCE_NAME); + CREATE TABLE REQUESTER_GROUP_MOUNT_RULE( DISK_INSTANCE_NAME VARCHAR2(100) CONSTRAINT RQSTER_GRP_RULE_DIN_NN NOT NULL, REQUESTER_GROUP_NAME VARCHAR2(100) CONSTRAINT RQSTER_GRP_RULE_RGN_NN NOT NULL, @@ -356,10 +363,13 @@ CREATE TABLE REQUESTER_GROUP_MOUNT_RULE( LAST_UPDATE_HOST_NAME VARCHAR2(100) CONSTRAINT RQSTER_GRP_RULE_LUHN_NN NOT NULL, LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT RQSTER_GRP_RULE_LUT_NN NOT NULL, CONSTRAINT RQSTER_GRP_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_GROUP_NAME), - CONSTRAINT RQSTER_GRP_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) - REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME) + CONSTRAINT RQSTER_GRP_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME), + CONSTRAINT RQSTER_GRP_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME) + ); CREATE INDEX REQ_GRP_MNT_RULE_MPN_IDX ON REQUESTER_GROUP_MOUNT_RULE(MOUNT_POLICY_NAME); +CREATE INDEX REQ_GRP_MNT_RULE_DIN_IDX ON REQUESTER_GROUP_MOUNT_RULE(DISK_INSTANCE_NAME); + CREATE TABLE ARCHIVE_FILE( ARCHIVE_FILE_ID NUMERIC(20, 0) CONSTRAINT ARCHIVE_FILE_AFI_NN NOT NULL, DISK_INSTANCE_NAME VARCHAR2(100) CONSTRAINT ARCHIVE_FILE_DIN_NN NOT NULL, @@ -376,6 +386,7 @@ CREATE TABLE ARCHIVE_FILE( COLLOCATION_HINT VARCHAR2(100), CONSTRAINT ARCHIVE_FILE_PK PRIMARY KEY(ARCHIVE_FILE_ID), CONSTRAINT ARCHIVE_FILE_STORAGE_CLASS_FK FOREIGN KEY(STORAGE_CLASS_ID) REFERENCES STORAGE_CLASS(STORAGE_CLASS_ID), + CONSTRAINT ARCHIVE_FILE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME), CONSTRAINT ARCHIVE_FILE_DIN_DFI_UN UNIQUE(DISK_INSTANCE_NAME, DISK_FILE_ID), CONSTRAINT ARCHIVE_FILE_ID_BOOL_CK CHECK(IS_DELETED IN ('0', '1')) ); diff --git a/catalogue/10.0/postgres_catalogue_schema.sql b/catalogue/10.0/postgres_catalogue_schema.sql index cb9bc24406c0256aeeb05dd3b841ff0843ed74b6..8e4e8537100993a582cb13de35158fcf111ed880 100644 --- a/catalogue/10.0/postgres_catalogue_schema.sql +++ b/catalogue/10.0/postgres_catalogue_schema.sql @@ -130,10 +130,13 @@ CREATE TABLE VIRTUAL_ORGANIZATION( LAST_UPDATE_USER_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_LUUN_NN NOT NULL, LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_LUHN_NN NOT NULL, LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT VIRTUAL_ORGANIZATION_LUT_NN NOT NULL, - DISK_INSTANCE_NAME VARCHAR(100), - CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID) + DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_DIN_NN NOT NULL, + CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID), + CONSTRAINT VIRTUAL_ORGANIZATION_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME) ); CREATE UNIQUE INDEX VIRTUAL_ORG_VON_UN_IDX ON VIRTUAL_ORGANIZATION(LOWER(VIRTUAL_ORGANIZATION_NAME)); +CREATE INDEX VIRTUAL_ORG_DIN_IDX ON VIRTUAL_ORGANIZATION(DISK_INSTANCE_NAME); + CREATE TABLE STORAGE_CLASS( STORAGE_CLASS_ID NUMERIC(20, 0) CONSTRAINT STORAGE_CLASS_SCI_NN NOT NULL, STORAGE_CLASS_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_SCN_NN NOT NULL, @@ -306,10 +309,12 @@ CREATE TABLE REQUESTER_ACTIVITY_MOUNT_RULE( LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT RQSTER_ACT_RULE_LUHN_NN NOT NULL, LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT RQSTER_ACT_RULE_LUT_NN NOT NULL, CONSTRAINT RQSTER_ACT_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_NAME, ACTIVITY_REGEX), - CONSTRAINT RQSTER_ACT_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) - REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME) + CONSTRAINT RQSTER_ACT_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME), + CONSTRAINT RQSTER_ACT_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME) ); CREATE INDEX REQ_ACT_MNT_RULE_MPN_IDX ON REQUESTER_ACTIVITY_MOUNT_RULE(MOUNT_POLICY_NAME); +CREATE INDEX REQ_ACT_MNT_RULE_DIN_IDX ON REQUESTER_ACTIVITY_MOUNT_RULE(DISK_INSTANCE_NAME); + CREATE TABLE REQUESTER_MOUNT_RULE( DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT RQSTER_RULE_DIN_NN NOT NULL, REQUESTER_NAME VARCHAR(100) CONSTRAINT RQSTER_RULE_RN_NN NOT NULL, @@ -322,10 +327,12 @@ CREATE TABLE REQUESTER_MOUNT_RULE( LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT RQSTER_RULE_LUHN_NN NOT NULL, LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT RQSTER_RULE_LUT_NN NOT NULL, CONSTRAINT RQSTER_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_NAME), - CONSTRAINT RQSTER_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) - REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME) + CONSTRAINT RQSTER_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME), + CONSTRAINT RQSTER_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME) ); CREATE INDEX REQ_MNT_RULE_MPN_IDX ON REQUESTER_MOUNT_RULE(MOUNT_POLICY_NAME); +CREATE INDEX REQ_MNT_RULE_DIN_IDX ON REQUESTER_MOUNT_RULE(DISK_INSTANCE_NAME); + CREATE TABLE REQUESTER_GROUP_MOUNT_RULE( DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT RQSTER_GRP_RULE_DIN_NN NOT NULL, REQUESTER_GROUP_NAME VARCHAR(100) CONSTRAINT RQSTER_GRP_RULE_RGN_NN NOT NULL, @@ -338,10 +345,13 @@ CREATE TABLE REQUESTER_GROUP_MOUNT_RULE( LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT RQSTER_GRP_RULE_LUHN_NN NOT NULL, LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT RQSTER_GRP_RULE_LUT_NN NOT NULL, CONSTRAINT RQSTER_GRP_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_GROUP_NAME), - CONSTRAINT RQSTER_GRP_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) - REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME) + CONSTRAINT RQSTER_GRP_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME), + CONSTRAINT RQSTER_GRP_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME) + ); CREATE INDEX REQ_GRP_MNT_RULE_MPN_IDX ON REQUESTER_GROUP_MOUNT_RULE(MOUNT_POLICY_NAME); +CREATE INDEX REQ_GRP_MNT_RULE_DIN_IDX ON REQUESTER_GROUP_MOUNT_RULE(DISK_INSTANCE_NAME); + CREATE TABLE ARCHIVE_FILE( ARCHIVE_FILE_ID NUMERIC(20, 0) CONSTRAINT ARCHIVE_FILE_AFI_NN NOT NULL, DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT ARCHIVE_FILE_DIN_NN NOT NULL, @@ -358,6 +368,7 @@ CREATE TABLE ARCHIVE_FILE( COLLOCATION_HINT VARCHAR(100), CONSTRAINT ARCHIVE_FILE_PK PRIMARY KEY(ARCHIVE_FILE_ID), CONSTRAINT ARCHIVE_FILE_STORAGE_CLASS_FK FOREIGN KEY(STORAGE_CLASS_ID) REFERENCES STORAGE_CLASS(STORAGE_CLASS_ID), + CONSTRAINT ARCHIVE_FILE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME), CONSTRAINT ARCHIVE_FILE_DIN_DFI_UN UNIQUE(DISK_INSTANCE_NAME, DISK_FILE_ID), CONSTRAINT ARCHIVE_FILE_ID_BOOL_CK CHECK(IS_DELETED IN ('0', '1')) ); diff --git a/catalogue/10.0/sqlite_catalogue_schema.sql b/catalogue/10.0/sqlite_catalogue_schema.sql index 6cbcb84dd8865fd81f65f04102a6a2f151cfbf8d..315b482d7420570e0e49c8affdf07d16bda43dd0 100644 --- a/catalogue/10.0/sqlite_catalogue_schema.sql +++ b/catalogue/10.0/sqlite_catalogue_schema.sql @@ -102,10 +102,13 @@ CREATE TABLE VIRTUAL_ORGANIZATION( LAST_UPDATE_USER_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_LUUN_NN NOT NULL, LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_LUHN_NN NOT NULL, LAST_UPDATE_TIME INTEGER CONSTRAINT VIRTUAL_ORGANIZATION_LUT_NN NOT NULL, - DISK_INSTANCE_NAME VARCHAR(100), - CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID) + DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_DIN_NN NOT NULL, + CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID), + CONSTRAINT VIRTUAL_ORGANIZATION_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME) ); CREATE UNIQUE INDEX VIRTUAL_ORG_VON_UN_IDX ON VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_NAME); +CREATE INDEX VIRTUAL_ORG_DIN_IDX ON VIRTUAL_ORGANIZATION(DISK_INSTANCE_NAME); + CREATE TABLE STORAGE_CLASS( STORAGE_CLASS_ID INTEGER CONSTRAINT STORAGE_CLASS_SCI_NN NOT NULL, STORAGE_CLASS_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_SCN_NN NOT NULL, @@ -278,10 +281,12 @@ CREATE TABLE REQUESTER_ACTIVITY_MOUNT_RULE( LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT RQSTER_ACT_RULE_LUHN_NN NOT NULL, LAST_UPDATE_TIME INTEGER CONSTRAINT RQSTER_ACT_RULE_LUT_NN NOT NULL, CONSTRAINT RQSTER_ACT_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_NAME, ACTIVITY_REGEX), - CONSTRAINT RQSTER_ACT_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) - REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME) + CONSTRAINT RQSTER_ACT_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME), + CONSTRAINT RQSTER_ACT_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME) ); CREATE INDEX REQ_ACT_MNT_RULE_MPN_IDX ON REQUESTER_ACTIVITY_MOUNT_RULE(MOUNT_POLICY_NAME); +CREATE INDEX REQ_ACT_MNT_RULE_DIN_IDX ON REQUESTER_ACTIVITY_MOUNT_RULE(DISK_INSTANCE_NAME); + CREATE TABLE REQUESTER_MOUNT_RULE( DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT RQSTER_RULE_DIN_NN NOT NULL, REQUESTER_NAME VARCHAR(100) CONSTRAINT RQSTER_RULE_RN_NN NOT NULL, @@ -294,10 +299,12 @@ CREATE TABLE REQUESTER_MOUNT_RULE( LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT RQSTER_RULE_LUHN_NN NOT NULL, LAST_UPDATE_TIME INTEGER CONSTRAINT RQSTER_RULE_LUT_NN NOT NULL, CONSTRAINT RQSTER_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_NAME), - CONSTRAINT RQSTER_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) - REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME) + CONSTRAINT RQSTER_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME), + CONSTRAINT RQSTER_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME) ); CREATE INDEX REQ_MNT_RULE_MPN_IDX ON REQUESTER_MOUNT_RULE(MOUNT_POLICY_NAME); +CREATE INDEX REQ_MNT_RULE_DIN_IDX ON REQUESTER_MOUNT_RULE(DISK_INSTANCE_NAME); + CREATE TABLE REQUESTER_GROUP_MOUNT_RULE( DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT RQSTER_GRP_RULE_DIN_NN NOT NULL, REQUESTER_GROUP_NAME VARCHAR(100) CONSTRAINT RQSTER_GRP_RULE_RGN_NN NOT NULL, @@ -310,10 +317,13 @@ CREATE TABLE REQUESTER_GROUP_MOUNT_RULE( LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT RQSTER_GRP_RULE_LUHN_NN NOT NULL, LAST_UPDATE_TIME INTEGER CONSTRAINT RQSTER_GRP_RULE_LUT_NN NOT NULL, CONSTRAINT RQSTER_GRP_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_GROUP_NAME), - CONSTRAINT RQSTER_GRP_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) - REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME) + CONSTRAINT RQSTER_GRP_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME), + CONSTRAINT RQSTER_GRP_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME) + ); CREATE INDEX REQ_GRP_MNT_RULE_MPN_IDX ON REQUESTER_GROUP_MOUNT_RULE(MOUNT_POLICY_NAME); +CREATE INDEX REQ_GRP_MNT_RULE_DIN_IDX ON REQUESTER_GROUP_MOUNT_RULE(DISK_INSTANCE_NAME); + CREATE TABLE ARCHIVE_FILE( ARCHIVE_FILE_ID INTEGER CONSTRAINT ARCHIVE_FILE_AFI_NN NOT NULL, DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT ARCHIVE_FILE_DIN_NN NOT NULL, @@ -330,6 +340,7 @@ CREATE TABLE ARCHIVE_FILE( COLLOCATION_HINT VARCHAR(100), CONSTRAINT ARCHIVE_FILE_PK PRIMARY KEY(ARCHIVE_FILE_ID), CONSTRAINT ARCHIVE_FILE_STORAGE_CLASS_FK FOREIGN KEY(STORAGE_CLASS_ID) REFERENCES STORAGE_CLASS(STORAGE_CLASS_ID), + CONSTRAINT ARCHIVE_FILE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME), CONSTRAINT ARCHIVE_FILE_DIN_DFI_UN UNIQUE(DISK_INSTANCE_NAME, DISK_FILE_ID), CONSTRAINT ARCHIVE_FILE_ID_BOOL_CK CHECK(IS_DELETED IN ('0', '1')) ); diff --git a/catalogue/AllCatalogueSchema.hpp b/catalogue/AllCatalogueSchema.hpp index 75b64bbc13d63529d906660e265120e4a28df16e..087a02c78dbca3027b124cfd37426fdcbd899f07 100644 --- a/catalogue/AllCatalogueSchema.hpp +++ b/catalogue/AllCatalogueSchema.hpp @@ -1082,10 +1082,13 @@ namespace catalogue{ " LAST_UPDATE_USER_NAME VARCHAR2(100) CONSTRAINT VIRTUAL_ORGANIZATION_LUUN_NN NOT NULL," " LAST_UPDATE_HOST_NAME VARCHAR2(100) CONSTRAINT VIRTUAL_ORGANIZATION_LUHN_NN NOT NULL," " LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT VIRTUAL_ORGANIZATION_LUT_NN NOT NULL," - " DISK_INSTANCE_NAME VARCHAR2(100)," - " CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID)" + " DISK_INSTANCE_NAME VARCHAR2(100) CONSTRAINT VIRTUAL_ORGANIZATION_DIN_NN NOT NULL," + " CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID)," + " CONSTRAINT VIRTUAL_ORGANIZATION_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME)" ");" "CREATE UNIQUE INDEX VIRTUAL_ORG_VON_UN_IDX ON VIRTUAL_ORGANIZATION(LOWER(VIRTUAL_ORGANIZATION_NAME));" + "CREATE INDEX VIRTUAL_ORG_DIN_IDX ON VIRTUAL_ORGANIZATION(DISK_INSTANCE_NAME);" + "" "CREATE TABLE STORAGE_CLASS(" " STORAGE_CLASS_ID NUMERIC(20, 0) CONSTRAINT STORAGE_CLASS_SCI_NN NOT NULL," " STORAGE_CLASS_NAME VARCHAR2(100) CONSTRAINT STORAGE_CLASS_SCN_NN NOT NULL," @@ -1258,10 +1261,12 @@ namespace catalogue{ " LAST_UPDATE_HOST_NAME VARCHAR2(100) CONSTRAINT RQSTER_ACT_RULE_LUHN_NN NOT NULL," " LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT RQSTER_ACT_RULE_LUT_NN NOT NULL," " CONSTRAINT RQSTER_ACT_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_NAME, ACTIVITY_REGEX)," - " CONSTRAINT RQSTER_ACT_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME)" - " REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)" + " CONSTRAINT RQSTER_ACT_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)," + " CONSTRAINT RQSTER_ACT_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME)" ");" "CREATE INDEX REQ_ACT_MNT_RULE_MPN_IDX ON REQUESTER_ACTIVITY_MOUNT_RULE(MOUNT_POLICY_NAME);" + "CREATE INDEX REQ_ACT_MNT_RULE_DIN_IDX ON REQUESTER_ACTIVITY_MOUNT_RULE(DISK_INSTANCE_NAME);" + "" "CREATE TABLE REQUESTER_MOUNT_RULE(" " DISK_INSTANCE_NAME VARCHAR2(100) CONSTRAINT RQSTER_RULE_DIN_NN NOT NULL," " REQUESTER_NAME VARCHAR2(100) CONSTRAINT RQSTER_RULE_RN_NN NOT NULL," @@ -1274,10 +1279,12 @@ namespace catalogue{ " LAST_UPDATE_HOST_NAME VARCHAR2(100) CONSTRAINT RQSTER_RULE_LUHN_NN NOT NULL," " LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT RQSTER_RULE_LUT_NN NOT NULL," " CONSTRAINT RQSTER_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_NAME)," - " CONSTRAINT RQSTER_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME)" - " REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)" + " CONSTRAINT RQSTER_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)," + " CONSTRAINT RQSTER_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME)" ");" "CREATE INDEX REQ_MNT_RULE_MPN_IDX ON REQUESTER_MOUNT_RULE(MOUNT_POLICY_NAME);" + "CREATE INDEX REQ_MNT_RULE_DIN_IDX ON REQUESTER_MOUNT_RULE(DISK_INSTANCE_NAME);" + "" "CREATE TABLE REQUESTER_GROUP_MOUNT_RULE(" " DISK_INSTANCE_NAME VARCHAR2(100) CONSTRAINT RQSTER_GRP_RULE_DIN_NN NOT NULL," " REQUESTER_GROUP_NAME VARCHAR2(100) CONSTRAINT RQSTER_GRP_RULE_RGN_NN NOT NULL," @@ -1290,10 +1297,13 @@ namespace catalogue{ " LAST_UPDATE_HOST_NAME VARCHAR2(100) CONSTRAINT RQSTER_GRP_RULE_LUHN_NN NOT NULL," " LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT RQSTER_GRP_RULE_LUT_NN NOT NULL," " CONSTRAINT RQSTER_GRP_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_GROUP_NAME)," - " CONSTRAINT RQSTER_GRP_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME)" - " REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)" + " CONSTRAINT RQSTER_GRP_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)," + " CONSTRAINT RQSTER_GRP_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME)" + "" ");" "CREATE INDEX REQ_GRP_MNT_RULE_MPN_IDX ON REQUESTER_GROUP_MOUNT_RULE(MOUNT_POLICY_NAME);" + "CREATE INDEX REQ_GRP_MNT_RULE_DIN_IDX ON REQUESTER_GROUP_MOUNT_RULE(DISK_INSTANCE_NAME);" + "" "CREATE TABLE ARCHIVE_FILE(" " ARCHIVE_FILE_ID NUMERIC(20, 0) CONSTRAINT ARCHIVE_FILE_AFI_NN NOT NULL," " DISK_INSTANCE_NAME VARCHAR2(100) CONSTRAINT ARCHIVE_FILE_DIN_NN NOT NULL," @@ -1310,6 +1320,7 @@ namespace catalogue{ " COLLOCATION_HINT VARCHAR2(100)," " CONSTRAINT ARCHIVE_FILE_PK PRIMARY KEY(ARCHIVE_FILE_ID)," " CONSTRAINT ARCHIVE_FILE_STORAGE_CLASS_FK FOREIGN KEY(STORAGE_CLASS_ID) REFERENCES STORAGE_CLASS(STORAGE_CLASS_ID)," + " CONSTRAINT ARCHIVE_FILE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME)," " CONSTRAINT ARCHIVE_FILE_DIN_DFI_UN UNIQUE(DISK_INSTANCE_NAME, DISK_FILE_ID)," " CONSTRAINT ARCHIVE_FILE_ID_BOOL_CK CHECK(IS_DELETED IN ('0', '1'))" ");" @@ -1560,10 +1571,13 @@ namespace catalogue{ " LAST_UPDATE_USER_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_LUUN_NN NOT NULL," " LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_LUHN_NN NOT NULL," " LAST_UPDATE_TIME INTEGER CONSTRAINT VIRTUAL_ORGANIZATION_LUT_NN NOT NULL," - " DISK_INSTANCE_NAME VARCHAR(100)," - " CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID)" + " DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_DIN_NN NOT NULL," + " CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID)," + " CONSTRAINT VIRTUAL_ORGANIZATION_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME)" ");" "CREATE UNIQUE INDEX VIRTUAL_ORG_VON_UN_IDX ON VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_NAME);" + "CREATE INDEX VIRTUAL_ORG_DIN_IDX ON VIRTUAL_ORGANIZATION(DISK_INSTANCE_NAME);" + "" "CREATE TABLE STORAGE_CLASS(" " STORAGE_CLASS_ID INTEGER CONSTRAINT STORAGE_CLASS_SCI_NN NOT NULL," " STORAGE_CLASS_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_SCN_NN NOT NULL," @@ -1736,10 +1750,12 @@ namespace catalogue{ " LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT RQSTER_ACT_RULE_LUHN_NN NOT NULL," " LAST_UPDATE_TIME INTEGER CONSTRAINT RQSTER_ACT_RULE_LUT_NN NOT NULL," " CONSTRAINT RQSTER_ACT_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_NAME, ACTIVITY_REGEX)," - " CONSTRAINT RQSTER_ACT_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME)" - " REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)" + " CONSTRAINT RQSTER_ACT_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)," + " CONSTRAINT RQSTER_ACT_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME)" ");" "CREATE INDEX REQ_ACT_MNT_RULE_MPN_IDX ON REQUESTER_ACTIVITY_MOUNT_RULE(MOUNT_POLICY_NAME);" + "CREATE INDEX REQ_ACT_MNT_RULE_DIN_IDX ON REQUESTER_ACTIVITY_MOUNT_RULE(DISK_INSTANCE_NAME);" + "" "CREATE TABLE REQUESTER_MOUNT_RULE(" " DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT RQSTER_RULE_DIN_NN NOT NULL," " REQUESTER_NAME VARCHAR(100) CONSTRAINT RQSTER_RULE_RN_NN NOT NULL," @@ -1752,10 +1768,12 @@ namespace catalogue{ " LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT RQSTER_RULE_LUHN_NN NOT NULL," " LAST_UPDATE_TIME INTEGER CONSTRAINT RQSTER_RULE_LUT_NN NOT NULL," " CONSTRAINT RQSTER_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_NAME)," - " CONSTRAINT RQSTER_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME)" - " REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)" + " CONSTRAINT RQSTER_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)," + " CONSTRAINT RQSTER_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME)" ");" "CREATE INDEX REQ_MNT_RULE_MPN_IDX ON REQUESTER_MOUNT_RULE(MOUNT_POLICY_NAME);" + "CREATE INDEX REQ_MNT_RULE_DIN_IDX ON REQUESTER_MOUNT_RULE(DISK_INSTANCE_NAME);" + "" "CREATE TABLE REQUESTER_GROUP_MOUNT_RULE(" " DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT RQSTER_GRP_RULE_DIN_NN NOT NULL," " REQUESTER_GROUP_NAME VARCHAR(100) CONSTRAINT RQSTER_GRP_RULE_RGN_NN NOT NULL," @@ -1768,10 +1786,13 @@ namespace catalogue{ " LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT RQSTER_GRP_RULE_LUHN_NN NOT NULL," " LAST_UPDATE_TIME INTEGER CONSTRAINT RQSTER_GRP_RULE_LUT_NN NOT NULL," " CONSTRAINT RQSTER_GRP_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_GROUP_NAME)," - " CONSTRAINT RQSTER_GRP_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME)" - " REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)" + " CONSTRAINT RQSTER_GRP_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)," + " CONSTRAINT RQSTER_GRP_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME)" + "" ");" "CREATE INDEX REQ_GRP_MNT_RULE_MPN_IDX ON REQUESTER_GROUP_MOUNT_RULE(MOUNT_POLICY_NAME);" + "CREATE INDEX REQ_GRP_MNT_RULE_DIN_IDX ON REQUESTER_GROUP_MOUNT_RULE(DISK_INSTANCE_NAME);" + "" "CREATE TABLE ARCHIVE_FILE(" " ARCHIVE_FILE_ID INTEGER CONSTRAINT ARCHIVE_FILE_AFI_NN NOT NULL," " DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT ARCHIVE_FILE_DIN_NN NOT NULL," @@ -1788,6 +1809,7 @@ namespace catalogue{ " COLLOCATION_HINT VARCHAR(100)," " CONSTRAINT ARCHIVE_FILE_PK PRIMARY KEY(ARCHIVE_FILE_ID)," " CONSTRAINT ARCHIVE_FILE_STORAGE_CLASS_FK FOREIGN KEY(STORAGE_CLASS_ID) REFERENCES STORAGE_CLASS(STORAGE_CLASS_ID)," + " CONSTRAINT ARCHIVE_FILE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME)," " CONSTRAINT ARCHIVE_FILE_DIN_DFI_UN UNIQUE(DISK_INSTANCE_NAME, DISK_FILE_ID)," " CONSTRAINT ARCHIVE_FILE_ID_BOOL_CK CHECK(IS_DELETED IN ('0', '1'))" ");" @@ -2063,10 +2085,13 @@ namespace catalogue{ " LAST_UPDATE_USER_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_LUUN_NN NOT NULL," " LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_LUHN_NN NOT NULL," " LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT VIRTUAL_ORGANIZATION_LUT_NN NOT NULL," - " DISK_INSTANCE_NAME VARCHAR(100)," - " CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID)" + " DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_DIN_NN NOT NULL," + " CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID)," + " CONSTRAINT VIRTUAL_ORGANIZATION_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME)" ");" "CREATE UNIQUE INDEX VIRTUAL_ORG_VON_UN_IDX ON VIRTUAL_ORGANIZATION(LOWER(VIRTUAL_ORGANIZATION_NAME));" + "CREATE INDEX VIRTUAL_ORG_DIN_IDX ON VIRTUAL_ORGANIZATION(DISK_INSTANCE_NAME);" + "" "CREATE TABLE STORAGE_CLASS(" " STORAGE_CLASS_ID NUMERIC(20, 0) CONSTRAINT STORAGE_CLASS_SCI_NN NOT NULL," " STORAGE_CLASS_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_SCN_NN NOT NULL," @@ -2239,10 +2264,12 @@ namespace catalogue{ " LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT RQSTER_ACT_RULE_LUHN_NN NOT NULL," " LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT RQSTER_ACT_RULE_LUT_NN NOT NULL," " CONSTRAINT RQSTER_ACT_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_NAME, ACTIVITY_REGEX)," - " CONSTRAINT RQSTER_ACT_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME)" - " REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)" + " CONSTRAINT RQSTER_ACT_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)," + " CONSTRAINT RQSTER_ACT_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME)" ");" "CREATE INDEX REQ_ACT_MNT_RULE_MPN_IDX ON REQUESTER_ACTIVITY_MOUNT_RULE(MOUNT_POLICY_NAME);" + "CREATE INDEX REQ_ACT_MNT_RULE_DIN_IDX ON REQUESTER_ACTIVITY_MOUNT_RULE(DISK_INSTANCE_NAME);" + "" "CREATE TABLE REQUESTER_MOUNT_RULE(" " DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT RQSTER_RULE_DIN_NN NOT NULL," " REQUESTER_NAME VARCHAR(100) CONSTRAINT RQSTER_RULE_RN_NN NOT NULL," @@ -2255,10 +2282,12 @@ namespace catalogue{ " LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT RQSTER_RULE_LUHN_NN NOT NULL," " LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT RQSTER_RULE_LUT_NN NOT NULL," " CONSTRAINT RQSTER_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_NAME)," - " CONSTRAINT RQSTER_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME)" - " REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)" + " CONSTRAINT RQSTER_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)," + " CONSTRAINT RQSTER_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME)" ");" "CREATE INDEX REQ_MNT_RULE_MPN_IDX ON REQUESTER_MOUNT_RULE(MOUNT_POLICY_NAME);" + "CREATE INDEX REQ_MNT_RULE_DIN_IDX ON REQUESTER_MOUNT_RULE(DISK_INSTANCE_NAME);" + "" "CREATE TABLE REQUESTER_GROUP_MOUNT_RULE(" " DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT RQSTER_GRP_RULE_DIN_NN NOT NULL," " REQUESTER_GROUP_NAME VARCHAR(100) CONSTRAINT RQSTER_GRP_RULE_RGN_NN NOT NULL," @@ -2271,10 +2300,13 @@ namespace catalogue{ " LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT RQSTER_GRP_RULE_LUHN_NN NOT NULL," " LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT RQSTER_GRP_RULE_LUT_NN NOT NULL," " CONSTRAINT RQSTER_GRP_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_GROUP_NAME)," - " CONSTRAINT RQSTER_GRP_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME)" - " REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)" + " CONSTRAINT RQSTER_GRP_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME)," + " CONSTRAINT RQSTER_GRP_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME)" + "" ");" "CREATE INDEX REQ_GRP_MNT_RULE_MPN_IDX ON REQUESTER_GROUP_MOUNT_RULE(MOUNT_POLICY_NAME);" + "CREATE INDEX REQ_GRP_MNT_RULE_DIN_IDX ON REQUESTER_GROUP_MOUNT_RULE(DISK_INSTANCE_NAME);" + "" "CREATE TABLE ARCHIVE_FILE(" " ARCHIVE_FILE_ID NUMERIC(20, 0) CONSTRAINT ARCHIVE_FILE_AFI_NN NOT NULL," " DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT ARCHIVE_FILE_DIN_NN NOT NULL," @@ -2291,6 +2323,7 @@ namespace catalogue{ " COLLOCATION_HINT VARCHAR(100)," " CONSTRAINT ARCHIVE_FILE_PK PRIMARY KEY(ARCHIVE_FILE_ID)," " CONSTRAINT ARCHIVE_FILE_STORAGE_CLASS_FK FOREIGN KEY(STORAGE_CLASS_ID) REFERENCES STORAGE_CLASS(STORAGE_CLASS_ID)," + " CONSTRAINT ARCHIVE_FILE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME)," " CONSTRAINT ARCHIVE_FILE_DIN_DFI_UN UNIQUE(DISK_INSTANCE_NAME, DISK_FILE_ID)," " CONSTRAINT ARCHIVE_FILE_ID_BOOL_CK CHECK(IS_DELETED IN ('0', '1'))" ");" diff --git a/catalogue/CatalogueTest.cpp b/catalogue/CatalogueTest.cpp index cf82f25d7d29367dcc880931e25fc390ba0ab05f..9e38bef21c348b692f5fee37872105e1769412f5 100644 --- a/catalogue/CatalogueTest.cpp +++ b/catalogue/CatalogueTest.cpp @@ -75,6 +75,15 @@ namespace { return admin; } + const cta::common::dataStructures::DiskInstance getDiskInstance() { + using namespace cta; + + common::dataStructures::DiskInstance di; + di.name = "disk instance"; + di.comment = "Creation of disk instance"; + return di; + } + cta::common::dataStructures::VirtualOrganization getVo() { using namespace cta; @@ -84,6 +93,7 @@ namespace { vo.readMaxDrives = 1; vo.writeMaxDrives = 1; vo.maxFileSize = 0; + vo.diskInstanceName = getDiskInstance().name; return vo; } @@ -96,6 +106,7 @@ namespace { vo.readMaxDrives = 1; vo.writeMaxDrives = 1; vo.maxFileSize = 0; + vo.diskInstanceName = getDiskInstance().name; return vo; } @@ -297,6 +308,7 @@ cta_catalogue_CatalogueTest::cta_catalogue_CatalogueTest(): m_anotherStorageClass(getAnotherStorageClass()), m_storageClassDualCopy(getStorageClassDualCopy()), m_storageClassTripleCopy(getStorageClassTripleCopy()), + m_diskInstance(getDiskInstance()), m_mediaType(getMediaType()), m_tape1(getTape1()), m_tape2(getTape2()), @@ -426,18 +438,18 @@ void cta_catalogue_CatalogueTest::SetUp() { m_catalogue->deleteDiskInstanceSpace(dis.name, dis.diskInstance); } } - { - const auto diskInstances = m_catalogue->getAllDiskInstances(); - for(auto &di: diskInstances) { - m_catalogue->deleteDiskInstance(di.name); - } - } { const auto virtualOrganizations = m_catalogue->getVirtualOrganizations(); for(auto &vo: virtualOrganizations) { m_catalogue->deleteVirtualOrganization(vo.name); } } + { + const auto diskInstances = m_catalogue->getAllDiskInstances(); + for(auto &di: diskInstances) { + m_catalogue->deleteDiskInstance(di.name); + } + } { const auto tapeDriveNames = m_catalogue->getTapeDriveNames(); for (const auto& name : tapeDriveNames) { @@ -888,6 +900,7 @@ TEST_P(cta_catalogue_CatalogueTest, isAdmin_true) { TEST_P(cta_catalogue_CatalogueTest, createStorageClass) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -911,6 +924,7 @@ TEST_P(cta_catalogue_CatalogueTest, createStorageClass) { TEST_P(cta_catalogue_CatalogueTest, createStorageClass_same_twice) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); ASSERT_THROW(m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy), exception::UserError); @@ -921,6 +935,7 @@ TEST_P(cta_catalogue_CatalogueTest, createStorageClass_emptyStringStorageClassNa auto storageClass = m_storageClassSingleCopy; storageClass.name = ""; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); ASSERT_THROW(m_catalogue->createStorageClass(m_admin, storageClass), catalogue::UserSpecifiedAnEmptyStringStorageClassName); } @@ -930,6 +945,7 @@ TEST_P(cta_catalogue_CatalogueTest, createStorageClass_emptyStringComment) { auto storageClass = m_storageClassSingleCopy; storageClass.comment = ""; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); ASSERT_THROW(m_catalogue->createStorageClass(m_admin, storageClass), catalogue::UserSpecifiedAnEmptyStringComment); } @@ -953,6 +969,7 @@ TEST_P(cta_catalogue_CatalogueTest, createStorageClass_nonExistingVo) { TEST_P(cta_catalogue_CatalogueTest, deleteStorageClass) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -984,6 +1001,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteStorageClass_non_existent) { TEST_P(cta_catalogue_CatalogueTest, modifyStorageClassNbCopies) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -1035,6 +1053,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyStorageClassNbCopies_nonExistentStorag TEST_P(cta_catalogue_CatalogueTest, modifyStorageClassComment) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -1086,6 +1105,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyStorageClassComment_nonExistentStorage TEST_P(cta_catalogue_CatalogueTest, modifyStorageClassName) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -1137,6 +1157,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyStorageClassName_nonExistentStorageCla TEST_P(cta_catalogue_CatalogueTest, modifyStorageClassName_newNameAlreadyExists) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -1152,6 +1173,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyStorageClassName_newNameAlreadyExists) TEST_P(cta_catalogue_CatalogueTest, modifyStorageClassVo) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -1168,6 +1190,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyStorageClassVo) { TEST_P(cta_catalogue_CatalogueTest, modifyStorageClassEmptyStringVo) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -1177,6 +1200,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyStorageClassEmptyStringVo) { TEST_P(cta_catalogue_CatalogueTest, modifyStorageClassVoDoesNotExist) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -1297,6 +1321,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteMediaType_usedByTapes) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTape(m_admin, m_tape1); @@ -1316,6 +1341,7 @@ TEST_P(cta_catalogue_CatalogueTest, getTapes_non_existent_tape_pool) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTape(m_admin, m_tape1); @@ -1954,6 +1980,7 @@ TEST_P(cta_catalogue_CatalogueTest, getMediaTypeByVid) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -1994,6 +2021,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTapePool) { const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); const std::string comment = "Create tape pool"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment); @@ -2063,6 +2091,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTapePool_null_supply) { const bool isEncrypted = true; const cta::optional<std::string> supply; const std::string comment = "Create tape pool"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment); @@ -2101,6 +2130,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTapePool_same_twice) { const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); const std::string comment = "Create tape pool"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment); ASSERT_THROW(m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment), exception::UserError); @@ -2129,6 +2159,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTapePool_tapes_of_mixed_state) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); { @@ -2250,6 +2281,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteTapePool) { const std::string tapePoolComment = "Create tape pool"; { const cta::optional<std::string> supply("value for the supply pool mechanism"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, tapePoolNbPartialTapes, tapePoolIsEncrypted, supply, tapePoolComment); @@ -2365,6 +2397,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteTapePool_notEmpty) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); { @@ -2438,6 +2471,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTapePool_emptyStringTapePoolName) { const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); const std::string comment = "Create tape pool"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); ASSERT_THROW(m_catalogue->createTapePool(m_admin, tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment), catalogue::UserSpecifiedAnEmptyStringTapePoolName); @@ -2465,6 +2499,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTapePool_emptyStringComment) { const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); const std::string comment = ""; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); ASSERT_THROW(m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment), catalogue::UserSpecifiedAnEmptyStringComment); @@ -2479,6 +2514,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteTapePool_non_existent) { TEST_P(cta_catalogue_CatalogueTest, deleteTapePool_used_in_an_archive_route) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -2541,6 +2577,8 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapePoolVo) { const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); const std::string comment = "Create tape pool"; + + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment); @@ -2611,6 +2649,8 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapePoolVo_emptyStringVo) { const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); const std::string comment = "Create tape pool"; + + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment); @@ -2651,6 +2691,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapePoolVo_VoDoesNotExist) { const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); const std::string comment = "Create tape pool"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment); @@ -2691,6 +2732,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapePoolNbPartialTapes) { const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); const std::string comment = "Create tape pool"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment); @@ -2767,6 +2809,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapePoolComment) { const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); const std::string comment = "Create tape pool"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment); @@ -2835,6 +2878,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapePoolComment_emptyStringComment) { const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); const std::string comment = "Create tape pool"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment); @@ -2883,6 +2927,7 @@ TEST_P(cta_catalogue_CatalogueTest, setTapePoolEncryption) { const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); const std::string comment = "Create tape pool"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment); @@ -2951,6 +2996,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapePoolSupply) { const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); const std::string comment = "Create tape pool"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment); @@ -3024,6 +3070,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapePoolSupply_emptyStringSupply) { const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); const std::string comment = "Create tape pool"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment); @@ -3106,6 +3153,7 @@ TEST_P(cta_catalogue_CatalogueTest, getTapePools_filterName) { const std::string firstPoolComment = "Create first tape pool"; const std::string secondPoolComment = "Create second tape pool"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createVirtualOrganization(m_admin, m_anotherVo); @@ -3192,6 +3240,7 @@ TEST_P(cta_catalogue_CatalogueTest, getTapePools_filterVO) { const std::string firstPoolComment = "Create first tape pool"; const std::string secondPoolComment = "Create second tape pool"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createVirtualOrganization(m_admin, m_anotherVo); @@ -3278,6 +3327,7 @@ TEST_P(cta_catalogue_CatalogueTest, getTapePools_filterEncrypted) { const std::string firstPoolComment = "Create first tape pool"; const std::string secondPoolComment = "Create second tape pool"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createVirtualOrganization(m_admin, m_anotherVo); @@ -3335,6 +3385,7 @@ TEST_P(cta_catalogue_CatalogueTest, getTapePools_filterEncrypted) { TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -3396,6 +3447,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapePoolName) { const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); const std::string comment = "Create tape pool"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment); @@ -3465,6 +3517,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapePoolName_emptyStringNewTapePoolNam const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); const std::string comment = "Create tape pool"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment); @@ -3500,6 +3553,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapePoolName_emptyStringNewTapePoolNam TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute_emptyStringStorageClassName) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); common::dataStructures::StorageClass storageClass; @@ -3522,6 +3576,7 @@ TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute_emptyStringStorageClassNa TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute_zeroCopyNb) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -3538,6 +3593,7 @@ TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute_zeroCopyNb) { TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute_emptyStringTapePoolName) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -3551,6 +3607,7 @@ TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute_emptyStringTapePoolName) TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute_emptyStringComment) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -3572,6 +3629,7 @@ TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute_non_existent_storage_clas const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -3583,6 +3641,7 @@ TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute_non_existent_storage_clas TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute_non_existent_tape_pool) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -3597,6 +3656,7 @@ TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute_non_existent_tape_pool) { TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute_same_twice) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -3614,6 +3674,7 @@ TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute_same_twice) { TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute_two_routes_same_pool) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -3634,6 +3695,7 @@ TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute_two_routes_same_pool) { TEST_P(cta_catalogue_CatalogueTest, deleteArchiveRoute) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -3677,6 +3739,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteArchiveRoute_non_existent) { TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute_deleteStorageClass) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -3713,6 +3776,7 @@ TEST_P(cta_catalogue_CatalogueTest, createArchiveRoute_deleteStorageClass) { TEST_P(cta_catalogue_CatalogueTest, modifyArchiveRouteTapePoolName) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -3769,6 +3833,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyArchiveRouteTapePoolName) { TEST_P(cta_catalogue_CatalogueTest, modifyArchiveRouteTapePoolName_nonExistentTapePool) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -3809,6 +3874,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyArchiveRouteTapePoolName_nonExistentTa TEST_P(cta_catalogue_CatalogueTest, modifyArchiveRouteTapePoolName_nonExistentArchiveRoute) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -3824,6 +3890,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyArchiveRouteTapePoolName_nonExistentAr TEST_P(cta_catalogue_CatalogueTest, modifyArchiveRouteComment) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -3878,6 +3945,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyArchiveRouteComment) { TEST_P(cta_catalogue_CatalogueTest, modifyArchiveRouteComment_nonExistentArchiveRoute) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -4108,6 +4176,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteLogicalLibrary) { ASSERT_EQ(creationLog, lastModificationLog); } m_catalogue->createMediaType(m_admin, m_mediaType); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); { @@ -4228,6 +4297,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteLogicalLibrary_non_empty) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -4517,6 +4587,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTape) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); { @@ -4591,6 +4662,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTape_emptyStringVid) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); { @@ -4620,6 +4692,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTape_emptyStringMediaType) { const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); { @@ -4649,6 +4722,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTape_emptyStringVendor) { m_catalogue->createMediaType(m_admin, m_mediaType); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); { @@ -4678,6 +4752,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTape_emptyStringLogicalLibraryName) { m_catalogue->createMediaType(m_admin, m_mediaType); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); { @@ -4718,6 +4793,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTape_non_existent_logical_library) { const cta::optional<std::string> supply("value for the supply pool mechanism"); m_catalogue->createMediaType(m_admin, m_mediaType); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); ASSERT_THROW(m_catalogue->createTape(m_admin, m_tape1), exception::UserError); @@ -4743,6 +4819,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTape_9_exabytes_capacity) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); { @@ -4816,6 +4893,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTape_same_twice) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); { @@ -4873,6 +4951,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTape_StateDoesNotExist) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -4892,6 +4971,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTape_StateNotActiveWithoutReasonShould m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -4916,6 +4996,7 @@ TEST_P(cta_catalogue_CatalogueTest, createTape_many_tapes) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); { @@ -5217,10 +5298,11 @@ TEST_P(cta_catalogue_CatalogueTest, createTape_many_tapes) { TEST_P(cta_catalogue_CatalogueTest, createTape_1_tape_with_write_log_1_tape_without) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; const bool logicalLibraryIsDisabled= false; const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; @@ -5398,6 +5480,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteTape) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -5439,6 +5522,7 @@ TEST_P(cta_catalogue_CatalogueTest, writeToTapeAndCheckMasterBytesAndFiles) { log::LogContext dummyLc(m_dummyLog); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -5446,7 +5530,7 @@ TEST_P(cta_catalogue_CatalogueTest, writeToTapeAndCheckMasterBytesAndFiles) { const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); @@ -5565,6 +5649,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteNonEmptyTape) { log::LogContext dummyLc(m_dummyLog); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -5572,7 +5657,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteNonEmptyTape) { const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); @@ -5716,6 +5801,8 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeMediaType) { m_catalogue->createMediaType(m_admin, anotherMediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -5792,6 +5879,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeVendor) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -5869,6 +5957,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeLogicalLibraryName) { m_catalogue->createLogicalLibrary(m_admin, anotherLogicalLibraryName, logicalLibraryIsDisabled, "Create another logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -5954,6 +6043,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeTapePoolName) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTapePool(m_admin, anotherTapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create another tape pool"); @@ -6027,6 +6117,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeTapePoolName_nonExistentTape) { const cta::optional<std::string> supply("value for the supply pool mechanism"); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -6044,6 +6135,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeEncryptionKeyName) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -6120,6 +6212,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeEncryptionKeyName_emptyStringEncry m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -6196,6 +6289,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeVerificationStatus) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -6295,6 +6389,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeState_nonExistentState) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -6315,6 +6410,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeState_noReasonWhenNotActive) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -6337,6 +6433,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeState) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -6395,6 +6492,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeStateResetReasonWhenBackToActiveSt m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -6429,6 +6527,7 @@ TEST_P(cta_catalogue_CatalogueTest, getTapesSearchCriteriaByState) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -6486,6 +6585,7 @@ TEST_P(cta_catalogue_CatalogueTest, tapeLabelled) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -6570,6 +6670,7 @@ TEST_P(cta_catalogue_CatalogueTest, tapeMountedForArchive) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -6691,6 +6792,7 @@ TEST_P(cta_catalogue_CatalogueTest, tapeMountedForRetrieve) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -6812,6 +6914,7 @@ TEST_P(cta_catalogue_CatalogueTest, setTapeFull) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -6892,6 +6995,7 @@ TEST_P(cta_catalogue_CatalogueTest, setTapeDirty) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -6974,6 +7078,7 @@ TEST_P(cta_catalogue_CatalogueTest, noSpaceLeftOnTape) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -7054,6 +7159,7 @@ TEST_P(cta_catalogue_CatalogueTest, setTapeIsFromCastorInUnitTests) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -7162,6 +7268,7 @@ TEST_P(cta_catalogue_CatalogueTest, getTapesForWriting) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -7194,6 +7301,7 @@ TEST_P(cta_catalogue_CatalogueTest, getTapesForWritingOrderedByDataInBytesDesc) m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -7228,7 +7336,7 @@ TEST_P(cta_catalogue_CatalogueTest, getTapesForWritingOrderedByDataInBytesDesc) std::set<cta::catalogue::TapeItemWrittenPointer> file1WrittenSet; file1WrittenSet.insert(file1WrittenUP.release()); file1Written.archiveFileId = 1234; - file1Written.diskInstance = "diskInstance"; + file1Written.diskInstance = m_diskInstance.name; file1Written.diskFileId = "5678"; file1Written.diskFileOwnerUid = PUBLIC_DISK_USER; file1Written.diskFileGid = PUBLIC_DISK_GROUP; @@ -7257,6 +7365,7 @@ TEST_P(cta_catalogue_CatalogueTest, getTapesForWriting_disabled_tape) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -7286,6 +7395,7 @@ TEST_P(cta_catalogue_CatalogueTest, getTapesForWriting_full_tape) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -7308,6 +7418,7 @@ TEST_P(cta_catalogue_CatalogueTest, DISABLED_getTapesForWriting_no_labelled_tape m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -7579,12 +7690,12 @@ TEST_P(cta_catalogue_CatalogueTest, createRequesterActivityMountRule) { auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); - + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); + const std::string comment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance"; const std::string requesterName = "requester_name"; const std::string activityRegex = "activity_regex"; - m_catalogue->createRequesterActivityMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, activityRegex, comment); + m_catalogue->createRequesterActivityMountRule(m_admin, mountPolicyName, m_diskInstance.name, requesterName, activityRegex, comment); const std::list<common::dataStructures::RequesterActivityMountRule> rules = m_catalogue->getRequesterActivityMountRules(); ASSERT_EQ(1, rules.size()); @@ -7598,6 +7709,7 @@ TEST_P(cta_catalogue_CatalogueTest, createRequesterActivityMountRule) { ASSERT_EQ(m_admin.host, rule.creationLog.host); ASSERT_EQ(activityRegex, rule.activityRegex); ASSERT_EQ(rule.creationLog, rule.lastModificationLog); + ASSERT_EQ(m_diskInstance.name, rule.diskInstance); } TEST_P(cta_catalogue_CatalogueTest, createRequesterActivityMountRule_same_twice) { @@ -7608,14 +7720,14 @@ TEST_P(cta_catalogue_CatalogueTest, createRequesterActivityMountRule_same_twice) auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); const std::string comment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance"; const std::string requesterName = "requester_name"; const std::string activityRegex = "activity_regex"; - m_catalogue->createRequesterActivityMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, activityRegex, comment); + m_catalogue->createRequesterActivityMountRule(m_admin, mountPolicyName, m_diskInstance.name, requesterName, activityRegex, comment); - ASSERT_THROW(m_catalogue->createRequesterActivityMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, activityRegex, comment), exception::UserError); + ASSERT_THROW(m_catalogue->createRequesterActivityMountRule(m_admin, mountPolicyName, m_diskInstance.name, requesterName, activityRegex, comment), exception::UserError); } TEST_P(cta_catalogue_CatalogueTest, createRequesterActivityMountRule_non_existent_mount_policy) { @@ -7625,14 +7737,31 @@ TEST_P(cta_catalogue_CatalogueTest, createRequesterActivityMountRule_non_existen const std::string comment = "Create mount rule for requester"; const std::string mountPolicyName = "non_existent_mount_policy"; - const std::string diskInstanceName = "disk_instance"; const std::string requesterName = "requester_name"; const std::string activityRegex = "activity_regex"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); + + ASSERT_THROW( m_catalogue->createRequesterActivityMountRule(m_admin, mountPolicyName, m_diskInstance.name, requesterName, + activityRegex, comment), exception::UserError); +} + +TEST_P(cta_catalogue_CatalogueTest, createRequesterActivityMountRule_non_existent_disk_instance) { + using namespace cta; + + ASSERT_TRUE(m_catalogue->getRequesterActivityMountRules().empty()); - ASSERT_THROW( m_catalogue->createRequesterActivityMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, + auto mountPolicyToAdd = getMountPolicy1(); + std::string mountPolicyName = mountPolicyToAdd.name; + m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + + const std::string comment = "Create mount rule for requester"; + const std::string requesterName = "requester_name"; + const std::string activityRegex = "activity_regex"; + ASSERT_THROW( m_catalogue->createRequesterActivityMountRule(m_admin, mountPolicyName, m_diskInstance.name, requesterName, activityRegex, comment), exception::UserError); } + TEST_P(cta_catalogue_CatalogueTest, deleteRequesterActivityMountRule) { using namespace cta; @@ -7641,17 +7770,17 @@ TEST_P(cta_catalogue_CatalogueTest, deleteRequesterActivityMountRule) { auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); - + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); + const std::string comment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance"; const std::string requesterName = "requester_name"; const std::string activityRegex = "activity_regex"; - m_catalogue->createRequesterActivityMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, activityRegex, comment); + m_catalogue->createRequesterActivityMountRule(m_admin, mountPolicyName, m_diskInstance.name, requesterName, activityRegex, comment); const std::list<common::dataStructures::RequesterActivityMountRule> rules = m_catalogue->getRequesterActivityMountRules(); ASSERT_EQ(1, rules.size()); - m_catalogue->deleteRequesterActivityMountRule(diskInstanceName, requesterName, activityRegex); + m_catalogue->deleteRequesterActivityMountRule(m_diskInstance.name, requesterName, activityRegex); ASSERT_TRUE(m_catalogue->getRequesterActivityMountRules().empty()); } @@ -7677,13 +7806,13 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterActivityMountRulePolicy) { auto anotherMountPolicy = getMountPolicy1(); anotherMountPolicy.name = anotherMountPolicyName; m_catalogue->createMountPolicy(m_admin,anotherMountPolicy); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); const std::string comment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance"; const std::string requesterName = "requester_name"; const std::string activityRegex = "activity"; - m_catalogue->createRequesterActivityMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, activityRegex, comment); + m_catalogue->createRequesterActivityMountRule(m_admin, mountPolicyName, m_diskInstance.name, requesterName, activityRegex, comment); { const std::list<common::dataStructures::RequesterActivityMountRule> rules = m_catalogue->getRequesterActivityMountRules(); @@ -7698,9 +7827,10 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterActivityMountRulePolicy) { ASSERT_EQ(m_admin.username, rule.creationLog.username); ASSERT_EQ(m_admin.host, rule.creationLog.host); ASSERT_EQ(rule.creationLog, rule.lastModificationLog); + ASSERT_EQ(m_diskInstance.name, rule.diskInstance); } - m_catalogue->modifyRequesterActivityMountRulePolicy(m_admin, diskInstanceName, requesterName, activityRegex, anotherMountPolicyName); + m_catalogue->modifyRequesterActivityMountRulePolicy(m_admin, m_diskInstance.name, requesterName, activityRegex, anotherMountPolicyName); { const std::list<common::dataStructures::RequesterActivityMountRule> rules = m_catalogue->getRequesterActivityMountRules(); @@ -7714,6 +7844,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterActivityMountRulePolicy) { ASSERT_EQ(activityRegex, rule.activityRegex); ASSERT_EQ(m_admin.username, rule.creationLog.username); ASSERT_EQ(m_admin.host, rule.creationLog.host); + ASSERT_EQ(m_diskInstance.name, rule.diskInstance); } } @@ -7725,12 +7856,12 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterActivityMountRulePolicy_nonEx auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); - const std::string diskInstanceName = "disk_instance"; const std::string requesterName = "requester_name"; const std::string activityRegex = "activity"; - ASSERT_THROW(m_catalogue->modifyRequesterActivityMountRulePolicy(m_admin, diskInstanceName, requesterName, activityRegex, mountPolicyName), + ASSERT_THROW(m_catalogue->modifyRequesterActivityMountRulePolicy(m_admin, m_diskInstance.name, requesterName, activityRegex, mountPolicyName), exception::UserError); } @@ -7742,12 +7873,12 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterActivityMountRuleComment) { auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); const std::string comment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance"; const std::string requesterName = "requester_name"; const std::string activityRegex = "activity"; - m_catalogue->createRequesterActivityMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, activityRegex, comment); + m_catalogue->createRequesterActivityMountRule(m_admin, mountPolicyName, m_diskInstance.name, requesterName, activityRegex, comment); { const std::list<common::dataStructures::RequesterActivityMountRule> rules = m_catalogue->getRequesterActivityMountRules(); @@ -7762,10 +7893,11 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterActivityMountRuleComment) { ASSERT_EQ(m_admin.username, rule.creationLog.username); ASSERT_EQ(m_admin.host, rule.creationLog.host); ASSERT_EQ(rule.creationLog, rule.lastModificationLog); + ASSERT_EQ(m_diskInstance.name, rule.diskInstance); } const std::string modifiedComment = "Modified comment"; - m_catalogue->modifyRequesterActivityMountRuleComment(m_admin, diskInstanceName, requesterName, activityRegex, modifiedComment); + m_catalogue->modifyRequesterActivityMountRuleComment(m_admin, m_diskInstance.name, requesterName, activityRegex, modifiedComment); { const std::list<common::dataStructures::RequesterActivityMountRule> rules = m_catalogue->getRequesterActivityMountRules(); @@ -7779,6 +7911,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterActivityMountRuleComment) { ASSERT_EQ(activityRegex, rule.activityRegex); ASSERT_EQ(m_admin.username, rule.creationLog.username); ASSERT_EQ(m_admin.host, rule.creationLog.host); + ASSERT_EQ(m_diskInstance.name, rule.diskInstance); } } @@ -7804,11 +7937,11 @@ TEST_P(cta_catalogue_CatalogueTest, createRequesterMountRule) { auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); const std::string comment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance"; const std::string requesterName = "requester_name"; - m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, comment); + m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, m_diskInstance.name, requesterName, comment); const std::list<common::dataStructures::RequesterMountRule> rules = m_catalogue->getRequesterMountRules(); ASSERT_EQ(1, rules.size()); @@ -7821,6 +7954,7 @@ TEST_P(cta_catalogue_CatalogueTest, createRequesterMountRule) { ASSERT_EQ(m_admin.username, rule.creationLog.username); ASSERT_EQ(m_admin.host, rule.creationLog.host); ASSERT_EQ(rule.creationLog, rule.lastModificationLog); + ASSERT_EQ(m_diskInstance.name, rule.diskInstance); } TEST_P(cta_catalogue_CatalogueTest, createRequesterMountRule_same_twice) { @@ -7831,12 +7965,12 @@ TEST_P(cta_catalogue_CatalogueTest, createRequesterMountRule_same_twice) { auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); const std::string comment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance"; const std::string requesterName = "requester_name"; - m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, comment); - ASSERT_THROW(m_catalogue->createRequesterMountRule(m_admin, mountPolicyToAdd.name, diskInstanceName, requesterName, + m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, m_diskInstance.name, requesterName, comment); + ASSERT_THROW(m_catalogue->createRequesterMountRule(m_admin, mountPolicyToAdd.name, m_diskInstance.name, requesterName, comment), exception::UserError); } @@ -7845,11 +7979,27 @@ TEST_P(cta_catalogue_CatalogueTest, createRequesterMountRule_non_existent_mount_ ASSERT_TRUE(m_catalogue->getRequesterMountRules().empty()); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); + const std::string comment = "Create mount rule for requester"; const std::string mountPolicyName = "non_existent_mount_policy"; - const std::string diskInstanceName = "disk_instance"; const std::string requesterName = "requester_name"; - ASSERT_THROW(m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, + ASSERT_THROW(m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, m_diskInstance.name, requesterName, + comment), exception::UserError); +} + +TEST_P(cta_catalogue_CatalogueTest, createRequesterMountRule_non_existent_disk_instance) { + using namespace cta; + + ASSERT_TRUE(m_catalogue->getRequesterMountRules().empty()); + + auto mountPolicyToAdd = getMountPolicy1(); + std::string mountPolicyName = mountPolicyToAdd.name; + m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + + const std::string comment = "Create mount rule for requester"; + const std::string requesterName = "requester_name"; + ASSERT_THROW(m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, m_diskInstance.name, requesterName, comment), exception::UserError); } @@ -7861,16 +8011,16 @@ TEST_P(cta_catalogue_CatalogueTest, deleteRequesterMountRule) { auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); const std::string comment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance"; const std::string requesterName = "requester_name"; - m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, comment); + m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, m_diskInstance.name, requesterName, comment); const std::list<common::dataStructures::RequesterMountRule> rules = m_catalogue->getRequesterMountRules(); ASSERT_EQ(1, rules.size()); - m_catalogue->deleteRequesterMountRule(diskInstanceName, requesterName); + m_catalogue->deleteRequesterMountRule(m_diskInstance.name, requesterName); ASSERT_TRUE(m_catalogue->getRequesterMountRules().empty()); } @@ -7890,6 +8040,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterMountRulePolicy) { auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); const std::string anotherMountPolicyName = "another_mount_policy"; @@ -7899,9 +8050,8 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterMountRulePolicy) { const std::string comment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance"; const std::string requesterName = "requester_name"; - m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, comment); + m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, m_diskInstance.name, requesterName, comment); { const std::list<common::dataStructures::RequesterMountRule> rules = m_catalogue->getRequesterMountRules(); @@ -7915,9 +8065,10 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterMountRulePolicy) { ASSERT_EQ(m_admin.username, rule.creationLog.username); ASSERT_EQ(m_admin.host, rule.creationLog.host); ASSERT_EQ(rule.creationLog, rule.lastModificationLog); + ASSERT_EQ(m_diskInstance.name, rule.diskInstance); } - m_catalogue->modifyRequesterMountRulePolicy(m_admin, diskInstanceName, requesterName, anotherMountPolicyName); + m_catalogue->modifyRequesterMountRulePolicy(m_admin, m_diskInstance.name, requesterName, anotherMountPolicyName); { const std::list<common::dataStructures::RequesterMountRule> rules = m_catalogue->getRequesterMountRules(); @@ -7930,6 +8081,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterMountRulePolicy) { ASSERT_EQ(comment, rule.comment); ASSERT_EQ(m_admin.username, rule.creationLog.username); ASSERT_EQ(m_admin.host, rule.creationLog.host); + ASSERT_EQ(m_diskInstance.name, rule.diskInstance); } } @@ -7941,11 +8093,11 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterMountRulePolicy_nonExistentRe auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); - const std::string diskInstanceName = "disk_instance"; const std::string requesterName = "requester_name"; - ASSERT_THROW(m_catalogue->modifyRequesterMountRulePolicy(m_admin, diskInstanceName, requesterName, mountPolicyName), + ASSERT_THROW(m_catalogue->modifyRequesterMountRulePolicy(m_admin, m_diskInstance.name, requesterName, mountPolicyName), exception::UserError); } @@ -7957,11 +8109,11 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesteMountRuleComment) { auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); const std::string comment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance"; const std::string requesterName = "requester_name"; - m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, comment); + m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, m_diskInstance.name, requesterName, comment); { const std::list<common::dataStructures::RequesterMountRule> rules = m_catalogue->getRequesterMountRules(); @@ -7975,10 +8127,11 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesteMountRuleComment) { ASSERT_EQ(m_admin.username, rule.creationLog.username); ASSERT_EQ(m_admin.host, rule.creationLog.host); ASSERT_EQ(rule.creationLog, rule.lastModificationLog); + ASSERT_EQ(m_diskInstance.name, rule.diskInstance); } const std::string modifiedComment = "Modified comment"; - m_catalogue->modifyRequesteMountRuleComment(m_admin, diskInstanceName, requesterName, modifiedComment); + m_catalogue->modifyRequesteMountRuleComment(m_admin, m_diskInstance.name, requesterName, modifiedComment); { const std::list<common::dataStructures::RequesterMountRule> rules = m_catalogue->getRequesterMountRules(); @@ -7991,6 +8144,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesteMountRuleComment) { ASSERT_EQ(modifiedComment, rule.comment); ASSERT_EQ(m_admin.username, rule.creationLog.username); ASSERT_EQ(m_admin.host, rule.creationLog.host); + ASSERT_EQ(m_diskInstance.name, rule.diskInstance); } } @@ -7999,11 +8153,12 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesteMountRuleComment_nonExistentRe ASSERT_TRUE(m_catalogue->getRequesterMountRules().empty()); - const std::string diskInstanceName = "disk_instance"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); + const std::string requesterName = "requester_name"; const std::string comment = "Comment"; - ASSERT_THROW(m_catalogue->modifyRequesteMountRuleComment(m_admin, diskInstanceName, requesterName, comment), + ASSERT_THROW(m_catalogue->modifyRequesteMountRuleComment(m_admin, m_diskInstance.name, requesterName, comment), exception::UserError); } @@ -8014,6 +8169,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterGroupMountRulePolicy) { auto mountPolicyToAdd = getMountPolicy1(); m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); std::string mountPolicyName = mountPolicyToAdd.name; @@ -8024,7 +8180,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterGroupMountRulePolicy) { m_catalogue->createMountPolicy(m_admin,anotherMountPolicy); const std::string comment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance"; + const std::string diskInstanceName = m_diskInstance.name; const std::string requesterGroupName = "requester_group_name"; m_catalogue->createRequesterGroupMountRule(m_admin, mountPolicyName, diskInstanceName, requesterGroupName, comment); @@ -8040,6 +8196,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterGroupMountRulePolicy) { ASSERT_EQ(m_admin.username, rule.creationLog.username); ASSERT_EQ(m_admin.host, rule.creationLog.host); ASSERT_EQ(rule.creationLog, rule.lastModificationLog); + ASSERT_EQ(diskInstanceName, rule.diskInstance); } m_catalogue->modifyRequesterGroupMountRulePolicy(m_admin, diskInstanceName, requesterGroupName, anotherMountPolicyName); @@ -8055,6 +8212,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterGroupMountRulePolicy) { ASSERT_EQ(comment, rule.comment); ASSERT_EQ(m_admin.username, rule.creationLog.username); ASSERT_EQ(m_admin.host, rule.creationLog.host); + ASSERT_EQ(diskInstanceName, rule.diskInstance); } } @@ -8066,8 +8224,9 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterGroupMountRulePolicy_nonExist auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); - const std::string diskInstanceName = "disk_instance"; + const std::string diskInstanceName = m_diskInstance.name; const std::string requesterGroupName = "requester_group_name"; ASSERT_THROW(m_catalogue->modifyRequesterGroupMountRulePolicy(m_admin, diskInstanceName, requesterGroupName, @@ -8082,9 +8241,10 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterGroupMountRuleComment) { auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); const std::string comment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance"; + const std::string diskInstanceName = m_diskInstance.name; const std::string requesterGroupName = "requester_group_name"; m_catalogue->createRequesterGroupMountRule(m_admin, mountPolicyName, diskInstanceName, requesterGroupName, comment); @@ -8100,6 +8260,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterGroupMountRuleComment) { ASSERT_EQ(m_admin.username, rule.creationLog.username); ASSERT_EQ(m_admin.host, rule.creationLog.host); ASSERT_EQ(rule.creationLog, rule.lastModificationLog); + ASSERT_EQ(diskInstanceName, rule.diskInstance); } const std::string modifiedComment = "ModifiedComment"; @@ -8116,6 +8277,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyRequesterGroupMountRuleComment) { ASSERT_EQ(modifiedComment, rule.comment); ASSERT_EQ(m_admin.username, rule.creationLog.username); ASSERT_EQ(m_admin.host, rule.creationLog.host); + ASSERT_EQ(diskInstanceName, rule.diskInstance); } } @@ -8140,9 +8302,10 @@ TEST_P(cta_catalogue_CatalogueTest, createRequesterGroupMountRule) { auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); const std::string comment = "Create mount rule for requester group"; - const std::string diskInstanceName = "disk_instance_name"; + const std::string diskInstanceName = m_diskInstance.name; const std::string requesterGroupName = "requester_group"; m_catalogue->createRequesterGroupMountRule(m_admin, mountPolicyName, diskInstanceName, requesterGroupName, comment); @@ -8158,6 +8321,7 @@ TEST_P(cta_catalogue_CatalogueTest, createRequesterGroupMountRule) { ASSERT_EQ(m_admin.username, rule.creationLog.username); ASSERT_EQ(m_admin.host, rule.creationLog.host); ASSERT_EQ(rule.creationLog, rule.lastModificationLog); + ASSERT_EQ(diskInstanceName, rule.diskInstance); } TEST_P(cta_catalogue_CatalogueTest, createRequesterGroupMountRule_same_twice) { @@ -8168,9 +8332,11 @@ TEST_P(cta_catalogue_CatalogueTest, createRequesterGroupMountRule_same_twice) { auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); + const std::string comment = "Create mount rule for requester group"; - const std::string diskInstanceName = "disk_instance"; + const std::string diskInstanceName = m_diskInstance.name; const std::string requesterGroupName = "requester_group"; m_catalogue->createRequesterGroupMountRule(m_admin, mountPolicyName, diskInstanceName, requesterGroupName, comment); ASSERT_THROW(m_catalogue->createRequesterGroupMountRule(m_admin, mountPolicyName, diskInstanceName, @@ -8182,10 +8348,29 @@ TEST_P(cta_catalogue_CatalogueTest, createRequesterGroupMountRule_non_existent_m ASSERT_TRUE(m_catalogue->getRequesterGroupMountRules().empty()); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); + const std::string comment = "Create mount rule for requester group"; const std::string mountPolicyName = "non_existent_mount_policy"; - const std::string diskInstanceName = "disk_instance"; + const std::string diskInstanceName = m_diskInstance.name; + const std::string requesterGroupName = "requester_group"; + ASSERT_THROW(m_catalogue->createRequesterGroupMountRule(m_admin, mountPolicyName, diskInstanceName, + requesterGroupName, comment), exception::UserError); +} + +TEST_P(cta_catalogue_CatalogueTest, createRequesterGroupMountRule_non_existent_disk_instance) { + using namespace cta; + + ASSERT_TRUE(m_catalogue->getRequesterGroupMountRules().empty()); + + auto mountPolicyToAdd = getMountPolicy1(); + std::string mountPolicyName = mountPolicyToAdd.name; + m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + + const std::string comment = "Create mount rule for requester group"; + const std::string diskInstanceName = m_diskInstance.name; const std::string requesterGroupName = "requester_group"; + ASSERT_THROW(m_catalogue->createRequesterGroupMountRule(m_admin, mountPolicyName, diskInstanceName, requesterGroupName, comment), exception::UserError); } @@ -8198,9 +8383,10 @@ TEST_P(cta_catalogue_CatalogueTest, deleteRequesterGroupMountRule) { auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); const std::string comment = "Create mount rule for requester group"; - const std::string diskInstanceName = "disk_instance"; + const std::string diskInstanceName = m_diskInstance.name; const std::string requesterGroupName = "requester_group"; m_catalogue->createRequesterGroupMountRule(m_admin, mountPolicyName, diskInstanceName, requesterGroupName, comment); @@ -8216,6 +8402,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteRequesterGroupMountRule) { ASSERT_EQ(m_admin.username, rule.creationLog.username); ASSERT_EQ(m_admin.host, rule.creationLog.host); ASSERT_EQ(rule.creationLog, rule.lastModificationLog); + ASSERT_EQ(diskInstanceName, rule.diskInstance); m_catalogue->deleteRequesterGroupMountRule(diskInstanceName, requesterGroupName); ASSERT_TRUE(m_catalogue->getRequesterGroupMountRules().empty()); @@ -8237,9 +8424,10 @@ TEST_P(cta_catalogue_CatalogueTest, checkAndGetNextArchiveFileId_no_archive_rout auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); - + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); + const std::string comment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance_name"; + const std::string diskInstanceName = m_diskInstance.name; const std::string requesterName = "requester_name"; m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, comment); @@ -8258,7 +8446,7 @@ TEST_P(cta_catalogue_CatalogueTest, checkAndGetNextArchiveFileId_no_archive_rout m_catalogue->createVirtualOrganization(m_admin, m_vo); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); common::dataStructures::RequesterIdentity requesterIdentity; @@ -8273,8 +8461,9 @@ TEST_P(cta_catalogue_CatalogueTest, checkAndGetNextArchiveFileId_no_mount_rules) ASSERT_TRUE(m_catalogue->getRequesterMountRules().empty()); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -8321,9 +8510,10 @@ TEST_P(cta_catalogue_CatalogueTest, checkAndGetNextArchiveFileId_after_cached_an auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); const std::string comment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance_name"; + const std::string diskInstanceName = m_diskInstance.name; const std::string requesterName = "requester_name"; m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, comment); @@ -8398,9 +8588,10 @@ TEST_P(cta_catalogue_CatalogueTest, checkAndGetNextArchiveFileId_requester_mount auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); - + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); + const std::string comment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance_name"; + const std::string diskInstanceName = m_diskInstance.name; const std::string requesterName = "requester_name"; m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, comment); @@ -8469,9 +8660,9 @@ TEST_P(cta_catalogue_CatalogueTest, checkAndGetNextArchiveFileId_requester_group auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); - + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); const std::string comment = "Create mount rule for requester group"; - const std::string diskInstanceName = "disk_instance"; + const std::string diskInstanceName = m_diskInstance.name; const std::string requesterGroupName = "requester_group"; m_catalogue->createRequesterGroupMountRule(m_admin, mountPolicyName, diskInstanceName, requesterGroupName, comment); @@ -8538,9 +8729,10 @@ TEST_P(cta_catalogue_CatalogueTest, checkAndGetNextArchiveFileId_after_cached_an auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); - + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); + const std::string comment = "Create mount rule for requester group"; - const std::string diskInstanceName = "disk_instance"; + const std::string diskInstanceName = m_diskInstance.name; const std::string requesterGroupName = "requester_group"; m_catalogue->createRequesterGroupMountRule(m_admin, mountPolicyName, diskInstanceName, requesterGroupName, comment); @@ -8614,9 +8806,10 @@ TEST_P(cta_catalogue_CatalogueTest, checkAndGetNextArchiveFileId_requester_mount auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); - + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); + const std::string requesterRuleComment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance_name"; + const std::string diskInstanceName = m_diskInstance.name; const std::string requesterName = "requester_name"; m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, requesterRuleComment); @@ -8702,9 +8895,10 @@ TEST_P(cta_catalogue_CatalogueTest, getArchiveFileQueueCriteria_no_archive_route auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); const std::string comment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance_name"; + const std::string diskInstanceName = m_diskInstance.name; const std::string requesterName = "requester_name"; m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, comment); @@ -8739,9 +8933,10 @@ TEST_P(cta_catalogue_CatalogueTest, getArchiveFileQueueCriteria_requester_mount_ auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); - + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); + const std::string comment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance_name"; + const std::string diskInstanceName = m_diskInstance.name; const std::string requesterName = "requester_name"; m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, comment); @@ -8802,9 +8997,10 @@ TEST_P(cta_catalogue_CatalogueTest, getArchiveFileQueueCriteria_requester_group_ auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); const std::string comment = "Create mount rule for requester group"; - const std::string diskInstanceName = "disk_instance"; + const std::string diskInstanceName = m_diskInstance.name; const std::string requesterGroupName = "requester_group"; m_catalogue->createRequesterGroupMountRule(m_admin, mountPolicyName, diskInstanceName, requesterGroupName, comment); @@ -8864,9 +9060,10 @@ TEST_P(cta_catalogue_CatalogueTest, getArchiveFileQueueCriteria_requester_mount_ auto mountPolicyToAdd = getMountPolicy1(); std::string mountPolicyName = mountPolicyToAdd.name; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); const std::string requesterRuleComment = "Create mount rule for requester"; - const std::string diskInstanceName = "disk_instance_name"; + const std::string diskInstanceName = m_diskInstance.name; const std::string requesterName = "requester_name"; m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, diskInstanceName, requesterName, requesterRuleComment); @@ -8940,7 +9137,7 @@ TEST_P(cta_catalogue_CatalogueTest, getArchiveFileQueueCriteria_requester_mount_ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId) { using namespace cta; - const std::string diskInstanceName1 = "disk_instance_1"; + const std::string diskInstanceName1 = m_diskInstance.name; const std::string diskInstanceName2 = "disk_instance_2"; const bool logicalLibraryIsDisabled= false; @@ -8950,6 +9147,8 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, diskInstanceName1, "comment"); + m_catalogue->createDiskInstance(m_admin, diskInstanceName2, "comment"); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -9122,7 +9321,7 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId) { uint64_t minArchiveRequestAge = mountPolicyToAdd.minArchiveRequestAge; uint64_t archivePriority = mountPolicyToAdd.archivePriority; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); - + const std::string comment = "Create mount rule for requester"; const std::string requesterName = "requester_name"; m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, diskInstanceName1, requesterName, comment); @@ -9160,7 +9359,7 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId) { TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId_disabledTapes) { using namespace cta; - const std::string diskInstanceName1 = "disk_instance_1"; + const std::string diskInstanceName1 = m_diskInstance.name; const bool logicalLibraryIsDisabled= false; const uint64_t nbPartialTapes = 2; @@ -9171,6 +9370,7 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId_disa m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -9347,7 +9547,7 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId_disa uint64_t minArchiveRequestAge = mountPolicyToAdd.minArchiveRequestAge; uint64_t archivePriority = mountPolicyToAdd.archivePriority; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); - + const std::string comment = "Create mount rule for requester"; const std::string requesterName = "requester_name"; m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, diskInstanceName1, requesterName, comment); @@ -9427,7 +9627,7 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId_disa TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId_returnNonSupersededFiles) { using namespace cta; - const std::string diskInstanceName1 = "disk_instance_1"; + const std::string diskInstanceName1 = m_diskInstance.name; const bool logicalLibraryIsDisabled= false; const uint64_t nbPartialTapes = 2; @@ -9436,6 +9636,7 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId_retu m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -9503,7 +9704,7 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId_retu uint64_t minArchiveRequestAge = mountPolicyToAdd.minArchiveRequestAge; uint64_t archivePriority = mountPolicyToAdd.archivePriority; m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd); - + const std::string comment = "Create mount rule for requester"; const std::string requesterName = "requester_name"; m_catalogue->createRequesterMountRule(m_admin, mountPolicyName, diskInstanceName1, requesterName, comment); @@ -9543,7 +9744,7 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId_retu TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId_ActivityMountPolicy) { using namespace cta; - const std::string diskInstanceName1 = "disk_instance_1"; + const std::string diskInstanceName1 = m_diskInstance.name; const std::string diskInstanceName2 = "disk_instance_2"; const bool logicalLibraryIsDisabled= false; @@ -9553,6 +9754,7 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId_Acti m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -9724,7 +9926,7 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId_Acti m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd1); auto mountPolicyToAdd2 = getMountPolicy2(); m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd2); - + const std::string comment = "Create mount rule for requester+activity"; const std::string requesterName = "requester_name"; const std::string activityRegex = "^activity_[a-zA-Z0-9-]+$"; @@ -9812,6 +10014,7 @@ TEST_P(cta_catalogue_CatalogueTest, getArchiveFiles_disk_file_id_without_instanc TEST_P(cta_catalogue_CatalogueTest, getArchiveFiles_existent_storage_class_without_disk_instance) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -9857,11 +10060,12 @@ TEST_P(cta_catalogue_CatalogueTest, filesWrittenToTape_many_archive_files) { const uint64_t nbPartialTapes = 1; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, tapePoolName1, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); { @@ -10988,11 +11192,12 @@ TEST_P(cta_catalogue_CatalogueTest, DISABLED_concurrent_filesWrittenToTape_many_ const uint64_t nbPartialTapes = 1; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, tapePoolName1, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); { @@ -11682,10 +11887,11 @@ TEST_P(cta_catalogue_CatalogueTest, filesWrittenToTape_1_archive_file_1_tape_cop const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTape(m_admin, m_tape1); @@ -11794,7 +12000,7 @@ TEST_P(cta_catalogue_CatalogueTest, filesWrittenToTape_1_archive_file_1_tape_cop TEST_P(cta_catalogue_CatalogueTest, filesWrittenToTape_1_archive_file_1_tape_copy_deleteStorageClass) { using namespace cta; - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; const bool logicalLibraryIsDisabled= false; const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; @@ -11802,6 +12008,7 @@ TEST_P(cta_catalogue_CatalogueTest, filesWrittenToTape_1_archive_file_1_tape_cop m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -11915,7 +12122,7 @@ TEST_P(cta_catalogue_CatalogueTest, filesWrittenToTape_1_file_recycle_log_delete log::LogContext dummyLc(m_dummyLog); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; const bool logicalLibraryIsDisabled= false; const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; @@ -11923,6 +12130,7 @@ TEST_P(cta_catalogue_CatalogueTest, filesWrittenToTape_1_file_recycle_log_delete m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -12005,10 +12213,11 @@ TEST_P(cta_catalogue_CatalogueTest, filesWrittenToTape_1_archive_file_2_tape_cop const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -12216,10 +12425,11 @@ TEST_P(cta_catalogue_CatalogueTest, filesWrittenToTape_1_archive_file_2_tape_cop const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_sintance"; + const std::string diskInstance = m_diskInstance.name; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTape(m_admin, m_tape1); @@ -12414,10 +12624,11 @@ TEST_P(cta_catalogue_CatalogueTest, filesWrittenToTape_1_archive_file_2_tape_cop const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTape(m_admin, m_tape1); @@ -12588,10 +12799,11 @@ TEST_P(cta_catalogue_CatalogueTest, filesWrittenToTape_1_archive_file_2_tape_cop const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTape(m_admin, m_tape1); @@ -12722,10 +12934,11 @@ TEST_P(cta_catalogue_CatalogueTest, filesWrittenToTape_1_archive_file_2_tape_cop const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTape(m_admin, m_tape1); @@ -12884,10 +13097,11 @@ TEST_P(cta_catalogue_CatalogueTest, filesWrittenToTape_1_archive_file_2_tape_cop const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTape(m_admin, m_tape1); @@ -13046,10 +13260,11 @@ TEST_P(cta_catalogue_CatalogueTest, filesWrittenToTape_1_archive_file_2_tape_cop const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTape(m_admin, m_tape1); @@ -13207,10 +13422,11 @@ TEST_P(cta_catalogue_CatalogueTest, deleteArchiveFile) { const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTape(m_admin, m_tape1); @@ -13480,7 +13696,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteArchiveFile) { } log::LogContext dummyLc(m_dummyLog); - m_catalogue->DO_NOT_USE_deleteArchiveFile_DO_NOT_USE("disk_instance", archiveFileId, dummyLc); + m_catalogue->DO_NOT_USE_deleteArchiveFile_DO_NOT_USE(diskInstance, archiveFileId, dummyLc); ASSERT_FALSE(m_catalogue->getArchiveFilesItor().hasMore()); } @@ -13492,10 +13708,11 @@ TEST_P(cta_catalogue_CatalogueTest, deleteArchiveFile_by_archive_file_id_of_anot const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTape(m_admin, m_tape1); @@ -13798,6 +14015,7 @@ TEST_P(cta_catalogue_CatalogueTest, getTapesByVid_1_tape) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -13853,6 +14071,7 @@ TEST_P(cta_catalogue_CatalogueTest, getTapesByVid_350_tapes) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -13915,6 +14134,7 @@ TEST_P(cta_catalogue_CatalogueTest, getVidToLogicalLibrary_1_tape) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -13957,6 +14177,7 @@ TEST_P(cta_catalogue_CatalogueTest, getVidToLogicalLibrary_310_tapes) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -15659,6 +15880,7 @@ TEST_P(cta_catalogue_CatalogueTest, getNbFilesOnTape_no_tape_files) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -15700,7 +15922,7 @@ TEST_P(cta_catalogue_CatalogueTest, getNbFilesOnTape_no_tape_files) { TEST_P(cta_catalogue_CatalogueTest, getNbFilesOnTape_one_tape_file) { using namespace cta; - const std::string diskInstanceName1 = "disk_instance_1"; + const std::string diskInstanceName1 = m_diskInstance.name; const bool logicalLibraryIsDisabled= false; const uint64_t nbPartialTapes = 2; @@ -15709,6 +15931,7 @@ TEST_P(cta_catalogue_CatalogueTest, getNbFilesOnTape_one_tape_file) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTape(m_admin, m_tape1); @@ -15810,6 +16033,7 @@ TEST_P(cta_catalogue_CatalogueTest, checkTapeForLabel_no_tape_files) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -15851,7 +16075,7 @@ TEST_P(cta_catalogue_CatalogueTest, checkTapeForLabel_no_tape_files) { TEST_P(cta_catalogue_CatalogueTest, checkTapeForLabel_one_tape_file) { using namespace cta; - const std::string diskInstanceName1 = "disk_instance_1"; + const std::string diskInstanceName1 = m_diskInstance.name; const bool logicalLibraryIsDisabled= false; const uint64_t nbPartialTapes = 2; @@ -15860,6 +16084,7 @@ TEST_P(cta_catalogue_CatalogueTest, checkTapeForLabel_one_tape_file) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTape(m_admin, m_tape1); @@ -15953,7 +16178,7 @@ TEST_P(cta_catalogue_CatalogueTest, checkTapeForLabel_one_tape_file) { TEST_P(cta_catalogue_CatalogueTest, checkTapeForLabel_one_tape_file_reclaimed_tape) { using namespace cta; - const std::string diskInstanceName1 = "disk_instance_1"; + const std::string diskInstanceName1 = m_diskInstance.name; const bool logicalLibraryIsDisabled= false; const uint64_t nbPartialTapes = 2; @@ -15962,6 +16187,7 @@ TEST_P(cta_catalogue_CatalogueTest, checkTapeForLabel_one_tape_file_reclaimed_ta m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTape(m_admin, m_tape1); @@ -16086,6 +16312,7 @@ TEST_P(cta_catalogue_CatalogueTest, reclaimTape_full_lastFSeq_0_no_tape_files) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -16165,6 +16392,7 @@ TEST_P(cta_catalogue_CatalogueTest, reclaimTape_not_full_lastFSeq_0_no_tape_file m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -16208,7 +16436,7 @@ TEST_P(cta_catalogue_CatalogueTest, reclaimTape_full_lastFSeq_1_no_tape_files) { log::LogContext dummyLc(m_dummyLog); - const std::string diskInstanceName1 = "disk_instance_1"; + const std::string diskInstanceName1 = m_diskInstance.name; const bool logicalLibraryIsDisabled= false; const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; @@ -16216,6 +16444,7 @@ TEST_P(cta_catalogue_CatalogueTest, reclaimTape_full_lastFSeq_1_no_tape_files) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTape(m_admin, m_tape1); @@ -16411,7 +16640,7 @@ TEST_P(cta_catalogue_CatalogueTest, reclaimTape_full_lastFSeq_1_one_tape_file) { using namespace cta; log::LogContext dummyLc(m_dummyLog); - const std::string diskInstanceName1 = "disk_instance_1"; + const std::string diskInstanceName1 = m_diskInstance.name; const bool logicalLibraryIsDisabled= false; const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; @@ -16419,6 +16648,7 @@ TEST_P(cta_catalogue_CatalogueTest, reclaimTape_full_lastFSeq_1_one_tape_file) { m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTape(m_admin, m_tape1); @@ -16568,6 +16798,7 @@ TEST_P(cta_catalogue_CatalogueTest, createVirtualOrganization) { common::dataStructures::VirtualOrganization vo = getVo(); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); ASSERT_NO_THROW(m_catalogue->createVirtualOrganization(m_admin,vo)); } @@ -16576,6 +16807,7 @@ TEST_P(cta_catalogue_CatalogueTest, createVirtualOrganizationAlreadyExists) { common::dataStructures::VirtualOrganization vo = getVo(); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); ASSERT_NO_THROW(m_catalogue->createVirtualOrganization(m_admin,vo)); ASSERT_THROW(m_catalogue->createVirtualOrganization(m_admin,vo),cta::exception::UserError); } @@ -16586,6 +16818,7 @@ TEST_P(cta_catalogue_CatalogueTest, createVirtualOrganizationEmptyComment) { common::dataStructures::VirtualOrganization vo = getVo(); vo.comment = ""; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); ASSERT_THROW(m_catalogue->createVirtualOrganization(m_admin,vo),cta::exception::UserError); } @@ -16597,6 +16830,18 @@ TEST_P(cta_catalogue_CatalogueTest, createVirtualOrganizationEmptyName) { vo.name = ""; vo.comment = "comment"; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); + ASSERT_THROW(m_catalogue->createVirtualOrganization(m_admin,vo),cta::exception::UserError); +} + +TEST_P(cta_catalogue_CatalogueTest, createVirtualOrganizationEmptyDiskInstanceName) { + using namespace cta; + + common::dataStructures::VirtualOrganization vo = getVo(); + + vo.diskInstanceName = ""; + + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); ASSERT_THROW(m_catalogue->createVirtualOrganization(m_admin,vo),cta::exception::UserError); } @@ -16605,6 +16850,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteVirtualOrganization) { common::dataStructures::VirtualOrganization vo = getVo(); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); ASSERT_NO_THROW(m_catalogue->createVirtualOrganization(m_admin,vo)); ASSERT_NO_THROW(m_catalogue->deleteVirtualOrganization(vo.name)); @@ -16618,6 +16864,8 @@ TEST_P(cta_catalogue_CatalogueTest, deleteVirtualOrganizationUsedByTapePool) { const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); const std::string comment = "Create tape pool"; + + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, comment); @@ -16629,6 +16877,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteVirtualOrganizationNameDoesNotExist) { common::dataStructures::VirtualOrganization vo = getVo(); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); ASSERT_NO_THROW(m_catalogue->createVirtualOrganization(m_admin,vo)); ASSERT_THROW(m_catalogue->deleteVirtualOrganization("DOES_NOT_EXIST"),cta::exception::UserError); @@ -16637,6 +16886,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteVirtualOrganizationNameDoesNotExist) { TEST_P(cta_catalogue_CatalogueTest, deleteVirtualOrganizationUsedByStorageClass) { using namespace cta; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); ASSERT_THROW(m_catalogue->deleteVirtualOrganization(m_vo.name),exception::UserError); @@ -16647,6 +16897,7 @@ TEST_P(cta_catalogue_CatalogueTest, getVirtualOrganizations) { common::dataStructures::VirtualOrganization vo = getVo(); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); ASSERT_NO_THROW(m_catalogue->createVirtualOrganization(m_admin,vo)); std::list<common::dataStructures::VirtualOrganization> vos = m_catalogue->getVirtualOrganizations(); @@ -16656,7 +16907,9 @@ TEST_P(cta_catalogue_CatalogueTest, getVirtualOrganizations) { ASSERT_EQ(vo.name,voRetrieved.name); ASSERT_EQ(vo.readMaxDrives,voRetrieved.readMaxDrives); ASSERT_EQ(vo.writeMaxDrives,voRetrieved.writeMaxDrives); + ASSERT_EQ(vo.diskInstanceName,voRetrieved.diskInstanceName); ASSERT_EQ(vo.comment,voRetrieved.comment); + ASSERT_EQ(m_admin.host,voRetrieved.creationLog.host); ASSERT_EQ(m_admin.username,voRetrieved.creationLog.username); ASSERT_EQ(m_admin.host,voRetrieved.lastModificationLog.host); @@ -16673,6 +16926,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyVirtualOrganizationName) { common::dataStructures::VirtualOrganization vo = getVo(); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); ASSERT_NO_THROW(m_catalogue->createVirtualOrganization(m_admin,vo)); std::string newVoName = "NewVoName"; @@ -16699,6 +16953,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyVirtualOrganizationNameThatAlreadyExis std::string vo2Name = "vo2"; std::string vo1Name = vo.name; + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); ASSERT_NO_THROW(m_catalogue->createVirtualOrganization(m_admin,vo)); vo.name = vo2Name; @@ -16712,6 +16967,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyVirtualOrganizationComment) { common::dataStructures::VirtualOrganization vo = getVo(); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); ASSERT_NO_THROW(m_catalogue->createVirtualOrganization(m_admin,vo)); std::string newComment = "newComment"; @@ -16731,6 +16987,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyVirtualOrganizationReadMaxDrives) { common::dataStructures::VirtualOrganization vo = getVo(); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); ASSERT_NO_THROW(m_catalogue->createVirtualOrganization(m_admin,vo)); uint64_t readMaxDrives = 42; @@ -16749,6 +17006,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyVirtualOrganizationWriteMaxDrives) { common::dataStructures::VirtualOrganization vo = getVo(); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); ASSERT_NO_THROW(m_catalogue->createVirtualOrganization(m_admin,vo)); uint64_t writeMaxDrives = 42; @@ -16767,6 +17025,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyVirtualOrganizationMaxFileSize) { common::dataStructures::VirtualOrganization vo = getVo(); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); ASSERT_NO_THROW(m_catalogue->createVirtualOrganization(m_admin,vo)); uint64_t maxFileSize = 1; @@ -16785,20 +17044,39 @@ TEST_P(cta_catalogue_CatalogueTest, modifyVirtualOrganizationDiskInstanceName) { common::dataStructures::VirtualOrganization vo = getVo(); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); + ASSERT_NO_THROW(m_catalogue->createVirtualOrganization(m_admin,vo)); std::string diskInstanceName = "diskInstanceName"; - + m_catalogue->createDiskInstance(m_admin, diskInstanceName, m_diskInstance.comment); ASSERT_NO_THROW(m_catalogue->modifyVirtualOrganizationDiskInstanceName(m_admin,vo.name,diskInstanceName)); auto vos = m_catalogue->getVirtualOrganizations(); auto &frontVo = vos.front(); - ASSERT_EQ(diskInstanceName,frontVo.diskInstanceName.value()); + ASSERT_EQ(diskInstanceName,frontVo.diskInstanceName); + +} + +TEST_P(cta_catalogue_CatalogueTest, modifyVirtualOrganizationDiskInstanceNameNonExistingVO) { + using namespace cta; ASSERT_THROW(m_catalogue->modifyVirtualOrganizationDiskInstanceName(m_admin,"DOES not exists","VO_DOES_NOT_EXIST"),cta::exception::UserError); } +TEST_P(cta_catalogue_CatalogueTest, modifyVirtualOrganizationDiskInstanceNameNonExistingDiskInstance) { + using namespace cta; + + const common::dataStructures::VirtualOrganization vo = getVo(); + + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); + ASSERT_NO_THROW(m_catalogue->createVirtualOrganization(m_admin,vo)); + + const std::string diskInstanceName = "diskInstanceName"; + ASSERT_THROW(m_catalogue->modifyVirtualOrganizationDiskInstanceName(m_admin,vo.name,diskInstanceName), cta::exception::Exception); +} + TEST_P(cta_catalogue_CatalogueTest, getVirtualOrganizationOfTapepool) { using namespace cta; @@ -16809,6 +17087,7 @@ TEST_P(cta_catalogue_CatalogueTest, getVirtualOrganizationOfTapepool) { common::dataStructures::VirtualOrganization vo = getVo(); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin,vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -16825,10 +17104,12 @@ TEST_P(cta_catalogue_CatalogueTest, updateDiskFileId) { const uint64_t nbPartialTapes = 2; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTape(m_admin, m_tape1); @@ -16970,11 +17251,12 @@ TEST_P(cta_catalogue_CatalogueTest, moveFilesToRecycleLog) { const uint64_t nbPartialTapes = 1; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; const std::string tapeDrive = "tape_drive"; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, tapePoolName1, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTapePool(m_admin, tapePoolName2, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -17096,10 +17378,11 @@ TEST_P(cta_catalogue_CatalogueTest, reclaimTapeRemovesFilesFromRecycleLog) { const uint64_t nbPartialTapes = 1; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, tapePoolName1, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createStorageClass(m_admin, m_storageClassSingleCopy); @@ -17210,11 +17493,12 @@ TEST_P(cta_catalogue_CatalogueTest, filesArePutInTheFileRecycleLogInsteadOfBeing const uint64_t nbPartialTapes = 1; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; const std::string tapeDrive = "tape_drive"; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, tapePoolName1, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTapePool(m_admin, tapePoolName2, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -17437,11 +17721,12 @@ TEST_P(cta_catalogue_CatalogueTest, sameFileWrittenToSameTapePutThePreviousCopyO const uint64_t nbPartialTapes = 1; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; const std::string tapeDrive = "tape_drive"; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, tapePoolName1, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTapePool(m_admin, tapePoolName2, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -18929,12 +19214,13 @@ TEST_P(cta_catalogue_CatalogueTest, DeleteTapeFileCopyUsingArchiveID) { const uint64_t nbPartialTapes = 1; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; const std::string tapeDrive = "tape_drive"; const std::string reason = "reason"; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, tapePoolName1, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTapePool(m_admin, tapePoolName2, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -19060,12 +19346,13 @@ TEST_P(cta_catalogue_CatalogueTest, DeleteTapeFileCopyDoesNotExist) { const uint64_t nbPartialTapes = 1; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; const std::string tapeDrive = "tape_drive"; const std::string reason = "reason"; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, tapePoolName1, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTapePool(m_admin, tapePoolName2, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -19097,12 +19384,13 @@ TEST_P(cta_catalogue_CatalogueTest, DeleteTapeFileCopyUsingFXID) { const uint64_t nbPartialTapes = 1; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; const std::string tapeDrive = "tape_drive"; const std::string reason = "reason"; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, tapePoolName1, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTapePool(m_admin, tapePoolName2, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -19234,12 +19522,13 @@ TEST_P(cta_catalogue_CatalogueTest, RestoreTapeFileCopy) { const uint64_t nbPartialTapes = 1; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; const std::string tapeDrive = "tape_drive"; const std::string reason = "reason"; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, tapePoolName1, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTapePool(m_admin, tapePoolName2, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -19367,12 +19656,13 @@ TEST_P(cta_catalogue_CatalogueTest, RestoreRewrittenTapeFileCopyFails) { const uint64_t nbPartialTapes = 1; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; const std::string tapeDrive = "tape_drive"; const std::string reason = "reason"; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, tapePoolName1, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTapePool(m_admin, tapePoolName2, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -19533,12 +19823,13 @@ TEST_P(cta_catalogue_CatalogueTest, RestoreVariousDeletedTapeFileCopies) { const uint64_t nbPartialTapes = 1; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; const std::string tapeDrive = "tape_drive"; const std::string reason = "reason"; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, tapePoolName1, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTapePool(m_admin, tapePoolName2, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); @@ -19708,12 +19999,13 @@ TEST_P(cta_catalogue_CatalogueTest, RestoreArchiveFileAndCopy) { const uint64_t nbPartialTapes = 1; const bool isEncrypted = true; const cta::optional<std::string> supply("value for the supply pool mechanism"); - const std::string diskInstance = "disk_instance"; + const std::string diskInstance = m_diskInstance.name; const std::string tapeDrive = "tape_drive"; const std::string reason = "reason"; m_catalogue->createMediaType(m_admin, m_mediaType); m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); + m_catalogue->createDiskInstance(m_admin, m_diskInstance.name, m_diskInstance.comment); m_catalogue->createVirtualOrganization(m_admin, m_vo); m_catalogue->createTapePool(m_admin, tapePoolName1, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); m_catalogue->createTapePool(m_admin, tapePoolName2, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool"); diff --git a/catalogue/CatalogueTest.hpp b/catalogue/CatalogueTest.hpp index 1502bc46afd12d36e366d4cd7ee16ff27fb21547..952dd768b451bf3be527a1449afbea3dc43d7896 100644 --- a/catalogue/CatalogueTest.hpp +++ b/catalogue/CatalogueTest.hpp @@ -47,6 +47,7 @@ protected: const cta::common::dataStructures::StorageClass m_anotherStorageClass; const cta::common::dataStructures::StorageClass m_storageClassDualCopy; const cta::common::dataStructures::StorageClass m_storageClassTripleCopy; + const cta::common::dataStructures::DiskInstance m_diskInstance; const cta::catalogue::MediaType m_mediaType; const cta::catalogue::CreateTapeAttributes m_tape1; const cta::catalogue::CreateTapeAttributes m_tape2; diff --git a/catalogue/RdbmsCatalogue.cpp b/catalogue/RdbmsCatalogue.cpp index 2802ccf6218ec15d6759eae62c67aae97a3769a9..9bcdc4abed1d0735e52ca4dca34e54edc3489a08 100644 --- a/catalogue/RdbmsCatalogue.cpp +++ b/catalogue/RdbmsCatalogue.cpp @@ -320,6 +320,10 @@ void RdbmsCatalogue::createVirtualOrganization(const common::dataStructures::Sec if(vo.comment.empty()) { throw UserSpecifiedAnEmptyStringComment("Cannot create virtual organization because the comment is an empty string"); } + if(vo.diskInstanceName.empty()) { + throw UserSpecifiedAnEmptyStringDiskInstanceName("Cannot create virtual organization because the disk instance is an empty string"); + } + auto conn = m_connPool.getConn(); if(virtualOrganizationExists(conn, vo.name)) { throw exception::UserError(std::string("Cannot create vo : ") + @@ -336,6 +340,8 @@ void RdbmsCatalogue::createVirtualOrganization(const common::dataStructures::Sec "WRITE_MAX_DRIVES," "MAX_FILE_SIZE," + "DISK_INSTANCE_NAME," + "USER_COMMENT," "CREATION_LOG_USER_NAME," @@ -352,6 +358,8 @@ void RdbmsCatalogue::createVirtualOrganization(const common::dataStructures::Sec ":WRITE_MAX_DRIVES," ":MAX_FILE_SIZE," + ":DISK_INSTANCE_NAME," + ":USER_COMMENT," ":CREATION_LOG_USER_NAME," @@ -370,6 +378,8 @@ void RdbmsCatalogue::createVirtualOrganization(const common::dataStructures::Sec stmt.bindUint64(":WRITE_MAX_DRIVES",vo.writeMaxDrives); stmt.bindUint64(":MAX_FILE_SIZE", vo.maxFileSize); + stmt.bindString(":DISK_INSTANCE_NAME", vo.diskInstanceName); + stmt.bindString(":USER_COMMENT", vo.comment); stmt.bindString(":CREATION_LOG_USER_NAME", admin.username); @@ -479,7 +489,7 @@ std::list<common::dataStructures::VirtualOrganization> RdbmsCatalogue::getVirtua virtualOrganization.lastModificationLog.username = rset.columnString("LAST_UPDATE_USER_NAME"); virtualOrganization.lastModificationLog.host = rset.columnString("LAST_UPDATE_HOST_NAME"); virtualOrganization.lastModificationLog.time = rset.columnUint64("LAST_UPDATE_TIME"); - virtualOrganization.diskInstanceName = rset.columnOptionalString("DISK_INSTANCE_NAME"); + virtualOrganization.diskInstanceName = rset.columnString("DISK_INSTANCE_NAME"); virtualOrganizations.push_back(virtualOrganization); } @@ -559,7 +569,7 @@ common::dataStructures::VirtualOrganization RdbmsCatalogue::getVirtualOrganizati virtualOrganization.lastModificationLog.username = rset.columnString("LAST_UPDATE_USER_NAME"); virtualOrganization.lastModificationLog.host = rset.columnString("LAST_UPDATE_HOST_NAME"); virtualOrganization.lastModificationLog.time = rset.columnUint64("LAST_UPDATE_TIME"); - virtualOrganization.diskInstanceName = rset.columnOptionalString("DISK_INSTANCE_NAME"); + virtualOrganization.diskInstanceName = rset.columnString("DISK_INSTANCE_NAME"); return virtualOrganization; } catch(exception::UserError &) { throw; @@ -5798,6 +5808,12 @@ void RdbmsCatalogue::createRequesterActivityMountRule( " to requester " + diskInstanceName + ":" + requesterName + " for activities matching " + activityRegex + " because mount-policy " + mountPolicyName + " does not exist"); } + if(!diskInstanceExists(conn, diskInstanceName)) { + throw exception::UserError(std::string("Cannot create a rule to assign mount-policy ") + mountPolicyName + + " to requester " + diskInstanceName + ":" + requesterName + " for activities matching " + activityRegex + + " because disk-instance " + diskInstanceName + " does not exist"); + } + const uint64_t now = time(nullptr); const char *const sql = "INSERT INTO REQUESTER_ACTIVITY_MOUNT_RULE(" @@ -5970,6 +5986,12 @@ void RdbmsCatalogue::createRequesterMountRule( " to requester " + diskInstanceName + ":" + requesterName + " because mount-policy " + mountPolicyName + " does not exist"); } + if(!diskInstanceExists(conn, diskInstanceName)) { + throw exception::UserError(std::string("Cannot create a rule to assign mount-policy ") + mountPolicyName + + " to requester " + diskInstanceName + ":" + requesterName + " because disk-instance " + diskInstanceName + + " does not exist"); + } + const uint64_t now = time(nullptr); const char *const sql = "INSERT INTO REQUESTER_MOUNT_RULE(" @@ -6137,6 +6159,11 @@ void RdbmsCatalogue::createRequesterGroupMountRule( throw exception::UserError(std::string("Cannot assign mount-policy ") + mountPolicyName + " to requester-group " + diskInstanceName + ":" + requesterGroupName + " because mount-policy " + mountPolicyName + " does not exist"); } + if(!diskInstanceExists(conn, diskInstanceName)) { + throw exception::UserError(std::string("Cannot assign mount-policy ") + mountPolicyName + " to requester-group " + + diskInstanceName + ":" + requesterGroupName + " because disk-instance " + diskInstanceName + " does not exist"); + } + const uint64_t now = time(nullptr); const char *const sql = "INSERT INTO REQUESTER_GROUP_MOUNT_RULE(" diff --git a/catalogue/common_catalogue_schema.sql b/catalogue/common_catalogue_schema.sql index 918a1ba5d9f3ba701606ab842e5d80f552fe7a44..09aa3972ad4e00501687ea1e13e6fd646223b431 100644 --- a/catalogue/common_catalogue_schema.sql +++ b/catalogue/common_catalogue_schema.sql @@ -81,10 +81,13 @@ CREATE TABLE VIRTUAL_ORGANIZATION( LAST_UPDATE_USER_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_LUUN_NN NOT NULL, LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_LUHN_NN NOT NULL, LAST_UPDATE_TIME UINT64TYPE CONSTRAINT VIRTUAL_ORGANIZATION_LUT_NN NOT NULL, - DISK_INSTANCE_NAME VARCHAR(100), - CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID) + DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_DIN_NN NOT NULL, + CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID), + CONSTRAINT VIRTUAL_ORGANIZATION_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME) ); CREATE UNIQUE INDEX VIRTUAL_ORG_VON_UN_IDX ON VIRTUAL_ORGANIZATION(LOWER(VIRTUAL_ORGANIZATION_NAME)); +CREATE INDEX VIRTUAL_ORG_DIN_IDX ON VIRTUAL_ORGANIZATION(DISK_INSTANCE_NAME); + CREATE TABLE STORAGE_CLASS( STORAGE_CLASS_ID UINT64TYPE CONSTRAINT STORAGE_CLASS_SCI_NN NOT NULL, STORAGE_CLASS_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_SCN_NN NOT NULL, @@ -257,10 +260,12 @@ CREATE TABLE REQUESTER_ACTIVITY_MOUNT_RULE( LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT RQSTER_ACT_RULE_LUHN_NN NOT NULL, LAST_UPDATE_TIME UINT64TYPE CONSTRAINT RQSTER_ACT_RULE_LUT_NN NOT NULL, CONSTRAINT RQSTER_ACT_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_NAME, ACTIVITY_REGEX), - CONSTRAINT RQSTER_ACT_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) - REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME) + CONSTRAINT RQSTER_ACT_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME), + CONSTRAINT RQSTER_ACT_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME) ); CREATE INDEX REQ_ACT_MNT_RULE_MPN_IDX ON REQUESTER_ACTIVITY_MOUNT_RULE(MOUNT_POLICY_NAME); +CREATE INDEX REQ_ACT_MNT_RULE_DIN_IDX ON REQUESTER_ACTIVITY_MOUNT_RULE(DISK_INSTANCE_NAME); + CREATE TABLE REQUESTER_MOUNT_RULE( DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT RQSTER_RULE_DIN_NN NOT NULL, REQUESTER_NAME VARCHAR(100) CONSTRAINT RQSTER_RULE_RN_NN NOT NULL, @@ -273,10 +278,12 @@ CREATE TABLE REQUESTER_MOUNT_RULE( LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT RQSTER_RULE_LUHN_NN NOT NULL, LAST_UPDATE_TIME UINT64TYPE CONSTRAINT RQSTER_RULE_LUT_NN NOT NULL, CONSTRAINT RQSTER_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_NAME), - CONSTRAINT RQSTER_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) - REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME) + CONSTRAINT RQSTER_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME), + CONSTRAINT RQSTER_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME) ); CREATE INDEX REQ_MNT_RULE_MPN_IDX ON REQUESTER_MOUNT_RULE(MOUNT_POLICY_NAME); +CREATE INDEX REQ_MNT_RULE_DIN_IDX ON REQUESTER_MOUNT_RULE(DISK_INSTANCE_NAME); + CREATE TABLE REQUESTER_GROUP_MOUNT_RULE( DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT RQSTER_GRP_RULE_DIN_NN NOT NULL, REQUESTER_GROUP_NAME VARCHAR(100) CONSTRAINT RQSTER_GRP_RULE_RGN_NN NOT NULL, @@ -289,10 +296,13 @@ CREATE TABLE REQUESTER_GROUP_MOUNT_RULE( LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT RQSTER_GRP_RULE_LUHN_NN NOT NULL, LAST_UPDATE_TIME UINT64TYPE CONSTRAINT RQSTER_GRP_RULE_LUT_NN NOT NULL, CONSTRAINT RQSTER_GRP_RULE_PK PRIMARY KEY(DISK_INSTANCE_NAME, REQUESTER_GROUP_NAME), - CONSTRAINT RQSTER_GRP_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) - REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME) + CONSTRAINT RQSTER_GRP_RULE_MNT_PLC_FK FOREIGN KEY(MOUNT_POLICY_NAME) REFERENCES MOUNT_POLICY(MOUNT_POLICY_NAME), + CONSTRAINT RQSTER_GRP_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME) + ); CREATE INDEX REQ_GRP_MNT_RULE_MPN_IDX ON REQUESTER_GROUP_MOUNT_RULE(MOUNT_POLICY_NAME); +CREATE INDEX REQ_GRP_MNT_RULE_DIN_IDX ON REQUESTER_GROUP_MOUNT_RULE(DISK_INSTANCE_NAME); + CREATE TABLE ARCHIVE_FILE( ARCHIVE_FILE_ID UINT64TYPE CONSTRAINT ARCHIVE_FILE_AFI_NN NOT NULL, DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT ARCHIVE_FILE_DIN_NN NOT NULL, @@ -309,6 +319,7 @@ CREATE TABLE ARCHIVE_FILE( COLLOCATION_HINT VARCHAR(100), CONSTRAINT ARCHIVE_FILE_PK PRIMARY KEY(ARCHIVE_FILE_ID), CONSTRAINT ARCHIVE_FILE_STORAGE_CLASS_FK FOREIGN KEY(STORAGE_CLASS_ID) REFERENCES STORAGE_CLASS(STORAGE_CLASS_ID), + CONSTRAINT ARCHIVE_FILE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME), CONSTRAINT ARCHIVE_FILE_DIN_DFI_UN UNIQUE(DISK_INSTANCE_NAME, DISK_FILE_ID), CONSTRAINT ARCHIVE_FILE_ID_BOOL_CK CHECK(IS_DELETED IN ('0', '1')) ); diff --git a/catalogue/migrations/liquibase/oracle/4.6to10.0.sql b/catalogue/migrations/liquibase/oracle/4.6to10.0.sql index 2795613094cdcfdbb8ffb88e9c21cb3b4fb0d36c..3227a2e3d3344eb2581160bccc6ebb06a96efe4a 100644 --- a/catalogue/migrations/liquibase/oracle/4.6to10.0.sql +++ b/catalogue/migrations/liquibase/oracle/4.6to10.0.sql @@ -3,7 +3,6 @@ --changeset mvelosob:1 failOnError:true dbms:oracle --preconditions onFail:HALT onError:HALT --precondition-sql-check expectedResult:"4.6" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE; ---precondition-sql-check expectedResult:"0.0" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE; --!!!THIS FALSE PRECONDITION IS HERE TO BLOCK AN UPGRADE WHILE THE DEVELOPMENT OF THE NEW CATALOGUE VERSION IS BEING DEVELOPED!!! UPDATE CTA_CATALOGUE SET STATUS='UPGRADING'; UPDATE CTA_CATALOGUE SET NEXT_SCHEMA_VERSION_MAJOR=10; @@ -155,6 +154,52 @@ ALTER TABLE LOGICAL_LIBRARY ADD (DISABLED_REASON VARCHAR2(1000)); --changeset mvelosob:7 failOnError:true dbms:oracle --preconditions onFail:HALT onError:HALT --precondition-sql-check expectedResult:"4.6" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE; +--precondition-sql-check expectedResult:"0" SELECT COUNT(*) FROM VIRTUAL_ORGANIZATION WHERE DISK_INSTANCE_NAME NOT IN (SELECT DISK_INSTANCE_NAME FROM DISK_INSTANCE); +ALTER TABLE VIRTUAL_ORGANIZATION ADD CONSTRAINT VIRTUAL_ORGANIZATION_DIN_NN CHECK (DISK_INSTANCE_NAME IS NOT NULL); +ALTER TABLE VIRTUAL_ORGANIZATION ADD CONSTRAINT VIRTUAL_ORGANIZATION_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME); +CREATE INDEX VIRTUAL_ORG_DIN_IDX ON VIRTUAL_ORGANIZATION(DISK_INSTANCE_NAME); +--rollback ALTER TABLE VIRTUAL_ORGANIZATION DROP CONSTRAINT VIRTUAL_ORGANIZATION_DIN_NN; +--rollback ALTER TABLE VIRTUAL_ORGANIZATION DROP CONSTRAINT VIRTUAL_ORGANIZATION_DIN_FK; +--rollback DROP INDEX VIRTUAL_ORG_DIN_IDX; + +--changeset mvelosob:8 failOnError:true dbms:oracle +--preconditions onFail:HALT onError:HALT +--precondition-sql-check expectedResult:"4.6" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE; +--precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM REQUESTER_ACTIVITY_MOUNT_RULE WHERE DISK_INSTANCE_NAME NOT IN (SELECT DISK_INSTANCE_NAME FROM DISK_INSTANCE); +ALTER TABLE REQUESTER_ACTIVITY_MOUNT_RULE ADD CONSTRAINT RQSTER_ACT_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME); +CREATE INDEX REQ_ACT_MNT_RULE_DIN_IDX ON REQUESTER_ACTIVITY_MOUNT_RULE(DISK_INSTANCE_NAME); +--rollback ALTER TABLE REQUESTER_ACTIVITY_MOUNT_RULE DROP CONSTRAINT RQSTER_ACT_RULE_DIN_FK; +--rollback DROP INDEX REQ_ACT_MNT_RULE_DIN_IDX; + +--changeset mvelosob:9 failOnError:true dbms:oracle +--preconditions onFail:HALT onError:HALT +--precondition-sql-check expectedResult:"4.6" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE; +--precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM REQUESTER_MOUNT_RULE WHERE DISK_INSTANCE_NAME NOT IN (SELECT DISK_INSTANCE_NAME FROM DISK_INSTANCE); +ALTER TABLE REQUESTER_MOUNT_RULE ADD CONSTRAINT RQSTER_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME); +CREATE INDEX REQ_MNT_RULE_DIN_IDX ON REQUESTER_MOUNT_RULE(DISK_INSTANCE_NAME); +--rollback ALTER TABLE REQUESTER_MOUNT_RULE DROP CONSTRAINT RQSTER_RULE_DIN_FK; +--rollback DROP INDEX REQ_MNT_RULE_DIN_IDX; + +--changeset mvelosob:10 failOnError:true dbms:oracle +--preconditions onFail:HALT onError:HALT +--precondition-sql-check expectedResult:"4.6" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE; +--precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM REQUESTER_GROUP_MOUNT_RULE WHERE DISK_INSTANCE_NAME NOT IN (SELECT DISK_INSTANCE_NAME FROM DISK_INSTANCE); +ALTER TABLE REQUESTER_GROUP_MOUNT_RULE ADD CONSTRAINT RQSTER_GRP_RULE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME); +CREATE INDEX REQ_GRP_MNT_RULE_DIN_IDX ON REQUESTER_GROUP_MOUNT_RULE(DISK_INSTANCE_NAME); +--rollback ALTER TABLE REQUESTER_GROUP_MOUNT_RULE DROP CONSTRAINT RQSTER_GRP_RULE_DIN_FK; +--rollback DROP INDEX REQ_GRP_MNT_RULE_DIN_IDX; + +--changeset mvelosob:11 failOnError:true dbms:oracle +--preconditions onFail:HALT onError:HALT +--precondition-sql-check expectedResult:"4.6" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE; +--precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM ARCHIVE_FILEq WHERE DISK_INSTANCE_NAME NOT IN (SELECT DISK_INSTANCE_NAME FROM DISK_INSTANCE); +ALTER TABLE ARCHIVE_FILE ADD CONSTRAINT ARCHIVE_FILE_DIN_FK FOREIGN KEY(DISK_INSTANCE_NAME) REFERENCES DISK_INSTANCE(DISK_INSTANCE_NAME); +--rollback ALTER TABLE ARCHIVE_FILE DROP CONSTRAINT ARCHIVE_FILE_DIN_FK; + + +--changeset mvelosob:12 failOnError:true dbms:oracle +--preconditions onFail:HALT onError:HALT +--precondition-sql-check expectedResult:"4.6" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE; UPDATE CTA_CATALOGUE SET STATUS='PRODUCTION'; UPDATE CTA_CATALOGUE SET SCHEMA_VERSION_MAJOR=10; UPDATE CTA_CATALOGUE SET SCHEMA_VERSION_MINOR=0; diff --git a/cmdline/CtaAdminCmdParse.hpp b/cmdline/CtaAdminCmdParse.hpp index 42fea20ecab360931e76adab268ca946f4532147..0584f901f2eca2519ed36ebfde4e97e92441fd96 100644 --- a/cmdline/CtaAdminCmdParse.hpp +++ b/cmdline/CtaAdminCmdParse.hpp @@ -682,7 +682,7 @@ const std::map<cmd_key_t, cmd_val_t> cmdOptions = { /*----------------------------------------------------------------------------------------------------*/ {{ AdminCmd::CMD_VIRTUALORGANIZATION, AdminCmd::SUBCMD_ADD }, - { opt_vo, opt_read_max_drives, opt_write_max_drives, opt_comment, opt_maxfilesize.optional() }}, + { opt_vo, opt_read_max_drives, opt_write_max_drives, opt_comment, opt_diskinstance, opt_maxfilesize.optional() }}, {{ AdminCmd::CMD_VIRTUALORGANIZATION, AdminCmd::SUBCMD_CH }, { opt_vo, opt_comment.optional(), opt_read_max_drives.optional(), opt_write_max_drives.optional(), opt_maxfilesize.optional(), opt_diskinstance.optional() }}, {{ AdminCmd::CMD_VIRTUALORGANIZATION, AdminCmd::SUBCMD_RM }, diff --git a/common/dataStructures/VirtualOrganization.hpp b/common/dataStructures/VirtualOrganization.hpp index 5b69108049199a40f74f4536215d173218e09d98..47e0ff338d720dbff22a7fb4b664399a03f4ef77 100644 --- a/common/dataStructures/VirtualOrganization.hpp +++ b/common/dataStructures/VirtualOrganization.hpp @@ -61,7 +61,7 @@ struct VirtualOrganization { /** * The disk instance name. */ - cta::optional<std::string> diskInstanceName; + std::string diskInstanceName; bool operator==(const VirtualOrganization & other) const{ return (name == other.name && comment == other.comment && readMaxDrives == other.readMaxDrives && diff --git a/continuousintegration/orchestration/tests/prepare_tests.sh b/continuousintegration/orchestration/tests/prepare_tests.sh index ebc7c2e161bfbd64e21b7daf701b384947fd3848..d308178eb0b961b04de0dfc09405530b58ce34ab 100755 --- a/continuousintegration/orchestration/tests/prepare_tests.sh +++ b/continuousintegration/orchestration/tests/prepare_tests.sh @@ -122,10 +122,15 @@ kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin --json version | jq --comment "ctasystest library mapped to drive ${TAPEDRIVES_IN_USE[${i}]}" done + kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin diskinstance add \ + --name ${EOSINSTANCE} \ + --comment "di" + kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin virtualorganization add \ --vo vo \ --readmaxdrives 1 \ --writemaxdrives 1 \ + --diskinstance ${EOSINSTANCE} \ --comment "vo" kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin tapepool add \ --name ctasystest \ diff --git a/scheduler/SchedulerTest.cpp b/scheduler/SchedulerTest.cpp index 4a4fe9e6f39c0a0e62359f9b823ae538f2763c71..1256b802dced07eec6c490be3639516b01818b58 100644 --- a/scheduler/SchedulerTest.cpp +++ b/scheduler/SchedulerTest.cpp @@ -191,6 +191,8 @@ public: ASSERT_EQ(minRetrieveRequestAge, group.retrieveMinRequestAge); ASSERT_EQ(mountPolicyComment, group.comment); + m_catalogue->createDiskInstance(s_adminOnAdminHost, s_diskInstance, "comment"); + const std::string ruleComment = "create requester mount-rule"; catalogue.createRequesterMountRule(s_adminOnAdminHost, mountPolicyName, s_diskInstance, s_userName, ruleComment); @@ -212,6 +214,7 @@ public: vo.writeMaxDrives = 1; vo.readMaxDrives = 1; vo.maxFileSize = 0; + vo.diskInstanceName = s_diskInstance; m_catalogue->createVirtualOrganization(s_adminOnAdminHost,vo); common::dataStructures::StorageClass storageClass; @@ -688,8 +691,13 @@ TEST_P(SchedulerTest, archive_report_and_retrieve_new_dual_copy_file) { ASSERT_EQ(minRetrieveRequestAge, group.retrieveMinRequestAge); ASSERT_EQ(mountPolicyComment, group.comment); + cta::common::dataStructures::DiskInstance di; + di.name = s_diskInstance; + di.comment = "comment"; + catalogue.createDiskInstance(s_adminOnAdminHost, di.name, di.comment); + const std::string ruleComment = "create requester mount-rule"; - catalogue.createRequesterMountRule(s_adminOnAdminHost, mountPolicyName, s_diskInstance, s_userName, ruleComment); + catalogue.createRequesterMountRule(s_adminOnAdminHost, mountPolicyName, di.name, s_userName, ruleComment); const std::list<common::dataStructures::RequesterMountRule> rules = catalogue.getRequesterMountRules(); ASSERT_EQ(1, rules.size()); @@ -709,6 +717,7 @@ TEST_P(SchedulerTest, archive_report_and_retrieve_new_dual_copy_file) { vo.writeMaxDrives = 1; vo.readMaxDrives = 1; vo.maxFileSize = 0; + vo.diskInstanceName = s_diskInstance; catalogue.createVirtualOrganization(s_adminOnAdminHost,vo); common::dataStructures::StorageClass storageClass; diff --git a/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp b/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp index 4a5884559e8d01373458ea6fb8d9d755b456b9c1..d68acb30798faa9d7149c02b27ae9dc5c8514cc4 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp +++ b/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp @@ -276,6 +276,13 @@ public: return mountPolicy; } + const cta::common::dataStructures::DiskInstance getDefaultDiskInstance() const { + cta::common::dataStructures::DiskInstance di; + di.name = s_diskInstance; + di.comment = "comment"; + return di; + } + cta::common::dataStructures::VirtualOrganization getDefaultVirtualOrganization() { cta::common::dataStructures::VirtualOrganization vo; vo.name = "vo"; @@ -283,6 +290,7 @@ public: vo.writeMaxDrives = 1; vo.maxFileSize = 0; vo.comment = "comment"; + vo.diskInstanceName = getDefaultDiskInstance().name; return vo; } @@ -330,8 +338,11 @@ public: ASSERT_EQ(minRetrieveRequestAge, group.retrieveMinRequestAge); ASSERT_EQ(mountPolicyComment, group.comment); + const auto di = getDefaultDiskInstance(); + catalogue.createDiskInstance(s_adminOnAdminHost, di.name, di.comment); + const std::string ruleComment = "create requester mount-rule"; - catalogue.createRequesterMountRule(s_adminOnAdminHost, mountPolicyName, s_diskInstance, s_userName, ruleComment); + catalogue.createRequesterMountRule(s_adminOnAdminHost, mountPolicyName, di.name, s_userName, ruleComment); const std::list<common::dataStructures::RequesterMountRule> rules = catalogue.getRequesterMountRules(); ASSERT_EQ(1, rules.size()); @@ -345,6 +356,7 @@ public: ASSERT_EQ(s_adminOnAdminHost.host, rule.creationLog.host); ASSERT_EQ(rule.creationLog, rule.lastModificationLog); + cta::common::dataStructures::VirtualOrganization vo = getDefaultVirtualOrganization(); catalogue.createVirtualOrganization(s_adminOnAdminHost, vo); @@ -553,7 +565,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionGooddayRecall) { catalogue.filesWrittenToTape(tapeFileWrittenSet); // Schedule the retrieval of the file - std::string diskInstance = "disk_instance"; + std::string diskInstance = s_diskInstance; cta::common::dataStructures::RetrieveRequest rReq; rReq.archiveFileID = fseq; rReq.requester.name = s_userName; @@ -739,7 +751,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionWrongChecksumRecall) { catalogue.filesWrittenToTape(tapeFileWrittenSet); // Schedule the retrieval of the file - std::string diskInstance="disk_instance"; + std::string diskInstance=s_diskInstance; cta::common::dataStructures::RetrieveRequest rReq; rReq.archiveFileID=fseq; rReq.requester.name = s_userName; @@ -957,7 +969,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionWrongRecall) { } // Schedule the retrieval of the file - std::string diskInstance = "disk_instance"; + std::string diskInstance = s_diskInstance; cta::common::dataStructures::RetrieveRequest rReq; rReq.archiveFileID = 1000 + fseq; rReq.requester.name = s_userName; @@ -1133,7 +1145,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionRAORecall) { catalogue.filesWrittenToTape(tapeFileWrittenSet); // Schedule the retrieval of the file - std::string diskInstance = "disk_instance"; + std::string diskInstance = s_diskInstance; cta::common::dataStructures::RetrieveRequest rReq; rReq.archiveFileID = fseq; rReq.requester.name = s_userName; @@ -1324,7 +1336,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionRAORecallLinearAlgorithm) { catalogue.filesWrittenToTape(tapeFileWrittenSet); // Schedule the retrieval of the file - std::string diskInstance = "disk_instance"; + std::string diskInstance = s_diskInstance; cta::common::dataStructures::RetrieveRequest rReq; rReq.archiveFileID = fseq; rReq.requester.name = s_userName; @@ -1511,7 +1523,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionRAORecallRAOAlgoDoesNotExistS catalogue.filesWrittenToTape(tapeFileWrittenSet); // Schedule the retrieval of the file - std::string diskInstance = "disk_instance"; + std::string diskInstance = s_diskInstance; cta::common::dataStructures::RetrieveRequest rReq; rReq.archiveFileID = fseq; rReq.requester.name = s_userName; @@ -1702,7 +1714,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionRAORecallSLTFRAOAlgorithm) { catalogue.filesWrittenToTape(tapeFileWrittenSet); // Schedule the retrieval of the file - std::string diskInstance = "disk_instance"; + std::string diskInstance = s_diskInstance; cta::common::dataStructures::RetrieveRequest rReq; rReq.archiveFileID = fseq; rReq.requester.name = s_userName; @@ -1887,7 +1899,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionNoSuchDrive) { catalogue.filesWrittenToTape(tapeFileWrittenSet); // Schedule the retrieval of the file - std::string diskInstance = "disk_instance"; + std::string diskInstance = s_diskInstance; cta::common::dataStructures::RetrieveRequest rReq; rReq.archiveFileID = fseq; rReq.requester.name = s_userName; @@ -2037,7 +2049,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionFailtoMount) { catalogue.filesWrittenToTape(tapeFileWrittenSet); // Schedule the retrieval of the file - std::string diskInstance = "disk_instance"; + std::string diskInstance = s_diskInstance; cta::common::dataStructures::RetrieveRequest rReq; rReq.archiveFileID = fseq; rReq.requester.name = s_userName; @@ -2143,6 +2155,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionGooddayMigration) { auto mountPolicy = getImmediateMountMountPolicy(); catalogue.createMountPolicy(requester, mountPolicy); std::string mountPolicyName = mountPolicy.name; + catalogue.createRequesterMountRule(requester, mountPolicyName, s_diskInstance, requester.username, "Rule comment"); //delete is unnecessary @@ -2292,6 +2305,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionWrongFileSizeMigration) { auto mountPolicy = getImmediateMountMountPolicy(); catalogue.createMountPolicy(requester, mountPolicy); std::string mountPolicyName = mountPolicy.name; + catalogue.createRequesterMountRule(requester, mountPolicyName, s_diskInstance, requester.username, "Rule comment"); //delete is unnecessary @@ -2470,6 +2484,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionWrongChecksumMigration) { auto mountPolicy = getImmediateMountMountPolicy(); catalogue.createMountPolicy(requester, mountPolicy); std::string mountPolicyName = mountPolicy.name; + catalogue.createRequesterMountRule(requester, mountPolicyName, s_diskInstance, requester.username, "Rule comment"); //delete is unnecessary @@ -2639,6 +2654,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionWrongFilesizeInMiddleOfBatchM auto mountPolicy = getImmediateMountMountPolicy(); catalogue.createMountPolicy(requester, mountPolicy); std::string mountPolicyName = mountPolicy.name; + catalogue.createRequesterMountRule(requester, mountPolicyName, s_diskInstance, requester.username, "Rule comment"); //delete is unnecessary @@ -2840,6 +2856,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionMissingFilesMigration) { auto mountPolicy = getImmediateMountMountPolicy(); catalogue.createMountPolicy(requester, mountPolicy); std::string mountPolicyName = mountPolicy.name; + catalogue.createRequesterMountRule(requester, mountPolicyName, s_diskInstance, requester.username, "Rule comment"); //delete is unnecessary @@ -3004,6 +3021,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionTapeFullMigration) { auto mountPolicy = getImmediateMountMountPolicy(); catalogue.createMountPolicy(requester, mountPolicy); std::string mountPolicyName = mountPolicy.name; + catalogue.createRequesterMountRule(requester, mountPolicyName, s_diskInstance, requester.username, "Rule comment"); //delete is unnecessary @@ -3172,6 +3190,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionTapeFullOnFlushMigration) { auto mountPolicy = getImmediateMountMountPolicy(); catalogue.createMountPolicy(requester, mountPolicy); std::string mountPolicyName = mountPolicy.name; + catalogue.createRequesterMountRule(requester, mountPolicyName, s_diskInstance, requester.username, "Rule comment"); //delete is unnecessary @@ -3336,6 +3355,7 @@ TEST_P(DataTransferSessionTest, CleanerSessionFailsShouldPutTheDriveDown) { auto mountPolicy = getImmediateMountMountPolicy(); catalogue.createMountPolicy(requester, mountPolicy); std::string mountPolicyName = mountPolicy.name; + catalogue.createRequesterMountRule(requester, mountPolicyName, s_diskInstance, requester.username, "Rule comment"); //delete is unnecessary diff --git a/tapeserver/castor/tape/tapeserver/daemon/MigrationReportPackerTest.cpp b/tapeserver/castor/tape/tapeserver/daemon/MigrationReportPackerTest.cpp index 5fb6881a499507312e6291ed536a46f3dd73bf04..eb9e6c2a66c688126eb0aa81ca460523ec6fcb7e 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/MigrationReportPackerTest.cpp +++ b/tapeserver/castor/tape/tapeserver/daemon/MigrationReportPackerTest.cpp @@ -64,7 +64,15 @@ const uint32_t TEST_GROUP_2 = 9754; mediaType.comment = "comment"; m_catalogue->createMediaType(admin,mediaType); } - + + const cta::common::dataStructures::DiskInstance getDefaultDiskInstance() const { + cta::common::dataStructures::DiskInstance di; + di.name = "di"; + di.comment = "comment"; + return di; + } + + cta::common::dataStructures::VirtualOrganization getDefaultVo(){ cta::common::dataStructures::VirtualOrganization vo; vo.name = "vo"; @@ -72,6 +80,7 @@ const uint32_t TEST_GROUP_2 = 9754; vo.writeMaxDrives = 1; vo.maxFileSize = 0; vo.comment = "comment"; + vo.diskInstanceName = getDefaultDiskInstance().name; return vo; } @@ -138,8 +147,9 @@ const uint32_t TEST_GROUP_2 = 9754; const bool fullValue = false; const std::string createTapeComment = "Create tape"; cta::common::dataStructures::VirtualOrganization vo = getDefaultVo(); - + const auto di = getDefaultDiskInstance(); cta::common::dataStructures::SecurityIdentity admin = cta::common::dataStructures::SecurityIdentity("admin","localhost"); + m_catalogue->createDiskInstance(admin, di.name, di.comment); m_catalogue->createVirtualOrganization(admin,vo); m_catalogue->createLogicalLibrary(admin, logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); @@ -177,7 +187,7 @@ const uint32_t TEST_GROUP_2 = 9754; job1.reset(mockJob.release()); } job1->archiveFile.archiveFileID=1; - job1->archiveFile.diskInstance="disk_instance"; + job1->archiveFile.diskInstance=di.name; job1->archiveFile.diskFileId="diskFileId1"; job1->archiveFile.diskFileInfo.path="filePath1"; job1->archiveFile.diskFileInfo.owner_uid=TEST_USER_1; @@ -200,7 +210,7 @@ const uint32_t TEST_GROUP_2 = 9754; job2.reset(mockJob.release()); } job2->archiveFile.archiveFileID=2; - job2->archiveFile.diskInstance="disk_instance"; + job2->archiveFile.diskInstance=di.name; job2->archiveFile.diskFileId="diskFileId2"; job2->archiveFile.diskFileInfo.path="filePath2"; job2->archiveFile.diskFileInfo.owner_uid=TEST_USER_2; @@ -300,7 +310,8 @@ const uint32_t TEST_GROUP_2 = 9754; cta::common::dataStructures::SecurityIdentity admin = cta::common::dataStructures::SecurityIdentity("admin","localhost"); cta::common::dataStructures::VirtualOrganization vo = getDefaultVo(); - + const auto &di = getDefaultDiskInstance(); + m_catalogue->createDiskInstance(admin, di.name, di.comment); m_catalogue->createVirtualOrganization(admin,vo); m_catalogue->createLogicalLibrary(admin, logicalLibraryName, logicalLibraryIsDisabled, "Create logical library"); @@ -353,7 +364,7 @@ const uint32_t TEST_GROUP_2 = 9754; } migratedBigFile->archiveFile.archiveFileID=4; - migratedBigFile->archiveFile.diskInstance="disk_instance"; + migratedBigFile->archiveFile.diskInstance=di.name; migratedBigFile->archiveFile.diskFileId="diskFileId2"; migratedBigFile->archiveFile.diskFileInfo.path="filePath2"; migratedBigFile->archiveFile.diskFileInfo.owner_uid=TEST_USER_2; @@ -369,7 +380,7 @@ const uint32_t TEST_GROUP_2 = 9754; migratedBigFile->tapeFile.checksumBlob.insert(cta::checksum::MD5, cta::checksum::ChecksumBlob::HexToByteArray("b170288bf1f61b26a648358866f4d6c6")); migratedFileSmall->archiveFile.archiveFileID=5; - migratedFileSmall->archiveFile.diskInstance="disk_instance"; + migratedFileSmall->archiveFile.diskInstance=di.name; migratedFileSmall->archiveFile.diskFileId="diskFileId3"; migratedFileSmall->archiveFile.diskFileInfo.path="filePath3"; migratedFileSmall->archiveFile.diskFileInfo.owner_uid=TEST_USER_2; @@ -385,7 +396,7 @@ const uint32_t TEST_GROUP_2 = 9754; migratedFileSmall->tapeFile.checksumBlob.insert(cta::checksum::MD5, cta::checksum::ChecksumBlob::HexToByteArray("b170288bf1f61b26a648358866f4d6c6")); migratedNullFile->archiveFile.archiveFileID=6; - migratedNullFile->archiveFile.diskInstance="disk_instance"; + migratedNullFile->archiveFile.diskInstance=di.name; migratedNullFile->archiveFile.diskFileId="diskFileId4"; migratedNullFile->archiveFile.diskFileInfo.path="filePath4"; migratedNullFile->archiveFile.diskFileInfo.owner_uid=TEST_USER_2; diff --git a/xroot_plugins/XrdCtaVirtualOrganizationLs.hpp b/xroot_plugins/XrdCtaVirtualOrganizationLs.hpp index 62825ed3bff396dd36c6e6c9103523e784d0d27e..22c6c90708eb9c78faa383ba112fd3b78be43d76 100644 --- a/xroot_plugins/XrdCtaVirtualOrganizationLs.hpp +++ b/xroot_plugins/XrdCtaVirtualOrganizationLs.hpp @@ -85,11 +85,8 @@ int VirtualOrganizationLsStream::fillBuffer(XrdSsiPb::OStreamBuffer<Data> *strea vo_item->mutable_last_modification_log()->set_host(vo.lastModificationLog.host); vo_item->mutable_last_modification_log()->set_time(vo.lastModificationLog.time); vo_item->set_comment(vo.comment); - - if (vo.diskInstanceName) { - vo_item->set_diskinstance(vo.diskInstanceName.value()); - } - + vo_item->set_diskinstance(vo.diskInstanceName); + is_buffer_full = streambuf->Push(record); } return streambuf->Size(); diff --git a/xroot_plugins/XrdSsiCtaRequestMessage.cpp b/xroot_plugins/XrdSsiCtaRequestMessage.cpp index c8bf62b609048eee76a5dae8e1e82e893ce0206c..ca16f458b2213a5ed3a74b3ab58ca5c6ed3f4938 100644 --- a/xroot_plugins/XrdSsiCtaRequestMessage.cpp +++ b/xroot_plugins/XrdSsiCtaRequestMessage.cpp @@ -2366,12 +2366,14 @@ void RequestMessage::processVirtualOrganization_Add(cta::xrd::Response &response const auto &writeMaxDrives = getRequired(OptionUInt64::WRITE_MAX_DRIVES); const auto &comment = getRequired(OptionString::COMMENT); const auto &maxFileSizeOpt = getOptional(OptionUInt64::MAX_FILE_SIZE); + const auto &diskInstanceName = getRequired(OptionString::DISK_INSTANCE); cta::common::dataStructures::VirtualOrganization vo; vo.name = name; vo.readMaxDrives = readMaxDrives; vo.writeMaxDrives = writeMaxDrives; vo.comment = comment; + vo.diskInstanceName = diskInstanceName; if (maxFileSizeOpt) { vo.maxFileSize = maxFileSizeOpt.value();