[pbs-devel] [PATCH v3 proxmox-backup 2/2] client: implement map/unmap commands for .img backups
Thomas Lamprecht
t.lamprecht at proxmox.com
Thu Oct 1 17:36:39 CEST 2020
On 25.08.20 13:46, Stefan Reiter wrote:
> Allows mapping fixed-index .img files (usually from VM backups) to be
> mapped to a local loopback device.
>
> The architecture uses a FUSE-backed temp file mapped to a loopdev:
>
> /dev/loopX -> FUSE /run/pbs-loopdev/xxx -> backup client -> PBS
>
> Since unmapping requires some cleanup (unmap the loopdev, stop FUSE,
> remove the temp files) a special 'unmap' command is added, which uses a
> PID file to send SIGINT to the backup-client instance started with
> 'map', which will handle the cleanup itself.
>
> The polling with select! in mount.rs needs to be split in two, since we
> have a chicken and egg problem between running FUSE and setting up the
> loop device - so we need to do them concurrently, until the loopdev is
> assigned, at which point we can report success and daemonize, and then
> continue polling the FUSE loop future.
>
> A loopdev module is added to tools containing all required functions for
> mapping a loop device to the FUSE file, with the ioctls moved into an
> inline module to avoid exposing them directly.
>
> The client code is placed in the 'mount' module, which, while
> admittedly a loose fit, allows reuse of the daemonizing code.
>
> Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
> ---
>
> v3:
> * better error messages in 'unmap'
> * rebase
>
> I checked, and FUSE is not notified when the loop device disconnects... I'd say
> we just have the user handle that.
>
>
> src/bin/proxmox-backup-client.rs | 2 +
> src/bin/proxmox_backup_client/mount.rs | 182 ++++++++++++++---
> src/tools.rs | 2 +
> src/tools/fuse_loop.rs | 258 +++++++++++++++++++++++++
> src/tools/loopdev.rs | 93 +++++++++
> 5 files changed, 509 insertions(+), 28 deletions(-)
> create mode 100644 src/tools/fuse_loop.rs
> create mode 100644 src/tools/loopdev.rs
>
What's the state of this? IIRC, Dietmar you wanted to give this a look?
Would be nice to have, IMO :-)
More information about the pbs-devel
mailing list