← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1384228] [NEW] Exception should be raised if nova has failed to add fixed ip

 

Public bug reported:

I have the following code

try:
    instance.add_fixed_ip(network.id)
except Exception as e:
    ...

The issue is that in Nova compute logs I can see exception, but it is not thrown on client side. 
Since add_fixed_ip() returns nothing, it is difficult to find if fixed address was assigned.

Exception:
"""
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher Traceback (most recent call last):
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 134, in _dispatch_and_reply
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     incoming.message))
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 177, in _dispatch
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     return self._do_dispatch(endpoint, method, ctxt, args)
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 123, in _do_dispatch
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     result = getattr(endpoint, method)(ctxt, **new_args)
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/compute/manager.py", line 393, in decorated_function
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     return function(self, context, *args, **kwargs)
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/exception.py", line 88, in wrapped
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     payload)
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/openstack/common/excutils.py", line 68, in __exit__
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     six.reraise(self.type_, self.value, self.tb)
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/exception.py", line 71, in wrapped
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     return f(self, context, *args, **kw)
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/compute/manager.py", line 274, in decorated_function
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     pass
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/openstack/common/excutils.py", line 68, in __exit__
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     six.reraise(self.type_, self.value, self.tb)
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/compute/manager.py", line 260, in decorated_function
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     return function(self, context, *args, **kwargs)
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/compute/manager.py", line 303, in decorated_function
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     e, sys.exc_info())
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/openstack/common/excutils.py", line 68, in __exit__
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     six.reraise(self.type_, self.value, self.tb)
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/compute/manager.py", line 290, in decorated_function
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     return function(self, context, *args, **kwargs)
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/compute/manager.py", line 3621, in add_fixed_ip_to_instance
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     network_id)
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/network/api.py", line 49, in wrapper
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     res = f(self, context, *args, **kwargs)
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/network/neutronv2/api.py", line 562, in add_fixed_ip_to_instance
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     instance_id=instance['uuid'])
2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher NetworkNotFoundForInstance: Network could not be found for instance b58e9e7a-b65e-494f-a5bb-43b2a1ead197.
"""

This exception, most probably, was caused by dhcp agent failing to find tap device:
"""
Stderr: 'Cannot find device "tap41e55d74-72"\n'
"""

The device indeed was missing, but after I restarted all services, it
did not appear.

** Affects: nova
     Importance: Undecided
         Status: New

** Summary changed:

- Exception should be raised if it failed to add fixed ip
+ Exception should be raised if nova has failed to add fixed ip

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1384228

Title:
  Exception should be raised if nova has failed to add fixed ip

Status in OpenStack Compute (Nova):
  New

Bug description:
  I have the following code

  try:
      instance.add_fixed_ip(network.id)
  except Exception as e:
      ...

  The issue is that in Nova compute logs I can see exception, but it is not thrown on client side. 
  Since add_fixed_ip() returns nothing, it is difficult to find if fixed address was assigned.

  Exception:
  """
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher Traceback (most recent call last):
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 134, in _dispatch_and_reply
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     incoming.message))
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 177, in _dispatch
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     return self._do_dispatch(endpoint, method, ctxt, args)
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 123, in _do_dispatch
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     result = getattr(endpoint, method)(ctxt, **new_args)
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/compute/manager.py", line 393, in decorated_function
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     return function(self, context, *args, **kwargs)
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/exception.py", line 88, in wrapped
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     payload)
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/openstack/common/excutils.py", line 68, in __exit__
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     six.reraise(self.type_, self.value, self.tb)
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/exception.py", line 71, in wrapped
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     return f(self, context, *args, **kw)
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/compute/manager.py", line 274, in decorated_function
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     pass
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/openstack/common/excutils.py", line 68, in __exit__
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     six.reraise(self.type_, self.value, self.tb)
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/compute/manager.py", line 260, in decorated_function
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     return function(self, context, *args, **kwargs)
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/compute/manager.py", line 303, in decorated_function
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     e, sys.exc_info())
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/openstack/common/excutils.py", line 68, in __exit__
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     six.reraise(self.type_, self.value, self.tb)
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/compute/manager.py", line 290, in decorated_function
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     return function(self, context, *args, **kwargs)
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/compute/manager.py", line 3621, in add_fixed_ip_to_instance
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     network_id)
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/network/api.py", line 49, in wrapper
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     res = f(self, context, *args, **kwargs)
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher   File "/home/vb/.virtualenvs/ecs/local/lib/python2.7/site-packages/nova/network/neutronv2/api.py", line 562, in add_fixed_ip_to_instance
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher     instance_id=instance['uuid'])
  2014-10-22 13:06:59.936 1015 TRACE oslo.messaging.rpc.dispatcher NetworkNotFoundForInstance: Network could not be found for instance b58e9e7a-b65e-494f-a5bb-43b2a1ead197.
  """

  This exception, most probably, was caused by dhcp agent failing to find tap device:
  """
  Stderr: 'Cannot find device "tap41e55d74-72"\n'
  """

  The device indeed was missing, but after I restarted all services, it
  did not appear.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1384228/+subscriptions


Follow ups

References