Bug 2222971

Summary: [vm-cloning] Validation of VM macAddress does not work with mixed delimiters (":" and "-")
Product: Container Native Virtualization (CNV) Reporter: Denys Shchedrivyi <dshchedr>
Component: VirtualizationAssignee: sgott
Status: NEW --- QA Contact: Kedar Bidarkar <kbidarka>
Severity: medium Docs Contact:
Priority: high    
Version: 4.14.0   
Target Milestone: ---   
Target Release: 4.15.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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:

Description Denys Shchedrivyi 2023-07-14 16:34:42 UTC
Description of problem:
 There is a validation of macAddress field when creating VMs and it works good when both macs have same delimiter (e.g. ":"), when the mac already in use - second VM can't be created
 
 But if the VMs have different macAddress delimiters (first ":", second "-") - the validation does not work
 As result it is possible to have 2 VMIs with the same mac address:

> $ oc describe vmi vm-fedora | grep "Mac:"
>    Mac:                             02:f2:8c:00:00:1a
> $ oc describe vmi vm-fedora-2 | grep "Mac:"
>    Mac:                             02:f2:8c:00:00:1a

> [fedora@vm-fedora ~]$ ip a | grep ether
>    link/ether 02:f2:8c:00:00:1a brd ff:ff:ff:ff:ff:ff

> [fedora@vm-fedora-2 ~]$ ip a | grep ether
>    link/ether 02:f2:8c:00:00:1a brd ff:ff:ff:ff:ff:ff

Version-Release number of selected component (if applicable):
4.11

How reproducible:
100%

Steps to Reproduce:
1. create first VM with macAddress using ":" as delimiters (e.g. "02:f2:8c:00:00:1a")
2. create second VM with same macAddress but "-" as delimiter (e.g. "02-f2-8c-00-00-1a")
3.

Actual results:
 Both VMs created

Expected results:
 VMs with the same mac address should not be created.

Additional info: