-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: rajasec <rajasec79@gmail.com> Adding bundle path Signed-off-by: Rajasekaran <rajasec79@gmail.com>
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
}, | ||
} |