mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 12:14:48 +00:00
runtime: Export StoragePathSuffix
storagePathSuffix defines the file path suffix - "vc" - used for Kata's persistent storage information, as a private constant. We duplicate this information in fc.go which also needs it. Export it from fs.go instead, so it can be used in fc.go. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
1719a8b491
commit
963d03ea8a
@ -27,6 +27,7 @@ import (
|
||||
hv "github.com/kata-containers/kata-containers/src/runtime/pkg/hypervisors"
|
||||
"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/persist/fs"
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/firecracker/client"
|
||||
models "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/firecracker/client/models"
|
||||
ops "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/firecracker/client/operations"
|
||||
@ -84,8 +85,6 @@ const (
|
||||
fcMetricsFifo = "metrics.fifo"
|
||||
|
||||
defaultFcConfig = "fcConfig.json"
|
||||
// storagePathSuffix mirrors persist/fs/fs.go:storagePathSuffix
|
||||
storagePathSuffix = "vc"
|
||||
)
|
||||
|
||||
// Specify the minimum version of firecracker supported
|
||||
@ -244,7 +243,7 @@ func (fc *firecracker) setPaths(hypervisorConfig *HypervisorConfig) {
|
||||
// <cgroups_base>/<exec_file_name>/<id>/
|
||||
hypervisorName := filepath.Base(hypervisorConfig.HypervisorPath)
|
||||
//fs.RunStoragePath cannot be used as we need exec perms
|
||||
fc.chrootBaseDir = filepath.Join("/run", storagePathSuffix)
|
||||
fc.chrootBaseDir = filepath.Join("/run", fs.StoragePathSuffix)
|
||||
|
||||
fc.vmPath = filepath.Join(fc.chrootBaseDir, hypervisorName, fc.id)
|
||||
fc.jailerRoot = filepath.Join(fc.vmPath, "root") // auto created by jailer
|
||||
|
@ -29,11 +29,11 @@ const dirMode = os.FileMode(0700) | os.ModeDir
|
||||
// fileMode is the permission bits used for creating a file
|
||||
const fileMode = os.FileMode(0600)
|
||||
|
||||
// storagePathSuffix is the suffix used for all storage paths
|
||||
// StoragePathSuffix is the suffix used for all storage paths
|
||||
//
|
||||
// Note: this very brief path represents "virtcontainers". It is as
|
||||
// terse as possible to minimise path length.
|
||||
const storagePathSuffix = "vc"
|
||||
const StoragePathSuffix = "vc"
|
||||
|
||||
// sandboxPathSuffix is the suffix used for sandbox storage
|
||||
const sandboxPathSuffix = "sbs"
|
||||
@ -64,7 +64,7 @@ func Init() (persistapi.PersistDriver, error) {
|
||||
return &FS{
|
||||
sandboxState: &persistapi.SandboxState{},
|
||||
containerState: make(map[string]persistapi.ContainerState),
|
||||
storageRootPath: filepath.Join("/run", storagePathSuffix),
|
||||
storageRootPath: filepath.Join("/run", StoragePathSuffix),
|
||||
driverName: "fs",
|
||||
}, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user