mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 08:17:37 +00:00
qemu: set stopped only if StopVM is successful
Fixes: #5624 Signed-off-by: Alexandru Matei <alexandru.matei@uipath.com>
This commit is contained in:
parent
0e3ac66e76
commit
7e481f2179
@ -969,7 +969,7 @@ func (q *qemu) waitVM(ctx context.Context, timeout int) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StopVM will stop the Sandbox's VM.
|
// StopVM will stop the Sandbox's VM.
|
||||||
func (q *qemu) StopVM(ctx context.Context, waitOnly bool) error {
|
func (q *qemu) StopVM(ctx context.Context, waitOnly bool) (err error) {
|
||||||
q.mu.Lock()
|
q.mu.Lock()
|
||||||
defer q.mu.Unlock()
|
defer q.mu.Unlock()
|
||||||
span, _ := katatrace.Trace(ctx, q.Logger(), "StopVM", qemuTracingTags, map[string]string{"sandbox_id": q.id})
|
span, _ := katatrace.Trace(ctx, q.Logger(), "StopVM", qemuTracingTags, map[string]string{"sandbox_id": q.id})
|
||||||
@ -983,7 +983,9 @@ func (q *qemu) StopVM(ctx context.Context, waitOnly bool) error {
|
|||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
q.cleanupVM()
|
q.cleanupVM()
|
||||||
q.stopped = true
|
if err == nil {
|
||||||
|
q.stopped = true
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if q.config.Debug && q.qemuConfig.LogFile != "" {
|
if q.config.Debug && q.qemuConfig.LogFile != "" {
|
||||||
|
Loading…
Reference in New Issue
Block a user