Skip to content

Commit

Permalink
[lib] Skip base/VCP image fetch when not used
Browse files Browse the repository at this point in the history
If a POD only has baremetal nodes, without VCP, skip fetching Ubuntu
cloud image.

While at it, prepare for supporting Ubuntu 18.04 base image:
- workaround systemd-resolved being used instead of resolvconf;
- preinstall ifupdown to workaround [1];

[1] saltstack/salt#49078

Change-Id: If51db0bc95eff1a497e1df5d457e26a7b902aa5a
Signed-off-by: Alexandru Avadanii <[email protected]>
  • Loading branch information
alexandruavadanii committed Feb 21, 2019
1 parent 3c34bab commit e7aa69d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions mcp/config/scenario/defaults.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ x86_64:
- saltstack 500 deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7 xenial main
pkg:
install:
- ifupdown
- linux-generic-hwe-16.04
- salt-minion
control:
Expand All @@ -55,6 +56,7 @@ aarch64:
- armband_3 1201 deb [arch=arm64] http://linux.enea.com/mcp-repos/rocky/xenial rocky-armband main
pkg:
install:
- ifupdown
- python-futures
- salt-minion
control:
Expand Down
15 changes: 12 additions & 3 deletions mcp/scripts/lib_jump_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ function __mount_image {
sudo mount -t proc proc "${OPNFV_MNT_DIR}/proc"
sudo mount -t sysfs sys "${OPNFV_MNT_DIR}/sys"
sudo mount -o bind /dev "${OPNFV_MNT_DIR}/dev"
sudo mkdir -p "${OPNFV_MNT_DIR}/run/resolvconf"
sudo mkdir -p "${OPNFV_MNT_DIR}/run/resolvconf" \
"${OPNFV_MNT_DIR}/run/systemd/resolve"
sudo cp /etc/resolv.conf "${OPNFV_MNT_DIR}/run/resolvconf"
sudo cp /etc/resolv.conf "${OPNFV_MNT_DIR}/run/systemd/resolve/stub-resolv.conf"
echo "GRUB_DISABLE_OS_PROBER=true" | \
sudo tee -a "${OPNFV_MNT_DIR}/etc/default/grub"
sudo sed -i -e 's/^\(GRUB_TIMEOUT\)=.*$/\1=1/g' -e 's/^GRUB_HIDDEN.*$//g' \
Expand Down Expand Up @@ -220,9 +222,15 @@ function prepare_vms {

cleanup_uefi
__cleanup_vms
__get_base_image "${base_image}" "${image_dir}"
IFS='^' read -r -a repos_pkgs <<< "${repos_pkgs_str}"

if [ ${#vnodes[@]} -eq 0 ] && \
([[ "${repos_pkgs_str}" =~ \^{3}$ ]] || [ -z "${repos_pkgs[*]:4}" ]); then
echo "[INFO] Patched base image / VCP image not required, skipping"
return 0
fi
__get_base_image "${base_image}" "${image_dir}"

local _h=$(echo "${repos_pkgs_str}.$(md5sum "${image_dir}/${_o}")" | \
md5sum | cut -c -8)
local _tmp="${image%.*}.${_h}.img"
Expand Down Expand Up @@ -454,7 +462,8 @@ function cleanup_mounts {
sudo sed -i -e 's/^\s*set root=.*$//g' -e 's/^\s*loopback.*$//g' \
"${OPNFV_MNT_DIR}/boot/grub/grub.cfg"
fi
sudo rm -f "${OPNFV_MNT_DIR}/run/resolvconf/resolv.conf"
sudo rm -f "${OPNFV_MNT_DIR}/run/resolvconf/resolv.conf" \
"${OPNFV_MNT_DIR}/run/systemd/resolve/stub-resolv.conf"
sync
if mountpoint -q "${OPNFV_MNT_DIR}"; then
sudo umount -l "${OPNFV_MNT_DIR}" || true
Expand Down

0 comments on commit e7aa69d

Please sign in to comment.