diff --git a/Makefile b/Makefile index 2f190c4a30..7e14884137 100644 --- a/Makefile +++ b/Makefile @@ -107,6 +107,7 @@ DEFENABLEHUGEPAGES := false DEFENABLESWAP := false DEFENABLEDEBUG := false DEFDISABLENESTINGCHECKS := false +DEFMSIZE9P := 8192 SED = sed @@ -179,6 +180,7 @@ USER_VARS += DEFENABLEHUGEPAGES USER_VARS += DEFENABLESWAP USER_VARS += DEFENABLEDEBUG USER_VARS += DEFDISABLENESTINGCHECKS +USER_VARS += DEFMSIZE9P V = @ Q = $(V:1=) @@ -271,6 +273,7 @@ const defaultEnableHugePages bool = $(DEFENABLEHUGEPAGES) const defaultEnableSwap bool = $(DEFENABLESWAP) const defaultEnableDebug bool = $(DEFENABLEDEBUG) const defaultDisableNestingChecks bool = $(DEFDISABLENESTINGCHECKS) +const defaultMsize9p uint32 = $(DEFMSIZE9P) // Default config file used by stateless systems. var defaultRuntimeConfiguration = "$(DESTCONFIG)" @@ -355,6 +358,7 @@ $(GENERATED_FILES): %: %.in Makefile VERSION -e "s|@DEFENABLEMSWAP@|$(DEFENABLESWAP)|g" \ -e "s|@DEFENABLEDEBUG@|$(DEFENABLEDEBUG)|g" \ -e "s|@DEFDISABLENESTINGCHECKS@|$(DEFDISABLENESTINGCHECKS)|g" \ + -e "s|@DEFMSIZE9P@|$(DEFMSIZE9P)|g" \ $< > $@ generate-config: $(CONFIG) diff --git a/cli/config.go b/cli/config.go index 98629e152e..586bc6687b 100644 --- a/cli/config.go +++ b/cli/config.go @@ -93,6 +93,7 @@ type hypervisor struct { Debug bool `toml:"enable_debug"` DisableNestingChecks bool `toml:"disable_nesting_checks"` EnableIOThreads bool `toml:"enable_iothreads"` + Msize9p uint32 `toml:"msize_9p"` } type proxy struct { @@ -242,6 +243,14 @@ func (h hypervisor) blockDeviceDriver() (string, error) { return h.BlockDeviceDriver, nil } +func (h hypervisor) msize9p() uint32 { + if h.Msize9p == 0 { + return defaultMsize9p + } + + return h.Msize9p +} + func (p proxy) path() string { if p.Path == "" { return defaultProxyPath @@ -323,6 +332,7 @@ func newQemuHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) { DisableNestingChecks: h.DisableNestingChecks, BlockDeviceDriver: blockDriver, EnableIOThreads: h.EnableIOThreads, + Msize9p: h.msize9p(), }, nil } @@ -426,6 +436,7 @@ func loadConfiguration(configPath string, ignoreLogging bool) (resolvedConfigPat DisableNestingChecks: defaultDisableNestingChecks, BlockDeviceDriver: defaultBlockDeviceDriver, EnableIOThreads: defaultEnableIOThreads, + Msize9p: defaultMsize9p, } err = config.InterNetworkModel.SetModel(defaultInterNetworkingModel) diff --git a/cli/config/configuration.toml.in b/cli/config/configuration.toml.in index b8ea01d8b2..7753093219 100644 --- a/cli/config/configuration.toml.in +++ b/cli/config/configuration.toml.in @@ -110,6 +110,10 @@ enable_iothreads = @DEFENABLEIOTHREADS@ # #disable_nesting_checks = true +# This is the msize used for 9p shares. It is the number of bytes +# used for 9p packet payload. +#msize_9p = @DEFMSIZE9P@ + [proxy.@PROJECT_TYPE@] path = "@PROXYPATH@" diff --git a/cli/config_test.go b/cli/config_test.go index 6b3f7c5818..9dd81cfb98 100644 --- a/cli/config_test.go +++ b/cli/config_test.go @@ -56,6 +56,7 @@ func makeRuntimeConfigFileData(hypervisor, hypervisorPath, kernelPath, imagePath default_memory = ` + strconv.FormatUint(uint64(defaultMemSize), 10) + ` disable_block_device_use = ` + strconv.FormatBool(disableBlock) + ` enable_iothreads = ` + strconv.FormatBool(enableIOThreads) + ` + msize_9p = ` + strconv.FormatUint(uint64(defaultMsize9p), 10) + ` [proxy.kata] path = "` + proxyPath + `" @@ -143,6 +144,7 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf DefaultBridges: defaultBridgesCount, Mlock: !defaultEnableSwap, EnableIOThreads: enableIOThreads, + Msize9p: defaultMsize9p, } agentConfig := vc.KataAgentConfig{} @@ -525,6 +527,7 @@ func TestMinimalRuntimeConfig(t *testing.T) { DefaultBridges: defaultBridgesCount, Mlock: !defaultEnableSwap, BlockDeviceDriver: defaultBlockDeviceDriver, + Msize9p: defaultMsize9p, } expectedAgentConfig := vc.KataAgentConfig{}