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.

  1. Create a qcow image 1. qemu-img create -f qcow2 /tmp/rocky8.qcow2 10G
  2. 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
  3. Run through the install as normal, using VNC
  4. Make sure to set the / partition as the only partition.
  5. Enable the network device
  6. Enable NTP
  7. Create a root user and password, but no other users
  8. Do a full install (not minimal :D)
  9. Once the install has finished reboot.
  10. Log in as the root user
  11. Install cloud-init
    1. yum install cloud-init
  12. Install grow-part
    1. yum install cloud-utils-growpart
  13. Disable ZEROCONF to ensure the metadata networks is accessible.
    1. echo "NOZEROCONF=yes" >> /etc/sysconfig/network
  14. 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
    1. console=tty0 console=ttyS0,115200n8
  15. 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.

  1. Check to ensure the required software is installed. 1. yum install mdadm nvme-cli rsyslog
  2. 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
  3. 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
  4. Rebuild initramfs. 1. dracut -f
  5. Power off the instance.
  6. Use virt-sysprep to prep the machine for use as an image. 1. virt-sysprep -d <domain_name>
  7. Convert image to RAW. 1. qemu-img convert diskimage.qcow2 diskimage.img

Until next time, Steve.