Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
virtcontainers: remove getVMPath method from agent
Browse files Browse the repository at this point in the history
`agent.getVMPath()` is an almost useless method that can be easily replaced
with `filepath.Join()`

Signed-off-by: Julio Montes <[email protected]>
  • Loading branch information
Julio Montes committed Feb 12, 2020
1 parent 658f779 commit 6be7481
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 28 deletions.
3 changes: 0 additions & 3 deletions virtcontainers/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 0 additions & 5 deletions virtcontainers/kata_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
Expand Down
5 changes: 0 additions & 5 deletions virtcontainers/kata_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 1 addition & 6 deletions virtcontainers/noop_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
}
Expand Down
7 changes: 0 additions & 7 deletions virtcontainers/noop_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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("")
Expand Down
4 changes: 2 additions & 2 deletions virtcontainers/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 6be7481

Please sign in to comment.