'FlatManager' object has no attribute 'allocate_floating_ip'

Bug #989746 reported by wangchangli
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Frederic Lepied

Bug Description

I am now using the FlatManager network mode, when I allocate a floating ip to a instance with nova api command:

nova floating-ip-create

I get the error log in the server side:

nova-api log:
2012-04-27 20:02:44 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/rpc/__init__.py", line 68, in call
2012-04-27 20:02:44 TRACE nova.api.openstack return _get_impl().call(context, topic, msg, timeout)
2012-04-27 20:02:44 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/rpc/impl_kombu.py", line 674, in call
2012-04-27 20:02:44 TRACE nova.api.openstack return rpc_amqp.call(context, topic, msg, timeout, Connection.pool)
2012-04-27 20:02:44 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/rpc/amqp.py", line 338, in call
2012-04-27 20:02:44 TRACE nova.api.openstack rv = list(rv)
2012-04-27 20:02:44 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/rpc/amqp.py", line 306, in __iter__
2012-04-27 20:02:44 TRACE nova.api.openstack raise result
2012-04-27 20:02:44 TRACE nova.api.openstack RemoteError: Remote error: AttributeError 'FlatManager' object has no attribute 'allocate_floating_ip'

nova-network log:
2012-04-27 20:02:44 TRACE nova.rpc.amqp Traceback (most recent call last):
2012-04-27 20:02:44 TRACE nova.rpc.amqp File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/rpc/amqp.py", line 249, in _process_data
2012-04-27 20:02:44 TRACE nova.rpc.amqp node_func = getattr(self.proxy, str(method))
2012-04-27 20:02:44 TRACE nova.rpc.amqp File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/service.py", line 213, in __getattr__
2012-04-27 20:02:44 TRACE nova.rpc.amqp return getattr(manager, key)
2012-04-27 20:02:44 TRACE nova.rpc.amqp AttributeError: 'FlatManager' object has no attribute 'allocate_floating_ip'

It is ok if I change the network mode to FlatDHCPManager. I read the nova source code and found that FloatingIP is the only class that have the "allocate_floating_ip" method and FlatDHCPManager is a subclass of this class, but class FlatManager is not a subclass of this class:

Code piece from network/manager.py:
class FlatDHCPManager(RPCAllocateFixedIP, FloatingIP, NetworkManager):

class FlatManager(NetworkManager):

class VlanManager(RPCAllocateFixedIP, FloatingIP, NetworkManager):

description: updated
Revision history for this message
Dan Smith (danms) wrote :

It looks like FlatManager stubbed out the floating ip methods from FloatingIP to avoid just this sort of thing, but missed several of them (including allocate_floating_ip). I think stubbing out the rest should complete the hack and avoid the crash, at least until it's implemented there properly.

Changed in nova:
status: New → Confirmed
tags: added: low-hanging-fruit
Thierry Carrez (ttx)
Changed in nova:
importance: Undecided → Medium
Andrew Laski (alaski)
Changed in nova:
assignee: nobody → Andrew Laski (alaski)
Andrew Laski (alaski)
Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/12212

Revision history for this message
Thierry Carrez (ttx) wrote :

Looks like you're not working on that anymore. Please set back to InProgress and reassign to you if you're working on proposing a change for merging.

Changed in nova:
assignee: Andrew Laski (alaski) → nobody
status: In Progress → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/20642

Changed in nova:
assignee: nobody → Frederic Lepied (flepied)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/20642
Committed: http://github.com/openstack/nova/commit/5640dab952b13a4ff7864a74d103e3d14b736b9e
Submitter: Jenkins
Branch: master

commit 5640dab952b13a4ff7864a74d103e3d14b736b9e
Author: Frederic Lepied <email address hidden>
Date: Mon Jan 28 22:16:54 2013 +0100

    Stub additional FloatingIP methods in FlatManager

    Fixes bug #989746.

    Added some stub methods for floating ip allocation in FlatManager in
    order to prevent exceptions from being raised when they are called.

    Changed get_floating_ip_by_address() in FlatManager to return a dict
    with expected keys for a floating ip, rather than None.

    Updated patch from Andrew Laski and added unit tests.

    Change-Id: I4ee1f5cf986b6f3411605aae5c1bc4e8cc2377b1

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → grizzly-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: grizzly-3 → 2013.1
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.