There's a special case in the update_port_precommit() method to handle
the case where an existing port is being added to a router. The method
will try to create an entry in the ovn_revision_numbers table but, if
that entry is already present a DBDuplicateEntry exception will be
raised and the whole update method will fail.
The update_port_precommit() is the only method at present that have this
special handler, for all other resources creating a new record in the
ovn_revision_numbers table happens at the create_*_precommit() methods
(this include create_port_precommit() as well).
This patch is fixing the problem by adding a new parameter to the
reate_initial_revision() method called "may_exist". When set to True the
code will not raise an DBDuplicateEntry if the record already exists. By
default this method is False.
Signed-off-by: Lucas Alvares Gomes <email@example.com>
(cherry picked from commit