mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-05-01 13:14:33 +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:
parent
069505e2d5
commit
3cf8b470cd
@ -113,8 +113,6 @@ func CreateSandbox(ctx context.Context, vci vc.VC, ociSpec specs.Spec, runtimeCo
|
||||
return nil, vc.Process{}, err
|
||||
}
|
||||
|
||||
sandboxConfig.Stateful = true
|
||||
|
||||
if err := checkForFIPS(&sandboxConfig); err != nil {
|
||||
return nil, vc.Process{}, err
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ func (a *Acrn) createDummyVirtioBlkDev(devices []Device) ([]Device, error) {
|
||||
}
|
||||
|
||||
// createSandbox is the Hypervisor sandbox creation.
|
||||
func (a *Acrn) createSandbox(ctx context.Context, id string, networkNS NetworkNamespace, hypervisorConfig *HypervisorConfig, stateful bool) error {
|
||||
func (a *Acrn) createSandbox(ctx context.Context, id string, networkNS NetworkNamespace, hypervisorConfig *HypervisorConfig) error {
|
||||
// Save the tracing context
|
||||
a.ctx = ctx
|
||||
|
||||
|
@ -237,7 +237,7 @@ func TestAcrnCreateSandbox(t *testing.T) {
|
||||
//set PID to 1 to ignore hypercall to get UUID and set a random UUID
|
||||
a.state.PID = 1
|
||||
a.state.UUID = "f81d4fae-7dec-11d0-a765-00a0c91e6bf6"
|
||||
err = a.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig, false)
|
||||
err = a.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig)
|
||||
assert.NoError(err)
|
||||
assert.Exactly(acrnConfig, a.config)
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ func (clh *cloudHypervisor) checkVersion() error {
|
||||
|
||||
// For cloudHypervisor this call only sets the internal structure up.
|
||||
// The VM will be created and started through startSandbox().
|
||||
func (clh *cloudHypervisor) createSandbox(ctx context.Context, id string, networkNS NetworkNamespace, hypervisorConfig *HypervisorConfig, stateful bool) error {
|
||||
func (clh *cloudHypervisor) createSandbox(ctx context.Context, id string, networkNS NetworkNamespace, hypervisorConfig *HypervisorConfig) error {
|
||||
clh.ctx = ctx
|
||||
|
||||
span, _ := clh.trace("createSandbox")
|
||||
|
@ -241,7 +241,7 @@ func TestClhCreateSandbox(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
err = clh.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig, false)
|
||||
err = clh.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig)
|
||||
assert.NoError(err)
|
||||
assert.Exactly(clhConfig, clh.config)
|
||||
}
|
||||
|
@ -149,9 +149,8 @@ type firecracker struct {
|
||||
config HypervisorConfig
|
||||
pendingDevices []firecrackerDevice // Devices to be added before the FC VM ready
|
||||
|
||||
state firecrackerState
|
||||
jailed bool //Set to true if jailer is enabled
|
||||
stateful bool //Set to true if running with shimv2
|
||||
state firecrackerState
|
||||
jailed bool //Set to true if jailer is enabled
|
||||
|
||||
fcConfigPath string
|
||||
fcConfig *types.FcConfig // Parameters configured before VM starts
|
||||
@ -196,7 +195,7 @@ func (fc *firecracker) truncateID(id string) string {
|
||||
|
||||
// For firecracker this call only sets the internal structure up.
|
||||
// The sandbox will be created and started through startSandbox().
|
||||
func (fc *firecracker) createSandbox(ctx context.Context, id string, networkNS NetworkNamespace, hypervisorConfig *HypervisorConfig, stateful bool) error {
|
||||
func (fc *firecracker) createSandbox(ctx context.Context, id string, networkNS NetworkNamespace, hypervisorConfig *HypervisorConfig) error {
|
||||
fc.ctx = ctx
|
||||
|
||||
span, _ := fc.trace("createSandbox")
|
||||
@ -207,7 +206,6 @@ func (fc *firecracker) createSandbox(ctx context.Context, id string, networkNS N
|
||||
fc.id = fc.truncateID(id)
|
||||
fc.state.set(notReady)
|
||||
fc.config = *hypervisorConfig
|
||||
fc.stateful = stateful
|
||||
|
||||
// When running with jailer all resources need to be under
|
||||
// a specific location and that location needs to have
|
||||
@ -367,7 +365,7 @@ func (fc *firecracker) fcInit(timeout int) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if !fc.config.Debug && fc.stateful {
|
||||
if !fc.config.Debug {
|
||||
args = append(args, "--daemonize")
|
||||
}
|
||||
|
||||
@ -399,7 +397,7 @@ func (fc *firecracker) fcInit(timeout int) error {
|
||||
cmd = exec.Command(fc.config.HypervisorPath, args...)
|
||||
}
|
||||
|
||||
if fc.config.Debug && fc.stateful {
|
||||
if fc.config.Debug {
|
||||
stdin, err := fc.watchConsole()
|
||||
if err != nil {
|
||||
return err
|
||||
@ -697,7 +695,7 @@ func (fc *firecracker) fcInitConfiguration() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if fc.config.Debug && fc.stateful {
|
||||
if fc.config.Debug {
|
||||
fcKernelParams = append(fcKernelParams, Param{"console", "ttyS0"})
|
||||
} else {
|
||||
fcKernelParams = append(fcKernelParams, []Param{
|
||||
|
@ -776,7 +776,7 @@ func generateVMSocket(id string, useVsock bool, vmStogarePath string) (interface
|
||||
// hypervisor is the virtcontainers hypervisor interface.
|
||||
// The default hypervisor implementation is Qemu.
|
||||
type hypervisor interface {
|
||||
createSandbox(ctx context.Context, id string, networkNS NetworkNamespace, hypervisorConfig *HypervisorConfig, stateful bool) error
|
||||
createSandbox(ctx context.Context, id string, networkNS NetworkNamespace, hypervisorConfig *HypervisorConfig) error
|
||||
startSandbox(timeout int) error
|
||||
stopSandbox() error
|
||||
pauseSandbox() error
|
||||
|
@ -26,7 +26,7 @@ func (m *mockHypervisor) hypervisorConfig() HypervisorConfig {
|
||||
return HypervisorConfig{}
|
||||
}
|
||||
|
||||
func (m *mockHypervisor) createSandbox(ctx context.Context, id string, networkNS NetworkNamespace, hypervisorConfig *HypervisorConfig, stateful bool) error {
|
||||
func (m *mockHypervisor) createSandbox(ctx context.Context, id string, networkNS NetworkNamespace, hypervisorConfig *HypervisorConfig) error {
|
||||
err := hypervisorConfig.valid()
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -31,7 +31,7 @@ func TestMockHypervisorCreateSandbox(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
// wrong config
|
||||
err := m.createSandbox(ctx, sandbox.config.ID, NetworkNamespace{}, &sandbox.config.HypervisorConfig, false)
|
||||
err := m.createSandbox(ctx, sandbox.config.ID, NetworkNamespace{}, &sandbox.config.HypervisorConfig)
|
||||
assert.Error(err)
|
||||
|
||||
sandbox.config.HypervisorConfig = HypervisorConfig{
|
||||
@ -40,7 +40,7 @@ func TestMockHypervisorCreateSandbox(t *testing.T) {
|
||||
HypervisorPath: fmt.Sprintf("%s/%s", testDir, testHypervisor),
|
||||
}
|
||||
|
||||
err = m.createSandbox(ctx, sandbox.config.ID, NetworkNamespace{}, &sandbox.config.HypervisorConfig, false)
|
||||
err = m.createSandbox(ctx, sandbox.config.ID, NetworkNamespace{}, &sandbox.config.HypervisorConfig)
|
||||
assert.NoError(err)
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,6 @@ func (s *Sandbox) dumpConfig(ss *persistapi.SandboxState) {
|
||||
|
||||
ShmSize: sconfig.ShmSize,
|
||||
SharePidNs: sconfig.SharePidNs,
|
||||
Stateful: sconfig.Stateful,
|
||||
SystemdCgroup: sconfig.SystemdCgroup,
|
||||
SandboxCgroupOnly: sconfig.SandboxCgroupOnly,
|
||||
DisableGuestSeccomp: sconfig.DisableGuestSeccomp,
|
||||
@ -458,7 +457,6 @@ func loadSandboxConfig(id string) (*SandboxConfig, error) {
|
||||
|
||||
ShmSize: savedConf.ShmSize,
|
||||
SharePidNs: savedConf.SharePidNs,
|
||||
Stateful: savedConf.Stateful,
|
||||
SystemdCgroup: savedConf.SystemdCgroup,
|
||||
SandboxCgroupOnly: savedConf.SandboxCgroupOnly,
|
||||
DisableGuestSeccomp: savedConf.DisableGuestSeccomp,
|
||||
|
@ -459,7 +459,7 @@ func (q *qemu) setupFileBackedMem(knobs *govmmQemu.Knobs, memory *govmmQemu.Memo
|
||||
}
|
||||
|
||||
// createSandbox is the Hypervisor sandbox creation implementation for govmmQemu.
|
||||
func (q *qemu) createSandbox(ctx context.Context, id string, networkNS NetworkNamespace, hypervisorConfig *HypervisorConfig, stateful bool) error {
|
||||
func (q *qemu) createSandbox(ctx context.Context, id string, networkNS NetworkNamespace, hypervisorConfig *HypervisorConfig) error {
|
||||
// Save the tracing context
|
||||
q.ctx = ctx
|
||||
|
||||
|
@ -99,7 +99,7 @@ func TestQemuCreateSandbox(t *testing.T) {
|
||||
parentDir := filepath.Join(q.store.RunStoragePath(), sandbox.id)
|
||||
assert.NoError(os.MkdirAll(parentDir, DirMode))
|
||||
|
||||
err = q.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig, false)
|
||||
err = q.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig)
|
||||
assert.NoError(err)
|
||||
assert.NoError(os.RemoveAll(parentDir))
|
||||
assert.Exactly(qemuConfig, q.config)
|
||||
@ -131,7 +131,7 @@ func TestQemuCreateSandboxMissingParentDirFail(t *testing.T) {
|
||||
parentDir := filepath.Join(q.store.RunStoragePath(), sandbox.id)
|
||||
assert.NoError(os.RemoveAll(parentDir))
|
||||
|
||||
err = q.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig, false)
|
||||
err = q.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig)
|
||||
assert.NoError(err)
|
||||
}
|
||||
|
||||
@ -343,7 +343,7 @@ func TestQemuQemuPath(t *testing.T) {
|
||||
qemuConfig.HypervisorPath = expectedPath
|
||||
qkvm := &qemuArchBase{
|
||||
qemuMachine: govmmQemu.Machine{
|
||||
Type: "pc",
|
||||
Type: "pc",
|
||||
Options: "",
|
||||
},
|
||||
qemuExePath: expectedPath,
|
||||
@ -445,7 +445,7 @@ func TestQemuFileBackedMem(t *testing.T) {
|
||||
store: sandbox.newStore,
|
||||
}
|
||||
sandbox.config.HypervisorConfig.SharedFS = config.VirtioFS
|
||||
err = q.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig, false)
|
||||
err = q.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig)
|
||||
assert.NoError(err)
|
||||
|
||||
assert.Equal(q.qemuConfig.Knobs.FileBackedMem, true)
|
||||
@ -463,7 +463,7 @@ func TestQemuFileBackedMem(t *testing.T) {
|
||||
sandbox.config.HypervisorConfig.SharedFS = config.VirtioFS
|
||||
sandbox.config.HypervisorConfig.MemoryPath = fallbackFileBackedMemDir
|
||||
|
||||
err = q.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig, false)
|
||||
err = q.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig)
|
||||
|
||||
expectErr := errors.New("VM templating has been enabled with either virtio-fs or file backed memory and this configuration will not work")
|
||||
assert.Equal(expectErr.Error(), err.Error())
|
||||
@ -476,7 +476,7 @@ func TestQemuFileBackedMem(t *testing.T) {
|
||||
store: sandbox.newStore,
|
||||
}
|
||||
sandbox.config.HypervisorConfig.FileBackedMemRootDir = "/tmp/xyzabc"
|
||||
err = q.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig, false)
|
||||
err = q.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig)
|
||||
assert.NoError(err)
|
||||
assert.Equal(q.qemuConfig.Knobs.FileBackedMem, false)
|
||||
assert.Equal(q.qemuConfig.Knobs.MemShared, false)
|
||||
@ -491,7 +491,7 @@ func TestQemuFileBackedMem(t *testing.T) {
|
||||
}
|
||||
sandbox.config.HypervisorConfig.EnableVhostUserStore = true
|
||||
sandbox.config.HypervisorConfig.HugePages = true
|
||||
err = q.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig, false)
|
||||
err = q.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig)
|
||||
assert.NoError(err)
|
||||
assert.Equal(q.qemuConfig.Knobs.MemShared, true)
|
||||
|
||||
@ -504,7 +504,7 @@ func TestQemuFileBackedMem(t *testing.T) {
|
||||
}
|
||||
sandbox.config.HypervisorConfig.EnableVhostUserStore = true
|
||||
sandbox.config.HypervisorConfig.HugePages = false
|
||||
err = q.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig, false)
|
||||
err = q.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig)
|
||||
|
||||
expectErr = errors.New("Vhost-user-blk/scsi is enabled without HugePages. This configuration will not work")
|
||||
assert.Equal(expectErr.Error(), err.Error())
|
||||
|
@ -105,10 +105,6 @@ type SandboxConfig struct {
|
||||
// SharePidNs sets all containers to share the same sandbox level pid namespace.
|
||||
SharePidNs bool
|
||||
|
||||
// types.Stateful keeps sandbox resources in memory across APIs. Users will be responsible
|
||||
// for calling Release() to release the memory resources.
|
||||
Stateful bool
|
||||
|
||||
// SystemdCgroup enables systemd cgroup support
|
||||
SystemdCgroup bool
|
||||
|
||||
@ -200,7 +196,6 @@ type Sandbox struct {
|
||||
|
||||
shmSize uint64
|
||||
sharePidNs bool
|
||||
stateful bool
|
||||
seccompSupported bool
|
||||
disableVMShutdown bool
|
||||
|
||||
@ -291,14 +286,6 @@ func (s *Sandbox) Release() error {
|
||||
return s.agent.disconnect()
|
||||
}
|
||||
|
||||
func (s *Sandbox) releaseStatelessSandbox() error {
|
||||
if s.stateful {
|
||||
return nil
|
||||
}
|
||||
|
||||
return s.Release()
|
||||
}
|
||||
|
||||
// Status gets the status of the sandbox
|
||||
// TODO: update container status properly, see kata-containers/runtime#253
|
||||
func (s *Sandbox) Status() SandboxStatus {
|
||||
@ -526,7 +513,6 @@ func newSandbox(ctx context.Context, sandboxConfig SandboxConfig, factory Factor
|
||||
wg: &sync.WaitGroup{},
|
||||
shmSize: sandboxConfig.ShmSize,
|
||||
sharePidNs: sandboxConfig.SharePidNs,
|
||||
stateful: sandboxConfig.Stateful,
|
||||
networkNS: NetworkNamespace{NetNsPath: sandboxConfig.NetworkConfig.NetNSPath},
|
||||
ctx: ctx,
|
||||
}
|
||||
@ -562,7 +548,7 @@ func newSandbox(ctx context.Context, sandboxConfig SandboxConfig, factory Factor
|
||||
}
|
||||
|
||||
// new store doesn't require hypervisor to be stored immediately
|
||||
if err = s.hypervisor.createSandbox(ctx, s.id, s.networkNS, &sandboxConfig.HypervisorConfig, s.stateful); err != nil {
|
||||
if err = s.hypervisor.createSandbox(ctx, s.id, s.networkNS, &sandboxConfig.HypervisorConfig); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ func NewVM(ctx context.Context, config VMConfig) (*VM, error) {
|
||||
}
|
||||
}()
|
||||
|
||||
if err = hypervisor.createSandbox(ctx, id, NetworkNamespace{}, &config.HypervisorConfig, false); err != nil {
|
||||
if err = hypervisor.createSandbox(ctx, id, NetworkNamespace{}, &config.HypervisorConfig); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user