Create Server with min count greater than max count is not raising BadRequest
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Create server with min count greater than max count is being accepted instead of raising BadRequest
Following are nosetests logs of various scenarios for creations of servers with min count and max count:
=======
FAIL: Create server with mincount=2 & maxcount=1
-------
Traceback (most recent call last):
File "/home/
self.
AssertionError: Server got created with mincount=2 & maxcount=1 instead of raising BadRequest and this is wrong
The behaviour is same for min = max = 0
=======
FAIL: Create server with mincount=0 & maxcount=0
-------
Traceback (most recent call last):
File "/home/
self.
AssertionError: Server got created with mincount=0 & maxcount=0 instead of raising BadRequest and this is wrong
=======
FAIL: Create server with mincount=1 & maxcount=0
-------
Traceback (most recent call last):
File "/home/
self.
AssertionError: Server got created with mincount=1 & maxcount=0 instead of raising BadRequest and this is wrong
affects: | tempest → nova |
Changed in nova: | |
milestone: | none → folsom-3 |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | folsom-3 → 2012.2 |
Well, here is the nova code that deals with this. I don't think there is a spec for this but the comment indicates the min>max case is to be accepted. The 0 case might be a '0 is False' programming error or might not. Either way, if we file a nova bug against this I would recommend that it be marked as Won't Fix. Changing undocumented API corner cases to be more restrictive is IMO always a bad idea unless the current behavior is some kind of security hole or other very serious issue.
min_count = server_ dict.get( 'min_count' ) dict.get( 'max_count' )
min_ count = max_count
max_count = server_
# min_count and max_count are optional. If they exist, they come
# in as strings. We want to default 'min_count' to 1, and default
# 'max_count' to be 'min_count'.
min_count = int(min_count) if min_count else 1
max_count = int(max_count) if max_count else min_count
if min_count > max_count: