Repository navigation
runtime: Make vCPUs and memory to be configurable for uncontrained co… #198
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,12 @@ const ( | |
| defaultKernelPath = "/usr/share/clear-containers/vmlinux.container" | ||
| defaultImagePath = "/usr/share/clear-containers/clear-containers.img" | ||
| defaultHypervisorPath = "/usr/bin/qemu-lite-system-x86_64" | ||
| defaultUnconstrained_sockets = 1 | ||
| defaultUnconstrained_cores = 2 | ||
| defaultUnconstrained_threads = 1 | ||
| defaultUnconstrained_memory = 256 | ||
| defaultUnconstrained_slots = 2 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use underscores in Go names; const defaultUnconstrained_slots should be defaultUnconstrainedSlots |
||
| defaultUnconstrained_max_memory = 512 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use underscores in Go names; const defaultUnconstrained_max_memory should be defaultUnconstrainedMaxMemory |
||
| defaultProxyURL = "unix:///run/cc-oci-runtime/proxy.sock" | ||
| defaultPauseRootPath = "/var/lib/clear-containers/runtime/bundles/pause_bundle" | ||
| pauseBinRelativePath = "bin/pause" | ||
|
|
@@ -81,6 +87,14 @@ type hypervisor struct { | |
| Path string | ||
| Kernel string | ||
| Image string | ||
|
|
||
| Unconstrained_sockets uint32 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use underscores in Go names; struct field Unconstrained_sockets should be UnconstrainedSockets |
||
| Unconstrained_cores uint32 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use underscores in Go names; struct field Unconstrained_cores should be UnconstrainedCores |
||
| Unconstrained_threads uint32 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use underscores in Go names; struct field Unconstrained_threads should be UnconstrainedThreads |
||
|
|
||
| Unconstrained_memory uint32 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use underscores in Go names; struct field Unconstrained_memory should be UnconstrainedMemory |
||
| Unconstrained_slots uint8 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use underscores in Go names; struct field Unconstrained_slots should be UnconstrainedSlots |
||
| Unconstrained_max_memory uint32 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use underscores in Go names; struct field Unconstrained_max_memory should be UnconstrainedMaxMemory |
||
| } | ||
|
|
||
| type proxy struct { | ||
|
|
@@ -123,6 +137,54 @@ func (h hypervisor) image() string { | |
| return h.Image | ||
| } | ||
|
|
||
| func (h hypervisor) unconstrained_sockets() uint32 { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use underscores in Go names; func unconstrained_sockets should be unconstrainedSockets |
||
| if h.Unconstrained_sockets == 0 { | ||
| return defaultUnconstrained_sockets | ||
| } | ||
|
|
||
| return h.Unconstrained_sockets | ||
| } | ||
|
|
||
| func (h hypervisor) unconstrained_cores() uint32 { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use underscores in Go names; func unconstrained_cores should be unconstrainedCores |
||
| if h.Unconstrained_cores == 0 { | ||
| return defaultUnconstrained_cores | ||
| } | ||
|
|
||
| return h.Unconstrained_cores | ||
| } | ||
|
|
||
| func (h hypervisor) unconstrained_threads() uint32 { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use underscores in Go names; func unconstrained_threads should be unconstrainedThreads |
||
| if h.Unconstrained_threads == 0 { | ||
| return defaultUnconstrained_threads | ||
| } | ||
|
|
||
| return h.Unconstrained_threads | ||
| } | ||
|
|
||
| func (h hypervisor) unconstrained_memory() uint32 { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use underscores in Go names; func unconstrained_memory should be unconstrainedMemory |
||
| if h.Unconstrained_memory == 0 { | ||
| return defaultUnconstrained_memory | ||
| } | ||
|
|
||
| return h.Unconstrained_memory | ||
| } | ||
|
|
||
| func (h hypervisor) unconstrained_slots() uint8 { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use underscores in Go names; func unconstrained_slots should be unconstrainedSlots |
||
| if h.Unconstrained_slots == 0 { | ||
| return defaultUnconstrained_slots | ||
| } | ||
|
|
||
| return h.Unconstrained_slots | ||
| } | ||
|
|
||
| func (h hypervisor) unconstrained_max_memory() uint32 { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use underscores in Go names; func unconstrained_max_memory should be unconstrainedMaxMemory |
||
| if h.Unconstrained_max_memory == 0 { | ||
| return defaultUnconstrained_max_memory | ||
| } | ||
|
|
||
| return h.Unconstrained_max_memory | ||
| } | ||
|
|
||
| func (p proxy) url() string { | ||
| if p.URL == "" { | ||
| return defaultProxyURL | ||
|
|
@@ -171,6 +233,12 @@ func newQemuHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) { | |
| hypervisor := h.path() | ||
| kernel := h.kernel() | ||
| image := h.image() | ||
| sockets := h.unconstrained_sockets() | ||
| cores := h.unconstrained_cores() | ||
| threads := h.unconstrained_threads() | ||
| memory := h.unconstrained_memory() | ||
| slots := h.unconstrained_slots() | ||
| max_memory := h.unconstrained_max_memory() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use underscores in Go names; var max_memory should be maxMemory |
||
|
|
||
| for _, file := range []string{hypervisor, kernel, image} { | ||
| if !fileExists(file) { | ||
|
|
@@ -183,6 +251,12 @@ func newQemuHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) { | |
| HypervisorPath: hypervisor, | ||
| KernelPath: kernel, | ||
| ImagePath: image, | ||
| Unconstrained_sockets: sockets, | ||
| Unconstrained_cores: cores, | ||
| Unconstrained_threads: threads, | ||
| Unconstrained_memory: memory, | ||
| Unconstrained_slots: slots, | ||
| Unconstrained_max_memory: max_memory, | ||
| }, nil | ||
| } | ||
|
|
||
|
|
@@ -284,6 +358,12 @@ func loadConfiguration(configPath string) (oci.RuntimeConfig, error) { | |
| HypervisorPath: defaultHypervisorPath, | ||
| KernelPath: defaultKernelPath, | ||
| ImagePath: defaultImagePath, | ||
| Unconstrained_sockets: defaultUnconstrained_sockets, | ||
| Unconstrained_cores: defaultUnconstrained_cores, | ||
| Unconstrained_threads: defaultUnconstrained_threads, | ||
| Unconstrained_memory: defaultUnconstrained_memory, | ||
| Unconstrained_slots: defaultUnconstrained_slots, | ||
| Unconstrained_max_memory: defaultUnconstrained_max_memory, | ||
| } | ||
|
|
||
| defaultAgentConfig := vc.HyperConfig{ | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use underscores in Go names; const defaultUnconstrained_memory should be defaultUnconstrainedMemory