]> git.proxmox.com Git - proxmox-backup.git/log
proxmox-backup.git
2 years agobump version to 2.2.4-1
Thomas Lamprecht [Thu, 14 Jul 2022 16:38:02 +0000 (18:38 +0200)]
bump version to 2.2.4-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoproxy: scheduler: only do a single round of time alignment and drop counter
Thomas Lamprecht [Thu, 14 Jul 2022 16:20:41 +0000 (18:20 +0200)]
proxy: scheduler: only do a single round of time alignment and drop counter

not much value in waiting an extra minute, that doesn't really
guarantees better scheduling (as in, less impact on startup).

Dropping that also allows easily to drop the counter by just moving
the sleep to the beginning of the loop.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoproxy: scheduler: code cleanup/bloat reduction
Thomas Lamprecht [Thu, 14 Jul 2022 16:10:05 +0000 (18:10 +0200)]
proxy: scheduler: code cleanup/bloat reduction

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoproxy: scheduler: move fallback inside next_minute fn, drops result from return
Thomas Lamprecht [Thu, 14 Jul 2022 15:59:24 +0000 (17:59 +0200)]
proxy: scheduler: move fallback inside next_minute fn, drops result from return

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodocs: buildsys: use wild card target for generating config synopsis
Thomas Lamprecht [Thu, 14 Jul 2022 15:56:18 +0000 (17:56 +0200)]
docs: buildsys: use wild card target for generating config synopsis

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodocs: buildsys: use wild card target for generating synopsis
Thomas Lamprecht [Thu, 14 Jul 2022 15:54:16 +0000 (17:54 +0200)]
docs: buildsys: use wild card target for generating synopsis

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodocs: replace copyright years statement with single source of truth from conf
Thomas Lamprecht [Thu, 14 Jul 2022 14:53:14 +0000 (16:53 +0200)]
docs: replace copyright years statement with single source of truth from conf

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodocs: conf: update copyright years
Thomas Lamprecht [Thu, 14 Jul 2022 14:49:23 +0000 (16:49 +0200)]
docs: conf: update copyright years

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodocs: epilog: add version dynamically and drop unused AUTHOR replacement
Thomas Lamprecht [Thu, 14 Jul 2022 14:50:50 +0000 (16:50 +0200)]
docs: epilog: add version dynamically and drop unused AUTHOR replacement

now that the man pages are generated from sphinx, not rst2man, they
got access to the conf.py and things like its rst_epilog variable.

Use that to set the correct version in there dynamically

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodocs: let sphinx build man pages for better integration and less cruft
Thomas Lamprecht [Thu, 14 Jul 2022 14:41:43 +0000 (16:41 +0200)]
docs: let sphinx build man pages for better integration and less cruft

rst2man is only good for use in projects that don't use sphinx
already, as there it can help to avoid bringing in the full sphinx
dependencies and be easier to manage (as long as it stay small).

But we already use sphinx, so there's no point in managing the manual
pages in a separate, semi-related way that is quite restricted as we
have no access to sphinx infrastructure like conf.py defined
variables and helpers for things like the current version.

Besides that, we're rather big, so the complexity of sphinx can
shine, e.g., see the diffstat report from switching out rst2man for
sphinx:

22 files changed, 74 insertions(+), 347 deletions(-)

so 273 lines less in total is rather nice.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix: api2: make tasks endpoint work with new prune job worker type
Stefan Sterz [Wed, 13 Jul 2022 14:36:29 +0000 (16:36 +0200)]
fix: api2: make tasks endpoint work with new prune job worker type

when prune jobs were refactored, their worker type was changed from
"prune" to "prunejob" this broke `check_job_store` and
`check_job_privs`

as reported in the forum: https://forum.proxmox.com/threads/problem-with-apirequest-on-pbs-2-2-3.112131/#post-483835

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2 years agoapi2: optimize filtered snapshot listing
Wolfgang Bumiller [Thu, 14 Jul 2022 08:53:39 +0000 (10:53 +0200)]
api2: optimize filtered snapshot listing

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agodatastore: add BackupGroup::exists helper
Wolfgang Bumiller [Thu, 14 Jul 2022 09:13:44 +0000 (11:13 +0200)]
datastore: add BackupGroup::exists helper

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agodatastore: factor type out of ListGroups into ListGroupsType
Wolfgang Bumiller [Wed, 13 Jul 2022 12:56:36 +0000 (14:56 +0200)]
datastore: factor type out of ListGroups into ListGroupsType

In the API we want to iterate over all backup groups
belonging to a particular type at least once, and iterating
through *everything* and simply "skipping" over every single
entry from another type makes no sense given that the groups
are organized into subdirectories based on their type.

Let's have an `.iter_backup_type()` method which returns an
iterator over all the groups of a specific type named
ListGroupsType and factorize the type level iterator out of
ListGroups for reuse.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agodatastore: simplify iter_backup_groups_ok
Wolfgang Bumiller [Wed, 13 Jul 2022 12:43:17 +0000 (14:43 +0200)]
datastore: simplify iter_backup_groups_ok

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoapi-types: make BackupType::iter an actual iterator
Wolfgang Bumiller [Thu, 14 Jul 2022 09:09:34 +0000 (11:09 +0200)]
api-types: make BackupType::iter an actual iterator

Otherwise we have to use BackupType::iter().iter() whenever
we're not using a `for _ in iter()` construct.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoapi: wrap get_snapshots_count in spawn_blocking
Wolfgang Bumiller [Wed, 13 Jul 2022 12:00:38 +0000 (14:00 +0200)]
api: wrap get_snapshots_count in spawn_blocking

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoapi: wrap set_backup_owner in spawn_blocking
Wolfgang Bumiller [Wed, 13 Jul 2022 12:01:24 +0000 (14:01 +0200)]
api: wrap set_backup_owner in spawn_blocking

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoapi: wrap set_protection in spawn_blocking
Wolfgang Bumiller [Wed, 13 Jul 2022 12:01:09 +0000 (14:01 +0200)]
api: wrap set_protection in spawn_blocking

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoapi: wrap catalog in spawn_blocking
Wolfgang Bumiller [Wed, 13 Jul 2022 12:01:00 +0000 (14:01 +0200)]
api: wrap catalog in spawn_blocking

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoapi: wrap delete_snapshot in spawn_blocking
Wolfgang Bumiller [Wed, 13 Jul 2022 12:00:25 +0000 (14:00 +0200)]
api: wrap delete_snapshot in spawn_blocking

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoapi: wrap list_snapshot_files in spawn_blocking
Wolfgang Bumiller [Wed, 13 Jul 2022 12:00:13 +0000 (14:00 +0200)]
api: wrap list_snapshot_files in spawn_blocking

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoapi: wrap delete_group in spawn_blocking
Wolfgang Bumiller [Wed, 13 Jul 2022 11:52:38 +0000 (13:52 +0200)]
api: wrap delete_group in spawn_blocking

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoapi: move 'list_snapshots' to a blocking thread
Wolfgang Bumiller [Tue, 12 Jul 2022 09:07:55 +0000 (11:07 +0200)]
api: move 'list_snapshots' to a blocking thread

This is a stop-gap measure to prevent snapshot listing from
blocking the main async worker threads as it can potentially
do a *lot* of I/O.

Ideally we'll move to a proper streaming API, but this will
be an API break.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agowrap fs_info calls in spawn_blocking
Wolfgang Bumiller [Mon, 11 Jul 2022 08:41:16 +0000 (10:41 +0200)]
wrap fs_info calls in spawn_blocking

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agotape: include used tapes in tape notification e-mails
Dominik Csapak [Fri, 1 Jul 2022 12:11:04 +0000 (14:11 +0200)]
tape: include used tapes in tape notification e-mails

by saving them in the pool-writer, and setting them in the
TapeBackupJobSummary

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agomove json_object_to_query to proxmox-http+http-helpers
Fabian Grünbichler [Tue, 21 Jun 2022 12:32:02 +0000 (14:32 +0200)]
move json_object_to_query to proxmox-http+http-helpers

it's used by the subscription code that will be extracted next.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agomove to/write_canonical_json to proxmox-serde
Fabian Grünbichler [Tue, 21 Jun 2022 12:27:00 +0000 (14:27 +0200)]
move to/write_canonical_json to proxmox-serde

as preparation for extracting subscription-related code into its own
crate.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agocruft: remove tools::http
Fabian Grünbichler [Wed, 29 Jun 2022 09:54:20 +0000 (11:54 +0200)]
cruft: remove tools::http

it's not used by anything.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agorustfmt
Wolfgang Bumiller [Thu, 30 Jun 2022 08:18:32 +0000 (10:18 +0200)]
rustfmt

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoapi: tape/backup: improve behaviour for vanishing snapshots
Dominik Csapak [Wed, 29 Jun 2022 12:15:44 +0000 (14:15 +0200)]
api: tape/backup: improve behaviour for vanishing snapshots

when snapshots vanish during tape backup, we skip them. Until now,
we also warned with the error and failed the task at the end.

Since deleting snapshots during tape backup does not really interfere
with it, don't fail the whole task, and only add a log line that it
was skipped.

To differentiate from different errors (e.g. permission problems),
introduce a 'SnapshotBackupResult' which is returned by 'backup_snapshot'.

Also remove the 'pub' there since we don't want to leak the
SnapshotBackupResult type and it's not used anywhere outside this file.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agofile-restore: fix a hyperlink in docs
Wolfgang Bumiller [Thu, 30 Jun 2022 08:16:03 +0000 (10:16 +0200)]
file-restore: fix a hyperlink in docs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoapi-types: doc: add crate to `Display` trait in comments
Stefan Sterz [Wed, 29 Jun 2022 08:55:38 +0000 (10:55 +0200)]
api-types: doc: add crate to `Display` trait in comments

when creating the documentation (e.g. `cargo doc --open`), it would
warn that `Display` is not in scope.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agotape reader: improve error for unknown magic number
Thomas Lamprecht [Wed, 29 Jun 2022 10:09:37 +0000 (12:09 +0200)]
tape reader: improve error for unknown magic number

ancient LTO version can cause this too (got some forum reports)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopartially fix #2915: 'stat' in case ReadDirEntry does not contain type
Dominik Csapak [Tue, 28 Jun 2022 13:15:14 +0000 (15:15 +0200)]
partially fix #2915: 'stat' in case ReadDirEntry does not contain type

readdir/getdents may return 'DT_UNKNOWN' for the file type
(which corresponds to 'None' in nix::dir::Entry), so stat the file and
check the type

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agobump proxmox-sys dep to 0.3.1
Wolfgang Bumiller [Wed, 29 Jun 2022 07:44:42 +0000 (09:44 +0200)]
bump proxmox-sys dep to 0.3.1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agod/control cleanup
Wolfgang Bumiller [Tue, 21 Jun 2022 08:52:57 +0000 (10:52 +0200)]
d/control cleanup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agobump d/control
Wolfgang Bumiller [Tue, 21 Jun 2022 08:48:59 +0000 (10:48 +0200)]
bump d/control

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agorestore-daemon: make file listing 'streaming'
Dominik Csapak [Mon, 20 Jun 2022 07:51:13 +0000 (09:51 +0200)]
restore-daemon: make file listing 'streaming'

