Creating OpenStack (Ironic) Baremetal/Virtual images (Rocky 8)
Creating OpenStack (Ironic) Baremetal/Virtual images (Rocky 8)
I have the pleasure of operating an OpenStack cloud that provides both virtual instances, and access to full baremetal nodes as well.
Standard virtual images are usually availible direct from the big distributions, but sometimes when working with baremetal due to the way the cloud images are built, and some of our internal design choices the images provided by the distros dont work.
So if you ever need to build an image to work with OpenStack Ironic, and software RAID, the below might help.
This requires access to KVM and the ISO you wish to build from. These are rough notes.
- Create a qcow image 1.
qemu-img create -f qcow2 /tmp/rocky8.qcow2 10G
- Create a VM with 4 cores and 2Gb memory 1.
virt-install --virt-type kvm --vcpus 4 --name rocky --ram 2048 --disk rocky8.qcow2,format=qcow2 \
--network network=default --graphics vnc,listen=0.0.0.0 --noautoconsole --os-variant=rocky8.6 \
--cdrom=Rocky-8.8-x86_64-minimal.iso
- Run through the install as normal, using VNC
- Make sure to set the / partition as the only partition.
- Enable the network device
- Enable NTP
- Create a root user and password, but no other users
- Do a full install (not minimal :D)
- Once the install has finished reboot.
- Log in as the root user
- Install cloud-init
yum install cloud-init
- Install grow-part
- yum install cloud-utils-growpart
- Disable ZEROCONF to ensure the metadata networks is accessible.
echo "NOZEROCONF=yes" >> /etc/sysconfig/network
- Update grub to ensure console works with nova, and that the serial console works with Serial over Lan. Add the following to
GRUB_CMDLINE_LINUX
in/etc/default/grub
console=tty0 console=ttyS0,115200n8
- Remake the grub config. 1.
grub2-mkconfig -o /boot/grub2/grub.cfg
At this point if the image is not going to be used for a BareMetal ironic node with software RAID and or NVME drives your good to go. If not read on.
- Check to ensure the required software is installed. 1.
yum install mdadm nvme-cli rsyslog
- Add the following file to ensure NVME drivers are correctly loaded. 1.
cat > /etc/dracut.conf.d/10-nvme.conf <<EOF # dracut modules to add to the default add_dracutmodules+=" nvmf " add_drivers+=" nvme " EOF
- Add the following to ensure MDRAID drivers are available at boot. 1.
cat > /etc/dracut.conf.d/11-mdraid.conf <<EOF \# dracut modules to add to the default add_dracutmodules+=" dm mdraid " \# additional kernel modules to the default add_drivers+=" dm_raid dm_mod dm_mirror dm_log dm_region_hash raid1 " \# install local /etc/mdadm.conf mdadmconf="yes" EOF
- Rebuild initramfs. 1.
dracut -f
- Power off the instance.
- Use virt-sysprep to prep the machine for use as an image. 1.
virt-sysprep -d <domain_name>
- Convert image to RAW. 1.
qemu-img convert diskimage.qcow2 diskimage.img
Until next time, Steve.