]> git.proxmox.com Git - proxmox-backup.git/log
proxmox-backup.git
6 days agopxar: bin: rework and dynamically generate `list` test data master
Christian Ebner [Wed, 11 Sep 2024 10:47:22 +0000 (12:47 +0200)]
pxar: bin: rework and dynamically generate `list` test data

Commit f16c5de757 ("pxar: bin: test `pxar list` with payload-input")
introduced a regression test for listing of split pxar archives. This
test relies on a large pxar blob file, the large size (> 100M) being
overlooked when writing the test.

In order to not depend on this file any further in the future, drop
it and rewrite the test to dynamically generate the files, needed and
further extend the test thereby also cover the archive creation and
extraction for split pxar archives.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
12 days agoapi: replace deprecated 'streaming' attribute with 'serializing'
Wolfgang Bumiller [Thu, 5 Sep 2024 11:37:40 +0000 (13:37 +0200)]
api: replace deprecated 'streaming' attribute with 'serializing'

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
12 days agoupdate to proxmox-router 3 and proxmox-rest-server 0.8
Wolfgang Bumiller [Thu, 5 Sep 2024 11:35:21 +0000 (13:35 +0200)]
update to proxmox-router 3 and proxmox-rest-server 0.8

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
12 days agopxar: list stuff to stdout instead of stderr
Wolfgang Bumiller [Thu, 5 Sep 2024 11:58:26 +0000 (13:58 +0200)]
pxar: list stuff to stdout instead of stderr

Our tooling really needs to stop doing outputs wrong...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
12 days agobump proxmox-log dependency to 0.2.4 for stderr logging
Wolfgang Bumiller [Thu, 5 Sep 2024 11:47:58 +0000 (13:47 +0200)]
bump proxmox-log dependency to 0.2.4 for stderr logging

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
12 days agopxar-bin: remove `log` dependency, use `tracing` directly
Gabriel Goller [Wed, 4 Sep 2024 13:28:57 +0000 (15:28 +0200)]
pxar-bin: remove `log` dependency, use `tracing` directly

When using the `log` to `tracing` translation layer, the messages get
padded with whitespaces. This bug will get fixed upstream [0], but in
the meantime we switch to the `tracing` macros.

[0]: https://github.com/tokio-rs/tracing/pull/3070

Tested-by: Christian Ebner <c.ebner@proxmox.com>
Reviewed-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2 weeks agotape: fix read element status for some changers
Dominik Csapak [Mon, 26 Aug 2024 14:04:59 +0000 (16:04 +0200)]
tape: fix read element status for some changers

It seems some changers are setting the PVolTag/AVolTag flags in the
ELEMENT STATUS page response, but don't include the actual fields then.
To make it work with such changers, downgrade the errors to warnings, so
we can continue to decode the remaining data.

This is OK since one volume tag is optional and the other is skipped
anyway.

Reported in the forum:
https://forum.proxmox.com/threads/hpe-storeonce-vtl.152547/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 weeks agomove client binaries to tracing
Gabriel Goller [Thu, 29 Aug 2024 13:40:40 +0000 (15:40 +0200)]
move client binaries to tracing

Add tracing logger to all client binaries and remove env_logger.

The reason for this change is twofold: our migration to tracing, and the
behavior when the client calls an api handler directly. Currently the
proxmox-backup-manager calls the api handlers directly for some
commands. This results in no output (on console and task log), as no
tracing logger is instantiated.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2 weeks agofix #5622: backup client: properly handle rate/burst parameters
Dominik Csapak [Fri, 9 Aug 2024 08:20:32 +0000 (10:20 +0200)]
fix #5622: backup client: properly handle rate/burst parameters

The rate and burst parameters are integers, so the mapping from value
with `.as_str()` will always return `None` effectively never
applying any rate limit at all.

Fix it by turning them into a HumanByte instead of an integer.

To not crowd the parameter section so much, create a
ClientRateLimitConfig struct that gets flattened into the parameter list
of the backup client.

To adapt the description of the parameters, add new schemas that copy
the `HumanByte` schema but change the description.

With this, the rate limit actually works, and there is no lower limit
any more.

The old TRAFFIC_CONTROL_RATE/BURST_SCHEMAs can be deleted since the
client was the only user of them.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 weeks agodata_blob: add TODO comment for zstd api
Dominik Csapak [Thu, 8 Aug 2024 08:18:25 +0000 (10:18 +0200)]
data_blob: add TODO comment for zstd api

we currently use the behavior of zstd that is not part of the public
api, so this is at risk to be changed without notice.

There is a public api that we could use, but it's only available
with zstd_sys >= 2.0.9, which at this time, is not yet packaged for/by
us.

Add a comment that we can use the public api for this when the
new version of the crate gets available.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 weeks agofix: proxmox-backup-manager network reload wait on worker
Gabriel Goller [Wed, 21 Aug 2024 10:22:36 +0000 (12:22 +0200)]
fix: proxmox-backup-manager network reload wait on worker

