diff options
28 files changed, 204 insertions, 143 deletions
@@ -29,7 +29,7 @@ function prepare_env() function download_git() { - file_dir=$CACHE_DIR/${1%.*} + file_dir=$CACHE_DIR/${1%.*} if [[ -d $file_dir/.git ]]; then cd $file_dir git pull origin master @@ -57,22 +57,30 @@ function download_url() function download_local() { - cp $2 $CACHE_DIR/ -rf + if [[ $2 != $CACHE_DIR/$1 ]]; then + cp $2 $CACHE_DIR/ -rf + fi } function download_packages() { for i in $CENTOS_BASE $COMPASS_CORE $COMPASS_WEB $COMPASS_INSTALL $TRUSTY_JUNO_PPA $UBUNTU_ISO \ $CENTOS_ISO $CENTOS7_JUNO_PPA $LOADERS $CIRROS $APP_PACKAGE $COMPASS_PKG $PIP_REPO $ANSIBLE_MODULE; do + + if [[ ! $i ]]; then + continue + fi name=`basename $i` + if [[ ${name##*.} == git ]]; then download_git $name $i - elif [[ "https?" =~ ${i%%:*} ]]; then + elif [[ "https?" =~ ${i%%:*} || "file://" =~ ${i%%:*} ]]; then download_url $name $i else download_local $name $i fi done + } function copy_file() @@ -87,25 +95,39 @@ function copy_file() rm -rf $new/.rr_moved - cp $CACHE_DIR/`basename $UBUNTU_ISO` $new/repos/cobbler/ubuntu/iso/ -rf - cp $CACHE_DIR/`basename $TRUSTY_JUNO_PPA` $new/repos/cobbler/ubuntu/ppa/ -rf - cp $CACHE_DIR/`basename $CENTOS_ISO` $new/repos/cobbler/centos/iso/ -rf - cp $CACHE_DIR/`basename $CENTOS7_JUNO_PPA` $new/repos/cobbler/centos/ppa/ -rf + if [[ $UBUNTU_ISO ]]; then + cp $CACHE_DIR/`basename $UBUNTU_ISO` $new/repos/cobbler/ubuntu/iso/ -rf + fi + + if [[ $TRUSTY_JUNO_PPA ]]; then + cp $CACHE_DIR/`basename $TRUSTY_JUNO_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 + + if [[ $CENTOS7_JUNO_PPA ]]; then + cp $CACHE_DIR/`basename $CENTOS7_JUNO_PPA` $new/repos/cobbler/centos/ppa/ -rf + fi cp $CACHE_DIR/`basename $LOADERS` $new/ -rf || exit 1 - cp $CACHE_DIR/`basename $CIRROS` $new/guestimg/ -rf || exit 1 cp $CACHE_DIR/`basename $APP_PACKAGE` $new/app_packages/ -rf || exit 1 cp $CACHE_DIR/`basename $ANSIBLE_MODULE | sed 's/.git//g'` $new/ansible/ -rf || exit 1 + if [[ $CIRROS ]]; then + cp $CACHE_DIR/`basename $CIRROS` $new/guestimg/ -rf || exit 1 + fi + for i in $COMPASS_CORE $COMPASS_INSTALL $COMPASS_WEB; do cp $CACHE_DIR/`basename $i | sed 's/.git//g'` $new/compass/ -rf done cp $COMPASS_DIR/deploy/adapters $new/compass/compass-adapters -rf - tar -zxvf $CACHE_DIR/pip.tar.gz -C $new/ + tar -zxvf $CACHE_DIR/`basename $PIP_REPO` -C $new/ - find $new/compass -name ".git" |xargs rm -rf + find $new/compass -name ".git" | xargs rm -rf } function rebuild_ppa() diff --git a/build/build.conf b/build/build.conf index cf44905f..d57e5f37 100644 --- a/build/build.conf +++ b/build/build.conf @@ -1,25 +1,24 @@ TIMEOUT=10 -PACKAGE_URL=${PACKAGE_URL:-http://58.251.166.184:9999} +export PACKAGE_URL=${PACKAGE_URL:-http://58.251.166.184:9999} #begin: package download -PACKAGE_MD5=${PACKAGE_MD5:-$PACKAGE_URL/md5.txt} -CENTOS_BASE=${CENTOS_BASE:-$PACKAGE_URL/centos_base.iso} -COMPASS_CORE=${COMPASS_CORE:-http://github.com/baigk/compass-core.git} -COMPASS_WEB=${COMPASS_WEB:-http://github.com/baigk/compass-web.git} -COMPASS_INSTALL=${COMPASS_INSTALL:-http://github.com/baigk/compass-install.git} -TRUSTY_JUNO_PPA=${TRUSTY_JUNO_PPA:-$PACKAGE_URL/trusty-juno-ppa.tar.gz} -UBUNTU_ISO=${UBUNTU_ISO:-$PACKAGE_URL/ubuntu-14.04.3-server-amd64.iso} -CENTOS_ISO=${CENTOS_ISO:-$PACKAGE_URL/CentOS-7-x86_64-Minimal-1503-01.iso} -CENTOS7_JUNO_PPA=${CENTOS7_JUNO_PPA:-$PACKAGE_URL/centos7-juno-ppa.tar.gz} -COMPASS_PKG=${COMPASS_PKG:-$PACKAGE_URL/centos6-package.tar.gz} -LOADERS=${LOADERS:-$PACKAGE_URL/loaders.tar.gz} -CIRROS=${CIRROS:-$PACKAGE_URL/cirros-0.3.3-x86_64-disk.img} -APP_PACKAGE=${APP_PACKAGE:-$PACKAGE_URL/packages.tar.gz} -PIP_REPO=${PIP_REPO:-$PACKAGE_URL/pip.tar.gz} -ANSIBLE_MODULE=${ANSIBLE_MODULE:-https://github.com/openstack-ansible/openstack-ansible-modules.git} +export CENTOS_BASE=${CENTOS_BASE:-$PACKAGE_URL/centos_base.iso} +export COMPASS_CORE=${COMPASS_CORE:-http://github.com/baigk/compass-core.git} +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 TRUSTY_JUNO_PPA=${TRUSTY_JUNO_PPA:-$PACKAGE_URL/trusty-juno-ppa.tar.gz} +export UBUNTU_ISO=${UBUNTU_ISO:-$PACKAGE_URL/ubuntu-14.04.3-server-amd64.iso} +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 COMPASS_PKG=${COMPASS_PKG:-$PACKAGE_URL/centos6-package.tar.gz} +export LOADERS=${LOADERS:-$PACKAGE_URL/loaders.tar.gz} +export CIRROS=${CIRROS:-$PACKAGE_URL/cirros-0.3.3-x86_64-disk.img} +export APP_PACKAGE=${APP_PACKAGE:-$PACKAGE_URL/packages.tar.gz} +export PIP_REPO=${PIP_REPO:-$PACKAGE_URL/pip.tar.gz} +export ANSIBLE_MODULE=${ANSIBLE_MODULE:-https://github.com/openstack-ansible/openstack-ansible-modules.git} #end -PIP_CONF="https://bootstrap.pypa.io/ez_setup.py \ +export PIP_CONF="https://bootstrap.pypa.io/ez_setup.py \ https://pypi.python.org/packages/source/s/setuptools/setuptools-18.2.zip \ https://pypi.python.org/packages/source/p/pip/pip-7.1.2.tar.gz \ https://pypi.python.org/packages/source/a/ansible/ansible-1.9.2.tar.gz \ diff --git a/build/os/centos/rhel6/base.repo b/build/os/centos/rhel6/base.repo deleted file mode 100644 index e1ea7c4b..00000000 --- a/build/os/centos/rhel6/base.repo +++ /dev/null @@ -1,52 +0,0 @@ -# CentOS-Base.repo -# -# The mirror system uses the connecting IP address of the client and the -# update status of each mirror to pick mirrors that are updated to and -# geographically close to the client. You should use this for CentOS updates -# unless you are manually picking other mirrors. -# -# If the mirrorlist= does not work for you, as a fall back you can try the -# remarked out baseurl= line instead. -# -# - -[base] -name=CentOS-$releasever - Base - 163.com -baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/ -#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os -gpgcheck=1 -gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 - -#released updates -[updates] -name=CentOS-$releasever - Updates - 163.com -baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/ -#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates -gpgcheck=1 -gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 - -#additional packages that may be useful -[extras] -name=CentOS-$releasever - Extras - 163.com -baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/ -#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras -gpgcheck=1 -gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 - -#additional packages that extend functionality of existing packages -[centosplus] -name=CentOS-$releasever - Plus - 163.com -baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/ -#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus -gpgcheck=1 -enabled=0 -gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 - -#contrib - packages by Centos Users -[contrib] -name=CentOS-$releasever - Contrib - 163.com -baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/ -#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib -gpgcheck=1 -enabled=0 -gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 diff --git a/build/os/centos/rhel7/juno/Dockerfile.tmpl b/build/os/centos/rhel7/juno/Dockerfile.tmpl index 450e5c85..34945d00 100644 --- a/build/os/centos/rhel7/juno/Dockerfile.tmpl +++ b/build/os/centos/rhel7/juno/Dockerfile.tmpl @@ -1,9 +1,6 @@ FROM centos:7.1.1503 MAINTAINER Chigang(Justin) <chigang@huawei.com> -# TODO: Is there some easy way to get the fastest/closest mirror? -# RUN sed -i 's/archive.ubuntu.com/mirrors.163.com/g' /etc/apt/sources.list - # set cache enable RUN sed -i 's/keepcache=0/keepcache=1/g' /etc/yum.conf #set packages = $getVar('spcial_packages', []) diff --git a/build/os/ubuntu/trusty/juno/Dockerfile.tmpl b/build/os/ubuntu/trusty/juno/Dockerfile.tmpl index d723b6e7..2071cb41 100644 --- a/build/os/ubuntu/trusty/juno/Dockerfile.tmpl +++ b/build/os/ubuntu/trusty/juno/Dockerfile.tmpl @@ -1,9 +1,6 @@ FROM ubuntu:14.04.3 MAINTAINER Chigang(Justin) <chigang@huawei.com> -# TODO: Is there some easy way to get the fastest/closest mirror? -RUN sed -i 's/archive.ubuntu.com/mirrors.163.com/g' /etc/apt/sources.list - #RUN apt-get update RUN rm -f /etc/apt/apt.conf.d/docker-clean diff --git a/build/os/ubuntu/trusty/kilo/Dockerfile.tmpl b/build/os/ubuntu/trusty/kilo/Dockerfile.tmpl index d723b6e7..2071cb41 100644 --- a/build/os/ubuntu/trusty/kilo/Dockerfile.tmpl +++ b/build/os/ubuntu/trusty/kilo/Dockerfile.tmpl @@ -1,9 +1,6 @@ FROM ubuntu:14.04.3 MAINTAINER Chigang(Justin) <chigang@huawei.com> -# TODO: Is there some easy way to get the fastest/closest mirror? -RUN sed -i 's/archive.ubuntu.com/mirrors.163.com/g' /etc/apt/sources.list - #RUN apt-get update RUN rm -f /etc/apt/apt.conf.d/docker-clean diff --git a/build/templates/RedHat_juno.tmpl b/build/templates/RedHat_juno.tmpl index 6381ef8d..e8a54ac8 100644 --- a/build/templates/RedHat_juno.tmpl +++ b/build/templates/RedHat_juno.tmpl @@ -4,7 +4,6 @@ set -x yum remove systemd -y # add 163 repo yum install wget -y -#wget -O /etc/yum.repos.d/CentOS7-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo wget -O /epel-release-7-5.noarch.rpm http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm yum remove wget iptables-services -y yum update -y diff --git a/deploy/adapters/ansible/roles/ceilometer_compute/templates/ceilometer.j2 b/deploy/adapters/ansible/roles/ceilometer_compute/templates/ceilometer.j2 index d3ee52ab..716317da 100644 --- a/deploy/adapters/ansible/roles/ceilometer_compute/templates/ceilometer.j2 +++ b/deploy/adapters/ansible/roles/ceilometer_compute/templates/ceilometer.j2 @@ -2,6 +2,7 @@ verbose = True rpc_backend = rabbit rabbit_host = {{ internal_vip.ip }} +rabbit_userid = {{ RABBIT_USER }} rabbit_password = {{ RABBIT_PASS }} [publisher] diff --git a/deploy/adapters/ansible/roles/ceilometer_controller/templates/ceilometer.j2 b/deploy/adapters/ansible/roles/ceilometer_controller/templates/ceilometer.j2 index 09ca5272..c2993885 100644 --- a/deploy/adapters/ansible/roles/ceilometer_controller/templates/ceilometer.j2 +++ b/deploy/adapters/ansible/roles/ceilometer_controller/templates/ceilometer.j2 @@ -1,6 +1,7 @@ [DEFAULT] rpc_backend = rabbit rabbit_host = {{ internal_vip.ip }} +rabbit_userid = {{ RABBIT_USER }} rabbit_password = {{ RABBIT_PASS }} auth_strategy = keystone verbose = True diff --git a/deploy/adapters/ansible/roles/ceilometer_controller/templates/glance.j2 b/deploy/adapters/ansible/roles/ceilometer_controller/templates/glance.j2 index c34f5d81..616e7e05 100644 --- a/deploy/adapters/ansible/roles/ceilometer_controller/templates/glance.j2 +++ b/deploy/adapters/ansible/roles/ceilometer_controller/templates/glance.j2 @@ -2,4 +2,5 @@ notification_driver = messagingv2 rpc_backend = rabbit rabbit_host = {{ internal_vip.ip }} +rabbit_userid = {{ RABBIT_USER }} rabbit_password = {{ RABBIT_PASS }} diff --git a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_openstack_conf.yml b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_openstack_conf.yml index 2c194fae..ab010266 100644 --- a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_openstack_conf.yml +++ b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_openstack_conf.yml @@ -1,21 +1,36 @@ --- +- name: chown of glance/api.log + shell: ssh -o StrictHostKeyChecking=no {{ item }} -t "chown -R glance:glance /var/log/glance" + with_items: + - "{{ groups['controller'] }}" + tags: + - ceph_conf_glance + ignore_errors: True - name: modify glance-api.conf for ceph - shell: ssh -o StrictHostKeyChecking=no {{ item }} -t "sed -i 's/^\(default_store\).*/\1 = rbd/' /etc/glance/glance-api.conf && sed -i '/^\[glance_store/a stores = rbd\nrbd_store_pool = images\nrbd_store_user = glance\nrbd_store_ceph_conf = /etc/ceph/ceph.conf\nrbd_store_chunk_size = 8\nshow_image_direct_url=True' /etc/glance/glance-api.conf && service {{ glance_service }} restart" + shell: ssh -o StrictHostKeyChecking=no {{ item }} -t "sed -i 's/^\(default_store\).*/\1 = rbd/g' /etc/glance/glance-api.conf && sed -i '/^\[glance_store/a stores = rbd\nrbd_store_pool = images\nrbd_store_user = glance\nrbd_store_ceph_conf = /etc/ceph/ceph.conf\nrbd_store_chunk_size = 8\nshow_image_direct_url=True' /etc/glance/glance-api.conf" + with_items: + - "{{ groups['controller'] }}" + tags: + - ceph_conf_glance + +- name: restart glance + shell: ssh -o StrictHostKeyChecking=no {{ item }} -t "rm -f /var/log/glance/api.log && chown -R glance:glance /var/log/glance && service {{ glance_service }} restart" with_items: - "{{ groups['controller'] }}" tags: - ceph_conf_glance + ignore_errors: True - name: modify cinder.conf for ceph - shell: ssh -o StrictHostKeyChecking=no {{ item }} -t "sed -i 's/^\(volume_driver\).*/\1 = cinder.volume.drivers.rbd.RBDDriver/' /etc/cinder/cinder.conf && sed -i '/^\[DEFAULT/a rbd_pool = volumes\nrbd_ceph_conf = /etc/ceph/ceph.conf\nrbd_flatten_volume_from_snapshot = false\nrbd_max_clone_depth = 5\nrbd_store_chunk_size = 4\nrados_connect_timeout = -1\nglance_api_version = 2\nrbd_user = cinder\nrbd_secret_uuid = {{ ceph_uuid.stdout_lines[0] }}' /etc/cinder/cinder.conf && service {{ cinder_service }} restart" + shell: ssh -o StrictHostKeyChecking=no {{ item }} -t "sed -i 's/^\(volume_driver\).*/\1 = cinder.volume.drivers.rbd.RBDDriver/g' /etc/cinder/cinder.conf && sed -i 's/^\(rbd_secret_uuid\).*/\1 = {{ ceph_uuid.stdout_lines[0] }}/g' /etc/cinder/cinder.conf && sed -i '/^\[DEFAULT/a rbd_pool = volumes\nrbd_ceph_conf = /etc/ceph/ceph.conf\nrbd_flatten_volume_from_snapshot = false\nrbd_max_clone_depth = 5\nrbd_store_chunk_size = 4\nrados_connect_timeout = -1\nglance_api_version = 2\nrbd_user = cinder\nrbd_secret_uuid = {{ ceph_uuid.stdout_lines[0] }}' /etc/cinder/cinder.conf && service {{ cinder_service }} restart" with_items: - "{{ groups['compute'] }}" tags: - ceph_conf_cinder - name: modify nova.conf for ceph - shell: ssh -o StrictHostKeyChecking=no {{ item }} -t "sed -i 's/^\(images_type\).*/\1 = rbd/' /etc/nova/nova-compute.conf && sed -i '/^\[libvirt/a images_rbd_pool = vms\nimages_rbd_ceph_conf = /etc/ceph/ceph.conf\nrbd_user = cinder\nrbd_secret_uuid = {{ ceph_uuid.stdout_lines[0] }}\ndisk_cachemodes=\"network=writeback\"\nlive_migration_flag=\"VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST,VIR_MIGRATE_TUNNELLED\"' /etc/nova/nova-compute.conf && service {{ nova_service }} restart" + shell: ssh -o StrictHostKeyChecking=no {{ item }} -t "sed -i 's/^\(images_type\).*/\1 = rbd/g' /etc/nova/nova-compute.conf && sed -i 's/^\(rbd_secret_uuid\).*/\1 = {{ ceph_uuid.stdout_lines[0] }}/g' /etc/nova/nova-compute.conf && sed -i '/^\[libvirt/a images_rbd_pool = vms\nimages_rbd_ceph_conf = /etc/ceph/ceph.conf\nrbd_user = cinder\nrbd_secret_uuid = {{ ceph_uuid.stdout_lines[0] }}\ndisk_cachemodes=\"network=writeback\"\nlive_migration_flag=\"VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST,VIR_MIGRATE_TUNNELLED\"' /etc/nova/nova-compute.conf && service {{ nova_service }} restart" with_items: - "{{ groups['compute'] }}" tags: diff --git a/deploy/adapters/ansible/roles/cinder-volume/files/create_img.sh b/deploy/adapters/ansible/roles/cinder-volume/files/create_img.sh new file mode 100644 index 00000000..b69db0ed --- /dev/null +++ b/deploy/adapters/ansible/roles/cinder-volume/files/create_img.sh @@ -0,0 +1,3 @@ +if [[ ! -f /var/cinder.img ]]; then + dd if=/dev/zero of=/var/cinder.img bs=1 count=1 seek=$1 +fi diff --git a/deploy/adapters/ansible/roles/cinder-volume/files/get_var_size.sh b/deploy/adapters/ansible/roles/cinder-volume/files/get_var_size.sh new file mode 100644 index 00000000..9670da12 --- /dev/null +++ b/deploy/adapters/ansible/roles/cinder-volume/files/get_var_size.sh @@ -0,0 +1,6 @@ +size=`df /var | awk '$3 ~ /[0-9]+/ { print $4 }'`; +if [[ $size -gt 2000000000 ]]; then + echo -n 2000000000000; +else + echo -n $((size * 1000)); +fi diff --git a/deploy/adapters/ansible/roles/cinder-volume/files/losetup.sh b/deploy/adapters/ansible/roles/cinder-volume/files/losetup.sh new file mode 100644 index 00000000..d0e6c776 --- /dev/null +++ b/deploy/adapters/ansible/roles/cinder-volume/files/losetup.sh @@ -0,0 +1,7 @@ +loop_dev=`losetup -a |grep "/var/cinder.img"|awk -F':' '{print $1}'` +if [[ -z $loop_dev ]]; then + losetup -f --show /var/cinder.img +else + echo $loop_dev +fi + diff --git a/deploy/adapters/ansible/roles/cinder-volume/tasks/loop.yml b/deploy/adapters/ansible/roles/cinder-volume/tasks/loop.yml new file mode 100644 index 00000000..b44253c4 --- /dev/null +++ b/deploy/adapters/ansible/roles/cinder-volume/tasks/loop.yml @@ -0,0 +1,20 @@ +--- +- include_vars: "{{ ansible_os_family }}.yml" + +- name: get available /var partition size + script: get_var_size.sh + register: part_size + +- name: create cinder file if not exitst + script: create_img.sh {{ part_size.stdout }} + +- name: do a losetup on /mnt/cinder-volumes + script: losetup.sh + register: loop_device + +- name: debug loop device + debug: msg={{ loop_device.stdout }} + +- name: create physical and group volumes + lvg: vg=cinder-volumes pvs={{ loop_device.stdout }} + vg_options=--force diff --git a/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml b/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml index b64024da..a258a0cf 100644 --- a/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml +++ b/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml @@ -13,43 +13,13 @@ stat: path={{ physical_device }} register: status -- name: replace physical_device if st is false - local_action: copy src=loop.yml dest=/tmp/loop.yml - when: status.stat.exists == False - - name: load loop.yml - include_vars: /tmp/loop.yml - when: status.stat.exists == False - -- name: check if cinder-volumes is mounted - shell: ls /mnt - register: cindervolumes - -- name: get available partition size - shell: df / | awk '$3 ~ /[0-9]+/ { print $4 }' - register: partition_size - -- name: if not mounted, mount it - shell: dd if=/dev/zero of=/mnt/cinder-volumes - bs=1 count=0 seek={{ partition_size.stdout }} - when: cindervolumes.stdout != 'cinder-volumes' - -- name: get first lo device - shell: losetup -f - register: first_lo - when: cindervolumes.stdout != 'cinder-volumes' - -- name: do a losetup on /mnt/cinder-volumes - shell: losetup {{ first_lo.stdout }} /mnt/cinder-volumes - when: cindervolumes.stdout != 'cinder-volumes' - -- name: destroy GPT lable - shell: dd if=/dev/urandom of=/dev/sdb bs=4M count=1 - ignore_errors: True + include: loop.yml + when: status.stat.isblk == False -- name: create physical and group volumes - lvg: vg=cinder-volumes pvs={{ physical_device }} - vg_options=--force +- name: load real.yml + include: real.yml + when: status.stat.isblk == True - name: upload cinder-volume configuration template: src=cinder.conf dest=/etc/cinder/cinder.conf diff --git a/deploy/adapters/ansible/roles/cinder-volume/tasks/real.yml b/deploy/adapters/ansible/roles/cinder-volume/tasks/real.yml new file mode 100644 index 00000000..19ef828b --- /dev/null +++ b/deploy/adapters/ansible/roles/cinder-volume/tasks/real.yml @@ -0,0 +1,10 @@ +--- +- include_vars: "{{ ansible_os_family }}.yml" + +- name: destroy GPT lable + shell: dd if=/dev/urandom of={{ physical_device }} bs=4M count=1 + ignore_errors: True + +- name: create physical and group volumes + lvg: vg=cinder-volumes pvs={{ physical_device }} + vg_options=--force diff --git a/deploy/adapters/ansible/roles/database/tasks/mongodb.yml b/deploy/adapters/ansible/roles/database/tasks/mongodb.yml index ca61e905..5ca23a19 100644 --- a/deploy/adapters/ansible/roles/database/tasks/mongodb.yml +++ b/deploy/adapters/ansible/roles/database/tasks/mongodb.yml @@ -19,7 +19,7 @@ - name: manually restart mongodb server service: name=mongodb state=restarted -- wait_for: port=27017 delay=3 timeout=30 host={{ internal_vip.ip }} +- wait_for: port=27017 delay=3 timeout=60 host={{ internal_vip.ip }} - name: create mongodb user run_once: True diff --git a/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg b/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg index 721c9731..c8065f05 100644 --- a/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg +++ b/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg @@ -39,7 +39,6 @@ listen proxy-glance_api_cluster bind {{ internal_vip.ip }}:9292 bind {{ public_vip.ip }}:9292 option tcpka - option httpchk option tcplog balance source {% for host,ip in haproxy_hosts.items() %} diff --git a/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml b/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml index 7658d90d..5bea0ae2 100755 --- a/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml +++ b/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml @@ -9,10 +9,9 @@ - name: Stop the Open vSwitch service and clear existing OVSDB shell: > - service openvswitch-switch stop ; - rm -rf /var/log/openvswitch/* ; - rm -rf /etc/openvswitch/conf.db ; - service openvswitch-switch start ; + ovs-vsctl del-br br-int ; + ovs-vsctl del-br br-tun ; + ovs-vsctl del-manager ; #- name: get image http server # shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf diff --git a/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py b/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py index 5e6520af..bf784bb3 100644 --- a/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py +++ b/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py @@ -56,6 +56,7 @@ def setup_ips(ip_settings, sys_intf_mappings): cmd = "ip addr add %s/%s brd %s dev %s;" \ % (intf_info["ip"], intf_info["netmask"], str(network.broadcast),intf_name) if "gw" in intf_info: + cmd += "route del default;" cmd += "ip route add default via %s dev %s" % (intf_info["gw"], intf_name) LOG.info("setup_ips: cmd=%s" % cmd) os.system(cmd) diff --git a/deploy/compass_vm.sh b/deploy/compass_vm.sh index 9e192281..79eb1ecf 100644 --- a/deploy/compass_vm.sh +++ b/deploy/compass_vm.sh @@ -30,6 +30,7 @@ function install_compass_core() { function wait_ok() { set +x log_info "wait_compass_ok enter" + ssh-keygen -f "/root/.ssh/known_hosts" -R $MGMT_IP >/dev/null 2>&1 retry=0 until timeout 1s ssh $ssh_args root@$MGMT_IP "exit" >/dev/null 2>&1 do @@ -108,7 +109,7 @@ function launch_compass() { sudo virsh define $compass_vm_dir/libvirt.xml sudo virsh start compass - if ! wait_ok 300;then + if ! wait_ok 360;then log_error "install os timeout" exit 1 fi diff --git a/deploy/conf/baremetal_cluster_sh.yml b/deploy/conf/baremetal_cluster_sh.yml index 1078cb5c..fe329548 100644 --- a/deploy/conf/baremetal_cluster_sh.yml +++ b/deploy/conf/baremetal_cluster_sh.yml @@ -5,6 +5,7 @@ POWER_TOOL: ipmitool ipmiUser: root ipmiPass: Huawei@123 +ipmiVer: '1.0' hosts: - name: host1 diff --git a/deploy/conf/compass.conf b/deploy/conf/compass.conf index eee23e9f..0bae6d3b 100644 --- a/deploy/conf/compass.conf +++ b/deploy/conf/compass.conf @@ -1,14 +1,15 @@ export COMPASS_VIRT_CPUS=4 export COMPASS_VIRT_MEM=4096 export COMPASS_SERVER=$INSTALL_IP -export COMPASS_SERVER_URL="http://$COMPASS_SERVER/api" +export COMPASS_SERVER_URL="http://$MGMT_IP/api" +export HTTP_SERVER_URL="http://$MGMT_IP/api" export COMPASS_USER_EMAIL="admin@huawei.com" export COMPASS_USER_PASSWORD="admin" export COMPASS_DNS1=${COMPASS_DNS1:-'8.8.8.8'} export COMPASS_DNS2=${COMPASS_DNS2:-} -export COMPASS_EXTERNAL_IP=${COMPASS_EXTERNAL_IP:-192.168.124.221} -export COMPASS_EXTERNAL_MASK=${COMPASS_EXTERNAL_MASK:-255.255.252.0} -export COMPASS_EXTERNAL_GW=${COMPASS_EXTERNAL_GW:-192.168.124.1} +export COMPASS_EXTERNAL_IP=${COMPASS_EXTERNAL_IP:-} +export COMPASS_EXTERNAL_MASK=${COMPASS_EXTERNAL_MASK:-} +export COMPASS_EXTERNAL_GW=${COMPASS_EXTERNAL_GW:-} export LANGUAGE="EN" export TIMEZONE="America/Los_Angeles" export NTP_SERVER="$COMPASS_SERVER" diff --git a/deploy/conf/virtual_cluster_odl.yml b/deploy/conf/virtual_cluster_odl.yml new file mode 100644 index 00000000..e2ee19c6 --- /dev/null +++ b/deploy/conf/virtual_cluster_odl.yml @@ -0,0 +1,29 @@ +TYPE: virtual +FLAVOR: cluster + +hosts: + - name: host1 + roles: + - controller + - ha + - odl + + - name: host2 + roles: + - controller + - ha + - odl + + - name: host3 + roles: + - controller + - ha + - odl + + - name: host4 + roles: + - compute + + - name: host5 + roles: + - compute diff --git a/deploy/conf/virtual_cluster_onos.yml b/deploy/conf/virtual_cluster_onos.yml new file mode 100644 index 00000000..fcd07efc --- /dev/null +++ b/deploy/conf/virtual_cluster_onos.yml @@ -0,0 +1,29 @@ +TYPE: virtual +FLAVOR: cluster + +hosts: + - name: host1 + roles: + - controller + - ha + - onos + + - name: host2 + roles: + - controller + - ha + - onos + + - name: host3 + roles: + - controller + - ha + - onos + + - name: host4 + roles: + - compute + + - name: host5 + roles: + - compute diff --git a/deploy/deploy_host.sh b/deploy/deploy_host.sh index 2ec7b8c8..a055702e 100644 --- a/deploy/deploy_host.sh +++ b/deploy/deploy_host.sh @@ -3,12 +3,12 @@ function deploy_host(){ NEUTRON_FILE=${COMPASS_DIR}/deploy/conf/neutron_cfg.yaml pip install oslo.config - ssh $ssh_args root@${COMPASS_SERVER} mkdir -p /opt/compass/bin/ansible_callbacks - scp $ssh_args -r ${COMPASS_DIR}/deploy/status_callback.py root@${COMPASS_SERVER}:/opt/compass/bin/ansible_callbacks/status_callback.py + ssh $ssh_args root@${MGMT_IP} mkdir -p /opt/compass/bin/ansible_callbacks + scp $ssh_args -r ${COMPASS_DIR}/deploy/status_callback.py root@${MGMT_IP}:/opt/compass/bin/ansible_callbacks/status_callback.py reboot_hosts - python ${COMPASS_DIR}/deploy/client.py --compass_server="${COMPASS_SERVER_URL}" \ + python ${COMPASS_DIR}/deploy/client.py --compass_server="${HTTP_SERVER_URL}" \ --compass_user_email="${COMPASS_USER_EMAIL}" --compass_user_password="${COMPASS_USER_PASSWORD}" \ --cluster_name="${CLUSTER_NAME}" --language="${LANGUAGE}" --timezone="${TIMEZONE}" \ --hostnames="${HOSTNAMES}" --partitions="${PARTITIONS}" --subnets="${SUBNETS}" \ diff --git a/deploy/template/power/ipmitool.tmpl b/deploy/template/power/ipmitool.tmpl index 5d2630af..73278e45 100644 --- a/deploy/template/power/ipmitool.tmpl +++ b/deploy/template/power/ipmitool.tmpl @@ -1,6 +1,7 @@ source \${COMPASS_DIR}/util/log.sh #set default_ipmiUser=$getVar('ipmiUser', '') #set default_ipmiPass=$getVar('ipmiPass', '') +#set default_ipmiVer=$getVar('ipmiVer', '2.0') #set hosts=$getVar('hosts', []) #set fail_list="" #for host in $hosts @@ -20,8 +21,15 @@ exit 1 #set ipmiIp=$host.get('ipmiIp', '') #set ipmiUser=$host.get('ipmiUser', $default_ipmiUser) #set ipmiPass=$host.get('ipmiPass', $default_ipmiPass) +#set ipmiVer=$host.get('ipmiVer', $default_ipmiVer) +#if $ipmiVer == '2.0' + #set interface='lanplus' +#else + #set interface='lan' +#end if + for i in {1..5}; do - if ipmitool -I lan -H $ipmiIp -U $ipmiUser -P $ipmiPass chassis bootdev pxe >/dev/null 2>&1 + if ipmitool -I $interface -H $ipmiIp -U $ipmiUser -P $ipmiPass chassis bootdev pxe >/dev/null 2>&1 then break elif [[ i -lt 5 ]] @@ -34,7 +42,7 @@ for i in {1..5}; do done sleep 1 for i in {1..5}; do - if ipmitool -I lan -H $ipmiIp -U $ipmiUser -P $ipmiPass chassis power reset >/dev/null 2>&1 + if ipmitool -I $interface -H $ipmiIp -U $ipmiUser -P $ipmiPass chassis power reset >/dev/null 2>&1 then break elif [[ i -lt 5 ]] |