Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b8e9d4bbf1 | |||
| 8bafb04735 | |||
| 5949555747 |
@@ -22,7 +22,7 @@
|
||||
# Helper routines for tape handling
|
||||
|
||||
progname="${0##*/}"
|
||||
version="0.0.14"
|
||||
version="0.0.15"
|
||||
|
||||
# global variables
|
||||
color=0
|
||||
@@ -901,8 +901,8 @@ ltfs_reformat () {
|
||||
fi
|
||||
# wiping: put tape in an unformatted state
|
||||
ltfs_wipe
|
||||
# RET = 8 -> error?
|
||||
if [ $? -eq 0 ]; then
|
||||
# format: create the ltfs partitions
|
||||
ltfs_format $volume_name_active $volume_serial
|
||||
if [ $? -eq 0 ]; then
|
||||
ltfs_mount
|
||||
@@ -1091,7 +1091,7 @@ mount_tape () {
|
||||
|
||||
ltfs_is_mounted
|
||||
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
|
||||
get_lastwrite ${mediapool_name}
|
||||
if [ $? != 0 ]; then
|
||||
@@ -1128,7 +1128,7 @@ mount_tape () {
|
||||
# check if given tape is poolmember of selected pool
|
||||
get_poolmember ${mediapool_name} ${volume_name}
|
||||
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}
|
||||
if [ ${#volume_mediapolicy} -gt 0 ]; then
|
||||
if [ ${volume_mediapolicy} = "append" ] ; then
|
||||
@@ -1147,6 +1147,8 @@ mount_tape () {
|
||||
printf "${MAGENTA}Valid tape, retensiondate has exposed: ${GREEN}%s${NO_COLOR}\n" \
|
||||
"${volume_retensiondate}"
|
||||
fi
|
||||
#ltfs_format ${volume_name_active}
|
||||
ltfs_reformat ${volume_name_active}
|
||||
return 0
|
||||
fi
|
||||
if [ $? -eq 1 ]; then
|
||||
@@ -1188,7 +1190,7 @@ mount_tape () {
|
||||
"${volume_name}"
|
||||
fi
|
||||
ltfs_wipe
|
||||
#ltfs_format ${volume_name} ${volume_serial}
|
||||
#ltfs_reformat ${volume_name_active}
|
||||
if [ $? -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
@@ -1298,7 +1300,7 @@ mount_tape () {
|
||||
RET=$?
|
||||
if [ $RET -eq 2 ]; 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
|
||||
ltfs_mount
|
||||
return 0
|
||||
@@ -1326,7 +1328,7 @@ mount_tape () {
|
||||
if [ $? -eq 2 ]; then
|
||||
# retensiondate has exposed: wipe given tape
|
||||
ltfs_wipe
|
||||
#ltfs_format ${volume_name} ${volume_serial}
|
||||
ltfs_format ${volume_name} ${volume_serial}
|
||||
if [ $? -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
@@ -1386,7 +1388,7 @@ mtx_getlabel () {
|
||||
volume_name_active=$(perl -ne '
|
||||
/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')
|
||||
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" \
|
||||
"${slot_source}" "${volume_name_active}"
|
||||
fi
|
||||
@@ -2405,76 +2407,70 @@ case $cmd in
|
||||
fi
|
||||
;;
|
||||
ltfs-is-mounted)
|
||||
if ! $quiet; then
|
||||
printf "${MAGENTA}LTFS tape mount checke\n"
|
||||
fi
|
||||
ltfs_is_mounted
|
||||
if test $? -gt 0; then
|
||||
exit 1
|
||||
else
|
||||
if ! $quiet; then
|
||||
printf "${MAGENTA}LTFS Tape is-mounted: ${GREEN}true${NO_COLOR}\n"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
ltfs-mount)
|
||||
if ! $quiet; then
|
||||
printf "${MAGENTA}LTFS mount Tape\n"
|
||||
fi
|
||||
ltfs_mount
|
||||
if test $? -gt 0; then
|
||||
exit 1
|
||||
else
|
||||
if ! $quiet; then
|
||||
printf "${MAGENTA}LTFS Tape mount: ${GREEN}true${NO_COLOR}\n"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
ltfs-reformat)
|
||||
ltfs_reformat "${volume_name}"
|
||||
if test $? -gt 0; then
|
||||
return 1
|
||||
else
|
||||
if ! $quiet; then
|
||||
printf "${MAGENTA}LTFS Tape reformat: ${GREEN}%s${NO_COLOR}\n" \
|
||||
"${volume_name}"
|
||||
fi
|
||||
ltfs_reformat "${volume_name}"
|
||||
if test $? -gt 0; then
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
ltfs-umount)
|
||||
ltfs_umount
|
||||
if test $? -gt 0; then
|
||||
exit 1
|
||||
else
|
||||
if ! $quiet; then
|
||||
printf "${MAGENTA}LTFS Tape unmount: ${GREEN}true${NO_COLOR}\n"
|
||||
fi
|
||||
ltfs_umount
|
||||
if test $? -gt 0; then
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
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
|
||||
if test $? -gt 0; then
|
||||
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
|
||||
;;
|
||||
mount)
|
||||
mount_tape "${mediapool_name}" "${volume_name}"
|
||||
if test $? -gt 0; then
|
||||
exit 1
|
||||
else
|
||||
if ! $quiet; 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}"
|
||||
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}"
|
||||
fi
|
||||
fi
|
||||
mount_tape "${mediapool_name}" "${volume_name}"
|
||||
if test $? -gt 0; then
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
mtx-exchange)
|
||||
|
||||
Reference in New Issue
Block a user