]> git.proxmox.com Git - proxmox-backup.git/log
proxmox-backup.git
3 years agobump version to 0.9.1-1 v0.9.1
Dietmar Maurer [Wed, 14 Oct 2020 11:42:30 +0000 (13:42 +0200)]
bump version to 0.9.1-1

3 years agouse SslAcceptor::mozilla_intermediate_v5
Dietmar Maurer [Wed, 14 Oct 2020 10:24:15 +0000 (12:24 +0200)]
use SslAcceptor::mozilla_intermediate_v5

This allows TLSv1.3, and let the client select ciphers. After this
change AES is prefered over chacha20, so TLS speed is now much faster.

3 years agopxar: remove unused parameter
Wolfgang Bumiller [Wed, 14 Oct 2020 09:32:22 +0000 (11:32 +0200)]
pxar: remove unused parameter

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agopxar: pass full path to callback, let verbose flag list files
Wolfgang Bumiller [Wed, 14 Oct 2020 09:31:42 +0000 (11:31 +0200)]
pxar: pass full path to callback, let verbose flag list files

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoclippy fixups
Wolfgang Bumiller [Wed, 14 Oct 2020 09:18:26 +0000 (11:18 +0200)]
clippy fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agointroduction.rst: add History
Dietmar Maurer [Wed, 14 Oct 2020 07:46:52 +0000 (09:46 +0200)]
introduction.rst: add History

3 years agofix #2847: proxmox-backup-client: add change-owner cmd
Dylan Whyte [Tue, 13 Oct 2020 08:58:41 +0000 (10:58 +0200)]
fix #2847: proxmox-backup-client: add change-owner cmd

This adds a change-owner command to proxmox-backup-client,
that allows a caller with datastore modify privileges
to change the owner of a backup-group.

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agoavoid compiler warning
Dietmar Maurer [Wed, 14 Oct 2020 06:36:39 +0000 (08:36 +0200)]
avoid compiler warning

3 years agofix #2847: api: datastore: change backup owner
Dylan Whyte [Tue, 13 Oct 2020 08:58:40 +0000 (10:58 +0200)]
fix #2847: api: datastore: change backup owner

This adds an api method to change the owner of
a backup-group.

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agoproxmox-backup-client key: rename 'paper-key' command to 'paperkey' (remove dash)
Dietmar Maurer [Tue, 13 Oct 2020 07:44:40 +0000 (09:44 +0200)]
proxmox-backup-client key: rename 'paper-key' command to 'paperkey' (remove dash)

3 years agoserver/REST: check auth: code cleanup, better variable names
Thomas Lamprecht [Mon, 12 Oct 2020 16:39:45 +0000 (18:39 +0200)]
server/REST: check auth: code cleanup, better variable names

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver/REST: make handle_request private
Thomas Lamprecht [Mon, 12 Oct 2020 16:38:58 +0000 (18:38 +0200)]
server/REST: make handle_request private

it's not used anywhere else, so do not suggest so

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodon't require WorkerTask in backup/
Wolfgang Bumiller [Mon, 12 Oct 2020 09:46:34 +0000 (11:46 +0200)]
don't require WorkerTask in backup/

To untangle the server code from the actual backup
implementation.
It would be ideal if the whole backup/ dir could become its
own crate with minimal dependencies, certainly without
depending on the actual api server. That would then also be
used more easily to create forensic tools for all the data
file types we have in the backup repositories.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agointroduce TaskState trait
Wolfgang Bumiller [Mon, 12 Oct 2020 09:28:03 +0000 (11:28 +0200)]
introduce TaskState trait

Used to not require access to the WorkerTask struct outside
the `server` and `api2` module, so it'll be easier to
separate those backup/server/client parts into separate
crates.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoserver: get index: make content-type non mutable
Thomas Lamprecht [Mon, 12 Oct 2020 08:38:13 +0000 (10:38 +0200)]
server: get index: make content-type non mutable

feels more idiomatic

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver/rest: code cleanup: use async
Thomas Lamprecht [Mon, 12 Oct 2020 08:36:32 +0000 (10:36 +0200)]
server/rest: code cleanup: use async

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoreadme: allow to directly copy+paste+execute commands
Thomas Lamprecht [Mon, 12 Oct 2020 08:34:52 +0000 (10:34 +0200)]
readme: allow to directly copy+paste+execute commands

plus fix s/ssh:/git:/ for protocol

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #3070: replace internal with public URLs
Fabian Grünbichler [Mon, 12 Oct 2020 10:10:29 +0000 (12:10 +0200)]
fix #3070: replace internal with public URLs

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agobackup: index readers: drop useless shared lock
Thomas Lamprecht [Fri, 9 Oct 2020 10:45:36 +0000 (12:45 +0200)]
backup: index readers: drop useless shared lock

This is only acquired in those two methods, both as shared. So it has
no use.

It seems, that it was planned in the past that the index deletion
should take the exclusive, while read and write takes the shared
flock on the index, as one can guess from the lock comments in commit
046521895307aa8bde8bab7ea3ef9e437d5ab5e5

But then later, in commit c8ec450e379f54e7ac648b3a3ff701b37e9a6620)
the documented semantics where changed to use a temp file and do an
atomic rename instead for atomicity.

The reader shared flock on the index file was done inbetween,
probably as preparatory step, but was not removed again when strategy
was changed to using the file rename instead.

Do so now, to avoid confusion of readers and a useless flock.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoadd "Build" section to README.rst
Hannes Laimer [Fri, 9 Oct 2020 09:34:55 +0000 (11:34 +0200)]
add "Build" section to README.rst

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoreader: actually allow users to downlod their own backups
Fabian Grünbichler [Fri, 9 Oct 2020 09:21:02 +0000 (11:21 +0200)]
reader: actually allow users to downlod their own backups

via HTTP2/backup reader protocol. they already could do so via the plain
HTTP download-file/.. API calls that the GUI uses, but the reader
environment required READ permission on the whole datastore instead of
just BACKUP on the backup group itself.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoreader: track index chunks and limit access
Fabian Grünbichler [Fri, 9 Oct 2020 09:21:01 +0000 (11:21 +0200)]
reader: track index chunks and limit access

a reader connection should not be allowed to read arbitrary chunks in
the datastore, but only those that were previously registered by opening
the corresponding index files.

this mechanism is needed to allow unprivileged users (that don't have
full READ permissions on the whole datastore) access to their own
backups via a reader environment.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoREST: don't print CSRF token
Fabian Grünbichler [Thu, 8 Oct 2020 13:37:20 +0000 (15:37 +0200)]
REST: don't print CSRF token

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoUserid: fix borrow/deref recursion
Fabian Grünbichler [Thu, 8 Oct 2020 13:37:19 +0000 (15:37 +0200)]
Userid: fix borrow/deref recursion

not triggered by any current code, but this would lead to a stack
exhaustion since borrow would call deref which would call borrow again..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoUserid: simplify comparison with str
Fabian Grünbichler [Thu, 8 Oct 2020 13:37:18 +0000 (15:37 +0200)]
Userid: simplify comparison with str

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agodepend on proxmox 0.4.3
Fabian Grünbichler [Thu, 8 Oct 2020 08:44:51 +0000 (10:44 +0200)]
depend on proxmox 0.4.3

needed for constnamedbitmap macro

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoapi: datastore: require allocate privilege for deletion
Thomas Lamprecht [Thu, 8 Oct 2020 07:16:02 +0000 (09:16 +0200)]
api: datastore: require allocate privilege for deletion

makes only sense if we allow addition of a datastore also just with
that privilege

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
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>