mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-10-22 04:18:53 +00:00
virtcontainers: Alias for pkg/types
Since we're going to have both external and internal types packages, we alias the external one as vcTypes. And the internal one will be usable through the types namespace. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
"os"
|
||||
|
||||
vc "github.com/kata-containers/runtime/virtcontainers"
|
||||
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
|
||||
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
@@ -152,7 +152,7 @@ func networkModifyCommand(ctx context.Context, containerID, input string, opType
|
||||
}
|
||||
switch opType {
|
||||
case interfaceType:
|
||||
var inf, resultingInf *types.Interface
|
||||
var inf, resultingInf *vcTypes.Interface
|
||||
if err = json.NewDecoder(f).Decode(&inf); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -171,7 +171,7 @@ func networkModifyCommand(ctx context.Context, containerID, input string, opType
|
||||
}
|
||||
json.NewEncoder(output).Encode(resultingInf)
|
||||
case routeType:
|
||||
var routes, resultingRoutes []*types.Route
|
||||
var routes, resultingRoutes []*vcTypes.Route
|
||||
if err = json.NewDecoder(f).Decode(&routes); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -209,7 +209,7 @@ func networkListCommand(ctx context.Context, containerID string, opType networkT
|
||||
|
||||
switch opType {
|
||||
case interfaceType:
|
||||
var interfaces []*types.Interface
|
||||
var interfaces []*vcTypes.Interface
|
||||
interfaces, err = vci.ListInterfaces(ctx, sandboxID)
|
||||
if err != nil {
|
||||
kataLog.WithField("existing-interfaces", fmt.Sprintf("%+v", interfaces)).
|
||||
@@ -217,7 +217,7 @@ func networkListCommand(ctx context.Context, containerID string, opType networkT
|
||||
}
|
||||
json.NewEncoder(file).Encode(interfaces)
|
||||
case routeType:
|
||||
var routes []*types.Route
|
||||
var routes []*vcTypes.Route
|
||||
routes, err = vci.ListRoutes(ctx, sandboxID)
|
||||
if err != nil {
|
||||
kataLog.WithField("resulting-routes", fmt.Sprintf("%+v", routes)).
|
||||
|
@@ -13,24 +13,24 @@ import (
|
||||
"testing"
|
||||
|
||||
vc "github.com/kata-containers/runtime/virtcontainers"
|
||||
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
|
||||
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var (
|
||||
testAddInterfaceFuncReturnNil = func(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
|
||||
testAddInterfaceFuncReturnNil = func(ctx context.Context, sandboxID string, inf *vcTypes.Interface) (*vcTypes.Interface, error) {
|
||||
return nil, nil
|
||||
}
|
||||
testRemoveInterfaceFuncReturnNil = func(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
|
||||
testRemoveInterfaceFuncReturnNil = func(ctx context.Context, sandboxID string, inf *vcTypes.Interface) (*vcTypes.Interface, error) {
|
||||
return nil, nil
|
||||
}
|
||||
testListInterfacesFuncReturnNil = func(ctx context.Context, sandboxID string) ([]*types.Interface, error) {
|
||||
testListInterfacesFuncReturnNil = func(ctx context.Context, sandboxID string) ([]*vcTypes.Interface, error) {
|
||||
return nil, nil
|
||||
}
|
||||
testUpdateRoutsFuncReturnNil = func(ctx context.Context, sandboxID string, routes []*types.Route) ([]*types.Route, error) {
|
||||
testUpdateRoutsFuncReturnNil = func(ctx context.Context, sandboxID string, routes []*vcTypes.Route) ([]*vcTypes.Route, error) {
|
||||
return nil, nil
|
||||
}
|
||||
testListRoutesFuncReturnNil = func(ctx context.Context, sandboxID string) ([]*types.Route, error) {
|
||||
testListRoutesFuncReturnNil = func(ctx context.Context, sandboxID string) ([]*vcTypes.Route, error) {
|
||||
return nil, nil
|
||||
}
|
||||
)
|
||||
|
Reference in New Issue
Block a user