]> git.proxmox.com Git - pve-guest-common.git/commitdiff
Cleanup for stateless jobs.
authorWolfgang Link <w.link@proxmox.com>
Wed, 9 May 2018 12:48:21 +0000 (14:48 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 9 May 2018 13:10:30 +0000 (15:10 +0200)
If a VM configuration has been manually moved or recovered by HA,
there is no status on this new node.
In this case, the replication snapshots still exist on the remote side.
It must be possible to remove a job without status,
otherwise, a new replication job on the same remote node will fail
and the disks will have to be manually removed.
When searching through the sorted_volumes generated from the VMID.conf,
we can be sure that every disk will be removed in the event
of a complete job removal on the remote side.

In the end, the remote_prepare_local_job calls on the remote side a prepare.

PVE/Replication.pm

index ce267fe5d34fece3f08dc19549af51716dbac334..4d1e071e30bc075c4cbb2e2f2d8e5740580cf86b 100644 (file)
@@ -214,8 +214,13 @@ sub replicate {
 
        if ($remove_job eq 'full' && $jobcfg->{target} ne $local_node) {
            # remove all remote volumes
+           my @store_list = map { (PVE::Storage::parse_volume_id($_))[0] } @$sorted_volids;
+
+           my %hash = map { $_ => 1 } @store_list;
+
            my $ssh_info = PVE::Cluster::get_ssh_info($jobcfg->{target});
-           remote_prepare_local_job($ssh_info, $jobid, $vmid, [], $state->{storeid_list}, 0, undef, 1, $logfunc);
+
+           remote_prepare_local_job($ssh_info, $jobid, $vmid, [], [ keys %hash ], 1, undef, 1, $logfunc);
 
        }
        # remove all local replication snapshots (lastsync => 0)