Make the `network reload` command in proxmox-backup-manager wait on the
api handler's workertask. Otherwise the task would be killed when the
client exits.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2 weeks agoui: user view: disable 'Unlock TFA' button by default
Christoph Heiss [Thu, 22 Aug 2024 11:08:36 +0000 (13:08 +0200)]
ui: user view: disable 'Unlock TFA' button by default

Without this, the button is enabled if no entry at all is selected (e.g.
when switching to the 'User Management' tab), with the button then
(obviously) being a noop.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2 weeks agotests: replace static mut with a mutex
Wolfgang Bumiller [Thu, 29 Aug 2024 09:40:48 +0000 (11:40 +0200)]
tests: replace static mut with a mutex

rustc warns about creating references to them (although it does allow
using `.as_ref()` on them for some reason), and this will become a
hard error with edition 2024.

Previously we could not use Mutex there as its ::new() was not a
`const fn` , but not we can, so let's drop the `mut`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 weeks agolog: retrieve `ReaderEnvironment` debug flag from tracing
Gabriel Goller [Fri, 16 Aug 2024 10:39:58 +0000 (12:39 +0200)]
log: retrieve `ReaderEnvironment` debug flag from tracing

Don't hardcode the debug flag but retrieve the currently enabled level
using tracing. This will change the default log-behavior and disable
some logs that have been printed previously. F.e.: the "protocol upgrade
done" message is not visible anymore per default because it is printed
with debug.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
4 weeks agobump d/control
Wolfgang Bumiller [Wed, 14 Aug 2024 10:15:40 +0000 (12:15 +0200)]
bump d/control

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 weeks agocargo: remove unused dependencies
Maximiliano Sandoval [Wed, 14 Aug 2024 09:21:14 +0000 (11:21 +0200)]
cargo: remove unused dependencies

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
4 weeks agobackup-client: remove unused dependencies
Maximiliano Sandoval [Wed, 14 Aug 2024 09:21:13 +0000 (11:21 +0200)]
backup-client: remove unused dependencies

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
4 weeks agopxar-bin: remove unused dependencies
Maximiliano Sandoval [Wed, 14 Aug 2024 09:21:12 +0000 (11:21 +0200)]
pxar-bin: remove unused dependencies

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
4 weeks agorestore-daemon: remove unused dependencies
Maximiliano Sandoval [Wed, 14 Aug 2024 09:21:11 +0000 (11:21 +0200)]
restore-daemon: remove unused dependencies

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
4 weeks agofile-restore: remove unused deps
Maximiliano Sandoval [Wed, 14 Aug 2024 09:21:10 +0000 (11:21 +0200)]
file-restore: remove unused deps

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
4 weeks agoclient: remove unused deps
Maximiliano Sandoval [Wed, 14 Aug 2024 09:21:09 +0000 (11:21 +0200)]
client: remove unused deps

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
4 weeks agotools: remove unused dependencies
Maximiliano Sandoval [Wed, 14 Aug 2024 09:21:08 +0000 (11:21 +0200)]
tools: remove unused dependencies

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
4 weeks agobackup: remove lazy_static dependency
Maximiliano Sandoval [Tue, 13 Aug 2024 08:44:15 +0000 (10:44 +0200)]
backup: remove lazy_static dependency

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
4 weeks agorestore-daemon: remove lazy_static dependency
Maximiliano Sandoval [Tue, 13 Aug 2024 08:44:14 +0000 (10:44 +0200)]
restore-daemon: remove lazy_static dependency

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
4 weeks agodatastore: remove lazy_static dependency
Maximiliano Sandoval [Tue, 13 Aug 2024 08:44:13 +0000 (10:44 +0200)]
datastore: remove lazy_static dependency

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
4 weeks agofuse-loop: remove lazy_static dependency
Maximiliano Sandoval [Tue, 13 Aug 2024 08:44:12 +0000 (10:44 +0200)]
fuse-loop: remove lazy_static dependency

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
4 weeks agotape: remove lazy_static dependency
Maximiliano Sandoval [Tue, 13 Aug 2024 08:44:11 +0000 (10:44 +0200)]
tape: remove lazy_static dependency

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
4 weeks agoconfig: remove lazy_static dependency
Maximiliano Sandoval [Tue, 13 Aug 2024 08:44:10 +0000 (10:44 +0200)]
config: remove lazy_static dependency

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
4 weeks agocargo: declare msrv
Maximiliano Sandoval [Tue, 13 Aug 2024 08:44:09 +0000 (10:44 +0200)]
cargo: declare msrv

