vexxhost / migratekit

Near-live migration toolkit for VMware to OpenStack
Apache License 2.0
79 stars 12 forks source link

MAC address with uppercase letters can't be mapped #40

Open gustavofaganello opened 1 month ago

gustavofaganello commented 1 month ago

Hello, folks! Hope you are doing well :-)

I believe I found a bug today, hopefully with an easy fix.

In client.go 125-131:

    for _, nic := range nics {
        card := nic.(types.BaseVirtualEthernetCard).GetVirtualEthernetCard()

        mapping, ok := networkMappings.Mappings[card.MacAddress]
        if !ok {
            return nil, errors.New("no network mapping found for MAC address")
        }

card.MacAddress seems to be converted to lowercase characters, even if the user-provided mac field in network-mapping comes with uppercase letters, making networkMappings.Mappings[card.MacAddress] return nothing when the interface's MAC address in VMware has uppercase letters, causing a mapping mismatch and returning Error: no network mapping found for MAC address.

Example:

The empty value of mapping makes me believe the uppercase letters are the problem here.

A workaround I tested was changing the interface's MAC address in VMware to have only lowercase letters.

Hope this makes sense. Thank you!

mnaser commented 1 month ago

What if you tried to simply using lower caase in the mapping?

gustavofaganello commented 1 month ago

I did, got the same error.