]> git.proxmox.com Git - proxmox-backup.git/log
proxmox-backup.git
5 weeks agoGC status: reduce code duplication
Fabian Grünbichler [Mon, 22 Apr 2024 11:21:42 +0000 (13:21 +0200)]
GC status: reduce code duplication

the schedule handling is the same whether there was a last run or not, so let's
do it once and not twice. the duration can be stored right away, instead of
using an intermediate variable.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
5 weeks agoui: don't re-calculate GC duration
Fabian Grünbichler [Mon, 22 Apr 2024 09:44:49 +0000 (11:44 +0200)]
ui: don't re-calculate GC duration

it is returned by the API anyway

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
5 weeks agoapi: merge garbage-collection-status and -job-status
Fabian Grünbichler [Mon, 22 Apr 2024 09:43:51 +0000 (11:43 +0200)]
api: merge garbage-collection-status and -job-status

the latter was newly introduced, and they both return basically the same
information now. the new extended (job) status struct is a strict superset of
the old status struct, so this is not a breaking change API wise.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
5 weeks agoGC: flatten existing status into job status
Fabian Grünbichler [Mon, 22 Apr 2024 09:02:57 +0000 (11:02 +0200)]
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>
5 weeks agoui: gc view: remove unnecessary widths in columns
Dominik Csapak [Mon, 22 Apr 2024 11:05:05 +0000 (13:05 +0200)]
ui: gc view: remove unnecessary widths in columns

setting `width` and `flex` in a column simultaneously won't work, and
the `flex` value takes priority. So remove the unused `width`
properties.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 weeks agoui: prune/gc view: improve sizing & scrolling behaviour
Dominik Csapak [Mon, 22 Apr 2024 11:05:04 +0000 (13:05 +0200)]
ui: prune/gc view: improve sizing & scrolling behaviour

before, this was only used where the top list was a fixed size and only
for one datastore (which limits the number of prune jobs a bit)

since now we show gc jobs for all datastores here too and all their
prune jobs, this panel can get much bigger.

To improve it's scrolling sizing behavior, make the prune jobs panel
`flex: 1`, so it fills out the rest of the view, and add a splitter
between them so one can resize them on the fly. To prevent making one of
the panels too small, set an appropriate minHeight for both and make the
surrounding panel scrollable.

To not save the height into it's state, we have to filter that out for
the GCView.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 weeks agoui: gc view: use beforedestroy for stopping the store
Dominik Csapak [Mon, 22 Apr 2024 11:05:03 +0000 (13:05 +0200)]
ui: gc view: use beforedestroy for stopping the store

because during destroy, the controller (and the relevant function) might
not be there anymore

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 weeks agoproxmox-backup-mgr: gc jobs: pretty-print bytes/duration/timestamps
Lukas Wagner [Thu, 18 Apr 2024 10:17:06 +0000 (12:17 +0200)]
proxmox-backup-mgr: gc jobs: pretty-print bytes/duration/timestamps

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Gabriel Goller <g.goller@proxmox.com>
5 weeks agoui: gcview: fix eslint warnings
Lukas Wagner [Thu, 18 Apr 2024 10:17:05 +0000 (12:17 +0200)]
ui: gcview: fix eslint warnings

The ternary ? operator should be at the start of the line if the
the expression is split into multiple lines.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Gabriel Goller <g.goller@proxmox.com>
5 weeks agoui: configure width and flex on GC Jobs columns
Stefan Lendl [Thu, 18 Apr 2024 10:17:04 +0000 (12:17 +0200)]
ui: configure width and flex on GC Jobs columns

table expands to the full width and relevant data is still visible on a
narrow screen.

Signed-off-by: Stefan Lendl <s.lendl@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>
5 weeks agoui: show removed and pending data of last run in bytes
Stefan Lendl [Thu, 18 Apr 2024 10:17:03 +0000 (12:17 +0200)]
ui: show removed and pending data of last run in bytes

Show the removed and pending data of the last run formatted with
Proxmox.Utils.format_size for better readability identically to data
display in the overview tab.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Tested-by: Gabriel Goller <g.goller@proxmox.com>
Reviewd-by: Gabriel Goller <g.goller@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
Suggested-by: Lukas Wagner <l.wagner@proxmox.com>
5 weeks agofix #4723: cli: list gc jobs with proxmox-backup-manager
Stefan Lendl [Thu, 18 Apr 2024 10:17:02 +0000 (12:17 +0200)]
fix #4723: cli: list gc jobs with proxmox-backup-manager

proxmox-backup-manager garbage-collection list
  to list the garbage collection job status for all datastores,
  including datastores without gc jobs.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
  [LW: add ref to bugzilla issue to commit message]
Signed-off-by: Lukas Wagner <l.wagner@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>
5 weeks agoui: order Prune & GC before Sync Jobs
Stefan Lendl [Thu, 18 Apr 2024 10:17:01 +0000 (12:17 +0200)]
ui: order Prune & GC before Sync Jobs

Make the order identical to local datastore view.

Signed-off-by: Stefan Lendl <s.lendl@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>
5 weeks agoui: hide datastore column in local gc view
Stefan Lendl [Thu, 18 Apr 2024 10:17:00 +0000 (12:17 +0200)]
ui: hide datastore column in local gc view

