Re: [Bacula-users] Lack Persistent Device Naming to use with Alert Command

2019-01-27 Thread Nate K
This is the rules file, I will have to spend some time going through it.
Thanks.

*> cat /lib/udev/rules.d/60-persistent-storage-tape.rules*
*# do not edit this file, it will be overwritten on update*

*# persistent storage links: /dev/tape/{by-id,by-path}*

*ACTION=="remove", GOTO="persistent_storage_tape_end"*
*ENV{UDEV_DISABLE_PERSISTENT_STORAGE_RULES_FLAG}=="1",
GOTO="persistent_storage_tape_end"*

*# type 8 devices are "Medium Changers"*
*SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8",
IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d
$devnode", \*
*  SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}"*

*SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end"*

*KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*",
ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394"*
*KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb",
IMPORT{builtin}="usb_id"*
*KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi",
KERNELS=="[0-9]*:*[0-9]", ENV{.BSG_DEV}="$root/bsg/$id"*
*KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*",
IMPORT{program}="scsi_id --whitelisted --export --device=$env{.BSG_DEV}",
ENV{ID_BUS}="scsi"*
*KERNEL=="st*[0-9]",  ENV{ID_SERIAL}=="?*",
SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}"*
*KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*",
SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst"*

*# by-path (parent device path)*
*KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{builtin}="path_id"*
*KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*",
SYMLINK+="tape/by-path/$env{ID_PATH}"*
*KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*",
SYMLINK+="tape/by-path/$env{ID_PATH}-nst"*

*LABEL="persistent_storage_tape_end"*


On Sun, Jan 27, 2019 at 3:14 AM Adam Nielsen  wrote:

> > There are symlinks for the archive devices but not the tape drive control
> > devices which is what the tape alert commands need.
>
> Ah I see, you need the /dev/sg* equivalent for the /dev/st* in use.
>
> Can you copy the udev rules that produce symlinks for the autochangers
> (see link in my last post) and tweak them so that they also work for the
> drives themselves?  It looks like they pick up anything that's a
> "type 8" device so if you duplicate the rule but change it to whatever
> type number that tape drives are, presumably you'd end up with the same
> result.
>
> > My only other idea is that maybe you could create a script that rewrites
> > the bacula-sd.conf every boot by parsing the output of this command as it
> > shows which sg* devices correspond to the st* ones:
>
> If you wanted to do that it might be easier to have the script
> create/update symlinks in /dev so you don't need to rewrite the Bacula
> config file.  But this is pretty much what udev does already so better
> to get that working if you can.
>
> Cheers,
> Adam.
>
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Lack Persistent Device Naming to use with Alert Command

2019-01-27 Thread Adam Nielsen
> There are symlinks for the archive devices but not the tape drive control
> devices which is what the tape alert commands need.

Ah I see, you need the /dev/sg* equivalent for the /dev/st* in use.

Can you copy the udev rules that produce symlinks for the autochangers
(see link in my last post) and tweak them so that they also work for the
drives themselves?  It looks like they pick up anything that's a 
"type 8" device so if you duplicate the rule but change it to whatever
type number that tape drives are, presumably you'd end up with the same
result.

> My only other idea is that maybe you could create a script that rewrites
> the bacula-sd.conf every boot by parsing the output of this command as it
> shows which sg* devices correspond to the st* ones:

If you wanted to do that it might be easier to have the script
create/update symlinks in /dev so you don't need to rewrite the Bacula
config file.  But this is pretty much what udev does already so better
to get that working if you can.

Cheers,
Adam.


___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users