Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.

runtime: Make vCPUs and memory to be configurable for uncontrained co… - #198

Closed
wuzhy wants to merge 1 commit into
clearcontainers:masterfrom
wuzhy:dev
Closed

wuzhy wants to merge 1 commit into
clearcontainers:masterfrom
wuzhy:dev

Conversation

@wuzhy

@wuzhy wuzhy commented Jun 6, 2017

Copy link
Copy Markdown

…ntainers

For more info, please refer to

#164

Signed-off-by: Zhi Yong Wu zhiyong.wu@ucloud.cn

…ntainers

For more info, please refer to

clearcontainers#164

Signed-off-by: Zhi Yong Wu <zhiyong.wu@ucloud.cn>
Comment thread config.go
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

Comment thread config.go
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

Comment thread config.go
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

Comment thread config.go
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

Comment thread config.go
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

Comment thread config.go
Image string

Unconstrained_sockets uint32
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

Comment thread config.go
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

Comment thread config.go
defaultUnconstrained_threads = 1
defaultUnconstrained_memory = 256
defaultUnconstrained_slots = 2
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

Comment thread config.go
defaultUnconstrained_cores = 2
defaultUnconstrained_threads = 1
defaultUnconstrained_memory = 256
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

Comment thread config.go
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

@jodh-intel

Copy link
Copy Markdown

Hi @wuzhy - thanks for submitting this - it is much appreciated and looks promising! There are few (mostly minor) things to do though:

  • Run the code through gofmt to ensure consistent formatting.
  • Fix the hound issues (remove the underscores).
  • Add some brief tests for the new functions (like hypervisor.unconstrained_sockets()).
    (I noticed that there weren't any tests for existing functions like hypervisor.image(). That was an oversight, so I have raised config: Add new tests for default values. #199 to resolve that so feel free to copy the basic pattern in that PR).

The last issue is the changes to virtcontainers. Since we vendor that package, we cannot change the contents of the vendor/ directory - think of it as a "read-only snapshot" of the upstream projects we use. What that means is that you'll have to raise a PR on https://github.com/containers/virtcontainers for the virtcontainers changes you have made before this PR can be merged.

I'm going to add some comments to the virtcontainers files you've changed though to help get those changes upstreamed.

}

if conf.Unconstrained_sockets == 0 {
return false, fmt.Errorf("Missing cpu sockets")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be preferable to not require the specification of sockets, cores and threads and have virtcontainers default to sensible values itself.

// VCPUs is the number of available virtual CPUs.
VCPUs uint

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.

These variables should be documented.

// Memory is the amount of available memory in MiB.
Memory uint

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.

These should also be documented (including specifying the units they refer to).

// ImagePath is the guest image host path.
ImagePath 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.

These variables should be documented (also it would be worth explaining what "unconstrained" means briefly).

func (q *qemu) setMemoryResources(podConfig PodConfig) ciaoQemu.Memory {
mem := defaultMemSize
memMax := defaultMemMax
mem := fmt.Sprintf("%dM", q.config.Unconstrained_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.

It looks like we've changed from GB to MB here?

@jodh-intel

Copy link
Copy Markdown

Hi @wuzhy - are you still planning to update this PR? If we can help, please let us know.

@dvoytik

dvoytik commented Jul 3, 2017

Copy link
Copy Markdown

Hi @jodh-intel . I'm working on it. If you don't mind I'll create a separate pull request

@sameo

sameo commented Jul 3, 2017

Copy link
Copy Markdown

@dvoytik Please do. @wuzhy Are you ok with that ?

@grahamwhaley

Copy link
Copy Markdown
Contributor

@dvoytik @wuzhy If this is now superseded by #297 ?, can we mark this one with a Do-No-Merge label, and then close this when #297 lands - OK?

@dvoytik

dvoytik commented Jul 12, 2017

Copy link
Copy Markdown

Hi @grahamwhaley. Yes, #297 supersedes this PR. Sure, please do. Thank you!

@jodh-intel

Copy link
Copy Markdown

Some of this functionality has now been added under #297.

@wuzhy - do you want to rework this PR, or does the current functionality provide enough of what you need (so that we can close this PR)?

@dvoytik

dvoytik commented Jul 20, 2017

Copy link
Copy Markdown

I wonder, if a user/ops really should have access to these low level settings:

 unconstrained_sockets = 1
 unconstrained_threads = 1
 unconstrained_slots = 2
 unconstrained_max_memory = 512

@jodh-intel

Copy link
Copy Markdown

Hi @wuzhy - I'm going to assume that the features currently provided by the runtime are sufficient so that we can close this PR. If I'm wrong, please let us know so we can re-open this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants