Commit Graph

122 Commits

Author SHA1 Message Date
Dominic Jäger
dc6e0a523a vzdump: Fix typo in UPID error message
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
2020-09-29 11:09:38 +02:00
Fabian Ebner
de2d177ec6 make use of archive_info and archive_remove
to avoid some code duplication.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-08-20 17:41:04 +02:00
Aaron Lauterer
eb0021502a backup: fix #2913 order jobs numerically by VMID
At this point, the VMIDs are already numerically sorted by the
PVE::VZDump::check_vmids method. Calling another sort on the array,
especially without `{$a <=> $b}`, resulted in reordering the array
alphabetically.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2020-08-11 13:48:19 +02:00
Fabian Grünbichler
01fc36722d vzdump: use configured tmpdir for PBS
instead of always using the default hard-coded one.

otherwise, suspend mode container backups might run out of space even though the admin configured a big enough tmpdir.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-08-06 16:03:05 +02:00
Stoiko Ivanov
5d0d14f179 VZDump: add TARFILE to environment for hookscripts
The renaming of tarfile to target in 6cba1855d8
can break existing vzdump hook scripts of users.
by setting the TARFILE variable in addition to TARGET the scripts will continue
to work.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2020-07-14 10:27:18 +02:00
Thomas Lamprecht
ef7d3fdd04 vzdump: use more general 'guest' instead of 'vm'
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-07-14 10:26:50 +02:00
Thomas Lamprecht
310cde8bab vzdump: render a duration of 0s as <1s
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-07-14 10:26:14 +02:00
Aaron Lauterer
da7cb515c0 vzdump: included_guest: return empty hash if no guests selected
This will fix the behaviour when calling `vzdump --stop` to cause all
local guests to be backed up.

When refactoring this logic in commit df5875b4, the assumption was that
every call will have one of the following parameters set: pool, list of
VMIDs or all (intentional or when exclude is used).

There is an addtional possibility, that vzdump is called with only
--stop. Thus there are no other parameters that would indicate which
VMIDs to include.

In this case we want to return the empty hash.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2020-07-09 13:30:47 +02:00
Thomas Lamprecht
e21a31a71f vzdump: drop usless pbs upload finished log message
this is implied, if not there should be an error.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-07-06 22:03:42 +02:00
Thomas Lamprecht
b3c3304ffc vzdump: set target key for PBS based backups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-07-03 16:49:19 +02:00
Thomas Lamprecht
6cba1855d8 vzdump: rename tasks 'tarfile' key to 'target'
Even now we can have plain vma files which, while an archive, are not
a TARfile.
Use the generic (backup) target as key instead. Makes it less
confusing to be reused for PBS in a later patch.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-07-03 16:45:22 +02:00
Fabian Ebner
5b6b72e6ee Simplify how maxfiles is determined
No functional change is intended.
The preference order is: option, then storage config, then vzdump defaults.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-06-30 13:55:11 +02:00
Fabian Ebner
3a805f8d68 storage_info: avoid duplication
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-06-30 13:54:32 +02:00
Fabian Ebner
a6fcd7d9d4 Die if dumpdir and storage are both defined
dumpdir will be overwritten if a storage is specified

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-06-30 13:54:16 +02:00
Thomas Lamprecht
50ba40ec59 vzdump: move VMID sorting to check_vmids
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-06-17 15:45:56 +02:00
Thomas Lamprecht
05447e0459 vzdump: import split_list and cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-06-17 15:45:21 +02:00
Thomas Lamprecht
f839f3d153 vzdump: style fix, trailing comma and closing brace on new line
also sort the hash definition

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-06-17 15:39:46 +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
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
Thomas Lamprecht
9c3a51ee22 vzdump: format size: future proof against huge VM disks
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-06-08 15:54:35 +02:00
Dietmar Maurer
071e573a13 PVE/VZDump.pm: use new --quiet option for proxmox-backup-client prune 2020-06-03 11:08:50 +02:00
Fabian Grünbichler
7ddcb3afda vzdump: set 'pbs' option when backing up to PBS target
this unifies the logic into a single place instead of all over this
module and the plugins.

it also fixes tons of 'uninitialized value' warnings when backing up
with --dumpdir but no --storage set, since the existing conditions for
PBS targets are missing a definedness check.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-05-06 16:21:41 +02:00
Fabian Grünbichler
7420d7ff95 zstd: add --rsyncable flag
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-05-04 12:19:31 +02:00
Alwin Antreich
3e2c5105f8 Fix #2124: Add support for zstd
This patch adds the zstd to the compression selection for backup on the
GUI and add .zst to the backup file filter. Including zstd as package
install dependency.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2020-05-04 10:41:59 +02:00
Thomas Lamprecht
3d45fe518b followup: whitespace and indentation cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-12 17:44:26 +01:00
Moayad Almalat
5979889332 fix #2634: print specific error if hook-script is not executable
Signed-off-by: Moayad Almalat <m.almalat@proxmox.com>
Tested-by: Oguz Bektas <o.bektas@proxmox.com>
2020-03-12 16:32:32 +01:00
Dietmar Maurer
1a87db9e56 vzdump: add support for proxmox backup server 2020-02-19 14:02:05 +01:00
Thomas Lamprecht
df2d3636f4 VZDump: sort module usage
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-02-10 11:16:32 +01:00
Stefan Reiter
819e4ff59c fix #2509: add --rsyncable to pigz again
fixes commit e953f92adf

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-12-16 11:39:59 +01:00
Dominic Jäger
ce84a9506d Fix #352: Limit the length of backup logs for mails
When creating a backup the log part can make the mail too big to be
transferred. To ensure delivery, two measures are taken:
1. Always omit the status lines
2. Omit the whole log part if a mail becomes (too) big

Additionally, add a check for missing log files.

Co-developed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
2019-11-19 15:02:50 +01:00
Fabian Grünbichler
3ac3653e63 use PVE::DataCenterConfig
to make sure that the corresponding cfs_read_file works() works.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-18 12:25:35 +01: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
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
Thomas Lamprecht
7618913027 perl: fix some common typos found with codespell
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-15 10:40:20 +02:00
Oguz Bektas
6c09101a02 change error message related to maxbackups
make the message a bit more informative (with help from thomas), namely
mentioning the ability to change/increase the limit.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2019-06-11 18:25:10 +02:00
Thomas Lamprecht
1e4583d5de vzdump: new: code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-11 17:38:18 +02:00
Thomas Lamprecht
4e0947c88b vzdump: allow plugins to set guest resume time
This refactors things a bit to avoid having the same two lines in 3
places and allows the plugin to set the "guest was resumed" time
stamp at the point it really was resumed, not only once the backup
completed (see #503). Further, if a plugin prints it's own
"resumed/running after X seconds" message, it can unset the vmstop
time and thus avoid printing the message twice.

related to a fix for #503

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-15 14:30:45 +02:00
Dominic Jäger
29f26f6ddb Fix #482: Add timestamps to backup create task log
Adding timestamps to the log messages facilitates troubleshooting.

We only log this in the task log, as the syslog and the backup log
(stored together with the backup on the target storage) already have
date/time prefixed, so only the task log missed this info in case of
multiple backups tasks for a single job.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
2019-04-24 09:17:06 +00:00
Thomas Lamprecht
9ff893ae52 vzdump: code cleanup empty newlines
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-16 14:16:21 +00:00
Thomas Lamprecht
e2b5eb29b5 vzdump: use strftime for backup basename assembly
we already use POSIX strftime a lot in the stack, so nothing new,
also just use the perl built in localtime

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-16 14:09:03 +00:00
Alwin Antreich
59abc310f0 Add cephfs to allowed storages for vzdump backup
Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2018-07-04 16:57:32 +02:00
Wolfgang Link
6d09915c51 Add CIFS in strorage info to allow backup. 2018-04-05 13:48:52 +02:00
Fabian Grünbichler
998e4eebe7 VZDump: handle timelocal year correctly
while this is unlikely to cause any problems, it is unnecessary to
substract 1900 here - timelocal handles 4-digit years perfectly well.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2018-03-07 11:36:31 +01:00
Thomas Lamprecht
f2e9079f0d remove obsolete Posix use clause
besides the cleanup purpose this fixes an actual problem, perls POSIX
module has the following caveat:

`Everything is exported by default (with a handful of exceptions).
This is an unfortunate backwards compatibility feature and its use is
strongly discouraged. You should either prevent the exporting (by
saying "use POSIX ();", as usual) and then use fully qualified names
(e.g.  "POSIX::SEEK_END"), or give an explicit import list. If you do
neither and opt for the default (as in "use POSIX;"), you will import
hundreds and hundreds of symbols into your namespace.'

see `perldoc POSIX`

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-09-25 15:18:25 +02:00
Thomas Lamprecht
a5c9479705 use log method from base VZDump::Plugin
we copied our log method over there to resolve a cyclic dependency,
now use it here to reduce code duplication.
As we are below pve-guest-common in the dpendency hierachy we may use
it, but it does not may (or at least should) use us.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-09-22 09:34:09 +02:00
Thomas Lamprecht
8555b100bb vzdump/pigz: use ProcFSTools for core count, not sysconf
A "sysconf(84)" is not really descripitve. There is no POSIX const
entry for _SC_NPROCESSORS_ONLN (number of processors online) as its
not standard but an adoption of glibc.
Better just use our proven ProcFSTool's cpuinfo method for getting
the desired information.

This is kept only for backwards compatibillity as we guaranteed that
we use #cpus/2 if 'pigz' is set to 1, else I would have removed this
alltogether and just directly passed 'pigz' to the command...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-09-20 12:34:22 +02:00
Fabian Grünbichler
c3b58274d4 fix #1389: vzdump: handle storage failure in new()
otherwise the mail notification is not triggered

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-06-08 16:20:03 +02:00
Dietmar Maurer
9f07075f0a vzdump: do not generate locale specific time stamps
Avoid perl warning: Wide character in print
2017-04-24 07:17:21 +02:00