1
0
mirror of https://github.com/rancher/os.git synced 2025-09-01 23:04:41 +00:00

Merge pull request #820 from imikushin/kexec-kernel-args

Add --append to `ros os upgrade` to pass kernel args for --kexec
This commit is contained in:
Darren Shepherd
2016-04-04 13:41:11 -07:00
2 changed files with 17 additions and 4 deletions

View File

@@ -54,6 +54,10 @@ func osSubcommands() []cli.Command {
Name: "kexec",
Usage: "reboot using kexec",
},
cli.StringFlag{
Name: "append",
Usage: "kernel args to append by kexec",
},
},
},
{
@@ -153,7 +157,7 @@ func osUpgrade(c *cli.Context) {
if c.Args().Present() {
log.Fatalf("invalid arguments %v", c.Args())
}
if err := startUpgradeContainer(image, c.Bool("stage"), c.Bool("force"), !c.Bool("no-reboot"), c.Bool("kexec")); err != nil {
if err := startUpgradeContainer(image, c.Bool("stage"), c.Bool("force"), !c.Bool("no-reboot"), c.Bool("kexec"), c.String("append")); err != nil {
log.Fatal(err)
}
}
@@ -172,7 +176,7 @@ func yes(in *bufio.Reader, question string) bool {
return strings.ToLower(line[0:1]) == "y"
}
func startUpgradeContainer(image string, stage, force, reboot, kexec bool) error {
func startUpgradeContainer(image string, stage, force, reboot, kexec bool, kernelArgs string) error {
in := bufio.NewReader(os.Stdin)
command := []string{
@@ -182,6 +186,11 @@ func startUpgradeContainer(image string, stage, force, reboot, kexec bool) error
if kexec {
command = append(command, "-k")
kernelArgs = strings.TrimSpace(kernelArgs)
if kernelArgs != "" {
command = append(command, "-a", kernelArgs)
}
}
container, err := compose.CreateService(nil, "os-upgrade", &project.ServiceConfig{