Create Server with min count greater than max count is not raising BadRequest

Bug #1012667 reported by Harika Vakadi
8
This bug affects 1 person
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/openstack/tempest_13thJune_servers/tempest/tempest/tests/test_servers.py", line 247, in test_create_server_with_mincount_greaterThan_maxcount
    self.fail("Server got created with mincount=2 & maxcount=1"
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/openstack/tempest_13thJune_servers/tempest/tempest/tests/test_servers.py", line 220, in test_create_server_with_mincount_maxcount_as_zero
    self.fail("Server got created with mincount=0 & maxcount=0"
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/openstack/tempest_13thJune_servers/tempest/tempest/tests/test_servers.py", line 274, in test_create_server_with_valid_mincount_and_maxcountas_zero
    self.fail("Server got created with mincount=1 & maxcount=0 "
AssertionError: Server got created with mincount=1 & maxcount=0 instead of raising BadRequest and this is wrong

Revision history for this message
David Kranz (david-kranz) wrote :

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')
        max_count = server_dict.get('max_count')
        # 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:
            min_count = max_count

affects: tempest → nova
Revision history for this message
Harika Vakadi (harika-vakadi) wrote :

Hi David,

If the bug be marked as 'Won't fix', what would be the status of test cases?..Shall we skip them for now pointing to the same bug ID?

Revision history for this message
David Kranz (david-kranz) wrote :

They should be skipped for now. The handling of this issue by the nova team will determine what the spec for this actually is supposed to be and then the test can adjusted accordingly.

Revision history for this message
Harika Vakadi (harika-vakadi) wrote :

Hi David,

Yes, skipped the mentioned test cases pointing to the same bug ID. Please follow the link below for review.

https://review.openstack.org/#/c/8516/2

Thanks,
Harika.

Revision history for this message
Russell Bryant (russellb) wrote :
Changed in nova:
status: New → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → folsom-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: folsom-3 → 2012.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.