mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-02 00:02:01 +00:00
Merge pull request #207 from amshinde/msize-9p
Add configuration for 9p msize
This commit is contained in:
commit
ea789dbab9
4
Makefile
4
Makefile
@ -107,6 +107,7 @@ DEFENABLEHUGEPAGES := false
|
|||||||
DEFENABLESWAP := false
|
DEFENABLESWAP := false
|
||||||
DEFENABLEDEBUG := false
|
DEFENABLEDEBUG := false
|
||||||
DEFDISABLENESTINGCHECKS := false
|
DEFDISABLENESTINGCHECKS := false
|
||||||
|
DEFMSIZE9P := 8192
|
||||||
|
|
||||||
SED = sed
|
SED = sed
|
||||||
|
|
||||||
@ -179,6 +180,7 @@ USER_VARS += DEFENABLEHUGEPAGES
|
|||||||
USER_VARS += DEFENABLESWAP
|
USER_VARS += DEFENABLESWAP
|
||||||
USER_VARS += DEFENABLEDEBUG
|
USER_VARS += DEFENABLEDEBUG
|
||||||
USER_VARS += DEFDISABLENESTINGCHECKS
|
USER_VARS += DEFDISABLENESTINGCHECKS
|
||||||
|
USER_VARS += DEFMSIZE9P
|
||||||
|
|
||||||
V = @
|
V = @
|
||||||
Q = $(V:1=)
|
Q = $(V:1=)
|
||||||
@ -271,6 +273,7 @@ const defaultEnableHugePages bool = $(DEFENABLEHUGEPAGES)
|
|||||||
const defaultEnableSwap bool = $(DEFENABLESWAP)
|
const defaultEnableSwap bool = $(DEFENABLESWAP)
|
||||||
const defaultEnableDebug bool = $(DEFENABLEDEBUG)
|
const defaultEnableDebug bool = $(DEFENABLEDEBUG)
|
||||||
const defaultDisableNestingChecks bool = $(DEFDISABLENESTINGCHECKS)
|
const defaultDisableNestingChecks bool = $(DEFDISABLENESTINGCHECKS)
|
||||||
|
const defaultMsize9p uint32 = $(DEFMSIZE9P)
|
||||||
|
|
||||||
// Default config file used by stateless systems.
|
// Default config file used by stateless systems.
|
||||||
var defaultRuntimeConfiguration = "$(DESTCONFIG)"
|
var defaultRuntimeConfiguration = "$(DESTCONFIG)"
|
||||||
@ -355,6 +358,7 @@ $(GENERATED_FILES): %: %.in Makefile VERSION
|
|||||||
-e "s|@DEFENABLEMSWAP@|$(DEFENABLESWAP)|g" \
|
-e "s|@DEFENABLEMSWAP@|$(DEFENABLESWAP)|g" \
|
||||||
-e "s|@DEFENABLEDEBUG@|$(DEFENABLEDEBUG)|g" \
|
-e "s|@DEFENABLEDEBUG@|$(DEFENABLEDEBUG)|g" \
|
||||||
-e "s|@DEFDISABLENESTINGCHECKS@|$(DEFDISABLENESTINGCHECKS)|g" \
|
-e "s|@DEFDISABLENESTINGCHECKS@|$(DEFDISABLENESTINGCHECKS)|g" \
|
||||||
|
-e "s|@DEFMSIZE9P@|$(DEFMSIZE9P)|g" \
|
||||||
$< > $@
|
$< > $@
|
||||||
|
|
||||||
generate-config: $(CONFIG)
|
generate-config: $(CONFIG)
|
||||||
|
@ -76,8 +76,9 @@ type hypervisor struct {
|
|||||||
DefaultVCPUs int32 `toml:"default_vcpus"`
|
DefaultVCPUs int32 `toml:"default_vcpus"`
|
||||||
DefaultMemSz uint32 `toml:"default_memory"`
|
DefaultMemSz uint32 `toml:"default_memory"`
|
||||||
DefaultBridges uint32 `toml:"default_bridges"`
|
DefaultBridges uint32 `toml:"default_bridges"`
|
||||||
DisableBlockDeviceUse bool `toml:"disable_block_device_use"`
|
Msize9p uint32 `toml:"msize_9p"`
|
||||||
BlockDeviceDriver string `toml:"block_device_driver"`
|
BlockDeviceDriver string `toml:"block_device_driver"`
|
||||||
|
DisableBlockDeviceUse bool `toml:"disable_block_device_use"`
|
||||||
MemPrealloc bool `toml:"enable_mem_prealloc"`
|
MemPrealloc bool `toml:"enable_mem_prealloc"`
|
||||||
HugePages bool `toml:"enable_hugepages"`
|
HugePages bool `toml:"enable_hugepages"`
|
||||||
Swap bool `toml:"enable_swap"`
|
Swap bool `toml:"enable_swap"`
|
||||||
@ -233,6 +234,14 @@ func (h hypervisor) blockDeviceDriver() (string, error) {
|
|||||||
return h.BlockDeviceDriver, nil
|
return h.BlockDeviceDriver, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h hypervisor) msize9p() uint32 {
|
||||||
|
if h.Msize9p == 0 {
|
||||||
|
return defaultMsize9p
|
||||||
|
}
|
||||||
|
|
||||||
|
return h.Msize9p
|
||||||
|
}
|
||||||
|
|
||||||
func (p proxy) path() string {
|
func (p proxy) path() string {
|
||||||
if p.Path == "" {
|
if p.Path == "" {
|
||||||
return defaultProxyPath
|
return defaultProxyPath
|
||||||
@ -314,6 +323,7 @@ func newQemuHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
|||||||
DisableNestingChecks: h.DisableNestingChecks,
|
DisableNestingChecks: h.DisableNestingChecks,
|
||||||
BlockDeviceDriver: blockDriver,
|
BlockDeviceDriver: blockDriver,
|
||||||
EnableIOThreads: h.EnableIOThreads,
|
EnableIOThreads: h.EnableIOThreads,
|
||||||
|
Msize9p: h.msize9p(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -417,6 +427,7 @@ func loadConfiguration(configPath string, ignoreLogging bool) (resolvedConfigPat
|
|||||||
DisableNestingChecks: defaultDisableNestingChecks,
|
DisableNestingChecks: defaultDisableNestingChecks,
|
||||||
BlockDeviceDriver: defaultBlockDeviceDriver,
|
BlockDeviceDriver: defaultBlockDeviceDriver,
|
||||||
EnableIOThreads: defaultEnableIOThreads,
|
EnableIOThreads: defaultEnableIOThreads,
|
||||||
|
Msize9p: defaultMsize9p,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = config.InterNetworkModel.SetModel(defaultInterNetworkingModel)
|
err = config.InterNetworkModel.SetModel(defaultInterNetworkingModel)
|
||||||
|
@ -110,6 +110,10 @@ enable_iothreads = @DEFENABLEIOTHREADS@
|
|||||||
#
|
#
|
||||||
#disable_nesting_checks = true
|
#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@]
|
[proxy.@PROJECT_TYPE@]
|
||||||
path = "@PROXYPATH@"
|
path = "@PROXYPATH@"
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ func makeRuntimeConfigFileData(hypervisor, hypervisorPath, kernelPath, imagePath
|
|||||||
default_memory = ` + strconv.FormatUint(uint64(defaultMemSize), 10) + `
|
default_memory = ` + strconv.FormatUint(uint64(defaultMemSize), 10) + `
|
||||||
disable_block_device_use = ` + strconv.FormatBool(disableBlock) + `
|
disable_block_device_use = ` + strconv.FormatBool(disableBlock) + `
|
||||||
enable_iothreads = ` + strconv.FormatBool(enableIOThreads) + `
|
enable_iothreads = ` + strconv.FormatBool(enableIOThreads) + `
|
||||||
|
msize_9p = ` + strconv.FormatUint(uint64(defaultMsize9p), 10) + `
|
||||||
|
|
||||||
[proxy.kata]
|
[proxy.kata]
|
||||||
path = "` + proxyPath + `"
|
path = "` + proxyPath + `"
|
||||||
@ -134,6 +135,7 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
|
|||||||
DefaultBridges: defaultBridgesCount,
|
DefaultBridges: defaultBridgesCount,
|
||||||
Mlock: !defaultEnableSwap,
|
Mlock: !defaultEnableSwap,
|
||||||
EnableIOThreads: enableIOThreads,
|
EnableIOThreads: enableIOThreads,
|
||||||
|
Msize9p: defaultMsize9p,
|
||||||
}
|
}
|
||||||
|
|
||||||
agentConfig := vc.KataAgentConfig{}
|
agentConfig := vc.KataAgentConfig{}
|
||||||
@ -516,6 +518,7 @@ func TestMinimalRuntimeConfig(t *testing.T) {
|
|||||||
DefaultBridges: defaultBridgesCount,
|
DefaultBridges: defaultBridgesCount,
|
||||||
Mlock: !defaultEnableSwap,
|
Mlock: !defaultEnableSwap,
|
||||||
BlockDeviceDriver: defaultBlockDeviceDriver,
|
BlockDeviceDriver: defaultBlockDeviceDriver,
|
||||||
|
Msize9p: defaultMsize9p,
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedAgentConfig := vc.KataAgentConfig{}
|
expectedAgentConfig := vc.KataAgentConfig{}
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
//
|
//
|
||||||
// XXX: Increment for every change to the output format
|
// XXX: Increment for every change to the output format
|
||||||
// (meaning any change to the EnvInfo type).
|
// (meaning any change to the EnvInfo type).
|
||||||
const formatVersion = "1.0.10"
|
const formatVersion = "1.0.11"
|
||||||
|
|
||||||
// MetaInfo stores information on the format of the output itself
|
// MetaInfo stores information on the format of the output itself
|
||||||
type MetaInfo struct {
|
type MetaInfo struct {
|
||||||
@ -75,8 +75,9 @@ type HypervisorInfo struct {
|
|||||||
MachineType string
|
MachineType string
|
||||||
Version string
|
Version string
|
||||||
Path string
|
Path string
|
||||||
Debug bool
|
|
||||||
BlockDeviceDriver string
|
BlockDeviceDriver string
|
||||||
|
Msize9p uint32
|
||||||
|
Debug bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProxyInfo stores proxy details
|
// ProxyInfo stores proxy details
|
||||||
@ -271,6 +272,7 @@ func getHypervisorInfo(config oci.RuntimeConfig) HypervisorInfo {
|
|||||||
Version: version,
|
Version: version,
|
||||||
Path: hypervisorPath,
|
Path: hypervisorPath,
|
||||||
BlockDeviceDriver: config.HypervisorConfig.BlockDeviceDriver,
|
BlockDeviceDriver: config.HypervisorConfig.BlockDeviceDriver,
|
||||||
|
Msize9p: config.HypervisorConfig.Msize9p,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,6 +232,7 @@ func getExpectedHypervisor(config oci.RuntimeConfig) HypervisorInfo {
|
|||||||
Path: config.HypervisorConfig.HypervisorPath,
|
Path: config.HypervisorConfig.HypervisorPath,
|
||||||
MachineType: config.HypervisorConfig.HypervisorMachineType,
|
MachineType: config.HypervisorConfig.HypervisorMachineType,
|
||||||
BlockDeviceDriver: config.HypervisorConfig.BlockDeviceDriver,
|
BlockDeviceDriver: config.HypervisorConfig.BlockDeviceDriver,
|
||||||
|
Msize9p: config.HypervisorConfig.Msize9p,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -902,6 +902,7 @@ func TestStatusSandboxSuccessfulStateReady(t *testing.T) {
|
|||||||
DefaultBridges: defaultBridges,
|
DefaultBridges: defaultBridges,
|
||||||
BlockDeviceDriver: defaultBlockDriver,
|
BlockDeviceDriver: defaultBlockDriver,
|
||||||
DefaultMaxVCPUs: defaultMaxQemuVCPUs,
|
DefaultMaxVCPUs: defaultMaxQemuVCPUs,
|
||||||
|
Msize9p: defaultMsize9p,
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedStatus := SandboxStatus{
|
expectedStatus := SandboxStatus{
|
||||||
@ -958,6 +959,7 @@ func TestStatusSandboxSuccessfulStateRunning(t *testing.T) {
|
|||||||
DefaultBridges: defaultBridges,
|
DefaultBridges: defaultBridges,
|
||||||
BlockDeviceDriver: defaultBlockDriver,
|
BlockDeviceDriver: defaultBlockDriver,
|
||||||
DefaultMaxVCPUs: defaultMaxQemuVCPUs,
|
DefaultMaxVCPUs: defaultMaxQemuVCPUs,
|
||||||
|
Msize9p: defaultMsize9p,
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedStatus := SandboxStatus{
|
expectedStatus := SandboxStatus{
|
||||||
|
@ -215,6 +215,9 @@ type HypervisorConfig struct {
|
|||||||
// DisableNestingChecks is used to override customizations performed
|
// DisableNestingChecks is used to override customizations performed
|
||||||
// when running on top of another VMM.
|
// when running on top of another VMM.
|
||||||
DisableNestingChecks bool
|
DisableNestingChecks bool
|
||||||
|
|
||||||
|
// Msize9p is used as the msize for 9p shares
|
||||||
|
Msize9p uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (conf *HypervisorConfig) valid() (bool, error) {
|
func (conf *HypervisorConfig) valid() (bool, error) {
|
||||||
@ -246,6 +249,10 @@ func (conf *HypervisorConfig) valid() (bool, error) {
|
|||||||
conf.DefaultMaxVCPUs = defaultMaxQemuVCPUs
|
conf.DefaultMaxVCPUs = defaultMaxQemuVCPUs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if conf.Msize9p == 0 {
|
||||||
|
conf.Msize9p = defaultMsize9p
|
||||||
|
}
|
||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,9 @@ func TestHypervisorConfigDefaults(t *testing.T) {
|
|||||||
DefaultBridges: defaultBridges,
|
DefaultBridges: defaultBridges,
|
||||||
BlockDeviceDriver: defaultBlockDriver,
|
BlockDeviceDriver: defaultBlockDriver,
|
||||||
DefaultMaxVCPUs: defaultMaxQemuVCPUs,
|
DefaultMaxVCPUs: defaultMaxQemuVCPUs,
|
||||||
|
Msize9p: defaultMsize9p,
|
||||||
}
|
}
|
||||||
|
|
||||||
if reflect.DeepEqual(hypervisorConfig, hypervisorConfigDefaultsExpected) == false {
|
if reflect.DeepEqual(hypervisorConfig, hypervisorConfigDefaultsExpected) == false {
|
||||||
t.Fatal()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
|
@ -474,6 +474,8 @@ func (k *kataAgent) startSandbox(sandbox Sandbox) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sharedDir9pOptions = append(sharedDir9pOptions, fmt.Sprintf("msize=%d", sandbox.config.HypervisorConfig.Msize9p))
|
||||||
|
|
||||||
// We mount the shared directory in a predefined location
|
// We mount the shared directory in a predefined location
|
||||||
// in the guest.
|
// in the guest.
|
||||||
// This is where at least some of the host config files
|
// This is where at least some of the host config files
|
||||||
|
@ -97,6 +97,7 @@ const (
|
|||||||
defaultCPUModel = "host"
|
defaultCPUModel = "host"
|
||||||
defaultBridgeBus = "pcie.0"
|
defaultBridgeBus = "pcie.0"
|
||||||
maxDevIDSize = 31
|
maxDevIDSize = 31
|
||||||
|
defaultMsize9p = 8192
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -28,6 +28,7 @@ func newQemuConfig() HypervisorConfig {
|
|||||||
DefaultBridges: defaultBridges,
|
DefaultBridges: defaultBridges,
|
||||||
BlockDeviceDriver: defaultBlockDriver,
|
BlockDeviceDriver: defaultBlockDriver,
|
||||||
DefaultMaxVCPUs: defaultMaxQemuVCPUs,
|
DefaultMaxVCPUs: defaultMaxQemuVCPUs,
|
||||||
|
Msize9p: defaultMsize9p,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user