mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-10-22 20:39:41 +00:00
runtime: delete Stateful from SandboxConfig
Since all containers are started from shim v2, `Stateful` is not needed. Fixes: #332 Signed-off-by: bin liu <bin@hyper.sh>
This commit is contained in:
@@ -62,9 +62,6 @@ func CreateSandbox(ctx context.Context, sandboxConfig SandboxConfig, factory Fac
|
||||
defer span.Finish()
|
||||
|
||||
s, err := createSandboxFromConfig(ctx, sandboxConfig, factory)
|
||||
if err == nil {
|
||||
s.releaseStatelessSandbox()
|
||||
}
|
||||
|
||||
return s, err
|
||||
}
|
||||
@@ -157,7 +154,6 @@ func DeleteSandbox(ctx context.Context, sandboxID string) (VCSandbox, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
// Delete it.
|
||||
if err := s.Delete(); err != nil {
|
||||
@@ -227,7 +223,6 @@ func StartSandbox(ctx context.Context, sandboxID string) (VCSandbox, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
// Start it
|
||||
err = s.Start()
|
||||
@@ -263,7 +258,6 @@ func StopSandbox(ctx context.Context, sandboxID string, force bool) (VCSandbox,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
// Stop it.
|
||||
err = s.Stop(force)
|
||||
@@ -289,7 +283,6 @@ func RunSandbox(ctx context.Context, sandboxConfig SandboxConfig, factory Factor
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
unlock, err := rwLockSandbox(s.id)
|
||||
if err != nil {
|
||||
@@ -365,7 +358,6 @@ func StatusSandbox(ctx context.Context, sandboxID string) (SandboxStatus, error)
|
||||
if err != nil {
|
||||
return SandboxStatus{}, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
var contStatusList []ContainerStatus
|
||||
for _, container := range s.containers {
|
||||
@@ -409,7 +401,6 @@ func CreateContainer(ctx context.Context, sandboxID string, containerConfig Cont
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
c, err := s.CreateContainer(containerConfig)
|
||||
if err != nil {
|
||||
@@ -448,7 +439,6 @@ func DeleteContainer(ctx context.Context, sandboxID, containerID string) (VCCont
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
return s.DeleteContainer(containerID)
|
||||
}
|
||||
@@ -477,7 +467,6 @@ func StartContainer(ctx context.Context, sandboxID, containerID string) (VCConta
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
return s.StartContainer(containerID)
|
||||
}
|
||||
@@ -506,7 +495,6 @@ func StopContainer(ctx context.Context, sandboxID, containerID string) (VCContai
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
return s.StopContainer(containerID, false)
|
||||
}
|
||||
@@ -535,7 +523,6 @@ func EnterContainer(ctx context.Context, sandboxID, containerID string, cmd type
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
c, process, err := s.EnterContainer(containerID, cmd)
|
||||
if err != nil {
|
||||
@@ -569,7 +556,6 @@ func StatusContainer(ctx context.Context, sandboxID, containerID string) (Contai
|
||||
if err != nil {
|
||||
return ContainerStatus{}, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
return statusContainer(s, containerID)
|
||||
}
|
||||
@@ -616,7 +602,6 @@ func KillContainer(ctx context.Context, sandboxID, containerID string, signal sy
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
return s.KillContainer(containerID, signal, all)
|
||||
}
|
||||
@@ -645,7 +630,6 @@ func ProcessListContainer(ctx context.Context, sandboxID, containerID string, op
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
return s.ProcessListContainer(containerID, options)
|
||||
}
|
||||
@@ -674,7 +658,6 @@ func UpdateContainer(ctx context.Context, sandboxID, containerID string, resourc
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
return s.UpdateContainer(containerID, resources)
|
||||
}
|
||||
@@ -703,7 +686,6 @@ func StatsContainer(ctx context.Context, sandboxID, containerID string) (Contain
|
||||
if err != nil {
|
||||
return ContainerStats{}, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
return s.StatsContainer(containerID)
|
||||
}
|
||||
@@ -728,7 +710,6 @@ func StatsSandbox(ctx context.Context, sandboxID string) (SandboxStats, []Contai
|
||||
if err != nil {
|
||||
return SandboxStats{}, []ContainerStats{}, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
sandboxStats, err := s.Stats()
|
||||
if err != nil {
|
||||
@@ -766,7 +747,6 @@ func togglePauseContainer(ctx context.Context, sandboxID, containerID string, pa
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
if pause {
|
||||
return s.PauseContainer(containerID)
|
||||
@@ -810,7 +790,6 @@ func AddDevice(ctx context.Context, sandboxID string, info deviceConfig.DeviceIn
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
return s.AddDevice(info)
|
||||
}
|
||||
@@ -830,7 +809,6 @@ func toggleInterface(ctx context.Context, sandboxID string, inf *vcTypes.Interfa
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
if add {
|
||||
return s.AddInterface(inf)
|
||||
@@ -874,7 +852,6 @@ func ListInterfaces(ctx context.Context, sandboxID string) ([]*vcTypes.Interface
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
return s.ListInterfaces()
|
||||
}
|
||||
@@ -898,7 +875,6 @@ func UpdateRoutes(ctx context.Context, sandboxID string, routes []*vcTypes.Route
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
return s.UpdateRoutes(routes)
|
||||
}
|
||||
@@ -922,7 +898,6 @@ func ListRoutes(ctx context.Context, sandboxID string) ([]*vcTypes.Route, error)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
return s.ListRoutes()
|
||||
}
|
||||
|
Reference in New Issue
Block a user