Add info for driver
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
1c79b747bb
commit
cfd188e925
3 changed files with 24 additions and 5 deletions
|
@ -55,10 +55,26 @@ func init() {
|
|||
}
|
||||
|
||||
type driver struct {
|
||||
root string
|
||||
}
|
||||
|
||||
func NewDriver() (*driver, error) {
|
||||
return &driver{}, nil
|
||||
type info struct {
|
||||
ID string
|
||||
driver *driver
|
||||
}
|
||||
|
||||
func (i *info) IsRunning() bool {
|
||||
p := filepath.Join(i.driver.root, "containers", i.ID, "rootfs", ".nspid")
|
||||
if _, err := os.Stat(p); err == nil {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func NewDriver(root string) (*driver, error) {
|
||||
return &driver{
|
||||
root: root,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (int, error) {
|
||||
|
@ -98,7 +114,10 @@ func (d *driver) Restore(c *execdriver.Command) error {
|
|||
}
|
||||
|
||||
func (d *driver) Info(id string) execdriver.Info {
|
||||
return nil
|
||||
return &info{
|
||||
ID: id,
|
||||
driver: d,
|
||||
}
|
||||
}
|
||||
|
||||
func (d *driver) Name() string {
|
||||
|
|
|
@ -1044,7 +1044,7 @@ func TestEnv(t *testing.T) {
|
|||
goodEnv := []string{
|
||||
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
||||
"HOME=/",
|
||||
"container=lxc",
|
||||
"container=docker",
|
||||
"HOSTNAME=" + utils.TruncateID(container.ID),
|
||||
"FALSE=true",
|
||||
"TRUE=false",
|
||||
|
|
|
@ -704,7 +704,7 @@ func NewRuntimeFromDirectory(config *DaemonConfig, eng *engine.Engine) (*Runtime
|
|||
|
||||
sysInfo := sysinfo.New(false)
|
||||
|
||||
ed, err := namespaces.NewDriver()
|
||||
ed, err := namespaces.NewDriver(config.Root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue