[pbs-devel] [PATCH proxmox-backup v9 12/26] add auto-mounting for removable datastores
Wolfgang Bumiller
w.bumiller at proxmox.com
Wed Apr 24 15:35:41 CEST 2024
On Tue, Apr 23, 2024 at 10:29:46AM +0200, Hannes Laimer wrote:
> Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
> ---
> debian/proxmox-backup-server.install | 1 +
> debian/proxmox-backup-server.udev | 3 ++
> etc/Makefile | 3 +-
> etc/removable-device-attach at .service.in | 8 +++
> src/bin/proxmox_backup_manager/datastore.rs | 56 ++++++++++++++++++++-
> 5 files changed, 69 insertions(+), 2 deletions(-)
> create mode 100644 etc/removable-device-attach at .service.in
>
> diff --git a/debian/proxmox-backup-server.install b/debian/proxmox-backup-server.install
> index ee114ea3..cda01069 100644
> --- a/debian/proxmox-backup-server.install
> +++ b/debian/proxmox-backup-server.install
> @@ -4,6 +4,7 @@ etc/proxmox-backup-daily-update.service /lib/systemd/system/
> etc/proxmox-backup-daily-update.timer /lib/systemd/system/
> etc/proxmox-backup-proxy.service /lib/systemd/system/
> etc/proxmox-backup.service /lib/systemd/system/
> +etc/removable-device-attach at .service /lib/systemd/system/
> usr/bin/pmt
> usr/bin/pmtx
> usr/bin/proxmox-tape
> diff --git a/debian/proxmox-backup-server.udev b/debian/proxmox-backup-server.udev
> index afdfb2bc..e21b8bc7 100644
> --- a/debian/proxmox-backup-server.udev
> +++ b/debian/proxmox-backup-server.udev
> @@ -16,3 +16,6 @@ SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="1", ENV{ID_SCSI_SER
> SYMLINK+="tape/by-id/scsi-$env{ID_SCSI_SERIAL}-sg"
>
> LABEL="persistent_storage_tape_end"
> +
> +# triggers the mounting of a removable device
> +ACTION=="add", SUBSYSTEM=="block", ENV{ID_FS_UUID}!="", TAG+="systemd", ENV{SYSTEMD_WANTS}="removable-device-attach@$env{ID_FS_UUID}"
> \ No newline at end of file
^ newline
Also: This now
- causes log messages about this service getting started whenever a
device is plugged in.
- runs the command which will fill the log with errors when the device
is not actually a removable datastore
It might make more sense to listen to udev events in a separate thread
(within the proxy? or a separate daemon?) and do this more silently?
Or use a `RUN` entry instead of a service...
Or create rules for each known removable datastore explicitly...
More information about the pbs-devel
mailing list