Rate This Document
Findability
Accuracy
Completeness
Readability

Creating User Images and Uploading Them to the Image Service

The BMS requires the deployment image and user image. The deployment image contains the ironic-python-agent service that is used to control and deploy bare metal instance nodes during BMS deployment. The user images are used by an end user. Perform the following operations on the controller node of OpenStack. The CentOS images are used as an example.

  1. Obtain x86 and Arm guest images.
    1
    2
    wget https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-2003.qcow2 --no-check-certificate
    wget https://cloud.centos.org/centos/7/images/CentOS-7-aarch64-GenericCloud-2003.qcow2 --no-check-certificate
    
  2. Add the user images of the bare metal instance to the Glance image service.
    1
    2
    glance image-create --name CentOS-7-x86_64-GenericCloud-2003 --visibility public --disk-format qcow2 --container-format bare < ./CentOS-7-x86_64-GenericCloud-2003.qcow2
    glance image-create --name CentOS-7-aarch64-GenericCloud-2003 --visibility public --disk-format qcow2 --container-format bare < ./CentOS-7-aarch64-GenericCloud-2003.qcow2
    
  3. Obtain the x86 deployment image.
    1
    2
    wget --no-check-certificate https://tarballs.opendev.org/openstack/ironic-python-agent/dib/files/ipa-centos7-stable-train.initramfs -o ipa-x86.initramfs
    wget --no-check-certificate https://tarballs.opendev.org/openstack/ironic-python-agent/dib/files/ipa-centos7-stable-train.kernel -o ipa-x86.kernel
    
  4. Add the x86 deployment image to the Glance image service.
    1
    2
    openstack image create ipa-x86-kernel --public --disk-format aki --container-format aki --file ipa-x86.kernel
    openstack image create ipa-x86-initrd --public --disk-format ari --container-format ari --file ipa-x86.initramfs
    
  5. Compile the Arm deployment image.

    Use ironic-python-agent-builder to compile the Arm deployment image. Because the latest ironic-python-agent-builder version does not support Python 2 (the latest version that supports Python 2 is 1.1.0), it is advised to upgrade Python 3 in another Arm environment and compile the deployment image. The following uses Python 3.9 as an example:

    1. Install ironic-python-agent-builder.
      1
      pip install ironic-python-agent-builder==5.2.0
      
    2. Install diskimage-builder.
      1
      pip install diskimage-builder==3.28.0
      
    3. Install setuptools.
      1
      pip install setuptools
      
    4. Set the environment variables.
      1
      2
      3
      4
      5
      6
      7
      8
      9
      export ARCH=aarch64
      export DIB_REPOREF_ironic_python_agent=stein-eol
      export DIB_REPOREF_requirements=stein-eol
      export DIB_RELEASE=7
      export DIB_PYTHON_EXEC="/usr/bin/python3"
      export DIB_DEV_USER_USERNAME=devuser
      export DIB_DEV_USER_PWDLESS_SUDO=YES
      export DIB_DEV_USER_PASSWORD=PASSWORD
      git config --global http.sslverify false
      

      In this document, all passwords are represented as PASSWORD. Use the actual password during the operation. PASSWORD indicates the password for logging in to the system during the deployment. The password can be customized. The default username is devuser.

    5. Modify the build tool.
      1. Create a /etc/resolv.conf file.
        touch /etc/resolv.conf
      2. Modify the 01-00-centos-python3 file.
        vi /usr/local/lib/python3.9/site-packages/diskimage_builder/elements/yum/pre-install.d/01-00-centos-python3

        The contents to be modified are highlighted in the following figure. Perform modification accordingly.

      3. Modify the 98-source-repositories file.
        vi /usr/local/lib/python3.9/site-packages/diskimage_builder/elements/source-repositories/extra-data.d/98-source-repositories

        The contents to be modified are highlighted in the following figure. Perform modification accordingly.

      4. Modify the install-packages file.
        vi /usr/local/lib/python3.9/site-packages/diskimage_builder/elements/yum/bin/install-packages

        The contents to be modified are highlighted in the following figure. Perform modification accordingly.

    6. Compile the deployment image.
      ironic-python-agent-builder -o ipa-aarch64 -e "devuser dynamic-login dhcp-all-interfaces deploy-baremetal" --release 7 centos-minimal --extra-args=-x

      After the compilation is complete, the ipa-aarch64.initramfs and ipa-aarch64.kernel files are generated as the AArch64 deployment image. Upload the two files to the controller node of OpenStack.

  6. Add the AArch64 deployment image to the Glance image service.
    1
    2
    openstack image create ipa-aarch64-kernel --public --disk-format aki --container-format aki --file ipa-aarch64.kernel
    openstack image create ipa-aarch64-initrd --public --disk-format ari --container-format ari --file ipa-aarch64.initramfs