[pbs-devel] [PATCH proxmox-backup v9 12/26] add auto-mounting for removable datastores

Hannes Laimer h.laimer at proxmox.com
Thu Apr 25 06:59:23 CEST 2024


On Wed Apr 24, 2024 at 3:35 PM CEST, Wolfgang Bumiller wrote:
> 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?
>
I guess, but how often are devices with filesystems on it relly
plugged in, I think having four lines in the journal is a good tradeoff
if the alternative is having a thread running all the time for something
that maybe happens 2-3 times per day

> Or use a `RUN` entry instead of a service...
whatever is in RUN has to be super fast, since it'll be shut down
almost immediately. Spawning a thread won't work since it'll be killed
and using the API is too "slow" eventhough it is local

>
> Or create rules for each known removable datastore explicitly...
sure, but again, idk if avoiding 4 lines of journal for something that
happens probably not that often justifies adding the complexity of managing
udev rules





More information about the pbs-devel mailing list