← Back to team overview

openstack team mailing list archive

Re: [Netstack] Can't associate floating IP

 

Thanks, Vish. It works for me now.

Yapeng



On Feb 27, 2012, at 08:42 PM, Vishvananda Ishaya <vishvananda@xxxxxxxxx> wrote:

1) is not a quantum specific problem. There is a fix for the associate 500 here:

https://review.openstack.org/#change,4593
Vish

On Feb 27, 2012, at 1:02 PM, Yapeng Wu wrote:

Hello, Darragh,

I debugged further on these two problems, narrowed down further, the following are some detailed information, you could put them in the bug report.

1) Regarding of dashboard problem, it is caused by that the fixed ip address was not passed in properly when calling nova-network manager API.

2012-02-27 15:46:46 DEBUG nova.rpc.common [-] received {u'_context_roles': [u'admin', u'KeystoneAdmin', u'K
eystoneServiceAdmin'], u'_msg_id': u'95ece54eb00b4f079605e2c86c1b2e78', u'_context_read_deleted': u'no', u'
_context_request_id': u'req-94727efb-571f-4f18-84b5-e66ba67e0f46', u'args': {u'fixed_address': u'10.0.0.2',
 u'floating_address': 1, u'affect_auto_assigned': False}, u'_context_auth_token': u'0d94795a15df42cab25f38d
ad0e57832', u'_context_strategy': u'keystone', u'_context_is_admin': True, u'_context_project_id': u'f7cd00
c4da844d1fbbb0ebf8a111daa1', u'_context_timestamp': u'2012-02-27T20:46:46.486152', u'_context_user_id': u'4
0aac756d361448fb8e9ed9ae99421de', u'method': u'associate_floating_ip', u'_context_remote_address': u'10.122
.67.187'} from (pid=2192) _safe_log /opt/stack/nova/nova/rpc/common.py:144
2012-02-27 15:46:46 DEBUG nova.rpc.common [req-94727efb-571f-4f18-84b5-e66ba67e0f46 40aac756d361448fb8e9ed9
ae99421de f7cd00c4da844d1fbbb0ebf8a111daa1] unpacked context: {'request_id': u'req-94727efb-571f-4f18-84b5-
e66ba67e0f46', 'user_id': u'40aac756d361448fb8e9ed9ae99421de', 'roles': [u'admin', u'KeystoneAdmin', u'Keys
toneServiceAdmin'], 'timestamp': '2012-02-27T20:46:46.486152', 'is_admin': True, 'auth_token': u'0d94795a15
df42cab25f38dad0e57832', 'project_id': u'f7cd00c4da844d1fbbb0ebf8a111daa1', 'remote_address': u'10.122.67.1
87', 'read_deleted': u'no', 'strategy': u'keystone'} from (pid=2192) unpack_context /opt/stack/nova/nova/rp
c/amqp.py:186
2012-02-27 15:46:46 ERROR nova.rpc.common [-] Exception during message handling
(nova.rpc.common): TRACE: Traceback (most recent call last):
(nova.rpc.common): TRACE:   File "/opt/stack/nova/nova/rpc/amqp.py", line 250, in _process_data
(nova.rpc.common): TRACE:     rval = node_func(context=ctxt, **node_args)
(nova.rpc.common): TRACE:   File "/opt/stack/nova/nova/network/manager.py", line 239, in wrapped
(nova.rpc.common): TRACE:     return func(self, context, *args, **kwargs)
(nova.rpc.common): TRACE:   File "/opt/stack/nova/nova/network/manager.py", line 418, in associate_floating
_ip
(nova.rpc.common): TRACE:     floating_address)
(nova.rpc.common): TRACE:   File "/opt/stack/nova/nova/db/api.py", line 340, in floating_ip_get_by_address
(nova.rpc.common): TRACE:     return IMPL.floating_ip_get_by_address(context, address)
(nova.rpc.common): TRACE:   File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 119, in wrapper
(nova.rpc.common): TRACE:     return f(*args, **kwargs)
(nova.rpc.common): TRACE:   File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 854, in floating_ip_get_
by_address
(nova.rpc.common): TRACE:     raise exception.FloatingIpNotFoundForAddress(address=address)
(nova.rpc.common): TRACE: FloatingIpNotFoundForAddress: Floating ip not found for address 1.
(nova.rpc.common): TRACE:
2012-02-27 15:46:46 ERROR nova.rpc.common [-] Returning exception Floating ip not found for address 1. to caller
2012-02-27 15:46:46 ERROR nova.rpc.common [-] ['Traceback (most recent call last):\n', '  File "/opt/stack/nova/nova/rpc/amqp.py", line 250, in _process_data\n    rval = node_func(context=ctxt, **node_args)\n', '  File "/opt/stack/nova/nova/network/manager.py", line 239, in wrapped\n    return func(self, context, *args, **kwargs)\n', '  File "/opt/stack/nova/nova/network/manager.py", line 418, in associate_floating_ip\n    floating_address)\n', '  File "/opt/stack/nova/nova/db/api.py", line 340, in floating_ip_get_by_address\n    return IMPL.floating_ip_get_by_address(context, address)\n', '  File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 119, in wrapper\n    return f(*args, **kwargs)\n', '  File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 854, in floating_ip_get_by_address\n    raise exception.FloatingIpNotFoundForAddress(address=address)\n', 'FloatingIpNotFoundForAddress: Floating ip not found for address 1.\n']
2012-02-27 15:46:46 DEBUG nova.rpc.common [-] received {u'_context_roles': [u'admin', u'KeystoneAdmin', u'KeystoneServiceAdmin'], u'_msg_id': u'0fe592eba7dd4c65899739a3c5dac972', u'_context_read_deleted': u'no', u'_context_request_id': u'req-737909c1-2f4b-4ca1-a763-4be1ba3feb17', u'_context_auth_token': u'0d94795a15df42cab25f38dad0e57832', u'_context_strategy': u'keystone', u'_context_is_admin': True, u'_context_project_id': u'f7cd00c4da844d1fbbb0ebf8a111daa1', u'_context_timestamp': u'2012-02-27T20:46:46.966987', u'_context_user_id': u'40aac756d361448fb8e9ed9ae99421de', u'method': u'get_floating_ips_by_project', u'_context_remote_address': u'10.122.67.187'} from (pid=2192) _safe_log /opt/stack/nova/nova/rpc/common.py:144

2) For the second problem: command line issue, I found that it was due to the code in nova/network/manager.py, line 435 to 452:
        if network['multi_host']:
            instance = self.db.instance_get(context, fixed_ip['instance_id'])
            host = instance['host']
        else:
            host = network['host']
        interface = floating_ip['interface']
        if host == self.host:
            # i'm the correct host
            self._associate_floating_ip(context, floating_address,
                                        fixed_address, interface)
        else:
            # send to correct host
            rpc.cast(context,
                     self.db.queue_get_for(context, FLAGS.network_topic, host),
                     {'method': '_associate_floating_ip',
                      'args': {'floating_address': floating_address,
                               'fixed_address': fixed_address,
                               'interface': interface}})

The "host" should be self.host in this case, but not. So it calls rpc.cast. I thought host is read from the database by the 'instance_id'? I am not sure. If I "hacked" the code by calling self._associate_floating_ip directly, associate floating ip works.

Maybe someone familiar with nova-network code could help us on this.

Yapeng



On Feb 27, 2012, at 12:18 PM, Dan Wendlandt <dan@xxxxxxxxxx> wrote:

Hi Darragh,

Thanks for the detailed write-up. Would be great if you could take this content and create a bug on launchpad. We'll look into this. On a related note. The check in stack.sh to avoid creating a floating IP pool if quantum is enabled is no longer valid, now that Quantum Manager does (or at least intends to :P ) support floating IPs. But rather than remove it, it may be good to just change to the check to avoid creating floating IPs if melange is enabled, as Quantum Manager's current floating IP support requires using the traditional Nova IPAM, not Melange.
Dan


On Mon, Feb 27, 2012 at 6:38 AM, Darragh OReilly <darragh.oreilly@xxxxxxxxx> wrote:



    When I try to associate a floating IP from the dash I get:
    Error: Error associating Floating IP: Associate floating ip failed (HTTP 500)

    >From the command line I don't get any errors or exceptions on any of the screens after nova add-floating-ip, but the association does not happen. Are these steps right?

    thanks Darragh


    u1@u1110srv:~/devstack$ cat localrc
    LOGFILE=stacklog
    MYSQL_PASSWORD=nova
    RABBIT_PASSWORD=nova
    SERVICE_TOKEN=nova
    ADMIN_PASSWORD=nova
    SWIFT_HASH=nova
    ENABLED_SERVICES="g-api,g-reg,key,n-api,n-cpu,n-net,n-sch,n-vnc,horizon,mysql,rabbit,openstackx,n-vol,q-svc,q-agt,swift,quantum"
    Q_PLUGIN=openvswitch

    After running stack.sh have:

    u1@u1110srv:~/devstack$ nova-manage network list