In the following commit we will make use of std::sync::LazyLock which
was introduced in rust 1.80.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
4 weeks agotools: remove unused lazy_static dependency
Maximiliano Sandoval [Tue, 13 Aug 2024 08:44:08 +0000 (10:44 +0200)]
tools: remove unused lazy_static dependency

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
4 weeks agoclient: remove unused lazy_static dependency
Maximiliano Sandoval [Tue, 13 Aug 2024 08:44:07 +0000 (10:44 +0200)]
client: remove unused lazy_static dependency

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
4 weeks agoapi-types: remove unused lazy_static dependency
Maximiliano Sandoval [Tue, 13 Aug 2024 08:44:06 +0000 (10:44 +0200)]
api-types: remove unused lazy_static dependency

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
5 weeks agobump d/control
Wolfgang Bumiller [Fri, 9 Aug 2024 11:06:32 +0000 (13:06 +0200)]
bump d/control

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 weeks agobump proxmox-rrd dep to 0.3
Wolfgang Bumiller [Fri, 9 Aug 2024 11:06:25 +0000 (13:06 +0200)]
bump proxmox-rrd dep to 0.3

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 weeks agoapi-types: rrd: use api-types from proxmox-rrd
Lukas Wagner [Tue, 6 Aug 2024 12:59:56 +0000 (14:59 +0200)]
api-types: rrd: use api-types from proxmox-rrd

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
5 weeks agorrd_cache: use new callback for RRD creation
Lukas Wagner [Tue, 6 Aug 2024 12:59:55 +0000 (14:59 +0200)]
rrd_cache: use new callback for RRD creation

Some changes in `promox-rrd` now require a separate callback for
creating a new RRD.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
5 weeks agodaily-update: initialize context for notification system
Lukas Wagner [Fri, 9 Aug 2024 08:19:50 +0000 (10:19 +0200)]
daily-update: initialize context for notification system

Otherwise proxmox-daily-update panics if attempting to send a
notification for any available new updates:

  "context for proxmox-notify has not been set yet"

Reported on our community forum:
https://forum.proxmox.com/threads/152429/

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
5 weeks agobackup: use proxmox-systemd crate
Thomas Lamprecht [Wed, 7 Aug 2024 18:53:48 +0000 (20:53 +0200)]
backup: use proxmox-systemd crate

Some systemd code got split out from proxmox-sys and left there
re-exported with a deprecation marker, use the newer crate, the
workspace already depends on proxmox-systemd anyway.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 weeks agofile restore: use proxmox-systemd crate
Thomas Lamprecht [Wed, 7 Aug 2024 18:53:18 +0000 (20:53 +0200)]
file restore: use proxmox-systemd crate

Some systemd code got split out from proxmox-sys and left there
re-exported with a deprecation marker, use the newer crate, the
workspace already depends on proxmox-systemd anyway.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 weeks agoclient: use proxmox_systemd crate
Thomas Lamprecht [Wed, 7 Aug 2024 18:51:20 +0000 (20:51 +0200)]
client: use proxmox_systemd crate

Some systemd code got split out from proxmox-sys and left there
re-exported with a deprecation marker, use the newer crate, the
workspace already depends on proxmox-systemd anyway.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 weeks agocargo fmt
Thomas Lamprecht [Wed, 7 Aug 2024 18:50:28 +0000 (20:50 +0200)]
cargo fmt

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 weeks agodatastore: data blob encode: simplify code
Dominik Csapak [Mon, 5 Aug 2024 09:24:14 +0000 (11:24 +0200)]
datastore: data blob encode: simplify code

by combining the compression call from both encrypted and unencrypted
paths and deciding on the header magic at one site.

No functional changes intended, besides reusing the same buffer for
compression.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 weeks agodatastore: data blob: increase compression throughput
Dominik Csapak [Mon, 5 Aug 2024 09:24:13 +0000 (11:24 +0200)]
datastore: data blob: increase compression throughput

Increase the zstd compression throughput by not using the
`zstd::stream::copy_encode` method, because it seems it uses an
internal buffer size of 32 KiB [0], copies at least once extra in the
target buffer and might have some additional (allocation and/or
syscall) overhead. Due to the amount of wrappers and indirections it's
a bit hard to tell for sure.  In anyway, there can be a reduced
throughput observed if all, the target and source storage and the
network are so fast that the operations from creating chunks, like
compressions, can become the bottleneck.

Instead use the lower-level `zstd_safe::compress` which avoids (big)
allocations, since we provide the target buffer.

In case of a compression error just return the uncompressed data,
there's nothing we can do and saving uncompressed data is better than
having none. Additionally, log any such error besides the one for the
target buffer being too small.

Some benchmarks on my machine (Intel i7-12700K with DDR5-4800 memory
using a ASUS Prime Z690-A motherboard) from a tmpfs to a datastore on
tmpfs:

Type                without patches (MiB/s)  with patches (MiB/s)
.img file           ~614                     ~767
pxar one big file   ~657                     ~807
pxar small files    ~576                     ~627

The new approach is faster by a factor of 1.19.

