Merge "Added cloud-init growpart element"

This commit is contained in:
Zuul 2022-10-13 20:41:55 +00:00 committed by Gerrit Code Review
commit ea7de37ccb
6 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,17 @@
===================
cloud-init-growpart
===================
This element enables growpart for OS images. It allows to grow
Specific partitions during the deployment process.
To enable this element simply include it in the elements list.
**Disclaimer:** This element might not work with some device names supplied, for example when server is deployed and the image is written to a fibre channel device, or a SAS/SATA SSD controller.
* ``DIB_CLOUD_INIT_GROWPART_DEVICES``: List of partition names that needs to be populated in order to be grown by cloud-init. **Populating this variable is mandatory.**
Cloud-init growpart module documentation - https://cloudinit.readthedocs.io/en/latest/topics/modules.html?highlight=growpart#growpart
Dependencies:
* ``/usr/bin/growpart``: **is needed on the system in order to grow the partition**,
however it is part of different packages depending on linux family. That is already taken care of by package-installs.

View File

@ -0,0 +1,2 @@
package-installs
pkg-map

View File

@ -0,0 +1 @@
growpart_package:

View File

@ -0,0 +1,10 @@
{
"family": {
"redhat": {
"growpart_package": "cloud-utils-growpart"
},
"debian": {
"growpart_package": "cloud-guest-utils"
}
}
}

View File

@ -0,0 +1,25 @@
#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
if [[ -n ${DIB_CLOUD_INIT_GROWPART_DEVICES} ]]; then
if [ -d /etc/cloud/cloud.cfg.d ]; then
cat > /etc/cloud/cloud.cfg.d/55-growpart.cfg <<EOF
#cloud-config
growpart:
mode: auto
devices: $DIB_CLOUD_INIT_GROWPART_DEVICES
ignore_growroot_disabled: false
EOF
else
echo "The /etc/cloud/cloud.cfg.d directory must exist."
exit 1
fi
else
echo "Set the device list in DIB_CLOUD_INIT_GROWPART_DEVICES."
exit 1
fi

View File

@ -0,0 +1,7 @@
---
features:
- |
Added growpart element. It allows for growing specific partitions
during the deployment, which will result in less post deploy actions
needed for the server to be ready for use.