server: Remove the mount points after stopping the containers
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 <sameo@linux.intel.com>
This commit is contained in:
parent
19e7b78aea
commit
c3cb6a133f
2 changed files with 6 additions and 4 deletions
|
@ -34,6 +34,8 @@ func (s *Server) RemoveContainer(ctx context.Context, req *pb.RemoveContainerReq
|
|||
return nil, fmt.Errorf("failed to delete container %s: %v", c.ID(), err)
|
||||
}
|
||||
|
||||
s.removeContainer(c)
|
||||
|
||||
if err := s.storage.StopContainer(c.ID()); err != nil {
|
||||
return nil, fmt.Errorf("failed to unmount container %s: %v", c.ID(), err)
|
||||
}
|
||||
|
@ -43,7 +45,6 @@ func (s *Server) RemoveContainer(ctx context.Context, req *pb.RemoveContainerReq
|
|||
}
|
||||
|
||||
s.releaseContainerName(c.Name())
|
||||
s.removeContainer(c)
|
||||
|
||||
if err := s.ctrIDIndex.Delete(c.ID()); err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue