From b38cce017b9f1173e7444ac6f0fef78265dac4ed Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Fri, 1 May 2015 11:53:26 -0400 Subject: [PATCH] Add a flag for specifying system properties. Signed-off-by: Mrunal Patel --- nsinit/config.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nsinit/config.go b/nsinit/config.go index 1eee9dd9..bf3506c2 100644 --- a/nsinit/config.go +++ b/nsinit/config.go @@ -44,6 +44,7 @@ var createFlags = []cli.Flag{ cli.StringFlag{Name: "veth-gateway", Usage: "veth gateway address"}, cli.IntFlag{Name: "veth-mtu", Usage: "veth mtu"}, cli.BoolFlag{Name: "cgroup", Usage: "mount the cgroup data for the container"}, + cli.StringSliceFlag{Name: "sysctl", Value: &cli.StringSlice{}, Usage: "set system properties in the container"}, } var configCommand = cli.Command{ @@ -111,6 +112,14 @@ func modify(config *configs.Config, context *cli.Context) { node.Gid = uint32(userns_uid) } } + config.SystemProperties = make(map[string]string) + for _, sysProp := range context.StringSlice("sysctl") { + parts := strings.SplitN(sysProp, "=", 2) + if len(parts) != 2 { + logrus.Fatalf("invalid system property %s", sysProp) + } + config.SystemProperties[parts[0]] = parts[1] + } for _, rawBind := range context.StringSlice("bind") { mount := &configs.Mount{ Device: "bind",