mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-02 00:02:01 +00:00
config: add hypervisor_loglevel
Implement HypervisorLoglevel config option for clh. Signed-off-by: Cameron Baird <cameronbaird@microsoft.com>
This commit is contained in:
parent
41f23f1d2a
commit
b6b0addd5e
@ -205,6 +205,11 @@ block_device_driver = "virtio-blk"
|
|||||||
# Default false
|
# Default false
|
||||||
#enable_debug = true
|
#enable_debug = true
|
||||||
|
|
||||||
|
# This option specifies the loglevel of the hypervisor
|
||||||
|
#
|
||||||
|
# Default 1
|
||||||
|
#hypervisor_loglevel = 1
|
||||||
|
|
||||||
# Enable hot-plugging of VFIO devices to a root-port.
|
# Enable hot-plugging of VFIO devices to a root-port.
|
||||||
# The default setting is "no-port"
|
# The default setting is "no-port"
|
||||||
#hot_plug_vfio = "root-port"
|
#hot_plug_vfio = "root-port"
|
||||||
|
@ -63,6 +63,7 @@ const defaultVCPUCount uint32 = 1
|
|||||||
const defaultMaxVCPUCount uint32 = 0
|
const defaultMaxVCPUCount uint32 = 0
|
||||||
const defaultMemSize uint32 = 2048 // MiB
|
const defaultMemSize uint32 = 2048 // MiB
|
||||||
const defaultMemSlots uint32 = 10
|
const defaultMemSlots uint32 = 10
|
||||||
|
const defaultHypervisorLoglevel uint32 = 1
|
||||||
const defaultMemOffset uint64 = 0 // MiB
|
const defaultMemOffset uint64 = 0 // MiB
|
||||||
const defaultVirtioMem bool = false
|
const defaultVirtioMem bool = false
|
||||||
const defaultBridgesCount uint32 = 1
|
const defaultBridgesCount uint32 = 1
|
||||||
|
@ -61,6 +61,9 @@ const (
|
|||||||
maxPCIeRootPorts uint32 = 16
|
maxPCIeRootPorts uint32 = 16
|
||||||
maxPCIeSwitchPorts uint32 = 16
|
maxPCIeSwitchPorts uint32 = 16
|
||||||
|
|
||||||
|
// the maximum valid loglevel for the hypervisor
|
||||||
|
maxHypervisorLoglevel uint32 = 3
|
||||||
|
|
||||||
errInvalidHypervisorPrefix = "configuration file contains invalid hypervisor section"
|
errInvalidHypervisorPrefix = "configuration file contains invalid hypervisor section"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -126,6 +129,7 @@ type hypervisor struct {
|
|||||||
NetRateLimiterBwOneTimeBurst int64 `toml:"net_rate_limiter_bw_one_time_burst"`
|
NetRateLimiterBwOneTimeBurst int64 `toml:"net_rate_limiter_bw_one_time_burst"`
|
||||||
NetRateLimiterOpsMaxRate int64 `toml:"net_rate_limiter_ops_max_rate"`
|
NetRateLimiterOpsMaxRate int64 `toml:"net_rate_limiter_ops_max_rate"`
|
||||||
NetRateLimiterOpsOneTimeBurst int64 `toml:"net_rate_limiter_ops_one_time_burst"`
|
NetRateLimiterOpsOneTimeBurst int64 `toml:"net_rate_limiter_ops_one_time_burst"`
|
||||||
|
HypervisorLoglevel uint32 `toml:"hypervisor_loglevel"`
|
||||||
VirtioFSCacheSize uint32 `toml:"virtio_fs_cache_size"`
|
VirtioFSCacheSize uint32 `toml:"virtio_fs_cache_size"`
|
||||||
VirtioFSQueueSize uint32 `toml:"virtio_fs_queue_size"`
|
VirtioFSQueueSize uint32 `toml:"virtio_fs_queue_size"`
|
||||||
DefaultMaxVCPUs uint32 `toml:"default_maxvcpus"`
|
DefaultMaxVCPUs uint32 `toml:"default_maxvcpus"`
|
||||||
@ -545,6 +549,14 @@ func (h hypervisor) defaultBridges() uint32 {
|
|||||||
return h.DefaultBridges
|
return h.DefaultBridges
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h hypervisor) defaultHypervisorLoglevel() uint32 {
|
||||||
|
if h.HypervisorLoglevel > maxHypervisorLoglevel {
|
||||||
|
return maxHypervisorLoglevel
|
||||||
|
}
|
||||||
|
|
||||||
|
return h.HypervisorLoglevel
|
||||||
|
}
|
||||||
|
|
||||||
func (h hypervisor) defaultVirtioFSCache() string {
|
func (h hypervisor) defaultVirtioFSCache() string {
|
||||||
if h.VirtioFSCache == "" {
|
if h.VirtioFSCache == "" {
|
||||||
return defaultVirtioFSCacheMode
|
return defaultVirtioFSCacheMode
|
||||||
@ -962,6 +974,7 @@ func newQemuHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
|||||||
SharedFS: sharedFS,
|
SharedFS: sharedFS,
|
||||||
VirtioFSDaemon: h.VirtioFSDaemon,
|
VirtioFSDaemon: h.VirtioFSDaemon,
|
||||||
VirtioFSDaemonList: h.VirtioFSDaemonList,
|
VirtioFSDaemonList: h.VirtioFSDaemonList,
|
||||||
|
HypervisorLoglevel: h.defaultHypervisorLoglevel(),
|
||||||
VirtioFSCacheSize: h.VirtioFSCacheSize,
|
VirtioFSCacheSize: h.VirtioFSCacheSize,
|
||||||
VirtioFSCache: h.defaultVirtioFSCache(),
|
VirtioFSCache: h.defaultVirtioFSCache(),
|
||||||
VirtioFSQueueSize: h.VirtioFSQueueSize,
|
VirtioFSQueueSize: h.VirtioFSQueueSize,
|
||||||
@ -1094,6 +1107,7 @@ func newClhHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
|||||||
SharedFS: sharedFS,
|
SharedFS: sharedFS,
|
||||||
VirtioFSDaemon: h.VirtioFSDaemon,
|
VirtioFSDaemon: h.VirtioFSDaemon,
|
||||||
VirtioFSDaemonList: h.VirtioFSDaemonList,
|
VirtioFSDaemonList: h.VirtioFSDaemonList,
|
||||||
|
HypervisorLoglevel: h.defaultHypervisorLoglevel(),
|
||||||
VirtioFSCacheSize: h.VirtioFSCacheSize,
|
VirtioFSCacheSize: h.VirtioFSCacheSize,
|
||||||
VirtioFSCache: h.VirtioFSCache,
|
VirtioFSCache: h.VirtioFSCache,
|
||||||
MemPrealloc: h.MemPrealloc,
|
MemPrealloc: h.MemPrealloc,
|
||||||
@ -1248,6 +1262,7 @@ func newStratovirtHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
|||||||
SharedFS: sharedFS,
|
SharedFS: sharedFS,
|
||||||
VirtioFSDaemon: h.VirtioFSDaemon,
|
VirtioFSDaemon: h.VirtioFSDaemon,
|
||||||
VirtioFSDaemonList: h.VirtioFSDaemonList,
|
VirtioFSDaemonList: h.VirtioFSDaemonList,
|
||||||
|
HypervisorLoglevel: h.defaultHypervisorLoglevel(),
|
||||||
VirtioFSCacheSize: h.VirtioFSCacheSize,
|
VirtioFSCacheSize: h.VirtioFSCacheSize,
|
||||||
VirtioFSCache: h.defaultVirtioFSCache(),
|
VirtioFSCache: h.defaultVirtioFSCache(),
|
||||||
VirtioFSExtraArgs: h.VirtioFSExtraArgs,
|
VirtioFSExtraArgs: h.VirtioFSExtraArgs,
|
||||||
@ -1469,6 +1484,7 @@ func GetDefaultHypervisorConfig() vc.HypervisorConfig {
|
|||||||
GuestHookPath: defaultGuestHookPath,
|
GuestHookPath: defaultGuestHookPath,
|
||||||
VhostUserStorePath: defaultVhostUserStorePath,
|
VhostUserStorePath: defaultVhostUserStorePath,
|
||||||
VhostUserDeviceReconnect: defaultVhostUserDeviceReconnect,
|
VhostUserDeviceReconnect: defaultVhostUserDeviceReconnect,
|
||||||
|
HypervisorLoglevel: defaultHypervisorLoglevel,
|
||||||
VirtioFSCache: defaultVirtioFSCacheMode,
|
VirtioFSCache: defaultVirtioFSCacheMode,
|
||||||
DisableImageNvdimm: defaultDisableImageNvdimm,
|
DisableImageNvdimm: defaultDisableImageNvdimm,
|
||||||
RxRateLimiterMaxRate: defaultRxRateLimiterMaxRate,
|
RxRateLimiterMaxRate: defaultRxRateLimiterMaxRate,
|
||||||
|
@ -570,6 +570,7 @@ func TestMinimalRuntimeConfig(t *testing.T) {
|
|||||||
Msize9p: defaultMsize9p,
|
Msize9p: defaultMsize9p,
|
||||||
GuestHookPath: defaultGuestHookPath,
|
GuestHookPath: defaultGuestHookPath,
|
||||||
VhostUserStorePath: defaultVhostUserStorePath,
|
VhostUserStorePath: defaultVhostUserStorePath,
|
||||||
|
HypervisorLoglevel: defaultHypervisorLoglevel,
|
||||||
VirtioFSCache: defaultVirtioFSCacheMode,
|
VirtioFSCache: defaultVirtioFSCacheMode,
|
||||||
BlockDeviceAIO: defaultBlockDeviceAIO,
|
BlockDeviceAIO: defaultBlockDeviceAIO,
|
||||||
DisableGuestSeLinux: defaultDisableGuestSeLinux,
|
DisableGuestSeLinux: defaultDisableGuestSeLinux,
|
||||||
|
@ -1362,7 +1362,7 @@ func (clh *cloudHypervisor) launchClh() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
args := []string{cscAPIsocket, clh.state.apiSocket}
|
args := []string{cscAPIsocket, clh.state.apiSocket}
|
||||||
if clh.config.Debug {
|
if clh.config.Debug && clh.config.HypervisorLoglevel > 0 {
|
||||||
// Cloud hypervisor log levels
|
// Cloud hypervisor log levels
|
||||||
// 'v' occurrences increase the level
|
// 'v' occurrences increase the level
|
||||||
//0 => Warn
|
//0 => Warn
|
||||||
@ -1382,7 +1382,8 @@ func (clh *cloudHypervisor) launchClh() error {
|
|||||||
// output. For further details, see the discussion on:
|
// output. For further details, see the discussion on:
|
||||||
//
|
//
|
||||||
// https://github.com/kata-containers/kata-containers/pull/2751
|
// https://github.com/kata-containers/kata-containers/pull/2751
|
||||||
args = append(args, "-v")
|
verbosityString := fmt.Sprintf("-%s", strings.Repeat("v", int(clh.config.HypervisorLoglevel)))
|
||||||
|
args = append(args, verbosityString)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable the `seccomp` feature from Cloud Hypervisor by default
|
// Enable the `seccomp` feature from Cloud Hypervisor by default
|
||||||
|
@ -601,6 +601,10 @@ type HypervisorConfig struct {
|
|||||||
// enable debug output where available.
|
// enable debug output where available.
|
||||||
Debug bool
|
Debug bool
|
||||||
|
|
||||||
|
// HypervisorLoglevel determines the level of logging emitted
|
||||||
|
// from the hypervisor. Accepts values 0-3.
|
||||||
|
HypervisorLoglevel uint32
|
||||||
|
|
||||||
// MemPrealloc specifies if the memory should be pre-allocated
|
// MemPrealloc specifies if the memory should be pre-allocated
|
||||||
MemPrealloc bool
|
MemPrealloc bool
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user