2014-03-26 07:38:32 |
Yi Liu |
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! |
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! |
|