libcontainer: Add a helper func to set CriuPath
Added a helper func to set CriuPath for LinuxFactory. Signed-off-by: Yang Hongyang <imhy.yang@gmail.com>
This commit is contained in:
parent
9d7831e41d
commit
9ade2cc5ce
|
@ -103,6 +103,15 @@ func TmpfsRoot(l *LinuxFactory) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// CriuPath returns an option func to configure a LinuxFactory with the
|
||||
// provided criupath
|
||||
func CriuPath(criupath string) func(*LinuxFactory) error {
|
||||
return func(l *LinuxFactory) error {
|
||||
l.CriuPath = criupath
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// New returns a linux based container factory based in the root directory and
|
||||
// configures the factory with the provided option funcs.
|
||||
func New(root string, options ...func(*LinuxFactory) error) (Factory, error) {
|
||||
|
|
|
@ -37,10 +37,7 @@ func loadFactory(context *cli.Context) (libcontainer.Factory, error) {
|
|||
return nil, fmt.Errorf("systemd cgroup flag passed, but systemd support for managing cgroups is not available")
|
||||
}
|
||||
}
|
||||
return libcontainer.New(abs, cgroupManager, func(l *libcontainer.LinuxFactory) error {
|
||||
l.CriuPath = context.GlobalString("criu")
|
||||
return nil
|
||||
})
|
||||
return libcontainer.New(abs, cgroupManager, libcontainer.CriuPath(context.GlobalString("criu")))
|
||||
}
|
||||
|
||||
// getContainer returns the specified container instance by loading it from state
|
||||
|
|
Loading…
Reference in New Issue