Handle inst not found exceptions in pollsters
Updates the CPU/Net/Disk compute pollsters so we handle instance not found exceptions. These types of exceptions may occur when an instance has been deleted during sample processing. Fixes LP Bug #1223098. Change-Id: Icc8a79f8c23276b68aa27e758872ff80ad484061
This commit is contained in:
parent
46b51362da
commit
7aeefa0e99
@ -21,6 +21,7 @@
|
|||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
from ceilometer.compute import plugin
|
from ceilometer.compute import plugin
|
||||||
from ceilometer.compute.pollsters import util
|
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 log
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
@ -44,6 +45,9 @@ class CPUPollster(plugin.ComputePollster):
|
|||||||
volume=cpu_info.time,
|
volume=cpu_info.time,
|
||||||
additional_metadata=cpu_num,
|
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:
|
except Exception as err:
|
||||||
LOG.error('could not get CPU time for %s: %s',
|
LOG.error('could not get CPU time for %s: %s',
|
||||||
instance.id, err)
|
instance.id, err)
|
||||||
|
@ -24,6 +24,7 @@ import collections
|
|||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
from ceilometer.compute import plugin
|
from ceilometer.compute import plugin
|
||||||
from ceilometer.compute.pollsters import util
|
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 log
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
@ -86,6 +87,9 @@ class _Base(plugin.ComputePollster):
|
|||||||
instance_name,
|
instance_name,
|
||||||
)
|
)
|
||||||
yield self._get_sample(instance, c_data)
|
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:
|
except Exception as err:
|
||||||
LOG.warning('Ignoring instance %s: %s',
|
LOG.warning('Ignoring instance %s: %s',
|
||||||
instance_name, err)
|
instance_name, err)
|
||||||
|
@ -23,6 +23,7 @@ import copy
|
|||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
from ceilometer.compute import plugin
|
from ceilometer.compute import plugin
|
||||||
from ceilometer.compute.pollsters import util
|
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 log
|
||||||
from ceilometer.openstack.common import timeutils
|
from ceilometer.openstack.common import timeutils
|
||||||
|
|
||||||
@ -83,6 +84,9 @@ class _Base(plugin.ComputePollster):
|
|||||||
LOG.info(self.NET_USAGE_MESSAGE, instance_name,
|
LOG.info(self.NET_USAGE_MESSAGE, instance_name,
|
||||||
vnic.name, info.rx_bytes, info.tx_bytes)
|
vnic.name, info.rx_bytes, info.tx_bytes)
|
||||||
yield self._get_sample(instance, vnic, info)
|
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:
|
except Exception as err:
|
||||||
LOG.warning('Ignoring instance %s: %s',
|
LOG.warning('Ignoring instance %s: %s',
|
||||||
instance_name, err)
|
instance_name, err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user