CPU instance constraints not working as expected
Bug #1210086 reported by
Tom Haddon
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
juju-core |
Fix Released
|
Medium
|
Sidnei da Silva |
Bug Description
--constraints "cpu-cores=1 mem=4G arch=amd64" gets 4 core machine, even when a flavor matching the exact instance exists:
(clupdown)
| 1103 | cpu1-ram4-
Related branches
lp:~sidnei/juju-core/sort-by-cost-lowest-fallback
- Juju Engineering: Pending requested
-
Diff: 293 lines (+135/-34)3 files modifiedenvirons/instances/instancetype.go (+18/-2)
environs/instances/instancetype_test.go (+117/-31)
environs/openstack/image.go (+0/-1)
tags: | added: canonical-webops |
Changed in juju-core: | |
status: | New → In Progress |
importance: | Undecided → Medium |
assignee: | nobody → Sidnei da Silva (sidnei) |
milestone: | none → 1.13.1 |
Changed in juju-core: | |
status: | In Progress → Fix Committed |
Changed in juju-core: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Initial findings:
In the openstack provider, 'Cost' is set to RAM:
Cost: uint64(flavor.RAM),
When finding instance types, we are sorting by Cost:
sort. Sort(byCost( itypes) )
But all costs being the same, it's actually taking the original order into account, which I assume might be busting the computation.
A suggestion is to include the number of cores into the cost for the openstack provider, such that if two machines have the same amount of RAM, the one with the less number of cores that matches the cpu-cores constraint is picked first.