Commit 073feb07 authored by Giuseppe Lo Presti's avatar Giuseppe Lo Presti
Browse files

Fixed Tape.media_type import according to #488 + other fixes.

Tape.media_type and Tape.capacity in CTA are uniquely
specified by the density in VMGR by a hard-coded mapping.
Also incorporated formatting changes, removed useless function,
converted file checksum to CHAR (this is temporary, pending
the final format to store file checksums).
parent d72ee987
......@@ -154,24 +154,10 @@ BEGIN
END;
/
/* Function to convert seconds into a time string using the format:
* DD-MON-YYYY HH24:MI:SS. If seconds is not defined then the current time
* will be returned. Note that the time is converted from UTC to the
* currently defined time zone.
*/
CREATE OR REPLACE FUNCTION getTimeString
(seconds IN NUMBER DEFAULT NULL,
format IN VARCHAR2 DEFAULT 'DD-MON-YYYY HH24:MI:SS')
RETURN VARCHAR2 AS
BEGIN
RETURN (to_char(to_date('01-JAN-1970', 'DD-MON-YYYY') + (systimestamp - cast(sys_extract_utc(systimestamp) as date))
+ nvl(seconds, getTime()) / (60 * 60 * 24), format));
END;
/
-- Import metadata from the CASTOR namespace
-- Entry point to import metadata from the CASTOR namespace
CREATE OR REPLACE PROCEDURE importFromCASTOR(inTapePool VARCHAR2, inVO VARCHAR2, inEOSCTAInstance VARCHAR2,
Dirs OUT SYS_REFCURSOR, Files OUT SYS_REFCURSOR) AS
Dirs OUT SYS_REFCURSOR, Files OUT SYS_REFCURSOR) AS
BEGIN
-- first import tapes; can raise exceptions
importTapePool(inTapePool, inVO);
......@@ -189,6 +175,7 @@ BEGIN
END;
/
-- Insert the file-level metadata for the given migration
CREATE OR REPLACE PROCEDURE populateCTAFromCASTOR(inEOSCTAInstance VARCHAR2) AS
pathInEos VARCHAR2;
ct INTEGER := 0;
......@@ -201,7 +188,7 @@ BEGIN
disk_gid, size_in_bytes, checksum_type, checksum_value,
storage_class_id, creation_time, reconciliation_time)
VALUES (f.fileId, inEOSCTAInstance, f.fileId, pathInEos, f.gid,
f.filesize, 'AD', f.checksum, f.classname, f.atime, 0); -- XXX 'AD'?
f.filesize, 'AD', to_char(f.checksum), f.classname, f.atime, 0);
-- insert tape metadata
INSERT INTO Tape_File (archive_file_id, vid, fseq, block_id, copy_nb, creation_time)
VALUES (f.fileId, f.vid, f.fseq, f.blockId, f.copyno, f.s_mtime);
......@@ -240,7 +227,7 @@ BEGIN
'CASTOR', 'CASTOR', getTime(),
'CASTOR', 'CASTOR', getTime()
);
FOR T in (SELECT T.vid, T.model, T.manufacturer, DGN.dgn, TS.status, TS.nbfiles,
FOR T in (SELECT T.vid, T.manufacturer, DGN.dgn, TS.status, TS.nbfiles,
TS.rcount, TS.wcount, TS.rhost, TS.whost, TS.rtime, TS.wtime
FROM castor.Vmgr_tape_info T, castor.Vmgr_tape_side TS, castor.Vmgr_tape_dgnmap DGN
WHERE T.vid = TS.vid
......@@ -252,14 +239,22 @@ BEGIN
label_drive, label_time, last_read_drive, last_read_time, read_mount_count,
last_write_drive, last_write_time, write_mount_count,
user_comment, creation_log_user_name, creation_log_host_name, creation_log_time,
last_update_user_name, last_update_host_name, last_update_time) VALUES (
last_update_user_name, last_update_host_name, last_update_time)
VALUES (
T.vid,
T.model,
decode(T.density, -- media type: only one of the options below (see #488)
'7000GC', '3592JC',
'8000GC', '3592JC',
'9TC', 'LTO-7M',
'10TC', '3592JD',
'12TC', 'LTO-8',
'15TC', '3592JD',
'UNDEFINED'),
T.manufacturer,
T.dgn,
varTapePoolName,
'', -- blank encryption key
decode(T.density, -- capacity: only one of those options
'', -- blank encryption key
decode(T.density, -- capacity: only one of the options below (see #488)
'7000GC', 7000000000000,
'8000GC', 8000000000000,
'9TC', 9000000000000,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment