]> git.proxmox.com Git - proxmox-backup.git/log
proxmox-backup.git
2 days agoversion: remove named features
Fabian Grünbichler [Thu, 21 Nov 2024 09:13:38 +0000 (10:13 +0100)]
version: remove named features

and use version comparison for the push code that previously used it.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 days agosync: add/adapt access check comments
Fabian Grünbichler [Thu, 21 Nov 2024 09:00:21 +0000 (10:00 +0100)]
sync: add/adapt access check comments

add a bit more detail for the pull side, and reword some comments on the push
side to make them easier to read.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 days agopush: treat all missing referenced files as fatal
Fabian Grünbichler [Thu, 21 Nov 2024 08:33:19 +0000 (09:33 +0100)]
push: treat all missing referenced files as fatal

`try_exists` will return Ok(false) if the path is or containts a dangling
symlink, treat that as hard error just like if `try_exists` has returned an
Err(..).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 days agopush: reduce initial capacity of known chunks
Fabian Grünbichler [Wed, 20 Nov 2024 18:55:04 +0000 (19:55 +0100)]
push: reduce initial capacity of known chunks

one million chunks are a bit much, considering that chunks are representing
1-2MB (dynamic) to 4MB (fixed) of input data, that would mean 1-4TB of re-used
input data in a single snapshot.

64k chunks are still representing 64-256GB of input data, which should be
plenty (and for such big snapshots with lots of re-used chunks, growing the
allocation of the HashSet should not be the bottleneck), and is also the
default capacity used for pulling.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 days agopush: reduce calls to list_snapshots on target side
Fabian Grünbichler [Wed, 20 Nov 2024 18:34:54 +0000 (19:34 +0100)]
push: reduce calls to list_snapshots on target side

instead of calling this three times, call it once:

retrieving the highest backup timestamp doesn't need its own request, it can
re-use the "main" result, the corresponding helper can thus be dropped.

remove_vanished can re-use the earlier result - if anybody prunes the backup
group or adds new snapshots while the sync is running, the whole group sync is
racy and might cause spurious errors anyway.

since re-syncing the last already existing snapshot is not possible at the
moment, the code can also be simplified by treating such a snapshots already
fully synced.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 days agopush: fix remove_vanished namespaces logic
Fabian Grünbichler [Wed, 20 Nov 2024 16:47:21 +0000 (17:47 +0100)]
push: fix remove_vanished namespaces logic

a vanished namespace is one that
- exists on the target side, below the target prefix
- but within the specified max_depth
- and was not part of the synced namespaces

Co-developed-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 days agopush: rename namespace parameters/variables
Fabian Grünbichler [Wed, 20 Nov 2024 15:54:47 +0000 (16:54 +0100)]
push: rename namespace parameters/variables

two parameters that only differ by a letter are not very nice for quickly
understanding semantics..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 days agopush: code style cleanup
Fabian Grünbichler [Wed, 20 Nov 2024 15:53:56 +0000 (16:53 +0100)]
push: code style cleanup

BackupGroup is serializable as its API parameter components, like BackupDir.
move the (always present) namespace closer to the group to improve readability.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 days agopush: remove namespace: improve missing Modify priv error
Fabian Grünbichler [Wed, 20 Nov 2024 15:46:36 +0000 (16:46 +0100)]
push: remove namespace: improve missing Modify priv error

to make it easier to distinguish from missing "Prune" privs when removing
vanished groups.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 days agopush: factor out remote api path helper
Fabian Grünbichler [Wed, 20 Nov 2024 15:42:37 +0000 (16:42 +0100)]
push: factor out remote api path helper

to make the complex logic code shorter and easier to parse. no semantic changes
intended.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 days agopush: code style cleanup
Fabian Grünbichler [Wed, 20 Nov 2024 15:42:11 +0000 (16:42 +0100)]
push: code style cleanup

no semantic changes intended

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 days agopush: add comment for version guard
Fabian Grünbichler [Wed, 20 Nov 2024 15:32:22 +0000 (16:32 +0100)]
push: add comment for version guard

explaining why that particular version is used as lower bound.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 days agopush: clippy fixes
Fabian Grünbichler [Wed, 20 Nov 2024 13:59:46 +0000 (14:59 +0100)]
push: clippy fixes

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 days agodocs: add section for sync jobs in push direction
Christian Ebner [Mon, 11 Nov 2024 15:43:53 +0000 (16:43 +0100)]
docs: add section for sync jobs in push direction

Documents the caveats of sync jobs in push direction, explicitly
recommending setting up dedicted remotes for these sync jobs.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoapi: version: add 'prune-delete-stats' as supported feature
Christian Ebner [Mon, 11 Nov 2024 15:43:52 +0000 (16:43 +0100)]
api: version: add 'prune-delete-stats' as supported feature

Expose the 'prune-delete-stats' as supported feature, in order for
the sync job in pull direction to pass the optional
`error-on-protected=false` flag to the api calls when pruning backup
snapshots, groups or namespaces.

