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
|
@ -55,10 +55,26 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
type driver struct {
|
type driver struct {
|
||||||
|
root string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDriver() (*driver, error) {
|
type info struct {
|
||||||
return &driver{}, nil
|
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) {
|
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 {
|
func (d *driver) Info(id string) execdriver.Info {
|
||||||
return nil
|
return &info{
|
||||||
|
ID: id,
|
||||||
|
driver: d,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *driver) Name() string {
|
func (d *driver) Name() string {
|
||||||
|
|
|
@ -1044,7 +1044,7 @@ func TestEnv(t *testing.T) {
|
||||||
goodEnv := []string{
|
goodEnv := []string{
|
||||||
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
||||||
"HOME=/",
|
"HOME=/",
|
||||||
"container=lxc",
|
"container=docker",
|
||||||
"HOSTNAME=" + utils.TruncateID(container.ID),
|
"HOSTNAME=" + utils.TruncateID(container.ID),
|
||||||
"FALSE=true",
|
"FALSE=true",
|
||||||
"TRUE=false",
|
"TRUE=false",
|
||||||
|
|
|
@ -704,7 +704,7 @@ func NewRuntimeFromDirectory(config *DaemonConfig, eng *engine.Engine) (*Runtime
|
||||||
|
|
||||||
sysInfo := sysinfo.New(false)
|
sysInfo := sysinfo.New(false)
|
||||||
|
|
||||||
ed, err := namespaces.NewDriver()
|
ed, err := namespaces.NewDriver(config.Root)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue