Change StateUnknown to StateInit
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
@@ -93,7 +93,7 @@ func (s *Store) Get(id string) (Sandbox, error) {
|
||||
if err != nil {
|
||||
return sb, err
|
||||
}
|
||||
if sb.Status.Get().State == StateUnknown {
|
||||
if sb.Status.Get().State == StateInit {
|
||||
return Sandbox{}, store.ErrNotExist
|
||||
}
|
||||
return sb, nil
|
||||
@@ -123,7 +123,7 @@ func (s *Store) List() []Sandbox {
|
||||
defer s.lock.RUnlock()
|
||||
var sandboxes []Sandbox
|
||||
for _, sb := range s.sandboxes {
|
||||
if sb.Status.Get().State == StateUnknown {
|
||||
if sb.Status.Get().State == StateInit {
|
||||
continue
|
||||
}
|
||||
sandboxes = append(sandboxes, sb)
|
||||
|
||||
@@ -106,7 +106,7 @@ func TestSandboxStore(t *testing.T) {
|
||||
},
|
||||
NetNSPath: "TestNetNS-3defg",
|
||||
},
|
||||
Status{State: StateUnknown},
|
||||
Status{State: StateInit},
|
||||
)
|
||||
assert := assertlib.New(t)
|
||||
s := NewStore()
|
||||
|
||||
@@ -22,15 +22,15 @@ import (
|
||||
)
|
||||
|
||||
// State is the sandbox state we use in containerd/cri.
|
||||
// It has unknown state defined.
|
||||
// It has init state defined.
|
||||
type State uint32
|
||||
|
||||
const (
|
||||
// StateUnknown is unknown state of sandbox. Sandbox
|
||||
// is in unknown state before its corresponding sandbox container
|
||||
// is created. Sandbox in unknown state should be ignored by most
|
||||
// StateInit is init state of sandbox. Sandbox
|
||||
// is in init state before its corresponding sandbox container
|
||||
// is created. Sandbox in init state should be ignored by most
|
||||
// functions, unless the caller needs to update sandbox state.
|
||||
StateUnknown State = iota
|
||||
StateInit State = iota
|
||||
// StateReady is ready state, it means sandbox container
|
||||
// is running.
|
||||
StateReady
|
||||
|
||||
@@ -28,7 +28,7 @@ func TestStatus(t *testing.T) {
|
||||
testStatus := Status{
|
||||
Pid: 123,
|
||||
CreatedAt: time.Now(),
|
||||
State: StateUnknown,
|
||||
State: StateInit,
|
||||
}
|
||||
updateStatus := Status{
|
||||
Pid: 456,
|
||||
|
||||
Reference in New Issue
Block a user