mirror of
https://github.com/opencontainers/runc.git
synced 2025-09-27 03:46:19 +08:00
libcontainer: remove LinuxFactory
Since LinuxFactory has become the means to specify containers state top directory (aka --root), and is only used by two methods (Create and Load), it is easier to pass root to them directly. Modify all the users and the docs accordingly. While at it, fix Create and Load docs (those that were originally moved from the Factory interface docs). Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -23,19 +23,15 @@ import (
|
||||
|
||||
var errEmptyID = errors.New("container id cannot be empty")
|
||||
|
||||
// getContainer returns the specified container instance by loading it from state
|
||||
// with the default factory.
|
||||
// getContainer returns the specified container instance by loading it from
|
||||
// a state directory (root).
|
||||
func getContainer(context *cli.Context) (libcontainer.Container, error) {
|
||||
id := context.Args().First()
|
||||
if id == "" {
|
||||
return nil, errEmptyID
|
||||
}
|
||||
root := context.GlobalString("root")
|
||||
factory, err := libcontainer.New(root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return factory.Load(id)
|
||||
return libcontainer.Load(root, id)
|
||||
}
|
||||
|
||||
func getDefaultImagePath() string {
|
||||
@@ -185,11 +181,7 @@ func createContainer(context *cli.Context, id string, spec *specs.Spec) (libcont
|
||||
}
|
||||
|
||||
root := context.GlobalString("root")
|
||||
factory, err := libcontainer.New(root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return factory.Create(id, config)
|
||||
return libcontainer.Create(root, id, config)
|
||||
}
|
||||
|
||||
type runner struct {
|
||||
|
Reference in New Issue
Block a user