5
0
mirror of git://git.proxmox.com/git/proxmox-backup.git synced 2025-01-08 21:18:07 +03:00
Commit Graph

8058 Commits

Author SHA1 Message Date
Fabian Grünbichler
4e37c678dc pxar: add file name to path_info when applying metadata
else, error messages using this path_info refer to the parent directory instead
of the actual file entry causing the problem. since this is just for
informational purposes, lossy conversion is acceptable.

Acked-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-11-22 10:38:42 +01:00
Christian Ebner
da11d22610 fix #5710: api: backup: stat known chunks on backup finish
Known chunks are expected to be present on the datastore a-priori,
allowing clients to only re-index these chunks without uploading the
raw chunk data. The list of reusable known chunks is send to the
client by the server, deduced from the indexed chunks of the previous
backup snapshot of the group.

If however such a known chunk disappeared (the previous backup
snapshot having been verified before that or not verified just yet),
the backup will finish just fine, leading to a seemingly successful
backup. Only a subsequent verification job will detect the backup
snapshot as being corrupt.

In order to reduce the impact, stat the list of previously known
chunks when finishing the backup. If a missing chunk is detected, the
backup run itself will fail and the previous backup snapshots verify
state is set to failed.
This prevents the same snapshot from being reused by another,
subsequent backup job.

Note:
The current backup run might have been just fine, if the now missing
known chunk is not indexed. But since there is no straight forward
way to detect which known chunks have not been reused in the fast
incremental mode for fixed index backups, the backup run is
considered failed.

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

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>
2024-11-22 10:26:25 +01:00
Christian Ebner
6265b1103a server: push: various smaller improvements to error messages
Various smaller adaptions such as capitalization of the start of
sentences, expansion of abbreviations and shortening of to long
error messages.

To improve consistency with the rest of the error messages for the
sync job in push direction.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>

FG: use "skipping" for non-owner-groups - we haven't started uploading at that
point, there is nothing to "abort"

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-11-22 10:03:02 +01:00
Fabian Grünbichler
2134a2af48 push: move log messages for removed snapshot/group
so that they are logged in the success case, since the error case already has
its own log messages.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-11-22 09:56:26 +01:00
Christian Ebner
935368a62f server: push: consistently use remote over target for error messages
Mixing of terms only makes the errors harder to understand.

In order to make error messages more intuitive, always refer to the
sync push target as remote, mention the remote explicitly and/or
improve messages where needed.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2024-11-22 09:51:17 +01:00
Christian Ebner
ffd52fbeeb server: push: fix needless borrow clippy warning
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2024-11-22 09:51:17 +01:00
Gabriel Goller
cc6fc6a540 fix #5801: backup_manager: make api call on datastore update
When updating the datastore config using `proxmox-backup-manager` we
need to make an api-call, because the api-route starts a tokio task to
update the proxy-cache and the client will kill the task if we don't
wait. With an api-call the tokio task will be executed on the api
process and runs in the background while the endpoint handler has
already returned.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2024-11-22 09:15:58 +01:00
Gabriel Goller
41b97b2454 fix: allow datastore creation in directory with lost+found directory
When creating a datastore without the "reuse-datastore" option and the
datastore contains a `lost+found` directory (which is quite common), the
creation fails. Add `lost+found` to the ignore list.

Reported here: https://forum.proxmox.com/threads/bug-when-adding-new-storage-task-error-datastore-path-is-not-empty.157629/#post-721733

Fixes: 6e101ff757 ("fix #5439: allow to reuse existing datastore")
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>

FG: slight code style change
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-11-22 09:06:53 +01:00
Hannes Laimer
cd933e9d69 chunk_store: fix problem with permission checking
Permissions are stored in the lower 9 bits (rwxrwxrwx),
so we have to mask `st_mode` with 0o777.
The datastore root dir is created with 755, the `.chunks` dir and its
contents with 750 and the `.lock` file with 644, this changes the
expected permissions accordingly.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
Fixes: 6e101ff757 ("fix #5439: allow to reuse existing datastore")
Reviewed-By: Gabriel Goller <g.goller@proxmox.com>
2024-11-22 08:49:32 +01:00
Christian Ebner
ec4ffa924a docs: client: fix formatting by using double ticks
With single ticks the containing modes and archive formats are
displayed cursive, to be consistent with other sections of the
documentation use inline blocks.

Adapted line wrappings to the additional line length.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Reviewed-by: Shannon Sterz <s.sterz@proxmox.com>
2024-11-21 17:02:28 +01:00
Christian Ebner
98ac310845 docs: reference technical change detection mode section for client
Currently, the change detection modes are described in the client
usage section, not intended for in-depth explanation on how these
client option works, but rather with focus on how to use them.
Therefore, add a reference to the more detailed technical section
regarding the change detection modes and reduce duplicate
explanations.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Reviewed-by: Shannon Sterz <s.sterz@proxmox.com>
2024-11-21 17:02:28 +01:00
Christian Ebner
1964cbdaad docs: explain the working principle of the change detection modes
Describe in more details how the different change detection modes
operate and give insights into the inner workings, especially for the
more complex `metadata` mode, which involves lookahead caching and
padding calculation for reused payload chunks.

Suggested-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Reviewed-by: Shannon Sterz <s.sterz@proxmox.com>
2024-11-21 17:02:28 +01:00
Stoiko Ivanov
e70c389918 docs: fix wrong product name in certificate docs
this got reported via e-mail - seems this one occurrence was
forgotten. grepped through the docs (and the whole repo) for 'Mail'
and 'Gateway', and it seems this was the only one.

