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

@ -28,7 +28,6 @@ import (
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config"
persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api" persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types" "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" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils"
) )
@ -543,7 +542,7 @@ func (a *Acrn) updateBlockDevice(drive *config.BlockDrive) error {
slot := AcrnBlkdDevSlot[drive.Index] slot := AcrnBlkdDevSlot[drive.Index]
//Explicitly set PCIPath to NULL, so that VirtPath can be used //Explicitly set PCIPath to NULL, so that VirtPath can be used
drive.PCIPath = vcTypes.PciPath{} drive.PCIPath = types.PciPath{}
args := []string{"blkrescan", a.acrnConfig.Name, fmt.Sprintf("%d,%s", slot, drive.File)} args := []string{"blkrescan", a.acrnConfig.Name, fmt.Sprintf("%d,%s", slot, drive.File)}

View File

@ -13,7 +13,6 @@ import (
pbTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols" pbTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols/grpc" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols/grpc"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
"golang.org/x/net/context" "golang.org/x/net/context"
) )
@ -170,7 +169,7 @@ type agent interface {
copyFile(ctx context.Context, src, dst string) error copyFile(ctx context.Context, src, dst string) error
// Tell the agent to setup the swapfile in the guest // Tell the agent to setup the swapfile in the guest
addSwap(ctx context.Context, PCIPath vcTypes.PciPath) error addSwap(ctx context.Context, PCIPath types.PciPath) error
// markDead tell agent that the guest is dead // markDead tell agent that the guest is dead
markDead(ctx context.Context) markDead(ctx context.Context)

View File

@ -32,7 +32,6 @@ import (
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils/katatrace" "github.com/kata-containers/kata-containers/src/runtime/pkg/katautils/katatrace"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types" "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" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils"
) )
@ -632,18 +631,18 @@ func clhDriveIndexToID(i int) string {
// and/or kernel enumerates it. They get away with it only because // and/or kernel enumerates it. They get away with it only because
// they don't use bridges, and so the bus is always 0. Under that // they don't use bridges, and so the bus is always 0. Under that
// assumption convert a clh PciDeviceInfo into a PCI path // assumption convert a clh PciDeviceInfo into a PCI path
func clhPciInfoToPath(pciInfo chclient.PciDeviceInfo) (vcTypes.PciPath, error) { func clhPciInfoToPath(pciInfo chclient.PciDeviceInfo) (types.PciPath, error) {
tokens := strings.Split(pciInfo.Bdf, ":") tokens := strings.Split(pciInfo.Bdf, ":")
if len(tokens) != 3 || tokens[0] != "0000" || tokens[1] != "00" { if len(tokens) != 3 || tokens[0] != "0000" || tokens[1] != "00" {
return vcTypes.PciPath{}, fmt.Errorf("Unexpected PCI address %q from clh hotplug", pciInfo.Bdf) return types.PciPath{}, fmt.Errorf("Unexpected PCI address %q from clh hotplug", pciInfo.Bdf)
} }
tokens = strings.Split(tokens[2], ".") tokens = strings.Split(tokens[2], ".")
if len(tokens) != 2 || tokens[1] != "0" || len(tokens[0]) != 2 { if len(tokens) != 2 || tokens[1] != "0" || len(tokens[0]) != 2 {
return vcTypes.PciPath{}, fmt.Errorf("Unexpected PCI address %q from clh hotplug", pciInfo.Bdf) return types.PciPath{}, fmt.Errorf("Unexpected PCI address %q from clh hotplug", pciInfo.Bdf)
} }
return vcTypes.PciPathFromString(tokens[0]) return types.PciPathFromString(tokens[0])
} }
func (clh *cloudHypervisor) hotplugAddBlockDevice(drive *config.BlockDrive) error { func (clh *cloudHypervisor) hotplugAddBlockDevice(drive *config.BlockDrive) error {
@ -719,7 +718,7 @@ func (clh *cloudHypervisor) hotPlugVFIODevice(device *config.VFIODev) error {
return fmt.Errorf("Unexpected PCI address %q from clh hotplug", pciInfo.Bdf) return fmt.Errorf("Unexpected PCI address %q from clh hotplug", pciInfo.Bdf)
} }
device.GuestPciPath, err = vcTypes.PciPathFromString(tokens[0]) device.GuestPciPath, err = types.PciPathFromString(tokens[0])
return err return err
} }