Note that the new approach should not have a measurable negative
impact, e.g. (peak) memory usage wise. That is because we always
reserved a vector with max-data-size (data length + header length) and
thus did not have to add a new buffer, rather we actually removed the
buffer that the high-level zstd wrapper crate used internally.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 weeks agodatastore: data blob: allow checking for zstd internal buffer-to-small error
Dominik Csapak [Mon, 5 Aug 2024 09:24:12 +0000 (11:24 +0200)]
datastore: data blob: allow checking for zstd internal buffer-to-small error

We want to check the error code of zstd not to be 'Destination buffer
to small' (dstSize_tooSmall),  but currently there is no practical API
that is also public. So we introduce a helper that uses the internal
logic of zstd to determine the error.

Since this is not guaranteed to be a stable api, add a test for that
so we catch that error early on build. This should be fine, as long as
the zstd behavior only changes with e.g. major debian upgrades, which
is normally the only time where the zstd version is updated.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [ TL: re-order fn, rename test and reword comments ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 weeks agodatastore: test DataBlob encode/decode roundtrip
Dominik Csapak [Mon, 5 Aug 2024 09:24:11 +0000 (11:24 +0200)]
datastore: test DataBlob encode/decode roundtrip

so that we can be sure we can decode an encoded blob again

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 weeks agodatastore: remove unused data blob writer
Dominik Csapak [Mon, 5 Aug 2024 09:24:10 +0000 (11:24 +0200)]
datastore: remove unused data blob writer

This is leftover code that is not currently used outside of its own
tests.

Should we need it again, we can just revert this commit.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 weeks agofix typos in variables and function names
Maximiliano Sandoval [Wed, 7 Aug 2024 12:10:45 +0000 (14:10 +0200)]
fix typos in variables and function names

Variables, methods and functions in public API were not changed.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
5 weeks agofix typos in strings
Maximiliano Sandoval [Wed, 7 Aug 2024 12:10:44 +0000 (14:10 +0200)]
fix typos in strings

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
5 weeks agofix typos in docs an manual pages
Maximiliano Sandoval [Wed, 7 Aug 2024 12:10:43 +0000 (14:10 +0200)]
fix typos in docs an manual pages

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
5 weeks agofix typos in rust documentation blocks
Maximiliano Sandoval [Wed, 7 Aug 2024 12:10:42 +0000 (14:10 +0200)]
fix typos in rust documentation blocks

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
5 weeks agofix typos in comments
Maximiliano Sandoval [Wed, 7 Aug 2024 12:10:41 +0000 (14:10 +0200)]
fix typos in comments

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
5 weeks agodocs: add external metrics server page
Gabriel Goller [Wed, 7 Aug 2024 12:37:36 +0000 (14:37 +0200)]
docs: add external metrics server page

Add External Metrics page to PBS's documentation. Most of it is copied
from the PVE documentation, minus the Graphite part.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
6 weeks agoreplace proxmox_sys::systemd with proxmox_systemd calls
Wolfgang Bumiller [Tue, 6 Aug 2024 12:13:58 +0000 (14:13 +0200)]
replace proxmox_sys::systemd with proxmox_systemd calls

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
7 weeks agobump h2 to 0.4
Fabian Grünbichler [Thu, 25 Jul 2024 11:06:54 +0000 (13:06 +0200)]
bump h2 to 0.4

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
7 weeks agoremove use of proxmox_lang::error::io_err_other
Wolfgang Bumiller [Fri, 26 Jul 2024 10:17:09 +0000 (12:17 +0200)]
remove use of proxmox_lang::error::io_err_other

by now its functionality is provided by std::io::Error::other

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
7 weeks agoupdate to proxmox-log 0.2 and proxmox-rest-server 0.7
Wolfgang Bumiller [Wed, 24 Jul 2024 12:34:56 +0000 (14:34 +0200)]
update to proxmox-log 0.2 and proxmox-rest-server 0.7

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agoclient: avoid unnecessary allocation in AES benchmark
Dietmar Maurer [Fri, 19 Jul 2024 10:01:15 +0000 (12:01 +0200)]
client: avoid unnecessary allocation in AES benchmark

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2 months agoimage backup: use 4M input buffer
Fabian Grünbichler [Wed, 17 Jul 2024 13:08:27 +0000 (15:08 +0200)]
image backup: use 4M input buffer

with the default 8k input buffer size, the client will spend most of the time
polling instead of reading/chunking/uploading.

tested with 16G random data file from tmpfs to fresh datastore backed by tmpfs,
without encryption.

stock:

Time (mean ± σ):     36.064 s ±  0.655 s    [User: 21.079 s, System: 26.415 s]
  Range (min … max):   35.663 s … 36.819 s    3 runs

patched:

 Time (mean ± σ):     23.591 s ±  0.807 s    [User: 16.532 s, System: 18.629 s]
  Range (min … max):   22.663 s … 24.125 s    3 runs

Summary
  patched ran
    1.53 ± 0.06 times faster than stock

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 months agoexample: improve chunking speed example
Fabian Grünbichler [Wed, 17 Jul 2024 13:08:26 +0000 (15:08 +0200)]
example: improve chunking speed example

by dropping the print-per-chunk and making the input buffer size configurable
(8k is the default when using `new()`).

this allows benchmarking various input buffer sizes. basically the same code is
used for image-based backups in proxmox-backup-client, but just the
reading and chunking part. looking at the flame graphs the smaller input
buffer sizes clearly show most of time spent polling, instead of
reading+copying (or reading and scanning and copying).

for a fixed chunk size stream with a 16G input file on tmpfs:

fixed 1M ran
    1.06 ± 0.17 times faster than fixed 4M
    1.22 ± 0.11 times faster than fixed 16M
    1.25 ± 0.09 times faster than fixed 512k
    1.31 ± 0.10 times faster than fixed 256k
    1.55 ± 0.13 times faster than fixed 128k
    1.92 ± 0.15 times faster than fixed 64k
    3.09 ± 0.31 times faster than fixed 32k
    4.76 ± 0.32 times faster than fixed 16k
    8.08 ± 0.59 times faster than fixed 8k

(from 15.275s down to 1.890s)

dynamic chunk stream, same input:

dynamic 4M ran
    1.01 ± 0.03 times faster than dynamic 1M
    1.03 ± 0.03 times faster than dynamic 16M
    1.06 ± 0.04 times faster than dynamic 512k
    1.07 ± 0.03 times faster than dynamic 128k
    1.12 ± 0.03 times faster than dynamic 64k
    1.15 ± 0.20 times faster than dynamic 256k
    1.23 ± 0.03 times faster than dynamic 32k
    1.47 ± 0.04 times faster than dynamic 16k
    1.92 ± 0.05 times faster than dynamic 8k

(from 26.5s down to 13.772s)

same input file on ext4 on LVM on CT2000P5PSSD8 (with caches dropped for each run):

fixed 4M ran
   1.06 ± 0.02 times faster than fixed 16M
   1.10 ± 0.01 times faster than fixed 1M
   1.12 ± 0.01 times faster than fixed 512k
   1.15 ± 0.02 times faster than fixed 128k
   1.17 ± 0.01 times faster than fixed 256k
   1.22 ± 0.02 times faster than fixed 64k
   1.55 ± 0.05 times faster than fixed 32k
   2.00 ± 0.07 times faster than fixed 16k
   3.01 ± 0.15 times faster than fixed 8k

(from 19.807s down to 6.574s)

dynamic 4M ran
    1.04 ± 0.02 times faster than dynamic 512k
    1.04 ± 0.02 times faster than dynamic 128k
    1.04 ± 0.02 times faster than dynamic 16M
    1.06 ± 0.02 times faster than dynamic 1M
    1.06 ± 0.02 times faster than dynamic 256k
    1.08 ± 0.02 times faster than dynamic 64k
    1.16 ± 0.02 times faster than dynamic 32k
    1.34 ± 0.03 times faster than dynamic 16k
    1.70 ± 0.04 times faster than dynamic 8k

(from 31.184s down to 18.378s)

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 months agobuild: ensure wrapper config is picked up
Fabian Grünbichler [Wed, 10 Jul 2024 12:29:24 +0000 (14:29 +0200)]
build: ensure wrapper config is picked up

`cargo build` and `cargo install` pick up different config files, by symlinking
the wrapper config into a place with higher precedence than the one in the
top-level git repo dir, we ensure the package build actually picks up the
desired config instead of the one intended for quick dev builds.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 months agoserver: pull: fix sync info message for root namespace
Christian Ebner [Mon, 15 Jul 2024 10:15:43 +0000 (12:15 +0200)]
server: pull: fix sync info message for root namespace

The root namespace is displayed as empty string when used in the
format string. Distinguish and explicitly write out the root namespace
in the sync info message shown in the sync jobs task log.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 months agowww: sync edit: indetation style fix
Christian Ebner [Mon, 15 Jul 2024 10:15:42 +0000 (12:15 +0200)]
www: sync edit: indetation style fix

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 months agoserver: pull: silence clippy to many arguments warning
Christian Ebner [Mon, 15 Jul 2024 10:15:41 +0000 (12:15 +0200)]
server: pull: silence clippy to many arguments warning

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 months agoserver: pull: be more specific in module comment
Christian Ebner [Mon, 15 Jul 2024 10:15:40 +0000 (12:15 +0200)]
server: pull: be more specific in module comment

Describe the `pull` direction of the sync operation more precisely
before adding also a `push` direction as synchronization operation.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 months agodatastore: data blob: fix typos in comments
Christian Ebner [Mon, 15 Jul 2024 10:15:39 +0000 (12:15 +0200)]
datastore: data blob: fix typos in comments

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 months agoapi certs: run cargo fmt
Thomas Lamprecht [Wed, 17 Jul 2024 11:28:05 +0000 (13:28 +0200)]
api certs: run cargo fmt

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agofix #3699: client: prefer xdg cache directory for tmp files
Maximiliano Sandoval [Wed, 17 Jul 2024 10:18:35 +0000 (12:18 +0200)]
fix #3699: client: prefer xdg cache directory for tmp files

Adds a helper to create temporal files in XDG_CACHE_HOME. If we cannot
create a file there, we fallback to /tmp as before.

Note that the temporary files stored by the client might grow
arbitrarily in size, making XDG_RUNTIME_DIR a less desirable option.
Citing the Arch wiki [1]:

> Should not store large files as it may be mounted as a tmpfs.

While the cache directory is most often not backed up by an ephemeral
FS, using the `O_TMPFILE` flag avoids the need for potential cleanup,
e.g. on interruption of a command. As with this flag set the data will
be discarded when the last file descriptor is closed.

[1] https://wiki.archlinux.org/title/XDG_Base_Directory

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
 [ TL: mention TMPFILE flag for clarity ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agobump apt-api-types dependency to 1.0.1
Thomas Lamprecht [Wed, 17 Jul 2024 09:44:40 +0000 (11:44 +0200)]
bump apt-api-types dependency to 1.0.1

to pull in the fix for restoring backwards compatibility due to the
digest from that crate using a u8 slice instead of our dedicated
ConfigDigest type, which would serialize to String.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agodatastore: replace deprecated `archive_type` function
Christian Ebner [Wed, 3 Jul 2024 10:11:00 +0000 (12:11 +0200)]
datastore: replace deprecated `archive_type` function

Commit ea584a75 "move more api types for the client" deprecated
the `archive_type` function in favor of the associated function
`ArchiveType::from_path`.

Replace all remaining callers of the deprecated function with its
replacement.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
[WB: and remove the deprecated function]
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agodatastore: fix typo in comment
Gabriel Goller [Wed, 3 Jul 2024 14:55:06 +0000 (16:55 +0200)]
datastore: fix typo in comment

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2 months agodatastore: use cached snapshot time string in path
Gabriel Goller [Wed, 3 Jul 2024 15:08:36 +0000 (17:08 +0200)]
datastore: use cached snapshot time string in path

When getting the `full_path` of a snapshot we did not use the cached
time string. By using it we avoid a call to the super-slow libc strftime.

This has some minor performance improvements of circa 7%. That is ~100ms
on my datastore with ~5000 snapshots.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2 months agodatastore: avoid calculating protected attribute twice
Gabriel Goller [Wed, 3 Jul 2024 15:02:46 +0000 (17:02 +0200)]
datastore: avoid calculating protected attribute twice

The protected status of the snapshot is retrieved twice. This is slow
because it stat's the .protected file multiple times.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
Tested-by: Christian Ebner <c.ebner@proxmox.com>
Reviewed-by: Christian Ebner <c.ebner@proxmox.com>
2 months agodon't directly depend on tracing-subscriber
Wolfgang Bumiller [Fri, 12 Jul 2024 09:19:25 +0000 (11:19 +0200)]
don't directly depend on tracing-subscriber

This was only used for LevelFilter which is also exposed via the
tracing crate directly.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agoapi: inherit LogContext in tasks hyper spawns in h2 handlers
Wolfgang Bumiller [Thu, 11 Jul 2024 14:21:35 +0000 (16:21 +0200)]
api: inherit LogContext in tasks hyper spawns in h2 handlers

so that tasks spawn()ed by hyper's h2 code log to the correct place

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agobump sys and rest-server dependencies to 0.6
Wolfgang Bumiller [Thu, 11 Jul 2024 13:33:43 +0000 (15:33 +0200)]
bump sys and rest-server dependencies to 0.6

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agoapi: switch from task_log! macro to tracing
Gabriel Goller [Tue, 9 Jul 2024 14:20:13 +0000 (16:20 +0200)]
api: switch from task_log! macro to tracing

Import `proxmox-log` and substitute all `task_log!`
(and task_warn!, task_error!) invocations with tracing calls (info!,
warn!, etc..). Remove worker references where it isn't necessary
anymore.

Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Lukas Wagner <l.wagner@proxmox.com>
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2 months agoswitch from task_log! macro to tracing
Gabriel Goller [Tue, 9 Jul 2024 14:20:12 +0000 (16:20 +0200)]
switch from task_log! macro to tracing

Import `proxmox-log` and substitute all `task_log!`
(and task_warn!, task_error!) invocations with tracing calls (info!,
warn!, etc..). Remove worker references where it isn't necessary
anymore.

Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Lukas Wagner <l.wagner@proxmox.com>
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2 months agocargo: fix package name
Gabriel Goller [Thu, 11 Jul 2024 08:33:28 +0000 (10:33 +0200)]
cargo: fix package name

s/proxmox-apt-api/proxmox-apt-api-types/

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2 months agocargo: add local dependencies
Gabriel Goller [Tue, 9 Jul 2024 10:54:26 +0000 (12:54 +0200)]
cargo: add local dependencies

Add local dependencies for new crates `proxmox-apt-api-types` and
`proxmox-config-digest`. Also fix order of deps.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2 months agobump d/control
Wolfgang Bumiller [Tue, 9 Jul 2024 06:06:17 +0000 (08:06 +0200)]
bump d/control

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agouse new apt/apt-api-types crate
Dietmar Maurer [Fri, 21 Jun 2024 09:51:30 +0000 (11:51 +0200)]
use new apt/apt-api-types crate

2 months agobump proxmox-tfa dependency to 5.0.0
Wolfgang Bumiller [Wed, 3 Jul 2024 13:27:47 +0000 (15:27 +0200)]
bump proxmox-tfa dependency to 5.0.0

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agobump version to 3.2.7-1 v3.2.7
Thomas Lamprecht [Wed, 3 Jul 2024 11:33:59 +0000 (13:33 +0200)]
bump version to 3.2.7-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoupdate online help reference info
Thomas Lamprecht [Wed, 3 Jul 2024 08:59:39 +0000 (10:59 +0200)]
update online help reference info

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agomanager: restore newline in wipe-disk confirmation query
Wolfgang Bumiller [Wed, 3 Jul 2024 09:20:40 +0000 (11:20 +0200)]
manager: restore newline in wipe-disk confirmation query

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agobackup_manager: use confirmation helper in wipe-disk command
Gabriel Goller [Wed, 19 Jun 2024 10:15:44 +0000 (12:15 +0200)]
backup_manager: use confirmation helper in wipe-disk command

Use `Confirmation` helper in the wipe-disk command prompt.

Improves: 887d83cb (cli: add interactive confirmation for block device wipe, 2023-11-29)
Cc: Markus Frank <m.frank@proxmox.com>
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2 months agodatastore: fix problem with operations counting
Hannes Laimer [Thu, 25 Apr 2024 09:01:50 +0000 (11:01 +0200)]
datastore: fix problem with operations counting

... if `.chunks/` is not available(deleted/moved) ChunkStore::open
fails, but that would happen after updating the active operations on the
datastore, so no reference that could be dropped is returned. Leading to
the operations counter to always increase. This only updates the counter
when a reference is returned, not before.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2 months agohttp_client: keep renewal future running on failed re-auth
Hannes Laimer [Mon, 24 Jun 2024 07:54:38 +0000 (09:54 +0200)]
http_client: keep renewal future running on failed re-auth

The re-authentication request can also fail due to network instability,
and not necesarrily only due to an invalid ticket. In that case it makes
sense to retry refreshing the ticket in 15 minutes. Also, the future does
not depend on a failed re-authentication to be clean up properly, so that
happens already somewhere else, therefore we don't rely on this return
anyway. If the ticket is actually invalid or timed out, the main job
will fail and also terminate the renewal future, same applies if the
network is not just unstable but straight up not working.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agofix 5304: client: set process uid/gid for .pxarexclude-cli
Christian Ebner [Tue, 30 Apr 2024 15:37:14 +0000 (17:37 +0200)]
fix 5304: client: set process uid/gid for .pxarexclude-cli

The .pxarexclude-cli encodes the exclude patterns the client was
invoked with in the pxar archive as regular file entry. The current
behaviour of setting the uid and gid to default 0 (root) causes
however issues when trying to backup and restore the backup as
non-root user.

Opt for using the uid/gid of the user the executable was called as,
allowing the restore for this user to succeed. Root will succeed
to restore anyways.

Link to issue in bugtracker:
https://bugzilla.proxmox.com/show_bug.cgi?id=5304

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Tested-by: Gabriel Goller <g.goller@proxmox.com>
2 months agoclient: mount: wait for child to return before exiting
Gabriel Goller [Tue, 18 Jun 2024 14:03:33 +0000 (16:03 +0200)]
client: mount: wait for child to return before exiting

When using the `proxmox-backup-client mount` command, the parent sometimes
exits before we can print any error message. Most notably this happens
when no PBS_REPOSITORY is passed, as this is the first option checked.
If the underlying file descriptor has been closed, wait for the client
to complete and return the error message.

Reported-by: Friedrich Weber <f.weber@proxmox.com>
Suggested-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
2 months agoclose #5571: client: fix regression for `map` command
Christian Ebner [Tue, 2 Jul 2024 07:24:14 +0000 (09:24 +0200)]
close #5571: client: fix regression for `map` command

Commit 08fe5052 introduced functionality to mount split pxar archives
(sharing code with the map command), moving the manifest lookup
exclusive to fixed index archives.

However, the lookup now uses the incorrect archive name, not
containing the `.fidx` extension, which is however required for the
lookup in the manifest.

Fix the issue by calling the method with the correct server archive
name including the required extension.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Tested-by: Gabriel Goller <g.goller@proxmox.com>
Reviewed-by: Gabriel Goller <g.goller@proxmox.com>
Fixes: 08fe5052 ("client: mount: make split pxar archives mountable")
[FG: reworded, add proper "Fixes:" trailer.]
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 months agomake: add deb-nostrip target
Fabian Grünbichler [Thu, 27 Jun 2024 08:33:39 +0000 (10:33 +0200)]
make: add deb-nostrip target

it builds about 1.5 times faster than regular `make deb` (shaving off a
whopping 100s on my machine). the resulting debs containing executables are of
course bigger (since the debug symbols are not split out into their own
package, and the ELF linkage stripping is also skipped), but other than the
associated file and memory mapping overhead there should be no difference in
behaviour or performance, and such debs are suitable for local testing (both of
the build process, and the built code).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 months agodon't call contains_key() before remove()
Wolfgang Bumiller [Fri, 28 Jun 2024 07:33:23 +0000 (09:33 +0200)]
don't call contains_key() before remove()

HashMap::remove() returns the value it removes as an Option<>, so
instead of first checking if the key exists before removing it, just
try to remove it and use the returned Option<> to test whether we
should bail!().

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agotools: add missing cfg(test) macro
Maximiliano Sandoval [Wed, 26 Jun 2024 13:06:03 +0000 (15:06 +0200)]
tools: add missing cfg(test) macro

Fixes the rustc warning:

warning: struct `TestAsyncCacher` is never constructed
  --> pbs-tools/src/async_lru_cache.rs:86:12
   |
86 |     struct TestAsyncCacher {
   |            ^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2 months agochunk_store: do not explicitly write implied trait
Maximiliano Sandoval [Wed, 26 Jun 2024 13:06:02 +0000 (15:06 +0200)]
chunk_store: do not explicitly write implied trait

Fixes the clippy warning:

warning: this bound is already specified as the supertrait of `std::iter::FusedIterator`
   --> pbs-datastore/src/chunk_store.rs:254:14
    |
254 |         impl Iterator<Item = (Result<proxmox_sys::fs::ReadDirEntry, Error>, usize, bool)>
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implied_bounds_in_impls
    = note: `#[warn(clippy::implied_bounds_in_impls)]` on by default
help: try removing this bound
    |
254 -         impl Iterator<Item = (Result<proxmox_sys::fs::ReadDirEntry, Error>, usize, bool)>
255 -             + std::iter::FusedIterator,
254 +         impl std::iter::FusedIterator<Item = (Result<proxmox_sys::fs::ReadDirEntry, Error>, usize, bool)>,

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2 months agotools: write multiplication by 01 succinctly
Maximiliano Sandoval [Wed, 26 Jun 2024 13:06:01 +0000 (15:06 +0200)]
tools: write multiplication by 01 succinctly

Fixes the clippy warning:

warning: this multiplication by -1 can be written more succinctly
   --> pbs-client/src/tools/mod.rs:700:58
    |
700 |                         SignedDuration::Negative(val) => -1 * i64::try_from(val.as_secs())?,
    |                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `-i64::try_from(val.as_secs())?`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#neg_multiply
    = note: `#[warn(clippy::neg_multiply)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2 months agoapi: remove use of unnecessary pub(self)
Maximiliano Sandoval [Wed, 26 Jun 2024 13:06:00 +0000 (15:06 +0200)]
api: remove use of unnecessary pub(self)

Fixes the clippy warning:

warning: unnecessary `pub(self)`
  --> src/api2/access/mod.rs:35:1
   |
35 | pub(self) async fn user_update_auth<S: AsRef<str>>(
   | ^^^^^^^^^ help: remove it
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pub_self
   = note: `#[warn(clippy::needless_pub_self)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2 months agoreplace get(key).is_none() with !contains_key()
Maximiliano Sandoval [Wed, 26 Jun 2024 13:05:59 +0000 (15:05 +0200)]
replace get(key).is_none() with !contains_key()

Fixes the clippy warning:

warning: unnecessary use of `get(&user2).is_none()`
    --> pbs-config/src/acl.rs:1067:36
     |
1067 |                 assert!(node.users.get(&user2).is_none());
     |                         -----------^^^^^^^^^^^^^^^^^^^^^
     |                         |
     |                         help: replace it with: `!node.users.contains_key(&user2)`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_get_then_check

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2 months agoreplace get(key).is_some() with contains_key()
Maximiliano Sandoval [Wed, 26 Jun 2024 13:05:58 +0000 (15:05 +0200)]
replace get(key).is_some() with contains_key()

Fixes the clippy warning:

warning: unnecessary use of `get(realm).is_some()`
  --> pbs-config/src/domains.rs:68:58
   |
68 |     realm == "pbs" || realm == "pam" || domains.sections.get(realm).is_some()
   |                                                          ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `contains_key(realm)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_get_then_check

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2 months agoMakefile: drop outdated comment
Fabian Grünbichler [Thu, 27 Jun 2024 07:43:01 +0000 (09:43 +0200)]
Makefile: drop outdated comment

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>