]> git.proxmox.com Git - proxmox-backup.git/log
proxmox-backup.git
3 years agoserver: add Datastore.Allocate privilege
Thomas Lamprecht [Tue, 6 Oct 2020 10:08:54 +0000 (12:08 +0200)]
server: add Datastore.Allocate privilege

Previously only Datastore.Modify was required for creating a new
datastore.

But, that endpoint allows one to pass an arbitrary path, of which all
parent directories will be created, this can allow any user with the
"Datastore Admin" role on "/datastores" to do some damage to the
system. Further, it is effectively a side channel for revealing the
systems directory structure through educated guessing and error
handling.

Add a new privilege "Datastore.Allocate" which, for now, is used
specifically for the create datastore API endpoint.

Add it only to the "Admin" role.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoacl: use modified constnamedbitmap macro
Thomas Lamprecht [Tue, 6 Oct 2020 10:08:53 +0000 (12:08 +0200)]
acl: use modified constnamedbitmap macro

avoiding the need for reshuffling all bits when a new privilege is
added at the start or in the middle of this definition.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofuse_loop: handle unmap on crashed instance
Stefan Reiter [Wed, 7 Oct 2020 11:53:08 +0000 (13:53 +0200)]
fuse_loop: handle unmap on crashed instance

If a fuse_loop instance dies suddenly (e.g. SIGKILL), the FUSE mount and
loop device assignment are left behind. We can determine this scenario
on specific unmap, when the PID file is either missing or contains a PID
of a non-running process, but the backing file and potentially loop
device are still there.

If that's the case, do an "emergency cleanup", by unassigning the
loopdev, calling 'fusermount -u' and then cleaning any leftover files
manually.

With this in place, pretty much any situation is now recoverable via
only the 'proxmox-backup-client' binary, by either calling 'unmap' with
or without parameters.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofuse_loop: wait for instance to close after killing
Stefan Reiter [Wed, 7 Oct 2020 11:53:07 +0000 (13:53 +0200)]
fuse_loop: wait for instance to close after killing

On unmap, only report success if the instance we are killing actually
terminates. This is especially important so that cleanup routines can be
assured that /run files are actually cleaned up after calling
cleanup_unused_run_files.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofuse_loop: add automatic cleanup of run files and dangling instances
Stefan Reiter [Wed, 7 Oct 2020 11:53:06 +0000 (13:53 +0200)]
fuse_loop: add automatic cleanup of run files and dangling instances

A 'map' call will only clean up what it needs, that is only leftover
files or dangling instances of it's own name.

For a full cleanup the user can call 'unmap' without any arguments.

The 'cleanup on error' behaviour of map_loop is removed. It is no longer
needed (since the next call will clean up anyway), and in fact fixes a
bug where trying to map an image twice would result in an error, but
also cleanup the .pid file of the running instance, causing 'unmap' to
fail afterwards.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agomount/map: use names for map/unmap for easier use
Stefan Reiter [Wed, 7 Oct 2020 11:53:05 +0000 (13:53 +0200)]
mount/map: use names for map/unmap for easier use

So user doesn't need to remember which loop devices he has mapped to
what.

systemd unit encoding is used to transform a unique identifier for the
mapped image into a suitable name. The files created in /run/pbs-loopdev
will be named accordingly.

The encoding all happens outside fuse_loop.rs, so the fuse_loop module
does not need to care about encodings - it can always assume a name is a
valid filename.

'unmap' without parameter displays all current mappings. It's
autocompletion handler will list the names of all currently mapped
images for easy selection. Unmap by /dev/loopX or loopdev number is
maintained, as those can be distinguished from mapping names.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoloopdev: add module doc
Stefan Reiter [Wed, 7 Oct 2020 11:53:04 +0000 (13:53 +0200)]
loopdev: add module doc

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofuse_loop: add documentation
Stefan Reiter [Wed, 7 Oct 2020 11:53:03 +0000 (13:53 +0200)]
fuse_loop: add documentation

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoformat: fix typo in function name
Stefan Reiter [Wed, 7 Oct 2020 11:53:02 +0000 (13:53 +0200)]
format: fix typo in function name

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agodocs: typo fixups
Oguz Bektas [Wed, 7 Oct 2020 12:03:48 +0000 (14:03 +0200)]
docs: typo fixups

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agoui: network: remove create VLAN option
Oguz Bektas [Wed, 7 Oct 2020 11:32:18 +0000 (13:32 +0200)]
ui: network: remove create VLAN option

