mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-30 04:34:27 +00:00
qemu: allow to create a stopped guest
When Knobs.Stopped is set, the guest CPU will not be started at startup. Signed-off-by: Peng Tao <bergwolf@gmail.com>
This commit is contained in:
parent
283d7df99e
commit
723bc5f3c6
@ -1182,6 +1182,9 @@ type Knobs struct {
|
|||||||
// Only active when Realtime is set to true
|
// Only active when Realtime is set to true
|
||||||
Mlock bool
|
Mlock bool
|
||||||
|
|
||||||
|
// Stopped will not start guest CPU at startup
|
||||||
|
Stopped bool
|
||||||
|
|
||||||
// Realtime will enable realtime QEMU
|
// Realtime will enable realtime QEMU
|
||||||
Realtime bool
|
Realtime bool
|
||||||
}
|
}
|
||||||
@ -1521,6 +1524,10 @@ func (config *Config) appendKnobs() {
|
|||||||
config.qemuParams = append(config.qemuParams, "mlock=off")
|
config.qemuParams = append(config.qemuParams, "mlock=off")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.Knobs.Stopped == true {
|
||||||
|
config.qemuParams = append(config.qemuParams, "-S")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (config *Config) appendBios() {
|
func (config *Config) appendBios() {
|
||||||
|
@ -388,7 +388,7 @@ func TestAppendEmptyDevice(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAppendKnobsAllTrue(t *testing.T) {
|
func TestAppendKnobsAllTrue(t *testing.T) {
|
||||||
var knobsString = "-no-user-config -nodefaults -nographic -daemonize -realtime mlock=on"
|
var knobsString = "-no-user-config -nodefaults -nographic -daemonize -realtime mlock=on -S"
|
||||||
knobs := Knobs{
|
knobs := Knobs{
|
||||||
NoUserConfig: true,
|
NoUserConfig: true,
|
||||||
NoDefaults: true,
|
NoDefaults: true,
|
||||||
@ -399,6 +399,7 @@ func TestAppendKnobsAllTrue(t *testing.T) {
|
|||||||
FileBackedMemShared: true,
|
FileBackedMemShared: true,
|
||||||
Realtime: true,
|
Realtime: true,
|
||||||
Mlock: true,
|
Mlock: true,
|
||||||
|
Stopped: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
testAppend(knobs, knobsString, t)
|
testAppend(knobs, knobsString, t)
|
||||||
@ -415,6 +416,7 @@ func TestAppendKnobsAllFalse(t *testing.T) {
|
|||||||
FileBackedMemShared: false,
|
FileBackedMemShared: false,
|
||||||
Realtime: false,
|
Realtime: false,
|
||||||
Mlock: false,
|
Mlock: false,
|
||||||
|
Stopped: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
testAppend(knobs, knobsString, t)
|
testAppend(knobs, knobsString, t)
|
||||||
|
Loading…
Reference in New Issue
Block a user