Hi all,
I tried to run virtio-net on X86 machine according to the Wiki page
https://wiki.xenproject.org/wiki/Virtio_On_Xen.
And I Encountered some confusing problems.
The Qemu version I used is QEMU emulator version 4.2.1 (Debian
1:4.2-3ubuntu6.17)
The content of guest.cfg is as below:
type = "hvm"
name = "g1"
memory = 512
vcpus = 2
vif = [ 'model=virtio-net' ]
disk = [ 'file:xxx/rootfs.image,xvda1,rw,backendtype=qdisk' ] kernel =
"/boot/vmlinuz-5.4.0-80-generic"
ramdisk = "/boot/initrd.img-5.4.0-80-generic"
root = "/dev/xvda1 ro"
extra = 'console=hvc0 xencons=tty'
I enter the guest shell. Use ps command to get the running qemu command as
below:
/usr/local/lib/xen/bin/qemu-system-i386
-xen-domid 31
-no-shutdown
-chardev socket,id=libxl-cmd,path=/var/run/xen/qmp-libxl-31,server=on,wait=off
-mon chardev=libxl-cmd,mode=control
-chardev
socket,id=libxenstat-cmd,path=/var/run/xen/qmp-libxenstat-31,server=on,wait=off
-mon chardev=libxenstat-cmd,mode=control
-nodefaults -no-user-config
-name g1
-vnc 127.0.0.1:0,to=99
-display none
-kernel /boot/vmlinuz-5.4.0-80-generic
-initrd /boot/initrd.img-5.4.0-80-generic -append root=/dev/xvda1 ro
console=hvc0 xencons=tty -device cirrus-vga,vgamem_mb=8 -boot order=cda -smp
2,maxcpus=2 -device virtio-net,id=nic0,netdev=net0,mac=00:16:3e:30:1a:6e
-netdev type=tap,id=net0,ifname=vif31.0-emu,br=xenbr0,script=no,downscript=no
-machine xenfv,suppress-vmdesc=on -m 504 -drive
file=xxx/rootfs.image,if=ide,index=0,media=disk,format=raw,cache=writeback
The network-related parameters are
"
-device virtio-net,id=nic0,netdev=net0,mac=00:16:3e:30:1a:6e
-netdev type=tap,id=net0,ifname=vif31.0-emu,br=xenbr0,script=no,downscript=no
"
Get the interface info as below using command 'ip a'. The mac address of eth0 is
00:16:3e:30:1a:6e, the same as in the qemu command, which made me think
virto-net has run successfully.
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group
default qlen 1000
link/ether 00:16:3e:30:1a:6e brd ff:ff:ff:ff:ff:ff
inet 192.168.200.3/24 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::216:3eff:fe30:1a6e/64 scope link
valid_lft forever preferred_lft forever
I made further check.
1. I run command 'lspci' and got below message. But there is no virtio devices.
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
00:03.0 VGA compatible controller: Cirrus Logic GD 5446
2. Run "ls /sys/class/net/ -l", what I got is as below:
lrwxrwxrwx 1 root root 0 Aug 19 08:15 eth0 -> ../../devices/vif-0/net/eth0
lrwxrwxrwx 1 root root 0 Aug 19 08:15 lo -> ../../devices/virtual/net/lo
Run "ls /sys/bus/xen/devices/vif-0/net/ -l", what I got is as below:
total 0 drwxr-xr-x 5
root root 0 Aug 19 08:15 eth0
It seems eth0 is not virtio-net, properly a pv-net. I am really confused.
I have the following questions:
1. Does Xen x86 still support virtio-net based on QEMU backend?
2. If yes, is there anything wrong in my guest config file?
3. Is my way to check virtio-net in guest is right?
It is highly appreciated if you kindly tell me about these.
Best wishes
Jiamei Xie