Merge "Handle inst not found exceptions in pollsters"

This commit is contained in:
Jenkins 2013-09-13 01:53:34 +00:00 committed by Gerrit Code Review
commit 53f770b0ea
3 changed files with 12 additions and 0 deletions

View File

@ -21,6 +21,7 @@
from ceilometer import sample
from ceilometer.compute import plugin
from ceilometer.compute.pollsters import util
from ceilometer.compute.virt import inspector as virt_inspector
from ceilometer.openstack.common import log
LOG = log.getLogger(__name__)
@ -44,6 +45,9 @@ class CPUPollster(plugin.ComputePollster):
volume=cpu_info.time,
additional_metadata=cpu_num,
)
except virt_inspector.InstanceNotFoundException as err:
# Instance was deleted while getting samples. Ignore it.
LOG.debug('Exception while getting samples %s', err)
except Exception as err:
LOG.error('could not get CPU time for %s: %s',
instance.id, err)

View File

@ -24,6 +24,7 @@ import collections
from ceilometer import sample
from ceilometer.compute import plugin
from ceilometer.compute.pollsters import util
from ceilometer.compute.virt import inspector as virt_inspector
from ceilometer.openstack.common import log
LOG = log.getLogger(__name__)
@ -86,6 +87,9 @@ class _Base(plugin.ComputePollster):
instance_name,
)
yield self._get_sample(instance, c_data)
except virt_inspector.InstanceNotFoundException as err:
# Instance was deleted while getting samples. Ignore it.
LOG.debug('Exception while getting samples %s', err)
except Exception as err:
LOG.warning('Ignoring instance %s: %s',
instance_name, err)

View File

@ -23,6 +23,7 @@ import copy
from ceilometer import sample
from ceilometer.compute import plugin
from ceilometer.compute.pollsters import util
from ceilometer.compute.virt import inspector as virt_inspector
from ceilometer.openstack.common import log
from ceilometer.openstack.common import timeutils
@ -83,6 +84,9 @@ class _Base(plugin.ComputePollster):
LOG.info(self.NET_USAGE_MESSAGE, instance_name,
vnic.name, info.rx_bytes, info.tx_bytes)
yield self._get_sample(instance, vnic, info)
except virt_inspector.InstanceNotFoundException as err:
# Instance was deleted while getting samples. Ignore it.
LOG.debug('Exception while getting samples %s', err)
except Exception as err:
LOG.warning('Ignoring instance %s: %s',
instance_name, err)