Move storage of persistent drive states to the DB
We would like to decouple the persistent storage of tape drive states from the queuing functionality of the objectstore. This will simplify the code, remove the dependency of libctatapedaemon
on libctaobjectstore
, and simplify the process of cleaning up the objectstore manually when required.
The proposal is to store drive states in the DB.
The drive status update code is in tapeserver/daemon/DriveHandler.cpp
in DriveHandler::runChild()
. After a preamble to initialise contact with the objectstore, the main work is done by calling scheduler.reportDriveStatus()
, scheduler.setDesiredDriveState()
and scheduler.reportDriveConfig()
.
Proposed approach:
- Define a new table in the DB schema to contain the drive status. See the
DiskSpaceReservation
,DriveConfig
,DriveState
andDriveStatePointer
definitions inobjectstore/cta.proto
for an indication of what fields need to be included. The drive configuration could be stored as a serialized blob. - Add new methods to the DB classes in
catalogue/
to update and read back from the new table. These methods will be analagous to the scheduler methodsgetDriveStates
,removeDrive
,reportDriveStatus
,reportDriveConfig
andsetDesiredDriveState
. - Add code to
tapeserver/daemon/DriveHandler.cpp
to call the above methods to update the DB (leave the code to update the objectstore in place for now, so both DB and objectstore will be updated). - Add a new command to
cta-admin
with corresponding code in the CTA Frontend with equivalent functionality tocta-admin drive
(up
/down
/ls
/ch
/rm
).
This can be deployed, with both the old and new way of storing drive statuses.
Once it has been validated:
- Replace the old
cta-admin
command with the new one and remove the old code incta-admin
and the CTA Frontend. - Remove the code referencing the objectstore from
tapeserver/daemon/DriveHandler.cpp
- Remove the
getDriveStates
,removeDrive
,reportDriveStatus
,reportDriveConfig
andsetDesiredDriveState
methods from the scheduler. - Remove the drive state definitions from
cta.proto
.