runtime: remove duplicate 'types' import

Fallout of 09f7962ff

Fixes #4285

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
This commit is contained in:
Rafael Fonseca
2022-05-18 22:13:05 +02:00
parent d7aded7238
commit ce2e521a0f
9 changed files with 49 additions and 58 deletions

View File

@@ -41,7 +41,6 @@ import (
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/cpuset"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/rootless"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils"
)
@@ -744,18 +743,18 @@ func rwLockSandbox(sandboxID string) (func() error, error) {
// sandbox structure, based on a container ID.
func (s *Sandbox) findContainer(containerID string) (*Container, error) {
if s == nil {
return nil, vcTypes.ErrNeedSandbox
return nil, types.ErrNeedSandbox
}
if containerID == "" {
return nil, vcTypes.ErrNeedContainerID
return nil, types.ErrNeedContainerID
}
if c, ok := s.containers[containerID]; ok {
return c, nil
}
return nil, errors.Wrapf(vcTypes.ErrNoSuchContainer, "Could not find the container %q from the sandbox %q containers list",
return nil, errors.Wrapf(types.ErrNoSuchContainer, "Could not find the container %q from the sandbox %q containers list",
containerID, s.id)
}
@@ -763,15 +762,15 @@ func (s *Sandbox) findContainer(containerID string) (*Container, error) {
// sandbox structure, based on a container ID.
func (s *Sandbox) removeContainer(containerID string) error {
if s == nil {
return vcTypes.ErrNeedSandbox
return types.ErrNeedSandbox
}
if containerID == "" {
return vcTypes.ErrNeedContainerID
return types.ErrNeedContainerID
}
if _, ok := s.containers[containerID]; !ok {
return errors.Wrapf(vcTypes.ErrNoSuchContainer, "Could not remove the container %q from the sandbox %q containers list",
return errors.Wrapf(types.ErrNoSuchContainer, "Could not remove the container %q from the sandbox %q containers list",
containerID, s.id)
}
@@ -1417,7 +1416,7 @@ func (s *Sandbox) KillContainer(ctx context.Context, containerID string, signal
// DeleteContainer deletes a container from the sandbox
func (s *Sandbox) DeleteContainer(ctx context.Context, containerID string) (VCContainer, error) {
if containerID == "" {
return nil, vcTypes.ErrNeedContainerID
return nil, types.ErrNeedContainerID
}
// Fetch the container.
@@ -1453,7 +1452,7 @@ func (s *Sandbox) DeleteContainer(ctx context.Context, containerID string) (VCCo
// StatusContainer gets the status of a container
func (s *Sandbox) StatusContainer(containerID string) (ContainerStatus, error) {
if containerID == "" {
return ContainerStatus{}, vcTypes.ErrNeedContainerID
return ContainerStatus{}, types.ErrNeedContainerID
}
if c, ok := s.containers[containerID]; ok {
@@ -1472,7 +1471,7 @@ func (s *Sandbox) StatusContainer(containerID string) (ContainerStatus, error) {
}, nil
}
return ContainerStatus{}, vcTypes.ErrNoSuchContainer
return ContainerStatus{}, types.ErrNoSuchContainer
}
// EnterContainer is the virtcontainers container command execution entry point.
@@ -1719,7 +1718,7 @@ func (s *Sandbox) Stop(ctx context.Context, force bool) error {
// setSandboxState sets the in-memory state of the sandbox.
func (s *Sandbox) setSandboxState(state types.StateString) error {
if state == "" {
return vcTypes.ErrNeedState
return types.ErrNeedState
}
// update in-memory state
@@ -2324,7 +2323,7 @@ func (s *Sandbox) getSandboxCPUSet() (string, string, error) {
func fetchSandbox(ctx context.Context, sandboxID string) (sandbox *Sandbox, err error) {
virtLog.Info("fetch sandbox")
if sandboxID == "" {
return nil, vcTypes.ErrNeedSandboxID
return nil, types.ErrNeedSandboxID
}
var config SandboxConfig