RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 852984 - virsh start command will be hung with openvswitch network interface
Summary: virsh start command will be hung with openvswitch network interface
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.4
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Laine Stump
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-08-30 07:45 UTC by Alex Jia
Modified: 2013-02-21 07:22 UTC (History)
6 users (show)

Fixed In Version: libvirt-0.10.2-0rc1.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-21 07:22:36 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
backtrace of hung libvirtd (83.00 KB, text/plain)
2012-08-30 07:50 UTC, Alex Jia
no flags Details
backtrace of hung libvirtd (27.23 KB, text/plain)
2012-08-30 07:53 UTC, Alex Jia
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2013:0276 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2013-02-20 21:18:26 UTC

Description Alex Jia 2012-08-30 07:45:49 UTC
Description of problem:
To add openvswitch network interface into guest then just build ovs without ovs configuration, virsh start <guest> will be hang forever. 

Version-Release number of selected component (if applicable):

# rpm -q kernel libvirt qemu-kvm-rhev
kernel-2.6.32-288.el6.x86_64
libvirt-0.10.0-1.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.302.el6.x86_64

# ovs-vsctl --version
ovs-vsctl (Open vSwitch) 1.4.2
Compiled Aug 30 2012 10:58:29


How reproducible:
always

Steps to Reproduce:
1. To build ovs according to the following guide:

# wget http://openvswitch.org/releases/openvswitch-1.4.2.tar.gz
# tar zxvf openvswitch-1.4.2.tar.gz
# cd openvswitch-1.4.2
# ./boot.sh && % ./configure --prefix=/usr --localstatedir=/var
# make && make install
# ovs-vsctl --version

2. Don't need to do any ovs configuration, for example, you will see the following error:

# ovs-vsctl show
Aug 30 15:42:34|00001|stream_unix|ERR|/tmp/stream-unix.26185.0: connection to /var/run/openvswitch/db.sock failed: No such file or directory
Aug 30 15:42:34|00002|reconnect|WARN|unix:/var/run/openvswitch/db.sock: connection attempt failed (No such file or directory)

3. To define a virtual network like this:

# virsh net-dumpxml ovs-net
<network>
  <name>ovs-net</name>
  <uuid>6fa8aa9c-4a37-ded6-20c0-5c53786a5a4a</uuid>
  <forward mode='nat'/>
  <bridge name='ovsbr0' stp='on' delay='0' />
  <mac address='52:54:00:D0:D6:A3'/>
  <ip address='192.168.100.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.100.2' end='192.168.122.254' />
    </dhcp>
  </ip>
</network>

4. To add openvswitch network interface into guest:

# virsh dumpxml foo
<domain type='kvm'>
  <name>foo</name>
  <uuid>492d9815-7eba-3d09-d857-63b1dc423ec7</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>524288</currentMemory>
  <vcpu placement='static'>5</vcpu>
  <os>
    <type arch='x86_64' machine='rhel6.2.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    ......
    </controller>
    <interface type='network'>
      <mac address='52:54:00:97:47:62'/>
      <source network='default'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='bridge'>
      <mac address='52:54:00:ca:b4:39'/>
      <source bridge='ovsbr0'/>
      <virtualport type='openvswitch'>
        <parameters interfaceid='3e092f81-7e82-fc95-47a1-8f5a5d3c389d'/>
      </virtualport>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </interface>
    ......
  </devices>
</domain>

5. To start the guest

# virsh start foo

Actual results:
virsh start will be hang forever, and all of virsh commands also are hang.

Expected results:
Successfully start the guest.

Additional info:

# ps -ef | grep -E "[O|o]vs"
nobody   25598     1  0 15:20 ?        00:00:00 /usr/sbin/dnsmasq --strict-order --bind-interfaces --local=// --domain-needed --filterwin2k --pid-file=/var/run/libvirt/network/ovs-net.pid --conf-file= --except-interface lo --listen-address 192.168.100.1 --dhcp-range 192.168.100.2,192.168.122.254 --dhcp-leasefile=/var/lib/libvirt/dnsmasq/ovs-net.leases --dhcp-lease-max=5885 --dhcp-no-override
root     26472 26293  0 15:48 ?        00:00:00 ovs-vsctl -- --may-exist add-port ovsbr0 vnet1

Comment 1 Alex Jia 2012-08-30 07:50:21 UTC
Created attachment 608065 [details]
backtrace of hung libvirtd

Comment 3 Alex Jia 2012-08-30 07:53:14 UTC
Created attachment 608066 [details]
backtrace of hung libvirtd

Comment 4 Daniel Veillard 2012-08-30 08:56:27 UTC
should be fixed upstream now,

commit 5e465df6be8bcb00f0b4bff831e91f4042fae272
Author: Kyle Mestery <kmestery>
Date:   Wed Aug 29 14:44:36 2012 -0400

    Fix a crash when using Open vSwitch virtual ports
    
    Fixup buffer usage when handling VLANs. Also fix the logic
    used to determine if the virNetDevVlanPtr is valid or not.
    Fixes crashes in the latest code when using Open vSwitch
    virtualports.
    
    Signed-off-by: Kyle Mestery <kmestery>

Comment 5 Daniel Veillard 2012-08-30 09:01:43 UTC
Ah, hum, no looking at the backtrace it's likely to be a different problem ...

Daniel

Comment 6 Alex Jia 2012-08-30 09:52:48 UTC
(In reply to comment #5)
> Ah, hum, no looking at the backtrace it's likely to be a different problem
> ...
> 
> Daniel

Yes, it's diffrent issue, so move the bug to 'NEW' again, I just simply configured ovs and also could meet this issue:

# ps -ef | grep --color -E "[O|o]vs"
nobody   23555     1  0 17:47 ?        00:00:00 /usr/sbin/dnsmasq --strict-order --bind-interfaces --local=// --domain-needed --filterwin2k --pid-file=/var/run/libvirt/network/ovs-net.pid --conf-file= --except-interface lo --listen-address 192.168.100.1 --dhcp-range 192.168.100.2,192.168.122.254 --dhcp-leasefile=/var/lib/libvirt/dnsmasq/ovs-net.leases --dhcp-lease-max=5885 --dhcp-no-override
root     23581 21962  0 17:47 ?        00:00:00 ovs-vsctl -- --may-exist add-port ovsbr0 vnet0  -- set Interface vnet0 external-ids:attached-mac="52:54:00:79:50:4F" -- set Interface vnet0 external-ids:iface-id="9189f2ed-9aba-0e0f-35ad-83050282a3c7" -- set Interface vnet0 external-ids:vm-id="af57deb3-98a3-6cb7-b611-d63bcde2d7d5" -- set Interface vnet0 external-ids:iface-status=active

Comment 7 Laine Stump 2012-09-04 18:20:48 UTC
The problem is that, by default, ovs-vsctl will wait forever for ovs-vswitchd to respond, even if ovs-vswitchd isn't running.

The ovs-vsctl manpage recommends adding "--no-wait" to the ovs-vsctl commandline if you know that ovs-vswitchd isn't running, but of course we *don't* know that (and anyway, when I tested  --nowait just now, I found that it had absolutely no effect for the ovs-vsctl addport command).

An alternative is to set a timeout for the command with "--timeout=n" (all of this information is from the ovs-vsctl manpage). In this case, ovs-vsctl *will* exit with SIGALRM after the specified number of seconds. So the only trick is in figuring out the optimal setting for this - a shorter time means a greater likelyhood of false failure, but a longer time means a much longer stderr message in the logs. My preference is for longer messages, but greater reliability.

Comment 8 Laine Stump 2012-09-06 14:33:09 UTC
Pushed the following patch upstream:

commit 98e732fc34a47ad9dfdb64aa4207623ee4c1ebcd
Author: Laine Stump <laine>
Date:   Tue Sep 4 15:26:29 2012 -0400

    network: prevent infinite hang if ovs-vswitchd isn't running
    
    This fixes https://bugzilla.redhat.com/show_bug.cgi?id=852984
    
    If a network or interface is configured to use Open vSwitch, but
    ovs-vswitchd (the Open vSwitch database service) isn't running, the
    ovs-vsctl add-port/del-port commands will hang indefinitely rather
    than returning an error. There is a --nowait option, but that appears
    to have no effect on add-port and del-port commands, so instead we add
    a --timeout=5 to the commands - they will retry for up to 5 seconds,
    then fail if there is no response.

Comment 10 yanbing du 2012-09-20 10:55:22 UTC
Test with libvirt-0.10.2-0rc1.el6.x86_64, and the virsh command hang issue is fixed.
Following the steps in comment 0, when start guest, will get an error, but virsh will not hang.
# virsh start aaa
error: Failed to start domain aaa
error: Unable to add port vnet0 to OVS bridge ovsbr0: Operation not permitted

libvirtd.log
------
2012-09-20 10:08:16.957+0000: 22402: error : virCommandWait:2345 : internal error Child process (ovs-vsctl --timeout=5 -- --may-exist add-port ovsbr0 vnet0 -- set Interface vnet0 'external-ids:attached-mac="52:54:00:CA:B4:39"' -- set Interface vnet0 'external-ids:iface-id="3e092f81-7e82-fc95-47a1-8f5a5d3c389d"' -- set Interface vnet0 'external-ids:vm-id="59fa20eb-dfb1-7dc8-2158-7888dbbec13b"' -- set Interface vnet0 external-ids:iface-status=active) unexpected fatal signal 14: 2012-09-20T10:08:10Z|00002|stream_unix|ERR|/var/run/openvswitch/db.sock: connection failed (No such file or directory)
2012-09-20T10:08:10Z|00003|reconnect|WARN|unix:/var/run/openvswitch/db.sock: connection attempt failed (No such file or directory)
2012-09-20T10:08:11Z|00004|stream_unix|ERR|/var/run/openvswitch/db.sock: connection failed (No such file or directory)
2012-09-20T10:08:11Z|00005|reconnect|WARN|unix:/var/run/openvswitch/db.sock: connection attempt failed (No such file or directory)
2012-09-20T10:08:13Z|00006|stream_unix|ERR|/var/run/openvswitch/db.sock: connection failed (No such file or directory)
2012
2012-09-20 10:08:16.957+0000: 22402: error : virNetDevOpenvswitchAddPort:136 : Unable to add port vnet0 to OVS bridge ovsbr0: Operation not permitted
2012-09-20 10:08:17.007+0000: 22402: error : virCommandWait:2345 : internal error Child process (ovs-vsctl --timeout=5 -- --if-exists del-port) unexpected exit status 1: ovs-vsctl: 'del-port' command requires at least 1 arguments

2012-09-20 10:08:17.007+0000: 22402: error : virNetDevOpenvswitchRemovePort:173 : Unable to delete port (null) from OVS: Operation not permitted
------

Comment 11 errata-xmlrpc 2013-02-21 07:22:36 UTC
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-0276.html


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