mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 08:17:37 +00:00
virtcontainers/store: make VCStoreUUIDPath rootless
The uuid file shouldn't be created at `/var` if running rootless. Modify `VMUUIDStoragePath` to get a path accessible for non-root users if running rootless. fixes #2133 Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
c7b4c5eab9
commit
abec17f8f2
@ -105,7 +105,14 @@ var RunVMStoragePath = func() string {
|
|||||||
|
|
||||||
// VMUUIDStoragePath is the uuid directory.
|
// VMUUIDStoragePath is the uuid directory.
|
||||||
// It will contain all uuid info used by guest vm.
|
// It will contain all uuid info used by guest vm.
|
||||||
var VMUUIDStoragePath = filepath.Join("/var/lib", StoragePathSuffix, UUIDPathSuffix)
|
var VMUUIDStoragePath = func() string {
|
||||||
|
path := filepath.Join("/var/lib", StoragePathSuffix, UUIDPathSuffix)
|
||||||
|
if rootless.IsRootless() {
|
||||||
|
return filepath.Join(rootless.GetRootlessDir(), path)
|
||||||
|
}
|
||||||
|
return path
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func itemToFile(item Item) (string, error) {
|
func itemToFile(item Item) (string, error) {
|
||||||
switch item {
|
switch item {
|
||||||
|
@ -271,7 +271,7 @@ func SandboxConfigurationItemPath(id string, item Item) (string, error) {
|
|||||||
|
|
||||||
// VCStoreUUIDPath returns a virtcontainers runtime uuid URL.
|
// VCStoreUUIDPath returns a virtcontainers runtime uuid URL.
|
||||||
func VCStoreUUIDPath() string {
|
func VCStoreUUIDPath() string {
|
||||||
return filesystemScheme + "://" + filepath.Join(VCStorePrefix, VMUUIDStoragePath)
|
return filesystemScheme + "://" + filepath.Join(VCStorePrefix, VMUUIDStoragePath())
|
||||||
}
|
}
|
||||||
|
|
||||||
// SandboxRuntimeRoot returns a virtcontainers sandbox runtime root URL.
|
// SandboxRuntimeRoot returns a virtcontainers sandbox runtime root URL.
|
||||||
|
Loading…
Reference in New Issue
Block a user