Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@sameo
Copy link

@sameo sameo commented Mar 3, 2017

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]

@mikebrow
Copy link
Contributor

mikebrow commented Mar 3, 2017

Reviewed.. LGTM

return nil, fmt.Errorf("failed to delete container %s: %v", c.ID(), err)
}

s.releaseContainerName(c.Name())
Copy link
Member

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?

return nil, fmt.Errorf("failed to remove pod sandbox %s: %v", sb.id, err)
}

s.releaseContainerName(podInfraContainer.Name())
Copy link
Member

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.

@mikebrow
Copy link
Contributor

mikebrow commented Mar 3, 2017

hmm dualing lock metaphors.. in-memory state vs reference to mount point..


s.removeContainer(c)

if err := s.ctrIDIndex.Delete(c.ID()); err != nil {
Copy link
Member

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.


s.releasePodName(sb.name)
s.removeSandbox(sb.id)
if err := s.podIDIndex.Delete(sb.id); err != nil {
Copy link
Member

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.


s.removeContainer(podInfraContainer)
sb.infraContainer = nil
s.removeSandbox(sb.id)
Copy link
Member

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!

@mrunalp mrunalp added this to the 0.2 milestone Mar 16, 2017
@runcom
Copy link
Member

runcom commented Mar 20, 2017

make lint failure, LGTM otherwise

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]>
@sameo
Copy link
Author

sameo commented Mar 21, 2017

@runcom @mrunalp lint errors fixed now, thanks for the review.

@runcom
Copy link
Member

runcom commented Mar 21, 2017

LGTM, ping @mrunalp

@mrunalp
Copy link
Member

mrunalp commented Mar 21, 2017

LGTM

@mrunalp mrunalp merged commit b487a9b into cri-o:master Mar 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants