Skip to content

Commit 87baa22

Browse files
committed
Catch exceptions for interfaceStats in libvirt inspector
In the Libvirt inspector we call the interfaceStats() function but there is a race between us checking if the domain is stopped and calling interfaceStats. This adds a try-catch around interfaceStats the same way as is already done for blockStats etc. Closes-Bug: #2113768 Change-Id: I25ba64f5eefe8140b45bc4ff7e20c323dc5efd79 (cherry picked from commit 70a56ba) Signed-off-by: Tobias Urdin <tobias.urdin@binero.com>
1 parent 8dc61a6 commit 87baa22

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

ceilometer/compute/virt/libvirt/inspector.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,13 @@ def inspect_vnics(self, instance, duration):
114114
params['interfaceid'] = interfaceid
115115
params['bridge'] = bridge
116116

117-
dom_stats = domain.interfaceStats(name)
117+
try:
118+
dom_stats = domain.interfaceStats(name)
119+
except libvirt.libvirtError as ex:
120+
LOG.warning(_("Error from libvirt when running instanceStats, "
121+
"This may not be harmful, but please check : "
122+
"%(ex)s") % {'ex': ex})
123+
continue
118124

119125
# Retrieve previous values
120126
prev = self.cache.get(name)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
Fixed `bug #2113768 <https://bugs.launchpad.net/ceilometer/+bug/2113768>`__ where
5+
the Libvirt inspector did not catch exceptions thrown when calling interfaceStats
6+
function on a domain.

0 commit comments

Comments
 (0)