View File

@ -23,7 +23,6 @@ import (
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols/grpc" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols/grpc"
vcAnnotations "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/annotations" vcAnnotations "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/annotations"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types" "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" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
@ -405,7 +404,7 @@ func (c *Container) GetPatchedOCISpec() *specs.Spec {
// container. // container.
func (c *Container) setContainerState(state types.StateString) error { func (c *Container) setContainerState(state types.StateString) error {
if state == "" { if state == "" {
return vcTypes.ErrNeedState return types.ErrNeedState
} }
c.Logger().Debugf("Setting container state from %v to %v", c.state.State, state) c.Logger().Debugf("Setting container state from %v to %v", c.state.State, state)

View File

@ -32,7 +32,6 @@ import (
vcAnnotations "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/annotations" vcAnnotations "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/annotations"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/rootless" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/rootless"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types" "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" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils"
"github.com/gogo/protobuf/proto" "github.com/gogo/protobuf/proto"
@ -417,7 +416,7 @@ func (k *kataAgent) configure(ctx context.Context, h Hypervisor, id, sharePath s
} }
case types.MockHybridVSock: case types.MockHybridVSock:
default: default:
return vcTypes.ErrInvalidConfigType return types.ErrInvalidConfigType
} }
// Neither create shared directory nor add 9p device if hypervisor // Neither create shared directory nor add 9p device if hypervisor
@ -2147,7 +2146,7 @@ func (k *kataAgent) copyFile(ctx context.Context, src, dst string) error {
return nil return nil
} }
func (k *kataAgent) addSwap(ctx context.Context, PCIPath vcTypes.PciPath) error { func (k *kataAgent) addSwap(ctx context.Context, PCIPath types.PciPath) error {
span, ctx := katatrace.Trace(ctx, k.Logger(), "addSwap", kataAgentTracingTags) span, ctx := katatrace.Trace(ctx, k.Logger(), "addSwap", kataAgentTracingTags)
defer span.End() defer span.End()

View File

@ -35,7 +35,6 @@ import (
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/mock" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/mock"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/rootless" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/rootless"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
) )
const sysHugepagesDir = "/sys/kernel/mm/hugepages" const sysHugepagesDir = "/sys/kernel/mm/hugepages"
@ -45,7 +44,7 @@ var (
testBlockDeviceCtrPath = "testBlockDeviceCtrPath" testBlockDeviceCtrPath = "testBlockDeviceCtrPath"
testDevNo = "testDevNo" testDevNo = "testDevNo"
testNvdimmID = "testNvdimmID" testNvdimmID = "testNvdimmID"
testPCIPath, _ = vcTypes.PciPathFromString("04/02") testPCIPath, _ = types.PciPathFromString("04/02")
testSCSIAddr = "testSCSIAddr" testSCSIAddr = "testSCSIAddr"
testVirtPath = "testVirtPath" testVirtPath = "testVirtPath"
) )
@ -372,11 +371,11 @@ func TestHandleBlockVolume(t *testing.T) {
vDestination := "/VhostUserBlk/destination" vDestination := "/VhostUserBlk/destination"
bDestination := "/DeviceBlock/destination" bDestination := "/DeviceBlock/destination"
dDestination := "/DeviceDirectBlock/destination" dDestination := "/DeviceDirectBlock/destination"
vPCIPath, err := vcTypes.PciPathFromString("01/02") vPCIPath, err := types.PciPathFromString("01/02")
assert.NoError(t, err) assert.NoError(t, err)
bPCIPath, err := vcTypes.PciPathFromString("03/04") bPCIPath, err := types.PciPathFromString("03/04")
assert.NoError(t, err) assert.NoError(t, err)
dPCIPath, err := vcTypes.PciPathFromString("04/05") dPCIPath, err := types.PciPathFromString("04/05")
assert.NoError(t, err) assert.NoError(t, err)
vDev := drivers.NewVhostUserBlkDevice(&config.DeviceInfo{ID: vDevID}) vDev := drivers.NewVhostUserBlkDevice(&config.DeviceInfo{ID: vDevID})

View File

@ -13,7 +13,6 @@ import (
pbTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols" pbTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols/grpc" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols/grpc"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
"golang.org/x/net/context" "golang.org/x/net/context"
) )
@ -217,7 +216,7 @@ func (n *mockAgent) copyFile(ctx context.Context, src, dst string) error {
} }
// addSwap is the Noop agent setup swap. It does nothing. // addSwap is the Noop agent setup swap. It does nothing.
func (n *mockAgent) addSwap(ctx context.Context, PCIPath vcTypes.PciPath) error { func (n *mockAgent) addSwap(ctx context.Context, PCIPath types.PciPath) error {
return nil return nil
} }

