Commit 5928e7a6 authored by Tim Rozet's avatar Tim Rozet
Browse files

Fixes repos and adds errexit checks per radez github commit



Also fixes node vms naming issue where naming is changed from
baremetal_x to baremetalbrbm_x in liberty.

Change-Id: I8b791d71466d7c5c1037e45839e689a9aac0dd8f
Signed-off-by: default avatarTim Rozet <trozet@redhat.com>
parent d4dc4ba1
......@@ -100,12 +100,12 @@ rpm:
pushd ../ && git archive --format=tar --prefix=opnfv-apex-2.0/ HEAD > build/opnfv-apex.tar
tar -u --xform="s:instack.qcow2:opnfv-apex-2.0/build/instack.qcow2:" --file=opnfv-apex.tar instack.qcow2
tar -u --xform="s:instack.xml:opnfv-apex-2.0/build/instack.xml:" --file=opnfv-apex.tar instack.xml
qemu-img create -f qcow2 baremetal_0.qcow2 40G
tar -u --xform="s:baremetal_0.qcow2:opnfv-apex-2.0/build/baremetal_0.qcow2:" --file=opnfv-apex.tar baremetal_0.qcow2
tar -u --xform="s:baremetal_0.xml:opnfv-apex-2.0/build/baremetal_0.xml:" --file=opnfv-apex.tar baremetal_0.xml
qemu-img create -f qcow2 baremetal_1.qcow2 40G
tar -u --xform="s:baremetal_1.qcow2:opnfv-apex-2.0/build/baremetal_1.qcow2:" --file=opnfv-apex.tar baremetal_1.qcow2
tar -u --xform="s:baremetal_1.xml:opnfv-apex-2.0/build/baremetal_1.xml:" --file=opnfv-apex.tar baremetal_1.xml
qemu-img create -f qcow2 baremetalbrbm_0.qcow2 40G
tar -u --xform="s:baremetalbrbm_0.qcow2:opnfv-apex-2.0/build/baremetalbrbm_0.qcow2:" --file=opnfv-apex.tar baremetalbrbm_0.qcow2
tar -u --xform="s:baremetalbrbm_0.xml:opnfv-apex-2.0/build/baremetalbrbm_0.xml:" --file=opnfv-apex.tar baremetalbrbm_0.xml
qemu-img create -f qcow2 baremetalbrbm_1.qcow2 40G
tar -u --xform="s:baremetalbrbm_1.qcow2:opnfv-apex-2.0/build/baremetalbrbm_1.qcow2:" --file=opnfv-apex.tar baremetalbrbm_1.qcow2
tar -u --xform="s:baremetalbrbm_1.xml:opnfv-apex-2.0/build/baremetalbrbm_1.xml:" --file=opnfv-apex.tar baremetalbrbm_1.xml
tar -u --xform="s:brbm.xml:opnfv-apex-2.0/build/brbm.xml:" --file=opnfv-apex.tar brbm.xml
tar -u --xform="s:instackenv-virt.json:opnfv-apex-2.0/build/instackenv-virt.json:" --file=opnfv-apex.tar instackenv-virt.json
tar -u --xform="s:stack/deploy-ramdisk-ironic.initramfs:opnfv-apex-2.0/build/stack/deploy-ramdisk-ironic.initramfs:" --file=opnfv-apex.tar stack/deploy-ramdisk-ironic.initramfs
......@@ -129,8 +129,8 @@ instack.qcow2:
.PHONY: instack-clean
instack-clean:
rm -f instackenv-virt.json
rm -f baremetal_0.xml
rm -f baremetal_1.xml
rm -f baremetalbrbm_0.xml
rm -f baremetalbrbm_1.xml
rm -f instack.xml
rm -f instack.qcow2
rm -rf stack
......
......@@ -3,6 +3,7 @@ set -e
declare -i CNT
RDO_RELEASE=kilo
SSH_OPTIONS=(-o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null)
# RDO Manager expects a stack user to exist, this checks for one
# and creates it if you are root
......@@ -45,7 +46,7 @@ if ! rpm -q rdo-release > /dev/null && [ "$1" != "-master" ]; then
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-tripleo/delorean.repo
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-current.repo http://trunk.rdoproject.org/centos7-liberty/current/delorean.repo
sudo sed -i 's/\[delorean\]/\[delorean-current\]/' /etc/yum.repos.d/delorean-current.repo
sudo curl -o /etc/yum.repos.d/delorean-deps.repo http://trunk.rdoproject.org/centos7-liberty/delorean-deps.repo
......@@ -69,12 +70,13 @@ fi
# ensure that no previous undercloud VMs are running
# and rebuild the bare undercloud VMs
ssh -T -o "StrictHostKeyChecking no" stack@localhost <<EOI
set -e
virsh destroy instack 2> /dev/null || echo -n ''
virsh undefine instack 2> /dev/null || echo -n ''
virsh destroy baremetal_0 2> /dev/null || echo -n ''
virsh undefine baremetal_0 2> /dev/null || echo -n ''
virsh destroy baremetal_1 2> /dev/null || echo -n ''
virsh undefine baremetal_1 2> /dev/null || echo -n ''
virsh destroy baremetalbrbm_0 2> /dev/null || echo -n ''
virsh undefine baremetalbrbm_0 2> /dev/null || echo -n ''
virsh destroy baremetalbrbm_1 2> /dev/null || echo -n ''
virsh undefine baremetalbrbm_1 2> /dev/null || echo -n ''
instack-virt-setup
EOI
......@@ -104,11 +106,12 @@ done
# yum repo, triple-o package and ssh key setup for the undercloud
ssh -T -o "StrictHostKeyChecking no" "root@$UNDERCLOUD" <<EOI
set -e
if ! rpm -q epel-release > /dev/null; then
yum install http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
fi
curl -o /etc/yum.repos.d/delorean.repo http://trunk.rdoproject.org/centos7/current-tripleo/delorean.repo
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-current.repo http://trunk.rdoproject.org/centos7-liberty/current/delorean.repo
sed -i 's/\\[delorean\\]/\\[delorean-current\\]/' /etc/yum.repos.d/delorean-current.repo
echo "\\nincludepkgs=diskimage-builder,openstack-heat,instack,instack-undercloud,openstack-ironic,openstack-ironic-inspector,os-cloud-config,python-ironic-inspector-client,python-tripleoclient,tripleo-common,openstack-tripleo-heat-templates,openstack-tripleo-image-elements,openstack-tripleo-puppet-elements,openstack-tuskar-ui-extras,openstack-puppet-modules" >> /etc/yum.repos.d/delorean-current.repo
......@@ -124,7 +127,8 @@ ssh -o "StrictHostKeyChecking no" "stack@$UNDERCLOUD" "openstack undercloud inst
# 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 -o "StrictHostKeyChecking no" stack@localhost <<EOI
echo "Shuttind down instack to take snapshot"
set -e
echo "Shutting down instack to take snapshot"
virsh shutdown instack
echo "Waiting for instack VM to shutdown"
......@@ -140,8 +144,8 @@ if virsh list | grep instack > /dev/null; then
fi
echo "\nCopying instack disk image and starting instack VM."
virsh dumpxml baremetal_0 > baremetal_0.xml
virsh dumpxml baremetal_1 > baremetal_1.xml
virsh dumpxml baremetalbrbm_0 > baremetalbrbm_0.xml
virsh dumpxml baremetalbrbm_1 > baremetalbrbm_1.xml
cp -f /var/lib/libvirt/images/instack.qcow2 .
virsh dumpxml instack > instack.xml
#virsh vol-dumpxml instack.qcow2 --pool default > instack.qcow2.xml
......@@ -151,8 +155,8 @@ EOI
# copy off the instack artifacts
echo "Copying instack files to build directory"
scp -o "StrictHostKeyChecking no" stack@localhost:baremetal_0.xml .
scp -o "StrictHostKeyChecking no" stack@localhost:baremetal_1.xml .
scp -o "StrictHostKeyChecking no" stack@localhost:baremetalbrbm_0.xml .
scp -o "StrictHostKeyChecking no" stack@localhost:baremetalbrbm_1.xml .
scp -o "StrictHostKeyChecking no" stack@localhost:instack.xml .
scp -o "StrictHostKeyChecking no" stack@localhost:brbm.xml .
scp -o "StrictHostKeyChecking no" stack@localhost:instack.qcow2 .
......@@ -181,6 +185,7 @@ ssh -T -o "StrictHostKeyChecking no" stack@localhost "scp -r -o 'StrictHostKeyCh
# build the overcloud images
echo "Building overcloud images"
ssh -T -o "StrictHostKeyChecking no" "stack@$UNDERCLOUD" <<EOI
set -e
export DIB_YUM_REPO_CONF="/etc/yum.repos.d/delorean.repo /etc/yum.repos.d/delorean-current.repo /etc/yum.repos.d/delorean-deps.repo"
openstack overcloud image build --all
EOI
......@@ -200,15 +205,16 @@ done
# move and Sanitize private keys from instack.json file
mv stack/instackenv.json instackenv-virt.json
sed -i '/pm_password/c\ "pm_password": "INSERT_STACK_USER_PRIV_KEY",' instackenv-virt.json
sed -i '/ssh-key/c\ "ssh-key": "INSERT_STACK_USER_PRIV_KEY",' instackenv-virt.json
sed -i '/ssh-key/c\ "ssh-key": "INSERT_STACK_USER_PRIV_KEY",' instackenv-virt.json
# clean up the VMs
ssh -T -o "StrictHostKeyChecking no" stack@localhost <<EOI
set -e
virsh destroy instack 2> /dev/null || echo -n ''
virsh undefine instack 2> /dev/null || echo -n ''
virsh destroy baremetal_0 2> /dev/null || echo -n ''
virsh undefine baremetal_0 2> /dev/null || echo -n ''
virsh destroy baremetal_1 2> /dev/null || echo -n ''
virsh undefine baremetal_1 2> /dev/null || echo -n ''
virsh destroy baremetalbrbm_0 2> /dev/null || echo -n ''
virsh undefine baremetalbrbm_0 2> /dev/null || echo -n ''
virsh destroy baremetalbrbm_1 2> /dev/null || echo -n ''
virsh undefine baremetalbrbm_1 2> /dev/null || echo -n ''
EOI
......@@ -28,13 +28,13 @@ cp ci/deploy.sh %{buildroot}%{_bindir}/
mkdir -p %{buildroot}%{_sharedstatedir}/libvirt/images/
cp build/instack.qcow2 %{buildroot}%{_sharedstatedir}/libvirt/images/
cp build/baremetal_0.qcow2 %{buildroot}%{_sharedstatedir}/libvirt/images/
cp build/baremetal_1.qcow2 %{buildroot}%{_sharedstatedir}/libvirt/images/
cp build/baremetalbrbm_0.qcow2 %{buildroot}%{_sharedstatedir}/libvirt/images/
cp build/baremetalbrbm_1.qcow2 %{buildroot}%{_sharedstatedir}/libvirt/images/
mkdir -p %{buildroot}%{_sysconfdir}/libvirt/qemu/
cp build/instack.xml %{buildroot}%{_sysconfdir}/libvirt/qemu/
cp build/baremetal_0.xml %{buildroot}%{_sysconfdir}/libvirt/qemu/
cp build/baremetal_1.xml %{buildroot}%{_sysconfdir}/libvirt/qemu/
cp build/baremetalbrbm_0.xml %{buildroot}%{_sysconfdir}/libvirt/qemu/
cp build/baremetalbrbm_1.xml %{buildroot}%{_sysconfdir}/libvirt/qemu/
mkdir -p %{buildroot}%{_sysconfdir}/libvirt/qemu/networks/
cp build/brbm.xml %{buildroot}%{_sysconfdir}/libvirt/qemu/networks/
......@@ -54,11 +54,11 @@ cp build/stack/fedora-user.qcow2 %{buildroot}%{_var}/opt/opnfv/stack/
%files
%{_bindir}/deploy.sh
%{_sharedstatedir}/libvirt/images/instack.qcow2
%{_sharedstatedir}/libvirt/images/baremetal_0.qcow2
%{_sharedstatedir}/libvirt/images/baremetal_1.qcow2
%{_sharedstatedir}/libvirt/images/baremetalbrbm_0.qcow2
%{_sharedstatedir}/libvirt/images/baremetalbrbm_1.qcow2
%{_sysconfdir}/libvirt/qemu/instack.xml
%{_sysconfdir}/libvirt/qemu/baremetal_0.xml
%{_sysconfdir}/libvirt/qemu/baremetal_1.xml
%{_sysconfdir}/libvirt/qemu/baremetalbrbm_0.xml
%{_sysconfdir}/libvirt/qemu/baremetalbrbm_1.xml
%{_sysconfdir}/libvirt/qemu/networks/brbm.xml
%{_var}/opt/opnfv/instackenv-virt.json
%{_var}/opt/opnfv/stack/deploy-ramdisk-ironic.initramfs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment