Merge "Clean up logging related to new state machine"
This commit is contained in:
commit
3e55bfe541
@ -72,12 +72,12 @@ class NodeInfo(object):
|
|||||||
finished_at=None, error=None, node=None, ports=None,
|
finished_at=None, error=None, node=None, ports=None,
|
||||||
ironic=None, lock=None):
|
ironic=None, lock=None):
|
||||||
self.uuid = uuid
|
self.uuid = uuid
|
||||||
self._version_id = version_id
|
|
||||||
self._state = state
|
|
||||||
self.started_at = started_at
|
self.started_at = started_at
|
||||||
self.finished_at = finished_at
|
self.finished_at = finished_at
|
||||||
self.error = error
|
self.error = error
|
||||||
self.invalidate_cache()
|
self.invalidate_cache()
|
||||||
|
self._version_id = version_id
|
||||||
|
self._state = state
|
||||||
self._node = node
|
self._node = node
|
||||||
if ports is not None and not isinstance(ports, dict):
|
if ports is not None and not isinstance(ports, dict):
|
||||||
ports = {p.address: p for p in ports}
|
ports = {p.address: p for p in ports}
|
||||||
@ -98,8 +98,10 @@ class NodeInfo(object):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"""Self represented as an UUID and a state."""
|
"""Self represented as an UUID and a state."""
|
||||||
return _("%(uuid)s state %(state)s") % {'uuid': self.uuid,
|
parts = [self.uuid]
|
||||||
'state': self._state}
|
if self._state:
|
||||||
|
parts += [_('state'), self._state]
|
||||||
|
return ' '.join(parts)
|
||||||
|
|
||||||
def acquire_lock(self, blocking=True):
|
def acquire_lock(self, blocking=True):
|
||||||
"""Acquire a lock on the associated node.
|
"""Acquire a lock on the associated node.
|
||||||
@ -555,10 +557,6 @@ def fsm_event_before(event, strict=False):
|
|||||||
'%(func)s', {'event': event, 'func': func},
|
'%(func)s', {'event': event, 'func': func},
|
||||||
node_info=node_info)
|
node_info=node_info)
|
||||||
node_info.fsm_event(event, strict=strict)
|
node_info.fsm_event(event, strict=strict)
|
||||||
LOG.debug('Calling: %(func)s(<node>, *%(args_)s, '
|
|
||||||
'**%(kwargs_)s)', {'func': func, 'args_': args,
|
|
||||||
'kwargs_': kwargs},
|
|
||||||
node_info=node_info)
|
|
||||||
return func(node_info, *args, **kwargs)
|
return func(node_info, *args, **kwargs)
|
||||||
return inner
|
return inner
|
||||||
return outer
|
return outer
|
||||||
@ -576,10 +574,6 @@ def fsm_event_after(event, strict=False):
|
|||||||
def outer(func):
|
def outer(func):
|
||||||
@six.wraps(func)
|
@six.wraps(func)
|
||||||
def inner(node_info, *args, **kwargs):
|
def inner(node_info, *args, **kwargs):
|
||||||
LOG.debug('Calling: %(func)s(<node>, *%(args_)s, '
|
|
||||||
'**%(kwargs_)s)', {'func': func, 'args_': args,
|
|
||||||
'kwargs_': kwargs},
|
|
||||||
node_info=node_info)
|
|
||||||
ret = func(node_info, *args, **kwargs)
|
ret = func(node_info, *args, **kwargs)
|
||||||
LOG.debug('Processing event %(event)s after calling '
|
LOG.debug('Processing event %(event)s after calling '
|
||||||
'%(func)s', {'event': event, 'func': func},
|
'%(func)s', {'event': event, 'func': func},
|
||||||
|
@ -112,7 +112,12 @@ class TestProcessingLogger(base.BaseTest):
|
|||||||
|
|
||||||
def test_prefix_NodeInfo_instance(self):
|
def test_prefix_NodeInfo_instance(self):
|
||||||
node_info = node_cache.NodeInfo('NNN')
|
node_info = node_cache.NodeInfo('NNN')
|
||||||
self.assertEqual('[node: NNN state None]',
|
self.assertEqual('[node: NNN]',
|
||||||
|
utils.processing_logger_prefix(node_info=node_info))
|
||||||
|
|
||||||
|
def test_prefix_NodeInfo_instance_with_state(self):
|
||||||
|
node_info = node_cache.NodeInfo('NNN', state='foobar')
|
||||||
|
self.assertEqual('[node: NNN state foobar]',
|
||||||
utils.processing_logger_prefix(node_info=node_info))
|
utils.processing_logger_prefix(node_info=node_info))
|
||||||
|
|
||||||
def test_adapter_no_bmc(self):
|
def test_adapter_no_bmc(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user