4.8. 为 overcloud 节点获取镜像

director 需要几个磁盘镜像用于置备 overcloud 节点:

  • 一个内省内核和 ramdisk 用于通过 PXE 引导进行裸机系统内省。
  • 一个实施内核和 ramdisk 用于系统置备和部署。
  • overcloud 内核、ramdisk 和完整镜像形成写到节点硬盘中的基本 overcloud 系统。

以下操作过程旨在展示如何获取并安装这些镜像。

4.8.1. 单个 CPU 架构 overcloud

使用默认 CPU 架构 x86-64 部署 overcloud,需要这些镜像和过程。

步骤

  1. 查找 stackrc 文件,以启用 director 命令行工具:

    [stack@director ~]$ source ~/stackrc
  2. 安装 rhosp-director-imagesrhosp-director-images-ipa 软件包:

    (undercloud) [stack@director ~]$ sudo dnf install rhosp-director-images rhosp-director-images-ipa
  3. 将镜像存档解包到 stack 用户主目录 (/home/stack/images) 中的 images 目录中:

    (undercloud) [stack@director ~]$ cd ~/images
    (undercloud) [stack@director images]$ for i in /usr/share/rhosp-director-images/overcloud-full-latest-16.1.tar /usr/share/rhosp-director-images/ironic-python-agent-latest-16.1.tar; do tar -xvf $i; done
  4. 把这些镜像导入到 director:

    (undercloud) [stack@director images]$ openstack overcloud image upload --image-path /home/stack/images/

    此脚本将以下镜像上传到 director:

    • overcloud-full
    • overcloud-full-initrd
    • overcloud-full-vmlinuz

    另外,此脚本还会在 director PXE 服务器上安装内省镜像。

  5. 验证镜像是否已成功上传:

    (undercloud) [stack@director images]$ openstack image list
    +--------------------------------------+------------------------+
    | ID                                   | Name                   |
    +--------------------------------------+------------------------+
    | ef793cd0-e65c-456a-a675-63cd57610bd5 | overcloud-full         |
    | 9a51a6cb-4670-40de-b64b-b70f4dd44152 | overcloud-full-initrd  |
    | 4f7e33f4-d617-47c1-b36f-cbe90f132e5d | overcloud-full-vmlinuz |
    +--------------------------------------+------------------------+

    此列表不显示内省 PXE 镜像。director 将这些文件复制到 /var/lib/ironic/httpboot

    (undercloud) [stack@director images]$ ls -l /var/lib/ironic/httpboot
    total 417296
    -rwxr-xr-x. 1 root  root    6639920 Jan 29 14:48 agent.kernel
    -rw-r--r--. 1 root  root  420656424 Jan 29 14:48 agent.ramdisk
    -rw-r--r--. 1 42422 42422       758 Jan 29 14:29 boot.ipxe
    -rw-r--r--. 1 42422 42422       488 Jan 29 14:16 inspector.ipxe

4.8.2. 多个 CPU 架构 overcloud

部署 overcloud 以启用对附加 CPU 架构的支持需要这些镜像和操作。

以下示例步骤使用 ppc64le 镜像。

