In message <[EMAIL PROTECTED]> you wrote:
>
> Is there a way to rename volumes in Bacula to match the new barcodes?  If
> there is not, does anyone on the list know if the Quantum Superloader 3 will
> support custom barcode labels with my volume format?

Well, you might address the problem just the other  way  round.  Just
add  a  little  glue to match the cryptic barcode labels to something
you find more suitable. This is what I'm doing:

1) I have a text file "/etc/bacula/Barcodes.conf", which is just a
   table listing the barcode label and the corresponding volume name:

        $ cat Barcodes.conf
        Barcode VolumeID
        ======= ========
        ABV101  I-001
        ABV102  I-002
        ABV103  I-003
        ABV104  I-004
        ABV105  I-005
        ABV106  I-006
        ABV107  I-007
        ABV108  I-008
        ABV109  I-009
        ABV110  I-010
        ABV111  I-011
        ...

2) add a little code to the "mtx-changer" script to do the
   translation, for example:

--- /usr/local/src/bacula-2.2.3/scripts/mtx-changer     2007-09-10 
22:43:39.000000000 +0200
+++ /etc/bacula/mtx-changer     2007-09-10 22:55:54.000000000 +0200
@@ -79,6 +80,26 @@
     fi
 }
 
+#
+# Map barcode label into a more comprehensive volume name
+#
+# Input: "2:" or "4:ABC123" ==> Output: "2:" resp. "4:K-H-4"
+#
+# Slot: ${line%%:*}, Barcode: ${line##*:}
+#
+map_barcode() {
+  while read line ; do
+    if [ \! -r /etc/bacula/Barcodes.conf ] ; then
+      echo "$line"
+      continue
+    fi
+    if [ -z "${line##*:}" ] ; then
+      echo "$line"
+      continue
+    fi
+    echo "${line%%:*}:`grep "^${line##*:}" /etc/bacula/Barcodes.conf | sed -e 
"s/${line##*:}[   ][      ]*//"`"
+  done
+}
 
 #
 # Create a temporary file
@@ -188,13 +214,12 @@
 #     ${MTX} -f $ctl inventory
       ${MTX} -f $ctl status >${TMPFILE}
       rtn=$?
-      cat ${TMPFILE} | grep " Storage Element [0-9]*:.*Full" | awk "{print \$3 
\$4}" | sed "s/Full *\(:VolumeTag=\)*//"
-#
-# If you have a VXA PacketLoader and the above does not work, try
-#  turning it off and enabling the following line.
-#     cat ${TMPFILE} | grep " *Storage Element [0-9]*:.*Full" | sed "s/ 
Storage Element //" | sed "s/Full :VolumeTag=//"
-#
-      cat ${TMPFILE} | grep "^Data Transfer Element [0-9]*:Full (Storage 
Element [0-9]" | awk '{printf "%s:%s\n",$7,$10}'
+      { grep ' *Storage Element [0-9]*:.*Full' <${TMPFILE} | \
+               awk '{print $3 $4}' | \
+               sed 's/Full *\(:VolumeTag=\)*//'
+        grep '^Data Transfer Element [0-9]*:Full (Storage Element [0-9]' 
<${TMPFILE} | \
+               awk '{printf "%s:%s\n",$7,$10}'
+      } | map_barcode
       rm -f ${TMPFILE} >/dev/null 2>&1
       exit $rtn
       ;;


So for example when I run a native mtx command I will see this:

# mtx status
  Storage Changer /dev/changer:1 Drives, 7 Slots ( 0 Import/Export )
Data Transfer Element 0:Empty
      Storage Element 1:Full :VolumeTag=ACP816                          
      Storage Element 2:Full :VolumeTag=ACP817                          
      Storage Element 3:Full :VolumeTag=ACP818                          
      Storage Element 4:Full :VolumeTag=AJE904                          
      Storage Element 5:Full :VolumeTag=AJE905                          
      Storage Element 6:Full :VolumeTag=AJE900                          
      Storage Element 7:Full :VolumeTag=CLN381                          

but in bacula I get this:

*update slots barcodes storage=SLR100-1
Connecting to Storage daemon SLR100-1 at mneme.denx.de:9103 ...
3306 Issuing autochanger "slots" command.
Device "SLR100-1" has 7 slots.
Connecting to Storage daemon SLR100-1 at mneme.denx.de:9103 ...
3306 Issuing autochanger "list" command.
Catalog record for Volume "K-Q-5" updated to reference slot 1.
Catalog record for Volume "K-Q-6" updated to reference slot 2.
Catalog record for Volume "K-Q-7" updated to reference slot 3.
Catalog record for Volume "K-Q-8" updated to reference slot 4.
Catalog record for Volume "K-Q-9" updated to reference slot 5.
Catalog record for Volume "K-S-0" updated to reference slot 6.
Catalog record for Volume "K-S-1" updated to reference slot 7.


Hope this helps...

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [EMAIL PROTECTED]
As far as we know, our computer has never had an undetected error.
                                                           -- Weisert

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to