Enable subcloud install from image in dc vault
The subcloud install is updated to allow reference to the
vault load iso.
When the image is not specified in the install values, or the
image specified matches the vault load location, the image input iso
is updated to reference the System Controller load vault.
In such case, the bootimage iso is no longer duplicated, thus reduces
the storage requirements.
The -a' or '--active' flag, enables the upload of an active image:`
system --os-region-name SystemController \
load-import -a <bootimage.iso> <bootimage.sig>
Tests Performed:
Import active image into dc vault
Import active image into dc vault with new image
Subcloud Install from image in dc vault
Change-Id: I9faab0a5c9c7be7861ce2b4bc785cd44b9d4771a
Story: 2007267
Task: 40695
Depends-On: https://review.opendev.org/#/c/746972
Signed-off-by: John Kung <john.kung@windriver.com>
This commit is contained in:
@@ -368,7 +368,17 @@ class SubcloudsController(object):
|
||||
|
||||
@staticmethod
|
||||
def _validate_install_values(payload):
|
||||
"""Validate install values if 'install_values' is present in payload.
|
||||
|
||||
The image in payload install values is optional, and if not provided,
|
||||
the image is set to the available active load image.
|
||||
|
||||
:return boolean: True if bmc install requested, otherwise False
|
||||
"""
|
||||
install_values = payload.get('install_values')
|
||||
if not install_values:
|
||||
return False
|
||||
|
||||
bmc_password = payload.get('bmc_password')
|
||||
if not bmc_password:
|
||||
pecan.abort(400, _('subcloud bmc_password required'))
|
||||
@@ -383,8 +393,20 @@ class SubcloudsController(object):
|
||||
|
||||
for k in install_consts.MANDATORY_INSTALL_VALUES:
|
||||
if k not in install_values:
|
||||
pecan.abort(400, _('Mandatory install value %s not present')
|
||||
% k)
|
||||
if k == 'image':
|
||||
# check for the image at load vault load location
|
||||
matching_iso, matching_sig = utils.get_vault_load_files(tsc.SW_VERSION)
|
||||
if not os.path.isfile(matching_iso):
|
||||
msg = ('Failed to get active load image. Provide '
|
||||
'active load image via '
|
||||
'"system --os-region-name SystemController '
|
||||
'load-import --active"')
|
||||
pecan.abort(400, _(msg))
|
||||
|
||||
LOG.info("image was not in install_values: will reference %s" %
|
||||
matching_iso)
|
||||
else:
|
||||
pecan.abort(400, _('Mandatory install value %s not present') % k)
|
||||
|
||||
if (install_values['install_type'] not in
|
||||
range(install_consts.SUPPORTED_INSTALL_TYPES)):
|
||||
@@ -450,6 +472,8 @@ class SubcloudsController(object):
|
||||
LOG.exception(e)
|
||||
pecan.abort(400, _("rd.net.timeout.ipv6dad invalid: %s") % e)
|
||||
|
||||
return True
|
||||
|
||||
def _get_subcloud_users(self):
|
||||
"""Get the subcloud users and passwords from keyring"""
|
||||
DEFAULT_SERVICE_PROJECT_NAME = 'services'
|
||||
@@ -763,8 +787,7 @@ class SubcloudsController(object):
|
||||
systemcontroller_gateway_ip,
|
||||
group_id)
|
||||
|
||||
if 'install_values' in payload:
|
||||
self._validate_install_values(payload)
|
||||
self._validate_install_values(payload)
|
||||
|
||||
# Upload the deploy config files if it is included in the request
|
||||
# It has a dependency on the subcloud name, and it is called after
|
||||
@@ -850,8 +873,7 @@ class SubcloudsController(object):
|
||||
pecan.abort(400, _('Invalid group-id'))
|
||||
|
||||
data_install = None
|
||||
if INSTALL_VALUES in payload:
|
||||
self._validate_install_values(payload)
|
||||
if self._validate_install_values(payload):
|
||||
data_install = json.dumps(payload[INSTALL_VALUES])
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user