mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-31 23:36:12 +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
|
Realtime bool
|
||||||
|
|
||||||
// Exit instead of rebooting
|
// Exit instead of rebooting
|
||||||
|
// Prevents QEMU from rebooting in the event of a Triple Fault.
|
||||||
NoReboot bool
|
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 will enable IOMMU for supported devices
|
||||||
IOMMUPlatform bool
|
IOMMUPlatform bool
|
||||||
}
|
}
|
||||||
@ -2795,6 +2799,10 @@ func (config *Config) appendKnobs() {
|
|||||||
config.qemuParams = append(config.qemuParams, "--no-reboot")
|
config.qemuParams = append(config.qemuParams, "--no-reboot")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.Knobs.NoShutdown {
|
||||||
|
config.qemuParams = append(config.qemuParams, "--no-shutdown")
|
||||||
|
}
|
||||||
|
|
||||||
if config.Knobs.Daemonize {
|
if config.Knobs.Daemonize {
|
||||||
config.qemuParams = append(config.qemuParams, "-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.
|
// This function will block until the SHUTDOWN event is received.
|
||||||
func (q *QMP) ExecuteSystemPowerdown(ctx context.Context) error {
|
func (q *QMP) ExecuteSystemPowerdown(ctx context.Context) error {
|
||||||
filter := &qmpEventFilter{
|
filter := &qmpEventFilter{
|
||||||
eventName: "SHUTDOWN",
|
eventName: "POWERDOWN",
|
||||||
}
|
}
|
||||||
return q.executeCommand(ctx, "system_powerdown", nil, filter)
|
return q.executeCommand(ctx, "system_powerdown", nil, filter)
|
||||||
}
|
}
|
||||||
|
@ -802,7 +802,7 @@ func TestQMPSystemPowerdown(t *testing.T) {
|
|||||||
disconnectedCh := make(chan struct{})
|
disconnectedCh := make(chan struct{})
|
||||||
buf := newQMPTestCommandBuffer(t)
|
buf := newQMPTestCommandBuffer(t)
|
||||||
buf.AddCommand("system_powerdown", nil, "return", nil)
|
buf.AddCommand("system_powerdown", nil, "return", nil)
|
||||||
buf.AddEvent("SHUTDOWN", time.Millisecond*100,
|
buf.AddEvent("POWERDOWN", time.Millisecond*100,
|
||||||
nil,
|
nil,
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"seconds": seconds,
|
"seconds": seconds,
|
||||||
|
Loading…
Reference in New Issue
Block a user