Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 884590 - ovs-ifup affect but ovs-ifdown not affect when run a guest with a wrong netdriver(e.g. ... -device virtio-pci-net,...)
ovs-ifup affect but ovs-ifdown not affect when run a guest with a wrong netdr...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.4
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Amos Kong
Virtualization Bugs
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-06 05:56 EST by Qian Guo
Modified: 2015-05-24 20:06 EDT (History)
13 users (show)

See Also:
Fixed In Version: qemu-kvm-0.12.1.2-2.361.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-21 00:58:30 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2013:1553 normal SHIPPED_LIVE Important: qemu-kvm security, bug fix, and enhancement update 2013-11-20 16:40:29 EST

  None (edit)
Description Qian Guo 2012-12-06 05:56:42 EST
Description of problem:
when using openvswitch 
I run a guest with a wrong cli(... -device virtio-pci-net,... ), the tap0 could not be delete from the ovs0

Version-Release number of selected component (if applicable):
host#rpm -qa \*openvswitch\*
openvswitch-controller-1.7.1-7.el6.x86_64
openvswitch-debuginfo-1.7.1-7.el6.x86_64
openvswitch-1.7.1-7.el6.x86_64

host# rpm -qa \*qemu\*
qemu-kvm-debuginfo-0.12.1.2-2.337.el6.x86_64
gpxe-roms-qemu-0.9.7-6.9.el6.noarch
qemu-img-0.12.1.2-2.337.el6.x86_64
qemu-kvm-0.12.1.2-2.337.el6.x86_64
qemu-kvm-tools-0.12.1.2-2.337.el6.x86_64
qemu-guest-agent-0.12.1.2-2.337.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.run guest like this 
<qemu-kvm cmdline>...-netdev tap,id=hostnet0,vhost=on,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown -device virtio-pci-net,netdev=hostnet0,id=virt-net0,mac=54:52:1a:32:b4:01 ...

which virtio-pci-net is  a wrong discription

then qemu quit like this
qemu-kvm: -device virtio-pci-net,netdev=hostnet0,id=virt-net0,mac=54:52:1a:32:b4:01: Parameter 'driver' expects a driver name
Try with argument '?' for a list.

2.in host do 
host#ovs-vsctl show
Bridge "ovs0"
        Port "ovs0"
            Interface "ovs0"
                type: internal
        Port "tap0"
            Interface "tap0"
        Port "eth0"
            Interface "eth0"
    ovs_version: "1.7.1"

  
Actual results:
tap0 is still in the openvswitch  "ovs0". ovs-ifup affect and ovs-ifdown not affect

Expected results:
ovs-ifdown should affect and delete tap0 from ovs0

Additional info:
host#cat /etc/ovs-ifup
#!/bin/sh
switch=ovs0
/sbin/ifconfig $1 0.0.0.0 up
ovs-vsctl add-port ${switch} $1

host#cat /etc/ovs-ifdown
#!/bin/sh
switch=ovs0
/sbin/ifconfig $1 0.0.0.0 down
ovs-vsctl del-port ${switch} $1
Comment 2 Qian Guo 2012-12-07 08:26:02 EST
Additional info:

This bug could be reproduced 100% when kill the qemu-kvm process e.g.
#kill -9 $pid of qemu-kvm
Comment 3 Amos Kong 2012-12-10 23:29:05 EST
Close this bug according to comment #2.
Comment 4 Amos Kong 2012-12-10 23:30:46 EST
Sorry, I made a mistake. Please ignore comment #3
Comment 5 Amos Kong 2012-12-11 00:46:05 EST
(In reply to comment #2)
> Additional info:
> 
> This bug could be reproduced 100% when kill the qemu-kvm process e.g.
> #kill -9 $pid of qemu-kvm

downscript could not be executed if you use 'SIGKILL' to kill qemu process.
downscript can be executed to cleanup tap if you kill by default signal of kill

# kill $qemu-pid

However, the problem in comment #1 is a real bug.

====

tap device would be created when net_init_clients() is called.
'device' option is parsed after calling net_init_clients().
we should call net_cleanup() when device parse fails.


I did a quick fix, the tap device should be removed in the situation of comment #1.
But there are many "exit(1)" after calling net_init_clients() in vl.c, it's ugly to call net_cleanup() before each exit.
Not sure if we have some exit(1) in other sub functions, which is also called after calling net_init_clients().

@@ -3882,8 +3889,11 @@ int main(int argc, char **argv, char **envp)
     }

     /* init generic devices */
-    if (qemu_opts_foreach(qemu_find_opts("device"), device_init_func, NULL, 1) != 0)
+    if (qemu_opts_foreach(qemu_find_opts("device"), device_init_func,
+                          NULL, 1) != 0) {
+        net_cleanup();
         exit(1);
+    }
Comment 7 Amos Kong 2012-12-18 05:10:17 EST
Posted patch to upstream:
http://lists.nongnu.org/archive/html/qemu-devel/2012-12/msg01348.html
Comment 17 Qian Guo 2013-07-03 23:23:44 EDT
1.Reproduced this bug with qemu-kvm-0.12.1.2-2.335.el6.x86_64
steps:
1.run guest like this 
<qemu-kvm cmdline>...-netdev tap,id=hostnet0,vhost=on,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown -device virtio-pci-net,netdev=hostnet0,id=virt-net0,mac=54:52:1a:32:b4:01 ...

which virtio-pci-net is  a wrong discription

Then qemu-kvm quit w/ following messages:
qemu-kvm: -device virtio-pci-net,netdev=hostnet0,id=virt-net0,mac=54:52:1a:32:b4:01: Parameter 'driver' expects a driver name
Try with argument '?' for a list.

Result:tap0 is still in the ovs bridge, So, base on above testing, this bug is reproduced

# ovs-vsctl show
83f619a3-afd0-47ce-8ac7-c716daa4f662
    Bridge "ovs0"
        Port "eth0"
            Interface "eth0"
        Port "ovs0"
            Interface "ovs0"
                type: internal
        Port "tap0"
            Interface "tap0"
    ovs_version: "1.9.0"


Verify this bug w/ qemu-kvm-0.12.1.2-2.377.el6.x86_64:
Steps:
1.run guest like this 
<qemu-kvm cmdline>...-netdev tap,id=hostnet0,vhost=on,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown -device virtio-pci-net,netdev=hostnet0,id=virt-net0,mac=54:52:1a:32:b4:01 ...

which virtio-pci-net is  a wrong discription

Then qemu-kvm quit w/ following messages:
qemu-kvm: -device virtio-pci-net,netdev=hostnet0,id=virt-net0,mac=54:52:1a:32:b4:01: Parameter 'driver' expects a driver name
Try with argument '?' for a list.

Result:There's no tap device in the ovs bridge, so base on above testing, this bug is verified by qemu-kvm-0.12.1.2-2.377.el6.x86_64 .
# ovs-vsctl show
83f619a3-afd0-47ce-8ac7-c716daa4f662
    Bridge "ovs0"
        Port "eth0"
            Interface "eth0"
        Port "ovs0"
            Interface "ovs0"
                type: internal
    ovs_version: "1.9.0"
Comment 19 errata-xmlrpc 2013-11-21 00:58:30 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2013-1553.html

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