this prevents an oom kill when listing large directories.
Without this, i'd get an oom kill in the restore vm when
i tried to list a directory with ~60000 entries, but with this,
i'd get the response for even 250000 entries

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agofixed_index: remove unused 'print_info' function
Hannes Laimer [Wed, 15 Jun 2022 08:19:57 +0000 (08:19 +0000)]
fixed_index: remove unused 'print_info' function

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agodocs: add note for setting verbosity level
Hannes Laimer [Wed, 15 Jun 2022 08:19:56 +0000 (08:19 +0000)]
docs: add note for setting verbosity level

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoreplace print with log macro
Hannes Laimer [Wed, 15 Jun 2022 08:19:55 +0000 (08:19 +0000)]
replace print with log macro

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoproxmox-rest-server: replace print with log macro
Hannes Laimer [Wed, 15 Jun 2022 08:19:54 +0000 (08:19 +0000)]
proxmox-rest-server: replace print with log macro

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoproxmox-file-restore: replace print with log macro
Hannes Laimer [Wed, 15 Jun 2022 08:19:53 +0000 (08:19 +0000)]
proxmox-file-restore: replace print with log macro

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoproxmox-backup-client: replace print with log macro
Hannes Laimer [Wed, 15 Jun 2022 08:19:52 +0000 (08:19 +0000)]
proxmox-backup-client: replace print with log macro

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agopbs-fuse+pbs-tape: replace print with log macro
Hannes Laimer [Wed, 15 Jun 2022 08:19:51 +0000 (08:19 +0000)]
pbs-fuse+pbs-tape: replace print with log macro

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agopbs-datastore: replace print with log macro
Hannes Laimer [Wed, 15 Jun 2022 08:19:50 +0000 (08:19 +0000)]
pbs-datastore: replace print with log macro

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agopbs-client: replace print with log macro
Hannes Laimer [Wed, 15 Jun 2022 08:19:49 +0000 (08:19 +0000)]
pbs-client: replace print with log macro

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agobins: init cli logger
Hannes Laimer [Wed, 15 Jun 2022 08:19:48 +0000 (08:19 +0000)]
bins: init cli logger

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agobump proxmox-router dep to 1.2.4
Wolfgang Bumiller [Tue, 21 Jun 2022 08:43:11 +0000 (10:43 +0200)]
bump proxmox-router dep to 1.2.4

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoui: disks: show partitions by default
Hannes Laimer [Wed, 8 Jun 2022 08:51:53 +0000 (08:51 +0000)]
ui: disks: show partitions by default

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2 years agodisks: use builder pattern for querying disk usage
Hannes Laimer [Wed, 15 Jun 2022 06:17:14 +0000 (06:17 +0000)]
disks: use builder pattern for querying disk usage

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2 years agoapi2: disks endpoint return partitions
Hannes Laimer [Wed, 8 Jun 2022 08:51:51 +0000 (08:51 +0000)]
api2: disks endpoint return partitions

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2 years agoremove outdated comment
Wolfgang Bumiller [Tue, 14 Jun 2022 11:00:14 +0000 (13:00 +0200)]
remove outdated comment

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agofix #3867: server/api: send emails on certificate renewal failure
Stefan Sterz [Tue, 14 Jun 2022 08:09:45 +0000 (10:09 +0200)]
fix #3867: server/api: send emails on certificate renewal failure

the superuser's email will be used to notify them that certificate
renewal has failed.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agobump proxmox-fuse dep to 0.1.3
Wolfgang Bumiller [Mon, 13 Jun 2022 13:12:07 +0000 (15:12 +0200)]
bump proxmox-fuse dep to 0.1.3

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agobump d/control
Wolfgang Bumiller [Mon, 13 Jun 2022 08:05:44 +0000 (10:05 +0200)]
bump d/control

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoui: add MetricServerView and use it
Dominik Csapak [Fri, 10 Jun 2022 11:17:57 +0000 (13:17 +0200)]
ui: add MetricServerView and use it

simple CRUD interface to show/add/edit/delete metric servers

it's a bit different from PVE's so it's harder to reuse that than to
copy it. If we need it again, we can still refactor and combine them.

introduce 'PBS.Schema' class to hold the server type/xtype mappings

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoui: add window/InfluxDbEdit
Dominik Csapak [Fri, 10 Jun 2022 11:17:56 +0000 (13:17 +0200)]
ui: add window/InfluxDbEdit

contains both windows for HTTP and UDP

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoapi: add metricserver endpoints
Dominik Csapak [Fri, 10 Jun 2022 11:17:55 +0000 (13:17 +0200)]
api: add metricserver endpoints

but in contrast to pve, we split the api by type of the section config,
since we cannot handle multiple types in the updater

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoproxmox-backup-proxy: send metrics to configured metrics server
Dominik Csapak [Fri, 10 Jun 2022 11:17:54 +0000 (13:17 +0200)]
proxmox-backup-proxy: send metrics to configured metrics server

and keep the data as similar as possible to pve (tags/fields)

datastores get their own 'object' type and reside in the "blockstat"
measurement

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agobackup-proxy: decouple stats gathering from rrd update
Dominik Csapak [Fri, 10 Jun 2022 11:17:53 +0000 (13:17 +0200)]
backup-proxy: decouple stats gathering from rrd update

