mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-23 01:04:25 +01:00
virtiofsd: refactor qemu.go to use code in virtiofsd.go
CloudHypervisor is using virtiofsd.go to manage virtiofsd process, but qemu has its code in qemu.go. This commit let qemu to re-use code in virtiofsd.go to reduce code and improve maintenanceability. Fixes: #1933 Signed-off-by: bin <bin@hyper.sh>
This commit is contained in:
@@ -11,7 +11,6 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
govmmQemu "github.com/kata-containers/govmm/qemu"
|
||||
@@ -550,35 +549,6 @@ func createQemuSandboxConfig() (*Sandbox, error) {
|
||||
return &sandbox, nil
|
||||
}
|
||||
|
||||
func TestQemuVirtiofsdArgs(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
q := &qemu{
|
||||
id: "foo",
|
||||
config: HypervisorConfig{
|
||||
VirtioFSCache: "none",
|
||||
Debug: true,
|
||||
},
|
||||
}
|
||||
|
||||
savedKataHostSharedDir := kataHostSharedDir
|
||||
kataHostSharedDir = func() string {
|
||||
return "test-share-dir"
|
||||
}
|
||||
defer func() {
|
||||
kataHostSharedDir = savedKataHostSharedDir
|
||||
}()
|
||||
|
||||
result := "--fd=123 -o source=test-share-dir/foo/shared -o cache=none --syslog -o no_posix_lock -d"
|
||||
args := q.virtiofsdArgs(123)
|
||||
assert.Equal(strings.Join(args, " "), result)
|
||||
|
||||
q.config.Debug = false
|
||||
result = "--fd=123 -o source=test-share-dir/foo/shared -o cache=none --syslog -o no_posix_lock -f"
|
||||
args = q.virtiofsdArgs(123)
|
||||
assert.Equal(strings.Join(args, " "), result)
|
||||
}
|
||||
|
||||
func TestQemuGetpids(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user