diff options
21 files changed, 138 insertions, 55 deletions
diff --git a/.gitignore b/.gitignore index 20bd388d8..72e939cfd 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ deploy/autodeploy.log /docs_build/ /docs_output/ /releng/ -mcp/scripts/images/mcp_*iso -mcp/scripts/images/mcp_*qcow2 +mcp/deploy/images/ mcp/scripts/mcp.rsa* mcp/scripts/user-data.sh diff --git a/.gitmodules b/.gitmodules index 7a41f7523..d3ffb555b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,3 +3,7 @@ url = https://github.com/Mirantis/reclass-system-salt-model branch = master ignore = all +[submodule "scripts"] + path = mcp/deploy/scripts + url = https://github.com/salt-formulas/salt-formulas-scripts + branch = master diff --git a/ci/deploy.sh b/ci/deploy.sh index f51ba5fb0..b9c533323 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -32,7 +32,8 @@ $(notify "$(basename "$0"): Deploy the Fuel@OPNFV MCP stack" 3) $(notify "USAGE:" 2) $(basename "$0") -b base-uri -l lab-name -p pod-name -s deploy-scenario \\ - [-B PXE Bridge [-B Mgmt Bridge [-B Internal Bridge [-B Public Bridge]]]] + [-B PXE Bridge [-B Mgmt Bridge [-B Internal Bridge [-B Public Bridge]]]] \\ + [-S storage-dir] $(notify "OPTIONS:" 2) -b Base-uri for the stack-configuration structure @@ -41,6 +42,7 @@ $(notify "OPTIONS:" 2) -l Lab-name -p Pod-name -s Deploy-scenario short-name + -S Storage dir for VM images $(notify "DISABLED OPTIONS (not yet supported with MCP):" 3) -d (disabled) Dry-run @@ -49,7 +51,6 @@ $(notify "DISABLED OPTIONS (not yet supported with MCP):" 3) -F (disabled) Do only create a Salt master -i (disabled) iso url -L (disabled) Deployment log path and file name - -S (disabled) Storage dir for VM images -T (disabled) Timeout, in minutes, for the deploy. $(notify "Description:" 2) @@ -78,6 +79,7 @@ $(notify "Input parameters to the build script are:" 2) -p POD name as defined in the configuration directory, e.g. pod-1 -s Deployment-scenario, this points to a short deployment scenario name, which has to be defined in config directory (e.g. os-odl_l2-nofeature-noha). +-S Storage dir for VM images, default is mcp/deploy/images $(notify "Disabled input parameters (not yet supported with MCP):" 3) -d (disabled) Dry-run - Produce deploy config files, but do not execute deploy @@ -85,7 +87,6 @@ $(notify "Disabled input parameters (not yet supported with MCP):" 3) -e (disabled) Do not launch environment deployment -F (disabled) Do only create a Salt master -L (disabled) Deployment log path and name, eg. -L /home/jenkins/job.log.tar.gz --S (disabled) Storage dir for VM images, default is fuel/deploy/images -T (disabled) Timeout, in minutes, for the deploy. It defaults to using the DEPLOY_TIMEOUT environment variable when defined. -i (disabled) .iso image to be deployed (needs to be provided in a URI @@ -133,11 +134,14 @@ clean() { # SCRIPT_PATH=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")") DEPLOY_DIR=$(cd "${SCRIPT_PATH}/../mcp/scripts"; pwd) +STORAGE_DIR=$(cd "${SCRIPT_PATH}/../mcp/deploy/images"; pwd) DEPLOY_TYPE='baremetal' OPNFV_BRIDGES=('pxebr' 'mgmt' 'internal' 'public') URI_REGEXP='(file|https?|ftp)://.*' -export SSH_KEY=${SSH_KEY:-mcp.rsa} +# NOTE: When this script runs with sudo, key will land in /root/opnfv/mcp.rsa, +# unless SSH_KEY is set to point to non-root user's home (e.g. via env var). +export SSH_KEY=${SSH_KEY:-"${HOME}/opnfv/mcp.rsa"} export SALT_MASTER=${SALT_MASTER_IP:-192.168.10.100} export MAAS_IP=${MAAS_IP:-192.168.10.3} export SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ${SSH_KEY}" @@ -147,7 +151,6 @@ set +x USE_EXISTING_FUEL='' FUEL_CREATION_ONLY='' NO_DEPLOY_ENVIRONMENT='' -STORAGE_DIR='' DRY_RUN=0 if ! [ -z "${DEPLOY_TIMEOUT}" ]; then DEPLOY_TIMEOUT="-dt ${DEPLOY_TIMEOUT}" @@ -220,7 +223,6 @@ do DEPLOY_SCENARIO=${OPTARG} ;; S) - notify '' 3 "${OPTION}"; continue if [[ ${OPTARG} ]]; then STORAGE_DIR="-s ${OPTARG}" fi @@ -295,11 +297,11 @@ if [ "$(uname -i)" = "aarch64" ]; then fi # Check scenario file existence -if [ ! -f ../config/scenario/${DEPLOY_TYPE}/${DEPLOY_SCENARIO}.yaml ]; then +if [ ! -f "../config/scenario/${DEPLOY_TYPE}/${DEPLOY_SCENARIO}.yaml" ]; then notify "[WARN] ${DEPLOY_SCENARIO}.yaml not found! \ Setting simplest scenario (os-nosdn-nofeature-noha)\n" 3 DEPLOY_SCENARIO='os-nosdn-nofeature-noha' - if [ ! -f ../config/scenario/${DEPLOY_TYPE}/${DEPLOY_SCENARIO}.yaml ]; then + if [ ! -f "../config/scenario/${DEPLOY_TYPE}/${DEPLOY_SCENARIO}.yaml" ]; then notify "[ERROR] Scenario definition file is missing!\n" 1>&2 exit 1 fi @@ -322,9 +324,10 @@ done # Infra setup generate_ssh_key -prepare_vms virtual_nodes "${base_image}" +prepare_vms virtual_nodes "${base_image}" "${STORAGE_DIR}" create_networks OPNFV_BRIDGES -create_vms virtual_nodes virtual_nodes_ram virtual_nodes_vcpus OPNFV_BRIDGES +create_vms virtual_nodes virtual_nodes_ram virtual_nodes_vcpus \ + OPNFV_BRIDGES "${STORAGE_DIR}" update_mcpcontrol_network start_vms virtual_nodes check_connection diff --git a/mcp/deploy/images/.gitkeep b/mcp/deploy/images/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/mcp/deploy/images/.gitkeep diff --git a/mcp/deploy/scripts b/mcp/deploy/scripts new file mode 160000 +Subproject 4c9818260372459977be1cc4a3869b871ddba0a diff --git a/mcp/patches/Makefile b/mcp/patches/Makefile index fafa83f86..dc87832b8 100644 --- a/mcp/patches/Makefile +++ b/mcp/patches/Makefile @@ -32,7 +32,7 @@ FPATCHES = $(shell find ${F_PATCH_DIR} -name '*.patch') # To enable remote tracking, set the following var to any non-empty string. # Leaving this var empty will bind each git submodule to its saved commit. -FUEL_TRACK_REMOTES ?= yes +FUEL_TRACK_REMOTES ?= .PHONY: all all: release @@ -50,7 +50,7 @@ sub: .cachefuelinfo @if [ -n "${FUEL_TRACK_REMOTES}" ]; then \ cd ${F_GIT_ROOT} && git submodule update --init --remote 2>/dev/null; \ else \ - git submodule update --init 2>/dev/null; \ + cd ${F_GIT_ROOT} && git submodule update --init 2>/dev/null; \ fi @touch $@ @@ -87,7 +87,7 @@ patches-import: sub .cachepatched SUB_TAG=${F_OPNFV_TAG}-fuel$$SUB_FEATURE/patch; \ echo "`tput setaf 2`-- patching $$name ($$SUB_TAG)`tput sgr0`";\ git tag $$SUB_TAG-root && \ - git am -3 --whitespace=nowarn --patch-format=mbox \ + git am -3 --ignore-whitespace --patch-format=mbox \ --committer-date-is-author-date $$SUB_PATCHES && \ git tag $$SUB_TAG || exit 1; \ fi \ diff --git a/mcp/patches/scripts/0001-salt-master-setup.sh-Allow-arm64-salt-bootstrap.patch b/mcp/patches/scripts/0001-salt-master-setup.sh-Allow-arm64-salt-bootstrap.patch new file mode 100644 index 000000000..20e17c6ca --- /dev/null +++ b/mcp/patches/scripts/0001-salt-master-setup.sh-Allow-arm64-salt-bootstrap.patch @@ -0,0 +1,51 @@ +From: Alexandru Avadanii <Alexandru.Avadanii@enea.com> +Date: Fri, 1 Sep 2017 00:48:26 +0200 +Subject: [PATCH] salt-master-setup.sh: Allow arm64 salt-bootstrap + +Upstream commit [1] broke Salt bootstrap on AArch64, by +introducing an architecture condition that is too strict to allow +Debian package installation (even if we provide our own repo). + +Add "arm64" to the list of supported architectures. This needs +to be done on the fly, as the bootstrap script is fetched using +`curl` from <salt-master-setup.sh>. + +[1] https://github.com/saltstack/salt-bootstrap/commit/caa6d7d + +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com> +--- + salt-master-setup.sh | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/salt-master-setup.sh b/salt-master-setup.sh +index cba21fb..0dd3036 100755 +--- a/salt-master-setup.sh ++++ b/salt-master-setup.sh +@@ -237,12 +237,12 @@ install_salt_master_pkg() + debian) + $SUDO apt-get install -y git + which reclass || $SUDO apt install -qqq -y reclass +- curl -L https://bootstrap.saltstack.com | $SUDO sh -s -- -M ${BOOTSTRAP_SALTSTACK_OPTS} &>/dev/null || true ++ curl -L https://bootstrap.saltstack.com | sed 's@"amd64")@"amd64"|"arm64")@g' | $SUDO sh -s -- -M ${BOOTSTRAP_SALTSTACK_OPTS} &>/dev/null || true + ;; + rhel) + yum install -y git + which reclass || $SUDO yum install -y reclass +- curl -L https://bootstrap.saltstack.com | $SUDO sh -s -- -M ${BOOTSTRAP_SALTSTACK_OPTS} &>/dev/null || true ++ curl -L https://bootstrap.saltstack.com | sed 's@"amd64")@"amd64"|"arm64")@g' | $SUDO sh -s -- -M ${BOOTSTRAP_SALTSTACK_OPTS} &>/dev/null || true + ;; + esac + +@@ -310,10 +310,10 @@ install_salt_minion_pkg() + + case $PLATFORM_FAMILY in + debian) +- curl -L https://bootstrap.saltstack.com | $SUDO sh -s -- ${BOOTSTRAP_SALTSTACK_OPTS} &>/dev/null || true ++ curl -L https://bootstrap.saltstack.com | sed 's@"amd64")@"amd64"|"arm64")@g' | $SUDO sh -s -- ${BOOTSTRAP_SALTSTACK_OPTS} &>/dev/null || true + ;; + rhel) +- curl -L https://bootstrap.saltstack.com | $SUDO sh -s -- ${BOOTSTRAP_SALTSTACK_OPTS} &>/dev/null || true ++ curl -L https://bootstrap.saltstack.com | sed 's@"amd64")@"amd64"|"arm64")@g' | $SUDO sh -s -- ${BOOTSTRAP_SALTSTACK_OPTS} &>/dev/null || true + ;; + esac + diff --git a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-odl-ha/infra/kvm.yml b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-odl-ha/infra/kvm.yml index 7a151560e..f73d48e7a 100644 --- a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-odl-ha/infra/kvm.yml +++ b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-odl-ha/infra/kvm.yml @@ -32,7 +32,7 @@ parameters: ##Default production sizing openstack.control: cpu: 4 - ram: 8192 + ram: 10240 disk_profile: small net_profile: default openstack.database: @@ -42,7 +42,7 @@ parameters: net_profile: default openstack.message_queue: cpu: 4 - ram: 8192 + ram: 2048 disk_profile: small net_profile: default # openstack.telemetry: @@ -52,7 +52,7 @@ parameters: # net_profile: default openstack.proxy: cpu: 2 - ram: 4096 + ram: 2048 disk_profile: small net_profile: default # stacklight.log: diff --git a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-odl-ha/openstack/compute.yml b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-odl-ha/openstack/compute.yml index 6f0c52c72..6d2c7f39c 100644 --- a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-odl-ha/openstack/compute.yml +++ b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-odl-ha/openstack/compute.yml @@ -2,11 +2,14 @@ classes: - system.linux.system.repo.mcp.openstack - system.linux.system.repo.mcp.extra - system.linux.system.repo.saltstack.xenial +- system.linux.storage.loopback - system.nova.compute.cluster - system.nova.compute.nfv.hugepages - system.nova.compute.nfv.cpu_pinning - system.neutron.gateway.opendaylight.single - system.neutron.gateway.cluster +- system.cinder.volume.single +- system.cinder.volume.backend.lvm - system.ceilometer.agent.cluster - cluster.baremetal-mcp-ocata-odl-ha.infra parameters: @@ -27,6 +30,7 @@ parameters: interface_mtu: 1500 keepalived_vip_interface: br-ctl keepalived_vip_virtual_router_id: 69 + loopback_device_size: 20 neutron_agents: - neutron-dhcp-agent - neutron-metadata-agent diff --git a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-odl-ha/openstack/control.yml b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-odl-ha/openstack/control.yml index e8666d6c1..b46e23da7 100644 --- a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-odl-ha/openstack/control.yml +++ b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-odl-ha/openstack/control.yml @@ -10,7 +10,7 @@ classes: - system.neutron.control.opendaylight.cluster - system.nova.control.cluster - system.cinder.control.cluster -- system.cinder.volume.single +- system.cinder.control.backend.lvm - system.heat.server.cluster - system.designate.server.cluster - system.designate.server.backend.bind diff --git a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-dpdk-ha/infra/kvm.yml b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-dpdk-ha/infra/kvm.yml index 973686488..a4945e595 100644 --- a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-dpdk-ha/infra/kvm.yml +++ b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-dpdk-ha/infra/kvm.yml @@ -32,7 +32,7 @@ parameters: ##Default production sizing openstack.control: cpu: 4 - ram: 8192 + ram: 10240 disk_profile: small net_profile: default openstack.database: @@ -42,7 +42,7 @@ parameters: net_profile: default openstack.message_queue: cpu: 4 - ram: 8192 + ram: 2048 disk_profile: small net_profile: default # openstack.telemetry: @@ -52,7 +52,7 @@ parameters: # net_profile: default openstack.proxy: cpu: 2 - ram: 4096 + ram: 2048 disk_profile: small net_profile: default # stacklight.log: diff --git a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-dpdk-ha/openstack/compute.yml b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-dpdk-ha/openstack/compute.yml index 6ea3827b9..a534e225f 100644 --- a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-dpdk-ha/openstack/compute.yml +++ b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-dpdk-ha/openstack/compute.yml @@ -2,11 +2,14 @@ classes: - system.linux.system.repo.mcp.openstack - system.linux.system.repo.mcp.extra - system.linux.system.repo.saltstack.xenial +- system.linux.storage.loopback - system.nova.compute.cluster - system.nova.compute.nfv.hugepages - system.nova.compute.nfv.cpu_pinning - system.neutron.compute.nfv.dpdk - system.neutron.gateway.cluster +- system.cinder.volume.single +- system.cinder.volume.backend.lvm - system.ceilometer.agent.cluster - cluster.baremetal-mcp-ocata-ovs-dpdk-ha.infra parameters: @@ -26,6 +29,7 @@ parameters: interface_mtu: 1500 keepalived_vip_interface: br-ctl keepalived_vip_virtual_router_id: 69 + loopback_device_size: 20 neutron: gateway: dpdk: True diff --git a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-dpdk-ha/openstack/control.yml b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-dpdk-ha/openstack/control.yml index e7a3b85c4..7e8ea312f 100644 --- a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-dpdk-ha/openstack/control.yml +++ b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-dpdk-ha/openstack/control.yml @@ -10,7 +10,7 @@ classes: - system.neutron.control.openvswitch.cluster - system.nova.control.cluster - system.cinder.control.cluster -- system.cinder.volume.single +- system.cinder.control.backend.lvm - system.heat.server.cluster - system.designate.server.cluster - system.designate.server.backend.bind diff --git a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-dpdk-ha/openstack/init.yml b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-dpdk-ha/openstack/init.yml index bfe0d8ca5..016fcb8f5 100644 --- a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-dpdk-ha/openstack/init.yml +++ b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-dpdk-ha/openstack/init.yml @@ -95,15 +95,15 @@ parameters: rabbitmq_admin_password: opnfv_secret rabbitmq_openstack_password: opnfv_secret neutron_tenant_vlan_range: "1000:1030" - nova_cpu_pinning: "1,2,3,4,5,7,8,9,10,11" + nova_cpu_pinning: "5-7,13-15" compute_hugepages_size: 1G - compute_hugepages_count: 16 + compute_hugepages_count: 12 compute_hugepages_mount: /mnt/hugepages_1G - compute_kernel_isolcpu: ${_param:nova_cpu_pinning} + compute_kernel_isolcpu: 2,5,6,7,9,10,13,14,15 compute_dpdk_driver: uio - compute_ovs_pmd_cpu_mask: "0x6" - compute_ovs_dpdk_socket_mem: "1024" - compute_ovs_dpdk_lcore_mask: "0x400" + compute_ovs_pmd_cpu_mask: "0x2060" + compute_ovs_dpdk_socket_mem: "1024,1024" + compute_ovs_dpdk_lcore_mask: "0x1000" compute_ovs_memory_channels: "2" glance_version: ${_param:openstack_version} glance_service_host: ${_param:openstack_control_address} diff --git a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/infra/kvm.yml b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/infra/kvm.yml index 44301a019..d919fe707 100644 --- a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/infra/kvm.yml +++ b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/infra/kvm.yml @@ -32,7 +32,7 @@ parameters: ##Default production sizing openstack.control: cpu: 4 - ram: 8192 + ram: 10240 disk_profile: small net_profile: default openstack.database: @@ -42,7 +42,7 @@ parameters: net_profile: default openstack.message_queue: cpu: 4 - ram: 8192 + ram: 2048 disk_profile: small net_profile: default openstack.telemetry: @@ -52,7 +52,7 @@ parameters: net_profile: default openstack.proxy: cpu: 2 - ram: 4096 + ram: 2048 disk_profile: small net_profile: default # stacklight.log: diff --git a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/openstack/compute.yml b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/openstack/compute.yml index 070ab7865..e11e35e54 100644 --- a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/openstack/compute.yml +++ b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/openstack/compute.yml @@ -2,10 +2,13 @@ classes: - system.linux.system.repo.mcp.openstack - system.linux.system.repo.mcp.extra - system.linux.system.repo.saltstack.xenial +- system.linux.storage.loopback - system.nova.compute.cluster - system.nova.compute.nfv.hugepages - system.nova.compute.nfv.cpu_pinning - system.neutron.gateway.cluster +- system.cinder.volume.single +- system.cinder.volume.backend.lvm - system.ceilometer.agent.cluster - cluster.baremetal-mcp-ocata-ovs-ha.infra parameters: @@ -26,6 +29,7 @@ parameters: interface_mtu: 1500 keepalived_vip_interface: br-ctl keepalived_vip_virtual_router_id: 69 + loopback_device_size: 20 linux: network: bridge: openvswitch diff --git a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/openstack/control.yml b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/openstack/control.yml index a5913dd52..1711ab0fe 100644 --- a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/openstack/control.yml +++ b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/openstack/control.yml @@ -10,7 +10,7 @@ classes: - system.neutron.control.openvswitch.cluster - system.nova.control.cluster - system.cinder.control.cluster -- system.cinder.volume.single +- system.cinder.control.backend.lvm - system.heat.server.cluster - system.designate.server.cluster - system.designate.server.backend.bind diff --git a/mcp/reclass/classes/system b/mcp/reclass/classes/system -Subproject 02926007d5db81e0358f63d7ae3c9c28eb17dd8 +Subproject 4b335b98fae73d59af0eb4bf81e33369d55a94c diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh index 3f740589d..1812663d3 100644 --- a/mcp/scripts/lib.sh +++ b/mcp/scripts/lib.sh @@ -4,25 +4,28 @@ # generate_ssh_key() { + # shellcheck disable=SC2155 + local mcp_ssh_key=$(basename "${SSH_KEY}") local user=${USER} if [ -n "${SUDO_USER}" ] && [ "${SUDO_USER}" != 'root' ]; then user=${SUDO_USER} fi - if [ -f "/tmp/${SSH_KEY}" ]; then - cp "/tmp/${SSH_KEY}" . - ssh-keygen -f "${SSH_KEY}" -y > "${SSH_KEY}.pub" + if [ -f "${SSH_KEY}" ]; then + cp "${SSH_KEY}" . + ssh-keygen -f "${mcp_ssh_key}" -y > "${mcp_ssh_key}.pub" fi - [ -f "${SSH_KEY}" ] || ssh-keygen -f "${SSH_KEY}" -N '' - install -o "${user}" -m 0600 "${SSH_KEY}" /tmp/ + [ -f "${mcp_ssh_key}" ] || ssh-keygen -f "${mcp_ssh_key}" -N '' + install -D -o "${user}" -m 0600 "${mcp_ssh_key}" "${SSH_KEY}" } get_base_image() { local base_image=$1 + local image_dir=$2 - mkdir -p images - wget -P /tmp -N "${base_image}" + mkdir -p "${image_dir}" + wget -P "${image_dir}" -N "${base_image}" } cleanup_vms() { @@ -38,17 +41,19 @@ cleanup_vms() { prepare_vms() { local -n vnodes=$1 local base_image=$2 + local image_dir=$3 cleanup_vms - get_base_image "${base_image}" - envsubst < user-data.template > user-data.sh + get_base_image "${base_image}" "${image_dir}" + envsubst '${SALT_MASTER},${CLUSTER_DOMAIN}' < \ + user-data.template > user-data.sh for node in "${vnodes[@]}"; do # create/prepare images - ./create-config-drive.sh -k "${SSH_KEY}.pub" -u user-data.sh \ - -h "${node}" "images/mcp_${node}.iso" - cp "/tmp/${base_image/*\/}" "images/mcp_${node}.qcow2" - qemu-img resize "images/mcp_${node}.qcow2" 100G + ./create-config-drive.sh -k "$(basename "${SSH_KEY}").pub" -u user-data.sh \ + -h "${node}" "${image_dir}/mcp_${node}.iso" + cp "${image_dir}/${base_image/*\/}" "${image_dir}/mcp_${node}.qcow2" + qemu-img resize "${image_dir}/mcp_${node}.qcow2" 100G done } @@ -76,6 +81,7 @@ create_vms() { local -n vnodes_ram=$2 local -n vnodes_vcpus=$3 local -n vnode_networks=$4 + local image_dir=$5 # AArch64: prepare arch specific arguments local virt_extra_args="" @@ -105,10 +111,10 @@ create_vms() { virt-install --name "${node}" \ --ram "${vnodes_ram[$node]}" --vcpus "${vnodes_vcpus[$node]}" \ --cpu host-passthrough --accelerate ${net_args} \ - --disk path="$(pwd)/images/mcp_${node}.qcow2",format=qcow2,bus=virtio,cache=none,io=native \ + --disk path="${image_dir}/mcp_${node}.qcow2",format=qcow2,bus=virtio,cache=none,io=native \ --os-type linux --os-variant none \ --boot hd --vnc --console pty --autostart --noreboot \ - --disk path="$(pwd)/images/mcp_${node}.iso",device=cdrom \ + --disk path="${image_dir}/mcp_${node}.iso",device=cdrom \ --noautoconsole \ ${virt_extra_args} done @@ -116,7 +122,9 @@ create_vms() { update_mcpcontrol_network() { # set static ip address for salt master node, MaaS node + # shellcheck disable=SC2155 local cmac=$(virsh domiflist cfg01 2>&1| awk '/mcpcontrol/ {print $5; exit}') + # shellcheck disable=SC2155 local amac=$(virsh domiflist mas01 2>&1| awk '/mcpcontrol/ {print $5; exit}') virsh net-update "mcpcontrol" add ip-dhcp-host \ "<host mac='${cmac}' name='cfg01' ip='${SALT_MASTER}'/>" --live diff --git a/mcp/scripts/salt.sh b/mcp/scripts/salt.sh index 9f88f1c77..4fa54ab1c 100755 --- a/mcp/scripts/salt.sh +++ b/mcp/scripts/salt.sh @@ -17,7 +17,7 @@ OPNFV_TMP_DIR="/home/${SALT_MASTER_USER}/fuel" OPNFV_FUEL_DIR="/root/fuel" # patch reclass-system-salt-model locally before copying it over -make -C "${F_GIT_ROOT}/mcp/patches" patches-import +make -C "${F_GIT_ROOT}/mcp/patches" deepclean patches-import # push to cfg01 current git repo first (including submodules), at ~ubuntu/fuel # later we move it to ~root/fuel and delete the temporary clone @@ -34,19 +34,21 @@ ssh ${SSH_OPTS} "${SSH_SALT}" bash -s << SALT_INSTALL_END while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo -n '.'; sleep 1; done echo ' done' - DEBIAN_FRONTEND=noninteractive apt-get install -y git curl - - git clone --depth=1 https://github.com/salt-formulas/salt-formulas-scripts /srv/salt/scripts + mkdir -p /srv/salt /usr/share/salt-formulas/reclass mv ${OPNFV_TMP_DIR} ${OPNFV_FUEL_DIR} && chown -R root.root ${OPNFV_FUEL_DIR} ln -s ${OPNFV_FUEL_DIR}/mcp/reclass /srv/salt/reclass + ln -s ${OPNFV_FUEL_DIR}/mcp/deploy/scripts /srv/salt/scripts - mkdir -p /usr/share/salt-formulas/reclass cp -r ${OPNFV_FUEL_DIR}/mcp/metadata/service /usr/share/salt-formulas/reclass cd /srv/salt/reclass/classes/service && \ ln -s /usr/share/salt-formulas/reclass/service/opendaylight cd ${OPNFV_FUEL_DIR}/mcp/patches && ./patch.sh patches.list reclass cd /srv/salt/scripts + if [ "\$(uname -i)" = "aarch64" ]; then + # NOTE(armband): On AArch64, skip creating apt source list definitions (-r) + export BOOTSTRAP_SALTSTACK_OPTS=" -r -dX stable 2016.11 " + fi MASTER_HOSTNAME=cfg01.${CLUSTER_DOMAIN} DISTRIB_REVISION=nightly ./salt-master-init.sh salt-key -Ay diff --git a/mcp/scripts/user-data.template b/mcp/scripts/user-data.template index cc97a6027..292c37c0c 100644 --- a/mcp/scripts/user-data.template +++ b/mcp/scripts/user-data.template @@ -1,6 +1,10 @@ #!/bin/bash -wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.11/SALTSTACK-GPG-KEY.pub | sudo apt-key add - -echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.11 xenial main" > /etc/apt/sources.list.d/salt.list +SALT_REPO=repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.11 +if [ "$(uname -i)" = "aarch64" ]; then + SALT_REPO=linux.enea.com/saltstack/apt/ubuntu/16.04/arm64/2016.11 +fi +wget -O - "https://${SALT_REPO}/SALTSTACK-GPG-KEY.pub" | sudo apt-key add - +echo "deb http://${SALT_REPO} xenial main" > /etc/apt/sources.list.d/salt.list apt update apt-get install -y salt-minion rm /etc/salt/minion_id |