1
0
mirror of https://github.com/rancher/os.git synced 2025-09-17 07:30:42 +00:00

Add --append to ros os upgrade to pass kernel args for --kexec

This commit is contained in:
Ivan Mikushin
2016-03-22 12:16:06 -07:00
parent cb772977bd
commit 5a8d0e7f34
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{