diff options
-rwxr-xr-x | build.sh | 2 | ||||
-rw-r--r-- | build/build-aarch64.yaml | 18 | ||||
-rw-r--r-- | deploy/adapters/cobbler/snippets/kickstart_sysctl.conf | 1 | ||||
-rw-r--r-- | deploy/adapters/cobbler/snippets/preseed_sysctl.conf | 1 | ||||
-rw-r--r-- | deploy/adapters/cobbler/snippets/sysctl.xml | 1 | ||||
-rw-r--r-- | deploy/client.py | 17 | ||||
-rwxr-xr-x | deploy/compass_vm.sh | 20 | ||||
-rw-r--r-- | deploy/conf/base.conf | 1 | ||||
-rw-r--r-- | deploy/config_parse.py | 1 | ||||
-rwxr-xr-x | deploy/launch.sh | 5 | ||||
-rw-r--r-- | deploy/status_callback.py | 2 | ||||
-rwxr-xr-x | util/docker-compose/group_vars/all | 29 | ||||
-rwxr-xr-x | util/docker-compose/roles/cobbler/tasks/main.yml | 51 | ||||
-rwxr-xr-x | util/docker-compose/roles/cobbler/templates/dhcp.template.j2 | 2 | ||||
-rwxr-xr-x | util/docker-compose/roles/compass/tasks/main.yml | 5 |
15 files changed, 117 insertions, 39 deletions
@@ -102,7 +102,7 @@ function build_tar() sudo rm -rf compass_dists mkdir -p compass_dists sudo cp -f *.tar *.iso compass_dists - sudo cp $COMPASS_PATH/build/build.yaml compass_dists + sudo cp $COMPASS_PATH/build/build*.yaml compass_dists sudo cp -rf $COMPASS_PATH/util/docker-compose ./ sudo tar -zcf compass.tar.gz docker-compose compass_dists sudo mv compass.tar.gz $TAR_DIR/$TAR_NAME diff --git a/build/build-aarch64.yaml b/build/build-aarch64.yaml index 47bd0eb1..e197f33b 100644 --- a/build/build-aarch64.yaml +++ b/build/build-aarch64.yaml @@ -13,29 +13,25 @@ packages: - name: compass-deck description: "RESTful API and DB Handlers for Compass" get_method: docker - url: $COMPASS_DOCKER_REPO/compass-deck:latest + url: linaro/compass-deck:latest - - name: compass-tasks-k8s + # XXX: only supports k8s now + - name: compass-tasks description: "compass task container for kubernets deployment via kargo" get_method: docker - url: $COMPASS_DOCKER_REPO/compass-tasks-k8s:latest + url: linaro/compass-tasks-k8s:latest - name: compass-cobbler description: "cobbler container for compass" get_method: docker - url: $COMPASS_DOCKER_REPO/compass-cobbler:latest + url: linaro/compass-cobbler:latest - name: compass-db description: "datebase container for compass" get_method: docker - url: $COMPASS_DOCKER_REPO/compass-db:latest + url: linaro/compass-db:latest - name: compass-mq description: "message queue container for compass" get_method: docker - url: $COMPASS_DOCKER_REPO/compass-mq:latest - - - name: compass-docker-compose - description: "containerized compass compose ansible" - get_method: git - url: $COMPASS_GIT_REPO/compass-docker-compose + url: linaro/compass-mq:latest diff --git a/deploy/adapters/cobbler/snippets/kickstart_sysctl.conf b/deploy/adapters/cobbler/snippets/kickstart_sysctl.conf index c227ecfa..112f010d 100644 --- a/deploy/adapters/cobbler/snippets/kickstart_sysctl.conf +++ b/deploy/adapters/cobbler/snippets/kickstart_sysctl.conf @@ -59,7 +59,6 @@ net.ipv4.ip_local_port_range = 15000 61000 net.ipv4.tcp_fin_timeout=30 # fast cycling of sockets in time_wait state and re-using them -net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_tw_reuse = 1 # increase the maximum number of requests queued to a listen socket diff --git a/deploy/adapters/cobbler/snippets/preseed_sysctl.conf b/deploy/adapters/cobbler/snippets/preseed_sysctl.conf index c227ecfa..112f010d 100644 --- a/deploy/adapters/cobbler/snippets/preseed_sysctl.conf +++ b/deploy/adapters/cobbler/snippets/preseed_sysctl.conf @@ -59,7 +59,6 @@ net.ipv4.ip_local_port_range = 15000 61000 net.ipv4.tcp_fin_timeout=30 # fast cycling of sockets in time_wait state and re-using them -net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_tw_reuse = 1 # increase the maximum number of requests queued to a listen socket diff --git a/deploy/adapters/cobbler/snippets/sysctl.xml b/deploy/adapters/cobbler/snippets/sysctl.xml index fe13bf7f..42f95976 100644 --- a/deploy/adapters/cobbler/snippets/sysctl.xml +++ b/deploy/adapters/cobbler/snippets/sysctl.xml @@ -62,7 +62,6 @@ net.ipv4.ip_local_port_range = 15000 61000 net.ipv4.tcp_fin_timeout=30 # fast cycling of sockets in time_wait state and re-using them -net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_tw_reuse = 1 # increase the maximum number of requests queued to a listen socket diff --git a/deploy/client.py b/deploy/client.py index 910aa7f8..891e632c 100644 --- a/deploy/client.py +++ b/deploy/client.py @@ -399,17 +399,20 @@ class CompassClient(object): except: raise RuntimeError('subnet %s format is invalid' % subnet) - if CONF.expansion == "false": + subnet_exist = False + for subnet_in_db in subnets_in_db: + if subnet == subnet_in_db['subnet']: + subnet_mapping[subnet] = subnet_in_db['id'] + subnet_exist = True + break + + if not subnet_exist: status, resp = self.client.add_subnet(subnet) LOG.info('add subnet %s status %s response %s', subnet, status, resp) if not self.is_ok(status): raise RuntimeError('failed to add subnet %s' % subnet) subnet_mapping[resp['subnet']] = resp['id'] - else: - for subnet_in_db in subnets_in_db: - if subnet == subnet_in_db['subnet']: - subnet_mapping[subnet] = subnet_in_db['id'] self.subnet_mapping = subnet_mapping @@ -475,8 +478,8 @@ class CompassClient(object): if host['hostname'] in hostnames: self.host_mapping[host['hostname']] = host['id'] - if CONF.expansion == "false": - assert(len(self.host_mapping) == len(machines)) + # if CONF.expansion == "false": + # assert(len(self.host_mapping) == len(machines)) def set_cluster_os_config(self, cluster_id): """set cluster os config.""" diff --git a/deploy/compass_vm.sh b/deploy/compass_vm.sh index 7689f41c..cf215f3b 100755 --- a/deploy/compass_vm.sh +++ b/deploy/compass_vm.sh @@ -10,6 +10,26 @@ compass_vm_dir=$WORK_DIR/vm/compass rsa_file=$compass_vm_dir/boot.rsa ssh_args="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i $rsa_file" + +function check_container_alive() { + docker exec -it compass-deck bash -c "exit" 1>/dev/null 2>&1 + local deck_state=$? + docker exec -it compass-tasks bash -c "exit" 1>/dev/null 2>&1 + local tasks_state=$? + docker exec -it compass-cobbler bash -c "exit" 1>/dev/null 2>&1 + local cobbler_state=$? + docker exec -it compass-db bash -c "exit" 1>/dev/null 2>&1 + local db_state=$? + docker exec -it compass-mq bash -c "exit" 1>/dev/null 2>&1 + local mq_state=$? + + if [ $((deck_state||tasks_state||cobbler_state||db_state||mq-state)) == 0 ]; then + echo "true" + else + echo "false" + fi +} + function tear_down_compass() { sudo virsh destroy compass > /dev/null 2>&1 sudo virsh undefine compass > /dev/null 2>&1 diff --git a/deploy/conf/base.conf b/deploy/conf/base.conf index c2bf5291..5395405d 100644 --- a/deploy/conf/base.conf +++ b/deploy/conf/base.conf @@ -8,7 +8,6 @@ export EXT_NAT_GW=${EXT_NAT_GW:-192.16.1.1} export EXT_NAT_IP_START=${EXT_NAT_IP_START:-192.16.1.3} export EXT_NAT_IP_END=${EXT_NAT_IP_END:-192.16.1.254} export EXTERNAL_NIC=${EXTERNAL_NIC:-eth0} -export CLUSTER_NAME="opnfv2" export DOMAIN="ods.com" export PARTITIONS="/=30%,/home=5%,/tmp=5%,/var=60%" export SUBNETS="10.1.0.0/24,172.16.2.0/24,172.16.3.0/24,172.16.4.0/24" diff --git a/deploy/config_parse.py b/deploy/config_parse.py index 3d8dedc5..1575ca37 100644 --- a/deploy/config_parse.py +++ b/deploy/config_parse.py @@ -104,6 +104,7 @@ def export_dha_file(dha, dha_file, ofile): plugin_list.append(plugin_str) env.update({'plugins': ','.join(plugin_list)}) + env.update({'CLUSTER_NAME': dha.get('NAME', "opnfv")}) env.update({'TYPE': dha.get('TYPE', "virtual")}) env.update({'FLAVOR': dha.get('FLAVOR', "cluster")}) env.update({'HOSTNAMES': hostnames(dha, ',')}) diff --git a/deploy/launch.sh b/deploy/launch.sh index 6cbad1fa..98d9e4d6 100755 --- a/deploy/launch.sh +++ b/deploy/launch.sh @@ -55,7 +55,8 @@ if [[ "$EXPANSION" == "false" ]]; then export machines - if [[ "$DEPLOY_COMPASS" == "true" ]]; then + CONTAINER_ALIVE=$(check_container_alive) + if [[ "$DEPLOY_COMPASS" == "true" && "$CONTAINER_ALIVE" == "false" ]]; then if ! prepare_env;then echo "prepare_env failed" exit 1 @@ -71,7 +72,7 @@ if [[ "$EXPANSION" == "false" ]]; then log_error "launch_compass failed" exit 1 fi - else + elif [[ "$DEPLOY_COMPASS" == "true" && "$CONTAINER_ALIVE" == "true" ]]; then refresh_compass_core fi else diff --git a/deploy/status_callback.py b/deploy/status_callback.py index f0615f3f..6169b87f 100644 --- a/deploy/status_callback.py +++ b/deploy/status_callback.py @@ -8,7 +8,7 @@ ############################################################################## import httplib -import json +import simplejson as json import sys # noqa:F401 from ansible.plugins.callback import CallbackBase diff --git a/util/docker-compose/group_vars/all b/util/docker-compose/group_vars/all index 1dafe814..920589ce 100755 --- a/util/docker-compose/group_vars/all +++ b/util/docker-compose/group_vars/all @@ -19,7 +19,7 @@ install_ip_range: 10.1.0.100 10.1.0.250 pip_pkg_name: pip-openstack.tar.gz feature_pkg_name: packages.tar.gz -distros: +distros_x86_64: ubuntu-16.04.3: breed: "ubuntu" kickstart: "default16.seed" @@ -30,6 +30,8 @@ distros: version: "ubuntu" iso_name: ubuntu-16.04.3-server-amd64 ppa_name: xenial-pike-ppa + cobbler_name: ubuntu-16.04.3-server + cobbler_arch: x86_64 CentOS-7: breed: "redhat" @@ -38,4 +40,29 @@ distros: version: "centos" iso_name: CentOS-7-x86_64-Minimal-1708 ppa_name: centos7-pike-ppa + cobbler_name: CentOS-7-Minimal-1708 + cobbler_arch: x86_64 +distros_aarch64: + ubuntu-16.04: + breed: "ubuntu" + kickstart: "default16.seed" + kopts: "netcfg/choose_interface=auto console=ttyS0 console=ttyAMA0 console=tty0 net.ifnames=0" + kopts_post: "console=ttyS0 console=ttyAMA0 console=tty0 net.ifnames=0" + extra: "--apt-dists=xenial --apt-components=main" + aliase: "xenial" + version: "ubuntu" + iso_name: ubuntu-16.04-server-arm64 + ppa_name: xenial-pike-ppa + cobbler_name: ubuntu-16.04-server + cobbler_arch: arm + + CentOS-7: + breed: "redhat" + kickstart: "default-aarch64.ks" + aliase: "centos7" + version: "centos" + iso_name: CentOS-7-aarch64-Minimal-1611 + ppa_name: centos7-pike-ppa + cobbler_name: CentOS-7-Minimal-1611 + cobbler_arch: arm diff --git a/util/docker-compose/roles/cobbler/tasks/main.yml b/util/docker-compose/roles/cobbler/tasks/main.yml index e3f13088..0a30e0c5 100755 --- a/util/docker-compose/roles/cobbler/tasks/main.yml +++ b/util/docker-compose/roles/cobbler/tasks/main.yml @@ -44,23 +44,22 @@ docker cp "{{ compass_dists_dir }}/{{ item.value.ppa_name }}.tar.gz" compass-cobbler:/tmp docker exec compass-cobbler bash -c \ "mkdir -p /var/lib/cobbler/repo_mirror/{{ item.value.ppa_name }}" - with_dict: "{{ distros }}" + with_dict: "{{ vars['distros_' + ansible_architecture] }}" run_once: "True" ignore_errors: "True" - name: cobbler import iso shell: | - name=`basename {{ item.value.iso_name }} | \ - sed -e 's/.iso//g' -e 's/-amd64//g' -e 's/-x86_64//g'` + name="{{ item.value.cobbler_name }}" docker exec compass-cobbler bash -c \ "service cobblerd restart; sleep 3; cobbler import --name $name \ --path /mnt/{{ item.value.iso_name }} \ - --arch x86_64 \ + --arch {{ item.value.cobbler_arch }} \ --kickstart /var/lib/cobbler/kickstarts/{{ item.value.kickstart }} \ --breed {{ item.value.breed }}" - with_dict: "{{ distros }}" + with_dict: "{{ vars['distros_' + ansible_architecture] }}" run_once: "True" register: result2 until: result2.rc == 0 @@ -73,14 +72,14 @@ "cobbler repo add --name {{ item.value.ppa_name }} \ --mirror /var/lib/cobbler/repo_mirror/{{ item.value.ppa_name }} \ --mirror-locally True \ - --arch=x86_64 {{ item.value.extra | default()}}" - with_dict: "{{ distros }}" + --arch={{ item.value.cobbler_arch }} \ + {{ item.value.extra | default() }}" + with_dict: "{{ vars['distros_' + ansible_architecture] }}" run_once: "True" -- name: edit profiles +- name: edit profiles for x86_64 shell: | - name=`basename {{ item.value.iso_name }} | \ - sed -e 's/.iso//g' -e 's/-amd64//g' -e 's/-x86_64//g'`-x86_64 + name="{{ item.value.cobbler_name }}-x86_64" docker exec compass-cobbler bash -c \ "cobbler profile edit --name $name \ --name-servers '' \ @@ -88,8 +87,38 @@ --ksmeta \"tree=http://{{ host_ip }}/cobbler/ks_mirror/$name\" \ --kopts \"{{ item.value.kopts | default('') }}\" \ --kopts-post \"{{ item.value.kopts_post | default('') }}\"" - with_dict: "{{ distros }}" + with_dict: "{{ distros_x86_64 }}" run_once: "True" + when: ansible_architecture == "x86_64" + +- name: edit profile for aarch64 + shell: | + # Cobbler naming on Arm is a mess + # Imported name: + # - CentOS-7-Minimal-1611 + # - ubuntu-16.04-server + # Profile name: + # - CentOS-7-Minimal-1611-arm-arm + # - ubuntu-16.04-server-arm-arm64-arm + # Kickstart meta url name + # - http://x.x.x.x/cobbler/ks_mirror/CentOS-7-Minimal-1611-arm + # - http://x.x.x.x/cobbler/ks_mirror/ubuntu-16.04-server-arm-arm64 + name="{{ item.value.cobbler_name }}-arm" + profiles=`docker exec compass-cobbler bash -c \ + "cobbler profile list | grep $name"` + for profile_name in $profiles; do + docker exec compass-cobbler bash -c \ + "cobbler profile edit \ + --name $profile_name \ + --name-servers '' \ + --repos {{ item.value.ppa_name }} \ + --ksmeta \"tree=http://{{ host_ip }}/cobbler/ks_mirror/${profile_name%????}\" \ + --kopts \"{{ item.value.kopts | default('') }}\" \ + --kopts-post \"{{ item.value.kopts_post | default('') }}\"" + done + with_dict: "{{ distros_aarch64 }}" + run_once: "True" + when: ansible_architecture == "aarch64" - name: cobbler sync shell: | diff --git a/util/docker-compose/roles/cobbler/templates/dhcp.template.j2 b/util/docker-compose/roles/cobbler/templates/dhcp.template.j2 index 0665f2fe..8b1f2a61 100755 --- a/util/docker-compose/roles/cobbler/templates/dhcp.template.j2 +++ b/util/docker-compose/roles/cobbler/templates/dhcp.template.j2 @@ -42,6 +42,8 @@ subnet {{ install_subnet }} netmask {{ install_netmask }} { filename "grub/grub-x86.efi"; } else if option pxe-system-type = 00:07 { filename "grub/grub-x86_64.efi"; + } else if option pxe-system-type = 00:0B { + filename "grub/grub-aarch64.efi"; } else { filename "pxelinux.0"; } diff --git a/util/docker-compose/roles/compass/tasks/main.yml b/util/docker-compose/roles/compass/tasks/main.yml index 9ee7902e..c7dba96b 100755 --- a/util/docker-compose/roles/compass/tasks/main.yml +++ b/util/docker-compose/roles/compass/tasks/main.yml @@ -1,5 +1,8 @@ --- -- include_vars: "{{ compass_dists_dir }}/build.yaml" +- include_vars: "{{ item }}" + with_first_found: + - "{{ compass_dists_dir }}/build-{{ ansible_architecture }}.yaml" + - "{{ compass_dists_dir }}/build.yaml" - set_fact: image_name: "{{ item.name | regex_replace('-', '_') }}" |