This commit integrates the previously created lvm snapshot
code in [1], [2] and [3] with the upgrade/rollback process:
[1] https://review.opendev.org/c/starlingx/update/+/946371
[2] https://review.opendev.org/c/starlingx/update/+/946716
[3] https://review.opendev.org/c/starlingx/update/+/946835
NOTE: the feature is supported ONLY for AIO-SX for now
NOTE: the 'Depends-on' commit ensures that deploy precheck
enforces the feature requirements are satisfied before
allowing it to be enabled on deploy start
TODO: the snapshot removal after upgrade is successful will be
implemented after the action 'delete' is included for
the upgrade scripts; currently this is still in progress
- New functions are added to the lvm_snapshot module, to
create and restore lvm snapshots safely, i.e.:
- For snapshot creation, if it fails to create any snapshot
then it will delete the others and proceed with the feature
disabled
- For snapshot restoration, it validates if all expected
snapshots exists, if they aren't expired (not older than
a time limit) and if they are valid (not 100% full) and
only after all these conditions are satisfied the snapshots
are restored. If any of them fail, rollback proceeds with
the feature disabled
- Now, software controller effectively uses the --snapshot option
to trigger snapshot creation during deploy start step
- lvm_snapshot.py module can be called as a standalone executable
to allow it be called from deploy start script, reducing the
dependenvy of the feature on the from-release code
- software controller restores the lvm snapshots during
activate-rollback, so that the workflow is not changed (which
is better from the point of view of orchestration)
- If lvm snapshot restoration fails, it will fall back to
the standard activate-rollback procedure (upgrade scripts
with action 'activate-rollback')
- Snapshots are now an object, and can override the default
behavior of create/restore; one case was introduced to var-lv,
to update software.json so that after host reboots the deployment
data is correct
This commit also improve some log messages and remove deprecated code.
Test Plan
PASS: AIO-SX stx-10 -> stx-11 e2e upgrade with snapshot enabled
PASS: AIO-SX stx-10 -> stx-11 e2e rollback with snapshot enabled
PASS: AIO-SX stx-10 -> stx-11 e2e upgrade with snapshot disabled
PASS: AIO-SX stx-10 -> stx-11 e2e rollback with snapshot disabled
PASS: AIO-DX stx-10 -> stx-11, attempt to enable snapshot and
verify deploy precheck blocks it
PASS: AIO-DX stx-10 -> stx-11 e2e upgrade with snapshot disabled
Depends-on: https://review.opendev.org/c/starlingx/update/+/946672
Story: 2011357
Task: 51981
Change-Id: I0759c424f9590947b349263a181a16e9d277741b
Signed-off-by: Heitor Matsui <heitorvieira.matsui@windriver.com>