mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-31 07:19:06 +00:00
Merge pull request #202 from mcastelino/topic/fix-shutdown
Add clean shutdown support
This commit is contained in:
commit
c4da1a902a
@ -2421,8 +2421,12 @@ type Knobs struct {
|
||||
Realtime bool
|
||||
|
||||
// Exit instead of rebooting
|
||||
// Prevents QEMU from rebooting in the event of a Triple Fault.
|
||||
NoReboot bool
|
||||
|
||||
// Don’t exit QEMU on guest shutdown, but instead only stop the emulation.
|
||||
NoShutdown bool
|
||||
|
||||
// IOMMUPlatform will enable IOMMU for supported devices
|
||||
IOMMUPlatform bool
|
||||
}
|
||||
@ -2795,6 +2799,10 @@ func (config *Config) appendKnobs() {
|
||||
config.qemuParams = append(config.qemuParams, "--no-reboot")
|
||||
}
|
||||
|
||||
if config.Knobs.NoShutdown {
|
||||
config.qemuParams = append(config.qemuParams, "--no-shutdown")
|
||||
}
|
||||
|
||||
if config.Knobs.Daemonize {
|
||||
config.qemuParams = append(config.qemuParams, "-daemonize")
|
||||
}
|
||||
|
@ -761,7 +761,7 @@ func (q *QMP) ExecuteCont(ctx context.Context) error {
|
||||
// This function will block until the SHUTDOWN event is received.
|
||||
func (q *QMP) ExecuteSystemPowerdown(ctx context.Context) error {
|
||||
filter := &qmpEventFilter{
|
||||
eventName: "SHUTDOWN",
|
||||
eventName: "POWERDOWN",
|
||||
}
|
||||
return q.executeCommand(ctx, "system_powerdown", nil, filter)
|
||||
}
|
||||
|
@ -802,7 +802,7 @@ func TestQMPSystemPowerdown(t *testing.T) {
|
||||
disconnectedCh := make(chan struct{})
|
||||
buf := newQMPTestCommandBuffer(t)
|
||||
buf.AddCommand("system_powerdown", nil, "return", nil)
|
||||
buf.AddEvent("SHUTDOWN", time.Millisecond*100,
|
||||
buf.AddEvent("POWERDOWN", time.Millisecond*100,
|
||||
nil,
|
||||
map[string]interface{}{
|
||||
"seconds": seconds,
|
||||
|
Loading…
Reference in New Issue
Block a user