containers / virtcontainers

A Go package for building hardware virtualized container runtimes
Apache License 2.0
139 stars 43 forks source link

qemu: honor DefaultVCPUs #662

Closed devimc closed 6 years ago

devimc commented 6 years ago

Currently when a container with CPU constrains is created using docker, the VM starts with a wrong number of vCPUs, the VM must start with the number of vCPUs specified by default_vcpus allowing to the runtime hot add/remove resources as needed.

For example if DefaultVCPUs (default_vcpus) is 1 and the container has a constraint of 4 (docker run --cpus 4 ...), the VM must start with 1 vCPU because the runtime hot add 4 vCPUs. Qemu command line example: old: qemu-system-x86_64 ... -smp 4,cores=1,threads=1,sockets=1,maxcpus=240

new: qemu-system-x86_64 ... -smp 1,cores=1,threads=1,sockets=1,maxcpus=240

Depends-on: github.com/clearcontainers/runtime#1048

see clearcontainers/runtime#1032 and clearcontainers/runtime#1041

fixes #661

Signed-off-by: Julio Montes julio.montes@intel.com

grahamwhaley commented 6 years ago

DNM I presume this is WIP. I see lots of deleted code :-) It would be nice if we had some fragments of the qemu command line - the current bad one and the proposed new one - in the PR message, so we could see what was changing.

devimc commented 6 years ago

@grahamwhaley changes applied, thanks

sboeuf commented 6 years ago

Thanks @devimc, this is the follow up we need after your patch for hotplugging CPU was merged. LGTM

sameo commented 6 years ago

LGTM

Approved with PullApprove Approved with PullApprove