Browse Source

Merge "Stop running a periodic task for the noop PXE filter" into stable/ussuri

changes/13/739813/1
Zuul 3 weeks ago
committed by Gerrit Code Review
parent
commit
c4b29de9a0
3 changed files with 18 additions and 7 deletions
  1. +7
    -3
      ironic_inspector/conductor/manager.py
  2. +3
    -0
      ironic_inspector/pxe_filter/base.py
  3. +8
    -4
      ironic_inspector/test/unit/test_pxe_filter.py

+ 7
- 3
ironic_inspector/conductor/manager.py View File

@@ -88,10 +88,14 @@ class ConductorManager(object):
spacing=CONF.clean_up_period
)(sync_with_ironic)

callables = [(periodic_clean_up_, None, None),
(sync_with_ironic_, None, None)]
driver_task = driver.get_periodic_sync_task()
if driver_task is not None:
callables.append((driver_task, None, None))

self._periodics_worker = periodics.PeriodicWorker(
callables=[(driver.get_periodic_sync_task(), None, None),
(periodic_clean_up_, None, None),
(sync_with_ironic_, None, None)],
callables=callables,
executor_factory=periodics.ExistingExecutor(utils.executor()),
on_failure=self._periodics_watchdog)



+ 3
- 0
ironic_inspector/pxe_filter/base.py View File

@@ -205,6 +205,9 @@ class BaseFilter(interface.FilterDriver):
class NoopFilter(BaseFilter):
"""A trivial PXE boot filter."""

def get_periodic_sync_task(self):
return None


_DRIVER_MANAGER = None



+ 8
- 4
ironic_inspector/test/unit/test_pxe_filter.py View File

@@ -28,6 +28,10 @@ from ironic_inspector.test import base as test_base
CONF = cfg.CONF


class TestFilter(pxe_filter.BaseFilter):
pass


class TestDriverManager(test_base.BaseTest):
def setUp(self):
super(TestDriverManager, self).setUp()
@@ -90,7 +94,7 @@ class BaseFilterBaseTest(test_base.BaseTest):
self.mock_bounded_semaphore = self.useFixture(
fixtures.MockPatchObject(semaphore, 'BoundedSemaphore')).mock
self.mock_bounded_semaphore.return_value = self.mock_lock
self.driver = pxe_filter.NoopFilter()
self.driver = TestFilter()

def assert_driver_is_locked(self):
"""Assert the driver is currently locked and wasn't locked before."""
@@ -142,10 +146,10 @@ class TestBaseFilterFsmPrecautions(BaseFilterBaseTest):
def setUp(self):
super(TestBaseFilterFsmPrecautions, self).setUp()
self.mock_fsm = self.useFixture(
fixtures.MockPatchObject(pxe_filter.NoopFilter, 'fsm')).mock
fixtures.MockPatchObject(TestFilter, 'fsm')).mock
# NOTE(milan): overriding driver so that the patch ^ is applied
self.mock_bounded_semaphore.reset_mock()
self.driver = pxe_filter.NoopFilter()
self.driver = TestFilter()
self.mock_reset = self.useFixture(
fixtures.MockPatchObject(self.driver, 'reset')).mock

@@ -168,7 +172,7 @@ class TestBaseFilterFsmPrecautions(BaseFilterBaseTest):
raise automaton_errors.NotFound('Oops!')

self.assertRaisesRegex(pxe_filter.InvalidFilterDriverState,
'.*NoopFilter.*Oops!', fun)
'.*TestFilter.*Oops!', fun)
self.mock_reset.assert_not_called()

def test_fsm_reset_on_error_ctx_custom_error(self):


Loading…
Cancel
Save