From e93d595baf9b3fbbc0ec213ad725ce438772d8a4 Mon Sep 17 00:00:00 2001 From: "carey.xu" Date: Thu, 26 Nov 2015 18:00:55 +0800 Subject: support libverty on ubuntu JIRA: COMPASS-169 Change-Id: I4656cf43eb3db0ba61fae4b03416b9c0239bb50b Signed-off-by: carey.xu --- build.sh | 6 +- build/build.conf | 1 + build/make_repo.sh | 9 ++- build/os/ubuntu/trusty/liberty/Dockerfile.tmpl | 26 +++++++ build/templates/Debian_liberty.tmpl | 49 +++++++++++++ build/templates/RedHat_liberty.tmpl | 83 ++++++++++++++++++++++ deploy/adapters/ansible/openstack_liberty/.gitkeep | 0 .../adapters/ansible/roles/common/vars/Debian.yml | 2 +- .../ansible/roles/ha/templates/keepalived.conf | 6 +- deploy/conf/cluster.conf | 6 +- deploy/prepare.sh | 2 + deploy/qemu_hook.sh | 10 +++ 12 files changed, 191 insertions(+), 9 deletions(-) create mode 100644 build/os/ubuntu/trusty/liberty/Dockerfile.tmpl create mode 100644 build/templates/Debian_liberty.tmpl create mode 100644 build/templates/RedHat_liberty.tmpl create mode 100644 deploy/adapters/ansible/openstack_liberty/.gitkeep create mode 100755 deploy/qemu_hook.sh diff --git a/build.sh b/build.sh index 6ec5bfb3..988ddae7 100755 --- a/build.sh +++ b/build.sh @@ -64,7 +64,7 @@ function download_local() function download_packages() { - for i in $CENTOS_BASE $COMPASS_CORE $COMPASS_WEB $COMPASS_INSTALL $TRUSTY_JUNO_PPA $UBUNTU_ISO \ + for i in $CENTOS_BASE $COMPASS_CORE $COMPASS_WEB $COMPASS_INSTALL $TRUSTY_JUNO_PPA $TRUSTY_LIBERTY_PPA $UBUNTU_ISO \ $CENTOS_ISO $CENTOS7_JUNO_PPA $CENTOS7_KILO_PPA $LOADERS $CIRROS $APP_PACKAGE $COMPASS_PKG \ $PIP_REPO $ANSIBLE_MODULE; do @@ -104,6 +104,10 @@ function copy_file() cp $CACHE_DIR/`basename $TRUSTY_JUNO_PPA` $new/repos/cobbler/ubuntu/ppa/ -rf fi + if [[ $TRUSTY_LIBERTY_PPA ]]; then + cp $CACHE_DIR/`basename $TRUSTY_LIBERTY_PPA` $new/repos/cobbler/ubuntu/ppa/ -rf + fi + if [[ $CENTOS_ISO ]]; then cp $CACHE_DIR/`basename $CENTOS_ISO` $new/repos/cobbler/centos/iso/ -rf fi diff --git a/build/build.conf b/build/build.conf index 2f2025c3..c72451ee 100644 --- a/build/build.conf +++ b/build/build.conf @@ -8,6 +8,7 @@ export COMPASS_WEB=${COMPASS_WEB:-http://github.com/baigk/compass-web.git} export COMPASS_INSTALL=${COMPASS_INSTALL:-http://github.com/baigk/compass-install.git} export UBUNTU_ISO=${UBUNTU_ISO:-$PACKAGE_URL/ubuntu-14.04.3-server-amd64.iso} export TRUSTY_JUNO_PPA=${TRUSTY_JUNO_PPA:-$PACKAGE_URL/trusty-juno-ppa.tar.gz} +export TRUSTY_LIBERTY_PPA=${TRUSTY_LIBERTY_PPA:-$PACKAGE_URL/trusty-liberty-ppa.tar.gz} export CENTOS_ISO=${CENTOS_ISO:-$PACKAGE_URL/CentOS-7-x86_64-Minimal-1503-01.iso} export CENTOS7_JUNO_PPA=${CENTOS7_JUNO_PPA:-$PACKAGE_URL/centos7-juno-ppa.tar.gz} #export CENTOS7_KILO_PPA=${CENTOS7_KILO_PPA:-$PACKAGE_URL/centos7-kilo-ppa.tar.gz} diff --git a/build/make_repo.sh b/build/make_repo.sh index 61c40aef..c4afd4fa 100755 --- a/build/make_repo.sh +++ b/build/make_repo.sh @@ -187,12 +187,17 @@ function make_all_repo() make_repo --os-ver trusty --package-tag juno \ --ansible-dir $WORK_PATH/deploy/adapters/ansible \ --default-package "openssh-server" \ - --special-package "openvswitch-datapath-dkms openvswitch-switch" \ + --special-package "openvswitch-datapath-dkms openvswitch-switch" make_repo --os-ver trusty --package-tag kilo \ --ansible-dir $WORK_PATH/deploy/adapters/ansible \ --default-package "openssh-server" \ - --special-package "openvswitch-datapath-dkms openvswitch-switch" \ + --special-package "openvswitch-datapath-dkms openvswitch-switch" + + make_repo --os-ver trusty --package-tag liberty \ + --ansible-dir $WORK_PATH/deploy/adapters/ansible \ + --default-package "openssh-server" \ + --special-package "openvswitch-datapath-dkms openvswitch-switch" make_repo --os-ver rhel7 --package-tag juno \ --ansible-dir $WORK_PATH/deploy/adapters/ansible \ diff --git a/build/os/ubuntu/trusty/liberty/Dockerfile.tmpl b/build/os/ubuntu/trusty/liberty/Dockerfile.tmpl new file mode 100644 index 00000000..2071cb41 --- /dev/null +++ b/build/os/ubuntu/trusty/liberty/Dockerfile.tmpl @@ -0,0 +1,26 @@ +FROM ubuntu:14.04.3 +MAINTAINER Chigang(Justin) + +#RUN apt-get update + +RUN rm -f /etc/apt/apt.conf.d/docker-clean +#set packages = $getVar('spcial_packages', []) +#for package in $packages +ADD ./Debian/packages/$package /var/cache/apt/archives/ +#end for +#set scripts = $getVar('scripts', []) +#for script in $scripts +ADD ./Debian/script/$script /tmp/chigang/$script +RUN chmod +x /tmp/chigang/$script +RUN /tmp/chigang/$script +#end for +ADD ./install_packages.sh /tmp/chigang/install_packages.sh +RUN chmod +x /tmp/chigang/install_packages.sh +RUN /tmp/chigang/install_packages.sh + +ADD ./cp_repo.sh /tmp/chigang/cp_repo.sh +RUN chmod +x /tmp/chigang/cp_repo.sh +RUN mkdir /result + +CMD ["/tmp/chigang/cp_repo.sh"] +#VOLUME /tmp/chigang diff --git a/build/templates/Debian_liberty.tmpl b/build/templates/Debian_liberty.tmpl new file mode 100644 index 00000000..ede5b51f --- /dev/null +++ b/build/templates/Debian_liberty.tmpl @@ -0,0 +1,49 @@ +#!/bin/bash +set -ex + +# add openstack liberty repo +sudo apt-get update && apt-get install -y software-properties-common +sudo add-apt-repository -y cloud-archive:liberty + +# add galeracluster repo +#sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db +#sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu trusty main' +sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 D669017EBC19DDBA +sudo add-apt-repository 'deb http://releases.galeracluster.com/ubuntu trusty main' +# add oracle java8 ppa +sudo add-apt-repository ppa:webupd8team/java +# add open java7 repo +sudo add-apt-repository 'deb http://security.ubuntu.com/ubuntu trusty-security main' + +sudo apt-get update + +sudo apt-get install reprepro -y + +#download packages +#set packages = $getVar('default_packages', []) +#for pkg in $packages +sudo apt-get -d install $pkg -y +#end for +#set packages = $getVar('packages', []) +#for pkg in $packages +sudo apt-get -d install $pkg -y +#end for + +#make repo +mkdir -p trusty-liberty-ppa/conf +cat < trusty-liberty-ppa/conf/distributions +Codename: trusty +Components: main +Architectures: amd64 +EOF + +sudo apt-get install wget +wget -O /var/cache/apt/python-pyasn1_0.1.8-2_all.deb http://us.archive.ubuntu.com/ubuntu/pool/main/p/pyasn1/python-pyasn1_0.1.8-2_all.deb +rm -rf /var/cache/apt/python-pyasn1_0.1.7-1ubuntu2_all.deb + +mkdir deb +find /var/cache/apt/ -name *.deb | xargs -i cp {} deb + +reprepro -b trusty-liberty-ppa includedeb trusty deb/*.deb + +tar -zcvf /trusty-liberty-ppa.tar.gz ./trusty-liberty-ppa diff --git a/build/templates/RedHat_liberty.tmpl b/build/templates/RedHat_liberty.tmpl new file mode 100644 index 00000000..8473f070 --- /dev/null +++ b/build/templates/RedHat_liberty.tmpl @@ -0,0 +1,83 @@ +#!/bin/bash +set -x + +yum remove systemd -y +# add 163 repo +#rm -f /etc/yum.repos.d/CentOS-*.repo +yum repolist +yum clean all +# add openstack liberty repo +yum install yum-plugin-priorities -y +yum install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm -y +yum install http://rdo.fedorapeople.org/openstack-liberty/rdo-release-liberty.rpm -y + +# modify centos7 repo for workaround +sed -i 's/epel-Derived from Red Hat Enterprise Linux 7.1 (Source)/epel-7/g' /etc/yum.repos.d/rdo-release.repo + +# add galeracluster repo +cat </etc/yum.repos.d/MariaDB.repo +[mariadb] +name =MariaDB +baseurl = http://yum.mariadb.org/5.5/centos7-amd64 +gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB +gpgcheck=1 +EOF + +cat </etc/yum.repos.d/syslog.repo +[rsyslog_v7] +name=rsyslog +baseurl="http://rpms.adiscon.com/v7-stable/epel-7/x86_64" +enabled=1 +gpgcheck=0 +gpgkey=http://rpms.adiscon.com/RPM-GPG-KEY-Adiscon +protect=1 +EOF + +cat </etc/yum.repos.d/ceph.repo +[ceph] +name=Ceph packages for x86_64 +baseurl=http://ceph.com/rpm-hammer/rhel7/x86_64 +enabled=1 +priority=2 +gpgcheck=1 +type=rpm-md +gpgkey=https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc + +[ceph-noarch] +name=Ceph noarch packages +baseurl=http://ceph.com/rpm-hammer/rhel7/noarch +enabled=1 +priority=2 +gpgcheck=1 +type=rpm-md +gpgkey=https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc +EOF + +yum update -y +yum install createrepo tar -y + +yum -y install --downloadonly MariaDB-Galera-server +#download packages +#set packages = $getVar('default_packages', []) +yum -y install --downloadonly #echo ' '.join(packages) +#set packages = $getVar('packages', []) +#silent packages.pop(packages.index('MariaDB-Galera-server')) +yum -y install --downloadonly #echo ' '.join(packages) + +#make repo +mkdir -p /centos7-liberty-ppa/{Packages,repodata} + +find /var/cache/yum/ -name "*.rpm" | xargs -i cp {} /centos7-liberty-ppa/Packages/ + +rm /centos7-liberty-ppa/Packages/selinux-policy* -f +rm /centos7-liberty-ppa/Packages/systemd* -f + +mv /epel-release-7-5.noarch.rpm /centos7-liberty-ppa/Packages/ +cp /comps.xml /centos7-liberty-ppa/ +cp /ceph_key_release.asc /centos7-liberty-ppa/ +createrepo -g comps.xml /centos7-liberty-ppa +mkdir /centos7-liberty-ppa/noarch +mkdir /centos7-liberty-ppa/noarch/Packages +cp -r /centos7-liberty-ppa/Packages/ceph* /centos7-liberty-ppa/noarch/Packages/ +cp -r /centos7-liberty-ppa/repodata/ /centos7-liberty-ppa/noarch/ +tar -zcvf /centos7-liberty-ppa.tar.gz /centos7-liberty-ppa diff --git a/deploy/adapters/ansible/openstack_liberty/.gitkeep b/deploy/adapters/ansible/openstack_liberty/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/deploy/adapters/ansible/roles/common/vars/Debian.yml b/deploy/adapters/ansible/roles/common/vars/Debian.yml index bc273a10..8dce2729 100644 --- a/deploy/adapters/ansible/roles/common/vars/Debian.yml +++ b/deploy/adapters/ansible/roles/common/vars/Debian.yml @@ -1,7 +1,7 @@ --- packages: - ubuntu-cloud-keyring - - python-dev + #- python-dev - openvswitch-datapath-dkms - openvswitch-switch - crudini diff --git a/deploy/adapters/ansible/roles/ha/templates/keepalived.conf b/deploy/adapters/ansible/roles/ha/templates/keepalived.conf index d6f424cd..c2af86b0 100644 --- a/deploy/adapters/ansible/roles/ha/templates/keepalived.conf +++ b/deploy/adapters/ansible/roles/ha/templates/keepalived.conf @@ -14,9 +14,8 @@ vrrp_instance internal_vip { virtual_router_id {{ vrouter_id_internal }} state BACKUP nopreempt - preempt_delay 30 advert_int 1 - priority 100 + priority {{ 50 + (host_index[inventory_hostname] * 50) }} authentication { auth_type PASS @@ -33,9 +32,8 @@ vrrp_instance public_vip { virtual_router_id {{ vrouter_id_public }} state BACKUP nopreempt - preempt_delay 30 advert_int 1 - priority 100 + priority {{ 50 + (host_index[inventory_hostname] * 50) }} authentication { auth_type PASS diff --git a/deploy/conf/cluster.conf b/deploy/conf/cluster.conf index 39e6d467..200fae65 100644 --- a/deploy/conf/cluster.conf +++ b/deploy/conf/cluster.conf @@ -1,8 +1,12 @@ export ADAPTER_OS_PATTERN=${ADAPTER_OS_PATTERN:-'(?i)ubuntu-14\.04\.3.*'} +export ADAPTER_TARGET_SYSTEM_PATTERN="^openstack$" + export REPO_NAME=${REPO_NAME:-"trusty-juno-ppa"} export ADAPTER_NAME="openstack_juno" -export ADAPTER_TARGET_SYSTEM_PATTERN="^openstack$" export ADAPTER_FLAVOR_PATTERN="HA-ansible-multinodes-juno" +#export REPO_NAME=${REPO_NAME:-"trusty-liberty-ppa"} +#export ADAPTER_NAME="openstack_liberty" +#export ADAPTER_FLAVOR_PATTERN="HA-ansible-multinodes-liberty" #export ADAPTER_OS_PATTERN=${ADAPTER_OS_PATTERN:-'(?i)CentOS-7.*1503-01.*'} #export REPO_NAME=${REPO_NAME:-"centos7-kilo-ppa"} diff --git a/deploy/prepare.sh b/deploy/prepare.sh index 8a9ecef0..ce8b7aca 100755 --- a/deploy/prepare.sh +++ b/deploy/prepare.sh @@ -52,4 +52,6 @@ function prepare_env() { chmod 755 $WORK_DIR -R virtualenv $WORK_DIR/venv + + sudo cp ${COMPASS_DIR}/deploy/qemu_hook.sh /etc/libvirt/hooks/qemu } diff --git a/deploy/qemu_hook.sh b/deploy/qemu_hook.sh new file mode 100755 index 00000000..9c6ff6cf --- /dev/null +++ b/deploy/qemu_hook.sh @@ -0,0 +1,10 @@ +#!/bin/bash +if [ "$2" == "started" ]; then + timestamp=$(date +"%Y-%m-%d %H:%M:%S") + exists=$(ifconfig | grep macvtap|awk '{print $1}') + + for i in $exists; do + ifconfig $i allmulti + echo "$timestamp ALLMULTI set on $i" >> /var/log/libvirt_hook_qemu.log + done +fi -- cgit 1.2.3-korg