Bug 1277967

Summary: MAC address - Wrong MAC address appears in the warning message when importing VM with NICs that have MAC addresses in use
Product: [oVirt] ovirt-engine Reporter: Michael Burman <mburman>
Component: BLL.NetworkAssignee: Martin Mucha <mmucha>
Status: CLOSED CURRENTRELEASE QA Contact: Michael Burman <mburman>
Severity: medium Docs Contact:
Priority: low    
Version: 3.6.0CC: bugs, danken, mburman, mmucha
Target Milestone: ovirt-3.6.1Flags: danken: ovirt-3.6.z?
mburman: planning_ack?
rule-engine: devel_ack+
rule-engine: testing_ack+
Target Release: 3.6.1.1   
Hardware: x86_64   
OS: Linux   
Whiteboard: network
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-22 13:29:20 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
screenshot none

Description Michael Burman 2015-11-04 12:42:57 UTC
Created attachment 1089669 [details]
screenshot

Description of problem:
MAC address - Wrong MAC address appears in the warning message when importing VM with NICs that has MAC addresses in use.

When importing VM with NICs from export domain, i will get a warning message about NICs that have MAC addresses in use and therefore it's being unplugged from VM.
"Network Interface nic1 has MAC address 00:00:00:00:00:4b which is in use, therefore it is being unplugged from VM yyyyy77"

But, the MAC address in the warning message is not the MAC address that is in use, it is the newly assigned MAC address for the vNIC from engine. 
Therefore this warning message is wrong and misleading.

Version-Release number of selected component (if applicable):
3.6.0.3-0.1.el6

How reproducible:
100

Steps to Reproduce:
1. Create new VM with 3 vNICs 
2. Export VM to export domain
3. Import VM 

Actual results:
Warning message is displayed while VM being imported.
"Network Interface nic1 has MAC address 00:00:00:00:00:4b which is in use, therefore it is being unplugged from VM yyyyy77"

00:00:00:00:00:4b is the new MAC address that the vNIC will get.
00:00:00:00:00:45 is the used one.

Expected results:
Warning message should display the right MAC address which is in use.

Comment 1 Martin Mucha 2015-11-06 13:12:01 UTC
I do not understand this flow sufficiently — I'm not aware of fact, that when nic has duplicate mac address when plugging, the new one will be generated instead of it. Maybe it works like that, I just don't see it in code. Can you confirm it and maybe provide some details how this work?

But prior to doing that, can you reverify, that you used correct host? From provided screen shot it seems, that messages are related to host "yyyy77", while network interfaces tab relates to host "yyyy". Could this be the reason why nics has different macs than in warning message? (since it's different nics?).

Comment 2 Michael Burman 2015-11-08 06:04:56 UTC
Hi Martin,

I think you are a bit confused here. 'yyyy' and 'yyyy77' are VMs and not servers.
My screen shot here i trying to show you the wrong MAC address in the warning message. 
'yyyy' is a VM that was exported to export domain with 3 MAC addresses:
00:00:00:00:00:45 
00:00:00:00:00:46
00:00:00:00:00:47 

'yyyy7' and 'yyyy77' are both VMs that were imported from export domain based on VM 'yyyy' ^^ 
In the warning message you expect to see that :
"Network Interface nic1 has MAC address 00:00:00:00:00:45 which is in use, therefore it is being unplugged from VM yyyyy77"
"Network Interface nic2 has MAC address 00:00:00:00:00:46 which is in use, therefore it is being unplugged from VM yyyyy77"
"Network Interface nic1 has MAC address 00:00:00:00:00:47 which is in use, therefore it is being unplugged from VM yyyyy77"
Cause they are the used MAC addresses by VM 'yyyy', but instead of that, the MAC addresses in the warning message are the ones the engine assign to the newly imported VMs.
And this is why the warning message is wrong..

And yes, that is the behavior when importing VMs from export domain that have NICs. This is the warning message that you will get, and the NICs are being unplugged and will get new MACs from the range.

Comment 3 Martin Mucha 2015-11-09 12:25:39 UTC
to me it seems as a different bug; this message should not be presented at all, since new mac was assigned, thus there cannot be duplicity. If, on the other hand, we're not assigning new mac, and using existing, we will endup with "mac used" or duplicate mac in pool, which is suprisingly not dependant on pool setting. It seems to me, that error was introduced here: 2f471d83d145d7bc6674c6039bf7f8d1ba9ed137
I'll try to discuss it to be sure about it and fix it if it's this cause.



Some more detail:
looking at the code, I cannot see such thing. Maybe there's some logic in UI I did not saw, but talking about backend only now, it's more controlled via 'importAsNewEntity' flag in ImportVmParameters. 

1. ImportVmParameters#importAsNewEntity = true —> new MAC addresses are assigned and stored no matter what. And due to flow, regardless they were unused before call, and were just assigned for the first time, there's complaint, that they're used and thus because of that, we have to unplug nic. This seems as a bug.

2. ImportVmParameters#importAsNewEntity = false —> MAC addresses of NICs from imported vm are preserved. Depending on hotplug support:

FeatureSupported.hotPlug(clusterCompatibilityVersion) && getOsRepository().hasNicHotplugSupport(osId, clusterCompatibilityVersion)

2.1 are these MACs added into pool regardless of whether they are there or not, resp.
2.2 are these MACs addes into pool only if they aren't there yet and MAC_ADDRESS_IS_IN_USE is generated otherwise.

Comment 4 Red Hat Bugzilla Rules Engine 2015-12-03 13:21:58 UTC
Bug tickets that are moved to testing must have target release set to make sure tester knows what to test. Please set the correct target release before moving to ON_QA.

Comment 5 Michael Burman 2015-12-09 10:07:06 UTC
Hi Dan , Martin

Is the fix for this bug is that the error message won't be displayed/presented any more when importing the VM from export domain ?

Comment 6 Dan Kenigsberg 2015-12-16 12:42:35 UTC
If there is no problem importing VMs (a fresh mac address is allocated per vnic, and not duplication exist) we should be happy and mark the bug as verified.

Comment 7 Michael Burman 2015-12-17 07:27:14 UTC
VM imported with new/fresh MAC addresses for the vNICs and they are plugged.
Warning message isn't appears any more.

Verified on - 3.6.1.3-0.1.el6

Comment 8 Sandro Bonazzola 2015-12-22 13:29:20 UTC
oVirt 3.6.1 has been released and bz verified, moving to closed current release