Fabian Ebner [Tue, 11 May 2021 12:59:54 +0000 (14:59 +0200)]
snapshot_destroy: make interface agnostic to source/dest
Also drop the 'method' parameter which is not used consistently (e.g. ignored
in the later half of the very same function, in snapshot_exist, vm_exists,...),
and not documented. Simply rely on the presence of the IP address as is done in
many other places already.
In snapshot_add, there is no need to try and destroy the snapshot on the
destination (did happen previously, because $dest was passed along), because we
just failed to create the snapshot on the source side.
Fabian Ebner [Tue, 11 May 2021 12:59:52 +0000 (14:59 +0200)]
remove all old snapshots belonging to a job
Changing maxsnap to something smaller can lead to left-over snaphsots otherwise,
as previously at most one snapshot would be removed, even if there are multiple
old snapshots according to the new setting.
Hopefully nobody relied on the fact that pve-zsync didn't clean up after itself
in such cases...
Negative values and 0 for 'maxsnap' should still be interpreted as infinity to
match the previous behavior.
Fabian Ebner [Tue, 11 May 2021 12:59:50 +0000 (14:59 +0200)]
param_to_job: handle --maxsnap 0 on creation
format_job expects the value to be set, so creating a job with '--maxsnap 0' led
to '--maxsnap' being written without an argument, and thus a (for zsync)
unparsable cron file.
However, issuing sync jobs via CLI with '--maxsnap 0' works with 0 being treated
as unlimited. There is a default value, so no need to worry about definedness,
simply pass along the value.
Fabian Ebner [Tue, 4 May 2021 08:10:04 +0000 (10:10 +0200)]
fix #1669: add prepend-storage-id flag
so one can set up jobs for guests with disks with the same name on different
storages. For example,
storageA:vm-123-disk-0
storageB:vm-123-disk-0
will be synced to
target/storageA/vm-123-disk-0
target/storageB/vm-123-disk-0
when the flag is specified.
The necessary parent file systems (one per storage ID) are created as needed.
Fabian Ebner [Tue, 4 May 2021 08:09:57 +0000 (10:09 +0200)]
usage: describe flag parameters correctly
It's not possible to provide a false value. From the documentation for
GetOptionsFromArray:
The argument specification is optional. If omitted, the option is considered
boolean, a value of 1 will be assigned when the option is used on the
command line.
Make it clear that specifying the flag alone already enables it.
Fabian Ebner [Thu, 17 Dec 2020 14:17:39 +0000 (15:17 +0100)]
fix #2821: only abort if there really is a waiting/syncing job
by remembering the process via PID+start time+boot ID and checking for that
information in the new instance. If the old instance can't be found, the new
one will continue and register itself in the state.
After updating the pve-zsync package, if there is a waiting instance running the
old version, one more might be created, because there is no instance_id yet. But
the new instance will set the instance_id, which any later instance will see.
More importantly, if the state is wrongly 'waiting' or 'syncing', i.e.
because an instance was terminated before finishing, we don't abort anymore and
recover from the wrong state, thus fixing the bug.
Wolfgang Link [Wed, 18 Mar 2020 06:51:12 +0000 (07:51 +0100)]
check for correct incremental sync snapshot on destination
For an incremental sync you need the last_snap on both sides. The
call to the zfs list contains the snapshot. If the snapshot does not
exist, the command is returned with an error that we are catching.
Signed-off-by: Wolfgang Link <w.link@proxmox.com> Reviewed-By: Fabian Ebner <f.ebner@proxmox.com> Tested-By: Fabian Ebner <f.ebner@proxmox.com>
Fabian Ebner [Thu, 10 Oct 2019 09:55:17 +0000 (11:55 +0200)]
Check whether job has been disabled while waiting/syncing
There are two new checks that allow disabling a job while
it is 'syncing' or 'waiting'. Previously when sync finished
it would re-enable such a job involuntarily.
Disabling a 'waiting' job causes it to not sync anymore.
Fabian Ebner [Thu, 10 Oct 2019 09:55:16 +0000 (11:55 +0200)]
Detect other running instances of the same job
A 'waiting' state is introduced and other 'waiting' and 'syncing'
instances of the same job are now detected by moving the check out
from the sync lock.
Fabian Ebner [Thu, 10 Oct 2019 09:55:14 +0000 (11:55 +0200)]
Refactor locking
This introduces a new locked() mechanism allowing to enclose locked
sections in a cleaner way. There's only two types of locks namely one
for state and cron (they are always read together and almost always
written together) and one for sync.
Mira Limbeck [Wed, 3 Apr 2019 12:23:04 +0000 (14:23 +0200)]
close #1933: add -dest-config-path option
this allows the config dir to be set on the destination target. this can
be useful if the default path in $CONFIG_PATH (/var/lib/pve-zsync) is not
persistent. the option is optional and falls back to $CONFIG_PATH if not
specified.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
David Limbeck [Tue, 21 Aug 2018 09:40:17 +0000 (11:40 +0200)]
fix #1860 added ability to specify source and destination user
source user and destination user can be specified with -source-user and
-dest-user, root is chosen if none is specified, -source-user is invalid
for VMs as source
requires zfs permissions on source and destination target
destination dataset has to be created already but not mounted