Update libcontainerd to use containerd 1.0
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com> Upstream-commit: ddae20c032058a0fd42c34c2e9750ee8f6296ac8 Component: engine
This commit is contained in:
@@ -48,9 +48,10 @@ func GetPluginGetter() plugingetter.PluginGetter {
|
||||
|
||||
// authorizationPlugin is an internal adapter to docker plugin system
|
||||
type authorizationPlugin struct {
|
||||
plugin *plugins.Client
|
||||
name string
|
||||
once sync.Once
|
||||
initErr error
|
||||
plugin *plugins.Client
|
||||
name string
|
||||
once sync.Once
|
||||
}
|
||||
|
||||
func newAuthorizationPlugin(name string) Plugin {
|
||||
@@ -95,7 +96,6 @@ func (a *authorizationPlugin) AuthZResponse(authReq *Request) (*Response, error)
|
||||
// initPlugin initializes the authorization plugin if needed
|
||||
func (a *authorizationPlugin) initPlugin() error {
|
||||
// Lazy loading of plugins
|
||||
var err error
|
||||
a.once.Do(func() {
|
||||
if a.plugin == nil {
|
||||
var plugin plugingetter.CompatPlugin
|
||||
@@ -108,11 +108,11 @@ func (a *authorizationPlugin) initPlugin() error {
|
||||
plugin, e = plugins.Get(a.name, AuthZApiImplements)
|
||||
}
|
||||
if e != nil {
|
||||
err = e
|
||||
a.initErr = e
|
||||
return
|
||||
}
|
||||
a.plugin = plugin.Client()
|
||||
}
|
||||
})
|
||||
return err
|
||||
return a.initErr
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package mount
|
||||
import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// GetMounts retrieves a list of mounts for the current running process.
|
||||
@@ -74,12 +76,18 @@ func RecursiveUnmount(target string) error {
|
||||
if !strings.HasPrefix(m.Mountpoint, target) {
|
||||
continue
|
||||
}
|
||||
if err := Unmount(m.Mountpoint); err != nil && i == len(mounts)-1 {
|
||||
logrus.Debugf("Trying to unmount %s", m.Mountpoint)
|
||||
err = Unmount(m.Mountpoint)
|
||||
if err != nil && i == len(mounts)-1 {
|
||||
if mounted, err := Mounted(m.Mountpoint); err != nil || mounted {
|
||||
return err
|
||||
}
|
||||
// Ignore errors for submounts and continue trying to unmount others
|
||||
// The final unmount should fail if there ane any submounts remaining
|
||||
} else if err != nil {
|
||||
logrus.Errorf("Failed to unmount %s: %v", m.Mountpoint, err)
|
||||
} else if err == nil {
|
||||
logrus.Debugf("Unmounted %s", m.Mountpoint)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package system
|
||||
|
||||
import "os"
|
||||
|
||||
// IsProcessAlive returns true if process with a given pid is running.
|
||||
func IsProcessAlive(pid int) bool {
|
||||
_, err := os.FindProcess(pid)
|
||||
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// KillProcess force-stops a process.
|
||||
func KillProcess(pid int) {
|
||||
p, err := os.FindProcess(pid)
|
||||
if err == nil {
|
||||
p.Kill()
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ func EnsureRemoveAll(dir string) error {
|
||||
|
||||
// track retries
|
||||
exitOnErr := make(map[string]int)
|
||||
maxRetry := 5
|
||||
maxRetry := 50
|
||||
|
||||
// Attempt to unmount anything beneath this dir first
|
||||
mount.RecursiveUnmount(dir)
|
||||
|
||||
Reference in New Issue
Block a user