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
This commit is contained in:
Derek Higgins 2021-12-08 09:56:46 +00:00
parent a35c77e62e
commit 12f5f30e63
5 changed files with 15 additions and 7 deletions

View File

@ -200,12 +200,13 @@ def _write_whole_disk_image(image, image_info, device):
disk_utils.udev_settle() disk_utils.udev_settle()
command = ['qemu-img', 'convert', command = ['qemu-img', 'convert',
'-t', 'directsync', '-O', 'host_device', '-W', '-t', 'directsync', '-S', '0', '-O', 'host_device', '-W',
image, device] image, device]
LOG.info('Writing image with command: %s', ' '.join(command)) LOG.info('Writing image with command: %s', ' '.join(command))
try: try:
disk_utils.convert_image(image, device, out_format='host_device', 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: except processutils.ProcessExecutionError as e:
raise errors.ImageWriteError(device, e.exit_code, e.stdout, e.stderr) raise errors.ImageWriteError(device, e.exit_code, e.stdout, e.stderr)

View File

@ -182,7 +182,8 @@ class TestStandbyExtension(base.IronicAgentTest):
convert_mock.assert_called_once_with(location, device, convert_mock.assert_called_once_with(location, device,
out_format='host_device', out_format='host_device',
cache='directsync', cache='directsync',
out_of_order=True) out_of_order=True,
sparse_size='0')
wipe_mock.assert_called_once_with(device, '') wipe_mock.assert_called_once_with(device, '')
udev_mock.assert_called_once_with() udev_mock.assert_called_once_with()
rescan_mock.assert_called_once_with(device) rescan_mock.assert_called_once_with(device)

View File

@ -6,7 +6,7 @@ cryptography==2.3
dogpile.cache==0.9.2 dogpile.cache==0.9.2
eventlet==0.18.2 eventlet==0.18.2
importlib_metadata==1.7.0;python_version<'3.8' importlib_metadata==1.7.0;python_version<'3.8'
ironic-lib==4.7.1 ironic-lib==5.1.0
netifaces==0.10.4 netifaces==0.10.4
openstacksdk==0.49.0 openstacksdk==0.49.0
oslo.concurrency==3.26.0 oslo.concurrency==3.26.0
@ -14,7 +14,7 @@ oslo.config==5.2.0
oslo.log==3.36.0 oslo.log==3.36.0
oslo.serialization==2.18.0 oslo.serialization==2.18.0
oslo.service==1.24.0 oslo.service==1.24.0
oslo.utils==3.33.0 oslo.utils==3.34.0
oslotest==3.2.0 oslotest==3.2.0
pbr==2.0.0 pbr==2.0.0
psutil==3.2.2 psutil==3.2.2

View File

@ -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.

View File

@ -10,13 +10,13 @@ oslo.concurrency>=3.26.0 # Apache-2.0
oslo.log>=3.36.0 # Apache-2.0 oslo.log>=3.36.0 # Apache-2.0
oslo.serialization!=2.19.1,>=2.18.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.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 Pint>=0.5 # BSD
psutil>=3.2.2 # BSD psutil>=3.2.2 # BSD
pyudev>=0.18 # LGPLv2.1+ pyudev>=0.18 # LGPLv2.1+
requests>=2.14.2 # Apache-2.0 requests>=2.14.2 # Apache-2.0
stevedore>=1.20.0 # Apache-2.0 stevedore>=1.20.0 # Apache-2.0
tenacity>=6.2.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 Werkzeug>=1.0.1 # BSD License
cryptography>=2.3 # BSD/Apache-2.0 cryptography>=2.3 # BSD/Apache-2.0