From 19ff368213d04f61b686cdf93beed4dd6145063c Mon Sep 17 00:00:00 2001 From: Fabian Ebner Date: Thu, 29 Oct 2020 14:31:32 +0100 Subject: [PATCH] don't migrate replicated VM whose replication job is marked for removal while it didn't actually fail, we probably want to avoid the behavior: With remove_job=full: * run_replication called during migration causes the replicated volumes to be removed * migration continues by fully copying all volumes With remove_job=local: * run_replication called during migration causes the job (and local replication snapshots) to be removed * migration continues by fully copying all volumes and renaming them to avoid collision with the still existing remote volumes Signed-off-by: Fabian Ebner --- PVE/QemuMigrate.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm index 3fb28509..c6623e17 100644 --- a/PVE/QemuMigrate.pm +++ b/PVE/QemuMigrate.pm @@ -224,6 +224,10 @@ sub prepare { $self->{replication_jobcfg} = $repl_conf->find_local_replication_job($vmid, $self->{node}); $self->{is_replicated} = $repl_conf->check_for_existing_jobs($vmid, 1); + if ($self->{replication_jobcfg} && defined($self->{replication_jobcfg}->{remove_job})) { + die "refusing to migrate replicated VM whose replication job is marked for removal\n"; + } + PVE::QemuConfig->check_lock($conf); my $running = 0;