2 days agoapi: datastore/namespace: return backup groups delete stats on remove
Christian Ebner [Mon, 11 Nov 2024 15:43:51 +0000 (16:43 +0100)]
api: datastore/namespace: return backup groups delete stats on remove

Add and optionally expose the backup group delete statistics by adding the
return type to the corresponding REST API endpoints.

Clients can opt-into the new behaviour by setting the new `error-on-protected`
flag to `false` when calling the api endpoints, which results in removal not
erroring out when encountering protected snapshots.

The default value for the flag remains `true` for now, to remain backwards
compatible with older clients expecting this behaviour.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
FG: reworded commit message slightly
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 days agoui: sync view: set proxy on view instead of model
Christian Ebner [Mon, 11 Nov 2024 15:43:50 +0000 (16:43 +0100)]
ui: sync view: set proxy on view instead of model

In order to load data using the same model from different sources,
set the proxy on the store instead of the model.
This allows to use the view to display sync jobs in either pull or
push direction, by setting the `sync-direction` ont the view.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoui: sync job: adapt edit window to be used for pull and push
Christian Ebner [Mon, 11 Nov 2024 15:43:49 +0000 (16:43 +0100)]
ui: sync job: adapt edit window to be used for pull and push

Switch the subject and labels to be shown based on the direction of
the sync job, and set the `sync-direction` parameter from the
submit values in case of push direction.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoui: add view with separate grids for pull and push sync jobs
Christian Ebner [Mon, 11 Nov 2024 15:43:48 +0000 (16:43 +0100)]
ui: add view with separate grids for pull and push sync jobs

Show sync jobs in pull and in push direction in two separate grids,
visually separating them to limit possible misconfiguration.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoui: sync edit: source group filters based on sync direction
Christian Ebner [Mon, 11 Nov 2024 15:43:47 +0000 (16:43 +0100)]
ui: sync edit: source group filters based on sync direction

Switch to the local datastore, used as sync source for jobs in push
direction, to get the available group filter options.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoui: group filter: allow to set namespace for local datastore
Christian Ebner [Mon, 11 Nov 2024 15:43:46 +0000 (16:43 +0100)]
ui: group filter: allow to set namespace for local datastore

The namespace has to be set in order to get the correct groups to be
used as group filter options with a local datastore as source,
required for sync jobs in push direction.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agobin: manager: add datastore push cli command
Christian Ebner [Mon, 11 Nov 2024 15:43:45 +0000 (16:43 +0100)]
bin: manager: add datastore push cli command

Expose the push api endpoint to be callable via the command line
interface.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoapi: admin: avoid duplicate name for list sync jobs api method
Christian Ebner [Mon, 11 Nov 2024 15:43:44 +0000 (16:43 +0100)]
api: admin: avoid duplicate name for list sync jobs api method

`list_sync_jobs` exists as api method in `api2::admin::sync` and
`api2::config::sync`.

Rename the admin api endpoint method to `list_config_sync_jobs` in
order to reduce possible confusion when searching/reviewing.

No functional change intended.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoapi: sync jobs: expose optional `sync-direction` parameter
Christian Ebner [Mon, 11 Nov 2024 15:43:43 +0000 (16:43 +0100)]
api: sync jobs: expose optional `sync-direction` parameter

Exposes and switch the config type for sync job operations based
on the `sync-direction` parameter, exposed on required api endpoints.

If not set, the default config type is `sync` and the default sync
direction is `pull` for full backwards compatibility. Whenever
possible, determine the sync direction and config type from the sync
job config directly rather than requiring it as optional api
parameter.

Further, extend read and modify access checks by sync direction to
conditionally check for the required permissions in pull and push
direction.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoapi: config: factor out sync job owner check
Christian Ebner [Mon, 11 Nov 2024 15:43:42 +0000 (16:43 +0100)]
api: config: factor out sync job owner check

Move the sync job owner check to its own helper function, for it to
be reused for the owner check for sync jobs in push direction.

No functional change intended.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoapi: config: Require PRIV_DATASTORE_AUDIT to modify sync job
Christian Ebner [Mon, 11 Nov 2024 15:43:41 +0000 (16:43 +0100)]
api: config: Require PRIV_DATASTORE_AUDIT to modify sync job

Read access to sync jobs is not granted to users not having at least
PRIV_DATASTORE_AUDIT permissions on the datastore. However a user is
able to create or modify such jobs, without having the audit
permission.

Therefore, further restrict the modify check by also including the
audit permissions.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoapi: sync: move sync job invocation to server sync module
Christian Ebner [Mon, 11 Nov 2024 15:43:40 +0000 (16:43 +0100)]
api: sync: move sync job invocation to server sync module

Moves and refactores the sync_job_do function into the common server
sync module so that it can be reused for both sync directions, pull
and push.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoapi: push: implement endpoint for sync in push direction
Christian Ebner [Mon, 11 Nov 2024 15:43:39 +0000 (16:43 +0100)]
api: push: implement endpoint for sync in push direction

