Merge pull request #131 from merwick/master

qemu: Add NoReboot config Knob for qemuParams
This commit is contained in:
Julio Montes 2020-07-28 08:52:09 -05:00 committed by GitHub
commit 6c3315ba8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -2122,6 +2122,9 @@ type Knobs struct {
// Realtime will enable realtime QEMU
Realtime bool
// Exit instead of rebooting
NoReboot bool
}
// IOThread allows IO to be performed on a separate thread.
@ -2457,6 +2460,10 @@ func (config *Config) appendKnobs() {
config.qemuParams = append(config.qemuParams, "-nographic")
}
if config.Knobs.NoReboot {
config.qemuParams = append(config.qemuParams, "--no-reboot")
}
if config.Knobs.Daemonize {
config.qemuParams = append(config.qemuParams, "-daemonize")
}

View File

@ -501,11 +501,12 @@ func TestAppendEmptyDevice(t *testing.T) {
}
func TestAppendKnobsAllTrue(t *testing.T) {
var knobsString = "-no-user-config -nodefaults -nographic -daemonize -realtime mlock=on -S"
var knobsString = "-no-user-config -nodefaults -nographic --no-reboot -daemonize -realtime mlock=on -S"
knobs := Knobs{
NoUserConfig: true,
NoDefaults: true,
NoGraphic: true,
NoReboot: true,
Daemonize: true,
MemPrealloc: true,
FileBackedMem: true,
@ -524,6 +525,7 @@ func TestAppendKnobsAllFalse(t *testing.T) {
NoUserConfig: false,
NoDefaults: false,
NoGraphic: false,
NoReboot: false,
MemPrealloc: false,
FileBackedMem: false,
MemShared: false,
@ -668,6 +670,18 @@ func TestAppendMemoryFileBackedMemPrealloc(t *testing.T) {
testConfigAppend(conf, knobs, memString+" "+knobsString+" "+mlockFalseString, t)
}
func TestNoRebootKnob(t *testing.T) {
conf := &Config{}
knobs := Knobs{
NoReboot: true,
}
knobsString := "--no-reboot"
mlockFalseString := "-realtime mlock=off"
testConfigAppend(conf, knobs, knobsString+" "+mlockFalseString, t)
}
var kernelString = "-kernel /opt/vmlinux.container -initrd /opt/initrd.container -append root=/dev/pmem0p1 rootflags=dax,data=ordered,errors=remount-ro rw rootfstype=ext4 tsc=reliable"
func TestAppendKernel(t *testing.T) {