Open
Description
SUMMARY
The module simply throws an error on attempt to gather facts about network that doesn't have bridge name definition in it so hostdev or passthrough mode networks are primarily affected.
ISSUE TYPE
- Bug Report
COMPONENT NAME
virt_net
ANSIBLE VERSION
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/user1/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /home/user1/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.12.3 (main, Jan 17 2025, 18:03:48) [GCC 13.3.0] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
COLLECTION VERSION
# /home/user1/.ansible/collections/ansible_collections
Collection Version
----------------- -------
community.libvirt 1.3.1
# /usr/lib/python3/dist-packages/ansible_collections
Collection Version
----------------- -------
community.libvirt 1.3.0
CONFIGURATION
CONFIG_FILE() = /etc/ansible/ansible.cfg
DEFAULT_BECOME(/etc/ansible/ansible.cfg) = True
DEFAULT_BECOME_ASK_PASS(/etc/ansible/ansible.cfg) = False
DEFAULT_BECOME_METHOD(/etc/ansible/ansible.cfg) = sudo
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = ['/etc/ansible/inventory']
DEFAULT_PRIVATE_KEY_FILE(/etc/ansible/ansible.cfg) = /home/user1/.ssh/id_rsa
DEFAULT_REMOTE_USER(/etc/ansible/ansible.cfg) = asergeev
DEFAULT_ROLES_PATH(/etc/ansible/ansible.cfg) = ['/etc/ansible/vault/roles', '/etc/ansible/dev', '/etc/ansible/servers', '/etc/ansible/services']
DEFAULT_STDOUT_CALLBACK(/etc/ansible/ansible.cfg) = yaml
DEPRECATION_WARNINGS(/etc/ansible/ansible.cfg) = False
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
OS / ENVIRONMENT
Distributor ID: Ubuntu
Description: Ubuntu 24.04.2 LTS
Release: 24.04
Codename: noble
Python 3.12.3 (main, Jan 17 2025, 18:03:48) [GCC 13.3.0]
STEPS TO REPRODUCE
- Define hostdev or passthrough mode network, like this
<network>
<name>hostdev-lan1f</name>
<uuid>e30530c3-b0e2-494f-8a0f-c8134145e960</uuid>
<forward mode='hostdev' managed='yes'>
<address type='pci' domain='0x0000' bus='0x18' slot='0x02' function='0x0'/>
<address type='pci' domain='0x0000' bus='0x18' slot='0x02' function='0x1'/>
<address type='pci' domain='0x0000' bus='0x18' slot='0x02' function='0x2'/>
</forward>
</network>
- Try to gather networks facts
- hosts:
- localhost
gather_facts: no
tasks:
- name: Gathering facts about networks
virt_net:
command: facts
- Get an error
EXPECTED RESULTS
Expected that networks facts will be gathered.
ACTUAL RESULTS
The full traceback is:
File "/tmp/ansible_virt_net_payload_zan2l5b2/ansible_virt_net_payload.zip/ansible_collections/community/libvirt/plugins/modules/virt_net.py", line 636, in main
File "/tmp/ansible_virt_net_payload_zan2l5b2/ansible_virt_net_payload.zip/ansible_collections/community/libvirt/plugins/modules/virt_net.py", line 572, in core
File "/tmp/ansible_virt_net_payload_zan2l5b2/ansible_virt_net_payload.zip/ansible_collections/community/libvirt/plugins/modules/virt_net.py", line 461, in facts
File "/tmp/ansible_virt_net_payload_zan2l5b2/ansible_virt_net_payload.zip/ansible_collections/community/libvirt/plugins/modules/virt_net.py", line 356, in get_bridge
File "/usr/lib/python3/dist-packages/libvirt.py", line 3462, in bridgeName
raise libvirtError('virNetworkGetBridgeName() failed')
fatal: [nstb-kvm-farm-3.consultant.ru]: FAILED! => changed=false
invocation:
module_args:
autostart: null
command: facts
name: null
state: null
uri: qemu:///system
xml: null
msg: 'internal error: network ''hostdev-lan1f'' does not have a bridge name.'
Metadata
Metadata
Assignees
Labels
No labels