Check drive name is not already used in objectstore before registering it
We should make sure that the drive name is unique and not already in use in the objectstore. I did a simple test in CI:
# kubectl -n toto exec ctacli -- cta-admin dr ls
library drive host desired request status since vid tapepool files data MB/s session priority activity age
VDSTK01 VDSTK01 tpsrv01 Up - Free 23312 - - - - - - 0 - 2
VDSTK02 VDSTK02 tpsrv02 Down - Down 0 - - - - - - 0 - 0
Then I removed VDSTK02
tape drive and renamed VDSTK02
drive to VDSTK01
in VDSTK02
library with the following TPCONFIG
:
[root@tpsrv02 /]# cat /etc/cta/TPCONFIG
VDSTK01 VDSTK02 /dev/nst1 smc1
Upon cta-taped
restart, I obtained the following interesting mix:
[root@eosctafst0011 ~]# kubectl -n toto exec ctacli -- cta-admin dr ls
library drive host desired request status since vid tapepool files data MB/s session priority activity age
VDSTK01 VDSTK01 tpsrv01 Down - Down 89 - - - - - - 0 - 2
And a few seconds later:
[root@eosctafst0011 ~]# kubectl -n toto exec ctacli -- cta-admin dr ls
library drive host desired request status since vid tapepool files data MB/s session priority activity age
VDSTK02 VDSTK01 tpsrv02 Down - Down 461 - - - - - - 0 - 1
The drive name is used to uniquely identify a tape drive, but it looks like the last host reporting it gets the handle and both cta-taped
processes are happily fighting for it.
We should enforce the following:
- drive name is unique in a cta objectstore: this is something we have now and we want to enforce in non-CERN deployments as well
-
cta-taped
process should failed upon start if a drive is already registered with a different library or host - when 2 processes are fighting to update the drive state the one with a different host or library should terminate and cleanup the current sessions (it can happen if an admin remove a drive, register it on another host and the original process update its status afterwards).