mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-29 16:32:24 +00:00
PVE::Replication - aquire guest_migration_lock during replication
To block guest migration.
This commit is contained in:
parent
ffe5a020b7
commit
1a9dc09e83
@ -11,11 +11,13 @@ use PVE::ProcFSTools;
|
|||||||
use PVE::Tools;
|
use PVE::Tools;
|
||||||
use PVE::CalendarEvent;
|
use PVE::CalendarEvent;
|
||||||
use PVE::Cluster;
|
use PVE::Cluster;
|
||||||
|
use PVE::AbstractConfig;
|
||||||
use PVE::QemuConfig;
|
use PVE::QemuConfig;
|
||||||
use PVE::QemuServer;
|
use PVE::QemuServer;
|
||||||
use PVE::LXC::Config;
|
use PVE::LXC::Config;
|
||||||
use PVE::LXC;
|
use PVE::LXC;
|
||||||
use PVE::Storage;
|
use PVE::Storage;
|
||||||
|
use PVE::GuestHelpers;
|
||||||
use PVE::ReplicationConfig;
|
use PVE::ReplicationConfig;
|
||||||
|
|
||||||
# Note: regression tests can overwrite $state_path for testing
|
# Note: regression tests can overwrite $state_path for testing
|
||||||
@ -388,7 +390,12 @@ my $run_replication = sub {
|
|||||||
|
|
||||||
$logfunc->($start_time, "$jobcfg->{id}: start replication job") if $logfunc;
|
$logfunc->($start_time, "$jobcfg->{id}: start replication job") if $logfunc;
|
||||||
|
|
||||||
eval { replicate($jobcfg, $state->{last_sync}, $start_time, $logfunc); };
|
eval {
|
||||||
|
my $timeout = 2; # do not wait too long - we repeat periodically anyways
|
||||||
|
PVE::GuestHelpers::guest_migration_lock(
|
||||||
|
$jobcfg->{guest}, $timeout, \&replicate,
|
||||||
|
$jobcfg, $state->{last_sync}, $start_time, $logfunc);
|
||||||
|
};
|
||||||
my $err = $@;
|
my $err = $@;
|
||||||
|
|
||||||
$state->{duration} = tv_interval($t0);
|
$state->{duration} = tv_interval($t0);
|
||||||
|
Loading…
Reference in New Issue
Block a user