From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 27BAB7ADE1 for ; Wed, 6 Jul 2022 13:49:52 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1E2A2AC8D for ; Wed, 6 Jul 2022 13:49:52 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 6 Jul 2022 13:49:51 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 4359B43DA2 for ; Wed, 6 Jul 2022 13:49:51 +0200 (CEST) Date: Wed, 6 Jul 2022 13:49:50 +0200 From: Wolfgang Bumiller To: Hannes Laimer Cc: pbs-devel@lists.proxmox.com Message-ID: <20220706114950.5g6d5ewxx6amthma@casey.proxmox.com> References: <20220705130834.14285-1-h.laimer@proxmox.com> <20220705130834.14285-28-h.laimer@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220705130834.14285-28-h.laimer@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.288 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% 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 T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pbs-devel] [PATCH proxmox-backup 25/26] debian/etc: add udev rules and simple service for automounting 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: , X-List-Received-Date: Wed, 06 Jul 2022 11:49:52 -0000 On Tue, Jul 05, 2022 at 01:08:33PM +0000, 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 | 6 ++++++ > 4 files changed, 12 insertions(+), 1 deletion(-) > create mode 100644 etc/removable-device-attach@.service.in > > diff --git a/debian/proxmox-backup-server.install b/debian/proxmox-backup-server.install > index 6e2219b4..3cabd46e 100644 > --- a/debian/proxmox-backup-server.install > +++ b/debian/proxmox-backup-server.install > @@ -3,6 +3,7 @@ etc/proxmox-backup.service /lib/systemd/system/ > etc/proxmox-backup-banner.service /lib/systemd/system/ > etc/proxmox-backup-daily-update.service /lib/systemd/system/ > etc/proxmox-backup-daily-update.timer /lib/systemd/system/ > +etc/removable-device-attach@.service /lib/systemd/system/ > etc/pbs-enterprise.list /etc/apt/sources.list.d/ > usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-api > usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-proxy > diff --git a/debian/proxmox-backup-server.udev b/debian/proxmox-backup-server.udev > index afdfb2bc..e5aa26c3 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}" Have you tried using systemd generators? (man 7 systemd.generator) Because this adds `Wants=removable-device-attach@...` to *all* blockdevs with uuids. I don't like this. I think we could put a binary in `/lib/systemd/system-generators/` which writes out a unit file for all the removable datastores which depends on the `.device` unit created by the `TAG+="systemd"` bit of the udev rule. (We could then remove the ENV bit). Additionally, further unit files in `/run` would have to be created and removed by the daemon when they are added/removed via the API/CLI. > diff --git a/etc/Makefile b/etc/Makefile > index 42f639f6..730de4f8 100644 > --- a/etc/Makefile > +++ b/etc/Makefile > @@ -7,7 +7,8 @@ DYNAMIC_UNITS := \ > proxmox-backup-banner.service \ > proxmox-backup-daily-update.service \ > proxmox-backup.service \ > - proxmox-backup-proxy.service > + proxmox-backup-proxy.service \ > + removable-device-attach@.service > > all: $(UNITS) $(DYNAMIC_UNITS) pbs-enterprise.list > > diff --git a/etc/removable-device-attach@.service.in b/etc/removable-device-attach@.service.in > new file mode 100644 > index 00000000..12fa103f > --- /dev/null > +++ b/etc/removable-device-attach@.service.in > @@ -0,0 +1,6 @@ > +[Unit] > +Description=Try to mount the removable device with uuid '%i'. > + > +[Service] > +Type=simple > +ExecStart=/usr/sbin/proxmox-backup-manager removable-device mount-uuid %i > -- > 2.30.2