Skip to content

Commit

Permalink
Setting cgroup resources
Browse files Browse the repository at this point in the history
Signed-off-by: rajasec <rajasec79@gmail.com>

Adding bundle path

Signed-off-by: Rajasekaran <rajasec79@gmail.com>
  • Loading branch information
rajasec committed Nov 18, 2015
1 parent 7767914 commit fcd3a99
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func main() {
pauseCommand,
resumeCommand,
execCommand,
setCommand,
}
app.Before = func(context *cli.Context) error {
if context.GlobalBool("debug") {
Expand Down
51 changes: 51 additions & 0 deletions set.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package main

import (
"github.com/codegangsta/cli"
"os"
)

var setCommand = cli.Command{
Name: "set",
Usage: "set cgroup resources",
Flags: []cli.Flag{
cli.StringFlag{
Name: "bundle, b",
Value: "",
Usage: "path to the root of the bundle directory",
},
cli.StringFlag{
Name: "config-file, c",
Value: "config.json",
Usage: "path to spec file for writing",
},
cli.StringFlag{
Name: "runtime-file, r",
Value: "runtime.json",
Usage: "path for runtime file for writing",
},
},
Action: func(context *cli.Context) {
container, err := getContainer(context)
if err != nil {
fatal(err)
}
bundle := context.String("bundle")
if bundle != "" {
if err := os.Chdir(bundle); err != nil {
fatal(err)
}
}
spec, rspec, err := loadSpec(context.String("config-file"), context.String("runtime-file"))
if err != nil {
fatal(err)
}
config, err := createLibcontainerConfig(context.GlobalString("id"), spec, rspec)
if err != nil {
fatal(err)
}
if err := container.Set(*config); err != nil {
fatal(err)
}
},
}

0 comments on commit fcd3a99

Please sign in to comment.