Bug 603851 - QMP: Can't reuse same 'id' when netdev_add fails
QMP: Can't reuse same 'id' when netdev_add fails
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.0
All Linux
low Severity medium
: rc
: ---
Assigned To: Markus Armbruster
Virtualization Bugs
:
Depends On:
Blocks: 559201
  Show dependency treegraph
 
Reported: 2010-06-14 13:23 EDT by Luiz Capitulino
Modified: 2013-01-09 17:44 EST (History)
6 users (show)

See Also:
Fixed In Version: qemu-kvm-0.12.1.2-2.86.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-07-08 01:36:44 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Luiz Capitulino 2010-06-14 13:23:33 EDT
Description of problem:

If the netdev_add command fails, the 'id' issued with it is not freed and can't be reused in subsequent calls.

Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.73.el6

How reproducible:


Steps to Reproduce:
1. Run qemu-kvm with a QMP connection:

# qemu-kvm [...] -qmp tcp:localhost:4444,server

2. Connect with telnet and issue the capabilities command:

$ telnet localhost 4444
{ "execute": "qmp_capabilities" }

2. Issue an obviously wrong netdev_add command

{ "execute": "netdev_add", "arguments": { "type": "foobar", "id": "netdev1" } }

3. Issue the right one

{ "execute": "netdev_add", "arguments": { "type": "user", "id": "netdev1" } }

Actual results:

The valid command fails.

Expected results:

It should work, there's no reason to fail.

Additional info:

I have the impression that 'id' is leaking, but I didn't investigate further.
Comment 1 RHEL Product and Program Management 2010-06-14 13:42:56 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.
Comment 2 Luiz Capitulino 2010-06-21 13:34:38 EDT
A patch to fix this issue has been submitted upstream:

http://lists.gnu.org/archive/html/qemu-devel/2010-06/msg02553.html
Comment 6 juzhang 2010-07-08 01:35:25 EDT
Reproduced on qemu-kvm-0.12.1.2-2.77.el6

Using the verification steps
After step4
{"error": {"class": "DuplicateId", "desc": "Duplicate ID 'hostnet2' for netdev", "data": {"object": "netdev", "id": "hostnet2"}}}

Verified on qemu-kvm-0.12.1.2-2.90.el6,pass

Steps:
1. boot guest enable qmp
#/usr/libexec/qemu-kvm -m 4G -smp 4 -drive file=/root/zhangjunyi/rhel6.64.qcow2,if=none,id=drive-virtio-disk0,boot=on,cache=none,format=qcow2 -device virtio-blk-pci,bus=pci.0,drive=drive-virtio-disk0,id=virtio-disk0  -device virtio-balloon-pci -cpu qemu64,+sse2,+x2apic -monitor stdio -vnc :10 -qmp tcp:0:4445,server,nowait -drive file=/root/zhangjunyi/boot.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,drive=drive-ide0-1-0 -boot order=cdn,menu=on -net none
2.Connect with telnet and issue the capabilities command:
$ telnet 10.66.91.89 4444
{ "execute": "qmp_capabilities" }
3.Issue an obviously wrong netdev_add command
{ "execute": "netdev_add", "arguments": { "type":"tap1","id":"hostnet2"}}

4. Issue the right one

{ "execute": "netdev_add", "arguments": { "type":"tap","id":"hostnet2"}}

5. repeat step4

{ "execute": "netdev_add", "arguments": { "type":"tap","id":"hostnet2"}}

Results:
After step3
{"error": {"class": "InvalidParameterValue", "desc": "Parameter 'type' expects a netdev backend type", "data": {"name": "type", "expected": "a netdev backend type"}}}

After step4
{"return": {}},hostnet2 was added.
(qemu) info network 
VLAN 0 devices:
Devices not on any VLAN:
  hostnet2: ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown

After step5
{"error": {"class": "DuplicateId", "desc": "Duplicate ID 'hostnet2' for netdev", "data": {"object": "netdev", "id": "hostnet2"}}}
Comment 7 juzhang 2010-07-08 01:36:44 EDT
according to comment6,close this issue.

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