Commit Graph

42 Commits

Author SHA1 Message Date
Fiona Ebner
2b233ecc08 api: vzdump: soften parameter permission checks
Allows sufficiently privileged users to pass-in retention and
performance parameters for manual backup, but keeps tmpdir, dumpdir
and script root-only. Such users could already edit the job
accordingly, so essentially not granting anything new.

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2022-11-21 14:13:05 +01:00
Thomas Lamprecht
2b5f3f98cd api vzdump: split/sort module usage
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-15 14:07:39 +01:00
Fiona Ebner
7a516cbfd1 api: vzdump: also check for default storage permission
Acked-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2022-11-15 13:58:29 +01:00
Fiona Ebner
93880785c8 vzdump: handle new 'performance' property string
Also generalizes the way vzdump property strings are handled for jobs.
Something similar could be done in VZDump.pm, but there the maxfiles
and prune-backups settings are currently coupled, so a dedicated
parse_performance() is used instead. Can be changed once maxfiles is
dropped.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2022-10-10 13:04:17 +02:00
Fabian Ebner
c53d5c5ec1 api: vzdump: extract config: add content type check
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-04-01 09:24:35 +02:00
Fabian Ebner
0bd224e56b api: vzdump: extract config: check for VM.Backup privilege
In preparation to have check_volume_access() always allow access for
users with Datastore.Allocate privilege. As to not automatically give
all such users permission to extract the config too.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-04-01 09:24:35 +02:00
Thomas Lamprecht
ff119724ee vdzump: whitespace/extra-lines clean up
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-06-18 14:35:25 +02:00
Fabian Ebner
173f8c49ef vzdump: remove deprecated size parameter
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-06-08 15:22:52 +02:00
Lorenz Stechauner
91db3ececc fix #3402: add Pool.Audit permission
everywhere where Pool.Allocate was unnecessarly used it was replaced
with Pool.Audit.

`/cluster/resources` now returns pool infomation for guests only if
the requesting user has the Pool.Audit permission on the pool.

`/pool/` now returns only pools where the requesting user has the
Pool.Audit permission.

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
2021-06-01 10:31:11 +02:00
Fabian Ebner
5b9a4030dd api: vzdump: add call to get currently configured vzdump defaults
on a given node (and storage).

There is no datacenter/storage fallback for the bandwidth limit, so the default
can just be returned as is. While the bandwidth limit is a root-only option when
executing the backup, it still makes sense to return it for all users, so they
can see what's going to be used.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-05-03 14:36:59 +02:00
Fabian Ebner
875c2e5aae vzdump: getlock: return lock file handle and let the caller close it
so it doesn't get out of scope too early.

Regression introduced by 5620e5761e as pointed
out by Fabian Grünbichler.

Reported in the community forum:
https://forum.proxmox.com/threads/limit-simultaneous-backup-jobs.87489

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-04-12 14:36:08 +02:00
Fabian Ebner
f8ed6af80d vzdump: refactor parsing mailto so it can be mocked
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Reviewed-By: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-02-19 16:33:33 +01:00
Fabian Ebner
7f87414894 backup: include IDs for non-existent guests
Like this, there will be a backup task (within the big worker task)
for such IDs, which will then visibly (i.e. also visible in the
notification mail) fail with, e.g.:
unable to find VM '123'

In get_included_guests, the key '' was chosen for the orphaned IDs,
because it cannot possibly denote a nodename.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-10-22 16:29:26 +02:00
Fabian Ebner
e6946086e3 Allow prune-backups as an alternative to maxfiles
and make the two options mutally exclusive as long
as they are specified on the same level (e.g. both
from the storage configuration). Otherwise prefer
option > storage config > default (only maxfiles has a default currently).

Defines the backup limit for prune-backups as the sum of all
keep-values.

There is no perfect way to determine whether a
new backup would trigger a removal with prune later:
1. we would need a way to include the not yet existing backup
   in a 'prune --dry-run' check.
2. even if we had that check, if it's executed right before
   a full hour, and the actual backup happens after the full
   hour, the information from the check is not correct.

So in some cases, we allow backup jobs with remove=0, that
will lead to a removal when the next prune is executed.
Still, the job with remove=0 does not execute a prune, so:
1. There is a well-defined limit.
2. A job with remove=0 never removes an old backup.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-09-30 10:56:30 +02:00
Aaron Lauterer
df5875b41e vzdump: move remaining guest include logic to single method
The `guest include` logic handling `all` and `exclude` parameters was in
the `PVE::VZDump->exec_backup()` method. Moving this logic into the
`get_included_guests` method allows us to simplify and generalize it.

This helps to make the overall logic easier to test and develop other
features around vzdump backup jobs.

The method now returns a hash with node names as keys mapped to arrays
of VMIDs on these nodes that are included in the vzdump job.

The VZDump API call to create a new backup is adapted to use the new
method to create the list of local VMIDs and the skiplist.

Permission checks are kept where they are to be able to handle missing
permissions according to the current context. The old behavior to die
on a backup job when the user is missing the permission to a guest and
the job is not an 'all' or 'exclude' job is kept.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2020-06-17 15:16:06 +02:00
Thomas Lamprecht
47399e41ad small nit follouwp: use $var->[0] to acccess array ref element
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-06-08 15:57:34 +02:00
Aaron Lauterer
5c4da4c3e8 vzdump: make guest include logic testable
As a first step to make the whole guest include logic more testable the
part from the API endpoint has been moved to its own method with as
little changes as possible.

Everything concerning `all` and `exclude` logic is still in the
PVE::VZDump->exec_backup() method.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2020-06-08 15:54:42 +02:00
Christian Ebner
2424074ee7 vzdump: move code needed for cfs register of vzdump.cron to guest-common
This moves the cfs register code for vzdump.cron to the
pve-guest-common package. Therefore, it relies on the corresponding
patches in pve-guest-common and pve-docs as build dependencies.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-18 08:23:40 +02:00
Stefan Reiter
6cd5ffb06c fix #1594: allow skipping VMIDs on other nodes from API
This was previously gated to CLI only, but it causes a vzdump job
started with the newly introduced "Run Now" button to fail if it
includes VMIDs on other nodes.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-08-14 13:36:08 +02:00
Stefan Reiter
e953f92adf fix #2314: remove GZIP env var
...and replace instead with command line argument.
Avoids a deprecation warning.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-08-08 13:18:45 +02:00
Tim Marx
f337626155 fix #1278 api: add pool backup option
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-06-28 18:05:19 +02:00
Tim Marx
60e049c231 whitespace cleanup
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-06-28 18:01:04 +02:00
Fabian Grünbichler
742d2ad20e fix #1997: set taskid for single-guest backups
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-01-03 09:17:38 +01:00
Dietmar Maurer
989f3c7ead use new PVE::Storage::check_volume_access() 2017-01-18 17:30:40 +01:00
Fabian Grünbichler
6d0507a87a vzdump: move restricted API parameters check
for better visibility and earlier error detection
2016-10-12 17:30:45 +02:00
Fabian Grünbichler
eb2d6fd390 vzdump: document restricted API parameters 2016-10-12 17:30:26 +02:00
Wolfgang Bumiller
403761c43e Fix #1015: vzdump: send email on early errors
VZDump->new() dies when a tmpdir or dumpdir is configured
but does not exist. At this point the error is not being
reported via email.

This also moves the instantiation of VZDump into the worker
since new() can now call sendmail() on error.

Additionally rather than only showing a single error if both
tmpdir and dumpdir don't exist, both are included in the
message.
2016-06-06 13:38:35 +02:00
Fabian Grünbichler
7619e4dd31 add vzdump/extractconfig API path 2016-06-03 12:11:14 +02:00
Fabian Grünbichler
e2a2525e60 VZDump: mark 'size' as deprecated, warn if set
this parameter should be removed in a future release, just
warn and change description for now to avoid breakage.
2016-04-14 10:39:45 +02:00
Dietmar Maurer
eab837c4c4 cleanup vzdump -stop implementation
* do not unlink $pidfile inside stop_running_backups to avoid race conditions
* use pve UPID to save pid (see PVE::Tools::upid_decode)
* allow to pass -stop parameter to nomal backup job
* simple return 'OK' instead of calling exit() inside API call.
* rename stop_all_backups to stop_running_backups
2015-01-20 09:35:01 +01:00
Wolfgang Link
8682f6fcb1 Fix backup failure at shutdown.
This fix include a new function of vzdump.
Now you can call vzdump -stop and the backup will be aborted.
Also if the pve-manager init script stop the process, vzdump -stop will called.

Signed-off-by: Wolfgang Link <wolfgang@linksystems.org>
2015-01-20 08:06:59 +01:00
Stefan Priebe
6ec9de4426 VZDump: send an error email in case of lock failure
Signed-off-by: Stefan Priebe <s.priebe@profihost.ag>
2014-10-23 10:57:22 +02:00
Dietmar Maurer
336ec53a48 fix vzdump --exclude-path 2012-05-30 07:25:49 +02:00
Dietmar Maurer
4412265f02 check storage permissions on vzdump API 2012-02-06 11:41:48 +01:00
Dietmar Maurer
98e84b16d5 set permissions for VZDump API 2012-02-06 11:17:42 +01:00
Dietmar Maurer
a7e42354de fix bug 45: skip external VMs 2011-11-28 10:19:48 +01:00
Dietmar Maurer
f4a8bab48f allow exclude-path in /etc/vzdump.conf 2011-11-28 08:14:58 +01:00
Dietmar Maurer
49046e5392 fix bug 39: proxy backup request to correct node 2011-11-17 11:51:47 +01:00
Dietmar Maurer
31aef76131 cleanup vzdump backup/cron code 2011-10-31 08:47:18 +01:00
Dietmar Maurer
ac27b58d10 finnish and cleanup vzdump API 2011-10-25 09:28:55 +02:00
Dietmar Maurer
30edfad922 start backup/restore GUI 2011-10-18 12:49:14 +02:00
Dietmar Maurer
bf58f8ddda plug VZDump into our API 2011-10-14 13:43:06 +02:00