summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ironic_python_agent/burnin.py8
-rw-r--r--ironic_python_agent/hardware.py7
-rw-r--r--ironic_python_agent/tests/unit/test_burnin.py21
3 files changed, 34 insertions, 2 deletions
diff --git a/ironic_python_agent/burnin.py b/ironic_python_agent/burnin.py
index 375f11d3..f3918173 100644
--- a/ironic_python_agent/burnin.py
+++ b/ironic_python_agent/burnin.py
@@ -183,8 +183,16 @@ def fio_network(node):
"'agent_burnin_fio_network_config' in driver_info")
raise errors.CleaningError(error_msg)
LOG.debug("agent_burnin_fio_network_config is %s", str(config))
+
role = config.get('role')
+ if role not in NETWORK_BURNIN_ROLES:
+ error_msg = ("fio (network) found an unknown role: %s", role)
+ raise errors.CleaningError(error_msg)
+
partner = config.get('partner')
+ if not partner:
+ error_msg = ("fio (network) failed to find partner")
+ raise errors.CleaningError(error_msg)
_do_fio_network(role == 'writer', runtime, partner)
LOG.debug("fio (network): first direction done, swapping roles ...")
diff --git a/ironic_python_agent/hardware.py b/ironic_python_agent/hardware.py
index e963059f..fb743744 100644
--- a/ironic_python_agent/hardware.py
+++ b/ironic_python_agent/hardware.py
@@ -447,7 +447,7 @@ def list_all_block_devices(block_type='disk',
# media, however USB devices are also flagged as removable media.
# we have to explicitly do this as floppy disks are type disk.
if ignore_floppy and str(device.get('KNAME')).startswith('fd'):
- LOG.debug('Ignoring floppy disk device %s', device)
+ LOG.debug('Ignoring floppy disk device: %s', line)
continue
# Search for raid in the reply type, as RAID is a
@@ -456,7 +456,10 @@ def list_all_block_devices(block_type='disk',
# lvm, part, rom, loop
if devtype != block_type:
if devtype is None or ignore_raid:
- LOG.debug("Skipping: %s", line)
+ LOG.debug(
+ "TYPE did not match. Wanted: %(block_type)s but found: "
+ "%(line)s (RAID devices are ignored)",
+ {'block_type': block_type, 'line': line})
continue
elif ('raid' in devtype
and block_type in ['raid', 'disk']):
diff --git a/ironic_python_agent/tests/unit/test_burnin.py b/ironic_python_agent/tests/unit/test_burnin.py
index 18025b41..2258352e 100644
--- a/ironic_python_agent/tests/unit/test_burnin.py
+++ b/ironic_python_agent/tests/unit/test_burnin.py
@@ -198,6 +198,27 @@ class TestBurnin(base.IronicAgentTest):
self.assertRaises(errors.CommandExecutionError,
burnin.fio_network, node)
+ def test_fio_network_unknown_role(self, mock_execute):
+
+ node = {'driver_info': {'agent_burnin_fio_network_config':
+ {'partner': 'host-003', 'role': 'read'}}}
+
+ self.assertRaises(errors.CleaningError, burnin.fio_network, node)
+
+ def test_fio_network_no_role(self, mock_execute):
+
+ node = {'driver_info': {'agent_burnin_fio_network_config':
+ {'partner': 'host-003'}}}
+
+ self.assertRaises(errors.CleaningError, burnin.fio_network, node)
+
+ def test_fio_network_no_partner(self, mock_execute):
+
+ node = {'driver_info': {'agent_burnin_fio_network_config':
+ {'role': 'reader'}}}
+
+ self.assertRaises(errors.CleaningError, burnin.fio_network, node)
+
@mock.patch('time.sleep', autospec=True)
def test_fio_network_reader_loop(self, mock_time, mock_execute):