diff options
author | Dan Radez <dradez@redhat.com> | 2017-05-05 16:51:02 -0400 |
---|---|---|
committer | Dan Radez <dradez@redhat.com> | 2017-06-22 16:37:59 -0400 |
commit | 586110a27dc11e89a5ff3552f3215e8a0716aa92 (patch) | |
tree | e1fa6054d3f8077f114675d8de2b5da4a302a374 | |
parent | ff9beeb45e7d25aedf2d25644497b0468a96ee16 (diff) |
Adding conditionals dependent on arch
There are x86 specific build items that can't be used when building on
aarch64. Adding conditionals so that the items only get built in when
building on x86_64.
There are aarch64 specific settings that need to be set for deployment.
JIRA: APEX-381
Change-Id: I63e1c99d5d22bbb523c88be7e973a6c834a38b01
Signed-off-by: Dan Radez <dradez@redhat.com>
-rwxr-xr-x | build/overcloud-full.sh | 57 | ||||
-rwxr-xr-x | build/overcloud-opendaylight.sh | 29 | ||||
-rwxr-xr-x | ci/clean.sh | 2 | ||||
-rwxr-xr-x | lib/configure-deps-functions.sh | 53 | ||||
-rwxr-xr-x | lib/configure-vm | 32 | ||||
-rw-r--r-- | lib/installer/domain.xml | 6 | ||||
-rw-r--r-- | lib/python/apex/inventory.py | 3 | ||||
-rwxr-xr-x | lib/undercloud-functions.sh | 41 | ||||
-rwxr-xr-x | lib/virtual-setup-functions.sh | 10 |
9 files changed, 166 insertions, 67 deletions
diff --git a/build/overcloud-full.sh b/build/overcloud-full.sh index 0f7318a6..5f50c1d5 100755 --- a/build/overcloud-full.sh +++ b/build/overcloud-full.sh @@ -35,6 +35,37 @@ pushd apex-os-net-config/os_net_config > /dev/null git archive --format=tar.gz --prefix=os_net_config/ HEAD > ${BUILD_DIR}/apex-os-net-config.tar.gz popd > /dev/null +# tar up vsperf +rm -rf vsperf vsperf.tar.gz +git clone https://gerrit.opnfv.org/gerrit/vswitchperf vsperf +tar czf vsperf.tar.gz vsperf + +# Increase disk size by 900MB to accommodate more packages +qemu-img resize overcloud-full_build.qcow2 +900MB + +# expand file system to max disk size +# installing forked apex-puppet-tripleo +LIBGUESTFS_BACKEND=direct virt-customize \ + --run-command "xfs_growfs /dev/sda" \ + --upload ${BUILD_DIR}/apex-puppet-tripleo.tar.gz:/etc/puppet/modules \ + --run-command "cd /etc/puppet/modules && rm -rf tripleo && tar xzf apex-puppet-tripleo.tar.gz" \ + --upload ${BUILD_DIR}/apex-os-net-config.tar.gz:/usr/lib/python2.7/site-packages \ + --run-command "cd /usr/lib/python2.7/site-packages/ && rm -rf os_net_config && tar xzf apex-os-net-config.tar.gz" \ + --run-command "if ! rpm -qa | grep python-redis; then yum install -y python-redis; fi" \ + --run-command "sed -i 's/^#UseDNS.*$/UseDNS no/' /etc/ssh/sshd_config" \ + --run-command "sed -i 's/^GSSAPIAuthentication.*$/GSSAPIAuthentication no/' /etc/ssh/sshd_config" \ + --run-command "yum install -y etcd" \ + --install python-etcd \ + --run-command "puppet module install cristifalcas/etcd" \ + --run-command "rm -f /etc/sysctl.d/80-vpp.conf" \ + --install unzip \ + --upload ${BUILD_DIR}/vsperf.tar.gz:/var/opt \ + --run-command "cd /var/opt && tar xzf vsperf.tar.gz" \ + --run-command "sed -i -E 's/timeout=[0-9]+/timeout=60/g' /usr/share/openstack-puppet/modules/rabbitmq/lib/puppet/provider/rabbitmqctl.rb" \ + -a overcloud-full_build.qcow2 + +# Arch dependent on x86 +if [ "$(uname -i)" == 'x86_64' ]; then dpdk_pkg_str='' for package in ${dpdk_rpms[@]}; do wget "$dpdk_uri_base/$package" @@ -48,11 +79,6 @@ pushd puppet-fdio > /dev/null git archive --format=tar.gz --prefix=fdio/ HEAD > ${BUILD_DIR}/puppet-fdio.tar.gz popd > /dev/null -# tar up vsperf -rm -rf vsperf vsperf.tar.gz -git clone https://gerrit.opnfv.org/gerrit/vswitchperf vsperf -tar czf vsperf.tar.gz vsperf - # Master FD.IO Repo cat > ${BUILD_DIR}/fdio.repo << EOF [fdio-master] @@ -75,44 +101,29 @@ done # Increase disk size by 900MB to accommodate more packages qemu-img resize overcloud-full_build.qcow2 +900MB -# expand file system to max disk size -# installing forked apex-puppet-tripleo # upload dpdk rpms but do not install # install fd.io yum repo and packages # upload puppet fdio # git clone vsperf into the overcloud image # upload the rt_kvm kernel LIBGUESTFS_BACKEND=direct virt-customize \ - --run-command "xfs_growfs /dev/sda" \ - --upload ${BUILD_DIR}/apex-puppet-tripleo.tar.gz:/etc/puppet/modules \ - --run-command "cd /etc/puppet/modules && rm -rf tripleo && tar xzf apex-puppet-tripleo.tar.gz" \ - --upload ${BUILD_DIR}/apex-os-net-config.tar.gz:/usr/lib/python2.7/site-packages \ - --run-command "cd /usr/lib/python2.7/site-packages/ && rm -rf os_net_config && tar xzf apex-os-net-config.tar.gz" \ - --run-command "if ! rpm -qa | grep python-redis; then yum install -y python-redis; fi" \ - --run-command "sed -i 's/^#UseDNS.*$/UseDNS no/' /etc/ssh/sshd_config" \ - --run-command "sed -i 's/^GSSAPIAuthentication.*$/GSSAPIAuthentication no/' /etc/ssh/sshd_config" \ --run-command "mkdir /root/dpdk_rpms" \ $dpdk_pkg_str \ + --upload ${BUILD_DIR}/puppet-fdio.tar.gz:/etc/puppet/modules \ + --run-command "cd /etc/puppet/modules && tar xzf puppet-fdio.tar.gz" \ --run-command "mkdir /root/fdio" \ --upload ${BUILD_DIR}/noarch/$netvpp_pkg:/root/fdio \ $fdio_pkg_str \ --run-command "yum install -y /root/fdio/*.rpm" \ - --run-command "yum install -y etcd" \ - --install python-etcd \ - --run-command "puppet module install cristifalcas/etcd" \ - --run-command "rm -f /etc/sysctl.d/80-vpp.conf" \ - --install unzip \ --upload ${BUILD_DIR}/puppet-fdio.tar.gz:/etc/puppet/modules \ --run-command "cd /etc/puppet/modules && tar xzf puppet-fdio.tar.gz" \ - --upload ${BUILD_DIR}/vsperf.tar.gz:/var/opt \ - --run-command "cd /var/opt && tar xzf vsperf.tar.gz" \ --run-command "curl -f https://copr.fedorainfracloud.org/coprs/leifmadsen/ovs-master/repo/epel-7/leifmadsen-ovs-master-epel-7.repo > /etc/yum.repos.d/leifmadsen-ovs-master-epel-7.repo" \ --run-command "mkdir /root/ovs27" \ --run-command "yumdownloader --destdir=/root/ovs27 openvswitch*2.7* python-openvswitch-2.7*" \ - --run-command "sed -i -E 's/timeout=[0-9]+/timeout=60/g' /usr/share/openstack-puppet/modules/rabbitmq/lib/puppet/provider/rabbitmqctl.rb" \ --upload ${CACHE_DIR}/$kvmfornfv_kernel_rpm:/root/ \ --install python2-networking-sfc \ -a overcloud-full_build.qcow2 +fi mv -f overcloud-full_build.qcow2 overcloud-full.qcow2 popd > /dev/null diff --git a/build/overcloud-opendaylight.sh b/build/overcloud-opendaylight.sh index 0492491b..91652008 100755 --- a/build/overcloud-opendaylight.sh +++ b/build/overcloud-opendaylight.sh @@ -56,9 +56,6 @@ pushd netready/ > /dev/null git archive --format=tar.gz HEAD:deploy/puppet/ > ${BUILD_DIR}/puppet-gluon.tar.gz popd > /dev/null -# Download quagga/zrpc rpms -populate_cache http://artifacts.opnfv.org/apex/danube/quagga/quagga-3.tar.gz - # Download ODL netvirt for VPP populate_cache http://artifacts.opnfv.org/apex/danube/fdio_netvirt/opendaylight-7.0.0-0.1.20170531snap665.el7.noarch.rpm @@ -69,9 +66,7 @@ populate_cache http://artifacts.opnfv.org/apex/danube/fdio_netvirt/opendaylight- # upload neutron patch for generic NS linux interface driver + OVS for external networks LIBGUESTFS_BACKEND=direct virt-customize \ --upload ${BUILD_DIR}/opendaylight.repo:/etc/yum.repos.d/opendaylight.repo \ - --run-command "curl -L https://nexus.fd.io/content/repositories/fd.io.stable.1704.centos7/io/fd/hc2vpp/honeycomb/1.17.04-2048.noarch/honeycomb-1.17.04-2048.noarch.rpm > /root/fdio/honeycomb-1.17.04-2048.noarch.rpm" \ --install opendaylight,python-networking-odl \ - --run-command "yum install -y /root/fdio/honeycomb-1.17.04-2048.noarch.rpm" \ --upload ${BUILD_DIR}/puppet-opendaylight-boron.tar.gz:/etc/puppet/modules/ \ --run-command "cd /etc/puppet/modules/ && tar xzf puppet-opendaylight-boron.tar.gz" \ --upload ${BUILD_DIR}/puppet-opendaylight-carbon.tar.gz:/root/ \ @@ -81,16 +76,30 @@ LIBGUESTFS_BACKEND=direct virt-customize \ --install python-click \ --upload ${CACHE_DIR}/$gluon_rpm:/root/\ --install /root/$gluon_rpm \ - --upload ${CACHE_DIR}/quagga-3.tar.gz:/root/ \ - --run-command "cd /root/ && tar xzf quagga-3.tar.gz" \ --run-command "yum downgrade -y python-zmq-14.3.1" \ - --install zeromq-4.1.4 \ --install capnproto-libs,capnproto \ - --run-command "cd /root/quagga; packages=\$(ls |grep -vE 'debuginfo|devel|contrib'); yum -y install \$packages" \ - --run-command "sudo usermod -a -G quaggavt quagga" \ --upload ${BUILD_ROOT}/patches/neutron-patch-NSDriver.patch:/usr/lib/python2.7/site-packages/ \ --upload ${CACHE_DIR}/opendaylight-7.0.0-0.1.20170531snap665.el7.noarch.rpm:/root/ \ -a overcloud-full-opendaylight_build.qcow2 +# Arch dependent on x86 +if [ "$(uname -i)" == 'x86_64' ]; then + +# Download quagga/zrpc rpms +populate_cache http://artifacts.opnfv.org/apex/danube/quagga/quagga-3.tar.gz +# Download Honeycomb +populate_cache https://nexus.fd.io/content/repositories/fd.io.stable.1704.centos7/io/fd/hc2vpp/honeycomb/1.17.04-2048.noarch/honeycomb-1.17.04-2048.noarch.rpm + +LIBGUESTFS_BACKEND=direct virt-customize \ + --upload ${CACHE_DIR}/honeycomb-1.17.04-2048.noarch.rpm:/root/fdio/ \ + --run-command "yum install -y /root/fdio/honeycomb-1.17.04-2048.noarch.rpm" \ + --install zeromq-4.1.4 \ + --upload ${CACHE_DIR}/quagga-3.tar.gz:/root/ \ + --run-command "cd /root/ && tar xzf quagga-3.tar.gz" \ + --run-command "cd /root/quagga; packages=\$(ls |grep -vE 'debuginfo|devel|contrib'); yum -y install \$packages" \ + --run-command "sudo usermod -a -G quaggavt quagga" \ + -a overcloud-full-opendaylight_build.qcow2 +fi + LIBGUESTFS_BACKEND=direct virt-sparsify --compress overcloud-full-opendaylight_build.qcow2 overcloud-full-opendaylight.qcow2 popd > /dev/null diff --git a/ci/clean.sh b/ci/clean.sh index bd48c0d1..fba1f126 100755 --- a/ci/clean.sh +++ b/ci/clean.sh @@ -89,7 +89,7 @@ fi # Clean off instack/undercloud VM for vm in instack undercloud; do virsh destroy $vm 2> /dev/null | xargs echo -n - virsh undefine $vm 2> /dev/null | xargs echo -n + virsh undefine --nvram $vm 2> /dev/null | xargs echo -n /usr/bin/touch /var/lib/libvirt/images/${vm}.qcow2 virsh vol-delete ${vm}.qcow2 --pool default 2> /dev/null | xargs echo -n rm -f /var/lib/libvirt/images/${vm}.qcow2 2> /dev/null diff --git a/lib/configure-deps-functions.sh b/lib/configure-deps-functions.sh index 32900015..3d0e3ac7 100755 --- a/lib/configure-deps-functions.sh +++ b/lib/configure-deps-functions.sh @@ -129,36 +129,39 @@ EOF virsh pool-list --all | grep default > /dev/null || virsh pool-define-as --name default dir --target /var/lib/libvirt/images virsh pool-list | grep -Eo "default\s+active" > /dev/null || (virsh pool-autostart default; virsh pool-start default) - if ! egrep '^flags.*(vmx|svm)' /proc/cpuinfo > /dev/null; then - echo "${red}virtualization extensions not found, kvm kernel module insertion may fail.\n \ + # Virt flag check is Arch dependent on x86 + if "$(uname -i)" == 'x86_64'; then + if ! egrep '^flags.*(vmx|svm)' /proc/cpuinfo > /dev/null; then + echo "${red}virtualization extensions not found, kvm kernel module insertion may fail.\n \ Are you sure you have enabled vmx in your bios or hypervisor?${reset}" - fi + fi - if ! lsmod | grep kvm > /dev/null; then modprobe kvm; fi - if ! lsmod | grep kvm_intel > /dev/null; then modprobe kvm_intel; fi + if ! lsmod | grep kvm > /dev/null; then modprobe kvm; fi + if ! lsmod | grep kvm_intel > /dev/null; then modprobe kvm_intel; fi - if ! lsmod | grep kvm > /dev/null; then - echo "${red}kvm kernel modules not loaded!${reset}" - return 1 - fi + if ! lsmod | grep kvm > /dev/null; then + echo "${red}kvm kernel modules not loaded!${reset}" + return 1 + fi - # try to enabled nested kvm - if [ "$virtual" == "TRUE" ]; then - nested_kvm=`cat /sys/module/kvm_intel/parameters/nested` - if [ "$nested_kvm" != "Y" ]; then - # try to enable nested kvm - echo 'options kvm-intel nested=1' > /etc/modprobe.d/kvm_intel.conf - if rmmod kvm_intel; then - modprobe kvm_intel + # try to enabled nested kvm + if [ "$virtual" == "TRUE" ]; then + nested_kvm=`cat /sys/module/kvm_intel/parameters/nested` + if [ "$nested_kvm" != "Y" ]; then + # try to enable nested kvm + echo 'options kvm-intel nested=1' > /etc/modprobe.d/kvm_intel.conf + if rmmod kvm_intel; then + modprobe kvm_intel + fi + nested_kvm=`cat /sys/module/kvm_intel/parameters/nested` + fi + if [ "$nested_kvm" != "Y" ]; then + echo "${red}Cannot enable nested kvm, falling back to qemu for deployment${reset}" + DEPLOY_OPTIONS+=" --libvirt-type qemu" + else + echo "${blue}Nested kvm enabled, deploying with kvm acceleration${reset}" + fi fi - nested_kvm=`cat /sys/module/kvm_intel/parameters/nested` - fi - if [ "$nested_kvm" != "Y" ]; then - echo "${red}Cannot enable nested kvm, falling back to qemu for deployment${reset}" - DEPLOY_OPTIONS+=" --libvirt-type qemu" - else - echo "${blue}Nested kvm enabled, deploying with kvm acceleration${reset}" - fi fi ##sshkeygen for root diff --git a/lib/configure-vm b/lib/configure-vm index 340a7ab6..5cb45218 100755 --- a/lib/configure-vm +++ b/lib/configure-vm @@ -100,6 +100,7 @@ def main(): 'enable_serial_console': '', 'direct_boot': '', 'kernel_args': '', + 'user_interface': '', } if args.image is not None: params['imagefile'] = args.image @@ -162,6 +163,37 @@ def main(): <cmdline>%s</cmdline> """ % ' '.join(args.kernel_args) + if args.arch == 'aarch64': + + params['direct_boot'] += """ + <loader readonly='yes' type='pflash'>/usr/share/AAVMF/AAVMF_CODE.fd</loader> + <nvram>/var/lib/libvirt/qemu/nvram/centos7.0_VARS.fd</nvram> + """ + params['user_interface'] = """ + <controller type='virtio-serial' index='0'> + <address type='virtio-mmio'/> + </controller> + <serial type='pty'> + <target port='0'/> + </serial> + <console type='pty'> + <target type='serial' port='0'/> + </console> + <channel type='unix'> + <target type='virtio' name='org.qemu.guest_agent.0'/> + <address type='virtio-serial' controller='0' bus='0' port='1'/> + </channel> + """ + else: + params['user_interface'] = """ + <input type='mouse' bus='ps2'/> + <graphics type='vnc' port='-1' autoport='yes'/> + <video> + <model type='cirrus' vram='9216' heads='1'/> + </video> + """ + + libvirt_template = source_template % params conn=libvirt.open(args.uri) a = conn.defineXML(libvirt_template) diff --git a/lib/installer/domain.xml b/lib/installer/domain.xml index ead0de69..57a67d87 100644 --- a/lib/installer/domain.xml +++ b/lib/installer/domain.xml @@ -29,10 +29,6 @@ %(network)s %(bm_network)s %(enable_serial_console)s - <input type='mouse' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> - <video> - <model type='cirrus' vram='9216' heads='1'/> - </video> + %(user_interface)s </devices> </domain> diff --git a/lib/python/apex/inventory.py b/lib/python/apex/inventory.py index 2e08d3b9..64f47b49 100644 --- a/lib/python/apex/inventory.py +++ b/lib/python/apex/inventory.py @@ -9,6 +9,7 @@ import yaml import json +import platform from .common import constants from .common import utils @@ -67,7 +68,7 @@ class Inventory(dict): 'for non-HA baremetal deployment') if virtual: - self['arch'] = 'x86_64' + self['arch'] = platform.machine() self['host-ip'] = '192.168.122.1' self['power_manager'] = \ 'nova.virt.baremetal.virtual_power_driver.VirtualPowerManager' diff --git a/lib/undercloud-functions.sh b/lib/undercloud-functions.sh index 3bd0341a..44bd3903 100755 --- a/lib/undercloud-functions.sh +++ b/lib/undercloud-functions.sh @@ -173,6 +173,7 @@ EOI echo "Running undercloud installation and configuration." echo "Logging undercloud installation to stack@undercloud:/home/stack/apex-undercloud-install.log" ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" << EOI +set -e openstack-config --set undercloud.conf DEFAULT local_ip ${admin_installer_vm_ip}/${admin_cidr##*/} openstack-config --set undercloud.conf DEFAULT network_gateway ${admin_installer_vm_ip} openstack-config --set undercloud.conf DEFAULT network_cidr ${admin_cidr} @@ -194,6 +195,22 @@ sudo sed -i '/CephClusterFSID:/c\\ CephClusterFSID: \\x27$(cat /proc/sys/kernel sudo sed -i '/CephMonKey:/c\\ CephMonKey: \\x27'"\$(ceph-authtool --gen-print-key)"'\\x27' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml sudo sed -i '/CephAdminKey:/c\\ CephAdminKey: \\x27'"\$(ceph-authtool --gen-print-key)"'\\x27' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml +if [ "\$(uname -i)" == 'aarch64' ]; then + +# These two fixes are done in the base OOO image build right now +# keeping them here to know that they are done and in case we need +# to take care of them in the future. +# # remove syslinux references for aarch64 +# sudo sh -xc 'cd /etc/puppet/modules/ironic/manifests && patch -p0 < puppet-ironic-manifests-pxe-pp-aarch64.patch' +# sudo sed -i '/syslinux-extlinux/d' /usr/share/instack-undercloud/puppet-stack-config/puppet-stack-config.pp +# +# # disable use_linkat in swift +# sudo sed -i 's/o_tmpfile_supported()/False/' /usr/lib/python2.7/site-packages/swift/obj/diskfile.py + + openstack-config --set undercloud.conf DEFAULT ipxe_enabled false + sudo sed -i '/ _link_ip_address_pxe_configs/a\\ _link_mac_pxe_configs(task)' /usr/lib/python2.7/site-packages/ironic/common/pxe_utils.py +fi + openstack undercloud install &> apex-undercloud-install.log || { # cat the undercloud install log incase it fails echo "ERROR: openstack undercloud install has failed. Dumping Log:" @@ -201,6 +218,30 @@ openstack undercloud install &> apex-undercloud-install.log || { exit 1 } +if [ "\$(uname -i)" == 'aarch64' ]; then +sudo yum -y reinstall grub2-efi shim +sudo cp /boot/efi/EFI/centos/grubaa64.efi /tftpboot/grubaa64.efi +sudo mkdir -p /tftpboot/EFI/centos +sudo tee /tftpboot/EFI/centos/grub.cfg > /dev/null << EOF +set default=master +set timeout=5 +set hidden_timeout_quiet=false + +menuentry "master" { +configfile /tftpboot/\\\$net_default_ip.conf +} +EOF +sudo chmod 644 /tftpboot/EFI/centos/grub.cfg +sudo openstack-config --set /etc/ironic/ironic.conf pxe uefi_pxe_config_template \\\$pybasedir/drivers/modules/pxe_grub_config.template +sudo openstack-config --set /etc/ironic/ironic.conf pxe uefi_pxe_bootfile_name grubaa64.efi +sudo service openstack-ironic-conductor restart +sudo sed -i 's/linuxefi/linux/g' /usr/lib/python2.7/site-packages/ironic/drivers/modules/pxe_grub_config.template +sudo sed -i 's/initrdefi/initrd/g' /usr/lib/python2.7/site-packages/ironic/drivers/modules/pxe_grub_config.template +echo '' | sudo tee --append /tftpboot/map-file > /dev/null +echo 'r ^/EFI/centos/grub.cfg-(.*) /tftpboot/pxelinux.cfg/\\1' | sudo tee --append /tftpboot/map-file > /dev/null +sudo service xinetd restart +fi + # Set nova domain name sudo openstack-config --set /etc/nova/nova.conf DEFAULT dns_domain ${domain_name} sudo openstack-config --set /etc/nova/nova.conf DEFAULT dhcp_domain ${domain_name} diff --git a/lib/virtual-setup-functions.sh b/lib/virtual-setup-functions.sh index ac7b507b..8e15ef5d 100755 --- a/lib/virtual-setup-functions.sh +++ b/lib/virtual-setup-functions.sh @@ -81,7 +81,7 @@ EOF cpu: $vcpus memory: $ramsize disk: 41 - arch: "x86_64" + arch: "$(uname -i)" capabilities: "$capability" EOF vbmc add baremetal$i --port 623$i @@ -139,11 +139,17 @@ function define_vm () { kernel_args='--kernel-arg console=ttyS0 --kernel-arg root=/dev/sda' fi + if [ "$(uname -i)" == 'aarch64' ]; then + diskbus='scsi' + else + diskbus='sata' + fi + # create the VM $LIB/configure-vm --name $1 \ --bootdev $2 \ --image "$volume_path" \ - --diskbus sata \ + --diskbus $diskbus \ --arch $(uname -i) \ --cpus $vcpus \ --memory $ramsize \ |