Bug 603851 - QMP: Can't reuse same 'id' when netdev_add fails
Summary: QMP: Can't reuse same 'id' when netdev_add fails
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm   
(Show other bugs)
Version: 6.0
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Markus Armbruster
QA Contact: Virtualization Bugs
Depends On:
Blocks: 559201
TreeView+ depends on / blocked
Reported: 2010-06-14 17:23 UTC by Luiz Capitulino
Modified: 2013-01-09 22:44 UTC (History)
6 users (show)

Fixed In Version: qemu-kvm-
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-07-08 05:36:44 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Luiz Capitulino 2010-06-14 17:23:33 UTC
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):

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 17:42:56 UTC
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

Comment 2 Luiz Capitulino 2010-06-21 17:34:38 UTC
A patch to fix this issue has been submitted upstream:


Comment 6 juzhang 2010-07-08 05:35:25 UTC
Reproduced on qemu-kvm-

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

Verified on qemu-kvm-,pass

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 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"}}

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 05:36:44 UTC
according to comment6,close this issue.

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