Ask Your Question
0

libvirt does not show all interfaces

asked 2012-06-17 07:42:17 -0500

epsilon2 gravatar image

Hi I'm trying to use libvirt with python and when I use libvirt.listInterfaces() it only shows eth0 and lo but I have other interfaces such as virbr0, macvtap0 and wlan0. Here is my code

import libvirt

libConnect = libvirt.open('qemu:///system')
print libConnect.listInterfaces
libConnect.close()

How do I list all the interfaces in my system?

edit retag flag offensive close merge delete

Comments

Those are bridges/networks - not interfaces. Try listNetworks and/or listDevices

bit4man gravatar imagebit4man ( 2015-06-01 21:44:52 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-06-11 21:29:02 -0500

mhayden gravatar image

updated 2015-06-11 21:29:35 -0500

I get similar results as my normal user and as root (but I adjusted listInterfaces to be listInterfaces()):

[major@hydrogen ~]$ ./libvirt-messaround.py 
['enp4s0', 'enp5s0', 'lo']
[major@hydrogen ~]$ sudo ./libvirt-messaround.py
[sudo] password for major: 
['enp4s0', 'enp5s0', 'lo']

From what I've read on various mailing list posts, libvirt will only show you network devices that it has created and manages. However, if you're using something like virt-manager or virt-install to create your VM's, you can manually specify the network device for the VM.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2012-06-17 07:42:17 -0500

Seen: 176 times

Last updated: Jun 11 '15