Bug 1530531

Summary: When removing router interface the provider doesn't remove the attachment to the subnet
Product: [oVirt] ovirt-provider-ovn Reporter: Mor <mkalfon>
Component: providerAssignee: Dominik Holler <dholler>
Status: CLOSED CURRENTRELEASE QA Contact: Mor <mkalfon>
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: bugs, danken, dholler, lveyde, myakove, ylavi
Target Milestone: ovirt-4.2.2Flags: ylavi: ovirt-4.2+
ylavi: exception+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-provider-ovn-1.2.7-2 Doc Type: Bug Fix
Doc Text:
Cause: When deleting a router attached to subnet ovirt-provider-ovn doesn't remove the attachment to the subnet. Consequence: It was not possible to delete the subnet. Fix: If there is a subnet associated with a router interface, on removing this interface the subnet is disconnected from the router, even if the interface is removed by a port. Result: It is possible to delete a subnet after it is detached from a router.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-29 11:02:30 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-03 09:45:01 UTC
Created attachment 1376235 [details]
ovirt-provider-ovn.log

Description of problem:
When creating OVN router, OVN network, OVN subnet attached to the OVN network, and adding router interface by subnet, if the router is deleted, it is impossible remove the subnet using the provider. Provider error is logged: "Unable to delete subnet <SUBNET_ID> because it is connected to router <ROUTER_ID>. Please disconnect the subnet from the router first."

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:
{
    "network": {
        "name": "test_network",
        "admin_state_up": true
    }
}

NOTE network_id in response.

2. Create OVN subnet and attach it to the OVN network:
{
    "subnet": {
        "name": "test_subnet",
        "network_id": "<OVN_NET_ID>",
        "ip_version": 4,
        "cidr": "<CIDR>/24",
        "gateway_ip": "<CIDR_GW>"
    }
}

NOTE subnet_id in response.

3. Create OVN router:
{
    "router": {
        "name": "test_router",
        "admin_state_up": true
    }
}

NOTE router_id in response.

4. Create interface router by subnet:
{
    "subnet_id": "<OVN_SUBNET_ID>"
}

5. Delete the router:
DELETE on https://<SERVER>:9696/v2.0/routers/<OVN_ROUTER_ID>

6. Try to delete the subnet:
DELETE on https://<SERVER>:9696/v2.0/subnets/<OVN_SUBNET_ID>
{
  "error": {
    "message": "Unable to delete subnet <SUBNET_ID> because it is connected to router <ROUTER_ID. Please disconnect the subnet from the router first.",
    "code": 400,
    "title": "Bad Request"
  }
}

Actual results:
You cannot remove the subnet from the provider using API requests, only by using OVN commands.

Expected results:
All interfaces of a router should be removed once the router is deleted.

Additional info:

Comment 1 Mor 2018-02-22 13:25:01 UTC
Verified on: ovirt-provider-ovn-1.2.7-2.el7ev.noarch

I used the following flow to verify the bug:
1. Create network.
2. Create subnet and attach it to network.
3. Create router.
4. Add interface to router by subnet from step 2.
5. Remove interface by subnet from step 2. --> Step needed to remove the subnet.
6. Remove the router.

Comment 2 Sandro Bonazzola 2018-03-29 11:02:30 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.