Skip to content

Commit

Permalink
CRAYSAT-1330: Specify image name directly in CFS session when possible
Browse files Browse the repository at this point in the history
When possible, specify the desired resulting image name directly when
creating the CFS session instead of requiring a costly and failure-prone
image rename operation after the CFS configuration has been completed.

This greatly improves the reliability and performance of `sat bootprep`
for image customization.

Test Description:
Not tested yet.
  • Loading branch information
haasken-hpe committed Aug 9, 2024
1 parent 8c196e8 commit 520f8ee
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions sat/cli/bootprep/input/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,21 @@ def rename_configured_image(self):
if not configured_image_id:
raise ImageCreateError('Failed to determine ID of configured image.')

LOGGER.info(f'Renaming configured image with ID {configured_image_id} to {self.name}')
if self.cfs_client.supports_customized_image_name:
LOGGER.debug(f'No rename necessary since CFS supports naming the configured '
f'image {self.name}')
self.final_image_id = configured_image_id
return

rename_description = f'configured image with ID {configured_image_id} to {self.name}'
LOGGER.info(f'Renaming {rename_description}')

try:
self.final_image_id = self.ims_client.rename_image(configured_image_id, self.name)
except APIError as err:
raise ImageCreateError(f'Failed to rename configured image with ID {configured_image_id} '
f'from {self.created_image_name} to {self.name}: {err}')
raise ImageCreateError(f'Failed to rename {rename_description}: {err}')

LOGGER.info(f'Renamed {rename_description}')

def delete_overwritten_images(self):
"""Delete the images which were marked to be overwritten
Expand Down

0 comments on commit 520f8ee

Please sign in to comment.