libvirt tests fail due to too many connections

Bug #1157992 reported by Vish Ishaya
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Vish Ishaya

Bug Description

Our libvirt unit tests can open too many connections to libvirt and cause a failure:

ft533.70: nova.tests.test_libvirt.LibvirtConnTestCase.test_xml_and_uri_no_ramdisk_StringException: Empty attachments:
  stderr
  stdout

pythonlogging:'nova': {{{
Loading network driver 'nova.network.linux_net'
Loading network driver 'nova.network.linux_net'
Loading network driver 'nova.network.linux_net'
URI qemu:///system does not support events
Loading network driver 'nova.network.linux_net'
Connection to libvirt failed: Cannot recv data: Connection reset by peer
Traceback (most recent call last):
  File "/home/jenkins/workspace/gate-nova-python27/nova/virt/libvirt/driver.py", line 625, in _connect
    return libvirt.openReadOnly(uri)
  File "/usr/lib/python2.7/dist-packages/libvirt.py", line 247, in openReadOnly
    if ret is None:raise libvirtError('virConnectOpenReadOnly() failed')
libvirtError: Cannot recv data: Connection reset by peer
URI qemu:///system does not support events
Connection to libvirt failed: Cannot write data: Broken pipe
Traceback (most recent call last):
  File "/home/jenkins/workspace/gate-nova-python27/nova/virt/libvirt/driver.py", line 625, in _connect
    return libvirt.openReadOnly(uri)
  File "/usr/lib/python2.7/dist-packages/libvirt.py", line 247, in openReadOnly
    if ret is None:raise libvirtError('virConnectOpenReadOnly() failed')
libvirtError: Cannot write data: Broken pipe
URI qemu:///system does not support events
}}}

Traceback (most recent call last):
  File "/home/jenkins/workspace/gate-nova-python27/nova/tests/test_libvirt.py", line 940, in test_xml_and_uri_no_ramdisk
    expect_kernel=True, expect_ramdisk=False)
  File "/home/jenkins/workspace/gate-nova-python27/nova/tests/test_libvirt.py", line 2012, in _check_xml_and_uri
    rescue=rescue)
  File "/home/jenkins/workspace/gate-nova-python27/nova/virt/libvirt/driver.py", line 2326, in to_xml
    disk_info, rescue, block_device_info)
  File "/home/jenkins/workspace/gate-nova-python27/nova/virt/libvirt/driver.py", line 2145, in get_guest_config
    guest.cpu = self.get_guest_cpu_config()
  File "/home/jenkins/workspace/gate-nova-python27/nova/virt/libvirt/driver.py", line 1996, in get_guest_cpu_config
    cpu = self.get_host_cpu_for_guest()
  File "/home/jenkins/workspace/gate-nova-python27/nova/virt/libvirt/driver.py", line 1937, in get_host_cpu_for_guest
    caps = self.get_host_capabilities()
  File "/home/jenkins/workspace/gate-nova-python27/nova/virt/libvirt/driver.py", line 1922, in get_host_capabilities
    xmlstr = self._conn.getCapabilities()
AttributeError: 'NoneType' object has no attribute 'getCapabilities'

Tags: libvirt
Changed in nova:
importance: Undecided → High
assignee: nobody → Vish Ishaya (vishvananda)
Revision history for this message
Rick Harris (rconradharris) wrote :

Was just looking at this.

Looks like _connect really shouldn't return None since so much of the rest of the code depends on it being present (and we probably don't want to add guards everywhere).

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/24946

Changed in nova:
status: New → In Progress
tags: added: libvirt
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/24946
Committed: http://github.com/openstack/nova/commit/8d5159dd6dd36d6f3d1aadc1123574c5b0aa0614
Submitter: Jenkins
Branch: master

commit 8d5159dd6dd36d6f3d1aadc1123574c5b0aa0614
Author: Vishvananda Ishaya <email address hidden>
Date: Wed Mar 20 16:37:42 2013 -0700

    Don't actually connect to libvirtd in unit tests.

    The libvirt tests shouldn't actually be connecting to libvirtd
    while running unit tests. Many of the tests were calling either
    getLibVersion or getCapabilites, which would start a connection.
    Fake these out so the tests can run properly without libvirtd.

    Fixes bug 1157992

    Change-Id: Iff1a60fc3cc912fdaf641f1f289744bcc9cc9736

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-1 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.