Commit Graph

6690 Commits

Author SHA1 Message Date
Hannes Laimer
dce4b5403b 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>
2022-06-21 10:43:19 +02:00
Hannes Laimer
e10fccf5cc 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>
2022-06-21 10:43:19 +02:00
Hannes Laimer
955aea8ae8 bins: init cli logger
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-21 10:43:19 +02:00
Wolfgang Bumiller
a3593c890e bump proxmox-router dep to 1.2.4
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-21 10:43:19 +02:00
Hannes Laimer
30730d544c ui: disks: show partitions by default
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2022-06-15 10:59:38 +02:00
Hannes Laimer
be2604109d disks: use builder pattern for querying disk usage
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2022-06-15 10:59:34 +02:00
Hannes Laimer
6a6ba4cdac api2: disks endpoint return partitions
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2022-06-15 10:59:21 +02:00
Wolfgang Bumiller
a1896bffb6 remove outdated comment
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-14 13:00:14 +02:00
Stefan Sterz
9e8daa1d10 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>
2022-06-14 12:59:17 +02:00
Wolfgang Bumiller
a83283cdf5 bump proxmox-fuse dep to 0.1.3
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-13 15:12:07 +02:00
Wolfgang Bumiller
670534b0e3 bump d/control
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-13 10:05:44 +02:00
Dominik Csapak
f7ff48ded4 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>
2022-06-13 10:01:05 +02:00
Dominik Csapak
3d6b21bf05 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>
2022-06-13 10:01:05 +02:00
Dominik Csapak
173b479b08 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>
2022-06-13 10:01:05 +02:00
Dominik Csapak
4d397849b5 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>
2022-06-13 10:01:05 +02:00
Dominik Csapak
759c4c87af 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>
2022-06-13 10:01:05 +02:00
Dominik Csapak
9f30a31e53 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>
2022-06-13 10:01:05 +02:00
Dominik Csapak
db971bf298 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>
2022-06-13 09:57:16 +02:00
Stefan Sterz
3a8d54e81f 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>
2022-06-10 11:30:40 +02:00
Thomas Lamprecht
a73eafaa1f d/lintian-overrides: ignore some expected warnings
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-08 14:51:03 +02:00
Thomas Lamprecht
b80d7f95db bump version to 2.2.3-2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-08 14:23:25 +02:00
Thomas Lamprecht
b4bda79ac5 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>
2022-06-08 14:04:36 +02:00
Thomas Lamprecht
2d7ec3578b config: re-enable efficient mixed acl path/slice support
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-08 14:01:53 +02:00
Fabian Grünbichler
d8ec2a25ba 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>
2022-06-08 13:38:02 +02:00
Fabian Grünbichler
663165d662 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>
2022-06-08 11:26:36 +02:00
Thomas Lamprecht
87005234c6 cargo fmt/format variable inlining
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-07 14:35:00 +02:00
Thomas Lamprecht
ce9b00e7e3 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>
2022-06-07 14:29:50 +02:00
Thomas Lamprecht
72b550a836 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>
2022-06-07 14:12:02 +02:00
Thomas Lamprecht
74cad4a8bd tree wide: typo fixes through codespell
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-07 14:08:09 +02:00
Thomas Lamprecht
1e319bcb06 access: fix typo in RPC env wrong-type error
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-07 08:53:24 +02:00
Thomas Lamprecht
e7b0347eaa d/changelog: fix typos in historical entries
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-07 08:52:34 +02:00
Dominik Csapak
1cc73a43a3 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>
2022-06-07 08:42:22 +02:00
Thomas Lamprecht
5a2e6ccf77 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>
2022-06-05 16:59:57 +02:00
Thomas Lamprecht
f31e32a006 api: tape restore: some code cleanups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-05 16:55:13 +02:00
Thomas Lamprecht
2ad96e1635 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>
2022-06-05 16:47:27 +02:00
Thomas Lamprecht
7bc2e240b1 api: tape restore: use HumanByte for friendlier total/throughput reporting
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-05 10:45:13 +02:00
Thomas Lamprecht
20a04cf07c 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>
2022-06-05 10:42:47 +02:00
Thomas Lamprecht
a40ffb92ac code formatting fixups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-05 10:38:33 +02:00
Thomas Lamprecht
e2aeff40eb tape: use inline variable in formats for code reduction
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-05 10:38:33 +02:00
Thomas Lamprecht
d20137e5a9 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>
2022-06-05 10:34:10 +02:00
Thomas Lamprecht
6a35698796 bump version to 2.2.3-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-04 16:30:20 +02:00
Thomas Lamprecht
2981cdd4c0 api: datastore status: use cheaper any_privs_below over can_access_any_namespace
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-04 15:34:42 +02:00
Thomas Lamprecht
8c9c6c0755 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>
2022-06-04 15:34:42 +02:00
Thomas Lamprecht
2c69b69108 config: cached user info: expose new any_privs_below
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-04 15:29:45 +02:00
Thomas Lamprecht
0bed1f2956 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>
2022-06-04 15:29:45 +02:00
Thomas Lamprecht
4ef6b7d1f0 config: s/propagating/only_propagated/ and style nits
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-04 15:29:45 +02:00
Stefan Sterz
87d8aa4278 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>
2022-06-04 15:29:45 +02:00
Thomas Lamprecht
51d900d187 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>
2022-06-04 15:26:50 +02:00
Thomas Lamprecht
519ca9d010 datastore: make unsafe fn public again, useful for example/test
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-03 17:10:17 +02:00
Thomas Lamprecht
615a50c108 datastore: make unsafe functions only visible in their own crate
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-03 13:42:42 +02:00