Signed-off-by: Stefan Lendl <s.lendl@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>
5 weeks agoui: move prune and gc widget to config
Stefan Lendl [Thu, 18 Apr 2024 10:16:59 +0000 (12:16 +0200)]
ui: move prune and gc widget to config

* move datastore/PruneAndGC to config/PruneAndGC
* renaming the widgets to PBS.config.PruneAndGC

Signed-off-by: Stefan Lendl <s.lendl@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>
5 weeks agofix #3217: ui: global prune and gc job view
Stefan Lendl [Thu, 18 Apr 2024 10:16:58 +0000 (12:16 +0200)]
fix #3217: ui: global prune and gc job view

In the global datastore view, extend the prune view to display gc job
status as a table.  Use the same widget in the local view and dispaly gc
job status as a single row.

The local PruneAndGC view is parameterized (cbind) with the datastore.
At initialization the only row is selected.  This allows the rest of the
grid to act on selected rows and it requires far less special casing if
the datastore is set on the view or not.

Having a single row always selected and therefore highlighted, is
visually not appealing.  Therefore, highlighting of selected rows is
disabled in the local view.

Moved GCView to different file and enhanced it with last, next run,
status and duration. Added button to show task log.

Changed `render_task_status()` to also take in account upids stored in
other 'columns'.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
  [LW: include ref to bugzilla in commit message]
Signed-off-by: Lukas Wagner <l.wagner@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>
5 weeks agoapi: garbage collect job status
Stefan Lendl [Thu, 18 Apr 2024 10:16:57 +0000 (12:16 +0200)]
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>
5 weeks agoui: fix layout reset
Dominik Csapak [Mon, 22 Apr 2024 11:06:16 +0000 (13:06 +0200)]
ui: fix layout reset

we have to iterate over the keys of the state object here, not over the
values. This meant one could not reset the layout from the settings
window.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 weeks agoapi: assert that maintenance mode transitions are valid
Dietmar Maurer [Mon, 22 Apr 2024 08:31:30 +0000 (10:31 +0200)]
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>
5 weeks agomaintenance: derive Copy for maintenance type and make maintenance mode fields public
Dietmar Maurer [Mon, 22 Apr 2024 08:31:29 +0000 (10:31 +0200)]
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>
5 weeks agopbs-api-types: use SchemaDeserializer for maintenance mode
Dietmar Maurer [Mon, 22 Apr 2024 08:31:28 +0000 (10:31 +0200)]
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>
5 weeks agoclient: backup writer: fix minor formatting issue
Christian Ebner [Fri, 19 Apr 2024 09:37:33 +0000 (11:37 +0200)]
client: backup writer: fix minor formatting issue

no functional changes

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
5 weeks agoclient: fix whitespace issue
Christian Ebner [Fri, 19 Apr 2024 09:37:32 +0000 (11:37 +0200)]
client: fix whitespace issue

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
6 weeks agoui: sync view: increase default width of 'Max. Depth' column
Lukas Wagner [Thu, 18 Apr 2024 12:01:18 +0000 (14:01 +0200)]
ui: sync view: increase default width of 'Max. Depth' column

Before, the column was so small that it was practically invisible.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
6 weeks agoui: sync view: add 'max-depth' to model
Lukas Wagner [Thu, 18 Apr 2024 12:01:17 +0000 (14:01 +0200)]
ui: sync view: add 'max-depth' to model

Otherwise, the sync job overview does no refresh if 'max-depth' is
changed in the edit window.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
6 weeks agoui: sync view: rename column 'Max. Recursion' -> 'Max. Depth'
Lukas Wagner [Thu, 18 Apr 2024 12:01:16 +0000 (14:01 +0200)]
ui: sync view: rename column 'Max. Recursion' -> 'Max. Depth'

In the edit dialog we already use 'Max. Depth', so it makes sense
to use the same term in the overview.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
6 weeks agodocs: add missing html_css_files entry
Hannes Duerr [Fri, 29 Mar 2024 15:07:37 +0000 (16:07 +0100)]
docs: add missing html_css_files entry

Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
6 weeks agodocs: move custom.js and custom.css into _static folder
Hannes Duerr [Fri, 29 Mar 2024 15:07:36 +0000 (16:07 +0100)]
docs: move custom.js and custom.css into _static folder

The sphinx documentation [0] describes the _static folder as the
location for the custom.js and custom.css so we move the files there, as
we do not need those files outside the directory.
This also removes the error message when building:
WARNING: html_static_path entry '_static' does not exist

[0] https://www.sphinx-doc.org/en/master/development/theming.html#add-your-own-static-files-to-the-build-assets

Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
7 weeks agopbs-client: fixed typo in error message
Gabriel Goller [Wed, 10 Apr 2024 12:54:56 +0000 (14:54 +0200)]
pbs-client: fixed typo in error message

Fixed error message on the client: 'dynmamic' -> 'dynamic'.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
7 weeks agoapi: make prune-group a real workertask
Gabriel Goller [Fri, 8 Mar 2024 13:36:22 +0000 (14:36 +0100)]
api: make prune-group a real workertask

`prune-group` is currently not a real workertask, ie it behaves like one
but doesn't start a thread nor a task to do its work.

Changed it to start a tokio-task, so that we can delete snapshots
asynchronously. The `dry-run` feature still behaves in the same way and
returns early.

