Bug 623877 - error happens when attach network device using virsh
error happens when attach network device using virsh
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
All Linux
low Severity medium
: rc
: ---
Assigned To: Jiri Denemark
Virtualization Bugs
Depends On:
  Show dependency treegraph
Reported: 2010-08-12 23:30 EDT by Shirley Zhou
Modified: 2015-03-04 19:52 EST (History)
10 users (show)

See Also:
Fixed In Version: libvirt-0.8.1-27.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-11-10 16:05:37 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Shirley Zhou 2010-08-12 23:30:38 EDT
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-12 23:57:59 EDT
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 10:03:23 EDT
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 17:58:15 EDT
libvirt-0_8_1-26_el6 has been built in RHEL-6-candidate with the fix.

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

Comment 11 xhu 2010-08-20 02:31:44 EDT
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 16:05:37 EST
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.