Bug 1503577

Summary: Duplicate OVN network name (with subnet) on different DCs pops unfriendly UI message
Product: [oVirt] ovirt-provider-ovn Reporter: Mor <mkalfon>
Component: providerAssignee: Miguel Duarte Barroso <mduarted>
Status: CLOSED CURRENTRELEASE QA Contact: msheena
Severity: low Docs Contact:
Priority: low    
Version: 1.0.4CC: bugs, danken, mburman, mduarted, mmirecki, ylavi
Target Milestone: ovirt-4.2.6Flags: rule-engine: ovirt-4.2+
rule-engine: ovirt-4.3+
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:08:21 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
logs + screenshot none

Description Mor 2017-10-18 12:20:31 UTC
Created attachment 1340163 [details]
logs + screenshot

Description of problem:
Creation of duplicate OVN networks on different oVirt Data Centers, pops unfriendly UI error message:
"
Error while executing action:

    may not be null
    Attribute: networkId
"

Version-Release number of selected component (if applicable):
4.2.0-0.0.master.20171013142622.git15e767c.el7.centos
ovirt-provider-ovn-1.2-0.20171013135342.git023d6ce.el7.centos.noarch

How reproducible:
100%

Steps to Reproduce:
1. Create OVN network 'ovn_network_1' with subnet (supply CIDR) on DC1.  
2. Try to create additional duplicate network name 'ovn_network_1' with subnet (supply CIDR) on the default DC.
3. UI shows an error (screenshot is attached to the ticket).

Actual results:
Unfriendly message.

Expected results:
Should be handled in UI (validation or better error message) or in engine (should block duplicate names).

Comment 1 Dan Kenigsberg 2017-10-19 09:18:39 UTC
Since OVN does not support it, we should not allow net name dups. We should have a clearer error message, though.

Comment 2 Marcin Mirecki 2017-12-15 10:33:32 UTC
self.idl.ls_add(switch=name, may_exist=False).execute() just exits cleanly if name is a duplicate

Two solution for this:
- better log message - must validate the logical switch exists before adding it
- allow duplicate names - store actual name in external_ids

Comment 3 Miguel Duarte Barroso 2018-07-16 09:22:38 UTC
Patch posted: https://gerrit.ovirt.org/#/c/92177/

Comment 4 Miguel Duarte Barroso 2018-08-07 14:36:33 UTC
Instead of updating the ui to throw a better error message, the ovirt-provider-ovn service was updated to *allow* networks having the same name.

This suggestion can be seen in comment#2: 'allow duplicate names - store actual name in external_ids'.

To verify the bug, you should check that indeed networks with the same name are allowed - e.g. no UI error thrown.

To further verify it, you could use ovn-nbctl in engine node to check the data of the networks:

 - ovn-nbctl list logical_switch

You should see multiple logical switches with names in the following format: ovirt-<network_name>-<generated_uuid>. 

Each of those logical switches should have the user specified name in its external ids column - one entry like 'name: <user_specified_name>'

Comment 5 msheena 2018-08-13 14:02:55 UTC
 Verified according to comment #4 on:
ovirt-engine-4.2.6-0.1.el7ev.noarch
ovirt-provider-ovn-1.2.14-1.el7ev.noarch
openvswitch-ovn-common-2.9.0-55.el7fdp.x86_64
openvswitch-ovn-central-2.9.0-55.el7fdp.x86_64