Expose the sync job in push direction via a dedicated API endpoint,
analogous to the pull direction.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoapi types/config: add `sync-push` config type for push sync jobs
Christian Ebner [Mon, 11 Nov 2024 15:43:38 +0000 (16:43 +0100)]
api types/config: add `sync-push` config type for push sync jobs

In order for sync jobs to be either pull or push jobs, allow to
configure the direction of the job.

Adds an additional config type `sync-push` to the sync job config, to
clearly distinguish sync jobs configured in pull and in push
direction and defines and implements the required `SyncDirection` api
type.

This approach was chosen in order to limit possible misconfiguration,
as unintentionally switching the sync direction could potentially
delete still required snapshots.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agofix #3044: server: implement push support for sync operations
Christian Ebner [Mon, 11 Nov 2024 15:43:37 +0000 (16:43 +0100)]
fix #3044: server: implement push support for sync operations

Adds the functionality required to push datastore contents from a
source to a remote target.
This includes syncing of the namespaces, backup groups and snapshots
based on the provided filters as well as removing vanished contents
from the target when requested.

While trying to mimic the pull direction of sync jobs, the
implementation is different as access to the remote must be performed
via the REST API, not needed for the pull job which can access the
local datastore via the filesystem directly.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoapi/api-types: refactor api endpoint version, add api types
Christian Ebner [Mon, 11 Nov 2024 15:43:36 +0000 (16:43 +0100)]
api/api-types: refactor api endpoint version, add api types

Add a dedicated api type for the `version` api endpoint and helper
methods for supported feature comparison.
This will be used to detect api incompatibility of older hosts, not
supporting some features.

Use the new api type to refactor the version endpoint and set it as
return type.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agodatastore: increment deleted group counter when removing group
Christian Ebner [Mon, 11 Nov 2024 15:43:35 +0000 (16:43 +0100)]
datastore: increment deleted group counter when removing group

To correctly account also for the number of deleted backup groups, in
preparation to correctly return the delete statistics when removing
contents via the REST API.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoapi types: implement api type for `BackupGroupDeleteStats`
Christian Ebner [Mon, 11 Nov 2024 15:43:34 +0000 (16:43 +0100)]
api types: implement api type for `BackupGroupDeleteStats`

Make the `BackupGroupDeleteStats` exposable via the API by implementing
the ApiTypes trait via the api macro invocation and add an additional
field to account for the number of deleted groups.
Further, add a method to add up the statistics.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agodatastore: move `BackupGroupDeleteStats` to api types
Christian Ebner [Mon, 11 Nov 2024 15:43:33 +0000 (16:43 +0100)]
datastore: move `BackupGroupDeleteStats` to api types

In preparation for the delete stats to be exposed as return type to
the backup group delete api endpoint.

Also, rename the private field `unremoved_protected` to a better
fitting `protected_snapshots` to be in line with the method names.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoapi types: define remote permissions and roles for push sync
Christian Ebner [Mon, 11 Nov 2024 15:43:32 +0000 (16:43 +0100)]
api types: define remote permissions and roles for push sync

Adding the privileges to allow backup, namespace creation and prune
on remote targets, to be used for sync jobs in push direction.

Also adds dedicated roles setting the required privileges.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoapi types: implement remote acl path method for sync job
Christian Ebner [Mon, 11 Nov 2024 15:43:31 +0000 (16:43 +0100)]
api types: implement remote acl path method for sync job

Add `remote_acl_path` method which generates the acl path from the sync
job configuration. This helper allows to easily generate the acl path
from a given sync job config for privilege checks.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoapi types: add remote acl path method for `BackupNamespace`
Christian Ebner [Mon, 11 Nov 2024 15:43:30 +0000 (16:43 +0100)]
api types: add remote acl path method for `BackupNamespace`

Add a `remote_acl_path` helper method for creating acl paths for
remote namespaces, to be used by the priv checks on remote datastore
namespaces for e.g. the sync job in push direction.

Factor out the common path extension into a dedicated method.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoconfig: acl: allow namespace components for remote datastores
Christian Ebner [Mon, 11 Nov 2024 15:43:29 +0000 (16:43 +0100)]
config: acl: allow namespace components for remote datastores

Extend the component limit for ACL paths of `remote` to include
possible namespace components.

This allows to limit the permissions for sync jobs in push direction
to a namespace subset on the remote datastore.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoconfig: acl: refactor acl path component check for datastore
Christian Ebner [Mon, 11 Nov 2024 15:43:28 +0000 (16:43 +0100)]
config: acl: refactor acl path component check for datastore

Combine the two if statements checking the datastores ACL path
components, which can be represented more concisely as one.

Further, extend the pre-existing comment to clarify that `datastore`
ACL paths are not limited to the datastore name, but might have
further sub-components specifying the namespace.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoclient: backup writer: allow push uploading index and chunks
Christian Ebner [Mon, 11 Nov 2024 15:43:27 +0000 (16:43 +0100)]
client: backup writer: allow push uploading index and chunks

Add a method `upload_index_chunk_info` to be used for uploading an
existing index and the corresponding chunk stream.
Instead of taking an input stream of raw bytes as the
`upload_stream`, this takes a stream of `MergedChunkInfo` object
provided by the local chunk reader of the sync jobs source.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoclient: backup writer: factor out merged chunk stream upload
Christian Ebner [Mon, 11 Nov 2024 15:43:26 +0000 (16:43 +0100)]
client: backup writer: factor out merged chunk stream upload

In preparation for implementing push support for sync jobs.

Factor out the upload stream for merged chunks, which can be reused
to upload the local chunks to a remote target datastore during a
snapshot sync operation in push direction.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agoclient: backup writer: refactor backup and upload stats counters
Christian Ebner [Mon, 11 Nov 2024 15:43:25 +0000 (16:43 +0100)]
client: backup writer: refactor backup and upload stats counters

In preparation for push support in sync jobs.

Extend and move `BackupStats` into `backup_stats` submodule and add
method to create them from `UploadStats`.

Further, introduce `UploadCounters` struct to hold the Arc clones of
the chunk upload statistics counters, simplifying the house keeping.

By bundling the counters into the struct, they can be passed as
single function parameter when factoring out the common stream future
in the subsequent implementation of the chunk upload for sync jobs
in push direction.

Co-developed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agosync: extend sync source's list namespaces method by filter callback
Christian Ebner [Mon, 11 Nov 2024 15:43:24 +0000 (16:43 +0100)]
sync: extend sync source's list namespaces method by filter callback

Allow to filter namespaces by given callback function. This will be
used to pre-filter the list of namespaces to push to a remote target
for sync jobs in push direction, based on the privs of the sync jobs
local user on the source datastore.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 days agosync: pull: optimize backup group sorting
Christian Ebner [Mon, 11 Nov 2024 15:43:23 +0000 (16:43 +0100)]
sync: pull: optimize backup group sorting

`BackupGroup` implements `cmp::Ord`, so use that implementation for
comparing groups during sorting. Furtuher, only sort the list of
backup groups after filtering, thereby possibly reducing the number
of required comparisons.

No functional changes.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
4 days agobump version to 3.2.10-1
Thomas Lamprecht [Tue, 19 Nov 2024 21:36:36 +0000 (22:36 +0100)]
bump version to 3.2.10-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 days agocargo: require proxmox-log 0.2.6
Thomas Lamprecht [Tue, 19 Nov 2024 10:40:04 +0000 (11:40 +0100)]
cargo: require proxmox-log 0.2.6

To ensure the fix for avoiding printing verbose log levels to stderr,
stdout is included, as that spams the log with the full worker log
tasks.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 days agoapi: disk list: do not fail but just log error on gathering smart data
Thomas Lamprecht [Sun, 17 Nov 2024 19:28:51 +0000 (20:28 +0100)]
api: disk list: do not fail but just log error on gathering smart data

I plugged in a USB pen drive and the whole disk list UI became
completely unusable because smartctl fails to handle that device due
to some `Unknown USB bridge [0x090c:0x1000 (0x1100)]` error.

That itself might be improvable, but most often I do not care at all
about smart data, and certainly not enough to make failing gathering
it disallow me from viewing my disks (or the smart data from disks
where it still could be gathered, for that matter!)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 days agodisks: add UUID to partition info
Hannes Laimer [Wed, 13 Nov 2024 15:00:41 +0000 (16:00 +0100)]
disks: add UUID to partition info

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
6 days agoconfig: factor out method to get the absolute datastore path
Dietmar Maurer [Wed, 13 Nov 2024 15:00:38 +0000 (16:00 +0100)]
config: factor out method to get the absolute datastore path

removable datastores will have a PBS-managed mountpoint as path, direct
access to the field needs to be replaced with a helper that can account
for this.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
6 days agotools: add disks utility functions
Hannes Laimer [Wed, 13 Nov 2024 15:00:37 +0000 (16:00 +0100)]
tools: add disks utility functions

... for mounting and unmounting

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
9 days agobump version to 3.2.9-1 v3.2.9
Thomas Lamprecht [Thu, 14 Nov 2024 15:10:14 +0000 (16:10 +0100)]
bump version to 3.2.9-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 days agofix #5233: don't require root for some tape operations
Dominik Csapak [Wed, 13 Nov 2024 11:37:42 +0000 (12:37 +0100)]
fix #5233: don't require root for some tape operations

instead, require 'Tape.Write' or 'Tape.Modify' on '/tape' path.
This makes it possible for a TapeOperator to destroy tapes and for a
TapeAdmin to update the tape status, instead of just root@pam.

I opted for the path '/tape' since we don't have a dedicated acl
structure for single tapes, just '/tape/pool' (which does not apply
since not all tapes have to have a pool), '/tape/device' (which is
intended for drives/changers) and '/tape/jobs' (which is for jobs only).

Also we use that path for e.g. move_tape already.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 days agofix #5868: workspace: require rest-server >= 0.8.2
Thomas Lamprecht [Thu, 14 Nov 2024 14:15:35 +0000 (15:15 +0100)]
fix #5868: workspace: require rest-server >= 0.8.2

