Explorar el Código

Fix get pids for nsinit
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)

Michael Crosby hace 11 años
padre
commit
9bf6cb2692
Se han modificado 2 ficheros con 3 adiciones y 4 borrados
  1. 1 1
      execdriver/namespaces/default_template.go
  2. 2 3
      execdriver/namespaces/driver.go

+ 1 - 1
execdriver/namespaces/default_template.go

@@ -34,7 +34,7 @@ func getDefaultTemplate() *libcontainer.Container {
 			libcontainer.CLONE_NEWUTS,
 		},
 		Cgroups: &cgroups.Cgroup{
-			Name:         "docker",
+			Parent:       "docker",
 			DeviceAccess: false,
 		},
 	}

+ 2 - 3
execdriver/namespaces/driver.go

@@ -129,13 +129,11 @@ func (d *driver) Name() string {
 func (d *driver) GetPidsForContainer(id string) ([]int, error) {
 	pids := []int{}
 
-	subsystem := "cpu"
+	subsystem := "devices"
 	cgroupRoot, err := cgroups.FindCgroupMountpoint(subsystem)
 	if err != nil {
 		return pids, err
 	}
-	cgroupRoot = filepath.Dir(cgroupRoot)
-
 	cgroupDir, err := cgroups.GetThisCgroupDir(subsystem)
 	if err != nil {
 		return pids, err
@@ -252,6 +250,7 @@ func createContainer(c *execdriver.Command) *libcontainer.Container {
 			},
 		}
 	}
+	container.Cgroups.Name = c.ID
 	if c.Privileged {
 		container.Capabilities = nil
 		container.Cgroups.DeviceAccess = true