251 Commits

Author SHA1 Message Date
Christoph Heiss
c7051f3342 api: access: add routes for managing AD realms
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Lukas Wagner <l.wagner@proxmox.com>
2024-04-24 21:06:14 +02:00
Lukas Wagner
89ef8b5035 api-types: api: tape: add notification-mode parameter
Same as with datastores, this option determines whether we send
notifications the old way (send email via sendmail to a user's email
address) or the new way (emit matchable notification events to the
notification stack).

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Gabriel Goller <g.goller@proxmox.com>
Reviewed-by: Gabriel Goller <g.goller@proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-23 23:14:46 +02:00
Lukas Wagner
7b668dbc2b api-types: api: datatore: add notification-mode parameter
This one lets the user choose between the old notification behavior
(selecting an email address/user and always/error/never behavior per
datastore) and the new one (emit notification events to the
notification system)

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Gabriel Goller <g.goller@proxmox.com>
Reviewed-by: Gabriel Goller <g.goller@proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-23 23:14:46 +02:00
Fabian Grünbichler
3ae21d87c1 GC: flatten existing status into job status
to avoid drifting definitions and reduce duplication. with the next major
release, the 'upid' field could then be renamed and aliased to be in line with
the other jobs, which all use 'last-run-upid'. doing it now would break
existing callers of the GC status endpoint (or consumers of the on-disk status
file).

the main difference is that the GC status fields are now not optional (except
for the UPID) in the job status, since flattening an optional value is not
possible. this only affects datastores that were never GCed at all, and only
direct API consumers, since the UI handles those fields correctly.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-04-22 13:58:08 +02:00
Stefan Lendl
fe1d34d2e4 api: garbage collect job status
Adds an api endpoint on the datastore that reports the gc job status
such as:
 - Schedule
 - State (of last run)
 - Duration (of last run)
 - Last Run
 - Next Run (if scheduled)
 - Pending Chunks (of last run)
 - Pending Bytes (of last run)
 - Removed Chunks (of last run)
 - Removed Bytes (of last run)

