CPU instance constraints not working as expected

Bug #1210086 reported by Tom Haddon
14
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)prodstack-u1@wekufe:~$ nova flavor-list | grep cpu1-ram4-disk50-ephemeral20
| 1103 | cpu1-ram4-disk50-ephemeral20 | 4096 | 50 | 20 | | 1 | 1.0 | True | {} |

Related branches

Tom Haddon (mthaddon)
tags: added: canonical-webops
Revision history for this message
Sidnei da Silva (sidnei) wrote :

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.

Sidnei da Silva (sidnei)
Changed in juju-core:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Sidnei da Silva (sidnei)
milestone: none → 1.13.1
Revision history for this message
Sidnei da Silva (sidnei) wrote :

Verification:

$ nova flavor-list | grep ram4
| 1003 | cpu1-ram4-disk10-ephemeral20 | 4096 | 10 | 20 | | 1 | 1.0 | True | {} |
| 1013 | cpu2-ram4-disk10-ephemeral20 | 4096 | 10 | 20 | | 2 | 1.0 | True | {} |
| 1023 | cpu3-ram4-disk10-ephemeral20 | 4096 | 10 | 20 | | 3 | 1.0 | True | {} |
| 1033 | cpu4-ram4-disk10-ephemeral20 | 4096 | 10 | 20 | | 4 | 1.0 | True | {} |

$ juju deploy --constraints="cpu-cores=1 mem=4G" ubuntu
$ nova show 93bf2782-701a-44ec-8632-04215f94b2ab | grep flavor
| flavor | cpu1-ram4-disk10-ephemeral20 (1003)

$ juju deploy --constraints="cpu-cores=2 mem=4G" ubuntu ubuntu2
$ nova show e5b40610-f796-4860-aa7f-97d75ffe63e0 | grep flavor
| flavor | cpu2-ram4-disk10-ephemeral20 (1013)

Seems good to go.

Revision history for this message
Sidnei da Silva (sidnei) wrote :

Double checking. Without the fix, got:

$ juju -v deploy --constraints="cpu-cores=1 mem=4G" ubuntu ubuntu1
$ nova show 7c99e0ce-5044-4e50-aeab-7f15e9b79c65 | grep flavor
| flavor | cpu3-ram4-disk10-ephemeral20 (1023)

$ juju deploy --constraints="cpu-cores=2 mem=4G" ubuntu ubuntu2
$ nova show ca0383cf-b553-4052-8056-d3793aedde5b
| flavor | m1.medium (3)

With the attached branch, confirmed working per previous comment.

Sidnei da Silva (sidnei)
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.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.