This paves the way for the new logging infra (which uses `task_local` to
define a logger) and improves performance of bigger backup-groups.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
7 weeks agoapi: datastore create: allow re-using existing dirs if empty & not a mountpoint
Markus Frank [Thu, 30 Nov 2023 10:37:24 +0000 (11:37 +0100)]
api: datastore create: allow re-using existing dirs if empty & not a mountpoint

When formatting and creating a filesystem on a disk it's important
that the target directory in `/mnt/datastore/<name>` either doesn't
exist yet, or is empty and not a mountpoint of an existing FS. As that
way we ensure that no data is lost, or gets hidden, on creating a new
datastore. Our current check was a bit stricter than required, it
always bailed if the target directory existed, even if it was a plain
& empty directory on the root file-system.

So adapt the check and also check whether an existing target directory
is empty and not already mounted, as then it can be used just fine.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
Tested-by: Christian Ebner <c.ebner@proxmox.com>
 [ TL: reword subject and commit message to include more details ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 weeks agoclient: backup: early check for fixed index type
Christian Ebner [Thu, 28 Mar 2024 12:36:27 +0000 (13:36 +0100)]
client: backup: early check for fixed index type

Early return when the check fails, avoiding constuction of unused
object instances.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
8 weeks agoclient: backup writer: only borrow http client
Christian Ebner [Thu, 28 Mar 2024 12:36:25 +0000 (13:36 +0100)]
client: backup writer: only borrow http client

Instead of taking ownership of the http client when starting a new
BackupWriter instance, only borrow the client.

This allows to reuse the http client to later reuse it to start also a
BackupReader instance as required for backup runs with metadata based
file change detection mode, where both must use the same http client.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2 months agofix #5248: client: allow self-signed/untrusted certificate chains
Fabian Grünbichler [Tue, 26 Mar 2024 08:15:03 +0000 (09:15 +0100)]
fix #5248: client: allow self-signed/untrusted certificate chains

instead of rejecting any non-leaf certificate not pre-validated by OpenSSL,
treat them as valid but keep track of the fact that the pre-validation result
is no logner trustable.

certificate chains completely trusted by openssl are still accepted like
before, and leaf certificates without a chain are also handled the same (since
the verify callback is only ever called with depth == 0 in that case).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 months agobump version to 3.1.5-1
Thomas Lamprecht [Mon, 25 Mar 2024 15:49:31 +0000 (16:49 +0100)]
bump version to 3.1.5-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agorealm sync: generic-ify `LdapSyncSettings` and `GeneralSyncSettings`
Christoph Heiss [Fri, 12 Jan 2024 16:16:01 +0000 (17:16 +0100)]
realm sync: generic-ify `LdapSyncSettings` and `GeneralSyncSettings`

Since both only needs a handful of attributes anyway, pass them
explicitly instead of as an LDAP-specific config object, such that these
types can be reused for other realms like the new Active Directory one.

No functional changes.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoauth: factor out CA store and cert lookup into own fn
Christoph Heiss [Fri, 12 Jan 2024 16:16:00 +0000 (17:16 +0100)]
auth: factor out CA store and cert lookup into own fn

This will be needed by the AD authenticator as well, so avoid duplicate
code.

No functional changes.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoapi-types: factor out `LdapMode` -> `ConnectionMode` conversion into own fn
Christoph Heiss [Fri, 12 Jan 2024 16:15:59 +0000 (17:15 +0100)]
api-types: factor out `LdapMode` -> `ConnectionMode` conversion into own fn

This will be needed by the AD authenticator as well, so avoid duplicate
code.

No functional changes.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoapi: use if-let pattern for error-only handling
Maximiliano Sandoval [Wed, 14 Feb 2024 08:23:35 +0000 (09:23 +0100)]
api: use if-let pattern for error-only handling

It is more readable than using match. We also inline variables in
eprintln!.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agopxar-fuse: use ReplyBufState::is_full() when possible
Maximiliano Sandoval [Wed, 14 Feb 2024 08:23:34 +0000 (09:23 +0100)]
pxar-fuse: use ReplyBufState::is_full() when possible

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoui: prune job: disallow setting blank schedule
Stefan Lendl [Thu, 7 Mar 2024 13:33:43 +0000 (14:33 +0100)]
ui: prune job: disallow setting blank schedule

The schedule value for prune jobs can not be empty.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agodocs: added shell prompt
Gabriel Goller [Thu, 7 Mar 2024 14:41:57 +0000 (15:41 +0100)]
docs: added shell prompt

On this `ls` command the shell prompt ('#') was missing.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agodocs: add examples for --exclude parameter
Gabriel Goller [Thu, 7 Mar 2024 14:41:56 +0000 (15:41 +0100)]
docs: add examples for --exclude parameter

Added two examples for the `--exclude` parameter of the
`proxmox-backup-client backup` command.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoapi: sync job: log stats for removed vanished entities
Christian Ebner [Fri, 8 Mar 2024 13:01:50 +0000 (14:01 +0100)]
api: sync job: log stats for removed vanished entities

Extend the current task log summary to include a log entry stating the
number of removed because vanished on the source side snapshots,
backup groups and namespaces.

The additional task log line states, e.g.:
> Summary: removed vanished: snapshots: 2, groups: 1, namespaces: 0

The log line is not shown if the sync jobs `remove_vanished` flag was
not set and therefore no removed vanished stats are present.

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoserver: sync job: include removed vanished stats
Christian Ebner [Fri, 8 Mar 2024 13:01:49 +0000 (14:01 +0100)]
server: sync job: include removed vanished stats

Include statistics of vanished and therefore removed snapshots, backup
groups and namespaces in the `PullStats`.

In preparation for including these values in the sync jobs task log
output.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agodatastore: group: return basic stats on backup group destroy
Christian Ebner [Fri, 8 Mar 2024 13:01:48 +0000 (14:01 +0100)]
datastore: group: return basic stats on backup group destroy

No functional change intended: In preparation for including the
removed vanished groups and snapshots statistics in a sync jobs task
log output.

Instead of returning a boolean value showing whether all of the
snapshots of the group have been removed, return an instance of
`BackupGroupDeleteStats`, containing the count of deleted and
protected snapshots, the latter not having been removed from the
group.

The `removed_all` method is introduced as replacement for the previous
boolean return value and can be used to check if all snapshots have
been removed. If there are no protected snapshots, the group is
considered to be deleted.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agobump version to 3.1.5-1
Thomas Lamprecht [Mon, 25 Mar 2024 15:36:40 +0000 (16:36 +0100)]
bump version to 3.1.5-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agofix #5188: gui: add copy to clipboard on snapshots
Gabriel Goller [Thu, 14 Mar 2024 09:32:24 +0000 (10:32 +0100)]
fix #5188: gui: add copy to clipboard on snapshots

When navigating to Datastores -> Content, it is now possible to
right-click on a snapshot/group and copy the name to the clipboard.
This makes the proxmox-backup-client much easier to use, especially when
restoring archives.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agogui: remove document.execCommand calls
Gabriel Goller [Thu, 14 Mar 2024 09:32:23 +0000 (10:32 +0100)]
gui: remove document.execCommand calls

The `document.execCommand` call is deprecated since a few years [0] so I
went ahead and removed it. We only use it to copy stuff to the clipboard
and the recommended way now is to use `navigator.clipboard.writeText`
[1]. `writeText` is kind of new, but I think we'll be alright regarding
compatibility (Compat table is also available at [1]).

Making the handler functions async is okay because extjs executes the
handler and does not expect any result from it, nor does it need to do
some work afterwards.

[0]: https://developer.mozilla.org/en-US/docs/Web/API/document/execCommand
[1]: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agodocs: clarify difference between zfs cache and log
Gabriel Goller [Fri, 22 Mar 2024 12:54:01 +0000 (13:54 +0100)]
docs: clarify difference between zfs cache and log

The commands to add a zfs cache and log had the same description.
Differentiate them more clearly by explaining the benefit.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2 months agodatastore: remove datastore from internal cache based on maintenance mode
Hannes Laimer [Mon, 4 Mar 2024 13:26:18 +0000 (14:26 +0100)]
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>
2 months agodaily-update: inline variables into format string if possible
Lukas Wagner [Mon, 25 Mar 2024 10:50:45 +0000 (11:50 +0100)]
daily-update: inline variables into format string if possible

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2 months agodaily-update: fix typo
Lukas Wagner [Mon, 25 Mar 2024 10:50:44 +0000 (11:50 +0100)]
daily-update: fix typo

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2 months agoadd 'confirmation-password' parameter to user password change API/UI
Wolfgang Bumiller [Fri, 15 Mar 2024 13:31:46 +0000 (14:31 +0100)]
add 'confirmation-password' parameter to user password change API/UI

Similar to a recent change in pve-access-control [0], add a new
'confirmation-password' parameter to the change-password endpoint and
require non-root users to confirm their passwords.

Doing so avoids that an attacker that has direct access to a computer
where a user is logged in to the PVE interface can change the password
of said user and thus either prolong their possibility to attack,
and/or create a denial of service situation, where the original user
cannot login into the PVE host using their old credentials.

Note that this might sound worse than it is, as for this attack to
work the attacker needs either:
- physical access to an unlocked computer that is currently logged in
  to a PVE host
- having taken over such a computer already through some unrelated
  vulnerability

As these required pre-conditions are pretty big implications, which
allow (temporary) access to all of the resources (including PVE ones)
that the user can control, we see this as slight improvement that
won't hurt, might protect one in some specific cases that is simply
too cheap not to do.

For now we avoid additional confirmation through a second factor, as
that is a much higher complexity without that much gain, and some
forms like (unauthenticated) button press on a WebAuthn token or the
TOTP code would be easy to circumvent in the physical access case and
in the local access case one might be able to MITM themselves too.

[0]: https://git.proxmox.com/?p=pve-access-control.git;a=commit;h=5bcf553e3a193a537d92498f4fee3c23e22d1741

Reported-by: Wouter Arts <security@wth-security.nl>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
 [ TL: Extend ocmmit message, squash in UI change ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoui: re-use password edit window from widget-toolkit
Thomas Lamprecht [Mon, 25 Mar 2024 13:08:12 +0000 (14:08 +0100)]
ui: re-use password edit window from widget-toolkit

no need to keep a copy of that component here, just re-use the common
one from widget-toolkit. That one provides also some more features
that will be used here with a next commit.

Originally-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
 [ TL: move switch to common widget up front ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agocompile fixup for previous commit by using concatcp
Wolfgang Bumiller [Wed, 20 Mar 2024 11:20:55 +0000 (12:20 +0100)]
compile fixup for previous commit by using concatcp

restoring the old code does not work since we now don't have the
components as macros anymore, switch to concatcp for it

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agorestore CIDR regexes in network parser
Wolfgang Bumiller [Wed, 20 Mar 2024 11:18:07 +0000 (12:18 +0100)]
restore CIDR regexes in network parser

Commit 2416aea8d456 accidentally removed this since they looked the
same as the ones we already have in proxmox-schema now. However, we
make use of the *capture groups* here.
Added a comment to the code to avoid this in the future.

Fixes 2416aea8d456 ("pbs-api-types: use const_format and new api-types from proxmox-schema")
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agocargo fmt (import reordering)
Wolfgang Bumiller [Wed, 20 Mar 2024 10:13:13 +0000 (11:13 +0100)]
cargo fmt (import reordering)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agopbs-api-types: use const_format and new api-types from proxmox-schema
Dietmar Maurer [Wed, 20 Mar 2024 10:03:55 +0000 (11:03 +0100)]
pbs-api-types: use const_format and new api-types from proxmox-schema

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2 months agodocs: avoid orphan warnings for man-page skeletons
Thomas Lamprecht [Fri, 8 Mar 2024 07:08:03 +0000 (08:08 +0100)]
docs: avoid orphan warnings for man-page skeletons

Use the `:orphan:` special metadata field [0] to tell Sphinx that this
file is expected to not be included in any TOC-tree.

[0]: https://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html#special-metadata-fields

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agogitignore: generally ignore generated systemd service files
Thomas Lamprecht [Fri, 8 Mar 2024 07:00:30 +0000 (08:00 +0100)]
gitignore: generally ignore generated systemd service files

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agogitignore: ignore generated synopsis and config docs
Stefan Lendl [Thu, 7 Mar 2024 14:23:43 +0000 (15:23 +0100)]
gitignore: ignore generated synopsis and config docs

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
 [ TL: condense this to something more general ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agogitignore: add target/ in sub-directories
Stefan Lendl [Thu, 7 Mar 2024 14:23:42 +0000 (15:23 +0100)]
gitignore: add target/ in sub-directories

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
2 months agoui: tape: transfer: increase timeout to 3 minutes
Dominik Csapak [Wed, 6 Mar 2024 14:04:25 +0000 (15:04 +0100)]
ui: tape: transfer: increase timeout to 3 minutes

the default timeout of 30 seconds is too short to properly wait for a
slot transfer. Increase the timeout to a value of 3 minutes. In my
tests, it took about 60 seconds in a very basic changer to move a tape
between two slots, so triple that to account for bigger and more
complicated libraries.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 months agosync job: avoid printing NaN if no data was pulled
Thomas Lamprecht [Thu, 7 Mar 2024 13:31:27 +0000 (14:31 +0100)]
sync job: avoid printing NaN if no data was pulled

Previously, if there was no data to pull one could get:
> Summary: sync job pulled 0 B in 0 chunks (average rate: NaN B/s)

Now one gets the following log entry in that case:
> Summary: sync job found no new data to pull

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoserver: sync job: format downloaded amount in human readable units
Christian Ebner [Wed, 6 Mar 2024 14:11:53 +0000 (15:11 +0100)]
server: sync job: format downloaded amount in human readable units

Use the methods provided by HumanByte for the output for consistency
with the rest of the task log and better readability.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agofix #5285: api: sync job: add job summary to task log
Christian Ebner [Wed, 6 Mar 2024 14:11:52 +0000 (15:11 +0100)]
fix #5285: api: sync job: add job summary to task log

Adds a summary to the end of the task log showing the size and number
of chunks pulled as well as the average transfer rate.

Such an entry looks something like:
> Summary: sync job pulled 214.445 MiB in 166 chunks (average rate: 111.012 MiB/s)

Link: https://bugzilla.proxmox.com/show_bug.cgi?id=5285
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoserver: sync job: return `PullStats` for pull related methods
Christian Ebner [Wed, 6 Mar 2024 14:11:51 +0000 (15:11 +0100)]
server: sync job: return `PullStats` for pull related methods

Return basic statistics on pull related methods via `PullStats`
objects, in order to construct a global summary for sync jobs.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoui: user edit: clean-up getValues function
Thomas Lamprecht [Thu, 7 Mar 2024 09:37:35 +0000 (10:37 +0100)]
ui: user edit: clean-up getValues function

values.username just does not exist, and we do not need to delete the
username part anyway, as that field is used to assemble the full
userid by concatenating the name@realm parts.

While at it move this over to let-assignments and do not call setting
expiry explicitly a hack, it's fine and warranted code, because if one
wants to use a datefield's empty value as 0 one needs to do so
explicitly, nothing hacky there..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoui: user edit: don't send realm property
Stefan Sterz [Wed, 6 Mar 2024 11:45:56 +0000 (12:45 +0100)]
ui: user edit: don't send realm property

the api does not accept a realm property here, it is only needed to
construct a proper user id of the form `{username}@{realm}`. so
remove it before sending it to the api and getting an error in return.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2 months agoui: verify job: don't send delete value on creation
Dominik Csapak [Wed, 6 Mar 2024 11:21:04 +0000 (12:21 +0100)]
ui: verify job: don't send delete value on creation

the conditional `deleteEmpty` was missing only for max-depth

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 months agoui: sync job: don't send delete value on creation
Dominik Csapak [Wed, 6 Mar 2024 11:21:03 +0000 (12:21 +0100)]
ui: sync job: don't send delete value on creation

since that's not a valid api parameter there
we have to pass the `isCreate` value through to the inputpanel, we even
used it there already but it was never set.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 months agoui: prune: fix sending invalid parameters
Dominik Csapak [Wed, 6 Mar 2024 11:21:02 +0000 (12:21 +0100)]
ui: prune: fix sending invalid parameters

the prune input panel is used in various contexts (add/editing a
prunejob, adding a datastore, executing a prune). These different api
calls don't all take the same parameters, so we have to correctly set
the `isCreate` to not send a `delete` paramter for those request if
there was an empty field.

Also set 'max-depth:0' only when recursive was not set *and* we can
set 'recursive', because for creating a datastore that is not supported
by the api, and for the prune job editing we override the whole
onGetValues anyway so that's not an issue there.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 months agoui: tape backup job: don't send delete value on creation
Dominik Csapak [Wed, 6 Mar 2024 11:21:01 +0000 (12:21 +0100)]
ui: tape backup job: don't send delete value on creation

this is not a valid parameter for the create call. To do that in the
onGetValues method, we have to pass the 'isCreate' value through to the
input panels via cbind.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 months agoui: metrics: don't send digest when creating a new influxdbupd host
Dominik Csapak [Wed, 6 Mar 2024 11:21:00 +0000 (12:21 +0100)]
ui: metrics: don't send digest when creating a new influxdbupd host

we accidentally always tried to load an existing config, even when
creating a new entry. This returned the list of all configured ones plus
the digest (which gets set by the edit window). When the digest is set,
the edit window will send it along, but that does not exist for the
create api call, so it failed.

To fix it, guard the load behind the `serverid` property, which is only
set when we edit an existing entry.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 months agoui: prune job edit: indent fix
Dominik Csapak [Wed, 6 Mar 2024 11:20:59 +0000 (12:20 +0100)]
ui: prune job edit: indent fix

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 months agodocs: lto barcode generator: add worm tape types
Dominik Csapak [Wed, 6 Mar 2024 15:11:01 +0000 (16:11 +0100)]
docs: lto barcode generator: add worm tape types

see
https://www.ibm.com/docs/en/ts4500-tape-library?topic=media-lto-bar-code-labels

for a reference of the codes

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 months agodocs: lto barcode generator: add lto-9 type
Dominik Csapak [Wed, 6 Mar 2024 15:11:00 +0000 (16:11 +0100)]
docs: lto barcode generator: add lto-9 type

and make it the new default

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 months agodocs: lto barcod generator: disable add button when fields are not valid
Dominik Csapak [Wed, 6 Mar 2024 15:10:59 +0000 (16:10 +0100)]
docs: lto barcod generator: disable add button when fields are not valid

otherwise we end up with entries in the list that won't be
displayed/printed anyway.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 months agofix #5217: api: send missing header when upgrading to HTTP/2
Max Carrara [Fri, 1 Mar 2024 13:49:06 +0000 (14:49 +0100)]
fix #5217: api: send missing header when upgrading to HTTP/2

The "Connection: upgrade" header is strictly expected to be included
in the response sent by the server when an upgrade to a different
protocol is requested by the client.

A detailed explanation as well as additional context follows below.

Background
----------

Neither RFC 9110 (HTTP Semantics) [0] or RFC 7540 (HTTP/2) [1]
*explicitly state* that the "Connection: upgrade" header must be
included *in the server's response* when a client requests an upgrade
to a different protocol. For clients, however, it is specified [2]:

> A sender of Upgrade MUST also send an "Upgrade" connection option in
> the Connection header field (Section 7.6.1) to inform intermediaries
> not to forward this field.

Yet, the example for a response provided in RFC 9110 [3] does include
the header:

> HTTP/1.1 101 Switching Protocols
> Connection: upgrade
> Upgrade: websocket
>
> [... data stream switches to websocket with an appropriate response
> (as defined by new protocol) to the "GET /hello" request ...]

The example in RFC 7540 [4] also includes the header:

> HTTP/1.1 101 Switching Protocols
> Connection: Upgrade
> Upgrade: h2c
>
> [ HTTP/2 connection ...

Additionally, RFC 9113 [5], which obsoletes RFC 7540 [1], mentions:

> The HTTP/1.1 Upgrade mechanism is deprecated and no longer specified
> in this document. It was never widely deployed, with plaintext
> HTTP/2 users choosing to use the prior-knowledge implementation
> instead.

I therefore initially concluded that whether the "Connection: upgrade"
header should / should not / must / must not be included in the
server's response was unspecified.

Further Revelations
-------------------

As per Thomas's suggestion [6], I opened a discussion over at Caddy's
GitHub issue tracker [7]. This discussion revealed that RFC 7230 [8],
which is obsoleted by RFC 9110 [1], does in fact specify that the
header must be included [9], thus proving my initial conclusion to be
incorrect:

> When a header field aside from Connection is used to supply control
> information for or about the current connection, the sender MUST
> list the corresponding field-name within the Connection header
> field. [...]

The discussion [7] also revealed that the WebSocket RFC 6455 [10]
specifies the usage of the "Connection" header in more detail [11]:

> 3.  If the response lacks a |Connection| header field or the
> |Connection| header field doesn't contain a token that is an ASCII
> case-insensitive match for the value "Upgrade", the client MUST
> _Fail the WebSocket Connection_.

Furthermore [12]:

> 5.  If the server chooses to accept the incoming connection, it
> MUST reply with a valid HTTP response indicating the following.
>
> [...]
>
>     3.  A |Connection| header field with value "Upgrade".

Although we're using the upgrade mechanism for HTTP/2, the WebSocket
RFC [10] specifies its usage more clearly and most importantly, in an
explicit manner.

Final Conclusion
----------------

The "Connection: upgrade" header must therefore definitely be included
as per RFC 7230 section 6.1 [8], even if the newer RFC 9110 [1] does
not specify this explicitly anymore.

Finally, this fixes bug #5217 [13] and allows PBS to be deployed
behind Caddy. Also tested with nginx, which still works as expected.

[0]: https://datatracker.ietf.org/doc/html/rfc9110
[1]: https://datatracker.ietf.org/doc/html/rfc7540
[2]: https://datatracker.ietf.org/doc/html/rfc9110#section-7.8-14
[3]: https://datatracker.ietf.org/doc/html/rfc9110#section-7.8-13
[4]: https://datatracker.ietf.org/doc/html/rfc7540#section-3.2
[5]: https://datatracker.ietf.org/doc/html/rfc9113#appendix-B-2.3
[6]: https://lists.proxmox.com/pipermail/pbs-devel/2024-February/007948.html
[7]: https://github.com/caddyserver/caddy/issues/6134
[8]: https://datatracker.ietf.org/doc/html/rfc7230
[9]: https://datatracker.ietf.org/doc/html/rfc7230#section-6.1
[10]: https://datatracker.ietf.org/doc/html/rfc6455
[11]: https://datatracker.ietf.org/doc/html/rfc6455#section-4.1
[12]: https://datatracker.ietf.org/doc/html/rfc6455#section-4.2.2
[13]: https://bugzilla.proxmox.com/show_bug.cgi?id=5217

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
2 months agoui: system config: fix deleting DNS entries
Dominik Csapak [Fri, 1 Mar 2024 09:03:41 +0000 (10:03 +0100)]
ui: system config: fix deleting DNS entries

While PVE and PMG use a rather brittle "replace whole config" style on
their DNS entry CRUD API, the PBS one was made with a per-entry level
granularity, so that single entries can modified, or deleted, without
touching the others.

But the UI from the widget-toolkit was made for the older PVE/PMG
behavior and did  not sent along the delete-array of to-be-deleted
keys.

Since widget-toolkit commit 8d161ac ("dns: update comment to avoid
coupling to downstream dependency") the DNS edit window supports
opting into that by setting the new `deleteEmpty` config parameter.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [ TL: expand commit message ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agoui: trim whitespaces when adding a subscription key
Stefan Sterz [Fri, 1 Mar 2024 09:40:19 +0000 (10:40 +0100)]
ui: trim whitespaces when adding a subscription key

users that add the correct subscription key just get unnecessarily
confused with a "value does not match the regex pattern" error if
they accidentally have a stray whitespace at the end or beginning
otherwise.

Switch to using our `proxmoxtextfield` component that provides a
`trimValue` config option since widget-toolkit commit 5d7d30d ("text
field: add trimValue config") that was made just for this case.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
 [ TL: reference widget toolkit commit ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agoui: tape inventory: do not translate UUID
Thomas Lamprecht [Wed, 28 Feb 2024 10:06:08 +0000 (11:06 +0100)]
ui: tape inventory: do not translate UUID

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agoclient: pxar: early return on exclude pattern match
Christian Ebner [Wed, 21 Feb 2024 14:48:04 +0000 (15:48 +0100)]
client: pxar: early return on exclude pattern match

Move the exclude pattern matching further up to avoid unnecessary
instantiation of the metadata object, not needed if the entry was
matched.

No functional change intended.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agoclient: pxar: fix minor formatting issues
Christian Ebner [Wed, 21 Feb 2024 14:48:03 +0000 (15:48 +0100)]
client: pxar: fix minor formatting issues

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
3 months agodocs: clarify prune settings slightly more
Fiona Ebner [Tue, 20 Feb 2024 15:25:56 +0000 (16:25 +0100)]
docs: clarify prune settings slightly more

The formulation "Keep backups for the last N intervals" might suggest
that intervals without backups also count, which they do not.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
3 months agofix #4975: client: ignore E2BIG error flag
Gabriel Goller [Wed, 14 Feb 2024 09:52:01 +0000 (10:52 +0100)]
fix #4975: client: ignore E2BIG error flag

Some filesystems (f.e. zfs) support xattrs bigger than 64kB, sadly we
can't get them because the kernel vfs limits us. The syscalls listxattr
and getxattr will return a E2BIG error in this case.
Added a flag --ignore-e2big-xattr to the client, this will ignore the
metadata (but still backup the file) if this error occurs.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
3 months agobackup-proxy: avoid block in if condition
Maximiliano Sandoval [Tue, 13 Feb 2024 12:43:28 +0000 (13:43 +0100)]
backup-proxy: avoid block in if condition

Fixes the clippy lint:

```
warning: in a `match` scrutinee, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
   --> src/bin/proxmox-backup-proxy.rs:874:58
    |
874 |           let stats = match tokio::task::spawn_blocking(|| {
    |  __________________________________________________________^
875 | |             let hoststats = collect_host_stats_sync();
876 | |             let (hostdisk, datastores) = collect_disk_stats_sync();
877 | |             Arc::new((hoststats, hostdisk, datastores))
878 | |         })
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#blocks_in_conditions
    = note: `#[warn(clippy::blocks_in_conditions)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 months agoreport: inline errors in writeln!
Maximiliano Sandoval [Tue, 13 Feb 2024 09:53:19 +0000 (10:53 +0100)]
report: inline errors in writeln!

Fixes the clippy lint:

```
warning: `to_string` applied to a type that implements `Display` in `writeln!` args
   --> src/server/report.rs:141:72
    |
141 |                 let _ = writeln!(out, "error during read-dir - {}", err.to_string());
    |                                                                        ^^^^^^^^^^^^ help: remove this
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 months agodisks: remove useless conversion to the same type
Maximiliano Sandoval [Tue, 13 Feb 2024 09:53:17 +0000 (10:53 +0100)]
disks: remove useless conversion to the same type

Fixes the clippy lint:

```
warning: useless conversion to the same type: `std::ffi::OsString`
    --> src/tools/disks/mod.rs:1161:9
     |
1161 |         count_str.into(),
     |         ^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `count_str`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 months agoclient: rename variable to sensible name
Fabian Grünbichler [Tue, 13 Feb 2024 09:47:03 +0000 (10:47 +0100)]
client: rename variable to sensible name

two-letter abbreviations should only be used for things that have a very common
meaning (e.g. NS, RE, ..), not arbitrary things.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 months agoclient: add "delete-groups" param to delete namespace
Gabriel Goller [Mon, 12 Feb 2024 10:43:40 +0000 (11:43 +0100)]
client: add "delete-groups" param to delete namespace

The api parameter "delete-groups" was missing on the
proxmox-backup-client command. This allows the client to remove
non-empty namespaces.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
3 months agoconfig: Remove unused hex dependency
Maximiliano Sandoval [Tue, 13 Feb 2024 09:04:16 +0000 (10:04 +0100)]
config: Remove unused hex dependency

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 months agopxar: elide explicit lifetime
Maximiliano Sandoval [Mon, 12 Feb 2024 13:17:34 +0000 (14:17 +0100)]
pxar: elide explicit lifetime

Fixes the clippy lint

```
warning: the following explicit lifetimes could be elided: 'b
   --> pbs-client/src/pxar/create.rs:225:33
    |
225 |     fn archive_dir_contents<'a, 'b, T: SeqWrite + Send>(
    |                                 ^^
226 |         &'a mut self,
227 |         encoder: &'a mut Encoder<'b, T>,
    |                                  ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
    |
225 ~     fn archive_dir_contents<'a, T: SeqWrite + Send>(
226 |         &'a mut self,
227 ~         encoder: &'a mut Encoder<'_, T>,
    |
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 months agodatastore: use is_{err, some} rather than match {Ok, Some}(_)
Maximiliano Sandoval [Mon, 12 Feb 2024 13:17:32 +0000 (14:17 +0100)]
datastore: use is_{err, some} rather than match {Ok, Some}(_)

Fixes the clippy lint:

```
warning: redundant pattern matching, consider using `is_ok()`
    --> pbs-datastore/src/datastore.rs:1025:10
     |
1025 |         !matches!(self.inner.gc_mutex.try_lock(), Ok(_))
     |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.inner.gc_mutex.try_lock().is_ok()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
     = note: `#[warn(clippy::redundant_pattern_matching)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 months agoaccess first element with first() rather than get(0)
Maximiliano Sandoval [Mon, 12 Feb 2024 13:17:31 +0000 (14:17 +0100)]
access first element with first() rather than get(0)

Fixes the clippy lint

```
warning: accessing first element with `self.transports.get(0)`
   --> pbs-tape/src/lib.rs:283:9
    |
283 | /         self.transports
284 | |             .get(0)
    | |___________________^ help: try: `self.transports.first()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
    = note: `#[warn(clippy::get_first)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 months agouse or_default instead of or_insert_with(Default::default)
Maximiliano Sandoval [Mon, 12 Feb 2024 13:17:30 +0000 (14:17 +0100)]
use or_default instead of or_insert_with(Default::default)

We need to annotate some cases to allow the compile to infer the types.

Fixes the clippy lint:

```
warning: use of `or_insert_with` to construct default value
   --> src/api2/tape/restore.rs:750:18
    |
750 |                 .or_insert_with(Vec::new);
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
    = note: `#[warn(clippy::unwrap_or_default)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 months agomedia_catalog: use stream_position
Maximiliano Sandoval [Mon, 12 Feb 2024 13:17:29 +0000 (14:17 +0100)]
media_catalog: use stream_position

Fixes the following clippy lint:

```
warning: using `SeekFrom::Current` to start from current position
   --> src/tape/media_catalog.rs:798:23
    |
798 |             let pos = file.seek(SeekFrom::Current(0))?; // get current pos
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `file.stream_position()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#seek_from_current
    = note: `#[warn(clippy::seek_from_current)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 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>
3 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>