From 514a0a19e5f37458d1a7e44c8b2fb4bff3b12d5b Mon Sep 17 00:00:00 2001
From: jikui <jikui2@huawei.com>
Date: Fri, 5 Nov 2021 16:40:05 +0800
Subject: [PATCH] kata-runtime: fix delete sandbox failed problem

Signed-off-by: jikui <jikui2@huawei.com>
---
 src/runtime/virtcontainers/sandbox.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/runtime/virtcontainers/sandbox.go b/src/runtime/virtcontainers/sandbox.go
index 33ae6f0..09cb2eb 100644
--- a/src/runtime/virtcontainers/sandbox.go
+++ b/src/runtime/virtcontainers/sandbox.go
@@ -1114,6 +1114,8 @@ func (s *Sandbox) CreateContainer(ctx context.Context, contConfig ContainerConfi
 			if len(s.config.Containers) > 0 {
 				// delete container config
 				s.config.Containers = s.config.Containers[:len(s.config.Containers)-1]
+				// need to flush change to persist storage
+				_ = s.storeSandbox(ctx)
 			}
 		}
 	}()
-- 
2.25.1

