cannot assign multi value for NovaSchedulerHints

Bug #1297667 reported by Yi Liu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Pavlo Shchelokovskyy

Bug Description

We can assign multi value for one key when using nova boot, for example, below we indicate 2 different_host hints:
nova boot --image cedef40a-ed67-4d10-800e-17455edce175 --flavor 1 --hint different_host=a0cf03a5-d921-4877-bb5c-86d26cf818e1 --hint different_host=8c19174f-4220-44f0-824a-cd1eeef10287 server-1

However, in Heat, for example when we compose the instance in template like below:
"server-2": {
      "Type": "AWS::EC2::Instance",
      "Properties": {
        "ImageId": { "Ref" : "image" },
        "InstanceType": { "Ref" : "flavor" },
        "NovaSchedulerHints": [{"Key":"different_host", "Value": {"Ref": "instance_1_id"}},{"Key":"different_host", "Value": {"Ref": "instance_2_id"}}]},
      "UserData": { "Fn::Base64": "userdata content, not used in this case" }
    }

Only the different_host=<instance_2_id> is effective.

I have check the </usr/lib/python2.6/site-packages/heat/engine/resources/instance.py>, from line 327 to 332:
327 scheduler_hints = {}
328 if self.properties['NovaSchedulerHints']:
329 for tm in self.properties['NovaSchedulerHints']:
330 scheduler_hints[tm['Key']] = tm['Value']
331 else:
332 scheduler_hints = None

According to my understanding, in the example case, the later different_host overwrote the previous one.
That's why only the different_host=<instance_2_id> is effective.

As a result, I think this might be a bug/shortage.
Or maybe the format of the example template above is wrong, then please guide how to compose the NovaSchedulerHints for multi value for one key in correct way.

Any way, need you guys confirmation.
Thank you!

Yi Liu (ryan-yi-liu)
description: updated
Revision history for this message
Steven Hardy (shardy) wrote :

Currently I don't think the heat key/value map will allow you to specify what you want, which is multiple values associated with one key.

It seems that we need to allow optional specification of a key/list map, that's what the underlying API requires AFAICS:

http://docs.openstack.org/havana/config-reference/content/scheduler-filters.html

'os:scheduler_hints': {
    'different_host': ['a0cf03a5-d921-4877-bb5c-86d26cf818e1',
                       '8c19174f-4220-44f0-824a-cd1eeef10287'],
}

I'm not quite sure what the expected interface is at the novaclient level - there don't seem to be any tests at all covering the hints interfaces to v1.1 servers.

Changed in heat:
status: New → Triaged
importance: Undecided → Medium
milestone: none → juno-1
Changed in heat:
assignee: nobody → Pavlo Shchelokovskyy (pshchelo)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/85089

Changed in heat:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/85089
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=28ade4a5be5fc0bc5c6b25690b1b15b98b703e5e
Submitter: Jenkins
Branch: master

commit 28ade4a5be5fc0bc5c6b25690b1b15b98b703e5e
Author: Pavlo Shchelokovskyy <email address hidden>
Date: Thu Apr 3 18:35:47 2014 +0300

    Allow complex scheduler hints for AWS Instance

    Nova supports providing several values for the same scheduler hint,
    in which case the hint value is formed as a list. This functionality was
    missing in AWS::EC2::Instance resource.

    Change-Id: Id05e4f2ebe89871c1f27f8d97441f3b6cf469dd3
    Closes-Bug: #1297667

Changed in heat:
status: In Progress → Fix Committed
Revision history for this message
Steve Baker (steve-stevebaker) wrote :

NovaSchedulerHints needs to be deprecated, and these templates should switch to OS::Nova::Server

tags: added: icehouse-backport-potential
Thierry Carrez (ttx)
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: juno-1 → 2014.2
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.