Fix compile and unit test errors after merge

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby
2014-03-27 08:25:01 +00:00
parent eab56ac007
commit 2d270c4f06
7 changed files with 43 additions and 75 deletions
-1
View File
@@ -404,7 +404,6 @@ func populateCommand(c *Container) {
User: c.Config.User,
Config: driverConfig,
Resources: resources,
Context: c.Config.Context,
}
c.command.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
}
+18 -7
View File
@@ -30,9 +30,9 @@ lxc.pts = 1024
# disable the main console
lxc.console = none
{{if getProcessLabel .Context}}
lxc.se_context = {{ getProcessLabel .Context}}
{{$MOUNTLABEL := getMountLabel .Context}}
{{if getProcessLabel .Config}}
lxc.se_context = {{ getProcessLabel .Config}}
{{$MOUNTLABEL := getMountLabel .Config}}
{{end}}
# no controlling tty at all
@@ -147,12 +147,23 @@ func getMemorySwap(v *execdriver.Resources) int64 {
return v.Memory * 2
}
func getProcessLabel(c execdriver.Context) string {
return c["process_label"]
func getProcessLabel(c map[string][]string) string {
return getLabel(c, "process")
}
func getMountLabel(c execdriver.Context) string {
return c["mount_label"]
func getMountLabel(c map[string][]string) string {
return getLabel(c, "mount")
}
func getLabel(c map[string][]string, name string) string {
label := c["label"]
for _, l := range label {
parts := strings.SplitN(l, "=", 2)
if parts[0] == name {
return parts[1]
}
}
return ""
}
func init() {
+2 -1
View File
@@ -2,13 +2,14 @@ package runtime
import (
"github.com/dotcloud/docker/runconfig"
"github.com/dotcloud/docker/utils"
"testing"
)
func TestMergeLxcConfig(t *testing.T) {
var (
hostConfig = &runconfig.HostConfig{
LxcConf: []runconfig.KeyValuePair{
LxcConf: []utils.KeyValuePair{
{Key: "lxc.cgroups.cpuset", Value: "1,2"},
},
}