Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown

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

defaultUnconstrained_slots = 2

Copy link
Copy Markdown

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_slots should be defaultUnconstrainedSlots

defaultUnconstrained_max_memory = 512

Copy link
Copy Markdown

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_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"
Expand Down Expand Up @@ -81,6 +87,14 @@ type hypervisor struct {
Path string
Kernel string
Image string

Unconstrained_sockets uint32

Copy link
Copy Markdown

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; struct field Unconstrained_sockets should be UnconstrainedSockets

Unconstrained_cores uint32

Copy link
Copy Markdown

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; struct field Unconstrained_cores should be UnconstrainedCores

Unconstrained_threads uint32

Copy link
Copy Markdown

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; struct field Unconstrained_threads should be UnconstrainedThreads


Unconstrained_memory uint32

Copy link
Copy Markdown

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; struct field Unconstrained_memory should be UnconstrainedMemory

Unconstrained_slots uint8

Copy link
Copy Markdown

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; struct field Unconstrained_slots should be UnconstrainedSlots

Unconstrained_max_memory uint32

Copy link
Copy Markdown

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; struct field Unconstrained_max_memory should be UnconstrainedMaxMemory

}

type proxy struct {
Expand Down Expand Up @@ -123,6 +137,54 @@ func (h hypervisor) image() string {
return h.Image
}

func (h hypervisor) unconstrained_sockets() uint32 {

Copy link
Copy Markdown

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; func unconstrained_sockets should be unconstrainedSockets

if h.Unconstrained_sockets == 0 {
return defaultUnconstrained_sockets
}

return h.Unconstrained_sockets
}

func (h hypervisor) unconstrained_cores() uint32 {

Copy link
Copy Markdown

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; func unconstrained_cores should be unconstrainedCores

if h.Unconstrained_cores == 0 {
return defaultUnconstrained_cores
}

return h.Unconstrained_cores
}

func (h hypervisor) unconstrained_threads() uint32 {

Copy link
Copy Markdown

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; func unconstrained_threads should be unconstrainedThreads

if h.Unconstrained_threads == 0 {
return defaultUnconstrained_threads
}

return h.Unconstrained_threads
}

func (h hypervisor) unconstrained_memory() uint32 {

Copy link
Copy Markdown

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; func unconstrained_memory should be unconstrainedMemory

if h.Unconstrained_memory == 0 {
return defaultUnconstrained_memory
}

return h.Unconstrained_memory
}

func (h hypervisor) unconstrained_slots() uint8 {

Copy link
Copy Markdown

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; 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 {

Copy link
Copy Markdown

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; 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
Expand Down Expand Up @@ -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()

Copy link
Copy Markdown

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; var max_memory should be maxMemory


for _, file := range []string{hypervisor, kernel, image} {
if !fileExists(file) {
Expand All @@ -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
}

Expand Down Expand Up @@ -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{
Expand Down
9 changes: 9 additions & 0 deletions config/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ path = "/usr/bin/qemu-lite-system-x86_64"
kernel = "/usr/share/clear-containers/vmlinux.container"
image = "/usr/share/clear-containers/clear-containers.img"

unconstrained_sockets = 1
unconstrained_cores = 2
unconstrained_threads = 1

# The amount of memory is in MiB
unconstrained_memory = 256
unconstrained_slots = 2
unconstrained_max_memory = 512

[proxy.cc]
url = "unix:///var/run/clear-containers/proxy.sock"

Expand Down
31 changes: 31 additions & 0 deletions vendor/github.com/containers/virtcontainers/hypervisor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions vendor/github.com/containers/virtcontainers/pod.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 6 additions & 18 deletions vendor/github.com/containers/virtcontainers/qemu.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.