[fedora-virt] fc12 virsh tap networking problem

Mark McLoughlin markmc at redhat.com
Thu Dec 10 08:21:47 UTC 2009


On Tue, 2009-12-08 at 19:43 -0800, Chiradeep Vittal wrote:
> Hi,
> On a fresh FC12 system, I am able to create and run KVM-based vms with
> tap networking using the qemu-kvm command line but not using virsh.
> I have user and group set to "root" in /etc/libvirt/qemu.conf. "user
> mode networking" works with virsh, but not tap! selinux is disabled. 

Okay, you've ruled out the most likely culprits :-)

Is this a stock Fedora 12 kernel?

> I have this xml:
> <domain type='kvm'>
>   <name>centos</name>
>   <uuid>22d9d573-d82c-c18d-36c0-d3ffef057468</uuid>
>   <memory>131072</memory>
>   <vcpu>1</vcpu>
>   <os>
>     <type arch='x86_64'>hvm</type>
>   </os>
>   <features>
>     <acpi/>
>     <pae/>
>   </features>
>   <clock offset='utc'/>
>   <devices>
>     <emulator>/usr/bin/qemu-kvm</emulator>
>     <disk type='file' device='disk'>
>       <source
> file='/var/lib/images/centos.5-4.x86-64/centos-small.img'/>
>       <target dev='hda' bus='ide'/>
>     </disk>
>     <interface type='user'>
>       <mac address='52:54:00:7e:5b:58'/>
>     </interface>
>     <interface type='ethernet'>
>       <mac address='52:54:00:2e:33:c8'/>
>       <script path='/var/lib/images/centos.5-4.x86-64/qemu-ifup'/>

Try adding:

        <target dev="mytap0"/>

here and seeing if that helps?

>     </interface>
>     <graphics type='vnc' port='5910' autoport='no' listen=''/>
>   </devices>
> </domain>
> 
> This won't start even when I execute virsh as root:
> [root at fc12 centos.5-4.x86-64]# virsh -c qemu+unix:///system   create
> domr.xml 
> error: Failed to create domain from domr.xml
> error: monitor socket did not show up.: No such file or directory
> [root at fc12 centos.5-4.x86-64]# tail
> -3 /var/log/libvirt/qemu/centos.log 
> LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin
> QEMU_AUDIO_DRV=none /usr/bin/qemu-kvm -S -M pc-0.11 -m 128 -smp 1
> -name centos -uuid 22d9d573-d82c-c18d-36c0-d3ffef057468 -monitor
> unix:/var/lib/libvirt/qemu/centos.monitor,server,nowait -boot c -drive
> file=/var/lib/images/centos.5-4.x86-64/centos-small.img,if=ide,index=0,boot=on -net nic,macaddr=52:54:00:7e:5b:58,vlan=0,name=nic.0 -net user,vlan=0,name=user.0 -net nic,macaddr=52:54:00:2e:33:c8,vlan=1,name=nic.1 -net tap,script=/var/lib/images/centos.5-4.x86-64/qemu-ifup,vlan=1,name=tap.0 -serial none -parallel none -usb -vnc :10 -vga cirrus 
> warning: could not configure /dev/net/tun: no virtual network
> emulation
> qemu: Could not initialize device 'tap'

The code here is quite straightforward:

  http://repo.or.cz/w/qemu-kvm/fedora.git/blob/HEAD:/net.c#l1801

all it's doing is configuring the tap device flags and name using the
TUNSETIFF ioctl

You could try strace e.g.

  $> service libvirtd stop
  $> strace -f libvirtd > t.log 2>&1

that might give you more insight to what qemu is doing when it calls
TUNSETIFF

> '***** But I can execute the same command line and it works!!********
> [root at fc12 centos.5-4.x86-64]# LC_ALL=C
> PATH=/sbin:/usr/sbin:/bin:/usr/bin
> QEMU_AUDIO_DRV=none /usr/bin/qemu-kvm -S -M pc-0.11 -m 128 -smp 1
> -name centos -uuid 22d9d573-d82c-c18d-36c0-d3ffef057468 -monitor
> unix:/var/lib/libvirt/qemu/centos.monitor,server,nowait -boot c -drive
> file=/var/lib/images/centos.5-4.x86-64/centos-small.img,if=ide,index=0,boot=on -net nic,macaddr=52:54:00:7e:5b:58,vlan=0,name=nic.0 -net user,vlan=0,name=user.0 -net nic,macaddr=52:54:00:2e:33:c8,vlan=1,name=nic.1 -net tap,script=/var/lib/images/centos.5-4.x86-64/qemu-ifup,vlan=1,name=tap.0 -serial none -parallel none -usb -vnc :10 -vga cirrus &
> 2] 4543

I've no idea why this works, but doesn't work when launched from libvirt

Cheers,
Mark.





More information about the Fedora-virt mailing list