id IPv4 IPv6 start address DNS1 DNS2 VlanID project uuid 2012-02-27 13:38:04 DEBUG nova.utils [req-7b6febc7-c8cd-49e5-ac48-5707c70d8bb5 None None] backend <module 'nova.db.sqlalchemy.api' from '/opt/stack/nova/nova/db/sqlalchemy/api.pyc'> from (pid=4776) __get_backend /opt/stack/nova/nova/utils.py:603
    1        10.0.0.0/24           None               10.0.0.2           8.8.4.4            None               None               None               20cda3a7-f4a8-4b3c-b399-4dd624cb7a40


    u1@u1110srv:~/devstack$ TENANT=
    u1@u1110srv:~/devstack$ USERNAME=
    u1@u1110srv:~/devstack$ . openrc
    u1@u1110srv:~/devstack$

    u1@u1110srv:~/devstack$ nova boot --flavor 6 --image 21b0573e-8dd6-4b42-9c01-4c8684b0b080 guest1


    u1@u1110srv:~/devstack$ nova show guest1
    +-------------------+----------------------------------------------------------+
    |      Property     |                          Value                           |
    +-------------------+----------------------------------------------------------+
    | OS-DCF:diskConfig | MANUAL                                                   |
    | accessIPv4        |                                                          |
    | accessIPv6        |                                                          |
    | config_drive      |                                                          |
    | created           | 2012-02-27T13:49:00Z                                     |
    | flavor            | micro                                                    |
    | hostId            | 372f92b8889526d07feaa81ec5ab9bb80228350db4cfa563c15baf6f |
    | id                | 3d931521-9ea2-4344-ad52-13faf4172e96                     |
    | image             | cirros-0.3.0-x86_64-blank                                |
    | key_name          |                                                          |
    | metadata          | {}                                                       |
    | name              | guest1                                                   |
    | private network   | 10.0.0.2                                                 |
    | progress          | None                                                     |
    | status            | ACTIVE                                                   |
    | tenant_id         | 5b5a2c42b5874058962c6f543ee91c72                         |
    | updated           | 2012-02-27T13:49:30Z                                     |
    | user_id           | demo                                                     |
    +-------------------+----------------------------------------------------------+


    u1@u1110srv:~/devstack$ ssh cirros@10.0.0.2
    The authenticity of host '10.0.0.2 (10.0.0.2)' can't be established.
    RSA key fingerprint is ed:b0:be:78:26:23:2a:8d:81:22:84:84:f0:6c:ec:3c.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '10.0.0.2' (RSA) to the list of known hosts.
    cirros@10.0.0.2's password:
    $ ping www.openstack.org
    PING www.openstack.org (98.129.229.144): 56 data bytes
    64 bytes from 98.129.229.144: seq=1 ttl=61 time=182.020 ms
    64 bytes from 98.129.229.144: seq=2 ttl=61 time=182.166 ms
    ^C
    --- www.openstack.org ping statistics ---
    3 packets transmitted, 2 packets received, 33% packet loss
    round-trip min/avg/max = 182.020/182.093/182.166 ms
    $ Connection to 10.0.0.2 closed.
    u1@u1110srv:~/devstack$


    stack.sh is not creating any floating range with quantum enabled:

       if is_service_enabled q-svc; then
            echo "Not creating floating IPs (not supported by QuantumManager)"
        else
            # create some floating ips
            $NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE

            # create a second pool
            $NOVA_DIR/bin/nova-manage floating create --ip_range=$TEST_FLOATING_RANGE --pool=$TEST_FLOATING_POOL
        fi


    u1@u1110srv:~/devstack$ nova-manage floating create --ip_range=172.241.1.0/24 --interface=eth2

    u1@u1110srv:~/devstack$ nova-manage floating list 2>/dev/null | head -3
    None    172.241.1.1    None    nova    eth2
    None    172.241.1.2    None    nova    eth2
    None    172.241.1.3    None    nova    eth2

    u1@u1110srv:~/devstack$ nova floating-ip-create
    +-------------+-------------+----------+------+
    |      Ip     | Instance Id | Fixed Ip | Pool |
    +-------------+-------------+----------+------+
    | 172.241.1.1 | None        | None     | nova |
    +-------------+-------------+----------+------+

    u1@u1110srv:~/devstack$ nova add-floating-ip guest1 172.241.1.1
    u1@u1110srv:~/devstack$ echo $?
    0
    u1@u1110srv:~/devstack$ nova floating-ip-list
    +-------------+-------------+----------+------+
    |      Ip     | Instance Id | Fixed Ip | Pool |
    +-------------+-------------+----------+------+
    | 172.241.1.1 | None        | None     | nova |
    +-------------+-------------+----------+------+

    u1@u1110srv:~/devstack$ ip link show dev eth2
    2: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
        link/ether 08:00:27:1a:5c:69 brd ff:ff:ff:ff:ff:ff

    u1@u1110srv:~/devstack$ sudo iptables -t nat -vnL | grep -i float
    Chain nova-api-float-snat (1 references)
81 4863 nova-api-float-snat all -- * * 0.0.0.0/0 0.0.0.0/0 Chain nova-compute-float-snat (1 references) 82 4947 nova-compute-float-snat all -- * * 0.0.0.0/0 0.0.0.0/0 Chain nova-manage-float-snat (1 references) 81 4863 nova-manage-float-snat all -- * * 0.0.0.0/0 0.0.0.0/0 Chain nova-network-float-snat (1 references) 82 4947 nova-network-float-snat all -- * * 0.0.0.0/0 0.0.0.0/0

    --
    Mailing list: https://launchpad.net/~netstack
    Post to     : netstack@xxxxxxxxxxxxxxxxxxx
    Unsubscribe : https://launchpad.net/~netstack
    More help   : https://help.launchpad.net/ListHelp




--
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dan Wendlandt Nicira Networks: www.nicira.com
twitter: danwendlandt
~~~~~~~~~~~~~~~~~~~~~~~~~~~

--
Mailing list: https://launchpad.net/~netstack
Post to : netstack@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~netstack
More help : https://help.launchpad.net/ListHelp
_______________________________________________
Mailing list: https://launchpad.net/~openstack
Post to     : openstack@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


References