Libvirt driver should reply with a meaningful exception, when connection to libvirt is broken

Bug #1240344 reported by Vladik Romanovsky
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Vladik Romanovsky

Bug Description

Currently, when libvirt connection is broken, there is no meaningful exception being thrown. Instead, every call result in a mutlple traces, as below.
This makes it imposible to handle these exceptions properly in the higher levels.

2013-10-11 15:06:25.179 DEBUG nova.virt.libvirt.driver [req-cd22b4f2-0bfe-4d93-b191-02736ac8a437 None None] Connecting to libvirt: qemu:///system from (pid=28433) _get_connection /home/vladikr/devel/openstack/nova/nova/virt/libvirt/driver.py:600
2013-10-11 15:06:25.180 ERROR nova.virt.libvirt.driver [-] Connection to libvirt failed: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
2013-10-11 15:06:25.180 TRACE nova.virt.libvirt.driver Traceback (most recent call last):
2013-10-11 15:06:25.180 TRACE nova.virt.libvirt.driver File "/home/vladikr/devel/openstack/nova/nova/virt/libvirt/driver.py", line 694, in _connect
2013-10-11 15:06:25.180 TRACE nova.virt.libvirt.driver return libvirt.openAuth(uri, auth, flags)
2013-10-11 15:06:25.180 TRACE nova.virt.libvirt.driver File "/usr/lib64/python2.7/site-packages/libvirt.py", line 102, in openAuth
2013-10-11 15:06:25.180 TRACE nova.virt.libvirt.driver if ret is None:raise libvirtError('virConnectOpenAuth() failed')
2013-10-11 15:06:25.180 TRACE nova.virt.libvirt.driver libvirtError: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
2013-10-11 15:06:25.180 TRACE nova.virt.libvirt.driver
----------------------------------------------------------------------------------------------------------
2013-10-11 15:06:25.188 WARNING nova.virt.libvirt.driver [req-cd22b4f2-0bfe-4d93-b191-02736ac8a437 None None] URI qemu:///system does not support events
Traceback (most recent call last):
  File "/usr/lib64/python2.7/logging/__init__.py", line 851, in emit
2013-10-11 15:06:25.190 ERROR nova.openstack.common.periodic_task [req-cd22b4f2-0bfe-4d93-b191-02736ac8a437 None None] Error during ComputeManager.update_available_resource: 'N
oneType' object has no attribute 'getInfo'
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task Traceback (most recent call last):
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task File "/home/vladikr/devel/openstack/nova/nova/openstack/common/periodic_task.py", line 180, in run_periodic_
tasks
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task task(self, context)
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task File "/home/vladikr/devel/openstack/nova/nova/compute/manager.py", line 4867, in update_available_resource
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task rt.update_available_resource(context)
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task File "/home/vladikr/devel/openstack/nova/nova/openstack/common/lockutils.py", line 246, in inner
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task return f(*args, **kwargs)
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task File "/home/vladikr/devel/openstack/nova/nova/compute/resource_tracker.py", line 274, in update_available_resource
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task resources = self.driver.get_available_resource(self.nodename)
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task File "/home/vladikr/devel/openstack/nova/nova/virt/libvirt/driver.py", line 3744, in get_available_resource
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task stats = self.host_state.get_host_stats(refresh=True)
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task File "/home/vladikr/devel/openstack/nova/nova/virt/libvirt/driver.py", line 4779, in get_host_stats
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task self.update_status()
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task File "/home/vladikr/devel/openstack/nova/nova/virt/libvirt/driver.py", line 4813, in update_status
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task data["memory_mb"] = self.driver.get_memory_mb_total()
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task File "/home/vladikr/devel/openstack/nova/nova/virt/libvirt/driver.py", line 3383, in get_memory_mb_total
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task return self._conn.getInfo()[1]
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task AttributeError: 'NoneType' object has no attribute 'getInfo'
2013-10-11 15:06:25.190 TRACE nova.openstack.common.periodic_task
q

Tags: libvirt
Changed in nova:
assignee: nobody → Vladik Romanovsky (vladik-romanovsky-r)
tags: added: libvirt
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/52184
Committed: http://github.com/openstack/nova/commit/86be0b7fdf1af20403e0d763b86da06849bcc437
Submitter: Jenkins
Branch: master

commit 86be0b7fdf1af20403e0d763b86da06849bcc437
Author: Vladik Romanovsky <email address hidden>
Date: Tue Oct 22 11:12:37 2013 -0400

    Reply with a meaningful exception, when libvirt connection is broken.

    Libvirt driver will respond with a meaningful error on any
    command, when the connection to the libvirt service is broken.

    Closes-bug: #1240344
    Change-Id: I823fefaffcf969ecf9eb853ac99dc18cef92d137

Changed in nova:
status: New → Fix Committed
Changed in nova:
milestone: none → icehouse-1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-1 → 2014.1
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.