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

OpenBSD cloud-init network fails with set-name #559

Open
ivomarino opened this issue Sep 29, 2024 · 2 comments
Open

OpenBSD cloud-init network fails with set-name #559

ivomarino opened this issue Sep 29, 2024 · 2 comments

Comments

@ivomarino
Copy link

ivomarino commented Sep 29, 2024

when I try to use the following OpenBSD 7.5 cloud image from https://github.com/hcartiaux/openbsd-cloud-image/releases/download/v7.5_2024-05-13-15-25/openbsd-min.qcow2 with this config:

vm create \
-t openbsd-nvme \
-s 4G \
-c 2 \
-m 512M \
-i openbsd-min.qcow2 \
-C -n "ip=192.168.140.172/24;gateway=192.168.140.1;nameservers=192.168.140.1" \
-k /home/syseng/.ssh/id_rsa.pub \
controller-test-openbsd

cloud-init fails during network setup, this is the error:

Cloud-init v. 24.1.4 running 'init-local' at Sun, 29 Sep 2024 14:29:00 +0000. Up 11.273105382919312 seconds.
2024-09-29 14:29:00,773 - util.py[DEPRECATED]: The use of `gateway4` and `gateway6` is deprecated in 22.4 and scheduled to be removed in 27.4
. For more info check out: https://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v2.html
2024-09-29 14:29:00,793 - util.py[WARNING]: failed stage init-local
failed run of stage init-local
------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/cloud_init-24.1.4-py3.10.egg/cloudinit/cmd/main.py", line 772, in status_wrapper
    ret = functor(name, args)
  File "/usr/local/lib/python3.10/site-packages/cloud_init-24.1.4-py3.10.egg/cloudinit/cmd/main.py", line 435, in main_init
    init.apply_network_config(bring_up=bring_up_interfaces)
  File "/usr/local/lib/python3.10/site-packages/cloud_init-24.1.4-py3.10.egg/cloudinit/stages.py", line 1084, in apply_network_config
    return self.distro.apply_network_config(
  File "/usr/local/lib/python3.10/site-packages/cloud_init-24.1.4-py3.10.egg/cloudinit/distros/__init__.py", line 439, in apply_network_confi
g
    network_state = parse_net_config_data(netconfig, renderer=renderer)
  File "/usr/local/lib/python3.10/site-packages/cloud_init-24.1.4-py3.10.egg/cloudinit/net/network_state.py", line 1107, in parse_net_config_
data
    nsi.parse_config(skip_broken=skip_broken)
  File "/usr/local/lib/python3.10/site-packages/cloud_init-24.1.4-py3.10.egg/cloudinit/net/network_state.py", line 305, in parse_config
    self.parse_config_v2(skip_broken=skip_broken)
  File "/usr/local/lib/python3.10/site-packages/cloud_init-24.1.4-py3.10.egg/cloudinit/net/network_state.py", line 361, in parse_config_v2
    self._v2_common(command)
  File "/usr/local/lib/python3.10/site-packages/cloud_init-24.1.4-py3.10.egg/cloudinit/net/network_state.py", line 824, in _v2_common
    self._handle_individual_nameserver(name_cmd, iface)
  File "/usr/local/lib/python3.10/site-packages/cloud_init-24.1.4-py3.10.egg/cloudinit/net/network_state.py", line 119, in decorator
    return func(self, command, *args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/cloud_init-24.1.4-py3.10.egg/cloudinit/net/network_state.py", line 603, in _handle_individual
_nameserver
    _iface[iface]["dns"] = {"nameservers": nameservers, "search": search}
KeyError: 'vio0'
cat /zroot/vm/.templates/openbsd-nvme.conf
loader="grub"
cpu=1
memory=256M
network0_type="virtio-net"
network0_switch="public"
disk0_type="nvme"
disk0_name="disk0.img"
grub_install0="kopenbsd -h com0 /6.2/amd64/bsd.rd"
grub_run0="kopenbsd -h com0 -r sd0a /bsd"
bhyve_options="-w"

Tested both this vm-bhyve versions:

pkg search vm-bhyve
vm-bhyve-1.5.0_1               Management system for bhyve virtual machines
vm-bhyve-devel-1.5.0.26_1      Management system for bhyve virtual machines

any suggestions? Thanks

@ivomarino
Copy link
Author

ivomarino commented Oct 3, 2024

turns out the problem is hardcoded set-name: eth0 on OpenBSD, see: https://github.com/churchers/vm-bhyve/blob/master/lib/vm-core#L284, if we remove this line, or rename eth0 to vio0 everything works fine

@ivomarino ivomarino changed the title OpenBSD 7.5 cloud-init network fails with cloud image OpenBSD cloud-init network fails with set-name Oct 3, 2024
ivomarino added a commit to ivomarino/vm-bhyve that referenced this issue Oct 3, 2024
@GogoFC
Copy link

GogoFC commented Oct 28, 2024

Ivo do you know how to use more of the Cloud init features? Is there a way to pass a yaml file or something?

I see you use -C -n to set the network but I use DHCP so I don't need that.

I pass the key with -k but that's about all I know.

How do we use other features like to set the hostname for example? I don't need that either as the hostname get's set to the VM's name, just trying to figure out how to use cloud init.

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