persist: remove all usage of VCStore

Remove VCStore usage from all modules

Signed-off-by: Wei Zhang <weizhang555.zw@gmail.com>
This commit is contained in:
Wei Zhang 2019-11-28 14:59:26 +08:00
parent 01b4a64be2
commit 8e88859ee4
23 changed files with 135 additions and 190 deletions

View File

@ -24,8 +24,8 @@ import (
"github.com/kata-containers/runtime/pkg/rootless"
"github.com/kata-containers/runtime/virtcontainers/device/config"
persistapi "github.com/kata-containers/runtime/virtcontainers/persist/api"
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
"github.com/kata-containers/runtime/virtcontainers/pkg/uuid"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/types"
"github.com/kata-containers/runtime/virtcontainers/utils"
)
@ -327,7 +327,7 @@ func (a *Acrn) setup(id string, hypervisorConfig *HypervisorConfig) error {
// The path might already exist, but in case of VM templating,
// we have to create it since the sandbox has not created it yet.
if err = os.MkdirAll(store.SandboxRuntimeRootPath(id), store.DirMode); err != nil {
if err = os.MkdirAll(filepath.Join(fs.RunStoragePath(), id), DirMode); err != nil {
return err
}
@ -443,8 +443,8 @@ func (a *Acrn) startSandbox(timeoutSecs int) error {
a.Logger().WithField("default-kernel-parameters", formatted).Debug()
}
vmPath := filepath.Join(store.RunVMStoragePath(), a.id)
err := os.MkdirAll(vmPath, store.DirMode)
vmPath := filepath.Join(fs.RunVMStoragePath(), a.id)
err := os.MkdirAll(vmPath, DirMode)
if err != nil {
return err
}
@ -657,7 +657,7 @@ func (a *Acrn) getSandboxConsole(id string) (string, error) {
span, _ := a.trace("getSandboxConsole")
defer span.Finish()
return utils.BuildSocketPath(store.RunVMStoragePath(), id, acrnConsoleSocket)
return utils.BuildSocketPath(fs.RunVMStoragePath(), id, acrnConsoleSocket)
}
func (a *Acrn) saveSandbox() error {
@ -802,7 +802,7 @@ func (a *Acrn) storeInfo() error {
if os.IsNotExist(err) {
// Root directory
a.Logger().WithField("path", dirPath).Debugf("Creating UUID directory")
if err := os.MkdirAll(dirPath, store.DirMode); err != nil {
if err := os.MkdirAll(dirPath, DirMode); err != nil {
return err
}
} else if err != nil {

View File

@ -13,7 +13,7 @@ import (
"testing"
"github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
"github.com/kata-containers/runtime/virtcontainers/types"
"github.com/stretchr/testify/assert"
)
@ -106,7 +106,7 @@ func TestAcrnArchBaseAppendConsoles(t *testing.T) {
assert := assert.New(t)
acrnArchBase := newAcrnArchBase()
path := filepath.Join(store.SandboxRuntimeRootPath(sandboxID), consoleSocket)
path := filepath.Join(filepath.Join(fs.RunStoragePath(), sandboxID), consoleSocket)
expectedOut := []Device{
ConsoleDevice{

View File

@ -12,7 +12,7 @@ import (
"testing"
"github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
"github.com/kata-containers/runtime/virtcontainers/types"
"github.com/stretchr/testify/assert"
)
@ -198,7 +198,7 @@ func TestAcrnGetSandboxConsole(t *testing.T) {
ctx: context.Background(),
}
sandboxID := "testSandboxID"
expected := filepath.Join(store.RunVMStoragePath(), sandboxID, consoleSocket)
expected := filepath.Join(fs.RunVMStoragePath(), sandboxID, consoleSocket)
result, err := a.getSandboxConsole(sandboxID)
assert.NoError(err)

View File

@ -16,7 +16,6 @@ import (
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
"github.com/kata-containers/runtime/virtcontainers/pkg/compatoci"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/types"
specs "github.com/opencontainers/runtime-spec/specs-go"
opentracing "github.com/opentracing/opentracing-go"
@ -50,7 +49,6 @@ func SetLogger(ctx context.Context, logger *logrus.Entry) {
virtLog = logger.WithFields(fields)
deviceApi.SetLogger(virtLog)
store.SetLogger(virtLog)
compatoci.SetLogger(virtLog)
}

View File

@ -16,11 +16,11 @@ import (
"testing"
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
"github.com/kata-containers/runtime/virtcontainers/persist"
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
"github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
"github.com/kata-containers/runtime/virtcontainers/pkg/mock"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/types"
"github.com/kata-containers/runtime/virtcontainers/utils"
specs "github.com/opencontainers/runtime-spec/specs-go"
@ -69,6 +69,16 @@ func newBasicTestCmd() types.Cmd {
return cmd
}
func rmSandboxDir(sid string) error {
store, err := persist.GetDriver("fs")
if err != nil {
return fmt.Errorf("failed to get fs persist driver: %v", err)
}
store.Destroy(sid)
return nil
}
func newTestSandboxConfigNoop() SandboxConfig {
bundlePath := filepath.Join(testDir, testBundle)
containerAnnotations[annotations.BundlePathKey] = bundlePath
@ -139,7 +149,7 @@ func TestCreateSandboxNoopAgentSuccessful(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
sandboxDir := store.SandboxRuntimeRootPath(p.ID())
sandboxDir := filepath.Join(fs.RunStoragePath(), p.ID())
_, err = os.Stat(sandboxDir)
assert.NoError(err)
}
@ -176,7 +186,7 @@ func TestCreateSandboxKataAgentSuccessful(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
sandboxDir := store.SandboxRuntimeRootPath(p.ID())
sandboxDir := filepath.Join(fs.RunStoragePath(), p.ID())
_, err = os.Stat(sandboxDir)
assert.NoError(err)
}
@ -203,7 +213,7 @@ func TestDeleteSandboxNoopAgentSuccessful(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
sandboxDir := store.SandboxRuntimeRootPath(p.ID())
sandboxDir := filepath.Join(fs.RunStoragePath(), p.ID())
_, err = os.Stat(sandboxDir)
assert.NoError(err)
@ -248,7 +258,7 @@ func TestDeleteSandboxKataAgentSuccessful(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
sandboxDir := store.SandboxRuntimeRootPath(p.ID())
sandboxDir := filepath.Join(fs.RunStoragePath(), p.ID())
_, err = os.Stat(sandboxDir)
assert.NoError(err)
@ -264,7 +274,7 @@ func TestDeleteSandboxFailing(t *testing.T) {
defer cleanUp()
assert := assert.New(t)
sandboxDir := store.SandboxRuntimeRootPath(testSandboxID)
sandboxDir := filepath.Join(fs.RunStoragePath(), testSandboxID)
os.Remove(sandboxDir)
p, err := DeleteSandbox(context.Background(), testSandboxID)
@ -328,7 +338,7 @@ func TestStartSandboxFailing(t *testing.T) {
defer cleanUp()
assert := assert.New(t)
sandboxDir := store.SandboxRuntimeRootPath(testSandboxID)
sandboxDir := filepath.Join(fs.RunStoragePath(), testSandboxID)
os.Remove(sandboxDir)
p, err := StartSandbox(context.Background(), testSandboxID)
@ -395,7 +405,7 @@ func TestStopSandboxKataAgentSuccessful(t *testing.T) {
func TestStopSandboxFailing(t *testing.T) {
defer cleanUp()
sandboxDir := store.SandboxRuntimeRootPath(testSandboxID)
sandboxDir := filepath.Join(fs.RunStoragePath(), testSandboxID)
os.Remove(sandboxDir)
p, err := StopSandbox(context.Background(), testSandboxID, false)
@ -413,7 +423,7 @@ func TestRunSandboxNoopAgentSuccessful(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
sandboxDir := store.SandboxRuntimeRootPath(p.ID())
sandboxDir := filepath.Join(fs.RunStoragePath(), p.ID())
_, err = os.Stat(sandboxDir)
assert.NoError(err)
}
@ -451,7 +461,7 @@ func TestRunSandboxKataAgentSuccessful(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
sandboxDir := store.SandboxRuntimeRootPath(p.ID())
sandboxDir := filepath.Join(fs.RunStoragePath(), p.ID())
_, err = os.Stat(sandboxDir)
assert.NoError(err)
@ -617,8 +627,6 @@ func TestStatusSandboxSuccessfulStateRunning(t *testing.T) {
assert.Exactly(status, expectedStatus)
}
/*FIXME: replace DeleteAll with newstore.Destroy
func TestStatusSandboxFailingFetchSandboxConfig(t *testing.T) {
defer cleanUp()
assert := assert.New(t)
@ -630,7 +638,7 @@ func TestStatusSandboxFailingFetchSandboxConfig(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
store.DeleteAll()
rmSandboxDir(p.ID())
globalSandboxList.removeSandbox(p.ID())
_, err = StatusSandbox(ctx, p.ID())
@ -648,12 +656,12 @@ func TestStatusPodSandboxFailingFetchSandboxState(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
store.DeleteAll()
rmSandboxDir(p.ID())
globalSandboxList.removeSandbox(p.ID())
_, err = StatusSandbox(ctx, p.ID())
assert.Error(err)
}*/
}
func newTestContainerConfigNoop(contID string) ContainerConfig {
// Define the container command and bundle.
@ -680,7 +688,7 @@ func TestCreateContainerSuccessful(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
sandboxDir := store.SandboxRuntimeRootPath(p.ID())
sandboxDir := filepath.Join(fs.RunStoragePath(), p.ID())
_, err = os.Stat(sandboxDir)
assert.NoError(err)
@ -734,7 +742,7 @@ func TestDeleteContainerSuccessful(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
sandboxDir := store.SandboxRuntimeRootPath(p.ID())
sandboxDir := filepath.Join(fs.RunStoragePath(), p.ID())
_, err = os.Stat(sandboxDir)
assert.NoError(err)
@ -778,7 +786,7 @@ func TestDeleteContainerFailingNoContainer(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
sandboxDir := store.SandboxRuntimeRootPath(p.ID())
sandboxDir := filepath.Join(fs.RunStoragePath(), p.ID())
_, err = os.Stat(sandboxDir)
assert.NoError(err)
@ -835,7 +843,7 @@ func TestStartContainerFailingNoContainer(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
sandboxDir := store.SandboxRuntimeRootPath(p.ID())
sandboxDir := filepath.Join(fs.RunStoragePath(), p.ID())
_, err = os.Stat(sandboxDir)
assert.NoError(err)
@ -856,7 +864,7 @@ func TestStartContainerFailingSandboxNotStarted(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
sandboxDir := store.SandboxRuntimeRootPath(p.ID())
sandboxDir := filepath.Join(fs.RunStoragePath(), p.ID())
_, err = os.Stat(sandboxDir)
assert.NoError(err)
@ -936,7 +944,7 @@ func TestStopContainerFailingNoContainer(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
sandboxDir := store.SandboxRuntimeRootPath(p.ID())
sandboxDir := filepath.Join(fs.RunStoragePath(), p.ID())
_, err = os.Stat(sandboxDir)
assert.NoError(err)
@ -1040,7 +1048,7 @@ func TestEnterContainerFailingNoContainer(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
sandboxDir := store.SandboxRuntimeRootPath(p.ID())
sandboxDir := filepath.Join(fs.RunStoragePath(), p.ID())
_, err = os.Stat(sandboxDir)
assert.NoError(err)
@ -1093,7 +1101,7 @@ func TestStatusContainerSuccessful(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
sandboxDir := store.SandboxRuntimeRootPath(p.ID())
sandboxDir := filepath.Join(fs.RunStoragePath(), p.ID())
_, err = os.Stat(sandboxDir)
assert.NoError(err)
@ -1136,7 +1144,7 @@ func TestStatusContainerStateReady(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
sandboxDir := store.SandboxRuntimeRootPath(p.ID())
sandboxDir := filepath.Join(fs.RunStoragePath(), p.ID())
_, err = os.Stat(sandboxDir)
assert.NoError(err)
@ -1199,7 +1207,7 @@ func TestStatusContainerStateRunning(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
sandboxDir := store.SandboxRuntimeRootPath(p.ID())
sandboxDir := filepath.Join(fs.RunStoragePath(), p.ID())
_, err = os.Stat(sandboxDir)
assert.NoError(err)
@ -1246,7 +1254,6 @@ func TestStatusContainerStateRunning(t *testing.T) {
assert.Exactly(status, expectedStatus)
}
/* FIXME: replace DeleteAll with newstore.Destroy
func TestStatusContainerFailing(t *testing.T) {
defer cleanUp()
assert := assert.New(t)
@ -1259,12 +1266,12 @@ func TestStatusContainerFailing(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
store.DeleteAll()
rmSandboxDir(p.ID())
globalSandboxList.removeSandbox(p.ID())
_, err = StatusContainer(ctx, p.ID(), contID)
assert.Error(err)
}*/
}
func TestStatsContainerFailing(t *testing.T) {
defer cleanUp()
@ -1278,7 +1285,7 @@ func TestStatsContainerFailing(t *testing.T) {
assert.NoError(err)
assert.NotNil(p)
store.DeleteAll()
rmSandboxDir(p.ID())
globalSandboxList.removeSandbox(p.ID())
_, err = StatsContainer(ctx, p.ID(), contID)
@ -1312,7 +1319,6 @@ func TestStatsContainer(t *testing.T) {
pImpl, ok := p.(*Sandbox)
assert.True(ok)
defer store.DeleteAll()
contConfig := newTestContainerConfigNoop(contID)
_, c, err := CreateContainer(ctx, p.ID(), contConfig)
@ -1358,7 +1364,7 @@ func TestProcessListContainer(t *testing.T) {
pImpl, ok := p.(*Sandbox)
assert.True(ok)
defer store.DeleteAll()
// defer store.DeleteAll()
contConfig := newTestContainerConfigNoop(contID)
_, c, err := CreateContainer(ctx, p.ID(), contConfig)
@ -1414,7 +1420,7 @@ func createAndStartSandbox(ctx context.Context, config SandboxConfig) (sandbox V
return nil, "", err
}
sandboxDir = store.SandboxRuntimeRootPath(sandbox.ID())
sandboxDir = filepath.Join(fs.RunStoragePath(), sandbox.ID())
_, err = os.Stat(sandboxDir)
if err != nil {
return nil, "", err
@ -1699,7 +1705,7 @@ func TestCleanupContainer(t *testing.T) {
CleanupContainer(ctx, p.ID(), c.ID(), true)
}
sandboxDir := store.SandboxRuntimeRootPath(p.ID())
sandboxDir := filepath.Join(fs.RunStoragePath(), p.ID())
_, err = os.Stat(sandboxDir)
if err == nil {

View File

@ -21,13 +21,13 @@ import (
"time"
persistapi "github.com/kata-containers/runtime/virtcontainers/persist/api"
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
chclient "github.com/kata-containers/runtime/virtcontainers/pkg/cloud-hypervisor/client"
opentracing "github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/types"
"github.com/kata-containers/runtime/virtcontainers/utils"
)
@ -303,8 +303,8 @@ func (clh *cloudHypervisor) startSandbox(timeout int) error {
clh.Logger().WithField("function", "startSandbox").Info("starting Sandbox")
vmPath := filepath.Join(store.RunVMStoragePath(), clh.id)
err := os.MkdirAll(vmPath, store.DirMode)
vmPath := filepath.Join(fs.RunVMStoragePath(), clh.id)
err := os.MkdirAll(vmPath, DirMode)
if err != nil {
return err
}
@ -604,23 +604,23 @@ func (clh *cloudHypervisor) generateSocket(id string, useVsock bool) (interface{
}
func (clh *cloudHypervisor) virtioFsSocketPath(id string) (string, error) {
return utils.BuildSocketPath(store.RunVMStoragePath(), id, virtioFsSocket)
return utils.BuildSocketPath(fs.RunVMStoragePath(), id, virtioFsSocket)
}
func (clh *cloudHypervisor) vsockSocketPath(id string) (string, error) {
return utils.BuildSocketPath(store.RunVMStoragePath(), id, clhSocket)
return utils.BuildSocketPath(fs.RunVMStoragePath(), id, clhSocket)
}
func (clh *cloudHypervisor) serialPath(id string) (string, error) {
return utils.BuildSocketPath(store.RunVMStoragePath(), id, clhSerial)
return utils.BuildSocketPath(fs.RunVMStoragePath(), id, clhSerial)
}
func (clh *cloudHypervisor) apiSocketPath(id string) (string, error) {
return utils.BuildSocketPath(store.RunVMStoragePath(), id, clhAPISocket)
return utils.BuildSocketPath(fs.RunVMStoragePath(), id, clhAPISocket)
}
func (clh *cloudHypervisor) logFilePath(id string) (string, error) {
return utils.BuildSocketPath(store.RunVMStoragePath(), id, clhLogFile)
return utils.BuildSocketPath(fs.RunVMStoragePath(), id, clhLogFile)
}
func (clh *cloudHypervisor) waitVMM(timeout uint) error {
@ -998,7 +998,7 @@ func (clh *cloudHypervisor) cleanupVM(force bool) error {
}
// cleanup vm path
dir := filepath.Join(store.RunVMStoragePath(), clh.id)
dir := filepath.Join(fs.RunVMStoragePath(), clh.id)
// If it's a symlink, remove both dir and the target.
link, err := filepath.EvalSymlinks(dir)
@ -1027,14 +1027,7 @@ func (clh *cloudHypervisor) cleanupVM(force bool) error {
}
if clh.config.VMid != "" {
dir = store.SandboxConfigurationRootPath(clh.config.VMid)
if err := os.RemoveAll(dir); err != nil {
if !force {
return err
}
clh.Logger().WithError(err).WithField("path", dir).Warnf("failed to remove vm path")
}
dir = store.SandboxRuntimeRootPath(clh.config.VMid)
dir = filepath.Join(fs.RunStoragePath(), clh.config.VMid)
if err := os.RemoveAll(dir); err != nil {
if !force {
return err

View File

@ -219,18 +219,8 @@ func TestClhCreateSandbox(t *testing.T) {
},
}
vcStore, err := store.NewVCSandboxStore(sandbox.ctx, sandbox.id)
err = clh.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig, false)
assert.NoError(err)
sandbox.store = vcStore
// Create parent dir path for hypervisor.json
parentDir := store.SandboxConfigurationRootPath(sandbox.id)
assert.NoError(os.MkdirAll(parentDir, store.DirMode))
err = clh.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig, sandbox.store, false)
assert.NoError(err)
assert.NoError(os.RemoveAll(parentDir))
assert.Exactly(clhConfig, clh.config)
}
@ -245,23 +235,6 @@ func TestClooudHypervisorStartSandbox(t *testing.T) {
virtiofsd: &virtiofsdMock{},
}
sandbox := &Sandbox{
ctx: context.Background(),
id: "testSandbox",
config: &SandboxConfig{
HypervisorConfig: clhConfig,
},
}
vcStore, err := store.NewVCSandboxStore(sandbox.ctx, sandbox.id)
assert.NoError(err)
sandbox.store = vcStore
// Create parent dir path for hypervisor.json
parentDir := store.SandboxConfigurationRootPath(sandbox.id)
assert.NoError(os.MkdirAll(parentDir, store.DirMode))
err = clh.startSandbox(10)
assert.NoError(err)
}

View File

@ -29,7 +29,6 @@ import (
"github.com/kata-containers/runtime/pkg/rootless"
"github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/device/manager"
"github.com/kata-containers/runtime/virtcontainers/store"
)
// https://github.com/torvalds/linux/blob/master/include/uapi/linux/major.h
@ -322,8 +321,6 @@ type Container struct {
sandbox *Sandbox
runPath string
configPath string
containerPath string
rootfsSuffix string
@ -673,8 +670,6 @@ func newContainer(sandbox *Sandbox, contConfig *ContainerConfig) (*Container, er
rootFs: contConfig.RootFs,
config: contConfig,
sandbox: sandbox,
runPath: store.ContainerRuntimeRootPath(sandbox.id, contConfig.ID),
configPath: store.ContainerConfigurationRootPath(sandbox.id, contConfig.ID),
containerPath: filepath.Join(sandbox.id, contConfig.ID),
rootfsSuffix: "rootfs",
state: types.ContainerState{},

View File

@ -21,7 +21,6 @@ import (
"github.com/kata-containers/runtime/virtcontainers/device/drivers"
"github.com/kata-containers/runtime/virtcontainers/device/manager"
"github.com/kata-containers/runtime/virtcontainers/persist"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/types"
"github.com/stretchr/testify/assert"
)
@ -267,7 +266,7 @@ func testSetupFakeRootfs(t *testing.T) (testRawFile, loopDev, mntDir string, err
assert.NoError(err)
mntDir = filepath.Join(tmpDir, "rootfs")
err = os.Mkdir(mntDir, store.DirMode)
err = os.Mkdir(mntDir, DirMode)
assert.NoError(err)
err = syscall.Mount(loopDev, mntDir, "ext4", uintptr(0), "")

View File

@ -15,7 +15,7 @@ import (
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/factory/direct"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
)
func TestTemplateFactory(t *testing.T) {
@ -35,14 +35,11 @@ func TestTemplateFactory(t *testing.T) {
ctx := context.Background()
ConfigStoragePathSaved := store.ConfigStoragePath
RunStoragePathSaved := store.RunStoragePath
runPathSave := fs.RunStoragePath()
fs.TestSetRunStoragePath(filepath.Join(testDir, "vc", "run"))
// allow the tests to run without affecting the host system.
store.ConfigStoragePath = func() string { return filepath.Join(testDir, store.StoragePathSuffix, "config") }
store.RunStoragePath = func() string { return filepath.Join(testDir, store.StoragePathSuffix, "run") }
defer func() {
store.ConfigStoragePath = ConfigStoragePathSaved
store.RunStoragePath = RunStoragePathSaved
fs.TestSetRunStoragePath(runPathSave)
}()
// New

View File

@ -38,7 +38,6 @@ import (
"github.com/blang/semver"
"github.com/containerd/console"
"github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/types"
"github.com/kata-containers/runtime/virtcontainers/utils"
)
@ -76,6 +75,8 @@ const (
fcMetricsFifo = "metrics.fifo"
defaultFcConfig = "fcConfig.json"
// storagePathSuffix mirrors persist/fs/fs.go:storagePathSuffix
storagePathSuffix = "vc"
)
// Specify the minimum version of firecracker supported
@ -244,8 +245,8 @@ func (fc *firecracker) createSandbox(ctx context.Context, id string, networkNS N
// Also jailer based on the id implicitly sets up cgroups under
// <cgroups_base>/<exec_file_name>/<id>/
hypervisorName := filepath.Base(hypervisorConfig.HypervisorPath)
//store.ConfigStoragePath cannot be used as we need exec perms
fc.chrootBaseDir = filepath.Join("/var/lib/", store.StoragePathSuffix)
//fs.RunStoragePath cannot be used as we need exec perms
fc.chrootBaseDir = filepath.Join("/run", storagePathSuffix)
fc.vmPath = filepath.Join(fc.chrootBaseDir, hypervisorName, fc.id)
fc.jailerRoot = filepath.Join(fc.vmPath, "root") // auto created by jailer
@ -374,7 +375,7 @@ func (fc *firecracker) fcInit(timeout int) error {
}
// Fetch sandbox network to be able to access it from the sandbox structure.
err := os.MkdirAll(fc.jailerRoot, store.DirMode)
err := os.MkdirAll(fc.jailerRoot, DirMode)
if err != nil {
return err
}

View File

@ -17,7 +17,7 @@ import (
"github.com/kata-containers/runtime/virtcontainers/device/config"
persistapi "github.com/kata-containers/runtime/virtcontainers/persist/api"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
"github.com/kata-containers/runtime/virtcontainers/types"
"github.com/kata-containers/runtime/virtcontainers/utils"
)
@ -720,7 +720,7 @@ func generateVMSocket(id string, useVsock bool) (interface{}, error) {
}, nil
}
path, err := utils.BuildSocketPath(filepath.Join(store.RunVMStoragePath(), id), defaultSocketName)
path, err := utils.BuildSocketPath(filepath.Join(fs.RunVMStoragePath(), id), defaultSocketName)
if err != nil {
return nil, err
}

View File

@ -26,11 +26,11 @@ import (
"github.com/kata-containers/runtime/pkg/rootless"
"github.com/kata-containers/runtime/virtcontainers/device/config"
persistapi "github.com/kata-containers/runtime/virtcontainers/persist/api"
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
vcAnnotations "github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
ns "github.com/kata-containers/runtime/virtcontainers/pkg/nsenter"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
"github.com/kata-containers/runtime/virtcontainers/pkg/uuid"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/types"
"github.com/opencontainers/runtime-spec/specs-go"
opentracing "github.com/opentracing/opentracing-go"
@ -217,7 +217,7 @@ func (k *kataAgent) Logger() *logrus.Entry {
}
func (k *kataAgent) getVMPath(id string) string {
return filepath.Join(store.RunVMStoragePath(), id)
return filepath.Join(fs.RunVMStoragePath(), id)
}
func (k *kataAgent) getSharePath(id string) string {
@ -402,7 +402,7 @@ func (k *kataAgent) configure(h hypervisor, id, sharePath string, builtin bool,
HostPath: sharePath,
}
if err = os.MkdirAll(sharedVolume.HostPath, store.DirMode); err != nil {
if err = os.MkdirAll(sharedVolume.HostPath, DirMode); err != nil {
return err
}
@ -2126,7 +2126,7 @@ func (k *kataAgent) copyFile(src, dst string) error {
cpReq := &grpc.CopyFileRequest{
Path: dst,
DirMode: uint32(store.DirMode),
DirMode: uint32(DirMode),
FileMode: st.Mode,
FileSize: fileSize,
Uid: int32(st.Uid),

View File

@ -37,6 +37,9 @@ const storagePathSuffix = "vc"
// sandboxPathSuffix is the suffix used for sandbox storage
const sandboxPathSuffix = "sbs"
// vmPathSuffix is the suffix used for guest VMs.
const vmPathSuffix = "vm"
// RunStoragePath is the sandbox runtime directory.
// It will contain one state.json and one lock file for each created sandbox.
var RunStoragePath = func() string {
@ -47,6 +50,17 @@ var RunStoragePath = func() string {
return path
}
// RunVMStoragePath is the vm directory.
// It will contain all guest vm sockets and shared mountpoints.
// The function is declared this way for mocking in unit tests
var RunVMStoragePath = func() string {
path := filepath.Join("/run", storagePathSuffix, vmPathSuffix)
if rootless.IsRootless() {
return filepath.Join(rootless.GetRootlessDir(), path)
}
return path
}
// FS storage driver implementation
type FS struct {
sandboxState *persistapi.SandboxState

View File

@ -14,7 +14,7 @@ import (
"strings"
kataclient "github.com/kata-containers/agent/protocols/client"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
"github.com/sirupsen/logrus"
)
@ -146,7 +146,7 @@ func validateProxyConfig(proxyConfig ProxyConfig) error {
func defaultProxyURL(id, socketType string) (string, error) {
switch socketType {
case SocketTypeUNIX:
socketPath := filepath.Join(store.SandboxRuntimeRootPath(id), "proxy.sock")
socketPath := filepath.Join(filepath.Join(fs.RunStoragePath(), id), "proxy.sock")
return fmt.Sprintf("unix://%s", socketPath), nil
case SocketTypeVSOCK:
// TODO Build the VSOCK default URL

View File

@ -12,7 +12,7 @@ import (
"path/filepath"
"testing"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
)
@ -173,7 +173,7 @@ func testDefaultProxyURL(expectedURL string, socketType string, sandboxID string
}
func TestDefaultProxyURLUnix(t *testing.T) {
path := filepath.Join(store.SandboxRuntimeRootPath(sandboxID), "proxy.sock")
path := filepath.Join(filepath.Join(fs.RunStoragePath(), sandboxID), "proxy.sock")
socketPath := fmt.Sprintf("unix://%s", path)
assert.NoError(t, testDefaultProxyURL(socketPath, SocketTypeUNIX, sandboxID))
}
@ -183,7 +183,7 @@ func TestDefaultProxyURLVSock(t *testing.T) {
}
func TestDefaultProxyURLUnknown(t *testing.T) {
path := filepath.Join(store.SandboxRuntimeRootPath(sandboxID), "proxy.sock")
path := filepath.Join(filepath.Join(fs.RunStoragePath(), sandboxID), "proxy.sock")
socketPath := fmt.Sprintf("unix://%s", path)
assert.Error(t, testDefaultProxyURL(socketPath, "foobar", sandboxID))
}
@ -204,7 +204,7 @@ func testProxyStart(t *testing.T, agent agent, proxy proxy) {
}
invalidPath := filepath.Join(tmpdir, "enoent")
expectedSocketPath := filepath.Join(store.SandboxRuntimeRootPath(testSandboxID), "proxy.sock")
expectedSocketPath := filepath.Join(filepath.Join(fs.RunStoragePath(), testSandboxID), "proxy.sock")
expectedURI := fmt.Sprintf("unix://%s", expectedSocketPath)
data := []testData{

View File

@ -32,8 +32,8 @@ import (
"github.com/kata-containers/runtime/virtcontainers/device/config"
persistapi "github.com/kata-containers/runtime/virtcontainers/persist/api"
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
"github.com/kata-containers/runtime/virtcontainers/pkg/uuid"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/types"
"github.com/kata-containers/runtime/virtcontainers/utils"
)
@ -269,7 +269,7 @@ func (q *qemu) setup(id string, hypervisorConfig *HypervisorConfig) error {
// The path might already exist, but in case of VM templating,
// we have to create it since the sandbox has not created it yet.
if err = os.MkdirAll(store.SandboxRuntimeRootPath(id), store.DirMode); err != nil {
if err = os.MkdirAll(filepath.Join(fs.RunStoragePath(), id), DirMode); err != nil {
return err
}
}
@ -324,7 +324,7 @@ func (q *qemu) memoryTopology() (govmmQemu.Memory, error) {
}
func (q *qemu) qmpSocketPath(id string) (string, error) {
return utils.BuildSocketPath(store.RunVMStoragePath(), id, qmpSocket)
return utils.BuildSocketPath(fs.RunVMStoragePath(), id, qmpSocket)
}
func (q *qemu) getQemuMachine() (govmmQemu.Machine, error) {
@ -568,7 +568,7 @@ func (q *qemu) createSandbox(ctx context.Context, id string, networkNS NetworkNa
VGA: "none",
GlobalParam: "kvm-pit.lost_tick_policy=discard",
Bios: firmwarePath,
PidFile: filepath.Join(store.RunVMStoragePath(), q.id, "pid"),
PidFile: filepath.Join(fs.RunVMStoragePath(), q.id, "pid"),
}
if ioThread != nil {
@ -590,7 +590,7 @@ func (q *qemu) createSandbox(ctx context.Context, id string, networkNS NetworkNa
}
func (q *qemu) vhostFSSocketPath(id string) (string, error) {
return utils.BuildSocketPath(store.RunVMStoragePath(), id, vhostFSSocket)
return utils.BuildSocketPath(fs.RunVMStoragePath(), id, vhostFSSocket)
}
func (q *qemu) virtiofsdArgs(fd uintptr) []string {
@ -694,8 +694,8 @@ func (q *qemu) startSandbox(timeout int) error {
q.fds = []*os.File{}
}()
vmPath := filepath.Join(store.RunVMStoragePath(), q.id)
err := os.MkdirAll(vmPath, store.DirMode)
vmPath := filepath.Join(fs.RunVMStoragePath(), q.id)
err := os.MkdirAll(vmPath, DirMode)
if err != nil {
return err
}
@ -867,7 +867,7 @@ func (q *qemu) stopSandbox() error {
func (q *qemu) cleanupVM() error {
// cleanup vm path
dir := filepath.Join(store.RunVMStoragePath(), q.id)
dir := filepath.Join(fs.RunVMStoragePath(), q.id)
// If it's a symlink, remove both dir and the target.
// This can happen when vm template links a sandbox to a vm.
@ -888,11 +888,7 @@ func (q *qemu) cleanupVM() error {
}
if q.config.VMid != "" {
dir = store.SandboxConfigurationRootPath(q.config.VMid)
if err := os.RemoveAll(dir); err != nil {
q.Logger().WithError(err).WithField("path", dir).Warnf("failed to remove vm path")
}
dir = store.SandboxRuntimeRootPath(q.config.VMid)
dir = filepath.Join(fs.RunStoragePath(), q.config.VMid)
if err := os.RemoveAll(dir); err != nil {
q.Logger().WithError(err).WithField("path", dir).Warnf("failed to remove vm path")
}
@ -1582,7 +1578,7 @@ func (q *qemu) getSandboxConsole(id string) (string, error) {
span, _ := q.trace("getSandboxConsole")
defer span.Finish()
return utils.BuildSocketPath(store.RunVMStoragePath(), id, consoleSocket)
return utils.BuildSocketPath(fs.RunVMStoragePath(), id, consoleSocket)
}
func (q *qemu) saveSandbox() error {

View File

@ -16,7 +16,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
"github.com/kata-containers/runtime/virtcontainers/types"
"github.com/pkg/errors"
)
@ -259,7 +259,7 @@ func TestQemuArchBaseAppendConsoles(t *testing.T) {
assert := assert.New(t)
qemuArchBase := newQemuArchBase()
path := filepath.Join(store.SandboxRuntimeRootPath(sandboxID), consoleSocket)
path := filepath.Join(filepath.Join(fs.RunStoragePath(), sandboxID), consoleSocket)
expectedOut := []govmmQemu.Device{
govmmQemu.SerialDevice{

View File

@ -17,7 +17,7 @@ import (
govmmQemu "github.com/intel/govmm/qemu"
"github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/persist"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
"github.com/kata-containers/runtime/virtcontainers/types"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
@ -92,8 +92,8 @@ func TestQemuCreateSandbox(t *testing.T) {
assert.NoError(err)
// Create parent dir path for hypervisor.json
parentDir := store.SandboxRuntimeRootPath(sandbox.id)
assert.NoError(os.MkdirAll(parentDir, store.DirMode))
parentDir := filepath.Join(fs.RunStoragePath(), sandbox.id)
assert.NoError(os.MkdirAll(parentDir, DirMode))
err = q.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig, false)
assert.NoError(err)
@ -120,7 +120,7 @@ func TestQemuCreateSandboxMissingParentDirFail(t *testing.T) {
assert.NoError(err)
// Ensure parent dir path for hypervisor.json does not exist.
parentDir := store.SandboxRuntimeRootPath(sandbox.id)
parentDir := filepath.Join(fs.RunStoragePath(), sandbox.id)
assert.NoError(os.RemoveAll(parentDir))
err = q.createSandbox(context.Background(), sandbox.id, NetworkNamespace{}, &sandbox.config.HypervisorConfig, false)
@ -280,7 +280,7 @@ func TestQemuGetSandboxConsole(t *testing.T) {
ctx: context.Background(),
}
sandboxID := "testSandboxID"
expected := filepath.Join(store.RunVMStoragePath(), sandboxID, consoleSocket)
expected := filepath.Join(fs.RunVMStoragePath(), sandboxID, consoleSocket)
result, err := q.getSandboxConsole(sandboxID)
assert.NoError(err)

View File

@ -37,7 +37,6 @@ import (
"github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
"github.com/kata-containers/runtime/virtcontainers/pkg/compatoci"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/types"
"github.com/kata-containers/runtime/virtcontainers/utils"
)
@ -46,6 +45,9 @@ const (
// vmStartTimeout represents the time in seconds a sandbox can wait before
// to consider the VM starting operation failed.
vmStartTimeout = 10
// DirMode is the permission bits used for creating a directory
DirMode = os.FileMode(0750) | os.ModeDir
)
// SandboxStatus describes a sandbox status.
@ -188,9 +190,6 @@ type Sandbox struct {
containers map[string]*Container
runPath string
configPath string
state types.SandboxState
networkNS NetworkNamespace
@ -519,8 +518,6 @@ func newSandbox(ctx context.Context, sandboxConfig SandboxConfig, factory Factor
config: &sandboxConfig,
volumes: sandboxConfig.Volumes,
containers: map[string]*Container{},
runPath: store.SandboxRuntimeRootPath(sandboxConfig.ID),
configPath: store.SandboxConfigurationRootPath(sandboxConfig.ID),
state: types.SandboxState{},
annotationsLock: &sync.RWMutex{},
wg: &sync.WaitGroup{},

View File

@ -21,8 +21,8 @@ import (
"github.com/kata-containers/runtime/virtcontainers/device/drivers"
"github.com/kata-containers/runtime/virtcontainers/device/manager"
exp "github.com/kata-containers/runtime/virtcontainers/experimental"
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
"github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/types"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/stretchr/testify/assert"
@ -682,7 +682,7 @@ func TestSandboxAttachDevicesVFIO(t *testing.T) {
testDeviceBDFPath := "0000:00:1c.0"
devicesDir := filepath.Join(tmpDir, testFDIOGroup, "devices")
err = os.MkdirAll(devicesDir, store.DirMode)
err = os.MkdirAll(devicesDir, DirMode)
assert.Nil(t, err)
deviceFile := filepath.Join(devicesDir, testDeviceBDFPath)
@ -990,7 +990,7 @@ func TestDeleteStoreWhenNewContainerFail(t *testing.T) {
}
_, err = newContainer(p, &contConfig)
assert.NotNil(t, err, "New container with invalid device info should fail")
storePath := store.ContainerRuntimeRootPath(testSandboxID, contID)
storePath := filepath.Join(fs.RunStoragePath(), testSandboxID, contID)
_, err = os.Stat(storePath)
assert.NotNil(t, err, "Should delete configuration root after failed to create a container")
}
@ -1160,8 +1160,8 @@ func TestAttachBlockDevice(t *testing.T) {
}
// create state file
path := store.ContainerRuntimeRootPath(testSandboxID, container.ID())
err := os.MkdirAll(path, store.DirMode)
path := filepath.Join(fs.RunStoragePath(), testSandboxID, container.ID())
err := os.MkdirAll(path, DirMode)
assert.NoError(t, err)
defer os.RemoveAll(path)
@ -1238,8 +1238,8 @@ func TestPreAddDevice(t *testing.T) {
container.state.State = types.StateReady
// create state file
path := store.ContainerRuntimeRootPath(testSandboxID, container.ID())
err := os.MkdirAll(path, store.DirMode)
path := filepath.Join(fs.RunStoragePath(), testSandboxID, container.ID())
err := os.MkdirAll(path, DirMode)
assert.NoError(t, err)
defer os.RemoveAll(path)
@ -1336,9 +1336,6 @@ func checkDirNotExist(path string) error {
func checkSandboxRemains() error {
var err error
if err = checkDirNotExist(sandboxDirConfig); err != nil {
return fmt.Errorf("%s still exists", sandboxDirConfig)
}
if err = checkDirNotExist(sandboxDirState); err != nil {
return fmt.Errorf("%s still exists", sandboxDirState)
}

View File

@ -16,7 +16,6 @@ import (
"testing"
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/kata-containers/runtime/virtcontainers/utils"
"github.com/sirupsen/logrus"
)
@ -35,12 +34,7 @@ const testDisabledAsNonRoot = "Test disabled as requires root privileges"
// package variables set in TestMain
var testDir = ""
var sandboxDirConfig = ""
var sandboxFileConfig = ""
var sandboxDirState = ""
var sandboxDirLock = ""
var sandboxFileState = ""
var sandboxFileLock = ""
var testQemuKernelPath = ""
var testQemuInitrdPath = ""
var testQemuImagePath = ""
@ -63,22 +57,16 @@ var savedRunVMStoragePathFunc func() string
// the next test to run.
func cleanUp() {
globalSandboxList.removeSandbox(testSandboxID)
store.DeleteAll()
os.RemoveAll(fs.RunStoragePath())
os.RemoveAll(fs.RunVMStoragePath())
os.RemoveAll(testDir)
store.VCStorePrefix = ""
store.RunVMStoragePath = savedRunVMStoragePathFunc
os.MkdirAll(testDir, DirMode)
setup()
}
func setup() {
store.VCStorePrefix = testDir
savedRunVMStoragePathFunc = store.RunVMStoragePath
store.RunVMStoragePath = func() string {
return filepath.Join("testDir", "vm")
}
os.MkdirAll(store.RunVMStoragePath(), store.DirMode)
os.MkdirAll(filepath.Join(testDir, testBundle), store.DirMode)
os.Mkdir(filepath.Join(testDir, testBundle), DirMode)
for _, filename := range []string{testQemuKernelPath, testQemuInitrdPath, testQemuImagePath, testQemuPath} {
_, err := os.Create(filename)
@ -90,7 +78,7 @@ func setup() {
}
func setupAcrn() {
os.Mkdir(filepath.Join(testDir, testBundle), store.DirMode)
os.Mkdir(filepath.Join(testDir, testBundle), DirMode)
for _, filename := range []string{testAcrnKernelPath, testAcrnImagePath, testAcrnPath, testAcrnCtlPath} {
_, err := os.Create(filename)
@ -102,7 +90,7 @@ func setupAcrn() {
}
func setupClh() {
os.Mkdir(filepath.Join(testDir, testBundle), store.DirMode)
os.Mkdir(filepath.Join(testDir, testBundle), DirMode)
for _, filename := range []string{testClhKernelPath, testClhImagePath, testClhPath, testVirtiofsdPath} {
_, err := os.Create(filename)
@ -135,7 +123,7 @@ func TestMain(m *testing.M) {
}
fmt.Printf("INFO: Creating virtcontainers test directory %s\n", testDir)
err = os.MkdirAll(testDir, store.DirMode)
err = os.MkdirAll(testDir, DirMode)
if err != nil {
fmt.Println("Could not create test directories:", err)
os.Exit(1)
@ -170,25 +158,16 @@ func TestMain(m *testing.M) {
setupClh()
ConfigStoragePathSaved := store.ConfigStoragePath
RunStoragePathSaved := store.RunStoragePath
// allow the tests to run without affecting the host system.
store.ConfigStoragePath = func() string { return filepath.Join(testDir, store.StoragePathSuffix, "config") }
store.RunStoragePath = func() string { return filepath.Join(testDir, store.StoragePathSuffix, "run") }
runPathSave := fs.RunStoragePath()
fs.TestSetRunStoragePath(filepath.Join(testDir, "vc", "run"))
defer func() {
store.ConfigStoragePath = ConfigStoragePathSaved
store.RunStoragePath = RunStoragePathSaved
fs.TestSetRunStoragePath(runPathSave)
}()
// set now that configStoragePath has been overridden.
sandboxDirConfig = filepath.Join(store.ConfigStoragePath(), testSandboxID)
sandboxFileConfig = filepath.Join(store.ConfigStoragePath(), testSandboxID, store.ConfigurationFile)
sandboxDirState = filepath.Join(store.RunStoragePath(), testSandboxID)
sandboxDirLock = filepath.Join(store.RunStoragePath(), testSandboxID)
sandboxFileState = filepath.Join(store.RunStoragePath(), testSandboxID, store.StateFile)
sandboxFileLock = filepath.Join(store.RunStoragePath(), testSandboxID, store.LockFile)
sandboxDirState = filepath.Join(fs.RunStoragePath(), testSandboxID)
testHyperstartCtlSocket = filepath.Join(testDir, "test_hyper.sock")
testHyperstartTtySocket = filepath.Join(testDir, "test_tty.sock")

View File

@ -16,8 +16,8 @@ import (
pb "github.com/kata-containers/runtime/protocols/cache"
"github.com/kata-containers/runtime/virtcontainers/persist"
persistapi "github.com/kata-containers/runtime/virtcontainers/persist/api"
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
"github.com/kata-containers/runtime/virtcontainers/pkg/uuid"
"github.com/kata-containers/runtime/virtcontainers/store"
"github.com/sirupsen/logrus"
)
@ -285,7 +285,7 @@ func NewVMFromGrpc(ctx context.Context, v *pb.GrpcVM, config VMConfig) (*VM, err
}
func buildVMSharePath(id string) string {
return filepath.Join(store.RunVMStoragePath(), id, "shared")
return filepath.Join(fs.RunVMStoragePath(), id, "shared")
}
func (v *VM) logger() logrus.FieldLogger {