mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-27 15:57:09 +00:00
virtcontainers: unmount host mounts if container can't be created
Mount points, like `resolv.conf` and `hostname` are left in the host when the cgroup creation fails. Use `unmountHostMounts()` and `bindUnmountContainerRootfs()` in the rollback function that is called when container's creation fails. fixes #2108 Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
c7b4c5eab9
commit
eca7bd2705
@ -857,6 +857,12 @@ func (c *Container) rollbackFailingContainerCreation() {
|
||||
if err := c.removeDrive(); err != nil {
|
||||
c.Logger().WithError(err).Error("rollback failed removeDrive()")
|
||||
}
|
||||
if err := c.unmountHostMounts(); err != nil {
|
||||
c.Logger().WithError(err).Error("rollback failed unmountHostMounts()")
|
||||
}
|
||||
if err := bindUnmountContainerRootfs(c.ctx, kataHostSharedDir(), c.sandbox.id, c.id); err != nil {
|
||||
c.Logger().WithError(err).Error("rollback failed bindUnmountContainerRootfs()")
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Container) checkBlockDeviceSupport() bool {
|
||||
|
Loading…
Reference in New Issue
Block a user