From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 5EB1B20EC91 for ; Thu, 25 Apr 2024 06:59:21 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 41DC71A235; Thu, 25 Apr 2024 06:59:27 +0200 (CEST) Mime-Version: 1.0 Date: Thu, 25 Apr 2024 06:59:23 +0200 Message-Id: From: "Hannes Laimer" To: "Wolfgang Bumiller" X-Mailer: aerc 0.17.0-78-g4ffbaa6b3946 References: <20240423083000.28002-1-h.laimer@proxmox.com> <20240423083000.28002-13-h.laimer@proxmox.com> <4i4p4q4o4ifzq3d3f36sjkh4zc5gisvurei5bmilmjpfb6pmfv@7tlb6qonjioh> In-Reply-To: <4i4p4q4o4ifzq3d3f36sjkh4zc5gisvurei5bmilmjpfb6pmfv@7tlb6qonjioh> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.009 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pbs-devel] [PATCH proxmox-backup v9 12/26] add auto-mounting for removable datastores X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Cc: pbs-devel@lists.proxmox.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" 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 > > --- > > debian/proxmox-backup-server.install | 1 + > > debian/proxmox-backup-server.udev | 3 ++ > > etc/Makefile | 3 +- > > etc/removable-device-attach@.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@.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@.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 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel