Commit Graph

84 Commits

Author SHA1 Message Date
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
Thomas Lamprecht
83ec8f816a VZDump: switch ha managed check from enabled to started
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2016-11-22 16:47:19 +01:00
Stefan Priebe
c76d010656 VZDump: die with error if plugin loading fails
Signed-off-by: Stefan Priebe <s.priebe@profihost.ag>
2016-11-17 07:06:38 +01:00
Wolfgang Bumiller
6acb632a54 vzdump: set task mode early to fix a warning
when a vzdump script is set and the backup fails early (eg.
when exceeding the number of backups) run_hook_script()
showed an uninitialized value error trying to use
$task->{mode} which is set only after prepare() was called.

This sets $task->{mode} early, still updated later to $stop
if !$running, and changes the condition for whether
cleanup() should be called to not use $task->{mode} (which
makes no real sense anyway) to using the $cleanup hash like
the rest of the code.
2016-08-19 13:54:38 +02:00
Fabian Grünbichler
0da2260fc2 vzdump: add newline in mail text
for consistency with html version and better readability
2016-07-07 11:12:24 +02:00
Wolfgang Bumiller
44b21574f0 Fix #1048: vzdump: include job-* hook logs in email 2016-07-07 10:52:58 +02:00
Wolfgang Bumiller
6cd975001f vzdump: safer cp call 2016-07-07 10:52:58 +02:00
Fabian Grünbichler
e42ae622cc fix #1005: don't exclude /var/log/?* with stdexcludes
the old behaviour can be easily restored with --exclude-path
and this seemed to surprise a lot of users.
2016-06-08 12:34:04 +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
d50472438d fix #949: add post-restart hook to vzdump 2016-04-22 10:54:18 +02:00
Fabian Grünbichler
74b47fd8e1 Fix 'mailto: ...' in /etc/vzdump.conf
allow comma-separated list of email addresses, like the API2
parameter.
2016-04-14 17:02:37 +02:00
Fabian Grünbichler
4f367c1917 VZDump: add -mailto schema desc 2016-04-14 12:46:21 +02:00
Fabian Grünbichler
3c6feff249 VZDump: remove dead code
remove get_lvm_mapping and get_lvm_device, which are not
used anywhere anymore.
2016-04-14 10:39:59 +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
Fabian Grünbichler
2fcb93475f VM -> guest in VZDump schema descriptions 2016-04-14 10:37:26 +02:00
Fabian Grünbichler
af77c16479 Spelling in VZDump descriptions 2016-04-14 10:36:58 +02:00
Dominik Csapak
d1918d1bf6 revert default compress mode for vzdump to 0
rationale is the following:

we had this as default before commit
1ab98f059e

but wrongly documented

since we set the compression mode explicitly via the gui,
we can set the default to 0, which makes some operations more
intuitive (e.g. with the -stdout parameter it makes no sense
to compress it by default)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-04-12 12:44:44 +02:00
Thomas Lamprecht
7a0a8e67bf vzdump: use sendmail from tools
use the factored out sendmail from the PVE::Tools package

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2016-04-05 06:30:11 +02:00
Wolfgang Bumiller
e94fa5cbd8 Fix #926: vzdump: config/default key regression
Add a missing defined() so that explicit `0` values in
/etc/vzdump.conf don't get replaced by their defaults.
2016-03-31 17:21:37 +02:00
Fabian Grünbichler
bbcfdc08cc use PVE::Storage::config(), not cfs_read_file() 2016-03-30 10:35:58 +02:00
Wolfgang Bumiller
1ab98f059e vzdump: fix default values
Not all document default values matched their actual
default, fix this by not maintaining two separate lists of
default values.

Note that this changes:
 - the default compression from none to the documented LZO
 - the documented default mode from stop to snapshot
2016-03-04 09:04:06 +01:00
Jean-Francois Dagenais
0568e342e8 vzdump: make sure only DOT pid files excluded
and not files like "acpid"

Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
2016-03-04 09:02:29 +01:00
Wolfgang Bumiller
c6977cf081 vzdump: revert /var/run stdexclude entry to its original
It used to be /var/run/.+pid when we used regular
expressions so now it should be /var/run/?*pid
2016-03-03 10:59:52 +01:00
Wolfgang Bumiller
b1f0911702 vzdump: don't double exclude-paths from the config
The exclude list is built from both the command line
parameters and the config. If no excludes are passed on the
command line we previously copied the defaults to it,
effectively passing them twice.
2016-03-03 09:54:11 +01:00
Wolfgang Bumiller
6368bbd484 vzdump: make exclude-path from config file work again
Call split_args() on the 'exclude-path' option read from
/etc/vzdump.conf

With the move to the generic JSONSchema::parse_config() in
commit cc61ea36 the call to split_args() for 'exclude-path'
was dropped breaking the 'exclude-path' option.
2016-03-03 09:51:05 +01:00
Thomas Lamprecht
10a9a736ed fix PVE::HA use clause so HA resources get registered
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2016-01-27 17:11:21 +01:00
Dietmar Maurer
ca2605e76f fix bug #719: vzdump - only call cleanup after prepare 2015-10-03 15:30:45 +02:00
Dietmar Maurer
1daa93803f Revert "fix bug #706: Use comma to split vmid list when building the crontab vzdump command"
This reverts commit 4bf3cc21b6.

No longer required, because vzdump accepts space separated vmid lists again.
2015-09-21 09:50:34 +02:00
Thomas Lamprecht
2de3ee58c8 Deny stop mode backups from HA managed and enabled services
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2015-09-20 09:53:12 +02:00
Wolfgang Bumiller
45f16a06e5 vzdump: replace 'find' exclude command switches
We're replacing the use of 'find' in the backup code for
various reasons, so we cannot use find-specific options
anymore. Besides, it's up to the plugin to create the
archive and there's no guarantee using 'find' even makes
sense. Even in the current code it's not being used when
hitting the rsync case anyway.

Now using simple glob patterns as that is more widely
supported.
2015-09-16 11:45:15 +02:00
Emmanuel Kasper
4bf3cc21b6 fix bug #706: Use comma to split vmid list when building the crontab vzdump command 2015-09-10 12:06:19 +02:00
Dietmar Maurer
e1bde2800b vzdump: improve bash completion 2015-09-04 09:12:10 +02:00
Thomas Lamprecht
cc61ea3661 Use JSONSchema to parse vzdump config
Instead of a lot of hardcoded if's use JSONSchema::parse_config to
parse and validate vzdump.conf. To do that $confdesc was extended
to match a valid schema.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2015-07-30 11:27:49 +02:00
Thomas Lamprecht
4341db1d2f Added functionality do disable temporary a backup job
Added an option to disable a backup job while preserving its
settings. When a job is disabled a '#' is added in front of the vzdump
command in the vzdump.cron file. So the cron job still fires,
but only a comment gets executed. If we would comment out the cron job
a bit more changes to the parser would be needed.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2015-07-27 09:15:09 +02:00
Thomas Lamprecht
778d5b6d4e Added parallel compress support for vzdump with pigz.
Added a vzdump.conf option to controll gzip compression.
When 'pigz' (defaults to 0) is >0, pigz support is enabled.
When the pigz option equals 1 pigz uses #cores/2 threads,
else it spawns N threads. To use it select gzip in the web
interface and set the aproppriate option in /etc/vzdump.conf

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2015-07-23 06:08:09 +02:00
Dietmar Maurer
8187f6b0ed load new LXC vzdump plugin 2015-04-29 09:11:44 +02:00
Dietmar Maurer
b13a7a31e0 vzdump: improve error message 2015-04-28 08:02:04 +02:00
Dietmar Maurer
dafb62468e remove OpenVZ related code
There is still no OpenVZ for kernel 3.10 or newer, so we remove that code now.
2015-03-27 13:43:59 +01: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