Commit Graph

21 Commits

Author SHA1 Message Date
Fiona Ebner
55b1af44fd pvesr: prepare local job: remove stale replicated volumes immediately
Commit d8cd8e8cf9 introduced a
regression where only stale replicated volumes with an older
timestamp would be cleaned up. This meant that after removing a volume
from the guest config, it would only be cleaned up the second time the
replication ran afterwards. And the volume could become completely
orphaned in case the relevant storage wasn't used by the job anymore.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2022-08-02 11:05:06 +02:00
Fiona Ebner
e3e0e09637 pvesr: rename last_snapshots to local_snapshots
while dropping the instance where the local variable was unused.
prepare() was changed a while ago to return all local snapshots.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2022-08-02 11:04:55 +02:00
Wolfgang Link
64d39c2ef2 Send an email when a replication job fails.
A email notification will be send for each job when the job fails.
This message will only send when an error occurs and the fail count is on 1.

Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2017-12-13 14:51:07 +01:00
Thomas Lamprecht
ca7d070799 pvesr: allow schedule now from CLI
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-06-29 17:44:35 +02:00
Thomas Lamprecht
0cfec28cd8 pvesr status: handle disabled jobs
As the nodes replication status call also returns disabled jobs now,
we need to handle them here too.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-06-29 11:50:15 +02:00
Emmanuel Kasper
0b142737f7 Better Status description for jobs which are about to be run 2017-06-22 09:52:48 +02:00
Wolfgang Link
fdc8b76982 pvesr set_state 2017-06-12 11:40:15 +02:00
Dietmar Maurer
810c6776d9 PVE::Replication - remove dependency to PVE::LXC/PVE::QemuServer
So that we can move the whole class to package pve-guest-common.
2017-06-12 05:59:51 +02:00
Fabian Grünbichler
544bb4e2a0 pvesr: prepare_local_job: fixup
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-06-08 11:53:30 +02:00
Fabian Grünbichler
d8cd8e8cf9 pvesr: prepare_local_job: use PVE::replication::prepare
to reduce code duplication. this slightly changes behaviour
compared to the previous version:

only disks with the correct prefix are cleaned up, not all
disks with __replication* snapshots.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-06-08 11:13:47 +02:00
Wolfgang Link
37efc934a7 Fix: list_images returns now a array of hashes so adopt the code. 2017-06-08 10:29:11 +02:00
Dietmar Maurer
91ee6a2fec replication: improve stale volume detection, allow sync from parent snapshot
We pass a list of storage to scan for stale volumes to prepare_local_job().
So we make sure that we only activate/scan related storages.

Snapshot rollback may remove local replication shapshots. In that case
we still have the $conf->{parent} snapshot on both sides, so we
can use that as base snapshot.
2017-06-07 17:26:56 +02:00
Dietmar Maurer
a9da300ded PVE::API2::ReplicationConfig - extract guest ID from job ID 2017-06-07 11:30:52 +02:00
Dietmar Maurer
c364b61f8e PVE::Replication - do not pass time to logfunc
This is simply not neccessary.
2017-06-06 06:36:03 +02:00
Dietmar Maurer
f9d38c545c PVE::API2::ReplicationConfig - implement delete
We just set the remove_job property in the configuration. Actual removal
is done asynchronous inside replicate().
2017-05-31 08:23:47 +02:00
Dietmar Maurer
fcc22c0bfb pvesr finalize-local-job: add helper to cleanup job
This will be called after replication on the target node. For now, this
just removes old snapshots.
2017-05-31 08:23:47 +02:00
Dietmar Maurer
fae995063c pvesr prepare-local-job: new helper
Prepare for starting a replication job. This is called on the target
node before replication starts. This call is for internal use, and
return a JSON object on stdout. The method first test if VM <vmid>
reside on the local node. If so, stop immediately. After that the
method scans all volume IDs for snapshots, and removes all replications
snapshots with timestamps different than <last_sync>. It also removes
any unused volumes.

Returns a hash with boolean markers for all volumes with existing
replication snapshots.
2017-05-31 08:23:46 +02:00
Dietmar Maurer
f70997ea80 pvesr run: add --verbose flag
We can now pass a $logfunc parameter to replicate() to
produce more verbose logs/output. This is especially useful
for regression testing.
2017-05-31 08:23:46 +02:00
Dietmar Maurer
5c180db3b5 PVE::Replication - use new calendar events instead of interval
And implement retry algorythm after failure:

  $next_sync = $state->{last_try} + 5*60*$fail_count;

and limit to 3 failures.
2017-05-31 08:23:46 +02:00
Dietmar Maurer
483f89dd47 PVE/Replication.pm: save pid/ptime to running job state
So that we can check which job is running.
2017-05-31 08:23:46 +02:00
Dietmar Maurer
892821fd87 pvesr: add pve storage replication tool
Just added code to configure jobs. Replication itself is not
implemented.
2017-05-31 08:23:46 +02:00