Perform remote ostree pull during local-based ostree install

For Redfish-based subcloud installs which use a local ostree repo as the
basis of their install, we perform a secondary ostree pull from the
system controller. This will pull any ostree commits which have been
applied (via patch) since the local ostree repo was created.

Note that this also requires syncing of the patch metadata via
/opt/patching. This step is done via the install ansible playbook.

Test Plan:

PASS:
- Simulate a local ostree-based install during a sushy subcloud add in
  libvirt. Verify that a remote ostree pull retrieves any patch commits
  from the system controller. This is done by manipulating ostree repo
  contents on the system controller during the miniboot.cfg kicktart.

PASS:
- Prestage a subcloud from a non-patched system controller.
  Prestaged ostree_repo is stored on platform-backup partition.
  Patch the system controller. Add the prestaged subcloud.
  Verify that the subcloud boots and that the patched ostree commit
  is transferred to the subcloud during the miniboot.cfg kickstart.

Partial-Bug: 1998256

Signed-off-by: Kyle MacLeod <kyle.macleod@windriver.com>
Change-Id: Iee08b40dc2b930dacbbf4df08b0f727eb945d4ba
This commit is contained in:
Kyle MacLeod 2022-11-28 21:58:28 -05:00
parent 1796ed8740
commit d634510319

View File

@ -2040,7 +2040,11 @@ else
# If ostree_repo is found at the mounted backup directory,
# then set the ostree url to its location.
remote_insturl=
if [ -e ${backup_mount}/ostree_repo ]; then
# Preserve remote_insturl for use in 2nd ostree pull below
remote_insturl=${insturl}
insturl="file:///${backup_mount}/ostree_repo"
ilog "Setting insturl to ${insturl} to use prestaged ostree_repo"
fi
@ -2073,9 +2077,34 @@ else
report_failure_with_msg "ostree pull failed, rc=$rc"
fi
if [ -n "${remote_insturl}" ]; then
# In this case, we've initialized our ostree repo from local disk
# store - either via prestaging or due to installing from ISO.
# We now perform an extra ostree pull from the system controller
# in order to pick up any patch commits.
ilog "ostree_repo archive pull from ${remote_insturl} for patch commits"
# Set feed ostree remote "starlingx" to point to active controller's feed ostree repo
ilog "Replacing ostree feed remote with: ${remote_insturl} ${instbr}"
ostree --repo=${repo} remote delete ${instbr}
ostree --repo=${repo} remote add ${instbr} ${remote_insturl} ${instbr}
if grep -q noverifyssl /proc/cmdline 2>/dev/null; then
ilog "Configuring ostree for unverified SSL"
ostree config --repo=${repo} set "remote \"${instbr}\"".tls-permissive true
fi
ilog "Executing ostree pull from ${remote_insturl}:"
ilog "ostree --repo=${repo} pull --depth=-1 --mirror ${instbr}:${instbr}"
ostree --repo=${repo} pull --depth=-1 --mirror ${instbr}:${instbr}
rc=$?
if [ $rc -ne 0 ]; then
report_failure_with_msg "ostree pull failed, rc=$rc"
fi
fi
ilog "ostree log for ${repo}, branch=${instbr}:"
ostree --repo=${repo} log ${instbr}
umount ${backup_mount}
umount ${PHYS_SYSROOT}
fi
fi