Public bug reported: I'm trying to do an INACTIVE port binding cleanup using neutron-remove-duplicated-port-bindings tool from #1979072 But I found an issue with this help tool: it doens't remove entries from the ml2_port_binding_levels table that still blocks new port binding to the host.
Demo: 1) create VM and bind a port to another host: $ openstack port create my-port --network private --device-owner compute:test -> get port port ID -> 075c4058-2933-4f6f-90a9-f754e81cef52 $ curl -k -H "x-auth-token: $t" -H "Content-Type: application/json" -X POST http://10.136.16.186:9696/networking/v2.0/ports/075c4058-2933-4f6f-90a9-f754e81cef52/bindings -d '{"binding": {"host": "ak-dev2"}}' MariaDB [neutron]> select port_id,host,vif_type,status from ml2_port_bindings where port_id='075c4058-2933-4f6f-90a9-f754e81cef52'; +--------------------------------------+---------+----------+----------+ | port_id | host | vif_type | status | +--------------------------------------+---------+----------+----------+ | 075c4058-2933-4f6f-90a9-f754e81cef52 | ak-dev1 | ovs | ACTIVE | | 075c4058-2933-4f6f-90a9-f754e81cef52 | ak-dev2 | ovs | INACTIVE | +--------------------------------------+---------+----------+----------+ 2 rows in set (0.000 sec) MariaDB [neutron]> select * from ml2_port_binding_levels where port_id='075c4058-2933-4f6f-90a9-f754e81cef52'; +--------------------------------------+---------+-------+-------------+--------------------------------------+ | port_id | host | level | driver | segment_id | +--------------------------------------+---------+-------+-------------+--------------------------------------+ | 075c4058-2933-4f6f-90a9-f754e81cef52 | ak-dev1 | 0 | openvswitch | 2250e731-0046-46ae-8cf0-8da7fd3aad98 | | 075c4058-2933-4f6f-90a9-f754e81cef52 | ak-dev2 | 0 | openvswitch | 2250e731-0046-46ae-8cf0-8da7fd3aad98 | +--------------------------------------+---------+-------+-------------+--------------------------------------+ 2 rows in set (0.000 sec) MariaDB [neutron]> 2) remove INACTIVE port bindings via neutron-remove-duplicated-port-bindings: $ neutron-remove-duplicated-port-bindings --config-file /etc/neutron/neutron.conf MariaDB [neutron]> select port_id,host,vif_type,status from ml2_port_bindings where port_id='075c4058-2933-4f6f-90a9-f754e81cef52'; +--------------------------------------+---------+----------+--------+ | port_id | host | vif_type | status | +--------------------------------------+---------+----------+--------+ | 075c4058-2933-4f6f-90a9-f754e81cef52 | ak-dev1 | ovs | ACTIVE | +--------------------------------------+---------+----------+--------+ 1 row in set (0.000 sec) MariaDB [neutron]> select * from ml2_port_binding_levels where port_id='075c4058-2933-4f6f-90a9-f754e81cef52'; +--------------------------------------+---------+-------+-------------+--------------------------------------+ | port_id | host | level | driver | segment_id | +--------------------------------------+---------+-------+-------------+--------------------------------------+ | 075c4058-2933-4f6f-90a9-f754e81cef52 | ak-dev1 | 0 | openvswitch | 2250e731-0046-46ae-8cf0-8da7fd3aad98 | | 075c4058-2933-4f6f-90a9-f754e81cef52 | ak-dev2 | 0 | openvswitch | 2250e731-0046-46ae-8cf0-8da7fd3aad98 | +--------------------------------------+---------+-------+-------------+--------------------------------------+ 2 rows in set (0.000 sec) MariaDB [neutron]> 3) Create the port binding again. It fails: $ # curl -k -H "x-auth-token: $t" -H "Content-Type: application/json" -X POST http://10.136.16.186:9696/networking/v2.0/ports/075c4058-2933-4f6f-90a9-f754e81cef52/bindings -d '{"binding": {"host": "ak-dev2"}}' {"NeutronError": {"type": "NeutronDbObjectDuplicateEntry", "message": "Failed to create a duplicate PortBindingLevel: for attribute(s) ['PRIMARY'] with value(s) 075c4058-2933-4f6f-90a9-f754e81cef52-ak-dev2-0", "detail": ""}} ** Affects: neutron Importance: Undecided Status: New -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/2000078 Title: neutron-remove-duplicated-port-bindings doesn't remove binding_levels Status in neutron: New Bug description: I'm trying to do an INACTIVE port binding cleanup using neutron-remove-duplicated-port-bindings tool from #1979072 But I found an issue with this help tool: it doens't remove entries from the ml2_port_binding_levels table that still blocks new port binding to the host. Demo: 1) create VM and bind a port to another host: $ openstack port create my-port --network private --device-owner compute:test -> get port port ID -> 075c4058-2933-4f6f-90a9-f754e81cef52 $ curl -k -H "x-auth-token: $t" -H "Content-Type: application/json" -X POST http://10.136.16.186:9696/networking/v2.0/ports/075c4058-2933-4f6f-90a9-f754e81cef52/bindings -d '{"binding": {"host": "ak-dev2"}}' MariaDB [neutron]> select port_id,host,vif_type,status from ml2_port_bindings where port_id='075c4058-2933-4f6f-90a9-f754e81cef52'; +--------------------------------------+---------+----------+----------+ | port_id | host | vif_type | status | +--------------------------------------+---------+----------+----------+ | 075c4058-2933-4f6f-90a9-f754e81cef52 | ak-dev1 | ovs | ACTIVE | | 075c4058-2933-4f6f-90a9-f754e81cef52 | ak-dev2 | ovs | INACTIVE | +--------------------------------------+---------+----------+----------+ 2 rows in set (0.000 sec) MariaDB [neutron]> select * from ml2_port_binding_levels where port_id='075c4058-2933-4f6f-90a9-f754e81cef52'; +--------------------------------------+---------+-------+-------------+--------------------------------------+ | port_id | host | level | driver | segment_id | +--------------------------------------+---------+-------+-------------+--------------------------------------+ | 075c4058-2933-4f6f-90a9-f754e81cef52 | ak-dev1 | 0 | openvswitch | 2250e731-0046-46ae-8cf0-8da7fd3aad98 | | 075c4058-2933-4f6f-90a9-f754e81cef52 | ak-dev2 | 0 | openvswitch | 2250e731-0046-46ae-8cf0-8da7fd3aad98 | +--------------------------------------+---------+-------+-------------+--------------------------------------+ 2 rows in set (0.000 sec) MariaDB [neutron]> 2) remove INACTIVE port bindings via neutron-remove-duplicated-port-bindings: $ neutron-remove-duplicated-port-bindings --config-file /etc/neutron/neutron.conf MariaDB [neutron]> select port_id,host,vif_type,status from ml2_port_bindings where port_id='075c4058-2933-4f6f-90a9-f754e81cef52'; +--------------------------------------+---------+----------+--------+ | port_id | host | vif_type | status | +--------------------------------------+---------+----------+--------+ | 075c4058-2933-4f6f-90a9-f754e81cef52 | ak-dev1 | ovs | ACTIVE | +--------------------------------------+---------+----------+--------+ 1 row in set (0.000 sec) MariaDB [neutron]> select * from ml2_port_binding_levels where port_id='075c4058-2933-4f6f-90a9-f754e81cef52'; +--------------------------------------+---------+-------+-------------+--------------------------------------+ | port_id | host | level | driver | segment_id | +--------------------------------------+---------+-------+-------------+--------------------------------------+ | 075c4058-2933-4f6f-90a9-f754e81cef52 | ak-dev1 | 0 | openvswitch | 2250e731-0046-46ae-8cf0-8da7fd3aad98 | | 075c4058-2933-4f6f-90a9-f754e81cef52 | ak-dev2 | 0 | openvswitch | 2250e731-0046-46ae-8cf0-8da7fd3aad98 | +--------------------------------------+---------+-------+-------------+--------------------------------------+ 2 rows in set (0.000 sec) MariaDB [neutron]> 3) Create the port binding again. It fails: $ # curl -k -H "x-auth-token: $t" -H "Content-Type: application/json" -X POST http://10.136.16.186:9696/networking/v2.0/ports/075c4058-2933-4f6f-90a9-f754e81cef52/bindings -d '{"binding": {"host": "ak-dev2"}}' {"NeutronError": {"type": "NeutronDbObjectDuplicateEntry", "message": "Failed to create a duplicate PortBindingLevel: for attribute(s) ['PRIMARY'] with value(s) 075c4058-2933-4f6f-90a9-f754e81cef52-ak-dev2-0", "detail": ""}} To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/2000078/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

