-
Notifications
You must be signed in to change notification settings - Fork 1.1k
server: Remove the mount points after stopping the containers #383
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
Conversation
|
Reviewed.. LGTM |
server/container_remove.go
Outdated
| return nil, fmt.Errorf("failed to delete container %s: %v", c.ID(), err) | ||
| } | ||
|
|
||
| s.releaseContainerName(c.Name()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can keep the removing in-memory state last. That way we can support idempotent operations and clear them from in-memory state only once the container is removed and storage is cleaned up. WDYT?
server/sandbox_remove.go
Outdated
| return nil, fmt.Errorf("failed to remove pod sandbox %s: %v", sb.id, err) | ||
| } | ||
|
|
||
| s.releaseContainerName(podInfraContainer.Name()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. The in-memory state could be cleared after storage cleanup.
|
hmm dualing lock metaphors.. in-memory state vs reference to mount point.. |
server/container_remove.go
Outdated
|
|
||
| s.removeContainer(c) | ||
|
|
||
| if err := s.ctrIDIndex.Delete(c.ID()); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block is also in-memory state and can be moved down.
server/sandbox_remove.go
Outdated
|
|
||
| s.releasePodName(sb.name) | ||
| s.removeSandbox(sb.id) | ||
| if err := s.podIDIndex.Delete(sb.id); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be moved down, too.
server/sandbox_remove.go
Outdated
|
|
||
| s.removeContainer(podInfraContainer) | ||
| sb.infraContainer = nil | ||
| s.removeSandbox(sb.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just this line should be moved after s.ctrIDIndex.Delete. Otherwise looks good. Thanks!
|
|
When starting pods or containers, we create the mount points first. It seems natural to do something symetrical when stopping pods or containers, i.e. removing the mount point at last. Also, the current logic may not work with VM based containers as the hypervisor may hold a reference on the mount point while we're trying to remove them. Signed-off-by: Samuel Ortiz <[email protected]>
|
LGTM, ping @mrunalp |
|
LGTM |
When starting pods or containers, we create the mount points
first. It seems natural to do something symetrical when stopping
pods or containers, i.e. removing the mount point at last.
Also, the current logic may not work with VM based containers as the
hypervisor may hold a reference on the mount point while we're trying to
remove them.
Signed-off-by: Samuel Ortiz [email protected]