This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #351 from devimc/docker/loadRuntimeConfig
integration/docker: read default number of vCPUs from config file
- Loading branch information
Showing
19 changed files
with
3,335 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// Copyright (c) 2018 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
package tests | ||
|
||
import ( | ||
"io/ioutil" | ||
|
||
"github.com/BurntSushi/toml" | ||
) | ||
|
||
// RuntimeConfig is the runtime configuration | ||
type RuntimeConfig struct { | ||
Hypervisor map[string]hypervisor | ||
Proxy map[string]proxy | ||
Shim map[string]shim | ||
Agent map[string]agent | ||
Runtime runtime | ||
} | ||
|
||
type hypervisor struct { | ||
Path string `toml:"path"` | ||
Kernel string `toml:"kernel"` | ||
Initrd string `toml:"initrd"` | ||
Image string `toml:"image"` | ||
Firmware string `toml:"firmware"` | ||
MachineAccelerators string `toml:"machine_accelerators"` | ||
KernelParams string `toml:"kernel_params"` | ||
MachineType string `toml:"machine_type"` | ||
DefaultVCPUs int32 `toml:"default_vcpus"` | ||
DefaultMaxVCPUs uint32 `toml:"default_maxvcpus"` | ||
DefaultMemSz uint32 `toml:"default_memory"` | ||
DefaultBridges uint32 `toml:"default_bridges"` | ||
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"` | ||
Debug bool `toml:"enable_debug"` | ||
DisableNestingChecks bool `toml:"disable_nesting_checks"` | ||
EnableIOThreads bool `toml:"enable_iothreads"` | ||
} | ||
|
||
type proxy struct { | ||
Path string `toml:"path"` | ||
Debug bool `toml:"enable_debug"` | ||
} | ||
|
||
type runtime struct { | ||
Debug bool `toml:"enable_debug"` | ||
InterNetworkModel string `toml:"internetworking_model"` | ||
} | ||
|
||
type shim struct { | ||
Path string `toml:"path"` | ||
Debug bool `toml:"enable_debug"` | ||
} | ||
|
||
type agent struct { | ||
} | ||
|
||
const ( | ||
// DefaultHypervisor default hypervisor | ||
DefaultHypervisor = "qemu" | ||
|
||
// DefaultProxy default proxy | ||
DefaultProxy = "kata" | ||
|
||
// DefaultAgent default agent | ||
DefaultAgent = "kata" | ||
|
||
// DefaultShim default shim | ||
DefaultShim = "kata" | ||
|
||
// DefaultRuntimeConfigPath is the default path to the runtime configuration file | ||
DefaultRuntimeConfigPath = "/usr/share/defaults/kata-containers/configuration.toml" | ||
) | ||
|
||
// LoadRuntimeConfiguration loads runtime configuration | ||
func LoadRuntimeConfiguration(configPath string) (RuntimeConfig, error) { | ||
var config RuntimeConfig | ||
configData, err := ioutil.ReadFile(configPath) | ||
if err != nil { | ||
return config, err | ||
} | ||
|
||
_, err = toml.Decode(string(configData), &config) | ||
if err != nil { | ||
return config, err | ||
} | ||
|
||
return config, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/COPYING
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/COPYING
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.