[BUG] Error when using forward hostdev virt.network state "Missing parameter bridge for state virt.network_running"
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
When using states virt.network_defined or virt.network_running, with a forward: hostdev network type, Salt raises an error stating that bridge name is mandatory, although it does not make any sense.
full error is :
----------
ID: test
Function: virt.network_running
Result: False
Comment: Missing parameter bridge for state virt.network_running
Changes:
If I mention a bridge name in a sls (bridge: br0) , which does not make sense but anyway, the following error (libvirt generated I guess) appears instead :
----------
ID: test
Function: virt.network_running
Name: test
Result: False
Comment: XML error: bridge name not allowed in hostdev mode (network 'test')
Started: 13:37:49.955720
Duration: 11.871 ms
Changes:
Steps to Reproduce the behavior
Use this state to reproduce :
test:
virt.network_running:
- forward: hostdev
- physical_function: enpXsXfX
Same behavior when using interfaces instead of physical_function.
Expected behavior
The state should be valid and virt network should be created and running
Workaround
I found the following Workaround. If I mention bridge: "", it passes the salt validation without the libvirt error.
Versions Report
Salt Version:
Salt: 3006.9
Python Version:
Python: 3.10.14 (main, Jun 26 2024, 11:44:37) [GCC 11.2.0]
Dependency Versions:
cffi: 1.14.6
cherrypy: unknown
cryptography: 42.0.5
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.4
libgit2: Not Installed
looseversion: 1.0.2
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 22.0
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.19.1
pygit2: Not Installed
python-gnupg: 0.4.8
PyYAML: 6.0.1
PyZMQ: 23.2.0
relenv: 0.17.0
smmap: Not Installed
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: rhel 8.7 Ootpa
locale: utf-8
machine: x86_64
release: 4.18.0-339.rt7.120.el8.x86_64
system: Linux
version: Red Hat Enterprise Linux 8.7 Ootpa
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the virt.network_defined and virt.network_running state entry points, using the provided YAML with forward: hostdev and physical_function or interfaces. Compare validation with bridge omitted, bridge: br0, and bridge: "". Done means a hostdev network can be created and run without requiring a bridge, while still rejecting an invalid bridge value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100