e8f8de
From 13f9e172d4a3576efa1ddacaca26286266866d2d Mon Sep 17 00:00:00 2001
e8f8de
From: Joerg Steffens <joerg.steffens@bareos.com>
e8f8de
Date: Tue, 21 Nov 2017 12:21:49 +0100
e8f8de
Subject: [PATCH] udev-rules: make tape-changers also apprear in
e8f8de
 /dev/tape/by-path/
e8f8de
e8f8de
It is important to be able to access tape changer ("Medium Changers") by
e8f8de
persistant name.
e8f8de
While tape devices can be accessed via /dev/tape/by-id/ and
e8f8de
/dev/tape/by-path/, tape-changers could only be accessed by
e8f8de
/dev/tape/by-id/.
e8f8de
However, in some cases, especially when accessing Amazon Webservice
e8f8de
Storage Gateway VTLs (or accessing iSCSI VTLs in general?) this does not
e8f8de
work, as all tape devices and the tape changer have the same ENV{ID_SERIAL}.
e8f8de
The results is, that only the last device is available in
e8f8de
/dev/tape/by-id/, as the former devices have been overwritten.
e8f8de
e8f8de
As this behavior is hard to change without breaking consistentcy,
e8f8de
this additional device in /dev/tape/by-path/ can be used to access the medium changes.
e8f8de
The tape devices can also be accessed by this path.
e8f8de
e8f8de
The content of the directory will now look like:
e8f8de
e8f8de
  # SCSI tape device, rewind (unchanged)
e8f8de
  /dev/tape/by-path/$env{ID_PATH} -> ../../st*
e8f8de
e8f8de
  # SCSI tape device, no-rewind (unchanged)
e8f8de
  /dev/tape/by-path/$env{ID_PATH}-nst -> ../../nst*
e8f8de
e8f8de
  # SCSI tape changer device (newly added)
e8f8de
  /dev/tape/by-path/$env{ID_PATH}-changer -> ../../sg*
e8f8de
e8f8de
Tape devices and tape changer have different ID_PATHs.
e8f8de
SCSI tape changer get the suffix "-changer"
e8f8de
to make them better distinguishable from tape devices.
e8f8de
e8f8de
(cherry-picked from commit 7f8ddf96a25162f06bd94a684cf700c128d18142)
e8f8de
(cherry picked from commit 1b723aea42e29becd0be2fdef990401803dbfba6)
e8f8de
Resolves: #1814028
e8f8de
---
e8f8de
 rules/60-persistent-storage-tape.rules | 3 +++
e8f8de
 1 file changed, 3 insertions(+)
e8f8de
e8f8de
diff --git a/rules/60-persistent-storage-tape.rules b/rules/60-persistent-storage-tape.rules
e8f8de
index f2eabd92a8..99898c147b 100644
e8f8de
--- a/rules/60-persistent-storage-tape.rules
e8f8de
+++ b/rules/60-persistent-storage-tape.rules
e8f8de
@@ -8,6 +8,9 @@ ACTION=="remove", GOTO="persistent_storage_tape_end"
e8f8de
 SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d $devnode", \
e8f8de
   SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}"
e8f8de
 
e8f8de
+SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{builtin}="path_id", \
e8f8de
+  SYMLINK+="tape/by-path/$env{ID_PATH}-changer"
e8f8de
+
e8f8de
 SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end"
e8f8de
 
e8f8de
 KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394"