Introduce validate_release_version_supported, a dcmanager util
method to check whether a release version is supported by the
current active version. This is necessary as many dcmanager
operations/commands now allow the user to specify a release
version (e.g., subcloud add, deploy, restore). That is, this
check is intended to validate the release version parameter
provided to the various operations that support it.
This implementation is based on sysinv-conductor's
import_load check, which parses the upgrades metadata.xml
file to check for the supported versions.
This validation check will be iteratively added to all the
API endpoints that consume a release parameter. Currently,
it is only used for the subcloud deploy upload endpoint.
Test Plan:
Test the release parameter using deploy upload -
"subcloud-deploy upload ... --release <release>":
1. PASS: Verify that the current active version is
accepted as a valid parameter.
2. PASS: Verify that all the supported upgrade versions
in /usr/rootdirs/opt/upgrades/metadata.xml are accepted
as a valid release parameter.
3. PASS: Verify that any upgrade version that's not included
in metadata.xml is rejected with an error
"<release> is not a supported release version". The only
exception to this is the current active version, it must
always be valid.
4. PASS: Delete all the "supported_upgrades" elements in
metadata.xml and verify the error
"Unable to validate the release version" is printed.
5. PASS: Delete metadata.xml and verify that
"Unable to validate the release version" error is printed.
6. PASS: Verify that the current active version is valid
regardless of metadata.xml file and its contents.
7. PASS: Exclude the release parameter and verify that the
deploy upload is successful (with an upload completed
for the current active version).
Closes-Bug: 2031557
Change-Id: Id8b5670b8cfcdf86d36bbf9180abe064c4279d1a
Signed-off-by: Salman Rana <salman.rana@windriver.com>