-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds functionality to apply constraints to a LXD container spec #8869
Conversation
Constraints for CPU cores, memory and instance type are supported.
Ping @pmatulis to sync regarding docs. |
Merge check failure looks related to https://bugs.launchpad.net/juju/+bug/1778986. |
Same again. !!build!! |
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.
How hard would it be to support something like cpu affinity?
https://stgraber.org/2016/03/26/lxd-2-0-resource-control-412/
(I'm quite surprised about limits.cpu, how do you specify just the 3rd cpu, because it looks like:
limits.cpu 0,3
means only cpu 0 and 3
but
limits.cpu 2
means limit to '2' cpus.
I suppose it is whether the given item looks like a list?
Maybe
limits.cpu 2,
?
Anyway, it has been a field request to be able to constrain containers in that fashion, and it feels like this starts to open up that possibility. We should discuss syntax, etc.
I recall there was some trepidation regarding using constraints (get me a machine satisfying these I.e. "at least") for container limits (at most). There is nothing in constraints.Value that obviously does as a pass through to pinning CPUs, but we can thrash that out in said discussions. |
|
@manadart Confirm that these LXD constraints are maximums while traditional constraints are minimums? |
@pmatulis Indeed, confirmed. |
I don't think that's really going to be easy to explain. I mean obviously, we can document it, but it means every time we mention constraints we have to say "(* not LXD)" or whatever. Unless I am misunderstanding. Also, it will actually mix the types of constraint in a single command e.g. in future when networks are added. |
I will discuss with @jam and/or @mitechie and/or @howbazaar on how we should approach the concern here. |
Note that the KVM container manager already implements constraints in similar fashion. |
@jameinel Down the page in the comments section of that post, the single core pinning question was asked. The answer is to use the range syntax.
|
#8891 ## Description of change Removes the constrain validation added in #8869 and passes constraints through to LXD as config, as they are supplied. This changes behaviour from #8869 where specifying an instance-type would override settings for CPU cores and/or memory. LXD's behaviour, now deferred to, is for any specific CPU/mem constraints to override those implied by an instance type _even when they are lower_. ## QA steps Only CPU and Memory ```juju add-machine lxd:0 --constraints "cores=2 mem=1G"``` - Check the LXD config for the new container and verify that: - limits.cpu = "2" and; - limits.memory = "1024MB" Specific Overrides Instance Type ```juju add-machine lxd:0 --constraints "cores=2 mem=2G instance-type=t2.micro"``` - Check the LXD config for the new container and verify that: - limits.cpu = "2" and; - limits.memory = "2048MB" Merged ```juju add-machine lxd:0 --constraints "mem=2G instance-type=t2.micro"``` - Check the LXD config for the new container and verify that: - limits.cpu = "1" and; - limits.memory = "2048MB" ## Documentation changes This changes the documentation requirements from #8869. ## Bug reference N/A
#8889 ## Description of change This is a backport of functionality added to the development branch, for supporting constraints and image types when provisioning LXD container machines. It cherry picks all commits from these PRs: - #8825 - #8838 - #8869 - #8891 ## QA steps See: #8891 ## Documentation changes Yes. ## Bug reference N/A
Description of change
This change introduces constraints support for LXD container machines.
The currently supported constraints are:
Instance types are congruent with AWS, GCE and Azure types. Those are listed here:
https://github.com/dustinkirkland/instance-type/tree/master/yaml
If an instance type constraint is supplied and any of CPU cores or memory are also supplied, these are ignored and a warning indicating such is logged.
Given recent networking changes, we should also be able to filter networking devices based on space constraints in a future patch.
QA steps
juju add-machine lxd:0 --constraints "cores=2 mem=1G"
juju add-machine lxd:0 --constraints "cores=2 mem=1G instance-type=t2.micro"
Documentation changes
Support for this enhancement should be documented.
Bug reference
N/A