Nova deletes first preexisting port if second was attached to instance

Bug #1433524 reported by Andrey Pavlov
20
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Davanum Srinivas (DIMS)

Bug Description

based on this change - https://github.com/openstack/nova/commit/1153a46738fc3ffff98a1df9d94b5a55fdd58777

If I boot instance with preexisting port and delete this instance then port remains.
But If I boot instance with preexisting port and attach one more port then first port is deleted while I delete the instance.

1) Create port with neutron
| 81c98edb-06ac-4286-ad7a-2edeb901474b | | fa:16:3e:5b:1d:c6 | {"subnet_id": "71b456c2-4805-4905-a8d8-9293e162f917", "ip_address": "172.24.4.4"} |
2) Run instance with this port
(0):~/devstack$ nova boot ttt --flavor 42 --image aab2d892-636d-4bde-8636-71f8ffd3c51d --nic port-id=81c98edb-06ac-4286-ad7a-2edeb901474b

port list -
~/devstack$ neutron port-list
+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------------+
| id | name | mac_address | fixed_ips |
+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------------+
| 81c98edb-06ac-4286-ad7a-2edeb901474b | | fa:16:3e:5b:1d:c6 | {"subnet_id": "71b456c2-4805-4905-a8d8-9293e162f917", "ip_address": "172.24.4.4"} |
| a92337de-d3f2-4a5c-beb4-54bd48ec043f | | fa:16:3e:41:b9:00 | {"subnet_id": "134b9bd5-da87-4b8f-880d-72e24206a721", "ip_address": "10.0.0.1"} |
| e59d3841-215a-4352-a212-d5cac5cb7bbe | | fa:16:3e:06:4b:27 | {"subnet_id": "134b9bd5-da87-4b8f-880d-72e24206a721", "ip_address": "10.0.0.2"} |
| fa67a224-907e-4c11-bcae-9d919330c6b8 | | fa:16:3e:5e:2d:a7 | {"subnet_id": "71b456c2-4805-4905-a8d8-9293e162f917", "ip_address": "172.24.4.2"} |
+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------------+

3) Create another port
(0):~/devstack$ neutron port-create public
| fixed_ips | {"subnet_id": "71b456c2-4805-4905-a8d8-9293e162f917", "ip_address": "172.24.4.8"} |
| id | a26c8bc0-ea94-4abb-9ffc-752a594e08e7 |

4) attach port to the instance
(0):~/devstack$ nova interface-attach --port-id a26c8bc0-ea94-4abb-9ffc-752a594e08e7 ttt

5) check instance ports -
(0):~/devstack$ nova interface-list ttt
+------------+--------------------------------------+--------------------------------------+--------------+-------------------+
| Port State | Port ID | Net ID | IP addresses | MAC Addr |
+------------+--------------------------------------+--------------------------------------+--------------+-------------------+
| DOWN | 81c98edb-06ac-4286-ad7a-2edeb901474b | 1e629e00-28b6-4a67-9940-dee2660a23a8 | 172.24.4.4 | fa:16:3e:5b:1d:c6 |
| DOWN | a26c8bc0-ea94-4abb-9ffc-752a594e08e7 | 1e629e00-28b6-4a67-9940-dee2660a23a8 | 172.24.4.8 | fa:16:3e:a1:74:eb |
+------------+--------------------------------------+--------------------------------------+--------------+-------------------+
(0):~/devstack$ neutron port-list
+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------------+
| id | name | mac_address | fixed_ips |
+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------------+
| 81c98edb-06ac-4286-ad7a-2edeb901474b | | fa:16:3e:5b:1d:c6 | {"subnet_id": "71b456c2-4805-4905-a8d8-9293e162f917", "ip_address": "172.24.4.4"} |
| a26c8bc0-ea94-4abb-9ffc-752a594e08e7 | | fa:16:3e:a1:74:eb | {"subnet_id": "71b456c2-4805-4905-a8d8-9293e162f917", "ip_address": "172.24.4.8"} |
| a92337de-d3f2-4a5c-beb4-54bd48ec043f | | fa:16:3e:41:b9:00 | {"subnet_id": "134b9bd5-da87-4b8f-880d-72e24206a721", "ip_address": "10.0.0.1"} |
| e59d3841-215a-4352-a212-d5cac5cb7bbe | | fa:16:3e:06:4b:27 | {"subnet_id": "134b9bd5-da87-4b8f-880d-72e24206a721", "ip_address": "10.0.0.2"} |
| fa67a224-907e-4c11-bcae-9d919330c6b8 | | fa:16:3e:5e:2d:a7 | {"subnet_id": "71b456c2-4805-4905-a8d8-9293e162f917", "ip_address": "172.24.4.2"} |
+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------------+

6) delete instance and check ports in neutron -

(0):~/devstack$ neutron port-list
+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------------+
| id | name | mac_address | fixed_ips |
+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------------+
| a26c8bc0-ea94-4abb-9ffc-752a594e08e7 | | fa:16:3e:a1:74:eb | {"subnet_id": "71b456c2-4805-4905-a8d8-9293e162f917", "ip_address": "172.24.4.8"} |
| a92337de-d3f2-4a5c-beb4-54bd48ec043f | | fa:16:3e:41:b9:00 | {"subnet_id": "134b9bd5-da87-4b8f-880d-72e24206a721", "ip_address": "10.0.0.1"} |
| e59d3841-215a-4352-a212-d5cac5cb7bbe | | fa:16:3e:06:4b:27 | {"subnet_id": "134b9bd5-da87-4b8f-880d-72e24206a721", "ip_address": "10.0.0.2"} |
| fa67a224-907e-4c11-bcae-9d919330c6b8 | | fa:16:3e:5e:2d:a7 | {"subnet_id": "71b456c2-4805-4905-a8d8-9293e162f917", "ip_address": "172.24.4.2"} |
+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------------+

Expected result - all preexisting ports remain in my system after instance deletion.

Matt Riedemann (mriedem)
tags: added: neutron
Changed in nova:
importance: Undecided → Medium
tags: added: network
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

Andrey,

Can you please try to see if this patch works for you?
https://review.openstack.org/#/c/165608/

thanks,
dims

Revision history for this message
Andrey Pavlov (apavlov-e) wrote :

Davanum,
Yes, this patch fixes this case and it works for me now.

Changed in nova:
assignee: nobody → Davanum Srinivas (DIMS) (dims-v)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/165608
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=58295fa8121f76729201135b660041cbe716981b
Submitter: Jenkins
Branch: master

commit 58295fa8121f76729201135b660041cbe716981b
Author: Davanum Srinivas <email address hidden>
Date: Wed Mar 18 17:17:55 2015 -0400

    Fix for deletes first preexisting port if second was attached to instance

    In Ia5367cf064d40690670ffeac3c1f16998464c234, we added a capability
    to preserve preexisting ports on server delete. There was one scenario
    that broken as a result as reported in the bug.
    "If I boot instance with preexisting port and attach one more port
    then first port is deleted while I delete the instance."

    Essentially we have to lookup get_preexisting_port_ids during
    boot as well as when we are attaching an interface.

    Closes-Bug: #1433524
    Change-Id: I3d557dd95f442106c495249a5ef1d2ac36e6a2ea

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