From 12f5f30e630b98c8b69d4aa201f5c23b2ca85824 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Wed, 8 Dec 2021 09:56:46 +0000 Subject: Instruct qemu-img to write image zeros to disk. Doing this will cause it not to zero out the entire block device which can be very costly on a slow HDD. Story: 2009227 Task: 43315 Change-Id: I62ba2afc037d9844387e6b0984fe5008779d95d2 --- ironic_python_agent/extensions/standby.py | 5 +++-- ironic_python_agent/tests/unit/extensions/test_standby.py | 3 ++- lower-constraints.txt | 4 ++-- releasenotes/notes/qemu-write-zeros-2edbf3152c57e2b6.yaml | 6 ++++++ requirements.txt | 4 ++-- 5 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/qemu-write-zeros-2edbf3152c57e2b6.yaml diff --git a/ironic_python_agent/extensions/standby.py b/ironic_python_agent/extensions/standby.py index 623423b9..1e7855c4 100644 --- a/ironic_python_agent/extensions/standby.py +++ b/ironic_python_agent/extensions/standby.py @@ -200,12 +200,13 @@ def _write_whole_disk_image(image, image_info, device): disk_utils.udev_settle() command = ['qemu-img', 'convert', - '-t', 'directsync', '-O', 'host_device', '-W', + '-t', 'directsync', '-S', '0', '-O', 'host_device', '-W', image, device] LOG.info('Writing image with command: %s', ' '.join(command)) try: disk_utils.convert_image(image, device, out_format='host_device', - cache='directsync', out_of_order=True) + cache='directsync', out_of_order=True, + sparse_size='0') except processutils.ProcessExecutionError as e: raise errors.ImageWriteError(device, e.exit_code, e.stdout, e.stderr) diff --git a/ironic_python_agent/tests/unit/extensions/test_standby.py b/ironic_python_agent/tests/unit/extensions/test_standby.py index 559a15bb..bce88a00 100644 --- a/ironic_python_agent/tests/unit/extensions/test_standby.py +++ b/ironic_python_agent/tests/unit/extensions/test_standby.py @@ -182,7 +182,8 @@ class TestStandbyExtension(base.IronicAgentTest): convert_mock.assert_called_once_with(location, device, out_format='host_device', cache='directsync', - out_of_order=True) + out_of_order=True, + sparse_size='0') wipe_mock.assert_called_once_with(device, '') udev_mock.assert_called_once_with() rescan_mock.assert_called_once_with(device) diff --git a/lower-constraints.txt b/lower-constraints.txt index 6e5fc9bc..8fbb7f13 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -6,7 +6,7 @@ cryptography==2.3 dogpile.cache==0.9.2 eventlet==0.18.2 importlib_metadata==1.7.0;python_version<'3.8' -ironic-lib==4.7.1 +ironic-lib==5.1.0 netifaces==0.10.4 openstacksdk==0.49.0 oslo.concurrency==3.26.0 @@ -14,7 +14,7 @@ oslo.config==5.2.0 oslo.log==3.36.0 oslo.serialization==2.18.0 oslo.service==1.24.0 -oslo.utils==3.33.0 +oslo.utils==3.34.0 oslotest==3.2.0 pbr==2.0.0 psutil==3.2.2 diff --git a/releasenotes/notes/qemu-write-zeros-2edbf3152c57e2b6.yaml b/releasenotes/notes/qemu-write-zeros-2edbf3152c57e2b6.yaml new file mode 100644 index 00000000..8b79dc23 --- /dev/null +++ b/releasenotes/notes/qemu-write-zeros-2edbf3152c57e2b6.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + IPA instructs qemu-img to write image zeros to disk. + Doing this will cause it not to zero out the entire + block device which can be very costly on a slow HDD. diff --git a/requirements.txt b/requirements.txt index 69d886cd..cadb5c30 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,13 +10,13 @@ oslo.concurrency>=3.26.0 # Apache-2.0 oslo.log>=3.36.0 # Apache-2.0 oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0 oslo.service!=1.28.1,>=1.24.0 # Apache-2.0 -oslo.utils>=3.33.0 # Apache-2.0 +oslo.utils>=3.34.0 # Apache-2.0 Pint>=0.5 # BSD psutil>=3.2.2 # BSD pyudev>=0.18 # LGPLv2.1+ requests>=2.14.2 # Apache-2.0 stevedore>=1.20.0 # Apache-2.0 tenacity>=6.2.0 # Apache-2.0 -ironic-lib>=4.7.1 # Apache-2.0 +ironic-lib>=5.1.0 # Apache-2.0 Werkzeug>=1.0.1 # BSD License cryptography>=2.3 # BSD/Apache-2.0 -- cgit v1.2.1