Contrail port-list does not have fixed-ips based filtering

Bug #1371035 reported by Babu Shanmugam
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
New
Undecided
Unassigned
R1.1
In Progress
Undecided
Babu Shanmugam
OpenContrail
Fix Committed
Undecided
Babu Shanmugam

Bug Description

While nova validates the network when creating an instance, there is a problem when a second instance is created with a v4-fixed-ip
   Steps to reproduce -
    1. Create a test-net
    2. Create a subnet for test-net
    3. Boot an instance with nic-id=test-net
    4. Boot another instance with nic-id=test-net,v4-fixed-ip=<an ip other than IP allocated to the first instance>
    5. Step 4 will fail, which it should not.

Tags: neutronapi
Babu Shanmugam (anbu-p)
Changed in opencontrail:
assignee: nobody → Babu Shanmugam (anbu-p)
status: New → In Progress
Revision history for this message
Vedamurthy Joshi (vedujoshi) wrote :

Babu,
 This is what i tried. But it seemed to get created fine. Am i missing anything ?

neutron net-create test-net
neutron subnet-create test-net 20.1.1.0/24
nova boot --flavor 2 --image $image_id --nic net-id=4b6eab13-69f3-408e-8cfc-0a19802d9d92 test_vm1 ( creates 20.1.1.2)
nova boot --flavor 2 --image $image_id --nic net-id=4b6eab13-69f3-408e-8cfc-0a19802d9d92,v4-fixed-ip=20.1.1.10 test_vm2

root@nodec22:~# nova list |grep test-net
| 01cfb703-0a8d-48b9-b797-02ff21c35149 | test_vm1 | ACTIVE | None | Running | test-net=20.1.1.2 |
| 466fc134-bdf2-41c2-b782-90353e271be8 | test_vm2 | ACTIVE | None | Running | test-net=20.1.1.10 |
root@nodec22:~#

Revision history for this message
Babu Shanmugam (anbu-p) wrote : Re: [Bug 1371035] Re: Contrail port-list does not have fixed-ips based filtering

Hi Vedamurthy,
This is surprising.
Following is my investigation on this issue,
* When we try to create an instance for the second time, nova validates
the network setting to check if there is already a port with the same
network settings request (please refer to
$NOVA_SRC/nova/network/neutronv2/api.py - API.validate_networks()).
* If you can see validate_networks() method, there will be a call to
list_ports with a fixed-ip filter
* Since the port_list function in vnc_openstack/neutron_plugin_db.py
<https://review.opencontrail.org/#/c/2916/1/src/config/vnc_openstack/vnc_openstack/neutron_plugin_db.py>
does not have a filter for fixed-ips, it returns the entire list of
ports (basically the port created for the first instance)
* But when nova sees that list_ports with fixed-ips filter is not empty,
it throws an exception.FixedIpAlreadyInUse.

I don't understand how it worked for you. If possible, can you please
check if you have the same code-flow? My nova code is somewhat old (the
last commit was on Aug 8), but my contrail code is somewhat latest (Aug
28).

You can also check my patch https://review.opencontrail.org/#/c/2916/
which attempts to fix this bug.

Thank you,
Babu

On Thursday 18 September 2014 11:30 PM, Vedamurthy Joshi wrote:
> Babu,
> This is what i tried. But it seemed to get created fine. Am i missing anything ?
>
> neutron net-create test-net
> neutron subnet-create test-net 20.1.1.0/24
> nova boot --flavor 2 --image $image_id --nic net-id=4b6eab13-69f3-408e-8cfc-0a19802d9d92 test_vm1 ( creates 20.1.1.2)
> nova boot --flavor 2 --image $image_id --nic net-id=4b6eab13-69f3-408e-8cfc-0a19802d9d92,v4-fixed-ip=20.1.1.10 test_vm2
>
> root@nodec22:~# nova list |grep test-net
> | 01cfb703-0a8d-48b9-b797-02ff21c35149 | test_vm1 | ACTIVE | None | Running | test-net=20.1.1.2 |
> | 466fc134-bdf2-41c2-b782-90353e271be8 | test_vm2 | ACTIVE | None | Running | test-net=20.1.1.10 |
> root@nodec22:~#
>

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/2916
Committed: http://github.org/Juniper/contrail-controller/commit/5e69809f88170c6c2b1258ef30bd4b5459f1730c
Submitter: Zuul
Branch: master

commit 5e69809f88170c6c2b1258ef30bd4b5459f1730c
Author: anbu <email address hidden>
Date: Thu Sep 18 10:13:50 2014 +0000

Implementing fixed-ips filter for port-list function

Closes-bug: #1371035

Change-Id: Iefa215a557fd4c6241cb15e58471f7a01fee6be5

Babu Shanmugam (anbu-p)
Changed in opencontrail:
status: In Progress → Fix Released
status: Fix Released → Fix Committed
tags: added: neutronapi
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R1.10

Review in progress for https://review.opencontrail.org/15308
Submitter: Jean-Philippe Braun (<email address hidden>)

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.