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

Commit fae27a6

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 65ffcc6 commit fae27a6

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-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
@@ -334,6 +335,7 @@ func getHypervisorInfo(config oci.RuntimeConfig) HypervisorInfo {
334335
UseVSock: config.HypervisorConfig.UseVSock,
335336
MemorySlots: config.HypervisorConfig.MemSlots,
336337
EntropySource: config.HypervisorConfig.EntropySource,
338+
SharedFS: config.HypervisorConfig.SharedFS,
337339
}
338340
}
339341

cli/kata-env_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const defaultGuestHookPath string = ""
4444

4545
var (
4646
hypervisorDebug = false
47+
enableVirtioFS = false
4748
proxyDebug = false
4849
runtimeDebug = false
4950
runtimeTrace = false
@@ -82,6 +83,11 @@ func createConfig(configPath string, fileData string) error {
8283
}
8384

8485
func makeRuntimeConfigFileData(hypervisor, hypervisorPath, kernelPath, imagePath, kernelParams, machineType, shimPath, proxyPath, netmonPath, logPath string, disableBlock bool, blockDeviceDriver string, enableIOThreads bool, hotplugVFIOOnRootBus, disableNewNetNs bool) string {
86+
sharedFS := "virtio-9p"
87+
if enableVirtioFS {
88+
sharedFS = "virtio-fs"
89+
}
90+
8591
return `
8692
# Runtime configuration file
8793
@@ -101,6 +107,8 @@ func makeRuntimeConfigFileData(hypervisor, hypervisorPath, kernelPath, imagePath
101107
msize_9p = ` + strconv.FormatUint(uint64(defaultMsize9p), 10) + `
102108
enable_debug = ` + strconv.FormatBool(hypervisorDebug) + `
103109
guest_hook_path = "` + defaultGuestHookPath + `"
110+
shared_fs = "` + sharedFS + `"
111+
virtio_fs_daemon = "/path/to/virtiofsd"
104112
105113
[proxy.kata]
106114
enable_debug = ` + strconv.FormatBool(proxyDebug) + `
@@ -338,6 +346,7 @@ func getExpectedHypervisor(config oci.RuntimeConfig) HypervisorInfo {
338346
MemorySlots: config.HypervisorConfig.MemSlots,
339347
Debug: config.HypervisorConfig.Debug,
340348
EntropySource: config.HypervisorConfig.EntropySource,
349+
SharedFS: config.HypervisorConfig.SharedFS,
341350
}
342351
}
343352

@@ -515,6 +524,7 @@ func TestEnvGetEnvInfo(t *testing.T) {
515524
// options are tested.
516525
for _, toggle := range []bool{false, true} {
517526
hypervisorDebug = toggle
527+
enableVirtioFS = toggle
518528
proxyDebug = toggle
519529
runtimeDebug = toggle
520530
runtimeTrace = toggle

0 commit comments

Comments
 (0)