X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=build%2Finstack.sh;h=52384689d8595b5de1709ec7e206b27b16a518cf;hb=1c448e3d0694db04fc1ddda32883d66a8ede0042;hp=f23df672bd564dad8de4384ed8f422a309af88f4;hpb=46b80eeb284002aac64b4c2dcf41c9a75bc8b5d2;p=apex.git diff --git a/build/instack.sh b/build/instack.sh index f23df672..52384689 100755 --- a/build/instack.sh +++ b/build/instack.sh @@ -1,15 +1,26 @@ #!/bin/sh +############################################################################## +# Copyright (c) 2015 Tim Rozet (Red Hat), Dan Radez (Red Hat) and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## set -e declare -i CNT -rdo_images_uri=https://ci.centos.org/artifacts/rdo/images/liberty/delorean/stable +#rdo_images_uri=https://repos.fedorapeople.org/repos/openstack-m/rdo-images-centos-liberty-opnfv +rdo_images_uri=file:///stable-images +onos_artifacts_uri=file:///stable-images/onos vm_index=4 RDO_RELEASE=liberty SSH_OPTIONS=(-o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null) +OPNFV_NETWORK_TYPES="admin_network private_network public_network storage_network" # check for dependancy packages -for i in libguestfs-tools python-docutils bsdtar; do +for i in rpm-build createrepo libguestfs-tools python-docutils bsdtar; do if ! rpm -q $i > /dev/null; then sudo yum install -y $i fi @@ -40,32 +51,27 @@ fi ssh -T ${SSH_OPTIONS[@]} stack@localhost "rm -f instack*.qcow2" # Yum repo setup for building the undercloud -if ! rpm -q epel-release > /dev/null; then - sudo yum install http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -fi - -if ! rpm -q rdo-release > /dev/null; then - sudo yum install -y https://rdoproject.org/repos/openstack-${RDO_RELEASE}/rdo-release-${RDO_RELEASE}.rpm -fi - if ! rpm -q rdo-release > /dev/null && [ "$1" != "-master" ]; then - sudo yum install -y https://rdoproject.org/repos/openstack-${RDO_RELEASE}/rdo-release-${RDO_RELEASE}.rpm - sudo rm -rf /etc/yum.repos.d/delorean.repo - sudo rm -rf /etc/yum.repos.d/delorean-current.repo - sudo rm -rf /etc/yum.repos.d/delorean-deps.repo -elif [ "$1" == "-master" ]; then + #pulling from current-passed-ci instead of release repos + #sudo yum install -y https://rdoproject.org/repos/openstack-${RDO_RELEASE}/rdo-release-${RDO_RELEASE}.rpm sudo yum -y install yum-plugin-priorities sudo yum-config-manager --disable openstack-${RDO_RELEASE} sudo curl -o /etc/yum.repos.d/delorean.repo http://trunk.rdoproject.org/centos7-liberty/current-passed-ci/delorean.repo sudo curl -o /etc/yum.repos.d/delorean-deps.repo http://trunk.rdoproject.org/centos7-liberty/delorean-deps.repo sudo rm -f /etc/yum.repos.d/delorean-current.repo +elif [ "$1" == "-master" ]; then + sudo yum -y install yum-plugin-priorities + sudo yum-config-manager --disable openstack-${RDO_RELEASE} + sudo curl -o /etc/yum.repos.d/delorean.repo http://trunk.rdoproject.org/centos7/current-passed-ci/delorean.repo + sudo curl -o /etc/yum.repos.d/delorean-deps.repo http://trunk.rdoproject.org/centos7-liberty/delorean-deps.repo + sudo rm -f /etc/yum.repos.d/delorean-current.repo fi # install the opendaylight yum repo definition cat << 'EOF' | sudo tee /etc/yum.repos.d/opendaylight.repo [opendaylight] name=OpenDaylight $releasever - $basearch -baseurl=http://cbs.centos.org/repos/nfv7-opendaylight-3-candidate/$basearch/os/ +baseurl=http://cbs.centos.org/repos/nfv7-opendaylight-33-release/$basearch/os/ enabled=1 gpgcheck=0 EOF @@ -93,7 +99,7 @@ sudo ../ci/clean.sh # and rebuild the bare undercloud VMs ssh -T ${SSH_OPTIONS[@]} stack@localhost < /dev/null; then yum install http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm fi @@ -124,26 +146,20 @@ fi yum -y install yum-plugin-priorities curl -o /etc/yum.repos.d/delorean.repo http://trunk.rdoproject.org/centos7-liberty/current-passed-ci/delorean.repo curl -o /etc/yum.repos.d/delorean-deps.repo http://trunk.rdoproject.org/centos7-liberty/delorean-deps.repo -yum install -y python-tripleoclient + cp /root/.ssh/authorized_keys /home/stack/.ssh/authorized_keys chown stack:stack /home/stack/.ssh/authorized_keys EOI -# install undercloud on Undercloud VM -ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "openstack undercloud install" - # copy instackenv file for future virt deployments if [ ! -d stack ]; then mkdir stack; fi scp ${SSH_OPTIONS[@]} stack@$UNDERCLOUD:instackenv.json stack/instackenv.json -# Clean cache to reduce the images size -ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "yum clean all" - # make a copy of instack VM's definitions, and disk image # it must be stopped to make a copy of its disk image ssh -T ${SSH_OPTIONS[@]} stack@localhost < baremetalbrbm_brbm1_\$i.xml + virsh dumpxml baremetalbrbm_brbm1_brbm2_brbm3_\$i | awk '/model type='\''virtio'\''/{c++;if(c==2){sub("model type='\''virtio'\''","model type='\''rtl8139'\''");c=0}}1' > baremetalbrbm_brbm1_brbm2_brbm3_\$i.xml done virsh dumpxml instack > instack.xml virsh net-dumpxml brbm > brbm-net.xml virsh net-dumpxml brbm1 > brbm1-net.xml +virsh net-dumpxml brbm2> brbm2-net.xml +virsh net-dumpxml brbm3 > brbm3-net.xml virsh pool-dumpxml default > default-pool.xml EOI # copy off the instack artifacts echo "Copying instack files to build directory" for i in $(seq 0 $vm_index); do - scp ${SSH_OPTIONS[@]} stack@localhost:baremetalbrbm_brbm1_${i}.xml . + scp ${SSH_OPTIONS[@]} stack@localhost:baremetalbrbm_brbm1_brbm2_brbm3_${i}.xml . done scp ${SSH_OPTIONS[@]} stack@localhost:instack.xml . scp ${SSH_OPTIONS[@]} stack@localhost:brbm-net.xml . scp ${SSH_OPTIONS[@]} stack@localhost:brbm1-net.xml . +scp ${SSH_OPTIONS[@]} stack@localhost:brbm2-net.xml . +scp ${SSH_OPTIONS[@]} stack@localhost:brbm3-net.xml . scp ${SSH_OPTIONS[@]} stack@localhost:default-pool.xml . -# copy the instack disk image for inclusion in artifacts -sudo cp /var/lib/libvirt/images/instack.qcow2 ./instack.qcow2 - -#sudo chown $(whoami):$(whoami) ./instack.qcow2_ -#virt-sparsify --check-tmpdir=fail ./instack.qcow2_ ./instack.qcow2 -#rm -f ./instack.qcow2_ - # pull down the the built images echo "Copying overcloud resources" -IMAGES="deploy-ramdisk-ironic.tar" -IMAGES+=" ironic-python-agent.tar" -IMAGES+=" overcloud-full.tar" -#IMAGES+="undercloud.qcow2" +IMAGES="overcloud-full.tar" +IMAGES+=" undercloud.qcow2" for i in $IMAGES; do # download prebuilt images from RDO Project if [ "$(curl -L $rdo_images_uri/${i}.md5 | awk {'print $1'})" != "$(md5sum stack/$i | awk {'print $1'})" ] ; then - curl https://ci.centos.org/artifacts/rdo/images/liberty/delorean/stable/$i -o stack/$i --verbose --silent --location + #if [ $i == "undercloud.qcow2" ]; then + ### there's a problem with the Content-Length reported by the centos artifacts + ### server so using wget for it until a resolution is figured out. + #wget -nv -O stack/$i $rdo_images_uri/$i + #else + curl $rdo_images_uri/$i -o stack/$i + #fi fi - tar -xf stack/$i -C stack/ + # only untar the tar files + if [ "${i##*.}" == "tar" ]; then tar -xf stack/$i -C stack/; fi done -#Adding OpenDaylight to overcloud +#Adding OpenStack packages to undercloud pushd stack -cp overcloud-full.qcow2 overcloud-full-odl.qcow2 -for i in opendaylight python-networking-odl; do - yumdownloader $i - if rpmfile=$(ls -r $i*); then - rpmfile=$(echo $rpmfile | head -n1) - LIBGUESTFS_BACKEND=direct virt-customize --upload $rpmfile:/tmp --install /tmp/$rpmfile -a overcloud-full-odl.qcow2 - else - echo "Cannot install $i into overcloud-full image." - exit 1 - fi -done +cp undercloud.qcow2 instack.qcow2 +LIBGUESTFS_BACKEND=direct virt-customize --install yum-priorities -a instack.qcow2 +PACKAGES="qemu-kvm-common,qemu-kvm,libvirt-daemon-kvm,libguestfs,python-libguestfs,openstack-nova-compute" +PACKAGES+=",openstack-swift,openstack-ceilometer-api,openstack-neutron-ml2,openstack-ceilometer-alarm" +PACKAGES+=",openstack-nova-conductor,openstack-ironic-inspector,openstack-ironic-api,python-openvswitch" +PACKAGES+=",openstack-glance,python-glance,python-troveclient,openstack-puppet-modules" +PACKAGES+=",openstack-neutron,openstack-neutron-openvswitch,openstack-nova-scheduler,openstack-keystone,openstack-swift-account" +PACKAGES+=",openstack-swift-container,openstack-swift-object,openstack-swift-plugin-swift3,openstack-swift-proxy" +PACKAGES+=",openstack-nova-api,openstack-nova-cert,openstack-heat-api-cfn,openstack-heat-api," +PACKAGES+=",openstack-ceilometer-central,openstack-ceilometer-polling,openstack-ceilometer-collector," +PACKAGES+=",openstack-heat-api-cloudwatch,openstack-heat-engine,openstack-heat-common,openstack-ceilometer-notification" +PACKAGES+=",hiera,puppet,memcached,keepalived,mariadb,mariadb-server,rabbitmq-server,python-pbr,python-proliantutils" +PACKAGES+=",ceph-common" + +# install the packages above and enabling ceph to live on the controller +LIBGUESTFS_BACKEND=direct virt-customize --install $PACKAGES \ + --run-command "sed -i '/ControllerEnableCephStorage/c\\ ControllerEnableCephStorage: true' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml" \ + --run-command "sed -i '/ \$enable_ceph = /c\\ \$enable_ceph = true' /usr/share/openstack-tripleo-heat-templates/puppet/manifests/overcloud_controller_pacemaker.pp" \ + --run-command "sed -i '/ \$enable_ceph = /c\\ \$enable_ceph = true' /usr/share/openstack-tripleo-heat-templates/puppet/manifests/overcloud_controller.pp" \ + -a instack.qcow2 +popd + + +pushd stack + +########################################################## +##### Prep initial overcloud image with common deps ##### +########################################################## + +# make a copy of the cached overcloud-full image +cp overcloud-full.qcow2 overcloud-full-opendaylight.qcow2 +# Update puppet-aodh it's old +rm -rf aodh +git clone https://github.com/openstack/puppet-aodh aodh +pushd aodh +git checkout stable/liberty +popd +tar -czf puppet-aodh.tar.gz aodh + +# work around for XFS grow bug +# http://xfs.org/index.php/XFS_FAQ#Q:_Why_do_I_receive_No_space_left_on_device_after_xfs_growfs.3F +cat > /tmp/xfs-grow-remount-fix.service << EOF +[Unit] +Description=XFS Grow Bug Remount +After=network.target +Before=getty@tty1.service + +[Service] +Type=oneshot +ExecStart=/bin/bash -c "mount -o remount,inode64 /" +RemainAfterExit=no + +[Install] +WantedBy=multi-user.target +EOF + +# Add epel, aodh and ceph, remove openstack-neutron-openvswitch +AODH_PKG="openstack-aodh-api,openstack-aodh-common,openstack-aodh-compat,openstack-aodh-evaluator,openstack-aodh-expirer" +AODH_PKG+=",openstack-aodh-listener,openstack-aodh-notifier" +LIBGUESTFS_BACKEND=direct virt-customize --upload "/tmp/xfs-grow-remount-fix.service:/usr/lib/systemd/system/xfs-grow-remount-fix.service" \ + --run-command "systemctl enable xfs-grow-remount-fix.service" \ + --upload puppet-aodh.tar.gz:/etc/puppet/modules/ \ + --run-command "cd /etc/puppet/modules/ && rm -rf aodh && tar xzf puppet-aodh.tar.gz" \ + --run-command "yum remove -y openstack-neutron-openvswitch" \ + --run-command "echo 'nf_conntrack_proto_sctp' > /etc/modules-load.d/nf_conntrack_proto_sctp.conf" \ + --install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ + --install "$AODH_PKG,ceph" \ + -a overcloud-full-opendaylight.qcow2 + +############################################### +##### Adding OpenDaylight to overcloud ##### +############################################### + +cat > /tmp/opendaylight.repo << EOF +[opendaylight] +name=OpenDaylight \$releasever - \$basearch +baseurl=http://cbs.centos.org/repos/nfv7-opendaylight-33-release/\$basearch/os/ +enabled=1 +gpgcheck=0 +EOF + +# install ODL packages +LIBGUESTFS_BACKEND=direct virt-customize \ + --upload /tmp/opendaylight.repo:/etc/yum.repos.d/opendaylight.repo \ + --install opendaylight,python-networking-odl \ + -a overcloud-full-opendaylight.qcow2 + +## WORK AROUND +## when OpenDaylight lands in upstream RDO manager this can be removed + +# upload the opendaylight puppet module +rm -rf puppet-opendaylight +git clone -b 2.2.0 https://github.com/dfarrell07/puppet-opendaylight +pushd puppet-opendaylight +git archive --format=tar.gz --prefix=opendaylight/ HEAD > ../puppet-opendaylight.tar.gz +popd +LIBGUESTFS_BACKEND=direct virt-customize --upload puppet-opendaylight.tar.gz:/etc/puppet/modules/ \ + --run-command "cd /etc/puppet/modules/ && tar xzf puppet-opendaylight.tar.gz" \ + --upload ../opendaylight-puppet-neutron.patch:/tmp \ + --run-command "cd /etc/puppet/modules/neutron && patch -Np1 < /tmp/opendaylight-puppet-neutron.patch" \ + -a overcloud-full-opendaylight.qcow2 + +# Patch in OpenDaylight installation and configuration +LIBGUESTFS_BACKEND=direct virt-customize --upload ../opnfv-tripleo-heat-templates.patch:/tmp \ + --run-command "cd /usr/share/openstack-tripleo-heat-templates/ && patch -Np1 < /tmp/opnfv-tripleo-heat-templates.patch" \ + -a instack.qcow2 + +# REMOVE ME AFTER Brahmaputra +LIBGUESTFS_BACKEND=direct virt-customize --upload ../puppet-neutron-force-metadata.patch:/tmp \ + --run-command "cd /etc/puppet/modules/neutron && patch -Np1 < /tmp/puppet-neutron-force-metadata.patch" \ + -a overcloud-full-opendaylight.qcow2 + +LIBGUESTFS_BACKEND=direct virt-customize --upload ../puppet-cinder-quota-fix.patch:/tmp \ + --run-command "cd /etc/puppet/modules/cinder && patch -Np1 < /tmp/puppet-cinder-quota-fix.patch" \ + -a overcloud-full-opendaylight.qcow2 + +LIBGUESTFS_BACKEND=direct virt-customize --upload ../aodh-puppet-tripleo.patch:/tmp \ + --run-command "cd /etc/puppet/modules/tripleo && patch -Np1 < /tmp/aodh-puppet-tripleo.patch" \ + -a overcloud-full-opendaylight.qcow2 + +# adds tripleoclient aodh workaround +# for keystone +LIBGUESTFS_BACKEND=direct virt-customize --upload ../aodh-tripleoclient.patch:/tmp \ + --run-command "cd /usr/lib/python2.7/site-packages/tripleoclient && patch -Np1 < /tmp/aodh-tripleoclient.patch" \ + --upload ../aodh-os-cloud-config.patch:/tmp \ + --run-command "cd /usr/lib/python2.7/site-packages/os_cloud_config && patch -Np1 < /tmp/aodh-os-cloud-config.patch" \ + -a instack.qcow2 +# END REMOVE ME AFTER Brahmaputra + +################################################ +##### Adding SFC+OpenDaylight overcloud ##### +################################################ + +cat > /tmp/opendaylight.repo << EOF +[opendaylight] +name=OpenDaylight \$releasever - \$basearch +baseurl=http://cbs.centos.org/repos/nfv7-opendaylight-4-testing/\$basearch/os/ +enabled=1 +gpgcheck=0 +EOF + +#copy opendaylight overcloud full to isolate odl-sfc +cp overcloud-full-opendaylight.qcow2 overcloud-full-opendaylight-sfc.qcow2 + +# upload the opendaylight puppet module rm -rf puppet-opendaylight -git clone https://github.com/dfarrell07/puppet-opendaylight +git clone -b 3.0.1 https://github.com/dfarrell07/puppet-opendaylight pushd puppet-opendaylight git archive --format=tar.gz --prefix=opendaylight/ HEAD > ../puppet-opendaylight.tar.gz popd -LIBGUESTFS_BACKEND=direct virt-customize --upload puppet-opendaylight.tar.gz:/etc/puppet/modules/ --run-command "cd /etc/puppet/modules/; tar xzf puppet-opendaylight.tar.gz" -a overcloud-full-odl.qcow2 + +LIBGUESTFS_BACKEND=direct virt-customize \ + --install 'https://radez.fedorapeople.org/kernel-ml-3.13.7-1.el7.centos.x86_64.rpm' \ + --run-command 'grub2-set-default "\$(grep -P \"submenu|^menuentry\" /boot/grub2/grub.cfg | cut -d \"\\x27\" | head -n 1)"' \ + --install 'https://radez.fedorapeople.org/openvswitch-kmod-2.3.90-1.el7.centos.x86_64.rpm' \ + --run-command 'yum downgrade -y https://radez.fedorapeople.org/openvswitch-2.3.90-1.x86_64.rpm' \ + --run-command 'rm -f /lib/modules/3.13.7-1.el7.centos.x86_64/kernel/net/openvswitch/openvswitch.ko' \ + --run-command 'ln -s /lib/modules/3.13.7-1.el7.centos.x86_64/kernel/extra/openvswitch/openvswitch.ko /lib/modules/3.13.7-1.el7.centos.x86_64/kernel/net/openvswitch/openvswitch.ko' \ + --upload /tmp/opendaylight.repo:/etc/yum.repos.d/opendaylight.repo \ + --run-command "yum remove -y opendaylight" \ + --run-command "yum clean all" \ + --run-command "yum install -y opendaylight" \ + --run-command "rm -rf /etc/puppet/modules/opendaylight && rm -f /etc/puppet/modules/puppet-opendaylight.tar.gz " \ + --upload puppet-opendaylight.tar.gz:/etc/puppet/modules/ \ + --run-command "cd /etc/puppet/modules/ && tar xzf puppet-opendaylight.tar.gz" \ + -a overcloud-full-opendaylight-sfc.qcow2 + + + +############################################### +##### Adding ONOS to overcloud ##### +############################################### + +## WORK AROUND +## when ONOS lands in upstream OPNFV artifacts this can be removed + +# upload the onos puppet module + +rm -rf puppet-onos +git clone https://github.com/bobzhouHW/puppet-onos.git +pushd puppet-onos +# download jdk, onos and maven dependancy packages. +pushd files +curl ${onos_artifacts_uri}/jdk-8u51-linux-x64.tar.gz -o ./jdk-8u51-linux-x64.tar.gz +curl ${onos_artifacts_uri}/onos-1.3.0.tar.gz -o ./onos-1.3.0.tar.gz +curl ${onos_artifacts_uri}/repository.tar -o ./repository.tar +popd +popd +mv puppet-onos onos +tar -czf puppet-onos.tar.gz onos +LIBGUESTFS_BACKEND=direct virt-customize --upload puppet-onos.tar.gz:/etc/puppet/modules/ \ + --run-command "cd /etc/puppet/modules/ && tar xzf puppet-onos.tar.gz" -a overcloud-full-opendaylight.qcow2 + +## END WORK AROUND + popd # move and Sanitize private keys from instack.json file @@ -234,8 +430,8 @@ set -e virsh destroy instack 2> /dev/null || echo -n '' virsh undefine instack --remove-all-storage 2> /dev/null || echo -n '' for i in \$(seq 0 $vm_index); do - virsh destroy baremetalbrbm_brbm1_\$i 2> /dev/null || echo -n '' - virsh undefine baremetalbrbm_brbm1_\$i --remove-all-storage 2> /dev/null || echo -n '' + virsh destroy baremetalbrbm_brbm1_brbm2_brbm3_\$i 2> /dev/null || echo -n '' + virsh undefine baremetalbrbm_brbm1_brbm2_brbm3_\$i --remove-all-storage 2> /dev/null || echo -n '' done EOI