diff options
31 files changed, 763 insertions, 70 deletions
@@ -9,10 +9,15 @@ ############################################################################## set -ex +#avoid locale issue on some environment +export LC_ALL=en_US.UTF-8 + COMPASS_PATH=`cd ${BASH_SOURCE[0]%/*};pwd` WORK_DIR=$COMPASS_PATH/work/building export CACHE_DIR=$WORK_DIR/cache +COMPASS_ARCH=$(uname -m) + echo $COMPASS_PATH REDHAT_REL=${REDHAT_REL:-"false"} @@ -23,12 +28,17 @@ mkdir -p $WORK_DIR $CACHE_DIR function install_docker_ubuntu() { + REPO_ARCH=amd64 + if [ "$COMPASS_ARCH" = "aarch64" ]; then + REPO_ARCH=arm64 + fi + sudo apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual sudo apt-get install -y apt-transport-https ca-certificates curl \ software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo apt-key fingerprint 0EBFCD88 - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + sudo add-apt-repository "deb [arch=$REPO_ARCH] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" sudo apt-get update @@ -78,7 +88,12 @@ function prepare_env() function download_packages() { - python $COMPASS_PATH/build/parser.py $COMPASS_PATH/build/build.yaml + build_yaml_file=build.yaml + if [ -f "$COMPASS_PATH/build/build-$COMPASS_ARCH.yaml" ]; then + build_yaml_file=build-$COMPASS_ARCH.yaml + fi + + python $COMPASS_PATH/build/parser.py $COMPASS_PATH/build/$build_yaml_file } function build_tar() diff --git a/build/build-aarch64.yaml b/build/build-aarch64.yaml new file mode 100644 index 00000000..47bd0eb1 --- /dev/null +++ b/build/build-aarch64.yaml @@ -0,0 +1,41 @@ +--- +packages: + - name: CentOS-7-aarch64-Minimal-1611.iso + description: "Centos ISO of each host for provisioning" + get_method: cached + url: $COMPASS_ISO_REPO/CentOS-7-aarch64-Minimal-1611.iso + + - name: ubuntu-16.04-server-arm64.iso + description: "Ubuntu ISO of each host for provisioning" + get_method: cached + url: $COMPASS_ISO_REPO/ubuntu-16.04-server-arm64.iso + + - name: compass-deck + description: "RESTful API and DB Handlers for Compass" + get_method: docker + url: $COMPASS_DOCKER_REPO/compass-deck:latest + + - name: compass-tasks-k8s + description: "compass task container for kubernets deployment via kargo" + get_method: docker + url: $COMPASS_DOCKER_REPO/compass-tasks-k8s:latest + + - name: compass-cobbler + description: "cobbler container for compass" + get_method: docker + url: $COMPASS_DOCKER_REPO/compass-cobbler:latest + + - name: compass-db + description: "datebase container for compass" + get_method: docker + url: $COMPASS_DOCKER_REPO/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 @@ -30,6 +30,8 @@ export OPENSTACK_VERSION=${OPENSTACK_VERSION:-ocata} +export COMPASS_ARCH=$(uname -m) + if [[ "x"$KUBERNETES_VERSION != "x" ]]; then unset OPENSTACK_VERSION fi diff --git a/deploy/adapters/ansible/kubernetes/roles/kargo/files/mirrors_aarch64.repo b/deploy/adapters/ansible/kubernetes/roles/kargo/files/mirrors_aarch64.repo new file mode 100644 index 00000000..1d622d3c --- /dev/null +++ b/deploy/adapters/ansible/kubernetes/roles/kargo/files/mirrors_aarch64.repo @@ -0,0 +1,22 @@ +[base] +name=CentOS-$releasever - Base +baseurl=http://mirror.centos.org/altarch/$releasever/os/$basearch/ +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 + file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64 + +#released updates +[updates] +name=CentOS-$releasever - Updates +baseurl=http://mirror.centos.org/altarch/$releasever/updates/$basearch/ +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 + file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64 + +#additional packages that may be useful +[extras] +name=CentOS-$releasever - Extras +baseurl=http://mirror.centos.org/altarch/$releasever/extras/$basearch/ +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 + file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64 diff --git a/deploy/adapters/ansible/kubernetes/roles/kargo/tasks/main.yml b/deploy/adapters/ansible/kubernetes/roles/kargo/tasks/main.yml index 6d6720ba..4df8dffa 100644 --- a/deploy/adapters/ansible/kubernetes/roles/kargo/tasks/main.yml +++ b/deploy/adapters/ansible/kubernetes/roles/kargo/tasks/main.yml @@ -23,8 +23,11 @@ - name: configure local mirror repo copy: - src: mirrors.repo + src: "{{ item }}" dest: /etc/yum.repos.d/mirrors.repo + with_first_found: + - mirrors_{{ ansible_architecture }}.repo + - mirrors.repo run_once: "True" when: ansible_os_family == 'RedHat' diff --git a/deploy/adapters/ansible/kubernetes/roles/pre-k8s/files/centos_base_aarch64.repo b/deploy/adapters/ansible/kubernetes/roles/pre-k8s/files/centos_base_aarch64.repo new file mode 100644 index 00000000..1d622d3c --- /dev/null +++ b/deploy/adapters/ansible/kubernetes/roles/pre-k8s/files/centos_base_aarch64.repo @@ -0,0 +1,22 @@ +[base] +name=CentOS-$releasever - Base +baseurl=http://mirror.centos.org/altarch/$releasever/os/$basearch/ +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 + file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64 + +#released updates +[updates] +name=CentOS-$releasever - Updates +baseurl=http://mirror.centos.org/altarch/$releasever/updates/$basearch/ +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 + file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64 + +#additional packages that may be useful +[extras] +name=CentOS-$releasever - Extras +baseurl=http://mirror.centos.org/altarch/$releasever/extras/$basearch/ +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 + file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64 diff --git a/deploy/adapters/ansible/kubernetes/roles/pre-k8s/tasks/RedHat.yml b/deploy/adapters/ansible/kubernetes/roles/pre-k8s/tasks/RedHat.yml index 58af0f7b..8e410e15 100644 --- a/deploy/adapters/ansible/kubernetes/roles/pre-k8s/tasks/RedHat.yml +++ b/deploy/adapters/ansible/kubernetes/roles/pre-k8s/tasks/RedHat.yml @@ -51,5 +51,8 @@ - name: change sources(yum) list copy: - src: centos_base.repo + src: "{{ item }}" dest: /etc/yum.repos.d/centos_base.repo + with_first_found: + - centos_base_{{ ansible_architecture }}.repo + - centos_base.repo diff --git a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml index ef7128c5..8d944387 100644 --- a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml +++ b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml @@ -41,7 +41,10 @@ - setup-openstack - sync-inventory -- hosts: compute +- hosts: + - compute + - utility + - neutron_server remote_user: root roles: - post-osa diff --git a/deploy/adapters/ansible/roles/post-osa/files/sfc.conf b/deploy/adapters/ansible/roles/post-osa/files/sfc.conf new file mode 100755 index 00000000..ce42c9e1 --- /dev/null +++ b/deploy/adapters/ansible/roles/post-osa/files/sfc.conf @@ -0,0 +1,9 @@ +[DEFAULT] + +service_plugins = router,metering,flow_classifier,sfc + +[sfc] +drivers = ovs + +[flowclassifier] +drivers = ovs diff --git a/deploy/adapters/ansible/roles/post-osa/tasks/install_networking_sfc.yml b/deploy/adapters/ansible/roles/post-osa/tasks/install_networking_sfc.yml new file mode 100644 index 00000000..fbed5815 --- /dev/null +++ b/deploy/adapters/ansible/roles/post-osa/tasks/install_networking_sfc.yml @@ -0,0 +1,73 @@ +--- + +- name: install networking-sfc + pip: + name: networking-sfc + virtualenv: /openstack/venvs/neutron-15.1.4 + when: + - inventory_hostname in groups['neutron_server'] + +- name: install crudini + package: + name: crudini + state: latest + when: + - inventory_hostname in groups['neutron_server'] + +- name: Install networking-sfc for CLI + pip: + name: networking-sfc + when: + - inventory_hostname in groups['utility'] + +- name: turn off neutron-server on control node + service: name=neutron-server state=stopped + when: inventory_hostname in groups['neutron_server'] + +- name: copy sfc.conf + copy: + src: "{{ sfc_plugins.src }}" + dest: "{{ sfc_plugins.dst }}" + mode: 0755 + when: inventory_hostname in groups['neutron_server'] + +- name: Configure SFC driver + shell: crudini --merge /etc/neutron/neutron.conf < /opt/sfc.conf + when: inventory_hostname in groups['neutron_server'] + +- name: delete sfc.conf + shell: rm -rf {{ sfc_plugins.dst }} + when: inventory_hostname in groups['neutron_server'] + +- name: Perform a Neutron DB online upgrade + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + --config-file /etc/neutron/neutron.conf + --config-file /etc/neutron/plugins/ml2/ml2_conf.ini + upgrade --expand + become: "yes" + become_user: "neutron" + when: inventory_hostname in groups['neutron_server'][0] + +- name: Perform a Neutron DB offline upgrade + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + --config-file /etc/neutron/neutron.conf + --config-file /etc/neutron/plugins/ml2/ml2_conf.ini + upgrade --contract + become: "yes" + become_user: "neutron" + when: inventory_hostname in groups['neutron_server'][0] + +- name: SFC DB upgrade + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + --subproject networking-sfc + upgrade head + become: "yes" + become_user: "neutron" + when: inventory_hostname in groups['neutron_server'][0] + +- name: turn on neutron-server on control node + service: name=neutron-server state=started + when: inventory_hostname in groups['neutron_server'] diff --git a/deploy/adapters/ansible/roles/post-osa/tasks/main.yml b/deploy/adapters/ansible/roles/post-osa/tasks/main.yml index c48a5d1a..f7f7a6cc 100644 --- a/deploy/adapters/ansible/roles/post-osa/tasks/main.yml +++ b/deploy/adapters/ansible/roles/post-osa/tasks/main.yml @@ -8,3 +8,10 @@ ############################################################################## --- - include: "{{ ansible_distribution }}.yml" + when: inventory_hostname in groups['compute'] + +# install networking-sfc for non odl scenarios +- include: install_networking_sfc.yml + when: + - odl_sfc is not defined or odl_sfc == "Disable" + - inventory_hostname not in groups['compute'] diff --git a/deploy/adapters/ansible/roles/post-osa/vars/main.yml b/deploy/adapters/ansible/roles/post-osa/vars/main.yml new file mode 100644 index 00000000..4feb9756 --- /dev/null +++ b/deploy/adapters/ansible/roles/post-osa/vars/main.yml @@ -0,0 +1,5 @@ +--- + +sfc_plugins: + src: sfc.conf + dst: /opt/sfc.conf diff --git a/deploy/adapters/cobbler/kickstarts/default-aarch64.ks b/deploy/adapters/cobbler/kickstarts/default-aarch64.ks new file mode 100644 index 00000000..365694fb --- /dev/null +++ b/deploy/adapters/cobbler/kickstarts/default-aarch64.ks @@ -0,0 +1,136 @@ +# Kickstart for Profile: CentOS7.3_aarch64 +# Distro: CentOS7.3 + +# System Authorization +auth --useshadow --enablemd5 + +#if $os_version == "rhel7" +eula --agreed +services --enabled=NetworkManager,sshd +#end if + +# Use Graphic Mode +text + +# Disable Firewall +firewall --disabled + +# Run the Setup Agent on first-boot +firstboot --disable + +# System Keyboard +keyboard us + +# Language Setting +lang en_US + +# Installation Loggin Level +logging --level=info + +# Network Installation +url --url=$tree + + +$SNIPPET('kickstart_network_config') +$SNIPPET('kickstart_yum_repo_config') + +# Set User Password +#if $getVar('username', 'root') != "root" +rootpw root + #set username = $getVar('username', 'root') + #set crypted_param = '' + #set password_param = '--password=%s' % $username + #if $getVar('password', '') != "" + #set crypted_param = '--iscrypted' + #set password_param = '--password=%s' % $password + #end if +user --name=$username $crypted_param $password_param +#else + #if $getVar('password', '') != "" +rootpw --iscrypted $password + #else +rootpw root + #end if +#end if + +# Selinux Disable +selinux --disabled + +# No X Window System +skipx + +# System Timezone +#if $getVar('timezone', '') != "" +timezone --utc $timezone +#else +timezone --utc US/Pacific +#end if + +ignoredisk --only-use=sda +bootloader --location=mbr +clearpart --drives=sda --all --initlabel +part /boot/efi --fstype=efi --size=200 +part /boot --fstype=ext4 --size=512 +part / --fstype=ext4 --size=10240 --grow +part swap --size=4000 + +# Install +install + +# Reboot After Installation +reboot + +%pre +$SNIPPET('kickstart_pre_log') +$SNIPPET('kickstart_start') +$SNIPPET('kickstart_pre_install_network_config') + +# Enable installation monitoring +$SNIPPET('kickstart_pre_anamon') +%end + +# Packages +%packages --nobase +@core +iproute +# ntp +openssh-clients +# wget +# yum-plugin-priorities +json-c +libestr +rsyslog +parted +# vim +# lsof +# strace +# if $os_version == "rhel7" +# net-tools +# end if +#if $getVar('tool', '') != '' + #set $kickstart_software = "kickstart_software_%s" % $tool +$SNIPPET($kickstart_software) +#end if +%end + +%post --log=/var/log/post_install.log +$SNIPPET('kickstart_post_log') +$SNIPPET('kickstart_post_install_kernel_options') +$SNIPPET('kickstart_post_install_network_config') + +chkconfig iptables off +chkconfig ip6tables off + +$SNIPPET('kickstart_yum') +$SNIPPET('kickstart_ssh') +# $SNIPPET('kickstart_ntp') +$SNIPPET('kickstart_limits.conf') +$SNIPPET('kickstart_sysctl.conf') +$SNIPPET('kickstart_rsyslog.conf') +#if $getVar('tool', '') != '' + #set $kickstart_tool = "kickstart_%s" % $tool +$SNIPPET($kickstart_tool) +#end if +$SNIPPET('kickstart_post_anamon') +$SNIPPET('kickstart_done') +%end diff --git a/deploy/adapters/cobbler/snippets/kickstart_done b/deploy/adapters/cobbler/snippets/kickstart_done index 2a936adb..aafcd76f 100644 --- a/deploy/adapters/cobbler/snippets/kickstart_done +++ b/deploy/adapters/cobbler/snippets/kickstart_done @@ -17,7 +17,7 @@ ## PXE JUST ONCE #if $pxe_just_once in [ "1", "true", "yes", "y" ] #if $breed == 'redhat' - #set nopxe = "\nwget \"http://%s/cblr/svc/op/nopxe/system/%s\" -O /var/log/nopxe" % (srv, system_name) + #set nopxe = "\ncurl \"http://%s/cblr/svc/op/nopxe/system/%s\" -O /var/log/nopxe" % (srv, system_name) #else if $breed == 'vmware' and $os_version == 'esx4' #set nopxe = "\ncurl \"http://%s/cblr/svc/op/nopxe/system/%s\" -o /var/log/nopxe" % (srv, system_name) #else if $breed == 'vmware' diff --git a/deploy/compass_conf/adapter/ansible_kubernetes.conf b/deploy/compass_conf/adapter/ansible_kubernetes.conf index 7b8023c2..a3ab671a 100644 --- a/deploy/compass_conf/adapter/ansible_kubernetes.conf +++ b/deploy/compass_conf/adapter/ansible_kubernetes.conf @@ -3,5 +3,5 @@ DISPLAY_NAME = 'Kubernetes' PARENT = 'general' PACKAGE_INSTALLER = 'ansible_installer_kubernetes' OS_INSTALLER = 'cobbler' -SUPPORTED_OS_PATTERNS = ['(?i)ubuntu-16\.04', '(?i)CentOS-7.*16.*'] +SUPPORTED_OS_PATTERNS = ['(?i)ubuntu-16\.04', '(?i)CentOS-7.*16.*', '(?i)CentOS-7.*arm.*'] DEPLOYABLE = True diff --git a/deploy/compass_conf/os/centos7.3.aarch64.conf b/deploy/compass_conf/os/centos7.3.aarch64.conf new file mode 100755 index 00000000..bd3bce30 --- /dev/null +++ b/deploy/compass_conf/os/centos7.3.aarch64.conf @@ -0,0 +1,3 @@ +NAME = 'CentOS-7-Minimal-1611-arm-arm' +PARENT = 'CentOS' +DEPLOYABLE = True diff --git a/deploy/compass_conf/os/ubuntu16.04.aarch64.conf b/deploy/compass_conf/os/ubuntu16.04.aarch64.conf new file mode 100755 index 00000000..986c0397 --- /dev/null +++ b/deploy/compass_conf/os/ubuntu16.04.aarch64.conf @@ -0,0 +1,3 @@ +NAME = 'ubuntu-16.04-server-arm-arm64-arm' +PARENT = 'Ubuntu' +DEPLOYABLE = True diff --git a/deploy/compass_conf/templates/cobbler/CentOS-7-Minimal-1611-arm-arm/profile.tmpl b/deploy/compass_conf/templates/cobbler/CentOS-7-Minimal-1611-arm-arm/profile.tmpl new file mode 100755 index 00000000..cfa89004 --- /dev/null +++ b/deploy/compass_conf/templates/cobbler/CentOS-7-Minimal-1611-arm-arm/profile.tmpl @@ -0,0 +1,3 @@ +{ + "repos": "$getVar('repo_name', '')" +} diff --git a/deploy/compass_conf/templates/cobbler/CentOS-7-Minimal-1611-arm-arm/system.tmpl b/deploy/compass_conf/templates/cobbler/CentOS-7-Minimal-1611-arm-arm/system.tmpl new file mode 100755 index 00000000..8e4cbbbe --- /dev/null +++ b/deploy/compass_conf/templates/cobbler/CentOS-7-Minimal-1611-arm-arm/system.tmpl @@ -0,0 +1,76 @@ +{ + "name": "$hostname", + "hostname": "$hostname", + "profile": "$profile", + "gateway": "$gateway", + #import simplejson as json + #set nameservers = json.dumps($nameservers, encoding='utf-8') + "name_servers": $nameservers, + #set search_path = ' '.join($search_path) + "name_servers_search": "$search_path", + "proxy": "$getVar('http_proxy', '')", + "modify_interface": + #set networks = $networks + #set rekeyed = {} + #set promic_nic = "" + #for $nic, $val in $networks.iteritems(): + #set ip_key = '-'.join(('ipaddress', $nic)) + #set netmask_key = '-'.join(('netmask', $nic)) + #set mgmt_key = '-'.join(('management', $nic)) + #set static_key = '-'.join(('static', $nic)) + #set $rekeyed[$ip_key] = $val.ip + #set $rekeyed[$netmask_key] = $val.netmask + #set $rekeyed[$mgmt_key] = $val.is_mgmt + #set $rekeyed[$static_key] = True + + #set dns_key = '-'.join(('dnsname', $nic)) + #if $val.is_mgmt + #set $rekeyed[$dns_key] = $dns + #else + #if '.' in $dns + #set $dns_name, $dns_domain = $dns.split('.', 1) + #set $dns_nic = '%s-%s.%s' % ($dns_name, $nic, $dns_domain) + #else + #set $dns_nic = '%s-%s' % ($dns, $nic) + #end if + #set $rekeyed[$dns_key] = $dns_nic + #end if + + #if $val.is_promiscuous: + #set promic_nic = $nic + #end if + #if $val.is_mgmt: + #set mac_key = '-'.join(('macaddress', $nic)) + #set $rekeyed[$mac_key] = $mac + #end if + #end for + #set nic_info = json.dumps($rekeyed, encoding='utf-8') + $nic_info + , + "ksmeta":{ + #set partition_config = '' + #for k, v in $partition.iteritems(): + #set path = '' + #if v['vol_percentage']: + #set $path = k + ' ' + str(v['vol_percentage']) + '%' + #else: + #set $path = k + ' ' + str(v['vol_size']) + #end if + #set partition_config = ';'.join((partition_config, $path)) + #end for + #set partition_config = partition_config[1:] + #import crypt + #set $password = crypt.crypt($server_credentials.password, "az") + #set no_proxy = ','.join($getVar('no_proxy', [])) + "username": "$server_credentials.username", + "password": "$password", + "promisc_nics": "$promic_nic", + "partition": "$partition_config", + "https_proxy": "$getVar('https_proxy', '')", + "ntp_server": "$ntp_server", + "timezone": "$timezone", + "ignore_proxy": "$no_proxy", + "local_repo": "$getVar('local_repo', '')", + "disk_num": "1" + } +} diff --git a/deploy/compass_conf/templates/cobbler/ubuntu-16.04-server-arm-arm64-arm/profile.tmpl b/deploy/compass_conf/templates/cobbler/ubuntu-16.04-server-arm-arm64-arm/profile.tmpl new file mode 100755 index 00000000..cfa89004 --- /dev/null +++ b/deploy/compass_conf/templates/cobbler/ubuntu-16.04-server-arm-arm64-arm/profile.tmpl @@ -0,0 +1,3 @@ +{ + "repos": "$getVar('repo_name', '')" +} diff --git a/deploy/compass_conf/templates/cobbler/ubuntu-16.04-server-arm-arm64-arm/system.tmpl b/deploy/compass_conf/templates/cobbler/ubuntu-16.04-server-arm-arm64-arm/system.tmpl new file mode 100755 index 00000000..cfcc883e --- /dev/null +++ b/deploy/compass_conf/templates/cobbler/ubuntu-16.04-server-arm-arm64-arm/system.tmpl @@ -0,0 +1,75 @@ +{ + "name": "$hostname", + "hostname": "$hostname", + "profile": "$profile", + "gateway": "$gateway", + #import simplejson as json + #set nameservers = json.dumps($nameservers, encoding='utf-8') + "name_servers": $nameservers, + #set search_path = ' '.join($search_path) + "name_servers_search": "$search_path", + "proxy": "$getVar('http_proxy', '')", + "modify_interface": + #set networks = $networks + #set rekeyed = {} + #set promic_nic = "" + #for $nic, $val in $networks.iteritems(): + #set ip_key = '-'.join(('ipaddress', $nic)) + #set netmask_key = '-'.join(('netmask', $nic)) + #set mgmt_key = '-'.join(('management', $nic)) + #set static_key = '-'.join(('static', $nic)) + #set $rekeyed[$ip_key] = $val.ip + #set $rekeyed[$netmask_key] = $val.netmask + #set $rekeyed[$static_key] = True + + #set dns_key = '-'.join(('dnsname', $nic)) + #if $val.is_mgmt + #set $rekeyed[$dns_key] = $dns + #else + #if '.' in $dns + #set $dns_name, $dns_domain = $dns.split('.', 1) + #set $dns_nic = '%s-%s.%s' % ($dns_name, $nic, $dns_domain) + #else + #set $dns_nic = '%s-%s' % ($dns, $nic) + #end if + #set $rekeyed[$dns_key] = $dns_nic + #end if + + #if $val.is_promiscuous: + #set promic_nic = $nic + #end if + #if $val.is_mgmt: + #set mac_key = '-'.join(('macaddress', $nic)) + #set $rekeyed[$mac_key] = $mac + #end if + #end for + #set nic_info = json.dumps($rekeyed, encoding='utf-8') + $nic_info + , + "ksmeta":{ + #set partition_config = '' + #for k, v in $partition.iteritems(): + #set path = '' + #if v['vol_percentage']: + #set $path = k + ' ' + str(v['vol_percentage']) + '%' + #else: + #set $path = k + ' ' + str(v['vol_size']) + #end if + #set partition_config = ';'.join((partition_config, $path)) + #end for + #set partition_config = partition_config[1:] + #import crypt + #set $password = crypt.crypt($server_credentials.password, "az") + #set no_proxy = ','.join($getVar('no_proxy', [])) + "username": "$server_credentials.username", + "password": "$password", + "promisc_nics": "$promic_nic", + "partition": "$partition_config", + "https_proxy": "$getVar('https_proxy', '')", + "ntp_server": "$ntp_server", + "timezone": "$timezone", + "ignore_proxy": "$no_proxy", + "local_repo": "$getVar('local_repo', '')", + "disk_num": "1" + } +} diff --git a/deploy/conf/compass.conf b/deploy/conf/compass.conf index 98ba3027..dc3a975e 100644 --- a/deploy/conf/compass.conf +++ b/deploy/conf/compass.conf @@ -18,14 +18,17 @@ export NAMESERVERS=${USER_NAMESERVER:-"$COMPASS_SERVER"} export COMPASS_REPO_PORT="5151" export OFFLINE_DEPLOY=${OFFLINE_DEPLOY:-'Disable'} -export COMPASS_DECK="compass4nfv/compass-deck" -export COMPASS_TASKS="compass4nfv/compass-tasks-osa:euphrates" +# Set docker registry for architectures other than x86_64 +COMPASS_DOCKER_REPO=${COMPASS_DOCKER_REPO:-compass4nfv} + +export COMPASS_DECK="$COMPASS_DOCKER_REPO/compass-deck" +export COMPASS_TASKS="$COMPASS_DOCKER_REPO/compass-tasks-osa:euphrates" if [[ "x"$KUBERNETES_VERSION != "x" ]]; then - export COMPASS_TASKS="compass4nfv/compass-tasks-k8s" + export COMPASS_TASKS="$COMPASS_DOCKER_REPO/compass-tasks-k8s" fi -export COMPASS_COBBLER="compass4nfv/compass-cobbler" -export COMPASS_DB="compass4nfv/compass-db" -export COMPASS_MQ="compass4nfv/compass-mq" -export COMPASS_REPO="compass4nfv/compass-repo-osa-ubuntu:euphrates" +export COMPASS_COBBLER="$COMPASS_DOCKER_REPO/compass-cobbler" +export COMPASS_DB="$COMPASS_DOCKER_REPO/compass-db" +export COMPASS_MQ="$COMPASS_DOCKER_REPO/compass-mq" +export COMPASS_REPO="$COMPASS_DOCKER_REPO/compass-repo-osa-ubuntu:euphrates" diff --git a/deploy/host_virtual.sh b/deploy/host_virtual.sh index bd2f49af..03a1230f 100755 --- a/deploy/host_virtual.sh +++ b/deploy/host_virtual.sh @@ -13,14 +13,32 @@ function tear_down_machines() { IFS=, for i in $HOSTNAMES; do sudo virsh destroy $i - sudo virsh undefine $i + if [ "$COMPASS_ARCH" = "aarch64" ]; then + # --nvram is required for UEFI enabled VM + sudo virsh undefine --nvram $i + else + sudo virsh undefine $i + fi rm -rf $host_vm_dir/$i done IFS=$old_ifs } function reboot_hosts() { - log_warn "reboot_hosts do nothing" + # We do need it for aarch64 + if [ "$COMPASS_ARCH" = "aarch64" ]; then + old_ifs=$IFS + IFS=, + for i in $HOSTNAMES; do + sudo virsh destroy $i + sleep 3 + sudo virsh start $i + sleep 3 + done + IFS=$old_ifs + else + log_warn "reboot_hosts do nothing" + fi } function launch_host_vms() { @@ -28,6 +46,13 @@ function launch_host_vms() { IFS=, #function_bod mac_array=($machines) + + # Select vm template per arch + vm_template_dir="$COMPASS_DIR/deploy/template/vm" + vm_template_file="$vm_template_dir/host.xml" + vm_template_arch="$vm_template_dir/host-$COMPASS_ARCH.xml" + [ -f $vm_template_arch ] && vm_template_file=$vm_template_arch + log_info "bringing up pxe boot vms" i=0 for host in $HOSTNAMES; do @@ -43,7 +68,7 @@ function launch_host_vms() { -e "s/REPLACE_BOOT_MAC/${mac_array[i]}/g" \ -e "s/REPLACE_NET_INSTALL/install/g" \ -e "s/REPLACE_NET_IAAS/external_nat/g" \ - $COMPASS_DIR/deploy/template/vm/host.xml\ + "$vm_template_file" \ > $vm_dir/libvirt.xml sudo virsh define $vm_dir/libvirt.xml diff --git a/deploy/prepare.sh b/deploy/prepare.sh index 0927347c..e4cfb95b 100755 --- a/deploy/prepare.sh +++ b/deploy/prepare.sh @@ -26,6 +26,12 @@ function install_docker() stable" sudo apt-get update sudo apt-get install -y docker-ce + sleep 5 + sudo cat << EOF > /etc/docker/daemon.json +{ + "storage-driver": "devicemapper" +} +EOF sudo service docker start sudo service docker restart @@ -134,7 +140,7 @@ function _pre_env_setup() tar -zxvf $jhpkg_url -C $WORK_DIR/prepare/ cd $WORK_DIR/prepare/jh_env_package - tar -zxvf trusty-jh-ppa.tar.gz + tar -zxvf jh-ppa.tar.gz if [[ ! -z /etc/apt/sources.list.d ]]; then mv /etc/apt/sources.list.d /etc/apt/sources.list.d.bak @@ -144,7 +150,7 @@ function _pre_env_setup() mv /etc/apt/apt.conf /etc/apt/apt.conf.bak fi - cat << EOF > /etc/apt/apt.conf + sudo cat << EOF > /etc/apt/apt.conf APT::Get::Assume-Yes "true"; APT::Get::force-yes "true"; Acquire::http::Proxy::127.0.0.1:9998 DIRECT; @@ -154,11 +160,17 @@ EOF mv /etc/apt/sources.list /etc/apt/sources.list.bak fi - cat << EOF > /etc/apt/sources.list -deb [arch=amd64] http://127.0.0.1:9998/trusty-jh-ppa trusty main + sudo cat << EOF > /etc/apt/sources.list +deb [arch=amd64] http://127.0.0.1:9998/jh-ppa $(lsb_release -cs) main EOF - nohup python -m SimpleHTTPServer 9998 & + if [[ $(lsb_release -cs) == "trusty" ]]; then + nohup python -m SimpleHTTPServer 9998 & + else + nohup python3 -m http.server 9998 & + fi + + http_ppa_pid=$! cd - sleep 5 @@ -172,12 +184,25 @@ EOF sudo docker version >/dev/null 2>&1 if [[ $? -ne 0 ]]; then - install_docker + sudo apt-get install -y docker-ce + sleep 5 + sudo cat << EOF > /etc/docker/daemon.json +{ + "storage-driver": "devicemapper" +} +EOF + + sudo service docker start + sudo service docker restart + else + StorageDriver=$(sudo docker info | grep "Storage Driver" | awk '{print $3}') + if [[ $StorageDriver != "devicemapper" ]]; then + echo "The storage driver of docker currently only supports 'devicemapper'." + exit 1 + fi fi - pid=$(ps -ef | grep SimpleHTTPServer | grep 9998 | awk '{print $2}') - echo $pid - kill -9 $pid + kill -9 $http_ppa_pid if [[ ! -d /etc/libvirt/hooks ]]; then sudo mkdir -p /etc/libvirt/hooks @@ -210,8 +235,6 @@ function _pre_pip_setup() mkdir -p ~/.pip fi -# rm -rf ~/.pip -# mkdir -p ~/.pip rm -rf $WORK_DIR/prepare mkdir -p $WORK_DIR/prepare jhpkg_url=${JHPKG_URL:7} @@ -223,7 +246,7 @@ function _pre_pip_setup() tar -zxvf $jhpkg_url -C $WORK_DIR/prepare/ cd $WORK_DIR/prepare/jh_env_package - tar -zxvf env_trusty_pip.tar.gz + tar -zxvf jh_pip.tar.gz cat << EOF > ~/.pip/pip.conf [global] @@ -233,7 +256,14 @@ no-index = true trusted-host=127.0.0.1 EOF - nohup python -m SimpleHTTPServer 9999 & + if [[ $(lsb_release -cs) == "trusty" ]]; then + nohup python -m SimpleHTTPServer 9999 & + else + nohup python3 -m http.server 9999 & + fi + + http_pip_pid=$! + echo $http_pip_pid sleep 5 @@ -244,25 +274,27 @@ EOF virtualenv $WORK_DIR/venv source $WORK_DIR/venv/bin/activate - #pip install --upgrade cffi - - PIP="cffi MarkupSafe pip cheetah pyyaml requests netaddr oslo.config ansible" - - #PIP="paramiko jinja2 PyYAML setuptools pycrypto pyasn1 cryptography MarkupSafe idna six enum34 ipaddress pycparser virtualenv cheetah requests netaddr pbr oslo.config ansible" - for i in ${PIP}; do - pip install --upgrade $i - done + pip install cffi==1.10.0 + pip install MarkupSafe==1.0 + pip install pip==9.0.1 + pip install cheetah==2.4.4 + pip install pyyaml==3.12 + pip install requests==2.18.1 + pip install netaddr==0.7.19 + pip install oslo.config==4.6.0 + pip install ansible==2.3.1.0 + sudo pip install docker-compose==1.14.0 + if [[ $(lsb_release -cs) == "xenial" ]]; then + sudo pip install -U pyOpenSSL + fi - pid=$(ps -ef | grep SimpleHTTPServer | grep 9999 | awk '{print $2}') - echo $pid - kill -9 $pid + kill -9 $http_pip_pid if [[ -f ~/.pip/pip.conf.bak ]]; then mv ~/.pip/pip.conf.bak ~/.pip/pip.conf else rm -rf ~/.pip/pip.conf fi -# rm -rf ~/.pip/pip.conf } function prepare_python_env() diff --git a/deploy/template/vm/host-aarch64.xml b/deploy/template/vm/host-aarch64.xml new file mode 100644 index 00000000..7f32a198 --- /dev/null +++ b/deploy/template/vm/host-aarch64.xml @@ -0,0 +1,58 @@ +<domain type='kvm'> + <name>REPLACE_NAME</name> + <memory unit='MiB'>REPLACE_MEM</memory> + <currentMemory unit='MiB'>REPLACE_MEM</currentMemory> + <vcpu placement='static'>REPLACE_CPU</vcpu> + <os> + <type arch='aarch64' machine='virt'>hvm</type> + <loader readonly='yes' type='pflash'>/usr/share/AAVMF/AAVMF_CODE.fd</loader> + <boot dev='hd'/> + <boot dev='network'/> + </os> + <features> + <gic version='2'/> + </features> + <cpu mode='host-passthrough'/> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>restart</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-aarch64</emulator> + <disk type='file' device='disk'> + <driver name='qemu' type='raw'/> + <source file='REPLACE_IMAGE'/> + <target dev='sda' bus='scsi'/> + </disk> + <controller type='scsi' index='0' model='virtio-scsi'> + <address type='virtio-mmio'/> + </controller> + <interface type='network'> + <mac address=REPLACE_BOOT_MAC/> + <source network='REPLACE_NET_INSTALL'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </interface> + <interface type='network'> + <source network='REPLACE_NET_IAAS'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> + </interface> + <interface type='network'> + <source network='default'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> + </interface> + <interface type='network'> + <source network='default'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> + </interface> + <serial type='pty'> + <target port='0'/> + </serial> + <console type='pty'> + <target type='serial' port='0'/> + </console> + </devices> +</domain> diff --git a/docs/release/installation/k8s-deploy.rst b/docs/release/installation/k8s-deploy.rst index 65f638cb..49025ee3 100644 --- a/docs/release/installation/k8s-deploy.rst +++ b/docs/release/installation/k8s-deploy.rst @@ -20,7 +20,7 @@ If you want to deploy noha with1 controller and 1 compute, run the following com export SCENARIO=k8-nosdn-nofeature-noha.yml export VIRT_NUMBER=2 - curl https://raw.githubusercontent.com/opnfv/compass4nfv/euphrates/quickstart_k8s.sh | bash + curl https://raw.githubusercontent.com/opnfv/compass4nfv/stable/euphrates/quickstart_k8s.sh | bash Installation of K8s on Bare Metal ================================= diff --git a/docs/release/installation/vmdeploy.rst b/docs/release/installation/vmdeploy.rst index 16fb28d3..5db934be 100644 --- a/docs/release/installation/vmdeploy.rst +++ b/docs/release/installation/vmdeploy.rst @@ -17,9 +17,10 @@ Only 1 command to try virtual deployment, if you have Internet access. Just Past If you want to deploy noha with1 controller and 1 compute, run the following command .. code-block:: bash + export SCENARIO=os-nosdn-nofeature-noha.yml export VIRT_NUMBER=2 - curl https://raw.githubusercontent.com/opnfv/compass4nfv/euphrates/quickstart.sh | bash + curl https://raw.githubusercontent.com/opnfv/compass4nfv/stable/euphrates/quickstart.sh | bash Nodes Configuration (Virtual Deployment) ---------------------------------------- diff --git a/plugins/dpdk/roles/ins_dpdk/tasks/hugepages.yml b/plugins/dpdk/roles/ins_dpdk/tasks/hugepages.yml index 3f41cf03..d68fc031 100644 --- a/plugins/dpdk/roles/ins_dpdk/tasks/hugepages.yml +++ b/plugins/dpdk/roles/ins_dpdk/tasks/hugepages.yml @@ -41,5 +41,5 @@ - name: Wait for reboot local_action: module: wait_for - host={{ ansible_eth0.ipv4.address }} port=22 delay=1 timeout=300 + host={{ ansible_eth0.ipv4.address }} port=22 delay=10 timeout=1200 when: check_result.rc == 1 diff --git a/plugins/rt_kvm/roles/rt_kvm/tasks/kvm.yml b/plugins/rt_kvm/roles/rt_kvm/tasks/kvm.yml index 5d3ca7bc..289ab19d 100644 --- a/plugins/rt_kvm/roles/rt_kvm/tasks/kvm.yml +++ b/plugins/rt_kvm/roles/rt_kvm/tasks/kvm.yml @@ -37,4 +37,4 @@ - name: wait for reboot local_action: module: wait_for - host={{ ansible_eth0.ipv4.address }} port=22 delay=1 timeout=600 + host={{ ansible_eth0.ipv4.address }} port=22 delay=10 timeout=1200 diff --git a/repo/jhenv_template/ubuntu/trusty/Dockerfile b/repo/jhenv_template/ubuntu/trusty/Dockerfile index 4eeccb6c..99486bec 100644 --- a/repo/jhenv_template/ubuntu/trusty/Dockerfile +++ b/repo/jhenv_template/ubuntu/trusty/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:14.04.3 +FROM ubuntu:14.04.5 MAINTAINER Yifei Xue <xueyifei@huawei.com> ADD ./cp_env.sh /cp_env.sh @@ -11,35 +11,72 @@ RUN apt-get install -y -d mkisofs bc curl ipmitool openvswitch-switch \ git python-pip python-dev figlet \ libxslt-dev libxml2-dev libvirt-dev \ build-essential qemu-utils qemu-kvm libvirt-bin \ -virtinst libmysqld-dev \ +virtinst libmysqld-dev apparmor \ libssl-dev libffi-dev python-cffi -RUN wget -P /var/cache/apt/archives/ http://launchpadlibrarian.net/225838998/libffi6_3.1~rc1+r3.0.13-12ubuntu0.1_amd64.deb - RUN mkdir jh_deb RUN cp /var/cache/apt/archives/*.deb jh_deb/ -RUN apt-get install -y reprepro +#RUN wget -O jh_deb/gcc-5-base_5.4.0-6ubuntu1~16.04.5_amd64.deb http://launchpadlibrarian.net/336920226/gcc-5-base_5.4.0-6ubuntu1~16.04.5_amd64.deb + +#RUN wget -O jh_deb/libstdc++6_5.4.0-6ubuntu1~16.04.5_amd64.deb http://launchpadlibrarian.net/336920453/libstdc++6_5.4.0-6ubuntu1~16.04.5_amd64.deb + +#RUN wget -O jh_deb/libssl1.0.0_1.0.2g-1ubuntu4.9_amd64.deb http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.0.0_1.0.2g-1ubuntu4.9_amd64.deb + +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y linux-image-extra-4.4.0-31-generic + +RUN apt-get install -y reprepro curl \ +linux-image-extra-virtual apt-transport-https ca-certificates \ +software-properties-common + +RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - + +RUN apt-key fingerprint 0EBFCD88 + +RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ +trusty stable" + +RUN apt-get update + +RUN apt-get install -y docker-ce -d + +RUN cp /var/cache/apt/archives/*.deb jh_deb/ -RUN mkdir -p trusty-jh-ppa/conf +RUN mkdir -p jh-ppa/conf RUN echo 'Codename: trusty\n\ Components: main\n\ Architectures: amd64\n'\ ->> trusty-jh-ppa/conf/distributions +>> jh-ppa/conf/distributions -RUN reprepro -b trusty-jh-ppa includedeb trusty jh_deb/*.deb +RUN reprepro -b jh-ppa includedeb trusty jh_deb/*.deb -RUN tar -zcvf /jh-ppa-trusty.tar.gz ./trusty-jh-ppa +RUN tar -zcvf /jh-ppa.tar.gz ./jh-ppa -RUN apt-get install -y python-pip +RUN apt-get install -y python-pip ansible libffi-dev python-dev RUN mkdir jh_pip -RUN pip install --upgrade paramiko jinja2 PyYAML setuptools pycrypto pyasn1 \ -cryptography MarkupSafe idna six enum34 ipaddress cffi pycparser \ -virtualenv cheetah requests netaddr pbr oslo.config ansible -d jh_pip/ +RUN pip install virtualenv \ +cffi==1.10.0 \ +MarkupSafe==1.0 \ +pip==9.0.1 \ +cheetah==2.4.4 \ +pyyaml==3.12 \ +netaddr==0.7.19 \ +oslo.config==4.6.0 \ +cryptography==1.9 \ +ansible==2.3.1.0 \ +docker-compose==1.14.0 \ +-d jh_pip/ + +RUN pip install pyOpenSSL \ +cryptography==1.9 \ +-d jh_pip/ + +RUN pip install requests==2.18.1 \ +-d jh_pip/ RUN tar -zcvf jh_pip.tar.gz jh_pip/ diff --git a/repo/jhenv_template/ubuntu/xenial/Dockerfile b/repo/jhenv_template/ubuntu/xenial/Dockerfile index 6b9b517a..42b34c91 100644 --- a/repo/jhenv_template/ubuntu/xenial/Dockerfile +++ b/repo/jhenv_template/ubuntu/xenial/Dockerfile @@ -11,35 +11,68 @@ RUN apt-get install -y -d mkisofs bc curl ipmitool openvswitch-switch \ git python-pip python-dev figlet \ libxslt-dev libxml2-dev libvirt-dev \ build-essential qemu-utils qemu-kvm libvirt-bin \ -virtinst libmysqld-dev \ +virtinst libmysqld-dev apparmor \ libssl-dev libffi-dev python-cffi -#RUN wget -P /var/cache/apt/archives/ http://launchpadlibrarian.net/225838998/libffi6_3.1~rc1+r3.0.13-12ubuntu0.1_amd64.deb - RUN mkdir jh_deb RUN cp /var/cache/apt/archives/*.deb jh_deb/ -RUN apt-get install -y reprepro +RUN wget -O jh_deb/gcc-5-base_5.4.0-6ubuntu1~16.04.5_amd64.deb http://launchpadlibrarian.net/336920226/gcc-5-base_5.4.0-6ubuntu1~16.04.5_amd64.deb + +RUN wget -O jh_deb/libstdc++6_5.4.0-6ubuntu1~16.04.5_amd64.deb http://launchpadlibrarian.net/336920453/libstdc++6_5.4.0-6ubuntu1~16.04.5_amd64.deb + +RUN wget -O jh_deb/libssl1.0.0_1.0.2g-1ubuntu4.9_amd64.deb http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.0.0_1.0.2g-1ubuntu4.9_amd64.deb + +RUN apt-get install -y reprepro curl linux-image-extra-4.4.0-87-generic \ +linux-image-extra-virtual apt-transport-https ca-certificates \ +software-properties-common + +RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - + +RUN apt-key fingerprint 0EBFCD88 + +RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ +xenial stable" + +RUN apt-get update + +RUN apt-get install -y docker-ce -d + +RUN cp /var/cache/apt/archives/*.deb jh_deb/ -RUN mkdir -p xenial-jh-ppa/conf +RUN mkdir -p jh-ppa/conf RUN echo 'Codename: xenial\n\ Components: main\n\ Architectures: amd64\n'\ ->> xenial-jh-ppa/conf/distributions +>> jh-ppa/conf/distributions -RUN reprepro -b xenial-jh-ppa includedeb xenial jh_deb/*.deb +RUN reprepro -b jh-ppa includedeb xenial jh_deb/*.deb -RUN tar -zcvf /jh-ppa-xenial.tar.gz ./xenial-jh-ppa +RUN tar -zcvf /jh-ppa.tar.gz ./jh-ppa RUN apt-get install -y python-pip RUN mkdir jh_pip -RUN pip install --upgrade paramiko jinja2 PyYAML setuptools pycrypto pyasn1 \ -cryptography MarkupSafe idna six enum34 ipaddress cffi pycparser \ -virtualenv cheetah requests netaddr pbr oslo.config ansible -d jh_pip/ +RUN pip install virtualenv \ +cffi==1.10.0 \ +MarkupSafe==1.0 \ +pip==9.0.1 \ +cheetah==2.4.4 \ +pyyaml==3.12 \ +netaddr==0.7.19 \ +oslo.config==4.6.0 \ +ansible==2.3.1.0 \ +docker-compose==1.14.0 \ +-d jh_pip/ + +RUN pip install pyOpenSSL \ +-d jh_pip/ + +RUN pip install requests==2.18.1 \ +-d jh_pip/ RUN tar -zcvf jh_pip.tar.gz jh_pip/ |