During the creation of a disk image (e.g. for a VM), there is the need to create, setup, configure and afterwards detach some kind of storage where the newly installed OS can be copied to or directly installed in.
The implementation for this proposed changed already exists, was discussed and is currently waiting for reviews [1]. To have a complete overview over the block device setup, this document is provided.
The dependencies are not implemented as they should be, because
When setting up a block device there is the need to partitioning the block device.
User (Actor: End User) wants to create multiple partitions in multiple block devices where the new system is installed in.
The user wants to specify if the image should be optimized for speed or for size.
The user wants the same behavior independently of the current host or target OS.
Move the partitioning functionality from elements/vm/block-device.d/10-partition to a new block_device python module: level1/partitioning.py.
Instead of using a program or a library, the data is written directly with the help of python file.write() into the disk image.
The existing implementation uses the parted program (old versions of DIB were using sfdisk). The first implementations of this change used the python-parted library.
All these approaches have a major drawback: they automatically optimize based on information collected on the host system - and not of the target system. Therefore the resulting partitioning layout may lead to a degradation of performance on the target system. A change in these external programs and libraries also lead to errors during a DIB run [4] or there are general issues [7].
Also everything build around GNU parted falls under the GPL2 (not LGPL2) license - which is incompatible with the currently used Apache license in diskimage-builder.
Extends the (optional) environment variable
DIB_BLOCK_DEVICE_CONFIG
: a JSON structure to configure the
(complete) block device setup. For this proposal the second entry in
the original list will be used (the first part (as described in [5])
is used by the level 0 modules).
The name of this module is partitioning (element[0]). The value (element[1]) is a dictionary.
For each disk that should be partitioned there exists one entry in the dictionary. The key is the name of the disk (see [5] how to specify names for block device level 0). The value is a dictionary that defines the partitioning of each disk.
There are the following key / value pairs to define one disk:
The following key / value pairs can be given for each partition:
(optional) List of flags for the partition. Default: empty. Possible values:
Example:
["partitioning",
{"rootdisk": {
"label": "mbr",
"partitions":
[{"name": "part-01",
"flags": ["boot"],
"size": "100%"}]}}]
None - functionality stays the same.
None.
Measurements showed there is a performance degradation for the target system of the partition table is not correctly aligned: writing takes about three times longer on an incorrect aligned system vs. one that is correctly aligned.
None - this is already a small part of a bigger change [1].
None.
The refactoring introduces no new test cases: the functionality is tested during each existing test building VM images.
End user: the additional environment variable is described.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.