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
This commit is contained in:
Ian Pilcher 2018-01-16 15:21:46 -06:00
parent ef1596988a
commit ab0492a364
1 changed files with 2 additions and 1 deletions

View File

@ -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):