that way we can reuse the stats gathered

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agopbs-config: add metrics config class
Dominik Csapak [Fri, 10 Jun 2022 11:17:52 +0000 (13:17 +0200)]
pbs-config: add metrics config class

a section config like in pve

also adds a helper to get Metrics structs for all configured servers

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agopbs-api-types: add metrics api types
Dominik Csapak [Fri, 10 Jun 2022 11:17:51 +0000 (13:17 +0200)]
pbs-api-types: add metrics api types

InfluxDbUdp and InfluxDbHttp for now

introduces schemas for host:port and https urls

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoconfig: remove duplicate privilege lookup in cached_user_info
Stefan Sterz [Fri, 10 Jun 2022 08:13:25 +0000 (10:13 +0200)]
config: remove duplicate privilege lookup in cached_user_info

`lookup_privs` just uses `lookup_privs_details` but ignores the
propagated privileges it returns. thus, the lookup here is redundant
as it is immediately followed by a call to `lookup_privs_details` with
the same parameters.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2 years agod/lintian-overrides: ignore some expected warnings
Thomas Lamprecht [Wed, 8 Jun 2022 12:51:03 +0000 (14:51 +0200)]
d/lintian-overrides: ignore some expected warnings

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 2.2.3-2
Thomas Lamprecht [Wed, 8 Jun 2022 12:23:25 +0000 (14:23 +0200)]
bump version to 2.2.3-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig: acl get child paths: make tests more specific
Thomas Lamprecht [Wed, 8 Jun 2022 12:04:33 +0000 (14:04 +0200)]
config: acl get child paths: make tests more specific

to avoid that extra paths "sneak" in in some regression

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig: re-enable efficient mixed acl path/slice support
Thomas Lamprecht [Wed, 8 Jun 2022 12:01:53 +0000 (14:01 +0200)]
config: re-enable efficient mixed acl path/slice support

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoacl: fix any_priv_below when used with API tokens
Fabian Grünbichler [Wed, 8 Jun 2022 09:27:24 +0000 (11:27 +0200)]
acl: fix any_priv_below when used with API tokens

The previous implementation had one issue with not handling API
tokens correctly.

In general, AclTree(Node) operates on the role level, not the priv
level - the latter is handled by cached_user_info.rs

Accordingly, the ACL tree helpers now return a list of paths where *any*
role is defined for the given AuthId, and any_priv_below then maps those
paths to privs via the regular helpers for priv lookup/checking. this
approach should also be robust if groups and group ACLs are ever
introduced.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoacl: rename get_node to get_node_mut
Fabian Grünbichler [Wed, 8 Jun 2022 09:26:36 +0000 (11:26 +0200)]
acl: rename get_node to get_node_mut

get_node will be re-introduced with the next patch, which requires a
non-mut accessor.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agocargo fmt/format variable inlining
Thomas Lamprecht [Tue, 7 Jun 2022 12:34:55 +0000 (14:34 +0200)]
cargo fmt/format variable inlining

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: tape restore: warn if snapshot could not get parsed
Thomas Lamprecht [Tue, 7 Jun 2022 12:18:46 +0000 (14:18 +0200)]
api: tape restore: warn if snapshot could not get parsed

unlikely, but cost is far too low to not do it.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: tape restore: code cleanup to reduce indentation level
Thomas Lamprecht [Tue, 7 Jun 2022 12:12:00 +0000 (14:12 +0200)]
api: tape restore: code cleanup to reduce indentation level

