tape-admin: update ltfs_reformat()

- only reformat the tape, if the given volume_name is a
  member of the requested pool
- only call mtx to exchange tapes, if the requested
  volume_name is not the loaded and active tape in given drive (slot 0)

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
2019-01-02 01:08:53 +01:00
parent 238c950c06
commit a94ae31a51

View File

@@ -803,6 +803,17 @@ ltfs_reformat () {
if [ ! -d $ltfs_mountpoint ]; then
mkdir -p $ltfs_mountpoint
fi
get_mediapool_name "${volume_name}"
if [ $? -eq 0 ]; then
get_slot "${mediapool_name}" "${volume_name}"
if [ $? -eq 0 ]; then
slot_source=0
mtx_getlabel ${slot_source}
if [ $? -eq 0 ]; then
if [ ${volume_name_active} != ${volume_name} ]; then
mtx_unload ${slot_source}
mtx load ${volume_slot}
fi
make_err_file
if [ $verbose -ge 2 ]; then
printf "${MAGENTA}LTFS mounting tape ${GREEN}'%s'${MAGENTA} to ${GREEN}'%s'${NO_COLOR}\n" \
@@ -820,6 +831,9 @@ ltfs_reformat () {
rm -f ${ERRFILE}
fi
fi
fi
fi
fi
if [ ${#volume_name} -eq 0 ] || [ $volume_name_active = $volume_name ]; then
tape_id=$(echo $volume_name_active | sed -e 's/\([[:alpha:]]*-\)//g')