Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rbd: check local image state during promote operation #2684

Merged
merged 1 commit into from
Dec 1, 2021

Conversation

Madhu-1
Copy link
Collaborator

@Madhu-1 Madhu-1 commented Nov 30, 2021

rbd mirroring CLI calls are async and it doesn't wait for the operation to be completed. ex:- rbd mirror image enable
it will enable the mirroring on the image but it doesn't ensure that the image is mirroring enabled and healthy
primary. The same goes for the promote volume also. This commits adds a check-in PromoteVolume to make sure the image is in a healthy state i.e up+stopped.

note:-

Signed-off-by: Madhu Rajanna madhupr007@gmail.com

@mergify mergify bot added the component/rbd Issues related to RBD label Nov 30, 2021
internal/rbd/mirror.go Outdated Show resolved Hide resolved
Copy link
Contributor

@yati1998 yati1998 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Nov 30, 2021

below is the output from VR condition when the image is not healthy primary

conditions:
    - lastTransitionTime: "2021-11-30T06:40:24Z"
      message: ""
      observedGeneration: 8
      reason: FailedToPromote
      status: "False"
      type: Completed
    - lastTransitionTime: "2021-11-30T06:40:24Z"
      message: ""
      observedGeneration: 8
      reason: Error
      status: "True"
      type: Degraded
    - lastTransitionTime: "2021-11-30T06:35:58Z"
      message: ""
      observedGeneration: 8
      reason: NotResyncing
      status: "False"
      type: Resyncing
    lastCompletionTime: "2021-11-30T06:35:58Z"
    lastStartTime: "2021-11-26T05:50:08Z"
    message: 'rpc error: code = Internal desc = replicapool/csi-vol-b2f4ee8a-4e7c-11ec-9b91-0242ac110005
      is not healthy. Image state is up=false, state="unknown"'

@Madhu-1 Madhu-1 requested review from ShyamsundarR, a team and yati1998 November 30, 2021 07:25
nixpanic
nixpanic previously approved these changes Nov 30, 2021
@Madhu-1 Madhu-1 requested review from nixpanic and a team December 1, 2021 05:10
internal/rbd/errors.go Outdated Show resolved Hide resolved
internal/rbd/replicationcontrollerserver.go Show resolved Hide resolved
@Madhu-1 Madhu-1 requested a review from humblec December 1, 2021 05:22
@mergify mergify bot dismissed nixpanic’s stale review December 1, 2021 05:23

Pull request has been modified.

internal/rbd/replicationcontrollerserver.go Outdated Show resolved Hide resolved
func checkHealthyPrimary(ctx context.Context, rbdVol *rbdVolume) error {
mirrorStatus, err := rbdVol.getImageMirroringStatus()
if err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return err -> return fmt.Errorf("failed to get mirror status: %w", err) ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getImageMirroringStatus already returning the same error message. doing this will add a duplicate error message.

Copy link
Contributor

@yati1998 yati1998 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Dec 1, 2021

/retest all

rbd mirroring CLI calls are async and it doesn't wait
for the operation to be completed. ex:- `rbd mirror image enable`
it will enable the mirroring on the image but it doesn't
ensure that the image is mirroring enabled and healthy
primary. The same goes for the promote volume also.
This commits adds a check-in PromoteVolume to make sure
the image in a healthy state i.e `up+stopped`.

note:- not considering any intermediate states to make
sure the image is completely healthy before responding
success to the RPC call.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
@mergify mergify bot merged commit 64ce5e0 into ceph:devel Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/rbd Issues related to RBD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants