Merge "Add warning for no active nics"
This commit is contained in:
commit
60475755e3
@ -98,6 +98,8 @@ def _numbered_nics(nic_mapping=None):
|
||||
|
||||
_NUMBERED_NICS[nic_alias] = nic_mapped
|
||||
logger.info("%s mapped to: %s" % (nic_alias, nic_mapped))
|
||||
if not _NUMBERED_NICS:
|
||||
logger.warning('No active nics found.')
|
||||
return _NUMBERED_NICS
|
||||
|
||||
|
||||
|
@ -569,3 +569,9 @@ class TestNumberedNicsMapping(base.TestCase):
|
||||
mapping = {'nic1': '12:34:56:de:f0:12', 'nic2': '12:34:56:78:9a:bc'}
|
||||
expected = {'nic1': 'em2', 'nic2': 'em1'}
|
||||
self.assertEqual(expected, objects._numbered_nics(nic_mapping=mapping))
|
||||
|
||||
def test_numbered_nics_no_active(self):
|
||||
self._stub_active_nics([])
|
||||
expected = {}
|
||||
# This only emits a warning, so it should still work
|
||||
self.assertEqual(expected, objects._numbered_nics())
|
||||
|
Loading…
x
Reference in New Issue
Block a user