Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1608408

Summary: Listing ports fails when stray subnet is present in db
Product: [oVirt] ovirt-provider-ovn Reporter: Marcin Mirecki <mmirecki>
Component: providerAssignee: Marcin Mirecki <mmirecki>
Status: CLOSED CURRENTRELEASE QA Contact: Michael Burman <mburman>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.2.7CC: bugs, danken, mburman, mmirecki, ylavi
Target Milestone: ovirt-4.2.6Flags: rule-engine: ovirt-4.2+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-provider-ovn-1.2.14 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-09-03 15:07:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Network RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marcin Mirecki 2018-07-25 13:19:52 UTC
Listing ports fails when stray subnet is present in db.

Stray subnets can appear in the db if the user deletes
a network outside of the provider. This leaves some
references in the db in a corrupted state. Deleting
entities outside of the provider is not supported,
but it should not affect working with other entities
present in the db.

The relevant log messages:

ElementNotFoundError: Cannot find Logical_Switch with name=7aead74b-9b81-4206-8ba3-5e0aa9b183aa
2018-07-25 13:48:51,100 root From: 10.35.128.15:54124 Request: GET /v2.0/ports?id=19ca17aa-7519-4a2a-8c2b-eabfc669b8ff
2018-07-25 13:48:51,103 requests.packages.urllib3.connectionpool Starting new HTTPS connection (1): mburman-4-upgrade-env.scl.lab.tlv.redhat.com
2018-07-25 13:48:51,146 requests.packages.urllib3.connectionpool "POST /ovirt-engine/sso/oauth/token-info HTTP/1.1" 200 323
2018-07-25 13:48:51,450 ovsdbapp.backend.ovs_idl.transaction Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ovsdbapp/backend/ovs_idl/connection.py", line 100, in run
    txn.results.put(txn.do_commit())
  File "/usr/lib/python2.7/site-packages/ovsdbapp/backend/ovs_idl/transaction.py", line 86, in do_commit
    command.run_idl(txn)
  File "/usr/lib/python2.7/site-packages/ovsdbapp/backend/ovs_idl/command.py", line 246, in run_idl
    self.result = self.api.lookup(self.table, self.record)
  File "/usr/lib/python2.7/site-packages/ovsdbapp/backend/ovs_idl/__init__.py", line 103, in lookup
    return self._lookup(table, record)
  File "/usr/lib/python2.7/site-packages/ovsdbapp/backend/ovs_idl/__init__.py", line 143, in _lookup
    row = idlutils.row_by_value(self, rl.table, rl.column, record)
  File "/usr/lib/python2.7/site-packages/ovsdbapp/backend/ovs_idl/idlutils.py", line 63, in row_by_value
    raise RowNotFound(table=table, col=column, match=match)
RowNotFound: Cannot find Logical_Switch with name=7aead74b-9b81-4206-8ba3-5e0aa9b183aa

Comment 1 Michael Burman 2018-08-15 13:58:37 UTC
Verified on - ovirt-provider-ovn-1.2.14-1.el7ev.noarch with
4.2.6.3_SNAPSHOT-94.gbbcd5cb.0.scratch.master.el7ev
vdsm-4.20.37-1.el7ev.x86_64
openvswitch-ovn-central-2.9.0-55.el7fdp.x86_64
openvswitch-ovn-common-2.9.0-55.el7fdp.x86_64

- Note that if removing a logical switch(network), but leaving it's subnet stray, we still see this multiple errors in the ovirt-provider.log


2018-08-15 16:43:34,898 ovsdbapp.backend.ovs_idl.command Error executing command
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ovsdbapp/backend/ovs_idl/command.py", line 35, in execute
    txn.add(self)
  File "/usr/lib64/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/usr/lib/python2.7/site-packages/ovsdbapp/api.py", line 94, in transaction
    self._nested_txn = None
  File "/usr/lib/python2.7/site-packages/ovsdbapp/api.py", line 54, in __exit__
    self.result = self.commit()
  File "/usr/lib/python2.7/site-packages/ovsdbapp/backend/ovs_idl/transaction.py", line 62, in commit
    raise result.ex
RowNotFound: Cannot find Logical_Switch with name=4cc5441d-d3b7-48e3-a31e-e17b75ad5f16

- But now all the other entities in db are not affected and we still may continue working and run VMs with ovn networks. 
Marcin, the errors(about missing ls) in the provider.log are expected correct?

Comment 2 Marcin Mirecki 2018-08-27 07:59:41 UTC
The error is raised, but we handle it.
I would rather leave this in the log, it shows us that there are some problems with the db consistency, which would otherwise go unnoticed forever.