virtcontainers: remove getVMPath method from agent

`agent.getVMPath()` is an almost useless method that can be easily replaced
with `filepath.Join()`

Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
Julio Montes 2020-01-30 19:56:58 +00:00
parent 658f77979c
commit 6be74811dc
6 changed files with 3 additions and 28 deletions

View File

@ -224,9 +224,6 @@ type agent interface {
// configureFromGrpc will update agent settings based on provided arguments which from Grpc
configureFromGrpc(h hypervisor, id string, builtin bool, config interface{}) error
// getVMPath will return the agent vm socket's directory path
getVMPath(id string) string
// getSharePath will return the agent 9pfs share mount path
getSharePath(id string) string

View File

@ -24,7 +24,6 @@ import (
"github.com/kata-containers/agent/protocols/grpc"
"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"
"github.com/kata-containers/runtime/virtcontainers/pkg/rootless"
@ -216,10 +215,6 @@ func (k *kataAgent) Logger() *logrus.Entry {
return virtLog.WithField("subsystem", "kata_agent")
}
func (k *kataAgent) getVMPath(id string) string {
return filepath.Join(fs.RunVMStoragePath(), id)
}
func (k *kataAgent) getSharePath(id string) string {
return filepath.Join(kataHostSharedDir(), id)
}

View File

@ -620,11 +620,6 @@ func TestAgentPathAPI(t *testing.T) {
k2 := &kataAgent{}
id := "foobar"
// getVMPath
path1 := k1.getVMPath(id)
path2 := k2.getVMPath(id)
assert.Equal(path1, path2)
// getSharePath
path1 = k1.getSharePath(id)
path2 = k2.getSharePath(id)

View File

@ -185,12 +185,7 @@ func (n *noopAgent) configureFromGrpc(h hypervisor, id string, builtin bool, con
return nil
}
// getVMPath is the Noop agent vm path getter. It does nothing.
func (n *noopAgent) getVMPath(id string) string {
return ""
}
// getVMPath is the Noop agent share path getter. It does nothing.
// getSharePath is the Noop agent share path getter. It does nothing.
func (n *noopAgent) getSharePath(id string) string {
return ""
}

View File

@ -156,13 +156,6 @@ func TestNoopAgentConfigure(t *testing.T) {
assert.NoError(err)
}
func TestNoopAgentGetVMPath(t *testing.T) {
n := &noopAgent{}
path := n.getVMPath("")
assert := assert.New(t)
assert.Empty(path)
}
func TestNoopAgentGetSharePath(t *testing.T) {
n := &noopAgent{}
path := n.getSharePath("")

View File

@ -412,9 +412,9 @@ func (v *VM) assignSandbox(s *Sandbox) error {
// - link 9pfs share path from sandbox dir (/run/kata-containers/shared/sandboxes/sbid/) to vm dir (/run/vc/vm/vmid/shared/)
vmSharePath := buildVMSharePath(v.id)
vmSockDir := v.agent.getVMPath(v.id)
vmSockDir := filepath.Join(v.store.RunVMStoragePath(), v.id)
sbSharePath := s.agent.getSharePath(s.id)
sbSockDir := s.agent.getVMPath(s.id)
sbSockDir := filepath.Join(v.store.RunVMStoragePath(), s.id)
v.logger().WithFields(logrus.Fields{
"vmSharePath": vmSharePath,