summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Anders <janders@redhat.com>2021-03-02 15:37:35 +1000
committerJacob Anders <janders@redhat.com>2021-03-02 15:37:35 +1000
commitd2127e7ef44260dec2fe07c12d0901db087d7932 (patch)
tree76d8517fdc818ba49da7f01fb105e7fe2bbd02bb
parent4a22c887f8f30ce18b23e3a7b4761e71512be7a5 (diff)
downloadironic-python-agent-d2127e7ef44260dec2fe07c12d0901db087d7932.tar.gz
Remove nvme-cli warning and delay on nvme-format
This change adds '-f' flag to nvme-cli calls during NVMe Secure Erase. This removes nvme-cli output warning that the device is about to be irreversibly deleted as well as the related 10 second delay which is pointlessly increasing NVMe cleaning time. Story: 2008290 Change-Id: I7b7b8b7d4f643b07d5c9dcf7ec35cf7ebedf44d1
-rw-r--r--ironic_python_agent/hardware.py2
-rw-r--r--ironic_python_agent/tests/unit/test_hardware.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/ironic_python_agent/hardware.py b/ironic_python_agent/hardware.py
index 020514ac..78d31bbb 100644
--- a/ironic_python_agent/hardware.py
+++ b/ironic_python_agent/hardware.py
@@ -1690,7 +1690,7 @@ class GenericHardwareManager(HardwareManager):
LOG.debug("Attempting to nvme-format %s using secure format mode "
"(ses) %s", block_device.name, format_mode)
utils.execute('nvme', 'format', block_device.name, '-s',
- format_mode)
+ format_mode, '-f')
LOG.info("nvme-cli format for device %s (ses= %s ) completed "
"successfully.", block_device.name, format_mode)
return True
diff --git a/ironic_python_agent/tests/unit/test_hardware.py b/ironic_python_agent/tests/unit/test_hardware.py
index e5e51cfd..22f8a188 100644
--- a/ironic_python_agent/tests/unit/test_hardware.py
+++ b/ironic_python_agent/tests/unit/test_hardware.py
@@ -3886,7 +3886,7 @@ class TestGenericHardwareManager(base.IronicAgentTest):
retval = self.hardware._nvme_erase(block_device)
mocked_execute.assert_has_calls([
mock.call('nvme', 'id-ctrl', '/dev/nvme0n1', '-o', 'json'),
- mock.call('nvme', 'format', '/dev/nvme0n1', '-s', 2),
+ mock.call('nvme', 'format', '/dev/nvme0n1', '-s', 2, '-f'),
])
self.assertTrue(retval)
@@ -3910,7 +3910,7 @@ class TestGenericHardwareManager(base.IronicAgentTest):
retval = self.hardware._nvme_erase(block_device)
mocked_execute.assert_has_calls([
mock.call('nvme', 'id-ctrl', '/dev/nvme0n1', '-o', 'json'),
- mock.call('nvme', 'format', '/dev/nvme0n1', '-s', 1),
+ mock.call('nvme', 'format', '/dev/nvme0n1', '-s', 1, '-f'),
])
self.assertTrue(retval)