From Fedora Project Wiki
Creating an overcloud image builder instance
Start a QEMU instance
Use virt-install to install CentOS7 inside a VM.
[hamzy@pkvmci853 ~]$ sudo virsh destroy Overcloud; sudo virsh undefine Overcloud Domain Overcloud destroyed Domain Overcloud has been undefined [hamzy@pkvmci853 ~]$ sudo virt-install --virt-type kvm --name Overcloud --memory 32768 --graphics none --disk ~/libvirt/Overcloud.qcow2,format=qcow2 --network=bridge:virbr0 --os-type=linux --os-variant=centos7.0 --location=http://mirror.centos.org/altarch/7/os/ppc64le/ --extra-args="inst.text console=tty0 console=ttyS0,115200 ks=file:/anaconda-ks-overcloud.cfg" --initrd-inject ~/libvirt/anaconda-ks-overcloud.cfg ... Installation complete. Press return to quit ... Domain creation completed. Restarting guest. ...
Optionally, you can update the local hostname name for the VM. Libvirt configures dnsmasq to read the file /var/lib/libvirt/dnsmasq/default.addnhosts for hostnames.
[hamzy@pkvmci853 ~]$ (FILE=/home/hamzy/libvirt/mac-dns.txt; > ${FILE}; for VMNAME in DLRN Overcloud; do MAC1=$(sudo virsh dumpxml ${VMNAME} | awk -F "'" '/mac address/ { print $2; exit }'); MAC2=${MAC1^^}; MAC3=${MAC2//:}; printf "${MAC3}\t${VMNAME}.virbr0\n" >> ${FILE}; done; cat ${FILE}) 5254008E0DD2 DLRN.virbr0 525400CBFE22 Overcloud.virbr0 [hamzy@pkvmci853 ~]$ (FILE=/var/lib/libvirt/dnsmasq/default.addnhosts; sudo rm -f ${FILE}; sudo arp-scan --interface=virbr0 --macfile=/home/hamzy/libvirt/mac-dns.txt --localnet | head -n-3 | tail -n+3 | cut -f1,3- | sudo tee -a ${FILE}) 192.168.122.104 DLRN.virbr0 192.168.122.147 Overcloud.virbr0
Install diskimage-builder
Diskimage-builder needs a hack patch to disable using python-greenlet from the CentOS repository.
[hamzy@overcloud ~]$ git clone git://git.openstack.org/openstack/diskimage-builder [hamzy@overcloud ~]$ (cd diskimage-builder; cat << '__EOF__' | git am -) From b3bfe84ca40e70bce5609e274050e7e23bef00b9 Mon Sep 17 00:00:00 2001 From: Mark Hamzy <hamzy@us.ibm.com> Date: Tue, 1 Aug 2017 12:44:12 -0500 Subject: [PATCH] fix python-greenlet conflict --- diskimage_builder/elements/yum/extra-data.d/99-yum-repo-conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/diskimage_builder/elements/yum/extra-data.d/99-yum-repo-conf b/diskimage_builder/elements/yum/extra-data.d/99-yum-repo-conf index b5b6e98..9fb27d0 100755 --- a/diskimage_builder/elements/yum/extra-data.d/99-yum-repo-conf +++ b/diskimage_builder/elements/yum/extra-data.d/99-yum-repo-conf @@ -25,3 +25,5 @@ for file in $DIB_YUM_REPO_CONF; do sudo cp -L -f $file $TMP_MOUNT_PATH/etc/yum.repos.d done + +echo 'exclude=python-greenlet*' | sudo tee -a $TMP_MOUNT_PATH/etc/yum.repos.d/CentOS-Base.repo -- 1.8.3.1 __EOF__ [hamzy@overcloud ~]$ (cd diskimage-builder/; sudo pip install --upgrade --force-reinstall --requirement requirements.txt) [hamzy@overcloud ~]$ (cd diskimage-builder/; sudo python setup.py install --force)
Configure the repositories that the overcloud building process uses
[hamzy@overcloud ~]$ cat << __EOF__ | sudo tee -a /etc/yum.repos.d/DLRN.repo [DLRN] name=DLRN baseurl=https://trunk.rdoproject.org/centos7/current-passed-ci/ enabled=1 gpgcheck=0 cost=1 __EOF__ [hamzy@overcloud ~]$ cat << __EOF__ | sudo tee -a /etc/yum.repos.d/cloud7-openstack-common-candidate.repo [cloud7_openstack_common_candidate] name=cloud7_openstack_common_candidate baseurl=https://cbs.centos.org/repos/cloud7-openstack-common-candidate/ppc64le/os/ enabled=1 gpgcheck=0 cost=2 __EOF__ [hamzy@overcloud ~]$ cat << __EOF__ | sudo tee -a /etc/yum.repos.d/cloud7-openstack-common-testing.repo [cloud7_openstack_common_testing] name=cloud7_openstack_common_testing baseurl=https://cbs.centos.org/repos/cloud7-openstack-common-testing/ppc64le/os/ enabled=1 gpgcheck=0 cost=3 __EOF__ [hamzy@overcloud ~]$ cat << __EOF__ | sudo tee -a /etc/yum.repos.d/cloud7-openstack-common-release.repo [cloud7_openstack_common_release] name=cloud7_openstack_common_release baseurl=https://cbs.centos.org/repos/cloud7-openstack-common-release/ppc64le/os/ enabled=1 gpgcheck=0 cost=4 __EOF__ [hamzy@overcloud ~]$ cat << __EOF__ | sudo tee -a /etc/yum.repos.d/cloud7-openstack-pike-testing.repo [cloud7_openstack_pike_testing] name=cloud7_openstack_pike_testing baseurl=http://cbs.centos.org/repos/cloud7-openstack-pike-testing/ppc64le/os/ enabled=1 gpgcheck=0 cost=5 __EOF__ [hamzy@overcloud ~]$ sudo yum clean all; sudo yum update -y
Install python-tripleoclient
Install python-tripleoclient and patch the overcloud-images.yaml file to use ppc64le instead of amd64.
[hamzy@overcloud ~]$ sudo yum install -y python-tripleoclient [hamzy@overcloud ~]$ (cd /; cat << '__EOF__' | sudo patch -p0) --- /usr/share/openstack-tripleo-common/image-yaml/overcloud-images.yaml.orig 2017-08-01 13:55:23.030754735 -0500 +++ /usr/share/openstack-tripleo-common/image-yaml/overcloud-images.yaml 2017-08-01 13:55:42.180946510 -0500 @@ -1,7 +1,7 @@ disk_images: - imagename: overcloud-full - arch: amd64 + arch: ppc64le type: qcow2 elements: - baremetal @@ -41,7 +41,7 @@ DIB_PYTHON_VERSION: '2' - imagename: ironic-python-agent - arch: amd64 + arch: ppc64le # This is bogus, but there's no initrd type in diskimage-builder type: qcow2 # So we just override the extension instead __EOF__
Run the overcloud building command
[hamzy@overcloud ~]$ (export DIB_DEBUG_TRACE=1; export DIB_YUM_REPO_CONF="/etc/yum.repos.d/DLRN.repo /etc/yum.repos.d/cloud7-openstack-common-candidate.repo /etc/yum.repos.d/cloud7-openstack-common-testing.repo /etc/yum.repos.d/cloud7-openstack-common-release.repo /etc/yum.repos.d/missing-overcloud.repo"; export NODE_ARCH=ppc64le; export DIB_CLOUD_IMAGES="http://ftp.unicamp.br/pub/ppc64el/centos/7/images/"; export BASE_IMAGE_FILE="CentOS-7-ppc64le-GenericCloud-1611.qcow2"; time openstack overcloud image build) 2>&1 | tee output.overcloud-image-build
Modifying IPA initramfs to have a password for root
[hamzy@overcloud ~]$ cp ironic-python-agent.initramfs ironic-python-agent.initramfs.orig [hamzy@overcloud ~]$ mv ironic-python-agent.initramfs ironic-python-agent.initramfs.gz [hamzy@overcloud ~]$ gzip --decompress --to-stdout ironic-python-agent.initramfs.orig > ironic-python-agent.initramfs.cpio [hamzy@overcloud ~]$ mkdir ironic-python-agent; cd ironic-python-agent; sudo cpio -id --no-preserve-owner --preserve-modification-time < ~/ironic-python-agent.initramfs.cpio) [hamzy@overcloud ~]$ (PASS=$(openssl passwd -1 -salt xyz password); sudo sed -i -e 's,^root:!!,root:'${PASS}',' ironic-python-agent/etc/shadow) [hamzy@overcloud ~]$ (cd ironic-python-agent/; sudo find . | sudo cpio -H newc -o > ~/ironic-python-agent.initramfs.cpio) [hamzy@overcloud ~]$ gzip < ~/ironic-python-agent.initramfs.cpio > ~/ironic-python-agent.initramfs.gz [hamzy@overcloud ~]$ cp ironic-python-agent.initramfs.gz ironic-python-agent.initramfs