Bug 623877

Summary: error happens when attach network device using virsh
Product: Red Hat Enterprise Linux 6 Reporter: Shirley Zhou <szhou>
Component: libvirtAssignee: Jiri Denemark <jdenemar>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: dallan, ddumas, eblake, jdenemar, llim, mshao, syeghiay, veillard, xen-maint, xhu
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.8.1-27.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-11-10 21:05:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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):
libvirt-0.8.1-23.el6.x86_64
qemu-kvm-0.12.1.2-2.109.el6.x86_64

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'/>
</interface>
  
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 127.0.0.1:0 -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.

Dave

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
testing,

Daniel

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-0.12.1.2-2.112.el6.x86_64. 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'/>
</interface>

# 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.