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

Commit 5555e70

Browse files
committed
kata-env: add SharedFS option to output
It's useful to know whether virtio-9p or virtio-fs is being used. Add the status to the kata-env output. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
1 parent f2234d2 commit 5555e70

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

cli/kata-env.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ type HypervisorInfo struct {
9292
MemorySlots uint32
9393
Debug bool
9494
UseVSock bool
95+
SharedFS string
9596
}
9697

9798
// ProxyInfo stores proxy details
@@ -352,6 +353,7 @@ func getHypervisorInfo(config oci.RuntimeConfig) HypervisorInfo {
352353
UseVSock: config.HypervisorConfig.UseVSock,
353354
MemorySlots: config.HypervisorConfig.MemSlots,
354355
EntropySource: config.HypervisorConfig.EntropySource,
356+
SharedFS: config.HypervisorConfig.SharedFS,
355357
}
356358
}
357359

cli/kata-env_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const testHypervisorVersion = "QEMU emulator version 2.7.0+git.741f430a96-6.1, C
3737

3838
var (
3939
hypervisorDebug = false
40+
enableVirtioFS = false
4041
proxyDebug = false
4142
runtimeDebug = false
4243
runtimeTrace = false
@@ -91,6 +92,7 @@ func makeRuntimeConfig(prefixDir string) (configFile string, config oci.RuntimeC
9192
enableIOThreads := true
9293
hotplugVFIOOnRootBus := true
9394
disableNewNetNs := false
95+
sharedFS := "virtio-9p"
9496

9597
filesToCreate := []string{
9698
hypervisorPath,
@@ -126,6 +128,10 @@ func makeRuntimeConfig(prefixDir string) (configFile string, config oci.RuntimeC
126128
return "", oci.RuntimeConfig{}, err
127129
}
128130

131+
if enableVirtioFS {
132+
sharedFS = "virtio-fs"
133+
}
134+
129135
hypConfig := katautils.GetDefaultHypervisorConfig()
130136

131137
configFileOptions := katatestutils.RuntimeConfigOptions{
@@ -157,6 +163,7 @@ func makeRuntimeConfig(prefixDir string) (configFile string, config oci.RuntimeC
157163
NetmonDebug: netmonDebug,
158164
AgentDebug: agentDebug,
159165
AgentTrace: agentTrace,
166+
SharedFS: sharedFS,
160167
}
161168

162169
runtimeConfig := katatestutils.MakeRuntimeConfigFileData(configFileOptions)
@@ -321,6 +328,7 @@ func getExpectedHypervisor(config oci.RuntimeConfig) HypervisorInfo {
321328
MemorySlots: config.HypervisorConfig.MemSlots,
322329
Debug: config.HypervisorConfig.Debug,
323330
EntropySource: config.HypervisorConfig.EntropySource,
331+
SharedFS: config.HypervisorConfig.SharedFS,
324332
}
325333
}
326334

@@ -498,6 +506,7 @@ func TestEnvGetEnvInfo(t *testing.T) {
498506
// options are tested.
499507
for _, toggle := range []bool{false, true} {
500508
hypervisorDebug = toggle
509+
enableVirtioFS = toggle
501510
proxyDebug = toggle
502511
runtimeDebug = toggle
503512
runtimeTrace = toggle

pkg/katatestutils/utils.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type RuntimeConfigOptions struct {
2727
BlockDeviceDriver string
2828
AgentTraceMode string
2929
AgentTraceType string
30+
SharedFS string
3031
DisableBlock bool
3132
EnableIOThreads bool
3233
HotplugVFIOOnRootBus bool
@@ -61,6 +62,8 @@ func MakeRuntimeConfigFileData(config RuntimeConfigOptions) string {
6162
msize_9p = ` + strconv.FormatUint(uint64(config.DefaultMsize9p), 10) + `
6263
enable_debug = ` + strconv.FormatBool(config.HypervisorDebug) + `
6364
guest_hook_path = "` + config.DefaultGuestHookPath + `"
65+
shared_fs = "` + config.SharedFS + `"
66+
virtio_fs_daemon = "/path/to/virtiofsd"
6467
6568
[proxy.kata]
6669
enable_debug = ` + strconv.FormatBool(config.ProxyDebug) + `

pkg/katautils/config_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
8383
enableIOThreads := true
8484
hotplugVFIOOnRootBus := true
8585
disableNewNetNs := false
86+
sharedFS := "virtio-9p"
8687

8788
configFileOptions := katatestutils.RuntimeConfigOptions{
8889
Hypervisor: "qemu",
@@ -113,6 +114,7 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
113114
NetmonDebug: netmonDebug,
114115
AgentDebug: agentDebug,
115116
AgentTrace: agentTrace,
117+
SharedFS: sharedFS,
116118
}
117119

118120
runtimeConfigFileData := katatestutils.MakeRuntimeConfigFileData(configFileOptions)
@@ -160,6 +162,8 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
160162
MemSlots: defaultMemSlots,
161163
EntropySource: defaultEntropySource,
162164
GuestHookPath: defaultGuestHookPath,
165+
SharedFS: sharedFS,
166+
VirtioFSDaemon: "/path/to/virtiofsd",
163167
}
164168

165169
agentConfig := vc.KataAgentConfig{}

0 commit comments

Comments
 (0)