Bug 623877 - error happens when attach network device using virsh
Summary: error happens when attach network device using virsh
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.0
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Jiri Denemark
QA Contact: Virtualization Bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2010-08-13 03:30 UTC by Shirley Zhou
Modified: 2015-03-05 00:52 UTC (History)
10 users (show)

Clone Of:
Last Closed: 2010-11-10 21:05:37 UTC

Attachments (Terms of Use)

Description Shirley Zhou 2010-08-13 03:30:38 UTC
Description of problem:
Fail to attach network device using virsh, error prompts "internal error unable to execute QEMU command 'device_add': Device 'virtio-net-pci' could not be initialized".

From libvirt log, we can see qmp command assign ""addr":"0x0"" to this device.

Version-Release number of selected component (if applicable):

How reproducible:
no stable reproducer

Steps to Reproduce:
1.attach device using virsh
virsh # attach-device rhel6-bug virtio_bridge.xml

cat virtio_bridge.xml
<interface type='bridge'>
<source bridge='breth0'/>
<model type='virtio'/>
Actual results:
error happens, and nic can not be attached.

Expected results:
nic can be hot added.

Additional info:

qemu cli:
/usr/libexec/qemu-kvm -S -M rhel6.0.0 -enable-kvm -m 1024 -smp 2,sockets=2,cores=1,threads=1 -name rhel6-bug -uuid 8da4827f-0ffa-8d16-dfae-5b4cc26afb2c -nodefconfig -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/rhel6-bug.monitor,server,nowait -mon chardev=monitor,mode=control -rtc base=utc -boot c -drive file=/mnt/rhel6.img,if=none,id=drive-virtio-disk0,boot=on,format=raw,cache=none -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -device usb-tablet,id=input0 -vnc -vga cirrus -device AC97,id=sound0,bus=pci.0,addr=0x3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5

libvirt log:
06:50:23.655: debug : qemuMonitorJSONCommandWithFd:217 : Send command '{"execute":"device_add","arguments":{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:eb:9c:39","bus":"pci.0","addr":"0x0"}}' for write with FD -1
06:50:23.656: debug : qemuMonitorJSONIOProcessLine:115 : Line [{"error": {"class": "DeviceInitFailed", "desc": "Device 'virtio-net-pci' could not be initialized", "data": {"device": "virtio-net-pci"}}}]
06:50:23.656: debug : qemuMonitorJSONIOProcess:188 : Total used 140 bytes out of 140 available in buffer
06:50:23.656: debug : qemuMonitorJSONCommandWithFd:222 : Receive command reply ret=0 errno=0 138 bytes '{"error": {"class": "DeviceInitFailed", "desc": "Device 'virtio-net-pci' could not be initialized", "data": {"device": "virtio-net-pci"}}}'
06:50:23.656: debug : qemuMonitorJSONCheckError:305 : unable to execute QEMU command {"execute":"device_add","arguments":{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:eb:9c:39","bus":"pci.0","addr":"0x0"}}: {"error":{"class":"DeviceInitFailed","desc":"Device 'virtio-net-pci' could not be initialized","data":{"device":"virtio-net-pci"}}}
06:50:23.656: error : qemuMonitorJSONCheckError:316 : internal error unable to execute QEMU command 'device_add': Device 'virtio-net-pci' could not be initialized

Comment 2 RHEL Product and Program Management 2010-08-13 03:57:59 UTC
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **

Comment 3 Jiri Denemark 2010-08-13 14:03:23 UTC
Actually, there is a reproducer for this bug:

1. start a guest
2. restart libvirtd
3. try to attach network device to the guest

Comment 8 Dave Allan 2010-08-17 21:58:15 UTC
libvirt-0_8_1-26_el6 has been built in RHEL-6-candidate with the fix.


Comment 9 Daniel Veillard 2010-08-18 13:51:31 UTC
since libvirt-0.8.1-26.el6 build is broken, use libvirt-0.8.1-27.el6 for


Comment 11 xhu 2010-08-20 06:31:44 UTC
I have verified it with RHEL6.0-20100818.0 including kernel-2.6.32-66.el6.x86_64, libvirt-0.8.1-27.el6 and qemu-kvm- The steps are as follows:
1. start a guest
# virsh start rhel6
Domain rhel6 started
2. restart libvirtd
# service libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]
3. attach network device to the guest via interface.xml
# cat interface.xml
<interface type='bridge'>
<source bridge='virbr0'/>
<model type='virtio'/>

# virsh attach-device rhel6 interface.xml 
Device attached successfully

Comment 12 releng-rhel@redhat.com 2010-11-10 21:05:37 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.

Note You need to log in before you can comment on or make changes to this bug.