mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-25 15:02:45 +00:00
Merge pull request #2973 from egernst/remove-cruft
Remove cruft, do some simple non-functional cleanup in the runtime
This commit is contained in:
commit
076dbe6cea
@ -16,10 +16,10 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/types"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
||||
pb "github.com/kata-containers/kata-containers/src/runtime/protocols/cache"
|
||||
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
|
||||
vf "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/factory"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
"golang.org/x/sys/unix"
|
||||
|
@ -26,8 +26,8 @@ import (
|
||||
"syscall"
|
||||
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
||||
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
@ -3,6 +3,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
//go:build arm64 || ppc64le
|
||||
// +build arm64 ppc64le
|
||||
|
||||
package main
|
||||
|
@ -18,10 +18,10 @@ import (
|
||||
"github.com/urfave/cli"
|
||||
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/utils"
|
||||
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
|
||||
exp "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/experimental"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci"
|
||||
vcUtils "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils"
|
||||
)
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
//go:build arm64 || ppc64le
|
||||
// +build arm64 ppc64le
|
||||
|
||||
package main
|
||||
|
@ -27,7 +27,7 @@ import (
|
||||
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katatestutils"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
@ -18,12 +18,12 @@ import (
|
||||
"syscall"
|
||||
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/signals"
|
||||
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
|
||||
exp "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/experimental"
|
||||
vf "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/factory"
|
||||
tl "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/factory/template"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/rootless"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
@ -21,8 +21,8 @@ import (
|
||||
|
||||
ktu "github.com/kata-containers/kata-containers/src/runtime/pkg/katatestutils"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
||||
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/vcmock"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -34,9 +34,9 @@ import (
|
||||
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils/katatrace"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
||||
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/compatoci"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci"
|
||||
)
|
||||
|
||||
type startManagementServerFunc func(s *service, ctx context.Context, ociSpec *specs.Spec)
|
||||
|
@ -31,9 +31,9 @@ import (
|
||||
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils/katatrace"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
||||
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/compatoci"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
|
||||
)
|
||||
|
||||
|
@ -16,9 +16,9 @@ import (
|
||||
"github.com/containerd/containerd/mount"
|
||||
cdshim "github.com/containerd/containerd/runtime/v2/shim"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
||||
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/compatoci"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci"
|
||||
)
|
||||
|
||||
func cReap(s *service, status int, id, execid string, exitat time.Time) {
|
||||
|
@ -16,8 +16,8 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
ktu "github.com/kata-containers/kata-containers/src/runtime/pkg/katatestutils"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
||||
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/vcmock"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
@ -17,7 +17,7 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
"google.golang.org/grpc/codes"
|
||||
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
||||
)
|
||||
|
||||
const defaultCheckInterval = 1 * time.Second
|
||||
|
@ -17,10 +17,10 @@ import (
|
||||
"github.com/BurntSushi/toml"
|
||||
govmmQemu "github.com/kata-containers/govmm/qemu"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils/katatrace"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
||||
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config"
|
||||
exp "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/experimental"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
@ -19,8 +19,8 @@ import (
|
||||
"testing"
|
||||
|
||||
ktu "github.com/kata-containers/kata-containers/src/runtime/pkg/katatestutils"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
||||
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
@ -14,9 +14,9 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils/katatrace"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
||||
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
|
||||
vf "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/factory"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
||||
|
||||
|
@ -19,9 +19,9 @@ import (
|
||||
"testing"
|
||||
|
||||
ktu "github.com/kata-containers/kata-containers/src/runtime/pkg/katatestutils"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
||||
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/compatoci"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/vcmock"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -323,18 +323,6 @@ func networkConfig(ocispec specs.Spec, config RuntimeConfig) (vc.NetworkConfig,
|
||||
return netConf, nil
|
||||
}
|
||||
|
||||
// GetContainerType determines which type of container matches the annotations
|
||||
// table provided.
|
||||
func GetContainerType(annotations map[string]string) (vc.ContainerType, error) {
|
||||
if containerType, ok := annotations[vcAnnotations.ContainerTypeKey]; ok {
|
||||
return vc.ContainerType(containerType), nil
|
||||
}
|
||||
|
||||
ociLog.Errorf("Annotations[%s] not found, cannot determine the container type",
|
||||
vcAnnotations.ContainerTypeKey)
|
||||
return vc.UnknownContainerType, fmt.Errorf("Could not find container type")
|
||||
}
|
||||
|
||||
// ContainerType returns the type of container and if the container type was
|
||||
// found from CRI servers annotations.
|
||||
func ContainerType(spec specs.Spec) (vc.ContainerType, error) {
|
@ -188,38 +188,6 @@ func TestMinimalSandboxConfig(t *testing.T) {
|
||||
assert.NoError(os.Remove(configPath))
|
||||
}
|
||||
|
||||
func testGetContainerTypeSuccessful(t *testing.T, annotations map[string]string, expected vc.ContainerType) {
|
||||
assert := assert.New(t)
|
||||
containerType, err := GetContainerType(annotations)
|
||||
assert.NoError(err)
|
||||
assert.Equal(containerType, expected)
|
||||
}
|
||||
|
||||
func TestGetContainerTypePodSandbox(t *testing.T) {
|
||||
annotations := map[string]string{
|
||||
vcAnnotations.ContainerTypeKey: string(vc.PodSandbox),
|
||||
}
|
||||
|
||||
testGetContainerTypeSuccessful(t, annotations, vc.PodSandbox)
|
||||
}
|
||||
|
||||
func TestGetContainerTypePodContainer(t *testing.T) {
|
||||
annotations := map[string]string{
|
||||
vcAnnotations.ContainerTypeKey: string(vc.PodContainer),
|
||||
}
|
||||
|
||||
testGetContainerTypeSuccessful(t, annotations, vc.PodContainer)
|
||||
}
|
||||
|
||||
func TestGetContainerTypeFailure(t *testing.T) {
|
||||
expected := vc.UnknownContainerType
|
||||
assert := assert.New(t)
|
||||
|
||||
containerType, err := GetContainerType(map[string]string{})
|
||||
assert.Error(err)
|
||||
assert.Equal(containerType, expected)
|
||||
}
|
||||
|
||||
func testContainerTypeSuccessful(t *testing.T, ociSpec specs.Spec, expected vc.ContainerType) {
|
||||
containerType, err := ContainerType(ociSpec)
|
||||
assert := assert.New(t)
|
@ -21,9 +21,9 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils/katatrace"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/uuid"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config"
|
||||
persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/uuid"
|
||||
"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"
|
||||
|
@ -1,4 +1,6 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
// Copyright (c) 2016 Intel Corporation
|
||||
// Copyright (c) 2014,2015,2016,2017 Docker, Inc.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils/katatrace"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/uuid"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/api"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config"
|
||||
persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api"
|
||||
@ -28,7 +29,6 @@ import (
|
||||
vcAnnotations "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/annotations"
|
||||
vccgroups "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/cgroups"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/rootless"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/uuid"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
|
||||
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
|
||||
|
||||
|
@ -8,7 +8,6 @@ package virtcontainers
|
||||
import (
|
||||
"context"
|
||||
cryptoRand "crypto/rand"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net"
|
||||
@ -26,9 +25,9 @@ import (
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils/katatrace"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/uuid"
|
||||
pbTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/rootless"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/uuid"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils"
|
||||
)
|
||||
|
||||
@ -197,132 +196,6 @@ type NetworkNamespace struct {
|
||||
NetmonPID int
|
||||
}
|
||||
|
||||
// TypedJSONEndpoint is used as an intermediate representation for
|
||||
// marshalling and unmarshalling Endpoint objects.
|
||||
type TypedJSONEndpoint struct {
|
||||
Type EndpointType
|
||||
Data json.RawMessage
|
||||
}
|
||||
|
||||
// MarshalJSON is the custom NetworkNamespace JSON marshalling routine.
|
||||
// This is needed to properly marshall Endpoints array.
|
||||
func (n NetworkNamespace) MarshalJSON() ([]byte, error) {
|
||||
// We need a shadow structure in order to prevent json from
|
||||
// entering a recursive loop when only calling json.Marshal().
|
||||
type shadow struct {
|
||||
NetNsPath string
|
||||
Endpoints []TypedJSONEndpoint
|
||||
NetNsCreated bool
|
||||
}
|
||||
|
||||
s := &shadow{
|
||||
NetNsPath: n.NetNsPath,
|
||||
NetNsCreated: n.NetNsCreated,
|
||||
}
|
||||
|
||||
var typedEndpoints []TypedJSONEndpoint
|
||||
for _, endpoint := range n.Endpoints {
|
||||
tempJSON, _ := json.Marshal(endpoint)
|
||||
|
||||
t := TypedJSONEndpoint{
|
||||
Type: endpoint.Type(),
|
||||
Data: tempJSON,
|
||||
}
|
||||
|
||||
typedEndpoints = append(typedEndpoints, t)
|
||||
}
|
||||
|
||||
s.Endpoints = typedEndpoints
|
||||
|
||||
b, err := json.Marshal(s)
|
||||
return b, err
|
||||
}
|
||||
|
||||
func generateEndpoints(typedEndpoints []TypedJSONEndpoint) ([]Endpoint, error) {
|
||||
var endpoints []Endpoint
|
||||
|
||||
for _, e := range typedEndpoints {
|
||||
var endpointInf Endpoint
|
||||
switch e.Type {
|
||||
case PhysicalEndpointType:
|
||||
var endpoint PhysicalEndpoint
|
||||
endpointInf = &endpoint
|
||||
|
||||
case VethEndpointType:
|
||||
var endpoint VethEndpoint
|
||||
endpointInf = &endpoint
|
||||
|
||||
case VhostUserEndpointType:
|
||||
var endpoint VhostUserEndpoint
|
||||
endpointInf = &endpoint
|
||||
|
||||
case MacvlanEndpointType:
|
||||
var endpoint MacvlanEndpoint
|
||||
endpointInf = &endpoint
|
||||
|
||||
case MacvtapEndpointType:
|
||||
var endpoint MacvtapEndpoint
|
||||
endpointInf = &endpoint
|
||||
|
||||
case TapEndpointType:
|
||||
var endpoint TapEndpoint
|
||||
endpointInf = &endpoint
|
||||
|
||||
case IPVlanEndpointType:
|
||||
var endpoint IPVlanEndpoint
|
||||
endpointInf = &endpoint
|
||||
|
||||
case TuntapEndpointType:
|
||||
var endpoint TuntapEndpoint
|
||||
endpointInf = &endpoint
|
||||
|
||||
default:
|
||||
networkLogger().WithField("endpoint-type", e.Type).Error("Ignoring unknown endpoint type")
|
||||
}
|
||||
|
||||
err := json.Unmarshal(e.Data, endpointInf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
endpoints = append(endpoints, endpointInf)
|
||||
networkLogger().WithFields(logrus.Fields{
|
||||
"endpoint": endpointInf,
|
||||
"endpoint-type": e.Type,
|
||||
}).Info("endpoint unmarshalled")
|
||||
}
|
||||
return endpoints, nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON is the custom NetworkNamespace unmarshalling routine.
|
||||
// This is needed for unmarshalling the Endpoints interfaces array.
|
||||
func (n *NetworkNamespace) UnmarshalJSON(b []byte) error {
|
||||
var s struct {
|
||||
NetNsPath string
|
||||
Endpoints json.RawMessage
|
||||
NetNsCreated bool
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(b, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
(*n).NetNsPath = s.NetNsPath
|
||||
(*n).NetNsCreated = s.NetNsCreated
|
||||
|
||||
var typedEndpoints []TypedJSONEndpoint
|
||||
if err := json.Unmarshal([]byte(string(s.Endpoints)), &typedEndpoints); err != nil {
|
||||
return err
|
||||
}
|
||||
endpoints, err := generateEndpoints(typedEndpoints)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
(*n).Endpoints = endpoints
|
||||
return nil
|
||||
}
|
||||
|
||||
func createLink(netHandle *netlink.Handle, name string, expectedLink netlink.Link, queues int) (netlink.Link, []*os.File, error) {
|
||||
var newLink netlink.Link
|
||||
var fds []*os.File
|
||||
|
@ -1,31 +0,0 @@
|
||||
// Copyright (c) 2018 Intel Corporation
|
||||
// Copyright 2015-2017 CNI authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
package nsenter
|
||||
|
||||
// NSType defines a namespace type.
|
||||
type NSType string
|
||||
|
||||
// List of namespace types.
|
||||
// Notice that neither "mnt" nor "user" are listed into this list.
|
||||
// Because Golang is multithreaded, we get some errors when trying
|
||||
// to switch to those namespaces, getting "invalid argument".
|
||||
// The solution is to reexec the current code so that it will call
|
||||
// into a C constructor, making sure the namespace can be entered
|
||||
// without multithreading issues.
|
||||
const (
|
||||
NSTypeCGroup NSType = "cgroup"
|
||||
NSTypeIPC NSType = "ipc"
|
||||
NSTypeNet NSType = "net"
|
||||
NSTypePID NSType = "pid"
|
||||
NSTypeUTS NSType = "uts"
|
||||
)
|
||||
|
||||
type Namespace struct {
|
||||
Path string
|
||||
Type NSType
|
||||
PID int
|
||||
}
|
@ -33,9 +33,9 @@ import (
|
||||
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils/katatrace"
|
||||
pkgUtils "github.com/kata-containers/kata-containers/src/runtime/pkg/utils"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/uuid"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config"
|
||||
persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/uuid"
|
||||
"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"
|
||||
|
@ -12,8 +12,8 @@ import (
|
||||
"github.com/containernetworking/plugins/pkg/ns"
|
||||
"github.com/vishvananda/netlink"
|
||||
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/uuid"
|
||||
persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/uuid"
|
||||
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
|
||||
)
|
||||
|
||||
|
@ -71,8 +71,8 @@ func GenerateRandomBytes(n int) ([]byte, error) {
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// ReverseString reverses whole string
|
||||
func ReverseString(s string) string {
|
||||
// reverseString reverses whole string
|
||||
func reverseString(s string) string {
|
||||
r := []rune(s)
|
||||
|
||||
length := len(r)
|
||||
@ -160,7 +160,7 @@ func GetVirtDriveName(index int) (string, error) {
|
||||
return "", fmt.Errorf("Index not supported")
|
||||
}
|
||||
|
||||
diskName := prefix + ReverseString(string(diskLetters[:i]))
|
||||
diskName := prefix + reverseString(string(diskLetters[:i]))
|
||||
return diskName, nil
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
//go:build amd64 || arm64 || s390x || !ppc64le
|
||||
// +build amd64 arm64 s390x !ppc64le
|
||||
|
||||
// Copyright (c) 2019 IBM
|
||||
|
@ -97,7 +97,7 @@ func TestGenerateRandomBytes(t *testing.T) {
|
||||
func TestRevereString(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
str := "Teststr"
|
||||
reversed := ReverseString(str)
|
||||
reversed := reverseString(str)
|
||||
assert.Equal(reversed, "rtstseT")
|
||||
}
|
||||
|
||||
|
@ -12,10 +12,10 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/uuid"
|
||||
pb "github.com/kata-containers/kata-containers/src/runtime/protocols/cache"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist"
|
||||
persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/uuid"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user