Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

CSI node plugin fix for unstaging volumes#3178

Open
beornf wants to merge1 commit intomoby:master
base:master
Choose a base branch
Loading
frombeornf:node-plugin-unstage-volume

Conversation

beornf
Copy link

- What I did
While running a CSI volume plugin that supports staging, I created a new swarm service that initiated an attempt to unpublish a cluster volume. The node agent callsNodeUnpublishVolume which returns no errors thenNodeUnstageVolume which also returns no errors. However, there was no call to the underlying plugin driver forNodeUnstageVolume.

- How I did it
Fixed the unpublish check to only return in the failing condition that the volume was not unpublished.

- How to test it
Create a cluster volume using CSI volume plugin then trigger a publish and unpublish by creating a swarm service and restarting the service.

- Description for the changelog

Signed-off-by: Beorn Facchini <beornf@gmail.com>
@beornf
Copy link
Author

beornf commentedJun 12, 2024
edited
Loading

Similarly, this early return inNodeUnpublishVolume skips the log which would be helpful in debugging:

ifv,ok:=np.volumeMap[req.ID];ok {
v.publishedPath=""
v.isPublished=false
returnnil
}
log.G(ctx).Info("volume unpublished")
returnnil

Copy link
Member

@thaJeztahthaJeztah left a comment

Choose a reason for hiding this comment

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

@dperny you're more familiar with this code; PTAL 🤗

Comment on lines +266 to 269
if v, ok := np.volumeMap[req.ID]; ok && v.isPublished {
return status.Errorf(codes.FailedPrecondition, "Volume %s is not unpublished", req.ID)
}

Copy link
Member

Choose a reason for hiding this comment

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

I'm not super-familiar with this code, but should this actually proceed if the volume was not found innp.volumeMap ?

i.e., the volume should be present if it was successfully staged. If a failure happened during staging, it wouldn't be added. Looking atNodeStageVolume further up;

iferr!=nil {
returnerr
}
v:=&volumePublishStatus{
stagingPath:stagingTarget,
}
np.volumeMap[req.ID]=v

Perhaps this should be something like;

ifv,ok:=np.volumeMap[req.ID];!ok||v.isPublished {// volume not found or is still publishedreturnstatus.Errorf(codes.FailedPrecondition,"Volume %s is not unpublished",req.ID)}

Or if it would be useful to have distinct errors for each situation

v,ok:=np.volumeMap[req.IDif!ok {returnstatus.Errorf(codes.FailedPrecondition,"Volume %s not found",req.ID)}if v.isPublished {returnstatus.Errorf(codes.FailedPrecondition,"Volume %s is not unpublished",req.ID)}

Copy link
Author

@beornfbeornfOct 18, 2024
edited
Loading

Choose a reason for hiding this comment

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

Indeed the assumptions around state for unstaging would always hold true ifnp.volumeMap was made persistent:

// volumeMap is the map from volume ID to Volume. Will place a volume once it is staged,
// remove it from the map for unstage.
// TODO: Make this map persistent if the swarm node goes down
volumeMapmap[string]*volumePublishStatus

I recall during testing it is possible that a volume had been staged before the node daemon restarted andnp.volumeMap was empty. In the methodNodeUnpublishVolume it always unpublishes the volume irrespective ofnp.volumeMap.

@olljanat
Copy link
Contributor

@beornf New test case for this would nice as CSI logic is still quite new which bugs like this exist. You can find examples from my PRs#3116 and#3123

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@thaJeztahthaJeztahthaJeztah left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@beornf@olljanat@thaJeztah

[8]ページ先頭

©2009-2025 Movatter.jp