Replace existing virt-customize usage with tripleo-mount-image

The `tripleo-mount-image` tool was created as an alternative for
kpartx-based customizations which do not support the multiple mount
points of overcloud-hardened-uefi-full.qcow2.

virt-customize sets a machine-id in the image, which results in all
overcloud nodes having the same machine-id [1]. virt-customize can
also be very slow on virtualized underclouds.

This change replaces virt-customize usage with
tripleo-mount-image+chroot as the recommended tool for overcloud image
customizations.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1554546

Change-Id: I3f65479777cc3dfa1ed3c396dbfbe182288ae65b
This commit is contained in:
Steve Baker 2022-04-04 11:25:09 +12:00
parent d2579125e8
commit cb6bef5615
2 changed files with 33 additions and 18 deletions

View File

@ -370,18 +370,28 @@ kernel module is deployed on the host
.....................................
The kernel module is deployed on the base Operating System via RPM or DKMS.
It is suggested to deploy the module via virt-customize.
The libguestfs-tools package contains the virt-customize tool. Install the libguestfs-tools::
Deploy the module by using the ``tripleo-mount-image`` tool and create a
``chroot``.
sudo yum install libguestfs-tools
First you need to create a repository file where the module will be downloaded from, and copy the repo file into the image::
Then you need to create a repository file where the module will be downloaded from, and uplaod the repo into the image::
temp_dir=$(mktemp -d)
sudo tripleo-mount-image -a /path/to/overcloud-full.qcow2 -m $temp_dir
sudo cp my-repo.repo $temp_dir/etc/yum.repos.d/
virt-customize --selinux-relabel -a overcloud-full.qcow2 --upload my-repo.repo:/etc/yum.repos.d/
You can now start a chroot and install the rpm that contains the kernel module::
Once the repository is deployed, you can now install the rpm that contains the kernel module::
sudo mount -o bind /dev $temp_dir/dev/
sudo cp /etc/resolv.conf $temp_dir/etc/resolv.conf
sudo chroot $temp_dir /bin/bash
dnf install my-rpm
exit
virt-customize --selinux-relabel -a overcloud-full.qcow2 --install my-rpm
Then unmount the image::
sudo rm $temp_dir/etc/resolv.conf
sudo umount $temp_dir/dev
sudo tripleo-unmount-image -m $temp_dir
Now that the rpm is deployed with the kernel module, we need to configure TripleO to load it.
To configure an extra kernel module named "dpdk_module" for a specific role, we would add::

View File

@ -71,20 +71,25 @@ Before deploying the Overcloud
1. Install client packages on overcloud-full image:
- Prepare installation script::
- Mount the image and create a chroot::
cat >install.sh<<EOF
#!/usr/bin/sh
yum install -y centos-release-opstools
yum install -y sensu fluentd collectd
EOF
temp_dir=$(mktemp -d)
sudo tripleo-mount-image -a /path/to/overcloud-full.qcow2 -m $temp_dir
sudo mount -o bind /dev $temp_dir/dev/
sudo cp /etc/resolv.conf $temp_dir/etc/resolv.conf
sudo chroot $temp_dir /bin/bash
- Run the script using virt-customize::
- Install the packages inside the chroot::
LIBGUESTFS_BACKEND=direct virt-customize -a /path/to/overcloud-full.qcow2 \
--upload install.sh:/tmp/install.sh \
--run-command "sh /tmp/install.sh" \
--selinux-relabel
dnf install -y centos-release-opstools
dnf install -y sensu fluentd collectd
exit
- Unmount the image::
sudo rm $temp_dir/etc/resolv.conf
sudo umount $temp_dir/dev
sudo tripleo-unmount-image -m $temp_dir
- Upload new image to undercloud image registry::