Comment 6 for bug 1557730

Revision history for this message
Rodion Tikunov (rtikunov) wrote :

Steps to reproduce:
1) Deploy OpenStack with one controller and one compute node
2) Create project with quota
source openrc
openstack project create --description 'test1' test1
openstack user create --project test1 --password test1test test1
neutron quota-update --tenant_id test1 --network 3 --subnet 3 --port 3 -- --floatingip 3 --router 3
3) Create network in that project
export OS_TENANT_NAME='test1'
export OS_PROJECT_NAME='test1'
export OS_USERNAME='test1'
export OS_PASSWORD='test1test'

neutron net-create --prefix 192.168.120.0/24 test1
neutron subnet-create test1 192.168.120.0/24
4) Patching file /usr/lib/python2.7/dist-packages/nova/compute/api.py
patch
--- /usr/lib/python2.7/dist-packages/nova/compute/api.py.orig 2016-04-11 15:29:48.655077119 +0000
+++ /usr/lib/python2.7/dist-packages/nova/compute/api.py 2016-04-11 15:30:42.315261962 +0000
@@ -1183,6 +1183,7 @@
         # max_net_count is the maximum number of instances requested by the
         # user adjusted for any network quota constraints, including
         # consideration of connections to each requested network
+ max_net_count = -12
         if max_net_count == 0:
             raise exception.PortLimitExceeded()
         elif max_net_count < max_count:
5) Restart nova services
rm /usr/lib/python2.7/dist-packages/nova/compute/api.pyc
service nova-scheduler restart; service nova-api restart; service nova-scheduler restart
6) Create instances
nova boot --image TestVM --flavor m1.tiny --min-count 2 --max-count 3 --nic net-id=1cc2f10c-d11f-4544-94c3-f76edd8ae2e3 test1
Result:
ERROR (ClientException): Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<type 'exceptions.IndexError'> (HTTP 500) (Request-ID: req-ba9ec03b-bb8b-438e-bc6c-b323b8257ab2)

in logs
2016-04-11 15:26:58.246 4153229 DEBUG nova.compute.api [req-644d6ed7-1973-482f-92d1-3c3a5d57f911 14bd92c40d7d4b92bbb24955cd6e99ff 67a8970da66e4cd0917e374bda795a79 - - -] max count reduced from 3 to -12 due
 to network port quota _create_instance /usr/lib/python2.7/dist-packages/nova/compute/api.py:1195
2016-04-11 15:26:58.251 4153229 DEBUG nova.quota [req-644d6ed7-1973-482f-92d1-3c3a5d57f911 14bd92c40d7d4b92bbb24955cd6e99ff 67a8970da66e4cd0917e374bda795a79 - - -] Created reservations [] reserve /usr/lib/
python2.7/dist-packages/nova/quota.py:1345
2016-04-11 15:26:58.252 4153229 DEBUG nova.compute.api [req-644d6ed7-1973-482f-92d1-3c3a5d57f911 14bd92c40d7d4b92bbb24955cd6e99ff 67a8970da66e4cd0917e374bda795a79 - - -] Going to run -12 instances... _prov
ision_instances /usr/lib/python2.7/dist-packages/nova/compute/api.py:1014
2016-04-11 15:26:58.336 4153229 ERROR nova.api.openstack.extensions [req-644d6ed7-1973-482f-92d1-3c3a5d57f911 14bd92c40d7d4b92bbb24955cd6e99ff 67a8970da66e4cd0917e374bda795a79 - - -] Unexpected exception i
n API method
2016-04-11 15:26:58.336 4153229 ERROR nova.api.openstack.extensions Traceback (most recent call last):
2016-04-11 15:26:58.336 4153229 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/dist-packages/nova/api/openstack/extensions.py", line 478, in wrapped
2016-04-11 15:26:58.336 4153229 ERROR nova.api.openstack.extensions return f(*args, **kwargs)
2016-04-11 15:26:58.336 4153229 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/dist-packages/nova/api/validation/__init__.py", line 73, in wrapper
2016-04-11 15:26:58.336 4153229 ERROR nova.api.openstack.extensions return func(*args, **kwargs)
2016-04-11 15:26:58.336 4153229 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/dist-packages/nova/api/validation/__init__.py", line 73, in wrapper
2016-04-11 15:26:58.336 4153229 ERROR nova.api.openstack.extensions return func(*args, **kwargs)
2016-04-11 15:26:58.336 4153229 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/dist-packages/nova/api/openstack/compute/servers.py", line 685, in create
2016-04-11 15:26:58.336 4153229 ERROR nova.api.openstack.extensions server = self._view_builder.create(req, instances[0])
2016-04-11 15:26:58.336 4153229 ERROR nova.api.openstack.extensions IndexError: list index out of range

7) After apllying fix
nova boot --image TestVM --flavor m1.tiny --min-count 2 --max-count 3 --nic net-id=1cc2f10c-d11f-4544-94c3-f76edd8ae2e3 test1
ERROR (Forbidden): Maximum number of ports exceeded (HTTP 403) (Request-ID: req-7b29edbd-31a2-401f-92cc-7ad61c005365)