summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Lindgren <hanlind@kth.se>2013-05-29 22:59:41 +0200
committerHans Lindgren <hanlind@kth.se>2013-06-03 21:13:01 +0200
commiteb40b5ab13d11e773eb0c78084e9935fcd5a6552 (patch)
tree2b3a07c032caa440f9a3c8d164342df0fc061ab7
parent783b0e836d9ba0630d4745a6457144fac6dfa9f0 (diff)
downloadnova-eb40b5ab13d11e773eb0c78084e9935fcd5a6552.tar.gz
nova-eb40b5ab13d11e773eb0c78084e9935fcd5a6552.tar.xz
nova-eb40b5ab13d11e773eb0c78084e9935fcd5a6552.zip
Stop libvirt errors from outputting to strerr
When a libvirt error happens, the default is to output to stderr. This behavior can be omitted by registering a new error that simply passes without doing anything. Resolves bug 1182184. Change-Id: If946f9d05388c93c0630d454e5ca3b6625bb14f9
-rw-r--r--nova/tests/virt/libvirt/fakelibvirt.py4
-rwxr-xr-xnova/virt/libvirt/driver.py6
2 files changed, 10 insertions, 0 deletions
diff --git a/nova/tests/virt/libvirt/fakelibvirt.py b/nova/tests/virt/libvirt/fakelibvirt.py
index 30c3e4d9c..9594757a8 100644
--- a/nova/tests/virt/libvirt/fakelibvirt.py
+++ b/nova/tests/virt/libvirt/fakelibvirt.py
@@ -914,6 +914,10 @@ def virEventRegisterDefaultImpl():
pass
+def registerErrorHandler(handler, ctxt):
+ pass
+
+
virDomain = Domain
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index 7af7e4e2a..09af56847 100755
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -289,6 +289,11 @@ MIN_LIBVIRT_LIVESNAPSHOT_VERSION = (1, 0, 0)
MIN_QEMU_LIVESNAPSHOT_VERSION = (1, 3, 0)
+def libvirt_error_handler(ctxt, err):
+ # Just ignore instead of default outputting to stderr.
+ pass
+
+
class LibvirtDriver(driver.ComputeDriver):
capabilities = {
@@ -543,6 +548,7 @@ class LibvirtDriver(driver.ComputeDriver):
dispatch_thread = eventlet.spawn(self._dispatch_thread)
def init_host(self, host):
+ libvirt.registerErrorHandler(libvirt_error_handler, None)
libvirt.virEventRegisterDefaultImpl()
if not self.has_min_version(MIN_LIBVIRT_VERSION):