1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2017 Enea AB and others.
4 : All rights reserved. This program and the accompanying materials
5 : are made available under the terms of the Apache License, Version 2.0
6 : which accompanies this distribution, and is available at
7 : http://www.apache.org/licenses/LICENSE-2.0
8 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
9 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
10 Date: Mon, 27 Nov 2017 01:29:32 +0100
11 Subject: [PATCH] AArch64: base image: pre-install salt-minion
13 While at it, rename apt repo in foundation node user-data template
14 from "salt" to "saltstack", to align with reclass model naming.
16 Change-Id: I5b216492349ae187b568884b1ab4046c52b1c6b2
17 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
20 mcp/config/scenario/defaults-aarch64.yaml | 2 ++
21 mcp/scripts/lib.sh | 8 +++++++-
22 mcp/scripts/user-data.template | 2 +-
23 4 files changed, 12 insertions(+), 4 deletions(-)
25 diff --git a/ci/deploy.sh b/ci/deploy.sh
26 index b88d2ba..8e1c3a5 100755
29 @@ -272,10 +272,10 @@ pushd "${DEPLOY_DIR}" > /dev/null
30 # Install required packages
31 [ -n "$(command -v apt-get)" ] && sudo apt-get install -y \
32 git make rsync mkisofs curl virtinst cpu-checker qemu-kvm uuid-runtime \
34 + libvirt-bin cloud-guest-utils e2fsprogs
35 [ -n "$(command -v yum)" ] && sudo yum install -y --skip-broken \
36 git make rsync genisoimage curl virt-install qemu-kvm util-linux \
38 + libvirt cloud-utils-growpart e2fsprogs
40 # For baremetal, python is indirectly required for PDF parsing
41 if [ "${DEPLOY_TYPE}" = 'baremetal' ]; then
42 diff --git a/mcp/config/scenario/defaults-aarch64.yaml b/mcp/config/scenario/defaults-aarch64.yaml
43 index d989819..edcd8d9 100644
44 --- a/mcp/config/scenario/defaults-aarch64.yaml
45 +++ b/mcp/config/scenario/defaults-aarch64.yaml
46 @@ -17,6 +17,7 @@ virtual:
47 - https://linux.enea.com/mcp-repos/ocata/xenial/archive-mcpocata.key
49 # <repo name> <repo prio> deb [arch=<arch>] <repo url> <repo dist> <repo comp>
50 + - saltstack 500 deb [arch=arm64] http://linux.enea.com/saltstack/apt/ubuntu/16.04/arm64/2016.11 xenial main
51 - armband_openstack 1100 deb [arch=arm64] http://linux.enea.com/mcp-repos/ocata/xenial ocata main
52 - armband_mk_openstack 1100 deb [arch=arm64] http://linux.enea.com/apt-mk/xenial nightly ocata
53 # NOTE(armband): Empty repo, keep commented out as reference
54 @@ -25,6 +26,7 @@ virtual:
56 - linux-image-generic-hwe-16.04-edge
57 - linux-headers-generic-hwe-16.04-edge
62 diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh
63 index 654f45e..8dd92e1 100644
64 --- a/mcp/scripts/lib.sh
65 +++ b/mcp/scripts/lib.sh
66 @@ -51,11 +51,15 @@ function mount_image {
67 OPNFV_LOOP_DEV=$(losetup -f)
68 export OPNFV_MNT_DIR OPNFV_LOOP_DEV
69 [ -n "${OPNFV_NBD_DEV}" ] && [ -n "${OPNFV_LOOP_DEV}" ] || exit 1
70 + qemu-img resize "${image_dir}/${image}" 3G
71 sudo qemu-nbd --connect="${OPNFV_NBD_DEV}" --aio=native --cache=none \
72 "${image_dir}/${image}"
73 sleep 5 # /dev/nbdNp1 takes some time to come up
74 - # grub-update does not like /dev/nbd*, so use a loop device to work around it
75 # Hardcode partition index to 1, unlikely to change for Ubuntu UCA image
76 + if sudo growpart "${OPNFV_NBD_DEV}" 1; then
77 + sudo e2fsck -yf "${OPNFV_NBD_DEV}p1" && sudo resize2fs "${OPNFV_NBD_DEV}p1"
79 + # grub-update does not like /dev/nbd*, so use a loop device to work around it
80 sudo losetup "${OPNFV_LOOP_DEV}" "${OPNFV_NBD_DEV}p1"
81 mkdir -p "${OPNFV_MNT_DIR}"
82 sudo mount "${OPNFV_LOOP_DEV}" "${OPNFV_MNT_DIR}"
83 @@ -66,6 +70,8 @@ function mount_image {
84 sudo cp /etc/resolv.conf "${OPNFV_MNT_DIR}/run/resolvconf"
85 echo "GRUB_DISABLE_OS_PROBER=true" | \
86 sudo tee -a "${OPNFV_MNT_DIR}/etc/default/grub"
87 + sudo sed -i -e 's/^\(GRUB_TIMEOUT\)=.*$/\1=1/g' -e 's/^GRUB_HIDDEN.*$//g' \
88 + "${OPNFV_MNT_DIR}/etc/default/grub"
91 function apt_repos_pkgs_image {
92 diff --git a/mcp/scripts/user-data.template b/mcp/scripts/user-data.template
93 index 6752039..b654477 100644
94 --- a/mcp/scripts/user-data.template
95 +++ b/mcp/scripts/user-data.template
96 @@ -11,7 +11,7 @@ if [ "$(uname -i)" = "aarch64" ]; then
97 SALT_REPO=linux.enea.com/saltstack/apt/ubuntu/16.04/arm64/2016.11
99 wget -O - "https://${SALT_REPO}/SALTSTACK-GPG-KEY.pub" | sudo apt-key add -
100 -echo "deb https://${SALT_REPO} xenial main" > /etc/apt/sources.list.d/salt.list
101 +echo "deb https://${SALT_REPO} xenial main" > /etc/apt/sources.list.d/saltstack.list
103 apt-get install -y salt-minion
104 rm /etc/salt/minion_id