步骤

  1. 查找 stackrc 文件,以启用 director 命令行工具:

    [stack@director ~]$ source ~/stackrc
  2. 安装 rhosp-director-images-all 软件包:

    (undercloud) [stack@director ~]$ sudo dnf install rhosp-director-images-all
  3. 将存档解包到特定于架构的目录中,该目录位于 stack 用户的主目录下的 images 目录 (/home/stack/images) 中:

    (undercloud) [stack@director ~]$ cd ~/images
    (undercloud) [stack@director images]$ for arch in x86_64 ppc64le ; do mkdir $arch ; done
    (undercloud) [stack@director images]$ for arch in x86_64 ppc64le ; do for i in /usr/share/rhosp-director-images/overcloud-full-latest-16.1-${arch}.tar /usr/share/rhosp-director-images/ironic-python-agent-latest-16.1-${arch}.tar ; do tar -C $arch -xf $i ; done ; done
  4. 把这些镜像导入到 director:

    (undercloud) [stack@director ~]$ cd ~/images
    (undercloud) [stack@director images]$ openstack overcloud image upload --local --image-path ~/images/ppc64le --architecture ppc64le --whole-disk --http-boot /var/lib/ironic/tftpboot/ppc64le
    (undercloud) [stack@director images]$ openstack overcloud image upload --local --image-path ~/images/x86_64/ --http-boot /var/lib/ironic/tftpboot

    这些命令将以下镜像导入到 director:

    • overcloud-full
    • overcloud-full-initrd
    • overcloud-full-vmlinuz
    • ppc64le-bm-deploy-kernel
    • ppc64le-bm-deploy-ramdisk
    • ppc64le-overcloud-full

      另外,此脚本还会在 director PXE 服务器上安装内省镜像。

  5. 验证镜像是否已成功上传:

    (undercloud) [stack@director images]$ openstack image list
    +--------------------------------------+---------------------------+--------+
    | ID                                   | Name                      | Status |
    +--------------------------------------+---------------------------+--------+
    | 6a6096ba-8f79-4343-b77c-4349f7b94960 | overcloud-full            | active |
    | de2a1bde-9351-40d2-bbd7-7ce9d6eb50d8 | overcloud-full-initrd     | active |
    | 67073533-dd2a-4a95-8e8b-0f108f031092 | overcloud-full-vmlinuz    | active |
    | 69a9ffe5-06dc-4d81-a122-e5d56ed46c98 | ppc64le-bm-deploy-kernel  | active |
    | 464dd809-f130-4055-9a39-cf6b63c1944e | ppc64le-bm-deploy-ramdisk | active |
    | f0fedcd0-3f28-4b44-9c88-619419007a03 | ppc64le-overcloud-full    | active |
    +--------------------------------------+---------------------------+--------+

    此列表不显示内省 PXE 镜像。director 会把这些文件复制到 /tftpboot

    (undercloud) [stack@director images]$ ls -l /var/lib/ironic/tftpboot /var/lib/ironic/tftpboot/ppc64le/
    /var/lib/ironic/tftpboot:
    total 422624
    -rwxr-xr-x. 1 root   root     6385968 Aug  8 19:35 agent.kernel
    -rw-r--r--. 1 root   root   425530268 Aug  8 19:35 agent.ramdisk
    -rwxr--r--. 1 ironic ironic     20832 Aug  8 02:08 chain.c32
    -rwxr--r--. 1 ironic ironic    715584 Aug  8 02:06 ipxe.efi
    -rw-r--r--. 1 root   root          22 Aug  8 02:06 map-file
    drwxr-xr-x. 2 ironic ironic        62 Aug  8 19:34 ppc64le
    -rwxr--r--. 1 ironic ironic     26826 Aug  8 02:08 pxelinux.0
    drwxr-xr-x. 2 ironic ironic        21 Aug  8 02:06 pxelinux.cfg
    -rwxr--r--. 1 ironic ironic     69631 Aug  8 02:06 undionly.kpxe
    
    /var/lib/ironic/tftpboot/ppc64le/:
    total 457204
    -rwxr-xr-x. 1 root             root              19858896 Aug  8 19:34 agent.kernel
    -rw-r--r--. 1 root             root             448311235 Aug  8 19:34 agent.ramdisk
    -rw-r--r--. 1 ironic-inspector ironic-inspector       336 Aug  8 02:06 default

4.8.3. 最小 overcloud 镜像

如果您不希望运行其他 Red Hat OpenStack Platform 服务或消耗您的一项订阅授权,您可以使用 overcloud-minimal 镜像来置备裸机操作系统。

步骤

  1. 查找 stackrc 文件,以启用 director 命令行工具:

    [stack@director ~]$ source ~/stackrc
  2. 安装 overcloud-minimal 软件包:

    (undercloud) [stack@director ~]$ sudo dnf install rhosp-director-images-minimal
  3. 将镜像存档解包到 stack 用户主目录 (/home/stack/images) 中的 images 目录中:

    (undercloud) [stack@director ~]$ cd ~/images
    (undercloud) [stack@director images]$ tar xf /usr/share/rhosp-director-images/overcloud-minimal-latest-16.1.tar
  4. 将镜像导入 director:

    (undercloud) [stack@director images]$ openstack overcloud image upload --image-path /home/stack/images/ --os-image-name overcloud-minimal.qcow2

    此脚本将以下镜像上传到 director:

    • overcloud-minimal
    • overcloud-minimal-initrd
    • overcloud-minimal-vmlinuz
  5. 验证镜像是否已成功上传:

    (undercloud) [stack@director images]$ openstack image list
    +--------------------------------------+---------------------------+
    | ID                                   | Name                      |
    +--------------------------------------+---------------------------+
    | ef793cd0-e65c-456a-a675-63cd57610bd5 | overcloud-full            |
    | 9a51a6cb-4670-40de-b64b-b70f4dd44152 | overcloud-full-initrd     |
    | 4f7e33f4-d617-47c1-b36f-cbe90f132e5d | overcloud-full-vmlinuz    |
    | 32cf6771-b5df-4498-8f02-c3bd8bb93fdd | overcloud-minimal         |
    | 600035af-dbbb-4985-8b24-a4e9da149ae5 | overcloud-minimal-initrd  |
    | d45b0071-8006-472b-bbcc-458899e0d801 | overcloud-minimal-vmlinuz |
    +--------------------------------------+---------------------------+
注意

默认的 overcloud-full.qcow2 镜像是一种平面分区镜像。但是,您仍可以导入和使用完整的磁盘镜像。有关更多信息,请参见 第 23 章 创建完整磁盘镜像