From ab0492a364b8d5ed20948e4de67f03dacaa3c38d Mon Sep 17 00:00:00 2001 From: Ian Pilcher Date: Tue, 16 Jan 2018 15:21:46 -0600 Subject: [PATCH] Use dd conv=sparse when writing images to nodes When using whole disk images, one generally wants the *virtual* size of the image to be close to the size of the overcloud nodes' physical disks (since no partition/logical volume/filesystem expansion is done). As an example, one might end up with a 4GB overcloud image (QCOW file) that has a virtual size of 100GB or more. Ironic uses qemu-img to convert this QCOW file to a "raw" image, which is a *sparse* file. When the image is copied to an overcloud node's disk (via iSCSI), we currently write all 100GB (mainly of zeroes) across the network to the node's disk. Adding conv=sparse to the dd command makes it skip the "holes" in the image file; it will only the write the portions of the image that actually contain data across the network. Closes-Bug #1743651 Change-Id: Ief3688b210c3b19ce8be45c5f9571b7ba6e79127 --- ironic_lib/disk_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ironic_lib/disk_utils.py b/ironic_lib/disk_utils.py index c8115512..a3be10e5 100644 --- a/ironic_lib/disk_utils.py +++ b/ironic_lib/disk_utils.py @@ -291,7 +291,8 @@ def is_block_device(dev): def dd(src, dst): """Execute dd from src to dst.""" - utils.dd(src, dst, 'bs=%s' % CONF.disk_utils.dd_block_size, 'oflag=direct') + utils.dd(src, dst, 'bs=%s' % CONF.disk_utils.dd_block_size, 'oflag=direct', + 'conv=sparse') def qemu_img_info(path):