Compare commits
3 Commits
bcdb95cab7
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| b8e9d4bbf1 | |||
| 8bafb04735 | |||
| 5949555747 |
@@ -22,7 +22,7 @@
|
|||||||
# Helper routines for tape handling
|
# Helper routines for tape handling
|
||||||
|
|
||||||
progname="${0##*/}"
|
progname="${0##*/}"
|
||||||
version="0.0.14"
|
version="0.0.15"
|
||||||
|
|
||||||
# global variables
|
# global variables
|
||||||
color=0
|
color=0
|
||||||
@@ -901,8 +901,8 @@ ltfs_reformat () {
|
|||||||
fi
|
fi
|
||||||
# wiping: put tape in an unformatted state
|
# wiping: put tape in an unformatted state
|
||||||
ltfs_wipe
|
ltfs_wipe
|
||||||
# RET = 8 -> error?
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
# format: create the ltfs partitions
|
||||||
ltfs_format $volume_name_active $volume_serial
|
ltfs_format $volume_name_active $volume_serial
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
ltfs_mount
|
ltfs_mount
|
||||||
@@ -1091,7 +1091,7 @@ mount_tape () {
|
|||||||
|
|
||||||
ltfs_is_mounted
|
ltfs_is_mounted
|
||||||
if test $? -eq 0; then
|
if test $? -eq 0; then
|
||||||
# get date from last written tape in given mediapool
|
# if no explicit tape should be mounted, get date from last written tape in given mediapool
|
||||||
if [ "${#volume_name}" -eq 0 ]; then
|
if [ "${#volume_name}" -eq 0 ]; then
|
||||||
get_lastwrite ${mediapool_name}
|
get_lastwrite ${mediapool_name}
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
@@ -1128,7 +1128,7 @@ mount_tape () {
|
|||||||
# check if given tape is poolmember of selected pool
|
# check if given tape is poolmember of selected pool
|
||||||
get_poolmember ${mediapool_name} ${volume_name}
|
get_poolmember ${mediapool_name} ${volume_name}
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
# volume_name is member of given mediapool
|
# check the mediapolicy for given volume_name
|
||||||
get_mediapolicy ${mediapool_name} ${volume_name_active}
|
get_mediapolicy ${mediapool_name} ${volume_name_active}
|
||||||
if [ ${#volume_mediapolicy} -gt 0 ]; then
|
if [ ${#volume_mediapolicy} -gt 0 ]; then
|
||||||
if [ ${volume_mediapolicy} = "append" ] ; then
|
if [ ${volume_mediapolicy} = "append" ] ; then
|
||||||
@@ -1147,6 +1147,8 @@ mount_tape () {
|
|||||||
printf "${MAGENTA}Valid tape, retensiondate has exposed: ${GREEN}%s${NO_COLOR}\n" \
|
printf "${MAGENTA}Valid tape, retensiondate has exposed: ${GREEN}%s${NO_COLOR}\n" \
|
||||||
"${volume_retensiondate}"
|
"${volume_retensiondate}"
|
||||||
fi
|
fi
|
||||||
|
#ltfs_format ${volume_name_active}
|
||||||
|
ltfs_reformat ${volume_name_active}
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
@@ -1188,7 +1190,7 @@ mount_tape () {
|
|||||||
"${volume_name}"
|
"${volume_name}"
|
||||||
fi
|
fi
|
||||||
ltfs_wipe
|
ltfs_wipe
|
||||||
#ltfs_format ${volume_name} ${volume_serial}
|
#ltfs_reformat ${volume_name_active}
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@@ -1298,7 +1300,7 @@ mount_tape () {
|
|||||||
RET=$?
|
RET=$?
|
||||||
if [ $RET -eq 2 ]; then
|
if [ $RET -eq 2 ]; then
|
||||||
if [ $verbose -ge 1 ]; then
|
if [ $verbose -ge 1 ]; then
|
||||||
printf "${MAGENTA}RetensionDate has exposed, mount the tape\n"
|
printf "${MAGENTA}RetensionDate has exposed, mount the tape${NO_COLOR}\n"
|
||||||
fi
|
fi
|
||||||
ltfs_mount
|
ltfs_mount
|
||||||
return 0
|
return 0
|
||||||
@@ -1326,7 +1328,7 @@ mount_tape () {
|
|||||||
if [ $? -eq 2 ]; then
|
if [ $? -eq 2 ]; then
|
||||||
# retensiondate has exposed: wipe given tape
|
# retensiondate has exposed: wipe given tape
|
||||||
ltfs_wipe
|
ltfs_wipe
|
||||||
#ltfs_format ${volume_name} ${volume_serial}
|
ltfs_format ${volume_name} ${volume_serial}
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@@ -1386,7 +1388,7 @@ mtx_getlabel () {
|
|||||||
volume_name_active=$(perl -ne '
|
volume_name_active=$(perl -ne '
|
||||||
/Data Transfer Element (\d+):Full \(Storage Element (\d+) Loaded\)(:VolumeTag =\s*(.+))?/ && print "$4\n";' ${TMPFILE})
|
/Data Transfer Element (\d+):Full \(Storage Element (\d+) Loaded\)(:VolumeTag =\s*(.+))?/ && print "$4\n";' ${TMPFILE})
|
||||||
volume_name_active=$(echo $volume_name_active | sed -e 's/ *$//g')
|
volume_name_active=$(echo $volume_name_active | sed -e 's/ *$//g')
|
||||||
if [ $verbose -ge 2 ]; then
|
if [ $verbose -ge 2 ] && [ ${#volume_name_active} -gt 0 ]; then
|
||||||
printf "${MAGENTA}Tape in slot ${GREEN}%s${MAGENTA} has Label: ${GREEN}%s${NO_COLOR}\n" \
|
printf "${MAGENTA}Tape in slot ${GREEN}%s${MAGENTA} has Label: ${GREEN}%s${NO_COLOR}\n" \
|
||||||
"${slot_source}" "${volume_name_active}"
|
"${slot_source}" "${volume_name_active}"
|
||||||
fi
|
fi
|
||||||
@@ -2405,76 +2407,70 @@ case $cmd in
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
ltfs-is-mounted)
|
ltfs-is-mounted)
|
||||||
|
if ! $quiet; then
|
||||||
|
printf "${MAGENTA}LTFS tape mount checke\n"
|
||||||
|
fi
|
||||||
ltfs_is_mounted
|
ltfs_is_mounted
|
||||||
if test $? -gt 0; then
|
if test $? -gt 0; then
|
||||||
exit 1
|
exit 1
|
||||||
else
|
|
||||||
if ! $quiet; then
|
|
||||||
printf "${MAGENTA}LTFS Tape is-mounted: ${GREEN}true${NO_COLOR}\n"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
ltfs-mount)
|
ltfs-mount)
|
||||||
|
if ! $quiet; then
|
||||||
|
printf "${MAGENTA}LTFS mount Tape\n"
|
||||||
|
fi
|
||||||
ltfs_mount
|
ltfs_mount
|
||||||
if test $? -gt 0; then
|
if test $? -gt 0; then
|
||||||
exit 1
|
exit 1
|
||||||
else
|
|
||||||
if ! $quiet; then
|
|
||||||
printf "${MAGENTA}LTFS Tape mount: ${GREEN}true${NO_COLOR}\n"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
ltfs-reformat)
|
ltfs-reformat)
|
||||||
ltfs_reformat "${volume_name}"
|
|
||||||
if test $? -gt 0; then
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
if ! $quiet; then
|
if ! $quiet; then
|
||||||
printf "${MAGENTA}LTFS Tape reformat: ${GREEN}%s${NO_COLOR}\n" \
|
printf "${MAGENTA}LTFS Tape reformat: ${GREEN}%s${NO_COLOR}\n" \
|
||||||
"${volume_name}"
|
"${volume_name}"
|
||||||
fi
|
fi
|
||||||
|
ltfs_reformat "${volume_name}"
|
||||||
|
if test $? -gt 0; then
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
ltfs-umount)
|
ltfs-umount)
|
||||||
ltfs_umount
|
|
||||||
if test $? -gt 0; then
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
if ! $quiet; then
|
if ! $quiet; then
|
||||||
printf "${MAGENTA}LTFS Tape unmount: ${GREEN}true${NO_COLOR}\n"
|
printf "${MAGENTA}LTFS Tape unmount: ${GREEN}true${NO_COLOR}\n"
|
||||||
fi
|
fi
|
||||||
|
ltfs_umount
|
||||||
|
if test $? -gt 0; then
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
media-change)
|
media-change)
|
||||||
|
if ! $quiet; then
|
||||||
|
if [ ${#volume_name} -ge 1 ]; then
|
||||||
|
printf "${MAGENTA}Media change in pool: ${GREEN}%s${NO_COLOR} (Volume-Name: ${GREEN}%s${NO_COLOR})\n" \
|
||||||
|
"${mediapool_name}" "${volume_name}"
|
||||||
|
else
|
||||||
|
printf "${MAGENTA}Media change in pool: ${GREEN}%s${NO_COLOR}\n" \
|
||||||
|
"${mediapool_name}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
media_change $mediapool_name $volume_name
|
media_change $mediapool_name $volume_name
|
||||||
if test $? -gt 0; then
|
if test $? -gt 0; then
|
||||||
return 1
|
return 1
|
||||||
else
|
|
||||||
if ! $quiet; then
|
|
||||||
if [ ${#volume_name} -ge 1 ]; then
|
|
||||||
printf "${MAGENTA}Media changed in pool: ${GREEN}%s${NO_COLOR} (Volume-Name: ${GREEN}%s${NO_COLOR})\n" \
|
|
||||||
"${mediapool_name}" "${volume_name}"
|
|
||||||
else
|
|
||||||
printf "${MAGENTA}Media changed in pool: ${GREEN}%s${NO_COLOR}\n" \
|
|
||||||
"${mediapool_name}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
mount)
|
mount)
|
||||||
mount_tape "${mediapool_name}" "${volume_name}"
|
|
||||||
if test $? -gt 0; then
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
if ! $quiet; then
|
if ! $quiet; then
|
||||||
if test ${#volume_name} -ge 1; then
|
if test ${#volume_name} -ge 1; then
|
||||||
printf "${MAGENTA}Tape ${GREEN}'%s'${MAGENTA} for ${GREEN}'%s'${MAGENTA} mounted${NO_COLOR}\n" \
|
printf "${MAGENTA}Mount tape ${GREEN}'%s'${MAGENTA} for ${GREEN}'%s'${NO_COLOR}\n" \
|
||||||
"${volume_name}" "${mediapool_name}"
|
"${volume_name}" "${mediapool_name}"
|
||||||
else
|
else
|
||||||
printf "${MAGENTA}Next tape for mediapool ${GREEN}'%s'${MAGENTA} mounted${NO_COLOR}\n" \
|
printf "${MAGENTA}Mount next tape for mediapool ${GREEN}'%s'${NO_COLOR}\n" \
|
||||||
"${mediapool_name}"
|
"${mediapool_name}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
mount_tape "${mediapool_name}" "${volume_name}"
|
||||||
|
if test $? -gt 0; then
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
mtx-exchange)
|
mtx-exchange)
|
||||||
|
|||||||
Reference in New Issue
Block a user