To ensure the recent fixes for the "infinite loop on early connection
abort when trying to detect the TLS handshake" problem is included.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 days agoclient: pxar: add debug output for exclude pattern matches
Christian Ebner [Thu, 26 Sep 2024 12:34:37 +0000 (14:34 +0200)]
client: pxar: add debug output for exclude pattern matches

Log the path of directory entries matched by an exclude pattern in
order to more conveniently debug possible issues.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
11 days agoclient: pxar: perform match pattern check only once
Christian Ebner [Thu, 26 Sep 2024 12:34:36 +0000 (14:34 +0200)]
client: pxar: perform match pattern check only once

While traversing the filesystem tree, `generate_directory_file_list`
generates the list of entries to include for each directory level,
already matching the entry against the given list of match patterns.

Since this already excludes entries which should not be included in
the archive, the same check in the `add_entry` call is redundant,
as it is executed for each entry which is included in the list
generated by `generate_directory_file_list`.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
11 days agofix #5600: pbs2to3: allow arbitrary newer '-pve' kernels after upgrade
Daniel Kral [Wed, 18 Sep 2024 13:01:00 +0000 (15:01 +0200)]
fix #5600: pbs2to3: allow arbitrary newer '-pve' kernels after upgrade

Fixes a bug where `pbs2to3` shows an incorrect warning about an
unexpected running kernel version, where newer kernel versions than 6.5
were marked as unexpected (e.g. "8.6.12-1-pve").

This commit allows arbitrary newer kernel versions that are suffixed
with '-pve' from kernel version 6.2 onward. This is the same behavior as
in other upgrade helpers like `pve7to8` [1] and `pmg7to8` [2].

[1] https://git.proxmox.com/?p=pve-manager.git;a=commit;h=fb59038a8b110b0b0b438ec035fd41dd9d591232
[2] https://git.proxmox.com/?p=pmg-api.git;a=commit;h=9d67a9af218b73027822c9c4665b88e6662e7ef7

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
11 days agopbs2to3: add test for kernel version compatibility
Daniel Kral [Wed, 18 Sep 2024 13:00:59 +0000 (15:00 +0200)]
pbs2to3: add test for kernel version compatibility

Factors the kernel version compatibility check into its own method and
adds test cases for a set of expected and unexpected kernel versions.

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
11 days agoapi: parallelize smartctl checks
Gabriel Goller [Tue, 17 Sep 2024 08:05:50 +0000 (10:05 +0200)]
api: parallelize smartctl checks

To improve the performance of the smartctl checks, especially when a lot
of disks are used, parallelize the checks using the `ParallelHandler`.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
11 days agoapi: avoid retrieving lsblk result twice
Gabriel Goller [Tue, 17 Sep 2024 08:05:49 +0000 (10:05 +0200)]
api: avoid retrieving lsblk result twice

Avoid running `lsblk` twice when executing the `list_disk`
endpoint/command. This and the various other small nits improve the
performance of the endpoint.

Does not really fix, but is related to: #4961.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
11 days agoclient: catalog shell: avoid navigating below archive root
Christian Ebner [Tue, 3 Sep 2024 12:39:46 +0000 (14:39 +0200)]
client: catalog shell: avoid navigating below archive root

Avoid to underflow the catalogs shell position stack by navigating
below the archives root directory into the catalog root. Otherwise
the shell will panic, as the root entry is always expected to be
present.

This threats the archive root directory as being it's own parent
directory, mimicking the behaviour of most common shells.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
11 days agoapi: tape: add permission to move_tape endpoint
Hannes Laimer [Wed, 6 Nov 2024 10:45:12 +0000 (11:45 +0100)]
api: tape: add permission to move_tape endpoint

... so it is usable by non-root users, this came up in support.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
12 days agoupdate proxmox-notify crate to 0.5
Thomas Lamprecht [Mon, 11 Nov 2024 22:55:25 +0000 (23:55 +0100)]
update proxmox-notify crate to 0.5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 days agoweb: disallow datastore in root, add reuse-datastore flag
Gabriel Goller [Thu, 29 Aug 2024 12:58:44 +0000 (14:58 +0200)]
web: disallow datastore in root, add reuse-datastore flag

Disallows creating a datastore in root on the frontend side, by
filtering the '/' path. Add reuse-flag to permit us to open existing
datastores.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
12 days agofix #5439: allow to reuse existing datastore
Gabriel Goller [Thu, 29 Aug 2024 12:58:43 +0000 (14:58 +0200)]
fix #5439: allow to reuse existing datastore

Disallow creating datastores in non-empty directories. Allow adding
existing datastores via a 'reuse-datastore' checkmark. This only checks
if all the necessary directories (.chunks + subdirectories and .lock)
exist and have the correct permissions. Note that the reuse-datastore
path does not open the datastore, so that we don't drop the
ProcessLocker of an existing datastore.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
12 days agofix #5861: remove min username length in ChangeOwner modal
Gabriel Goller [Mon, 11 Nov 2024 09:30:17 +0000 (10:30 +0100)]
fix #5861: remove min username length in ChangeOwner modal

We allow usernames shorter than 4 characters since this patch [0] in
pbs.

[0]: https://lore.proxmox.com/pbs-devel/20240117142918.264978-1-g.goller@proxmox.com/

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2 weeks agobump rest-server to 0.8.1
Wolfgang Bumiller [Fri, 8 Nov 2024 11:05:54 +0000 (12:05 +0100)]
bump rest-server to 0.8.1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 weeks agod/control: bump proxmox-subscription to 0.5
Christoph Heiss [Fri, 8 Nov 2024 09:34:15 +0000 (10:34 +0100)]
d/control: bump proxmox-subscription to 0.5

Seems this was forgotten while bumping it in Cargo.toml in dcd863e0.

Fixes: dcd863e0 ("bump proxmox-subscription to 0.5.0")
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2 weeks agobump proxmox-subscription to 0.5.0
Dietmar Maurer [Thu, 7 Nov 2024 13:09:15 +0000 (14:09 +0100)]
bump proxmox-subscription to 0.5.0

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2 weeks agosync: pull: reword last_sync_time resync comment
Fabian Grünbichler [Mon, 4 Nov 2024 13:48:28 +0000 (14:48 +0100)]
sync: pull: reword last_sync_time resync comment

make it a bit easier to parse and include some examples of what the resync
might be able to pick up.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 weeks agosync: pull: simplify logic for source snapshot filtering
Christian Ebner [Mon, 4 Nov 2024 12:56:14 +0000 (13:56 +0100)]
sync: pull: simplify logic for source snapshot filtering

Decouple the actual filter logic from the skip reason output logic by
pulling the latter out of the filter closue.

Makes the filtering logic more intuitive.

Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 weeks agosync: pull: mention why last snapshot of previous sync is resynced
Christian Ebner [Mon, 4 Nov 2024 12:56:13 +0000 (13:56 +0100)]
sync: pull: mention why last snapshot of previous sync is resynced

The last snapshot synced during the previous sync job might not have
been fully completed just yet (e.g. backup log still missing,
verification still ongoing, ...).
Explicitley mention the reason and that the resync is therefore
intentional by a comment in the filter logic.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 weeks agosync: fix premature return in snapshot skip filter logic
Christian Ebner [Mon, 4 Nov 2024 10:58:28 +0000 (11:58 +0100)]
sync: fix premature return in snapshot skip filter logic

While checking which snapshots to sync, the filter logic incorrectly
included the first snapshot newer that the last synced one
unconditionally, bypassing the transfer last check for that one
snapshot. Following snapshots are correctly handled again.

E.g. of an incorrect sync by excerpt of a task log provided by a user
in the community forum [0], with transfer last set to 1:

```
skipped: 2 snapshot(s) (2024-09-29T18:00:28Z .. 2024-10-20T18:00:29Z) - older than the newest local snapshot
skipped: 5 snapshot(s) (2024-10-28T19:00:28Z .. 2024-11-01T19:00:32Z) - due to transfer-last
sync snapshot vm/110/2024-10-27T19:00:25Z
...
sync snapshot vm/110/2024-11-02T19:00:23Z
```

Not only the last, but the first newer than newest and last were
incorrectly synced.

By dropping the early return, leading to incorrect inclusion of the
snapshot, the transfer last condition is now correctly checked as
well.

Link to the issue reported in the community forum:
[0] https://forum.proxmox.com/threads/156873/

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
4 weeks agoclient: catalog shell: drop payload offset in `stat` output
Christian Ebner [Thu, 24 Oct 2024 09:10:09 +0000 (11:10 +0200)]
client: catalog shell: drop payload offset in `stat` output

Drop the payload offset output for the multi line formatting helper,
as the formatting was skewed anyways and the `stat` output is not
intended for debugging.