for now this isn't needed and would take quite a bit of effort to
match the API schema with PVE.

if there are a lot of requests at some point we can add it in.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agoui: dashboard: code cleanup
Thomas Lamprecht [Tue, 6 Oct 2020 13:16:00 +0000 (15:16 +0200)]
ui: dashboard: code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: dashboard: add tooltip to gears edit tool
Thomas Lamprecht [Tue, 6 Oct 2020 13:15:43 +0000 (15:15 +0200)]
ui: dashboard: add tooltip to gears edit tool

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: fixup: s/Hours/Days/
Thomas Lamprecht [Tue, 6 Oct 2020 13:15:18 +0000 (15:15 +0200)]
ui: fixup: s/Hours/Days/

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: Dashboard/TaskSummary: show task overlay when clicking on a count
Dominik Csapak [Tue, 6 Oct 2020 10:25:28 +0000 (12:25 +0200)]
ui: Dashboard/TaskSummary: show task overlay when clicking on a count

when clicking on a count in the summary, a small task overlay now pops
up that shows those tasks. this way, the user has an easy way
of seeing which tasks failed exactly

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: Dashboard/TaskSummary: add Verifies to the Summary
Dominik Csapak [Tue, 6 Oct 2020 10:25:27 +0000 (12:25 +0200)]
ui: Dashboard/TaskSummary: add Verifies to the Summary

and count every type that starts with 'verify' (e.g. verifyjob)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: Dashboard/TaskSummary: refactor types and title
Dominik Csapak [Tue, 6 Oct 2020 10:25:26 +0000 (12:25 +0200)]
ui: Dashboard/TaskSummary: refactor types and title

by moving the definition into the controller and dynamically use them
in the updateTasks function

we will reuse/extend this later

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: implment task history limit and make it configurable
Dominik Csapak [Tue, 6 Oct 2020 10:25:25 +0000 (12:25 +0200)]
ui: implment task history limit and make it configurable

we showed 'last month' even if we did not limit the api call
implement that and make the number of days configurable
(we have most of the code already available for that, since
the base dashboard got copied from pmg and never cleaned up)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapi2/status: add type- and statusfilter to tasks api call
Dominik Csapak [Tue, 6 Oct 2020 10:25:24 +0000 (12:25 +0200)]
api2/status: add type- and statusfilter to tasks api call

we will use this for the pbs dashboard

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapi2/types: add TaskStateType struct
Dominik Csapak [Tue, 6 Oct 2020 10:25:23 +0000 (12:25 +0200)]
api2/types: add TaskStateType struct

the same as the regular TaskState, but without its fields, so that
we can use the api macro and use it as api call parameter

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agod/control: add ',' after qrencode dependency
Fabian Grünbichler [Tue, 6 Oct 2020 10:00:49 +0000 (12:00 +0200)]
d/control: add ',' after qrencode dependency

'${misc:Depends}' is empty at the moment, otherwise this would have
already generated invalid packages..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agodocs: installation: add system requirements section
Thomas Lamprecht [Tue, 6 Oct 2020 08:27:17 +0000 (10:27 +0200)]
docs: installation: add system requirements section

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoacl: document Admin and NoAccess a bit
Thomas Lamprecht [Mon, 5 Oct 2020 12:53:49 +0000 (14:53 +0200)]
acl: document Admin and NoAccess a bit

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodocs: typo fix
Thomas Lamprecht [Tue, 6 Oct 2020 08:26:46 +0000 (10:26 +0200)]
docs: typo fix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosrc/bin/proxmox_backup_client/mount.rs: fix img name completion
Dietmar Maurer [Tue, 6 Oct 2020 07:17:58 +0000 (09:17 +0200)]
src/bin/proxmox_backup_client/mount.rs: fix img name completion

3 years agoclient: implement map/unmap commands for .img backups
Stefan Reiter [Mon, 5 Oct 2020 08:57:58 +0000 (10:57 +0200)]
client: implement map/unmap commands for .img backups

Allows mapping fixed-index .img files (usually from VM backups) to be
mapped to a local loopback device.

The architecture uses a FUSE-backed temp file mapped to a loopdev:

  /dev/loopX -> FUSE /run/pbs-loopdev/xxx -> backup client -> PBS

Since unmapping requires some cleanup (unmap the loopdev, stop FUSE,
remove the temp files) a special 'unmap' command is added, which uses a
PID file to send SIGINT to the backup-client instance started with
'map', which will handle the cleanup itself.

The polling with select! in mount.rs needs to be split in two, since we
have a chicken and egg problem between running FUSE and setting up the
loop device - so we need to do them concurrently, until the loopdev is
assigned, at which point we can report success and daemonize, and then
continue polling the FUSE loop future.

A loopdev module is added to tools containing all required functions for
mapping a loop device to the FUSE file, with the ioctls moved into an
inline module to avoid exposing them directly.

The client code is placed in the 'mount' module, which, while
admittedly a loose fit, allows reuse of the daemonizing code.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agomount: handle SIGTERM as well
Stefan Reiter [Mon, 5 Oct 2020 08:57:57 +0000 (10:57 +0200)]
mount: handle SIGTERM as well

instead of only SIGINT

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofix comma dangle
Thomas Lamprecht [Mon, 5 Oct 2020 15:15:28 +0000 (17:15 +0200)]
fix comma dangle

...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodocs: fix broken reference to backup_remote
Oguz Bektas [Mon, 5 Oct 2020 15:08:16 +0000 (17:08 +0200)]
docs: fix broken reference to backup_remote

while restructuring the docs, explicit title wasn't included in the
correct file

fixes commit 04e24b14f0c51f01a1f8afe2d0eff124c1095758

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agogui: add onlineHelp for 'Prune Options'
Oguz Bektas [Mon, 5 Oct 2020 15:01:29 +0000 (17:01 +0200)]
gui: add onlineHelp for 'Prune Options'

also renamed the 'pruning' ref to 'backup-pruning' for clarity.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agoscanrefs: match all instances of 'onlineHelp' in js files
Oguz Bektas [Mon, 5 Oct 2020 14:57:10 +0000 (16:57 +0200)]
scanrefs: match all instances of 'onlineHelp' in js files

previously it looked for the first instance. this behavior
became an issue while trying to add multiple onlineHelp buttons

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agoui: refactor render_icon code
Dominik Csapak [Mon, 5 Oct 2020 13:43:14 +0000 (15:43 +0200)]
ui: refactor render_icon code

we will reuse this later

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agotask archive rotation: better handle non-existing archive
Dominik Csapak [Fri, 2 Oct 2020 13:20:10 +0000 (15:20 +0200)]
task archive rotation: better handle non-existing archive

if the archive file does not exist yet, we cannot rotate it, but it's not
actually an error, so just return Ok(false) to indicate no rotation took
place

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoRestructure docs (more first level headings)
Dylan Whyte [Fri, 2 Oct 2020 14:12:57 +0000 (16:12 +0200)]
Restructure docs (more first level headings)

This removes the "Backup Management" first level heading in the docs,
and either uses the sub headings contained within it as first level
headings, or groups previous sections logically under new headings.

The administration-guide.rst file is also removed. Its contents are
instead separated into various files, that relate to their respective
first level heading.

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agoAdd section "GUI"
Dylan Whyte [Fri, 2 Oct 2020 14:12:56 +0000 (16:12 +0200)]
Add section "GUI"

Section provides a brief overview of the web interface

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agoREST server: avoid hard coding world readable API endpoints
Thomas Lamprecht [Fri, 2 Oct 2020 11:17:12 +0000 (13:17 +0200)]
REST server: avoid hard coding world readable API endpoints

while we probably do not add much more to them, it still looks ugly.

If this was made so that adding a World readable API call is "hard"
and not done by accident, it rather should be done as a test on build
time. But, IMO, the API permission schema definitions are easy to
review, and not often changed/added - so any wrong World readable API
call will normally still caught.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 0.9.0-2
Thomas Lamprecht [Fri, 2 Oct 2020 13:37:59 +0000 (15:37 +0200)]
bump version to 0.9.0-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorest server: cleanup use statements
Thomas Lamprecht [Fri, 2 Oct 2020 11:04:08 +0000 (13:04 +0200)]
rest server: cleanup use statements

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: RemoteEdit: only send delete on update
Dominik Csapak [Fri, 2 Oct 2020 08:32:23 +0000 (10:32 +0200)]
ui: RemoteEdit: only send delete on update

the create api call does not understand the 'delete' paramter, so
send it only on update

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoupdate d/control
Thomas Lamprecht [Thu, 1 Oct 2020 14:57:33 +0000 (16:57 +0200)]
update d/control

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 0.9.0-1 v0.9.0
Thomas Lamprecht [Thu, 1 Oct 2020 14:19:49 +0000 (16:19 +0200)]
bump version to 0.9.0-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agod/control: bump versioned dependency of proxmox-widget-toolkit
Thomas Lamprecht [Thu, 1 Oct 2020 13:29:33 +0000 (15:29 +0200)]
d/control: bump versioned dependency of proxmox-widget-toolkit

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosrc/tools/parallel_handler.rs: remove lifetime hacks, require 'static
Dietmar Maurer [Thu, 1 Oct 2020 12:48:49 +0000 (14:48 +0200)]
src/tools/parallel_handler.rs: remove lifetime hacks, require 'static

In theory, one can do std::mem::forget, and ignore the drop handler. With
the lifetime hack, this could result in a crash.

So we simply require 'static lifetime now (futures also needs that).

3 years agod/control: add pve-eslint to build dependencies
Thomas Lamprecht [Thu, 1 Oct 2020 12:01:34 +0000 (14:01 +0200)]
d/control: add pve-eslint to build dependencies

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosrc/tools/parallel_handler.rs: cleanup check_abort code
Dietmar Maurer [Thu, 1 Oct 2020 12:37:29 +0000 (14:37 +0200)]
src/tools/parallel_handler.rs: cleanup check_abort code

3 years agorrd: fix integer underflow
Stefan Reiter [Thu, 1 Oct 2020 09:40:44 +0000 (11:40 +0200)]
rrd: fix integer underflow

Causes a panic if last_update is smaller than RRD_DATA_ENTRIES*reso,
which (I believe) can happen when inserting the first value for a DB.

Clamp the value to 0 in that case.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoParallelHandler: check for errors during thread join
Stefan Reiter [Thu, 1 Oct 2020 09:38:42 +0000 (11:38 +0200)]
ParallelHandler: check for errors during thread join

Fix a potential bug where errors that happen after the SendHandle has
been dropped while doing the thread join might have been ignored.
Requires internal check_abort to be moved out of 'impl SendHandle' since
we only have the Mutex left, not the SendHandle.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agowww: do incremental lint for development, full for build
Thomas Lamprecht [Thu, 1 Oct 2020 11:12:44 +0000 (13:12 +0200)]
www: do incremental lint for development, full for build

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoeslint fixes
Thomas Lamprecht [Thu, 1 Oct 2020 11:03:14 +0000 (13:03 +0200)]
eslint fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodatastore: gc: avoid unsafe call into libc, use epoch_i64 helper
Thomas Lamprecht [Thu, 1 Oct 2020 10:38:38 +0000 (12:38 +0200)]
datastore: gc: avoid unsafe call into libc, use epoch_i64 helper

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodatastore: gc: comment exclusive process lock
Thomas Lamprecht [Thu, 1 Oct 2020 10:38:04 +0000 (12:38 +0200)]
datastore: gc: comment exclusive process lock

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoassume correct backup, avoid verifying chunk existance
Thomas Lamprecht [Thu, 1 Oct 2020 09:59:18 +0000 (11:59 +0200)]
assume correct backup, avoid verifying chunk existance