Fixes: cbd7db1d ("docs: certificates")
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2024-11-21 16:59:22 +01:00
Christian Ebner
e3f2756cbb fix #5853: client: pxar: exclude stale files on metadata/link read
Skip and warn the user for files which returned a stale file handle
error while reading the metadata associated to that file, or the
target in case of a symbolic link.

Instead of returning with a hard error, report the stale file handle
and skip over encoding this file entry in the pxar archive.

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

Link to thread in community forum:
https://forum.proxmox.com/threads/156822/

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2024-11-21 13:21:02 +01:00
Christian Ebner
efb49d8abe client: pxar: warn user and ignore stale file handles on file open
Do not fail hard if a file open fails because of a stale file handle.
Warn the user and ignore the file, just like the client already does
in case of missing privileges to access the file.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2024-11-21 13:21:02 +01:00
Christian Ebner
102ab18146 client: pxar: skip directory entries on stale file handle
Skip over the entries when a stale file handle is encountered during
generation of the entry list of a directory entry.

This will lead to the directory not being backed up if the directory
itself was invalidated, as then reading all child entries will fail
also, or the directory is backed up without entries which have been
invalidated.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2024-11-21 13:21:02 +01:00
Christian Ebner
1b9df4ba4f client: pxar: skip directories on stale file handle
Skip over the whole directory in case the file handle was invalidated
and therefore the filesystem type check returns with ESTALE.

Encode the directory start entry in the archive and the catalog only
after the filesystem type check, so the directory can be fully skipped.
At this point it is still possible to ignore the invalidated
directory. If the directory is invalidated afterwards, it will be
backed up only partially.

Introduce a helper method to report entries for which a stale file
handle was encountered, providing an optional path for cases where
the `Archiver`s state does not store the correct path.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2024-11-21 13:21:02 +01:00
Christian Ebner
1be78aad72 client: pxar: refactor report vanished/changed helpers
Switch from mutable reference to shared reference on `self` and drop
unused return value.

These helpers only write log messages, there is currently no need for
a mutable reference to `self`, nor to return a `Result`.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2024-11-21 13:21:02 +01:00
Fabian Grünbichler
adbf59dd17 bump version to 3.2.11-1
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-11-21 12:47:11 +01:00
Fabian Grünbichler
5990728ec9 push: check that source namespace exists
else, combined with remove_vanished everything on the target side would be
removed.

Suggested-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-11-21 12:47:11 +01:00
Fabian Grünbichler
0679c25ebb manager: push: add more completions
the group filters need adaptations both for pushing and local pulling, so left
those out for now.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-11-21 12:01:04 +01:00
Fabian Grünbichler
c02d3a8717 push: keep track of created namespaces
to avoid attempting to create them multiple times in case a whole hierarchy is
missing, and misleadingly logging that they were created multiple times as
well.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-11-21 11:53:49 +01:00
Fabian Grünbichler
e0ddb88cb7 push: improve error messages
the error message for failure to sync the whole namespace was too long, so
split it into two lines and make it a warning.

the namespace creation one lacked context (that the error was caused by the
remote side or the connection) and had too much (the datastore, which is
already logged very often) at the same time.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-11-21 11:53:49 +01:00
Fabian Grünbichler
a5350595fc 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>
2024-11-21 11:53:49 +01:00
Fabian Grünbichler
a3a0c7dbe7 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>
2024-11-21 11:53:49 +01:00
Fabian Grünbichler
a304ed7c01 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>
2024-11-21 11:53:49 +01:00
Fabian Grünbichler
2492083e37 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>
2024-11-21 11:53:49 +01:00
Fabian Grünbichler
0bcbb1badd 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>
2024-11-21 11:53:49 +01:00
Fabian Grünbichler
56ab13f0e2 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>
2024-11-21 11:53:16 +01:00
Fabian Grünbichler
27b8321f2a 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>
2024-11-21 11:01:25 +01:00
Fabian Grünbichler
2031aa4bec 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>
2024-11-21 11:01:25 +01:00
Fabian Grünbichler
70acf0f1df 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>
2024-11-21 11:01:25 +01:00
Fabian Grünbichler
90900fd017 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>
2024-11-21 11:01:25 +01:00
Fabian Grünbichler
89ef8bf502 push: code style cleanup
no semantic changes intended

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-11-21 11:01:25 +01:00
Fabian Grünbichler
162ff15378 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>
2024-11-21 11:01:25 +01:00
Fabian Grünbichler
aec0ef6260 push: clippy fixes
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-11-21 11:01:25 +01:00
Christian Ebner
44999809b0 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>
2024-11-21 11:01:25 +01:00
Christian Ebner
00f441eb93 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.
2024-11-21 11:01:25 +01:00
Christian Ebner
4e50ef5193 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>
2024-11-21 10:57:09 +01:00
Christian Ebner
5462d9d44d 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>
2024-11-21 10:14:53 +01:00
Christian Ebner
9aa213b88e 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>
2024-11-21 10:14:53 +01:00
Christian Ebner
262395abaf 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>
2024-11-21 10:14:53 +01:00
Christian Ebner
0b965ec115 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>
2024-11-21 10:14:53 +01:00
Christian Ebner
43a92c8c1b 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>
2024-11-21 10:14:53 +01:00
Christian Ebner
964162ce35 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>
2024-11-21 10:14:53 +01:00
Christian Ebner
4a1fa30a6f 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>
2024-11-21 10:14:53 +01:00
Christian Ebner
397e9c9991 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>
2024-11-21 10:14:53 +01:00
Christian Ebner
c9078b189c 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>
2024-11-21 10:14:53 +01:00
Christian Ebner
5876a963b8 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>
2024-11-21 10:14:53 +01:00
Christian Ebner
46951c103b 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>
2024-11-21 10:14:53 +01:00