How to enable consistent network device names when creating a whole disk image

Solution In Progress - Updated -

Environment

  • Red Hat OpenStack Platform 16.2
  • Red Hat Enterprise Linux 8.2 Update KVM Guest Image

Issue

  • When creating a full disk image and deploying the overcloud, the NIC name is set as ethX.
  • net.ifnames=0 is set in /etc/default/grub
# virt-cat -a overcloud-hardened-uefi-full.qcow2 /etc/default/grub
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8 no_timer_check net.ifnames=0 crashkernel=auto"     <==(*)
GRUB_TIMEOUT=0
GRUB_ENABLE_BLSCFG=true
GRUB_DEVICE=LABEL=img-rootfs
GRUB_DISABLE_LINUX_UUID=true
GRUB_TIMEOUT=5
GRUB_TERMINAL="serial console"
GRUB_GFXPAYLOAD_LINUX=auto
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200 no_timer_check nofb nomodeset vga=normal console=tty0 console=ttyS0,115200 audit=1 nousb"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"

Resolution

  • net.ifnames=0 can be removed from GRUB_CMDLINE_LINUX by specifying the interface-names element when creating the image.

overcloud-hardened-images-uefi-python3.yaml:

disk_images:
  -
    imagename: overcloud-hardened-uefi-full
    type: qcow2
    elements:
      - openvswitch
...
      - openssh
      - disable-nouveau
      - interface-names                        <==(*)
    packages:
      - python3-psutil
...

Root Cause

  • The current RHEL8 KVM image has net.ifnames=0 set in the Kernel Args, which causes the NIC to be configured with ethX in the environment after image deployment.
  • Due to concerns about the impact of net.ifnames=0, tripleo has been modified to remove net.ifnames=0 from the Kernel Args when generating the image.

Diagnostic Steps

  • After creating a whole-disk image using the interface-names element, it is able to verify with virt-cat that net.ifnames=0 is not set in /etc/default/grub in the image.
[stack@imagebuild ~]$ cat overcloud-hardened-images-uefi-python3.yaml
disk_images:
  -
    imagename: overcloud-hardened-uefi-full
    type: qcow2
    elements:
      - openvswitch
...
      - openssh
      - disable-nouveau
      - interface-names                        <==(*)
    packages:
      - python3-psutil
...
[root@imagebuild ~]# virt-cat -a /home/stack/overcloud-hardened-uefi-full.qcow2 /etc/default/grub
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8 no_timer_check  crashkernel=auto"
GRUB_TIMEOUT=0
GRUB_ENABLE_BLSCFG=true
GRUB_DEVICE=LABEL=img-rootfs
GRUB_DISABLE_LINUX_UUID=true
GRUB_TIMEOUT=5
GRUB_TERMINAL="serial console"
GRUB_GFXPAYLOAD_LINUX=auto
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200 no_timer_check nofb nomodeset vga=normal console=tty0 console=ttyS0,115200 audit=1 nousb"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments