mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-13 13:46:46 +00:00
Merge pull request #131 from merwick/master
qemu: Add NoReboot config Knob for qemuParams
This commit is contained in:
commit
6c3315ba8a
@ -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")
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user