b549864bc8
As usual with major version bump, do not forget to run the upgrade script corresponding to your DB. A new README is provided in the package. Tested by sthen@ and myself. "Don't wait on me" merdely@ (maintainer) ok sthen@
145 lines
5.5 KiB
Plaintext
145 lines
5.5 KiB
Plaintext
$OpenBSD: patch-scripts_mtx-changer_in,v 1.6 2011/11/17 23:45:56 ajacoutot Exp $
|
|
|
|
XXX first hunk hand-rolled for CVS keyword, Id
|
|
|
|
--- scripts/mtx-changer.in.orig Sun Oct 30 13:03:42 2011
|
|
+++ scripts/mtx-changer.in Mon Nov 14 10:19:54 2011
|
|
@@ -1,6 +1,6 @@
|
|
#!/bin/sh
|
|
#
|
|
-# Bacula interface to mtx autoloader
|
|
+# Bacula interface to chio autoloader
|
|
#
|
|
# If you set in your Device resource
|
|
#
|
|
@@ -39,10 +39,10 @@
|
|
# e.g. mt -f $4 offline
|
|
#
|
|
# Many changers need an offline after the unload. Also many
|
|
-# changers need a sleep 60 after the mtx load.
|
|
+# changers need a sleep 60 after the chio load.
|
|
#
|
|
# N.B. If you change the script, take care to return either
|
|
-# the mtx exit code or a 0. If the script exits with a non-zero
|
|
+# the chio exit code or a 0. If the script exits with a non-zero
|
|
# exit code, Bacula will assume the request failed.
|
|
#
|
|
|
|
@@ -152,7 +152,7 @@ debug "Parms: $ctl $cmd $slot $device $drive"
|
|
|
|
case $cmd in
|
|
unload)
|
|
- debug "Doing mtx -f $ctl unload $slot $drive"
|
|
+ debug "Doing chio -f $ctl move drive $drive slot $slot"
|
|
|
|
if test ${offline} -eq 1 ; then
|
|
mt -f $device offline
|
|
@@ -160,12 +160,12 @@ case $cmd in
|
|
if test ${offline_sleep} -ne 0 ; then
|
|
sleep ${offline_sleep}
|
|
fi
|
|
- ${MTX} -f $ctl unload $slot $drive
|
|
+ ${MTX} -f $ctl move drive $drive slot $slot
|
|
;;
|
|
|
|
load)
|
|
- debug "Doing mtx -f $ctl load $slot $drive"
|
|
- ${MTX} -f $ctl load $slot $drive
|
|
+ debug "Doing chio -f $ctl move slot $slot drive $drive"
|
|
+ ${MTX} -f $ctl move slot $slot drive $drive
|
|
rtn=$?
|
|
if test ${load_sleep} -ne 0 ; then
|
|
sleep ${load_sleep}
|
|
@@ -175,61 +175,21 @@ case $cmd in
|
|
;;
|
|
|
|
list)
|
|
- debug "Doing mtx -f $ctl -- to list volumes"
|
|
+ debug "Doing chio -f $ctl status -- to list volumes"
|
|
make_temp_file
|
|
if test ${inventory} -ne 0 ; then
|
|
${MTX} -f $ctl inventory
|
|
fi
|
|
${MTX} -f $ctl status >${TMPFILE}
|
|
- rtn=$?
|
|
- if test ${vxa_packetloader} -ne 0 ; then
|
|
- cat ${TMPFILE} | grep " *Storage Element [0-9]*:.*Full" | sed "s/ Storage Element //" | sed "s/Full :VolumeTag=//"
|
|
- else
|
|
- cat ${TMPFILE} | grep " Storage Element [0-9]*:.*Full" | awk "{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//"
|
|
- fi
|
|
- cat ${TMPFILE} | grep "^Data Transfer Element [0-9]*:Full (Storage Element [0-9]" | awk '{printf "%s:%s\n",$7,$10}'
|
|
+ cat ${TMPFILE} | grep " *Storage Element [0-9]*:.*Full" | sed "s/ Storage Element //" | sed "s/Full :VolumeTag=//"
|
|
+ cat ${TMPFILE} | grep " *drive [0-9]*: <.*FULL.*>" | awk "{print \$2 \$4 \$5 \$6 \$7 \$8}" | sed "s/^/D/"
|
|
rm -f ${TMPFILE} >/dev/null 2>&1
|
|
exit $rtn
|
|
;;
|
|
|
|
listall)
|
|
-# Drive content: D:Drive num:F:Slot loaded:Volume Name
|
|
-# D:0:F:2:vol2 or D:Drive num:E
|
|
-# D:1:F:42:vol42
|
|
-# D:3:E
|
|
-#
|
|
-# Slot content:
|
|
-# S:1:F:vol1 S:Slot num:F:Volume Name
|
|
-# S:2:E or S:Slot num:E
|
|
-# S:3:F:vol4
|
|
-#
|
|
-# Import/Export tray slots:
|
|
-# I:10:F:vol10 I:Slot num:F:Volume Name
|
|
-# I:11:E or I:Slot num:E
|
|
-# I:12:F:vol40
|
|
-
|
|
- debug "Doing mtx -f $ctl -- to list all"
|
|
- make_temp_file
|
|
- if test ${inventory} -ne 0 ; then
|
|
- ${MTX} -f $ctl inventory
|
|
- fi
|
|
- ${MTX} -f $ctl status >${TMPFILE}
|
|
- rtn=$?
|
|
- # can be converted to awk+sed+cut, see below
|
|
- perl -ne '
|
|
-/Data Transfer Element (\d+):Empty/ && print "D:$1:E\n";
|
|
-/Data Transfer Element (\d+):Full \(Storage Element (\d+) Loaded\)(:VolumeTag =\s*(.+))?/ && print "D:$1:F:$2:$4\n";
|
|
-/Storage Element (\d+):Empty/ && print "S:$1:E\n";
|
|
-/Storage Element (\d+):Full( :VolumeTag=(.+))?/ && print "S:$1:F:$3\n";
|
|
-/Storage Element (\d+) IMPORT.EXPORT:Empty/ && print "I:$1:E\n";
|
|
-/Storage Element (\d+) IMPORT.EXPORT:Full( :VolumeTag=(.+))?/ && print "I:$1:F:$3\n";' ${TMPFILE}
|
|
- # If perl isn't installed, you can use by those commands
|
|
-#cat ${TMPFILE} | grep "Data Transfer Element" | awk "{print \"D:\"\$4 \$7 \$9 \$10}" | sed "s/=/:/" | sed "s/Full/F:/" | sed "s/Empty/E/"
|
|
-#cat ${TMPFILE} | grep -v "Data Transfer Element" | grep "Storage Element" | grep -v "IMPORT/EXPORT" | awk "{print \"S:\"\$3 \$4 \$5}" | sed "s/IMPORT\/EXPORT//" | sed "s/Full *:VolumeTag=/F:/" | sed "s/Empty/E/"
|
|
-#cat ${TMPFILE} | grep -v "Data Transfer Element" | grep "Storage Element" | grep "IMPORT/EXPORT" | awk "{print \"I:\"\$3 \$4 \$5}" | sed "s/IMPORT\/EXPORT//" | sed "s/Full *:VolumeTag=/F:/" | sed "s/Empty/E/"
|
|
-
|
|
- rm -f ${TMPFILE} >/dev/null 2>&1
|
|
- exit $rtn
|
|
+ echo "The listall command is not implemented on OpenBSD"
|
|
+ exit 1
|
|
;;
|
|
|
|
transfer)
|
|
@@ -241,18 +201,19 @@ case $cmd in
|
|
;;
|
|
|
|
loaded)
|
|
- debug "Doing mtx -f $ctl $drive -- to find what is loaded"
|
|
+ debug "Doing chio -f $ctl status -- to find what is loaded"
|
|
make_temp_file
|
|
${MTX} -f $ctl status >${TMPFILE}
|
|
rtn=$?
|
|
- cat ${TMPFILE} | grep "^Data Transfer Element $drive:Full" | awk "{print \$7}"
|
|
- cat ${TMPFILE} | grep "^Data Transfer Element $drive:Empty" | awk "{print 0}"
|
|
+ cat ${TMPFILE} | grep " *drive $drive: <.*FULL.*>" | awk "{print \$4}" | sed "s/^\[//" | sed "s/=\]$//"
|
|
+ cat ${TMPFILE} | grep " *drive $drive: <.*FULL.*>" > /dev/null 2>&1
|
|
+ if [ $? != 0 ]; then echo 0; fi
|
|
rm -f ${TMPFILE} >/dev/null 2>&1
|
|
exit $rtn
|
|
;;
|
|
|
|
slots)
|
|
- debug "Doing mtx -f $ctl -- to get count of slots"
|
|
- ${MTX} -f $ctl status | grep " *Storage Changer" | awk "{print \$5}"
|
|
+ debug "Doing chio -f $ctl status -- to get count of slots"
|
|
+ ${MTX} -f $ctl status | grep -c "slot [0-9]*"
|
|
;;
|
|
esac
|