Bug 1194620

Summary: User shouldn't be allowed to create an interface with same identifier of any existing one
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: WebUIAssignee: Marek Hulan <mhulan>
WebUI sub component: Foreman QA Contact: Sachin Ghai <sghai>
Status: CLOSED CURRENTRELEASE Docs Contact:
Severity: medium    
Priority: unspecified CC: bkearney, dlobatog, jcallaha
Version: 6.1.0Keywords: Triaged
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/9618
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 13:55:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1193987    
Attachments:
Description Flags
Multiple interfaces with same identifier
none
Duplicate interface names
none
defined two interfaces with same identifier
none
error on creating an interface with an existing identifier name none

Description Sachin Ghai 2015-02-20 11:44:46 UTC
Description of problem:
I created an alias interface and define eth0 in identifier, Form was submitted without any validation error and UI accepted it.

Ideally UI should raise a validation error as you can't create two interfaces with same identifier

here is the snippet from provisioning template:

--
# primary interface
real=`ip -o link | grep 52:54:00:34:ac:fb | awk '{print $2;}' | sed s/://`

cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$real
BOOTPROTO="dhcp"
DEVICE="$real"
HWADDR="52:54:00:34:ac:fb"
ONBOOT=yes
EOF

# eth0 interface
real=`ip -o link | grep 52:54:00:34:ac:fb | awk '{print $2;}' | sed s/:$//`
  real=`echo eth0 | sed s/eth0/$real/`

cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$real
BOOTPROTO="none"
IPADDR="192.168.100.122"
NETMASK="255.255.255.248"
DEVICE="$real"
ONBOOT=yes
PEERDNS=no
PEERROUTES=no
EOF
---

Version-Release number of selected component (if applicable):
sat6.1 beta snap3
Satellite-6.1.0-RHEL-6-20150217.0

How reproducible:
always

Steps to Reproduce:
1. create a new host and add an interface with same identifier as of existing one
2.
3.

Actual results:
no validation error

Expected results:
validation error should be raised on form submation

Additional info:

Comment 1 Marek Hulan 2015-03-03 14:08:50 UTC
Created redmine issue http://projects.theforeman.org/issues/9618 from this bug

Comment 2 Bryan Kearney 2015-03-26 10:05:05 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/9618 has been closed
-------------
Marek Hulán
Applied in changeset commit:f2d5f95539b5070f5c7aba37196c45346140357d.

Comment 3 jcallaha 2015-03-27 20:00:05 UTC
Created attachment 1007460 [details]
Multiple interfaces with same identifier

FailedQA on Satellite-6.1.0-RHEL-7-20150324.0

I was able to create multiple interfaces with the same identifier name.

Comment 4 Marek Hulan 2015-03-29 07:03:50 UTC
moving back to POST, I think you tested it too early (it wasn't MODIFIED yet)

Comment 5 jcallaha 2015-03-30 13:37:40 UTC
It was moved to POST. Let me know when it should be good to test.

Comment 6 Marek Hulan 2015-03-30 15:00:51 UTC
I'd say when it's set to MODIFIED?

Comment 9 jcallaha 2015-05-13 18:18:25 UTC
Failed QA in Satellite 6.1 Snap 3. 
I was able to create interfaces with duplicate names. See attached screenshot.

Comment 10 jcallaha 2015-05-13 18:18:56 UTC
Created attachment 1025133 [details]
Duplicate interface names

Comment 11 Marek Hulan 2015-05-14 06:38:40 UTC
I think you didn't hit the submit button. You can add interfaces through modal window that are not valid, it's the same as if you enter something into text field. It's just prepares the host form and it's not instantly validated until sent to server. When you hit the blue submit button then it sends the data to server and validation is performed. Please re-verify and let me know if you have any questions.

Comment 12 Sachin Ghai 2015-05-15 11:51:02 UTC
I was trying to reproduce this issue with snap4 c2.

Now what happens when you define two interfaces with same identifier while creating a new host and submit the "new_host", the form neither submitted nor raises any error.

however production.log filled with error:

2015-05-15 16:38:01 [I] Failed to save: Interfaces some of interfaces are invalid

Comment 13 Sachin Ghai 2015-05-15 11:52:51 UTC
Created attachment 1025811 [details]
defined two interfaces with same identifier

Comment 15 Daniel Lobato Garcia 2015-05-18 17:31:40 UTC
Merged as 9515e3edea13e45b6a30c4138eb703f40f51f858

Comment 17 Sachin Ghai 2015-05-22 10:15:20 UTC
Verified with sat6.1 GA snap5

Now UI throws proper validation error if user tries to create an interface with an existing identifier name. Thanks for fixing this issue.

Comment 18 Sachin Ghai 2015-05-22 10:16:12 UTC
Created attachment 1028681 [details]
error on creating an interface with an existing identifier name

Comment 19 Bryan Kearney 2015-08-11 13:19:27 UTC
This bug is slated to be released with Satellite 6.1.

Comment 20 Bryan Kearney 2015-08-12 13:55:54 UTC
This bug was fixed in version 6.1.1 of Satellite which was released on 12 August, 2015.