Skip to content

Commit

Permalink
Teardown replica when replication fails
Browse files Browse the repository at this point in the history
When disk replication fails during live storage migration, we detect it
properly, fail the operation and remove the disk from the destination
storage domain. However, we didn't tear down the replica on the host
that executes the replication and therefore, if the removal of the
destination disk was done on a different host, we had leftovers
remaining on the host that executed the replication.

This patch changes the diskReplicateFinish function to tear down the
replicate when the corresponding block job doesn't exist in order to
prevent this scenario of having leftovers on the host that could lead to
data corruption later on.

Bug-Url: https://bugzilla.redhat.com/2193392
Signed-off-by: Arik Hadas <ahadas@redhat.com>
  • Loading branch information
ahadas authored and aesteve-rh committed Jul 17, 2023
1 parent 8cb3d98 commit 5dfc982
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/vdsm/virt/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4443,6 +4443,13 @@ def diskReplicateFinish(self, srcDisk, dstDisk):
"srcDisk: %r, job: %r)",
drive.name, srcDisk, blkJobInfo)

# best-effort attempt to tear down the replica
try:
self.cif.teardownVolumePath(drive.diskReplicate)
except Exception as e:
self.log.exception("Failed to teardown replica of %s: %s",
drive, e)

# Making sure that we don't have any stale information
self._delDiskReplica(drive)
return response.error('replicaErr')
Expand Down

0 comments on commit 5dfc982

Please sign in to comment.