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 <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner 2020-10-29 14:31:32 +01:00 committed by Fabian Grünbichler
parent c2c96d7378
commit 19ff368213

View File

@ -224,6 +224,10 @@ sub prepare {
$self->{replication_jobcfg} = $repl_conf->find_local_replication_job($vmid, $self->{node}); $self->{replication_jobcfg} = $repl_conf->find_local_replication_job($vmid, $self->{node});
$self->{is_replicated} = $repl_conf->check_for_existing_jobs($vmid, 1); $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); PVE::QemuConfig->check_lock($conf);
my $running = 0; my $running = 0;