View File

@ -40,7 +40,6 @@ import (
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/drivers" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/drivers"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types" "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" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils"
) )
@ -1328,15 +1327,15 @@ func (q *qemu) hotplugAddBlockDevice(ctx context.Context, drive *config.BlockDri
} }
}() }()
bridgeSlot, err := vcTypes.PciSlotFromInt(bridge.Addr) bridgeSlot, err := types.PciSlotFromInt(bridge.Addr)
if err != nil { if err != nil {
return err return err
} }
devSlot, err := vcTypes.PciSlotFromString(addr) devSlot, err := types.PciSlotFromString(addr)
if err != nil { if err != nil {
return err return err
} }
drive.PCIPath, err = vcTypes.PciPathFromSlots(bridgeSlot, devSlot) drive.PCIPath, err = types.PciPathFromSlots(bridgeSlot, devSlot)
if err != nil { if err != nil {
return err return err
} }
@ -1420,12 +1419,12 @@ func (q *qemu) hotplugAddVhostUserBlkDevice(ctx context.Context, vAttr *config.V
return err return err
} }
devSlot, err := vcTypes.PciSlotFromString(addr) devSlot, err := types.PciSlotFromString(addr)
if err != nil { if err != nil {
return err return err
} }
vAttr.PCIPath, err = vcTypes.PciPathFromSlots(bridgeSlot, devSlot) vAttr.PCIPath, err = types.PciPathFromSlots(bridgeSlot, devSlot)
if err != nil { if err != nil {
return err return err
} }
@ -1445,16 +1444,16 @@ func (q *qemu) hotplugAddVhostUserBlkDevice(ctx context.Context, vAttr *config.V
} }
}() }()
bridgeSlot, err := vcTypes.PciSlotFromInt(bridge.Addr) bridgeSlot, err := types.PciSlotFromInt(bridge.Addr)
if err != nil { if err != nil {
return err return err
} }
devSlot, err := vcTypes.PciSlotFromString(addr) devSlot, err := types.PciSlotFromString(addr)
if err != nil { if err != nil {
return err return err
} }
vAttr.PCIPath, err = vcTypes.PciPathFromSlots(bridgeSlot, devSlot) vAttr.PCIPath, err = types.PciPathFromSlots(bridgeSlot, devSlot)
if err = q.qmpMonitorCh.qmp.ExecutePCIVhostUserDevAdd(q.qmpMonitorCh.ctx, driver, devID, vAttr.DevID, addr, bridge.ID); err != nil { if err = q.qmpMonitorCh.qmp.ExecutePCIVhostUserDevAdd(q.qmpMonitorCh.ctx, driver, devID, vAttr.DevID, addr, bridge.ID); err != nil {
return err return err
@ -1519,48 +1518,48 @@ func (q *qemu) hotplugVhostUserDevice(ctx context.Context, vAttr *config.VhostUs
} }
// Query QMP to find the PCI slot of a device, given its QOM path or ID // Query QMP to find the PCI slot of a device, given its QOM path or ID
func (q *qemu) qomGetSlot(qomPath string) (vcTypes.PciSlot, error) { func (q *qemu) qomGetSlot(qomPath string) (types.PciSlot, error) {
addr, err := q.qmpMonitorCh.qmp.ExecQomGet(q.qmpMonitorCh.ctx, qomPath, "addr") addr, err := q.qmpMonitorCh.qmp.ExecQomGet(q.qmpMonitorCh.ctx, qomPath, "addr")
if err != nil { if err != nil {
return vcTypes.PciSlot{}, err return types.PciSlot{}, err
} }
addrf, ok := addr.(float64) addrf, ok := addr.(float64)
// XXX going via float makes no real sense, but that's how // XXX going via float makes no real sense, but that's how
// JSON works, and we'll get away with it for the small values // JSON works, and we'll get away with it for the small values
// we have here // we have here
if !ok { if !ok {
return vcTypes.PciSlot{}, fmt.Errorf("addr QOM property of %q is %T not a number", qomPath, addr) return types.PciSlot{}, fmt.Errorf("addr QOM property of %q is %T not a number", qomPath, addr)
} }
addri := int(addrf) addri := int(addrf)
slotNum, funcNum := addri>>3, addri&0x7 slotNum, funcNum := addri>>3, addri&0x7
if funcNum != 0 { if funcNum != 0 {
return vcTypes.PciSlot{}, fmt.Errorf("Unexpected non-zero PCI function (%02x.%1x) on %q", return types.PciSlot{}, fmt.Errorf("Unexpected non-zero PCI function (%02x.%1x) on %q",
slotNum, funcNum, qomPath) slotNum, funcNum, qomPath)
} }
return vcTypes.PciSlotFromInt(slotNum) return types.PciSlotFromInt(slotNum)
} }
// Query QMP to find a device's PCI path given its QOM path or ID // Query QMP to find a device's PCI path given its QOM path or ID
func (q *qemu) qomGetPciPath(qemuID string) (vcTypes.PciPath, error) { func (q *qemu) qomGetPciPath(qemuID string) (types.PciPath, error) {
// XXX: For now we assume there's exactly one bridge, since // XXX: For now we assume there's exactly one bridge, since
// that's always how we configure qemu from Kata for now. It // that's always how we configure qemu from Kata for now. It
// would be good to generalize this to different PCI // would be good to generalize this to different PCI
// topologies // topologies
devSlot, err := q.qomGetSlot(qemuID) devSlot, err := q.qomGetSlot(qemuID)
if err != nil { if err != nil {
return vcTypes.PciPath{}, err return types.PciPath{}, err
} }
busq, err := q.qmpMonitorCh.qmp.ExecQomGet(q.qmpMonitorCh.ctx, qemuID, "parent_bus") busq, err := q.qmpMonitorCh.qmp.ExecQomGet(q.qmpMonitorCh.ctx, qemuID, "parent_bus")
if err != nil { if err != nil {
return vcTypes.PciPath{}, err return types.PciPath{}, err
} }
bus, ok := busq.(string) bus, ok := busq.(string)
if !ok { if !ok {
return vcTypes.PciPath{}, fmt.Errorf("parent_bus QOM property of %s is %t not a string", qemuID, busq) return types.PciPath{}, fmt.Errorf("parent_bus QOM property of %s is %t not a string", qemuID, busq)
} }
// `bus` is the QOM path of the QOM bus object, but we need // `bus` is the QOM path of the QOM bus object, but we need
@ -1569,16 +1568,16 @@ func (q *qemu) qomGetPciPath(qemuID string) (vcTypes.PciPath, error) {
// path component. // path component.
idx := strings.LastIndex(bus, "/") idx := strings.LastIndex(bus, "/")
if idx == -1 { if idx == -1 {
return vcTypes.PciPath{}, fmt.Errorf("Bus has unexpected QOM path %s", bus) return types.PciPath{}, fmt.Errorf("Bus has unexpected QOM path %s", bus)
} }
bridge := bus[:idx] bridge := bus[:idx]
bridgeSlot, err := q.qomGetSlot(bridge) bridgeSlot, err := q.qomGetSlot(bridge)
if err != nil { if err != nil {
return vcTypes.PciPath{}, err return types.PciPath{}, err
} }
return vcTypes.PciPathFromSlots(bridgeSlot, devSlot) return types.PciPathFromSlots(bridgeSlot, devSlot)
} }
func (q *qemu) hotplugVFIODevice(ctx context.Context, device *config.VFIODev, op Operation) (err error) { func (q *qemu) hotplugVFIODevice(ctx context.Context, device *config.VFIODev, op Operation) (err error) {
@ -1739,15 +1738,15 @@ func (q *qemu) hotplugNetDevice(ctx context.Context, endpoint Endpoint, op Opera
} }
}() }()
bridgeSlot, err := vcTypes.PciSlotFromInt(bridge.Addr) bridgeSlot, err := types.PciSlotFromInt(bridge.Addr)
if err != nil { if err != nil {
return err return err
} }
devSlot, err := vcTypes.PciSlotFromString(addr) devSlot, err := types.PciSlotFromString(addr)
if err != nil { if err != nil {
return err return err
} }
pciPath, err := vcTypes.PciPathFromSlots(bridgeSlot, devSlot) pciPath, err := types.PciPathFromSlots(bridgeSlot, devSlot)
endpoint.SetPciPath(pciPath) endpoint.SetPciPath(pciPath)
var machine govmmQemu.Machine var machine govmmQemu.Machine

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/cpuset"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/rootless" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/rootless"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types" "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" "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. // sandbox structure, based on a container ID.
func (s *Sandbox) findContainer(containerID string) (*Container, error) { func (s *Sandbox) findContainer(containerID string) (*Container, error) {
if s == nil { if s == nil {
return nil, vcTypes.ErrNeedSandbox return nil, types.ErrNeedSandbox
} }
if containerID == "" { if containerID == "" {
return nil, vcTypes.ErrNeedContainerID return nil, types.ErrNeedContainerID
} }
if c, ok := s.containers[containerID]; ok { if c, ok := s.containers[containerID]; ok {
return c, nil 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) containerID, s.id)
} }
@ -763,15 +762,15 @@ func (s *Sandbox) findContainer(containerID string) (*Container, error) {
// sandbox structure, based on a container ID. // sandbox structure, based on a container ID.
func (s *Sandbox) removeContainer(containerID string) error { func (s *Sandbox) removeContainer(containerID string) error {
if s == nil { if s == nil {
return vcTypes.ErrNeedSandbox return types.ErrNeedSandbox
} }
if containerID == "" { if containerID == "" {
return vcTypes.ErrNeedContainerID return types.ErrNeedContainerID
} }
if _, ok := s.containers[containerID]; !ok { 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) containerID, s.id)
} }
@ -1417,7 +1416,7 @@ func (s *Sandbox) KillContainer(ctx context.Context, containerID string, signal
// DeleteContainer deletes a container from the sandbox // DeleteContainer deletes a container from the sandbox
func (s *Sandbox) DeleteContainer(ctx context.Context, containerID string) (VCContainer, error) { func (s *Sandbox) DeleteContainer(ctx context.Context, containerID string) (VCContainer, error) {
if containerID == "" { if containerID == "" {
return nil, vcTypes.ErrNeedContainerID return nil, types.ErrNeedContainerID
} }
// Fetch the container. // Fetch the container.
@ -1453,7 +1452,7 @@ func (s *Sandbox) DeleteContainer(ctx context.Context, containerID string) (VCCo
// StatusContainer gets the status of a container // StatusContainer gets the status of a container
func (s *Sandbox) StatusContainer(containerID string) (ContainerStatus, error) { func (s *Sandbox) StatusContainer(containerID string) (ContainerStatus, error) {
if containerID == "" { if containerID == "" {
return ContainerStatus{}, vcTypes.ErrNeedContainerID return ContainerStatus{}, types.ErrNeedContainerID
} }
if c, ok := s.containers[containerID]; ok { if c, ok := s.containers[containerID]; ok {
@ -1472,7 +1471,7 @@ func (s *Sandbox) StatusContainer(containerID string) (ContainerStatus, error) {
}, nil }, nil
} }
return ContainerStatus{}, vcTypes.ErrNoSuchContainer return ContainerStatus{}, types.ErrNoSuchContainer
} }
// EnterContainer is the virtcontainers container command execution entry point. // 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. // setSandboxState sets the in-memory state of the sandbox.
func (s *Sandbox) setSandboxState(state types.StateString) error { func (s *Sandbox) setSandboxState(state types.StateString) error {
if state == "" { if state == "" {
return vcTypes.ErrNeedState return types.ErrNeedState
} }
// update in-memory state // 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) { func fetchSandbox(ctx context.Context, sandboxID string) (sandbox *Sandbox, err error) {
virtLog.Info("fetch sandbox") virtLog.Info("fetch sandbox")
if sandboxID == "" { if sandboxID == "" {
return nil, vcTypes.ErrNeedSandboxID return nil, types.ErrNeedSandboxID
} }
var config SandboxConfig var config SandboxConfig