This can slow things down by a lot on setups with (relatively) high
seek time, in the order of doubling the backup times if cache isn't
populated with the last backups chunk inode info.

Effectively there's nothing known this protects us from in the
codebase. The only thing which was theorized about was the case
where a really long running backup job (over 24 hours) is still
running and writing new chunks, not indexed yet anywhere, then an
update (or manual action) triggers a reload of the proxy. There was
some theory that then a GC in the new daemon would not know about the
oldest writer in the old one, and thus use a less strict atime limit
for chunk sweeping - opening up a window for deleting chunks from the
long running backup.
But, this simply cannot happen as we have a per datastore process
wide flock, which is acquired shared by backup jobs and exclusive by
GC. In the same process GC and backup can both get it, as it has a
process locking granularity. If there's an old daemon with a writer,
that also has the lock open shared, and so no GC in the new process
can get exclusive access to it.

So, with that confirmed we have no need for a "half-assed"
verification in the backup finish step. Rather, we plan to add an
opt-in "full verify each backup on finish" option (see #2988)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosrc/api2/reader.rs: fix speedtest description
Dietmar Maurer [Thu, 1 Oct 2020 09:16:15 +0000 (11:16 +0200)]
src/api2/reader.rs: fix speedtest description

3 years agosrc/api2/backup.rs: use block_in_place for remove_backup
Dietmar Maurer [Thu, 1 Oct 2020 09:11:14 +0000 (11:11 +0200)]
src/api2/backup.rs: use block_in_place for remove_backup

3 years agoupload_chunk: use block_in_place
Dietmar Maurer [Thu, 1 Oct 2020 09:00:23 +0000 (11:00 +0200)]
upload_chunk: use block_in_place

3 years agoui: RemoteEdit: remove port field and parse it from host field
Dominik Csapak [Thu, 1 Oct 2020 07:57:57 +0000 (09:57 +0200)]
ui: RemoteEdit: remove port field and parse it from host field

use our hostport regexes to parse out a potential port from the host field
and send it individually

this makes for a simpler and cleaner ui

this additionally checks the field for valid input before sending it to
the backend

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: RemoteView: improve host columns
Dominik Csapak [Thu, 1 Oct 2020 07:57:56 +0000 (09:57 +0200)]
ui: RemoteView: improve host columns

do not show the default (8007) port
and only add brackets [] to ipv6 addresses if there is a port

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapi2/types: fix DNS_NAME Regexes
Dominik Csapak [Wed, 30 Sep 2020 14:46:13 +0000 (16:46 +0200)]
api2/types: fix DNS_NAME Regexes

We forgot to put braces around the DNS_NAME regex, and in
DNS_NAME_OR_IP_REGEX

this is wrong because the regex

 ^foo|bar$

matches 'foo' at the beginning and 'bar' at the end, so either

 foobaz
 bazbar

would match. only

 ^(foo|bar)$

 matches only 'foo' and 'bar'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agofix ipv6 handling for remotes/sync jobs
Dominik Csapak [Wed, 30 Sep 2020 11:23:39 +0000 (13:23 +0200)]
fix ipv6 handling for remotes/sync jobs

* add square brackets to ipv6 adresses in BackupRepository if they not
already have some (we save them without in the remote config)

* in get_pull_parameters, we now create a BackupRepository first and use
  those values (which does the [] mapping), this also has the advantage
  that we have one place less were we hardcode 8007 as port

* in the ui, add square brackets for ipv6 adresses for remotes

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agosrc/client/pull.rs: log progress
Dietmar Maurer [Wed, 30 Sep 2020 11:35:09 +0000 (13:35 +0200)]
src/client/pull.rs: log progress

3 years agowww/index.hbs: add nodename to title
Dietmar Maurer [Wed, 30 Sep 2020 10:10:04 +0000 (12:10 +0200)]
www/index.hbs: add nodename to title

3 years agoui: improve running task overlay
Dominik Csapak [Wed, 30 Sep 2020 08:45:07 +0000 (10:45 +0200)]
ui: improve running task overlay

by setting a maxHeight+scrollable
(i used 500px to be still visible on our 'min screen size' 1280x720)

and by disabling emptyText deferral, which now shows the text instantly

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agotasks: improve behaviour on upgrade
Dominik Csapak [Wed, 30 Sep 2020 08:45:06 +0000 (10:45 +0200)]
tasks: improve behaviour on upgrade

when upgrading from a version where we stored all tasks in the 'active' file,
we did not completly account for finished tasks still there

we should update the file when encountering any finished task in
'active' as well as filter them out on the api call (if they get through)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agopaperkey: add html output
Dietmar Maurer [Wed, 30 Sep 2020 07:58:13 +0000 (09:58 +0200)]
paperkey: add html output

3 years agoexamples: fix HttpClient::new usage
Dietmar Maurer [Wed, 30 Sep 2020 07:57:25 +0000 (09:57 +0200)]
examples: fix HttpClient::new usage

3 years agosrc/tools.rs: make command_output return Vec<u8>
Dietmar Maurer [Wed, 30 Sep 2020 07:28:48 +0000 (09:28 +0200)]
src/tools.rs: make command_output return Vec<u8>

And add a new helper to return output as string.

3 years agoui: add port support for remotes
Dominik Csapak [Tue, 29 Sep 2020 14:18:59 +0000 (16:18 +0200)]
ui: add port support for remotes

by adding a field to RemoteEdit and showing it in the grid

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoclient/remote: add support to specify port number
Dominik Csapak [Tue, 29 Sep 2020 14:18:58 +0000 (16:18 +0200)]
client/remote: add support to specify port number

this adds the ability to add port numbers in the backup repo spec
as well as remotes, so that user that are behind a
NAT/Firewall/Reverse proxy can still use it

also adds some explanation and examples to the docs to make it clearer
for h2 client i left the localhost:8007 part, since it is not
configurable where we bind to

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapi: disks/zfs: check template exsits before enabling zfs-import service
Thomas Lamprecht [Wed, 30 Sep 2020 07:34:21 +0000 (09:34 +0200)]
api: disks/zfs: check template exsits before enabling zfs-import service

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi2/node/disks/zfs: instantiate import service
Stoiko Ivanov [Wed, 16 Sep 2020 12:14:18 +0000 (14:14 +0200)]
api2/node/disks/zfs: instantiate import service

When creating a new zpool for a datastore, also instantiate an
import-unit for it. This helps in cases where '/etc/zfs/zool.cache'
get corrupted and thus the pool is not imported upon boot.

This patch needs the corresponding addition of 'zfs-import@.service' in
the zfsonlinux repository.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoui: add task description for logrotation
Dominik Csapak [Tue, 29 Sep 2020 14:05:54 +0000 (16:05 +0200)]
ui: add task description for logrotation

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: RemoteEdit: make comment and fingerprint deletable
Dominik Csapak [Tue, 29 Sep 2020 14:05:53 +0000 (16:05 +0200)]
ui: RemoteEdit: make comment and fingerprint deletable

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agorequire square brackets for ipv6 addresses
Dominik Csapak [Tue, 29 Sep 2020 14:05:52 +0000 (16:05 +0200)]
require square brackets for ipv6 addresses

we need this, because we append the port to this to get a target url
e.g. we print

format!("https://{}:8007/", address)

if address is now an ipv6 (e.g. fe80::1) it would become

https://fe80::1:8007/ which is a valid ipv6 on its own

by using square brackets we get:

https://[fe80::1]:8007/ which now connects to the correct ip/port

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agodocs: fix wrong user in repository explanation
Dominik Csapak [Tue, 29 Sep 2020 14:05:51 +0000 (16:05 +0200)]
docs: fix wrong user in repository explanation

we use 'root@pam' by default, not 'root'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoserver/worker_task: fix panic on slice range when index is empty
Dominik Csapak [Tue, 29 Sep 2020 10:22:02 +0000 (12:22 +0200)]
server/worker_task: fix panic on slice range when index is empty

since len() and MAX_INDEX_TASKS are both usize, they underflow
instead of getting negative values

instead check the sizes and set them accordingly

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoproxmox-backup-proxy: add task archive rotation
Dominik Csapak [Mon, 28 Sep 2020 13:32:12 +0000 (15:32 +0200)]
proxmox-backup-proxy: add task archive rotation

this starts a task once a day at "00:00" that rotates the task log
archive if it is bigger than 500k

if we want, we can make the schedule/size limit/etc. configurable,
but for now it's ok to set fixed values for that

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoserver/worker_task: remove unecessary read_task_list
Dominik Csapak [Mon, 28 Sep 2020 13:32:11 +0000 (15:32 +0200)]
server/worker_task: remove unecessary read_task_list

since there are no users of this anymore and we now have a nicer
TaskListInfoIterator to use, we can drop this function

this also means that 'update_active_workers' does not need to return
a list anymore since we never used that result besides in
read_task_list

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapi2/status: use the TaskListInfoIterator here
Dominik Csapak [Mon, 28 Sep 2020 13:32:10 +0000 (15:32 +0200)]
api2/status: use the TaskListInfoIterator here

this means that limiting with epoch now works correctly
also change the api type to i64, since that is what the starttime is
saved as

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapi2/node/tasks: use TaskListInfoIterator instead of read_task_list
Dominik Csapak [Mon, 28 Sep 2020 13:32:09 +0000 (15:32 +0200)]
api2/node/tasks: use TaskListInfoIterator instead of read_task_list

this makes the filtering/limiting much nicer and readable

since we now have potentially an 'infinite' amount of tasks we iterate over,
and cannot now beforehand how many there are, we return the total count
as always 1 higher then requested iff we are not at the end (this is
the case when the amount of entries is smaller than the requested limit)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoserver/worker_task: add TaskListInfoIterator
Dominik Csapak [Mon, 28 Sep 2020 13:32:08 +0000 (15:32 +0200)]
server/worker_task: add TaskListInfoIterator

this is an iterator that reads/parses/updates the task list as
necessary and returns the tasks in descending order (newest first)

it does this by using our logrotate iterator and using a vecdeque

we can use this to iterate over all tasks, even if they are in the
archive and even if the archive is logrotated but only read
as much as we need

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoserver/worker_task: write older tasks into archive file
Dominik Csapak [Mon, 28 Sep 2020 13:32:07 +0000 (15:32 +0200)]
server/worker_task: write older tasks into archive file

instead of removing tasks beyond the 1000 that are in the index
write them into an archive file by appending them at the end
this way we can later still read them

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoserver/worker_task: split task list file into two
Dominik Csapak [Mon, 28 Sep 2020 13:32:06 +0000 (15:32 +0200)]
server/worker_task: split task list file into two

one for only the active tasks and one for up to 1000 finished tasks

factor out the parsing of a task file (we will later need this again)
and use iterator combinators for easier code

we now sort the tasks ascending (this will become important in a later patch)
but reverse (for now) it to keep compatibility

this code also omits the converting into an intermittent hash
since it cannot really happen that we have duplicate tasks in this list
(since the call is locked by an flock, and it is the only place where we
write into the lists)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoserver/worker_task: refactor locking of the task list
Dominik Csapak [Mon, 28 Sep 2020 13:32:05 +0000 (15:32 +0200)]
server/worker_task: refactor locking of the task list

also add the functionality of having a 'shared' (read) lock for the list
we will need this later

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agotools: add logrotate module
Dominik Csapak [Mon, 28 Sep 2020 13:32:04 +0000 (15:32 +0200)]
tools: add logrotate module

this is a helper to rotate and iterate over log files
there is an iterator for open filehandles as well as
only the filename

also it has the possibilty to rotate them
for compression, zstd is used

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoproxmox_backup_client key: allow to generate paperkey for master key
Dietmar Maurer [Tue, 29 Sep 2020 06:19:33 +0000 (08:19 +0200)]
proxmox_backup_client key: allow to generate paperkey for master key

3 years agoproxmox_backup_client key: add new paper-key command
Dietmar Maurer [Mon, 28 Sep 2020 15:40:12 +0000 (17:40 +0200)]
proxmox_backup_client key: add new paper-key command

3 years agoparallel_handler: clippy: 'while_let_loop'
Wolfgang Bumiller [Mon, 28 Sep 2020 07:53:43 +0000 (09:53 +0200)]
parallel_handler: clippy: 'while_let_loop'

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoparallel_handler: explicit Arc::clone
Wolfgang Bumiller [Mon, 28 Sep 2020 07:44:37 +0000 (09:44 +0200)]
parallel_handler: explicit Arc::clone

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoparallel_handler: formatting cleanup, doc comment typo fixup
Wolfgang Bumiller [Mon, 28 Sep 2020 07:43:03 +0000 (09:43 +0200)]
parallel_handler: formatting cleanup, doc comment typo fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agodepend on proxmox 0.4.2
Dietmar Maurer [Mon, 28 Sep 2020 08:50:44 +0000 (10:50 +0200)]
depend on proxmox 0.4.2

3 years agoserver/worker_task: factor out task list rendering
Dominik Csapak [Fri, 25 Sep 2020 14:13:19 +0000 (16:13 +0200)]
server/worker_task: factor out task list rendering

we will need this later again

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapi2/node/tasks: move userfilter to function signature
Dominik Csapak [Fri, 25 Sep 2020 14:13:17 +0000 (16:13 +0200)]
api2/node/tasks: move userfilter to function signature

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agosrc/tools/parallel_handler.rs: remove unnecessary Sync bound
Dietmar Maurer [Sat, 26 Sep 2020 14:13:44 +0000 (16:13 +0200)]
src/tools/parallel_handler.rs: remove unnecessary Sync bound

3 years agosrc/bin/proxmox_backup_client/benchmark.rs: avoid compiler warning
Dietmar Maurer [Sat, 26 Sep 2020 14:13:19 +0000 (16:13 +0200)]
src/bin/proxmox_backup_client/benchmark.rs: avoid compiler warning

3 years agosrc/backup/verify.rs: use ParallelHandler to verify chunks
Dietmar Maurer [Sat, 26 Sep 2020 09:14:37 +0000 (11:14 +0200)]
src/backup/verify.rs: use ParallelHandler to verify chunks

3 years agosrc/backup/verify.rs: cleanup use clause
Dietmar Maurer [Sat, 26 Sep 2020 08:23:44 +0000 (10:23 +0200)]
src/backup/verify.rs: cleanup use clause

3 years agosrc/client/pull.rs: simplify code
Dietmar Maurer [Sat, 26 Sep 2020 08:09:51 +0000 (10:09 +0200)]
src/client/pull.rs: simplify code

3 years agosrc/tools/parallel_handler.rs: remove static lifetime bound from handler_fn
Dietmar Maurer [Sat, 26 Sep 2020 07:22:50 +0000 (09:22 +0200)]
src/tools/parallel_handler.rs: remove static lifetime bound from handler_fn

3 years agosrc/tools/parallel_handler.rs: join all threads in drop handler
Dietmar Maurer [Sat, 26 Sep 2020 06:26:14 +0000 (08:26 +0200)]
src/tools/parallel_handler.rs: join all threads in drop handler

3 years agosrc/tools/parallel_handler.rs: remove unnecessary Sync trait bound
Dietmar Maurer [Sat, 26 Sep 2020 05:37:46 +0000 (07:37 +0200)]
src/tools/parallel_handler.rs: remove unnecessary Sync trait bound