mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-10 05:44:04 +00:00
cli: 9p: Add toml configuration for 9p msize
Allows msize for 9p to be configured in the toml file. Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
This commit is contained in:
parent
3187a98188
commit
cc61ccf9e9
4
Makefile
4
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)
|
||||
|
@ -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)
|
||||
|
@ -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@"
|
||||
|
||||
|
@ -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{}
|
||||
|
Loading…
Reference in New Issue
Block a user