Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using network-config v1, can't have a MAC address with all numbers #152

Open
neilgierman opened this issue Jul 31, 2024 · 2 comments
Open

Comments

@neilgierman
Copy link

neilgierman commented Jul 31, 2024

We are still on CloudBase-Init 1.1.4 due to #147. In testing using kvm, I found that if my VM and network-config has a MAC address with only numbers, CloudBase-Init fails to parse it because "int type doesn't have lower function".

Seems there needs to be some protection that if a MAC is of int type, don't try toLower (or always force the incoming MAC to be string).

My network-config:

version: 1
config:
  # multiple interfaces or networks so we need a bond/team NIC
  - type: physical
    name: eth0
    mac_address: 52:54:00:00:00:01
    mtu: 1450
  - type: physical
    name: eth1
    mac_address: 52:54:00:00:00:02
    mtu: 1450
  - type: bond
    name: Default
    mac_address: 52:54:00:00:00:01
    bond_interfaces:
    -  eth0
    -  eth1
    params:
      bond-mode: active-backup
      xmit_hash_policy: layer2
      bond-lacp-rate: false

  # multiple networks with vlans
  - type: vlan
    name: "Default.0"
    vlan_link:  Default
    vlan_id: 0
    subnets:
    - type: static
      address: 192.168.122.200/24
      gateway: 192.168.122.1
      dns_nameservers:
        - 192.168.1.254

My virt-install command to bring up the VM:

virt-install \
  --name win2022 \
  --memory 2048 \
  --vcpus 2 \
  --disk size=50 \
  --cdrom ./Win2022.iso \
  --os-variant win2k22 \
  --network network=default,mac=52:54:00:00:00:01 \
  --network network=default,mac=52:54:00:00:00:02 \
  --graphics spice,listen=0.0.0.0 \
  --boot uefi \
  --disk path=./win2022.img,format=raw,cache=none,device=floppy

From error log:
image

@neilgierman
Copy link
Author

Linux cloud-init might have a similar issue however have not tried it: https://github.com/canonical/cloud-init/blob/main/cloudinit/net/network_state.py#L738

@ader1990
Copy link
Member

ader1990 commented Aug 5, 2024

Hello,

I could reproduce the issue and it looks like a yaml quirk, as the yaml implementation sees the unquoted MAC addresses as integers.

Cloud-init has the same implementation and from a similar bug report, see canonical/cloud-init#3703:

cloud-init suggests in network config docs above that mac_address values should be colon-delimited values such as 04:11:20:54:23:11.
 Also, the network-config file is read as yaml, any integer-only values present in yaml will be interpreted as an int instead of strings. 
To ensure yaml sees an integer value as a string you would need either single quotes or double quotes around a value.

Is it possible to use single quotes or double quotes around the MAC address?

Thank you,
Adrian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants