Closed chuan137 closed 5 months ago
thanks for the review, I agree that the exception handling needs improvement. It could work to return the replica with error states as you suggested. I think the states are then updated here, https://github.com/sapcc/manila/blob/4daad526b93b90f99b046c02a7ce24ee8bb02095/manila/share/manager.py#L2794-L2816 It's a bit clumsy to read, and in the end it always log "promoted to active state successfully", which is not always true, I think. So I try to handle the unhealthy error explicitly https://github.com/sapcc/manila/blob/4daad526b93b90f99b046c02a7ce24ee8bb02095/manila/share/manager.py#L2699C1-L2714C33 the to-be-promoted replica will be in error states, (other replicas are not touched), and a message is sent so the reason is more transparent to the user.
This pull request introduces a force option to the share-replica-promote API. Normally, Manila drivers should verify that data replication is in sync with the source before promoting a replica to prevent data loss. Nevertheless, there are situations where promotion may proceed despite the status of the replication. The inclusion of this option in the API enables users to control the behavior of the driver. Additionally, it enhances verification in the NetApp driver by inspecting the health of SnapMirror before breaking it.
Change-Id: Ia08caf6d3f5864a112ce402567eddbd0d0aa1819