garbage collection currently is quite aggressive in removing all files
under the link_dir, which are not a hard-link to a checksum file.
removing directories that remain empty below the link_dir should thus
not too dangerous.
without this patch, removing a snapshot on a mirror, running gc there,
and syncing everything to a medium, leaves the medium with an
hierarchy of empty directories below the removed snapshot (the files
get cleaned up the directories remain).
using WalkDir::content_first() seems better than to check for
emptiness after each file-removal [0]
[0] https://docs.rs/walkdir/latest/walkdir/struct.WalkDir.html#method.contents_first
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
path.is_empty() checks for the empty-path, not an empty directory [0].
as the check that the path is below the link_dir happens anyways in
the if we can directly call std::fs::remove_dir (which is even safer
than the std::fs::remove_dir_all call used in pool::remove_dir()).
the oversight seems to have been in place since the intial commit. I
ran across the issue when removing many snapshots of a Debian Bookworm
repository, syncing this to a medium, and still having a vast amount
of empty directories left behind (as debian has one directory per
package), which in turn increases the sync run-time.
[0] https://docs.rs/nix/latest/nix/trait.NixPath.html#tymethod.is_empty
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
commit c598cb154e changed the pool
layout to have the pool directory (.pool for a mirror) on the same
level as the link directory (instead of below), to enable pool-sharing
across multiple mirrors.
the condition will never be true, drop the if statement to avoid
confusion in the future.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
The recent changes to proxmox-apt along with the introduction of the
proxmox_apt_apit_types crate led to the following changes.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
the old location has been deprecated for a while, and rustc 1.78 will start to warn about it.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
they then get stripped into their own package anyway, but without this we don't
get debug symbols at all with rustc >= 1.77
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Fixes the clippy lint
```
warning: the borrowed expression implements the required traits
--> src/medium.rs:143:9
|
143 | &statefile(base),
| ^^^^^^^^^^^^^^^^ help: change this to: `statefile(base)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
= note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
```
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Joining the strings might results in a double `//` in a path. This was
experienced in a ticket at our customer support in the following error:
Error: unable to read
"/var/lib/proxmox-offline-mirror/mirrors//.pool/sha256/<SOME_HASH>"
- Input/output error (os error 5) after downloading ±60GB of data.
Suggested-by: Stefan Sterz <s.sterz@proxmox.com>
Signed-off-by: Maximiliano Sandoval R <m.sandoval@proxmox.com>
it accidentally re-used the config flag for DSA, instead of its own. seems like
there aren't too many of these repos around anymore (thankfully).
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
this adds the dark mode from the proxmox backup server to the offline
mirror for a more consistent appearance of the documentation across
all products.
Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
this commit fixes a behavior where pom would applied any subscription
key that matched the provided product. it did not check whether the
server id of the activated subscription matched the current system.
this commit fixes that and only allows applying subscriptions for the
current system.
it also adds a couple of ux improvements:
- the `offline-key` sub-command now does not require the `--product`
parameter anymore. if there are multiple keys with different
products for the same server we will try to activate them all. the
assumption is that the user added all keys intentionally (e.g. a
combo pbs+pve system) and would like to activate them all at once.
since this only makes the api more permissive this shouldn't be a
breaking change.
- if the `offline-key` sub-command encounters multiple subscription
keys with the same product and server id, it only activates the one
with the due date furthest in the future. this makes sense in a
scenario where a user simply adds new subscription keys to their
key medium without removing older ones (perhaps older subscriptions
haven't even expired just yet).
- the interactive `setup` sub-command now only offers keys that have a
matching server id. it also orders them in such a way that the top
most key for a given product has the next due date furthest in the
future.
Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
when setting up a ceph enterprise repo we didn't add a subscription
for it. this commit adds a pve subscription so that pom can properly
authenticate itself when mirroring the ceph enterprise repos.
Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
since it's the new default ceph release, add support for setting up
the ceph reef repos in the `setup` command.
Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
the current version of POM is released for Debian 12 "Bookworm", update the
docs accordingly.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Adapted from proxmox-backup's 198ebc6c ("d/rules: patch out wrongly
linked libraries from ELFs")
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
the bookworm release of proxmox ve comes along with a new ceph
enterprise repo. this commit adds support for this new repo for
bookworm-based releases.
Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>