Revert "Add hypervisor inspector sanity check"

This change have introduced an issue, when the libvirt unix socket
is created after Ceilometer start. The pollster is disabled when
it should wait that libvirt come up.

The intent of the original bug was only to have a cosmetic logs
when the configuration file is wrong.

Also I don't see a safe way to disable the pollster when we can't
connect to libvirt, the reason is always unknown from Ceilometer PoV.

This reverts commit d17e75d267.

Closes-bug: #1649921
Change-Id: I63479d19fcf4a99fb198859c2e6ae370ff0e24e1
(cherry picked from commit 72b5a1e2bc)
This commit is contained in:
Mehdi Abaakouk 2016-11-28 13:14:54 +01:00
parent c4b08affa7
commit d84b976c85
5 changed files with 0 additions and 48 deletions

View File

@ -25,11 +25,6 @@ from ceilometer.compute.virt import inspector as virt_inspector
@six.add_metaclass(abc.ABCMeta)
class BaseComputePollster(plugin_base.PollsterBase):
def setup_environment(self):
super(BaseComputePollster, self).setup_environment()
# propagate exception from check_sanity
self.inspector.check_sanity()
@property
def inspector(self):
try:

View File

@ -216,22 +216,10 @@ class NoDataException(InspectorException):
pass
class NoSanityException(InspectorException):
pass
# Main virt inspector abstraction layering over the hypervisor API.
#
class Inspector(object):
def check_sanity(self):
"""Check the sanity of hypervisor inspector.
Each subclass could overwrite it to throw any exception
when detecting mis-configured inspector
"""
pass
def inspect_cpus(self, instance):
"""Inspect the CPU statistics for an instance.

View File

@ -84,10 +84,6 @@ class LibvirtInspector(virt_inspector.Inspector):
return self._connection
def check_sanity(self):
if not self.connection:
raise virt_inspector.NoSanityException()
@retry_on_disconnect
def _lookup_by_uuid(self, instance):
instance_name = util.instance_name(instance)

View File

@ -49,9 +49,6 @@ class TestPollsterBuilder(agentbase.TestPollster):
return [('builder1', cls()), ('builder2', cls())]
@mock.patch('ceilometer.compute.pollsters.'
'BaseComputePollster.setup_environment',
mock.Mock(return_value=None))
class TestManager(base.BaseTestCase):
def setUp(self):
super(TestManager, self).setUp()
@ -243,9 +240,6 @@ class TestRunTasks(agentbase.BaseAgentManagerTestCase):
resource_metadata=agentbase.default_test_data.resource_metadata)
@staticmethod
@mock.patch('ceilometer.compute.pollsters.'
'BaseComputePollster.setup_environment',
mock.Mock(return_value=None))
def create_manager():
return manager.AgentManager()

View File

@ -437,24 +437,3 @@ class TestLibvirtInspectionWithError(base.BaseTestCase):
def test_inspect_unknown_error(self):
self.assertRaises(virt_inspector.InspectorException,
self.inspector.inspect_cpus, 'foo')
class TestLibvirtInitWithError(base.BaseTestCase):
def setUp(self):
super(TestLibvirtInitWithError, self).setUp()
self.inspector = libvirt_inspector.LibvirtInspector()
libvirt_inspector.libvirt = mock.Mock()
def test_init_error(self):
with mock.patch.object(libvirt_inspector.libvirt,
'openReadOnly',
return_value=None):
self.assertRaises(virt_inspector.NoSanityException,
self.inspector.check_sanity)
def test_init_exception(self):
with mock.patch.object(libvirt_inspector.libvirt,
'openReadOnly',
side_effect=ImportError):
self.assertRaises(ImportError, self.inspector.check_sanity)