← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 2000078] Re: neutron-remove-duplicated-port-bindings doesn't remove binding_levels

 

Reviewed:  https://review.opendev.org/c/openstack/neutron/+/868301
Committed: https://opendev.org/openstack/neutron/commit/572185e1fd252772d8baaec099bf8bedfc837013
Submitter: "Zuul (22348)"
Branch:    master

commit 572185e1fd252772d8baaec099bf8bedfc837013
Author: Rodolfo Alonso Hernandez <ralonsoh@xxxxxxxxxx>
Date:   Mon Dec 12 05:10:01 2022 +0100

    Delete the PB level registers when deleting the duplicated PB
    
    The ``neutron-remove-duplicated-port-bindings`` script removes the
    duplicated port binding registers ("ml2_port_bindings" table) that
    have status=INACTIVE.
    
    This patch also removes the corresponding port binding levels
    ("ml2_port_binding_levels" table) associated to those inactive port
    bindings.
    
    Closes-Bug: #2000078
    
    Change-Id: I12fa0764cd0ff509f1859b61060d64cc5a54a7b9


** Changed in: neutron
       Status: In Progress => Fix Released

-- 
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:
  Fix Released

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



References