libvirt/tests/xml2vmxdata/xml2vmx-ethernet-mac-type.vmx

31 lines
943 B
Plaintext
Raw Normal View History

.encoding = "UTF-8"
config.version = "8"
virtualHW.version = "4"
guestOS = "other"
uuid.bios = "c7 a5 fd bd ed af 94 55-92 6a d6 5c 16 db 18 09"
displayName = "ethernet-mac-type"
memsize = "216"
sched.mem.max = "214"
numvcpus = "1"
floppy0.present = "false"
floppy1.present = "false"
ethernet0.present = "true"
ethernet0.networkName = "br0"
ethernet0.connectionType = "bridged"
ethernet0.addressType = "static"
ethernet0.address = "aa:bb:cc:dd:ee:ff"
ethernet0.checkMACAddress = "false"
ethernet1.present = "true"
ethernet1.networkName = "br1"
ethernet1.connectionType = "bridged"
ethernet1.addressType = "static"
ethernet1.address = "00:0c:29:dd:ee:fe"
ethernet1.checkMACAddress = "true"
ethernet2.present = "true"
ethernet2.networkName = "br2"
ethernet2.connectionType = "bridged"
vmx: fix logic handling mac address type With the current formatter, the XML snippets: <interface type='bridge'> <mac address='00:0c:29:dd:ee:fe' type='static'/> <source bridge='br1'/> </interface> <interface type='bridge'> <mac address='aa:bb:cc:dd:ee:fd' type='generated'/> <source bridge='br2'/> </interface> result in ethernet1.present = "true" ethernet1.networkName = "br1" ethernet1.connectionType = "bridged" ethernet1.addressType = "static" ethernet1.address = "00:0c:29:dd:ee:fe" ethernet1.checkMACAddress = "false" ethernet2.present = "true" ethernet2.networkName = "br2" ethernet2.connectionType = "bridged" ethernet2.addressType = "static" ethernet2.address = "aa:bb:cc:dd:ee:fd" ethernet2.checkMACAddress = "false" which is flawed, as both type='static' and type='generated' in the XML turn into 'static' in the VMX config. The existence of the 'static' attribute is further overriding whether the checkMACAddress config option is set as a side effect. Both these pieces of flawed logic were introduced in commit 454e5961abf40c14f8b6d7ee216229e68fd170bf Author: Bastien Orivel <bastien.orivel@diateam.net> Date: Mon Jul 13 16:28:53 2020 +0200 Add a type attribute on the mac address element which intentionally added the 'checkMACAddress' side effect based on the 'type' attribute. With this change, we're reverting the handling of checkMACAddress to match what existed historically. The 'type' attribute now directly maps to the addressType attribute, so the above config becomes: ethernet1.present = "true" ethernet1.networkName = "br1" ethernet1.connectionType = "bridged" ethernet1.addressType = "static" ethernet1.address = "00:0c:29:dd:ee:fe" ethernet2.present = "true" ethernet2.networkName = "br2" ethernet2.connectionType = "bridged" ethernet2.addressType = "generated" ethernet2.generatedAddress = "aa:bb:cc:dd:ee:fd" ethernet2.generatedAddressOffset = "0" Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-20 14:59:51 +00:00
ethernet2.addressType = "generated"
ethernet2.generatedAddress = "aa:bb:cc:dd:ee:fd"
ethernet2.generatedAddressOffset = "0"
ethernet2.checkMACAddress = "false"