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: discover if StagingTargetPath in NodeExpandVolume exists #3624

Merged
merged 1 commit into from
Jan 31, 2023

Conversation

Madhu-1
Copy link
Collaborator

@Madhu-1 Madhu-1 commented Jan 27, 2023

The StagingTargetPath is an optional entry in NodeExpandVolumeRequest, We cannot expect it to be permanently set, and at the same time, cephcsi depended on the StaingTargetPath to retrieve some metadata
information.

This commit will check all the mount ref and identifies the stagingTargetPath by reviewing the image-meta.json file that exists. This is a costly operation as we need to loop through all the mounts and check image-meta.json in each mount, but this happens only if the StaingTargetPath needs to be set in the NodeExpandVolumeRequest.

fixes #3623

Note :- gofmt tool I am using also fixed the indentation problem in the comment section in nodeserver.go

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

@mergify mergify bot added the component/rbd Issues related to RBD label Jan 27, 2023
@Madhu-1 Madhu-1 requested review from a team January 27, 2023 09:45
@Madhu-1 Madhu-1 force-pushed the fix-3623 branch 3 times, most recently from dc9209c to a653ee5 Compare January 27, 2023 10:47
@@ -1026,6 +1026,31 @@ func (ns *NodeServer) NodeUnstageVolume(
return &csi.NodeUnstageVolumeResponse{}, nil
}

// getStagingPath returns the staging path for the volume from the volume path.
/*
Copy link
Member

Choose a reason for hiding this comment

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

mixing of comment styles is a little odd.

Copy link
Member

@nixpanic nixpanic left a comment

Choose a reason for hiding this comment

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

just some nits, nothing serious

// If stagingTargetPath is not found in volumePath then use
// volumePath
volumePath = req.GetVolumePath()
log.ErrorLog(ctx, "failed to find stagingTargetPath from volumePath %v: %v", volumePath, err)
Copy link
Member

Choose a reason for hiding this comment

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

This isn't always an error, and there is an alternative value used... Maybe log as info?

nixpanic
nixpanic previously approved these changes Jan 30, 2023
Comment on lines 1072 to 1079
var err error
volumePath, err = ns.getStagingPath(volumePath)
if err != nil {
// If stagingTargetPath is not found in volumePath then use
// volumePath
volumePath = req.GetVolumePath()
log.UsefulLog(ctx, "failed to find stagingTargetPath from volumePath %v: %v", volumePath, err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@Madhu-1
Did you intend the code to the as follows ?

Otherwise the volumePath being sent to getStagingPath() is empty from the check on line 1066

Suggested change
var err error
volumePath, err = ns.getStagingPath(volumePath)
if err != nil {
// If stagingTargetPath is not found in volumePath then use
// volumePath
volumePath = req.GetVolumePath()
log.UsefulLog(ctx, "failed to find stagingTargetPath from volumePath %v: %v", volumePath, err)
}
var err error
volumePath, err = ns.getStagingPath(req.GetVolumePath())
if err != nil {
// If stagingTargetPath is not found in volumePath then use
// volumePath
volumePath = req.GetVolumePath()
log.UsefulLog(ctx, "failed to find stagingTargetPath from volumePath %v: %v", volumePath, 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.

Yes that correct, fixed now.

Rakshith-R
Rakshith-R previously approved these changes Jan 30, 2023
nixpanic
nixpanic previously approved these changes Jan 30, 2023
@nixpanic
Copy link
Member

@Mergifyio rebase

@mergify
Copy link
Contributor

mergify bot commented Jan 30, 2023

rebase

✅ Branch has been successfully rebased

@nixpanic nixpanic added the ok-to-test Label to trigger E2E tests label Jan 30, 2023
@github-actions
Copy link

/test ci/centos/k8s-e2e-external-storage/1.23

@github-actions
Copy link

/test ci/centos/k8s-e2e-external-storage/1.24

@github-actions
Copy link

/test ci/centos/k8s-e2e-external-storage/1.25

@github-actions
Copy link

/test ci/centos/mini-e2e-helm/k8s-1.23

@github-actions
Copy link

/test ci/centos/mini-e2e-helm/k8s-1.24

@github-actions
Copy link

/test ci/centos/mini-e2e-helm/k8s-1.25

@github-actions
Copy link

/test ci/centos/mini-e2e/k8s-1.23

@mergify mergify bot added ok-to-test Label to trigger E2E tests and removed ok-to-test Label to trigger E2E tests labels Jan 31, 2023
@nixpanic
Copy link
Member

Mergify dropped the approvals after rebase :(

I've seen that happen somewhere else too. But mostly the approvals are kept.

@mergify mergify bot merged commit e54a97b into ceph:devel Jan 31, 2023
@mergify mergify bot removed the ok-to-test Label to trigger E2E tests label Jan 31, 2023
@github-actions
Copy link

/test ci/centos/k8s-e2e-external-storage/1.23

@github-actions
Copy link

/test ci/centos/k8s-e2e-external-storage/1.24

@github-actions
Copy link

/test ci/centos/k8s-e2e-external-storage/1.25

@github-actions
Copy link

/test ci/centos/mini-e2e-helm/k8s-1.23

@github-actions
Copy link

/test ci/centos/mini-e2e-helm/k8s-1.24

@github-actions
Copy link

/test ci/centos/k8s-e2e-external-storage/1.23

@github-actions
Copy link

/test ci/centos/mini-e2e-helm/k8s-1.25

@github-actions
Copy link

/test ci/centos/k8s-e2e-external-storage/1.24

@github-actions
Copy link

/test ci/centos/mini-e2e/k8s-1.23

@github-actions
Copy link

/test ci/centos/k8s-e2e-external-storage/1.25

@github-actions
Copy link

/test ci/centos/mini-e2e/k8s-1.24

@github-actions
Copy link

/test ci/centos/mini-e2e-helm/k8s-1.23

@github-actions
Copy link

/test ci/centos/mini-e2e/k8s-1.25

@github-actions
Copy link

/test ci/centos/mini-e2e-helm/k8s-1.24

@github-actions
Copy link

/test ci/centos/upgrade-tests-cephfs

@github-actions
Copy link

/test ci/centos/mini-e2e-helm/k8s-1.25

@github-actions
Copy link

/test ci/centos/upgrade-tests-rbd

@github-actions
Copy link

/test ci/centos/mini-e2e/k8s-1.23

@github-actions
Copy link

/test ci/centos/mini-e2e/k8s-1.24

@github-actions
Copy link

/test ci/centos/mini-e2e/k8s-1.25

@github-actions
Copy link

/test ci/centos/upgrade-tests-cephfs

@github-actions
Copy link

/test ci/centos/upgrade-tests-rbd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/retry/e2e Label to retry e2e retesting on approved PR's component/rbd Issues related to RBD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

staging_path is optional parameter in the NodeExpandVolumeRequest RPC
4 participants