Merge pull request #207 from amshinde/msize-9p

Add configuration for 9p msize
This commit is contained in:
Sebastien Boeuf 2018-04-18 11:20:44 -07:00 committed by GitHub
commit ea789dbab9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 43 additions and 3 deletions

View File

@ -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)

View File

@ -76,8 +76,9 @@ type hypervisor struct {
DefaultVCPUs int32 `toml:"default_vcpus"`
DefaultMemSz uint32 `toml:"default_memory"`
DefaultBridges uint32 `toml:"default_bridges"`
DisableBlockDeviceUse bool `toml:"disable_block_device_use"`
Msize9p uint32 `toml:"msize_9p"`
BlockDeviceDriver string `toml:"block_device_driver"`
DisableBlockDeviceUse bool `toml:"disable_block_device_use"`
MemPrealloc bool `toml:"enable_mem_prealloc"`
HugePages bool `toml:"enable_hugepages"`
Swap bool `toml:"enable_swap"`
@ -233,6 +234,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
@ -314,6 +323,7 @@ func newQemuHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
DisableNestingChecks: h.DisableNestingChecks,
BlockDeviceDriver: blockDriver,
EnableIOThreads: h.EnableIOThreads,
Msize9p: h.msize9p(),
}, nil
}
@ -417,6 +427,7 @@ func loadConfiguration(configPath string, ignoreLogging bool) (resolvedConfigPat
DisableNestingChecks: defaultDisableNestingChecks,
BlockDeviceDriver: defaultBlockDeviceDriver,
EnableIOThreads: defaultEnableIOThreads,
Msize9p: defaultMsize9p,
}
err = config.InterNetworkModel.SetModel(defaultInterNetworkingModel)

View File

@ -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@"

View File

@ -47,6 +47,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 + `"
@ -134,6 +135,7 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
DefaultBridges: defaultBridgesCount,
Mlock: !defaultEnableSwap,
EnableIOThreads: enableIOThreads,
Msize9p: defaultMsize9p,
}
agentConfig := vc.KataAgentConfig{}
@ -516,6 +518,7 @@ func TestMinimalRuntimeConfig(t *testing.T) {
DefaultBridges: defaultBridgesCount,
Mlock: !defaultEnableSwap,
BlockDeviceDriver: defaultBlockDeviceDriver,
Msize9p: defaultMsize9p,
}
expectedAgentConfig := vc.KataAgentConfig{}

View File

@ -21,7 +21,7 @@ import (
//
// XXX: Increment for every change to the output format
// (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
type MetaInfo struct {
@ -75,8 +75,9 @@ type HypervisorInfo struct {
MachineType string
Version string
Path string
Debug bool
BlockDeviceDriver string
Msize9p uint32
Debug bool
}
// ProxyInfo stores proxy details
@ -271,6 +272,7 @@ func getHypervisorInfo(config oci.RuntimeConfig) HypervisorInfo {
Version: version,
Path: hypervisorPath,
BlockDeviceDriver: config.HypervisorConfig.BlockDeviceDriver,
Msize9p: config.HypervisorConfig.Msize9p,
}
}

View File

@ -232,6 +232,7 @@ func getExpectedHypervisor(config oci.RuntimeConfig) HypervisorInfo {
Path: config.HypervisorConfig.HypervisorPath,
MachineType: config.HypervisorConfig.HypervisorMachineType,
BlockDeviceDriver: config.HypervisorConfig.BlockDeviceDriver,
Msize9p: config.HypervisorConfig.Msize9p,
}
}

View File

@ -902,6 +902,7 @@ func TestStatusSandboxSuccessfulStateReady(t *testing.T) {
DefaultBridges: defaultBridges,
BlockDeviceDriver: defaultBlockDriver,
DefaultMaxVCPUs: defaultMaxQemuVCPUs,
Msize9p: defaultMsize9p,
}
expectedStatus := SandboxStatus{
@ -958,6 +959,7 @@ func TestStatusSandboxSuccessfulStateRunning(t *testing.T) {
DefaultBridges: defaultBridges,
BlockDeviceDriver: defaultBlockDriver,
DefaultMaxVCPUs: defaultMaxQemuVCPUs,
Msize9p: defaultMsize9p,
}
expectedStatus := SandboxStatus{

View File

@ -215,6 +215,9 @@ type HypervisorConfig struct {
// DisableNestingChecks is used to override customizations performed
// when running on top of another VMM.
DisableNestingChecks bool
// Msize9p is used as the msize for 9p shares
Msize9p uint32
}
func (conf *HypervisorConfig) valid() (bool, error) {
@ -246,6 +249,10 @@ func (conf *HypervisorConfig) valid() (bool, error) {
conf.DefaultMaxVCPUs = defaultMaxQemuVCPUs
}
if conf.Msize9p == 0 {
conf.Msize9p = defaultMsize9p
}
return true, nil
}

View File

@ -171,7 +171,9 @@ func TestHypervisorConfigDefaults(t *testing.T) {
DefaultBridges: defaultBridges,
BlockDeviceDriver: defaultBlockDriver,
DefaultMaxVCPUs: defaultMaxQemuVCPUs,
Msize9p: defaultMsize9p,
}
if reflect.DeepEqual(hypervisorConfig, hypervisorConfigDefaultsExpected) == false {
t.Fatal()
}

View File

@ -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
// in the guest.
// This is where at least some of the host config files

View File

@ -97,6 +97,7 @@ const (
defaultCPUModel = "host"
defaultBridgeBus = "pcie.0"
maxDevIDSize = 31
defaultMsize9p = 8192
)
const (

View File

@ -28,6 +28,7 @@ func newQemuConfig() HypervisorConfig {
DefaultBridges: defaultBridges,
BlockDeviceDriver: defaultBlockDriver,
DefaultMaxVCPUs: defaultMaxQemuVCPUs,
Msize9p: defaultMsize9p,
}
}