Bug 1531112

Summary: Remove router interface should remove the port from the switch
Product: [oVirt] ovirt-provider-ovn Reporter: Mor <mkalfon>
Component: providerAssignee: Dominik Holler <dholler>
Status: CLOSED CURRENTRELEASE QA Contact: Mor <mkalfon>
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: bugs, danken, dholler, lveyde, myakove, ylavi
Target Milestone: ovirt-4.2.2Flags: rule-engine: ovirt-4.2+
rule-engine: exception+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-provider-ovn-1.2.7-2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-29 10:58:42 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:
Attachments:
Description Flags
ovirt-provider-ovn.log none

Description Mor 2018-01-04 15:40:28 UTC
Description of problem:
When you connect a router to a network (switch in OVS terms) using add router interface by subnet, and then remove the router interface, it should remove the port assigned for the network. 

If you try to delete the network, you will get an error about a port already attached to it, but this port is detached by the remove interface operation: 
HTTP code 400 "Unable to delete network <NETWORK_ID>. Ports exist for the network".

Version-Release number of selected component (if applicable):
ovirt-provider-ovn-1.2.2-1.el7ev.noarch

How reproducible:
100%

Steps to Reproduce:
1. Create OVN network, create and attach subnet to it.
2. Create OVN router.
3. Add router interface by subnet and attach the subnet ID from step 1.
4. Remove interface from router using the subnet ID from step 1.
5. Try to remove the network from the provider.

Actual results:
See description for error message.

Expected results:
Should work.

Additional info:
https://developer.openstack.org/api-ref/network/v2/#remove-interface-from-router
Remove router interface states:
- This operation deletes an internal router interface, which detaches a subnet from the router. If this subnet ID is the last subnet on the port, this operation deletes the port itself.

Workaround: 
Look for the unassigned port and delete it, then remove the network.

Comment 1 Mor 2018-01-04 15:48:30 UTC
Created attachment 1377001 [details]
ovirt-provider-ovn.log

Comment 2 Mor 2018-02-22 12:08:33 UTC
Verified on: RHV 4.2.2.1-0.1.el7

Comment 3 Sandro Bonazzola 2018-03-29 10:58:42 UTC
This bugzilla is included in oVirt 4.2.2 release, published on March 28th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.2 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.