Commit 51e8fa96 ("client: pxar: include payload offset in entry
listing") introduced the payload offset output for pxar entries
in case of split archives for both, single line and multi line
formatting helpers with debugging prupose.

While the payload offset output is fine for the single line entry
formatting (generates the pxar dump output in debugging mode),
it should not be included in the multi line entry formatting helper,
used to generate the output for the `stat` command of the catalog
shell.

Fixes: 51e8fa96 ("client: pxar: include payload offset in entry listing")
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
4 weeks agopxar: tools: inline async recursion
Fabian Grünbichler [Wed, 23 Oct 2024 14:09:54 +0000 (16:09 +0200)]
pxar: tools: inline async recursion

this works since rustc 1.77, and makes the code less verbose.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 weeks agoclient: catalog shell: fallback to accessor for navigation
Christian Ebner [Mon, 12 Aug 2024 10:31:39 +0000 (12:31 +0200)]
client: catalog shell: fallback to accessor for navigation

Make the catalog optional and use the pxar accessor for navigation if
the catalog is not provided.
This allows to use the metadata archive for navigraion, as for split
pxar archives no dedicated catalog is encoded.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
4 weeks agoclient: helper to mimic catalog find using metadata archive
Christian Ebner [Mon, 12 Aug 2024 10:31:38 +0000 (12:31 +0200)]
client: helper to mimic catalog find using metadata archive

Adds helper functions to reimplement the catalog shell functionality
for snapshots being encoded as split pxar archives.

Just as the `CatalogReader`s find method, recursively iterate entries
and call the given callback on all entries matched by the match
patterns, starting from the given parent entry.

The helper has been split into 2 functions for the async recursion to
work.

4 weeks agoclient: catalog: fallback to metadata archives for catalog dump
Christian Ebner [Mon, 12 Aug 2024 10:31:37 +0000 (12:31 +0200)]
client: catalog: fallback to metadata archives for catalog dump

Commit c0302805c "client: backup: conditionally write catalog for
file level backups" drops encoding of the dedicated catalog when
archives are encoded as split metadata/data archives with the
`change-detection-mode` set to `data` or `metadata`.

Since the catalog is not present anymore, fallback to use the pxar
metadata archives in the manifest (if present) for generating the
listing of contents in a compatible manner.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
4 weeks agoclient: add helper to dump catalog from metadata archive
Christian Ebner [Mon, 12 Aug 2024 10:31:36 +0000 (12:31 +0200)]
client: add helper to dump catalog from metadata archive

Implements the methods to dump the contents of a metadata pxar
archive using the same output format as used by the catalog dump.

The helper function has been split into 2 for async recursion to
work.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
4 weeks agoclient: tools: factor out pxar entry to dir entry mapping
Christian Ebner [Mon, 12 Aug 2024 10:31:35 +0000 (12:31 +0200)]
client: tools: factor out pxar entry to dir entry mapping

Perform the conversion from pxar file entries to catalog entry
attributes by implementing `TryFrom<&FileEntry<T>>` for
`DirEntryAttribute` and use that.

Allows the reuse for the catalog shell, when using the split pxar
archive instead of the catalog.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
4 weeks agoclient: tools: factor out entry path prefix helper
Christian Ebner [Mon, 12 Aug 2024 10:31:34 +0000 (12:31 +0200)]
client: tools: factor out entry path prefix helper

Move the logic to generate `FileEntry` paths with a given prefix to
its own helper function for it to be reusable for the catalog shell
implementation of split pxar archives.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
4 weeks agoclient: make helper to get remote pxar reader reusable
Christian Ebner [Mon, 12 Aug 2024 10:31:33 +0000 (12:31 +0200)]
client: make helper to get remote pxar reader reusable

Move the `get_remote_pxar_reader` helper function so it can be reused
also for getting the metadata archive reader instance for the catalog
dump.

No functional changes.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
4 weeks agoclient: tools: move pxar root entry helper to pxar submodule
Christian Ebner [Mon, 12 Aug 2024 10:31:32 +0000 (12:31 +0200)]
client: tools: move pxar root entry helper to pxar submodule

Move the `handle_root_with_optional_format_version_prelude` helper,
purely related to handling the root entry for pxar format version 2
archives, to the more fitting pxar tools submodule.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
4 weeks agoclient: pxar: move catalog lookup helper to pxar tools
Christian Ebner [Mon, 12 Aug 2024 10:31:31 +0000 (12:31 +0200)]
client: pxar: move catalog lookup helper to pxar tools

The lookup helper used to generate catalog entries via the metadata
archive for split archive backups is pxar specific, therefore move it
to the appropriate pxar tools submodlue.

4 weeks agoclient: tools: make tools module public
Christian Ebner [Mon, 12 Aug 2024 10:31:30 +0000 (12:31 +0200)]
client: tools: make tools module public

Change namespace visibility for tools submodule to be accessible from
other creates, to be used for common pxar related helpers.

Switch helpers declared as `pub` to `pub(crate)` in order to keep module
encapsulation, adapt namespace for functions required to be `pub`.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
4 weeks agoapi: add missing doc-comment description for api enums
Thomas Lamprecht [Tue, 22 Oct 2024 13:26:35 +0000 (15:26 +0200)]
api: add missing doc-comment description for api enums

this is used as description in the api schema

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agofile-restore: add missing doc-comment description for api enums
Thomas Lamprecht [Tue, 22 Oct 2024 13:26:11 +0000 (15:26 +0200)]
file-restore: add missing doc-comment description for api enums

this is used as description in the api schema

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agoapi-types: add missing doc-comment description for api enums
Thomas Lamprecht [Tue, 22 Oct 2024 13:25:52 +0000 (15:25 +0200)]
api-types: add missing doc-comment description for api enums

this is used as description in the api schema

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agobump version to 3.2.8-1
Thomas Lamprecht [Fri, 18 Oct 2024 17:05:45 +0000 (19:05 +0200)]
bump version to 3.2.8-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agodocs: sync: explicitly mention `removed-vanish` flag
Christian Ebner [Mon, 21 Oct 2024 14:31:22 +0000 (16:31 +0200)]
docs: sync: explicitly mention `removed-vanish` flag

Add a short sentence describing the function of the remove vanished
flag since this has not been documented explicitly.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
4 weeks agodocs: prefix node.cfg man page with proxmox-backup
Thomas Lamprecht [Mon, 21 Oct 2024 07:07:55 +0000 (09:07 +0200)]
docs: prefix node.cfg man page with proxmox-backup

As node.cfg is a rather general name that could clash with manual
pages from other packages, or at least be a bit confusing if there's
another tool providing a node.cfg.

In the long term we should rename all existing manual pages from
section 5 and 7, i.e. all those that are not directly named after an
executable. As those normally talk about product-specific configs and
topics where just the filename is not specific enough for a system
wide manual page.

Note that there was some off-list discussion with proposal of using
"section suffixes" that man supports and can be used to differ between
manual pages with the same name (and in the same section), for example
`man 3pm Git`, but to me this seems a bit more obscure and potentially
less discoverable, but can be a great way to provide an link alias for
convenience.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agobuildsys: install node.cfg man page in server package
Thomas Lamprecht [Mon, 21 Oct 2024 07:07:03 +0000 (09:07 +0200)]
buildsys: install node.cfg man page in server package

Fixes: 3c9fe358 ("docs: add node.cfg man page")
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 weeks agodocs: fix warnings in external-metric-server page
Gabriel Goller [Thu, 10 Oct 2024 13:26:42 +0000 (15:26 +0200)]
docs: fix warnings in external-metric-server page

Rename external-metric-server page and fix code-block to remove some
warnings.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
5 weeks agodocs: add node.cfg man page
Gabriel Goller [Thu, 10 Oct 2024 13:26:41 +0000 (15:26 +0200)]
docs: add node.cfg man page

Add man page for the node.cfg config file.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
 [ TL: pull out sorting of synopsis file list to separate commit ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 weeks agobuildsys: sort list of generated synopsis and man page files alphabetically
Thomas Lamprecht [Fri, 18 Oct 2024 15:54:23 +0000 (17:54 +0200)]
buildsys: sort list of generated synopsis and man page files alphabetically

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 weeks agoclient: progress log: small opinionated code clean-up
Thomas Lamprecht [Thu, 17 Oct 2024 14:51:39 +0000 (16:51 +0200)]
client: progress log: small opinionated code clean-up

It was fine as is, but IMO saving a few lines is nice, albeit it makes
the atomic fetch expressions look slightly complexer by wrapping them
directly with the HumanByte and TimeSpan from-constructors.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 weeks agopartial fix #5560: client: periodically show backup progress
Christian Ebner [Fri, 11 Oct 2024 09:33:55 +0000 (11:33 +0200)]
partial fix #5560: client: periodically show backup progress

Spawn a new tokio task which about every minute displays the
cumulative progress of the backup for pxar, ppxar or img archive
streams. Catalog and metadata archive streams are excluded from the
output for better readability, and because the catalog upload lives
for the whole upload time, leading to possible temporal
misalignments in the output. The actual payload data is written via
the other streams anyway.

Add accounting for uploaded chunks, to distinguish from chunks queued
for upload, but not actually uploaded yet.

Example output in the backup task log:
```
...
INFO:  processed 2.471 GiB in 1m, uploaded 2.439 GiB
INFO:  processed 4.963 GiB in 2m, uploaded 4.929 GiB
INFO:  processed 7.349 GiB in 3m, uploaded 7.284 GiB
...
```

This partially fixes issue 5560:
https://bugzilla.proxmox.com/show_bug.cgi?id=5560

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 weeks agodocs: installation: fix wrong product reference
Christoph Heiss [Thu, 26 Sep 2024 13:32:48 +0000 (15:32 +0200)]
docs: installation: fix wrong product reference

This was probably copied verbatim from pve-docs and forgotten to be
appropriately changed.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
5 weeks agodocs: Fix typo for chunk directory naming and rewording
Christian Ebner [Fri, 11 Oct 2024 07:18:58 +0000 (09:18 +0200)]
docs: Fix typo for chunk directory naming and rewording

The chunks subdirectories are only using the chunk's 2 byte checksum
prefix given in hex notation.

Also, clarify that chunks are grouped into subdirectories.

Reported in the community forum:
https://forum.proxmox.com/threads/155751/

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
5 weeks agodebian: run wrap-and-sort -tkn to normalize control files
Thomas Lamprecht [Wed, 16 Oct 2024 12:34:11 +0000 (14:34 +0200)]
debian: run wrap-and-sort -tkn to normalize control files

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 weeks agoapi: metrics: check permissions before reading any data from the cache
Lukas Wagner [Tue, 15 Oct 2024 13:50:28 +0000 (15:50 +0200)]
api: metrics: check permissions before reading any data from the cache

Reading from the metric cache is somewhat expensive, so validate as many
of the required permissions as possible. For host metrics, we can
do the full check in advance. For datastores, we check if we have
audit permissions for *any* datastore. If we do not have privs for
either of those, we return early and avoid reading from the
cache altogether.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Suggested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>