No semantic change intended. IMO the interface of "both a datastore
and NS mapping must be present" is still a bit weird, at least in how
its used here to decide what to skip and what not, maybe we can
implement this in a more clear way (or maybe I'm just overlooking
something that makes it clearer as is).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotree wide: typo fixes through codespell
Thomas Lamprecht [Tue, 7 Jun 2022 07:22:45 +0000 (09:22 +0200)]
tree wide: typo fixes through codespell

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoaccess: fix typo in RPC env wrong-type error
Thomas Lamprecht [Tue, 7 Jun 2022 06:53:24 +0000 (08:53 +0200)]
access: fix typo in RPC env wrong-type error

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agod/changelog: fix typos in historical entries
Thomas Lamprecht [Tue, 7 Jun 2022 06:52:34 +0000 (08:52 +0200)]
d/changelog: fix typos in historical entries

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoreplace 'disk_usage' with 'fs_info' from proxmox-sys
Dominik Csapak [Thu, 2 Jun 2022 12:18:04 +0000 (14:18 +0200)]
replace 'disk_usage' with 'fs_info' from proxmox-sys

Use the moved 'fs_info' helpers from the proxmox-sys crate (available
from there since proxmox-sys 0.3.0) as replacement for 'disk_usage'
in the workspace local tools crate and remove the latter as we do not
need it anymore.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [ T: squashed in removal of now unused import and reworded commit
  message to include version availability info, among other things ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: tape restore: avoid throwing away ns mapping, use target_store instead
Thomas Lamprecht [Sun, 5 Jun 2022 14:59:55 +0000 (16:59 +0200)]
api: tape restore: avoid throwing away ns mapping, use target_store instead

avoid assembling a hash mapping of namespaces only to not use it,
i.e., throw it away then anyway

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: tape restore: some code cleanups
Thomas Lamprecht [Sun, 5 Jun 2022 14:55:13 +0000 (16:55 +0200)]
api: tape restore: some code cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: tape restore: split/rework datastore/namespace map implementation
Thomas Lamprecht [Sun, 5 Jun 2022 14:47:24 +0000 (16:47 +0200)]
api: tape restore: split/rework datastore/namespace map implementation

The split out helpers will (partially) be used in later patches for
call sites where we only need parts of the info assembled here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: tape restore: use HumanByte for friendlier total/throughput reporting
Thomas Lamprecht [Sun, 5 Jun 2022 08:45:13 +0000 (10:45 +0200)]
api: tape restore: use HumanByte for friendlier total/throughput reporting

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: tape restore: refactor some code parts shorter
Thomas Lamprecht [Sun, 5 Jun 2022 08:42:46 +0000 (10:42 +0200)]
api: tape restore: refactor some code parts shorter

not wanting to play code golf here, but bloat in code makes it often
also harder to read, so try to reduce some of that without making it
to terse.

No semantic change intended.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocode formatting fixups
Thomas Lamprecht [Sun, 5 Jun 2022 08:36:40 +0000 (10:36 +0200)]
code formatting fixups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotape: use inline variable in formats for code reduction
Thomas Lamprecht [Sun, 5 Jun 2022 08:33:26 +0000 (10:33 +0200)]
tape: use inline variable in formats for code reduction

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotree wide: typo fixes through codespell
Thomas Lamprecht [Sun, 5 Jun 2022 08:30:23 +0000 (10:30 +0200)]
tree wide: typo fixes through codespell

Most, not all, found and fixes using `codespell -wci3 -L crate`

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 2.2.3-1
Thomas Lamprecht [Sat, 4 Jun 2022 14:30:18 +0000 (16:30 +0200)]
bump version to 2.2.3-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: datastore status: use cheaper any_privs_below over can_access_any_namespace
Thomas Lamprecht [Sat, 4 Jun 2022 13:30:25 +0000 (15:30 +0200)]
api: datastore status: use cheaper any_privs_below over can_access_any_namespace

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: list datastore: avoid iterating over NS for priv check, use AclTree
Thomas Lamprecht [Sat, 4 Jun 2022 12:57:30 +0000 (14:57 +0200)]
api: list datastore: avoid iterating over NS for priv check, use AclTree

Make the assumption that if a user has any privilege that would make
an NS and (parts) of its content visible they also should be able to
know about the datastore and very basic errors on lookup (path
existence and maintenance mode) even if that NS doesn't even exists
(yet), as they could, e.g., make or view a backup and find out
anyway.

This avoids iterating over parts of the whole datastore folder tree
on disk, doing a priv check on each, swapping IO to virtual in memory
checks on info we got available already anyway, is always a good idea
after all

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig: cached user info: expose new any_privs_below
Thomas Lamprecht [Sat, 4 Jun 2022 12:50:43 +0000 (14:50 +0200)]
config: cached user info: expose new any_privs_below

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig: any_priv_below: plural name & switch to slice of &str for path
Thomas Lamprecht [Sat, 4 Jun 2022 12:47:35 +0000 (14:47 +0200)]
config: any_priv_below: plural name & switch to slice of &str for path

s/any_priv_below/any_privs_below/ for consistency and switch from a
single &str for the path param to the slice-ref string variant, as
that allows to use it more often without allocation.

Also allow passing the whole path as single &str element in the slice
by splitting each component on '/' like we do in other parts
nowadays. Note though that we need to omit the leading slash then.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig: s/propagating/only_propagated/ and style nits
Thomas Lamprecht [Sat, 4 Jun 2022 12:46:50 +0000 (14:46 +0200)]
config: s/propagating/only_propagated/ and style nits

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopbs-config: acl-tree: add any_priv_below
Stefan Sterz [Fri, 3 Jun 2022 15:32:24 +0000 (17:32 +0200)]
pbs-config: acl-tree: add any_priv_below

`any_priv_below()` checks if a given AuthId has any given privileges
on a sub-tree of the AclTree. to do so, it first takes into account
propagating privileges on the path itself and then uses a depth-first
search to check if any of the provided privileges are set on any
node of the sub-tree pointed to by the path.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatastore: swap ConfigVersionCache with digest for change detection
Thomas Lamprecht [Fri, 3 Jun 2022 15:18:13 +0000 (17:18 +0200)]
datastore: swap ConfigVersionCache with digest for change detection

We got the digest available anyway, and it's only 16 bytes more to
save (compared to last_generation and the recently removed last_time,
both being 64 bit = 8 bytes each)

Side benefit, we detect config changes made manually (e.g., `vim
datacenter.cfg`) immediately.

Note that we could restructure the maintenance mode checking to only
be done after checking if there's a cached datastore, in which case
using the generation could make sense to decide if we need to re-load
it again before blindly loading the config anyway. As that's not only
some (not exactly hard but not really trivial like a typo fix either)
restructuring work but also means we'd lose the "detect manual
changes" again I'd rather keep using the digest.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatastore: make unsafe fn public again, useful for example/test
Thomas Lamprecht [Fri, 3 Jun 2022 15:10:17 +0000 (17:10 +0200)]
datastore: make unsafe fn public again, useful for example/test

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatastore: make unsafe functions only visible in their own crate
Thomas Lamprecht [Fri, 3 Jun 2022 11:42:42 +0000 (13:42 +0200)]
datastore: make unsafe functions only visible in their own crate

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: list datastores: avoid unsafe datastore open
Thomas Lamprecht [Fri, 3 Jun 2022 11:31:26 +0000 (13:31 +0200)]
api: list datastores: avoid unsafe datastore open

to avoid the problematic open fresh datastore with fresh chunkstore
with, and that's the actual problematic part, fresh process locker.
As the latter uses posix record locks which are pretty dangreous as
they operate on a path level (not FD level) and thus closing any file
opened (even if it wasn't opened for locking at all) drops all active
locks on the same file on completely unrelated file descriptors -.-

Also, no operation wasn't exactly correct for this thing in the first
place, but we cannot use Operation::Lookup either, as we're currently
indeed using a rather stupid-simple way and *are* reading.

So until we optimize this to allow querying the AclTree if there's
any priv XYZ below a path, use the Operation::Read.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatastore: add safety doc comment for unsafe opens
Thomas Lamprecht [Fri, 3 Jun 2022 08:58:33 +0000 (10:58 +0200)]
datastore: add safety doc comment for unsafe opens

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatastore: reduce chunk store open visibility and comment pitfalls
Thomas Lamprecht [Fri, 3 Jun 2022 08:15:41 +0000 (10:15 +0200)]
datastore: reduce chunk store open visibility and comment pitfalls

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatastore: rename non-telling `map` to `datastore_cache`
Thomas Lamprecht [Fri, 3 Jun 2022 08:11:09 +0000 (10:11 +0200)]
datastore: rename non-telling `map` to `datastore_cache`

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>