diff options
Diffstat (limited to 'build/instack.sh')
-rwxr-xr-x | build/instack.sh | 58 |
1 files changed, 39 insertions, 19 deletions
diff --git a/build/instack.sh b/build/instack.sh index f96f63f9..3447e444 100755 --- a/build/instack.sh +++ b/build/instack.sh @@ -46,9 +46,9 @@ 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-current.repo http://trunk.rdoproject.org/liberty/centos7/current/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/liberty/centos7/delorean-deps.repo + sudo curl -o /etc/yum.repos.d/delorean-deps.repo http://trunk.rdoproject.org/centos7-liberty/delorean-deps.repo fi # ensure the undercloud package is installed so we can build the undercloud @@ -56,12 +56,12 @@ if ! rpm -q instack-undercloud > /dev/null; then sudo yum install -y instack-undercloud fi -# ensure openvswitch is installed +# ensure openvswitch is installed if ! rpm -q openvswitch > /dev/null; then sudo yum install -y openvswitch fi -# ensure libvirt is installed +# ensure libvirt is installed if ! rpm -q libvirt-daemon-kvm > /dev/null; then sudo yum install -y libvirt-daemon-kvm fi @@ -100,7 +100,7 @@ while ! ssh -T -o "StrictHostKeyChecking no" "root@$UNDERCLOUD" "echo ''" > /dev sleep 3 CNT=CNT-1 done -# TODO fail if CNT=0 +# TODO fail if CNT=0 # yum repo, triple-o package and ssh key setup for the undercloud ssh -T -o "StrictHostKeyChecking no" "root@$UNDERCLOUD" <<EOI @@ -109,10 +109,10 @@ if ! rpm -q epel-release > /dev/null; then 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-current.repo http://trunk.rdoproject.org/liberty/centos7/current/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 -curl -o /etc/yum.repos.d/delorean-deps.repo http://trunk.rdoproject.org/liberty/centos7/delorean-deps.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 @@ -124,7 +124,7 @@ 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 snapshop" +echo "Shuttind down instack to take snapshot" virsh shutdown instack echo "Waiting for instack VM to shutdown" @@ -145,6 +145,7 @@ virsh dumpxml baremetal_1 > baremetal_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 +virsh net-dumpxml brbm > brbm.xml virsh start instack EOI @@ -153,6 +154,7 @@ 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:instack.xml . +scp -o "StrictHostKeyChecking no" stack@localhost:brbm.xml . scp -o "StrictHostKeyChecking no" stack@localhost:instack.qcow2 . @@ -178,17 +180,35 @@ ssh -T -o "StrictHostKeyChecking no" stack@localhost "scp -r -o 'StrictHostKeyCh # build the overcloud images echo "Building overcloud images" -ssh -tt -o "StrictHostKeyChecking no" "stack@$UNDERCLOUD" "openstack overcloud image build --all" +ssh -T -o "StrictHostKeyChecking no" "stack@$UNDERCLOUD" <<EOI +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 # copy off the built images echo "Copying overcloud images" -if [ -f stack ]; then mkdir stack; fi -scp -o "StrictHostKeyChecking no" stack@$UNDERCLOUD:deploy-ramdisk-ironic.initramfs stack -scp -o "StrictHostKeyChecking no" stack@$UNDERCLOUD:deploy-ramdisk-ironic.kernel stack -#scp -o "StrictHostKeyChecking no" stack@$UNDERCLOUD:discovery-ramdisk.initramfs stack -#scp -o "StrictHostKeyChecking no" stack@$UNDERCLOUD:discovery-ramdisk.kernel stack -scp -o "StrictHostKeyChecking no" stack@$UNDERCLOUD:fedora-user.qcow2 stack -scp -o "StrictHostKeyChecking no" stack@$UNDERCLOUD:overcloud-full.initrd stack -scp -o "StrictHostKeyChecking no" stack@$UNDERCLOUD:overcloud-full.qcow2 stack -scp -o "StrictHostKeyChecking no" stack@$UNDERCLOUD:overcloud-full.vmlinuz stack -scp -o "StrictHostKeyChecking no" stack@$UNDERCLOUD:instackenv.json instackenv-virt.json +if [ ! -d stack ]; then mkdir stack; fi +IMAGES="deploy-ramdisk-ironic.initramfs deploy-ramdisk-ironic.kernel" +#IMAGES+=" ironic-python-agent.initramfs ironic-python-agent.kernel ironic-python-agent.vmlinuz" +IMAGES+=" overcloud-full.initrd overcloud-full.qcow2 overcloud-full.vmlinuz" +IMAGES+=" fedora-user.qcow2 instackenv.json" + +for i in $IMAGES; do +scp -o "StrictHostKeyChecking no" stack@$UNDERCLOUD:$i stack/ +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 + +# clean up the VMs +ssh -T -o "StrictHostKeyChecking no" stack@localhost <<EOI +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 '' +EOI + |