IndexError: list index out of range in assign_networks_by_default

Bug #1273099 reported by Gleb
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Invalid
Undecided
Unassigned

Bug Description

I can't assign role to the nodes.

After Fuel installation I run bootstrap_admin_node.sh few times to change admin network interface and ntp servers.
The nodes were discovered but I can't assign roles to them.

Please see atached logs for details.

Revision history for this message
Gleb (gleb-q) wrote :
Revision history for this message
Andrew Woodward (xarses) wrote :

try

/opt/nailgun/bin/manage.py dropdb
/opt/nailgun/bin/manage.py syncdb
/opt/nailgun/bin/manage.py loaddefault

this will purge and reset your db

Revision history for this message
Aleksey Kasatkin (alekseyk-ru) wrote :

From the log:

2014-01-27 07:01:29.742 DEBUG [7f4d5d7fb700] (logger) Request PUT /api/nodes from 10.204.83.1:41157 [{"id":39,"cluster_id":1,"pending_roles":["controller"],"pending_addition":true}]
2014-01-27 07:01:29.989 ERROR [7f4d5d7fb700] (logger) Traceback (most recent call last):
  File "/opt/nailgun/lib/python2.6/site-packages/web/application.py", line 239, in process
    return self.handle()
  File "/opt/nailgun/lib/python2.6/site-packages/web/application.py", line 230, in handle
    return self._delegate(fn, self.fvars, args)
  File "/opt/nailgun/lib/python2.6/site-packages/web/application.py", line 420, in _delegate
    return handle_class(cls)
  File "/opt/nailgun/lib/python2.6/site-packages/web/application.py", line 396, in handle_class
    return tocall(*args)
  File "<string>", line 2, in PUT
  File "/opt/nailgun/lib/python2.6/site-packages/nailgun/api/handlers/base.py", line 55, in content_json
    data = func(*args, **kwargs)
  File "/opt/nailgun/lib/python2.6/site-packages/nailgun/api/handlers/node.py", line 438, in PUT
    network_manager.assign_networks_by_default(node)
  File "/opt/nailgun/lib/python2.6/site-packages/nailgun/network/neutron.py", line 127, in assign_networks_by_default
    ifaces = [node.admin_interface]
  File "/opt/nailgun/lib/python2.6/site-packages/nailgun/db/sqlalchemy/models/node.py", line 228, in admin_interface
    return self.interfaces[0]
IndexError: list index out of range

2014-01-27 07:01:29.990 ERROR [7f4d5d7fb700] (logger) Response code '500 Internal Server Error' for PUT /api/nodes from 10.204.83.1:41157

It seems that the node with id=39 wasn't mentioned previously (for 28 hours at least).
Did you use UI?
What is the Fuel version or commits?

Revision history for this message
Gleb (gleb-q) wrote :

Andrew Woodward's solution works! Thanks a lot, Andrew

Changed in fuel:
status: New → Triaged
Changed in fuel:
status: Triaged → Opinion
status: Opinion → Invalid
Revision history for this message
Fabrizio Soppelsa (fsoppelsa) wrote :

An user reproduced this error while upgrading from 5.0.1 to 5.1.
Then, creating a new env got stuck

    2014-09-27 08:01:10 ERROR
    [7f0836a62740] (logger) Response code '500 Internal Server Error' for PUT /api/nodes from 172.17.42.1:57984
    2014-09-27 08:01:10 ERROR
    [7f0836a62740] (logger) Traceback (most recent call last):
      File "/usr/lib/python2.6/site-packages/web/application.py", line 239, in process
        return self.handle()
      File "/usr/lib/python2.6/site-packages/web/application.py", line 230, in handle
        return self._delegate(fn, self.fvars, args)
      File "/usr/lib/python2.6/site-packages/web/application.py", line 420, in _delegate
        return handle_class(cls)
      File "/usr/lib/python2.6/site-packages/web/application.py", line 396, in handle_class
        return tocall(*args)
      File "<string>", line 2, in PUT
      File "/usr/lib/python2.6/site-packages/nailgun/api/v1/handlers/base.py", line 93, in content_json
        data = func(*args, **kwargs)
      File "/usr/lib/python2.6/site-packages/nailgun/api/v1/handlers/node.py", line 99, in PUT
        self.collection.single.update(node, nd)
      File "/usr/lib/python2.6/site-packages/nailgun/objects/node.py", line 425, in update
        cls.add_into_cluster(instance, new_cluster_id)
      File "/usr/lib/python2.6/site-packages/nailgun/objects/node.py", line 587, in add_into_cluster
        network_manager.assign_networks_by_default(instance)
      File "/usr/lib/python2.6/site-packages/nailgun/network/manager.py", line 469, in assign_networks_by_default
        def_set = cls.get_default_networks_assignment(node)
      File "/usr/lib/python2.6/site-packages/nailgun/network/manager.py", line 457, in get_default_networks_assignment
        nics[0]['name']
    IndexError: list index out of range

Cleaning the db with the Andrew suggestion worked fine though:

dockerctl shell nailgun
manage.py dropdb
manage.py syncdb
manage.py loaddefault

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.