Adds a dedicated endpoint admin/gc that reports gc job status for all
datastores including the onces without a gc-schedule.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Originally-by: Gabriel Goller <g.goller@proxmox.com>
Tested-by: Gabriel Goller <g.goller@proxmox.com>
Reviewd-by: Gabriel Goller <g.goller@proxmox.com>
Tested-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2024-04-22 13:58:08 +02:00
Dietmar Maurer
50c0246a89 api: assert that maintenance mode transitions are valid
Maintenance mode Delete locks the datastore. It must not be possible to go
back to normal modes, because the datastore may be in undefined state.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2024-04-22 12:19:22 +02:00
Dietmar Maurer
7767c7cfd5 maintenance: derive Copy for maintenance type and make maintenance mode fields public
Because it is a public api type.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2024-04-22 12:19:22 +02:00
Dietmar Maurer
81904b652c pbs-api-types: use SchemaDeserializer for maintenance mode
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2024-04-22 12:19:22 +02:00
Hannes Laimer
9cba51ac78 datastore: remove datastore from internal cache based on maintenance mode
We keep a DataStore cache, so ChunkStore's and lock files are kept by
the proxy process and don't have to be reopened every time. However,
for specific maintenance modes, e.g. 'offline', our process should not
keep file in that datastore open. This clears the cache entry of a
datastore if it is in a specific maintanance mode and the last task
finished, which also drops any files still open by the process.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
Reviewed-by: Gabriel Goller <g.goller@proxmox.com>
Tested-by: Gabriel Goller <g.goller@proxmox.com>
2024-03-25 16:12:41 +01:00
Wolfgang Bumiller
708d5bdaf9 cargo fmt (import reordering)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-20 11:13:13 +01:00
Dietmar Maurer
2416aea8d4 pbs-api-types: use const_format and new api-types from proxmox-schema
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2024-03-20 11:09:26 +01:00
Gabriel Goller
e0222ce83c 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>
2024-02-08 18:14:30 +01:00
Wolfgang Bumiller
3a45719ecf 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>
2024-01-10 10:13:45 +01:00
Wolfgang Bumiller
64dec8d6f0 api-types: doc improvements
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-01-10 10:13:45 +01:00
Wolfgang Bumiller
126cf33c76 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>
2024-01-10 10:13:45 +01:00
Wolfgang Bumiller
4f0dd33704 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>
2024-01-10 10:13:45 +01:00
Wolfgang Bumiller
bc9509ad14 fixup import grouping
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-01-10 10:13:45 +01:00
Philipp Hufnagl
59c9273698 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>
2024-01-10 10:13:45 +01:00
Dominik Csapak
c7321e2ea3 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>
2023-12-14 10:23:49 +01:00
Dominik Csapak
667ec4a3c2 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>
2023-12-13 12:14:33 +01:00
Dominik Csapak
66402cdc1b 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>
2023-12-12 14:36:19 +01:00
Dominik Csapak
d555c3839b 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>
2023-12-12 14:36:08 +01:00
Dominik Csapak
70706fc9f6 tape: derive PartialEq and PartialOrd for TapeDensity
so that we can compare more easily

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2023-12-12 13:24:58 +01:00
Gabriel Goller
cbb478fa19 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>
2023-12-11 13:09:13 +01:00
Wolfgang Bumiller
1e3ed74be5 api-types: add a missing serde(default)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-12-06 15:53:57 +01:00
Thomas Lamprecht
6685122c3b tree-wide: fix various typos
found with codespell

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-29 18:32:07 +01:00
Gabriel Goller
de99031e49 node: status: declutter kernel-version
Return a struct with all the components of the kernel version like it
has been done in pve. Also return the legacy `kversion` to keep
backwards compat.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
Tested-by: Lukas Wagner <l.wagner@proxmox.com>
2023-11-29 15:31:35 +01:00
Gabriel Goller
1656c53486 node: status: added bootmode
Added field that shows the bootmode of the node. The bootmode is either
Legacy Bios, EFI, or EFI (Secure Boot). To detect the mode we use the
exact same method as in pve: We check if the `/sys/firmware/efi` folder
exists, then check if the `SecureBoot-xx...` file in the `efivars`
directory has the SecureBoot flag enabled.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
Tested-by: Lukas Wagner <l.wagner@proxmox.com>
2023-11-29 15:31:35 +01:00
Markus Frank
1ec643ce92 api types: add regex, format & schema for partition names
The new regex is similar to BLOCKDEVICE_NAME_REGEX but also allows
numbers at the end of the device name (also allows partitions names).
For nvme partitions it also allows the letter p and a number.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
2023-11-28 18:24:12 +01:00
Thomas Lamprecht
6c5248fbc6 tree-wide: run cargo fmt
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-27 15:37:35 +01:00
Maximiliano Sandoval R
dfe17914cf fix-3211: manager: Document --notify argument
Signed-off-by: Maximiliano Sandoval R <m.sandoval@proxmox.com>
2023-11-27 15:33:51 +01:00
Hannes Laimer
4ec733279b api: make Remote for SyncJob optional
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Tested-by: Gabriel Goller <g.goller@proxmox.com>
2023-11-25 17:07:42 +01:00
Dietmar Maurer
d1f438f51e pbs-api-types: derive Clone and PartialEq for BackupContent, SnapshotVerifyState, SnapshotListItem and GroupListItem
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-11-23 09:53:30 +01:00
Dietmar Maurer
e050aa187b PruneJobConfig: remove stale optional flag from the API macro.
The property is not optional - it is defined as "String".

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-11-16 17:47:38 +01:00
Dietmar Maurer
65c9e40695 pbs-api-types: derive Clone and PartialEq for job config/status types (for GUI)
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-11-15 16:37:44 +01:00
Fabian Grünbichler
07f321ddb4 apt: use apt changelog for changelog fetching
support for it got added to Proxmox repositories, so there is no need to use
custom logic and manual fetching for this anymore.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-11-14 08:43:47 +01:00
Dietmar Maurer
3d342e13d3 DatastoreTuning: fix serde attributes
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-11-12 12:02:19 +01:00
Dietmar Maurer
ded3a88888 DatastoteNotify: fix serde attributes
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-11-12 11:25:09 +01:00
Dietmar Maurer
3b7a6b25c1 TrafficControlCurrentRate: derive Clone and PartalEq (for GUI)
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-10-15 11:09:42 +02:00
Dietmar Maurer
1a1870ba86 move TrafficControlCurrentRate to pbs-api-types
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-10-15 11:07:58 +02:00
Dietmar Maurer
13984bd1bc TrafficControlRule: derive Clone and PartialEq (for GUI) 2023-10-15 09:25:26 +02:00
Dietmar Maurer
247ae35019 Interface: add missing serde skip_serializing_if to bond_xmit_hash_policy
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-10-12 12:39:18 +02:00
Dietmar Maurer
8192c9ea56 Interface: fix deserialize (add default)
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-10-11 11:38:01 +02:00
Dietmar Maurer
9c73fcf3cf Interface: derive Clone + PartialEq (for GUI)
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-10-11 11:37:15 +02:00
Dietmar Maurer
4a33ad1ca5 move MetricServerInfo definition to pbs-api-types
And derive Clone, Eq and Ord so that we can sort the list in the GUI.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-10-09 08:19:08 +02:00
Dietmar Maurer
6d33fb6fe3 pbs-api-types: move node status types from src/api2/types/mod.rs
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-09-28 08:13:30 +02:00
Dietmar Maurer
ac5e632f2f AclListItem: derive Clone and PartialEq
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-09-02 16:24:45 +02:00
Dietmar Maurer
fb1c262f9c TaskListItem: derive Clone and PartialEq 2023-08-30 13:34:51 +02:00
Stefan Sterz
a24d24cf9e fix: api-types: add support for lto 9 tape density
lto 9 tapes have a new density code which leads to these tapes not
being recognized properly. add the new density code and TapeDensity to
improve lto 9 support. since the documentation states that we support
lto 5 and above this constitutes a bug fix for lto 9 support.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2023-08-11 08:52:50 +02:00
Christoph Heiss
5a76907b06 api-types: drop unused leftover file
Commit d97ff8ae ("use new auth api crate") moved all auth-related code
into it's own crate inside the `proxmox` repo, including this file. Thus
drop it here, it's not even included in the compile.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-08-08 12:00:09 +02:00