]> git.proxmox.com Git - proxmox-backup.git/log
proxmox-backup.git
7 months agoremove needless borrows
Maximiliano Sandoval [Mon, 12 Feb 2024 13:17:28 +0000 (14:17 +0100)]
remove needless borrows

Fixes the clippy lint:

```
warning: the borrowed expression implements the required traits
   --> src/server/report.rs:193:47
    |
193 |                         get_directory_content(&path)
    |                                               ^^^^^ help: change this to: `path`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
    = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
7 months agoremove redundant guards
Maximiliano Sandoval [Mon, 12 Feb 2024 13:17:27 +0000 (14:17 +0100)]
remove redundant guards

Fixes the clippy lint:

```
warning: redundant guard
   --> pbs-datastore/src/chunk_store.rs:325:37
    |
325 |                     Err(ref err) if err == &nix::errno::Errno::ENOENT => {
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_guards
    = note: `#[warn(clippy::redundant_guards)]` on by default
help: try
    |
325 -                     Err(ref err) if err == &nix::errno::Errno::ENOENT => {
325 +                     Err(nix::errno::Errno::ENOENT) => {
    |
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
7 months agodocs: remove redundant explicit link target
Maximiliano Sandoval [Mon, 12 Feb 2024 13:17:26 +0000 (14:17 +0100)]
docs: remove redundant explicit link target

Fixes:

```
warning: redundant explicit link target
  --> src/tools/mod.rs:47:42
   |
47 | /// Returns a new instance of [`Client`](proxmox_http::client::Client) configured for PBS usage.
   |                                --------  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ explicit target is redundant
   |                                |
   |                                because label contains path that resolves to same destination
   |
   = note: when a link's destination is not specified,
           the label is used to resolve intra-doc links
   = note: `#[warn(rustdoc::redundant_explicit_links)]` on by default
help: remove explicit link target
   |
47 | /// Returns a new instance of [`Client`] configured for PBS usage.
   |                               ~~~~~~~~~~
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
7 months agofix #5229: tape: remove max sequence number limit
Dominik Csapak [Mon, 12 Feb 2024 12:27:34 +0000 (13:27 +0100)]
fix #5229: tape: remove max sequence number limit

The idea was to limit the number of tapes in a media set, but this was
not enforced when adding a medium to a media set, only on read/parsing
the inventory. With that, it is possible to create media sets greater
than the limit which in turn blocks access to most functions via
api/cli/gui due to the check.

Instead of enforcing an arbitrary limit, simply warn on creation when
the media-set is very large (20).

To restore the whole media set, the time taken would still be at least 38
hours for LTO-4 and 250 hours for LTO-9.

We already have a section in the docs where we tell about the
disadvantages of large media sets.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
7 months agofix #5190: api: OIDC: accept generic URIs for the ACR value
Gabriel Goller [Tue, 6 Feb 2024 10:09:07 +0000 (11:09 +0100)]
fix #5190: api: OIDC: accept generic URIs for the ACR value

Allow more complex strings for the acr-value when using openid. The
openid documentation only specifies the acr-value *should* be an URI
[0].  Implemented a regex that loosely disallows some of the reserved
URI characters specified in the RFC [1].

Currently values like:
- "urn:mace:incommon:iap:silver"
- "urn:comsolve.nl:idp:contract:rba:location"
do NOT work, although they are correct URI's and common acr tokens.

For Proxmox VE we had to actually make this more strict to align with
each other, as there we accepted any string.

[0]: https://openid.net/specs/openid-connect-core-1_0.html
[1]: https://www.rfc-editor.org/rfc/rfc2396.txt

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
7 months agotests: add oneOf schema support
Wolfgang Bumiller [Fri, 2 Feb 2024 14:07:38 +0000 (15:07 +0100)]
tests: add oneOf schema support

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
7 months agodocgen: add oneOf case to dump_schema
Wolfgang Bumiller [Fri, 14 Jul 2023 11:18:11 +0000 (13:18 +0200)]
docgen: add oneOf case to dump_schema

Since we additonally also support delcaring a "type" property for
`oneOf` schemas (to use with serde's *internally* tagged enum
representation, this contains an additional `typeProperty` and
`typeSchema` value.

It dumps as follows:
    {
        "type": "object",
        "description": ...,
        "typeProperty": "name-of-type-property",
        "typeSchema": {
            "type": "string",
            "enum": [ ... ], // technically not enforced by the code
        },
        "oneOf": [
            {
                "title": "<value from the above 'enum' array>",
                <schema>,
            },
            {
                "title": "<value from the above 'enum' array>",
                <schema>,
            },
            ... <one for each 'enum' above>
                // ^ exact match is not technically enforced by code
        }
    }

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
7 months agobump proxmox-schema dep to 3.0.0
Wolfgang Bumiller [Fri, 2 Feb 2024 13:27:27 +0000 (14:27 +0100)]
bump proxmox-schema dep to 3.0.0

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
7 months agobump version to 3.1.4-1
Thomas Lamprecht [Thu, 1 Feb 2024 15:30:31 +0000 (16:30 +0100)]
bump version to 3.1.4-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 months agotape: factor getting encryption fingerprint tuple out
Thomas Lamprecht [Thu, 1 Feb 2024 15:23:42 +0000 (16:23 +0100)]
tape: factor getting encryption fingerprint tuple out

makes it a bit more readable as there's less "noise" in the read_label
function and as the separate new fn allows us to nicely use ? to early
return as it has an option in the return signature avoiding 5 lines of
code while not really getting more terse.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 months agotape: fix regression in restoring key from medium
Dominik Csapak [Wed, 31 Jan 2024 13:42:33 +0000 (14:42 +0100)]
tape: fix regression in restoring key from medium

Since commit 1343dcaf we automatically try to load the key into the
drive after reading the media-set label, this cannot work for the case
where we actually restore the key from the tape itself.

To address this special case while preserving the automatic key
loading, everything except the setup of the key has been separated
from the 'read_label' method into a new function named
'read_label_without_loading_key'. Consequently, the 'restore-key' API
endpoint can be switched to utilize this new method, thereby avoiding
the issue.

Fixes: 1343dcaf ("tape: move 'set_encryption' calls to the TapeDriver")
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [ TL: reword and shorten commit message ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 months agotape: silence some warnings
Wolfgang Bumiller [Thu, 1 Feb 2024 12:54:18 +0000 (13:54 +0100)]
tape: silence some warnings

Nightly rustc now warns about unused private fields in the case of a
non-pub newtype struct, so use an underscore-prefixed dummy field name
to get rid of the warning.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
7 months agoremove `proxmox-rrd` crate
Lukas Wagner [Wed, 31 Jan 2024 15:24:36 +0000 (16:24 +0100)]
remove `proxmox-rrd` crate

The crate was split out and moved to the `proxmox` workspace.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
7 months agorrd_cache: use `proxmox-rrd` from `proxmox` workspace
Lukas Wagner [Wed, 31 Jan 2024 15:19:16 +0000 (16:19 +0100)]
rrd_cache: use `proxmox-rrd` from `proxmox` workspace

and use renamed structs from proxmox-rrd

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
[w.bumiller@proxmox.com: squash "and use renamed structs from proxmox-rrd" as build fix]
[w.bumiller@proxmox.com: bump d/control]
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
7 months agorun cargo fmt
Fabian Grünbichler [Tue, 30 Jan 2024 10:25:54 +0000 (11:25 +0100)]
run cargo fmt

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
7 months agofix: cargo local path
Gabriel Goller [Mon, 22 Jan 2024 11:46:00 +0000 (12:46 +0100)]
fix: cargo local path

Fixed the local path of `proxmox-acme` in the Cargo.toml file.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
7 months agoacme PluginConfig: add missing serde attributes
Dietmar Maurer [Wed, 24 Jan 2024 12:16:31 +0000 (13:16 +0100)]
acme PluginConfig: add missing serde attributes

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
7 months agobump version to 3.1.3-1
Thomas Lamprecht [Mon, 22 Jan 2024 14:21:02 +0000 (15:21 +0100)]
bump version to 3.1.3-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 months agodocs: tape: drop redefinition of systemd.time manpage link
Thomas Lamprecht [Mon, 22 Jan 2024 15:11:08 +0000 (16:11 +0100)]
docs: tape: drop redefinition of systemd.time manpage link

included in the always sourced epilog nowadays.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 months agodocs: tape: fix wrong underline length in LTO-9 section
Thomas Lamprecht [Mon, 22 Jan 2024 15:10:51 +0000 (16:10 +0100)]
docs: tape: fix wrong underline length in LTO-9 section

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 months agodocs: remotes: fix missing newline between list and admonition-note
Thomas Lamprecht [Mon, 22 Jan 2024 15:07:54 +0000 (16:07 +0100)]
docs: remotes: fix missing newline between list and admonition-note

Fixes: f93cbdae ("docs: document new include/exclude paramenter")
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 months agod/lintian-overrides: ignore pbs2to3 using dpkg database directly
Thomas Lamprecht [Mon, 22 Jan 2024 14:45:33 +0000 (15:45 +0100)]
d/lintian-overrides: ignore pbs2to3 using dpkg database directly

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 months agotape: drop unused has_encryption helper
Thomas Lamprecht [Mon, 22 Jan 2024 13:42:28 +0000 (14:42 +0100)]
tape: drop unused has_encryption helper

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 months agotape: remove unused methods of LtoTapeHandle
Dominik Csapak [Mon, 22 Jan 2024 11:50:35 +0000 (12:50 +0100)]
tape: remove unused methods of LtoTapeHandle

in preparation of making it not public anymore

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
7 months agotape: assert encryption mode when using the PoolWriter
Dominik Csapak [Mon, 22 Jan 2024 11:50:34 +0000 (12:50 +0100)]
tape: assert encryption mode when using the PoolWriter

by introducing an 'assert_encryption_mode' that checks the desired
state, and bails out if it's different, called directly where we
previously set the encryption mode (which is now done automatically)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [ TL: add drive_ prefix and fleece in comment ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 months agotape: move 'set_encryption' calls to the TapeDriver (and implementation)
Dominik Csapak [Mon, 22 Jan 2024 11:50:33 +0000 (12:50 +0100)]
tape: move 'set_encryption' calls to the TapeDriver (and implementation)

namely everytime we know what the key for the tape has to be:
* after we write the MediaSetLabel
* after reading the MediaSetLabel

When handling data on tape, we always have to have the MediaSetLabel, so
we should always trigger one of these. Because of that, we should not be
able to forget to set the encryption mode.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
7 months agotape: fix wrongly unloading encryption key
Dominik Csapak [Mon, 22 Jan 2024 11:50:32 +0000 (12:50 +0100)]
tape: fix wrongly unloading encryption key

For security, we want to automatically unload the encryption key from
the drive when we're done, so there was a Drop handler for SgTape that
handles that. Sadly, our tool we use to set it in the first place, also
invoked the Drop handler, thus unloading the keys again immediately

To fix that, move the Drop handler one logical level higher to the
LtoTapeHandle, which is not used by the 'sg-tape-cmd'.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
7 months agotape: don't call sg-tape-cmd for unloading encryption keys
Dominik Csapak [Mon, 22 Jan 2024 11:50:31 +0000 (12:50 +0100)]
tape: don't call sg-tape-cmd for unloading encryption keys

since sg-tape-cmd is only necessary if we want to load the key, we don't
have to call it when we don't have one.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
7 months agotape: use SgTape in sg-tape-cmd
Dominik Csapak [Mon, 22 Jan 2024 11:50:30 +0000 (12:50 +0100)]
tape: use SgTape in sg-tape-cmd

instead of LtoTapeHandle. This way, we can simply always call the binary
from LtoTapeHandle, and don't have to concern ourselves with the sg_tape
calling.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
7 months agotape: move key deriving into SgTape
Dominik Csapak [Mon, 22 Jan 2024 11:50:28 +0000 (12:50 +0100)]
tape: move key deriving into SgTape

makes the boundary a bit clearer, introduce 'load_key' to load a single
key from the key config

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
7 months agotape: provide 'open_lto_drive' methods for LtoTapeHandle and SgTape
Dominik Csapak [Mon, 22 Jan 2024 11:50:27 +0000 (12:50 +0100)]
tape: provide 'open_lto_drive' methods for LtoTapeHandle and SgTape

Prepares for the use in sg-tape-cmd, since we want to use the SgTape
directly instead of LtoTapeHandle.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
7 months agotape: improve function naming
Dominik Csapak [Mon, 22 Jan 2024 11:50:26 +0000 (12:50 +0100)]
tape: improve function naming

rename the inner 'set_encryption' in sg_tape to drive_set_encryption,
so that it's a bit clearer where it comes from.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
8 months agoclient: drop unused code
Wolfgang Bumiller [Fri, 19 Jan 2024 09:56:46 +0000 (10:56 +0100)]
client: drop unused code

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
8 months agocleanup more unnecesary allocations
Wolfgang Bumiller [Fri, 19 Jan 2024 09:51:17 +0000 (10:51 +0100)]
cleanup more unnecesary allocations

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
8 months agocleanup unnecessary allocation
Wolfgang Bumiller [Fri, 19 Jan 2024 09:49:02 +0000 (10:49 +0100)]
cleanup unnecessary allocation

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
8 months agoclose #4819: ui: allow usernames shorter than 4 characters
Gabriel Goller [Wed, 17 Jan 2024 14:29:08 +0000 (15:29 +0100)]
close #4819: ui: allow usernames shorter than 4 characters

This already works in pve and is also possible in pbs when using the
`proxmox-backup-manager user create` command.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
8 months agorun cargo fmt
Thomas Lamprecht [Thu, 18 Jan 2024 15:35:59 +0000 (16:35 +0100)]
run cargo fmt

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 months agoapi: custom certificate upload: make key optional
Dietmar Maurer [Thu, 18 Jan 2024 13:15:33 +0000 (14:15 +0100)]
api: custom certificate upload: make key optional

Use the existing key, if it's not specified, just like we do in the
PVE API.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 months agoreport: change output contract of functions
Thomas Lamprecht [Thu, 18 Jan 2024 14:13:32 +0000 (15:13 +0100)]
report: change output contract of functions

let them manage it completely themselves, as we cannot really say if a
code-block fits for the whole output, like it was the case for the
function that returned a limited output of a 'top' process status
command.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 months agoCertificateInfo: make filename non-optional
Dietmar Maurer [Tue, 16 Jan 2024 13:14:13 +0000 (14:14 +0100)]
CertificateInfo: make filename non-optional

It is used as idProperty in the GUI.

8 months agoCertificateInfo: make fields public
Dietmar Maurer [Tue, 16 Jan 2024 09:56:09 +0000 (10:56 +0100)]
CertificateInfo: make fields public

This is used in a public API, so fields needs to be public.

8 months agofix serde attributes for CertificateInfo
Dietmar Maurer [Mon, 15 Jan 2024 12:07:24 +0000 (13:07 +0100)]
fix serde attributes for CertificateInfo

skip_serializing_if fingerprint is none...

8 months agoui: tape: add remove media button
Dominik Csapak [Thu, 11 Jan 2024 10:40:36 +0000 (11:40 +0100)]
ui: tape: add remove media button

this only removes media from the inventory, it does not touch the data

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
8 months agoui: tape inventory: use uuid as id
Dominik Csapak [Thu, 11 Jan 2024 10:40:35 +0000 (11:40 +0100)]
ui: tape inventory: use uuid as id

and add it as a hidden column. This now displays all tapes even if there
are some with identical label-texts.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
8 months agoapi: tape: don't allow duplicate media label-texts
Dominik Csapak [Thu, 11 Jan 2024 10:40:34 +0000 (11:40 +0100)]
api: tape: don't allow duplicate media label-texts

quite a few parts of our code assumes that the label-text is unique in
the inventory, which leads to rather unexpected behaviour when having
more than one tape with the same label-text, e.g. a
`proxmox-tape media destroy <LABEL>`
destroys the first one in the config
(same with moving to vault, etc.)

since having multiple tapes with the same human readable name is always
confusing, simply disallow that here

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
8 months agoapi: tape: optinally accept uuid for destroy/move media
Dominik Csapak [Thu, 11 Jan 2024 10:40:33 +0000 (11:40 +0100)]
api: tape: optinally accept uuid for destroy/move media

so we can uniquely identify the tapes with duplicate labels.
The change is intended to be backwards compatible.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
8 months agotape: handle duplicate label-texts in inventory
Dominik Csapak [Thu, 11 Jan 2024 10:40:32 +0000 (11:40 +0100)]
tape: handle duplicate label-texts in inventory

find_media_by_label_text assumes that the label-texts are unique, but
currently this is not necessarily the case. To properly handle that,
change the signature to return a result, and in case there are duplicate
ones, return an error.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
8 months agobump proxmox-sys/time to dependency
Wolfgang Bumiller [Wed, 10 Jan 2024 09:44:27 +0000 (10:44 +0100)]
bump proxmox-sys/time to dependency

so Date header formatting uses the C locale

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
8 months agodatastore: add additional context for get_owner parsing error
Christian Ebner [Tue, 9 Jan 2024 17:13:05 +0000 (18:13 +0100)]
datastore: add additional context for get_owner parsing error

By this it becomes clear that the error stems from a parsing error when
getting the backup group owner.

See also: https://forum.proxmox.com/threads/139482/

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
8 months agocleanup manual unwrap_or_default()
Wolfgang Bumiller [Thu, 4 Jan 2024 12:23:57 +0000 (13:23 +0100)]
cleanup manual unwrap_or_default()

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
8 months agomove api-types tests to api-types and drop vec![] macro
Wolfgang Bumiller [Thu, 4 Jan 2024 11:10:12 +0000 (12:10 +0100)]
move api-types tests to api-types and drop vec![] macro

we don't need to allocate here

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
8 months agoapi-types: doc improvements
Wolfgang Bumiller [Thu, 4 Jan 2024 10:06:01 +0000 (11:06 +0100)]
api-types: doc improvements

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
8 months agoapi-types: impl Display for FilterType
Wolfgang Bumiller [Thu, 4 Jan 2024 10:05:51 +0000 (11:05 +0100)]
api-types: impl Display for FilterType

as the previous commit: simply keep the previous Display impl and call
it from out of the new GroupFilter impl

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
8 months agoapi-types: factor out FilterType parsing
Wolfgang Bumiller [Thu, 4 Jan 2024 09:20:16 +0000 (10:20 +0100)]
api-types: factor out FilterType parsing

simply keep the previous FromStr implementation and call it the new
GroupFilter impl

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
8 months agofixup import grouping
Wolfgang Bumiller [Thu, 4 Jan 2024 09:17:02 +0000 (10:17 +0100)]
fixup import grouping

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
8 months agotests: check if include/exclude behavior works correctly
Philipp Hufnagl [Tue, 2 Jan 2024 11:06:55 +0000 (12:06 +0100)]
tests: check if include/exclude behavior works correctly

This checks if including and excluding works as expected. That the
filter are added out of order is on purpose since it sould make no
difference.

Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
8 months agodocs: document new include/exclude paramenter
Philipp Hufnagl [Tue, 2 Jan 2024 11:06:54 +0000 (12:06 +0100)]
docs: document new include/exclude paramenter

Adding the newly introduced optional include/exclude parameter to the
PBS documentation.

Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
8 months agoui: Show if Filter includes or excludes
Philipp Hufnagl [Tue, 2 Jan 2024 11:06:53 +0000 (12:06 +0100)]
ui: Show if Filter includes or excludes

To make the UI compatible, the Group Filter dialogue has been extended
by a second list, so it now features a list for all include filter and
one for all exclude filters.

Internally, all include as well as exclude filter are managed into one
list. The 2 list view is just for a cleaner representation in the UI.

Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
8 months agofix #4315: jobs: modify GroupFilter so include/exclude is tracked
Philipp Hufnagl [Tue, 2 Jan 2024 11:06:52 +0000 (12:06 +0100)]
fix #4315: jobs: modify GroupFilter so include/exclude is tracked

After some discussion I canged the include/exclude behavior to first run
all include filter and after that all exclude filter (rather then
allowing to alternate inbetween). This is done by splitting them into 2
lists, running include first.

A lot of discussion happened how edge cases should be handled and we
came to following conclusion:

no include filter + no exclude filter => include all
some include filter + no exclude filter => filter as always
no include filter +  some exclude filter => include all then exclude

Since a GroupFilter now also features an behavior, the Struct has been
renamed To GroupType (since simply type is a keyword). The new
GroupFilter now has a behaviour as a flag 'is_exclude'.

I considered calling it 'is_include' but a reader later then might not
know what the opposite of 'include' is (do not include?  deactivate?). I
also considered making a new enum 'behaviour' but since there are only 2
values I considered it over engeneered.

Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
8 months agoreport: add prune.cfg to report
Stefan Lendl [Thu, 4 Jan 2024 11:10:30 +0000 (12:10 +0100)]
report: add prune.cfg to report

prune.cfg stores prune job configurations

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
8 months agotape: work around buggy changer implementations
Dominik Csapak [Wed, 13 Dec 2023 09:00:26 +0000 (10:00 +0100)]
tape: work around buggy changer implementations

allocation length for read element status is a 3 byte field, but it
seems some changers only look at the bottom two bytes. Since we used
0x010000 for it, those changers did not return any data and the calls
failed.

To work around it, request one byte less (0xFFFF) which should still be
enough for the data, but should now work with those buggy
implementations.

Reported by a user in the forum: https://forum.proxmox.com/threads/137391/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 months agodebian: add gdisk package
Gabriel Goller [Thu, 30 Nov 2023 16:07:28 +0000 (17:07 +0100)]
debian: add gdisk package

The gdisk package contains the `sgdisk` command, which gets used when
initializing a disk with gpt.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
9 months agofix #5117: ui: node info: avoid invalid array access for certain foreign kernels
Fiona Ebner [Thu, 14 Dec 2023 10:40:24 +0000 (11:40 +0100)]
fix #5117: ui: node info: avoid invalid array access for certain foreign kernels

with custom build date format, which would prevent the panel from loading.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
9 months agotape: move 'eject-before-unload' to a plain changer config option
Dominik Csapak [Thu, 14 Dec 2023 09:05:19 +0000 (10:05 +0100)]
tape: move 'eject-before-unload' to a plain changer config option

instead of having it in a property string. For now this should be fine,
and if we need many more such options, we can still move them into a
property string if we want.

Also update the cli command in the docs on how to set it now.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 months agodocs: tape: add lto 9 considerations
Dominik Csapak [Tue, 12 Dec 2023 14:34:25 +0000 (15:34 +0100)]
docs: tape: add lto 9 considerations

LTO-9 requires a bit of special handling while formatting/first use, so
document that, so nobody is suprised by this behaviour.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 months agodocs: tape: document advanced changer options
Dominik Csapak [Tue, 12 Dec 2023 14:34:24 +0000 (15:34 +0100)]
docs: tape: document advanced changer options

there is currently only one, but describe what it does and how to set
options in general.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 months agodocs: tape: replace 'export-media' with 'export-media-set'
Dominik Csapak [Tue, 12 Dec 2023 14:34:23 +0000 (15:34 +0100)]
docs: tape: replace 'export-media' with 'export-media-set'

there is no 'export-media' option, only 'export-media-set'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 months agotape: fix 'eject-before-unload' api type
Dominik Csapak [Wed, 13 Dec 2023 10:11:12 +0000 (11:11 +0100)]
tape: fix 'eject-before-unload' api type

by converting the bool into an option, otherwise having the options not
set at all will fail the unload while deserializing with
'eject-before-unload is not optional'

Also if we can automatically decide this in the future, we can now
detect if the option was explicitely set or not.

Fixes: 66402cdc ("fix #4904: tape changer: add option to eject before unload")
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 months agofix #4904: tape changer: add option to eject before unload
Dominik Csapak [Thu, 7 Dec 2023 12:51:02 +0000 (13:51 +0100)]
fix #4904: tape changer: add option to eject before unload

some tape libraries need the tape being ejected from the drive before
doing an unload. Since we cannot easily detect if that's the case,
introduce an 'eject_before_unload' option.

Instead of just adding a bool flag to the config, add a new 'options'
property string where we can put such niche options similar to how we
handle the datastore tuning options.

Extend the LtoTapeHandle with 'medium_present' which just uses a
TEST UNIT READY command to check for present medium, so we don't
try to eject an already ejected tape.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 months agotape: changer: save whole LtoTapeDrive config in MtxMediaChanger
Dominik Csapak [Thu, 7 Dec 2023 12:51:01 +0000 (13:51 +0100)]
tape: changer: save whole LtoTapeDrive config in MtxMediaChanger

we'll need more info from there in the future, so derive clone for it
and save the whole config instead of adding an additional field.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 months agotape: derive Debug for ElementType (fix previous commit)
Dietmar Maurer [Tue, 12 Dec 2023 13:20:42 +0000 (14:20 +0100)]
tape: derive Debug for ElementType (fix previous commit)

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
9 months agotape: improve error on decode element status page
Dominik Csapak [Wed, 6 Dec 2023 08:17:54 +0000 (09:17 +0100)]
tape: improve error on decode element status page

instead of wrapping the function body in a 'try_block', simply move the
map_err to the only call site, where we can even add more context than
in the function itself.

aside from better error output, no functional change intended

this could help in debugging cases like this issue reported in the forum:
https://forum.proxmox.com/threads/137391/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 months agoapi: tape: add lto9 initialization message to task log
Dominik Csapak [Tue, 12 Dec 2023 11:32:48 +0000 (12:32 +0100)]
api: tape: add lto9 initialization message to task log

so that it's clear that this operation can take a while

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 months agotape: adapt format_media for LTO9+
Dominik Csapak [Tue, 12 Dec 2023 11:32:47 +0000 (12:32 +0100)]
tape: adapt format_media for LTO9+

starting with LTO9, a FORMAT(04h) command also reinitializates the tape,
which can take up to tw hours. Since we don't actually want to do that
every time we format, use 'erase_media' when we want a fast erase.
(On a slow erase, we let it run and wait until the drive is ready
again).

The users have to pre-initializate the tapes before using it for them to
work properly though.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 months agotape: derive PartialEq and PartialOrd for TapeDensity
Dominik Csapak [Tue, 12 Dec 2023 11:32:46 +0000 (12:32 +0100)]
tape: derive PartialEq and PartialOrd for TapeDensity

so that we can compare more easily

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 months agotape: add optional timeout to wait_until_ready
Dominik Csapak [Tue, 12 Dec 2023 11:32:45 +0000 (12:32 +0100)]
tape: add optional timeout to wait_until_ready

instead of hardcodign the default timeout as only option. This will come
in handy when we need to wait for LTO9+ initialization that can take up
to two hours.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 months agostatus: use Option on avail/used datastore attrs
Gabriel Goller [Mon, 11 Dec 2023 08:59:02 +0000 (09:59 +0100)]
status: use Option on avail/used datastore attrs

Instead of returning -1 if we can't get the attributes, we use an
Option which will not be serialized on `None`.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
9 months agoui: datastore summary handle non-existent values
Gabriel Goller [Mon, 11 Dec 2023 08:59:01 +0000 (09:59 +0100)]
ui: datastore summary handle non-existent values

Correctly display missing 'avail' and 'used' attributes in the
datatstore summary. This simply sets it to 0, so that we don't get any
errors in the console.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
9 months agoapi-types: add a missing serde(default)
Wolfgang Bumiller [Wed, 6 Dec 2023 14:53:57 +0000 (15:53 +0100)]
api-types: add a missing serde(default)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
9 months agobump d/control
Wolfgang Bumiller [Wed, 6 Dec 2023 12:22:17 +0000 (13:22 +0100)]
bump d/control

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
9 months agofixup comment and condition readability
Wolfgang Bumiller [Wed, 6 Dec 2023 11:58:09 +0000 (12:58 +0100)]
fixup comment and condition readability

(not macro specific)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
9 months agocli: acme: add possibility to set eab via the cli
Folke Gleumes [Tue, 14 Nov 2023 14:14:04 +0000 (15:14 +0100)]
cli: acme: add possibility to set eab via the cli

If the ca demands external account binding credentials, the user will be
asked for them. If a custom directory is used, the user will be asked if
eab should be used.

Signed-off-by: Folke Gleumes <f.gleumes@proxmox.com>
9 months agoacme: api: add eab options to api
Folke Gleumes [Tue, 14 Nov 2023 14:14:03 +0000 (15:14 +0100)]
acme: api: add eab options to api

Optionally allow for setting external account binding credentials at the
account registration endpoint.

Signed-off-by: Folke Gleumes <f.gleumes@proxmox.com>
9 months agoupdate to proxmox-acme 0.5
Wolfgang Bumiller [Wed, 6 Dec 2023 11:45:35 +0000 (12:45 +0100)]
update to proxmox-acme 0.5

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
9 months agotools/disks: skip lsblk for partition check
Wolfgang Bumiller [Wed, 29 Nov 2023 16:20:30 +0000 (17:20 +0100)]
tools/disks: skip lsblk for partition check

We already have a 'Disk' which has a udev 'Device' which we can query
directly.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
9 months agoadd partition entry value getters to Disk
Wolfgang Bumiller [Wed, 29 Nov 2023 16:19:10 +0000 (17:19 +0100)]
add partition entry value getters to Disk

The ID_PART_ENTRY_* values describe what kind of partition this is and
thus can be used to implement the `.is_partition()` method which we
use in the next patch to avoid calling out to `lsblk`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
9 months agobump version to 3.1.2-1 v3.1.2
Thomas Lamprecht [Thu, 30 Nov 2023 10:56:54 +0000 (11:56 +0100)]
bump version to 3.1.2-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agosync: fix source store+namespace printing
Fabian Grünbichler [Thu, 30 Nov 2023 10:50:39 +0000 (11:50 +0100)]
sync: fix source store+namespace printing

previously this would always refer to the "top" namespace of the source,
instead of properly iterating over the namespace tree. adapt the trait
accordingly, since this was the only call site.

this fixes a cosmetic issue only.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
9 months agosync: fix recursive remote sync
Fabian Grünbichler [Thu, 30 Nov 2023 10:42:53 +0000 (11:42 +0100)]
sync: fix recursive remote sync

the snapshot pulling code always selected the "top" namespace of the
source, instead of the passed in namespace parameter.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
9 months agobump version to 3.1.1-1
Thomas Lamprecht [Thu, 30 Nov 2023 10:05:08 +0000 (11:05 +0100)]
bump version to 3.1.1-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agoui: fix deleting datastore without 'keep-job-configs'
Dominik Csapak [Thu, 30 Nov 2023 08:49:03 +0000 (09:49 +0100)]
ui: fix deleting datastore without 'keep-job-configs'

without any default value in the viewModel, the resulting url would be:

`<id>?destroy-data=<value>&keep-job-configs=`

which is missing the actual value, so add the default

Fixes: e9979a1a ("ui: add 'keep configs' checkbox to datastore removal window")
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Fiona Ebner <f.ebner@proxmox.com>
9 months agotree-wide: fix various typos
Thomas Lamprecht [Wed, 29 Nov 2023 17:32:06 +0000 (18:32 +0100)]
tree-wide: fix various typos

found with codespell

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agobump version to 3.1.0-1
Thomas Lamprecht [Wed, 29 Nov 2023 16:55:27 +0000 (17:55 +0100)]
bump version to 3.1.0-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agoui: dashboard: increase panel height a bit
Thomas Lamprecht [Wed, 29 Nov 2023 16:52:18 +0000 (17:52 +0100)]
ui: dashboard: increase panel height a bit

to make the system load/status summary one look less cramped, as that
got recently the boot-mode information line added.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agoserver: sync email notification: adapt template for local sync jobs
Lukas Wagner [Wed, 29 Nov 2023 16:35:12 +0000 (17:35 +0100)]
server: sync email notification: adapt template for local sync jobs

Add a guard clause that checks `job.remote`, otherwise the template
fails to render to to handlebars being configured in strict mode.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
9 months agodocs: note that the webui has a show connection information button
Dominik Csapak [Wed, 29 Nov 2023 15:49:52 +0000 (16:49 +0100)]
docs: note that the webui has a show connection information button

so that users know where they can easily copy that information

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 months agoui: add fingerprint also to the 'show connection information' window
Dominik Csapak [Wed, 29 Nov 2023 15:49:51 +0000 (16:49 +0100)]
ui: add fingerprint also to the 'show connection information' window

by globally calling the 'status' api once and saving the fingerprint
into the global Proxmox variable.

since not all users might have that permission, ignore errors for that,
and don't show the fingerprint in this case

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 months agoui: add 'show connection information' button for datastores
Dominik Csapak [Wed, 29 Nov 2023 15:49:50 +0000 (16:49 +0100)]
ui: add 'show connection information' button for datastores

this has a similar functionality as the 'show fingerprint' button,
but for repository strings that are needed e.g. for the cli

included with and without the current user for convenience

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [ TL: squash in window title rename and iconCls fix for light-mode ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agoui: datastore content: add menu separator above forget entry
Thomas Lamprecht [Wed, 29 Nov 2023 16:05:38 +0000 (17:05 +0100)]
ui: datastore content: add menu separator above forget entry

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agofix an unused import warning
Wolfgang Bumiller [Wed, 29 Nov 2023 14:34:43 +0000 (15:34 +0100)]
fix an unused import warning

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>